Index: tmp/org.txm.core/buildTST.properties
===================================================================
--- tmp/org.txm.core/buildTST.properties	(revision 0)
+++ tmp/org.txm.core/buildTST.properties	(revision 258)
@@ -0,0 +1,25 @@
+bin.includes = META-INF/,\
+               .,\
+               lib/
+jars.compile.order = .,\
+                     bin/
+source.. = src/groovy/,\
+           src/java/
+jars.extra.classpath = lib/ant-1.7.1.jar,\
+                       lib/antlr-2.7.7.jar,\
+                       lib/asm-analysis-2.2.3.jar,\
+                       lib/asm-tree-2.2.3.jar,\
+                       lib/colt-1.2.0.jar,\
+                       lib/commons-cli-1.2.jar,\
+                       lib/commons-io-1.4.jar,\
+                       lib/commons-lang-2.4.jar,\
+                       lib/concurrent-1.3.4.jar,\
+                       lib/hsqldb.jar,\
+                       lib/jline-0.9.94.jar,\
+                       lib/junit-4.5.jar,\
+                       lib/log4j-1.2.12.jar,\
+                       lib/REngine.jar,\
+                       lib/RserveEngine.jar,\
+                       lib/saxon-xom-9.2.jar
+source.. = src/java/
+output.. = bin/

Property changes on: tmp/org.txm.core/buildTST.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/buildJavadoc.xml
===================================================================
--- tmp/org.txm.core/buildJavadoc.xml	(revision 0)
+++ tmp/org.txm.core/buildJavadoc.xml	(revision 258)
@@ -0,0 +1,36 @@
+<project name="Toolbox" default="doc">
+	
+	<path id="lib.dir">
+		<!-- fileset : TO BE DEFINED MANUALLY -->
+		<fileset dir="/home/mdecorde/LIBRAIRIES/groovy-2.2.1/embeddable">
+			<include name="*.jar" />
+		</fileset>
+	</path>
+
+	<tstamp>
+		<format property="TODAY" pattern="yyyy-MM-dd HH:mm" />
+	</tstamp>
+
+	<taskdef name="groovydoc" classname="org.codehaus.groovy.ant.Groovydoc" classpathref="lib.dir" />
+	
+	<target name="doc">
+		<mkdir dir="javadoc/" />
+		<!-- packagenames : TO BE UPDATED MANUALLY using TBX exported packages list. BECAUSE org.txm.utils.tostring.ToString make groovydoc raise an exception ... -->
+		<groovydoc 
+			destdir="javadoc/" 
+			sourcepath="src/java:src/groovy" 
+			packagenames="filters.BuildXmlLiturgie,filters.Concatenator,filters.CutHeader,filters.EliminateWhiteSpaces,filters.FusionHeader,filters.FusionXmlHeaderBody,filters.MinimalFilter,filters.OneOpenTagPerLine,filters.OneTagPerLine,filters.ProcessEnclitics,filters.ProcessQuotes,filters.RegexFilter,filters.ReunitBrokenTags,filters.ReunitBrokenWords,filters.TagSentences,filters.Tokeniser,filters.WordInternalElement,filters.eliminateNAttributes,org.txm,org.txm.annotation,org.txm.doc,org.txm.export,org.txm.export.conll2009,org.txm.export.ts,org.txm.functions,org.txm.functions.ca,org.txm.functions.classification,org.txm.functions.concordances,org.txm.functions.concordances.comparators,org.txm.functions.contrasts,org.txm.functions.cooccurrences,org.txm.functions.cooccurrences.comparators,org.txm.functions.coocmatrix,org.txm.functions.diagnostic,org.txm.functions.internal,org.txm.functions.intertextualdistance,org.txm.functions.mesures,org.txm.functions.parabrowser,org.txm.functions.parallelcontexts,org.txm.functions.preview,org.txm.functions.queryindex,org.txm.functions.referencer,org.txm.functions.progression,org.txm.functions.selection,org.txm.functions.specificities,org.txm.functions.summary,org.txm.functions.index,org.txm.importer,org.txm.importer.RGAQCJ,org.txm.importer.alceste,org.txm.importer.bfm,org.txm.importer.bvh,org.txm.importer.corptef,org.txm.importer.csv,org.txm.importer.cwb,org.txm.importer.discours,org.txm.importer.doc,org.txm.importer.europress,org.txm.importer.factiva,org.txm.importer.filters,org.txm.importer.fleurs,org.txm.importer.frantext,org.txm.importer.graal,org.txm.importer.hyperbase,org.txm.importer.hyperprince,org.txm.importer.lasla,org.txm.importer.limsi,org.txm.importer.perrault,org.txm.importer.quick,org.txm.importer.scripting,org.txm.importer.tigersearch,org.txm.importer.tmx,org.txm.importer.transana,org.txm.importer.transcriber,org.txm.importer.wtc,org.txm.importer.xml,org.txm.importer.xmltxm,org.txm.importer.xmltxmpara,org.txm.metadatas,org.txm.objects,org.txm.renderer,org.txm.scripts,org.txm.scripts.clix,org.txm.scripts.i18n,org.txm.scripts.teitxm,org.txm.scripts.tigersearch,org.txm.searchengine.cqp,org.txm.searchengine.cqp.clientExceptions,org.txm.searchengine.cqp.corpus,org.txm.searchengine.cqp.corpus.query,org.txm.searchengine.cqp.serverException,org.txm.searchengine.ts,org.txm.setup,org.txm.sql,org.txm.stat,org.txm.stat.data,org.txm.stat.engine.r,org.txm.stat.engine.r.data,org.txm.stat.engine.r.function,org.txm.stat.engine.r.rcolt,org.txm.stat.utils,org.txm.svn,org.txm.sw,org.txm.test,org.txm.tests,org.txm.tokenizer,org.txm.toolbox,org.txm.utils,org.txm.utils.i18n,org.txm.utils.logger,org.txm.utils.processbuilder,org.txm.utils.saxon,org.txm.utils.treetagger" 
+			use="true"  
+			windowtitle="TXM Groovy and Java documentation ${TODAY}" 
+			doctitle="TXM Groovy and Java documentation ${TODAY}" 
+			header="TXM Groovy and Java documentation ${TODAY}" 
+			footer="TXM Groovy and Java documentation ${TODAY}" 
+			private="false">
+			
+			<link packages="java.,org.xml.,javax.,org.xml." href="http://java.sun.com/j2se/1.5.0/docs/api" />
+			<link packages="org.apache.ant.,org.apache.tools.ant." href="http://www.dpml.net/api/ant/1.7.0" />
+			<link packages="org.junit.,junit.framework." href="http://junit.sourceforge.net/junit3.8.1/javadoc/" />
+			<link packages="groovy.,org.codehaus.groovy." href="http://groovy.codehaus.org/api/" />
+		</groovydoc>
+	</target>
+</project>

Property changes on: tmp/org.txm.core/buildJavadoc.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/R/HelloWorld.R
===================================================================
--- tmp/org.txm.core/src/R/HelloWorld.R	(revision 0)
+++ tmp/org.txm.core/src/R/HelloWorld.R	(revision 258)
@@ -0,0 +1 @@
+print("Hello World!")
Index: tmp/org.txm.core/src/R/TXTCSV2Alceste.R
===================================================================
--- tmp/org.txm.core/src/R/TXTCSV2Alceste.R	(revision 0)
+++ tmp/org.txm.core/src/R/TXTCSV2Alceste.R	(revision 258)
@@ -0,0 +1,18 @@
+# Script R écrit par Lise Vaudor (UMR 5600 EVS) en mars 2012
+
+setwd(choose.dir())  # choix du répertoire de travail
+metadata=read.table("metadata.csv",sep=",",header=T)
+write.table("texte_tot.txt")
+
+for (i in 1:nrow(metadata)){   # on parcourt un à un les lignes du fichier de métadonnées
+   namefile=paste(metadata$id[i],".txt",sep="") # on considère le fichier dont le nom est donnée à la ième ligne
+   descripteur_i=c("****")
+   for (j in 1:ncol(metadata)){
+         descripteur_i=paste(descripteur_i," *",colnames(metadata)[j],"_",metadata[i,j],sep="")  # on parcourt l'ensemble des colonnes de metadata pour créer le descripteur
+   }
+   cat(descripteur_i, file="texte_tot.txt",append=T)  # on concatène au fichier texte_tot le decripteur...
+   cat("\n", file="texte_tot.txt",append=T)                # des sauts de ligne...
+   cat(scan(namefile, what="character"), file="texte_tot.txt",append=T) # le texte qui nous intéresse...
+   cat("\n", file="texte_tot.txt",append=T)                # re-des sauts de ligne
+   cat("\n", file="texte_tot.txt",append=T)
+}
Index: tmp/org.txm.core/src/R/plot100.R
===================================================================
--- tmp/org.txm.core/src/R/plot100.R	(revision 0)
+++ tmp/org.txm.core/src/R/plot100.R	(revision 258)
@@ -0,0 +1,3 @@
+x <- rnorm(100)
+y <- rnorm(100)
+plot(x, y)
Index: tmp/org.txm.core/src/R/sample.R
===================================================================
--- tmp/org.txm.core/src/R/sample.R	(revision 0)
+++ tmp/org.txm.core/src/R/sample.R	(revision 258)
@@ -0,0 +1,2 @@
+x <- rnorm(100)
+show(x)
Index: tmp/org.txm.core/src/java/org/txm/package.html
===================================================================
--- tmp/org.txm.core/src/java/org/txm/package.html	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Entry point for launching the toolbox.</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/java/org/txm/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/sql/package.html
===================================================================
--- tmp/org.txm.core/src/java/org/txm/sql/package.html	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/sql/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>SQL tools</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/java/org/txm/sql/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/sql/SQLConnection.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/sql/SQLConnection.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/sql/SQLConnection.java	(revision 258)
@@ -0,0 +1,46 @@
+package org.txm.sql;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+
+import org.txm.utils.logger.Log;
+
+public class SQLConnection {
+
+	public static SQLConnection sqlconn;
+
+	public static String SQL_ADDRESS = "address";
+	public static String SQL_USER = "user";
+	public static String SQL_DRIVER = "driver";
+	public static String SQL_PASSWORD = "password";
+	public static String SQL_PORT = "port";
+
+	public SQLConnection getSQLConnection(){
+		if(sqlconn == null){
+			return new SQLConnection();
+		}
+		return sqlconn;
+	}
+
+	public static Connection createConnection(String dbaddress, String dbdrivername, String dbusername, String dbpassword) throws Exception{
+		Connection con = null;
+		
+		Class.forName(dbdrivername);
+		con = DriverManager.getConnection(dbaddress, dbusername, dbpassword);
+		Log.info("Base de données connectée ["+dbaddress+"]");
+		return con;
+	}
+
+	public static boolean closeConnection(Connection con){
+		try {
+			con.close();
+			return true;
+		} catch (SQLException e) {
+			e.printStackTrace();
+		}
+		return false;
+	}
+
+
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/sql/SQLConnection.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/sql/SendData.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/sql/SendData.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/sql/SendData.java	(revision 258)
@@ -0,0 +1,45 @@
+package org.txm.sql;
+
+import java.sql.*;
+
+import org.txm.searchengine.cqp.corpus.Corpus;
+import org.txm.searchengine.cqp.corpus.CorpusManager;
+
+public class SendData {
+	
+	
+	
+	static private Connection connect() throws SQLException {
+		return DriverManager.getConnection("jdbc:hsqldb:file:txmdb/db", "sa", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+	}
+	
+	public static void sendCorpusInfos(Corpus corpus) throws SQLException
+	{
+		Connection conn = connect();
+		Statement statement = conn.createStatement();
+		String query = "INSERT INTO CORPORA (name, parent, type) VALUES ('"+corpus.getName()+"', NULL, 0)"; //$NON-NLS-1$ //$NON-NLS-2$
+		statement.executeUpdate(query);
+		statement.close();
+		conn.commit();
+		conn.close();
+	}
+	
+	public static void initTables() throws SQLException
+	{
+		Connection conn = connect();
+		Statement statement = conn.createStatement();
+		
+		String query = "CREATE TABLE CORPORA (name VARCHAR(30),parent VARCHAR(30),type INT)"; //$NON-NLS-1$
+		statement.executeUpdate(query);
+		statement.close();
+		conn.commit();
+		conn.close();
+	}
+	
+	public static void main(String[] args) throws Exception
+	{
+		SendData.initTables();
+		Corpus corpus = CorpusManager.getCorpusManager().getCorpus("DISCOURSTEST"); //$NON-NLS-1$
+		SendData.sendCorpusInfos(corpus);
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/sql/SendData.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/utils/NameSpaceXmlNodePrinter.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/utils/NameSpaceXmlNodePrinter.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/utils/NameSpaceXmlNodePrinter.java	(revision 258)
@@ -0,0 +1,460 @@
+package org.txm.utils;
+/*
+ * Copyright 2003-2010 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import groovy.util.*;
+import groovy.xml.QName;
+import org.codehaus.groovy.runtime.InvokerHelper;
+
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Prints a <code>groovy.util.Node</code> (as used with <code>XmlParser</code>) including all children in XML format.
+ * Typical usage:
+ * <pre>
+ * def xml = '&lt;html&gt;&lt;head&gt;&lt;title&gt;Title&lt;/title&gt;&lt;/head&gt;&lt;body&gt;&lt;h1&gt;Header&lt;/h1&gt;&lt;/body&gt;&lt;/html&gt;'
+ * def root = new XmlParser().parseText(xml)
+ * new NameSpaceXmlNodePrinter(preserveWhitespace:true).print(root.body[0])
+ * </pre>
+ * which when run produces this on stdout (or use your own <code>PrintWriter</code> to direct elsewhere):
+ * <pre>
+ * &lt;body&gt;
+ *   &lt;h1&gt;Header&lt;/h1&gt;
+ * &lt;/body&gt;
+ * </pre>
+ *
+ * @author Christian Stein
+ * @see groovy.util.NodePrinter
+ * @see groovy.xml.XmlUtil#serialize(Node)
+ */
+public class NameSpaceXmlNodePrinter {
+
+    protected final IndentPrinter out;
+    private String quote;
+    private boolean namespaceAware = true;
+    private boolean preserveWhitespace = false;
+    private boolean expandEmptyElements = false;
+
+    public NameSpaceXmlNodePrinter(PrintWriter out) {
+        this(out, "  ");
+    }
+
+    public NameSpaceXmlNodePrinter(PrintWriter out, String indent) {
+        this(out, indent, "\"");
+    }
+
+    public NameSpaceXmlNodePrinter(PrintWriter out, String indent, String quote) {
+        this(new IndentPrinter(out, indent), quote);
+    }
+
+    public NameSpaceXmlNodePrinter(IndentPrinter out) {
+        this(out, "\"");
+    }
+
+    public NameSpaceXmlNodePrinter(IndentPrinter out, String quote) {
+        if (out == null) {
+            throw new IllegalArgumentException("Argument 'IndentPrinter out' must not be null!");
+        }
+        this.out = out;
+        this.quote = quote;
+    }
+
+    public NameSpaceXmlNodePrinter() {
+        this(new PrintWriter(new OutputStreamWriter(System.out)));
+    }
+
+    public void print(Node node) {
+        print(node, new NamespaceContext());
+    }
+
+    /**
+     * Check if namespace handling is enabled.
+     * Defaults to <code>true</code>.
+     *
+     * @return true if namespace handling is enabled
+     */
+    public boolean isNamespaceAware() {
+        return namespaceAware;
+    }
+
+    /**
+     * Enable and/or disable namespace handling.
+     *
+     * @param namespaceAware the new desired value
+     */
+    public void setNamespaceAware(boolean namespaceAware) {
+        this.namespaceAware = namespaceAware;
+    }
+
+    /**
+     * Check if whitespace preservation is enabled.
+     * Defaults to <code>false</code>.
+     *
+     * @return true if whitespaces are honoured when printing simple text nodes
+     */
+    public boolean isPreserveWhitespace() {
+        return preserveWhitespace;
+    }
+
+    /**
+     * Enable and/or disable preservation of whitespace.
+     *
+     * @param preserveWhitespace the new desired value
+     */
+    public void setPreserveWhitespace(boolean preserveWhitespace) {
+        this.preserveWhitespace = preserveWhitespace;
+    }
+
+    /**
+     * Get Quote to use when printing attributes.
+     *
+     * @return the quote character
+     */
+    public String getQuote() {
+        return quote;
+    }
+
+    /**
+     * Set Quote to use when printing attributes.
+     *
+     * @param quote the quote character
+     */
+    public void setQuote(String quote) {
+        this.quote = quote;
+    }
+
+    /**
+     * Whether empty elements are expanded from &lt;tagName/&gt; to &lt;tagName&gt;&lt;/tagName&gt;.
+     *
+     * @return <code>true</code>, if empty elements will be represented by an opening tag
+     *                            followed immediately by a closing tag.
+     */
+    public boolean isExpandEmptyElements() {
+        return expandEmptyElements;
+    }
+
+    /**
+     * Whether empty elements are expanded from <tagName/> to <tagName></tagName>.
+     *
+     * @param expandEmptyElements if <code>true</code>, empty
+     *                            elements will be represented by an opening tag
+     *                            followed immediately by a closing tag.
+     *                            Defaults to <code>false</code>.
+     */
+    public void setExpandEmptyElements(boolean expandEmptyElements) {
+        this.expandEmptyElements = expandEmptyElements;
+    }
+
+    public void print(Node node, NamespaceContext ctx) {
+        /*
+         * Handle empty elements like '<br/>', '<img/> or '<hr noshade="noshade"/>.
+         */
+        if (isEmptyElement(node)) {
+            printLineBegin();
+            out.print("<");
+            out.print(getName(node));
+            if (ctx != null) {
+                printNamespace(node, ctx);
+            }
+            printNameAttributes(node.attributes(), ctx);
+            if (expandEmptyElements) {
+                out.print("></");
+                out.print(getName(node));
+                out.print(">");
+            } else {
+                out.print("/>");
+            }
+            printLineEnd();
+            out.flush();
+            return;
+        }
+
+        /*
+         * Hook for extra processing, e.g. GSP tag element!
+         */
+        if (printSpecialNode(node)) {
+            out.flush();
+            return;
+        }
+
+        /*
+         * Handle normal element like <html> ... </html>.
+         */
+        Object value = node.value();
+        if (value instanceof List) {
+            printName(node, ctx, true, isListOfSimple((List) value));
+            printList((List) value, ctx);
+            printName(node, ctx, false, isListOfSimple((List) value));
+            out.flush();
+            return;
+        }
+
+        // treat as simple type - probably a String
+        printName(node, ctx, true, preserveWhitespace);
+        printSimpleItemWithIndent(value);
+        printName(node, ctx, false, preserveWhitespace);
+        out.flush();
+    }
+
+    private boolean isListOfSimple(List value) {
+        for (Object p : value) {
+            if (p instanceof Node) return false;
+        }
+        return preserveWhitespace;
+    }
+
+    protected void printLineBegin() {
+        out.printIndent();
+    }
+
+    protected void printLineEnd() {
+        printLineEnd(null);
+    }
+
+    protected void printLineEnd(String comment) {
+        if (comment != null) {
+            out.print(" <!-- ");
+            out.print(comment);
+            out.print(" -->");
+        }
+        out.println();
+        out.flush();
+    }
+
+    protected void printList(List list, NamespaceContext ctx) {
+        out.incrementIndent();
+        for (Object value : list) {
+            NamespaceContext context = new NamespaceContext(ctx);
+            /*
+             * If the current value is a node, recurse into that node.
+             */
+            if (value instanceof Node) {
+                print((Node) value, context);
+                continue;
+            }
+            printSimpleItem(value);
+        }
+        out.decrementIndent();
+    }
+
+    protected void printSimpleItem(Object value) {
+        if (!preserveWhitespace) printLineBegin();
+        printEscaped(InvokerHelper.toString(value), false);
+        if (!preserveWhitespace) printLineEnd();
+    }
+    boolean firstElement = true;
+    protected void printName(Node node, NamespaceContext ctx, boolean begin, boolean preserve) {
+        if (node == null) {
+            throw new NullPointerException("Node must not be null.");
+        }
+        Object name = node.name();
+        if (name == null) {
+            throw new NullPointerException("Name must not be null.");
+        }
+        if (!preserve || begin) printLineBegin();
+        out.print("<");
+        if (!begin) {
+            out.print("/");
+        }
+        out.print(getName(node));
+        if (firstElement) { firstElement = false;
+        	//System.out.println("PRINT FIRST NAMESPACE");
+        	for (String prefix : ctx.namespaceMap.keySet()) {
+        		 out.print(" xmlns");
+                 if (prefix.length() > 0) {
+                     out.print(":");
+                     out.print(prefix);
+                 }
+                 out.print("=" + quote);
+                 out.print(ctx.namespaceMap.get(prefix));
+                 out.print(quote);
+        	}
+        }
+        if (ctx != null) {
+            printNamespace(node, ctx);
+        }
+        if (begin) {
+            printNameAttributes(node.attributes(), ctx);
+        }
+        out.print(">");
+        if (!preserve || !begin) printLineEnd();
+    }
+
+    protected boolean printSpecialNode(Node node) {
+        return false;
+    }
+
+    protected void printNamespace(Object object, NamespaceContext ctx) {
+        if (namespaceAware) {
+        	//System.out.println("CTX: "+ctx);
+            if (object instanceof Node) {
+                printNamespace(((Node) object).name(), ctx);
+            } else if (object instanceof QName) {
+                QName qname = (QName) object;
+                String namespaceUri = qname.getNamespaceURI();
+                if (namespaceUri != null) {
+                    String prefix = qname.getPrefix();
+                    if (!ctx.isPrefixRegistered(prefix, namespaceUri)) {
+                        ctx.registerNamespacePrefix(prefix, namespaceUri);
+                        out.print(" ");
+                        out.print("xmlns");
+                        if (prefix.length() > 0) {
+                            out.print(":");
+                            out.print(prefix);
+                        }
+                        out.print("=" + quote);
+                        out.print(namespaceUri);
+                        out.print(quote);
+                    }
+                }
+            }
+        }
+    }
+
+    protected void printNameAttributes(Map attributes, NamespaceContext ctx) {
+        if (attributes == null || attributes.isEmpty()) {
+            return;
+        }
+        for (Object p : attributes.entrySet()) {
+            Map.Entry entry = (Map.Entry) p;
+            out.print(" ");
+            out.print(getName(entry.getKey()));
+            out.print("=");
+            Object value = entry.getValue();
+            out.print(quote);
+            if (value instanceof String) {
+                printEscaped((String) value, true);
+            } else {
+                printEscaped(InvokerHelper.toString(value), true);
+            }
+            out.print(quote);
+            printNamespace(entry.getKey(), ctx);
+        }
+    }
+
+    private boolean isEmptyElement(Node node) {
+        if (node == null) {
+            throw new IllegalArgumentException("Node must not be null!");
+        }
+        if (!node.children().isEmpty()) {
+            return false;
+        }
+        return node.text().length() == 0;
+    }
+
+    private String getName(Object object) {
+        if (object instanceof String) {
+            return (String) object;
+        } else if (object instanceof QName) {
+            QName qname = (QName) object;
+            if (!namespaceAware) {
+                return qname.getLocalPart();
+            }
+            return qname.getQualifiedName();
+        } else if (object instanceof Node) {
+            Object name = ((Node) object).name();
+            return getName(name);
+        }
+        return object.toString();
+    }
+
+    private void printSimpleItemWithIndent(Object value) {
+        if (!preserveWhitespace) out.incrementIndent();
+        printSimpleItem(value);
+        if (!preserveWhitespace) out.decrementIndent();
+    }
+
+    // For ' and " we only escape if needed. As far as XML is concerned,
+    // we could always escape if we wanted to.
+    private void printEscaped(String s, boolean isAttributeValue) {
+        for (int i = 0; i < s.length(); i++) {
+            char c = s.charAt(i);
+            switch (c) {
+                case '<':
+                    out.print("&lt;");
+                    break;
+                case '>':
+                    out.print("&gt;");
+                    break;
+                case '&':
+                    out.print("&amp;");
+                    break;
+                case '\'':
+                    if (quote.equals("'"))
+                        out.print("&apos;");
+                    else
+                        out.print(c);
+                    break;
+                case '"':
+                    if (quote.equals("\""))
+                        out.print("&quot;");
+                    else
+                        out.print(c);
+                    break;
+                case '\n':
+                    if (isAttributeValue)
+                        out.print("&#10;");
+                    else
+                        out.print(c);
+                    break;
+                case '\r':
+                    if (isAttributeValue)
+                        out.print("&#13;");
+                    else
+                        out.print(c);
+                    break;
+                default:
+                    out.print(c);
+            }
+        }
+    }
+
+    public class NamespaceContext {
+        public final Map<String, String> namespaceMap;
+
+        public NamespaceContext() {
+            namespaceMap = new HashMap<String, String>();
+        }
+
+        public NamespaceContext(NamespaceContext context) {
+            this();
+            namespaceMap.putAll(context.namespaceMap);
+        }
+
+        public boolean isPrefixRegistered(String prefix, String uri) {
+            return namespaceMap.containsKey(prefix) && namespaceMap.get(prefix).equals(uri);
+        }
+
+        public void registerNamespacePrefix(String prefix, String uri) {
+            if (!isPrefixRegistered(prefix, uri)) {
+                namespaceMap.put(prefix, uri);
+            }
+        }
+
+        public String getNamespace(String prefix) {
+            Object uri = namespaceMap.get(prefix);
+            return (uri == null) ? null : uri.toString();
+        }
+        
+        public String toString() {
+        	return namespaceMap.toString();
+        }
+    }
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/utils/NameSpaceXmlNodePrinter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/utils/BundleUtils.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/utils/BundleUtils.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/utils/BundleUtils.java	(revision 258)
@@ -0,0 +1,165 @@
+package org.txm.utils;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.eclipse.core.runtime.Platform;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.Version;
+import org.txm.utils.io.FileCopy;
+import org.txm.utils.logger.Log;
+import org.txm.utils.zip.Zip;
+
+public class BundleUtils {
+
+	protected static File INSTALLDIR = new File(System.getProperty("eclipse.launcher")).getParentFile().getParentFile();
+	/**
+	 * 
+	 * @param bundle_id the Bundle ID
+	 * @return the relative path to the bundle directory
+	 */
+	public static Version getBundleVersion(String bundle_id) {
+		Bundle bundle = Platform.getBundle(bundle_id);
+		if (bundle == null) {
+			System.out.println("Error while initializing Oriflamms plugin: bundle not found.");
+			return null;
+		}
+		return bundle.getVersion();
+	}
+	
+	/**
+	 * 
+	 * @param bundle_id the Bundle ID
+	 * @return the relative path to the bundle directory
+	 */
+	public static String getBundleLocation(String bundle_id) {
+		Bundle bundle = Platform.getBundle(bundle_id);
+		if (bundle == null) {
+			System.out.println("Error while initializing Oriflamms plugin: bundle not found.");
+			return null;
+		}
+		return bundle.getLocation();
+	}
+	
+	/**
+	 * 
+	 * @param bundle_id the Bundle ID
+	 * @return the absolute File to the bundle directory. The File is a directory or a file.
+	 */
+	public static File getBundleFile(String bundle_id) {
+		Log.info("Retrieving file_path from "+bundle_id+" plugin.");
+		Bundle bundle = Platform.getBundle(bundle_id);
+		if (bundle == null) {
+			System.out.println("Error while initializing Oriflamms plugin: bundle not found.");
+			return null;
+		}
+		String bundleLocation = bundle.getLocation();
+		String eclipseHomeLocation = System.getProperty("eclipse.home.location");
+	
+		int idx = bundleLocation.lastIndexOf(":");
+		if (idx > 0) bundleLocation = bundleLocation.substring(idx + 1);
+		
+		idx = eclipseHomeLocation.indexOf("file:");
+		if (idx == 0) eclipseHomeLocation = eclipseHomeLocation.substring(5);
+		
+		File bundleDir = new File(bundleLocation);
+		if (bundleLocation.startsWith("/")) {
+			bundleDir = new File(bundleLocation);
+		} else {
+			bundleDir = new File(eclipseHomeLocation, bundleLocation);
+		}
+		
+		return bundleDir;
+	}
+	
+	/**
+	 * Copy a file from the bundle directory or Jar to @outputDirectory
+	 * 
+	 * if the bundle file is a directory then the asked file must be in the "res" directory
+	 * 
+	 * @param bundle_id
+	 * @param source_relative_directory only used when TXM is run from Eclipse
+	 * @param file_path relative path to the file to copy
+	 * @param file_name
+	 * @param outputDirectory
+	 * @return true if success
+	 */
+	public static boolean copyFiles(String bundle_id, String source_relative_directory, String file_path, String file_name, File outputDirectory) {
+		
+		if (!source_relative_directory.endsWith("/")) source_relative_directory += "/";
+		if (!file_path.endsWith("/")) file_path += "/";
+		
+		File bundleDir = getBundleFile(bundle_id);
+		String bundleLocation = getBundleLocation(bundle_id);
+		File outfile = new File(outputDirectory, file_name);
+
+		if (bundleDir.isDirectory()) { // TXM is run from Eclipse or we've decided to ship the Toolbox plugin in a directory
+			File fileInToolbox = new File(bundleDir, file_path+file_name);
+			if (!fileInToolbox.exists()) { // maybe run from Eclipse, then add the relative directory
+				fileInToolbox = new File(bundleDir, source_relative_directory+file_path+file_name);
+			}
+			try {
+				if (fileInToolbox.isDirectory())
+					FileCopy.copyFiles(fileInToolbox, outfile);
+				else 
+					FileCopy.copy(fileInToolbox, outfile);
+			} catch (IOException e) {
+				System.out.println("Copy of ressource script failed: "+e); 
+				Log.printStackTrace(e);
+				return false;
+			}
+		} else { // jar file
+			if (!bundleDir.exists()) { // get from the installed Toolbox
+				bundleDir = new File(INSTALLDIR, "TXM/"+bundleLocation);
+			}
+
+			if (!Zip.extractOneFile(bundleDir, file_path+file_name, outfile, false)) {
+				System.out.println("Extraction of ressource script failed from "+bundleDir+" with path "+file_path+file_name);
+				return false;
+			}
+		}
+		return true;
+	}
+
+	public static boolean replaceFilesIfNewer(String bundle_id, String source_relative_directory, String file_path, String file_name, File fileToReplace) {
+		if (!source_relative_directory.endsWith("/")) source_relative_directory += "/";
+		if (!file_path.endsWith("/")) file_path += "/";
+		
+		File bundleDir = getBundleFile(bundle_id);
+		String bundleLocation = getBundleLocation(bundle_id);
+
+		if (bundleDir.isDirectory()) { // TXM is run from Eclipse or we've decided to ship the Toolbox plugin in a directory
+			File fileInToolbox = new File(bundleDir, file_path+file_name);
+			if (!fileInToolbox.exists()) { // TXM may be run from Eclipse, then add the source relative directory
+				fileInToolbox = new File(bundleDir, source_relative_directory+file_path+file_name);
+			}
+			
+			if (fileInToolbox.lastModified() <= fileToReplace.lastModified()) { // no need to update
+				return true;
+			}
+			
+			try {
+				if (fileInToolbox.isDirectory()) {
+					FileCopy.copyFiles(fileInToolbox, fileToReplace);
+				} else { 
+					FileCopy.copy(fileInToolbox, fileToReplace);
+				}
+			} catch (IOException e) {
+				System.out.println("Copy of ressource script failed: "+e); 
+				Log.printStackTrace(e);
+				return false;
+			}
+		} else { // jar file
+			if (!bundleDir.exists()) { // get from the installed Toolbox
+				bundleDir = new File(INSTALLDIR, "TXM/"+bundleLocation);
+			}
+
+			if (!Zip.extractOneFile(bundleDir, file_path+file_name, fileToReplace, true)) {
+				System.out.println("Extraction of ressource script failed from "+bundleDir+" with path "+file_path+file_name);
+				return false;
+			}
+		}
+		return true;
+
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/utils/BundleUtils.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/importer/filters/FilterManager.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/importer/filters/FilterManager.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/importer/filters/FilterManager.java	(revision 258)
@@ -0,0 +1,126 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer.filters;
+
+import java.io.File;
+import java.util.Hashtable;
+
+import org.txm.core.messages.TXMCoreMessages;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Load groovy filters from a directory with the method get("ScriptName") during
+ * the initialization, the given path is scanned : each directory found must
+ * contains a groovy file with the same name.
+ *
+ * @author mdecorde
+ */
+public class FilterManager implements Manager<Filter> {
+	
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 923334159432679936L;
+	
+	/** The hashtable. */
+	private Hashtable<String, String> hashtable = new Hashtable<String, String>();
+
+	/** The home. */
+	File home;
+
+	/**
+	 * Instantiates a new filter manager.
+	 *
+	 * @param path the path
+	 */
+	public FilterManager(String path) {
+		File home = new File(path);
+		if (!home.exists())
+			System.out
+					.println(TXMCoreMessages.FilterManager_0 + path + TXMCoreMessages.FilterManager_1); 
+		else {
+			File[] list = home.listFiles();
+			for (File f : list)
+				if (f.isDirectory()) {
+					this.hashtable.put(f.getName(), f.getPath());
+				}
+		}
+	}
+
+	/* (non-Javadoc)
+	 * @see java.lang.Object#toString()
+	 */
+	@Override
+	public String toString() {
+		return this.hashtable.toString();
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Manager#getIDs()
+	 */
+	@Override
+	public Iterable<String> getIDs() {
+		return this.hashtable.keySet();
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Manager#get(java.lang.String)
+	 */
+	@Override
+	public Filter get(String key) {
+		Filter f = Filter.CreateFilterFromGroovy(this.hashtable.get(key), key);
+		return f;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Manager#GetManageDirectory()
+	 */
+	@Override
+	public String GetManageDirectory() {
+
+		return home.toString();
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Manager#containsKey(java.lang.String)
+	 */
+	@Override
+	public boolean containsKey(String key) {
+		return this.hashtable.containsKey(key);
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String args[]) {
+		String ActionHome = System.getProperty("user.home") + "/.txm/import/actions/"; //$NON-NLS-1$ //$NON-NLS-2$
+		Manager<Filter> m = new FilterManager(ActionHome);
+
+		System.out.println(m);
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/importer/filters/FilterManager.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/importer/filters/CatalogManager.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/importer/filters/CatalogManager.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/importer/filters/CatalogManager.java	(revision 258)
@@ -0,0 +1,109 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer.filters;
+
+import java.io.File;
+import java.util.Hashtable;
+
+import org.txm.core.messages.TXMCoreMessages;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class CatalogManager.
+ */
+public class CatalogManager extends Hashtable<String, Catalog> implements
+		Manager<Catalog> {
+	
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 5076240727042878267L;
+
+	/** The home. */
+	File home;
+
+	/**
+	 * Instantiates a new catalog manager.
+	 *
+	 * @param path the path
+	 */
+	public CatalogManager(String path) {
+		File home = new File(path);
+		if (!home.exists())
+			System.out
+					.println(TXMCoreMessages.CatalogManager_0 + path + TXMCoreMessages.CatalogManager_1); 
+		else {
+			File[] list = home.listFiles();
+			for (File f : list)
+				this.put(f.getName(), new Catalog(f.getPath()));
+		}
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Manager#GetManageDirectory()
+	 */
+	@Override
+	public String GetManageDirectory() {
+		return home.toString();
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Manager#get(java.lang.String)
+	 */
+	@Override
+	public Catalog get(String key) {
+		return super.get(key);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Manager#getIDs()
+	 */
+	@Override
+	public Iterable<String> getIDs() {
+		return this.keySet();
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Manager#containsKey(java.lang.String)
+	 */
+	@Override
+	public boolean containsKey(String key) {
+		return super.containsKey(key);
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String args[]) {
+		String CatalogHome = System.getProperty("user.home") + "/.txm/import/catalogs/"; //$NON-NLS-1$ //$NON-NLS-2$
+		CatalogManager m = new CatalogManager(CatalogHome);
+
+		System.out.println(m);
+	}
+
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/importer/filters/CatalogManager.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/importer/filters/Filter.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/importer/filters/Filter.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/importer/filters/Filter.java	(revision 258)
@@ -0,0 +1,316 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-08-29 14:23:55 +0200 (jeu., 29 août 2013) $
+// $LastChangedRevision: 2519 $
+// $LastChangedBy: nilskredens $ 
+//
+package org.txm.importer.filters;
+
+import groovy.lang.GroovyClassLoader;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.io.PipedReader;
+import java.io.PipedWriter;
+
+import org.txm.core.messages.TXMCoreMessages;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The base class to all the filters used to build an import chain. A filter
+ * reads from its input, apply some transformation and writes the result to its
+ * output.
+ * 
+ * @author jmague
+ * 
+ */
+public abstract class Filter extends Thread {
+	
+	/** The classname. */
+	String classname;
+	
+	/** The Constant gcl. */
+	public static final GroovyClassLoader gcl = new GroovyClassLoader();
+	
+	/** The source. */
+	public Filter source = null;
+	
+	/** The Pinput. */
+	public PipedReader Pinput = new PipedReader();
+	
+	/** The Poutput. */
+	public PipedWriter Poutput = new PipedWriter();
+
+	/** The input. */
+	public BufferedReader input = new BufferedReader(Pinput);
+	
+	/** The output. */
+	public BufferedWriter output = new BufferedWriter(this.Poutput);
+	
+	/** The line. */
+	protected String line = ""; //$NON-NLS-1$
+	
+	/** The read input. */
+	public boolean readInput = true;
+
+	/** The line separator. */
+	public String lineSeparator = "\r\n"; //$NON-NLS-1$
+	
+	/** The encodage. */
+	protected String encodage = "UTF-8"; //$NON-NLS-1$
+	
+	/** The encodage sortie. */
+	protected String encodageSortie = "UTF-8"; //$NON-NLS-1$
+	
+	/** The Thread counter. */
+	public Integer ThreadCounter;
+
+	/** The linecounter. */
+	public int linecounter = 0;
+
+	/**
+	 * Sets the counter.
+	 *
+	 * @param c the new counter
+	 */
+	public void setCounter(Integer c) {
+		this.ThreadCounter = c;
+	}
+
+	/**
+	 * Creates the filter from groovy.
+	 *
+	 * @param path the path
+	 * @param classname the classname
+	 * @return the filter
+	 */
+	@SuppressWarnings("unchecked") //$NON-NLS-1$
+	public static Filter CreateFilterFromGroovy(String path, String classname) {
+		// System.out.println("Creating Filter : "+path+"/"+classname+".groovy");
+		try {
+			gcl.addClasspath(path + "/"); //$NON-NLS-1$
+			Class<Filter> clazz = gcl.parseClass(new File(path
+					+ "/" + classname + ".groovy")); //$NON-NLS-1$ //$NON-NLS-2$
+			Object aScript = clazz.newInstance();
+			Filter myObject = (Filter) aScript;
+			myObject.classname = classname;
+			return myObject;
+		} catch (Exception e) {
+			System.err.println(e);
+			return null;
+		}
+	}
+
+	/**
+	 * Links the input of this filter to the output of another source filter.
+	 * This method builds chains of filters.
+	 *
+	 * @param source the new source
+	 */
+	public void setSource(Filter source) {
+		// System.out.println("connect "+this.toString()+" to "+source.toString());
+		try {
+			this.source = source;
+			// this.source.Poutput = new PipedWriter();
+			// this.Pinput = new PipedReader();
+			this.Pinput.connect(source.Poutput);
+			this.input = new BufferedReader(this.Pinput);
+
+		} catch (IOException e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+			System.exit(-1);
+		}
+	}
+
+	/**
+	 * Must be defined by all Filters. to set their args before launching them
+	 *
+	 * @param args the args
+	 */
+	public abstract void SetUsedParam(Object args);
+
+	/**
+	 * break all connected pipe.
+	 */
+	public void Disconnect() {
+		try {
+			this.input.close();
+			this.output.close();
+			this.Pinput.close();
+			this.Poutput.close();
+			this.output = null;
+			this.input = null;
+			this.Pinput = null;
+			this.Poutput = null;
+		} catch (IOException e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+	}
+
+	/**
+	 * set the source file of the filter.
+	 *
+	 * @param f the f
+	 */
+	public void SetInSource(File f) {
+		try {
+			this.source = null;
+			this.Pinput = null;
+			this.input = new BufferedReader(new InputStreamReader(
+					new FileInputStream(f), encodage));
+
+		} catch (IOException e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+			System.exit(-1);
+		}
+	}
+
+	/**
+	 * set the out file of the filter.
+	 *
+	 * @param f the f
+	 */
+	public void SetOutSource(File f) {
+		try {
+			this.Poutput = null;
+			this.output = new BufferedWriter(new OutputStreamWriter(
+					new FileOutputStream(f), encodageSortie));
+		} catch (IOException e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+			System.exit(-1);
+		}
+	}
+
+	/**
+	 * set In and Out encodings.
+	 *
+	 * @param entree the entree
+	 * @param sortie the sortie
+	 */
+	public void SetEncodages(String entree, String sortie) {
+		if (entree.length() > 0)
+			this.encodage = entree;
+		if (sortie.length() > 0)
+			this.encodageSortie = sortie;
+	}
+
+	/**
+	 * execute the filter on the input and write to the output.
+	 */
+	@Override
+	final public void run() {
+		before();
+		if (readInput) {
+			while (this.getLine()) {
+				linecounter++;
+				filter();
+			}
+		}
+		// System.out.println(this.classname + " : after");
+		after();
+
+		// System.out.println("  "+this.classname+" : processed line number : "+linecounter);
+		try {
+			this.output.close();
+		} catch (IOException e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+
+		// decrementCounter();
+	}
+
+	/**
+	 * the method used to get the next line.
+	 *
+	 * @return the line
+	 */
+	private boolean getLine() {
+		try {
+			this.line = this.input.readLine();
+			// System.out.println("getted line: "+this.line);
+			if (this.line != null)
+				return true;
+		} catch (IOException e) {
+			System.err.println(TXMCoreMessages.Filter_7); 
+			org.txm.utils.logger.Log.printStackTrace(e);
+			return false;
+		}
+		return false;
+	}
+
+	/**
+	 * Debug purpose : get String format of the chain from this filter backward
+	 * to the ultimate source(s).
+	 *
+	 * @return the string chain
+	 */
+	public String getStringChain() {
+		return printChain(""); //$NON-NLS-1$
+	}
+
+	/**
+	 * Prints the chain.
+	 *
+	 * @param prefix the prefix
+	 * @return the string
+	 */
+	protected String printChain(String prefix) {
+		String res = prefix + this.getClass().getName() + "\n"; //$NON-NLS-1$
+		if (source != null)
+			res += source.printChain(prefix + " "); //$NON-NLS-1$
+		return res;
+	}
+
+	/**
+	 * The method that actually realizes the transformation for each line.
+	 *
+	 */
+	protected void filter() {
+		try {
+			output.write(line);
+		} catch (IOException e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+			System.exit(-1);
+		}
+	}
+
+	/**
+	 * Called before {@link filter()}.
+	 *
+	 * @return true, if successful
+	 */
+	protected abstract boolean before();
+
+	/**
+	 * After.
+	 */
+	protected abstract void after();
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/importer/filters/Filter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/importer/filters/Sequence.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/importer/filters/Sequence.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/importer/filters/Sequence.java	(revision 258)
@@ -0,0 +1,194 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-08-29 14:23:55 +0200 (jeu., 29 août 2013) $
+// $LastChangedRevision: 2519 $
+// $LastChangedBy: nilskredens $ 
+//
+package org.txm.importer.filters;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.PipedReader;
+import java.io.PipedWriter;
+import java.util.LinkedList;
+import java.util.List;
+
+// TODO: Auto-generated Javadoc
+//private OutputStreamWriter output;
+/**
+ * Manage a sequence of filter to be applied one after the other.
+ */
+public class Sequence extends LinkedList<Filter> {
+	
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 1071883268500776713L;
+
+	/** The source. */
+	public File source;
+
+	/**
+	 * Instantiates a new sequence.
+	 */
+	public Sequence() { }
+
+	/**
+	 * Instantiates a new sequence.
+	 *
+	 * @param filters the filters
+	 */
+	public Sequence(List<Filter> filters) {
+		for (Filter f : filters) this.push(f);
+	}
+
+	/**
+	 * set the input file of the sequence and the output file of the sequence
+	 * then link all pipe between filters.
+	 *
+	 * @param infile the infile
+	 * @param outfile the outfile
+	 */
+	public void SetInFileAndOutFile(String infile, String outfile) {
+		for (int i = 1; i < this.size(); i++) {
+			// System.out.println(this.get(i)+"1st connect only : "+this.get(i).source);
+			this.get(i - 1).Poutput = new PipedWriter();
+			this.get(i - 1).output = new BufferedWriter(this.get(i - 1).Poutput);
+			this.get(i).Pinput = new PipedReader();
+			this.get(i).input = new BufferedReader(this.get(i).Pinput);
+
+			this.get(i).setSource(this.get(i - 1));
+		}
+
+		this.getFirst().Pinput = new PipedReader();
+		this.getFirst().input = new BufferedReader(this.getFirst().Pinput);
+		this.getFirst().SetInSource(new File(infile));
+
+		File f = new File(outfile);
+		this.getLast().Poutput = new PipedWriter();
+		this.getLast().output = new BufferedWriter(this.getLast().Poutput);
+		this.getLast().SetOutSource(f);
+	}
+
+	/**
+	 * start the sequence and wait for the last filter to finish its job.
+	 *
+	 * @return true, if successful
+	 */
+	public boolean proceed() {
+		Thread s = null;
+		int i = 0;
+		for (i = 0; i < this.size(); i++) {
+			s = new Thread(this.get(i));
+			s.start();
+		}
+		
+		try {
+			s.join();
+		} catch (InterruptedException e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+			return false;
+		}
+	
+		return true;
+	}
+
+	/**
+	 * set the encodings for all filters.
+	 *
+	 * @param entree the entree
+	 * @param sortie the sortie
+	 */
+	public void setEncodages(String entree, String sortie) {
+		for (Filter f : this) f.SetEncodages(entree, sortie);
+	}
+
+	/**
+	 * Clean.
+	 */
+	public void clean() {
+		for (Filter f : this) {
+			try {
+				f.Disconnect();
+			} catch (Exception e) { }
+		}
+		this.clear();
+		System.gc();
+	}
+
+	/**
+	 * set the lineseparator for all filters.
+	 *
+	 * @param lineSeparator the new line separators
+	 */
+	public void setLineSeparators(String lineSeparator) {
+		for (Filter f : this) f.lineSeparator = lineSeparator;
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args) {
+		// Get filter Manager
+		String ActionHome = System.getProperty("user.home") + "/.txm/import/actions/"; //$NON-NLS-1$ //$NON-NLS-2$
+		Manager<Filter> filterManager = new FilterManager(ActionHome);
+
+		// Create a sequence
+		Sequence S = new Sequence();
+
+		// Create filters
+		Filter F1 = filterManager.get("MinimalFilter"); //$NON-NLS-1$
+		Filter F2 = filterManager.get("MinimalFilter"); //$NON-NLS-1$
+		Filter F3 = filterManager.get("MinimalFilter"); //$NON-NLS-1$
+
+		// Set Filter's order
+		S.add(F1);
+		S.add(F2);
+		S.add(F3);
+
+		// Create Catalog Manager
+		String CatalogHome = System.getProperty("user.home") + "/.txm/import/catalogs/"; //$NON-NLS-1$ //$NON-NLS-2$
+		CatalogManager cm = new CatalogManager(CatalogHome);
+
+		// Get Catalog "BFM.clg"
+		Catalog c = cm.get("BFM.clg"); //$NON-NLS-1$
+
+		for (File f : c) {
+			S.SetInFileAndOutFile(f.getPath(), f.getPath() + "RESULT"); //$NON-NLS-1$
+
+			Object[] arguments1 = {};
+			F1.SetUsedParam(arguments1);
+			F3.SetUsedParam(arguments1);
+
+			Object[] arguments2 = {};
+			F2.SetUsedParam(arguments2);
+
+			S.proceed();
+		}
+
+		System.out.println("seq : " + S); //$NON-NLS-1$
+		System.out.println(S.getLast().getStringChain());
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/importer/filters/Sequence.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/importer/filters/Catalog.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/importer/filters/Catalog.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/importer/filters/Catalog.java	(revision 258)
@@ -0,0 +1,104 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2017-01-24 18:11:42 +0100 (Tue, 24 Jan 2017) $
+// $LastChangedRevision: 3400 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer.filters;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.LinkedList;
+
+import org.txm.core.messages.TXMCoreMessages;
+
+// TODO: Auto-generated Javadoc
+/**
+ * 
+ * aims at handling a Catalog of text, has to be more defined...
+ * 
+ * @author mdecorde
+ * 
+ */
+public class Catalog extends LinkedList<File> {
+	
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = -8648432882133436521L;
+
+	/** The source. */
+	File source;
+
+	/**
+	 * Instantiates a new catalog.
+	 *
+	 * @param path path to the catalog file catalog.clg
+	 */
+	public Catalog(String path) {
+		source = new File(path);
+		if (!source.exists()) {
+			System.err.println(TXMCoreMessages.Catalog_0 + path); 
+			System.exit(-1);
+		}
+
+		init();
+	}
+
+	/**
+	 * initialize the file List.
+	 */
+	private void init() {
+		if (source.exists()) {
+			try {
+				BufferedReader input = new BufferedReader(
+						new FileReader(source));
+
+				String filepath;
+				File file;
+
+				while ((filepath = input.readLine()) != null) {
+					file = new File(filepath);
+					if (file.exists())
+						this.add(file);
+				}
+
+			} catch (IOException e) {
+				System.out.println(e.getLocalizedMessage());
+			}
+		}
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args) {
+		Catalog C = new Catalog(
+				System.getProperty("user.home") + "/.txm/import/catalogs/test.clg"); //$NON-NLS-1$ //$NON-NLS-2$
+		System.out.println(C);
+
+	}
+}
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/java/org/txm/importer/filters/Catalog.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/importer/filters/Manager.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/importer/filters/Manager.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/importer/filters/Manager.java	(revision 258)
@@ -0,0 +1,68 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer.filters;
+
+// TODO: Auto-generated Javadoc
+/**
+ * interface of Manager with a repository directory.
+ *
+ * @param <E> the element type
+ * @author mdecorde
+ */
+public interface Manager<E> {
+	
+	/**
+	 * Gets the i ds.
+	 *
+	 * @return the i ds
+	 */
+	public Iterable<String> getIDs();
+
+	/**
+	 * Gets the.
+	 *
+	 * @param key the key
+	 * @return the e
+	 */
+	public E get(String key);
+
+	/**
+	 * Gets the manage directory.
+	 *
+	 * @return the string
+	 */
+	public String GetManageDirectory();
+
+	/**
+	 * Contains key.
+	 *
+	 * @param key the key
+	 * @return true, if successful
+	 */
+	public boolean containsKey(String key);
+}
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/java/org/txm/importer/filters/Manager.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/importer/filters/package.html
===================================================================
--- tmp/org.txm.core/src/java/org/txm/importer/filters/package.html	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/importer/filters/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Filters base class</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/java/org/txm/importer/filters/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/importer/ValidateXml.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/importer/ValidateXml.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/importer/ValidateXml.java	(revision 258)
@@ -0,0 +1,168 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2011-06-03 12:37:57 +0200 (ven., 03 juin 2011) $
+// $LastChangedRevision: 1867 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer;
+
+import groovy.util.Node;
+import groovy.util.XmlParser;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.txm.core.messages.TXMCoreMessages;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Validate a xml file with a stax parser.
+ *
+ * @author mdecorde
+ */
+public class ValidateXml {
+
+	/**
+	 * @throws XMLStreamException 
+	 * test a String, not implemented.
+	 *
+	 * @param xmldata the xmldata
+	 * @return true, if successful
+	 * @throws  
+	 */
+	public static boolean testAndThrow(File infile) throws XMLStreamException {
+		if (infile.isDirectory()) {
+			System.out.println( TXMCoreMessages.ValidateXml_0+infile+TXMCoreMessages.ValidateXml_1);
+			return false;
+		}
+		if (!infile.exists()) {
+			System.out.println( TXMCoreMessages.ValidateXml_0+infile+TXMCoreMessages.ValidateXml_2);
+			return false;
+		}
+		if (!infile.canRead()) {
+			System.out.println(TXMCoreMessages.ValidateXml_0+infile+TXMCoreMessages.ValidateXml_3);
+			return false;
+		}
+		try {
+			URL url = infile.toURI().toURL();
+			InputStream inputData = url.openStream();
+			XMLInputFactory factory = XMLInputFactory.newInstance();
+			XMLStreamReader parser = factory.createXMLStreamReader(inputData);
+			for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser
+					.next()) {
+
+			}
+			parser.close();
+			inputData.close();
+		} catch (IOException e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+			return false;
+		}
+		return true;
+	}
+
+	/**
+	 * test a content stored in a String, not implemented.
+	 *
+	 * @param xmldata the xmldata
+	 * @return true, if successful
+	 */
+	public static boolean test(String xmldata){
+		return testAndGetError(xmldata).length() == 0;
+	}
+	
+	/**
+	 * test a content stored in a String, not implemented.
+	 *
+	 * @param xmldata the xmldata
+	 * @return true, if successful
+	 */
+	public static String testAndGetError(String xmldata){
+		try {
+			Node records = new XmlParser().parseText(xmldata);
+			return "";
+		} catch (Exception e) {
+			System.out.println(e.getLocalizedMessage());
+			return e.toString();
+		}
+	}
+
+	/**
+	 * test a file.
+	 *
+	 * @param infile the infile
+	 * @return false if the file is not valid
+	 */
+	public static boolean test(File infile) {
+		if (infile.isDirectory()) {
+			System.out.println( TXMCoreMessages.ValidateXml_0+infile+TXMCoreMessages.ValidateXml_1);
+			return false;
+		}
+		if (!infile.exists()) {
+			System.out.println( TXMCoreMessages.ValidateXml_0+infile+TXMCoreMessages.ValidateXml_2);
+			return false;
+		}
+		if (!infile.canRead()) {
+			System.out.println(TXMCoreMessages.ValidateXml_0+infile+TXMCoreMessages.ValidateXml_3);
+			return false;
+		}
+		try {
+			URL url = infile.toURI().toURL();
+			InputStream inputData = url.openStream();
+			XMLInputFactory factory = XMLInputFactory.newInstance();
+			XMLStreamReader parser = factory.createXMLStreamReader(inputData);
+			for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser
+					.next()) {
+
+			}
+			parser.close();
+			inputData.close();
+			return true;
+		} catch (Exception e) {
+			System.out.println(e.getLocalizedMessage());
+			return false;
+		}
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args) {
+		if (ValidateXml.test(new File(
+				"~/TXM/corpora/discours/txm/01_DeGaulle.xml"))) //$NON-NLS-1$
+			System.out.println("OK"); //$NON-NLS-1$
+		else
+			System.out.println("ERROR"); //$NON-NLS-1$
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/importer/ValidateXml.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/importer/cwb/BuildCwbEncodeArgsFromWTC.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/importer/cwb/BuildCwbEncodeArgsFromWTC.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/importer/cwb/BuildCwbEncodeArgsFromWTC.java	(revision 258)
@@ -0,0 +1,216 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-08-29 14:23:55 +0200 (Thu, 29 Aug 2013) $
+// $LastChangedRevision: 2519 $
+// $LastChangedBy: nilskredens $ 
+//
+package org.txm.importer.cwb;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.xml.stream.FactoryConfigurationError;
+import javax.xml.stream.XMLStreamException;
+
+import org.txm.core.messages.TXMCoreMessages;
+
+// TODO: Auto-generated Javadoc
+/**
+ * build the sAttributes and pAttributs List from an xmlfile pAttributes
+ * (attributes of tei:w tags) and the sAttributes (attributes + max inclusion of
+ * tags).
+ *
+ * @author mdecorde
+ */
+public class BuildCwbEncodeArgsFromWTC {
+
+	/** The stack. */
+	LinkedList<String> stack = new LinkedList<String>();
+
+	/** The tagcount. */
+	HashMap<String, Integer> tagcount = new HashMap<String, Integer>();
+
+	/** The tagmax. */
+	HashMap<String, Integer> tagmax = new HashMap<String, Integer>();
+
+	/** The tagattrs. */
+	HashMap<String, HashSet<String>> tagattrs = new HashMap<String, HashSet<String>>();
+	int nWordProps = 0;
+	/**
+	 * process !!!.
+	 *
+	 * @param wtcfile the xmlfile
+	 * @param wordstag the wordstag
+	 * @return true, if successful
+	 * @throws XMLStreamException the xML stream exception
+	 * @throws FactoryConfigurationError the factory configuration error
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 */
+	public boolean process(File wtcfile)
+			throws XMLStreamException, FactoryConfigurationError, IOException {
+		if (wtcfile == null || !wtcfile.exists()) {
+			System.out.println(TXMCoreMessages.bind(TXMCoreMessages.BuildCwbEncodeArgs_0, wtcfile));
+			return false;
+		}
+
+		BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(wtcfile), "UTF-8"));
+
+		String line = reader.readLine();
+		String localname;
+		
+		
+		Pattern p = Pattern.compile("(([^= ]+)=\"([^\"]+)\")");
+		//for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+		for(; line != null ; line = reader.readLine()) {
+
+			if (line.startsWith("</") && line.endsWith(">")) { // END_ELEMENT
+				int idx = line.indexOf(" ");
+				if (idx == -1) idx = line.indexOf(">");
+				localname = line.substring(2, idx);
+
+				if (stack.size() > 0) {
+					stack.pop();
+					int count = tagcount.get(localname);
+					count--;
+					tagcount.put(localname, count);// decrement the
+					// recursion counter of the tag
+				}
+
+			} else if (line.startsWith("<") && line.endsWith("/>")) { // EMPTY_ELEMENT
+				// ignore milestones
+			} else if (line.startsWith("<") && line.endsWith(">")) { // START_ELEMENT
+				int idx = line.indexOf(" ");
+				if (idx == -1) idx = line.indexOf(">"); // no attributes
+				localname = line.substring(1, idx);
+
+				stack.push(localname);
+
+				if (!tagattrs.containsKey(localname))// initialize
+					// HashMaps
+				{
+					tagattrs.put(localname, new HashSet<String>());
+					tagcount.put(localname, 0);
+					tagmax.put(localname, 0);
+				}
+
+				Matcher m = p.matcher(line);
+				while (m.find()) {
+					if (m.groupCount() == 3) {
+						tagattrs.get(localname).add(m.group(2));
+					}
+				}
+
+				int count = tagcount.get(localname);
+				count++;
+				tagcount.put(localname, count);// increment the
+				// recursion counter of the tag
+				int max = tagmax.get(localname);
+				if (max < count)
+					tagmax.put(localname, count);// update max
+				// recursion of the tag
+
+			} else { // WORD LINE
+				if (nWordProps == 0) {
+					//System.out.println("Line: "+line);
+					String[] split = line.split("\t");
+					nWordProps = split.length;
+					//System.out.println("nprops: "+nWordProps);
+				}
+				
+			}
+		} // end while
+		reader.close();
+		return true;
+	}
+
+	/**
+	 * Gets the p attributes.
+	 *
+	 * @return the p attributes
+	 */
+	public Collection<String> getPAttributes() {
+		ArrayList<String> props = new ArrayList<String>();
+		for( int i = 1 ; i < nWordProps ; i++) { // don't count the "word" property
+			props.add("p"+i);
+		}
+		return props;
+	}
+
+	/**
+	 * Gets the s attributes.
+	 *
+	 * @return the s attributes
+	 */
+	public Collection<String> getSAttributes() {
+		ArrayList<String> rez = new ArrayList<String>();
+
+		for (String tag : tagattrs.keySet()) {
+			String s = tag.toLowerCase();
+			s += ":"; //$NON-NLS-1$
+
+			if (tagmax.get(tag) >= 0)
+				s += "" + (tagmax.get(tag) - 1); //$NON-NLS-1$
+
+			for (String attr : tagattrs.get(tag))
+				s += "+" + attr.toLowerCase(); //$NON-NLS-1$
+			rez.add(s);
+		}
+		return rez;
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args) {
+		try {
+			BuildCwbEncodeArgsFromWTC argsgetter = new BuildCwbEncodeArgsFromWTC();
+			argsgetter.process(new File(
+					"/home/mdecorde/xml/wtc/discours.wtc")); //$NON-NLS-1$
+
+			System.out.println("pAttributes : " + argsgetter.getPAttributes()); //$NON-NLS-1$
+			System.out.println("sAttributes : " + argsgetter.getSAttributes()); //$NON-NLS-1$
+		} catch (XMLStreamException e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		} catch (FactoryConfigurationError e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		} catch (IOException e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/importer/cwb/BuildCwbEncodeArgsFromWTC.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/importer/cwb/ReadRegistryFile.groovy
===================================================================
--- tmp/org.txm.core/src/java/org/txm/importer/cwb/ReadRegistryFile.groovy	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/importer/cwb/ReadRegistryFile.groovy	(revision 258)
@@ -0,0 +1,70 @@
+package org.txm.importer.cwb;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashMap;
+
+public class ReadRegistryFile {
+	File registryFile;
+	ArrayList<String> pAttributes;
+	ArrayList<String> sAttributes;
+	HashMap<String, ArrayList<String>> sattrs;
+	
+	public ReadRegistryFile(File registryFile) {
+		this.registryFile = registryFile;
+		read();
+	}
+	
+	public void read() {
+		pAttributes = [];
+		sAttributes = [];
+		sattrs = [:]
+		
+		registryFile.eachLine(System.getProperty("file.encoding")) { line ->
+			line = line.trim(); // remove first tab
+
+			if (line.startsWith("ATTRIBUTE ")) {
+				line = line.substring(10)
+				pAttributes << line
+			} else if (line.startsWith("STRUCTURE ")) {
+				line = line.substring(9)
+				line = line.replaceAll("\\#.*", "")
+				line = line.trim()
+				def split = line.split("_", 2);
+				//println split
+				if (split.length == 1) { // sattr decl
+					sattrs[split[0]] = []
+				} else {
+					sattrs[split[0]] << split[1]
+				}
+			}
+		}
+		
+		for (String sattr : sattrs.keySet()) {
+			String tmp = ""+sattr+":0"
+			for (String attr : sattrs[sattr])
+				tmp += "+"+attr
+			sAttributes << tmp
+		}
+	}
+	
+	public ArrayList<String> getPAttributes() {
+		return pAttributes;
+	}
+	
+	public ArrayList<String> getSAttributes() {
+		return sAttributes;
+	}
+	
+	public def getSAttributesMap() {
+		return sattrs;
+	}
+	
+	public static void main(String[] args) {
+		File registry = new File("/home/matt/xml/wtc/discours");
+		ReadRegistryFile reader = new ReadRegistryFile(registry);
+		System.out.println("pAttributes: "+reader.getPAttributes());
+		System.out.println("sAttributes Map: "+reader.getSAttributesMap());
+		System.out.println("sAttributes: "+reader.getSAttributes());
+	}
+}
Index: tmp/org.txm.core/src/java/org/txm/importer/cwb/CwbEncode.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/importer/cwb/CwbEncode.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/importer/cwb/CwbEncode.java	(revision 258)
@@ -0,0 +1,331 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2016-05-30 16:02:59 +0200 (Mon, 30 May 2016) $
+// $LastChangedRevision: 3220 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer.cwb;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.osgi.util.NLS;
+import org.txm.Toolbox;
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.searchengine.cqp.clientExceptions.ServerNotFoundException;
+import org.txm.stat.utils.ConsoleProgressBar;
+import org.txm.utils.OSDetector;
+import org.txm.utils.io.IOUtils;
+
+// TODO: Auto-generated Javadoc
+/**
+ * This class aims at handling a CQi server process. It is not a CQi server per
+ * se.
+ * 
+ * @author Adrien Yepdieu, mdecorde
+ */
+
+public class CwbEncode extends CwbProcess {
+	/**
+	 * Instantiates a new CQi server.
+	 */
+	public CwbEncode() {
+		super("cwb-encode"); //$NON-NLS-1$
+	}
+
+	/**
+	 * Instantiates a new cwb encode.
+	 *
+	 * @param name the name
+	 */
+	public CwbEncode(String name) {
+		super(name);
+	}
+
+	/**
+	 * * Instantiates a new CQi server.
+	 *
+	 * @param pathToExecutable the path to the executable
+	 * @param pathToData the path to data
+	 * @param inputFile the input file
+	 * @param pathToRegistry the path to the registry
+	 * @param pAttributes the positional attribute
+	 * @param sAttributes the structural atribute
+	 * @return true, if successful
+	 * @throws ServerNotFoundException the server not found exception
+	 * @throws IOException 
+	 * @throws InterruptedException 
+	 */
+	public boolean run(String pathToExecutable, String pathToData,
+			List<File> inputFiles, String pathToRegistry, String[] pAttributes,
+			String[] sAttributes) throws ServerNotFoundException, InterruptedException, IOException {
+		boolean ret = run(pathToExecutable, pathToData, inputFiles,
+				pathToRegistry, pAttributes, sAttributes, false);
+
+		return ret;
+	}
+
+	/**
+	 * * Instantiates a new CQi server.
+	 *
+	 * @param pathToExecutable the path to the executable
+	 * @param pathToData the path to data
+	 * @param inputFile the input file
+	 * @param pathToRegistry the path to the registry
+	 * @param pAttributes the positional attribute
+	 * @param sAttributes the structural atribute
+	 * @return true, if successful
+	 * @throws ServerNotFoundException the server not found exception
+	 * @throws IOException 
+	 * @throws InterruptedException 
+	 */
+	public boolean run(String pathToExecutable, String pathToData,
+			String inputFile, String pathToRegistry, String[] pAttributes,
+			String[] sAttributes) throws ServerNotFoundException, InterruptedException, IOException {
+		boolean ret = run(pathToExecutable, pathToData, inputFile,
+				pathToRegistry, pAttributes, sAttributes, false);
+
+		return ret;
+	}
+
+	/*
+	 * delete all files and directory of the given path
+	 */
+	/**
+	 * Delete dir.
+	 *
+	 * @param dir the dir
+	 * @return true, if successful
+	 */
+	public static boolean deleteDir(File dir) {
+		if (dir.isDirectory()) {
+			String[] children = dir.list();
+			for (int i = 0; i < children.length; i++) {
+				boolean success = deleteDir(new File(dir, children[i]));
+				if (!success) {
+					return false;
+				}
+			}
+		}
+		// The directory is now empty so delete it
+		return dir.delete();
+	}
+
+	public boolean run(String pathToExecutable, String pathToData,
+			String inputFile, String pathToRegistry, String[] pAttributes,
+			String[] sAttributes, boolean monitorOutput)
+					throws ServerNotFoundException, InterruptedException, IOException {
+
+		List<File> inputFiles = Arrays.asList(new File(inputFile));
+
+		return run(pathToExecutable, pathToData, inputFiles, pathToRegistry, pAttributes, sAttributes, monitorOutput);
+	}
+	/**
+	 * execute cwb-encode.
+	 *
+	 * @param pathToExecutable the path to the executable of cwb-encode
+	 * @param pathToData the path to cwb indexes
+	 * @param inputFile the input file
+	 * @param pathToRegistry the path to registry
+	 * @param pAttributes the attributes
+	 * @param sAttributes the s attributes
+	 * @param monitorOutput the monitor output
+	 * @return true, if successful
+	 * @throws ServerNotFoundException the server not found exception
+	 * @throws IOException 
+	 * @throws InterruptedException 
+	 */
+	public boolean run(String pathToExecutable, String pathToData,
+			List<File> inputFiles, String pathToRegistry, String[] pAttributes,
+			String[] sAttributes, boolean monitorOutput)
+					throws ServerNotFoundException, InterruptedException, IOException {
+		File data = new File(pathToData);
+		deleteDir(data);
+		data.mkdirs();
+
+		/*
+		 * if (System.getProperty("os.name").contains("Win")) { pathToExecutable
+		 * = "\""+pathToExecutable+"\""; pathToData = "\""+pathToData+"\"";
+		 * inputFile = "\""+inputFile+"\""; pathToRegistry =
+		 * "\""+pathToRegistry+"\""; }
+		 */
+
+		// Warning !! for WINDOWS ONLY the "" value does not work with the ProcessBuilder we must set the value to "\"\""
+		String empty_value_code = Toolbox.getParam(Toolbox.CQP_EMPTY_VALUE_CODE);
+		if (OSDetector.isFamilyWindows()) {
+			if (empty_value_code == null) empty_value_code = "\"\"";
+			empty_value_code = empty_value_code.trim();
+			if (empty_value_code.length() == 0) empty_value_code = "\"\"";
+		}
+
+		ArrayList<String> cmd = new ArrayList<String>();
+		if (inputFiles != null) { //read input from file
+			cmd.add(pathToExecutable);
+			cmd.add("-d");
+			cmd.add(new File(pathToData).getAbsolutePath()); //$NON-NLS-1$
+			cmd.add("-R"); //$NON-NLS-1$
+			cmd.add(new File(pathToRegistry).getAbsolutePath()); 
+			cmd.add("-U");
+			cmd.add(empty_value_code); //$NON-NLS-1$ //$NON-NLS-2$
+			cmd.add("-c"); //$NON-NLS-1$
+			cmd.add("utf8"); //$NON-NLS-1$ //$NON-NLS-2$
+
+			if (debug) {
+				cmd.add("-D"); //$NON-NLS-1$ 
+			}
+
+			for (File inputFile : inputFiles) { // append "-f path" parameters
+				cmd.add("-f"); //$NON-NLS-1$
+				cmd.add(inputFile.getAbsolutePath());
+			}
+		} else { //read input from stdin
+			String[] c = { pathToExecutable,
+					"-d", new File(pathToData).getAbsolutePath() //$NON-NLS-1$
+					, "-R", new File(pathToRegistry).getAbsolutePath() //$NON-NLS-1$
+					, "-U", empty_value_code //$NON-NLS-1$ //$NON-NLS-2$
+					, "-c", "utf8" //$NON-NLS-1$ //$NON-NLS-2$
+					//, "-x" //$NON-NLS-1$ 
+			}; 
+			cmd.addAll(Arrays.asList(c));
+		}
+
+		cmd.add("-xsB"); //$NON-NLS-1$ //$NON-NLS-2$
+		for (int i = 0; i < pAttributes.length; i++) {
+			cmd.add("-P"); //$NON-NLS-1$
+			// lower case pattributes
+			cmd.addAll(Arrays.asList(pAttributes[i].toLowerCase().split(" "))); //$NON-NLS-1$
+
+		}
+		for (int i = 0; i < sAttributes.length; i++) {
+			cmd.add("-S"); //$NON-NLS-1$
+			// lower case sattributes
+			cmd.addAll(Arrays.asList(sAttributes[i].toLowerCase().split(" "))); //$NON-NLS-1$
+		}
+		// String[] tmp = new String[cmd.length];
+		boolean waitForCWBEncodeToEnd = inputFiles != null;
+		return run(cmd, monitorOutput, waitForCWBEncodeToEnd) && new File(pathToRegistry).exists();
+	}
+
+	/**
+	 * Patch dir.
+	 *
+	 * @param directory the directory
+	 */
+	public static void patchDir(File directory) {
+		File bin = new File(directory, "bin"); //$NON-NLS-1$
+		File registry = new File(directory, "registry"); //$NON-NLS-1$
+		File corpora = new File(directory, "corpora"); //$NON-NLS-1$
+		if (!directory.exists()) {
+			System.err.println(TXMCoreMessages.CwbEncode_0 + directory);
+			return;
+		}
+		if (!bin.exists()) {
+			System.err.println(TXMCoreMessages.CwbEncode_21 + bin);
+			return;
+		}
+		if (!registry.exists()) {
+			System.err.println(TXMCoreMessages.CwbEncode_23 + registry);
+			return;
+		}
+		if (!corpora.exists()) {
+			System.err.println(TXMCoreMessages.CwbEncode_25 + corpora);
+			return;
+		}
+
+		for (File corpus : corpora.listFiles()) {
+			System.out.println(TXMCoreMessages.CwbEncode_27 + corpus.getName());
+			File data = new File(corpus, "data"); //$NON-NLS-1$
+
+			if (!data.exists()) {
+				System.err.println(TXMCoreMessages.CwbEncode_29 + data);
+				return;
+			}
+
+			String datapath = data.getAbsolutePath();
+			String regpath = registry.getAbsolutePath() + "/" + corpus.getName(); //$NON-NLS-1$
+			System.out.println(NLS.bind(TXMCoreMessages.CwbEncode_32, regpath, datapath));
+			try {
+				PatchCwbRegistry.patch(new File(regpath), new File(datapath));
+			} catch (IOException e) {
+				org.txm.utils.logger.Log.printStackTrace(e);
+			}
+		}
+	}
+
+	/**
+	 * concatenates WTC files into one master WTC file and wraps with the 'txmcorpus' structure. 
+	 * 
+	 * @param wtcFiles
+	 * @param allwtcFile
+	 * @return
+	 * @throws IOException
+	 */
+	public static boolean concat(ArrayList<File> wtcFiles, File allwtcFile) throws IOException {
+		PrintWriter output = IOUtils.getWriter(allwtcFile);
+		ConsoleProgressBar cpb = new ConsoleProgressBar(wtcFiles.size());
+
+		output.write("<txmcorpus lang=\"fr\">\n");
+		for (File wtcFile : wtcFiles) {
+			cpb.tick();
+			output.write(IOUtils.getText(wtcFile, "UTF-8"));
+			output.write("\n");
+			output.flush();
+		}
+		output.write("</txmcorpus>\n");
+		output.close();
+		return true;
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args) {
+		// CwbEncode cwbEn = new CwbEncode();
+		// String[] pAttributes = {"pos", "col", "line", "id", "facs", "dipl"};
+		// String[] sAttributes = {"p:0+n", "q:1", "s:0+n+id"};
+		/*
+		 * String[] pAttributes = {"pos", "id", "col"}; String[] sAttributes =
+		 * {"p:0+n", "s:0+n"}; try {//cwbEn.run(
+		 * "/home/ayepdieu/textometrie/trunk/toolbox/src/main/C/cwb-3.0/utils/cwb-encode"
+		 * , "/home/txm/form/data/qgraalcm", "/home/txm/form/wtc/qgraalcm.wtc",
+		 * "/home/txm/form/registry/qgraalcm",pAttributes, sAttributes);
+		 * cwbEn.run(
+		 * "/home/ayepdieu/textometrie/trunk/toolbox/src/main/C/cwb-3.0/utils/cwb-encode"
+		 * , "/home/txm/form/data/qgraalfrmod",
+		 * "/home/txm/form/wtc/qgraalfrmod.wtc",
+		 * "/home/txm/form/registry/qgraalfrmod", pAttributes, sAttributes);
+		 * System.out.println(cwbEn.getErrorStream().toString()); } catch
+		 * (Exception ex) { System.out.println(ex);
+		 * System.out.println(cwbEn.getErrorStream()); }
+		 */
+		CwbEncode.patchDir(new File(
+				"C:/Documents and Settings/H/Mes documents/TXM/cwb")); //$NON-NLS-1$
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/importer/cwb/CwbEncode.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/importer/cwb/CwbProcess.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/importer/cwb/CwbProcess.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/importer/cwb/CwbProcess.java	(revision 258)
@@ -0,0 +1,253 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2016-05-30 16:02:59 +0200 (Mon, 30 May 2016) $
+// $LastChangedRevision: 3220 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer.cwb;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.util.List;
+
+import org.apache.commons.lang.StringUtils;
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.searchengine.cqp.clientExceptions.ServerNotFoundException;
+import org.txm.utils.logger.Log;
+
+// TODO: Auto-generated Javadoc
+/**
+ * This class aims at handling a Cwb process. it uses a java ProcessBuilder
+ * 
+ * @author Adrien Yepdieu
+ */
+
+abstract class CwbProcess {
+
+	/** The debug. */
+	protected boolean debug = false;
+	/** The process. */
+	private Process process;
+
+	/** The name. */
+	private String name;
+
+	/**
+	 * * Instantiates a new Cwb process.
+	 *
+	 */
+	protected CwbProcess() {
+		name = "Cwb_Process"; //$NON-NLS-1$
+	}
+
+	/**
+	 * Instantiates a new cwb process.
+	 *
+	 * @param name the name
+	 */
+	protected CwbProcess(String name) {
+		this.name = name;
+	}
+
+	/**
+	 * Sets the debug.
+	 *
+	 * @param b the new debug
+	 */
+	public void setDebug(boolean b) {
+		this.debug = b;
+	}
+
+	/**
+	 * * run the command in cmd.
+	 *
+	 * @param cmd the cmd to be execute by the process
+	 * @param monitorOutput the monitor output
+	 * @return true, if successful
+	 * @throws ServerNotFoundException the server not found exception
+	 * @throws InterruptedException 
+	 * @throws IOException 
+	 */
+	protected boolean run(List<String> cmd, boolean monitorOutput, boolean waitFor)
+			throws ServerNotFoundException, InterruptedException, IOException {
+		Log.info(TXMCoreMessages.CwbProcess_1 + StringUtils.join(cmd, " ")); //$NON-NLS-1$ 
+		//System.out.println(StringUtils.join(cmd, " "));
+		for (String s : cmd) {
+			//System.out.println("s="+s);
+			if (s == null) {
+				System.out.println("ERROR null arg parameter: "+cmd);
+				return false;
+			}
+		}
+		ProcessBuilder processBuilder = new ProcessBuilder(cmd);
+		processBuilder.redirectErrorStream(true);
+		this.process = processBuilder.start();
+
+		final InputStream is = process.getInputStream();
+		new Thread() {
+			@Override
+			public void run() {
+				if (debug) System.out.println("Start logging "+name+" process...");
+				try {
+					InputStreamReader isr = new InputStreamReader(is);
+					BufferedReader br = new BufferedReader(isr);
+					String line;
+					while ((line = br.readLine()) != null) {
+						if (debug)
+							System.out.println(line);
+					}
+					isr.close();
+					if (debug) System.out.println("End of "+name+" process logs.");
+				} catch (IOException e) {
+					e.printStackTrace();
+				}
+			}
+		}.start();
+
+		if (waitFor) {
+			Log.warning("Waiting for end of process: "+name);
+			endProcess();
+		}
+		
+		return true;
+	}
+	
+	public void endProcess() throws InterruptedException {
+		this.process.waitFor();
+
+		int scount = 0;
+		do {
+			Thread.sleep(10);
+			scount++;
+		} while (isRunning() && scount <= 5);
+		this.process.destroy();
+	}
+
+	public OutputStream getOutPutStream() {
+		if (process == null)  return null;
+		return process.getOutputStream();
+	}
+
+	/**
+	 * Stop the cwb process.
+	 */
+	public void stop() {
+		Log.finest(TXMCoreMessages.CwbProcess_3 + name.toUpperCase());
+		this.process.destroy();
+		Log.finest(TXMCoreMessages.CwbProcess_4+name.toUpperCase());
+	}
+
+	/**
+	 * Checks if the process is running.
+	 * 
+	 * @return true, if is running
+	 */
+	public boolean isRunning() {
+		try {
+			if (this.process.exitValue() == 0)
+				return true;
+			// this throws an IllegalThreadStateException if the process is
+			// running
+			// The IllegalThreadStateException has not been thrown, the process
+			// is not running.
+			// false;
+			return false;
+		} catch (IllegalThreadStateException e) {
+			// The IllegalThreadStateException has been thrown, all good.
+			return true;
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Object#finalize()
+	 */
+	@Override
+	protected void finalize() throws Throwable {
+		try {
+			this.stop();
+		} finally {
+			super.finalize();
+		}
+	}
+
+	/**
+	 * Wait for.
+	 *
+	 * @return the int
+	 * @throws InterruptedException the interrupted exception
+	 */
+	public int waitFor() throws InterruptedException {
+		return this.process.waitFor();
+	}
+
+	/**
+	 * Gets the error stream.
+	 *
+	 * @return the error stream
+	 */
+	public InputStream getErrorStream() {
+		return process.getErrorStream();
+	}
+
+	/**
+	 * Gets the input stream.
+	 *
+	 * @return the input stream
+	 */
+	public InputStream getInputStream() {
+		return process.getInputStream();
+	}
+
+	/**
+	 * Gets the output stream.
+	 *
+	 * @return the output stream
+	 */
+	public OutputStream getOutputStream() {
+		return process.getOutputStream();
+	}
+
+	/**
+	 * Gets the CWB binaries location.
+	 *
+	 * @return the cWB location
+	 */
+	public static String getCWBLocation()
+	{
+		String cwbLoc = org.txm.Toolbox.getParam(org.txm.Toolbox.CQI_SERVER_PATH_TO_CQPLIB)+File.separator;
+
+		if (!new File(cwbLoc).exists()) {
+			System.out.println(TXMCoreMessages.CwbProcess_5+cwbLoc);
+			return null;
+		}
+
+		return cwbLoc;
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/importer/cwb/CwbProcess.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/importer/cwb/package.html
===================================================================
--- tmp/org.txm.core/src/java/org/txm/importer/cwb/package.html	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/importer/cwb/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>CWB utils. Wraps cwb-encode and cwb-makeall</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/java/org/txm/importer/cwb/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/importer/cwb/CwbDecode.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/importer/cwb/CwbDecode.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/importer/cwb/CwbDecode.java	(revision 258)
@@ -0,0 +1,598 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer.cwb;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Locale;
+import java.text.DateFormat;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+
+// Decode CWB indexes
+/**
+ * The Class CwbDecode.
+ */
+public class CwbDecode {
+
+	/** The binpath. */
+	String binpath = "";
+
+	/**
+	 * Instantiates a new cwb decode.
+	 *
+	 * @param binpath the binpath
+	 */
+	public CwbDecode(String binpath) {
+		this.binpath = binpath;
+	}
+
+	/** The version. */
+	String version = "0.0.0";
+
+	/** The desc. */
+	String desc = "Decode CWB indexes";
+
+	/** The debug. */
+	boolean debug = false;
+
+	/**
+	 * Debug.
+	 *
+	 * @param b the b
+	 */
+	public void debug(boolean b) {
+		debug = b;
+	};
+
+	// Lisp output mode
+
+	/** The is l. */
+	private Boolean isL = false;
+
+	/**
+	 * Sets the l.
+	 */
+	public void setL() {
+		this.isL = true;
+	}
+
+	/**
+	 * Unset l.
+	 */
+	public void unsetL() {
+		this.isL = false;
+	}
+
+	// concordance line ('horizonta'l) output mode
+
+	/** The is h. */
+	private Boolean isH = false;
+
+	/**
+	 * Sets the h.
+	 */
+	public void setH() {
+		this.isH = true;
+	}
+
+	/**
+	 * Unset h.
+	 */
+	public void unsetH() {
+		this.isH = false;
+	}
+
+	// compact output mode (suitable for encode)
+
+	/** The is c. */
+	private Boolean isC = false;
+
+	/**
+	 * Sets the c.
+	 */
+	public void setC() {
+		this.isC = true;
+	}
+
+	/**
+	 * Unset c.
+	 */
+	public void unsetC() {
+		this.isC = false;
+	}
+
+	// XML-compatible compact output (for {encode -x ...}))
+
+	/** The is cx. */
+	private Boolean isCx = false;
+
+	/**
+	 * Sets the cx.
+	 */
+	public void setCx() {
+		this.isCx = true;
+	}
+
+	/**
+	 * Unset cx.
+	 */
+	public void unsetCx() {
+		this.isCx = false;
+	}
+
+	// XML output mode
+
+	/** The is x. */
+	private Boolean isX = false;
+
+	/**
+	 * Sets the x.
+	 */
+	public void setX() {
+		this.isX = true;
+	}
+
+	/**
+	 * Unset x.
+	 */
+	public void unsetX() {
+		this.isX = false;
+	}
+
+	// show corpus position ('numbers')
+
+	/** The isn. */
+	private Boolean isn = false;
+
+	/**
+	 * Setn.
+	 */
+	public void setn() {
+		this.isn = true;
+	}
+
+	/**
+	 * Unsetn.
+	 */
+	public void unsetn() {
+		this.isn = false;
+	}
+
+	// first token to print (at corpus position {n})
+
+	/** The iss. */
+	private Boolean iss = false;
+
+	/** The s. */
+	private int s;
+
+	/**
+	 * Sets the s.
+	 *
+	 * @param arg the new s
+	 */
+	public void sets(int arg) {
+		this.iss = true;
+		this.s = arg;
+	}
+
+	/**
+	 * Unsets.
+	 */
+	public void unsets() {
+		this.iss = false;
+	}
+
+	// last token to print (at corpus position {n})
+
+	/** The ise. */
+	private Boolean ise = false;
+
+	/** The e. */
+	private int e;
+
+	/**
+	 * Sets the e.
+	 *
+	 * @param arg the new e
+	 */
+	public void sete(int arg) {
+		this.ise = true;
+		this.e = arg;
+	}
+
+	/**
+	 * Unsete.
+	 */
+	public void unsete() {
+		this.ise = false;
+	}
+
+	// set registry directory
+
+	/** The isr. */
+	private Boolean isr = false;
+
+	/** The r. */
+	private String r;
+
+	/**
+	 * Sets the r.
+	 *
+	 * @param arg the new r
+	 */
+	public void setr(String arg) {
+		this.isr = true;
+		this.r = arg;
+	}
+
+	/**
+	 * Unsetr.
+	 */
+	public void unsetr() {
+		this.isr = false;
+	}
+
+	// matchlist mode (input from stdin)
+
+	/** The isp. */
+	private Boolean isp = false;
+
+	/**
+	 * Setp.
+	 */
+	public void setp() {
+		this.isp = true;
+	}
+
+	/**
+	 * Unsetp.
+	 */
+	public void unsetp() {
+		this.isp = false;
+	}
+
+	// matchlist mode (input from {file})
+
+	/** The isf. */
+	private Boolean isf = false;
+
+	/** The f. */
+	private String f;
+
+	/**
+	 * Sets the f.
+	 *
+	 * @param arg the new f
+	 */
+	public void setf(String arg) {
+		this.isf = true;
+		this.f = arg;
+	}
+
+	/**
+	 * Unsetf.
+	 */
+	public void unsetf() {
+		this.isf = false;
+	}
+
+	// this help page
+
+	/** The ish. */
+	private Boolean ish = false;
+
+	/**
+	 * Seth.
+	 */
+	public void seth() {
+		this.ish = true;
+	}
+
+	/**
+	 * Unseth.
+	 */
+	public void unseth() {
+		this.ish = false;
+	}
+
+	// print p-attribute {att}
+
+	/** The is p. */
+	private Boolean isP = false;
+
+	/** The P. */
+	private List<String> P;
+
+	/**
+	 * Sets the p.
+	 *
+	 * @param arg the new p
+	 */
+	public void setP(List<String> arg) {
+		this.isP = true;
+		this.P = arg;
+	}
+
+	/**
+	 * Unset p.
+	 */
+	public void unsetP() {
+		this.isP = false;
+	}
+
+	// print s-attribute {att} (possibly including annotations)
+
+	/** The is s. */
+	private Boolean isS = false;
+
+	/** The S. */
+	private List<String> S;
+
+	/**
+	 * Sets the s.
+	 *
+	 * @param arg the new s
+	 */
+	public void setS(List<String> arg) {
+		this.isS = true;
+		this.S = arg;
+	}
+
+	/**
+	 * Unset s.
+	 */
+	public void unsetS() {
+		this.isS = false;
+	}
+
+	// show s-attribute annotation for each range in matchlist mode
+
+	/** The is v. */
+	private Boolean isV = false;
+
+	/** The V. */
+	private List<String> V;
+
+	/**
+	 * Sets the v.
+	 *
+	 * @param arg the new v
+	 */
+	public void setV(List<String> arg) {
+		this.isV = true;
+		this.V = arg;
+	}
+
+	/**
+	 * Unset v.
+	 */
+	public void unsetV() {
+		this.isV = false;
+	}
+
+	// print alignment attribute {att}
+
+	/** The is a. */
+	private Boolean isA = false;
+
+	/** The A. */
+	private List<String> A;
+
+	/**
+	 * Sets the a.
+	 *
+	 * @param arg the new a
+	 */
+	public void setA(List<String> arg) {
+		this.isA = true;
+		this.A = arg;
+	}
+
+	/**
+	 * Unset a.
+	 */
+	public void unsetA() {
+		this.isA = false;
+	}
+
+	// print all p-attributes and s-attributes
+
+	/** The is all. */
+	private Boolean isALL = false;
+
+	/**
+	 * Sets the all.
+	 */
+	public void setALL() {
+		this.isALL = true;
+	}
+
+	/**
+	 * Unset all.
+	 */
+	public void unsetALL() {
+		this.isALL = false;
+	}
+
+	// expand ranges to full {att} region (matchlist mode)
+
+	/** The isc. */
+	private Boolean isc = false;
+
+	/** The c. */
+	private String c;
+
+	/**
+	 * Sets the c.
+	 *
+	 * @param arg the new c
+	 */
+	public void setc(String arg) {
+		this.isc = true;
+		this.c = arg;
+	}
+
+	/**
+	 * Unsetc.
+	 */
+	public void unsetc() {
+		this.isc = false;
+	}
+
+	String[] options;
+	public void setAdditionalOptions(String[] options) {
+		this.options = options;
+	}
+
+	/**
+	 * Cwbdecode.
+	 *
+	 * @param corpus the corpus
+	 */
+	public void cwbdecode(String corpus) throws IOException
+	// arg : corpus name
+	{
+		ArrayList<String> args = new ArrayList<String>();
+		if(System.getProperty("os.name").contains("Windows")) {
+			args.add(binpath + "cwb-decode.exe");	
+		} else {
+			args.add(binpath + "cwb-decode");
+		}
+		if (isL)
+			args.add("-L");
+		if (isH)
+			args.add("-H");
+		if (isC)
+			args.add("-C");
+		if (isCx)
+			args.add("-Cx");
+		if (isX)
+			args.add("-X");
+		if (isn)
+			args.add("-n");
+		if (iss) {
+			args.add("-s");
+			args.add("" + s);
+		}
+		if (ise) {
+			args.add("-e");
+			args.add("" + e);
+		}
+		if (isr) {
+			args.add("-r");
+			args.add("" + r);
+		}
+		if (isp)
+			args.add("-p");
+		if (isf) {
+			args.add("-f");
+			args.add("" + f);
+		}
+		args.add("" + corpus);
+		if (ish)
+			args.add("-h");
+		if (isP)
+			for (int c = 0; c < P.size(); c++) {
+				args.add("-P");
+				args.add("" + P.get(c));
+			}
+		if (isS)
+			for (int c = 0; c < S.size(); c++) {
+				args.add("-S");
+				args.add("" + S.get(c));
+			}
+		if (isV)
+			for (int c = 0; c < V.size(); c++) {
+				args.add("-V");
+				args.add("" + V.get(c));
+			}
+		if (isA)
+			for (int c = 0; c < A.size(); c++) {
+				args.add("-A");
+				args.add("" + A.get(c));
+			}
+		if (isALL)
+			args.add("-ALL");
+		if (isc) {
+			args.add("-c");
+			args.add("" + c);
+		}
+
+		if (options != null) {
+			for (String opt : options) {
+				args.add(opt);
+			}
+		}
+
+		ProcessBuilder pb = new ProcessBuilder(args);
+		pb.redirectErrorStream(false);
+		Process process = null;
+		try {
+			process = pb.start();
+		} catch (IOException e) {
+			System.err.println(e);
+		}
+		InputStream is = process.getInputStream();
+		InputStreamReader isr = new InputStreamReader(is);
+		BufferedReader br = new BufferedReader(isr);
+		String line;
+		while ((line = br.readLine()) != null) {
+			System.out.println(line);
+		}
+		int e = 0;
+		try {
+			e = process.waitFor();
+		} catch (Exception err) {
+		}
+		if (e != 0) {
+			System.err.println("Process exited abnormally with code "
+					+ e
+					+ " at "
+					+ DateFormat.getDateInstance(DateFormat.FULL, Locale.UK)
+					.format(new Date()));
+
+			for (int c = 0; c < args.size(); c++)
+				System.out.print("" + args.get(c) + " ");
+			System.out.println();
+		}
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args) {
+		CwbDecode tt = new CwbDecode("");
+	}
+}
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/java/org/txm/importer/cwb/CwbDecode.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/importer/cwb/FixMilestoneDeclarations.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/importer/cwb/FixMilestoneDeclarations.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/importer/cwb/FixMilestoneDeclarations.java	(revision 258)
@@ -0,0 +1,122 @@
+package org.txm.importer.cwb;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+
+/**
+ * Remove milestone declarations and index files. Milestones are empty structures that cannot be used with CQL
+ * 
+ * @author mdecorde
+ *
+ */
+public class FixMilestoneDeclarations {
+	File registryFile;
+	File dataDirectory;
+	boolean debug = false;
+	
+	public static final String[] exts = { ".avs", ".avx", ".rng"};
+
+	public FixMilestoneDeclarations(File registryFile, File dataDirectory) {
+		this.registryFile = registryFile;
+		this.dataDirectory = dataDirectory;
+	}
+
+	
+	public boolean process() throws IOException {
+		if (!dataDirectory.exists()) return false;
+		if (!registryFile.exists()) return false;
+
+		// get structural units and their properties
+		ArrayList<String> structures = new ArrayList<String>();
+		HashMap<String, ArrayList<String>> structureAttributes = new HashMap<String, ArrayList<String>>();
+		BufferedReader reader = new BufferedReader(new FileReader(registryFile));
+		String line = reader.readLine();
+		String structure = "";
+		while (line != null) {
+
+			if (line.startsWith("STRUCTURE ")) {
+				if ( !line.contains("_")) {
+					structure = line.substring(10);
+					structures.add(structure);
+					structureAttributes.put(structure, new ArrayList<String>());
+				} else {
+					line = line.replaceAll("[ ]+# \\[annotations\\]", "");
+					structureAttributes.get(structure).add(line.substring(10));
+				}
+
+			}
+			line = reader.readLine();
+		}
+		reader.close();
+		if (debug) System.out.println("Structures: "+structures);
+
+		File[] files = dataDirectory.listFiles();
+		if (files == null) return false;
+
+		//removing empty data files
+		ArrayList<String> linesToRemove = new ArrayList<String>();
+		for (String s : structures) {
+			File f = new File(dataDirectory, s+".rng");
+
+			if (f.exists() && f.length() == 0) {
+				if (debug) System.out.println("Milestone detected : "+s);
+				f.delete();
+				linesToRemove.add(s);
+
+				if (debug) System.out.println("Removing files: "+structureAttributes.get(s));
+				for (String attribute : structureAttributes.get(s)) {
+					linesToRemove.add(attribute);
+					for (String ext : exts) {
+						new File(dataDirectory, attribute+ext).delete();
+					}
+				}
+				continue;
+			}
+
+			if (!f.exists()) {
+				if (debug) System.out.println("Structure "+s+" RNG file is missing: "+f);
+				linesToRemove.add(s);
+			}
+		}
+
+		// remove structure declarations
+		if (debug) System.out.println("Attributes to remove from registry files: "+linesToRemove);
+		reader = new BufferedReader(new FileReader(registryFile));
+		File registryFile_tmp = new File(registryFile.getAbsolutePath()+".tmp");
+		BufferedWriter writer = new BufferedWriter(new FileWriter(registryFile_tmp));
+		line = reader.readLine();
+		while (line != null) {
+			
+			if (line.startsWith("STRUCTURE ")) {
+				
+				structure = line.substring(10).replaceAll("[ ]+# \\[annotations\\]", "");
+				if (linesToRemove.contains(structure)) {
+					if (debug) System.out.println("Remove line: "+line);
+					// don't write attribute line
+				} else {
+					writer.write(line+"\n");
+				}
+			} else {
+				writer.write(line+"\n");
+			}
+			line = reader.readLine();
+		}
+		reader.close();
+		writer.close();
+
+		return (registryFile.delete() && registryFile_tmp.renameTo(registryFile));
+	}
+
+	public static void main(String args[]) throws IOException {
+		File registryFile = new File("/home/mdecorde/TXM/corpora/BAIP/registry/baip");
+		File dataDirectory = new File("/home/mdecorde/TXM/corpora/BAIP/data/BAIP");
+		FixMilestoneDeclarations fm = new FixMilestoneDeclarations(registryFile, dataDirectory);
+		System.out.println("Result: "+fm.process());
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/importer/cwb/FixMilestoneDeclarations.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/importer/cwb/BuildAlignOut.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/importer/cwb/BuildAlignOut.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/importer/cwb/BuildAlignOut.java	(revision 258)
@@ -0,0 +1,95 @@
+package org.txm.importer.cwb;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+
+import org.txm.utils.io.IOUtils;
+/**
+ * Create the CWB "align.out" file usually created with cwb-align using 2 WTC files. The alignement structure and property is not checked. Only structure order is used.
+ * 
+ * @author mdecorde
+ *
+ */
+public class BuildAlignOut {
+	
+	File wtcFile1;
+	File wtcFile2;
+	
+	public BuildAlignOut(File wtcFile1, File wtcFile2) {
+		this.wtcFile1 = wtcFile1;
+		this.wtcFile2 = wtcFile2;
+	}
+	
+	public boolean process(File alignOutFile, String su, String sup) throws IOException {
+		
+		ArrayList<Integer> positions1 = getWordPositions(wtcFile1, su, sup);
+		ArrayList<Integer> positions2 = getWordPositions(wtcFile2, su, sup);
+		
+		if (positions1.size() != positions2.size()) {
+			System.out.println("Error: the number of segment differs. "+positions1.size()+" in "+wtcFile1+" and "+positions2.size()+" in "+wtcFile2);
+			return false;
+		}
+		
+		System.out.println("Writing "+alignOutFile.getName()+" with "+positions1.size()+" positions.");
+		String encoding = "UTF-8";
+		PrintWriter writer = IOUtils.getWriter(alignOutFile, encoding);
+		
+		String c1 = wtcFile1.getName().toLowerCase();
+		c1 = c1.substring(0, c1.length()-4);
+		String c2 = wtcFile2.getName().toLowerCase();
+		c2 = c2.substring(0, c2.length()-4);
+		
+		writer.println(c1+"\t"+su+"\t"+c2+"\t"+su);
+		for (int i = 0 ; i < positions1.size() ; i = i+2) {
+			writer.println(""+positions1.get(i)+"\t"+positions1.get(i+1)+"\t"+positions2.get(i)+"\t"+positions2.get(i+1)+"\t1:1\t42");
+		}
+		writer.close();
+		
+		return true;
+	}
+
+	private static ArrayList<Integer> getWordPositions(File wtcFile, String su,
+			String sup) throws IOException {
+		
+		BufferedReader reader = IOUtils.getReader(wtcFile);
+		int position_counter = 0;
+		ArrayList<Integer> positions1 = new ArrayList<Integer>();
+		
+		String pattern = " "+sup+"=\"";
+		String line = reader.readLine();
+		while (line != null) {
+			if (line.startsWith("<"+su) && line.contains(pattern)) {
+				// align structure !
+				positions1.add(position_counter);
+			} else if (line.startsWith("</"+su+">")) {
+				// align structure !
+				positions1.add(position_counter-1);
+			}  else if (line.startsWith("<")) {
+				// structure !
+			} else if (line.length() == 0) {
+				// empty line
+			} else { // word line
+				//System.out.println("WORD: "+line);
+				position_counter++;
+			}
+			line = reader.readLine();
+		}
+		return positions1;
+	}
+	
+	public static void main(String args[]) throws IOException {
+		
+//		PatchCwbRegistry.patchAlignment(new File("/home/mdecorde/TEMP/align/registry", "c1"), "c2");
+//		PatchCwbRegistry.patchAlignment(new File("/home/mdecorde/TEMP/align/registry", "c2"), "c1");
+		
+		File wtcFile1 = new File("/home/mdecorde/TXM/corpora/SAMPLE/wtc/SAMPLE_en0.wtc");
+		File wtcFile2 = new File("/home/mdecorde/TXM/corpora/SAMPLE/wtc/SAMPLE_fr3.wtc");
+		File alignOutFile = new File("/home/mdecorde/TXM/corpora/SAMPLE/align.out");
+		
+		BuildAlignOut bao = new BuildAlignOut(wtcFile1, wtcFile2);
+		System.out.println("Result: "+bao.process(alignOutFile, "seg", "id"));
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/importer/cwb/BuildAlignOut.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/importer/cwb/CwbMakeAll.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/importer/cwb/CwbMakeAll.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/importer/cwb/CwbMakeAll.java	(revision 258)
@@ -0,0 +1,122 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2016-05-26 17:42:36 +0200 (Thu, 26 May 2016) $
+// $LastChangedRevision: 3219 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer.cwb;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+
+import org.txm.searchengine.cqp.clientExceptions.ServerNotFoundException;
+
+// TODO: Auto-generated Javadoc
+/**
+ * This class aims at handling a Cwb Make All.
+ * 
+ * @author Adrien Yepdieu
+ */
+public class CwbMakeAll extends CwbProcess {
+
+	/**
+	 * Instantiates a new cwb make all.
+	 */
+	public CwbMakeAll() {
+		super("cwb-makeall"); //$NON-NLS-1$
+	}
+
+	/**
+	 * Instantiates a new cwb make all.
+	 *
+	 * @param name the name
+	 */
+	public CwbMakeAll(String name) {
+		super(name);
+	}
+
+	/**
+	 * * Instantiates a new Cwb Make All.
+	 *
+	 * @param pathToExecutable the path to the executable
+	 * @param corpusName the corpus name
+	 * @param pathToRegistry the path to the registry
+	 * @return true, if successful
+	 * @throws ServerNotFoundException the server not found exception
+	 * @throws IOException 
+	 * @throws InterruptedException 
+	 */
+	public boolean run(String pathToExecutable, String corpusName,
+			String pathToRegistry) throws ServerNotFoundException, InterruptedException, IOException {
+		return run(pathToExecutable, corpusName, pathToRegistry, false);
+	}
+
+	/**
+	 * execute cwb-makeall.
+	 *
+	 * @param pathToExecutable path to cwb-makeall executable
+	 * @param corpusName the corpus name you want to build
+	 * @param pathToRegistry path to the directory which contains the corpus registry file
+	 * @param monitorOutput show output messages or not
+	 * @return true, if successful
+	 * @throws ServerNotFoundException the server not found exception
+	 * @throws IOException 
+	 * @throws InterruptedException 
+	 */
+	public boolean run(String pathToExecutable, String corpusName,
+			String pathToRegistry, boolean monitorOutput)
+			throws ServerNotFoundException, InterruptedException, IOException {
+		if (System.getProperty("os.name").contains("Win")) //$NON-NLS-1$ //$NON-NLS-2$
+		{
+			pathToExecutable = "\"" + pathToExecutable + "\""; //$NON-NLS-1$ //$NON-NLS-2$
+			pathToRegistry = "\"" + pathToRegistry + "\""; //$NON-NLS-1$ //$NON-NLS-2$
+		}
+		ArrayList<String> cmd = new ArrayList<String>();
+		cmd.addAll(Arrays.asList(pathToExecutable,
+				"-r", pathToRegistry, "-V", corpusName.toUpperCase())); //$NON-NLS-1$ //$NON-NLS-2$
+		if (debug) {
+			cmd.add(1, "-D"); //$NON-NLS-1$ //$NON-NLS-2$
+		}
+		return run(cmd, monitorOutput, true); // always wait for cwb-makeall to end
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args) {
+		CwbMakeAll cwbMa = new CwbMakeAll();
+		try {
+			// cwbMa.run("/home/ayepdieu/textometrie/trunk/toolbox/src/main/C/cwb-3.0/utils/cwb-makeall",
+			// "QGRAALCM", "/home/txm/form/registry");
+			cwbMa.run("/home/ayepdieu/textometrie/trunk/toolbox/src/main/C/cwb-3.0/utils/cwb-makeall", "QGRAALFRMOD", "/home/txm/form/registry"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+			// System.out.println(cwbMa.getErrorStream().toString());
+		} catch (Exception ex) {
+			System.out.println(ex);
+			// System.out.println(cwbMa.getErrorStream());
+		}
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/importer/cwb/CwbMakeAll.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/importer/cwb/PatchCwbRegistry.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/importer/cwb/PatchCwbRegistry.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/importer/cwb/PatchCwbRegistry.java	(revision 258)
@@ -0,0 +1,343 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2016-05-24 10:43:03 +0200 (Tue, 24 May 2016) $
+// $LastChangedRevision: 3216 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer.cwb;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.utils.logger.Log;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class PatchCwbRegistry.
+ */
+public class PatchCwbRegistry {
+	
+	/**
+	 * Patch.
+	 *
+	 * @param registryfile the file to patch
+	 * @param datadir the directory containing the cwb index
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 */
+	public static void patch(File registryfile, File datadir)
+			throws IOException {
+		//String corpus = registryfile.getName();
+		
+		// HOME INFO
+		File temp = File.createTempFile("temp", ".registry", registryfile.getParentFile()); //$NON-NLS-1$ //$NON-NLS-2$
+		
+		String encoding = "UTF-8"; //$NON-NLS-1$
+		//if (OSDetector.isFamilyWindows()) encoding = "ISO-8859-1"; //$NON-NLS-1$
+		BufferedReader reader = new BufferedReader(new InputStreamReader(
+				new FileInputStream(registryfile), encoding));
+		OutputStreamWriter writer = new OutputStreamWriter(
+				new FileOutputStream(temp), encoding);
+
+		String line = reader.readLine();
+		while (line != null) {
+			//System.out.println("LINE: "+line);
+			if (line.startsWith("HOME")) //$NON-NLS-1$
+				writer.write("HOME \"" + datadir + "\"\n"); //$NON-NLS-1$ //$NON-NLS-2$
+			else if (line.startsWith("INFO")) //$NON-NLS-1$
+				writer.write("INFO \"" + datadir + "/.info\"\n"); //$NON-NLS-1$ //$NON-NLS-2$
+			else
+				writer.write(line + "\n"); //$NON-NLS-1$
+			line = reader.readLine();
+		}
+		writer.close();
+		reader.close();
+		
+		registryfile.delete();
+		
+//		System.out.println("TMP file: "+temp);
+//		System.out.println("TMP file exists?: "+temp.exists());
+//		System.out.println("REG file exists?: "+registryfile.exists());
+		if (registryfile.exists()) {
+			System.out.println("ERROR: old registry path still exists. Result in "+temp);
+		} else {
+			temp.renameTo(registryfile);
+		}
+		
+//		System.out.println("TMP file exists?: "+temp.exists());
+//		System.out.println("REG file exists?: "+registryfile.exists());
+	}
+
+	/**
+	 * Change the encoding value.
+	 *
+	 * @param registryfile the registry file to patch
+	 * @param corpusEncoding the new encoding value
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 */
+	public static void patchEncoding(File registryfile, String corpusEncoding)
+			throws IOException {
+		String corpus = registryfile.getName();
+
+		// HOME INFO
+		File temp = File.createTempFile("temp", ".regsitry", registryfile.getParentFile()); //$NON-NLS-1$ //$NON-NLS-2$
+
+		String encoding = "UTF-8"; //$NON-NLS-1$
+		//if (OSDetector.isFamilyWindows()) encoding = "ISO-8859-1"; //$NON-NLS-1$
+		BufferedReader reader = new BufferedReader(new InputStreamReader(
+				new FileInputStream(registryfile), encoding));
+		OutputStreamWriter writer = new OutputStreamWriter(
+				new FileOutputStream(temp), encoding);
+
+		if (corpusEncoding.startsWith("ISO") || corpusEncoding.startsWith("iso")) { //$NON-NLS-1$ //$NON-NLS-2$
+			corpusEncoding = "latin" + corpusEncoding.substring(9);//remove iso-8859- //$NON-NLS-1$
+		}
+		corpusEncoding = corpusEncoding.toLowerCase();
+
+		Log.info(TXMCoreMessages.PatchCwbRegistry_2 + corpus
+				+ TXMCoreMessages.PatchCwbRegistry_23 + corpusEncoding);
+		String line = reader.readLine();
+		while (line != null) {
+			if (line.startsWith("##:: charset") || line.startsWith("charset")) { //$NON-NLS-1$ //$NON-NLS-2$
+				writer.write("charset = \"" + corpusEncoding + "\" # change if your corpus uses dif ferent charset : latin1, latin2 ... utf-8\n"); //$NON-NLS-1$ //$NON-NLS-2$
+			} else {
+				writer.write(line + "\n"); //$NON-NLS-1$
+			}
+			line = reader.readLine();
+		}
+		writer.close();
+		reader.close();
+		registryfile.delete();
+		temp.renameTo(registryfile);
+	}
+	
+	/**
+	 * Change the language value.
+	 *
+	 * @param registryfile the registry file to patch
+	 * @param corpusLanguage the new language value
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 */
+	public static void patchLanguage(File registryfile, String corpusLanguage)
+			throws IOException {
+		String corpus = registryfile.getName();
+
+		// HOME INFO
+		File temp = File.createTempFile("temp", ".regsitry", registryfile.getParentFile()); //$NON-NLS-1$ //$NON-NLS-2$
+
+		String encoding = "UTF-8"; //$NON-NLS-1$
+		//if (OSDetector.isFamilyWindows()) encoding = "ISO-8859-1"; //$NON-NLS-1$
+		BufferedReader reader = new BufferedReader(new InputStreamReader(
+				new FileInputStream(registryfile), encoding));
+		OutputStreamWriter writer = new OutputStreamWriter(
+				new FileOutputStream(temp), encoding);
+
+		corpusLanguage = corpusLanguage.toLowerCase();
+		Log.info(TXMCoreMessages.PatchCwbRegistry_34 + corpus
+				+ TXMCoreMessages.PatchCwbRegistry_35 + corpusLanguage);
+		String line = reader.readLine();
+		while (line != null) {
+			if (line.startsWith("##:: language") || line.startsWith("language")) { //$NON-NLS-1$ //$NON-NLS-2$
+				writer.write("language = \"" + corpusLanguage + "\" # insert ISO code for language (de, en, fr, ...)\n"); //$NON-NLS-1$ //$NON-NLS-2$
+			} else {
+				writer.write(line + "\n"); //$NON-NLS-1$
+			}
+			line = reader.readLine();
+		}
+		writer.close();
+		reader.close();
+		registryfile.delete();
+		temp.renameTo(registryfile);
+	}
+
+	/**
+	 * Add the ALIGNED <corpus> line to a registry file.
+	 *
+	 * @param registryfile the registry file to patch
+	 * @param targetcorpus the aligned corpus
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 */
+	public static boolean patchAlignment(File registryfile, String targetcorpus)
+			throws IOException {
+		targetcorpus = targetcorpus.toLowerCase();
+		String corpus = registryfile.getName();
+
+		if (!new File(registryfile.getParent(), targetcorpus).exists()) {
+			System.out.println(TXMCoreMessages.PatchCwbRegistry_3+" : "+new File(registryfile.getParent(), targetcorpus)); //$NON-NLS-1$
+			return false;
+		}
+		if (!registryfile.exists()) {
+			System.out.println(TXMCoreMessages.PatchCwbRegistry_13+registryfile.getAbsolutePath());
+			return false;
+		}
+		boolean alignmentwritten = false;
+		// HOME INFO
+		File temp = File.createTempFile("temp", ".registry", registryfile.getParentFile()); //$NON-NLS-1$ //$NON-NLS-2$
+
+		String encoding = "UTF-8"; //$NON-NLS-1$
+		//if (OSDetector.isFamilyWindows()) encoding = "ISO-8859-1"; //$NON-NLS-1$
+		BufferedReader reader = new BufferedReader(new InputStreamReader(
+				new FileInputStream(registryfile), encoding));
+		OutputStreamWriter writer = new OutputStreamWriter(
+				new FileOutputStream(temp), encoding);
+
+		Log.info(TXMCoreMessages.PatchCwbRegistry_4 + corpus
+				+ TXMCoreMessages.PatchCwbRegistry_5 + targetcorpus);
+		String line = reader.readLine();
+		while (line != null) {
+			if (line.startsWith("ALIGNED " + targetcorpus)) { //$NON-NLS-1$
+				alignmentwritten = true;
+				writer.write(line + "\n"); //$NON-NLS-1$
+			} else if (line.startsWith("# Yours sincerely, the Encode tool.")) { //$NON-NLS-1$
+				if (!alignmentwritten) {
+					writer.write("ALIGNED " + targetcorpus + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
+					alignmentwritten = true;
+				}
+				writer.write("# Yours sincerely, the Encode tool."); //$NON-NLS-1$
+			} else {
+				writer.write(line + "\n"); //$NON-NLS-1$
+			}
+			line = reader.readLine();
+		}
+
+		writer.close();
+		reader.close();
+		return registryfile.delete() && temp.renameTo(registryfile);
+	}
+	
+	/**
+	 * Add the ALIGNED <corpus> line to a registry file.
+	 *
+	 * @param registryfile the registry file to patch
+	 * @param oldname the oldname
+	 * @param newname the newname
+	 * @return true, if successful
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 */
+	public static boolean patchAttribute(File registryfile, String oldname, String newname)
+			throws IOException {
+		
+		boolean found = false;
+		String datapath = ""; //$NON-NLS-1$
+		
+		if (!registryfile.exists()) {
+			Log.warning(TXMCoreMessages.PatchCwbRegistry_16);
+			return false;
+		}
+
+		// HOME INFO
+		File temp = File.createTempFile("temp", ".regsitry", registryfile.getParentFile()); //$NON-NLS-1$ //$NON-NLS-2$
+
+		String encoding = "UTF-8"; //$NON-NLS-1$
+		//if (OSDetector.isFamilyWindows()) encoding = "ISO-8859-1"; //$NON-NLS-1$
+		BufferedReader reader = new BufferedReader(new InputStreamReader(
+				new FileInputStream(registryfile), encoding));
+		OutputStreamWriter writer = new OutputStreamWriter(
+				new FileOutputStream(temp), encoding);
+
+		String line = reader.readLine();
+		while (line != null) {
+			if (line.startsWith("ATTRIBUTE "+oldname)) { //$NON-NLS-1$
+				writer.write("ATTRIBUTE "+newname+"\n"); //$NON-NLS-1$ //$NON-NLS-2$
+				found = true;
+			} else {
+				if (line.startsWith("HOME")) { //$NON-NLS-1$
+					datapath = line.substring(5);
+				}
+				writer.write(line + "\n"); //$NON-NLS-1$
+			}
+			line = reader.readLine();
+		}
+		
+		if (found && datapath.length() > 0) {
+			System.out.println("rename "+oldname+".* files to "+newname+".*"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+			File datadir = new File(datapath);
+			if (datadir.exists()) {
+				for (File f : datadir.listFiles())
+					if (f.getName().startsWith(oldname+".")) //$NON-NLS-1$
+						f.renameTo(new File(f.getParent(), f.getName().replace(oldname+".", newname+"."))); //$NON-NLS-1$ //$NON-NLS-2$
+			} else {
+				System.out.println(TXMCoreMessages.PatchCwbRegistry_27+datadir +TXMCoreMessages.ValidateXml_2);
+				writer.close();
+				reader.close();
+				return false;
+			}
+		}
+		else
+		{
+			System.out.println(TXMCoreMessages.PatchCwbRegistry_28);
+			
+			if(!found)
+				System.out.println(oldname +TXMCoreMessages.PatchCwbRegistry_29+registryfile);
+			
+			if(!(datapath.length() > 0))
+				System.out.println(TXMCoreMessages.PatchCwbRegistry_27+oldname +TXMCoreMessages.PatchCwbRegistry_29+registryfile);
+			writer.close();
+			reader.close();
+			return false;
+		}
+		
+
+		writer.close();
+		reader.close();
+		registryfile.delete();
+		temp.renameTo(registryfile);
+		return true;
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args) {
+		try {
+			/*
+		PatchCwbRegistry.patchEncoding(new File(
+									"~/TXM/corpora/tmxtest/registry/tmxen"), "utf-8"); //$NON-NLS-1$ //$NON-NLS-2$
+			PatchCwbRegistry.patchLanguage(new File(
+					"~/TXM/corpora/tmxtest/registry/tmxen"), "en"); //$NON-NLS-1$ //$NON-NLS-2$
+			PatchCwbRegistry.patchAlignment(new File(
+									"~/TXM/corpora/tmxtest/registry/tmxen"), "TMXFR"); //$NON-NLS-1$ //$NON-NLS-2$
+			*/
+			File registry = new File("/home/mdecorde/TXM/corpora/VOEUX/registry/voeux"); //$NON-NLS-1$
+			File data = new File("/home/mdecorde/TXM/corpora/VOEUX/data/VOEUX");
+			PatchCwbRegistry.patch(registry, data);
+//			PatchCwbRegistry.patchAttribute(registry, "word", "form"); //$NON-NLS-1$ //$NON-NLS-2$
+//			try {
+//				new CwbMakeAll().run("/usr/lib/TXM/cwb/bin/cwb-makeall", "lasla", registry.getAbsolutePath()); //$NON-NLS-1$ //$NON-NLS-2$
+//			} catch (Exception e) {
+//				// TODO Auto-generated catch block
+//				org.txm.utils.logger.Log.printStackTrace(e);
+//			}
+		} catch (IOException e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/importer/cwb/PatchCwbRegistry.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/importer/cwb/BuildCwbEncodeArgsFromTEITXM.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/importer/cwb/BuildCwbEncodeArgsFromTEITXM.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/importer/cwb/BuildCwbEncodeArgsFromTEITXM.java	(revision 258)
@@ -0,0 +1,205 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-08-29 14:23:55 +0200 (jeu., 29 août 2013) $
+// $LastChangedRevision: 2519 $
+// $LastChangedBy: nilskredens $ 
+//
+package org.txm.importer.cwb;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+
+import javax.xml.stream.FactoryConfigurationError;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+// TODO: Auto-generated Javadoc
+/**
+ * build the sAttributes and pAttributs List from an xmlfile pAttributes
+ * (attributes of tei:w tags) and the sAttributes (attributes + max inclusion of
+ * tags).
+ *
+ * @author mdecorde
+ */
+public class BuildCwbEncodeArgsFromTEITXM {
+	
+	/** The stack. */
+	LinkedList<String> stack = new LinkedList<String>();
+	
+	/** The tagcount. */
+	HashMap<String, Integer> tagcount = new HashMap<String, Integer>();
+	
+	/** The tagmax. */
+	HashMap<String, Integer> tagmax = new HashMap<String, Integer>();
+	
+	/** The tagattrs. */
+	HashMap<String, HashSet<String>> tagattrs = new HashMap<String, HashSet<String>>();
+	
+	/** The wattrs. */
+	HashSet<String> wattrs = new HashSet<String>();
+
+	/**
+	 * process !!!.
+	 *
+	 * @param xmlfile the xmlfile
+	 * @throws XMLStreamException the xML stream exception
+	 * @throws FactoryConfigurationError the factory configuration error
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 */
+	public void process(File xmlfile) throws XMLStreamException,
+			FactoryConfigurationError, IOException {
+		URL u = xmlfile.toURI().toURL();
+		InputStream in = u.openStream();
+		XMLInputFactory factory = XMLInputFactory.newInstance();
+		XMLStreamReader parser = factory.createXMLStreamReader(in);
+
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser
+				.next()) {
+			switch (event) {
+			case XMLStreamConstants.START_ELEMENT:
+				stack.push(parser.getLocalName());
+
+				if (!tagattrs.containsKey(parser.getLocalName()))// initialize
+																	// HashMaps
+				{
+					tagattrs.put(parser.getLocalName(), new HashSet<String>());
+					tagcount.put(parser.getLocalName(), 0);
+					tagmax.put(parser.getLocalName(), 0);
+				}
+
+				if (parser.getLocalName().matches("w"))//get w attrs //$NON-NLS-1$
+					for (int i = 0; i < parser.getAttributeCount(); i++) {
+						String att = parser.getAttributeLocalName(i);
+						wattrs.add(att);
+					}
+
+				if (parser.getLocalName().matches("interp"))//get w attrs //$NON-NLS-1$
+				{
+					String att = parser.getAttributeValue(null, "type"); //$NON-NLS-1$
+					wattrs.add(att.substring(1));
+				}
+				for (int i = 0; i < parser.getAttributeCount(); i++)// get tags
+																	// attrs
+				{
+					String att = parser.getAttributeLocalName(i);
+					tagattrs.get(parser.getLocalName()).add(att);
+				}
+
+				int count = tagcount.get(parser.getLocalName());
+				count++;
+				tagcount.put(parser.getLocalName(), count);// increment the
+															// recursion counter
+															// of the tag
+				int max = tagmax.get(parser.getLocalName());
+				if (max < count)
+					tagmax.put(parser.getLocalName(), count);// update max
+																// recursion of
+																// the tag
+				break;
+			case XMLStreamConstants.END_ELEMENT:
+				stack.pop();
+
+				count = tagcount.get(parser.getLocalName());
+				count--;
+				tagcount.put(parser.getLocalName(), count);// decrement the
+															// recursion counter
+															// of the tag
+				break;
+			case XMLStreamConstants.CHARACTERS:
+
+				break;
+			case XMLStreamConstants.CDATA:
+
+				break;
+			} // end switch
+		} // end while
+		tagattrs.remove("w");//we dont need to report the w tags :) //$NON-NLS-1$
+		tagmax.remove("w"); //$NON-NLS-1$
+		parser.close();
+	}
+
+	/**
+	 * Gets the p attributes.
+	 *
+	 * @return the p attributes
+	 */
+	public Collection<String> getPAttributes() {
+		return wattrs;
+	}
+
+	/**
+	 * Gets the s attributes.
+	 *
+	 * @return the s attributes
+	 */
+	public Collection<String> getSAttributes() {
+		ArrayList<String> rez = new ArrayList<String>();
+
+		for (String tag : tagattrs.keySet()) {
+			String s = tag;
+			if (tagmax.get(tag) > 1)
+				s += "" + tagmax.get(tag); //$NON-NLS-1$
+			if (tagattrs.get(tag).size() > 0)
+				s += ":"; //$NON-NLS-1$
+			for (String attr : tagattrs.get(tag))
+				s += "+" + attr; //$NON-NLS-1$
+			rez.add(s);
+		}
+		return rez;
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args) {
+		try {
+			BuildCwbEncodeArgsFromTEITXM argsgetter = new BuildCwbEncodeArgsFromTEITXM();
+			argsgetter.process(new File(
+					"~/xml/rgaqcj/anainline/roland-p5.xml")); //$NON-NLS-1$
+
+			System.out.println("pAttributes : " + argsgetter.getPAttributes()); //$NON-NLS-1$
+			System.out.println("sAttributes : " + argsgetter.getSAttributes()); //$NON-NLS-1$
+		} catch (XMLStreamException e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		} catch (FactoryConfigurationError e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		} catch (IOException e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+	}
+}
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/java/org/txm/importer/cwb/BuildCwbEncodeArgsFromTEITXM.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/importer/cwb/BuildCwbEncodeArgs.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/importer/cwb/BuildCwbEncodeArgs.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/importer/cwb/BuildCwbEncodeArgs.java	(revision 258)
@@ -0,0 +1,241 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-08-29 14:23:55 +0200 (jeu., 29 août 2013) $
+// $LastChangedRevision: 2519 $
+// $LastChangedBy: nilskredens $ 
+//
+package org.txm.importer.cwb;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+
+import javax.xml.stream.FactoryConfigurationError;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.txm.core.messages.TXMCoreMessages;
+
+// TODO: Auto-generated Javadoc
+/**
+ * build the sAttributes and pAttributs List from an xmlfile pAttributes
+ * (attributes of tei:w tags) and the sAttributes (attributes + max inclusion of
+ * tags).
+ *
+ * @author mdecorde
+ */
+public class BuildCwbEncodeArgs {
+
+	/** The stack. */
+	LinkedList<String> stack = new LinkedList<String>();
+
+	/** The tagcount. */
+	HashMap<String, Integer> tagcount = new HashMap<String, Integer>();
+
+	/** The tagmax. */
+	HashMap<String, Integer> tagmax = new HashMap<String, Integer>();
+
+	/** The tagattrs. */
+	HashMap<String, HashSet<String>> tagattrs = new HashMap<String, HashSet<String>>();
+
+	/** The wattrs. */
+	HashSet<String> wattrs = new HashSet<String>();
+
+	private String scanElem;
+
+	/**
+	 * process !!!.
+	 *
+	 * @param xmlfile the xmlfile
+	 * @param wordstag the wordstag
+	 * @return true, if successful
+	 * @throws XMLStreamException the xML stream exception
+	 * @throws FactoryConfigurationError the factory configuration error
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 */
+	public boolean process(File xmlfile, ArrayList<String> wordstag)
+			throws XMLStreamException, FactoryConfigurationError, IOException {
+		if (xmlfile == null || !xmlfile.exists()) {
+			System.out.println(TXMCoreMessages.bind(TXMCoreMessages.BuildCwbEncodeArgs_0, xmlfile));
+			return false;
+		}
+		URL u = xmlfile.toURI().toURL();
+		InputStream in = u.openStream();
+		XMLInputFactory factory = XMLInputFactory.newInstance();
+		XMLStreamReader parser = factory.createXMLStreamReader(in);
+
+		gotoStartElement(parser);
+
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser
+				.next()) {
+			switch (event) {
+			case XMLStreamConstants.START_ELEMENT:
+				stack.push(parser.getLocalName());
+
+				if (!tagattrs.containsKey(parser.getLocalName()))// initialize
+					// HashMaps
+				{
+					tagattrs.put(parser.getLocalName(), new HashSet<String>());
+					tagcount.put(parser.getLocalName(), 0);
+					tagmax.put(parser.getLocalName(), 0);
+				}
+
+				if (wordstag.contains(parser.getLocalName()))// get w attrs
+					for (int i = 0; i < parser.getAttributeCount(); i++) {
+						String att = parser.getAttributeLocalName(i);
+						wattrs.add(att);
+					}
+
+				for (int i = 0; i < parser.getAttributeCount(); i++)// get tags
+					// attrs
+				{
+					String att = parser.getAttributeLocalName(i);
+					tagattrs.get(parser.getLocalName()).add(att);
+				}
+
+				int count = tagcount.get(parser.getLocalName());
+				count++;
+				tagcount.put(parser.getLocalName(), count);// increment the
+				// recursion counter
+				// of the tag
+				int max = tagmax.get(parser.getLocalName());
+				if (max < count)
+					tagmax.put(parser.getLocalName(), count);// update max
+				// recursion of
+				// the tag
+				break;
+			case XMLStreamConstants.END_ELEMENT:
+				if (stack.size() > 0) {
+					stack.pop();
+					count = tagcount.get(parser.getLocalName());
+					count--;
+					tagcount.put(parser.getLocalName(), count);// decrement the
+					// recursion counter
+					// of the tag
+				}
+
+				break;
+			case XMLStreamConstants.CHARACTERS:
+
+				break;
+			case XMLStreamConstants.CDATA:
+
+				break;
+			} // end switch
+		} // end while
+		tagattrs.remove("w");//we dont need to report the w tags :) //$NON-NLS-1$
+		tagmax.remove("w"); //$NON-NLS-1$
+		parser.close();
+		in.close();
+		return true;
+	}
+
+	public void gotoStartElement(XMLStreamReader parser) throws XMLStreamException
+	{
+		if (this.scanElem == null) return;
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser
+				.next()) {
+			switch (event) {
+			case XMLStreamConstants.START_ELEMENT:
+				if (parser.getLocalName() == scanElem)
+					return;
+			}
+		}
+	}
+
+	public void setElementToScan(String elem)
+	{
+		this.scanElem = elem;
+	}
+
+	/**
+	 * Gets the p attributes.
+	 *
+	 * @return the p attributes
+	 */
+	public Collection<String> getPAttributes() {
+		return wattrs;
+	}
+
+	/**
+	 * Gets the s attributes.
+	 *
+	 * @return the s attributes
+	 */
+	public Collection<String> getSAttributes() {
+		ArrayList<String> rez = new ArrayList<String>();
+
+		for (String tag : tagattrs.keySet()) {
+			String s = tag.toLowerCase();
+			s += ":"; //$NON-NLS-1$
+
+			if (tagmax.get(tag) >= 0)
+				s += "" + (tagmax.get(tag) - 1); //$NON-NLS-1$
+
+			for (String attr : tagattrs.get(tag))
+				s += "+" + attr.toLowerCase(); //$NON-NLS-1$
+					rez.add(s);
+		}
+		return rez;
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args) {
+		try {
+			BuildCwbEncodeArgs argsgetter = new BuildCwbEncodeArgs();
+			ArrayList<String> wordstag = new ArrayList<String>();
+			String[] awords = { "M", "PC", "MC" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+
+			for (String s : awords) {
+				wordstag.add(s);
+			}
+			argsgetter.process(new File(
+					"~/xml/fleurs/src/fleursduMal-2.xml"), wordstag); //$NON-NLS-1$
+
+			System.out.println("pAttributes : " + argsgetter.getPAttributes()); //$NON-NLS-1$
+			System.out.println("sAttributes : " + argsgetter.getSAttributes()); //$NON-NLS-1$
+		} catch (XMLStreamException e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		} catch (FactoryConfigurationError e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		} catch (IOException e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/importer/cwb/BuildCwbEncodeArgs.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/importer/cwb/CwbAlign.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/importer/cwb/CwbAlign.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/importer/cwb/CwbAlign.java	(revision 258)
@@ -0,0 +1,515 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2017-01-24 18:11:42 +0100 (Tue, 24 Jan 2017) $
+// $LastChangedRevision: 3400 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer.cwb;
+
+import java.util.Date;
+import java.util.Locale;
+import java.text.DateFormat;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+
+import org.txm.utils.logger.Log;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Align a corpus with an other Generated with ProcessBuilderBuilder 28/07/2010.
+ */
+public class CwbAlign {
+	
+	/** The binpath. */
+	String binpath = ""; //$NON-NLS-1$
+
+	/**
+	 * Instantiates a new cwb align.
+	 *
+	 * @param binpath the binpath
+	 */
+	public CwbAlign(String binpath) {
+		this.binpath = binpath;
+	}
+
+	/** The version. */
+	String version = "3.2"; //$NON-NLS-1$
+	
+	/** The desc. */
+	String desc = "Align a corpus with an other"; //$NON-NLS-1$
+	
+	/** The debug. */
+	boolean debug = false;
+
+	/**
+	 * Debug.
+	 *
+	 * @param b the b
+	 */
+	public void debug(boolean b) {
+		debug = b;
+	};
+
+	// use positional attribute [word]
+	/** The is p. */
+	private Boolean isP = false;
+	
+	/** The P. */
+	private String P;
+
+	/**
+	 * Sets the p.
+	 *
+	 * @param arg the new p
+	 */
+	public void setP(String arg) {
+		this.isP = true;
+		this.P = arg;
+	}
+
+	/**
+	 * Unset p.
+	 */
+	public void unsetP() {
+		this.isP = false;
+	}
+
+	// ordered prealignment
+	/** The is s. */
+	private Boolean isS = false;
+	
+	/** The S. */
+	private String S;
+
+	/**
+	 * Sets the s.
+	 *
+	 * @param arg the new s
+	 */
+	public void setS(String arg) {
+		this.isS = true;
+		this.S = arg;
+	}
+
+	/**
+	 * Unset s.
+	 */
+	public void unsetS() {
+		this.isS = false;
+	}
+
+	// ordered prealignment with annotations, ex : seg_id
+	/** The is v. */
+	private Boolean isV = false;
+	
+	/** The V. */
+	private String V;
+
+	/**
+	 * Sets the v.
+	 *
+	 * @param arg the new v
+	 */
+	public void setV(String arg) {
+		this.isV = true;
+		this.V = arg;
+	}
+
+	/**
+	 * Unset v.
+	 */
+	public void unsetV() {
+		this.isV = false;
+	}
+
+	// outfile file [out.align]
+	/** The iso. */
+	private Boolean iso = false;
+	
+	/** The o. */
+	private String o;
+
+	/**
+	 * Sets the o.
+	 *
+	 * @param arg the new o
+	 */
+	public void seto(String arg) {
+		this.iso = true;
+		this.o = arg;
+	}
+
+	/**
+	 * Unseto.
+	 */
+	public void unseto() {
+		this.iso = false;
+	}
+
+	// set 2:2 alignment split factor [1.2]
+	/** The iss. */
+	private Boolean iss = false;
+	
+	/** The s. */
+	private String s;
+
+	/**
+	 * Sets the s.
+	 *
+	 * @param arg the new s
+	 */
+	public void sets(String arg) {
+		this.iss = true;
+		this.s = arg;
+	}
+
+	/**
+	 * Unsets.
+	 */
+	public void unsets() {
+		this.iss = false;
+	}
+
+	// use best path search beam of width [50]
+	/** The isw. */
+	private Boolean isw = false;
+	
+	/** The w. */
+	private String w;
+
+	/**
+	 * Sets the w.
+	 *
+	 * @param arg the new w
+	 */
+	public void setw(String arg) {
+		this.isw = true;
+		this.w = arg;
+	}
+
+	/**
+	 * Unsetw.
+	 */
+	public void unsetw() {
+		this.isw = false;
+	}
+
+	// use registry directory
+	/** The isr. */
+	private Boolean isr = false;
+	
+	/** The r. */
+	private String r;
+
+	/**
+	 * Sets the r.
+	 *
+	 * @param arg the new r
+	 */
+	public void setr(String arg) {
+		this.isr = true;
+		this.r = arg;
+	}
+
+	/**
+	 * Unsetr.
+	 */
+	public void unsetr() {
+		this.isr = false;
+	}
+
+	// verbose mode
+	/** The isv. */
+	private Boolean isv = false;
+
+	/**
+	 * Setv.
+	 */
+	public void setv() {
+		this.isv = true;
+	}
+
+	/**
+	 * Unsetv.
+	 */
+	public void unsetv() {
+		this.isv = false;
+	}
+
+	// show help
+	/** The ish. */
+	private Boolean ish = false;
+
+	/**
+	 * Seth.
+	 */
+	public void seth() {
+		this.ish = true;
+	}
+
+	/**
+	 * Unseth.
+	 */
+	public void unseth() {
+		this.ish = false;
+	}
+
+	// create align file
+	/**
+	 * Cwbalign.
+	 *
+	 * @param source the source
+	 * @param target the target
+	 * @param sattrib the sattrib
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 */
+	public void cwbalign(String source, String target, String sattrib)
+			throws IOException
+	// arg : source corpus identif ier
+	// arg : target corpus identif ier
+	// arg : the aligned structure, ex : seg
+	{
+		ArrayList<String> args = new ArrayList<String>();
+		args.add(binpath + "cwb-align"); //$NON-NLS-1$
+		if (isP) {
+			args.add("-P"); //$NON-NLS-1$
+			args.add("" + P); //$NON-NLS-1$
+		}
+		if (isS) {
+			args.add("-S"); //$NON-NLS-1$
+			args.add("" + S); //$NON-NLS-1$
+		}
+		if (isV) {
+			args.add("-V"); //$NON-NLS-1$
+			args.add("" + V);} //$NON-NLS-1$
+		if (iso) {
+			args.add("-o"); //$NON-NLS-1$
+			args.add("" + o); //$NON-NLS-1$
+		}
+		if (iss) {
+			args.add("-s"); //$NON-NLS-1$
+			args.add("" + s); //$NON-NLS-1$
+		}
+		if (isw) {
+			args.add("-w"); //$NON-NLS-1$
+			args.add("" + w); //$NON-NLS-1$
+		}
+		if (isr) {
+			args.add("-r"); //$NON-NLS-1$
+			args.add("" + r); //$NON-NLS-1$
+		}
+		if (isv)
+			args.add("-v"); //$NON-NLS-1$
+		if (ish)
+			args.add("-h"); //$NON-NLS-1$
+		args.add("" + source); //$NON-NLS-1$
+		args.add("" + target); //$NON-NLS-1$
+		args.add("" + sattrib); //$NON-NLS-1$
+
+		ProcessBuilder pb = new ProcessBuilder(args);
+		pb.redirectErrorStream(true);
+		Process process = null;
+		try {
+			process = pb.start();
+		} catch (IOException e) {
+			System.err.println(e);
+		}
+		InputStream is = process.getInputStream();
+		InputStreamReader isr = new InputStreamReader(is);
+		BufferedReader br = new BufferedReader(isr);
+		String line;
+		while ((line = br.readLine()) != null) {
+			System.out.println(line);
+		}
+		int e = 0;
+		try {
+			e = process.waitFor();
+		} catch (Exception err) {
+		}
+		if (e != 0) {
+			System.err
+					.println("Process exited abnormally with code " + e + " at " + DateFormat.getDateInstance(DateFormat.FULL, Locale.UK).format(new Date())); //$NON-NLS-1$ //$NON-NLS-2$
+			for (int c = 0; c < args.size(); c++)
+				System.out.print("" + args.get(c) + " "); //$NON-NLS-1$ //$NON-NLS-2$
+			System.out.println();
+		}
+	}
+
+	// write data file to directory
+	/** The isd. */
+	private Boolean isd = false;
+	
+	/** The d. */
+	private String d;
+
+	/**
+	 * Sets the d.
+	 *
+	 * @param arg the new d
+	 */
+	public void setd(String arg) {
+		this.isd = true;
+		this.d = arg;
+	}
+
+	/**
+	 * Unsetd.
+	 */
+	public void unsetd() {
+		this.isd = false;
+	}
+
+	// write data files to corpus data directory
+	/** The is d. */
+	private Boolean isD = false;
+
+	/**
+	 * Sets the d.
+	 */
+	public void setD() {
+		this.isD = true;
+	}
+
+	/**
+	 * Unset d.
+	 */
+	public void unsetD() {
+		this.isD = false;
+	}
+
+	// compatibility mode (creates .alg file)
+	/** The is c. */
+	private Boolean isC = false;
+
+	/**
+	 * Sets the c.
+	 */
+	public void setC() {
+		this.isC = true;
+	}
+
+	/**
+	 * Unset c.
+	 */
+	public void unsetC() {
+		this.isC = false;
+	}
+
+	// create corpus align data
+	/**
+	 * Cwbalignencode.
+	 *
+	 * @param alignmentfile the alignmentfile
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 */
+	public void cwbalignencode(String alignmentfile) throws IOException
+	// arg : the align file created by cwb-align
+	{
+		ArrayList<String> args = new ArrayList<String>();
+		args.add(binpath + "cwb-align-encode"); //$NON-NLS-1$
+		if (isd) {
+			args.add("-d"); //$NON-NLS-1$
+			args.add("" + d); //$NON-NLS-1$
+		}
+		if (isD)
+			args.add("-D"); //$NON-NLS-1$
+		if (isC)
+			args.add("-C"); //$NON-NLS-1$
+		if (isr) {
+			args.add("-r"); //$NON-NLS-1$
+			args.add("" + r); //$NON-NLS-1$
+		}
+		if (isv)
+			args.add("-v"); //$NON-NLS-1$
+		if (ish)
+			args.add("-h"); //$NON-NLS-1$
+		args.add("" + alignmentfile); //$NON-NLS-1$
+
+		ProcessBuilder pb = new ProcessBuilder(args);
+		pb.redirectErrorStream(true);
+		Process process = null;
+		try {
+			process = pb.start();
+		} catch (IOException e) {
+			System.err.println(e);
+		}
+		InputStream is = process.getInputStream();
+		InputStreamReader isr = new InputStreamReader(is);
+		BufferedReader br = new BufferedReader(isr);
+		String line;
+		while ((line = br.readLine()) != null) {
+			System.out.println(line);
+		}
+		int e = 0;
+		try {
+			e = process.waitFor();
+		} catch (Exception err) {
+		}
+		if (e != 0) {
+			System.err
+					.println("Process exited abnormally with code " + e + " at " + DateFormat.getDateInstance(DateFormat.FULL, Locale.UK).format(new Date())); //$NON-NLS-1$ //$NON-NLS-2$
+			for (int c = 0; c < args.size(); c++)
+				System.out.print("" + args.get(c) + " "); //$NON-NLS-1$ //$NON-NLS-2$
+			System.out.println();
+		}
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args) {
+		// ./cwb-align -V seg_id -r ~/TXM/corpora/tmxtest/registry/
+		// tmxen tmxfr seg
+		// ./cwb-align-encode -D -r ~/TXM/corpora/tmxtest/registry/
+		// -v out.align
+		CwbAlign tt = new CwbAlign("~/TXMinstall/cwb/bin/"); //$NON-NLS-1$
+		tt.setV("seg_id"); //$NON-NLS-1$
+		tt
+				.setr(new File("~/TXM/corpora/tmxtest/registry/").getAbsolutePath()); //$NON-NLS-1$
+		try {
+			tt.cwbalign("tmxen", "tmxfr", "seg"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+		} catch (IOException e) {
+			Log.severe("Error while calling cwb-align: "+e.getLocalizedMessage());
+			return;
+		}
+
+		tt = new CwbAlign("~/TXMinstall/cwb/bin/"); //$NON-NLS-1$
+		tt.setD();
+		tt.setv();
+		tt
+				.setr(new File("~/TXM/corpora/tmxtest/registry/").getAbsolutePath()); //$NON-NLS-1$
+		try {
+			tt.cwbalignencode("out.align"); //$NON-NLS-1$
+		} catch (IOException e) {
+			Log.severe("Error while calling cwb-align: "+e.getLocalizedMessage());
+			return;
+		}
+	}
+}
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/java/org/txm/importer/cwb/CwbAlign.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/importer/Convert5To6.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/importer/Convert5To6.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/importer/Convert5To6.java	(revision 258)
@@ -0,0 +1,295 @@
+package org.txm.importer;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.regex.PatternSyntaxException;
+
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.objects.BaseParameters;
+import org.txm.objects.Page;
+import org.txm.utils.io.FileCopy;
+import org.txm.utils.xml.DomUtils;
+import org.txm.utils.zip.Zip;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+public class Convert5To6 {
+
+	File HTMLs, HTMLmulti, TXMs, DATAs, REGISTRY, BINDIR, IMPORT;
+	File OUTDIR;
+	File INDIR;
+
+	public Convert5To6(File directory, File outdir)
+	{
+		OUTDIR = directory;
+		OUTDIR = outdir;
+		INDIR = directory;
+	}
+	
+	public static boolean is6(File corpusdir) {
+		File param = new File(corpusdir, "import.xml"); //$NON-NLS-1$
+		if (!param.exists()) { 
+			//System.out.println("\n");
+			System.out.println(TXMCoreMessages.bind(TXMCoreMessages.Convert5To6_1,param)); //$NON-NLS-1$
+			return false; 
+		}
+
+		try {
+			Document doc = DomUtils.load(param);
+			Element root = doc.getDocumentElement();
+			return "0.6".compareTo(root.getAttribute("version").toString()) <= 0; //$NON-NLS-1$ //$NON-NLS-2$
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+		return false;
+	}
+
+	public boolean is5(boolean silent) {
+		File HTMLs = new File(INDIR, "HTML"); //$NON-NLS-1$
+		File HTMLmulti = new File(HTMLs, "multi"); //$NON-NLS-1$
+		File TXMs = new File(INDIR, "txm"); //$NON-NLS-1$
+		File DATAs = new File(INDIR, "data"); //$NON-NLS-1$
+		File REGISTRY = new File(INDIR, "registry"); //$NON-NLS-1$
+		File IMPORT = new File(INDIR, "import.xml"); //$NON-NLS-1$
+		
+		if (!silent) System.out.println(TXMCoreMessages.Convert5To6_6);
+		if (!TXMs.exists()) {
+			if (!silent) System.out.println(TXMCoreMessages.Convert5To6_7+TXMs);
+			return false;
+		}
+
+		if (!HTMLs.exists()) {
+			if (!silent) System.out.println(TXMCoreMessages.Convert5To6_8+HTMLs);
+			return false;
+		}
+
+		if (!DATAs.exists()) {
+			if (!silent) System.out.println(TXMCoreMessages.Convert5To6_9+DATAs);
+			return false;
+		}
+
+		if (!REGISTRY.exists()) {
+			if (!silent) System.out.println(TXMCoreMessages.Convert5To6_10+REGISTRY);
+			return false;
+		}
+
+		if (!HTMLmulti.exists()) {
+			if (!silent) System.out.println(TXMCoreMessages.Convert5To6_11+HTMLmulti);
+			return false;
+		}
+
+		return REGISTRY.listFiles().length > 0;
+	}
+
+	private boolean process() throws Exception {
+		System.out.println(TXMCoreMessages.Convert5To6_12);
+		String corpusname = REGISTRY.listFiles()[0].getName().toUpperCase();
+
+		// create the corpus directories
+		File HTMLc = new File(HTMLs, corpusname); 
+		File HTMLcmulti = new File(HTMLc, "default"); //$NON-NLS-1$
+		File HTMLconepage = new File(HTMLc, "onepage"); //$NON-NLS-1$
+		File TXMc = new File(TXMs, corpusname); 
+		File DATAc = new File(DATAs, corpusname); 
+
+		// mkdirs
+		HTMLc.mkdir();
+		HTMLcmulti.mkdir();
+		File[] files = HTMLs.listFiles();
+		if (files != null && files.length > 1)
+			HTMLconepage.mkdir();
+		TXMc.mkdir();
+		DATAc.mkdir();
+		
+		System.out.println(TXMCoreMessages.Convert5To6_15+OUTDIR);
+		// move files
+		for (File f : HTMLmulti.listFiles())
+			f.renameTo(new File(HTMLcmulti, f.getName()));
+		if (HTMLconepage.exists()) {
+			for (File f : HTMLs.listFiles())
+				if (f.isFile())
+					f.renameTo(new File(HTMLconepage, f.getName()));
+		}
+		for (File f : DATAs.listFiles())
+			f.renameTo(new File(DATAc, f.getName()));
+		for (File f : TXMs.listFiles())
+			f.renameTo(new File(TXMc, f.getName()));
+
+		// remove unused dir
+		HTMLmulti.delete();
+
+		// create import.xml
+		String baseDesc = ""; //$NON-NLS-1$
+		String baseName = corpusname.toUpperCase();
+
+		String corpusDesc = ""; //$NON-NLS-1$
+		String author = System.getProperty("user.name"); //$NON-NLS-1$
+		String rootDir = ""; //$NON-NLS-1$
+		String script = ""; //$NON-NLS-1$
+		String xslt = ""; //$NON-NLS-1$
+		String lang = "fr"; //$NON-NLS-1$
+		String encoding = "UTF-8"; //$NON-NLS-1$
+		String date = BaseParameters.dateformat.format(new Date(IMPORT.lastModified()));
+
+		if (IMPORT.exists()) {
+			System.out.println(TXMCoreMessages.Convert5To6_19+IMPORT);
+			Document doc = DomUtils.load(IMPORT);
+			Element root = doc.getDocumentElement();
+			lang = root.getAttribute("language"); //$NON-NLS-1$
+			baseDesc = root.getAttribute("description"); //$NON-NLS-1$
+			baseName = root.getAttribute("basename"); //$NON-NLS-1$
+			rootDir = root.getAttribute("rootDir"); //$NON-NLS-1$
+			script = root.getAttribute("script"); //$NON-NLS-1$
+			xslt = root.getAttribute("xslt"); //$NON-NLS-1$
+			encoding = root.getAttribute("encoding"); //$NON-NLS-1$
+			author = root.getAttribute("author"); //$NON-NLS-1$
+
+			IMPORT.delete();
+		}
+		
+		File PARAMS = new File(BINDIR, "import.xml"); //$NON-NLS-1$
+		System.out.println("writing "+PARAMS); //$NON-NLS-1$
+		BaseParameters.createEmptyParams(PARAMS, corpusname.toUpperCase());
+		System.out.println(TXMCoreMessages.Convert5To6_30);
+		BaseParameters params = new BaseParameters(PARAMS);
+		params.load();
+
+		System.out.println( "corpusname: $baseName, corpusdesc: $baseDesc, rootDir: $rootDir, script: $script"+ //$NON-NLS-1$
+			"\nCQPID: $corpusname, lang: $lang, xslt: $xslt, encoding: $encoding"); //$NON-NLS-1$
+		Element corpusElem = params.corpora.get(corpusname);
+		params.root.setAttribute("name", baseName); //$NON-NLS-1$
+		params.root.setAttribute("author", author); //$NON-NLS-1$
+		params.root.setAttribute("date", ""+date); //$NON-NLS-1$ //$NON-NLS-2$
+		params.root.setAttribute("desc", baseDesc); //$NON-NLS-1$
+		params.root.setAttribute("rootDir", rootDir); //$NON-NLS-1$
+		params.root.setAttribute("script", script); //$NON-NLS-1$
+
+		corpusElem.setAttribute("name", corpusname); //$NON-NLS-1$
+		corpusElem.setAttribute("lang", lang); //$NON-NLS-1$
+		corpusElem.setAttribute("encoding", encoding); //$NON-NLS-1$
+		corpusElem.setAttribute("desc", baseDesc); //$NON-NLS-1$
+	
+		params.getXsltElement(corpusElem).setAttribute("xsl", xslt); //$NON-NLS-1$
+		
+		//process xml-txm files
+		//params.addEditionDefinition(corpusElem, "default", "groovy", "");
+		params.addEditionDefinition(corpusElem, "onepage", "groovy", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+		for (File txmFile : TXMc.listFiles()) {
+			System.out.println(TXMCoreMessages.Convert5To6_46+txmFile);
+			String textname = txmFile.getName();
+			textname = textname.substring(0, textname.indexOf(".")); //$NON-NLS-1$
+
+			Element textElem = params.addText(corpusElem, textname, txmFile);
+			Element editionElem = params.addEdition(textElem, "default", HTMLc.getAbsolutePath(), "html"); //$NON-NLS-1$ //$NON-NLS-2$
+			
+			File[] htmlfiles = HTMLcmulti.listFiles();
+			Arrays.sort(htmlfiles, new Comparator<File>() {
+				@Override
+				public int compare(File arg0, File arg1) {
+					return getInt(arg0.getName()).compareTo(getInt(arg1.getName()));
+				}
+			});//.sort { a -> getInt(a.getName()); }
+			
+			int pagecounter = 1;
+			for (File page : htmlfiles) {
+				if (page.getName().startsWith(textname)) {
+					String firstwordid  = Page.foundFirstWordId(page);
+					params.addPage(editionElem, ""+pagecounter++, firstwordid); //$NON-NLS-1$
+				}
+			}
+
+			// add default Edition
+			if (HTMLconepage.exists()) {
+				editionElem = params.addEdition(textElem, "onepage", HTMLc.getAbsolutePath(), "html"); //$NON-NLS-1$ //$NON-NLS-2$
+				htmlfiles = HTMLconepage.listFiles();
+				pagecounter = 1;
+				for (File page : htmlfiles) {
+					if (page.getName().startsWith(textname)) {
+						String firstwordid  = Page.foundFirstWordId(page);
+						params.addPage(editionElem, ""+pagecounter++, firstwordid); //$NON-NLS-1$
+					}
+				}
+			}
+		}
+
+		return DomUtils.save(params.root.getOwnerDocument(), PARAMS);
+	}
+
+	private Integer getInt(String string) {
+		int r = 0;
+		try {
+			Pattern p = Pattern.compile("([0-9]+)"); //$NON-NLS-1$
+			Matcher m = p.matcher(string);
+			while (m.find()) {
+				string = m.group(1);
+				r = Integer.parseInt(string);
+			}
+		} catch (PatternSyntaxException pse) { }
+		return r;
+	}
+	
+	public boolean start() throws Exception {
+		if (is5(false)) {
+			FileCopy.copyFiles(INDIR, OUTDIR);
+			//OUTDIR.deleteDir();
+			//println "copying binary into "+OUTDIR
+			
+			BINDIR = OUTDIR;
+			HTMLs = new File(BINDIR, "HTML"); //$NON-NLS-1$
+			HTMLmulti = new File(HTMLs, "multi"); //$NON-NLS-1$
+			TXMs = new File(BINDIR, "txm"); //$NON-NLS-1$
+			DATAs = new File(BINDIR, "data"); //$NON-NLS-1$
+			REGISTRY = new File(BINDIR, "registry"); //$NON-NLS-1$
+	
+			IMPORT = new File(BINDIR, "import.xml"); //$NON-NLS-1$
+			
+			return process();
+		} else
+			return false;
+	}
+
+	public boolean zip(File zipFile) {
+		try {
+			Zip.compress(BINDIR, zipFile);
+		} catch (IOException e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+			return false;
+		}
+		return true;
+	}
+
+	public static void main(String[] args) {
+//		if (args.length < 2 || args.length > 3) {
+//			println "Usage: groovy Convert5to6 binaryDirV5 binaryDirV6 [zipFile]"
+//			System.exit 1;
+//		}
+//		}
+		File bindir = new File("/home/mdecorde/.TXMWEB/corporademo/ramses-bin"); //$NON-NLS-1$
+		File outDir = new File("/home/mdecorde/.TXMWEB/corporademo", bindir.getName()+"6"); //$NON-NLS-1$ //$NON-NLS-2$
+		//File zipFile = new File("/home/mdecorde/TXMCORPORA05/srcmf2-bin6.zip");
+		
+//		File bindir = new File(args[0]);
+//		File outDir = new File(args[1]);
+//		File zipFile = new File(outDir.getAbsolutePath()+".zip");
+//		if( args.length == 3)
+//			zipFile = new File(args[2]);
+		
+		Convert5To6 converter = new Convert5To6(bindir, outDir);
+		try {
+			converter.start();
+			System.out.println("done"); //$NON-NLS-1$
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+		//converter.zip(zipFile);
+		//	println Convert5To6.is6(new File("/home/mdecorde/TXM-corpus-backup/bfm1"))
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/importer/Convert5To6.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/importer/package.html
===================================================================
--- tmp/org.txm.core/src/java/org/txm/importer/package.html	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/importer/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Import tools</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/java/org/txm/importer/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/importer/ConvertDocument.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/importer/ConvertDocument.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/importer/ConvertDocument.java	(revision 258)
@@ -0,0 +1,148 @@
+package org.txm.importer;
+import java.io.File;
+import java.util.Arrays;
+import java.util.List;
+
+import org.artofsolving.jodconverter.OfficeDocumentConverter;
+import org.artofsolving.jodconverter.office.DefaultOfficeManagerConfiguration;
+import org.artofsolving.jodconverter.office.OfficeException;
+import org.artofsolving.jodconverter.office.OfficeManager;
+
+
+public class ConvertDocument {
+
+	boolean DEBUG = false;
+	List<String> supportedInput = Arrays.asList("odt", "doc", "docx", "html", "pdf"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+	List<String> supportedOutput = Arrays.asList("odt", "doc", "html", "pdf"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+	OfficeManager officeManager = null;
+
+	public ConvertDocument(String officeHome) {
+		DefaultOfficeManagerConfiguration office = new DefaultOfficeManagerConfiguration();
+		office.setOfficeHome(officeHome);
+	    //officeManager.setConnectionProtocol(OfficeConnectionProtocol.PIPE);
+	    //officeManager.setPipeNames("office1", "office2");
+	    //officeManager.setTaskExecutionTimeout(30000L);
+		officeManager = office.buildOfficeManager();
+		try {
+			officeManager.start();
+		} catch(Exception e) {
+			officeManager.stop();
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+	}
+	
+	public ConvertDocument() {
+		DefaultOfficeManagerConfiguration office = new DefaultOfficeManagerConfiguration();
+		//office.setOfficeHome("/usr/lib/openoffice");
+	    //officeManager.setConnectionProtocol(OfficeConnectionProtocol.PIPE);
+	    //officeManager.setPipeNames("office1", "office2");
+	    //officeManager.setTaskExecutionTimeout(30000L);
+		officeManager = office.buildOfficeManager();
+		try {
+			officeManager.start();
+		} catch(Exception e) {
+			officeManager.stop();
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+	}
+
+	public void setDebug(boolean b) {
+		DEBUG = b;
+		DefaultOfficeManagerConfiguration.DEBUG = DEBUG;
+	}
+	
+	public void stop() {
+		officeManager.stop();
+	}
+
+	public File toODT(File document, File outdir) throws Exception {
+		return auto(document, outdir, "odt"); //$NON-NLS-1$
+	}
+
+	public File toDOC(File document, File outdir) throws Exception {
+		return auto(document, outdir, "doc"); //$NON-NLS-1$
+	}
+
+	public File toPDF(File document, File outdir) throws Exception {
+		return auto(document, outdir, "pdf"); //$NON-NLS-1$
+	}
+
+	public File auto(File document, File outdir, String ext) throws Exception {
+		
+		//get filename without ext
+		int idx = document.getName().lastIndexOf("."); //$NON-NLS-1$
+		if (idx == -1) return null;
+		String name = document.getName().substring(0, idx-1);
+		
+		File outfile = new File(outdir, name+".odt"); //$NON-NLS-1$
+		try {
+			return autoFile(document, outfile, ext);
+		} catch(Exception e) {
+			if (e instanceof OfficeException) {
+				OfficeException oe = (OfficeException) e;
+				if (oe.getMessage().contains("officeHome not set")) {
+					throw new OfficeException("Could not find LibreOffice or OpenOffice 3.x installation. Reason="+e.getMessage());
+				} else if (oe.getMessage().contains("is already running")) {
+					String pid = oe.getMessage();
+					if (pid.indexOf("pid") > 0) {
+						pid = pid.substring(pid.indexOf("pid"));
+					}
+					throw new OfficeException("Could not run LibreOffice or OpenOffice because a 'soffice' process is already running (process id="+pid+"). Please kill the process and restart. Reason="+e.getMessage());
+				} else
+					throw e;
+			} else
+				throw e;
+		}
+	}
+
+	public File autoFile(File document, File outfile, String ext) throws Exception {
+		OfficeDocumentConverter converter = new OfficeDocumentConverter(officeManager);
+		converter.convert(document, outfile, converter.getFormatRegistry().getFormatByExtension(ext));
+		
+		if (outfile.exists())
+			return outfile;
+		else
+			return null;
+	}
+
+	/**
+	 * @param args
+	 */
+	public static void main(String[] args) {
+		//converter.convert(infile, outfile, new )
+		//		String[] srcexts = { "doc" };
+		//		String[] exts = { "odt" };//, "odt", "doc", "docx", "html", "pdf"}; // html pdf
+		//		for(String srcext : srcexts) {
+		//			File infile = new File("/home/mdecorde/Bureau/matrice/témoignages/CONVERSIONS/orig."+srcext);
+		//			for(String ext : exts) {
+		//				System.out.println("Convert from "+srcext+" to "+ext);
+		//				OfficeManager officeManager = null;
+		//				try {
+		//					officeManager = new DefaultOfficeManagerConfiguration().buildOfficeManager();
+		//					officeManager.start();
+		//
+		//					OfficeDocumentConverter converter = new OfficeDocumentConverter(officeManager);
+		//					System.out.println(converter.getFormatRegistry().getClass());
+		//					File outfile = new File("/home/mdecorde/Bureau/matrice/témoignages/CONVERSIONS/jod/"+srcext+"."+ext);
+		//					converter.convert(infile, outfile, converter.getFormatRegistry().getFormatByExtension(ext));
+		//
+		//				} catch(Exception e) {
+		//					System.out.println(e.getLocalizedMessage());
+		//				} finally {
+		//					officeManager.stop();
+		//				}
+		//			}
+		//		}
+
+		File infile = new File("/home/mdecorde/TEMP/Corpus_Riverains_TXM/EP27_txm.doc"); //$NON-NLS-1$
+		File outdir = new File("/home/mdecorde/TEMP"); //$NON-NLS-1$
+
+		//System.out.println("result: "+ConvertDocument.toODT(infile, outdir));
+		ConvertDocument convert = new ConvertDocument();
+		try {
+			System.out.println("result: "+convert.toODT(infile, outdir)); //$NON-NLS-1$
+		} catch(Exception e) { org.txm.utils.logger.Log.printStackTrace(e);}
+		convert.stop();
+	}
+
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/importer/ConvertDocument.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/importer/scripting/package.html
===================================================================
--- tmp/org.txm.core/src/java/org/txm/importer/scripting/package.html	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/importer/scripting/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>classes for Groovy calls</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/java/org/txm/importer/scripting/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/importer/scripting/GroovyImportScriptRunner.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/importer/scripting/GroovyImportScriptRunner.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/importer/scripting/GroovyImportScriptRunner.java	(revision 258)
@@ -0,0 +1,140 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-08-29 14:23:55 +0200 (jeu., 29 août 2013) $
+// $LastChangedRevision: 2519 $
+// $LastChangedBy: nilskredens $ 
+//
+package org.txm.importer.scripting;
+
+import groovy.lang.GroovyClassLoader;
+import groovy.lang.GroovyObject;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+
+import org.codehaus.groovy.control.CompilationFailedException;
+import org.txm.core.messages.TXMCoreMessages;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Do all the initialization job of the groovy script runner.
+ *
+ * @author mdecorde
+ */
+public class GroovyImportScriptRunner {
+
+	/** The script. */
+	File script = null;
+	
+	/** The classpath. */
+	List<File> classpath;
+
+	/**
+	 * Instantiates a new groovy import script runner.
+	 *
+	 */
+
+	public GroovyImportScriptRunner() {
+
+	}
+
+	/**
+	 * Instantiates a new groovy import script runner.
+	 *
+	 * @param script the script
+	 * @param classpath the classpath
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 */
+	public GroovyImportScriptRunner(File script, List<File> classpath)
+			throws IOException {
+		this.script = script;
+		this.classpath = classpath;
+	}
+
+	/**
+	 * Instantiates a new groovy import script runner.
+	 *
+	 * @param scriptfile the scriptfile
+	 * @param args the args
+	 */
+	public GroovyImportScriptRunner(File scriptfile, Object[] args) {
+		System.out.println(TXMCoreMessages.GroovyImportScriptRunner_0);
+		this.executeScript(scriptfile.getAbsolutePath(), args);
+	}
+
+	/**
+	 * Execute script.
+	 *
+	 * @param scriptfile the scriptfile
+	 * @param args the args
+	 */
+	public void executeScript(String scriptfile, Object args) {
+		System.out.println(TXMCoreMessages.GroovyImportScriptRunner_1 + scriptfile);
+		ClassLoader parent = getClass().getClassLoader();
+		GroovyClassLoader loader = new GroovyClassLoader(parent);
+		Class groovyClass = null;
+		try {
+			groovyClass = loader.parseClass(new File(scriptfile));
+		} catch (CompilationFailedException e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		} catch (IOException e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+
+		// let's call some method on an instance
+		GroovyObject groovyObject = null;
+		try {
+			groovyObject = (GroovyObject) groovyClass.newInstance();
+		} catch (InstantiationException e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		} catch (IllegalAccessException e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+
+		try {
+			groovyObject.invokeMethod("run", args); //$NON-NLS-1$
+		} catch (Exception e) {
+			System.err.println(e);
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+		System.out.println(TXMCoreMessages.GroovyImportScriptRunner_3);
+	}
+
+	/**
+	 * Run.
+	 *
+	 * @param groovyloader the groovyloader
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 */
+	public void run(GroovyClassLoader groovyloader) throws IOException {
+
+		// gse
+
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/importer/scripting/GroovyImportScriptRunner.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/importer/scripting/GroovyExecutionException.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/importer/scripting/GroovyExecutionException.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/importer/scripting/GroovyExecutionException.java	(revision 258)
@@ -0,0 +1,48 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer.scripting;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class GroovyExecutionException.
+ */
+public class GroovyExecutionException extends Exception {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * Instantiates a new groovy execution exception.
+	 *
+	 * @param e the e
+	 */
+	public GroovyExecutionException(Exception e) {
+		super(e);
+	}
+
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/importer/scripting/GroovyExecutionException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/tests/CWBCL.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/tests/CWBCL.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/tests/CWBCL.java	(revision 258)
@@ -0,0 +1,6 @@
+package org.txm.tests;
+
+public class CWBCL {
+	native void initialize_cqp(int argc, String argv[]);
+	native void do_cqi_corpus_list_corpora();
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/tests/CWBCL.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/tests/JniReadFile.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/tests/JniReadFile.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/tests/JniReadFile.java	(revision 258)
@@ -0,0 +1,30 @@
+package org.txm.tests;
+
+import java.io.File;
+
+class JniReadFile {
+	//Native method declaration
+	native byte[] loadFile(String name);
+	
+	//Load the library
+	static {
+		System.out.println(System.getProperty("java.library.path"));  //$NON-NLS-1$
+		System.loadLibrary("nativelib"); //$NON-NLS-1$
+	}
+
+	public static void main(String args[]) {
+		byte buf[];
+		
+		//Create class instance
+		JniReadFile mappedFile = new JniReadFile();
+		
+		//Call native method to load ReadFile.java
+		File aFile = new File("/home/mdecorde/Bureau/modifiedCWBSrc/cwb/trunk/COPYING"); //$NON-NLS-1$
+		buf = mappedFile.loadFile(aFile.getAbsolutePath());
+		
+		//Print contents of ReadFile.java
+		for (int i=0 ; i<buf.length ; i++) {
+			System.out.print((char)buf[i]);
+		}
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/tests/JniReadFile.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/tests/TestJNI.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/tests/TestJNI.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/tests/TestJNI.java	(revision 258)
@@ -0,0 +1,14 @@
+package org.txm.tests;
+
+class TestJNI {
+	public native void afficherBonjour();
+
+	static {
+		System.out.println(System.getProperty("java.library.path"));  //$NON-NLS-1$
+		System.loadLibrary("mabibjni"); //$NON-NLS-1$
+	}
+
+	public static void main(String[] args) {
+		new TestJNI().afficherBonjour();
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/tests/TestJNI.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/metadatas/MetadataGroup.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/metadatas/MetadataGroup.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/metadatas/MetadataGroup.java	(revision 258)
@@ -0,0 +1,41 @@
+package org.txm.metadatas;
+import java.util.ArrayList;
+
+import org.w3c.dom.Element;
+
+public class MetadataGroup extends Metadata{
+
+	public ArrayList<Metadata> metadatas;
+	public int position;
+	public MetadataGroup(String id, String shortname, String longname, String type, String sortBy, 
+			boolean selection, boolean partition, boolean display, int colwidth)
+	{
+		super(id, shortname, longname, type, sortBy, selection, partition, display, true, colwidth);
+		this.metadatas = new ArrayList<Metadata>();
+		this.position = 0;
+	}
+	
+	public MetadataGroup(Element node) {
+		super(node);
+		this.metadatas = new ArrayList<Metadata>();
+		this.position = Integer.parseInt(node.getAttribute("position")); //$NON-NLS-1$
+		this.id = node.getAttribute("ref"); //$NON-NLS-1$
+	}
+	
+	public MetadataGroup(String id, String shortname, String longname, String type, boolean selection, 
+			boolean partition, boolean display, ArrayList<Metadata> metadatas, int position, int colwidth)
+	{
+		super(id, shortname, longname, type, null, selection, partition, display, true, colwidth);
+		this.metadatas = metadatas;
+		this.position = position;
+	}
+	
+	public ArrayList<Metadata> getMetadatas() {
+		return metadatas;
+	}
+	
+	@Override
+	public String toString() {
+		return super.toString() + ", metadatas: "+metadatas+", position: "+position; //$NON-NLS-1$ //$NON-NLS-2$
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/metadatas/MetadataGroup.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/metadatas/DateMetadata.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/metadatas/DateMetadata.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/metadatas/DateMetadata.java	(revision 258)
@@ -0,0 +1,92 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+package org.txm.metadatas;
+
+import java.util.HashMap;
+
+import org.w3c.dom.Element;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class Metadata.
+ */
+public class DateMetadata extends org.txm.metadatas.Metadata
+{
+	public String inputFormat, outputFormat;
+	
+	/**
+	 * Instantiates a new metadata.
+	 *
+	 * @param meta the n
+	 */
+	public DateMetadata(Element meta)
+	{
+		super(meta);
+		inputFormat = meta.getAttribute("inputFormat"); //$NON-NLS-1$
+		outputFormat = meta.getAttribute("outputFormat"); //$NON-NLS-1$
+	}
+	
+	/**
+	 * Instantiates a new metadata.
+	 *
+	 * @param id the id
+	 * @param longname the longname
+	 * @param type the type
+	 * @param selection the selection
+	 * @param partition the partition
+	 * @param display the display
+	 */
+	public DateMetadata(String id, String shortname, String longname, String type, boolean selection, boolean partition, boolean display, String inputFormat, String outputFormat, int colwidth)
+	{
+		super(id, shortname, longname, type, null, selection, partition, display, true, colwidth);
+		this.inputFormat = inputFormat;
+		this.outputFormat = outputFormat;
+	}
+	
+	/**
+	 * Instantiates a new metadata.
+	 * @param sAttributeInfos 
+	 *
+	 * @param n the dom element
+	 */
+	public DateMetadata(HashMap<String, String> sAttributeInfos, Element n) {
+		super(sAttributeInfos, n);
+		inputFormat = sAttributeInfos.get("inputFormat"); //$NON-NLS-1$
+		outputFormat = sAttributeInfos.get("outputFormat"); //$NON-NLS-1$
+		//System.out.println("FORMATS: "+inputFormat+" "+outputFormat);
+	}
+	
+	/* (non-Javadoc)
+	 * @see java.lang.Object#toString()
+	 */
+	@Override
+	public String toString()
+	{
+		return super.toString()+", inputFormat="+inputFormat+", outputFormat="+outputFormat; //$NON-NLS-1$ //$NON-NLS-2$
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/metadatas/DateMetadata.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/metadatas/package.html
===================================================================
--- tmp/org.txm.core/src/java/org/txm/metadatas/package.html	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/metadatas/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Tools to manage metadata</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/java/org/txm/metadatas/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/metadatas/Metadata.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/metadatas/Metadata.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/metadatas/Metadata.java	(revision 258)
@@ -0,0 +1,186 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+package org.txm.metadatas;
+
+import java.util.HashMap;
+
+import org.w3c.dom.Element;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class Metadata: contains a metadata declaration.
+ */
+public class Metadata
+{
+	
+	/** The id. */
+	public String id;
+	public String shortname;
+	public String longname;
+	
+	/** The type. */
+	public String type = "String"; //$NON-NLS-1$
+	public String sortBy = null;
+	
+	/** The selection. */
+	public boolean selection = true;
+	
+	/** The partition. */
+	public boolean partition = false;
+	
+	/** The display. */
+	public boolean display = false;
+	public boolean open = false;
+	public int colwidth = 100;
+
+	/**
+	 * Instantiates a new metadata.
+	 *
+	 * @param n the n
+	 */
+	public Metadata(groovy.util.Node n)
+	{
+		id = (String) n.attribute("id"); //$NON-NLS-1$
+		shortname =(String) n.attribute("shortname"); //$NON-NLS-1$
+		longname = (String) n.attribute("longname"); //$NON-NLS-1$
+		type = (String) n.attribute("type"); //$NON-NLS-1$
+		sortBy = (String) n.attribute("sortBy"); //$NON-NLS-1$
+		if(n.attribute("selection") != null) //$NON-NLS-1$
+			selection = Boolean.parseBoolean((String) n.attribute("selection")); //$NON-NLS-1$
+		if(n.attribute("partition") != null) //$NON-NLS-1$
+			partition = Boolean.parseBoolean((String) n.attribute("partition")); //$NON-NLS-1$
+		if(n.attribute("display") != null) //$NON-NLS-1$
+			display = Boolean.parseBoolean((String) n.attribute("display")); //$NON-NLS-1$
+		if(n.attribute("open") != null) //$NON-NLS-1$
+			open = Boolean.parseBoolean((String) n.attribute("open")); //$NON-NLS-1$
+		if(n.attribute("colwidth") != null) //$NON-NLS-1$
+			colwidth = Integer.parseInt((String) n.attribute("colwidth")); //$NON-NLS-1$
+	}
+	
+	/**
+	 * Instantiates a new metadata.
+	 *
+	 * @param id the id
+	 * @param longname the longname
+	 * @param type the type
+	 * @param selection the selection
+	 * @param partition the partition
+	 * @param display the display
+	 */
+	public Metadata(String id, String shortname, String longname, String type, String sortBy, 
+			boolean selection, boolean partition, boolean display, boolean open, int colwidth)
+	{
+		this.id = id;
+		this.shortname = shortname;
+		this.longname = longname;
+		this.type = type;
+		this.selection = selection;
+		this.partition = partition;
+		this.display = display;
+		this.open = open;
+		this.sortBy = sortBy;
+	}
+	
+	//TODO: ambiguity with the Metadata defined in import.xml 
+	public Metadata(Element n) {
+		
+		shortname = n.getAttribute("shortname"); //$NON-NLS-1$
+		longname = n.getAttribute("longname"); //$NON-NLS-1$
+		type = n.getAttribute("type"); //$NON-NLS-1$
+		id = n.getAttribute("id"); //$NON-NLS-1$
+		sortBy = n.getAttribute("sortBy"); //$NON-NLS-1$
+		
+		if (n.getAttribute("selection") != null) //$NON-NLS-1$
+			try {
+				selection = Boolean.valueOf(n.getAttribute("selection")); //$NON-NLS-1$
+			} catch (Exception e) { System.out.println("Metadata: "+id+" error @selection "+e); } //$NON-NLS-1$ //$NON-NLS-2$
+		if (n.getAttribute("partition") != null) //$NON-NLS-1$
+			try {
+				partition = Boolean.valueOf(n.getAttribute("partition")); //$NON-NLS-1$
+			} catch (Exception e) { System.out.println("Metadata: "+id+" error @partition "+e); } //$NON-NLS-1$ //$NON-NLS-2$
+		if (n.getAttribute("display") != null) //$NON-NLS-1$
+			try {
+				display = Boolean.valueOf(n.getAttribute("display")); //$NON-NLS-1$
+			} catch (Exception e) { System.out.println("Metadata: "+id+" error @display "+e); } //$NON-NLS-1$ //$NON-NLS-2$
+		if (n.getAttribute("open") != null) //$NON-NLS-1$
+			try {
+				open = Boolean.valueOf(n.getAttribute("open")); //$NON-NLS-1$
+			} catch (Exception e) { System.out.println("Metadata: "+id+" error @open "+e); } //$NON-NLS-1$ //$NON-NLS-2$
+		if (n.getAttribute("colwidth") != null) //$NON-NLS-1$
+			try {
+				colwidth = Integer.parseInt(n.getAttribute("colwidth")); //$NON-NLS-1$
+			} catch (Exception e) { System.out.println("Metadata: "+id+" error @colwidth: "+e); } //$NON-NLS-1$ //$NON-NLS-2$
+	}
+	
+	/**
+	 * Instantiates a new metadata.
+	 * @param hashMap 
+	 *
+	 * @param n the n
+	 */
+	public Metadata(HashMap<String, String> sattributeInfos, Element n) {
+		
+		shortname = sattributeInfos.get("shortname"); //$NON-NLS-1$
+		longname = sattributeInfos.get("longname"); //$NON-NLS-1$
+		type = sattributeInfos.get("type"); //$NON-NLS-1$
+		
+		id = n.getAttribute("ref"); //$NON-NLS-1$
+		id = id.substring(5); // remove "text_"
+		sortBy = n.getAttribute("sortBy"); //$NON-NLS-1$
+		if (n.getAttribute("selection") != null) //$NON-NLS-1$
+			try {
+				selection = Boolean.valueOf(n.getAttribute("selection")); //$NON-NLS-1$
+			} catch (Exception e) { System.out.println("Metadata: "+id+" error @selection"); } //$NON-NLS-1$ //$NON-NLS-2$
+		if (n.getAttribute("partition") != null) //$NON-NLS-1$
+			try {
+				partition = Boolean.valueOf(n.getAttribute("partition")); //$NON-NLS-1$
+			} catch (Exception e) { System.out.println("Metadata: "+id+" error @partition"); } //$NON-NLS-1$ //$NON-NLS-2$
+		if (n.getAttribute("display") != null) //$NON-NLS-1$
+			try {
+				display = Boolean.valueOf(n.getAttribute("display")); //$NON-NLS-1$
+			} catch (Exception e) { System.out.println("Metadata: "+id+" error @display"); } //$NON-NLS-1$ //$NON-NLS-2$
+		if (n.getAttribute("open") != null) //$NON-NLS-1$
+			try {
+				open = Boolean.valueOf(n.getAttribute("open")); //$NON-NLS-1$
+			} catch (Exception e) { System.out.println("Metadata: "+id+" error @open"); } //$NON-NLS-1$ //$NON-NLS-2$
+		if (n.getAttribute("colwidth") != null) //$NON-NLS-1$
+			try {
+				colwidth = Integer.parseInt(n.getAttribute("colwidth")); //$NON-NLS-1$
+			} catch (Exception e) { System.out.println("Metadata: "+id+" error @colwidth"); } //$NON-NLS-1$ //$NON-NLS-2$
+	}
+	
+	/* (non-Javadoc)
+	 * @see java.lang.Object#toString()
+	 */
+	@Override
+	public String toString()
+	{
+		return id+"/"+shortname+"/"+longname+", "+type+", sortBy="+sortBy+", sel="+selection+ //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+				", part="+partition+", display="+display+", open="+open+", colwidth="+colwidth; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/metadatas/Metadata.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/metadatas/Entry.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/metadatas/Entry.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/metadatas/Entry.java	(revision 258)
@@ -0,0 +1,69 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+package org.txm.metadatas;
+
+import org.txm.utils.Pair;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class Entry.
+ */
+public class Entry extends Pair<String, String>
+{	
+	
+	/**
+	 * Instantiates a new entry.
+	 *
+	 * @param id the id
+	 * @param value the value
+	 */
+	public Entry(String id, String value)
+	{
+		super(id, value);
+	}
+	
+	/**
+	 * Gets the id.
+	 *
+	 * @return the id
+	 */
+	public String getId()
+	{
+		return this.getFirst();
+	}
+	
+	/**
+	 * Gets the value.
+	 *
+	 * @return the value
+	 */
+	public String getValue()
+	{
+		return this.getSecond();
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/metadatas/Entry.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/metadatas/Metadatas.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/metadatas/Metadatas.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/metadatas/Metadatas.java	(revision 258)
@@ -0,0 +1,605 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+package org.txm.metadatas;
+
+import groovy.util.Node;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.List;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathExpression;
+import javax.xml.xpath.XPathExpressionException;
+import javax.xml.xpath.XPathFactory;
+
+import org.txm.importer.AddAttributeInXml;
+import org.txm.importer.graal.PersonalNamespaceContext;
+import org.txm.utils.AsciiUtils;
+import org.txm.utils.CsvReader;
+import org.txm.utils.Pair;
+import org.txm.utils.logger.Log;
+import org.txm.utils.xml.DomUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class Metadatas.
+ */
+public class Metadatas extends LinkedHashMap<String , TextInjection> {
+	
+	/** Load metadatas from a xml file $lt;metadatas> $lt;meta key="key1"> $lt;entry name="attr1" value="value1"/> $lt;entry name="attr1" value="value1"/> $lt;meta/> $lt;/metadatas>. */
+	File xmlfile;
+	
+	/** The metadatas. */
+	ArrayList<Metadata> metadatas = new ArrayList<Metadata>();
+	
+	/** The headers list. */
+	ArrayList<String> headersList = new ArrayList<String>();
+	
+	/** The isinialize. */
+	boolean isinialize = false;
+	
+	/**
+	 * Checks if is initialized.
+	 *
+	 * @return true, if is initialized
+	 */
+	public boolean isInitialized()
+	{
+		return isinialize;
+	}
+	
+	/** The ns context. */
+	NamespaceContext nsContext = new PersonalNamespaceContext();
+	
+	/**
+	 * Instantiates a new metadatas.
+	 *
+	 * @param xmlfile the xmlfile
+	 */
+	public Metadatas(File xmlfile)
+	{
+		this.xmlfile = xmlfile;
+		if(!initialize())
+			System.out.println("Error: failed to load metadata from the file "+xmlfile);
+	}
+	
+	/**
+	 * Instantiates a new metadatas.
+	 *
+	 * @param csvfile the csvfile
+	 * @param encoding the encoding
+	 * @param separator the separator
+	 * @param nbheaderline the nbheaderline
+	 */
+	public Metadatas(File csvfile, String encoding, String separator, String txtseparator, int nbheaderline)
+	{
+		File xmlfile = new File(csvfile.getParent(), csvfile.getName()+".xml");
+		//println "create xml file version of "+csvfile+" : "+xmlfile
+		try {
+			if(convertCsvToXml(csvfile, xmlfile, encoding, separator, txtseparator, nbheaderline))
+			{	
+				this.xmlfile = xmlfile;
+				//println "xml file : "+xmlfile
+				if(!initialize())
+					System.out.println("Error: failed to load metadata from the file "+xmlfile);
+			}
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+			Log.severe(e.toString());
+		}
+	}
+	
+	public File getXMLFile() {
+		return xmlfile;
+	}
+	
+	/** The sattr. */
+	String sattr = "";
+	
+	/**
+	 * Initialize.
+	 *
+	 * @return true, if successful
+	 */
+	private boolean initialize()
+	{
+		Document doc;
+		try {
+			doc = DomUtils.load(xmlfile);
+		} catch (Exception e1) {
+			org.txm.utils.logger.Log.printStackTrace(e1);
+			Log.severe(e1.toString());
+			return false;
+		}
+		NodeList metadatasNodes = doc.getElementsByTagName("metadatas");
+		NodeList metadataNodes = null;
+		// get metadata nodes
+		for (int i = 0 ; i < metadatasNodes.getLength() ; ) {
+			Element metadatasNode = (Element)metadatasNodes.item(0);
+			metadataNodes = metadatasNode.getElementsByTagName("metadata");
+			break;
+		}
+		for (int i = 0 ; i < metadataNodes.getLength() ; i++) {
+			Element metadataNode = (Element)metadataNodes.item(i);
+			Metadata m = new Metadata(metadataNode);
+			if (m.id == null) {
+				System.out.println("The metadata file is missing attribute 'id'");
+				return false;
+			}
+			this.metadatas.add(m);
+			sattr +="+"+m.id;
+			headersList.add(m.id);
+		}
+		
+		// List<Node> Lmetadatas = doc.texts.text;
+		// get metadata nodes
+		NodeList textsNodes = doc.getElementsByTagName("texts");
+		NodeList textNodes = null;
+		for(int i = 0 ; i < textsNodes.getLength() ;) { // get text nodes
+			Element textsNode = (Element)textsNodes.item(0);
+			textNodes = textsNode.getElementsByTagName("text");
+			break;
+		}
+		for(int i = 0 ; i < textNodes.getLength() ; i++) {
+			Element e = (Element)textNodes.item(i);
+			TextInjection inj = new TextInjection(e);
+			this.put(inj.id, inj);
+		}
+		
+		isinialize = true;
+		return true;
+	}
+	
+	public HashMap<String, String> getTextMetadata(File f)
+	{
+		HashMap<String, String> data = new HashMap<String, String>();
+		String txtname = f.getName();
+		int idx = txtname.lastIndexOf(".");
+		if(idx > 0) txtname = txtname.substring(0, idx);
+		
+		TextInjection injection = this.get(txtname);
+		if (injection == null) {
+			System.out.println("Could not find injection for text "+txtname);
+			return data;
+		}
+		for (Entry e : injection) {
+			data.put(e.getId(), e.getValue());
+		}
+		
+		return data;
+	}
+	
+	/**
+	 * Convert csv to xml.
+	 *
+	 * @param csvfile the csvfile
+	 * @param xmlFile the xml file
+	 * @param encoding the encoding
+	 * @param separator the separator
+	 * @param nbheaderline the nbheaderline
+	 * @return true, if successful
+	 * @throws Exception 
+	 */
+	public static boolean convertCsvToXml(File csvfile, File xmlFile, String encoding, String separator, String txtseparator, int nbheaderline) throws Exception
+	{	
+		xmlFile.createNewFile();
+
+		if(!csvfile.exists())
+		{
+			System.out.println("Error: CSV file does not exists");
+			return false;
+		}
+		
+		XMLOutputFactory factory = XMLOutputFactory.newInstance();
+		FileOutputStream output = new FileOutputStream(xmlFile);
+		XMLStreamWriter writer = factory.createXMLStreamWriter(output, "UTF-8");//create a new file
+		
+		CsvReader reader = new CsvReader(csvfile.getAbsolutePath(), separator.charAt(0), Charset.forName(encoding));
+		if (txtseparator != null && txtseparator.length() > 0)
+			reader.setTextQualifier(txtseparator.charAt(0));
+		
+		reader.readHeaders();
+		
+		String[] headers = reader.getHeaders();
+		
+		if (headers.length == 0)
+		{
+			System.out.println("Error: No header in the metadata file "+csvfile);
+			return false;
+		}
+		
+		if(!headers[0].equals("id"))
+		{
+			System.out.println("Error: The first column name in the header line of the metadata file '$csvfile' must be 'id' and found '"+headers[0]+"'");
+			return false;
+		}
+			
+		//check for double columns
+		HashSet<String> testhash = new HashSet<String>();
+		HashSet<String> doubles = new HashSet<String>();
+		for (String str : headers)
+		{
+			if (testhash.contains(str))
+				doubles.add(str);
+			testhash.add(str);
+		}
+		if (doubles.size() > 0)
+		{
+			System.out.println("Error: the metadata file '$csvfile' contains duplicated column names: "+doubles);
+			return false;
+		}
+		
+		String[] longnames = new String[headers.length];
+		String[] types = new String[headers.length];
+		if (nbheaderline > 1)//get longnames
+		{
+			reader.readRecord();
+			for (int i = 0 ; i < headers.length ; i++) {
+				longnames[i] = reader.get(headers[i]);
+			}
+		}
+		else
+			for (int i = 0 ; i < headers.length ; i++) {
+				longnames[i] = headers[i];
+			}
+		
+		if (nbheaderline > 2)//got types
+		{
+			reader.readRecord();
+			for (int i = 0 ; i < headers.length ; i++)
+			{
+				types[i] = reader.get(headers[i]);
+			}
+		}
+		else
+		{
+			for (int i = 0 ; i < headers.length ; i++) {
+				types[i] = "String";
+			}
+		}
+		
+		writer.writeStartDocument("UTF-8", "1.0");
+		writer.writeStartElement("enrichissement");
+		writer.writeStartElement("metadatas");
+		//println "headers : "+Arrays.toString(headers)
+		for (int i = 1 ; i < headers.length ; i++) {
+			if (headers[i].length() == 0) {
+				headers[i] = "noname";
+				System.out.println("Warning: the "+(i+1)+"th column name is empty");
+			}
+			//if(!headers[i].equals("id"))// the first
+			//{
+			writer.writeStartElement("metadata");
+			writer.writeAttribute("id", AsciiUtils.buildId(headers[i]));
+			writer.writeAttribute("shortname", headers[i]);
+			writer.writeAttribute("longname", longnames[i]);
+			writer.writeAttribute("type", types[i]);
+			writer.writeAttribute("colwidth", "100");
+			writer.writeAttribute("selection", "true");
+			writer.writeAttribute("partition", "true");
+			writer.writeAttribute("display", "true");
+			
+			writer.writeEndElement();
+			//}	
+		}
+		writer.writeEndElement();//close metadatas
+		
+		writer.writeStartElement("texts");
+		while (reader.readRecord())	{
+			writer.writeStartElement("text");
+			for(int i = 0 ; i < headers.length ; i++)
+				if(headers[i].equals("id")) {
+					writer.writeAttribute("id", reader.get(headers[i]));
+				} else if(headers[i].equals("xpath")) {
+					writer.writeAttribute("xpath", reader.get(headers[i]));
+				}
+			
+			for(int i = 0 ; i < headers.length ; i++)
+				if(!headers[i].equals("id") && !headers[i].equals("xpath"))
+				{
+					writer.writeEmptyElement("entry");
+					writer.writeAttribute("id", AsciiUtils.buildId(headers[i]));
+					String value = reader.get(headers[i]);
+					if(value.length()  ==  0)
+						writer.writeAttribute("value", "N/A");
+					else
+						writer.writeAttribute("value", value);
+					
+				}
+			writer.writeEndElement();
+		}
+		writer.writeEndElement();//close texts
+		writer.writeEndElement();//close metadatas
+		
+		reader.close();
+		writer.close();
+		output.close();
+		
+		output = null;
+		writer = null;
+		return true;
+	}
+	
+	/**
+	 * Keep only metadatas.
+	 *
+	 * @param ids the ids
+	 */
+	public void keepOnlyMetadatas(String[] ids)
+	{
+		//println metadatas
+		List<String> Lids = Arrays.asList(ids);
+		headersList.removeAll(Lids);
+		for(int i = 0 ; i < metadatas.size() ; i++)
+		{
+			Metadata m = metadatas.get(i);
+			if(!Lids.contains(m.id))
+			{	
+				metadatas.remove(i);
+				i--;
+			}
+		}
+		
+		for(TextInjection inj : this.values())
+		{
+			for(int i = 0 ; i < inj.size() ; i++)
+			{
+				Entry e = inj.get(i);
+				if(!Lids.contains(e.getId()))
+				{
+					inj.remove(i);
+					i--;
+				}
+			}
+		}
+	}
+	
+	/**
+	 * Inject metadatas in xml txm.
+	 *
+	 * @param infile the infile
+	 * @param outfile the outfile
+	 * @return true, if successful
+	 */
+	public boolean injectMetadatasInXmlTXM(File infile, File outfile)
+	{
+		return injectMetadatasInXml(infile, outfile,"text", "tei");
+	}
+	
+	/**
+	 * Inject metadatas in xml.
+	 *
+	 * @param infile the infile
+	 * @param outfile the outfile
+	 * @param tag the tag
+	 * @return true, if successful
+	 */
+	public boolean injectMetadatasInXml(File infile, File outfile, String tag)
+	{
+		return injectMetadatasInXml(infile, outfile,tag, null);
+	}
+	
+	/**
+	 * Inject metadatas in xml.
+	 *
+	 * @param infile the infile
+	 * @param outfile the outfile
+	 * @param tag the tag
+	 * @param namespace the namespace
+	 * @return true, if successful
+	 */
+	public boolean injectMetadatasInXml(File infile, File outfile, String tag, String namespace)
+	{
+		String key = infile.getName();
+		if(key.lastIndexOf(".") > 0)
+			key = key.substring(0, key.lastIndexOf("."));
+		
+		ArrayList<org.txm.metadatas.Entry> metas = get(key);
+		
+		if (metas == null) {
+			System.out.println("\nError: can't find metadata for text of id="+key);
+			System.out.println("Maybe the metadata file doesn't have the right format (comma separated values are needed)");
+			return false;
+		}
+		
+		AddAttributeInXml builder = new AddAttributeInXml(infile, tag, metas);
+		builder.onlyOneElement();
+		return builder.process(outfile);
+	}
+	
+	/**
+	 * Save.
+	 *
+	 * @param doc the doc
+	 * @param outfile the outfile
+	 * @return true, if successful
+	 */
+	private boolean save(org.w3c.dom.Node doc, File outfile)
+	{
+		try {
+			// Création de la source DOM
+			Source source = new DOMSource(doc);
+			
+			// Création du fichier de sortie
+			Writer writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outfile), "UTF-8")); 
+			Result resultat = new StreamResult(writer);
+			
+			// Configuration du transformer
+			TransformerFactory fabrique = new net.sf.saxon.TransformerFactoryImpl();
+			Transformer transformer = fabrique.newTransformer();
+			transformer.setOutputProperty(OutputKeys.INDENT, "yes");
+			transformer.setOutputProperty(OutputKeys.METHOD, "xml");
+			transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
+			
+			// Transformation
+			transformer.transform(source, resultat);
+			writer.close();
+			doc = null;
+			return true;
+		} catch (Exception e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+			return false;
+		}
+	}
+	
+	/**
+	 * Insert.
+	 *
+	 * @param doc the doc
+	 * @param xpath the xpath
+	 * @param pairs the pairs
+	 * @return true, if successful
+	 * @throws XPathExpressionException 
+	 */
+	public boolean insert(Node doc, String xpath, List<Pair<String, String>> pairs) throws XPathExpressionException
+	{
+		//println ("insert $pairs into $xpath")
+		XPathFactory factory = XPathFactory.newInstance();
+		XPath XpathObj = factory.newXPath();
+		
+		XpathObj.setNamespaceContext(nsContext);
+		XPathExpression expr = XpathObj.compile(xpath);
+		
+		NodeList nodes = (NodeList) expr.evaluate(doc, XPathConstants.NODESET);
+		int count = 0;
+		for(int i = 0 ; i < nodes.getLength() ; i++) {
+			org.w3c.dom.Node node = nodes.item(i);
+			Element elem = (Element)node;
+			for(Pair<String, String> p : pairs) {
+				//println "add attr "+p.getFirst()+"="+ p.getSecond()
+				elem.setAttribute(p.getFirst(), p.getSecond());
+			}
+			count++;
+		}
+		
+		factory = null;
+		XpathObj = null;
+		expr = null;
+		if(count > 0)
+			return true;
+		else
+		{
+			System.out.println("Error: no tag has been found with the xpath: "+xpath);
+			return false;
+		}
+	}
+	
+	/**
+	 * Gets the property names.
+	 *
+	 * @return the property names
+	 */
+	public List<String> getPropertyNames()
+	{
+		return headersList;
+	}
+	
+	/**
+	 * Gets the sattributes.
+	 *
+	 * @return the sattributes
+	 */
+	public String getSattributes()
+	{
+		String sattr = "";
+		for(String attr : headersList)
+			sattr += "+"+attr;
+		return sattr;
+	}
+	
+	/* (non-Javadoc)
+	 * @see java.util.AbstractMap#toString()
+	 */
+	@Override
+	public String toString()
+	{
+		StringBuffer str = new StringBuffer();
+		str.append("Metadata: \n");
+		for(Metadata data : metadatas)
+			str.append(" "+data.toString()+"\n");
+		
+		str.append("Injections: \n");
+		for(TextInjection injection : this.values())
+		{
+			str.append(" "+injection.toString()+"\n");
+		}
+		return str.toString();
+	}
+	
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args)
+	{
+		String userhome = System.getProperty("user.home");
+		File xmlfile = new File(userhome, "/xml/metadata.xml");
+		File csvfile = new File(userhome, "/xml/metadata.csv");
+
+		Metadatas m = new Metadatas(csvfile, "UTF-8", ",","\"", 1);
+		if(m.isInitialized())
+		{
+			String[] okmetadatas = {"date", "lieu"};
+			System.out.println(m.toString());
+		}
+	}
+
+	public ArrayList<Metadata> getMetadatas() {
+		return metadatas;
+	}	
+	
+	public ArrayList<String> getHeadersList(){
+		return this.headersList;
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/metadatas/Metadatas.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/metadatas/MinMaxDateGroup.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/metadatas/MinMaxDateGroup.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/metadatas/MinMaxDateGroup.java	(revision 258)
@@ -0,0 +1,69 @@
+package org.txm.metadatas;
+
+import org.txm.objects.Corpus;
+import org.w3c.dom.Element;
+
+public class MinMaxDateGroup extends MetadataGroup
+{
+	String inputFormat = "yyyy-MM-dd"; //$NON-NLS-1$
+	String outputFormat = "yyyy-MM-dd"; //$NON-NLS-1$
+	public static String TYPE = "MinMaxDateGroup"; //$NON-NLS-1$
+	
+	public MinMaxDateGroup(String id, String shortname, String longname, boolean selection, boolean partition, boolean display, Metadata min, Metadata max, String inputFormat, String outputFormat, int position, int colwidth)
+	{
+		super(id, shortname, longname, TYPE, null, selection, partition, display, colwidth);
+		
+		this.position = position;
+		metadatas.add(min);
+		metadatas.add(max);
+		this.inputFormat = inputFormat;
+		this.outputFormat = outputFormat;
+	}
+
+	public MinMaxDateGroup(Corpus corpus, Element group) {
+		super(group);
+		id = group.getAttribute("ref"); //$NON-NLS-1$
+		//System.out.println("create1 MinMaxDateGroup: "+group);
+		String minname = group.getAttribute("min"); //$NON-NLS-1$
+		String maxname = group.getAttribute("max"); //$NON-NLS-1$
+		this.outputFormat = group.getAttribute("outputFormat"); //$NON-NLS-1$
+		this.inputFormat = group.getAttribute("inputFormat"); //$NON-NLS-1$
+		//System.out.println("create minmaxdategroup with: "+corpus.importmetadatas);
+		//get the Metadata objects
+		Metadata min=null, max=null;
+		for (Metadata meta : corpus.importmetadatas) {
+			//System.out.println("declared meta: "+meta);
+			if (min != null && max != null) // stop when all metadatas are found
+				break;
+			if (meta.id.equals(minname))
+				min = meta;
+			else if (meta.id.equals(maxname))
+				max = meta;
+		}
+		metadatas.add(min);
+		metadatas.add(max);
+		//System.out.println(this);
+	}
+	
+	@Override
+	public String toString()
+	{
+		return super.toString()+", output: "+outputFormat+", intput: "+inputFormat; //$NON-NLS-1$ //$NON-NLS-2$
+	}
+
+	public String getInputFormat() {
+		return inputFormat;
+	}
+
+	public void setInputFormat(String inputFormat) {
+		this.inputFormat = inputFormat;
+	}
+
+	public String getOutputFormat() {
+		return outputFormat;
+	}
+
+	public void setOutputFormat(String outputFormat) {
+		this.outputFormat = outputFormat;
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/metadatas/MinMaxDateGroup.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/metadatas/TextInjection.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/metadatas/TextInjection.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/metadatas/TextInjection.java	(revision 258)
@@ -0,0 +1,81 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+package org.txm.metadatas;
+
+import java.util.ArrayList;
+import org.txm.metadatas.Entry;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class TextInjection.
+ */
+public class TextInjection extends ArrayList<Entry>
+{
+	
+	/** The id. */
+	public String id;
+	
+	/** The xpath. */
+	public String xpath;
+
+	public TextInjection(Element elem) {
+		
+		this.id = elem.getAttribute("id"); //$NON-NLS-1$
+		this.xpath = elem.getAttribute("xpath"); //$NON-NLS-1$
+		NodeList entries = elem.getElementsByTagName("entry"); //$NON-NLS-1$
+		for(int i = 0 ; i < entries.getLength() ; i++)
+		{
+			Element e = (Element)entries.item(i);
+			this.add(new Entry(e.getAttribute("id"), e.getAttribute("value"))); //$NON-NLS-1$ //$NON-NLS-2$
+		}
+	}
+	
+	/**
+	 * create empty TextInjection.
+	 *
+	 * @param id the id
+	 * @param xpath the xpath
+	 */
+	public TextInjection(String id, String xpath)
+	{
+		this.id = id;
+		this.xpath = xpath;
+	}
+
+
+	/* (non-Javadoc)
+	 * @see java.util.AbstractCollection#toString()
+	 */
+	@Override
+	public String toString()
+	{
+		return "<"+id+", "+xpath+"> : "+super.toString(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/metadatas/TextInjection.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/Toolbox.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/Toolbox.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/Toolbox.java	(revision 258)
@@ -0,0 +1,1171 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2017-01-24 18:11:42 +0100 (Tue, 24 Jan 2017) $
+// $LastChangedRevision: 3400 $
+// $LastChangedBy: mdecorde $ 
+//
+
+package org.txm;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Properties;
+import java.util.TreeMap;
+import java.util.logging.Level;
+
+import org.apache.commons.lang.StringUtils;
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.core.results.ITXMResult;
+import org.txm.importer.cwb.PatchCwbRegistry;
+import org.txm.objects.Base;
+import org.txm.objects.Workspace;
+import org.txm.searchengine.cqp.AbstractCqiClient;
+import org.txm.searchengine.cqp.AbstractCqiServer;
+import org.txm.searchengine.cqp.MemCqiClient;
+import org.txm.searchengine.cqp.MemCqiServer;
+import org.txm.searchengine.cqp.NetCqiClient;
+import org.txm.searchengine.cqp.NetCqiServer;
+import org.txm.searchengine.cqp.clientExceptions.ServerNotFoundException;
+import org.txm.searchengine.cqp.corpus.Corpus;
+import org.txm.searchengine.cqp.corpus.CorpusManager;
+import org.txm.searchengine.cqp.corpus.MainCorpus;
+import org.txm.searchengine.cqp.corpus.Partition;
+import org.txm.statsengine.r.core.RStatsEngine;
+import org.txm.statsengine.r.core.exceptions.RWorkspaceException;
+import org.txm.utils.OSDetector;
+//import org.txm.tbx.chartsengine.jfreechart.JFCChartsEngine;
+//import org.txm.tbx.chartsengine.r.RChartsEngine;
+//import org.txm.tbx.chartsengine.r.RDevice;
+import org.txm.utils.Sh;
+import org.txm.utils.logger.Log;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class Toolbox. A collection of static methods to initialize the toolbox
+ * It initialize its StatEngine : R, and its SearchEngine : CWB
+ * 
+ * @author jmague, mdecorde, sjacquot
+ */
+public class Toolbox {
+
+	public static boolean useNetCQi = false;
+
+	/** The TXMHOME. */
+	protected static String TXMHOME = System.getProperty("user.home") + "/TXM"; //$NON-NLS-1$ //$NON-NLS-2$
+
+	/** The TXMINSTALL. */
+	public static String TXMINSTALL = System.getProperty("user.home") + "/TXM"; //$NON-NLS-1$ //$NON-NLS-2$
+
+	/** The state. */
+	private static boolean state = false;
+
+	/** The state search engine. */
+	private static boolean stateSearchEngine = false;
+
+	/** The state workspace. */
+	private static boolean stateWorkspace = false;
+
+	/** The properties. */
+	private static Properties properties = new Properties();
+
+	/** The workspace. */
+	public static Workspace workspace;
+
+	/** The CQI server. */
+	private static AbstractCqiServer cqiServer;
+
+	/** The CQI client. */
+	private static AbstractCqiClient cqiClient;
+
+
+
+	/**
+	 * Sets the CQI server.
+	 *
+	 * @param cqiServer the new cqi server
+	 */
+	public static void setCqiServer(AbstractCqiServer cqiServer) {
+		Toolbox.cqiServer = cqiServer;
+	}
+
+	/**
+	 * Gets the cqi client.
+	 *
+	 * @return the cqi client
+	 */
+	public static AbstractCqiClient getCqiClient() {
+		return cqiClient;
+	}
+
+	/**
+	 * Sets the cqi client.
+	 *
+	 * @param cqiClient the new cqi client
+	 */
+	public static void setCqiClient(NetCqiClient cqiClient) {
+		Toolbox.cqiClient = cqiClient;
+	}
+
+	/**
+	 * Gets the CQI server.
+	 *
+	 * @return the CQI server
+	 */
+	public static AbstractCqiServer getCqiServer() {
+		return cqiServer;
+	}
+
+	/** The Constants for Toolbox properties. */
+	public static final String LOG_LEVEL = "log_level"; //$NON-NLS-1$
+	public static final String ADD_TECH_LOGS = "log_in_console"; //$NON-NLS-1$
+	public static final String SHOW_TIMINGS = "show_timings"; //$NON-NLS-1$
+	public static final String LOG_DIR = "log_directory"; //$NON-NLS-1$
+	public static final String LOG_IN_FILE = "log_in_file"; //$NON-NLS-1$
+	public static final String EXPERT_USER = "txm_expert_user"; //$NON-NLS-1$
+	public static final String LOG_STACKTRACE = "log_stacktrace"; //$NON-NLS-1$
+
+	/** The Constant CQI_SERVER_HOST. */
+	public static final String CQI_SERVER_HOST = "cqi_server_host"; //$NON-NLS-1$
+
+	/** The Constant CQI_SERVER_PORT. */
+	public static final String CQI_SERVER_PORT = "cqi_server_port"; //$NON-NLS-1$
+
+	/** The Constant CQI_SERVER_LOGIN. */
+	public static final String CQI_SERVER_LOGIN = "cqi_server_login"; //$NON-NLS-1$
+
+	/** The Constant CQI_SERVER_PASSWORD. */
+	public static final String CQI_SERVER_PASSWORD = "cqi_server_password"; //$NON-NLS-1$
+
+	/** The Constant CQI_SERVER_PATH_TO_EXECUTABLE. */
+	public static final String CQI_SERVER_PATH_TO_EXECUTABLE = "cqi_server_path_to_executable"; //$NON-NLS-1$
+
+	public static final String CQI_SERVER_PATH_TO_CQPLIB = "cqi_server_path_to_cqplib"; //$NON-NLS-1$
+
+	/** The Constant CQI_SERVER_PATH_TO_INIT_FILE. */
+	public static final String CQI_SERVER_PATH_TO_INIT_FILE = "cqi_server_path_to_init_file"; //$NON-NLS-1$
+
+	/** The Constant CQI_SERVER_ADDITIONAL_OPTIONS. */
+	public static final String CQI_SERVER_ADDITIONAL_OPTIONS = "cqi_server_additional_options"; //$NON-NLS-1$
+
+	/** The Constant CQI_SERVER_MONITOR_OUTPUT. */
+	public static final String CQI_SERVER_MONITOR_OUTPUT = "cqi_server_monitor_output"; //$NON-NLS-1$
+
+	/** The Constant CQI_SERVER_IS_REMOTE. */
+	public static final String CQI_SERVER_IS_REMOTE = "cqi_server_is_remote"; //$NON-NLS-1$
+
+	/** The Constant CQI_SERVER_MODE. */
+	public static final String CQI_NETWORK_MODE = "cqi_server_mode"; //$NON-NLS-1$
+
+	public static final String CQP_EMPTY_VALUE_CODE = "cqp_empty_value_code";
+
+
+	
+	/** The Constant SCRIPT_ROOT_DIR. */
+	public static final String SCRIPT_ROOT_DIR = "script_root_dir"; //$NON-NLS-1$
+
+	/** The Constant SCRIPT_CURRENT_DIR. */
+	public static final String SCRIPT_CURRENT_DIR = "script_current_dir"; //$NON-NLS-1$
+
+	/** The Constant UI_LOCALE. */
+	public static final String UI_LOCALE = "ui_locale"; //$NON-NLS-1$
+
+	/** The Constant WORKSPACE_LOCATION. */
+	public static final String WORKSPACE_LOCATION = "workspace_location"; //$NON-NLS-1$
+
+	/** The Constant INSTALL_DIR. */
+	public static final String INSTALL_DIR = "install_dir"; //$NON-NLS-1$
+
+	/** The Constant USER_TXM_HOME. */
+	public static final String USER_TXM_HOME = "user_txm_home"; //$NON-NLS-1$
+
+//	/** The Constant R_REMOTE. */
+//	public static final String IS_R_MANDATORY = "is_r_mandatory"; //$NON-NLS-1$
+//
+//	/** The Constant R_PATH_TO_EXECUTABLE. */
+//	public static final String R_PATH_TO_EXECUTABLE = "r_path_to_executable"; //$NON-NLS-1$
+//
+//	/** The Constant R_REMOTE. */
+//	public static final String R_REMOTE = "r_remote"; //$NON-NLS-1$
+//	public static final String R_DEBUG = "r_debug"; //$NON-NLS-1$
+//
+//	/** The Constant R_SERVER_ADDRESS. */
+//	public static final String R_SERVER_ADDRESS = "r_server_adress"; //$NON-NLS-1$
+//
+//	/** The Constant R_PORT. */
+//	public static final String R_PORT = "r_port"; //$NON-NLS-1$
+//
+//	/** The Constant R_USER. */
+//	public static final String R_USER = "r_user"; //$NON-NLS-1$
+//
+//	/** The Constant R_PASSWORD. */
+//	public static final String R_PASSWORD = "r_password"; //$NON-NLS-1$
+//
+//	/** The Constant R_PACKAGES_PATH. */
+//	public static final String R_PACKAGES_PATH = "r_packages_path"; //$NON-NLS-1$
+//
+//	public static final String R_RARGS = "r_rargs"; //$NON-NLS-1$
+//	public static final String R_RSERVEARGS = "r_rserveargs"; //$NON-NLS-1$
+//
+//	/** The Constant R_DISABLE. */
+//	public static final String R_DISABLE = "r_disable"; //$NON-NLS-1$
+//
+//	/** The Constant R_FILE_TRANSFERT. */
+//	public static final String R_FILE_TRANSFERT = "r_file_transfert"; //$NON-NLS-1$
+//	public static final String R_SVG_DEVICE = "r_svg_device"; //$NON-NLS-1$
+
+	/** The Constant TREETAGGER_INSTALL_PATH. */
+	public static final String TREETAGGER_INSTALL_PATH = "treetagger_install_path"; //$NON-NLS-1$
+	/** The Constant TREETAGGER_MODELS_PATH. */
+	public static final String TREETAGGER_MODELS_PATH = "treetagger_models_path"; //$NON-NLS-1$
+	public static final String TREETAGGER_OPTIONS = "treetagger_options"; //$NON-NLS-1$
+	public static final String TREETAGGER_APOSTROPHE = "treetagger_fix_apostrophes"; //$NON-NLS-1$
+
+	public static final String METADATA_ENCODING = "metadata_encoding"; //$NON-NLS-1$
+	public static final String METADATA_COLSEPARATOR = "metadata_colseparator"; //$NON-NLS-1$
+	public static final String METADATA_TXTSEPARATOR = "metadata_txtseparator"; //$NON-NLS-1$
+
+	private static boolean initializing = false;
+
+	public static boolean isInitializing() {
+		return initializing;
+	}
+
+	/** Contains all the parameters keys. */
+	public static final String[] existingKeys = { LOG_LEVEL, LOG_STACKTRACE, ADD_TECH_LOGS, LOG_DIR,
+		LOG_IN_FILE, CQI_SERVER_HOST, CQI_SERVER_PORT, CQI_SERVER_LOGIN,
+		CQI_SERVER_PASSWORD, CQI_SERVER_PATH_TO_EXECUTABLE,CQI_SERVER_PATH_TO_CQPLIB,
+		CQI_SERVER_ADDITIONAL_OPTIONS, CQI_SERVER_MONITOR_OUTPUT,
+		CQI_SERVER_IS_REMOTE, CQI_NETWORK_MODE, CQP_EMPTY_VALUE_CODE, SCRIPT_ROOT_DIR,
+		SCRIPT_CURRENT_DIR, UI_LOCALE, WORKSPACE_LOCATION, INSTALL_DIR,
+		USER_TXM_HOME,
+//		IS_R_MANDATORY, R_PATH_TO_EXECUTABLE, R_DEBUG, R_REMOTE, R_SERVER_ADDRESS,
+//		R_PORT, R_USER, R_PASSWORD, R_PACKAGES_PATH, R_RARGS, R_RSERVEARGS, R_DISABLE, R_FILE_TRANSFERT,R_SVG_DEVICE,
+		
+		TREETAGGER_INSTALL_PATH, TREETAGGER_MODELS_PATH,TREETAGGER_OPTIONS, TREETAGGER_APOSTROPHE,
+		METADATA_ENCODING, METADATA_COLSEPARATOR,METADATA_TXTSEPARATOR
+
+	};
+
+
+
+	/**
+	 * Initializes the toolbox with the parameters read in the file
+	 * textometrie.properties found in the user home directory
+	 *
+	 * @return true, if successful
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 */
+	public static boolean initialize() throws Exception {
+		initializing = true;
+		File home = new File(System.getProperty("user.home")); //$NON-NLS-1$
+		File txmDirectory = new File(home, ".txm"); //$NON-NLS-1$
+		if (!txmDirectory.exists()) {
+			txmDirectory.mkdir();
+		}
+		File configFile = new File(txmDirectory, "textometrie.properties"); //$NON-NLS-1$
+		if (!configFile.exists()) {
+			initializing = false;
+			throw new IllegalArgumentException(TXMCoreMessages.Toolbox_0 
+					+ configFile.getAbsolutePath()
+					+ TXMCoreMessages.Toolbox_16); 
+		}
+
+		boolean ret = initialize(configFile);
+		initializing = false;
+		return ret;
+	}
+
+	/**
+	 * Initializes the toolbox with the parameters read in the file
+	 * textometrie.properties found in the user home directory. Web version :
+	 * check if the Toolbox is already initialized
+	 *
+	 * @return true, if successful
+	 * @throws FileNotFoundException the file not found exception
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 */
+	public static boolean initialise() throws Exception {
+		initializing = true;
+		if (!isInitialized()) {
+			state = true;
+			boolean ret = initialize();
+			initializing = false;
+			return ret;
+		}
+
+		initializing = false;
+		return true;
+	}
+
+	/**
+	 * initialize the toolbox from a UTF-8 file
+	 * 
+	 * key1=value1 key2=value2.
+	 *
+	 * @param file the file
+	 * @return true, if successful
+	 * @throws FileNotFoundException the file not found exception
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 */
+	public static boolean initialize(File file) throws Exception {
+		initializing = true;
+		String encoding = "UTF-8"; //$NON-NLS-1$
+
+		// Windows OS
+		if (OSDetector.isFamilyWindows()) {
+			encoding = "ISO-8859-1"; //$NON-NLS-1$
+		}		
+
+		boolean ret = initialize(file, encoding);
+		initializing = false;
+		return ret;
+	}
+
+	/**
+	 * Initializes the toolbox with the parameters read in the properties file
+	 * passed in argument.
+	 *
+	 * @param file the file
+	 * @param encoding the encoding
+	 * @return true, if successful
+	 * @throws FileNotFoundException the file not found exception
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 */
+	public static boolean initialize(File file, String encoding) throws Exception {
+		initializing = true;
+		//System.out.println("Reading properties from file: " + file.getAbsolutePath());
+		Properties properties = new Properties();
+		try {
+			BufferedReader input = new BufferedReader(new InputStreamReader(
+					new FileInputStream(file), encoding));
+			String line = input.readLine();
+			while (line != null) {
+				String[] split = line.split("="); //$NON-NLS-1$
+				if (split.length == 2) {
+					properties.put(split[0], split[1]);
+				} else if (split.length > 2) {
+					String[] subsplit = new String[split.length - 1];
+					System.arraycopy(split, 1, subsplit, 0, split.length - 1);
+					properties.put(split[0], StringUtils.join(subsplit, "=")); //$NON-NLS-1$
+				}
+				line = input.readLine();
+			}
+			input.close();
+		} catch (UnsupportedEncodingException e) {
+			initializing = false;
+			System.err.println(e);
+		} catch (FileNotFoundException e) {
+			initializing = false;
+			System.err.println(e);
+			throw e;
+		} catch (IOException e) {
+			initializing = false;
+			throw e;
+		}
+		return initialize(properties);
+	}
+
+	/**
+	 * Initializes the toolbox with the properties passed in argument.
+	 *
+	 * @param props the props
+	 * @return true, if successful
+	 * @throws Exception 
+	 */
+	public static boolean initialize(Properties props) throws Exception {
+		initializing = true;
+
+		try {
+			Log.info(TXMCoreMessages.Toolbox_4 + props.toString()); 
+
+			// Create default values for initialization
+			if (props.getProperty(INSTALL_DIR) == null)
+				props.setProperty(INSTALL_DIR, TXMINSTALL); 
+			else
+				TXMINSTALL = props.getProperty(INSTALL_DIR);
+
+			if (props.getProperty(USER_TXM_HOME) == null)
+				props.setProperty(USER_TXM_HOME, TXMHOME); 
+			else
+				TXMHOME = props.getProperty(USER_TXM_HOME);
+
+			if (props.getProperty(LOG_LEVEL) == null)
+				props.setProperty(LOG_LEVEL, "OFF"); //$NON-NLS-1$
+			if (props.getProperty(ADD_TECH_LOGS) == null)
+				props.setProperty(ADD_TECH_LOGS, "" + false); //$NON-NLS-1$
+
+			if (props.getProperty(LOG_STACKTRACE) == null)
+				props.setProperty(LOG_STACKTRACE, "" + true); //$NON-NLS-1$
+			if (props.getProperty(LOG_IN_FILE) == null)
+				props.setProperty(LOG_IN_FILE, "" + false); //$NON-NLS-1$
+
+			if (props.getProperty(CQI_SERVER_PATH_TO_EXECUTABLE) == null)
+				props.setProperty(CQI_SERVER_PATH_TO_EXECUTABLE, TXMINSTALL
+						+ "/cwb/bin/cqpserver"); //$NON-NLS-1$
+			if (props.getProperty(CQI_SERVER_PATH_TO_INIT_FILE) == null)
+				props.setProperty(CQI_SERVER_PATH_TO_INIT_FILE, TXMINSTALL
+						+ "/cwb/cqpserver.init"); //$NON-NLS-1$
+			if (props.getProperty(CQI_SERVER_ADDITIONAL_OPTIONS) == null)
+				props.setProperty(CQI_SERVER_ADDITIONAL_OPTIONS, "-b 1000000 -d OFF"); //$NON-NLS-1$
+			if (props.getProperty(CQI_SERVER_PORT) == null)
+				props.setProperty(CQI_SERVER_PORT, "4877"); //$NON-NLS-1$
+			if (props.getProperty(CQI_SERVER_HOST) == null)
+				props.setProperty(CQI_SERVER_HOST, "localhost"); //$NON-NLS-1$
+			if (props.getProperty(CQI_SERVER_LOGIN) == null)
+				props.setProperty(CQI_SERVER_LOGIN, "anonymous"); //$NON-NLS-1$
+			if (props.getProperty(CQI_SERVER_PASSWORD) == null)
+				props.setProperty(CQI_SERVER_PASSWORD, ""); //$NON-NLS-1$
+			if (props.getProperty(CQI_SERVER_IS_REMOTE) == null)
+				props.setProperty(CQI_SERVER_IS_REMOTE, "" + false); //$NON-NLS-1$
+			if (props.getProperty(CQI_NETWORK_MODE) == null) {
+				props.setProperty(CQI_NETWORK_MODE, "false"); //$NON-NLS-1$
+			}
+			if (props.getProperty(CQP_EMPTY_VALUE_CODE) == null)
+				props.setProperty(CQP_EMPTY_VALUE_CODE, ""); //$NON-NLS-1$
+			if (props.getProperty(SCRIPT_ROOT_DIR) == null)
+				props.setProperty(SCRIPT_ROOT_DIR,
+						new File(TXMHOME, "scripts").getAbsolutePath()); //$NON-NLS-1$
+			if (props.getProperty(SCRIPT_CURRENT_DIR) == null)
+				props.setProperty(SCRIPT_CURRENT_DIR,
+						new File(TXMHOME, "scripts").getAbsolutePath()); //$NON-NLS-1$
+			if (props.getProperty(UI_LOCALE) == null)
+				props.setProperty(UI_LOCALE, "fr"); //$NON-NLS-1$
+			if (props.getProperty(WORKSPACE_LOCATION) == null)
+				props.setProperty(WORKSPACE_LOCATION, new File(TXMHOME, "workspaces/default.xml").getAbsolutePath()); //$NON-NLS-1$ 
+
+//			if (props.getProperty(IS_R_MANDATORY) == null)
+//				props.setProperty(IS_R_MANDATORY, "" + false); //$NON-NLS-1$
+//			if (props.getProperty(R_PATH_TO_EXECUTABLE) == null) {
+//				props.setProperty(R_PATH_TO_EXECUTABLE, ""); //$NON-NLS-1$
+//			}
+//			if (props.getProperty(R_SERVER_ADDRESS) == null)
+//				props.setProperty(R_SERVER_ADDRESS, "127.0.0.1"); //$NON-NLS-1$
+//			if (props.getProperty(R_PACKAGES_PATH) == null)
+//				props.setProperty(R_PACKAGES_PATH, ""); //$NON-NLS-1$
+//			if (props.getProperty(R_REMOTE) == null)
+//				props.setProperty(R_REMOTE, "" + false); //$NON-NLS-1$
+//			if (props.getProperty(R_DISABLE) == null)
+//				props.setProperty(R_DISABLE, "" + false); //$NON-NLS-1$
+//			if (props.getProperty(R_DEBUG) == null || props.getProperty(R_DEBUG).length() == 0)
+//				props.setProperty(R_DEBUG, "" + false); //$NON-NLS-1$
+//			if (props.getProperty(R_PORT) == null || props.getProperty(R_PORT).length() == 0)
+//				props.setProperty(R_PORT, "6311"); //$NON-NLS-1$
+//			if (props.getProperty(R_USER) == null)
+//				props.setProperty(R_USER, ""); //$NON-NLS-1$
+//			if (props.getProperty(R_PASSWORD) == null)
+//				props.setProperty(R_PASSWORD, ""); //$NON-NLS-1$
+//			if (props.getProperty(R_RARGS) == null)
+//				props.setProperty(R_RARGS, ""); //$NON-NLS-1$
+//			if (props.getProperty(R_RSERVEARGS) == null)
+//				props.setProperty(R_RSERVEARGS, ""); //$NON-NLS-1$
+//			if (props.getProperty(R_FILE_TRANSFERT) == null)
+//				props.setProperty(R_FILE_TRANSFERT, "false"); //$NON-NLS-1$
+//			if (props.getProperty(R_SVG_DEVICE) == null) {
+//				props.setProperty(R_SVG_DEVICE, "svg"); //$NON-NLS-1$
+//			}
+
+			//			if (props.getProperty(ChartsEngine.PROP_CHARTS_ENGINE_NAME) == null) {
+			//				props.setProperty(ChartsEngine.PROP_CHARTS_ENGINE_NAME, "jfreechart_charts_engine"); //$NON-NLS-1$
+			//			}
+			//			if (props.getProperty(ChartsEngine.PROP_CHARTS_ENGINE_OUTPUT_FORMAT) == null) {
+			//				props.setProperty(ChartsEngine.PROP_CHARTS_ENGINE_OUTPUT_FORMAT, "JFreeChart/Java2D"); //$NON-NLS-1$
+			//			}
+
+
+			if (props.getProperty(TREETAGGER_INSTALL_PATH) == null
+					|| props.getProperty(TREETAGGER_INSTALL_PATH).equals("")) //$NON-NLS-1$
+				props.setProperty(TREETAGGER_INSTALL_PATH, System
+						.getProperty("user.home") + "/TXM/treetagger"); //$NON-NLS-1$ //$NON-NLS-2$
+			if (props.getProperty(TREETAGGER_MODELS_PATH) == null
+					|| props.getProperty(TREETAGGER_MODELS_PATH).equals("")) //$NON-NLS-1$
+				props.setProperty(TREETAGGER_MODELS_PATH, props
+						.getProperty(TREETAGGER_INSTALL_PATH) + "/models"); //$NON-NLS-1$
+			if (props.getProperty(TREETAGGER_APOSTROPHE) == null
+					|| props.getProperty(TREETAGGER_APOSTROPHE).equals("")) //$NON-NLS-1$
+				props.setProperty(TREETAGGER_APOSTROPHE, "false"); //$NON-NLS-1$
+
+			if (props.getProperty(METADATA_COLSEPARATOR) == null || props.getProperty(METADATA_COLSEPARATOR).length() == 0)
+				props.setProperty(METADATA_COLSEPARATOR, ","); //$NON-NLS-1$
+			if (props.getProperty(METADATA_ENCODING) == null || props.getProperty(METADATA_ENCODING).length() == 0)
+				props.setProperty(METADATA_ENCODING, "UTF-8"); //$NON-NLS-1$
+			if (props.getProperty(METADATA_TXTSEPARATOR) == null)
+				props.setProperty(METADATA_TXTSEPARATOR, "\""); //$NON-NLS-1$
+
+			properties = props;
+
+			// initialize workspace : list of corpus loaded in TXM
+			stateWorkspace = startWorkspace();
+
+			Log.warning("Initializing logger");
+			Log.setLevel(Level.parse(props.getProperty(LOG_LEVEL)));
+			//System.out.println("log_in_file: "+props.getProperty(LOG_FILE));
+			Log.setPrintInConsole(Boolean.parseBoolean(props.getProperty(ADD_TECH_LOGS)));
+			//System.out.println("LOG in file: "+props.getProperty(LOG_IN_FILE)+ " -> "+Boolean.parseBoolean(props.getProperty(LOG_IN_FILE)));
+			if(props.getProperty(LOG_DIR) != null)
+				Log.setPrintInFile(Boolean.parseBoolean(props.getProperty(LOG_IN_FILE)), new File(props.getProperty(LOG_DIR)));
+			else
+				Log.setPrintInFile(Boolean.parseBoolean(props.getProperty(LOG_IN_FILE)));
+
+			useNetCQi = Boolean.parseBoolean(props.getProperty(CQI_NETWORK_MODE));
+			//System.out.println("CQI MODE NETWORK : "+useNetCQi);
+
+			Log.info(TXMCoreMessages.Toolbox_8 + checkInexistantParameterKey(props)); 
+			Log.info(TXMCoreMessages.Toolbox_9 + getSortedPropertiesAsString()); 
+
+			// start engines then the workspace
+			//System.out.println("REMOTE CQP: "+props.getProperty(CQI_SERVER_IS_REMOTE));
+			Log.warning("Killing CQP and RServe process if any");
+			processKiller();
+
+			startSearchEngine();
+
+			RStatsEngine.start();
+
+			Log.info("Toolbox states: cqp:" + stateSearchEngine + TXMCoreMessages.Toolbox_21 + RStatsEngine.isStarted() + TXMCoreMessages.Toolbox_22 + stateWorkspace); //$NON-NLS-1$
+		} catch (Exception e) {
+			initializing = false;
+			throw e;
+		}
+		initializing = false;
+		return checkState();
+	}
+
+	/**
+	 * find the keys not used by the Toolbox.
+	 *
+	 * @param p the p
+	 * @return the list
+	 */
+	public static List<String> checkInexistantParameterKey(Properties p) {
+		List<String> existingkeys = Arrays.asList(existingKeys);
+		List<String> missingkeys = new ArrayList<String>();
+		for (Object key : p.keySet()) {
+			String skey = key.toString();
+			if (!existingkeys.contains(skey))
+				missingkeys.add(skey);
+		}
+		return missingkeys;
+	}
+
+	/**
+	 * if searchengine or statengine or workspace is not ready then the toolbox
+	 * is not ready.
+	 *
+	 * @return true, if successful
+	 */
+	private static boolean checkState() {
+		state = stateSearchEngine && stateWorkspace;
+		if (RStatsEngine.isMandatory())	{ 
+			state = state && RStatsEngine.isStarted();
+		}
+		return state;
+	}
+
+	/**
+	 * start the workspace, creates a new one if WORKSPACE_LOCATION is wrong.
+	 *
+	 * @return true, if successful
+	 */
+	private static boolean startWorkspace() {
+		try {
+			System.out.print(TXMCoreMessages.Toolbox_workspace_init);
+			String txmhome = getParam(USER_TXM_HOME);
+			if (txmhome.length() == 0) {
+				stateWorkspace = false;
+				return false;
+			}
+			String location = properties.getProperty(WORKSPACE_LOCATION);
+			
+			System.out.println("Toolbox.startWorkspace(): workspace location = " + location);
+			
+			if (!new File(location).exists()) {
+				Log.info(TXMCoreMessages.Toolbox_10 + location); 
+				workspace = Workspace.createEmptyWorkspace(new File(location));
+			} else {
+				workspace = new Workspace(new File(location));
+			}
+			Log.info(TXMCoreMessages.Toolbox_12 + location); 
+			stateWorkspace = true;
+
+			if (workspace == null || workspace.getProject("default") == null) { //$NON-NLS-1$
+				Log.severe(TXMCoreMessages.Toolbox_14 + location); 
+				stateWorkspace = false;
+				System.out.println(TXMCoreMessages.FAILED);
+				return false;
+			} else {
+				System.out.println(TXMCoreMessages.DONE);
+			}
+
+			/*
+			 * if (CorpusManager.getCorpusManager() != null) {
+			 * if (CorpusManager.getCorpusManager().getCqiClient() != null) {
+			 * for(Base b : workspace.getProject("default").getBases()) {
+			 * MainCorpus c = b.getCorpus(b.getName().toUpperCase()); String
+			 * lang = Locale.getDefault().getLanguage(); try { StructuralUnit
+			 * txmcorpus = c.getStructuralUnit("txmcorpus");
+			 * 
+			 * if (txmcorpus != null) { StructuralUnitProperty p =
+			 * txmcorpus.getProperty("lang"); if (p != null) { List<String>
+			 * values = p.getValues(); if (values.size() > 0) lang =
+			 * values.get(0); } }
+			 * 
+			 * if (!c.getMetadatas().containsKey("lang")) {
+			 * c.setAttribute("lang", lang);
+			 * //System.out.println("set lang of "+c.getName()+" at "+lang); } }
+			 * catch(Exception e) {
+			 * Log.warning("could not restore corpus of base "+b.getName());
+			 * //Log.warning(Log.toString(e)); } } } } /*else
+			 * System.out.println("cqi is null"); } else
+			 * System.out.println("CM null");
+			 */
+
+		} catch (Exception e) {
+			System.err.println(TXMCoreMessages.Toolbox_workspace_init_failed + properties.getProperty(WORKSPACE_LOCATION)); 
+			Log.severe(TXMCoreMessages.Toolbox_15 + Log.toString(e));
+			Log.printStackTrace(e);
+			stateWorkspace = false;
+		}
+		return workspace != null;
+	}
+
+	/**
+	 * Starts the corpus engine if not remove then launch cqpserver.
+	 *
+	 * @return true, if successful
+	 */
+	private static boolean startSearchEngine() {
+
+		Log.warning("Starting Corpus Engine.");
+
+		
+		if (workspace == null) {
+			System.out.println("Can't start CQP with workspace not ready.");
+			return false;
+		}
+
+		boolean cqiserverok = false;
+		boolean remote = Boolean.parseBoolean(properties
+				.getProperty(Toolbox.CQI_SERVER_IS_REMOTE));
+		stateSearchEngine = false;
+		// test if must-have properties for CWB are set
+
+		String exec_path = properties.getProperty(CQI_SERVER_PATH_TO_EXECUTABLE);
+		String reg_path = ""; // new way that concats registry of loaded corpus
+		String path_separator = System.getProperty("path.separator");
+		for (Base b : workspace.getProject("default").getBases()) {
+			File binDir = b.getBaseDirectory();
+			File registryDir = new File(binDir, "registry");
+			reg_path += path_separator + registryDir.getAbsolutePath();
+			File[] files = registryDir.listFiles();
+			if (files != null)
+				for (File registryFile : files) {
+					if (registryFile.isHidden()) continue;
+					if (registryFile.isDirectory()) continue;
+
+					File dataDirectory = new File(binDir, "data/"+registryFile.getName().toUpperCase());
+					if (!dataDirectory.exists())dataDirectory = new File(binDir, "data"); // eventual old corpus
+					try {
+						PatchCwbRegistry.patch(registryFile, dataDirectory);
+					} catch (IOException e) {
+						System.out.println("Error while updating registry file "+registryFile+": "+e);
+						Log.printStackTrace(e);
+						return false;
+					}
+				}
+		}
+		if (reg_path.length() > 0) reg_path = reg_path.substring(path_separator.length()); // remove first path_separator
+		//System.out.println("REGPATH="+reg_path);
+		String init_path = properties.getProperty(CQI_SERVER_PATH_TO_INIT_FILE);
+
+
+		if (!remote) {
+			if (exec_path == null
+					|| reg_path == null
+					|| init_path == null) {
+				Log.severe(TXMCoreMessages.Toolbox_1); 
+			} else {
+				if (!useNetCQi) {
+					try {
+						Toolbox.cqiServer = new MemCqiServer(exec_path,
+								reg_path, 
+								init_path, 
+								properties.getProperty(CQI_SERVER_ADDITIONAL_OPTIONS)
+								+ " -P " + properties.getProperty(CQI_SERVER_PORT), //$NON-NLS-1$
+								Boolean.parseBoolean(properties
+										.getProperty(CQI_SERVER_MONITOR_OUTPUT)));
+					} catch (Exception e) {
+						// TODO Auto-generated catch block
+						org.txm.utils.logger.Log.printStackTrace(e);
+					}
+				} else {
+					Toolbox.cqiServer = new NetCqiServer(exec_path,
+							reg_path, 
+							init_path, 
+							properties.getProperty(CQI_SERVER_ADDITIONAL_OPTIONS)
+							+ " -P " + properties.getProperty(CQI_SERVER_PORT), //$NON-NLS-1$
+							Boolean.parseBoolean(properties
+									.getProperty(CQI_SERVER_MONITOR_OUTPUT)));
+				}
+				if (Toolbox.cqiServer != null)
+					cqiserverok = Toolbox.cqiServer.start();
+			}
+		}
+
+		// create cqi client
+		try {
+			if (cqiserverok) {
+				if (!useNetCQi) {
+					try {
+						cqiClient = new MemCqiClient((MemCqiServer) cqiServer);
+					} catch(Exception e) {
+						Log.severe(TXMCoreMessages.Toolbox_28+e);
+						cqiserverok = false;
+					}
+				} else {
+					int port = Integer.parseInt(properties.getProperty(CQI_SERVER_PORT));
+					String host = properties.getProperty(CQI_SERVER_HOST);
+					cqiClient = new NetCqiClient(host, port);
+				}
+			}
+		} catch (NumberFormatException e1) {
+			Log.severe(TXMCoreMessages.Toolbox_wrong_port + properties.getProperty(CQI_SERVER_PORT)); 
+		} catch (ServerNotFoundException e1) {
+			Log.severe(TXMCoreMessages.Error_CONNECTION_FAILED + properties.getProperty(CQI_SERVER_HOST) + TXMCoreMessages.Toolbox_27 + properties.getProperty(CQI_SERVER_PORT)); 
+		}
+
+		// try connecting to the CWB server
+		try {
+			if (cqiserverok) {
+				String login = properties.getProperty(CQI_SERVER_LOGIN);
+				String password = properties.getProperty(CQI_SERVER_PASSWORD);
+				stateSearchEngine = cqiClient.connect(login, password);
+			}
+		} catch (Exception e1) {
+			Log.severe(Log.toString(e1));
+		}
+
+		if (stateSearchEngine == false) {
+			System.out.println(TXMCoreMessages.Toolbox_29); 
+			System.out.println(TXMCoreMessages.Toolbox_30 + properties.getProperty(CQI_SERVER_LOGIN) + " " + properties.getProperty(CQI_SERVER_PASSWORD) + properties.getProperty(CQI_SERVER_HOST) + " " + Integer.parseInt(properties.getProperty(CQI_SERVER_PORT))); //$NON-NLS-1$ //$NON-NLS-2$
+			if (cqiServer != null)
+				System.out.println(TXMCoreMessages.Toolbox_33 + cqiServer.getLastCmdLine());
+		} else {
+			if (cqiServer == null || cqiServer instanceof NetCqiServer)
+				System.out.println(TXMCoreMessages.Toolbox_connected_to_corpus_sever); 
+		}
+
+		CorpusManager.setCqiClient(cqiClient);
+
+		// wait for CQPSERVER TO BE READY
+		int scount = 0;
+		try {
+			CorpusManager.getCorpusManager().getCorpora();
+			do {
+				Thread.sleep(100);
+				CorpusManager.cleanCorpora();// to be sure to call cqpserver
+				CorpusManager.getCorpusManager().getCorpora();
+				scount++;
+				if (scount >= 10) {
+					Log.warning(TXMCoreMessages.Toolbox_17); 
+					break;
+				}
+			} while (CorpusManager.getCorpusManager().getCorpora().size() == 0);
+		} catch (Exception e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+			Log.severe(TXMCoreMessages.Toolbox_18 + e);
+		} 
+
+		// initialize pre-configured subcorpus and partition of corpus registered in the default.xml workspace file
+		for (Base b : workspace.getProject("default").getBases()) {
+			if (!b.loadCQPCorpora()) {
+				System.out.println("Fail to load CQP corpora of corpus "+b.getName());
+			}
+		}
+
+		return stateSearchEngine;
+	}
+
+	/**
+	 * kill cqpserver process.
+	 */
+	private static void killSearchEngine() {
+		if ("false".equals(getParam(CQI_SERVER_IS_REMOTE))) //$NON-NLS-1$
+			// Windows OS
+			if (OSDetector.isFamilyWindows()) {
+				try {
+					Process p = Runtime.getRuntime().exec(
+							"taskkill /IM cqpserver.exe /F"); //$NON-NLS-1$
+					p.waitFor();
+					p = Runtime.getRuntime().exec("taskkill /IM cqpserver.exe /F"); //$NON-NLS-1$
+					p.waitFor();
+				} catch (IOException e) {
+					Log.severe(TXMCoreMessages.Toolbox_31+Log.toString(e));
+					System.out.println(TXMCoreMessages.Toolbox_31+Log.toString(e));
+					try {
+						Process p = Runtime.getRuntime().exec(
+								"tskill cqpserver.exe"); //$NON-NLS-1$
+						p.waitFor();
+						p = Runtime.getRuntime().exec("tskill cqpserver.exe"); //$NON-NLS-1$
+						p.waitFor();
+					} catch (IOException e2) {
+						Log.severe(TXMCoreMessages.Toolbox_34+Log.toString(e2));
+						System.out.println(TXMCoreMessages.Toolbox_34+Log.toString(e2));
+					} catch (InterruptedException e3) {
+						Log.severe(Log.toString(e3));
+						System.out.println(Log.toString(e3));
+					}
+				} catch (InterruptedException e) {
+					Log.severe("Error while closing CQP: "+e.getLocalizedMessage());
+					System.out.println(Log.toString(e));
+				}
+				;
+			}
+		// Mac, Linux
+			else {
+				String cmd = TXMCoreMessages.Toolbox_37 + getParam(CQI_SERVER_PORT) + TXMCoreMessages.Toolbox_38;
+				try {
+					//Process p = Runtime.getRuntime().exec("killall -9 cqpserver"); //$NON-NLS-1$
+					// System.out.println("kill `ps aux | grep cqpserver | awk '/-P "
+					// + getParam(CQI_SERVER_PORT) + "/ {print $2}'`");
+					// String[] args =
+					// {"kill","`ps aux | grep cqpserver | awk '/-P " +
+					// getParam(CQI_SERVER_PORT) + "/ {print $2}'`"};
+					// System.out.println("before Sh constructor");
+					Sh sh = new Sh(""); //$NON-NLS-1$
+					// System.out.println("after Sh constructor");
+					// System.out.println("EXECUTE SH : "+"kill `ps aux | grep cqpserver | awk '/-P "
+					// + getParam(CQI_SERVER_PORT) + "/ {print $2}'`");
+					sh.setIsc(cmd);
+					sh.sh();
+					// Runtime.getRuntime().exec("sh kill `ps aux | grep cqpserver | awk '/-P "
+					// + getParam(CQI_SERVER_PORT) + "/ {print $2}'`");
+
+				} catch (Exception e) {
+					Log.severe(TXMCoreMessages.Toolbox_39+cmd+TXMCoreMessages.Toolbox_40+Log.toString(e));
+					System.out.println(TXMCoreMessages.Toolbox_39+cmd+TXMCoreMessages.Toolbox_40+Log.toString(e));
+					org.txm.utils.logger.Log.printStackTrace(e);
+				}
+			}
+	}
+
+	/**
+	 * Kill process cqpserver and R-serve for windows and unix platform Win :
+	 * taskkill or tskill Unix : pkill.
+	 */
+	static void processKiller() {
+		killSearchEngine();
+		RStatsEngine.kill();
+	}
+
+	/**
+	 * Shut the toolbox down.
+	 */
+	public static void shutdown() {
+		if(Toolbox.workspace != null)
+			Toolbox.workspace.save();
+		Toolbox.workspace = null;
+		shutdownSearchEngine();
+		RStatsEngine.shutdown();
+		state = false;
+	}
+
+	/**
+	 * Shut the toolbox searchengine down.
+	 */
+	public static void shutdownSearchEngine() {
+		try {
+			if (cqiClient instanceof MemCqiClient) {
+				try  {
+					for (MainCorpus corpus : CorpusManager.getCorpusManager().getCorpora()) {
+						corpus.closeAnnotationManager();
+					}
+				} catch(Exception e) {}
+				for (String name : ((MemCqiClient)cqiClient).listCorpora()) {
+					((MemCqiClient)cqiClient).dropCorpus(name);
+				}
+			}
+			cqiClient.disconnect();
+			cqiServer.stop();
+
+			CorpusManager.clean();
+			if (cqiServer instanceof NetCqiServer)
+				killSearchEngine();
+
+			stateSearchEngine = false;
+			state = false;
+		} catch (Exception e) {
+			Log.severe("Error while closing CQP: "+e.getLocalizedMessage());
+		}
+	}
+
+	/**
+	 * Shut the toolbox workspace down.
+	 */
+	public static void shutdownWorkspace() {
+		try {
+			Toolbox.workspace.save();
+			Toolbox.workspace = null;
+			stateWorkspace = false;
+			state = false;
+		} catch (Exception e) {
+			Log.severe("Error while closing workspace: "+e.getLocalizedMessage());
+		}
+	}
+
+
+
+	/**
+	 * Restart the toolbox's searchengine.
+	 *
+	 * @return true, if successful
+	 */
+	public static boolean restartSearchEngine() {
+		try {
+			shutdownSearchEngine();
+			Thread.sleep(10);
+			startSearchEngine();
+
+		} catch (Exception e) {
+			Log.severe("Error while restarting CQP: "+e.getLocalizedMessage());
+		}
+		return checkState();
+	}
+
+	/**
+	 * Restart the toolbox's statengine.
+	 *
+	 * @return true, if successful
+	 */
+	public static boolean restartStatEngine() {
+		return restartStatEngine(false);
+	}
+
+	/**
+	 * Restart the toolbox's statengine.
+	 *
+	 * @param serverdown the serverdown
+	 * @return true, if successful
+	 */
+	public static boolean restartStatEngine(boolean serverdown) {
+		try {
+			if (!serverdown)	{
+				RStatsEngine.shutdown();
+			}
+
+			//remove results using R
+			CorpusManager cm = CorpusManager.getCorpusManager();
+			for(Corpus corpus : cm.getCorpora())	{
+				removeRResults(corpus);
+			}
+			RStatsEngine.start();
+		} catch (Exception e) {
+			Log.severe("Error while restarting R: "+e.getLocalizedMessage());
+		}
+		return checkState();
+	}
+
+	/**
+	 * Removes the r results.
+	 *
+	 * @param corpus the corpus
+	 */
+	protected static void removeRResults(Corpus corpus)
+	{
+		for (Corpus c : corpus.getSubcorpora())
+			removeRResults(c);
+
+		for (Partition p : corpus.getPartitions())
+			removeRResults(p);
+
+		for(ITXMResult result : corpus.getResults()) {
+			corpus.removeResult(result);
+		}
+	}
+
+	/**
+	 * Removes the r results.
+	 *
+	 * @param partition the partition
+	 */
+	protected static void removeRResults(Partition partition)
+	{
+		for(ITXMResult result : partition.getResults()) {
+			partition.removeResult(result);
+		}
+	}
+
+	/**
+	 * Restart the toolbox's workspace.
+	 *
+	 * @return true, if successful
+	 */
+	public static boolean restartWorkspace() {
+		try {
+			shutdownWorkspace();
+			startWorkspace();
+		} catch (Exception e) {
+			Log.severe("Error while restarting workspace: "+e.getLocalizedMessage());
+		}
+		return checkState();
+	}
+
+	/**
+	 * Restart the toolbox.
+	 *
+	 * @return true, if successful
+	 * @throws Exception 
+	 */
+	public static boolean restart() throws Exception {
+		Toolbox.shutdown();
+		Toolbox.initialize(properties);
+		return checkState();
+	}
+
+	/**
+	 * Update the toolbox properties.
+	 *
+	 * @param props the props
+	 */
+	public static void updateProperties(Properties props) {
+		for (Object okey : props.keySet()) {
+			String key = (String) okey;
+			//System.out.println("maj TBX prop "+key+" with "+props.get(key));
+
+			if (props.get(key) == null) {
+				Log.severe(TXMCoreMessages.Toolbox_2 + key);
+			}
+			else	{
+				properties.put(key, props.get(key));
+			}
+		}
+		Log.setLevel(Level.parse(getParam(LOG_LEVEL)));
+		Log.info(TXMCoreMessages.Toolbox_11 + getSortedPropertiesAsString());
+	}
+
+	/**
+	 * Shut the toolbox down. Web version : change the toolbox state
+	 *
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public static void shutdoweb() throws RWorkspaceException {
+		if (isInitialized()) {
+			shutdown();
+			state = false;
+		}
+	}
+
+	/**
+	 * get the string value of a toolbox's parameter
+	 * 
+	 * ex : Toolbox.getParam(Toolbox.R_Path_To_EXECUTABLE)
+	 *
+	 * @param key the key
+	 * @return the param
+	 */
+	public static String getParam(String key) {
+		if (properties != null)
+			return properties.getProperty(key);
+		else
+			return "ERROR WHILE GETTING TXM PARAM"; //$NON-NLS-1$
+	}
+
+	/**
+	 * set the string value of a toolbox's parameter
+	 * 
+	 * ex : Toolbox.setParam(Toolbox.R_Path_To_EXECUTABLE,"")
+	 *
+	 * @param key the key
+	 * @param value the value
+	 */
+	public static void setParam(String key, Object value) {
+		properties.setProperty(key, value.toString());
+	}
+
+	/**
+	 * test if searchEngine and statEngine and Workspace are initialized.
+	 *
+	 * @return true, if is initialized
+	 */
+	public static boolean isInitialized() {
+		return checkState();
+	}
+
+	/**
+	 * test if searchEngine is initialized.
+	 *
+	 * @return true, if is initialized
+	 */
+	public static boolean isSearchEngineInitialized() {
+		return stateSearchEngine ;
+	}
+
+	/**
+	 * test if StatEngine is initialized.
+	 *
+	 * @return true, if is initialized
+	 */
+	public static boolean isStatEngineInitialized() {
+		return RStatsEngine.isStarted();
+	}
+
+	/**
+	 * return all the properties of the toolbox.
+	 *
+	 * @return the properties
+	 */
+	public static Properties getProperties() {
+		return properties;
+	}
+
+	/* (non-Javadoc)
+	 * @see java.lang.Object#finalize()
+	 */
+	@Override
+	protected void finalize() throws Throwable {
+		try {
+			Toolbox.shutdown();
+		} finally {
+			super.finalize();
+		}
+	}
+
+	
+	
+	
+	/**
+	 * Returns a string representation of sorted properties.
+	 */
+	public static String getSortedPropertiesAsString()	{
+		TreeMap treeMap = new TreeMap(properties);
+		return treeMap.toString();
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/Toolbox.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/CqpServerWatcher.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/CqpServerWatcher.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/CqpServerWatcher.java	(revision 258)
@@ -0,0 +1,77 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+package org.txm;
+
+import org.txm.searchengine.cqp.AbstractCqiClient;
+import org.txm.utils.Watcher;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class CqpServerWatcher.
+ */
+public class CqpServerWatcher extends Watcher{
+
+	
+	/**
+	 * Instantiates a new cqp server watcher.
+	 */
+	public CqpServerWatcher()
+	{
+		this.processname = "CQPSERVER"; //$NON-NLS-1$
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.txm.Watcher#check()
+	 */
+	@Override
+	protected boolean check() {
+		AbstractCqiClient client = Toolbox.getCqiClient();
+		if (client == null)
+		{
+			return false;
+		}
+		else
+		{
+			try {
+				client.listCorpora();
+			} catch (Exception e) {
+				System.out.println("CWB watcher encounters an error: "+e); //$NON-NLS-1$
+				return false;
+			}
+		}
+		return true;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.Watcher#restart()
+	 */
+	@Override
+	protected boolean restart() {
+		return Toolbox.restartSearchEngine();
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/CqpServerWatcher.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/functions/diagnostic/package.html
===================================================================
--- tmp/org.txm.core/src/java/org/txm/functions/diagnostic/package.html	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/functions/diagnostic/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Diagnostic function</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/java/org/txm/functions/diagnostic/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/functions/diagnostic/Diagnostic.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/functions/diagnostic/Diagnostic.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/functions/diagnostic/Diagnostic.java	(revision 258)
@@ -0,0 +1,622 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2016-09-19 10:31:00 +0200 (Mon, 19 Sep 2016) $
+// $LastChangedRevision: 3298 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.functions.diagnostic;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Locale;
+
+import org.eclipse.osgi.util.NLS;
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.functions.Function;
+import org.txm.objects.Base;
+import org.txm.searchengine.cqp.AbstractCqiClient;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.corpus.Corpus;
+import org.txm.searchengine.cqp.corpus.CorpusManager;
+import org.txm.searchengine.cqp.corpus.Part;
+import org.txm.searchengine.cqp.corpus.Partition;
+import org.txm.searchengine.cqp.corpus.Property;
+import org.txm.searchengine.cqp.corpus.StructuralUnit;
+import org.txm.searchengine.cqp.corpus.StructuralUnitProperty;
+import org.txm.utils.logger.Log;
+
+// TODO: Auto-generated Javadoc
+/**
+ * compute a diagnostic of Corpus, sub corpus and partition @ author mdecorde.
+ */
+public class Diagnostic extends Function {
+	// Base base;
+	/** The corpus. */
+	Corpus corpus;
+	
+	/** The partition. */
+	Partition partition;
+	
+	/** The maxvalue. */
+	int maxvalue = 20;
+	
+	// Numbers
+	/** The T. */
+	int T = 0; // number of word
+
+	/** The N properties. */
+	int NProperties = 0; // number of word properties
+	//HashMap<String, Integer> propertiesCounts = new HashMap<String, Integer>(); // properties counts
+	/** The properties values. */
+	HashMap<String, List<String>> propertiesValues = new HashMap<String, List<String>>(); // properties values
+
+	/** The N structures. */
+	int NStructures = 0; // number of structures
+	
+	/** The structures counts. */
+	HashMap<String, Integer> structuresCounts = new HashMap<String, Integer>(); // structures counts
+
+	/** The internal architecture. */
+	List<String> internalArchitecture = new ArrayList<String>(); // wtc structures = propertiesCounts keys but ordered
+	
+	/** The hierarchie counts. */
+	HashMap<String, Integer> hierarchieCounts = new HashMap<String, Integer>(); // hierarchic structures counts
+	
+	/** The internal architecture properties. */
+	HashMap<String, HashMap<String, List<String>>> internalArchitectureProperties = new HashMap<String, HashMap<String, List<String>>>(); // hierarchic structures counts
+	
+	/** The internal architecture properties counts. */
+	HashMap<String, HashMap<String, Integer>> internalArchitecturePropertiesCounts = new HashMap<String, HashMap<String, Integer>>(); // hierarchic structures counts
+
+	// Annotations description
+	/** The annotations types. */
+	HashMap<String, Integer> annotationsTypes = new HashMap<String, Integer>(); // for each annotation its description
+	
+	/** The annotations origins. */
+	HashMap<String, Integer> annotationsOrigins = new HashMap<String, Integer>(); // for each annoation its origin description
+
+	// Import description
+	/** The import description. */
+	String importDescription = ""; //$NON-NLS-1$
+	
+	/** The properties. */
+	List<Property> properties;
+	
+	/** The structures. */
+	List<StructuralUnit> structures;
+
+	/**
+	 * Instantiates a new diagnostic.
+	 *
+	 * @param corpus a MainCorpus or a SubCorpus
+	 * @param maxvalue the number of values of properties shown
+	 */
+	public Diagnostic(Corpus corpus, int maxvalue) {
+		// long start = System.currentTimeMillis();
+		// base = b;
+		super(corpus);
+		this.corpus = corpus;
+		if (maxvalue <= 0)
+			maxvalue = 10;
+		this.maxvalue = maxvalue;
+	}
+	
+	/**
+	 * Process.
+	 */
+	public void process() {
+		stepGeneralInfos();
+		stepLexicalProperties();
+		stepStructuralUnits();
+	}
+	
+	/**
+	 * Step general infos.
+	 */
+	public void stepGeneralInfos()
+	{
+		try {
+			properties = corpus.getProperties();
+			NProperties = properties.size();
+		} catch (CqiClientException e1) {
+			Log.severe(TXMCoreMessages.Diagnostic_1 + corpus.getName()
+					+ TXMCoreMessages.Diagnostic_4);
+			return;
+		}
+		try {
+			T = corpus.getSize();// corpus.getLexicon(corpus.getProperty("id")).nbrOfToken();
+		} catch (CqiClientException e1) {
+			Log.severe(TXMCoreMessages.Diagnostic_6 + corpus.getName()
+					+ TXMCoreMessages.Diagnostic_8);
+			return;
+		} 
+	}
+	
+	/**
+	 * step2.
+	 * randomly position are choose
+	 */
+	public void stepLexicalProperties()
+	{
+		AbstractCqiClient cqiClient = CorpusManager.getCorpusManager().getCqiClient();
+		for (Property p : properties) {
+			//int size;
+			try {
+				//size = CorpusManager.getCorpusManager().getCqiClient().lexiconSize(p.getQualifiedName());
+				//propertiesCounts.put(p.getName(), size);
+				//List<String> list = Arrays.asList(corpus.getLexicon(p).getForms(this.maxvalue));
+
+				int[] positions = new int[Math.min(maxvalue, T)];
+				for(int i = 0 ; i < Math.min(maxvalue, T) ; i++)
+					positions[i] = i;
+				
+				//ArrayList<String> values = new ArrayList<String>();
+				LinkedHashSet<String> values = new LinkedHashSet<String>(cqiClient.getSingleData(p, positions));
+				propertiesValues.put(p.getName(), new ArrayList<String>(values));
+			} catch (Exception e) {
+				org.txm.utils.logger.Log.printStackTrace(e);
+			}
+
+			// System.out.println("Lexi size "+p+" : "+(System.currentTimeMillis()-
+			// start));
+			// start = System.currentTimeMillis();
+		}
+	}
+	
+	/**
+	 * Step structural units.
+	 */
+	public void stepStructuralUnits()
+	{
+		try {
+			structures = corpus.getOrderedStructuralUnits();
+		} catch (CqiClientException e1) {
+			Log.severe(TXMCoreMessages.Diagnostic_1 + corpus.getName()
+					+ TXMCoreMessages.Diagnostic_11);
+			return;
+		}
+		NStructures = structures.size();
+		for (StructuralUnit su : structures) { // for each structural unit
+			internalArchitecture.add(su.getName());
+			hierarchieCounts.put(su.getName(), -1);
+			internalArchitectureProperties.put(su.getName(),
+					new HashMap<String, List<String>>());
+			internalArchitecturePropertiesCounts.put(su.getName(),
+					new HashMap<String, Integer>());
+			if (su.getProperties().size() > 0) {
+				for (StructuralUnitProperty sup : su.getProperties())  {// for each of its property
+					try {
+						List<String> allvalues = sup.getValues(corpus);
+						internalArchitectureProperties.get(su.getName()).put(
+								sup.getName(),
+								allvalues.subList(0, Math.min(allvalues.size(),
+										maxvalue)));
+						internalArchitecturePropertiesCounts.get(su.getName())
+						.put(sup.getName(), allvalues.size());
+					} catch (Exception e) {
+						ArrayList<String> list = new ArrayList<String>(1);
+						list.add(TXMCoreMessages.Diagnostic_2);
+						internalArchitectureProperties.get(su.getName()).put(
+								sup.getName(), list);
+						internalArchitecturePropertiesCounts.get(su.getName())
+						.put(sup.getName(), -1);
+					}
+				}
+			}
+		}
+	}
+
+	/**
+	 * Instantiates a new diagnostic.
+	 *
+	 * @param partition the partition
+	 * @throws CqiClientException the cqi client exception
+	 */
+	public Diagnostic(Partition partition) throws CqiClientException {
+		corpus = partition.getCorpus();
+		this.partition = partition;
+		int T = corpus.getSize();
+		System.out.println(TXMCoreMessages.Diagnostic_12);
+		int nbParts = partition.getNPart();
+		List<String> partNames = partition.getPartNames();
+		List<Integer> partSizes = new ArrayList<Integer>();
+		List<List<Property>> partProperties = new ArrayList<List<Property>>();
+		List<String> partQueries = new ArrayList<String>();
+		for (Part part : partition.getParts()) {
+			partSizes.add(part.getSize());
+			partProperties.add(part.getProperties());
+			partQueries.add(part.getQuery().getQueryString());
+		}
+	}
+
+	/**
+	 * dump the results of the diagnostic in a String containing HTML code.
+	 *
+	 * @return the string
+	 */
+	public String htmldump() {
+		StringBuffer buff = new StringBuffer();
+
+		buff.append("<? version=\"1.0\" encoding=\"UTF-8\"?>\n" + //$NON-NLS-1$
+				"<html>" + //$NON-NLS-1$
+				"<head>" + //$NON-NLS-1$
+				"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/>" + //$NON-NLS-1$
+				"</head>" + //$NON-NLS-1$
+				"<body>\n"); //$NON-NLS-1$
+		buff.append("<h2 style'font-family:\"Arial\";'>"+TXMCoreMessages.Diagnostic_3 + this.corpus.getName() + "</h2>\n"); //$NON-NLS-2$ //$NON-NLS-1$
+		
+		if (corpus.getDescription() != null && corpus.getDescription().length() > 0) {
+			buff.append("<p>"+corpus.getDescription()+"</p>"); //$NON-NLS-1$ //$NON-NLS-2$
+		}
+		
+		buff.append("<h3 style'font-family:\"Arial\";'>"+TXMCoreMessages.Diagnostic_5+ "</h3>\n"); //$NON-NLS-1$ //$NON-NLS-2$ 
+
+		
+		
+		// counts
+		buff.append("<ul>\n"); //$NON-NLS-1$
+		buff.append("<li>" + TXMCoreMessages.Diagnostic_7 + T + "</li>\n"); //$NON-NLS-1$ //$NON-NLS-2$ 
+		buff
+		.append("<li>" + TXMCoreMessages.Diagnostic_9 + (NProperties - 1) + "</li>\n"); //$NON-NLS-2$ //$NON-NLS-1$
+		buff.append("<li>" + TXMCoreMessages.Diagnostic_16 + NStructures + "</li>\n"); //$NON-NLS-2$ //$NON-NLS-1$
+		buff.append("</ul>\n"); //$NON-NLS-1$
+
+		// Propriétés d'occurrences
+		buff.append("<h3 style'font-family:\"Arial\";'>"+NLS.bind(TXMCoreMessages.Diagnostic_14, maxvalue) + "</h3>\n"); //$NON-NLS-1$ //$NON-NLS-2$ 
+		ArrayList<String> properties = new ArrayList<String>(propertiesValues.keySet());
+		Collections.sort(properties);
+		buff.append("<ul>\n"); //$NON-NLS-1$
+		for (String s : properties) {
+			if (!s.equals("id")) //$NON-NLS-1$
+			{
+				//buff.append("<li> " + s + " (" + propertiesCounts.get(s) + ") : "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+				buff.append("<li> " + s + " : "); //$NON-NLS-1$ //$NON-NLS-2$ 
+				for (String v : propertiesValues.get(s))
+					buff.append(v + ", "); //$NON-NLS-1$
+				buff.append("..."); //$NON-NLS-1$
+				buff.append("</li>\n"); //$NON-NLS-1$ 
+			}
+		}
+		buff.append("</ul>\n"); //$NON-NLS-1$
+
+		// Propriété de structures
+		buff.append("<h3 style'font-family:\"Arial\";'>"+NLS.bind(TXMCoreMessages.Diagnostic_22, maxvalue)+"</h3>\n"); //$NON-NLS-1$ //$NON-NLS-2$
+		buff.append("<ul>\n"); //$NON-NLS-1$
+		for (String s : internalArchitecture) {
+			StringBuffer subbuffer = new StringBuffer();
+			if (s.equals("txmcorpus")) //$NON-NLS-1$
+				continue;//ignore the txmcorpus structure
+			
+			properties = new ArrayList<String>(internalArchitectureProperties.get(s).keySet());
+			
+			subbuffer.append("<li> " + s + "\n<ul>\n"); //$NON-NLS-1$ //$NON-NLS-2$
+			if (internalArchitectureProperties.get(s).keySet().size() == 0)
+				subbuffer.append("<li>"+TXMCoreMessages.Diagnostic_26+"</li>\n"); //$NON-NLS-1$ //$NON-NLS-2$ 
+
+			
+			//System.out.println("struct: "+s+" >> "+properties);
+			Collections.sort(properties);
+			//System.out.println("struct: "+s+" >sort> "+properties);
+			int nbOfValues = 0;
+			for (String ps : properties) {
+				if (!ps.equals("project") && !ps.equals("base") ) //$NON-NLS-1$ //$NON-NLS-2$ 
+				{
+					//System.out.println("struct: "+s+" >> "+ps);
+					int valuecount = internalArchitecturePropertiesCounts.get(s).get(ps);
+					ArrayList<String> values = new ArrayList<String>(
+							internalArchitectureProperties.get(s).get(ps));
+					subbuffer.append("<li> " + ps + " (" + valuecount + ") = "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+					//System.out.println("VALUES: "+values);
+					Collections.sort(values);
+					for (int i = 0 ; i < values.size() ; i++) {
+						nbOfValues++;
+						String psv = values.get(i);
+						if (psv != null && psv.length() > 0)
+							subbuffer.append(psv.replace("<", "&lt;")); //$NON-NLS-1$ //$NON-NLS-2$
+						else
+							subbuffer.append("\"\""); //$NON-NLS-1$
+						
+						if (i == values.size() -1)
+							subbuffer.append("."); //$NON-NLS-1$
+						else
+							subbuffer.append(", "); //$NON-NLS-1$
+						
+						if (i >= maxvalue) {
+							subbuffer.append("..."); //$NON-NLS-1$
+							break;
+						}
+					}
+					subbuffer.append("</li>\n"); //$NON-NLS-1$
+				}
+			}
+			subbuffer.append("</ul>\n</li>\n"); //$NON-NLS-1$
+			if (nbOfValues > 0) {
+				buff.append(subbuffer);
+			}
+		}
+		buff.append("</ul>\n"); //$NON-NLS-1$
+		buff.append("</body>\n"); //$NON-NLS-1$
+		buff.append("</html>\n"); //$NON-NLS-1$
+		
+		return buff.toString();
+	}
+
+	
+	
+	/**
+	 * dump the result in the console.
+	 *
+	 * @param maxvalue the maxvalue
+	 * @return the string
+	 */
+	public String dump(int maxvalue) {
+		StringBuffer buff = new StringBuffer();
+
+		buff.append(TXMCoreMessages.Diagnostic_40);
+		buff.append(TXMCoreMessages.Diagnostic_41 + String.format(Locale.FRANCE,"%,d", T) + "\n"); //$NON-NLS-1$ 
+		buff.append(TXMCoreMessages.Diagnostic_43 + String.format("%,d", NProperties) + "\n"); //$NON-NLS-1$ 
+		/*for (String s : propertiesCounts.keySet())
+			if (!s.equals("id")) //$NON-NLS-1$
+				buff.append(" - " + s + " " + propertiesCounts.get(s) + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+				*/
+		buff.append(TXMCoreMessages.Diagnostic_49 + String.format("%,d", NStructures) + "\n"); //$NON-NLS-1$ 
+		for (String s : structuresCounts.keySet())
+			buff.append(" - " + s + "\n");//+structuresCounts.get(s)+"\n"); //$NON-NLS-1$ //$NON-NLS-2$
+
+		/*
+		 * buff.append("* Structural Units counts\n"); for(String s :
+		 * internalArchitecture)
+		 * buff.append(" - "+s+" "+hierarchieCounts.get(s)+"\n");
+		 */
+		buff.append(TXMCoreMessages.Diagnostic_0);
+		for (String s : internalArchitecture) {
+			buff.append(" - " + s + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
+			for (String ps : internalArchitectureProperties.get(s).keySet()) {
+				if (!(s.equals("text") && (ps.equals("project") || ps.equals("base") || ps.equals("id")))) //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+				{
+					buff
+					.append("   - " + ps + "(" + internalArchitectureProperties.get(s).get(ps).size() + ") = "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+
+					int valuecount = 0;
+					for (String psv : internalArchitectureProperties.get(s)
+							.get(ps)) {
+						buff.append(psv);
+						if (valuecount++ >= maxvalue) {
+							buff.append("..."); //$NON-NLS-1$
+							break;
+						}
+						if (valuecount < internalArchitectureProperties.get(s)
+								.get(ps).size())
+							buff.append(", "); //$NON-NLS-1$
+					}
+
+					buff.append("\n"); //$NON-NLS-1$
+				}
+			}
+		}
+
+		return buff.toString();
+	}
+
+	/**
+	 * dump the result in the console with maxvalue=30.
+	 *
+	 * @return the string
+	 */
+	public String dump() {
+		return dump(30);
+	}
+
+	/**
+	 * Gets the name.
+	 *
+	 * @return the name
+	 */
+	public String getName() {
+		return corpus.getName();
+	}
+
+	/**
+	 * Gets the base.
+	 *
+	 * @return the base
+	 */
+	public Base getBase() {
+		return corpus.getBase();
+	}
+
+	/**
+	 * Gets the t.
+	 *
+	 * @return the t
+	 */
+	public int getT() {
+		return T;
+	}
+
+	/**
+	 * Gets the n properties.
+	 *
+	 * @return the n properties
+	 */
+	public int getNProperties() {
+		return NProperties;
+	}
+
+	/**
+	 * Gets the internal architecture.
+	 *
+	 * @return the internal architecture
+	 */
+	public List<String> getInternalArchitecture() {
+		return internalArchitecture;
+	}
+
+	/*public HashMap<String, Integer> getPropertiesCounts() {
+		return propertiesCounts;
+	}*/
+
+	/**
+	 * Gets the n structures.
+	 *
+	 * @return the n structures
+	 */
+	public int getNStructures() {
+		return NStructures;
+	}
+
+	/**
+	 * Gets the structures counts.
+	 *
+	 * @return the structures counts
+	 */
+	public HashMap<String, Integer> getStructuresCounts() {
+		return structuresCounts;
+	}
+
+	/**
+	 * Gets the annotations types.
+	 *
+	 * @return the annotations types
+	 */
+	public HashMap<String, Integer> getAnnotationsTypes() {
+		return annotationsTypes;
+	}
+
+	/**
+	 * Gets the annotations origins.
+	 *
+	 * @return the annotations origins
+	 */
+	public HashMap<String, Integer> getAnnotationsOrigins() {
+		return annotationsOrigins;
+	}
+
+	/**
+	 * Gets the import description.
+	 *
+	 * @return the import description
+	 */
+	public String getImportDescription() {
+		return importDescription;
+	}
+
+	/**
+	 * dump the diagnostic in a text file.
+	 *
+	 * @param outfile the outfile
+	 * @param maxvalue the maxvalue
+	 * @return true, if successful
+	 */
+	public boolean toTxt(File outfile, String encoding, int maxvalue) {
+		BufferedWriter writer;
+		try {
+			writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outfile),	encoding));
+		} catch (UnsupportedEncodingException e1) {
+			org.txm.utils.logger.Log.printStackTrace(e1);
+			return false;
+		} catch (FileNotFoundException e1) {
+			org.txm.utils.logger.Log.printStackTrace(e1);
+			return false;
+		}
+
+		try {
+			writer.write(this.dump(maxvalue));
+			writer.close();
+		} catch (IOException e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+			return false;
+		}
+
+		return true;
+	}
+
+	/**
+	 * dump the diagnostic in a HTML file.
+	 *
+	 * @param outfile the outfile
+	 * @return true, if successful
+	 */
+	public boolean toHTML(File outfile) {
+		OutputStreamWriter writer;
+		try {
+			writer = new OutputStreamWriter(new FileOutputStream(outfile), "UTF-8"); //$NON-NLS-1$
+			writer.write(this.htmldump());
+			writer.close();
+		} catch (IOException e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+			return false;
+		}
+
+		return true;
+	}
+
+	/**
+	 * dump the diagnostic in a text file, maxvalue = 100.
+	 *
+	 * @param outfile the outfile
+	 * @return true, if successful
+	 */
+	public boolean toTxt(File outfile) {
+
+		return toTxt(outfile, "UTF-8", 100); //$NON-NLS-1$
+	}
+
+	@Override
+	public void clean() {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public boolean toTxt(File outfile, String encoding, String colseparator,
+			String txtseparator) throws Exception {
+		return toTxt(outfile, encoding, 100);
+	}
+
+
+
+
+	@Override
+	public String getSimpleName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public String getDetails() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/functions/diagnostic/Diagnostic.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/functions/parallelcontexts/package.html
===================================================================
--- tmp/org.txm.core/src/java/org/txm/functions/parallelcontexts/package.html	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/functions/parallelcontexts/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Prototype of aligned contexts</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/java/org/txm/functions/parallelcontexts/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/functions/parallelcontexts/ParaCell.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/functions/parallelcontexts/ParaCell.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/functions/parallelcontexts/ParaCell.java	(revision 258)
@@ -0,0 +1,21 @@
+package org.txm.functions.parallelcontexts;
+
+public class ParaCell {
+	public String CCG, CCD, CG, keyword, CD, ref;
+	public ParaCell(String CCG, String CG, String keyword, String CD, String CCD, String ref)
+	{
+		this.CCG = CCG;
+		this.CG = CG;
+		this.CD = CD;
+		this.CCD = CCD;
+		this.keyword = keyword;
+		this.ref = ref;
+	}
+	/* (non-Javadoc)
+	 * @see java.lang.Object#toString()
+	 */
+	@Override
+	public String toString() {
+		return ref + ": " + CCG + ">" + CG + "|" + keyword + "|" + CD + "<" + CCD; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/functions/parallelcontexts/ParaCell.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/functions/parallelcontexts/ParallelContexts.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/functions/parallelcontexts/ParallelContexts.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/functions/parallelcontexts/ParallelContexts.java	(revision 258)
@@ -0,0 +1,424 @@
+package org.txm.functions.parallelcontexts;
+
+import groovy.lang.IntRange;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+
+import org.txm.Toolbox;
+import org.txm.searchengine.cqp.AbstractCqiClient;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.corpus.Corpus;
+import org.txm.searchengine.cqp.corpus.CorpusManager;
+import org.txm.searchengine.cqp.corpus.Property;
+import org.txm.searchengine.cqp.corpus.QueryResult;
+import org.txm.searchengine.cqp.corpus.StructuralUnitProperty;
+import org.txm.searchengine.cqp.corpus.query.Match;
+import org.txm.searchengine.cqp.corpus.query.Query;
+import org.txm.searchengine.cqp.serverException.CqiServerError;
+
+public class ParallelContexts {
+
+	ArrayList<String> queries;
+	String struct;
+	ArrayList<Corpus> corpora; 
+	ArrayList<String> props; 
+	ArrayList<String> refs; 
+	ArrayList<Integer> CGs;
+	ArrayList<Integer> CDs;
+	ArrayList<Boolean> participates;
+
+	// TODO : manage 
+	HashMap<String, Match[]> keywordsStartsEnds = new HashMap<String, Match[]>();
+	HashMap<String, ParaCell[]> keywordsStrings = new HashMap<String, ParaCell[]>();
+	ArrayList<String> segKeys;
+	private String structprop;
+
+	public ParallelContexts(ArrayList<String> queries, String struct, String structprop, ArrayList<Corpus> corpora, 
+			ArrayList<String> props, ArrayList<String> refs, 
+			ArrayList<Integer> CGs, ArrayList<Integer> CDs,
+			ArrayList<Boolean> participates) throws CqiClientException, IOException, CqiServerError
+			{
+		this.queries = queries;
+		this.corpora = corpora;
+		this.struct = struct;
+		this.structprop = structprop;
+		this.props = props;
+		this.refs = refs;
+		this.CGs = CGs;
+		this.CDs = CDs;
+		this.participates = participates;
+
+		for (int num = 0; num < corpora.size() ; num++) {
+			if (!participates.get(num))
+				continue;
+			Corpus corpus = corpora.get(num);
+			//String lang = corpus.getLang();
+			String query = queries.get(num);
+			System.out.println(corpus.getName()+" query: "+query);
+			QueryResult result = corpus.query(new Query(query), "TMP", true);
+
+			try {
+				List<Match> matches = result.getMatches();
+				int[] positions = result.getStarts();
+
+				StructuralUnitProperty align_id = corpus.getStructuralUnit(struct).getProperty(structprop);
+				System.out.println("struct: "+struct+" prop: "+structprop+" -> "+align_id);
+				int[] struct_pos = Toolbox.getCqiClient().cpos2Struc(align_id.getQualifiedName(), positions);
+				String[] struct_ids = Toolbox.getCqiClient().struc2Str(align_id.getQualifiedName(), struct_pos);
+
+				// fill allsegments
+				for (int i = 0 ; i < struct_ids.length ; i++) {
+					String id = struct_ids[i];
+					if (!keywordsStartsEnds.containsKey(id)) {
+						keywordsStartsEnds.put(id, new Match[corpora.size()]);
+						keywordsStrings.put(id, new ParaCell[corpora.size()]);
+					}
+					keywordsStartsEnds.get(id)[num] = matches.get(i); // take the first one
+				}
+			} catch(Exception e) {
+				System.out.println("Result is NULL ! "+e.toString());
+				org.txm.utils.logger.Log.printStackTrace(e);
+			}	
+		}
+
+		//sort allsegments
+		segKeys = new ArrayList<String>(keywordsStartsEnds.keySet());
+		Collections.sort(segKeys);
+		System.out.println("segKeys : "+segKeys.size());
+			}
+
+	/**
+	 * @return the keywordsStartsEnds
+	 */
+	public HashMap<String, Match[]> getKeywordsStartsEnds() {
+		return keywordsStartsEnds;
+	}
+
+	/**
+	 * @return the keywordsStrings
+	 * @throws CqiServerError 
+	 * @throws IOException 
+	 * @throws CqiClientException 
+	 */
+	public HashMap<String, ParaCell[]> getKeywordsStrings() throws CqiClientException, IOException, CqiServerError {
+		return getKeywordsStrings(0, segKeys.size());
+	}
+
+	/**
+	 * @return the keywordsStrings
+	 * @throws CqiClientException 
+	 * @throws CqiServerError 
+	 * @throws IOException 
+	 */
+	public LinkedHashMap<String, ParaCell[]> getKeywordsStrings(int from, int to) throws CqiClientException, IOException, CqiServerError {
+		if (from < 0 ) from = 0;
+		if (to > segKeys.size()) to = segKeys.size();
+
+		LinkedHashMap<String, ParaCell[]> rez = new LinkedHashMap<String, ParaCell[]>();
+		getMissingValues(from, to);
+		if (segKeys.size()>0) {
+			for (int i = from ; i < to ; i++)
+				rez.put(segKeys.get(i), keywordsStrings.get(segKeys.get(i)));
+			//System.out.println("getKeywordsStrings [REZ="+rez+"]");
+		} else {
+			System.out.println("getKeywordsStrings - NO SEG KEYS !!");
+		}
+
+		return rez;
+	}
+
+	private void getMissingValues(int from , int to) throws CqiClientException, IOException, CqiServerError
+	{
+		AbstractCqiClient cqiClient = CorpusManager.getCorpusManager().getCqiClient();
+		if (segKeys.size()>0){
+			String segquery = "<"+struct+"_"+structprop+"=\""; //\"]";
+			for (int i = from ; i < to ; i++) {
+				segquery += segKeys.get(i)+"|";
+			}
+			segquery = segquery.substring(0, segquery.length() -1 );
+			segquery += "\">[]";
+			System.out.println("align_seg_query : "+segquery);
+
+			// loop over corpus to minimize the number of queries
+			for (int nocorpus = 0; nocorpus < corpora.size() ; nocorpus++) {
+				Corpus corpus = corpora.get(nocorpus);
+				int MAXPOSITION = corpus.getSize();
+				StructuralUnitProperty align_id = corpus.getStructuralUnit(struct).getProperty(structprop);
+				Property prop = corpus.getProperty(props.get(nocorpus));
+				//PropertyHashMap<CqpDataProxy> proxies = CorpusManager.getCorpusManager().getCorpusProxies(corpus);
+				int iCG = CGs.get(nocorpus);
+				int iCD = CDs.get(nocorpus);
+				//System.out.println("iCG "+iCG+" iCD "+iCD);
+				//CqpDataProxy wordp = cqiClient.get(prop);
+				String[] split = refs.get(nocorpus).split("_", 2);
+				//System.out.println("refs : "+refs);
+				StructuralUnitProperty ref = null;
+				if (split.length == 2)
+					ref = corpus.getStructuralUnit(split[0]).getProperty(split[1]);
+
+				// get the seg that actually are in the corpus
+				QueryResult resul2t = corpus.query(new Query(segquery), "TMP", true);
+				int[] struct_starts = resul2t.getStarts();
+				int[] struct_pos = Toolbox.getCqiClient().cpos2Struc(align_id.getQualifiedName(), struct_starts);
+				String[] struct_ids = Toolbox.getCqiClient().struc2Str(align_id.getQualifiedName(), struct_pos);
+
+				//System.out.println("segs: "+Arrays.toString(struct_ids));
+
+				// get ref if asked
+				String[] ref_values = null;
+				if (ref != null) {
+					int[] struct_pos2 = Toolbox.getCqiClient().cpos2Struc(ref.getQualifiedName(), struct_starts);
+					ref_values = Toolbox.getCqiClient().struc2Str(ref.getQualifiedName(), struct_pos2);
+				}
+				//System.out.println("ref values: "+Arrays.toString(ref_values));
+
+				// get the words values of segs
+				QueryResult result = corpus.query(new Query(segquery+"+</"+struct+">"), "TMP", false);
+				List<Match> matches = result.getMatches();
+				//System.out.println("seg matches: "+matches);
+				ArrayList<Integer> positions = new ArrayList<Integer>();
+				for (Match m : matches) {
+					groovy.lang.IntRange range = (IntRange) m.getRange();
+
+					int minpos = range.get(0);
+					int maxpos = range.get(range.size()-1);
+					//System.out.println("range size "+range.size()+" minpos "+minpos+" maxpos "+maxpos);
+					//int n = 0;
+					for (int i = iCG ; i > 0 ; i--) {
+						if (minpos - i >= 0) {
+							positions.add(minpos - i);
+							//System.out.println("CG add "+(minpos-i));
+						}
+					}
+					positions.addAll(range);
+					//System.out.println("add "+range);
+					for (int i = 1 ; i <= iCD ; i++) {
+						if (maxpos+i < MAXPOSITION) {
+							positions.add(maxpos + i);
+							//System.out.println("CD add "+(maxpos+i));
+						}
+					}
+				}
+
+				int[] cpos = new int[positions.size()];
+				for (int i = 0 ; i < positions.size() ; i++)
+					cpos[i] = positions.get(i);
+
+				List<String> words = cqiClient.getSingleData(prop, cpos);
+				//System.out.println("words: "+(words));
+
+				int wordIterator = 0;
+				//System.out.println("loop");
+				for (int i = 0 ; i < struct_ids.length ; i++) // for each seg actually in the corpus
+				{
+					if (keywordsStrings.get(struct_ids[i])[nocorpus] != null)
+						continue; // this cell has already been computed
+					if (wordIterator >= words.size())
+						break; // no more words to process
+					Match m = matches.get(i);
+
+					Match keyWordMatch = keywordsStartsEnds.get(struct_ids[i])[nocorpus];
+					//System.out.println("wordIterator "+wordIterator+" str "+words.get(wordIterator)+ " str2 "+words.get(wordIterator+1)+" pos "+cpos[wordIterator]+" seg no "+i+" match "+m+" keyword "+keyWordMatch);
+					//if ((m.getStart() - cpos[wordIterator]) < iCG) System.out.println("WARNING CG");
+					String CCG="", CG ="", keyword="", CD="", CCD="", refValue = "";
+					int state = 1; // 0 CCG, 1 CG 2 keyword 3 CD 4 CCD
+					int previouspos = -1;
+					while (wordIterator < cpos.length 
+							&& cpos[wordIterator] <= m.getEnd() + iCD
+							&& previouspos <= cpos[wordIterator])
+					{ // concat word value
+						int pos = cpos[wordIterator];
+						previouspos = pos ;
+						//if (keyWordMatch != null) {
+						if (pos < m.getStart())
+							state = 0;
+						else if (keyWordMatch != null && pos < keyWordMatch.getStart())
+							state = 1;
+						else if (keyWordMatch != null && pos <= keyWordMatch.getEnd())
+							state = 2;
+						else if (pos <= m.getEnd())
+							state = 3;
+						else 
+							state = 4;
+						//}	
+						switch (state) {
+						case 0:
+							CCG += words.get(wordIterator)+" "; break;
+						case 1:
+							CG += words.get(wordIterator)+" "; break;
+						case 2:
+							keyword += words.get(wordIterator)+" "; break;
+						case 3:
+							CD += words.get(wordIterator)+" "; break;
+						case 4:
+							CCD += words.get(wordIterator)+" "; break;
+						}
+						wordIterator++;
+					}
+
+					if (ref_values != null) {
+						refValue = ref_values[i];
+						//System.out.println("ref: "+refValue);
+					}
+
+					// set ParaCell
+					ParaCell cell = new ParaCell(CCG, CG, keyword, CD, CCD, refValue);
+					keywordsStrings.get(struct_ids[i])[nocorpus] = cell;
+				}
+			}
+		}
+	}
+
+	/**
+	 * @return the segKeys
+	 */
+	public ArrayList<String> getSegKeys() {
+		return segKeys;
+	}
+
+	/**
+	 * @return the queries
+	 */
+	public ArrayList<String> getQueries() {
+		return queries;
+	}
+
+	/**
+	 * @return the struct
+	 */
+	public String getStruct() {
+		return struct;
+	}
+
+	/**
+	 * @return the corpora
+	 */
+	public ArrayList<Corpus> getCorpora() {
+		return corpora;
+	}
+
+	/**
+	 * @return the props
+	 */
+	public ArrayList<String> getProps() {
+		return props;
+	}
+
+	/**
+	 * @return the refs
+	 */
+	public ArrayList<String> getRefs() {
+		return refs;
+	}
+
+	/**
+	 * @return the cGs
+	 */
+	public ArrayList<Integer> getCGs() {
+		return CGs;
+	}
+
+	/**
+	 * @return the cDs
+	 */
+	public ArrayList<Integer> getCDs() {
+		return CDs;
+	}
+
+	/**
+	 * @return the participates
+	 */
+	public ArrayList<Boolean> getParticipates() {
+		return participates;
+	}
+
+	/* (non-Javadoc)
+	 * @see java.lang.Object#hashCode()
+	 */
+	@Override
+	public int hashCode() {
+		final int prime = 31;
+		int result = 1;
+		result = prime * result + ((CDs == null) ? 0 : CDs.hashCode());
+		result = prime * result + ((CGs == null) ? 0 : CGs.hashCode());
+		result = prime * result + ((corpora == null) ? 0 : corpora.hashCode());
+		result = prime * result
+				+ ((participates == null) ? 0 : participates.hashCode());
+		result = prime * result + ((props == null) ? 0 : props.hashCode());
+		result = prime * result + ((queries == null) ? 0 : queries.hashCode());
+		result = prime * result + ((refs == null) ? 0 : refs.hashCode());
+		result = prime * result + ((struct == null) ? 0 : struct.hashCode());
+		return result;
+	}
+
+	/* (non-Javadoc)
+	 * @see java.lang.Object#equals(java.lang.Object)
+	 */
+	@Override
+	public boolean equals(Object obj) {
+		if (this == obj)
+			return true;
+		if (obj == null)
+			return false;
+		if (getClass() != obj.getClass())
+			return false;
+		ParallelContexts other = (ParallelContexts) obj;
+		if (CDs == null) {
+			if (other.CDs != null)
+				return false;
+		} else if (!CDs.equals(other.CDs))
+			return false;
+		if (CGs == null) {
+			if (other.CGs != null)
+				return false;
+		} else if (!CGs.equals(other.CGs))
+			return false;
+		if (corpora == null) {
+			if (other.corpora != null)
+				return false;
+		} else if (!corpora.equals(other.corpora))
+			return false;
+		if (participates == null) {
+			if (other.participates != null)
+				return false;
+		} else if (!participates.equals(other.participates))
+			return false;
+		if (props == null) {
+			if (other.props != null)
+				return false;
+		} else if (!props.equals(other.props))
+			return false;
+		if (queries == null) {
+			if (other.queries != null)
+				return false;
+		} else if (!queries.equals(other.queries))
+			return false;
+		if (refs == null) {
+			if (other.refs != null)
+				return false;
+		} else if (!refs.equals(other.refs))
+			return false;
+		if (struct == null) {
+			if (other.struct != null)
+				return false;
+		} else if (!struct.equals(other.struct))
+			return false;
+		return true;
+	}
+
+	/* (non-Javadoc)
+	 * @see java.lang.Object#toString()
+	 */
+	@Override
+	public String toString() {
+		return "ParallelContexts [queries=" + queries + ", struct=" + struct
+				+ ", corpora=" + corpora + ", props=" + props + ", refs="
+				+ refs + ", CGs=" + CGs + ", CDs=" + CDs + ", participates="
+				+ participates + "]";
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/functions/parallelcontexts/ParallelContexts.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/functions/Function.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/functions/Function.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/functions/Function.java	(revision 258)
@@ -0,0 +1,174 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2016-09-19 10:31:00 +0200 (Mon, 19 Sep 2016) $
+// $LastChangedRevision: 3298 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.functions;
+
+import java.io.File;
+
+import org.txm.core.results.ITXMResult;
+import org.txm.core.results.TXMResult;
+
+/**
+ * 
+ * Function which produces a result of Textometry computation
+ * 
+ * The abstract Class Function.
+ * 
+ * Has methods to interact with a ProcessWatcher: set work amount, set messages, acquire/release interruption semaphore.
+ * 
+ *  @author mdecorde
+ *  @author nkredens
+ */
+public abstract class Function extends TXMResult {
+	
+	/**
+	 * 
+	 */
+	protected ProgressWatcher monitor;
+	
+	
+	
+	/**
+	 * 
+	 */
+	public Function() {
+		super();
+	}
+
+	/**
+	 * 
+	 * @param parent
+	 */
+	public Function(ITXMResult parent) {
+		super(parent);
+	}
+
+	/**
+	 * You must set the current monitor to be available to manage the process progress
+	 * @param monitor
+	 */
+	public void setCurrentMonitor(ProgressWatcher monitor) {
+		this.monitor = monitor;
+	}
+	
+	/**
+	 * increment the process 
+	 * @param amount of work
+	 */
+	public void worked(int amount) {
+		if (monitor != null) {
+			//System.out.println("worked "+amount);
+			monitor.worked(amount);
+		}
+	}
+	
+	/**
+	 * increment the progress and show a message
+	 * @param amount
+	 * @param message
+	 */
+	public void worked(int amount, String message) {
+		if (monitor != null) {
+			monitor.worked(amount, message);
+		}
+	}
+	
+	/**
+	 * show a message in progress
+	 * @param message
+	 */
+	public void setMessage(String message) {
+		if (monitor != null)
+			monitor.setMessage(message);
+	}
+	
+	/**
+	 * 
+	 * @return true if the monitor has been canceled by the user
+	 */
+	public boolean isCanceled() {
+		if (monitor != null) {
+			return monitor.isCanceled();
+		}
+		return false;
+	}
+	
+	public void done() {
+		if (monitor != null) {
+			monitor.done();
+		}
+	}
+	
+	public void acquireSemaphore() {
+		if (monitor != null)
+			monitor.acquireSemaphore();
+	}
+	
+	public boolean tryAcquireSemaphore() {
+		if (monitor != null)
+			return monitor.tryAcquireSemaphore();
+		else
+			return false;
+	}
+	
+	public void releaseSemaphore() {
+		if (monitor != null)
+			monitor.releaseSemaphore();
+	}
+	
+	//public abstract boolean toTxt(File file, String encoding) throws Exception;
+	public abstract boolean toTxt(File outfile, String encoding, String colseparator, String txtseparator) throws Exception;
+	
+	
+	
+
+	
+	/**
+	 * 
+	 * @return the array of extensions to show in the FileDialog SWT widget
+	 */
+	public String[] getExportTXTExtensions() {
+		return new String[]{"*.csv"};
+	}
+	
+	/**
+	 * 
+	 * @return the parent Object that contains this result
+	 */
+	@Deprecated
+	// FIXME: to remove when TXMResult2 will be fully implemented
+	//public abstract HasResults getHasResultsParent();
+	
+	/**
+	 * Used by the Corpora view to open an editor from a double-clicked element.
+	 * Extension functions must override this method to open an editor from their produced results
+	 * @return
+	 */
+	public boolean openEditor() {
+		return false;
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/functions/Function.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/functions/selection/package.html
===================================================================
--- tmp/org.txm.core/src/java/org/txm/functions/selection/package.html	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/functions/selection/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Selection: select text using metadata values</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/java/org/txm/functions/selection/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/functions/selection/SelectionResult.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/functions/selection/SelectionResult.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/functions/selection/SelectionResult.java	(revision 258)
@@ -0,0 +1,13 @@
+package org.txm.functions.selection;
+
+import java.util.*;
+
+public class SelectionResult extends ArrayList<String>{
+	public HashMap<String,ArrayList<String>> critera = new HashMap<String, ArrayList<String>>();
+	
+	@Override
+	public String toString()
+	{
+		return super.toString() + critera.toString();
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/functions/selection/SelectionResult.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/functions/selection/Selection.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/functions/selection/Selection.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/functions/selection/Selection.java	(revision 258)
@@ -0,0 +1,488 @@
+// 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
+// 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.
+// 
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+package org.txm.functions.selection;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.core.results.TXMResult;
+import org.txm.metadatas.Metadata;
+import org.txm.metadatas.MetadataGroup;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.clientExceptions.UnexpectedAnswerException;
+import org.txm.searchengine.cqp.corpus.Corpus;
+import org.txm.searchengine.cqp.corpus.CorpusManager;
+import org.txm.searchengine.cqp.corpus.MainCorpus;
+import org.txm.searchengine.cqp.corpus.Property;
+import org.txm.searchengine.cqp.corpus.QueryResult;
+import org.txm.searchengine.cqp.corpus.StructuralUnit;
+import org.txm.searchengine.cqp.corpus.StructuralUnitProperty;
+import org.txm.searchengine.cqp.corpus.query.Match;
+import org.txm.searchengine.cqp.corpus.query.Query;
+import org.txm.searchengine.cqp.serverException.CqiServerError;
+import org.txm.utils.logger.Log;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Used to build sub-corpus of texts.
+ * It links texts to their properties and compute some stats 
+ * @author mdecorde
+ *
+ */
+public class Selection extends TXMResult  {
+
+	/** Full selection. */
+	Corpus corpus;
+	
+	/** The query to get texts metadatas and number. */
+	Query query;
+	
+	/** The cqp positions of the texts start element. */
+	int[] positions;
+	
+	/** The all properties. */
+	List<StructuralUnitProperty> allProperties;
+	
+	/** The textids. */
+	List<String> textids;
+	
+	/** The numberofwords. */
+	HashMap<String, Integer> numberOfWordsPerText;
+
+	/** The text metadatas values. */
+	HashMap<String, HashMap<String, String>> metadatasValuesPerText;
+	HashMap<String, List<String>> valuesPerMetadata;
+	
+	/** The metadatas and groups. */
+	ArrayList<Metadata> metadatas;
+	ArrayList<MetadataGroup> metadatagroups;
+	
+	/** The property and group names per usage. */
+	private ArrayList<String> selectionPropertyNames;
+	private ArrayList<String> displayPropertyNames;
+	private ArrayList<String> selectionGroupNames;
+	private ArrayList<String> displayGroupNames;
+	
+	/** the list of property used per group**/
+	private HashMap<String, List<String>> propertyNamesPerGroup;
+	
+	/**
+	 * Instantiates a new selection.
+	 *
+	 * @param corpus the corpus
+	 */
+	public Selection(MainCorpus corpus) {
+		// this query returns N results, where N is the number of text
+		this.query = new Query("<text>[]"); //$NON-NLS-1$
+		this.corpus = corpus;
+		init();
+	}
+	
+	/**
+	 * get positions, properties
+	 * and compute texts stats (but not words)
+	 * and get texts metadatas.
+	 */
+	private boolean init() {
+		try {
+			if (corpus.getBase() == null) {
+				System.out.println(TXMCoreMessages.Selection_6+corpus+TXMCoreMessages.Selection_7);
+				return false;
+			}
+			metadatas = corpus.getImportMetadata();
+			metadatagroups = corpus.getMetadataGroups();
+			
+			//get texts positions
+			QueryResult result = corpus.query(query, "selection", false); //$NON-NLS-1$
+			List<Match> matches = result.getMatches();
+			result.drop();
+			//System.out.println("Nb of texts: "+matches.size());
+			positions = new int[matches.size()]; // starting positions of texts in the corpus
+			for (int i = 0 ; i < matches.size() ; i++)
+				positions[i] = matches.get(i).getStart();
+			
+			// select used structuralUnitsProperties in corpus structuralUnitsProperties
+			StructuralUnit text_su = corpus.getStructuralUnit("text"); //$NON-NLS-1$
+			allProperties = new ArrayList<StructuralUnitProperty>();
+			if (metadatas.size() > 0) {
+				for (Metadata m : metadatas) {
+					try {
+						StructuralUnitProperty sup = text_su.getProperty(m.id);
+						if (sup == null) {
+							Log.warning(TXMCoreMessages.Selection_8+m.id);
+							continue;
+						}
+						allProperties.add(sup);
+					} catch(Exception e) {
+						Log.severe(TXMCoreMessages.Selection_9+e);
+					}
+				}
+			}
+
+			// in case no metadatas are declared in import.xml
+			if (allProperties.size() == 0) 
+				for (StructuralUnitProperty sup : text_su.getProperties())
+					allProperties.add(sup);
+
+			//get text ids (using starting position of texts) + text size using the positions
+			StructuralUnitProperty sup = text_su.getProperty("id"); //$NON-NLS-1$
+			int[] idx = CorpusManager.getCorpusManager().getCqiClient().cpos2Struc(sup.getQualifiedName(), positions);
+			//System.out.println("cpos2Struc: "+Arrays.toString(idx));
+			String[] textsIdArray = CorpusManager.getCorpusManager().getCqiClient().struc2Str(sup.getQualifiedName(), idx);
+			//System.out.println("struc2Str: "+Arrays.toString(textsIdArray));
+			textids = Arrays.asList(textsIdArray);
+
+			metadatasValuesPerText = new HashMap<String, HashMap<String,String>>();
+			numberOfWordsPerText = new HashMap<String, Integer>();
+			for (int i = 0 ; i < textids.size() ; i++) {
+				this.metadatasValuesPerText.put(textids.get(i), new HashMap<String, String>());
+				
+				//QueryResult result2 = corpus.query(new Query("[_.text_id=\""+textids.get(i)+"\"] expand to text"), "temp", false); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+				QueryResult result2 = corpus.query(new Query("/region[text,a]:: a.text_id=\""+textids.get(i)+"\""), "temp", false); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+				int tot = 0;
+				for (Match m : result2.getMatches(0,0))
+					tot += m.getEnd()- m.getStart();
+				numberOfWordsPerText.put(textids.get(i), tot);
+				result2.drop();
+			}
+
+			//System.out.println(textMetadatas);
+			//INITIALIZATIONS
+			for (StructuralUnitProperty property : allProperties) {	
+				readTextMetadatas(property);
+			}
+
+			getTextMetadatas();
+			getStructuralUnitPropertyValues();
+			getDisplayPropertyNames();
+			getSelectionPropertyNames();
+			getDisplayGroupNames();
+			getSelectionGroupNames();
+			getMetadataGroupNames();
+		}
+		catch (Exception e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+			return false;
+		}
+		return true;
+	}
+	
+	public Corpus getCorpus() {
+		return this.corpus;
+	}
+	
+	public HashMap<String, List<String>> getMetadataGroupNames() {
+		if (propertyNamesPerGroup != null)
+			return propertyNamesPerGroup;
+		propertyNamesPerGroup = new HashMap<String, List<String>>();
+		for (MetadataGroup gp : metadatagroups) {
+			ArrayList<String> list = new ArrayList<String>();
+			System.out.println("gp: "+gp.id); //$NON-NLS-1$
+			propertyNamesPerGroup.put(gp.id, list);
+			for (Metadata m : gp.metadatas)
+				list.add(m.id);
+		}
+		return propertyNamesPerGroup;
+	}
+	
+	/**
+	 * print the full texts stats.
+	 *
+	 * @throws CqiClientException the cqi client exception
+	 */
+	public void fullDump() throws CqiClientException {
+		System.out.println(TXMCoreMessages.Selection_5);
+		System.out.println(TXMCoreMessages.Corpus_2+corpus);
+		System.out.println("Text query: "+query); //$NON-NLS-1$
+		System.out.println("Texts ids: "+textids); //$NON-NLS-1$
+		System.out.println("Text positions: "+Arrays.toString(positions)); //$NON-NLS-1$
+		System.out.println("Text nbwords: "+numberOfWordsPerText); //$NON-NLS-1$
+		System.out.println();
+		System.out.println("StructuralUnitsProperties: "+allProperties); //$NON-NLS-1$
+		System.out.println("Meta values per texts: "+metadatasValuesPerText); //$NON-NLS-1$
+		System.out.println("Meta values per name: "+valuesPerMetadata); //$NON-NLS-1$
+		System.out.println();
+		System.out.println("Declared metadatas: "+metadatas); //$NON-NLS-1$
+		System.out.println("Declared metadata groups: "+metadatagroups); //$NON-NLS-1$
+		System.out.println(""); //$NON-NLS-1$
+		System.out.println("Selection props: "+selectionPropertyNames); //$NON-NLS-1$
+		System.out.println("Displayed props: "+displayPropertyNames); //$NON-NLS-1$
+		System.out.println("Selection groups: "+selectionGroupNames); //$NON-NLS-1$
+		System.out.println("Displayed groups: "+displayGroupNames); //$NON-NLS-1$
+		System.out.println("Properties used per group: "+ propertyNamesPerGroup); //$NON-NLS-1$
+	}
+	
+	/**
+	 * Gets the number of word.
+	 *
+	 * @param property the property
+	 * @param value the value
+	 * @return the number of words which 'property' value matches param 'value'
+	 */
+	public int getNumberOfWord(StructuralUnitProperty property, String value) {
+		int nb = 0;
+		for (String text : metadatasValuesPerText.keySet())
+			if (metadatasValuesPerText.get(text).get(property).equals(value))
+				nb+= numberOfWordsPerText.get(text);
+		return nb;
+	}
+	
+	/**
+	 * Gets the text number.
+	 *
+	 * @param property the property
+	 * @param value the value
+	 * @return the number of text which 'property' value matches param 'value'
+	 */
+	public int getNumberOfText(StructuralUnitProperty property, String value) 
+	{
+		int nb = 0;
+		for (String text : metadatasValuesPerText.keySet())
+			if (metadatasValuesPerText.get(text).get(property).equals(value))
+				nb++;
+		return nb;
+	}
+	
+	/**
+	 * Loads the metadatas values and store them per text id.
+	 *
+	 * @param property the property
+	 * @return 
+	 * @return the text metadatas
+	 * @throws UnexpectedAnswerException the unexpected answer exception
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	private HashMap<String, HashMap<String, String>> readTextMetadatas(StructuralUnitProperty property) throws UnexpectedAnswerException, IOException, CqiServerError
+	{
+		int[] idx = CorpusManager.getCorpusManager().getCqiClient().cpos2Struc(property.getQualifiedName(), positions);
+		String[] values = CorpusManager.getCorpusManager().getCqiClient().struc2Str(property.getQualifiedName(), idx);
+
+		for (int i = 0 ; i < values.length ; i++) {
+			this.metadatasValuesPerText.get(textids.get(i)).put(property.getName(), values[i]);
+		}
+		
+		return metadatasValuesPerText;
+	}
+	
+	/**
+	 * Gets the text metadatas values per text.
+	 *
+	 * @return the text metadatas
+	 */
+	public HashMap<String, HashMap<String, String>> getTextMetadatas() {
+		return this.metadatasValuesPerText;
+	}
+	
+	/**
+	 * Gets the number of words.
+	 *
+	 * @return the number of words
+	 */
+	public HashMap<String, Integer> getNumberOfWordsPerText() {
+		return this.numberOfWordsPerText;
+	}
+	
+	/**
+	 * Gets the text ids.
+	 *
+	 * @return the text ids, corpus ordered
+	 */
+	public List<String> getTextIds() {
+		return this.textids;
+	}
+	
+	/**
+	 * Gets and loads the selection properties name.
+	 *
+	 * @return the selection text metadata
+	 */
+	public ArrayList<String> getSelectionPropertyNames()
+	{
+		if (selectionPropertyNames != null)
+			return selectionPropertyNames;
+		StructuralUnit text_su;
+		selectionPropertyNames = new ArrayList<String>();
+		/*try {
+			text_su = corpus.getStructuralUnit("text");
+
+			// if corpus has metadatas declared
+			if (metadatas.size() > 0)
+			{
+				for(Metadata m : metadatas)
+				{
+						selectionPropertyNames.add(m.id);
+				}
+			}
+
+			//if no props added via metadata then get all text properties
+			if (selectionPropertyNames.size() == 0) 
+			{
+				for(Property p : text_su.getProperties())
+					selectionPropertyNames.add(p.getName());
+			}
+
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		} //$NON-NLS-1$*/
+		for (StructuralUnitProperty prop : allProperties)
+			selectionPropertyNames.add(prop.getName());
+		return selectionPropertyNames;
+	}
+
+	/**
+	 * Gets and loads the selection group names.
+	 *
+	 * @return the selection text metadata
+	 */
+	public ArrayList<String> getSelectionGroupNames()
+	{
+		if (selectionGroupNames != null)
+			return selectionGroupNames;
+		selectionGroupNames = new ArrayList<String>();
+		for (Metadata m : metadatagroups) {
+			if (m.selection) {	
+				selectionGroupNames.add(m.id);
+			}
+		}
+
+		return selectionGroupNames;
+	}
+
+	/**
+	 * Gets the display properties name.
+	 *
+	 * @return the display text metadata
+	 */
+	public ArrayList<String> getDisplayPropertyNames()
+	{
+		if (displayPropertyNames != null)
+			return displayPropertyNames;
+		StructuralUnit text_su;
+		displayPropertyNames = new ArrayList<String>();
+		try {
+			text_su = corpus.getStructuralUnit("text"); //$NON-NLS-1$
+
+			// if corpus has metadatas declared
+			if (metadatas.size() > 0) {
+				for (Metadata m : metadatas) {
+					if (m.display) // only keep metadata for selection
+						displayPropertyNames.add(m.id);
+				}
+			}
+
+			if (displayPropertyNames.size() == 0) {
+				for (Property p : text_su.getProperties())
+					displayPropertyNames.add(p.getName());
+			}
+
+		} catch (Exception e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+		} 
+		return displayPropertyNames;
+	}
+
+	/**
+	 * Gets and loads the display group names.
+	 *
+	 * @return the display text metadata
+	 */
+	public ArrayList<String> getDisplayGroupNames()
+	{
+		if (displayGroupNames != null)
+			return displayGroupNames;
+		displayGroupNames = new ArrayList<String>();
+		for (Metadata m : metadatagroups) {
+			if (m.display) // only keep metadata for selection
+				displayGroupNames.add(m.id);
+		}
+		return displayGroupNames;
+	}
+
+	/**
+	 * Gets the structural unit property values per structuralUnitProperty.
+	 *
+	 * @return 
+	 */
+	public HashMap<String, List<String>> getStructuralUnitPropertyValues()
+	{
+		if (valuesPerMetadata != null)
+			return valuesPerMetadata;
+		valuesPerMetadata = new HashMap<String, List<String>>();
+
+		try {
+			for (StructuralUnitProperty sup : allProperties) {
+				try {
+					valuesPerMetadata.put(sup.getName(), sup.getValues());
+				} catch (CqiClientException e) {
+					System.out.println(TXMCoreMessages.Selection_26+sup.getFullName());
+					org.txm.utils.logger.Log.printStackTrace(e);
+					return valuesPerMetadata;
+				}
+			}
+		} catch(Exception e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+		return valuesPerMetadata;
+	}
+
+	public ArrayList<Metadata> getMetadatas() {
+		return metadatas;
+	}
+
+	public ArrayList<MetadataGroup> getMetadatagroups() {
+		return metadatagroups;
+	}
+
+	@Override
+	public String getName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public String getSimpleName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public String getDetails() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public void clean() {
+		// TODO Auto-generated method stub
+		
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/functions/selection/Selection.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/functions/parabrowser/ParaBrowser.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/functions/parabrowser/ParaBrowser.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/functions/parabrowser/ParaBrowser.java	(revision 258)
@@ -0,0 +1,238 @@
+package org.txm.functions.parabrowser;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.txm.core.results.TXMResult;
+import org.txm.functions.ReferencePattern;
+import org.txm.searchengine.cqp.CqpDataProxy;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.corpus.MainCorpus;
+import org.txm.searchengine.cqp.corpus.Property;
+import org.txm.searchengine.cqp.corpus.QueryResult;
+import org.txm.searchengine.cqp.corpus.StructuralUnit;
+import org.txm.searchengine.cqp.corpus.StructuralUnitProperty;
+import org.txm.searchengine.cqp.corpus.query.Match;
+import org.txm.searchengine.cqp.corpus.query.Query;
+import org.txm.searchengine.cqp.corpus.query.QueryPart;
+import org.txm.utils.Pair;
+import org.txm.utils.i18n.LangFormater;
+
+public class ParaBrowser extends TXMResult  {
+	
+	/**
+	 * Gets the nextor previous.
+	 *
+	 * @param unit the unit
+	 * @param property the property
+	 * @param value the value
+	 * @param isNext the is next
+	 * @return the nextor previous
+	 */
+	public String getNextOrPrevious(MainCorpus corpus, StructuralUnit unit,
+			StructuralUnitProperty property, String value, boolean isNext) {
+		String next = "";
+		Query query = null;
+		System.out.println("GET NEXT or PREVIOUS : " + value + " unit " + unit
+				+ " property " + property + " next? " + isNext);
+		if (isNext) {
+			query = new Query("<" + unit.getName() + "_id=\"" + value
+					+ "\">[]+</" + unit.getName() + ">[]");
+		} else {
+			query = new Query("<" + unit.getName() + ">[]+" + "</"
+					+ unit.getName() + "><" + unit.getName() + "_id=\"" + value
+					+ "\">[]+");
+		}
+		Property text_id = unit.getProperty("id"); //$NON-NLS-1$
+		// System.out.println("text_id = unit "+unit+" get props de id");
+		// System.out.println("Query : "+query);
+		if (property != null) {
+//			List<Line> lines;
+			int nLines;
+
+			ReferencePattern referencePattern = new ReferencePattern();
+			referencePattern.addProperty(text_id);
+			
+			QueryResult queryResult;
+			try {
+				Map<Property, List<List<String>>> wordPropValues = new HashMap<Property, List<List<String>>>();
+
+				queryResult = corpus.query(query, query.getQueryString().replace(
+						" ", "_")
+						+ "_parallel", false);
+				nLines = queryResult.getNMatch(); // get number of tokens
+				// System.out.println("nLines : "+nLines);
+//				lines = new ArrayList<Line>();
+
+				List<Match> matches = null;
+				if (nLines > 0)
+					matches = queryResult.getMatches(0, nLines - 1); // get the
+				// indexes
+				// sequences
+				// of
+				// result's
+				// tokens
+				else
+					matches = new ArrayList<Match>();
+
+				List<Integer> beginingOfKeywordsPositions = new ArrayList<Integer>();
+				List<Integer> lengthOfKeywords = new ArrayList<Integer>();
+				// keywordsViewPropValues = new HashMap<Property,
+				// List<List<String>>>();
+				int nb = 0;
+				for (int j = 0; j < nLines; j++) {
+					Match match = matches.get(j);
+					beginingOfKeywordsPositions.add(match.getStart()); // get
+					// the first
+					// index
+					lengthOfKeywords.add(match.getEnd() - match.getStart() + 1);// get
+					// the last index
+					nb = match.getEnd() - match.getStart() + 1;
+				}
+
+				if (!isNext) {
+					nb = 1;
+				}
+
+				// get all reference values of all lines
+				for (Property prop : referencePattern) {
+//					List<List<String>> propVals = cache.get(prop).getData(
+//							beginingOfKeywordsPositions,
+//							Collections.nCopies(beginingOfKeywordsPositions
+//									.size(), nb));
+//					// for the first word = 1
+//					// for the last word = nb
+//
+//					for (List<String> propVal : propVals) {
+//						for (String str : propVal) {
+//							// System.out.println("Next  = "+str);
+//							next = str;
+//						}
+//					}
+				}
+
+			} catch (CqiClientException e1) {
+				org.txm.utils.logger.Log.printStackTrace(e1);
+			}
+		}
+		return next;
+	}
+	
+	
+	/**
+	 * Gets the text region.
+	 *
+	 * @param unit the unit
+	 * @param property the property
+	 * @param value the value
+	 * @return the text region
+	 */
+	public Pair<String, QueryResult> getTextRegion(MainCorpus corpus, StructuralUnit unit,
+			StructuralUnitProperty property, String value) {
+		Query query = new QueryPart(unit, property, value);
+		System.out.println("GET REGION : " + value);
+
+		String text = "";
+
+		if (property != null) {
+			LinkedHashMap<String, Integer> counts;
+//			List<Line> lines;
+			int nLines;
+
+			CqpDataProxy cache;
+			try {
+				cache = new CqpDataProxy(null, corpus.getProperty("word")); // TODO: not null
+			} catch (CqiClientException e1) {
+				org.txm.utils.logger.Log.printStackTrace(e1);
+				return new Pair<String, QueryResult>(
+						"error can't get word property", null);
+			}
+
+			// get the cqp result of the query
+			QueryResult result;
+			try {
+				result = corpus.query(query, query.getQueryString().replace(" ",
+						"_")
+						+ "_parallel", false);
+				nLines = result.getNMatch(); // get number of tokens
+				System.out.println("nMatchs : " + nLines);
+//				lines = new ArrayList<Line>();
+
+				List<Match> matches = null;
+				if (nLines > 0)
+					matches = result.getMatches(0, nLines - 1); // get the
+				// indexes
+				// sequences of
+				// result's
+				// tokens
+				else
+					matches = new ArrayList<Match>();
+
+				List<Integer> beginingOfKeywordsPositions = new ArrayList<Integer>();
+				List<Integer> lengthOfKeywords = new ArrayList<Integer>();
+				// keywordsViewPropValues = new HashMap<Property,
+				// List<List<String>>>();
+
+				for (int j = 0; j < nLines; j++) {
+					Match match = matches.get(j);
+					beginingOfKeywordsPositions.add(match.getStart()); // get
+					// the
+					// first
+					// index
+					lengthOfKeywords.add(match.getEnd() - match.getStart() + 1);// get
+					// the
+					// last
+					// index
+				}
+
+				List<List<String>> propVals = cache.getData(
+						beginingOfKeywordsPositions, lengthOfKeywords);
+				for (List<String> prop : propVals) {
+					text += "\n\n";
+					for (String str : prop) {
+						text += str + " ";
+						// System.out.println("Region word = "+str);
+					}
+				}
+			} catch (CqiClientException e) {
+				org.txm.utils.logger.Log.printStackTrace(e);
+				return new Pair<String, QueryResult>("error", null);
+			} 
+			return new Pair<String, QueryResult>(LangFormater.format(text, corpus
+					.getAttribute("lang")), result);
+		}
+		// return keywordsViewPropValues;
+		return new Pair<String, QueryResult>("error no property", null);
+	}
+
+
+	@Override
+	public String getName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+
+	@Override
+	public String getSimpleName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+
+	@Override
+	public String getDetails() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+
+	@Override
+	public void clean() {
+		// TODO Auto-generated method stub
+		
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/functions/parabrowser/ParaBrowser.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/functions/parabrowser/package.html
===================================================================
--- tmp/org.txm.core/src/java/org/txm/functions/parabrowser/package.html	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/functions/parabrowser/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Prototype of aligned edition browser</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/java/org/txm/functions/parabrowser/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/functions/ReferencePattern.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/functions/ReferencePattern.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/functions/ReferencePattern.java	(revision 258)
@@ -0,0 +1,149 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2015-10-22 09:15:18 +0200 (Thu, 22 Oct 2015) $
+// $LastChangedRevision: 3040 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.functions;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.searchengine.cqp.corpus.Property;
+import org.txm.searchengine.cqp.corpus.StructuralUnitProperty;
+
+// TODO: Auto-generated Javadoc
+/**
+ * how to display the references.
+ *
+ * @author mdecorde
+ */
+public class ReferencePattern implements Iterable<Property> {
+
+	/** The properties. */
+	private List<Property> properties = new ArrayList<Property>();
+
+	/**
+	 * Instantiates a new reference pattern.
+	 */
+	public ReferencePattern() {
+		properties = new ArrayList<Property>();
+	}
+
+	/**
+	 * Instantiates a new reference pattern.
+	 *
+	 * @param parameters the properties
+	 */
+	public ReferencePattern(Property prop) {
+		List<Property> properties = new ArrayList<Property>();
+		properties.add(prop);
+		this.properties = properties;
+	}
+	
+	/**
+	 * Instantiates a new reference pattern.
+	 *
+	 * @param parameters the properties
+	 */
+	public ReferencePattern(StructuralUnitProperty prop) {
+		List<Property> properties = new ArrayList<Property>();
+		properties.add(prop);
+		this.properties = properties;
+	}
+	
+	/**
+	 * Instantiates a new reference pattern.
+	 *
+	 * @param properties the properties
+	 */
+	public ReferencePattern(List<Property> properties) {
+		this.properties = properties;
+	}
+	
+	
+	/**
+	 * Adds the property.
+	 *
+	 * @param property the property
+	 * @return the reference pattern
+	 */
+	public ReferencePattern addProperty(Property property) {
+		this.properties.add(property);
+		return this;
+	}
+
+	/* (non-Javadoc)
+	 * @see java.lang.Iterable#iterator()
+	 */
+	@Override
+	public Iterator<Property> iterator() {
+		return properties.iterator();
+	}
+
+	/**
+	 * Gets the properties.
+	 *
+	 * @return the properties
+	 */
+	public List<Property> getProperties() {
+		return properties;
+	}
+
+	/* (non-Javadoc)
+	 * @see java.lang.Object#toString()
+	 */
+	@Override
+	public String toString() {
+		StringBuffer buffer = new StringBuffer();
+		for (Property property : properties) {
+			buffer.append(property.getName() + " "); //$NON-NLS-1$
+		}
+		return buffer.toString().trim();
+	}
+
+	/**
+	 * Gets the title.
+	 *
+	 * @return the title
+	 */
+	public String getTitle() {
+		String title = ""; //$NON-NLS-1$
+		for(Property p : this.properties)
+			if (p instanceof StructuralUnitProperty)
+			{
+				StructuralUnitProperty sp = (StructuralUnitProperty)p;
+				title += sp.getFullName()+", "; //$NON-NLS-1$
+			}
+			else
+				title += p.getName()+", "; //$NON-NLS-1$
+		if (title.length() == 0)
+			title = TXMCoreMessages.ReferencePattern_3;
+		else
+			title = title.substring(0, title.length()-2);
+		return title;
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/functions/ReferencePattern.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/functions/internal/InternalView.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/functions/internal/InternalView.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/functions/internal/InternalView.java	(revision 258)
@@ -0,0 +1,209 @@
+package org.txm.functions.internal;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+
+import org.txm.Toolbox;
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.core.results.TXMResult;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.corpus.Corpus;
+import org.txm.searchengine.cqp.corpus.Property;
+import org.txm.searchengine.cqp.corpus.QueryResult;
+import org.txm.searchengine.cqp.corpus.StructuralUnit;
+import org.txm.searchengine.cqp.corpus.query.Match;
+import org.txm.searchengine.cqp.corpus.query.Query;
+
+public class InternalView extends TXMResult  {
+	Corpus corpus;
+	List<Property> properties;
+	StructuralUnit struct;
+	List<Property> structProperties;
+
+	int currentStruct = -1;
+	int nmatches = 0;
+	List<Match> matches = new ArrayList<Match>();
+
+
+	public InternalView(Corpus corpus, List<Property> properties, StructuralUnit struct, List<Property> structProperties) throws CqiClientException {
+		this.corpus = corpus;
+		this.properties = properties;
+		this.struct = struct;
+		this.structProperties = structProperties;
+
+		//find struct start-end
+		Query query = new Query("<"+struct.getName()+"> [] expand to "+struct); //$NON-NLS-1$ //$NON-NLS-2$
+		//System.out.println(query);
+		QueryResult result = corpus.query(query, "test", false); //$NON-NLS-1$
+		nmatches = result.getNMatch();
+		if (nmatches > 0) {
+			matches = result.getMatches();
+		}
+		result.drop();
+		//System.out.println(matches);
+	}
+
+	public String getStructInfos() {
+
+		try {
+			if (structProperties.size() > 0) {
+				String str = TXMCoreMessages.InternalView_3;
+				for (Property sup : structProperties) {
+					int[] array = {getCurrentSegmentNo()};
+					str += " "+sup.getName()+"="+Toolbox.getCqiClient().struc2Str(sup.getQualifiedName(), array)[0]; //$NON-NLS-1$ //$NON-NLS-2$
+				}
+				return str;
+			}
+		} catch (Exception e) {
+			System.out.println(TXMCoreMessages.InternalView_6+e.getMessage());
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+		return TXMCoreMessages.InternalView_7;
+	}
+
+	public HashMap<Property, List<String>> getNext() throws CqiClientException {
+		int next = currentStruct + 1;
+		if (next < nmatches) {
+			return getSegment(next);
+		} 
+		return new HashMap<Property, List<String>>();
+	}
+
+	public HashMap<Property, List<String>> getPrevious() throws CqiClientException {
+		int previous = currentStruct - 1;
+		if (previous >= 0 && previous < nmatches) {
+			return getSegment(previous);
+		}
+		return new HashMap<Property, List<String>>();
+	}
+
+	public HashMap<Property, List<String>> getFirst() throws CqiClientException {
+		if (0 < nmatches) {
+			return getSegment(0);
+		}
+		return new HashMap<Property, List<String>>();
+	}
+
+	public HashMap<Property, List<String>> getLast() throws CqiClientException {
+		if (nmatches - 1 >= 0) {
+			return getSegment(nmatches - 1);
+		}
+		return new HashMap<Property, List<String>>();
+	}
+
+	public HashMap<Property, List<String>> getSegment(int i) throws CqiClientException {
+		HashMap<Property, List<String>> rez = new HashMap<Property, List<String>>();
+
+		if (i >= 0 && i < nmatches) {
+			Match m = matches.get(i);
+			Collection<? extends Integer> positions = m.getRange();
+			int[] p = new int[positions.size()];
+			int c = 0;
+			for(int v : positions) p[c++] = v;
+			for (Property prop : properties) {
+				rez.put(prop, Match.getValuesForProperty(prop, p));
+			}
+			currentStruct = i;
+		}
+		return rez;
+	}
+
+	public void printNext() throws CqiClientException {
+		HashMap<Property, List<String>> seg = getNext();
+		if (seg.size() > 0)
+			System.out.println(seg);
+	}
+
+	public void printPrevious() throws CqiClientException {
+		HashMap<Property, List<String>> seg = getPrevious();
+		if (seg.size() > 0)
+			System.out.println(seg);
+	}
+
+	public void printSeg(HashMap<Property, List<String>> seg) {
+		Collection<List<String>> values = seg.values();
+		if(values.size() == 0) return;
+
+		for(List<String> list : values) {
+			for(String value : list)
+				System.out.print("\t"+value); //$NON-NLS-1$
+			System.out.println();
+		}
+		System.out.println();
+	}
+
+	public Corpus getCorpus() {
+		return corpus;
+	}
+
+	public StructuralUnit getStructuralUnit() {
+		return struct;
+	}
+
+	public List<Property> getProperties() {
+		return properties;
+	}
+
+	public int getCurrentSegmentNo() {
+		return currentStruct;
+	}
+
+	public int getNSegment() {
+		return nmatches;
+	}
+
+	public int getSegmentLength() {
+		if (matches.size() == 0) return 0;
+		Match m = matches.get(currentStruct);
+		return m.size();
+	}
+
+	public boolean isFirst() {
+		return currentStruct == 0;
+	}
+
+	public boolean isLast() {
+		return currentStruct == nmatches - 1;
+	}
+
+	public String getLocationTail() {
+		return " / "+nmatches; //$NON-NLS-1$
+	}
+	
+	public String getCurrentLocation() {
+		return ""+(currentStruct+1); //$NON-NLS-1$
+	}
+
+	public String getDetails() {
+		// TODO Auto-generated method stub
+		return corpus.getName()+" "+struct.getName()+" "+(currentStruct+1); //$NON-NLS-1$ //$NON-NLS-2$
+	}
+
+	public void setProperties(List<Property> properties2) {
+		this.properties = properties2;
+	}
+
+	public void setStructProperties(List<Property> properties2) {
+		this.structProperties = properties2;
+	}
+
+	@Override
+	public String getName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public String getSimpleName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public void clean() {
+		// TODO Auto-generated method stub
+		
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/functions/internal/InternalView.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/functions/internal/package.html
===================================================================
--- tmp/org.txm.core/src/java/org/txm/functions/internal/package.html	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/functions/internal/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Internal view</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/java/org/txm/functions/internal/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/functions/summary/Summary.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/functions/summary/Summary.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/functions/summary/Summary.java	(revision 258)
@@ -0,0 +1,259 @@
+package org.txm.functions.summary;
+
+import java.io.IOException;
+import java.util.ArrayList;
+
+import org.txm.Toolbox;
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.core.results.TXMResult;
+import org.txm.objects.Edition;
+import org.txm.objects.Page;
+import org.txm.objects.Text;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.corpus.MainCorpus;
+import org.txm.searchengine.cqp.corpus.Property;
+import org.txm.searchengine.cqp.corpus.QueryResult;
+import org.txm.searchengine.cqp.corpus.StructuralUnitProperty;
+import org.txm.searchengine.cqp.corpus.query.Query;
+import org.txm.searchengine.cqp.serverException.CqiServerError;
+
+import cern.colt.Arrays;
+
+public class Summary extends TXMResult  {
+	MainCorpus corpus;
+	TreeNode treenodes = new TreeNode("root"); //$NON-NLS-1$
+	private ArrayList<StructuralUnitProperty> properties;
+
+	public Summary(MainCorpus corpus)
+	{
+		this.corpus = corpus;
+	}
+
+	public TreeNode getRoot()
+	{
+		return treenodes;
+	}
+
+	public boolean init(ArrayList<StructuralUnitProperty> properties) throws CqiClientException, IOException, CqiServerError
+	{
+		this.properties = properties;
+		treenodes.end = corpus.getSize();
+		treenodes.id = corpus.getName();
+		treenodes.start = 0;
+		treenodes.parent = null;
+		// get all type of structures
+		for (int j = 0 ; j < properties.size() ; j++) {
+			String suname = properties.get(j).getStructuralUnit().getName();
+			//System.out.println("getting : "+properties.get(j).getFullName());
+
+			QueryResult result = corpus.query(new Query("<"+properties.get(j).getFullName()+">[]"), "summary", false); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+			int[] starts = result.getStarts();
+			result.drop();
+			result = corpus.query(new Query("[]</"+properties.get(j).getFullName()+">"), "summary", false); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+			int[] ends = result.getStarts();
+			result.drop();
+			//System.out.println("starts: "+Arrays.toString(starts));
+			//System.out.println("ends: "+Arrays.toString(ends));
+			int[] strcutpos = Toolbox.getCqiClient().cpos2Struc(properties.get(j).getQualifiedName(), starts);
+			String[] infos = Toolbox.getCqiClient().struc2Str(properties.get(j).getQualifiedName(), strcutpos);
+			//allMatches.put(suname, list);
+			if (starts.length != ends.length) {
+				System.out.println(suname+": starts.length "+starts.length+" != ends.length "+ends.length); //$NON-NLS-1$ //$NON-NLS-2$
+				return false;
+			}
+			for (int i = 0 ; i < starts.length ; i++) {
+				//System.out.println("suname: "+suname+" start: "+m.getStart());
+				TreeNode node = new TreeNode();
+				node.start = starts[i];
+				node.end = ends[i];
+				node.struct = suname;
+				node.id = infos[i];
+				treenodes.add(node);
+			}
+		}
+		//this.print();
+
+		//System.out.println("sorting... "+treenodes.size()+" nodes");
+		processNodeList(treenodes);
+
+		//System.out.println("checking result..."+treenodes.size()+" nodes");
+		if (treenodes.check())
+			return true;
+		else
+			return false;
+	}
+
+	private void processNodeList(TreeNode nodes)
+	{
+		//System.out.println("+processing node list: "+nodes.size());
+		if (nodes.size() == 0)
+			return;
+
+		// 1st loop
+		//System.out.println("1st loop: "+nodes.size());
+		for (int i = 0 ; i < nodes.size() ; i++) {
+			TreeNode node = nodes.get(i);
+			if (node.end == -1)
+				System.out.println("ERROR: node.end = -1"); //$NON-NLS-1$
+			for (int j = 0 ; j < nodes.size() ; j++) {
+				if (j != i) {
+					TreeNode n2 = nodes.get(j);
+					if (n2.start >= node.start && n2.end <= node.end) {
+						n2.parent = node;
+						node.add(n2);
+						nodes.remove(j);
+						j--;
+						if (j < i)
+							i--;
+					}
+				}
+			}
+		}
+
+		//process sublists
+		//System.out.println("processing sublists: "+nodes.size());
+		for (int i = 0 ; i < nodes.size() ; i++) {
+			TreeNode node = nodes.get(i);
+			processNodeList(node);
+		}
+	}
+
+	public ArrayList<StructuralUnitProperty> getProperties()
+	{
+		return properties;
+	}
+
+	public void print()
+	{
+		for (TreeNode node : treenodes)
+			System.out.println("\n"+node); //$NON-NLS-1$
+	}
+
+
+	public Page getDefaultEditionPage(TreeNode node) throws Exception
+	{
+		StructuralUnitProperty text_id = corpus.getStructuralUnit("text").getProperty("id"); //$NON-NLS-1$ //$NON-NLS-2$
+		Property w_id =  corpus.getProperty("id"); //$NON-NLS-1$
+		int[] positions = {node.getStart()};
+		final String[] wordids = Toolbox.getCqiClient().cpos2Str(w_id.getQualifiedName(), positions);
+		int[] textidstruct = Toolbox.getCqiClient().cpos2Struc(text_id.getQualifiedName(), positions);
+		String[] textids = Toolbox.getCqiClient().struc2Str(text_id.getQualifiedName(), textidstruct);
+
+		if (wordids.length == 1 && textids.length == 1) {
+			Text text = corpus.getText(textids[0]);
+			if (text == null) {
+				System.out.println(TXMCoreMessages.Summary_13+textids[0]+TXMCoreMessages.Summary_14);
+				return null;
+			}
+
+			Edition edition = text.getEdition("default"); //$NON-NLS-1$
+			if (edition == null) {
+				if (text.getEditions().size() == 0) {
+					System.out.println("No edition for text: "+text);
+				} else {
+					for (Edition ed : text.getEditions()) {
+						edition = ed;
+						break;
+					}
+				}
+			}
+			if (edition == null) {
+				System.out.println(TXMCoreMessages.Summary_15);
+				return null;
+			}
+
+			node.wordid = wordids[0];
+			return edition.getPageForWordId(wordids[0]);
+		} else {
+			System.out.println(TXMCoreMessages.Summary_16+Arrays.toString(textids)+TXMCoreMessages.Summary_17+Arrays.toString(wordids));
+			return null;
+		}
+	}
+
+	public class TreeNode extends ArrayList<TreeNode>
+	{
+		/**
+		 * 
+		 */
+		private static final long serialVersionUID = 1L;
+
+		public TreeNode parent;
+		boolean leaf = false;
+		String struct;
+		String id;
+		int start = -1;
+		int end = -1;
+		public String wordid;
+
+		public TreeNode()
+		{
+
+		}
+
+		public boolean check() {
+			for (TreeNode node : this) {
+				if(node.start >= this.start && node.end <= this.end && (node.end-node.start) < (this.end-this.start))
+					return node.check();
+				else
+					return false;
+			}
+			return true;
+		}
+
+
+		public TreeNode(String struct) {
+			this();
+			this.struct = struct;
+		}
+
+		@Override
+		public String toString()
+		{
+			String str = struct+"("+start+", "+end+")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+			if(size() > 0)
+				str +="\n\t"+super.toString(); //$NON-NLS-1$
+			return str;
+		}
+
+		public TreeNode getParent()
+		{
+			return parent;
+		}
+
+		public String getInfo() {
+			return id;
+		}
+
+		public int getStart() {
+			return start;
+		}
+
+		public String getWordId() {
+			return wordid;
+		}
+	}
+
+	@Override
+	public String getName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public String getSimpleName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public String getDetails() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public void clean() {
+		// TODO Auto-generated method stub
+		
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/functions/summary/Summary.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/functions/Reference.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/functions/Reference.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/functions/Reference.java	(revision 258)
@@ -0,0 +1,156 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-09-04 11:17:02 +0200 (mer., 04 sept. 2013) $
+// $LastChangedRevision: 2526 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.functions;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.corpus.Property;
+import org.txm.searchengine.cqp.corpus.query.Match;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class Reference: 
+ * defines a pattern of word and/or structure properties
+ *
+ * @author mdecorde
+ */
+public class Reference {
+
+	/** The values. */
+	Map<Property, String> values;
+	
+	/** The reference pattern. */
+	private ReferencePattern referencePattern = new ReferencePattern();
+
+	/**
+	 * Instantiates a new reference.
+	 *
+	 * @param values the values
+	 * @param referencePattern the reference pattern
+	 */
+	public Reference(Map<Property, String> values, ReferencePattern referencePattern) {
+		this.values = values;
+		this.referencePattern = referencePattern;
+	}
+
+	/**
+	 * Instantiates a new reference.
+	 *
+	 * @param match the match
+	 * @param referencePattern the reference pattern
+	 * @throws CqiClientException the cqi client exception
+	 */
+	public Reference(Match match, ReferencePattern referencePattern)
+			throws CqiClientException {
+		this.referencePattern = referencePattern;
+		this.values = new HashMap<Property, String>();
+		for (Property property : referencePattern)
+			values.put(property, match.getValueForProperty(property));
+	}
+
+	/**
+	 * Gets the reference pattern.
+	 *
+	 * @return the reference pattern
+	 */
+	public ReferencePattern getReferencePattern() {
+		return referencePattern;
+	}
+
+	/**
+	 * Gets the properties.
+	 *
+	 * @return the properties
+	 */
+	public List<Property> getProperties() {
+		return referencePattern.getProperties();
+	}
+
+	/**
+	 * Gets the value.
+	 *
+	 * @param property the property
+	 * @return the value
+	 */
+	public String getValue(Property property) {
+		return values.get(property);
+	}
+
+	/**
+	 * Checks if is oK.
+	 *
+	 * @return true, if is oK
+	 */
+	public boolean isOK() {
+		return (referencePattern != null && !values.isEmpty());
+	}
+
+	/* (non-Javadoc)
+	 * @see java.lang.Object#toString()
+	 */
+	@Override
+	public String toString() {
+		if (values.isEmpty())
+			return ""; //$NON-NLS-1$
+		//Iterator<Entry<Property, String>> iter = values.entrySet().iterator();
+		//Entry<Property, String> entry = iter.next();
+		StringBuffer buffer = new StringBuffer(""); //$NON-NLS-1$
+		/*
+		 * 
+		 if (StructuralUnitProperty.class.isInstance(entry.getKey())) {
+			StructuralUnitProperty sProperty = (StructuralUnitProperty) entry.getKey();
+			//buffer.append(sProperty.getStructuralUnit() + "(" + entry.getKey().toString() + "):" + entry.getValue()); //$NON-NLS-1$ //$NON-NLS-2$
+			buffer.append(entry.getValue()); //$NON-NLS-1$ //$NON-NLS-2$
+		} else {
+			//buffer.append(entry.getKey().toString() + ":" + entry.getValue()); //$NON-NLS-1$
+			buffer.append(entry.getValue()); //$NON-NLS-1$
+		}
+
+		while (iter.hasNext()) {
+			entry = iter.next();
+			if (StructuralUnitProperty.class.isInstance(entry.getKey())) {
+				StructuralUnitProperty sProperty = (StructuralUnitProperty) entry.getKey();
+				//buffer.append(", " + sProperty.getStructuralUnit() + "(" + entry.getKey().toString() + "):" + entry.getValue()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+				buffer.append(", " +entry.getValue()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+			} else {
+				//buffer.append(", " + entry.getKey().toString() + ":" + entry.getValue()); //$NON-NLS-1$ //$NON-NLS-2$
+				buffer.append(", " + entry.getValue()); //$NON-NLS-1$ //$NON-NLS-2$
+			}
+		}*/
+		for(Property p : this.getProperties())
+		{
+			buffer.append(values.get(p)+", "); //$NON-NLS-1$
+		}
+		if (buffer.length() > 0)
+			return buffer.substring(0, buffer.length()-2); 
+		else
+			return ""; //$NON-NLS-1$
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/functions/Reference.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/functions/package.html
===================================================================
--- tmp/org.txm.core/src/java/org/txm/functions/package.html	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/functions/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Entry point into the toolbox functionalities.</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/java/org/txm/functions/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/functions/referencer/package.html
===================================================================
--- tmp/org.txm.core/src/java/org/txm/functions/referencer/package.html	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/functions/referencer/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Compute an index such as those in books</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/java/org/txm/functions/referencer/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/functions/referencer/Referencer.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/functions/referencer/Referencer.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/functions/referencer/Referencer.java	(revision 258)
@@ -0,0 +1,695 @@
+// 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
+// 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.
+
+//
+// This file is part of the TXM platform.
+//
+// The TXM platform is free software: you can redistribute it and/or modif y
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 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/>.
+// 
+// 
+// 
+// $LastChangedDate: 2016-11-29 16:47:07 +0100 (Tue, 29 Nov 2016) $
+// $LastChangedRevision: 3349 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.functions.referencer;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.functions.Function;
+import org.txm.searchengine.cqp.AbstractCqiClient;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.corpus.Corpus;
+import org.txm.searchengine.cqp.corpus.CorpusManager;
+import org.txm.searchengine.cqp.corpus.Property;
+import org.txm.searchengine.cqp.corpus.QueryResult;
+import org.txm.searchengine.cqp.corpus.query.Match;
+import org.txm.searchengine.cqp.corpus.query.Query;
+import org.txm.searchengine.cqp.serverException.CqiServerError;
+import org.txm.statsengine.r.core.RWorkspace;
+import org.txm.statsengine.r.core.exceptions.RWorkspaceException;
+import org.txm.utils.logger.Log;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class Referencer.
+ */
+public class Referencer extends Function  {
+
+	/** The query. */
+	Query query;
+
+	/** The pattern. */
+	List<Property> pattern;
+
+	/** The prop. */
+	Property prop;
+
+	/** The nlines. */
+	int nlines;
+
+	/** The lines. */
+	List<Line> lines;
+
+	/** The cache. */
+	//private Map<Property, CqpDataProxy> cache;
+
+	/** The hierarchic sort. */
+	private boolean hierarchicSort;
+	
+	/** The writer. */
+	private BufferedWriter writer;
+
+
+	/**
+	 * Instantiates a new referencer.
+	 *
+	 * @param corpus the corpus
+	 * @param query the query
+	 * @param prop the prop
+	 * @param pattern the pattern
+	 * @param hierarchicSort the hierarchic sort
+	 */
+	public Referencer(Corpus corpus, Query query, Property prop, List<Property> pattern, boolean hierarchicSort)
+	{
+		super(corpus);
+		this.query = query;
+		this.pattern = pattern;
+		this.prop = prop;
+		this.hierarchicSort = hierarchicSort;
+	}
+
+	/** The result. */
+	QueryResult result;
+
+	/** The matches. */
+	List<Match> matches;
+
+	/** The indexes. */
+	int[] indexes;
+
+	/** The positions. */
+	int[] positions;
+
+	/** The processed idx. */
+	HashMap<Integer, Line> processedIdx;
+
+	/** The count idx. */
+	private HashMap<Integer, Integer> countIdx;
+
+	/** The symbol. */
+	private String symbol;
+
+	/**
+	 * Call in order all stages to compute the referencer.
+	 *
+	 * @return true, if successful
+	 * @throws CqiClientException the cqi client exception
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	public boolean compute() throws CqiClientException, IOException, CqiServerError
+	{
+		if (this.parent == null || query == null || pattern == null || prop == null)
+			return false;
+		if (pattern.size() == 0)
+			return false;
+		if (query.getQueryString().equals("")) //$NON-NLS-1$
+			return false;
+
+		if (!getQueryMatches())
+			return false;
+
+		if (!getQueryindexes())
+			return false;
+
+		if (!groupPositionsbyId())
+			return false;
+
+		return true;
+	}
+
+	/**
+	 * 1st step.
+	 *
+	 * @return the query matches
+	 * @throws CqiClientException 
+	 */
+	public boolean getQueryMatches() throws CqiClientException{
+
+		result = this.getCorpus().query(query, TXMCoreMessages.Referencer_1, false);
+		if (result.getNMatch() == 0)
+			return false;
+		matches = result.getMatches();
+		result.drop();
+		return true;
+	}
+
+	/**
+	 * 2nd step.
+	 *
+	 * @return the queryindexes
+	 */
+	public boolean getQueryindexes(){
+		try {
+			positions = new int[matches.size()];
+			int i = 0;
+			for (Match m : matches) {
+				positions[i++] = m.getStart();
+			}
+
+			indexes = CorpusManager.getCorpusManager().getCqiClient().cpos2Id(prop.getQualifiedName(),positions);
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+			return false;
+		}
+		return true;
+	}
+
+	/**
+	 * 3rd stage.
+	 *
+	 * @return true, if successful
+	 */
+	public boolean groupPositionsbyId() {
+		processedIdx = new HashMap<Integer, Line>();
+
+		lines = new ArrayList<Line>();
+		//System.out.println("indexes ");
+		for (int i = 0 ; i < indexes.length ; i++) {
+			int id = indexes[i];
+			//System.out.print(" "+id);
+			if (!processedIdx.containsKey(id)) {	
+				//System.out.println("add idx "+id);
+				Line l = new Line(id);
+				processedIdx.put(id, l);
+
+				lines.add(l);
+			}
+			processedIdx.get(id).addPosition(positions[i]);
+		}
+
+		nlines = processedIdx.keySet().size();
+		return true;
+	}
+
+	/**
+	 * Gets the lines.
+	 *
+	 * @return the lines
+	 * @throws CqiClientException the cqi client exception
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	public List<Line> getLines() throws CqiClientException, IOException, CqiServerError
+	{
+		return getLines(0,lines.size());
+	}
+
+	/**
+	 * Gets the lines.
+	 *
+	 * @param from the from
+	 * @param to the to
+	 * @return the lines
+	 * @throws CqiClientException the cqi client exception
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	public List<Line> getLines(int from, int to) throws CqiClientException, IOException, CqiServerError
+	{
+		if (from < 0)
+			from = 0;
+		if (to > lines.size())
+			to = lines.size();
+
+		HashMap<Integer, Line> lineswithoutpropvalue = new HashMap<Integer, Line>();
+
+		AbstractCqiClient cqiClient = CorpusManager.getCorpusManager().getCqiClient();
+		//build Missing lines
+		for(int i = from ; i < to ; i++)// for each position group
+		{
+			Line l = lines.get(i);
+			if (l.notcomputed) {
+				lineswithoutpropvalue.put(l.id, l);
+
+				// get all reference values of all position of the line
+				Map<Property, List<List<String>>> refValues = new HashMap<Property, List<List<String>>>();
+				for (Property property : pattern) {
+					refValues.put(property, cqiClient.getData(property,
+							l.positions, Collections.nCopies(l.positions.size(), 1)));
+				}
+
+				for (int j = 0 ; j < l.positions.size() ; j++)// build the Reference object
+				{
+					String propvalue = ""; //$NON-NLS-1$
+					for (Property property : pattern) {
+						propvalue += refValues.get(property).get(j).get(0)+", "; //$NON-NLS-1$
+					}
+
+					l.addReference(propvalue.substring(0, propvalue.length()-2));
+				}
+				if (hierarchicSort)
+					l.sortRef(true);
+				else
+					l.sortAlpha();
+				l.notcomputed = false;
+			}
+		}
+
+		// get idx String value
+		int[] idxwithoutvalues = new int[lineswithoutpropvalue.keySet().size()];
+		int count = 0;
+		for(int i : lineswithoutpropvalue.keySet()) {
+			idxwithoutvalues[count++] = i;
+		}
+
+		String[] values = CorpusManager.getCorpusManager().getCqiClient().id2Str(prop.getQualifiedName(), idxwithoutvalues);
+		for(int i = 0 ; i < values.length ; i++) {
+			int id = idxwithoutvalues[i];
+			lineswithoutpropvalue.get(id).linepropvalue = values[i];
+		}
+		return lines.subList(from, to);
+	}
+
+	/**
+	 * Gets the corpus.
+	 *
+	 * @return the corpus
+	 */
+	public Corpus getCorpus() {
+		return (Corpus) this.parent;
+	}
+
+	/**
+	 * Gets the query.
+	 *
+	 * @return the query
+	 */
+	public Query getQuery() {
+		return query;
+	}
+
+	/**
+	 * Gets the property.
+	 *
+	 * @return the property
+	 */
+	public Property getProperty() {
+		return prop;
+	}
+
+	/**
+	 * Gets the pattern.
+	 *
+	 * @return the pattern
+	 */
+	public List<Property> getPattern() {
+		return pattern;
+	}
+
+	/**
+	 * Sets the pattern.
+	 *
+	 * @param pattern the new pattern
+	 */
+	public void setPattern(List<Property> pattern) {
+		this.pattern = pattern;
+
+	}
+
+	/**
+	 * Gets the n lines.
+	 *
+	 * @return the n lines
+	 */
+	public int getNLines() {
+		return nlines;
+	}
+
+	/**
+	 * Sets the property.
+	 *
+	 * @param property the new property
+	 */
+	public void setProperty(Property property) {
+		this.prop = property;
+	}
+
+	/**
+	 * Clear all lines.
+	 */
+	public void clearAllLines()
+	{
+		for(Line line : lines)// we need to recompute lines' references
+		{
+			line.clear();
+		}
+	}
+
+	/**
+	 * The Class Line.
+	 */
+	public class Line
+	{
+
+		/** The id. */
+		int id;
+
+		/** The notcomputed. */
+		boolean notcomputed=true;
+
+		/** The propvalue. */
+		String linepropvalue;
+
+		/** The references. */
+		ArrayList<String> references;
+
+		/** The positions. */
+		ArrayList<Integer> positions;
+
+		/** The references counts. */
+		HashMap<String, Integer> referencesCounts = new HashMap<String, Integer>();
+
+		/**
+		 * Instantiates a new line.
+		 *
+		 * @param i the i
+		 */
+		public Line(int i) {
+			id = i;
+			positions = new ArrayList<Integer>();
+			references = new ArrayList<String>();
+		}
+
+		/**
+		 * Sort ref.
+		 *
+		 * @param reverse the reverse
+		 */
+		public void sortRef(final boolean reverse) {
+			Collections.sort(references, new Comparator<String>() {
+
+				@Override
+				public int compare(String arg0, String arg1) {
+					if (reverse)
+						return getCount(arg1) - getCount(arg0);
+					else
+						return getCount(arg0) - getCount(arg1);
+				}
+			});
+		}
+
+		/**
+		 * Sort alpha.
+		 */
+		public void sortAlpha() {
+			Collections.sort(references);
+		}
+
+		/**
+		 * Clear.
+		 */
+		public void clear() {
+			notcomputed = false;
+			references = new ArrayList<String>();
+		}
+
+		/* (non-Javadoc)
+		 * @see java.lang.Object#toString()
+		 */
+		@Override
+		public String toString()
+		{
+			return linepropvalue+" : <"+id+","+prop+"> : "+references.toString(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+		}
+
+		/**
+		 * Adds the reference.
+		 *
+		 * @param string the string
+		 */
+		public void addReference(String string) {
+			if (!referencesCounts.containsKey(string))
+			{
+				references.add(string);
+				referencesCounts.put(string, 1);
+			}
+			else
+			{
+				referencesCounts.put(string, referencesCounts.get(string)+1);
+			}
+		}
+
+		/**
+		 * Gets the references.
+		 *
+		 * @return the references
+		 */
+		public List<String> getReferences()
+		{
+			return references;
+		}
+
+		/**
+		 * Adds the position.
+		 *
+		 * @param i the i
+		 */
+		public void addPosition(int i) {
+			positions.add(i);
+		}
+
+		/**
+		 * Gets the referencer.
+		 *
+		 * @return the referencer
+		 */
+		public Referencer getReferencer()
+		{
+			return Referencer.this;
+		}
+
+		/**
+		 * Gets the prop value.
+		 *
+		 * @return the prop value
+		 */
+		public String getPropValue() {
+			return linepropvalue;
+		}
+
+		/**
+		 * Gets the count.
+		 *
+		 * @param ref the ref
+		 * @return the count
+		 */
+		public int getCount(String ref)
+		{
+			return referencesCounts.get(ref);
+		}
+
+		public HashMap<String, Integer> getCounts()
+		{
+			return referencesCounts;
+		}
+	}
+
+	/**
+	 * Write all the lines in a file.
+	 *
+	 * @param outfile the outfile
+	 * @param encoding the encoding
+	 * @return true, if successful
+	 */
+	public boolean toTxt(File outfile, String encoding) {
+
+		return toTxt(outfile, encoding, "\t", ""); //$NON-NLS-1$ //$NON-NLS-2$
+	}
+
+	/**
+	 * Write all the lines in a file.
+	 *
+	 * @param outfile the outfile
+	 * @param encoding the encoding
+	 * @param colseparator the colseparator
+	 * @param txtseparator the txtseparator
+	 * @return true, if successful
+	 */
+	public boolean toTxt(File outfile, String encoding, String colseparator, String txtseparator) {
+		try {
+			// NK: writer declared as class attribute to perform a clean if the operation is interrupted
+			this.writer = new BufferedWriter(new OutputStreamWriter(
+					new FileOutputStream(outfile), encoding)); 
+			// if ("UTF-8".equals(encoding)) writer.write('\ufeff'); // UTF-8 BOM
+			toTxt(writer, 0, lines.size() - 1, colseparator, txtseparator);
+		} catch (Exception e) {
+			System.err.println(TXMCoreMessages.Referencer_2 + Log.toString(e));
+			return false;
+		}
+		return true;
+	}
+
+	/**
+	 * Write the lines between from and to in a writer.
+	 *
+	 * @param writer Where to write the lines
+	 * @param from The first line to be written
+	 * @param to The last line to be writen
+	 * @param colseparator the colseparator
+	 * @param txtseparator the txtseparator
+	 * @throws CqiClientException the cqi client exception
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 */
+	public void toTxt(Writer writer, int from, int to, String colseparator, String txtseparator)
+			throws CqiClientException, IOException {
+		try {
+			getLines(0, 9999999);
+			writer.write(prop.getName()+colseparator+this.pattern+"\n"); //$NON-NLS-1$
+			for (Line line : lines) {
+				writer.write(txtseparator+line.getPropValue().replace(txtseparator, txtseparator+txtseparator)+txtseparator+ colseparator + txtseparator+ line.getReferences().toString().replace(txtseparator, txtseparator+txtseparator)+txtseparator+"\n"); //$NON-NLS-1$
+				writer.flush();
+			}
+
+			writer.close();
+		} catch (CqiServerError e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+	}
+
+
+
+	/**
+	 * Gets the name.
+	 *
+	 * @return the name
+	 */
+	public String getName() {
+		return ""+query; //$NON-NLS-1$
+	}
+
+
+	/** The noref. */
+	protected static int noref = 1;
+
+	/** The prefix r. */
+	protected static String prefixR = "Referencer"; //$NON-NLS-1$
+
+	/**
+	 * As r matrix.
+	 *
+	 * @return the string
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public String asRMatrix() throws RWorkspaceException {
+
+		String keywords[] = new String[lines.size()];
+		for(int i = 0 ; i < lines.size() ; i++)
+			keywords[i] = lines.get(i).getPropValue();
+		//System.out.println(Arrays.toString(keywords));
+
+		String symbol = prefixR+noref;
+
+		RWorkspace rw = RWorkspace.getRWorkspaceInstance();
+		rw.eval(symbol+" <- list()"); //$NON-NLS-1$
+		rw.addVectorToWorkspace("refkeywords", keywords); //$NON-NLS-1$
+		rw.eval(symbol+"$keywords <- refkeywords"); //$NON-NLS-1$
+		//rw.eval(symbol+"$query <- \""+this.query.getQueryString()+"\")");
+		rw.eval(symbol+"$refs <- list()"); //$NON-NLS-1$
+		int i = 1;
+		for(Line line : this.lines)
+		{
+			String refs[] = line.getReferences().toArray(new String[line.getReferences().size()]);
+			//System.out.println(line.getPropValue()+": "+Arrays.toString(refs));
+			rw.addVectorToWorkspace("reflinerefs", refs); //$NON-NLS-1$
+			rw.eval(symbol+"$refs[["+i+"]] <- reflinerefs"); //$NON-NLS-1$ //$NON-NLS-2$
+			i++;
+		}
+
+		noref++;
+		this.symbol = symbol;
+		return symbol;
+	}
+
+	/**
+	 * Gets the symbol.
+	 *
+	 * @return the symbol
+	 */
+	public String getSymbol() {
+		return symbol;
+	}
+
+	@Override
+	public void clean() {
+		try {
+			this.writer.flush();
+			this.writer.close();	
+		} catch (IOException e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+	}
+
+
+	public int getV() {
+		if (matches == null) return 0;
+		return matches.size();
+	}
+
+	@Override
+	public String getSimpleName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public String getDetails() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/functions/referencer/Referencer.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/functions/concordances/comparators/LocalizedLineComparator.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/functions/concordances/comparators/LocalizedLineComparator.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/functions/concordances/comparators/LocalizedLineComparator.java	(revision 258)
@@ -0,0 +1,86 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2014-07-15 09:42:00 +0200 (mar., 15 juil. 2014) $
+// $LastChangedRevision: 2820 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.functions.concordances.comparators;
+
+import java.text.Collator;
+import java.util.Locale;
+
+import org.txm.searchengine.cqp.corpus.Corpus;
+import org.txm.utils.logger.Log;
+
+// TODO: Auto-generated Javadoc
+/**
+ * use the giver locale to compare concordance line, if locale is not defined,
+ * use the system locale @ author mdecorde.
+ */
+public abstract class LocalizedLineComparator extends LineComparator {
+
+	/** The locale. */
+	private Locale locale = new Locale("en", "US"); //$NON-NLS-1$ //$NON-NLS-2$
+
+	/** The collator. */
+	protected Collator collator;
+
+	/**
+	 * Instantiates a new localized line comparator.
+	 *
+	 * @param name the name
+	 */
+	public LocalizedLineComparator(String name) {
+		super(name);
+	}
+
+	/**
+	 * Gets the locale.
+	 *
+	 * @return the locale
+	 */
+	public Locale getLocale() {
+		return locale;
+	}
+
+	/**
+	 * Sets the locale.
+	 *
+	 * @param locale the new locale
+	 */
+	public void setLocale(Locale locale) {
+		Log.info("Set comparator locale to "+locale);
+		this.locale = locale;
+		this.collator = Collator.getInstance(locale);
+		this.collator.setStrength(Collator.TERTIARY);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.functions.concordances.comparators.LineComparator#initialize(org.txm.searchengine.cqp.corpus.Corpus)
+	 */
+	@Override
+	public void initialize(Corpus corpus) {
+		setLocale(corpus.getLocale());
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/functions/concordances/comparators/LocalizedLineComparator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/functions/concordances/comparators/LexicographicLeftContextComparator.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/functions/concordances/comparators/LexicographicLeftContextComparator.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/functions/concordances/comparators/LexicographicLeftContextComparator.java	(revision 258)
@@ -0,0 +1,101 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2014-07-15 09:42:00 +0200 (mar., 15 juil. 2014) $
+// $LastChangedRevision: 2820 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.functions.concordances.comparators;
+
+import java.util.HashMap;
+import java.util.List;
+
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.functions.concordances.Concordance;
+import org.txm.functions.concordances.Line;
+import org.txm.searchengine.cqp.corpus.Property;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Compare two values of left context of a concordance line @ author mdecorde.
+ */
+public class LexicographicLeftContextComparator extends
+		StringListBasedComparator {
+
+	/** The Constant NAME. */
+	private static final String NAME = TXMCoreMessages.LexicographicLeftContextComparator_0;
+	private Concordance conc;
+	private List<Property> props;
+
+	/**
+	 * Instantiates a new lexicographic left context comparator.
+	 */
+	public LexicographicLeftContextComparator() {
+		super(NAME);
+	}
+
+	/* (non-Javadoc)
+	 * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+	 */
+	@Override
+	public int compare(Line l1, Line l2) {
+		
+		this.conc = l1.getConcordance();
+		this.props = conc.getLeftAnalysisProperties();
+		if (props.size() == 0)
+			return 0;
+		int rez = 0;
+		int i = 0;
+
+		HashMap<Property, List<String>> values1 = l1.getLeftAnalysisProperty();
+		HashMap<Property, List<String>> values2 = l2.getLeftAnalysisProperty();
+		int j1 = l1.getLeftAnalysisProperty().get(props.get(0)).size() -1;
+		int j2 = l2.getLeftAnalysisProperty().get(props.get(0)).size() -1;
+		
+		String v1, v2;
+		
+		while (rez == 0) {
+			
+			if ((j1 < 0) && (j2 < 0))
+				return 0;
+			if (j1 < 0)
+				return -1; // end of line 1
+			if (j2 < 0)
+				return 1; // end of line 2
+			
+			v1 = values1.get(props.get(i)).get(j1);
+			v2 = values2.get(props.get(i)).get(j2);
+			
+			if (v1 == null) return -1;
+			if (v2 == null) return 1;
+			
+			rez = collator.compare(v1, v2);
+			if (++i >= props.size()) { // iterates over properties before tokens
+				i = 0;
+				j1--;
+				j2--;
+			}
+		}
+		return rez;
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/functions/concordances/comparators/LexicographicLeftContextComparator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/functions/concordances/comparators/StringListBasedComparator.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/functions/concordances/comparators/StringListBasedComparator.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/functions/concordances/comparators/StringListBasedComparator.java	(revision 258)
@@ -0,0 +1,70 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.functions.concordances.comparators;
+
+import java.util.Iterator;
+import java.util.List;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class StringListBasedComparator.
+ */
+public abstract class StringListBasedComparator extends LocalizedLineComparator {
+
+	/**
+	 * Instantiates a new string list based comparator.
+	 *
+	 * @param name the name
+	 */
+	StringListBasedComparator(String name) {
+		super(name);
+	}
+
+	/**
+	 * Compare list.
+	 *
+	 * @param l1 the l1
+	 * @param l2 the l2
+	 * @return the int
+	 */
+	protected int compareList(List<String> l1, List<String> l2) {
+		Iterator<String> it1 = l1.iterator();
+		Iterator<String> it2 = l2.iterator();
+
+		while (it1.hasNext() && it2.hasNext()) {
+			int c = collator.compare(it1.next(), it2.next());
+			if (c != 0)
+				return c;
+		}
+		if (it1.hasNext())
+			return 1; // it2 is a prefix of it1
+		if (it2.hasNext())
+			return -1; // it1 is a prefix of it2
+		return 0;
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/functions/concordances/comparators/StringListBasedComparator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/functions/concordances/comparators/CompositeComparator.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/functions/concordances/comparators/CompositeComparator.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/functions/concordances/comparators/CompositeComparator.java	(revision 258)
@@ -0,0 +1,109 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.functions.concordances.comparators;
+
+import java.util.List;
+
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.functions.concordances.Line;
+import org.txm.searchengine.cqp.corpus.Corpus;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class CompositeComparator.
+ */
+public class CompositeComparator extends LineComparator {
+
+	/** The comparators. */
+	private List<LineComparator> comparators;
+
+	/**
+	 * Instantiates a new composite comparator. A composite comparator C is made
+	 * of a list compartors [C0,...,Cn]. C.compare(l1,l2) == 1 (resp. -1) if and
+	 * only if their exists k such as Ci.compare(l1,l2)==0 for i<k and
+	 * Ck.compare(l1,l2)=1 (resp. -1) C.compare(l1,l2) == 0 if and only if
+	 * Ci.compare(l1,l2)==0 for all i
+	 *
+	 * @param name the name
+	 * @param comparators the comparators
+	 */
+	public CompositeComparator(String name, List<LineComparator> comparators) {
+		super(name);
+		setComparators(comparators);
+	}
+
+	/*public CompositeComparator addComparator(LineComparator comparator) {
+		this.comparators.add(comparator);
+		return this;
+	}*/
+
+	/* (non-Javadoc)
+	 * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+	 */
+	@Override
+	public int compare(Line l1, Line l2) {
+		//System.out.println("compare: "+l1+" "+l2);
+		for (LineComparator comparator : comparators) {
+			int c = comparator.compare(l1, l2);
+			//System.out.println("comparator: "+comparator+" = "+c);
+			if (c != 0)
+				return c;
+		}
+		return 0;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.functions.concordances.comparators.LineComparator#initialize(org.txm.searchengine.cqp.corpus.Corpus)
+	 */
+	@Override
+	public void initialize(Corpus corpus) {
+		for (LineComparator comparator : comparators)
+			comparator.initialize(corpus);
+	}
+
+	/**
+	 * Gets the comparators.
+	 *
+	 * @return the comparators
+	 */
+	public List<LineComparator> getComparators() {
+		return comparators;
+	}
+
+	/**
+	 * Sets the comparators.
+	 *
+	 * @param comp the new comparators
+	 */
+	public void setComparators(List<LineComparator> comp) {
+		this.comparators = comp;
+		this.name = TXMCoreMessages.CompositeComparator_0;
+		for(LineComparator c: comp)
+			this.name += c.getName()+" "; //$NON-NLS-1$
+		}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/functions/concordances/comparators/CompositeComparator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/functions/concordances/comparators/LexicographicRightContextComparator.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/functions/concordances/comparators/LexicographicRightContextComparator.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/functions/concordances/comparators/LexicographicRightContextComparator.java	(revision 258)
@@ -0,0 +1,106 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2014-07-15 09:42:00 +0200 (mar., 15 juil. 2014) $
+// $LastChangedRevision: 2820 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.functions.concordances.comparators;
+
+import java.util.HashMap;
+import java.util.List;
+
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.functions.concordances.Concordance;
+import org.txm.functions.concordances.Line;
+import org.txm.searchengine.cqp.corpus.Property;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Compare two values of right context of a concordance line @ author mdecorde.
+ */
+public class LexicographicRightContextComparator extends
+		StringListBasedComparator {
+
+	/** The Constant NAME. */
+	private static final String NAME = TXMCoreMessages.LexicographicRightContextComparator_0;
+	private Concordance conc;
+	private List<Property> props;
+
+	/**
+	 * Instantiates a new lexicographic right context comparator.
+	 */
+	public LexicographicRightContextComparator() {
+		super(NAME);
+	}
+
+	/* (non-Javadoc)
+	 * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+	 */
+	@Override
+	public int compare(Line l1, Line l2) {
+		int rez = 0;
+		int i = 0; // property counter
+		int j = 0; // position counter
+		HashMap<Property, List<String>> values1 = l1.getRightAnalysisProperty();
+		HashMap<Property, List<String>> values2 = l2.getRightAnalysisProperty();
+		this.conc = l1.getConcordance();
+		this.props = conc.getRightAnalysisProperties();
+		
+		List<String> vals1;
+		List<String> vals2;
+		
+		String v1, v2;
+				
+		int size1  = values1.get(props.get(0)).size();
+		int size2 = values2.get(props.get(0)).size();
+		
+		while (rez == 0) {
+//			vals1 = values1.get(props.get(i));
+//			vals2 = values2.get(props.get(i));
+			
+			//System.out.println("LINE 1: "+vals1);
+			//System.out.println("LINE 2: "+vals2);
+			if(size1 <= j && size2 <= j)
+				return 0; // end of line 1
+			if (size1 <= j)
+				return -1; // end of line 1
+			if (size2 <= j)
+				return 1; // end of line 2
+			
+			v1 = values1.get(props.get(i)).get(j);
+			v2 = values2.get(props.get(i)).get(j);
+			
+			//System.out.println("COMP "+j+" : "+v1+" "+v2);
+			if (v1 == null) return -1;
+			if (v2 == null) return 1;
+			
+			rez = collator.compare(v1, v2);
+			if (++i >= props.size()) { // iterates over properties before tokens
+				i = 0;
+				j++;
+			}
+		}
+		return rez;
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/functions/concordances/comparators/LexicographicRightContextComparator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/functions/concordances/comparators/LexicographicKeywordComparator.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/functions/concordances/comparators/LexicographicKeywordComparator.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/functions/concordances/comparators/LexicographicKeywordComparator.java	(revision 258)
@@ -0,0 +1,87 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.functions.concordances.comparators;
+
+import java.util.HashMap;
+import java.util.List;
+
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.functions.concordances.Concordance;
+import org.txm.functions.concordances.Line;
+import org.txm.searchengine.cqp.corpus.Property;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Compare two values of keyword of a concordance line 
+ * @author mdecorde.
+ */
+public class LexicographicKeywordComparator extends LocalizedLineComparator {
+
+	/** The Constant NAME. */
+	private static final String NAME = TXMCoreMessages.LexicographicKeywordComparator_0;
+	private Concordance conc;
+	private List<Property> props;
+
+	/**
+	 * Instantiates a new lexicographic keyword comparator.
+	 */
+	public LexicographicKeywordComparator() {
+		super(NAME);
+	}
+
+	/* (non-Javadoc)
+	 * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+	 */
+	@Override
+	public int compare(Line l1, Line l2) {
+		int rez = 0;
+		int i = 0;
+		int j = 0;
+		HashMap<Property, List<String>> values1 = l1.getKeywordsAnalysisProperty();
+		HashMap<Property, List<String>> values2 = l2.getKeywordsAnalysisProperty();
+		this.conc = l1.getConcordance();
+		this.props = conc.getKeywordAnalysisProperties();
+		while(rez == 0) {
+			List<String> vals1 = values1.get(props.get(i));
+			List<String> vals2 = values2.get(props.get(i));
+			if(vals1.size() <= j && vals2.size() <= j)
+				return 0; // end of line 1
+			if(vals1.size() <= j)
+				return -1; // end of line 1
+			if(vals2.size() <= j)
+				return 1; // end of line 2
+			rez = collator.compare(vals1.get(j), vals2.get(j));
+			if(++i >= props.size()) { // iterates over properties before tokens
+				i = 0;
+				j++;
+			}
+		}
+
+		return rez;
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/functions/concordances/comparators/LexicographicKeywordComparator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/functions/concordances/comparators/package.html
===================================================================
--- tmp/org.txm.core/src/java/org/txm/functions/concordances/comparators/package.html	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/functions/concordances/comparators/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Sorters for displaying concordance.</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/java/org/txm/functions/concordances/comparators/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/functions/concordances/comparators/LineComparator.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/functions/concordances/comparators/LineComparator.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/functions/concordances/comparators/LineComparator.java	(revision 258)
@@ -0,0 +1,97 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.functions.concordances.comparators;
+
+import java.util.Comparator;
+
+import org.txm.functions.concordances.Line;
+import org.txm.searchengine.cqp.corpus.Corpus;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Abstract comparator of concordance line @ author mdecorde.
+ */
+public abstract class LineComparator implements Comparator<Line> {
+
+	/** The name. */
+	protected String name;
+
+	/** The available comparator. */
+	private static String[] availableComparator = new String[] {
+			"org.txm.functions.concordances.comparators.LexicographicKeywordComparator", //$NON-NLS-1$
+			"org.txm.functions.concordances.comparators.LexicographicLeftContextComparator", //$NON-NLS-1$
+			"org.txm.functions.concordances.comparators.LexicographicRightContextComparator", //$NON-NLS-1$
+			"org.txm.functions.concordances.comparators.PropertiesReferenceComparator" //$NON-NLS-1$
+	};
+
+	/**
+	 * Return the list of all the known comparators. Any non-abstract class
+	 * extending LineComparator should be mentionned in the availableComparator
+	 * list
+	 *
+	 * @return the available comparators
+	 */
+	static public String[] getAvailableComparators() {
+		return availableComparator;
+	}
+
+	/**
+	 * Instantiates a new line comparator.
+	 *
+	 * @param name the name
+	 */
+	public LineComparator(String name) {
+		this.name = name;
+
+	}
+
+	/**
+	 * Gets the name.
+	 *
+	 * @return the name
+	 */
+	public String getName() {
+		return name;
+	}
+
+	/* (non-Javadoc)
+	 * @see java.lang.Object#toString()
+	 */
+	@Override
+	public String toString() {
+		return "C:" + name; //$NON-NLS-1$
+	}
+
+	/**
+	 * Initialize.
+	 *
+	 * @param corpus the corpus
+	 */
+	public abstract void initialize(Corpus corpus);
+
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/functions/concordances/comparators/LineComparator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/functions/concordances/comparators/NullComparator.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/functions/concordances/comparators/NullComparator.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/functions/concordances/comparators/NullComparator.java	(revision 258)
@@ -0,0 +1,58 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.functions.concordances.comparators;
+
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.functions.concordances.Line;
+
+// TODO: Auto-generated Javadoc
+/**
+ * return the order of the text.
+ *
+ * @author mdecorde
+ */
+public class NullComparator extends LocalizedLineComparator {
+
+	/** The Constant NAME. */
+	private static final String NAME = TXMCoreMessages.NullComparator_0;
+
+	/**
+	 * Instantiates a new null comparator.
+	 */
+	public NullComparator() {
+		super(NAME);
+	}
+
+	/* (non-Javadoc)
+	 * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+	 */
+	@Override
+	public int compare(Line l1, Line l2) {
+		return l1.getKeywordPosition() - l2.getKeywordPosition();
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/functions/concordances/comparators/NullComparator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/functions/concordances/comparators/PropertiesReferenceComparator.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/functions/concordances/comparators/PropertiesReferenceComparator.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/functions/concordances/comparators/PropertiesReferenceComparator.java	(revision 258)
@@ -0,0 +1,81 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.functions.concordances.comparators;
+
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.functions.Reference;
+import org.txm.functions.concordances.Line;
+import org.txm.searchengine.cqp.corpus.Property;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Compare the references of concordance line @ author mdecorde.
+ */
+public class PropertiesReferenceComparator extends LocalizedLineComparator {
+
+	/** The Constant NAME. */
+	private static final String NAME = TXMCoreMessages.PropertiesReferenceComparator_0;
+
+	//protected Collator collator = Collator.getInstance(new Locale(System.getProperty("user.language"))); //$NON-NLS-1$
+
+	/**
+	 * Instantiates a new properties reference comparator.
+	 */
+	public PropertiesReferenceComparator() {
+		super(NAME);
+	}
+
+	/* (non-Javadoc)
+	 * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+	 */
+	@Override
+	public int compare(Line l1, Line l2) {
+		if (l1 == null || l2 == null)
+			return 0;
+
+		Reference ref1 = l1.getAnaRef();
+		Reference ref2 = l2.getAnaRef();
+		assert (ref1.getReferencePattern().equals(ref2.getReferencePattern()));
+		for (Property prop : ref1.getProperties()) {
+			int c = 0;
+			try {
+				Integer i1 = Integer.parseInt(ref1.getValue(prop));
+				Integer i2 = Integer.parseInt(ref2.getValue(prop));
+				c = i1.compareTo(i2);
+			} catch (NumberFormatException e) {
+				//System.out.println("sort "+ref1+ " "+ ref2 +" with "+collator);
+				c = collator.compare(ref1.getValue(prop), ref2.getValue(prop));
+			}
+
+			if (c != 0) {
+				return c;
+			}
+		}
+		return 0;
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/functions/concordances/comparators/PropertiesReferenceComparator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/functions/concordances/comparators/ReverseComparator.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/functions/concordances/comparators/ReverseComparator.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/functions/concordances/comparators/ReverseComparator.java	(revision 258)
@@ -0,0 +1,78 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.functions.concordances.comparators;
+
+import org.txm.functions.concordances.Line;
+import org.txm.searchengine.cqp.corpus.Corpus;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Revert a comparator @ author mdecorde.
+ */
+public class ReverseComparator extends LineComparator {
+
+	/** The comparator. */
+	private LineComparator comparator;
+
+	/**
+	 * Instantiates a new reverse comparator.
+	 *
+	 * @param name the name
+	 * @param comparator the comparator
+	 */
+	public ReverseComparator(String name, LineComparator comparator) {
+		super(name);
+		this.comparator = comparator;
+	}
+
+	/**
+	 * Instantiates a new reverse comparator.
+	 *
+	 * @param comparator the comparator
+	 */
+	public ReverseComparator(LineComparator comparator) {
+		super(comparator.getName());
+		this.comparator = comparator;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.functions.concordances.comparators.LineComparator#initialize(org.txm.searchengine.cqp.corpus.Corpus)
+	 */
+	@Override
+	public void initialize(Corpus corpus) {
+		comparator.initialize(corpus);
+	}
+
+	/* (non-Javadoc)
+	 * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+	 */
+	@Override
+	public int compare(Line l1, Line l2) {
+		return -1 * comparator.compare(l1, l2);
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/functions/concordances/comparators/ReverseComparator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/functions/concordances/Concordance.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/functions/concordances/Concordance.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/functions/concordances/Concordance.java	(revision 258)
@@ -0,0 +1,1689 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2016-11-29 16:47:07 +0100 (Tue, 29 Nov 2016) $
+// $LastChangedRevision: 3349 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.functions.concordances;
+
+import java.io.BufferedOutputStream;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.UnsupportedEncodingException;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+
+import org.txm.annotation.Annotation;
+import org.txm.annotation.AnnotationManager;
+import org.txm.annotation.repository.AnnotationType;
+import org.txm.annotation.repository.TypedValue;
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.functions.Function;
+import org.txm.functions.Reference;
+import org.txm.functions.ReferencePattern;
+import org.txm.functions.concordances.comparators.LineComparator;
+import org.txm.searchengine.cqp.AbstractCqiClient;
+import org.txm.searchengine.cqp.MemCqiClient;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.corpus.Corpus;
+import org.txm.searchengine.cqp.corpus.CorpusManager;
+import org.txm.searchengine.cqp.corpus.Property;
+import org.txm.searchengine.cqp.corpus.QueryResult;
+import org.txm.searchengine.cqp.corpus.StructuralUnit;
+import org.txm.searchengine.cqp.corpus.query.Match;
+import org.txm.searchengine.cqp.corpus.query.Query;
+import org.txm.searchengine.cqp.serverException.CqiServerError;
+import org.txm.statsengine.r.core.RWorkspace;
+import org.txm.statsengine.r.core.exceptions.RWorkspaceException;
+import org.txm.utils.logger.Log;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class Concordance.
+ * 
+ * @author jmague, mdecorde
+ */
+public class Concordance extends Function {
+
+	/**
+	 * The Enum Format.
+	 */
+	public enum Format {
+		/** The CONCORDANCE. */
+		CONCORDANCE, 
+		/** The CONTEXT. */
+		CONTEXT
+	};
+
+	/** The lines. */
+	private List<Line> lines;
+
+	/** The query result. */
+	private QueryResult queryResult;
+
+	/** The view properties. */
+	private List<Property> viewProperties; // contains all the view properties
+	// needed
+	/** The left c view properties. */
+	private List<Property> leftCViewProperties;
+
+	/** The right c view properties. */
+	private List<Property> rightCViewProperties;
+
+	/** The keyword view properties. */
+	private List<Property> keywordViewProperties;
+
+	/** The analysis property. */
+	private List<Property> leftAnalysisProperties;
+
+	/** The right c analysis property. */
+	private List<Property> rightAnalysisProperties;
+
+	/** The keyword analysis property. */
+	private List<Property> keywordAnalysisProperties;
+
+	/** The n lines. */
+	private int nLines;
+
+	/** The right context size. */
+	private int rightContextSize;
+
+	/** The left context size. */
+	private int leftContextSize;
+
+	/** The corpus. */
+	private Corpus corpus;
+
+	/** The reference pattern. */
+	private ReferencePattern refViewPattern;
+	private ReferencePattern refAnalysePattern;
+
+	/** The cache. */
+	//private Map<Property, CqpDataProxy> cache;
+
+	/** The query. */
+	private Query query;
+
+	/** The symbol. */
+	private String symbol;
+
+	/** The writer. */
+	private Writer writer;
+
+	/**
+	 * Creates a new concordance and compute it.
+	 *
+	 * @param corpus The corpus on which apply the query
+	 * @param query The query defining the keywords
+	 * @param analysisProperty The property used to sort the lines
+	 * @param viewProperties The property used to print the lines
+	 * @param referencePattern the reference pattern
+	 * @param leftContextSize The size in words of the left context
+	 * @param rightContextSize The size in words of the right context
+	 * @throws CqiClientException the cqi client exception
+	 */
+	public Concordance(Corpus corpus, Query query, Property analysisProperty,
+			List<Property> viewProperties, ReferencePattern referencePattern, ReferencePattern refAnalysePattern,
+			int leftContextSize, int rightContextSize)
+					throws CqiClientException {
+
+		super(corpus);
+		// set concordance parameters
+		this.corpus = corpus;
+		this.query = query;
+		this.leftAnalysisProperties = Arrays.asList(analysisProperty); // same analysis property
+		this.rightAnalysisProperties = Arrays.asList(analysisProperty);
+		this.keywordAnalysisProperties = Arrays.asList(analysisProperty);
+		this.viewProperties = viewProperties; // same view property for left, right context and keyword
+		this.leftCViewProperties = viewProperties;
+		this.rightCViewProperties = viewProperties;
+		this.keywordViewProperties = viewProperties;
+		this.updateViewPropertiesList();
+		this.refViewPattern = referencePattern;
+		this.refAnalysePattern = refAnalysePattern;
+		this.leftContextSize = leftContextSize;
+		this.rightContextSize = rightContextSize;
+
+		if (corpus != null) {
+			setCQLSeparator(corpus.getCQLLimitQuery());
+		}
+
+		computeConcordance();
+	}
+
+	/**
+	 * Creates a new concordance and compute it.
+	 *
+	 * @param corpus The corpus on which apply the query
+	 * @param query The query defining the keywords
+	 * @param analysisProperty The property used to sort the lines
+	 * @param leftCViewProperties The property used to print the lines of Left context
+	 * @param rightCViewProperties The property used to print the lines of right context
+	 * @param keywordViewProperties The property used to print the lines of keyword
+	 * @param referencePattern the reference pattern
+	 * @param leftContextSize The size in words of the left context
+	 * @param rightContextSize The size in words of the right context
+	 * @throws CqiClientException the cqi client exception
+	 */
+	public Concordance(Corpus corpus, Query query, Property analysisProperty,
+			List<Property> leftCViewProperties,
+			List<Property> rightCViewProperties,
+			List<Property> keywordViewProperties,
+			ReferencePattern referencePattern, 
+			ReferencePattern refAnalysePattern,int leftContextSize,
+			int rightContextSize) throws CqiClientException {
+		super(corpus);
+		// set concordance parameters
+		this.corpus = corpus;
+		this.query = query;
+		this.leftAnalysisProperties = Arrays.asList(analysisProperty);
+		this.rightAnalysisProperties = Arrays.asList(analysisProperty);
+		this.keywordAnalysisProperties = Arrays.asList(analysisProperty);
+		this.leftCViewProperties = leftCViewProperties;
+		this.rightCViewProperties = rightCViewProperties;
+		this.keywordViewProperties = keywordViewProperties;
+		this.updateViewPropertiesList();
+		this.refViewPattern = referencePattern;
+		this.refAnalysePattern = refAnalysePattern;
+		this.leftContextSize = leftContextSize;
+		this.rightContextSize = rightContextSize;
+
+		if (corpus != null) {
+			setCQLSeparator(corpus.getCQLLimitQuery());
+		}
+
+		computeConcordance();
+	}
+
+	/**
+	 * Creates a new concordance and compute it.
+	 *
+	 * @param corpus The corpus on which apply the query
+	 * @param query The query defining the keywords
+	 * @param leftCAnalysisProperty the left c analysis property
+	 * @param rightCAnalysisProperty the right c analysis property
+	 * @param keywordAnalysisProperty the keyword analysis property
+	 * @param leftCViewProperties The property used to print the lines of Left context
+	 * @param rightCViewProperties The property used to print the lines of right context
+	 * @param keywordViewProperties The property used to print the lines of keyword
+	 * @param referencePattern the reference pattern
+	 * @param leftContextSize The size in words of the left context
+	 * @param rightContextSize The size in words of the right context
+	 * @throws CqiClientException the cqi client exception
+	 */
+	public Concordance(Corpus corpus, Query query,
+			Property leftCAnalysisProperty, Property rightCAnalysisProperty,
+			Property keywordAnalysisProperty,
+			List<Property> leftCViewProperties,
+			List<Property> rightCViewProperties,
+			List<Property> keywordViewProperties,
+			ReferencePattern referencePattern, 
+			ReferencePattern refAnalysePattern,
+			int leftContextSize,
+			int rightContextSize) throws CqiClientException {
+		
+		super(corpus);
+		// set concordance parameters
+		this.corpus = corpus;
+		this.query = query;
+		this.leftAnalysisProperties = Arrays.asList(leftCAnalysisProperty);
+		this.rightAnalysisProperties = Arrays.asList(rightCAnalysisProperty);
+		this.keywordAnalysisProperties = Arrays.asList(keywordAnalysisProperty);
+		this.leftCViewProperties = leftCViewProperties;
+		this.rightCViewProperties = rightCViewProperties;
+		this.keywordViewProperties = keywordViewProperties;
+		this.updateViewPropertiesList();
+		this.refViewPattern = referencePattern;
+		this.refAnalysePattern = refAnalysePattern;
+		this.leftContextSize = leftContextSize;
+		this.rightContextSize = rightContextSize;
+
+		computeConcordance();
+	}
+
+	public Concordance(Corpus corpus, Query query,
+			List<Property> selectedLeftCSortProperty,
+			List<Property> selectedRightCSortProperty,
+			List<Property> selectedKeywordSortProperty,
+			List<Property> selectedLeftCViewProperties,
+			List<Property> selectedRightCViewProperties,
+			List<Property> selectedKeywordViewProperties,
+			ReferencePattern referencePattern, 
+			ReferencePattern refAnalysePattern, int leftContextSize,
+			int rightContextSize) throws CqiClientException {
+		
+		super(corpus);
+		// set concordance parameters
+		this.corpus = corpus;
+		this.query = query;
+		this.leftAnalysisProperties = selectedLeftCSortProperty;
+		this.rightAnalysisProperties = selectedRightCSortProperty;
+		this.keywordAnalysisProperties = selectedKeywordSortProperty;
+		this.leftCViewProperties = selectedLeftCViewProperties;
+		this.rightCViewProperties = selectedRightCViewProperties;
+		this.keywordViewProperties = selectedKeywordViewProperties;
+		this.updateViewPropertiesList();
+		this.refViewPattern = referencePattern;
+		this.refAnalysePattern = refAnalysePattern;
+		this.leftContextSize = leftContextSize;
+		this.rightContextSize = rightContextSize;
+
+		computeConcordance();
+	}
+
+	/**
+	 * Update view properties list.
+	 */
+	private void updateViewPropertiesList() {
+		// reset view properties
+		this.viewProperties = new ArrayList<Property>();
+		// fill it with the properties of the others
+		viewProperties.addAll(keywordViewProperties);
+
+		for (Property p : leftCViewProperties)// add the view properties of left context
+		{
+			if (!viewProperties.contains(p)) {
+				viewProperties.add(p);
+			}
+		}
+
+		for (Property p : rightCViewProperties)// add the view properties of right context
+		{
+			if (!viewProperties.contains(p)) {
+				viewProperties.add(p);
+			}
+		}
+	}
+
+	/**
+	 * Compute concordance.
+	 *
+	 * @return true, if successful
+	 * @throws CqiClientException 
+	 */
+	private boolean computeConcordance() throws CqiClientException {
+		this.queryResult = corpus.query(query, query.getQueryString()
+				.replace(" ", "_") + "_concordance", true); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+
+		this.nLines = queryResult.getNMatch();
+		this.lines = new ArrayList<Line>(Collections.nCopies(nLines,
+				(Line) null));// lines are lazily fetched; we force an
+		// ArrayList so we can use the 'set' method
+
+		return true;
+	}
+
+	/**
+	 * drop the concordance QueryResult
+	 */
+	public void cleanMemory() {
+		try {
+			if (queryResult != null) queryResult.drop();
+		} catch (CqiClientException e) {
+			System.out.println(TXMCoreMessages.Concordance_4+e);
+		}
+	}
+
+	/**
+	 * Returns the query used to build the concordance.
+	 * 
+	 * @return the query
+	 */
+	public Query getQuery() {
+		return query;
+	}
+
+	//int[] textStarts = null;
+	int[] CQLLimitStarts = null;
+	String cql_limit;
+
+	public List<Line> reloadLines(int topLine, int bottomLine) throws CqiClientException, IOException, CqiServerError {
+		for (int i = topLine; i < bottomLine; i++) {
+			lines.set(i, null);
+		}
+
+		return getLines(topLine, bottomLine);
+	}
+
+	/**
+	 * Returns the line between from and to.
+	 * 
+	 * @param from
+	 *            the from
+	 * @param to
+	 *            the to
+	 * 
+	 * @return the lines
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 * @throws CqiServerError 
+	 * @throws IOException 
+	 */
+	public List<Line> getLines(int from, int to) throws CqiClientException, IOException, CqiServerError {
+
+		Log.info(TXMCoreMessages.Concordance_6 + (to - from + 1) + TXMCoreMessages.Concordance_7);
+
+		AnnotationManager am = corpus.getAnnotationManager();
+
+		AbstractCqiClient cqiClient = CorpusManager.getCorpusManager().getCqiClient();
+		
+		long start = System.currentTimeMillis();
+
+		// check asked lines numbers
+		if (from < 0) from = 0;
+		if (from > to) from = to;
+		if (to >= nLines) to = nLines - 1;
+		if (from < 0 || from > to || to >= nLines) {
+			throw new IndexOutOfBoundsException();
+		}
+
+		List<Match> matches = queryResult.getMatches(from, to);
+
+		//		System.out.println("cqllimit="+cql_limit);
+		//		System.out.println("CQLLimitStarts="+CQLLimitStarts);
+		if (cql_limit != null && CQLLimitStarts == null) { // initialize text limits
+			try {
+				Log.warning("Get CQL limit for query="+cql_limit);
+				CQLLimitStarts = this.getCorpus().getStartLimits(cql_limit);
+				if (CQLLimitStarts.length > 0 && CQLLimitStarts[0] != 0) {
+					int[] tmp  = new int[CQLLimitStarts.length + 1];
+					System.arraycopy(CQLLimitStarts, 0, tmp, 1, CQLLimitStarts.length);
+					CQLLimitStarts = tmp;
+				}
+			} catch (Exception e) {
+				org.txm.utils.logger.Log.printStackTrace(e);
+				Log.severe(TXMCoreMessages.Concordance_8+e);
+			}
+		}
+
+		int currentCQLLimit = 0;
+		// System.out.println("texts: "+Arrays.toString(textStarts));
+		// we create the blocks of lines not created yet that may occur between
+		// from and to
+		//int step = Math.max(100/(to - from), 1);
+		for (int i = from; i <= to; i++) {
+			int j;
+			for (j = i; j <= to && lines.get(j) == null; j++); // THIS IS MANDATORY
+			// j is the index of the first next existing line
+			if (i != j) { // i does point at the beginning of a block of non
+				// existing lines. We have to create the lines between i and j
+
+				if (isCanceled()) return new ArrayList<Line>(); // check if user canceled the Job
+
+				// First we get all the data we need : values for the view
+				// properties, the analysis property and the reference
+				List<Integer> beginingOfKeywordsPositions = new ArrayList<Integer>(j - i);
+				List<Integer> targetPositions = new ArrayList<Integer>(j - i);
+				List<Integer> lengthOfKeywords = new ArrayList<Integer>(j - i);
+				List<Integer> beginingOfRightCtxPositions = new ArrayList<Integer>(	j - i);
+				List<Integer> lengthOfRightCtx = new ArrayList<Integer>(j - i);
+				List<Integer> beginingOfLeftCtxPositions = new ArrayList<Integer>(j - i);
+				List<Integer> lengthOfLeftCtx = new ArrayList<Integer>(j - i);
+
+				// get all first token and last token of all lines
+				int currentKeywordPos;// = matches.get(0).getStart();
+				//currentText = previousPivotText;
+
+				List<Match> subsetMatch = new ArrayList<Match>(); 
+
+				for (int k = 0; k < j - i; k++) {
+					Match match = matches.get(i - from + k);
+					subsetMatch.add(match);
+					//System.out.println("match: "+match);
+					//1) find current text using keyword position
+					currentKeywordPos = match.getStart();
+
+					if (CQLLimitStarts != null && currentCQLLimit < CQLLimitStarts.length) {
+						while (currentCQLLimit < CQLLimitStarts.length && CQLLimitStarts[currentCQLLimit] <= currentKeywordPos) { // find the match's text
+							currentCQLLimit++; // matches are ordered
+						}
+						if (currentCQLLimit > 0) {
+							currentCQLLimit--; // get the previous text
+						}
+					}
+
+					//System.out.println("text no: "+currentText+" text position: "+textStarts[currentText]);
+					// LEFT CONTEXT LIMITS
+					int ctxPosition = currentKeywordPos - leftContextSize; // left context start position
+					if (CQLLimitStarts != null && currentCQLLimit < CQLLimitStarts.length) {
+						if (CQLLimitStarts[currentCQLLimit] > ctxPosition) { // test if the end of left context is in the same text
+							ctxPosition = CQLLimitStarts[currentCQLLimit]; // the context start is the start of the text
+							//System.out.println("fix right "+currentText+" pos: "+ctxPosition);
+						}
+					}
+					beginingOfLeftCtxPositions.add(ctxPosition);
+					lengthOfLeftCtx.add(match.getStart() - ctxPosition); // distance between let context start position and keyword position
+					//System.out.println("left: "+ctxPosition+ "len: "+(match.getStart() - ctxPosition));
+
+					// KEYWORD LIMITS
+					beginingOfKeywordsPositions.add(match.getStart());
+					lengthOfKeywords.add(match.getEnd() - match.getStart() + 1);
+
+					//TARGET POSITION
+					targetPositions.add(match.getTarget());
+
+					// check if the end of keyword pass a text limit
+					// TODO: Can a keyword be over 2 texts ??
+					currentKeywordPos = match.getEnd();
+
+					if (CQLLimitStarts != null)
+						if (currentCQLLimit < CQLLimitStarts.length) {
+							while (currentCQLLimit < CQLLimitStarts.length && CQLLimitStarts[currentCQLLimit] <= currentKeywordPos) { // find the match's text
+								currentCQLLimit++; // matches are ordered
+							}
+							if (currentCQLLimit > 0)
+								currentCQLLimit--; // get the previous text
+						}
+					// find the right limit
+					ctxPosition = match.getEnd() + rightContextSize;
+
+					if (CQLLimitStarts != null)
+						if (currentCQLLimit + 1 < CQLLimitStarts.length) {
+							if (CQLLimitStarts[currentCQLLimit+1] < ctxPosition) { // test if the right context last position is in the same text as the pivot
+								ctxPosition = CQLLimitStarts[currentCQLLimit+1] -1 ; // the context end is the next text start position
+							}
+						}
+
+					//if (ctxPosition > corpus.getSize()) ctxPosition = corpus.getSize();
+
+					beginingOfRightCtxPositions.add(match.getEnd() + 1);
+					lengthOfRightCtx.add(ctxPosition - match.getEnd());
+					//System.out.println("right: "+ctxPosition+" len: "+(ctxPosition - match.getEnd() + 1)+"\n");
+				}
+
+				//List<Annotation> allAnnotations = null;
+				List<Annotation> annotationsPerMatch = null;;
+				if (viewAnnotation != null && am != null) {
+					try {
+						annotationsPerMatch = am.getAnnotationsForMatches(viewAnnotation, subsetMatch, overlapAnnotation);
+						//System.out.println("annotationsPerMatch: "+annotationsPerMatch);
+					} catch (Exception e) {
+						System.out.println("Error while reading annotation "+viewAnnotation+" and with "+subsetMatch.size()+" matches");
+						Log.printStackTrace(e);
+					}
+				}
+
+				//System.out.println("RIGHT ctx lengths: "+lengthOfRightCtx);
+				// get all view property values of all lines
+				Map<Property, List<List<String>>> keywordsViewPropValues = new HashMap<Property, List<List<String>>>();
+				Map<Property, List<List<String>>> leftCtxViewPropValues = new HashMap<Property, List<List<String>>>();
+				Map<Property, List<List<String>>> rightCtxViewPropValues = new HashMap<Property, List<List<String>>>();
+				for (Property property : leftCViewProperties) {
+					leftCtxViewPropValues.put(property, cqiClient.getData(property, beginingOfLeftCtxPositions,
+							lengthOfLeftCtx));
+				}
+				for (Property property : rightCViewProperties) {
+					rightCtxViewPropValues.put(property, cqiClient.getData(property, beginingOfRightCtxPositions,
+							lengthOfRightCtx));
+				}
+				for (Property property : keywordViewProperties) {
+					keywordsViewPropValues.put(property, cqiClient.getData(property, beginingOfKeywordsPositions,
+							lengthOfKeywords));
+				}
+
+				// get all analysis property values of all lines
+				HashMap<Property, List<List<String>>> leftCtxAnaPropValues = new HashMap<Property, List<List<String>>>();
+				for(Property p : leftAnalysisProperties) {
+					leftCtxAnaPropValues.put(p, cqiClient.getData(p, beginingOfLeftCtxPositions, lengthOfLeftCtx));
+				}
+				HashMap<Property, List<List<String>>> keywordsAnaPropValues = new HashMap<Property, List<List<String>>>();
+				for(Property p : keywordAnalysisProperties) {
+					keywordsAnaPropValues.put(p, cqiClient.getData(p, beginingOfKeywordsPositions, lengthOfKeywords));
+				}
+				HashMap<Property, List<List<String>>> rightCtxAnaPropValues = new HashMap<Property, List<List<String>>>();
+				for(Property p : rightAnalysisProperties) {
+					rightCtxAnaPropValues.put(p, cqiClient.getData(p, beginingOfRightCtxPositions, lengthOfRightCtx));
+				}
+				// get all view reference values of all lines
+				Map<Property, List<List<String>>> refValues = new HashMap<Property, List<List<String>>>();
+				for (Property property : refViewPattern) {
+					refValues.put(property, cqiClient.getData(property, 
+							beginingOfKeywordsPositions,
+							Collections.nCopies(beginingOfKeywordsPositions.size(), 1)));
+				}
+
+				// get all sort reference values of all lines
+				Map<Property, List<List<String>>> refSortValues = new HashMap<Property, List<List<String>>>();
+				for (Property property : refAnalysePattern) {
+					refSortValues.put(property, cqiClient.getData(property, beginingOfKeywordsPositions,
+							Collections.nCopies(beginingOfKeywordsPositions.size(), 1)));
+				}
+
+				// get all lines' tokens ids
+				Property id = corpus.getProperty("id"); //$NON-NLS-1$
+				StructuralUnit text = corpus.getStructuralUnit("text"); //$NON-NLS-1$
+				Property text_id = text.getProperty("id"); //$NON-NLS-1$
+
+				List<List<String>> keywordsIdValues;
+				List<List<String>> keywordsTextValues;
+				if (id != null && text_id != null) {
+					/** The occurrences Ids&Text => BackToText */
+					keywordsIdValues = cqiClient.getData(id, beginingOfKeywordsPositions, lengthOfKeywords);
+					keywordsTextValues = cqiClient.getData(text_id, beginingOfKeywordsPositions,
+							Collections.nCopies(beginingOfKeywordsPositions
+									.size(), 1));
+				} else {
+					keywordsTextValues = null;
+					keywordsIdValues = null;
+					Log.warning(TXMCoreMessages.Concordance_1);
+				}
+
+				// Since we get the value only for the first word of the
+				// keyword, we know that refValues maps each property to a list
+				// of list of size==1 : refValue.get(p).get(i).size()==1
+
+				// Second, we build the lines
+				for (int k = 0; k < j - i; k++) {
+					//worked(1);
+					// get the kth line's analysis property values
+					HashMap<Property, List<String>> lineLeftCtxAnaPropValue = new HashMap<Property, List<String>>();
+					for(Property p : leftAnalysisProperties) {
+						lineLeftCtxAnaPropValue.put(p, leftCtxAnaPropValues.get(p).get(k));
+					}
+					HashMap<Property, List<String>> lineKeywordsAnaPropValue = new HashMap<Property, List<String>>();
+					for(Property p : keywordAnalysisProperties) {
+						lineKeywordsAnaPropValue.put(p, keywordsAnaPropValues.get(p).get(k));
+					}
+					HashMap<Property, List<String>> lineRightCtxAnaPropValue = new HashMap<Property, List<String>>();
+					for(Property p : rightAnalysisProperties) {
+						lineRightCtxAnaPropValue.put(p, rightCtxAnaPropValues.get(p).get(k));
+					}
+					// get the kth line's view property values
+					Map<Property, List<String>> lineLeftCtxViewPropValue = new HashMap<Property, List<String>>();
+					Map<Property, List<String>> lineKeywordsViewPropValue = new HashMap<Property, List<String>>();
+					Map<Property, List<String>> lineRightCtxViewPropValue = new HashMap<Property, List<String>>();
+					for (Property property : leftCViewProperties) {
+						lineLeftCtxViewPropValue.put(property,
+								leftCtxViewPropValues.get(property).get(k));
+					}
+					for (Property property : rightCViewProperties) {
+						lineRightCtxViewPropValue.put(property,
+								rightCtxViewPropValues.get(property).get(k));
+					}
+					for (Property property : keywordViewProperties) {
+						lineKeywordsViewPropValue.put(property,
+								keywordsViewPropValues.get(property).get(k));
+					}
+
+					// get the kth line reference values
+					Map<Property, String> ref = new HashMap<Property, String>();
+					for (Property property : refViewPattern) {
+						ref.put(property, refValues.get(property).get(k).get(0));
+					}
+
+					// get the kth line reference values
+					Map<Property, String> refAna = new HashMap<Property, String>();
+					for (Property property : refAnalysePattern) {
+						refAna.put(property, refSortValues.get(property).get(k).get(0));
+					}
+
+					// get Text id of the line
+					String TextId;
+					List<String> wordids;
+					if (keywordsIdValues != null && keywordsTextValues != null) {
+						TextId = keywordsTextValues.get(k).get(0);
+						wordids = keywordsIdValues.get(k);
+					} else {
+						TextId = TXMCoreMessages.Concordance_2;
+						wordids = new ArrayList<String>();
+					}
+
+					int targetpos = targetPositions.get(k);
+
+
+					Annotation annotation = null;
+					Match match = matches.get(i- from + k);
+					if (annotationsPerMatch != null) {
+						annotation = annotationsPerMatch.get(k);
+					}
+					TypedValue annotationValue = null;
+					if (annotation!=null) {
+						annotationValue = viewAnnotation.getTypedValue(annotation.getValue());
+						if (annotationValue == null) { // the annotation is not stored in the KR type -> the annotation is surely built with the CQPAnnotationManager
+							//System.out.println("WARNING: no annotation value found for value id="+annotation.getValue()+" - will be created.");
+							annotationValue = new TypedValue(annotation.getValue(), annotation.getValue(), annotation.getType());
+						}
+					}
+
+					Line line = new Line(this, wordids, TextId,
+							lineLeftCtxViewPropValue,
+							lineKeywordsViewPropValue,
+							lineRightCtxViewPropValue, lineLeftCtxAnaPropValue,
+							lineKeywordsAnaPropValue, lineRightCtxAnaPropValue,
+							new Reference(ref, refViewPattern), 
+							new Reference(refAna, refAnalysePattern), 
+							match, 
+							annotation,
+							annotationValue,
+							targetpos);
+					lines.set(i + k, line);
+				}
+			}
+			i = j;
+		}
+		List<Line> res = lines.subList(from, to + 1);// our to is inclusive,
+		// sublist's is exlusive
+		Log.info((to - from + 1) + TXMCoreMessages.Concordance_3
+				+ (System.currentTimeMillis() - start) + "ms"); //$NON-NLS-1$ 
+		return res;
+	}
+
+
+	private List<Annotation> prepareAnnotationsList(List<Match> matches, List<Annotation> annotations, boolean overlap){
+		List<Annotation> annotsList = new ArrayList<Annotation>();
+
+		int iMatch = 0;
+		int iAnnotation = 0;
+		int nMatch = matches.size();
+		int nAnnotations = annotations.size();
+
+		while (iMatch < nMatch && iAnnotation < nAnnotations) {
+			if (overlap) {
+				if (matches.get(iMatch).getEnd() < annotations.get(iAnnotation).getStart()) {
+					iMatch++;
+					annotsList.add(null); // nothing for this match
+				} else if (annotations.get(iAnnotation).getEnd() < matches.get(iMatch).getStart()) {
+					iAnnotation++;
+				} else {
+					annotsList.add(annotations.get(iAnnotation));
+					iMatch++;
+				}
+			} else {
+				if (matches.get(iMatch).getEnd() < annotations.get(iAnnotation).getStart()) {
+					iMatch++;
+					annotsList.add(null); // nothing for this match
+				} else if (annotations.get(iAnnotation).getEnd() < matches.get(iMatch).getStart()) {
+					iAnnotation++;
+				} else if (annotations.get(iAnnotation).getStart() == matches.get(iMatch).getStart() && 
+						annotations.get(iAnnotation).getEnd() == matches.get(iMatch).getEnd()) {
+					annotsList.add(annotations.get(iAnnotation));
+					iMatch++;
+					iAnnotation++;
+				} else {
+					iAnnotation++;
+				}
+			}
+		}
+
+		while (annotsList.size() < matches.size() ) annotsList.add(null); // fill matches that were not process due to no more annotations
+
+		return annotsList;
+	}
+
+	private HashMap<Match, Annotation> prepareAnnotationsMap(List<Match> matches, List<Annotation> annots, boolean overlap){
+		HashMap<Match, Annotation> annotsList = new HashMap<Match, Annotation>();
+		for(Match m : matches){
+			boolean hasAnnotations = false;
+			if(annots!=null){
+				if(!annots.isEmpty()){
+					for(Annotation annot : annots) {
+						if(overlap){
+							if ((annot.getStart() <= m.getStart() && m.getStart() <= annot.getEnd() && m.getEnd() >= annot.getEnd()) || 
+									(annot.getStart() <= m.getEnd() && m.getEnd() <= annot.getEnd() && m.getStart() <= annot.getStart()) 
+									|| !(annot.getEnd() < m.getStart() || annot.getStart() > m.getEnd())){
+								annotsList.put(m, annot);
+								hasAnnotations = true;
+							}
+						}else {
+							if(annot.getStart()==m.getStart() && annot.getEnd()==m.getEnd()){
+								annotsList.put(m, annot); 
+								hasAnnotations = true;
+							}
+						}
+					}
+				}
+			}
+			if(!hasAnnotations){
+				annotsList.put(m, null);
+			}
+		}
+		return annotsList;
+	}
+
+	private String findAnnotationForLine(Match match, List<Annotation> annots, boolean overlap){
+		String annotationValue = "";
+		if(annots!=null){
+			if(!annots.isEmpty()){
+				for(Annotation annot : annots){
+					if(overlap){
+						if((annot.getStart()<=match.getStart() && annot.getEnd()>=match.getEnd()) || (annot.getStart()>match.getStart() && annot.getEnd()<match.getEnd())
+								){
+							annotationValue = annot.getValue(); 
+							// use the first Annotation found, the one stored in the temporary HSQL database
+							//should be modified to display a list of annotation values corresponding to the match positions (or wrapped if overlap is admitted)
+						}
+					}else {
+						if(annot.getStart()==match.getStart() && annot.getEnd()==match.getEnd()){
+							annotationValue = annot.getValue(); 
+							// use the first Annotation found, the one stored in the temporary HSQL database
+						}
+					}
+				}
+			}
+		}
+		return annotationValue;
+	}
+
+	/**
+	 * Gets the number of lines.
+	 * 
+	 * @return the n lines
+	 */
+	public int getNLines() {
+		return nLines;
+	}
+
+	/**
+	 * Sort the lines of the concordance according a comparator.
+	 * 
+	 * @param comparator
+	 *            the comparator used to compare the lines
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 * @throws CqiServerError 
+	 * @throws IOException 
+	 */
+	public void sort(LineComparator comparator) throws CqiClientException, IOException, CqiServerError {
+		System.currentTimeMillis();
+		this.acquireSemaphore();
+		comparator.initialize(corpus);
+		this.releaseSemaphore();
+		if (getNLines() == 0) return;
+		getLines(0, nLines - 1);
+		if (lines.size() > 0) {
+			Collections.sort(lines, comparator);
+		}
+		System.currentTimeMillis();
+	}
+
+	/**
+	 * Write all the lines on a writer.
+	 *
+	 * @param outfile the outfile
+	 * @param encoding the encoding
+	 * @param colseparator the colseparator
+	 * @param txtseparator the txtseparator
+	 * @return true, if successful
+	 * @throws IOException 
+	 */
+	public boolean toTxt(File outfile, String encoding, String colseparator, String txtseparator) throws IOException {
+
+		// NK: writer declared as class attribute to perform a clean if the operation is interrupted
+		try {
+			this.writer = new OutputStreamWriter(new BufferedOutputStream(new FileOutputStream(outfile)), encoding);
+			// if ("UTF-8".equals(encoding)) writer.write('\ufeff'); // UTF-8 BOM
+			toTxt(writer, 0, nLines - 1, colseparator, txtseparator);
+		} catch (UnsupportedEncodingException e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		} catch (Exception e) {
+			System.err.println(TXMCoreMessages.Concordance_12 + e);
+			Log.printStackTrace(e);
+			return false;
+		} 
+
+		return true;
+	}
+
+	/**
+	 * To txt.
+	 *
+	 * @param outfile the outfile
+	 * @param format the format
+	 * @return true, if successful
+	 */
+	public boolean toTxt(File outfile, Format format) {
+		try {
+			this.writer = new BufferedWriter(new OutputStreamWriter(
+					new FileOutputStream(outfile), "UTF-8")); //$NON-NLS-1$
+			toTxt(writer, 0, nLines - 1, format, "\t",""); //$NON-NLS-1$ //$NON-NLS-2$
+		} catch (Exception e) {
+			System.err.println(TXMCoreMessages.Concordance_12 + e);
+			Log.printStackTrace(e);
+			return false;
+		}
+		return true;
+	}
+
+	/**
+	 * Write the lines between from and to on a writer.
+	 * 
+	 * @param writer
+	 *            Where to write the lines
+	 * @param from
+	 *            The first line to be written
+	 * @param to
+	 *            The last line to be writen
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 * @throws CqiServerError 
+	 */
+	public void toTxt(Writer writer, int from, int to)
+			throws CqiClientException, IOException, CqiServerError {
+
+		toTxt(writer, from, to, Format.CONCORDANCE, "\t", ""); //$NON-NLS-1$ //$NON-NLS-2$
+	}
+
+	/**
+	 * Write the lines between from and to on a writer with custom col and txt separators.
+	 * 
+	 * @param writer
+	 *            Where to write the lines
+	 * @param from
+	 *            The first line to be written
+	 * @param to
+	 *            The last line to be writen
+	 * @param colseparator
+	 * 			  The column separator
+	 * @param txtseparator
+	 * 			  Thx text separator, e.g txtseparator=' : "I'm" >> "I''m"
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 * @throws CqiServerError 
+	 */
+	public void toTxt(Writer writer, int from, int to, String colseparator, String txtseparator)
+			throws CqiClientException, IOException, CqiServerError {
+
+		toTxt(writer, from, to, Format.CONCORDANCE, colseparator, txtseparator);
+	}
+
+	/**
+	 * Adds the txt sep.
+	 *
+	 * @param str the str
+	 * @param separator the separator
+	 * @return the string
+	 */
+	private String addTxtSep(String str, String separator)
+	{
+		return separator+(str.replace(separator, separator+separator))+separator;
+	}
+
+	/**
+	 * To txt.
+	 * Write line per packet to avoid memory limits
+	 *
+	 * @param writer the writer
+	 * @param from the from
+	 * @param to the to
+	 * @param format the format
+	 * @param colseparator the colseparator
+	 * @param txtseparator the txtseparator
+	 * @throws CqiClientException the cqi client exception
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError 
+	 */
+	public void toTxt(Writer writer, int from, int to, Format format, String colseparator, String txtseparator)
+			throws CqiClientException, IOException, CqiServerError {
+
+		int packetSize = 5000;
+		int nlines = to - from;
+		if (nlines == 0) nlines = 1;
+		int step = (100*packetSize)/nlines;
+		if (step == 0) step = 1;
+
+		String keyColSeparator = colseparator; // the separator is "" if export in CONTEXT mode
+		// write header and set keywordColumnSeparator
+		if (format == Format.CONTEXT) {
+			keyColSeparator = "";
+			writer.write(
+					txtseparator+TXMCoreMessages.Concordance_17+txtseparator
+					+ colseparator+txtseparator+TXMCoreMessages.Concordance_19+txtseparator
+					+ "\n"); //$NON-NLS-1$
+		} else {
+			writer.write(
+					addTxtSep(TXMCoreMessages.Concordance_13, txtseparator)+colseparator
+					+ addTxtSep(TXMCoreMessages.Concordance_14, txtseparator)+colseparator
+					+ addTxtSep(TXMCoreMessages.Concordance_15, txtseparator)+colseparator
+					+ addTxtSep(TXMCoreMessages.Concordance_16, txtseparator)
+					+ "\n"); //$NON-NLS-1$
+		}
+
+		//write lines
+		for (int i = from ; i <= to ; i += packetSize +1) {
+			worked(step);
+			//println "worked: $step"
+			//println "packet $i -> "+(i+packetSize)
+			int to2 = i+packetSize;
+			if (to2 > to) to2 = to;
+			//println "get lines: $i -> $to2"
+			List<Line> sublines = getLines(i, to2);
+			for (Line line : sublines) {
+				writer.write(
+						addTxtSep(line.getViewRef().toString(), txtseparator)
+						+ colseparator + addTxtSep(line.leftContextToString(), txtseparator)
+						+ keyColSeparator + addTxtSep(line.keywordToString(), txtseparator)
+						+ keyColSeparator + addTxtSep(line.rightContextToString(), txtseparator)
+						+ "\n"); //$NON-NLS-1$
+				writer.flush();
+			}
+			//println "Lines1: "+lines
+			//lines.addAll(i,Collections.nCopies(packetSize,	(Line) null)); // delete created lines
+			for(int j = i ; j <= to2 && j < lines.size() ; j++)
+				lines.set(j, null);
+			//println "Lines2: "+lines
+		}
+
+		writer.flush();
+		writer.close();
+	}
+
+	@Override
+	public void clean() {
+		try {
+			this.writer.flush();
+			this.writer.close();
+		} catch (IOException e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+	}
+
+	/**
+	 * Set both left and right contexts size.
+	 *
+	 * @param size the new context size
+	 */
+	public void setLeftContextSize(int size) {
+		this.leftContextSize = size;
+		this.lines = new ArrayList<Line>(Collections.nCopies(nLines,
+				(Line) null));// we could make it less radically. But the data
+		// is cached anyway...
+	}
+
+	/**
+	 * Set both left and right contexts size.
+	 * 
+	 * @param size
+	 *            the new context size
+	 */
+	public void setRightContextSize(int size) {
+		this.rightContextSize = size;
+		this.lines = new ArrayList<Line>(Collections.nCopies(nLines,
+				(Line) null));// we could make it less radically. But the data
+		// is cached anyway...
+	}
+
+	/**
+	 * Set both left and right contexts size.
+	 * 
+	 * @param size
+	 *            the new context size
+	 */
+	public void setContextSize(int size) {
+		this.leftContextSize = size;
+		this.rightContextSize = size;
+		this.lines = new ArrayList<Line>(Collections.nCopies(nLines,
+				(Line) null));// we could make it less radically. But the data
+		// is cached anyway...
+	}
+
+	/**
+	 * Set left and right contexts size.
+	 *
+	 * @param leftsize the leftsize
+	 * @param rightsize the rightsize
+	 */
+	public void setContextSize(int leftsize, int rightsize) {
+		this.leftContextSize = leftsize;
+		this.rightContextSize = rightsize;
+		this.lines = new ArrayList<Line>(Collections.nCopies(nLines,
+				(Line) null));// we could make it less radically. But the data
+		// is cached anyway...
+	}
+
+	/**
+	 * Set the analysis property.
+	 * 
+	 * @param list the new analysis property
+	 */
+	public void setAnalysisProperty(List<Property> list) {
+		this.leftAnalysisProperties = list;
+		this.rightAnalysisProperties = list;
+		this.keywordAnalysisProperties = list;
+		this.lines = new ArrayList<Line>(Collections.nCopies(nLines,
+				(Line) null)); // empty lines
+	}
+
+	/**
+	 * Set the analysis property per column.
+	 * 
+	 * @param list the new analysis property
+	 */
+	public void setAnalysisProperty(List<Property> leftProps, List<Property> keywordProps, List<Property> rightProps) {
+		this.leftAnalysisProperties = leftProps;
+		this.rightAnalysisProperties = keywordProps;
+		this.keywordAnalysisProperties = rightProps;
+		this.lines = new ArrayList<Line>(Collections.nCopies(nLines, (Line) null)); // empty lines
+	}
+
+	/**
+	 * Set the analysis propertyof the left context.
+	 * 
+	 * @param selectedLeftSortProperty
+	 *            the new analysis property
+	 */
+	public void setLeftAnalysisProperties(List<Property> selectedLeftSortProperty) {
+		this.leftAnalysisProperties = selectedLeftSortProperty;
+		this.lines = new ArrayList<Line>(Collections.nCopies(nLines,
+				(Line) null)); // empty lines
+	}
+
+	/**
+	 * Set the analysis propertyof the left context.
+	 * 
+	 * @param selectedRightSortProperty
+	 *            the new analysis property
+	 */
+	public void setRightAnalysisProperties(List<Property> selectedRightSortProperty) {
+		this.rightAnalysisProperties = selectedRightSortProperty;
+		this.lines = new ArrayList<Line>(Collections.nCopies(nLines,
+				(Line) null)); // empty lines
+	}
+
+	/**
+	 * Set the analysis propertyof the left context.
+	 * 
+	 * @param selectedKeywordSortProperty
+	 *            the new analysis property
+	 */
+	public void setKeywordAnalysisProperties(List<Property> selectedKeywordSortProperty) {
+		this.keywordAnalysisProperties = selectedKeywordSortProperty;
+		this.lines = new ArrayList<Line>(Collections.nCopies(nLines,
+				(Line) null));// we could make it less radically.
+	}
+
+	/**
+	 * Set the same view properties for left context, right context and keyword.
+	 * 
+	 * @param viewProperties
+	 *            the new view properties
+	 */
+	public void setViewProperties(List<Property> viewProperties) {
+		this.viewProperties = viewProperties;
+		this.leftCViewProperties = viewProperties;
+		this.rightCViewProperties = viewProperties;
+		this.keywordViewProperties = viewProperties;
+		this.lines = new ArrayList<Line>(Collections.nCopies(nLines,
+				(Line) null));// we could make it less radically. But teh data
+		// is cached anyway...
+	}
+
+	/**
+	 * Set specif ic view properties for left context, right context and keyword.
+	 * if the List are null, the corresponding list will be reset
+	 * 
+	 * @param leftCViewProperties
+	 *            left context view properties
+	 * @param rightCViewProperties
+	 *            right context view properties
+	 * @param keywordViewProperties
+	 *            keyword view properties
+	 */
+	public void setViewProperties(List<Property> leftCViewProperties,
+			List<Property> rightCViewProperties,
+			List<Property> keywordViewProperties) {
+		// reset list or use the given ones
+		if (leftCViewProperties != null)
+			this.leftCViewProperties = leftCViewProperties;
+		else
+			this.leftCViewProperties = new ArrayList<Property>();
+
+		if (rightCViewProperties != null)
+			this.rightCViewProperties = rightCViewProperties;
+		else
+			this.rightCViewProperties = new ArrayList<Property>();
+
+		if (keywordViewProperties != null)
+			this.keywordViewProperties = keywordViewProperties;
+		else
+			this.keywordViewProperties = new ArrayList<Property>();
+
+		this.updateViewPropertiesList();
+		
+		this.lines = new ArrayList<Line>(Collections.nCopies(nLines, (Line) null));// we could make it less radically. But the data
+		// is cached anyway...
+	}
+
+	/**
+	 * Set the reference Pattern.
+	 * 
+	 * @param referencePattern
+	 *            the new reference Pattern
+	 */
+	public void setRefViewPattern(ReferencePattern referencePattern) {
+		this.refViewPattern = referencePattern;
+		this.lines = new ArrayList<Line>(Collections.nCopies(nLines,
+				(Line) null));// we could make it less radically. But the data
+		// is cached anyway...
+	}
+
+	/**
+	 * Set the reference Pattern.
+	 * 
+	 * @param referencePattern
+	 *            the new reference Pattern
+	 */
+	public void setRefAnalysePattern(ReferencePattern referencePattern) {
+		this.refAnalysePattern = referencePattern;
+		this.lines = new ArrayList<Line>(Collections.nCopies(nLines,
+				(Line) null));// we could make it less radically. But the data
+		// is cached anyway...
+	}
+
+	/**
+	 * Gets the corpus.
+	 *
+	 * @return the corpus
+	 */
+	public Corpus getCorpus() {
+		return corpus;
+	}
+
+	/**
+	 * Gets the name.
+	 *
+	 * @return a generated name of the concordance with the corpus and the query
+	 */
+	public String getName() {
+		return TXMCoreMessages.Concordance_18 + corpus.getName()
+				+ ":" //$NON-NLS-1$
+				+ queryResult.getQuery().getQueryString();
+	}
+
+	/**
+	 * Gets the right context size.
+	 *
+	 * @return the rightContextSize
+	 */
+	public int getRightContextSize() {
+		return rightContextSize;
+	}
+
+	/**
+	 * Gets the left context size.
+	 *
+	 * @return the leftContextSize
+	 */
+	public int getLeftContextSize() {
+		return leftContextSize;
+	}
+
+	/**
+	 * Gets the view properties.
+	 *
+	 * @return the viewProperties
+	 */
+	public List<Property> getViewProperties() {
+		return viewProperties;
+	}
+
+	/**
+	 * Gets the left c view properties.
+	 *
+	 * @return the leftCViewProperties
+	 */
+	public List<Property> getLeftViewProperties() {
+		return leftCViewProperties;
+	}
+
+	/**
+	 * Gets the right c view properties.
+	 *
+	 * @return the rightCViewProperties
+	 */
+	public List<Property> getRightViewProperties() {
+		return rightCViewProperties;
+	}
+
+	/**
+	 * Gets the keyword view properties.
+	 *
+	 * @return the keywordViewProperties
+	 */
+	public List<Property> getKeywordViewProperties() {
+		return keywordViewProperties;
+	}
+
+	/**
+	 * Gets the left c analysis property.
+	 *
+	 * @return the analysisProperty
+	 */
+	public List<Property> getLeftAnalysisProperties() {
+		return leftAnalysisProperties;
+	}
+
+	/**
+	 * Gets the right c analysis property.
+	 *
+	 * @return the analysisProperty
+	 */
+	public List<Property> getRightAnalysisProperties() {
+		return rightAnalysisProperties;
+	}
+
+	/**
+	 * Gets the keyword analysis property.
+	 *
+	 * @return the analysisProperty
+	 */
+	public List<Property> getKeywordAnalysisProperties() {
+		return keywordAnalysisProperties;
+	}
+
+	/**
+	 * Gets the analysis property.
+	 *
+	 * @return the analysisProperty
+	 */
+	public List<Property> getAnalysisProperty() {
+		return keywordAnalysisProperties;
+	}
+
+	/**
+	 * Gets the reference pattern.
+	 *
+	 * @return the referencePattern
+	 */
+	public ReferencePattern getRefViewPattern() {
+		return refViewPattern;
+	}
+
+
+	public ReferencePattern getRefAnalysePattern() {
+		return refAnalysePattern;
+	}
+
+	/**
+	 * Gets the keywords id.
+	 *
+	 * @param text the text
+	 * @param from the from
+	 * @param to the to
+	 * @return the keywords id
+	 */
+	public List<String> getKeywordsId(String text, int from, int to) {
+		//System.out.println(Messages.Concordance_5+from+" "+to); //$NON-NLS-2$
+		HashSet<String> allids = new HashSet<String>();
+		for (int i = from; i < to && i < lines.size(); i++) {
+			if (i >= 0 && i < lines.size()) {
+				Line line = lines.get(i);
+				// System.out.println("line text "+line.getTextId());
+				if (line.getTextId().equals(text)) {
+					allids.addAll(line.getKeywordIds());
+				}
+			}
+		}
+		return new ArrayList<String>(allids);
+	}
+
+	/** The noconc. */
+	protected static int noconc = 1;
+
+	/** The prefix r. */
+	protected static String prefixR = "Concordances"; //$NON-NLS-1$
+
+	/**
+	 * As r matrix.
+	 *
+	 * @return the string
+	 * @throws RWorkspaceException the r workspace exception
+	 * @throws CqiServerError 
+	 * @throws IOException 
+	 */
+	public String asRMatrix() throws RWorkspaceException, IOException, CqiServerError {
+		symbol = prefixR+ noconc++;
+		String[] refs = new String[this.getNLines()];
+		String[] lefts = new String[this.getNLines()];
+		String[] keywords = new String[this.getNLines()];
+		String[] rights = new String[this.getNLines()];
+
+		int i = 0;
+		try {
+			for (Line line : this.getLines(0, this.getNLines())) {
+				refs[i] = line.getViewRef().toString();
+				lefts[i] = line.leftContextToString();
+				keywords[i] = line.keywordToString();
+				rights[i] = line.rightContextToString();
+				i++;
+			}
+		} catch (CqiClientException e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+			return ""; //$NON-NLS-1$
+		}
+
+		RWorkspace rw = RWorkspace.getRWorkspaceInstance();
+		rw.addVectorToWorkspace("concrefs", refs); //$NON-NLS-1$
+		rw.addVectorToWorkspace("conclefts", lefts); //$NON-NLS-1$
+		rw.addVectorToWorkspace("conckeywords", keywords); //$NON-NLS-1$
+		rw.addVectorToWorkspace("concrights", rights); //$NON-NLS-1$
+
+		rw.eval(symbol+ "<- matrix(data = c(concrefs, conclefts, conckeywords, concrights), nrow = "+this.getNLines()+", ncol = 4)"); //$NON-NLS-1$ //$NON-NLS-2$
+		rw.eval("colnames("+symbol+" ) <- c('refs', 'leftcontext', 'keyword', 'rightcontext')"); //$NON-NLS-1$ //$NON-NLS-2$
+		rw.eval(symbol+ "<- list(data="+symbol //$NON-NLS-1$
+				+ ", leftcontext="+this.leftContextSize //$NON-NLS-1$
+				+ ", rightcontext="+this.rightContextSize //$NON-NLS-1$
+				//+ ", query=\""+this.query.getQueryString()+"\""
+				+ ")"); //$NON-NLS-1$
+
+		return symbol;
+	}
+
+	/**
+	 * Gets the symbol.
+	 *
+	 * @return the symbol
+	 */
+	public String getSymbol() {
+		return symbol;
+	}
+
+	/** The properties to process. */
+	HashSet<String> propertiesToProcess;
+
+	private AnnotationType viewAnnotation;
+
+	private boolean overlapAnnotation;
+//
+//	/**
+//	 * Render.
+//	 *
+//	 * @param line the line
+//	 * @return the string
+//	 */
+//	public String render(Line line)
+//	{
+//		if(propertiesToProcess == null)
+//			propertiesToProcess = TxmRenderer.getPropertyToRender(this, "jsesh"); //$NON-NLS-1$
+//
+//		return line.toString();
+//	}
+
+	public boolean toTxt(File file, String encoding) throws Exception {
+		// TODO Auto-generated method stub
+		return toTxt(file, encoding, "\t", ""); //$NON-NLS-1$ //$NON-NLS-2$
+	}
+
+	@Override
+	public boolean delete() {
+		if (corpus.removeResult(this)) {
+			this.cleanMemory();
+			return true;
+		}
+		return false;
+	}
+
+	@Override
+	public String[] getExportTXTExtensions() {
+		return new String[]{"*.csv"};
+	}
+
+
+
+	public void setCQLSeparator(String cql_limit) {
+		if (this.cql_limit != null && !this.cql_limit.equals(cql_limit)) { 
+			//the CQL limit changed !
+			CQLLimitStarts = null;
+		}
+		this.cql_limit = cql_limit;
+	}
+
+	public List<Line> getLines() throws CqiClientException, IOException, CqiServerError {
+		return getLines(0, this.getNLines());
+	}
+
+	public List<Match> getMatches() throws CqiClientException {
+		return queryResult.getMatches();
+	}
+
+	public void setViewAnnotation(AnnotationType type) {
+		viewAnnotation = type;
+		this.lines = new ArrayList<Line>(Collections.nCopies(nLines,
+				(Line) null)); // empty lines
+	}
+
+	public AnnotationType getViewAnnotation(AnnotationType type) {
+		return viewAnnotation;
+	}
+
+	public void setAnnotationOverlap(boolean overlap) {
+		overlapAnnotation = overlap;
+	}
+
+	public boolean getAnnotationOverlap() {
+		return overlapAnnotation;
+	}
+
+	public QueryResult getQueryResult() {
+		return queryResult;
+	}
+
+	/**
+	 * Update the QueryResult removing the match of the given line.
+	 * 
+	 * It uses the "delete" command but needs to find the match number of all the matches of the queryresult (may be long depending on the queryresult size)
+	 * 
+	 * @param line
+	 * @return
+	 * @throws CqiClientException
+	 * @throws IOException
+	 * @throws CqiServerError
+	 */
+	public boolean removeLine(Line line) throws CqiClientException, IOException, CqiServerError {
+
+		AbstractCqiClient CQI = CorpusManager.getCorpusManager().getCqiClient();
+		if (CQI instanceof MemCqiClient) {
+			MemCqiClient MCQI = (MemCqiClient)CQI;
+
+			Match m = line.getMatch();
+			Match m2;
+			List<Match> allMatches = queryResult.getMatches();
+			int to = allMatches.size();
+			for (int i = 0 ; i < to; i++) {
+				m2 = allMatches.get(i);
+				if (m2.getStart() == m.getStart() && m2.getEnd() == m.getEnd()) {
+					String query = "delete "+this.queryResult.getQualifiedCqpId()+" "+i+";";
+					MCQI.query(query);
+
+					this.lines.remove(line);
+					this.nLines = queryResult.getNMatch();
+					return true;
+				}
+			}
+		}
+		return false;
+	}
+
+	/**
+	 * Update the QueryResult removing the match of the given line.
+	 * 
+	 * It uses the "delete" command but needs to find the match number of all the matches of the queryresult (may be long depending on the queryresult size)
+	 * 
+	 * @param line
+	 * @return
+	 * @throws CqiClientException
+	 * @throws IOException
+	 * @throws CqiServerError
+	 */
+	public boolean removeLines(List<Line> linesToRemove) throws CqiClientException, IOException, CqiServerError {
+
+		//reorder lines to start with the last line
+		Collections.sort(linesToRemove, new Comparator<Line>() {
+			@Override
+			public int compare(Line o1, Line o2) {
+				return o2.getKeywordPosition() - o1.getKeywordPosition();
+			}
+		});
+
+		AbstractCqiClient CQI = CorpusManager.getCorpusManager().getCqiClient();
+		List<Match> allMatches = queryResult.getMatches();
+		int to = allMatches.size();
+		int c = 0;
+		if (CQI instanceof MemCqiClient) {
+			MemCqiClient MCQI = (MemCqiClient)CQI;
+			for (Line line : linesToRemove) {
+				Match m = line.getMatch();
+				Match m2;
+
+				for (int i = 0 ; i < to; i++) {
+					m2 = allMatches.get(i);
+					if (m2.getStart() == m.getStart() && m2.getEnd() == m.getEnd()) {
+						String query = "delete "+this.queryResult.getQualifiedCqpId()+" "+i+";";
+						MCQI.query(query);
+						this.lines.remove(line);
+						c++;
+					}
+				}
+			}
+
+			this.nLines = queryResult.getNMatch();
+			return c > 0;
+		}
+		return false;
+	}
+
+
+	/**
+	 * Gets the line index linked to the global token position in corpus according to the current concordance sorting.
+	 * @param globalPosition
+	 * @return
+	 */
+	public int indexOf(int globalPosition)	{
+		int index = -1;
+
+		// FIXME: works but may be optimized (e.g. get range by 50 token until the token is found instead of getting all the lines)
+		try {
+			List<Line> allLines = this.getLines(0, this.nLines);
+
+			for(int i = 0; i < allLines.size(); i++) {
+				Line line = allLines.get(i);
+				if(line != null && line.getMatch().getStart() == globalPosition)	{
+					index = i;
+					break;
+				}
+			}
+		}
+		catch(CqiClientException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		catch(IOException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		catch(CqiServerError e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+
+		// FIXME: tests for optimization by range
+		//		try {
+		//			List<Line> lines;
+		//			int rangeLength = 20;
+		//			int rangeMax = 0; 
+		//			for(int i = 0; i < this.nLines; i += rangeLength) {
+		//				rangeMax += rangeLength;
+		//				lines = this.getLines(i, rangeMax);
+		//				System.out.println("Concordance.indexOf(): getLines " + i + " / " + rangeMax);
+		//
+		//				for(int j = 0; j < lines.size(); j++) {
+		//					Line line = lines.get(j);
+		//					if(line != null && line.getMatch().getStart() == globalPosition)	{
+		//						index = i + j;
+		//						break;
+		//					}
+		//				}
+		//				if(index != -1)	{
+		//					break;
+		//				}
+		//			}
+		//		}
+		//		catch(CqiClientException e) {
+		//			// TODO Auto-generated catch block
+		//			e.printStackTrace();
+		//		}
+		//		catch(IOException e) {
+		//			// TODO Auto-generated catch block
+		//			e.printStackTrace();
+		//		}
+		//		catch(CqiServerError e) {
+		//			// TODO Auto-generated catch block
+		//			e.printStackTrace();
+		//		}
+
+
+		// FIXME: tests for optimization
+		// Problem here is that we need the sorted index of
+		//		try {
+		//			List<Match> matches = queryResult.getMatches(0, this.nLines - 1);
+		//			Collections.sort(matches, );
+		//			for(int i = 0; i < matches.size(); i++) {
+		//				if(matches.get(i).getStart() == globalPosition)	{
+		//					index = i;
+		//					break;
+		//				}
+		//			}
+		//		}
+		//		catch(CqiClientException e) {
+		//			// TODO Auto-generated catch block
+		//			e.printStackTrace();
+		//		}
+
+
+
+		return index;
+	}
+
+	@Override
+	public String getSimpleName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public String getDetails() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/functions/concordances/Concordance.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/functions/concordances/package.html
===================================================================
--- tmp/org.txm.core/src/java/org/txm/functions/concordances/package.html	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/functions/concordances/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Concordance.</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/java/org/txm/functions/concordances/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/functions/concordances/Line.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/functions/concordances/Line.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/functions/concordances/Line.java	(revision 258)
@@ -0,0 +1,698 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2016-02-01 09:53:38 +0100 (Mon, 01 Feb 2016) $
+// $LastChangedRevision: 3101 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.functions.concordances;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.lang.StringUtils;
+import org.txm.annotation.Annotation;
+import org.txm.annotation.repository.TypedValue;
+import org.txm.functions.Reference;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.corpus.Corpus;
+import org.txm.searchengine.cqp.corpus.Property;
+import org.txm.searchengine.cqp.corpus.query.Match;
+import org.txm.utils.i18n.LangFormater;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class Line represents concordance line.
+ *
+ * @author jmague
+ */
+public class Line {
+
+	/** The concordance. */
+	private Concordance concordance;
+
+	/** The left ctx view properties. */
+	private Map<Property, List<String>> leftCtxViewProperties;
+	
+	/** The keywords view properties. */
+	private Map<Property, List<String>> keywordsViewProperties;
+	
+	/** The right ctx view properties. */
+	private Map<Property, List<String>> rightCtxViewProperties;
+
+	/** The left ctx analysis property. */
+	private HashMap<Property, List<String>> leftCtxAnalysisProperty;
+	
+	/** The keywords analysis property. */
+	private HashMap<Property, List<String>> keywordsAnalysisProperty;
+	
+	/** The right ctx analysis property. */
+	private HashMap<Property, List<String>> rightCtxAnalysisProperty;
+	
+	/** The PRO p_ separtor. */
+	public static String PROP_SEPARTOR ="_"; //$NON-NLS-1$
+
+	/** The references : view and sort */
+	private Reference refView;
+	private Reference refAna;
+	
+	/** The match. */
+	private Match match;
+
+	/** the line's text. */
+	private String textId;
+
+	/** the ids of the keywords. */
+	private List<String> keywordsIdValues;
+
+	/** The keywordpos. */
+	private int keywordpos;
+	
+	/**
+	 * the @target corpus position of the query
+	 */
+	private int targetpos;
+
+	private TypedValue annotationValue;
+
+	private Annotation annotation;
+
+	/**
+	 * Instantiates a new line.
+	 *
+	 * @param concordance the concordance
+	 * @param keywordsIdValues the keywords id values
+	 * @param textId the text id
+	 * @param leftCtxViewProperty the left context view property values
+	 * @param keywordsViewProperty the keywords view property values
+	 * @param rightCtxViewProperty the right context view property values
+	 * @param lineLeftCtxAnaPropValue the left context analysis property values
+	 * @param lineKeywordsAnaPropValue the keywords analysis property values
+	 * @param lineRightCtxAnaPropValue the right context analysis property values
+	 * @param refView the view references
+	 * @param reference2 the sort references
+	 * @param matchs the matchs
+	 * @param annotation 
+	 * @param annotationValue 
+	 */
+	public Line(Concordance concordance, List<String> keywordsIdValues,
+			String textId, Map<Property, List<String>> leftCtxViewProperty,
+			Map<Property, List<String>> keywordsViewProperty,
+			Map<Property, List<String>> rightCtxViewProperty,
+			HashMap<Property, List<String>> lineLeftCtxAnaPropValue,
+			HashMap<Property, List<String>> lineKeywordsAnaPropValue,
+			HashMap<Property, List<String>> lineRightCtxAnaPropValue, Reference refView,
+			Reference refAna, Match matchs, Annotation annotation, TypedValue annotationValue, int targetpos) {
+		this.textId = textId;
+		this.targetpos = targetpos;
+		this.keywordsIdValues = keywordsIdValues;
+		this.concordance = concordance;
+		this.leftCtxViewProperties = leftCtxViewProperty;
+		this.keywordsViewProperties = keywordsViewProperty;
+		this.rightCtxViewProperties = rightCtxViewProperty;
+		this.leftCtxAnalysisProperty = lineLeftCtxAnaPropValue;
+		this.keywordsAnalysisProperty = lineKeywordsAnaPropValue;
+		this.rightCtxAnalysisProperty = lineRightCtxAnaPropValue;
+		this.refView = refView;
+		this.refAna = refAna;
+		this.match = matchs;
+		this.keywordpos = matchs.getStart();
+		this.annotationValue = annotationValue;
+		this.annotation = annotation;
+	}
+
+	/**
+	 * Gets the keywords analysis property.
+	 * 
+	 * @return the keywords analysis property
+	 */
+	public HashMap<Property, List<String>> getKeywordsAnalysisProperty() {
+		return keywordsAnalysisProperty;
+	}
+
+	public TypedValue getAnnotationValue() {
+		return annotationValue;
+	}
+	
+	/**
+	 * Gets the left context analysis property.
+	 * 
+	 * @return the left context analysis property
+	 */
+	public HashMap<Property, List<String>> getLeftAnalysisProperty() {
+		return leftCtxAnalysisProperty;
+	}
+
+	/**
+	 * Gets the right ctx analysis property.
+	 * 
+	 * @return the right ctx analysis property
+	 */
+	public HashMap<Property, List<String>> getRightAnalysisProperty() {
+		return rightCtxAnalysisProperty;
+	}
+
+	/**
+	 * Gets the keywords view properties.
+	 * 
+	 * @return the keywords view properties
+	 */
+	public Map<Property, List<String>> getKeywordsViewProperties() {
+		return keywordsViewProperties;
+	}
+
+	/**
+	 * Gets the left context view properties.
+	 * 
+	 * @return the left context view properties
+	 */
+	public Map<Property, List<String>> getLeftCtxViewProperties() {
+		return leftCtxViewProperties;
+	}
+
+	/**
+	 * Gets the right context view properties.
+	 * 
+	 * @return the right context view properties
+	 */
+	public Map<Property, List<String>> getRightCtxViewProperties() {
+		return rightCtxViewProperties;
+	}
+
+	/**
+	 * Gets the reference.
+	 * 
+	 * @return the reference
+	 */
+	public Reference getViewRef() {
+		return refView;
+	}
+	
+	/**
+	 * Gets the reference.
+	 * 
+	 * @return the reference
+	 */
+	public Reference getAnaRef() {
+		return refAna;
+	}
+	
+
+	/**
+	 * Gets the left context size.
+	 * 
+	 * @return the left context size
+	 */
+	public int getLeftContextSize() {
+		return leftCtxViewProperties.values().iterator().next().size();
+	}
+
+	/**
+	 * Gets the keywords size.
+	 * 
+	 * @return the keywords size
+	 */
+	public int getKeywordsSize() {
+		return keywordsViewProperties.values().iterator().next().size();
+	}
+
+	/**
+	 * Gets the right context size.
+	 * 
+	 * @return the right context size
+	 */
+	public int getRightContextSize() {
+		return rightCtxViewProperties.values().iterator().next().size();
+	}
+
+	/**
+	 * Gets the match.
+	 * 
+	 * @return the match
+	 */
+	public Match getMatch() {
+		return match;
+	}
+
+	/**
+	 * Used by leftContextToString, keywordsToString and rightContextToString to
+	 * build te string they return.
+	 *
+	 * @param values A map returned by getLeftCtxViewProperties,
+	 * getKeywordsViewProperties or getRightCtxViewProperties
+	 * @param propertySeparator The string used to separate the dif ferent view properties for
+	 * each word
+	 * @param wordSeparator The string used to separate the dif ferent words
+	 * @return The string representation
+	 */
+	private String fieldToString(Map<Property, List<String>> values,
+			String propertySeparator, String wordSeparator) {
+		List<String> words = new ArrayList<String>();
+		for (int i = 0; i < values.get(concordance.getViewProperties().get(0))
+				.size(); i++) {
+			List<String> word = new ArrayList<String>();
+			for (Property property : concordance.getViewProperties())
+				word.add(values.get(property).get(i));
+			words.add(StringUtils.join(word, propertySeparator));
+		}
+		return LangFormater.format(StringUtils.join(words, wordSeparator),
+				concordance.getCorpus().getAttribute("lang")); //$NON-NLS-1$
+	}
+
+	/**
+	 * Fix spaces.
+	 *
+	 * @param str the str
+	 * @return the string
+	 */
+	private String fixSpaces(String str) {
+		str = str.replace(" ' ", " '"); //$NON-NLS-1$ //$NON-NLS-2$
+		str = str.replace("' ", "'"); //$NON-NLS-1$ //$NON-NLS-2$
+		str = str.replace(" , ", ", "); //$NON-NLS-1$ //$NON-NLS-2$
+		str = str.replace(" \" ", " \""); //$NON-NLS-1$ //$NON-NLS-2$
+		str = str.replace(" . ", ". "); //$NON-NLS-1$ //$NON-NLS-2$
+		str = str.replace("( ", "("); //$NON-NLS-1$ //$NON-NLS-2$
+		str = str.replace(" )", ")"); //$NON-NLS-1$ //$NON-NLS-2$
+		str = str.replace("[ ", "["); //$NON-NLS-1$ //$NON-NLS-2$
+		str = str.replace(" ]", "]"); //$NON-NLS-1$ //$NON-NLS-2$
+		str = str.replace("{ ", "{"); //$NON-NLS-1$ //$NON-NLS-2$
+		str = str.replace(" }", "}"); //$NON-NLS-1$ //$NON-NLS-2$
+		return str;
+	}
+
+	/**
+	 * Returns a string representing the left context.
+	 *
+	 * @param propertySeparator The string used to separate the dif ferent view properties for
+	 * each word
+	 * @param wordSeparator The string used to separate the dif ferent words
+	 * @param limit the limit
+	 * @return The string representation
+	 */
+	public String leftContextToString(String propertySeparator,
+			String wordSeparator, int limit) {
+		int currentPos = keywordpos - getLeftContextSize();
+		
+		List<String> words = new ArrayList<String>();
+		Map<Property, List<String>> values = getLeftCtxViewProperties();
+		int max = (limit == -1) ? (values.get(concordance
+				.getLeftViewProperties().get(0)).size()) : (limit);
+		int start = this.getLeftContextSize() - max;
+		for (int i = start; i < this.getLeftContextSize(); i++) {
+			List<String> word = new ArrayList<String>();
+			for (Property property : concordance.getLeftViewProperties())
+				word.add(values.get(property).get(i));
+			
+			words.add(StringUtils.join(word, propertySeparator));
+			
+			if (annotation != null) {
+				if (currentPos == annotation.getStart()) {
+					words.set(i, "< "+words.get(i));
+				} else if (currentPos == annotation.getEnd()) {
+					words.set(i, words.get(i)+" >");
+				}
+			}
+			
+			currentPos++; // next position
+		}
+
+		return LangFormater.format(StringUtils.join(words, wordSeparator),
+				concordance.getCorpus().getAttribute("lang")); //$NON-NLS-1$
+		// return fieldToString(getLeftCtxViewProperties(), propertySeparator,
+		// wordSeparator);
+	}
+
+	/**
+	 * Returns a string representing the keywords.
+	 *
+	 * @param propertySeparator The string used to separate the dif ferent view properties for
+	 * each word
+	 * @param wordSeparator The string used to separate the dif ferent words
+	 * @return The string representation
+	 */
+	public String keywordToString(String propertySeparator, String wordSeparator) {
+		
+		int currentPos = keywordpos;
+		
+		List<String> words = new ArrayList<String>();
+		Map<Property, List<String>> values = getKeywordsViewProperties();
+		int s = values.get(concordance.getKeywordViewProperties().get(0)).size();
+		int keywordEndPos = keywordpos + s - 1;
+		//System.out.println("Build STR of currentpos="+currentPos+" length="+s);
+		for (int i = 0; i < s; i++) {
+			List<String> word = new ArrayList<String>();
+			for (Property property : concordance.getKeywordViewProperties())
+				word.add(values.get(property).get(i));
+			
+			if (currentPos == targetpos) { // highlight the @ target 
+				words.add("["+StringUtils.join(word, propertySeparator)+"]");
+			} else {
+				words.add(StringUtils.join(word, propertySeparator));
+			}
+			if (annotation != null && (annotation.getStart() != keywordpos || annotation.getEnd() != keywordEndPos)) {
+				if (currentPos == annotation.getStart()) {
+					words.set(i, "< "+words.get(i));
+				}
+				if (currentPos == annotation.getEnd()) {
+					words.set(i, words.get(i)+" >");
+				}
+			}
+			
+			currentPos++; // next position
+		}
+		return LangFormater.format(StringUtils.join(words, wordSeparator),
+				concordance.getCorpus().getAttribute("lang")); //$NON-NLS-1$
+		// return fieldToString(getKeywordsViewProperties(), propertySeparator,
+		// wordSeparator);
+	}
+
+	/**
+	 * Returns a string representing the right context.
+	 *
+	 * @param propertySeparator The string used to separate the dif ferent view properties for
+	 * each word
+	 * @param wordSeparator The string used to separate the dif ferent words
+	 * @param limit the limit
+	 * @return The string representation
+	 */
+	public String rightContextToString(String propertySeparator,
+			String wordSeparator, int limit) {
+		List<String> words = new ArrayList<String>();
+		Map<Property, List<String>> values = getRightCtxViewProperties();
+		int max = (limit == -1) ? (values.get(concordance.getRightViewProperties().get(0)).size()) : (limit);
+		
+		int s = getKeywordsSize();
+		int currentPos = keywordpos + s;
+		//System.out.println("Line "+keywordToString()+" right context, currentpos="+currentPos+" keywordpos="+keywordpos+" keywordlength="+s);
+		for (int i = 0; i < max; i++) {
+			List<String> word = new ArrayList<String>();
+			for (Property property : concordance.getRightViewProperties())
+				word.add(values.get(property).get(i));
+			words.add(StringUtils.join(word, propertySeparator));
+			
+			if (annotation != null) {
+				if (currentPos == annotation.getStart()) {
+					words.set(i, "< "+words.get(i));
+				} else if (currentPos == annotation.getEnd()) {
+					words.set(i, words.get(i)+" >");
+				}
+			}
+			currentPos++;
+		}
+		return LangFormater.format(StringUtils.join(words, wordSeparator),
+				concordance.getCorpus().getLang()); 
+		// return fieldToString(getRightCtxViewProperties(), propertySeparator,
+		// wordSeparator);
+	}
+	
+	/** The properties to process. */
+	protected static HashSet<String> propertiesToProcess;
+	
+	/**
+	 * Right context render.
+	 *
+	 * @param limit the limit
+	 * @return the string
+	 */
+	public String rightContextRender(int limit)
+	{
+//		if(propertiesToProcess == null)
+//			propertiesToProcess = TxmRenderer.getPropertyToRender(concordance, "jsesh"); //$NON-NLS-1$
+		
+		List<String> words = new ArrayList<String>();
+		Map<Property, List<String>> values = getRightCtxViewProperties();
+		int max = (limit == -1) ? (values.get(concordance.getRightViewProperties().get(0)).size()) : (limit);
+		
+		for (int i = 0; i < max; i++) 
+		{
+			List<String> word = new ArrayList<String>();
+			for (Property property : concordance.getRightViewProperties())
+			{
+//				if(propertiesToProcess.contains(property.getName()))
+//					word.add(TxmRenderer.jseshrenderer.render(values.get(property).get(i)));
+//				else
+					word.add(values.get(property).get(i));
+			}
+			words.add(StringUtils.join(word, "_")); //$NON-NLS-1$
+		}
+		return LangFormater.format(StringUtils.join(words, " "), //$NON-NLS-1$
+				concordance.getCorpus().getAttribute("lang")); //$NON-NLS-1$
+	}
+	
+	/**
+	 * Keyword render.
+	 *
+	 * @param wordSeparator the word separator
+	 * @return the string
+	 */
+	public String keywordRender(String wordSeparator) {
+//		if(propertiesToProcess == null)
+//			propertiesToProcess = TxmRenderer.getPropertyToRender(concordance, "jsesh"); //$NON-NLS-1$
+		
+		List<String> words = new ArrayList<String>();
+		Map<Property, List<String>> values = getKeywordsViewProperties();
+		for (int i = 0; i < values.get(
+				concordance.getKeywordViewProperties().get(0)).size(); i++) {
+			List<String> word = new ArrayList<String>();
+			for (Property property : concordance.getKeywordViewProperties())
+			{
+//				if(propertiesToProcess.contains(property.getName()))
+//					word.add(TxmRenderer.jseshrenderer.render(values.get(property).get(i)));
+//				else
+					word.add(values.get(property).get(i));
+			}
+			words.add(StringUtils.join(word, wordSeparator));
+		}
+		return LangFormater.format(StringUtils.join(words, wordSeparator),
+				concordance.getCorpus().getAttribute("lang")); //$NON-NLS-1$
+	}
+	
+	/**
+	 * Left context render.
+	 *
+	 * @param limit the limit
+	 * @return the string
+	 */
+	public String leftContextRender(int limit) {
+		List<String> words = new ArrayList<String>();
+		Map<Property, List<String>> values = getLeftCtxViewProperties();
+		int max = (limit == -1) ? (values.get(concordance
+				.getLeftViewProperties().get(0)).size()) : (limit);
+		int start = this.getLeftContextSize() - max;
+		for (int i = start; i < this.getLeftContextSize(); i++) {
+			List<String> word = new ArrayList<String>();
+			for (Property property : concordance.getLeftViewProperties())
+			{
+//				if(propertiesToProcess.contains(property.getName()))
+//					word.add(TxmRenderer.jseshrenderer.render(values.get(property).get(i)));
+//				else
+					word.add(values.get(property).get(i));
+			}
+			words.add(StringUtils.join(word, "_")); //$NON-NLS-1$
+		}
+
+		return LangFormater.format(StringUtils.join(words, " "), //$NON-NLS-1$
+				concordance.getCorpus().getAttribute("lang")); //$NON-NLS-1$
+		// return fieldToString(getLeftCtxViewProperties(), propertySeparator,
+		// wordSeparator);
+	}
+
+	/**
+	 * Returns a string representing the left context. Equivalent to
+	 * leftContextToString("/"," ")
+	 * 
+	 * @return The string representation
+	 */
+	public String leftContextToString() {
+		return leftContextToString(PROP_SEPARTOR, " ", -1); //$NON-NLS-1$ 
+	}
+
+	/**
+	 * Left context to string.
+	 *
+	 * @param limit the limit
+	 * @return the string
+	 */
+	public String leftContextToString(int limit) {
+		return leftContextToString(PROP_SEPARTOR, " ", limit); //$NON-NLS-1$ 
+	}
+
+	/**
+	 * Returns a string representing the keywords. Equivalent to
+	 * keywordToString("/"," ")
+	 * 
+	 * @return The string representation
+	 */
+	public String keywordToString() {
+		return keywordToString(PROP_SEPARTOR, " "); //$NON-NLS-1$ 
+	}
+
+	/**
+	 * Returns a string representing the right context. Equivalent to
+	 * rightContextToString("/"," ")
+	 * 
+	 * @return The string representation
+	 */
+	public String rightContextToString() {
+		return rightContextToString(PROP_SEPARTOR, " ", -1); //$NON-NLS-1$ 
+	}
+
+	/**
+	 * Right context to string.
+	 *
+	 * @param limit the limit
+	 * @return the string
+	 */
+	public String rightContextToString(int limit) {
+		return rightContextToString(PROP_SEPARTOR, " ", limit); //$NON-NLS-1$ 
+	}
+
+	/**
+	 * Match get start.
+	 *
+	 * @return the integer
+	 */
+	public Integer matchGetStart() {
+		return match.getStart();
+	}
+
+	/**
+	 * Match get end.
+	 *
+	 * @return the integer
+	 */
+	public Integer matchGetEnd() {
+		return match.getEnd();
+	}
+
+	/**
+	 * Match get col.
+	 *
+	 * @param corpus the corpus
+	 * @return the string
+	 * @throws CqiClientException the cqi client exception
+	 */
+	public String matchGetCol(Corpus corpus) throws CqiClientException {
+		return match.getValueForProperty(corpus.getProperty("col")); //$NON-NLS-1$
+	}
+
+	/**
+	 * Match get id.
+	 *
+	 * @param corpus the corpus
+	 * @return the list
+	 * @throws CqiClientException the cqi client exception
+	 */
+	public List<String> matchGetId(Corpus corpus) throws CqiClientException {
+		return match.getValuesForProperty(corpus.getProperty("id")); //$NON-NLS-1$
+	}
+
+	/**
+	 * Match get id.
+	 *
+	 * @param corpus the corpus
+	 * @param positions the positions
+	 * @return the list
+	 * @throws CqiClientException the cqi client exception
+	 */
+	@SuppressWarnings("static-access") //$NON-NLS-1$
+	public List<String> matchGetId(Corpus corpus, int[] positions)
+			throws CqiClientException {
+		return match.getValuesForProperty(corpus.getProperty("id"), positions); //$NON-NLS-1$
+	}
+
+	/**
+	 * Match get propertie.
+	 *
+	 * @param corpus the corpus
+	 * @param propertie the propertie
+	 * @param positions the positions
+	 * @return the list
+	 * @throws CqiClientException the cqi client exception
+	 */
+	@SuppressWarnings("static-access") //$NON-NLS-1$
+	public List<String> matchGetPropertie(Corpus corpus, String propertie,
+			int[] positions) throws CqiClientException {
+		return match.getValuesForProperty(corpus.getProperty(propertie),
+				positions);
+	}
+
+	/**
+	 * Match get properties.
+	 *
+	 * @param corpus the corpus
+	 * @param propertie the propertie
+	 * @param positions the positions
+	 * @return the list
+	 * @throws CqiClientException the cqi client exception
+	 */
+	@SuppressWarnings("static-access") //$NON-NLS-1$
+	public List<String> matchGetProperties(Corpus corpus, Property propertie,
+			int[] positions) throws CqiClientException {
+		return match.getValuesForProperty(propertie, positions);
+	}
+
+	/**
+	 * Gets the text id.
+	 *
+	 * @return the text id
+	 */
+	public Object getTextId() {
+		return this.textId;
+	}
+
+	/**
+	 * Gets the concordance.
+	 *
+	 * @return the concordance
+	 */
+	public Concordance getConcordance() {
+		return concordance;
+	}
+
+	/**
+	 * Gets the keyword ids.
+	 *
+	 * @return the keyword ids
+	 */
+	public Collection<? extends String> getKeywordIds() {
+		return this.keywordsIdValues;
+	}
+
+	/**
+	 * Gets the keyword position.
+	 *
+	 * @return the keyword position
+	 */
+	public int getKeywordPosition() {
+		return keywordpos;
+	}
+
+	public Annotation getAnnotation() {
+		return annotation;
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/functions/concordances/Line.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/functions/preview/package.html
===================================================================
--- tmp/org.txm.core/src/java/org/txm/functions/preview/package.html	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/functions/preview/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Prototype of Preview functionnaly: shows the begining of a corpus or a partition.</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/java/org/txm/functions/preview/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/functions/preview/Preview.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/functions/preview/Preview.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/functions/preview/Preview.java	(revision 258)
@@ -0,0 +1,93 @@
+package org.txm.functions.preview;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.txm.core.results.TXMResult;
+import org.txm.searchengine.cqp.corpus.Corpus;
+import org.txm.searchengine.cqp.corpus.Partition;
+import org.txm.searchengine.cqp.corpus.Property;
+import org.txm.searchengine.cqp.corpus.query.Match;
+
+public class Preview extends TXMResult  {
+	private Corpus corpus;
+	private Partition partition;
+	private Property prop;
+	
+	private int n;
+	
+	public Preview(Corpus corpus, Property prop, int n) {
+		this.corpus = corpus;
+		this.prop = prop;
+		this.n = n;
+	}
+	
+	public Preview(Partition partition, Property prop, int n) {
+		this.partition = partition;
+		this.prop = prop;
+		this.n = n;
+	}
+	
+	public boolean compute() {
+		if (partition != null) {
+			return computePartition();
+		} else {
+			return computeCorpus();
+		}
+	}
+	
+	protected boolean computeCorpus() {
+		boolean ok = false;
+		
+		return ok;
+	}
+	
+	protected boolean computePartition() {
+		boolean ok = false;
+		List<Match> matches = corpus.getMatches();
+		for (Match m : matches) {
+			if (m.getLength() >= n) {
+				ok = true;
+			}
+		}
+		return ok;
+	}
+	
+	private String getLine(Corpus corpus) {
+		List<Match> matches = corpus.getMatches();
+		if (matches.size() == 0) return ""; //$NON-NLS-1$
+		
+		Match firstOkMatch = matches.get(0);
+		for (Match m : matches) {
+			if (m.getLength() >= n) {
+				Collection<? extends Integer> positions = m.getRange();
+				
+			}
+		}
+		return "";//getString(firstOkMatch); //$NON-NLS-1$
+	}
+
+	@Override
+	public String getName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public String getSimpleName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public String getDetails() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public void clean() {
+		// TODO Auto-generated method stub
+		
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/functions/preview/Preview.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/annotation/AnnotationManager.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/annotation/AnnotationManager.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/annotation/AnnotationManager.java	(revision 258)
@@ -0,0 +1,302 @@
+package org.txm.annotation;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+
+import org.txm.annotation.repository.AnnotationEffect;
+import org.txm.annotation.repository.AnnotationType;
+import org.txm.annotation.repository.TypedValue;
+import org.txm.annotation.storage.temporary.TemporaryAnnotationManager;
+import org.txm.functions.ProgressWatcher;
+import org.txm.searchengine.cqp.corpus.MainCorpus;
+import org.txm.searchengine.cqp.corpus.query.Match;
+import org.txm.utils.logger.Log;
+
+/**
+ * Manage annotations and is able to return annotation saved in JPA temporarythe CQP corpus
+ * 
+ * @author mdecorde
+ *
+ */
+public class AnnotationManager {
+
+	MainCorpus corpus;
+	TemporaryAnnotationManager tempManager;
+	CQPAnnotationManager cqpManager;
+
+	public AnnotationManager(MainCorpus mainCorpus){
+		this.corpus = mainCorpus;
+		tempManager = new TemporaryAnnotationManager(mainCorpus);
+		cqpManager = new CQPAnnotationManager(mainCorpus);
+	}
+
+	public TemporaryAnnotationManager getTemporaryManager(){
+		return tempManager;
+	}
+	
+	public CQPAnnotationManager getCQPManager(){
+		return cqpManager;
+	}
+	
+	public boolean saveAnnotations() throws Exception{
+		List<Annotation> annots = tempManager.getAnnotations();
+		if (annots.isEmpty()) {
+			System.out.println("No annotation to save. Aborting.");
+			return true;
+		}
+
+		AnnotationWriter writer = new AnnotationWriter(corpus);
+		if (writer.writeAnnotations(annots)) {
+			Log.info("Annotations succesfully written. Deleting temporary annotations...");
+			tempManager.deleteAnnotations();
+
+			return true;
+		}
+		return false;
+	}
+
+	public boolean exportAnnotationsToSyMoGIH(File resultZipFile) throws Exception{
+		AnnotationWriter writer = new AnnotationWriter(corpus);
+		
+		if (writer.writeAnnotationsInStandoff(resultZipFile)) {
+			Log.info("Annotations succesfully written in "+resultZipFile);
+			return true;
+		}
+		return false;
+	}
+	
+	//TODO: not ended?
+	/**
+	 * Deletes the annotations stored in the temporary annotation manager
+	 * @param type
+	 * @param job
+	 * @return
+	 * @throws Exception
+	 */
+	public boolean deleteAnnotations(AnnotationType type, ProgressWatcher job) throws Exception {
+		List<Annotation> temporaryAnnotations = null;
+		List<Annotation> cqpAnnotations = null;
+		try {
+			temporaryAnnotations = tempManager.getAnnotations(type);
+			tempManager.getEntityManager().getTransaction().begin();
+			for (Annotation a : temporaryAnnotations){
+				if (job != null && job.isCanceled()) {
+					System.out.println("Delete annotation canceled.");
+					return false;
+				}
+				tempManager.deleteAnnotation(type, a.getStart(), a.getEnd());
+			}
+			tempManager.getEntityManager().getTransaction().commit();
+			
+			cqpAnnotations = cqpManager.getAnnotations(type);
+			tempManager.getEntityManager().getTransaction().begin();
+			for (Annotation a : cqpAnnotations) {
+				if (job != null && job.isCanceled()) {
+					System.out.println("Delete annotation canceled.");
+					return false;
+				}
+				String value = cqpManager.getCQPAnnotationValue(a.getStart(), a.getEnd(), type);
+				if (value != null) {
+					tempManager.createAnnotationNoCommit(type, new TypedValue("#del", "#del", type.getId()),  a.getStart(), a.getEnd());
+				} else {
+					tempManager.deleteAnnotationNoCommit(type, a.getStart(), a.getEnd());
+				}
+			}
+			tempManager.getEntityManager().getTransaction().commit();
+		} catch(Exception e) {
+			e.printStackTrace();
+			return false;
+		}
+		return true;
+	}
+	
+	public boolean deleteAnnotations(AnnotationType type, List<Match> matches, ProgressWatcher job) throws Exception {
+		try {
+			tempManager.getEntityManager().getTransaction().begin();
+			for (Match m : matches) {
+				if (job != null && job.isCanceled()) {
+					System.out.println("Delete annotation canceled.");
+					return false;
+				}
+				
+				String value = cqpManager.getCQPAnnotationValue(m.getStart(), m.getEnd(), type);
+
+				if (value != null) {
+					tempManager.createAnnotationNoCommit(type, new TypedValue("#del", "#del", type.getId()),  m.getStart(), m.getEnd());
+				} else {
+					tempManager.deleteAnnotationNoCommit(type, m.getStart(), m.getEnd());
+				}
+			}
+			tempManager.getEntityManager().getTransaction().commit();
+		} catch (Exception e) {
+			e.printStackTrace();
+			return false;
+		}
+		return true;
+	}
+
+	/**
+	 * Returns the annotation saved in the temporary database and in the CQP corpus indexes
+	 * 
+	 * CQP Annotations must be shadowed by temporary annotations of the same type and positions
+	 */
+	public List<Annotation> getAnnotationsForMatches(AnnotationType type, List<Match> matches, boolean overlap) {
+		List<Annotation> temporaryAnnotations = null;
+		List<Annotation> resultAnnotations = new ArrayList<Annotation>();
+		try {
+			temporaryAnnotations = tempManager.getAnnotations(type, matches, null, false, overlap);
+			temporaryAnnotations = tempManager.getAnnotationsForMatches(matches, temporaryAnnotations, overlap);
+			
+			List<Annotation> cqpAnnotations = cqpManager.getAnnotationsForMatches(matches, type, overlap);
+
+		//	System.out.println("Temporary annotations: "+temporaryAnnotations);
+		//	System.out.println("CQP annotations: "+cqpAnnotations);
+			if (cqpAnnotations.size() != matches.size() || temporaryAnnotations.size() != matches.size()) {
+				System.out.println("ERROR in getAnnotationsForMatches methods! ");
+				return new ArrayList<Annotation>(matches.size());
+			}
+			// merge the 2 results
+			for (int i = 0 ; i < matches.size() ; i++) {
+				if (cqpAnnotations.get(i) == null && temporaryAnnotations.get(i) == null) {
+					resultAnnotations.add(null);
+				} else if (temporaryAnnotations.get(i) != null) {
+					resultAnnotations.add(temporaryAnnotations.get(i));
+				} else if (cqpAnnotations.get(i) != null) {
+					resultAnnotations.add(cqpAnnotations.get(i));
+				} else {
+					resultAnnotations.add(null);
+				}
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+			return new ArrayList<Annotation>(matches.size());
+		}
+		return resultAnnotations;
+	}
+
+	public void clearInstance() {
+		try {
+			tempManager.close();
+		} catch(Exception e) {
+			System.out.println("Fail to clear AnnotationManager instance: "+e);
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+	}
+
+	public void checkData() {
+		try {
+			tempManager.checkData();
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+	}
+
+	public boolean hasChanges() {
+		return tempManager.hasChanges();
+	}
+
+	/**
+	 * 
+	 * @param annotSelectedType not null
+	 * @param annotSelectedTypedValue not null
+	 * @param matches not null
+	 * @param job may be null
+	 * @return
+	 */
+	public HashMap<Match,List<Annotation>> createAnnotations(AnnotationType annotSelectedType,
+			TypedValue annotSelectedTypedValue, List<Match> matches, ProgressWatcher job) {
+
+		HashMap<Match,List<Annotation>> allAnnotationsThatCollides = new HashMap<Match, List<Annotation>>();
+		tempManager.getEntityManager().getTransaction().begin(); // warning
+		for (Match match : matches) {
+			allAnnotationsThatCollides.put(match, new ArrayList<Annotation>());
+			
+			if (job != null && job.isCanceled()) { // check if user canceled the job
+				System.out.println("Affect annotation canceled.");
+				return null;
+			}
+			
+			try {
+				List<Annotation> cqpAnnotations = null;
+				if (annotSelectedType.getEffect().equals(AnnotationEffect.SEGMENT)) {
+					cqpAnnotations = cqpManager.getAnnotations(null, match, null, true); // get all annotations
+					// remove A)the wrapping annotations and B) the annotation with same type and same positions
+					for (int i = 0 ; i < cqpAnnotations.size() ; i++) {
+						Annotation a = cqpAnnotations.get(i);
+
+						// exact match + exact type
+						if (a.getType().equals(annotSelectedType.getId()) && a.getStart() == match.getStart() && a.getEnd() == match.getEnd()) {
+							cqpAnnotations.remove(i);
+							i--;
+						} else if (!a.getType().equals(annotSelectedType.getId()) && (// different type and inner or outer wrap
+								(a.getStart() <= match.getStart() && match.getEnd() <= a.getEnd()) ||
+								(match.getStart() <= a.getStart() && a.getEnd() <= match.getEnd())
+								)) {
+							cqpAnnotations.remove(i);
+							i--;
+						}
+					}
+				} else {
+					// no need to test collision (AnnotationType=TOKEN)
+					cqpAnnotations = new ArrayList<Annotation>();
+				}
+				
+				if (cqpAnnotations.size() > 0) {
+					allAnnotationsThatCollides.get(match).addAll(cqpAnnotations);
+					continue; // don't create annotation, process next match
+				} else { // test with temporary annotation manager 
+					List<Annotation> tempAnnotations = null;
+					if (match.getTarget() >= 0) { // the @ operator has been used, annotate only the @position
+						tempAnnotations = tempManager.createAnnotationNoCommit(annotSelectedType, annotSelectedTypedValue, match.getTarget(), match.getTarget());
+					} else {
+						tempAnnotations = tempManager.createAnnotationNoCommit(annotSelectedType, annotSelectedTypedValue, match.getStart(), match.getEnd());
+					}
+					if (tempAnnotations.size() > 0)
+						allAnnotationsThatCollides.get(match).addAll(tempAnnotations);
+				}
+			} catch (Exception e) {
+				Log.printStackTrace(e);
+				System.out.println("Error during annotation creation: "+e);
+			}
+			
+			if (allAnnotationsThatCollides.get(match).size() == 0) allAnnotationsThatCollides.remove(match); // keep only colision lists
+		}
+		tempManager.getEntityManager().getTransaction().commit(); // warning
+		// test if there are CQP annotations for the 
+		return allAnnotationsThatCollides;
+	}
+
+	public List<Annotation> getAnnotations(AnnotationType type, int start, int end, boolean overlap) {
+		List<Annotation> temporaryAnnotations = null;
+		List<Annotation> cqpAnnotations = null;
+		try {
+			temporaryAnnotations = tempManager.getAnnotations(type, Arrays.asList(new Match(start, end)), null, false, overlap);
+			cqpAnnotations = cqpManager.getAnnotations(type, start, end, overlap);
+			
+			int i = 0;
+			for (Annotation a : cqpAnnotations) {
+				while (temporaryAnnotations.get(i).getStart() < a.getStart()) {
+					i++;
+				}
+				temporaryAnnotations.add(i, a);
+			}
+		} catch(Exception e) {
+			
+		}
+		return temporaryAnnotations;
+	}
+	
+	public List<Annotation> getAnnotations(AnnotationType type, int i, int j) {
+		return getAnnotations(type, i, j, false);
+	}
+
+	public void closeAll() {
+		Log.info("Closing annotation manager of "+corpus);
+		tempManager.close();
+		cqpManager.close();
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/annotation/AnnotationManager.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/annotation/AnnotationPK.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/annotation/AnnotationPK.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/annotation/AnnotationPK.java	(revision 258)
@@ -0,0 +1,66 @@
+package org.txm.annotation;
+
+import java.io.Serializable;
+
+import javax.persistence.*;
+
+@Embeddable
+public class AnnotationPK implements Serializable {
+
+	private static final long serialVersionUID = -2360693333015275209L;
+
+	//corresponding to the start and end positions (in the corpus)
+	private int startpos;
+	private int endpos;
+	private String refType;
+
+	public AnnotationPK() {
+	}
+
+	public AnnotationPK(int start, int end, String refType) {
+		this.startpos = start;
+		this.endpos = end;
+		this.refType = refType;
+	}
+
+	public void setRefType(String refType) {
+		this.refType = refType;
+	}
+
+	public void setStartPosition(int start) {
+		this.startpos = start;
+	}
+
+	public void setEndPosition(int end) {
+		this.endpos = end;
+	}
+
+	public String getRefType() {
+		return refType;
+	}
+
+	public int getStartPosition() {
+		return startpos;
+	}
+
+	public int getEndPosition() {
+		return endpos;
+	}
+
+	public boolean equals(Object obj) {
+		if (obj == null) return false;
+		if (obj == this) return true;
+		if (!(obj instanceof AnnotationPK)) return false;
+
+		AnnotationPK other = (AnnotationPK) obj;
+		return startpos == other.startpos && endpos == other.endpos&& refType.equals(other.refType);
+	}
+
+	public int hashCode() {
+		return refType.hashCode()+startpos+endpos;
+	}
+
+	public String toString() {
+		return getRefType() + "["+getStartPosition()+"-"+getEndPosition()+"]" ;
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/annotation/AnnotationPK.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/annotation/conversion/XMLTXMFileRuledConversion.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/annotation/conversion/XMLTXMFileRuledConversion.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/annotation/conversion/XMLTXMFileRuledConversion.java	(revision 258)
@@ -0,0 +1,169 @@
+package org.txm.annotation.conversion;
+
+import java.io.File;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.regex.Pattern;
+
+import javax.xml.stream.XMLStreamException;
+
+import org.txm.importer.StaxIdentityParser;
+
+public class XMLTXMFileRuledConversion extends StaxIdentityParser {
+
+	protected LinkedHashMap<Pattern, String> rules = new LinkedHashMap<Pattern, String>();
+	protected String oldType;
+	protected String newType;
+
+	public static final String DELETE = "supprimer";
+	public static final String COPY = "copier";
+	public static final String ABANDON = "abandon";
+	HashSet<String> noMatchValues = new HashSet<String>();
+	
+	public XMLTXMFileRuledConversion(File infile, LinkedHashMap<Pattern, String> rules, String oldType, String newType, String mode) {
+		super(infile);
+		this.rules = rules;
+		this.oldType = oldType;
+		this.newType = newType;
+		
+		this.mode = mode;
+		
+		if (!this.newType.startsWith("#")) this.newType = "#"+this.newType;
+		if (!this.oldType.startsWith("#")) this.oldType = "#"+this.oldType;
+	}
+
+	boolean inW = false, inAna = false, inForm;
+	LinkedHashMap<String, String> anaValues = new LinkedHashMap<String, String>();
+	LinkedHashMap<String, String> anaResps = new LinkedHashMap<String, String>();
+	String typeName = null;
+	String respName = null;
+	String formValue, typeValue = null;
+	private Object mode;
+
+	@Override
+	public void processStartElement() {
+		if (!inW) super.processStartElement(); // don't write W content
+
+		if (localname.equals("w")) {
+			inW = true;
+			anaValues.clear();
+			anaResps.clear();
+
+			//initialize the new type to a empty value in case there is transformation rule
+			anaValues.put(newType, "");
+			anaResps.put(newType, "#txm_recode");
+		} else if (localname.equals("ana")) {
+			inAna = true;
+			typeName = parser.getAttributeValue(null, "type");
+			respName = parser.getAttributeValue(null, "resp");
+			anaResps.put(typeName, respName);
+			//if (typeName != null) typeName = typeName.substring(1); // remove #
+			typeValue = "";
+		} else if (localname.equals("form")) {
+			inForm = true;
+			formValue = "";
+		} 
+	}
+
+	@Override
+	public void processCharacters() {
+		if (inW && inAna) typeValue+=parser.getText();
+		else if (inW && inForm) formValue+=parser.getText();
+		else super.processCharacters();
+	}
+
+	@Override
+	public void processEndElement() {
+		if (localname.equals("w")) {
+			inW = false;
+
+			// write W content
+			try {
+				// get the value to test
+				String value = null;
+				if (oldType.equals("word")) {
+					value = formValue;
+				} else {
+					value = anaValues.get(oldType);
+				}
+				
+				if (newType.equals("word")) { // update form property
+					updateFormValueIfMatch(value);
+				} else { // update another word property
+					if (value != null) {
+						updateAnaValuesIfMatch(value);
+					}
+				}
+				
+				// write the word element
+				writer.writeStartElement("txm:form");
+				writer.writeCharacters(formValue);
+				writer.writeEndElement();
+
+				for (String k : anaValues.keySet()) {
+					String resp = anaResps.get(k);
+					if (resp == null) resp = "#txm_recode";
+
+					writer.writeStartElement("txm:ana");
+					writer.writeAttribute("resp", resp);
+					writer.writeAttribute("type", k);
+					writer.writeCharacters(anaValues.get(k));
+					writer.writeEndElement();
+				}
+			} catch (XMLStreamException e) {
+				e.printStackTrace();
+			}
+		} else if (localname.equals("ana")) {
+			anaValues.put(typeName, typeValue);
+			inAna = false;
+		} else if (localname.equals("form")) {
+			inForm = false;
+		} 
+
+		if (!inW) super.processEndElement(); // don't write W content
+	}
+
+	protected void updateFormValueIfMatch(String value) {
+		for (Pattern rule : rules.keySet()) {
+			if (rule.matcher(value).matches()) {
+				formValue = rules.get(rule);
+				return; // ok stop
+			}
+		}
+			
+		noMatchValues.add(value);
+	}
+
+	protected void updateAnaValuesIfMatch(String value) {
+		for (Pattern rule : rules.keySet()) {
+			if (rule.matcher(value).matches()) {
+				value = rules.get(rule);
+				anaValues.put(newType, value); // do a replace if newType == oldType :-)
+				anaResps.put(newType, "#txm_recode");
+				return;
+			}
+		}
+		if (DELETE.equals(mode)) anaValues.put(newType, ""); // do a replace if newType == oldType :-)
+		else if (ABANDON.equals(mode)) anaValues.put(newType, "ERROR("+value+")"); // do a replace if newType == oldType :-)
+		
+		noMatchValues.add(value);
+	}
+	
+	public HashSet<String> getNoMatchValues() {
+		return noMatchValues;
+	}
+
+	public static void main(String args[]) {
+		File xmlFile = new File("/home/mdecorde/TXM/corpora/XTZTEXTUALPLANS/txm/XTZTEXTUALPLANS/test.xml");
+		File tmpFile = new File("/home/mdecorde/TXM/corpora/XTZTEXTUALPLANS/txm/XTZTEXTUALPLANS/test-o.xml");
+		String oldType = "type";
+		String newType = "type";
+		LinkedHashMap<Pattern, String> rules = new LinkedHashMap<Pattern, String>();
+		rules.put(Pattern.compile("w"), "WORD");
+		rules.put(Pattern.compile("x.+"), "XWORD");
+		rules.put(Pattern.compile("y"), "YWORD");
+		rules.put(Pattern.compile("y.*"), "YMULTIWORD");
+		XMLTXMFileRuledConversion converter = new XMLTXMFileRuledConversion(xmlFile, rules, oldType, newType, ABANDON);
+		System.out.println(converter.process(tmpFile));
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/annotation/conversion/XMLTXMFileRuledConversion.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/annotation/conversion/CorpusRuledConvertion.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/annotation/conversion/CorpusRuledConvertion.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/annotation/conversion/CorpusRuledConvertion.java	(revision 258)
@@ -0,0 +1,117 @@
+package org.txm.annotation.conversion;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.regex.Pattern;
+
+import org.apache.commons.lang.StringUtils;
+import org.txm.Toolbox;
+import org.txm.searchengine.cqp.corpus.MainCorpus;
+import org.txm.stat.utils.ConsoleProgressBar;
+import org.txm.utils.io.IOUtils;
+
+public class CorpusRuledConvertion {
+
+	LinkedHashMap<Pattern, String> rules = new LinkedHashMap<Pattern, String>();
+	private String oldType;
+	private String newType;
+
+	public CorpusRuledConvertion(File conversionFile, String oldType, String newType) throws IOException {
+		this.oldType = oldType;
+		this.newType = newType;
+
+		BufferedReader reader = IOUtils.getReader(conversionFile);
+		String line = reader.readLine();
+		while (line != null) {
+			int idx = line.indexOf("\t");
+			if (idx > 0) {
+				String k = line.substring(0, idx);
+				String v = line.substring(idx +1);
+				rules.put(Pattern.compile(k), v);
+			}
+			line = reader.readLine();
+		}
+
+		System.out.println("Conversion rules: "+rules);
+	}
+
+	public CorpusRuledConvertion(LinkedHashMap<Pattern, String> rules,
+			String oldType, String newType) {
+		this.oldType = oldType;
+		this.newType = newType;
+
+		this.rules = rules;
+	}
+
+	public boolean process(MainCorpus corpus) {
+		File binaryCorpusDirectory = corpus.getBaseDirectory();
+		File txmDirectory = new File(binaryCorpusDirectory, "txm");
+		if (!txmDirectory.exists()) {
+			System.out.println("'txm' directory not found in "+binaryCorpusDirectory.getAbsolutePath());
+			return false;
+		}
+		File txmCorpusDirectory = new File(txmDirectory, corpus.getName());
+		if (!txmCorpusDirectory.exists()) {
+			System.out.println("'"+corpus.getName()+"' corpus directory not found in "+txmDirectory.getAbsolutePath());
+			return false;
+		}
+		File[] files = txmCorpusDirectory.listFiles();
+		if (files == null || files.length == 0) {
+			System.out.println("No file in "+txmCorpusDirectory);
+			return false;
+		}
+		ConsoleProgressBar cpb = new ConsoleProgressBar(files.length);
+		for (File xmlFile : files) {
+			cpb.tick();
+			if (xmlFile.isDirectory()) continue;
+			if (xmlFile.isHidden()) continue;
+			if (!xmlFile.getName().endsWith(".xml")) continue;
+
+			File tmpFile = new File(xmlFile.getParentFile(), "tmp_"+xmlFile.getName());
+			XMLTXMFileRuledConversion converter = new XMLTXMFileRuledConversion(xmlFile, rules, oldType, newType, XMLTXMFileRuledConversion.ABANDON);
+			if (converter.process(tmpFile)) {
+				xmlFile.delete();
+				//				try {
+				//					FileCopy.copy(tmpFile, new File("/tmp/"+tmpFile.getName()));
+				//				} catch (IOException e) {
+				//					// TODO Auto-generated catch block
+				//					e.printStackTrace();
+				//				}
+
+				HashSet<String> errors = converter.getNoMatchValues();
+				if (errors.size() > 0) {
+					System.out.println("Some values did not match rule:");
+					int i = 0;
+					for (String error : errors) {
+						System.out.println("\t"+error);
+						if (i >= 10) break;
+					}
+					if (errors.size() > 10) {
+						try {
+							File errorFile = new File(Toolbox.getParam(Toolbox.USER_TXM_HOME), "errors.txt");
+							IOUtils.write(errorFile, StringUtils.join(errors, "\t"));
+							System.out.println("More errors, see "+errorFile.getAbsolutePath());
+						} catch (Exception e) {
+							e.printStackTrace();
+						}
+					}
+					return false;
+				}
+
+				tmpFile.renameTo(xmlFile);
+				if (tmpFile.exists()) {
+					System.out.println("Could not replace original file with the result file. "+xmlFile+ " with "+tmpFile);
+					return false;
+				}
+			} else {
+				System.out.println("Fail to process "+xmlFile);
+				return false;
+			}
+		}
+		System.out.println(); // end of ConsoleProgressBar
+		return true;
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/annotation/conversion/CorpusRuledConvertion.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/annotation/AnnotationSyMoGIHWriter.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/annotation/AnnotationSyMoGIHWriter.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/annotation/AnnotationSyMoGIHWriter.java	(revision 258)
@@ -0,0 +1,365 @@
+package org.txm.annotation;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.txm.annotation.repository.AnnotationType;
+import org.txm.importer.StaxIdentityParser;
+
+/**
+ * The Class AnnotationStandoffInjector.
+ *
+ * @author sgedzelman, mdecorde
+ *
+ * copy a XML-TXM file without annotations elements
+ * and creates annotations XML-TEI-SymoGIH annotation files for each annotation author
+ * 
+ */
+public class AnnotationSyMoGIHWriter extends StaxIdentityParser {
+
+	File xmlStandOffDirectory;
+	boolean debug = false;
+
+	String currentRef ;
+	String currentAuthor ;
+	String currentDate;
+	String currentStartPos ;
+	String currentEndPos ;
+	//read xmlFile, to find annotations and update/write to xmlstandofffile
+	//order annotations by annotator
+	////// order annotations by date
+	HashSet<String> types = new HashSet<String>();
+	ArrayList<String> positions;
+	HashMap<String, ArrayList<String>> annotationsPositions;
+	XMLStreamWriter currentWriter;
+	XMLStreamWriter standoffWriter;
+	String currentType;
+	boolean startAnnotation = false;
+	private String filename;
+
+	// author -> date -> annotation_values
+	HashMap<String, HashMap<String, ArrayList<String[]>>> allannotations = new HashMap<String, HashMap<String, ArrayList<String[]>>>();
+	HashMap<String, HashMap<String, ArrayList<ArrayList<String>>>> allannotationspositions = new HashMap<String, HashMap<String, ArrayList<ArrayList<String>>>>();
+	private String textid;
+
+	/**
+	 * 
+	 * @param xmlStandOffFile
+	 * @param tokenAnnotations 
+	 * @param annotationsToAddByStartPos
+	 * @param annotationsToAddByEndPos
+	 * @param corpus_start_position
+	 * @param debug
+	 * @throws MalformedURLException
+	 */
+	public AnnotationSyMoGIHWriter(String textid, File xmlFile, File xmlStandOffDirectory, List<AnnotationType> types, boolean debug) throws MalformedURLException {
+		super(xmlFile.toURI().toURL()); // init reader and writer
+		this.textid = textid;
+		this.filename = xmlFile.getName();
+		this.debug = debug;
+		this.xmlStandOffDirectory = xmlStandOffDirectory;
+		factory = XMLInputFactory.newInstance();
+		annotationsPositions = new HashMap<String, ArrayList<String>>();
+		//System.out.println("AnnotationStandoff -  ");
+		for (AnnotationType type : types){
+			this.types.add(type.getId()); //.getName().toLowerCase());
+			//System.out.println("Annotation Types in TXM : "+type.getName().toLowerCase() +" vs "+ type.getId());
+		}
+	}
+
+	/*<TEI xmlns="http://www.tei-c.org/ns/1.0">
+    <teiHeader>
+        <fileDesc>
+            <titleStmt>
+                <title>Title</title>
+            </titleStmt>
+            <publicationStmt>
+                <p>Publication Information</p>
+            </publicationStmt>
+            <sourceDesc>
+                <p>Ce document permet l'annotation sémantique de tous les textes concernant l'association avec des unités de connaissance</p>
+            </sourceDesc>
+        </fileDesc>
+    </teiHeader>
+    <text>
+        <body>
+            <div>
+                <div>
+                    <!-- La date dans le header indique la date d'annotation -->
+                    <head>
+                        <date type="annotation_date" when="2016-06-16"/>
+                    </head>
+                    <span type="identification d'entités nommées" ana="CoAc56389" 
+                          target="#w_article_baip_1254-0714_1850_num_01_005_974_tei_2152 
+                                  #w_article_baip_1254-0714_1850_num_01_005_974_tei_2153 
+                                  #w_article_baip_1254-0714_1850_num_01_005_974_tei_2154 
+                                  #w_article_baip_1254-0714_1850_num_01_005_974_tei_2155 
+                                  #w_article_baip_1254-0714_1850_num_01_005_974_tei_2156" />
+                </div>
+            </div>
+         </body>
+      </text>
+ </TEI>*/
+
+	protected void processStartElement() {
+		//<coac author="gazelledess" ref="CoAc397" start="5" end="5">
+
+		/*if(localname.startsWith("actr")){
+			System.out.println("Check existence of actr in Corpus !!!! "+localname);
+		}*/
+		boolean foundAnnot = false;
+
+		
+		if (types.contains(localname) && parser.getPrefix().equals("txm")) { // don't write txm annotation elements
+			//System.out.println(" START "+ localname);
+			foundAnnot = true;
+			currentType = localname;
+			//<txm:actr author="gazelledess" ref="PhileasFogg" date="2016-09-05" start="56" end="57">
+			currentAuthor = parser.getAttributeValue(null, "author");
+			currentRef = parser.getAttributeValue(null, "ref");
+			currentStartPos = parser.getAttributeValue(null, "start");
+			currentEndPos = parser.getAttributeValue(null, "end");
+			currentDate = parser.getAttributeValue(null, "date");
+			//annotation is here
+			startAnnotation = true;
+			positions = new ArrayList<String>();
+			annotationsPositions.put(currentType, positions);
+
+			// initialize allannotations
+			if (!allannotations.containsKey(currentAuthor)) {
+				allannotations.put(currentAuthor, new HashMap<String, ArrayList<String[]>>());
+				allannotationspositions.put(currentAuthor, new HashMap<String, ArrayList<ArrayList<String>>>());
+			}
+			HashMap<String, ArrayList<String[]>> authorsAnnotation = allannotations.get(currentAuthor);
+			HashMap<String, ArrayList<ArrayList<String>>> authorsAnnotationPositions = allannotationspositions.get(currentAuthor);
+			if (!authorsAnnotation.containsKey(currentDate)) {
+				authorsAnnotation.put(currentDate, new ArrayList<String[]>());
+				authorsAnnotationPositions.put(currentDate, new ArrayList<ArrayList<String>>());
+			}
+
+			storeAnnotation();
+		}
+
+		if (!foundAnnot) {
+			super.processStartElement(); /// continue writing in file all elements, except the tags that are now in stand-off files
+
+			// get words ids of the current annotations
+			if (localname.equals("w") && startAnnotation) {
+				String id = parser.getAttributeValue(null, "id");
+				for (String typeIn : annotationsPositions.keySet()) {
+					positions = annotationsPositions.get(typeIn);
+					positions.add(id);
+					//System.out.println("Positions of w id="+posW+" for ["+typeIn+"] ");
+				}
+			}
+		}
+	}
+
+
+	/**
+	 * ends the current author stand-off file
+	 * @param currentWriter
+	 */
+	private void writeEndStandOffFile(XMLStreamWriter currentWriter){
+		//System.out.println("writeEndStandOffFile ...");
+
+		try {
+			currentWriter.writeEndElement(); 
+			currentWriter.writeEndDocument();
+
+			currentWriter.flush();
+			currentWriter.close();
+		} catch (XMLStreamException e) {
+			e.printStackTrace();
+		}
+
+	}
+
+	/**
+	 * Create the stand-off file for one author
+	 * @param file
+	 * @return
+	 */
+	private XMLStreamWriter writeStartStandOffFile(File file){
+		//System.out.println("writeStartStandOffFile ...");
+
+		String ns = "http://www.tei-c.org/ns/1.0";    
+		XMLOutputFactory output = XMLOutputFactory.newInstance();
+		XMLStreamWriter writer = null ;
+		try {
+			writer = output.createXMLStreamWriter(new FileWriter(file));
+			writer.writeStartDocument();
+			writer.setPrefix("tei", ns);
+			writer.setDefaultNamespace(ns);
+
+			writer.writeStartElement("TEI");
+
+			writer.writeStartElement("teiHeader");
+			writer.writeStartElement("fileDesc");
+
+			writer.writeStartElement("titleStmt");
+			writer.writeStartElement("title");
+			writer.writeCharacters(textid); 
+			writer.writeEndElement(); // title
+			writer.writeEndElement(); // titleStmt
+
+			writer.writeStartElement("publicationStmt");
+			writer.writeStartElement("p");
+			writer.writeCharacters("PUBLICATION INFO à renseigner");
+			writer.writeEndElement(); // p
+			writer.writeEndElement(); // publicationStmt
+
+			writer.writeStartElement("sourceDesc");
+			writer.writeStartElement("p");
+			writer.writeCharacters("Ce document permet l'annotation sémantique de tous les textes, par auteur");
+			writer.writeEndElement(); // p
+			writer.writeEndElement(); // sourceDesc
+
+			writer.writeEndElement(); // </fileDesc>
+			writer.writeStartElement("encodingDesc");
+			writer.writeStartElement("projectDesc");
+			writer.writeStartElement("p");
+			writer.writeCharacters("Annotations created by "+currentAuthor+", for the use in Symogih XML platform");
+			writer.writeEndElement(); // p
+			writer.writeEndElement(); // </projectDesc>
+			writer.writeEndElement(); // </encodingDesc>
+			writer.writeEndElement(); // </teiHeader>
+
+
+			writer.writeStartElement("text");
+			writer.writeStartElement("body");
+			writer.writeCharacters("\n");
+			writer.writeStartElement("div");
+			writer.writeCharacters("\n");
+		} catch (XMLStreamException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (IOException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		return writer;
+	}
+
+	private void storeAnnotation() {
+		allannotations.get(currentAuthor).get(currentDate).add(new String[]{currentDate, currentRef, currentType});
+	}
+
+	private void storeAnnotationPositions() {
+		allannotationspositions.get(currentAuthor).get(currentDate).add(positions);
+	}
+
+	/**
+	 * write stand-off annotation
+	 */
+	private void writeStartAnnotationToStandoffFile(String[] data, ArrayList<String> positions) {
+		//System.out.println("writeStartAnnotationToStandoffFile ...");
+		try {
+			currentWriter.writeStartElement("span");
+			currentWriter.writeAttribute("type","named_entities_identifications");
+			currentWriter.writeAttribute("ana", data[1]);
+			StringBuffer listWids = new StringBuffer();
+			for (String posW : positions) {
+				listWids.append("#"+posW+" ");
+			}
+			currentWriter.writeAttribute("target", listWids.toString().trim());
+			currentWriter.writeComment("type="+data[2]);
+			currentWriter.writeEndElement(); // span
+			currentWriter.writeCharacters("\n");
+
+		} catch (XMLStreamException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+	}
+
+	protected void processEndElement() {
+		boolean foundAnnot = false;
+		if (types.contains(localname) && parser.getPrefix().equals("txm")) { // skip annotation end element
+			//System.out.println(" END "+ localname);
+			foundAnnot = true;
+			//annotation ends here
+			storeAnnotationPositions();
+
+			if (annotationsPositions.containsKey(localname)) {
+				annotationsPositions.remove(localname);
+			}
+
+			startAnnotation = false;
+		}
+
+		if (!foundAnnot) {
+			if (localname.equals("TEI")) {
+				try {
+					for (String author : allannotations.keySet()) {
+						System.out.println("    author="+author);
+						File currentXmlFile = new File(xmlStandOffDirectory, filename.substring(0, filename.length()-4)+"_"+currentAuthor+"_annotations.xml");
+
+						// write start of the stand-off file
+						currentWriter = writeStartStandOffFile(currentXmlFile);
+
+						// write annotations grouped per date
+						HashMap<String, ArrayList<String[]>> dates = allannotations.get(author);
+						HashMap<String, ArrayList<ArrayList<String>>> datesPositions = allannotationspositions.get(author);
+						for (String date : datesPositions.keySet()) {
+							ArrayList<String[]> datas = dates.get(date);
+							ArrayList<ArrayList<String>> positions = datesPositions.get(date);
+
+							currentWriter.writeStartElement("div");
+							currentWriter.writeCharacters("\n");
+							currentWriter.writeStartElement("head");
+							currentWriter.writeStartElement("date");
+							currentWriter.writeAttribute("type","annotation_date");
+							currentWriter.writeAttribute("when", date); 
+							currentWriter.writeEndElement(); // date
+							currentWriter.writeEndElement(); // head
+							currentWriter.writeCharacters("\n");
+
+							for (int i = 0 ; i < datas.size() ; i++) {
+								writeStartAnnotationToStandoffFile(datas.get(i), positions.get(i));
+							}
+
+							currentWriter.writeEndElement(); // div
+							currentWriter.writeCharacters("\n");
+						}
+
+						// write the end of the stand-off file
+						writeEndStandOffFile(currentWriter);
+					}
+				}
+				catch(Exception e){
+					System.out.println("Current writer "+currentWriter);
+				}
+			}
+			super.processEndElement();
+		}
+	}
+
+	public static void main(String strs[]){
+		File xmlFile = new File("/home/mdecorde/TXM/corpora/TDM80J/txm/TDM80J", "tdm80j.xml");
+		File outfile = new File(xmlFile.getParentFile(), "tdm80j-tei.xml");
+
+		File xmlStandOffDirectory = xmlFile.getParentFile();
+		List<AnnotationType> types = new ArrayList<AnnotationType>();
+		types.add(new AnnotationType("local","actr_id", "actr"));
+		AnnotationSyMoGIHWriter annotStdff;
+		try {
+			annotStdff = new AnnotationSyMoGIHWriter("TDBM80J", xmlFile, xmlStandOffDirectory, types, true);
+			annotStdff.process(outfile);
+		} catch (MalformedURLException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+	}
+}
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/java/org/txm/annotation/AnnotationSyMoGIHWriter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/annotation/AnnotationWriter.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/annotation/AnnotationWriter.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/annotation/AnnotationWriter.java	(revision 258)
@@ -0,0 +1,260 @@
+package org.txm.annotation;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.logging.Level;
+
+import org.apache.commons.lang.StringUtils;
+import org.txm.Toolbox;
+import org.txm.annotation.repository.AnnotationEffect;
+import org.txm.annotation.repository.AnnotationType;
+import org.txm.annotation.repository.KnowledgeRepository;
+import org.txm.importer.ValidateXml;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.clientExceptions.InvalidCqpIdException;
+import org.txm.searchengine.cqp.corpus.MainCorpus;
+import org.txm.searchengine.cqp.serverException.CqiServerError;
+import org.txm.stat.utils.ConsoleProgressBar;
+import org.txm.utils.DeleteDir;
+import org.txm.utils.logger.Log;
+import org.txm.utils.zip.Zip;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+
+
+public class AnnotationWriter {
+
+	MainCorpus corpus;
+	private List<AnnotationType> types;
+	private KnowledgeRepository defaultKR;
+
+	public AnnotationWriter(MainCorpus corpus){
+		this.corpus = corpus;
+		defaultKR = corpus.getKnowledgeRepository(corpus.getKnowledgeRepositoryNames().get(0));
+		types = defaultKR.getAllAnnotationTypes();
+		
+	}
+
+	/**
+	 * process a text to build standoff files
+	 * 
+	 * @param textid
+	 * @param currentXMLFile
+	 * @param currentXMLStandoffFile
+	 * @param xmlStandOffDirectory
+	 * @return
+	 * @throws IOException
+	 * @throws CqiServerError
+	 * @throws CqiClientException
+	 * @throws InvalidCqpIdException
+	 */
+	protected boolean writeTextAnnotationToSyMoGIH(String textid, File currentXMLFile, File currentXMLStandoffFile, File xmlStandOffDirectory) throws IOException, CqiServerError, CqiClientException, InvalidCqpIdException{
+		System.out.println("  text="+textid);
+		boolean show_debug = Log.getLevel().intValue() < Level.WARNING.intValue();
+		
+		AnnotationSyMoGIHWriter annotationstdoff = new AnnotationSyMoGIHWriter(textid, currentXMLFile, xmlStandOffDirectory, types, show_debug);
+		
+		///rather test on the new xml standoff files
+		if (annotationstdoff.process(currentXMLStandoffFile)) {
+			if (ValidateXml.test(currentXMLStandoffFile)) { //TODO ALSO check if annotations are well-written 
+				return true;
+			} else {
+				System.out.println("Error: result file "+currentXMLStandoffFile+" is malformed.");
+			}
+		} else {
+			System.out.println("Error: while processing "+currentXMLStandoffFile+" in standoff dir");
+		}
+		return false;
+		
+	}
+	
+	/**
+	 * Writing annotations in standoff files for each text of the corpus
+	 * 
+	 * @param allCorpusAnnotations
+	 * @return
+	 * @throws IOException
+	 * @throws CqiServerError
+	 * @throws CqiClientException
+	 * @throws InvalidCqpIdException
+	 */
+	public boolean writeAnnotationsInStandoff(File resultZipFile) throws IOException, CqiServerError, CqiClientException, InvalidCqpIdException{
+		
+		List<String> textsIds = corpus.getTextsID();
+		System.out.println("Exporting annotations of "+StringUtils.join(textsIds, ", ")+".");
+
+		File resultDirectory = new File(Toolbox.getParam(Toolbox.USER_TXM_HOME), "results/"+corpus.getName()+"_annotations");
+		DeleteDir.deleteDirectory(resultDirectory);
+		resultDirectory.mkdirs();
+		if (!(resultDirectory.exists() && resultDirectory.canWrite())) {
+			System.out.println("ERROR: could not create/write temporary directory: "+resultDirectory);
+			return false;
+		}
+		
+		File inputDirectory = corpus.getBaseDirectory();
+		File corpusTxmDirectory = new File(inputDirectory, "txm/"+corpus.getName());
+		
+		System.out.println("Writing annotations XML files in "+resultDirectory);
+		for (String textid : textsIds) { 
+			File currentXMLFile = new File(corpusTxmDirectory, textid+".xml");
+			if (!currentXMLFile.exists()) {
+				System.out.println("Error: cannot found XML file for text with id="+textid);
+				return false;
+			}
+			File currentXMLStandoffFile = new File(resultDirectory, textid+".xml"); //To Be Changed ?
+			if (!writeTextAnnotationToSyMoGIH(textid, currentXMLFile, currentXMLStandoffFile, resultDirectory )) {
+						System.out.println("Error while writing annotations of text "+currentXMLStandoffFile);
+						return false;
+			}
+		}
+		
+		Zip.compress(resultDirectory, resultZipFile, new ConsoleProgressBar(1));
+		DeleteDir.deleteDirectory(resultDirectory);
+		
+		System.out.println("Annotations saved in "+resultZipFile.getAbsolutePath());
+		return resultZipFile.exists();
+	}
+	
+	/**
+	 * 
+	 * @param allCorpusAnnotations ordered annotations
+	 * @return
+	 * @throws IOException
+	 * @throws CqiServerError
+	 * @throws CqiClientException
+	 * @throws InvalidCqpIdException
+	 */
+	public boolean writeAnnotations(List<Annotation> allCorpusAnnotations) throws IOException, CqiServerError, CqiClientException, InvalidCqpIdException{
+		//MainCorpus corpus = CorpusManager.getCorpusManager().getCorpus(c.getName());
+		System.out.println("Saving "+allCorpusAnnotations.size()+"annotations...");
+
+		int[] end_limits = corpus.getTextEndLimits();
+		int[] start_limits = corpus.getTextStartLimits();
+		List<String> textsIds = corpus.getTextsID();
+
+		File inputDirectory = corpus.getBaseDirectory();
+		File txmDirectory = new File(inputDirectory, "txm/"+corpus.getName());
+
+		ArrayList<Annotation> textAnnotations = new ArrayList<Annotation>();
+		HashMap<String, ArrayList<Annotation>> annotationsPerTexts = new HashMap<String, ArrayList<Annotation>>();
+
+		int currentText = 0;
+		File currentXMLFile = new File(txmDirectory, textsIds.get(currentText)+".xml");
+
+		//store first text
+		currentXMLFile = new File(txmDirectory, textsIds.get(currentText)+".xml");
+		textAnnotations = new ArrayList<Annotation>();
+		annotationsPerTexts.put(textsIds.get(currentText), textAnnotations);
+
+		// group annotations per text
+		for (Annotation currentAnnot : allCorpusAnnotations) { // parse all annotations
+			//System.out.println(" Annotation: "+currentAnnot);
+			int pos = currentAnnot.getPK().getEndPosition();
+
+			while (pos > end_limits[currentText]) { // while pos is not in the currentText.end 
+				currentText++;
+				currentXMLFile = new File(txmDirectory, textsIds.get(currentText)+".xml");
+				textAnnotations = new ArrayList<Annotation>();
+				annotationsPerTexts.put(textsIds.get(currentText), textAnnotations);
+			}
+
+			textAnnotations.add(currentAnnot);
+		}
+
+		File tmpXMLTXMDirectory = new File(txmDirectory.getAbsolutePath()+"_tmp");
+		DeleteDir.deleteDirectory(tmpXMLTXMDirectory);
+		tmpXMLTXMDirectory.mkdirs();
+		if (!(tmpXMLTXMDirectory.exists() && tmpXMLTXMDirectory.canWrite())) {
+			System.out.println("ERROR: could not create directory: "+tmpXMLTXMDirectory);
+			return false;
+		}
+
+		File previousXMLTXMDirectory = new File(txmDirectory.getAbsolutePath()+"_previous");
+		//DeleteDir.deleteDirectory(tmpXMLTXMDirectory);
+		previousXMLTXMDirectory.mkdirs();
+		if (!(previousXMLTXMDirectory.exists()  && previousXMLTXMDirectory.canWrite())) {
+			System.out.println("ERROR: could not create directory: "+previousXMLTXMDirectory);
+			return false;
+		}
+
+		System.out.println("Annotations grouped per text for "+annotationsPerTexts.size()+" text"+(annotationsPerTexts.size() > 0?"s":""));
+		System.out.println(" - Writing temporary XML files in: "+tmpXMLTXMDirectory);
+		System.out.println(" - Copying previous version of XML files in: "+previousXMLTXMDirectory);
+		// for all annotation PER TEXT, update the XML-TXM files
+		currentText = 0;
+		while (currentText < end_limits.length ) { // end limits : 10, 30, 45, 55, 103
+			currentXMLFile = new File(txmDirectory, textsIds.get(currentText)+".xml");
+			ArrayList<Annotation> allAnnotations = annotationsPerTexts.get(textsIds.get(currentText));
+			if (allAnnotations != null && allAnnotations.size() > 0) {
+				ArrayList<Annotation> allSegmentAnnotations = new ArrayList<Annotation>();
+				ArrayList<Annotation> allTokenAnnotations = new ArrayList<Annotation>();
+
+				KnowledgeRepository defaultKR = corpus.getKnowledgeRepository(corpus.getKnowledgeRepositoryNames().get(0));
+				System.out.println("Using KR="+defaultKR);
+				for (Annotation a : allAnnotations) {
+					AnnotationType type = defaultKR.getType(a.getType());
+					if (type != null) {
+						if (AnnotationEffect.SEGMENT.equals(type.getEffect())) {
+							allSegmentAnnotations.add(a);
+						} else if (AnnotationEffect.TOKEN.equals(type.getEffect())) {
+							allTokenAnnotations.add(a);
+						} else {
+							System.out.println("Annotation "+a+" with type="+a.getType()+" not found in default KR="+defaultKR);
+						}
+					} else {
+						System.out.println("Warning: unknowed type: "+a.getType());
+					}
+				}
+
+				if (!writeAnnotationsInFile(currentXMLFile, start_limits[currentText], 
+						allSegmentAnnotations, allTokenAnnotations, 
+						tmpXMLTXMDirectory, previousXMLTXMDirectory)) {
+					System.out.println("Error while writing annotations of text "+currentXMLFile);
+					return false;
+				}
+			}
+			currentText++;
+		}
+
+		return true;
+	}		
+
+	//writeAnnotationInStandoffFile(currentXMLStandoffFile, allAnnotations, annotator, tmpXMLTXMDirectory, previousXMLTXMDirectory))
+	
+	protected boolean writeAnnotationsInFile(File xmlFile, int text_start_position, 
+			ArrayList<Annotation> segmentAnnotations, ArrayList<Annotation> tokenAnnotations, File tmpXMLTXMDirectory, File previousXMLTXMDirectory) throws CqiClientException, IOException, CqiServerError, InvalidCqpIdException{
+		System.out.println("Writing annotations for text "+xmlFile+" segment annotations="+segmentAnnotations.size()+" token annotations="+tokenAnnotations.size());
+		System.out.println(segmentAnnotations);
+		System.out.println(tokenAnnotations);
+
+		boolean show_debug = Log.getLevel().intValue() < Level.WARNING.intValue();
+		AnnotationInjector annotationInjector = new AnnotationInjector(xmlFile, segmentAnnotations, tokenAnnotations, text_start_position, show_debug);
+
+		File tmpfile = new File(tmpXMLTXMDirectory, xmlFile.getName());
+		File previousfile = new File(previousXMLTXMDirectory, xmlFile.getName());
+
+		if (annotationInjector.process(tmpfile)) {
+			if (ValidateXml.test(tmpfile)) { //TODO ALSO check if annotations are well-written 
+				previousfile.delete(); // in case there is one
+				if (!previousfile.exists() && xmlFile.renameTo(previousfile)) {
+					tmpfile.renameTo(xmlFile);
+					return true;
+				} else {
+					System.out.println("Error: could not replace XML-TXM file: "+xmlFile+" with "+tmpfile);
+				}
+			} else {
+				System.out.println("Error: result file "+tmpfile+" is malformed.");
+			}
+		} else {
+			System.out.println("Error: while processing "+xmlFile+" in temp dir");
+		}
+		return false;
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/annotation/AnnotationWriter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/annotation/AnnotationInjector.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/annotation/AnnotationInjector.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/annotation/AnnotationInjector.java	(revision 258)
@@ -0,0 +1,755 @@
+package org.txm.annotation;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+
+import org.txm.importer.StaxIdentityParser;
+import org.txm.importer.ValidateXml;
+import org.txm.objects.BaseParameters;
+
+/**
+ * The Class AnnotationInjection.
+ *
+ * @author mdecorde
+ *
+ * inject annotation from a stand-off file into a xml-tei-txm file "id"
+ */
+
+public class AnnotationInjector extends StaxIdentityParser {
+
+	File xmlFile;
+	HashMap<Integer, List<Annotation>> annotationsToAddByStartPos; // contains
+																	// annotation
+																	// to write
+	HashMap<Integer, List<Annotation>> annotationsToAddByEndPos;
+	List<Annotation> currentStartAnnotations;
+	List<Annotation> currentEndAnnotations;
+	HashMap<String, Annotation> currentTokenAnnotations = new HashMap<String, Annotation>();
+
+	int n = 0;
+	boolean debug = false;
+
+	String data; // the word id properties to add/replace
+	String newform = null;
+	String wordId;
+	boolean inW = false;
+	String anaType;
+
+	int position_counter = 0;
+
+	String closeNext = null; // the next close tag to delete
+	ArrayList<String> openedElements = new ArrayList<String>(); // to ensure to
+																// delete the
+																// right element
+
+	private List<Annotation> previousEndAnnotations;
+	private ArrayList<Annotation> tokenAnnotations;
+
+	String user;
+
+	/**
+	 * 
+	 * @param xmlFile
+	 * @param tokenAnnotations
+	 * @param annotationsToAddByStartPos
+	 * @param annotationsToAddByEndPos
+	 * @param corpus_start_position
+	 * @param debug
+	 * @throws MalformedURLException
+	 */
+	public AnnotationInjector(File xmlFile, List<Annotation> segmentAnnotations, ArrayList<Annotation> tokenAnnotations, int corpus_start_position, boolean debug) throws MalformedURLException {
+		super(xmlFile.toURI().toURL()); // init reader and writer
+
+		this.user = System.getProperty("user.name");
+
+		this.debug = debug;
+		this.xmlFile = xmlFile;
+		this.n = 0;
+		// println ""+records.size()+" lines to process..."
+		this.position_counter = corpus_start_position;
+		factory = XMLInputFactory.newInstance();
+
+		// preparing annotations to being written in the right inclusion order
+		annotationsToAddByStartPos = new HashMap<Integer, List<Annotation>>();
+		annotationsToAddByEndPos = new HashMap<Integer, List<Annotation>>();
+
+		for (Annotation a : segmentAnnotations) {
+			if (!annotationsToAddByStartPos.containsKey(a.getStart()))
+				annotationsToAddByStartPos.put(a.getStart(), new ArrayList<Annotation>());
+			if (!annotationsToAddByEndPos.containsKey(a.getEnd()))
+				annotationsToAddByEndPos.put(a.getEnd(), new ArrayList<Annotation>());
+
+			annotationsToAddByStartPos.get(a.getStart()).add(a);
+			annotationsToAddByEndPos.get(a.getEnd()).add(a);
+		}
+
+		for (int i : annotationsToAddByStartPos.keySet()) {
+			List<Annotation> a = annotationsToAddByStartPos.get(i);
+			Collections.sort(a, new Comparator<Annotation>() { // reverse sort
+																// annotation ->
+																// write the
+																// smaller in
+																// the bigger
+						@Override
+						public int compare(Annotation arg0, Annotation arg1) {
+							return arg1.getEnd() - arg0.getEnd();
+						}
+					});
+		}
+		for (int i : annotationsToAddByEndPos.keySet()) {
+			List<Annotation> a = annotationsToAddByEndPos.get(i);
+			Collections.sort(a, new Comparator<Annotation>() { // reverse sort
+																// annotation ->
+																// write the
+																// smaller in
+																// the bigger
+						@Override
+						public int compare(Annotation arg0, Annotation arg1) {
+							return arg1.getStart() - arg0.getStart();
+						}
+					});
+		}
+
+		// sorting token annotations
+		this.tokenAnnotations = tokenAnnotations;
+		Collections.sort(tokenAnnotations, new Comparator<Annotation>() {
+			@Override
+			public int compare(Annotation arg0, Annotation arg1) {
+				return arg0.getStart() - arg1.getStart();
+			}
+		});
+
+		if (debug) {
+			System.out.println("annotations for " + xmlFile);
+			System.out.println(" segment grouped and ordered by start position: " + annotationsToAddByStartPos);
+			System.out.println(" segment grouped and ordered by end position: " + annotationsToAddByEndPos);
+			System.out.println(" token ordered by start position: " + tokenAnnotations);
+		}
+	}
+
+	boolean mustChangeAnaValue = false;
+	boolean inAna = false;
+
+	protected void processStartElement() {
+		
+		currentStartAnnotations = annotationsToAddByStartPos.get(position_counter);
+		currentEndAnnotations = annotationsToAddByEndPos.get(position_counter);
+		//System.out.println("A Starts: "+currentStartAnnotations+" "+currentEndAnnotations);
+		// if (debug)
+		// System.out.println("----- "+localname+"@"+position_counter+" START ANNOT = "+currentStartAnnotations);
+		if ("teiHeader".equals(localname)) {
+			super.processStartElement();
+			goToEnd("teiHeader"); // skip teiHeader // will be closed in
+									// processEndElement()
+		} else if ("w".equals(localname)) {
+			// System.out.println("W START pos="+position_counter+" annots="+currentStartAnnotations);
+			if (currentStartAnnotations != null) {// there are still annotations
+													// to write, possible
+													// several for a position
+				// if (debug)
+				// System.out.println("WRITING START at "+position_counter+": "+currentStartAnnotations);
+				for (Annotation a : currentStartAnnotations) {
+					if (!"#del".equals(a.getValue())) {
+						if (debug)
+							System.out.println(" force write start annotation " + a);
+						writeStartAnnotation(a);
+					} else {
+						if (debug)
+							System.out.println(" no need to write start annotation " + a);
+						currentEndAnnotations = annotationsToAddByEndPos.get(a.getEnd());
+						// System.out.println(" shall we need to change annotation attribute : "+a.getValue()+
+						// " | currentEndAnnotations : "+currentEndAnnotations);
+						if (currentEndAnnotations == null) {
+							System.out.println("WARNING ERROR null pointer for end position of annotation " + a);
+						} else {
+							currentEndAnnotations.remove(a);
+						}
+					}
+				}
+			}
+			inW = true;
+
+			// get token annotation if any
+			currentTokenAnnotations.clear(); // current word annotations to write, may be empty
+			Annotation a = null;
+			
+			if (tokenAnnotations.size() > 0) {
+				a = tokenAnnotations.get(0);
+				//System.out.println("for p="+position_counter+" next token annot="+a);
+				
+				if (a.getStart() <= position_counter && position_counter <= a.getEnd()) {
+					// write the annotation
+					currentTokenAnnotations.put(a.getType(), a);
+					if (a.getEnd() == position_counter) // its the last word that needs to write this annotation
+						tokenAnnotations.remove(0);
+				}
+			}
+
+			super.processStartElement(); // write the tag
+		} else if ("ana".equals(localname)) {
+			inAna = true;
+			String type = parser.getAttributeValue(null, "type").substring(1);
+			if (currentTokenAnnotations.containsKey(type)) {
+				Annotation a = currentTokenAnnotations.get(type);
+				//System.out.println("Updating token annotation with: " + a);
+
+				String value = a.getValue();
+				if ("#del".equals(value))
+					value = "";
+				if (value == null)
+					value = "ERROR";
+
+				try {
+					writer.writeStartElement("ana");
+					writer.writeAttribute("type", "#" + type);
+					writer.writeAttribute("resp", "#" + a.getAnnotator()); // change
+																			// resp
+					writer.writeCharacters(value);
+					mustChangeAnaValue = true;
+				} catch (XMLStreamException e) {
+					// TODO Auto-generated catch block
+					e.printStackTrace();
+				}
+
+				currentTokenAnnotations.remove(type); // annotation updated
+			} else {
+				super.processStartElement();
+			}
+		} else if (currentStartAnnotations != null) { // is it an annotations ?
+			// System.out.println("A START="+localname);
+			boolean toDelete = false;
+			for (int i = 0; i < currentStartAnnotations.size(); i++) {
+				Annotation a = currentStartAnnotations.get(i);
+				// if (debug)
+				// System.out.println("=============== Start annot : "+a);
+				if (a.getType().equals(localname)) { // force delete, will be
+														// written in the "w"
+														// case
+					int start = Integer.parseInt(parser.getAttributeValue(null, "start"));
+					int end = Integer.parseInt(parser.getAttributeValue(null, "end"));
+					if (a.getStart() == start && a.getEnd() == end) {
+						// updated = true;
+						// if (debug)
+						// System.out.println(" found existing annotation "+a);
+						if ("#del".equals(a.getValue())) {
+							toDelete = true;
+							// currentEndAnnotations.remove(a); // MAYBE NOT TO
+							// DO THIS HERE ?
+							if (debug)
+								System.out.println(" force delete start annotation " + a);
+						} else { // update existing annotation, no need to store
+									// the end of annotation
+							writeStartAnnotation(a);
+							toDelete = true;
+							if (debug)
+								System.out.println(" update annotation " + a);
+							currentEndAnnotations = annotationsToAddByEndPos.get(a.getEnd());// EL
+																								// NO
+																								// CAPITO
+																								// YET
+																								// !!
+							// System.out.println(" shall we need to change annotation attribute : "+a.getValue()+
+							// " | currentEndAnnotations : "+currentEndAnnotations);
+							if (currentEndAnnotations == null) {
+								System.out.println("WARNING ERROR null pointer for end position of annotation " + a);
+							} else {
+								currentEndAnnotations.remove(a);
+							}
+						}
+
+						currentStartAnnotations.remove(i);
+						i--;
+					}
+
+					break; // no need to continue
+				} else {
+					// System.out.println("------- with same start pos");
+					String s_end = parser.getAttributeValue(null, "end");
+					String s_start = parser.getAttributeValue(null, "start");
+					String s_author = parser.getAttributeValue(null, "author");
+					String s_ref = parser.getAttributeValue(null, "ref");
+					if (s_start != null && s_end != null && s_author != null && s_ref != null) {
+						int end = Integer.parseInt(s_end);
+						if (a.getEnd() >= end) { // must write a
+							if (!"#del".equals(a.getValue())) {
+								if (debug)
+									System.out.println(" writing of start annotation " + a);
+								writeStartAnnotation(a);
+
+							} else {
+								toDelete = true;
+								if (debug)
+									System.out.println(" no writing of start annotation " + a);
+								currentEndAnnotations = annotationsToAddByEndPos.get(a.getEnd());
+								// System.out.println(" shall we need to change annotation attribute : "+a.getValue()+
+								// " | currentEndAnnotations : "+currentEndAnnotations);
+								if (currentEndAnnotations == null) {
+									System.out.println("WARNING ERROR null pointer for end position of annotation " + a);
+								} else {
+									currentEndAnnotations.remove(a);
+								}
+							}
+							currentStartAnnotations.remove(i);
+							i--;
+							// break;
+						}
+					}
+				}
+			}
+			if (!toDelete) { // the structure or annotation was not modified
+				super.processStartElement();
+			}
+
+		} else {
+			// System.out.println("X START="+localname);
+			super.processStartElement();
+		}
+	}
+
+	@Override
+	public void processCharacters() {
+		//System.out.println("processCharaters inAna="+inAna+" mustChangeAnaValue="+mustChangeAnaValue);
+		if (inAna && mustChangeAnaValue) {
+			// nothing content is already written
+			//System.out.println("skip ana value because we replace it");
+		} else {
+			super.processCharacters();
+		}
+	}
+
+	protected void processEndElement() {
+		// currentEndAnnotations =
+		// annotationsToAddByEndPos.get(position_counter); // annotation to end
+		previousEndAnnotations = annotationsToAddByEndPos.get(position_counter - 1); // existing
+																						// (or
+																						// not)
+																						// annotation
+																						// that
+																						// have
+																						// already
+																						// been
+																						// closed
+		// if (debug)
+		// System.out.println("----- "+localname+"@"+position_counter+" END ANNOT = "+currentEndAnnotations);
+
+		if ("w".equals(localname)) {
+			// System.out.println("W END");
+
+			for (String type : currentTokenAnnotations.keySet()) {
+				try {
+					writer.writeStartElement("ana");
+					writer.writeAttribute("type", "#" + type);
+					writer.writeAttribute("resp", "#" + currentTokenAnnotations.get(type).getAnnotator()); // change
+																											// resp
+					writer.writeCharacters(currentTokenAnnotations.get(type).getValue());
+					writer.writeEndElement();
+				} catch (XMLStreamException e) {
+					e.printStackTrace();
+				}
+			}
+
+			super.processEndElement(); // write word then close annotations
+			inW = false;
+			// force write All known annotation after the word
+			if (currentEndAnnotations != null) {// there are still annotations
+												// to write, possible several
+												// for a position
+				// if (debug)
+				// System.out.println("WRITING END at "+position_counter+": "+currentEndAnnotations);
+				for (Annotation a : currentEndAnnotations) {
+					// if (debug)
+					// System.out.println("=============== End annot : "+a);
+					if (!"#del".equals(a.getValue())) {
+						if (debug)
+							System.out.println(" force write end annotation " + a);
+						writeEndAnnotation(a);
+					}/*
+					 * else { if (debug)
+					 * System.out.println(" no need to write end annotation "
+					 * +a); }
+					 */
+
+				}
+			}
+
+			position_counter++;
+		} else if ("ana".equals(localname)) {
+			//if (!mustChangeAnaValue)
+				super.processEndElement();
+			inAna = false;
+			mustChangeAnaValue = false;
+		} else if (previousEndAnnotations != null) { // force delete annotations
+														// previously written in
+														// the "w" case
+			// System.out.println("previousEndAnnotations !!!!! "+previousEndAnnotations);
+			boolean toDelete = false;
+			for (int i = 0; i < previousEndAnnotations.size(); i++) {
+				Annotation a = previousEndAnnotations.get(i);
+				if (a.getType().equals(localname)) { // update the annotation
+					// if (debug)
+					// System.out.println(" found existing end annotation "+a);
+
+					if ("#del".equals(a.getValue())) { // if
+														// (!"#del".equals(a.getValue()))
+														// {
+						toDelete = true;
+						if (debug)
+							System.out.println(" force delete end annotation " + a);
+					}
+
+					previousEndAnnotations.remove(i);
+					i--;
+					break; // no need to continue
+				}
+			}
+			if (!toDelete) { // the structure or annotation was not modified
+				super.processEndElement();
+			} else {
+				// if (debug)
+				// System.out.println("DELETING END at "+position_counter+" localname="+localname+": "+previousEndAnnotations);
+			}
+		} else {
+			// System.out.println("X END="+localname);
+			super.processEndElement();
+		}
+	}
+
+	private void writeStartAnnotation(Annotation a) {
+		try {
+			writer.writeStartElement("txm:" + a.getType());
+			writer.writeAttribute("author", "" + a.getAnnotator());
+			writer.writeAttribute("ref", a.getValue());
+			writer.writeAttribute("date", BaseParameters.dateformat.format(new Date()));
+			writer.writeAttribute("start", Integer.toString(a.getStart()));
+			writer.writeAttribute("end", Integer.toString(a.getEnd()));
+		} catch (XMLStreamException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+	}
+
+	private void writeEndAnnotation(Annotation a) {
+		try {
+			writer.writeEndElement();
+		} catch (XMLStreamException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+	}
+	
+//////////// TESTS ///////////
+	
+	public static ArrayList<Annotation>  testAdding(){
+
+		Annotation a1 = new Annotation("Actr", "Actr100", 15, 16);
+		ArrayList<Annotation> annotations = new ArrayList<Annotation>();
+		annotations.add(a1);
+		return annotations;
+	}
+
+	public static ArrayList<Annotation>  testAddingInclusive(){
+
+		Annotation a1 = new Annotation("CoAc", "CoAc2093", 15, 19);
+		ArrayList<Annotation> annotations = new ArrayList<Annotation>();
+		annotations.add(a1);
+		return annotations;
+	}
+
+	public static ArrayList<Annotation>  testAddingInclusive2(){
+
+		Annotation a1 = new Annotation("Actr", "Actr100", 15, 16);
+		ArrayList<Annotation> annotations = new ArrayList<Annotation>();
+		annotations.add(a1);
+		return annotations;
+	}
+
+	public static ArrayList<Annotation>  testUpdating(){
+
+		Annotation a1 = new Annotation("Actr", "Actr200", 15, 16);
+		ArrayList<Annotation> annotations = new ArrayList<Annotation>();
+		annotations.add(a1);
+		return annotations;
+	}
+
+	public static ArrayList<Annotation>  testUpdatingDeleting(){	
+		Annotation a1 = new Annotation("Actr", "Actr200", 15, 16);
+		Annotation a2 = new Annotation("CoAc", "#del", 15, 19);		
+		ArrayList<Annotation> annotations = new ArrayList<Annotation>();
+		annotations.add(a1);
+		annotations.add(a2);
+		return annotations;
+	}
+
+	public static ArrayList<Annotation>  testAddDeleting2(){	
+		Annotation a1 = new Annotation("Actr", "#del", 15, 16); //DELETE
+		Annotation a2 = new Annotation("NaPl", "NaPl14554", 15, 19); //ADD
+		ArrayList<Annotation> annotations = new ArrayList<Annotation>();
+		annotations.add(a1);
+		annotations.add(a2);
+		return annotations;
+	}
+
+	public static ArrayList<Annotation>  testUpdatingDeletingAdding(){	
+		Annotation a1 = new Annotation("Actr", "Actr200", 15, 16); //UPDATE
+		Annotation a2 = new Annotation("NaPl", "NaPl14554", 15, 19); //ADD	
+		Annotation a3 = new Annotation("CoAc", "#del", 15, 19);	//DELETE	
+		ArrayList<Annotation> annotations = new ArrayList<Annotation>();
+		annotations.add(a1);
+		annotations.add(a2);
+		annotations.add(a3);
+		return annotations;
+	}
+
+	public static ArrayList<Annotation>  testUpdatingDeletingAdding2(){	// NOT WORKING
+		Annotation a1 = new Annotation("Actr", "#del", 15, 16); //DELETE
+		Annotation a2 = new Annotation("NaPl", "NaPl14554", 15, 19); //ADD  same place as CoAc
+		Annotation a3 = new Annotation("CoAc", "CoAc2091", 15, 19); //UPDATE		
+		ArrayList<Annotation> annotations = new ArrayList<Annotation>();
+		annotations.add(a1);
+		annotations.add(a2);
+		annotations.add(a3);
+		return annotations;
+	}
+
+	public static ArrayList<Annotation>  testUpdatingDeletingAdding3(){	// NOT WORKING
+		Annotation a1 = new Annotation("Actr", "#del", 15, 16); //DELETE
+		Annotation a2 = new Annotation("NaPl", "NaPl14554", 15, 16); //ADD same place as Actr		
+		Annotation a3 = new Annotation("CoAc", "CoAc2091", 15, 19); //UPDATE		
+		ArrayList<Annotation> annotations = new ArrayList<Annotation>();
+		annotations.add(a1);
+		annotations.add(a2);
+		annotations.add(a3);
+		return annotations;
+	}
+
+	public static ArrayList<Annotation>  testUpdatingDeletingAdding4(){	
+		Annotation a1 = new Annotation("Actr", "#del", 15, 16); //DELETE
+		Annotation a2 = new Annotation("NaPl", "NaPl14554", 13, 20); //ADD Outside Actr and CoAc		
+		Annotation a3 = new Annotation("CoAc", "CoAc2091", 15, 19); //UPDATE		
+		ArrayList<Annotation> annotations = new ArrayList<Annotation>();
+		annotations.add(a1);
+		annotations.add(a2);
+		annotations.add(a3);
+		return annotations;
+	}
+
+	public static ArrayList<Annotation>  testUpdatingDeletingAdding5(){	
+		Annotation a1 = new Annotation("Actr", "#del", 15, 16); //DELETE
+		Annotation a2 = new Annotation("NaPl", "NaPl14554", 15, 16); //ADD		
+		Annotation a3 = new Annotation("CoAc", "#del", 15, 19); //DELETE		
+		ArrayList<Annotation> annotations = new ArrayList<Annotation>();
+		annotations.add(a1);
+		annotations.add(a2);
+		annotations.add(a3);
+		return annotations;
+	}
+
+	public static ArrayList<Annotation>  testUpdatingDeletingAdding6(){	 
+		Annotation a1 = new Annotation("Actr", "#del", 15, 16); //DELETE
+		Annotation a2 = new Annotation("NaPl", "NaPl14554", 15, 16); //ADD		
+		Annotation a3 = new Annotation("CoAc", "#del", 15, 19); //DELETE		
+		Annotation a4 = new Annotation("CoAc", "CoAc1", 15, 18); //DELETE
+		ArrayList<Annotation> annotations = new ArrayList<Annotation>();
+		annotations.add(a1);
+		annotations.add(a2);
+		annotations.add(a3);
+		annotations.add(a4);
+		return annotations;
+	}
+
+	public static ArrayList<Annotation>  testUpdatingInclusive(){	
+		Annotation a1 = new Annotation("Actr", "Actr200", 15, 16);
+		Annotation a2 = new Annotation("CoAc", "CoAc321", 15, 19);		
+		ArrayList<Annotation> annotations = new ArrayList<Annotation>();
+		annotations.add(a1);
+		annotations.add(a2);
+		return annotations;
+	}
+
+	public static ArrayList<Annotation>  testDeleting(){
+
+		Annotation a1 = new Annotation("Actr", "#del", 15, 16);
+		ArrayList<Annotation> annotations = new ArrayList<Annotation>();
+		annotations.add(a1);
+		return annotations;
+	}
+
+	public static ArrayList<Annotation>  testDeletingInclusive(){
+
+		Annotation a1 = new Annotation("Actr", "#del", 15, 16);
+		Annotation a2 = new Annotation("CoAc", "#del", 15, 16);		
+		ArrayList<Annotation> annotations = new ArrayList<Annotation>();
+		annotations.add(a1);
+		annotations.add(a2);
+		return annotations;
+	}
+
+	static int ADD = 1;
+	static int UPDATE = 2;
+	static int DELETE = 3;
+	static int ADD2 = 4;
+	static int UPDATE2 = 5;
+	static int DELETE2 = 6;
+	static int DELETE3 = 7;
+	static int DELETE4 = 8;
+	static int ADD3 = 9;
+	static int UPDATE3 = 10;
+	static int UPDATEDELETE = 11;
+	static int UPDATEDELETEADD = 12;
+	static int UPDATEDELETEADD2 = 13;
+	static int UPDATEDELETEADD3 = 14;
+	static int UPDATEDELETEADD4 = 15;
+	static int UPDATEDELETEADD5 = 16;
+	static int UPDATEDELETEADD6 = 17;
+	static int ADDDELETE2 = 18;
+
+	public static void main2(String args[]) throws IOException {
+		File xmlFile = null;
+		int corpus_start_position = 10;
+
+		ArrayList<Annotation> annotations = null;
+		int test = UPDATEDELETEADD3;//AnnotationWriter.UPDATE;// AnnotationWriter.ADD;
+		switch (test) {
+		case 1 : 
+			//AnnotationWriter.ADD
+			xmlFile = new File(System.getProperty("user.home"), "TXM/corpora/TEST/TEST.xml");
+			annotations = testAdding(); /// OK
+			break;
+		case 2 : 
+			//AnnotationWriter.UPDATE
+			xmlFile = new File(System.getProperty("user.home"), "TXM/corpora/TEST/TEST2.xml");
+			annotations = testUpdating(); /// OK
+			break;
+		case 3 : 
+			//AnnotationWriter.DELETE
+			xmlFile = new File(System.getProperty("user.home"), "TXM/corpora/TEST/TEST4.xml");
+			annotations = testDeleting(); /// OK
+			break;
+		case 4 : 
+			//AnnotationWriter.ADD2
+			xmlFile = new File(System.getProperty("user.home"), "TXM/corpora/TEST/TEST3.xml");
+			annotations = testAddingInclusive(); /// OK
+			break;
+		case 5 : 
+			//AnnotationWriter.UPDATE2
+			xmlFile = new File(System.getProperty("user.home"), "TXM/corpora/TEST/TEST5.xml");
+			annotations = testUpdating(); /// OK
+			break;
+		case 6 : 
+			//AnnotationWriter.DELETE2
+			xmlFile = new File(System.getProperty("user.home"), "TXM/corpora/TEST/TEST6.xml");
+			annotations = testDeleting();
+			break;
+		case 7 : 
+			//AnnotationWriter.DELETE3
+			xmlFile = new File(System.getProperty("user.home"), "TXM/corpora/TEST/TEST6.xml");
+			annotations = testDeletingInclusive();
+			break;
+		case 8 : 
+			//AnnotationWriter.DELETE4
+			xmlFile = new File(System.getProperty("user.home"), "TXM/corpora/TEST/TEST7.xml");
+			annotations = testDeletingInclusive();
+			break;
+		case 9 : 
+			//AnnotationWriter.ADD3
+			xmlFile = new File(System.getProperty("user.home"), "TXM/corpora/TEST/TEST3bis.xml");
+			annotations = testAddingInclusive2(); /// OK
+			break;
+		case 10 : 
+			//AnnotationWriter.UPDATE3
+			xmlFile = new File(System.getProperty("user.home"), "TXM/corpora/TEST/TEST5.xml");
+			annotations = testUpdatingInclusive(); /// OK
+			break;
+		case 11 : 
+			//AnnotationWriter.UPDATEDELETE
+			xmlFile = new File(System.getProperty("user.home"), "TXM/corpora/TEST/TEST5.xml");
+			annotations = testUpdatingDeleting(); /// OK
+			break;
+		case 12 : 
+			//AnnotationWriter.UPDATEDELETEADD
+			xmlFile = new File(System.getProperty("user.home"), "TXM/corpora/TEST/TEST5.xml");
+			annotations = testUpdatingDeletingAdding(); /// NOT OK
+			break;
+		case 13 : 
+			//AnnotationWriter.UPDATEDELETEADD2
+			xmlFile = new File(System.getProperty("user.home"), "TXM/corpora/TEST/TEST5.xml");
+			annotations = testUpdatingDeletingAdding2(); /// OK
+			break;
+		case 14 : 
+			//AnnotationWriter.UPDATEDELETEADD3
+			xmlFile = new File(System.getProperty("user.home"), "TXM/corpora/TEST/TEST5.xml");
+			annotations = testUpdatingDeletingAdding3(); /// OK
+			break;
+		case 15 : 
+			//AnnotationWriter.UPDATEDELETEADD4 -- add 1 annotation over the 2 others
+			xmlFile = new File(System.getProperty("user.home"), "TXM/corpora/TEST/TEST5.xml");
+			annotations = testUpdatingDeletingAdding4(); /// OK
+			break;
+		case 16 : 
+			//AnnotationWriter.UPDATEDELETEADD5 -- delete 2 annotations, add 1
+			xmlFile = new File(System.getProperty("user.home"), "TXM/corpora/TEST/TEST5.xml");
+			annotations = testUpdatingDeletingAdding5(); /// OK
+			break;
+		case 17 : 
+			//AnnotationWriter.UPDATEDELETEADD6 -- delete 2 annotations, add 2
+			xmlFile = new File(System.getProperty("user.home"), "TXM/corpora/TEST/TEST5.xml");
+			annotations = testUpdatingDeletingAdding6(); /// NOT OK
+			break;
+		case 18 : 
+			//AnnotationWriter.ADDDELETE -- delete 1, add 1
+			xmlFile = new File(System.getProperty("user.home"), "TXM/corpora/TEST/TEST5.xml");
+			annotations = testAddDeleting2(); /// OK 
+			break;
+			//
+		default: break;
+		}
+
+		// no token annotations
+		AnnotationInjector annotationInjector = new AnnotationInjector(xmlFile, annotations, new ArrayList<Annotation>(), corpus_start_position, true);
+		File outfile = new File(xmlFile.getParentFile(), "result-"+xmlFile.getName());
+		if (annotationInjector.process(outfile)) {
+			if (!ValidateXml.test(outfile)) {
+				System.out.println("FAIL");
+			} else {
+				System.out.println("SUCCESS ??");
+			}	
+		}
+
+	}
+
+	public static void main(String[] args) {
+		File xmlFile = new File("/home/mdecorde/TXM/corpora/TDM80J/txm/TDM80J/tdm80j.xml");
+		File outfile = new File("/home/mdecorde/TXM/corpora/TDM80J/txm/TDM80J/tdm80j-annot.xml");
+
+		ArrayList<Annotation> segmentAnnotations = new ArrayList<Annotation>();
+		int starts[] = { 5, 50, 104, 185, 235, 434, 517, 784, 949 };
+		int ends[] = { 6, 51, 105, 186, 236, 435, 518, 785, 950 };
+		for (int i = 0; i < starts.length; i++) {
+			segmentAnnotations.add(new Annotation("Actr", "Philou", starts[i], ends[i]));
+		}
+
+		ArrayList<Annotation> tokenAnnotations = new ArrayList<Annotation>();
+		int positions[] = { 1, 32, 79, 224, 358, 428, 889, 1247, 1253, 1346 };
+		for (int p : positions) tokenAnnotations.add(new Annotation("frlemma", "de", p, p+5));
+		
+		AnnotationInjector ai;
+		try {
+			ai = new AnnotationInjector(xmlFile, segmentAnnotations, tokenAnnotations, 0, true);
+			System.out.println("start processing...");
+			ai.process(outfile);
+			System.out.println("Done.");
+		} catch (MalformedURLException e) {
+			e.printStackTrace();
+		}
+	}
+}
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/java/org/txm/annotation/AnnotationInjector.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/annotation/CQPAnnotationManager.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/annotation/CQPAnnotationManager.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/annotation/CQPAnnotationManager.java	(revision 258)
@@ -0,0 +1,363 @@
+package org.txm.annotation;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import org.txm.Toolbox;
+import org.txm.annotation.repository.AnnotationEffect;
+import org.txm.annotation.repository.AnnotationType;
+import org.txm.annotation.repository.KnowledgeRepository;
+import org.txm.searchengine.cqp.AbstractCqiClient;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.corpus.MainCorpus;
+import org.txm.searchengine.cqp.corpus.Property;
+import org.txm.searchengine.cqp.corpus.StructuralUnit;
+import org.txm.searchengine.cqp.corpus.StructuralUnitProperty;
+import org.txm.searchengine.cqp.corpus.query.Match;
+import org.txm.searchengine.cqp.serverException.CqiServerError;
+import org.txm.utils.logger.Log;
+
+public class CQPAnnotationManager {
+	MainCorpus corpus;
+	
+	public static final String REF= "ref";
+
+	public CQPAnnotationManager(MainCorpus corpus) {
+		this.corpus = corpus;
+	}
+
+	/**
+	 * returns all annotations for a given type
+	 * 
+	 * @return
+	 * @throws Exception
+	 */
+	public List<Annotation> getAnnotations(AnnotationType type) throws Exception {
+		return getAnnotations(type, false);
+	}
+
+	/**
+	 * returns all annotations for a given type and  overlap option
+	 * 
+	 * @return
+	 * @throws Exception
+	 */
+	public List<Annotation> getAnnotations(AnnotationType type, boolean overlap) throws Exception {
+		return getAnnotations(type, null, null, overlap);
+	}
+
+	public List<Annotation> getAnnotations(AnnotationType type, int start, int end) throws CqiClientException, IOException, CqiServerError {
+		return getAnnotations(type, new Match(start, end), null, false);
+	}
+
+	public List<Annotation> getAnnotations(AnnotationType type, int start, int end, boolean overlap) throws CqiClientException, IOException, CqiServerError {
+		return getAnnotations(type, new Match(start, end), null, overlap);
+	}
+
+	/**
+	 * Return all annotations for ONE match
+	 * can be use to find out overlap
+	 * 
+	 * @param refType can be null
+	 * @param match can be null
+	 * @param value can be null
+	 * @param overlap
+	 * @return
+	 * @throws CqiClientException 
+	 * @throws CqiServerError 
+	 * @throws IOException 
+	 */
+	public List<Annotation> getAnnotations(AnnotationType type, Match match, String value, boolean overlap) throws CqiClientException, IOException, CqiServerError {
+		HashMap<StructuralUnitProperty, AnnotationType> supList = new HashMap<StructuralUnitProperty, AnnotationType>();
+
+		//TODO add a corpus parameters for structures that code annotations
+		//TODO manage word properties annotations
+		if (type == null) {
+			
+			// first get know annotations from corpus's KR
+			for (String kr_name : corpus.getKnowledgeRepositoryNames()) {
+				KnowledgeRepository kr = corpus.getKnowledgeRepository(kr_name);
+				if (kr == null) continue;
+				List<AnnotationType> types = kr.getAllAnnotationTypes();
+				for (AnnotationType t : types) {
+					StructuralUnit su = corpus.getStructuralUnit(t.getId().toLowerCase());
+					if (su != null) {
+						StructuralUnitProperty sup = su.getProperty(REF);
+						if (sup != null) {
+							supList.put(sup, t);
+						}
+					}
+				}
+			}
+			
+
+			for (StructuralUnit su : corpus.getStructuralUnits()) {
+				if (su.getName().equals("text") || su.getName().equals("txmcorpus") || 
+						su.getName().equals("lb") || su.getName().equals("pb")) continue; // that's no annotation for sure ;)
+
+				StructuralUnitProperty sup = su.getProperty(REF);
+				if (sup == null) sup = su.getProperty("n");
+				if (sup != null) {
+					if (!supList.containsKey(sup)) // don't override a know annotation
+						supList.put(sup, null);
+				}
+			}
+			
+		} else {
+			StructuralUnit su = corpus.getStructuralUnit(type.getId().toLowerCase());
+			if (su == null) return new ArrayList<Annotation>(); // no property, no annotation :)
+
+			StructuralUnitProperty sup = su.getProperty(REF);
+			if (sup == null) return new ArrayList<Annotation>(); // no attribute REF, no annotation :)
+
+			supList.put(sup, type);
+		}
+
+		ArrayList<Annotation> result = new ArrayList<Annotation>();
+		for (StructuralUnitProperty sup : supList.keySet()) {
+			String sup_name = sup.getStructuralUnit().getName();
+			AnnotationType sup_type = supList.get(sup);
+			if (sup_type != null) sup_name = sup_type.getId();
+			
+			int Nstruct = Toolbox.getCqiClient().attributeSize(sup.getQualifiedName());
+
+			//TODO: can optimize this, to fetch only structure that matches
+			int[] iStructs = new int[Nstruct];
+			for (int iStruct = 0; iStruct < Nstruct; iStruct++) iStructs[iStruct] = iStruct;
+			String svalues[] = Toolbox.getCqiClient().struc2Str(sup.getQualifiedName(), iStructs); // one position
+
+			for (int iStruct = 0; iStruct < Nstruct; iStruct++) {
+				int smatch[] = Toolbox.getCqiClient().struc2Cpos(sup.getQualifiedName(), iStruct);
+
+				if (value != null) { // supplementary test if value is specified
+					if (!value.equals(svalues[iStruct])) {
+						continue; // next struct
+					}
+				}
+				if (match != null) {
+					if (overlap) {
+						if (match.getEnd() <  smatch[0]) {
+							break; // no need to continue, structures are ordered
+						} else if (smatch[1] < match.getStart()) {
+							continue; // next structure
+						} else {
+							result.add(new Annotation(sup_name, svalues[iStruct], smatch[0], smatch[1]));
+						}
+					} else {
+						if (match.getStart() == smatch[0] && match.getEnd() == smatch[1]) {
+							result.add(new Annotation(sup_name, svalues[iStruct], smatch[0], smatch[1]));
+						}
+					}
+				} else { // get all annotations
+					result.add(new Annotation(sup_name, svalues[iStruct], smatch[0], smatch[1]));
+				}
+			}
+		}
+		return result;
+	}
+
+	/**
+	 * 
+	 * @param matches Ordered matches, not null
+	 * @param type not null
+	 * @param overlap use true to detect overlapping annotations
+	 * @return ONE Annotation per Match for a given type
+	 * 
+	 * @throws CqiServerError 
+	 * @throws IOException 
+	 * @throws CqiClientException 
+	 */
+	public List<Annotation> getAnnotationsForMatches(List<Match> matches, AnnotationType type, boolean overlap) throws IOException, CqiServerError, CqiClientException {
+		if (type.getEffect().equals(AnnotationEffect.SEGMENT)) {
+			return getSegmentAnnotationsForMatches(matches, type, overlap);
+		} else {
+			return getTokenAnnotationsForMatches(matches, type, overlap);
+		}
+	}
+	
+	/**
+	 * 
+	 * @param matches Ordered matches, not null
+	 * @param type not null
+	 * @param overlap use true to detect overlapping annotations
+	 * @return ONE Annotation per Match for a given type
+	 * 
+	 * @throws CqiServerError 
+	 * @throws IOException 
+	 * @throws CqiClientException 
+	 */
+	public List<Annotation> getTokenAnnotationsForMatches(List<Match> matches, AnnotationType type, boolean overlap) throws IOException, CqiServerError, CqiClientException {
+
+		Property prop = corpus.getProperty(type.getId().toLowerCase());
+		if (prop == null) return nullAnnotationList(matches.size()); // no property, no annotation :)
+
+		AbstractCqiClient cqi = Toolbox.getCqiClient();
+		
+		int positions[] = new int[matches.size()];
+		int i = 0;
+		for (Match m : matches) positions[i++] = m.getStart();
+		
+		String[] strs = cqi.cpos2Str(prop.getQualifiedName(), positions);
+		
+		ArrayList<Annotation> annotations = new ArrayList<Annotation>();
+		i = 0;
+		for (String str : strs) {
+			int p = positions[i++];
+			annotations.add(new Annotation(type.getId(), str, p, p));
+		}
+		Log.info("TOKEN ANNOTATION CQP VALUES: "+annotations);
+		return annotations;
+	}
+	
+	/**
+	 * 
+	 * @param matches Ordered matches, not null
+	 * @param type not null
+	 * @param overlap use true to detect overlapping annotations
+	 * @return ONE Annotation per Match for a given type
+	 * 
+	 * @throws CqiServerError 
+	 * @throws IOException 
+	 * @throws CqiClientException 
+	 */
+	public List<Annotation> getSegmentAnnotationsForMatches(List<Match> matches, AnnotationType type, boolean overlap) throws IOException, CqiServerError, CqiClientException {
+
+		StructuralUnit su = corpus.getStructuralUnit(type.getId().toLowerCase());
+		if (su == null) return nullAnnotationList(matches.size()); // no property, no annotation :)
+
+		StructuralUnitProperty sup = su.getProperty(REF);
+		if (sup == null) return nullAnnotationList(matches.size()); // no attribute REF, no annotation :)
+
+		int Nstruct = Toolbox.getCqiClient().attributeSize(sup.getQualifiedName());
+		int iMatch = 0;
+		int iStruct = 0;
+		int Nmatches = matches.size();
+		ArrayList<Integer> values = new ArrayList<Integer>(); // contains structure numbers
+		ArrayList<int[]> annotationsStartEnd = new ArrayList<int[]>(); // contains structure numbers
+
+		if (Nstruct == 0) return new ArrayList<Annotation>(matches.size()); // no annotation
+		//System.out.println("NUMBER OF STRUCT "+sup+" "+Nstruct);
+		//System.out.println("MATCHES "+matches);
+		int smatch[] = Toolbox.getCqiClient().struc2Cpos(sup.getQualifiedName(), iStruct);
+		//System.out.println(" TEST WITH "+smatch[0]+"-"+smatch[1]);
+		if (overlap) {
+			for (iMatch = 0 ; iStruct < Nstruct && iMatch < Nmatches; ) {
+				Match m = matches.get(iMatch);
+
+				if(smatch[1] < m.getStart()) { // next struct
+					iStruct++;
+					if (iStruct < Nstruct)
+						smatch = Toolbox.getCqiClient().struc2Cpos(sup.getQualifiedName(), iStruct);
+					//System.out.println(" NEXT STRUCT TEST WITH "+smatch[0]+"-"+smatch[1]);
+				} else if (m.getEnd() < smatch[0]) { // next match
+					values.add(null);
+					annotationsStartEnd.add(null);
+					iMatch++;
+					//System.out.println(" NEXT MATCH of ["+m.getStart()+"-"+m.getEnd()+"] match TEST WITH "+smatch[0]+"-"+smatch[1]);
+				} else {
+					//					((m.getStart() <= smatch[0] && smatch[0] <= m.getEnd()) ||
+					//								(m.getStart() <= smatch[1] && smatch[1] <= m.getEnd()) ||
+					//						(smatch[0] <= m.getStart() && m.getEnd() <= smatch[1])) {
+					iMatch++;
+					values.add(iStruct);
+					annotationsStartEnd.add(smatch);
+					//System.out.println(" FOUND annotation "+smatch[0]+"-"+smatch[1]);
+				}
+			}
+		} else { // strict matches
+			for (iMatch = 0 ; iStruct < Nstruct && iMatch < Nmatches; ) {
+				Match m = matches.get(iMatch);
+				if (smatch[0] == m.getStart() && smatch[1] == m.getEnd()) {
+					values.add(iStruct);
+					annotationsStartEnd.add(smatch);
+					iMatch++;
+					iStruct++;
+					if (iStruct < Nstruct)
+						smatch = Toolbox.getCqiClient().struc2Cpos(sup.getQualifiedName(), iStruct);
+				} else if(smatch[1] < m.getStart()) { // next struct
+					iStruct++;
+					if (iStruct < Nstruct)
+						smatch = Toolbox.getCqiClient().struc2Cpos(sup.getQualifiedName(), iStruct);
+				} else if (m.getEnd() < smatch[0]) { // next match
+					values.add(null);
+					annotationsStartEnd.add(null);
+					iMatch++;
+				} 
+			}
+		}
+
+		while (values.size() < matches.size()) {
+			values.add(null); // if matches have not been processed due to no more struct available
+			annotationsStartEnd.add(null);
+		}
+
+		int tmp_strucs[] = new int[values.size()]; // create the structure numbers array that CQP.struc2Str needs
+		for (int i = 0 ; i < values.size() ; i++) {
+			if (values.get(i) == null ) {
+				tmp_strucs[i] = 0; // add a fake value, remove after CQP call
+			} else {
+				tmp_strucs[i] = values.get(i);
+			}
+		}
+
+		String[] svalues = Toolbox.getCqiClient().struc2Str(sup.getQualifiedName(), tmp_strucs);
+		ArrayList<Annotation> annotations = new ArrayList<Annotation>();
+		for (int i = 0 ; i < values.size() ; i++) { // remove the fake values
+			if (values.get(i) == null) {
+				annotations.add(null);
+			} else {
+				annotations.add(new Annotation(type.getId(), svalues[i], annotationsStartEnd.get(i)[0], annotationsStartEnd.get(i)[1]));
+			}
+		}
+
+		Log.info("SEGMENT ANNOTATION CQP VALUES: "+annotations);
+		return annotations;
+	}
+
+	private ArrayList<Annotation> nullAnnotationList(int size) {
+		ArrayList<Annotation> a = new ArrayList<Annotation>(size);
+		for (int i = 0 ; i < size ; i++) {
+			a.add(null);
+		}
+		return a;
+	}
+
+	/**
+	 * @param start
+	 * @param end
+	 * @param type
+	 * @return value for a match and a StructuralUnit
+	 * @throws IOException
+	 * @throws CqiServerError
+	 * @throws CqiClientException 
+	 */
+	public String getCQPAnnotationValue(int start, int end, AnnotationType type) throws IOException, CqiServerError, CqiClientException {
+
+		StructuralUnit su = corpus.getStructuralUnit(type.getId().toLowerCase());
+		if (su == null) return null;
+
+		StructuralUnitProperty sup = su.getProperty(REF);
+		if (sup == null) return null;
+		int[] cpos = {start, end};
+		int[] struc = Toolbox.getCqiClient().cpos2Struc(sup.getQualifiedName(), cpos);
+
+		if (struc[0] >= 0) {
+			System.out.println("struct for positions "+start+"-"+end+" -> "+struc[0]+"-"+struc[1]);
+			if (struc[0] == struc[1]) { // même structure
+				String[] struc_str = Toolbox.getCqiClient().struc2Str(sup.getQualifiedName(), struc);
+				return struc_str[0];
+			} else { // should not happens
+				System.out.println("WARNING: FOUND EXISTING ANNOTATION FOR TYPE="+type+" START="+start+" END="+end);
+				return null;
+			}
+		} else {
+			return null;
+		}
+	}
+	
+	public void close() {
+		
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/annotation/CQPAnnotationManager.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/annotation/Annotation.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/annotation/Annotation.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/annotation/Annotation.java	(revision 258)
@@ -0,0 +1,86 @@
+package org.txm.annotation;
+
+import java.io.Serializable;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import javax.persistence.*;
+
+import org.txm.annotation.repository.KnowledgeRepository;
+import org.txm.objects.BaseParameters;
+ 
+@Entity
+public class Annotation implements Serializable {
+
+	private static final long serialVersionUID = -1007684142118207359L;
+
+	//primaryKey corresponds to the start and end positions (in the corpus) and the refType
+	@EmbeddedId
+	private AnnotationPK PK;	
+	
+	//corresponding to the type and value of the KnowledgeRepository, used to annotate
+	private String refVal = "";
+	//user in the project, responsible for the annotation, maybe should be an integer
+	private String annotatorId = "";
+
+	private String date ;
+	
+	public Annotation() {
+	}
+
+	
+	public Annotation(String refType, String refVal, int CQPstartpos, int CQPendpos) 	{
+		this.PK = new AnnotationPK(CQPstartpos, CQPendpos, refType);
+		this.refVal = refVal;
+		this.date = BaseParameters.dateformat.format(new Date());
+		
+		String s = System.getProperty(KnowledgeRepository.LOGIN_KEY);
+		if (s != null && s.length() > 0) {
+			this.annotatorId = s;
+		} else {
+			this.annotatorId = System.getProperty("user.name");
+		}
+	}
+	
+	
+	public AnnotationPK getPK() {
+		return this.PK;
+	}
+	
+	public int getStart() {
+		return this.PK.getStartPosition();
+	}
+	
+	public int getEnd() {
+		return this.PK.getEndPosition();
+	}
+	
+	public String getType() {
+		return this.PK.getRefType();
+	}
+	
+	public String getValue() {
+		return this.refVal;
+	}
+	
+	public String getDate(){
+		return this.date;
+	}
+	
+	//Maybe will be an integer ?
+	public String getAnnotator() {
+		return annotatorId;
+	}
+ 
+	
+	public void setReferentielVal(String newRefVal) {
+		this.refVal = newRefVal;
+	}
+	
+	
+	public String toString() {
+		return getPK().toString() + "=" + getValue();
+	}
+
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/annotation/Annotation.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/annotation/repository/TypedValue.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/annotation/repository/TypedValue.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/annotation/repository/TypedValue.java	(revision 258)
@@ -0,0 +1,49 @@
+package org.txm.annotation.repository;
+
+import java.io.Serializable;
+
+import javax.persistence.*;
+
+@Entity
+public class TypedValue implements Serializable {
+	
+	private static final long serialVersionUID = 7158271997193537962L;
+	
+	//primaryKey corresponds to the publicId and the type name
+	@EmbeddedId
+	private TypedValuePK PK;
+	private String name ;
+	
+	public TypedValue() {
+	}
+	
+	//ex: standardName = "Municipalité de Lyon" publicid = "CoAc1349", type = "CoAc"
+	public TypedValue(String name, String publicId, String typeId){
+		this.PK = new TypedValuePK(publicId, typeId);
+		this.name = name;
+	}
+
+	protected TypedValuePK getPK() {
+		return PK;
+	}
+	
+	public String getId() {
+		return PK.getId();
+	}
+	
+	public String getTypeID() {
+		return PK.getType();
+	}
+
+	public String getStandardName(){
+		return name;
+	}
+	
+	public String toString() {
+		return PK.toString()+"("+name+")";
+	}
+
+	public String toHumanString() {
+		return name +"("+PK.getId()+")";
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/annotation/repository/TypedValue.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/annotation/repository/messages.properties
===================================================================

Property changes on: tmp/org.txm.core/src/java/org/txm/annotation/repository/messages.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/annotation/repository/AnnotationEffect.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/annotation/repository/AnnotationEffect.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/annotation/repository/AnnotationEffect.java	(revision 258)
@@ -0,0 +1,13 @@
+package org.txm.annotation.repository;
+
+public enum AnnotationEffect {
+	SEGMENT, // annotate a token sequence
+	TOKEN, // annotate a token position
+	ANNOTATION; // annotate an annotation
+	
+	public String toSuffix() {
+		if (this.equals(TOKEN)) return " (T)";
+		else if (this.equals(ANNOTATION)) return " (A)";
+		else return "";
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/annotation/repository/AnnotationEffect.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/annotation/repository/Messages.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/annotation/repository/Messages.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/annotation/repository/Messages.java	(revision 258)
@@ -0,0 +1,14 @@
+package org.txm.annotation.repository;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+	private static final String BUNDLE_NAME = "org.txm.annotation.repository.messages"; //$NON-NLS-1$
+	static {
+		// initialize resource bundle
+		NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+	}
+
+	private Messages() {
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/annotation/repository/Messages.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/annotation/repository/KnowledgeRepositoryManager.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/annotation/repository/KnowledgeRepositoryManager.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/annotation/repository/KnowledgeRepositoryManager.java	(revision 258)
@@ -0,0 +1,266 @@
+package org.txm.annotation.repository;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.List;
+
+import org.apache.commons.io.FileUtils;
+import org.txm.Toolbox;
+import org.txm.annotation.DatabasePersistenceManager;
+import org.txm.objects.BaseParameters;
+import org.txm.sql.SQLConnection;
+import org.txm.utils.logger.Log;
+import org.txm.utils.xml.DomUtils;
+import org.w3c.dom.Element;
+
+
+public class KnowledgeRepositoryManager extends DatabasePersistenceManager {
+
+	//private static KnowledgeRepositoryManager INSTANCE = null;
+	private static HashMap<String, KnowledgeRepository> repositories = new HashMap<String, KnowledgeRepository>();
+
+//	public static KnowledgeRepositoryManager getInstance(){
+//		if (INSTANCE == null) {
+//			INSTANCE = new KnowledgeRepositoryManager();
+//		}
+//		return INSTANCE;
+//	}
+
+	/**
+	 * Lazy load KR.
+	 * 
+	 * @param name
+	 * @param conf
+	 * @return
+	 */
+	@SuppressWarnings("unchecked")
+	public static KnowledgeRepository createKnowledgeRepository(String name, Element element) {
+		HashMap<String, HashMap<String, ?>> conf = BaseParameters.getKnowledgeRepositoryConfiguration(name, element);
+		return createKnowledgeRepository(name, conf);
+	}
+	
+	/**
+	 * Lazy load KR.
+	 * 
+	 * @param name
+	 * @param conf
+	 * @return
+	 */
+	@SuppressWarnings("unchecked")
+	public static KnowledgeRepository createKnowledgeRepository(String name, HashMap<String, HashMap<String, ?>> conf) {
+
+		//System.out.println("Creating Knowledge repository ["+name+"] with configuration="+conf);
+
+		HashMap<String, String> access = (HashMap<String, String>) conf.get(BaseParameters.KNOWLEDGE_ACCESS);
+		HashMap<String, HashMap<String, String>> fields = (HashMap<String, HashMap<String, String>>) conf.get(BaseParameters.KNOWLEDGE_TYPES);
+		HashMap<String, HashMap<String, String>> strings = (HashMap<String, HashMap<String, String>>) conf.get(BaseParameters.KNOWLEDGE_STRINGS);
+		String access_type = access.get("mode");
+		
+		KnowledgeRepository kr = null;
+		if (!access_type.equals(DatabasePersistenceManager.ACCESS_SQL) 
+				&& !access_type.equals(DatabasePersistenceManager.ACCESS_FILE)) {
+			System.out.println("Unknowned repository type: "+access_type+". Assuming it's a 'file' KR.");
+			access.put("mode", "file");
+			access_type = "file";
+		}
+		
+		if (access_type.equals(DatabasePersistenceManager.ACCESS_SQL)) {
+			kr = new SQLKnowledgeRepository(name);
+			kr.setCredencialsNeeded("true".equals(access.get(SQLConnection.SQL_USER)), "true".equals(access.get(SQLConnection.SQL_PASSWORD)));
+		} else if (access_type.equals(DatabasePersistenceManager.ACCESS_FILE)) {
+			kr = new LocalKnowledgeRepository(name);
+		} else {
+			System.out.println("Unknowned repository type: "+access_type);
+		}
+		
+		if (kr != null) {
+			//System.out.println("------- KnowledgeRepositoryManager : KR is been created "+kr.getName()+"--------");
+			kr.setAccessProperties(access);
+			kr.setStrings(strings);
+			kr.setFieldsTypesProperties(fields);
+			kr.initializeEntityManager();
+			kr.buildTypesAndValues();
+		} else {
+			System.out.println("Error. KR not created.");
+		}
+		
+		return kr;
+	}
+	
+	/**
+	 * get all KR stored
+	 * 
+	 * @return
+	 */
+	public static KnowledgeRepository[] getKnowledgeRepositories(){
+		return repositories.values().toArray(new KnowledgeRepository[repositories.size()]);
+	}
+	
+	public static KnowledgeRepository getKnowledgeRepository(String name) {
+		KnowledgeRepository kr = null;
+		File krconf = new File(Toolbox.getParam(Toolbox.USER_TXM_HOME),"repositories/"+name+"/conf.xml");
+		if (repositories.containsKey(name)) {
+			kr = repositories.get(name);
+		} else {
+			if (krconf.exists()) {
+				try {
+					kr = createKnowledgeRepository(name, DomUtils.load(krconf).getDocumentElement());
+					repositories.put(name, kr);
+				} catch (Exception e) {
+					System.out.println("Fail to load KR from configuration file: "+krconf);
+					Log.printStackTrace(e);
+				}
+			}
+		}
+		return kr;
+	}
+
+	/**
+	 * get and lazy load a stored KR (initialized and all)
+	 * 
+	 * @param name
+	 * @return
+	 */
+	public static KnowledgeRepository getKnowledgeRepository(String name, org.txm.objects.Corpus corpus) {
+		KnowledgeRepository kr = null;
+		File krconf = new File(Toolbox.getParam(Toolbox.USER_TXM_HOME),"repositories/"+name+"/conf.xml");
+		if (repositories.containsKey(name)) {
+			kr = repositories.get(name);
+		} else {
+			if (krconf.exists()) {
+				try {
+					kr = createKnowledgeRepository(name, DomUtils.load(krconf).getDocumentElement());
+					if (kr != null) {
+						repositories.put(name, kr);
+					} else {
+						System.out.println("KR not created: "+name);
+					}
+				} catch (Exception e) {
+					System.out.println("Fail to load KR from configuration file: "+krconf);
+					Log.printStackTrace(e);
+				}
+			}
+		}
+		
+		Element krCorpusElement = corpus.getBase().getBaseParameters().getKnowledgeRepositoryElement(name);
+		String sKRCorpusVersion = krCorpusElement.getAttribute("version");
+		
+		if (kr != null) {
+			int version = kr.getVersion();
+			
+			int krCorpusVersion = 0;
+			if (sKRCorpusVersion.length() > 0)
+				krCorpusVersion = Integer.parseInt(sKRCorpusVersion);
+				//System.out.println("Versions KR : "+version+" >= "+krCorpusVersion);
+			if (version >= krCorpusVersion) { // version is more recent
+				return kr;
+			} else {
+				// replace the KR
+				System.out.println("REPLACE OLD KR="+kr+" (version="+version+") WITH corpus KR configuration (version="+krCorpusVersion+")");
+				KnowledgeRepository krNew = createKnowledgeRepository(name, krCorpusElement);
+				
+				try {
+					krconf.getParentFile().mkdirs();
+					DomUtils.save(krCorpusElement, krconf);
+				} catch (Exception e) {
+					System.out.println("Fail to create KR from corpus configuration: "+corpus);
+					Log.printStackTrace(e);
+					return kr;
+				}
+				if (krNew != null) {
+					repositories.put(name, krNew);
+					kr = krNew;
+				} else {
+					System.out.println("Internal error: the new KR is null: "+name);
+				}
+			}
+		} else {
+			// replace the KR
+			//System.out.println("CREATE KR="+kr+" WITH corpus KR configuration");
+			KnowledgeRepository krNew = createKnowledgeRepository(name, krCorpusElement);
+			try {
+				krconf.getParentFile().mkdirs();
+				DomUtils.save(krCorpusElement, krconf);
+			} catch (Exception e) {
+				System.out.println("Fail to create KR from corpus configuration: "+corpus);
+				Log.printStackTrace(e);
+				return kr;
+			}
+			if (krNew != null) {
+				repositories.put(name, krNew);
+				kr = krNew;
+			} else {
+				System.out.println("Internal error: the new KR is null: "+name);
+			}
+		}
+		
+		return kr;
+	}
+
+	public static boolean[] mustLoginToKnowledgeRepository(String kr_name,
+			org.txm.objects.Corpus corpus) {
+
+		KnowledgeRepository kr = getKnowledgeRepository(kr_name, corpus);
+		if (kr == null) return KnowledgeRepository.FALSES;
+		
+		return kr.mustLoginToKnowledgeRepository();
+	}
+
+	private static String generateTemplateURLPage(){
+		String html = "<html><head><title$title</title></head><body>$body</body></html>";
+		return html;
+	}
+	
+	public static String generateLocalURLPage(String krname, String name, String id) {
+	
+		KnowledgeRepository kr = getKnowledgeRepository(krname);
+		String path = Toolbox.getParam(Toolbox.USER_TXM_HOME)+"/repositories/"+krname;
+		//File htmlTemplateFile = new File(path+"/template.html");
+		File newHtmlFile = null;
+		String htmlString;
+		
+		if(kr != null){
+			AnnotationType t = kr.getType(id);
+			try {
+				//htmlString = FileUtils.readFileToString(htmlTemplateFile);
+				htmlString = generateTemplateURLPage();
+				String title = "<p>Information about "+name+ " ("+id+")</p>";
+				String body = "<p>Name : "+name + "("+id+")</p>";
+				if(t!=null){
+					List<TypedValue> values =  kr.getValues(t);
+					
+					body += "<p>Values : </p>";
+					for(TypedValue value : values){
+						body += "<p>"+value.toHumanString()+"</p>";
+					}
+					
+				}				
+				htmlString = htmlString.replace("$title", title);
+				htmlString = htmlString.replace("$body", body);
+				newHtmlFile = new File(path+"/"+id+".html");
+				FileUtils.writeStringToFile(newHtmlFile, htmlString);
+			} catch (Exception e) {
+				System.out.println("Generating HTML Page failed for "+id+" : "+e);
+				Log.printStackTrace(e);
+			}
+			
+		}else {
+			System.out.println("KR "+krname+" is null !");
+		}
+		
+		return newHtmlFile.getAbsolutePath();
+	}
+
+	public static void deleteKnowledgeRepository(KnowledgeRepository kr) {
+		//Delete all Annotation Types and Typed Values
+		List<AnnotationType> annotTypes = kr.getAllAnnotationTypes();
+		for(AnnotationType annotType : annotTypes)
+			kr.deleteType(annotType);
+		
+		repositories.remove(kr);
+	}
+
+	
+
+	
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/annotation/repository/KnowledgeRepositoryManager.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/annotation/repository/LocalKnowledgeRepository.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/annotation/repository/LocalKnowledgeRepository.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/annotation/repository/LocalKnowledgeRepository.java	(revision 258)
@@ -0,0 +1,101 @@
+package org.txm.annotation.repository;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.util.HashSet;
+
+import org.txm.Toolbox;
+import org.txm.annotation.DatabasePersistenceManager;
+import org.txm.sql.SQLConnection;
+
+public class LocalKnowledgeRepository extends KnowledgeRepository {
+
+	private File currentDirectory;
+
+	public LocalKnowledgeRepository(String name){
+		super(name);
+	}
+
+	public String getAccessType(){
+		return DatabasePersistenceManager.ACCESS_FILE;
+	}
+	
+	@Override
+	public boolean buildValues() {
+
+		String path = accessProperties.get(SQLConnection.SQL_ADDRESS);
+		if (path == null || path.trim().length() == 0) { // no address, forge one 
+			path = Toolbox.getParam(Toolbox.USER_TXM_HOME)+"/repositories/"+getName();
+			System.out.println("No address given to build values. No values created");
+			return true;
+		}
+		currentDirectory = new File(path);
+
+		if (!currentDirectory.exists()) {
+			System.out.println("Values address given does not exists: "+currentDirectory);
+			return false;
+		}
+		try {
+			for (String type : fieldsTypesProperties.keySet()) {
+				//					System.out.println("  TYPE="+type);
+				File f = new File(currentDirectory, type);
+				BufferedReader reader = new BufferedReader(new FileReader(f));
+				String line = reader.readLine();
+				int i = 0;
+				jpaem.getTransaction().begin();
+				HashSet<String> values = new HashSet<String>();
+				while (line != null) {
+					if (line.length() > 0) {
+						System.out.println("  LINE="+line);
+						String split[] = line.split("\t",2);
+						TypedValue val = null;
+						if (split.length == 2) {
+							val = new TypedValue(split[1], split[0], type);
+						} else if (split.length == 1) {
+							val = new TypedValue(split[0], split[0], type);
+						}
+
+						if (values.contains(val.getPK().getId())) {
+							System.out.println("WARNING: duplicate '"+val.getId()+"' value ID in '"+type+"' type of '"+name+"' knowledge repository. Ignoring the value.");
+						} else {
+							values.add(val.getPK().getId());
+							jpaem.persist(val);	
+						}
+					}
+					line = reader.readLine();
+					i++;
+					if ((i % 10000) == 0) {
+						jpaem.flush();
+						jpaem.clear();
+					}
+				}
+				reader.close();
+				jpaem.getTransaction().commit();
+			}
+			return true;
+		} catch(Exception e) {
+			System.out.println("Error while loading types from file: "+currentDirectory);
+			e.printStackTrace();
+			return false;
+		}
+	}
+
+	static final boolean[] FALSES = {false, false};
+	@Override
+	public boolean[] mustLoginToKnowledgeRepository() {
+		return FALSES;
+
+	}
+
+	@Override
+	public boolean checkConnection() {
+		return true; // no connection :-)
+	}
+
+
+	public boolean addTypeDeclaration(AnnotationType type) {
+		//What's the use ? Persistence
+		return false;
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/annotation/repository/LocalKnowledgeRepository.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/annotation/repository/AnnotationType.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/annotation/repository/AnnotationType.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/annotation/repository/AnnotationType.java	(revision 258)
@@ -0,0 +1,97 @@
+package org.txm.annotation.repository;
+
+import java.io.Serializable;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+
+@Entity
+public class AnnotationType implements Serializable {
+
+	private static final long serialVersionUID = -4968506428668515803L;
+
+	@Id
+	String id;
+	
+	String name;
+	String webaccess;
+	ValuesSize size = ValuesSize.SMALL;
+	String krname;
+	AnnotationEffect effect = AnnotationEffect.SEGMENT;
+	
+	public enum ValuesSize {SMALL, AVERAGE, LARGE};
+	
+	public AnnotationType() {
+		
+	}
+	
+	public AnnotationEffect setEffect(AnnotationEffect e) {
+		effect = e;
+		return e;
+	}
+	
+	public AnnotationEffect getEffect() {
+		return effect;
+	}
+	
+	public ValuesSize getSize() {
+		return size;
+	}
+
+	public void setSize(ValuesSize size) {
+		this.size = size;
+	}
+	
+	public void setSize(String size) {
+		this.size = ValuesSize.valueOf(size);
+	}
+
+	public AnnotationType(String krname, String id, String name) {
+		this.krname = krname;
+		this.id = id;
+		this.name = name;
+		//System.out.println("New Annotation Type : "+name+" / "+id);
+	}
+	
+	public AnnotationType(String krname, String id, String name, AnnotationEffect effect) {
+		this.krname = krname;
+		this.id = id;
+		this.name = name;
+		this.effect = effect;
+		//System.out.println("New Annotation Type : "+name+" / "+id);
+	}
+
+	public String getId() {
+		return id;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public String getKnowledgeRepository() {
+		return krname;
+	}
+	
+	public String toString() {
+		return name +"("+effect+")";
+	}
+
+	public void setURL(String webaccess) {
+		this.webaccess = webaccess;
+	}
+	
+	public String getURL() {
+		return this.webaccess;
+	}
+	
+	public String toHumanString() {
+		return this.getName()+" ("+this.getId()+"): "+this.webaccess;
+	}
+
+	public TypedValue getTypedValue(String value) {
+		KnowledgeRepository kr = KnowledgeRepositoryManager.getKnowledgeRepository(krname);
+		return kr.getValue(this, value);
+	}
+	
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/annotation/repository/AnnotationType.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/annotation/repository/TypedValuePK.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/annotation/repository/TypedValuePK.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/annotation/repository/TypedValuePK.java	(revision 258)
@@ -0,0 +1,48 @@
+package org.txm.annotation.repository;
+
+import java.io.Serializable;
+
+import javax.persistence.Embeddable;
+
+@Embeddable 
+public class TypedValuePK implements Serializable {
+
+	public static final long serialVersionUID = -2624411297196922947L;
+	
+	private String id ;
+	private String typeId;
+	
+	public TypedValuePK(){
+	
+	}
+
+	public TypedValuePK(String publicId, String typeId){
+		this.typeId = typeId;
+		this.id = publicId;
+	}
+
+	
+	public void setType(String typeId){
+		this.typeId = typeId;
+	}
+	
+	public void setPublicId(String publicId){
+		this.id = publicId;
+	}
+	
+	public String getType(){
+		return typeId;
+	}
+	
+	public String getId(){
+		return this.id;
+	}
+	
+	public int hashCode() {
+		return id.hashCode()+typeId.hashCode();
+	}
+	
+	public String toString() {
+		return typeId+"="+id;
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/annotation/repository/TypedValuePK.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/annotation/repository/KnowledgeRepository.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/annotation/repository/KnowledgeRepository.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/annotation/repository/KnowledgeRepository.java	(revision 258)
@@ -0,0 +1,446 @@
+package org.txm.annotation.repository;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.logging.Level;
+
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.Query;
+import javax.persistence.TypedQuery;
+
+import org.eclipse.persistence.config.PersistenceUnitProperties;
+import org.eclipse.persistence.jpa.PersistenceProvider;
+import org.txm.Toolbox;
+import org.txm.annotation.DatabasePersistenceManager;
+import org.txm.utils.logger.Log;
+
+public abstract class KnowledgeRepository  { //extends Vector<AnnotationType>
+
+	protected String values_base_url = "";
+	protected String types_base_url = "";
+	protected String url = "";
+	protected String dbPath = ""; // the KR database path
+
+	protected String name;
+	protected int version = 0;
+	protected boolean loginNeeded = false;
+	protected boolean passwordNeeded = false;
+	protected EntityManager jpaem = null;
+
+	protected HashMap<String, HashMap<String, String>> fieldsTypesProperties;
+	protected String accessType;
+	protected HashMap<String, String> accessProperties;
+
+	public final static String NAME = "name";
+	public final static String TYPE_URL = "url";
+	public final static String TYPE_RESURL = "resurl";
+	public final static String TYPE_TYPEURL = "typeurl";
+	public final static String TYPE_ID = "id";
+	public final static String TYPE_SIZE = "size";
+	public final static String TYPE_EFFECT = "effect";
+	public final static String TYPE_SQLFIELD_NAME = "sql_name";
+	public final static String TYPE_SQLFIELD_ID = "sql_id";
+	public final static String TYPE_SQLFIELD_QUERY = "sql_query";
+
+	public final static String LOGIN_KEY = "org.txm.repository.credencies.login.";
+	public final static String PASSWORD_KEY = "org.txm.repository.credencies.password.";
+
+	public static final boolean[] FALSES = {false, false};
+
+	public KnowledgeRepository(String name) {
+		this.name = name;
+	}
+	
+	public String toString() {
+		return name;
+	}
+
+	/**
+	 * Initialize the JPA persistence database
+	 * 
+	 * @return
+	 */
+	public EntityManager initializeEntityManager(){
+		this.dbPath = Toolbox.getParam(Toolbox.USER_TXM_HOME)+"/repositories/"+name;
+		//System.out.println("KnowledgeRepository.initializeEntityManager [DB @ "+dbPath+"]");
+		EntityManagerFactory emf;
+		HashMap<String, Object> properties = new HashMap<String, Object>();
+		properties.put(PersistenceUnitProperties.CLASSLOADER, Toolbox.class.getClassLoader());
+		properties.put("javax.persistence.jdbc.driver", "org.hsqldb.jdbcDriver");
+		String urlProperty = "jdbc:hsqldb:file:"+dbPath+"/db;shutdown=true;hsqldb.lock_file=false;";
+		if (Log.getLevel().intValue() < Level.WARNING.intValue()) {
+			urlProperty += "";
+		} else {
+			urlProperty += "hsqldb.applog=0;hsqldb.sqllog=0";
+		}
+		properties.put("javax.persistence.jdbc.url", urlProperty);
+		properties.put("javax.persistence.jdbc.username", "SA");
+		properties.put(PersistenceUnitProperties.DDL_GENERATION_MODE, "database");
+		properties.put(PersistenceUnitProperties.DDL_GENERATION, "create-or-extend-tables"); // create&update table if needed
+		//properties.put(PersistenceUnitProperties.DDL_GENERATION, "drop-and-create-tables"); // create&update table if needed
+		if (Log.getLevel().intValue() < Level.WARNING.intValue()) {
+			properties.put(PersistenceUnitProperties.LOGGING_LEVEL, "WARNING");
+			properties.put(PersistenceUnitProperties.LOGGING_PARAMETERS, "true");
+		} else {
+			properties.put(PersistenceUnitProperties.LOGGING_LEVEL, "OFF");
+			properties.put(PersistenceUnitProperties.LOGGING_PARAMETERS, "false");
+		}
+
+		// <property name="eclipselink.ddl-generation" value="drop-and-create-tables"/>
+
+		emf = new PersistenceProvider().createEntityManagerFactory(DatabasePersistenceManager.PERSISTENCE_UNIT_NAME, properties);
+		EntityManager entityManager = (EntityManager) emf.createEntityManager();
+		this.jpaem = entityManager;
+		return entityManager;
+	}
+
+
+	public void setAccessProperties (HashMap<String, String> accessProperties){
+		this.accessProperties = accessProperties;
+
+		String sVersion = accessProperties.get("version");
+		if (sVersion.length() > 0)
+			this.version = Integer.parseInt(sVersion);
+		this.url = accessProperties.get(TYPE_URL);
+		this.values_base_url = accessProperties.get(TYPE_RESURL);
+		this.types_base_url = accessProperties.get(TYPE_TYPEURL);
+
+	}
+
+	public HashMap<String, String> getAccessProperties(){
+		return accessProperties;
+	}
+
+	public boolean isLoginNeeded() {
+		return loginNeeded;
+	}
+
+	public boolean isPasswordNeeded() {
+		return passwordNeeded;
+	}
+
+	public void setCredencialsNeeded(boolean login, boolean password) {
+		this.loginNeeded  = login;
+		this.passwordNeeded = password;
+	}
+
+	public EntityManager getJPAManager(){
+		return this.jpaem ;
+	}
+
+	public abstract String getAccessType(); // local file, sql ...
+
+	public String getName() {
+		return name;
+	}
+
+	public List<TypedValue> getValues(AnnotationType type) throws Exception {
+		return getValues(type, -1);
+	}
+
+	/**
+	 * returns a resource url for a defined TypedValue (for instance to display in a html viewer)
+	 * @param kr
+	 * @param typedValue
+	 * @return
+	 */
+	public String getValueURL(TypedValue typedValue) {
+		return values_base_url+typedValue.getId();
+	}
+
+	/**
+	 * returns a resource url for a defined TypedValue (for instance to display in a html viewer)
+	 * @param kr
+	 * @param typedValue
+	 * @return
+	 */
+	public String getTypeURL(AnnotationType type) {
+		String url = type.getURL();
+		if (url == null || url.length() == 0) {
+			if (types_base_url != null && types_base_url.length() > 0) {
+				url = types_base_url+type.getId();
+			}
+		}
+		return url;
+	}
+
+	/**
+	 * returns a url for a defined KnowledgeRepository (for instance to display in a html viewer)
+	 * @param kr
+	 * @param typedValue
+	 * @return
+	 */
+	public String getURL(){
+		return url;
+	}
+
+	public HashMap<String, HashMap<String, String>> getFieldsTypesProperties() {
+		return fieldsTypesProperties;
+	}
+
+	public String toHumanString() {
+		StringBuffer buffer = new StringBuffer();
+		buffer.append(this.getName()+" version="+version+" ("+this.getURL()+"): "+this.getAccessType()+"\n");
+		for (AnnotationType type : getAllAnnotationTypes()) {
+			buffer.append("\t"+type.toHumanString()+"\n");
+		}
+		return buffer.toString();
+	}
+
+	public void reload() {
+		Log.info("Reloading KR "+name);
+
+		clearTypes();
+		buildTypesAndValues();
+	}
+
+	/**
+	 * returns all typed values with a specified type
+	 * @return
+	 * @throws Exception
+	 */
+	public List<TypedValue> getValues(AnnotationType type, int limit) throws Exception {
+		TypedQuery<TypedValue> query = jpaem.createQuery("SELECT t FROM TypedValue AS t "
+				+ "WHERE t.PK.typeId LIKE '"+type.getId()+"'", TypedValue.class);
+		if (limit != -1) {
+			query.setMaxResults(limit);
+		}
+
+		return query.getResultList();
+	}
+
+	/**
+	 * returns all typed values with a specified type
+	 * @return
+	 * @throws Exception
+	 */
+	public boolean hasValues(AnnotationType type) throws Exception {
+		TypedQuery<TypedValue> query = jpaem.createQuery("SELECT t.name FROM TypedValue AS t "
+				+ "WHERE t.PK.typeId LIKE '"+type.getId()+"'", TypedValue.class);
+		query.setMaxResults(1);
+
+		return query.getResultList().size() > 0;
+	}
+
+	public TypedValue getValue(AnnotationType type, String id) {
+		TypedValuePK pkval = new TypedValuePK(id, type.getId());
+		return jpaem.find(TypedValue.class, pkval);
+	}
+
+//	public TypedValue getValue(String typeId, String id) {
+//		TypedValuePK pkval = new TypedValuePK(id, typeId);
+//		return jpaem.find(TypedValue.class, pkval);
+//	}
+
+	public boolean clearTypes() {
+		// clear type list
+		//super.clear(); // clear vector
+
+		// clear all persisted values
+		if (jpaem!=null) {
+			jpaem.getTransaction().begin();
+			Query query = jpaem.createQuery("DELETE FROM TypedValue");
+			query.executeUpdate();
+			jpaem.getTransaction().commit();
+		}
+
+		return true;
+	}
+
+	/**
+	 * Populate the database with typed values if they do not exist yet
+	 * 
+	 * @param kr
+	 * @param dataAccessProperties
+	 * @param fieldsTypesProperties
+	 * @return 
+	 */
+	public boolean buildTypesAndValues() {
+		//build from the database (synchronizing with external repository)
+		//will probably modify or erase all types from the cache (database)
+		
+		List<AnnotationType> annotTypes = getAllAnnotationTypes();
+		if (annotTypes!=null) {
+			if (annotTypes.isEmpty()) {
+				buildTypes();
+			} else {
+				System.out.println("KR Annotation Types already exist:");
+				for (AnnotationType annotType : annotTypes) {
+					System.out.println(" - Type :"+annotType.getName());
+				}
+			}
+		} else {
+			buildTypes();
+		}
+		
+
+		return buildValues();
+	}
+
+	private void buildTypes(){
+		//System.out.println("KR build types ... : "+fieldsTypesProperties.size());
+		if (fieldsTypesProperties.size() != 0) {
+		 	for (String type : fieldsTypesProperties.keySet()) {
+				HashMap<String, String> typeFieldsContent = fieldsTypesProperties.get(type);
+		
+				String name = typeFieldsContent.get(KnowledgeRepository.NAME);
+				String url = typeFieldsContent.get(KnowledgeRepository.TYPE_URL);
+				String size = typeFieldsContent.get(KnowledgeRepository.TYPE_SIZE);
+				String s_effect = typeFieldsContent.get(KnowledgeRepository.TYPE_EFFECT);
+				if (s_effect == null) s_effect = "SEGMENT";
+		
+				for (String typeField : typeFieldsContent.keySet()) {
+					//System.out.println("Type field : "+typeField+" value : "+typeFieldsContent.get(typeField));
+					if (typeField.equals(KnowledgeRepository.NAME)) {
+						name = typeFieldsContent.get(typeField);
+					} else if (typeField.equals(KnowledgeRepository.TYPE_URL)) {
+						url = typeFieldsContent.get(typeField);
+					}	
+				}
+	
+				AnnotationType annotType = addType(name, type, url, AnnotationEffect.valueOf(s_effect));
+				annotType.setSize(size);
+		 	}
+		} else {
+			//System.out.println("KR should build type (undef) when expert mode is off !!");
+			//AnnotationType annotType = addType("undef", "undef", "", AnnotationEffect.valueOf("SEGMENT"));
+			//annotType.setSize("SMALL");
+		}
+	}
+	
+	/**
+	 * Add and create a type with a default URL
+	 * 
+	 * @param name
+	 * @param id
+	 * @return
+	 */
+	public AnnotationType addType(String name, String id) {
+		return addType(name, id, this.url+"/"+id);
+	}
+
+	/**
+	 * Add and create a type
+	 * 
+	 * @param name
+	 * @param id
+	 * @param url
+	 * @return
+	 */
+	public AnnotationType addType(String name, String id, String url) {
+		return addType(name, id, url, AnnotationEffect.SEGMENT);
+	}
+
+	/**
+	 * Add and create a type
+	 * 
+	 * @param name
+	 * @param id
+	 * @param url
+	 * @return
+	 */
+	public AnnotationType addType(String name, String id, String url, AnnotationEffect ae) {
+		AnnotationType annotType = new AnnotationType(this.getName(), id, name, ae);
+		annotType.setURL(url);
+		//System.out.println("KnowledgeRepository.addType () "+ annotType.toHumanString() +" ---- will be persisted");
+		jpaem.getTransaction().begin();
+		jpaem.persist(annotType);
+		jpaem.getTransaction().commit();	
+		return annotType;
+	}
+
+	public TypedValue addValue(String name, String id, String typeId) {
+		TypedValue val = new TypedValue(name, id, typeId);
+
+		jpaem.getTransaction().begin();
+		jpaem.persist(val);
+		jpaem.getTransaction().commit();	
+		return val;
+	}
+
+	public List<AnnotationType> getAllAnnotationTypes(){
+		TypedQuery<AnnotationType> query = jpaem.createQuery("SELECT t FROM AnnotationType AS t ", AnnotationType.class);
+		return query.getResultList();
+	}
+
+	public List<TypedValue> getAllTypedValuesForType(String idType){
+		TypedQuery<TypedValue> query = jpaem.createQuery("SELECT t FROM TypedValue AS t WHERE t.PK.typeId LIKE '"+idType+"'", TypedValue.class);
+		return query.getResultList();
+	}
+
+	/**
+	 * returns all typed values with a specified type and a specified value
+	 * @return
+	 * @throws Exception
+	 */
+	public List<TypedValue> findTypedValuesWithPrefix(AnnotationType type, String prefix) throws Exception {
+		TypedQuery<TypedValue> query = jpaem.createQuery("SELECT t FROM TypedValue AS t "
+				+ "WHERE t.PK.typeId LIKE '"+type.getId()+"'"
+				+ " AND t.name LIKE '"+prefix+"%'", TypedValue.class);
+		//System.out.println("Query for "+prefix+" has nb results = "+query.getResultList().size());
+		return query.getResultList();
+	}
+
+
+	public void setFieldsTypesProperties(HashMap<String, HashMap<String, String>> fields) {
+		this.fieldsTypesProperties = fields;
+	}
+
+	public abstract boolean buildValues();
+
+	public int getVersion() {
+		return version;
+	}
+
+	public abstract boolean[] mustLoginToKnowledgeRepository();
+
+	public abstract boolean checkConnection();
+
+	public void deleteType(AnnotationType t) {
+		//Remove all values first
+		List<TypedValue> values;
+		try {
+			values = this.getValues(t);
+			for(TypedValue val : values){
+				deleteValue(val);
+			}
+
+			jpaem.getTransaction().begin();
+			jpaem.remove(t);
+			jpaem.getTransaction().commit();	
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+	}
+
+	public void deleteValue(TypedValue v){
+		jpaem.getTransaction().begin();
+		jpaem.remove(v);
+		jpaem.getTransaction().commit();	
+	}
+
+	public AnnotationType getType(String id) {
+		return jpaem.find(AnnotationType.class, id);
+	}
+	
+	HashMap<String, HashMap<String, String>> strings = new HashMap<String, HashMap<String, String>>();
+	public String getString(String lang, String key) {
+		HashMap<String, String> values = null;
+		if (strings.containsKey(lang)) {
+			values = strings.get(lang);
+		}
+		if (values == null) { // get default lang = "en"
+			values = strings.get("en");
+		}
+		if (values == null) { // fail
+			return null;
+		}
+		return values.get(key);
+	}
+	
+	public void setStrings(HashMap<String, HashMap<String, String>> strings) {
+		 this.strings = strings;
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/annotation/repository/KnowledgeRepository.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/annotation/repository/SQLKnowledgeRepository.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/annotation/repository/SQLKnowledgeRepository.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/annotation/repository/SQLKnowledgeRepository.java	(revision 258)
@@ -0,0 +1,151 @@
+package org.txm.annotation.repository;
+
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.HashMap;
+
+import javax.persistence.EntityManager;
+
+import org.txm.annotation.DatabasePersistenceManager;
+import org.txm.sql.SQLConnection;
+import org.txm.utils.logger.Log;
+
+public class SQLKnowledgeRepository extends KnowledgeRepository {
+
+	private static final long serialVersionUID = 3813987566658055166L;
+	protected boolean isConnected = false;
+	
+	public SQLKnowledgeRepository(String name) {
+		super(name);
+	}
+
+	@Override
+	public String getAccessType() {
+		return DatabasePersistenceManager.ACCESS_SQL;
+	}
+	
+	
+
+	@Override
+	public boolean buildValues() {
+		return true; // values are lazily created
+	}
+
+
+	public TypedValue getValue(AnnotationType type, String annotationValue) {
+		//System.out.println("get value KR distant: "+type+"="+annotationValue);
+		String krname = type.getKnowledgeRepository();
+		KnowledgeRepository kr = KnowledgeRepositoryManager.getKnowledgeRepository(krname);
+		EntityManager em = kr.getJPAManager();
+
+		TypedValue value = super.getValue(type, annotationValue);
+
+		if (value != null) {
+			//System.out.println("Value found in persistence.");
+			return value;
+		}
+
+		// Looking for the annotation value in the KR remote SQL database  and building the value as a TypedValue obj.
+		HashMap<String, String> accessProperties = kr.getAccessProperties();
+		HashMap<String, HashMap<String, String>> fieldsByType = this.getFieldsTypesProperties();
+
+		String user = null;
+		String password = null;
+
+		if (kr.isLoginNeeded()) user = System.getProperty(LOGIN_KEY+kr.getName());
+		if (kr.isPasswordNeeded()) password = System.getProperty(PASSWORD_KEY+kr.getName());
+
+		Connection con = null;
+		try {
+			con = SQLConnection.createConnection(accessProperties.get(SQLConnection.SQL_ADDRESS), 
+					accessProperties.get(SQLConnection.SQL_DRIVER), 
+					user, 
+					password);
+		} catch (Exception e) {
+			System.out.println("Fail to get SQL connection with "+accessProperties+" error="+e); //$NON-NLS-1$ //$NON-NLS-2$
+			return null;
+		}
+
+		try {
+			Statement st = con.createStatement();
+
+			HashMap<String, String> typeFieldsContent = fieldsByType.get(type.getId());
+
+			String typeQuery = typeFieldsContent.get(KnowledgeRepository.TYPE_SQLFIELD_QUERY);
+			String name = typeFieldsContent.get(KnowledgeRepository.TYPE_SQLFIELD_NAME);
+			String publicid = typeFieldsContent.get(KnowledgeRepository.TYPE_SQLFIELD_ID);
+			typeQuery += " WHERE "+publicid+" LIKE '"+annotationValue+"'"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+
+			ResultSet rs = st.executeQuery(typeQuery);
+			//System.out.println("SQL query : "+typeQuery); //$NON-NLS-1$
+			//System.out.println("Keys for types : " +fieldsByType.keySet().toString()); //$NON-NLS-1$
+			em.getTransaction().begin();
+			int i = 0;
+			while (rs.next()) {
+				HashMap<String, String> fields = fieldsByType.get(type.getId());
+				for(String fieldKey : fields.keySet()){
+					if (fieldKey.equals(KnowledgeRepository.TYPE_SQLFIELD_NAME)){
+						name = rs.getString(fields.get(KnowledgeRepository.TYPE_SQLFIELD_NAME));
+					}
+					if (fieldKey.equals(KnowledgeRepository.TYPE_SQLFIELD_ID)){
+						publicid = rs.getString(fields.get(KnowledgeRepository.TYPE_SQLFIELD_ID));
+					}
+				}
+				value = new TypedValue(name, publicid, type.getId());
+				em.persist(value);	
+				//System.out.println("Value : "+annotationValue+" ("+publicid+"/"+name+") is going to be persisted !"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+				if (i > 1) {
+					System.out.println("KR should not return more than one value !"); //$NON-NLS-1$
+				}
+				i++;
+			}
+			em.getTransaction().commit();
+
+		} catch (SQLException e) {
+			e.printStackTrace();
+		}
+		isConnected = true;
+		SQLConnection.closeConnection(con);
+		return value;
+	}
+
+	@Override
+	public boolean[] mustLoginToKnowledgeRepository() {
+		boolean[] ret = {false, false};
+		
+		if (isConnected) return ret;
+		Log.warning("KR is not connected, checking credential requirement.");
+		if (DatabasePersistenceManager.ACCESS_SQL.equals(accessProperties.get("mode"))) {
+			ret[0] = "true".equals(accessProperties.get(SQLConnection.SQL_USER));
+			ret[1] = "true".equals(accessProperties.get(SQLConnection.SQL_PASSWORD));
+		} 
+		return ret;
+	}
+
+	@Override
+	public boolean checkConnection() {
+		Connection con = null;
+		try {
+			String user = accessProperties.get(SQLConnection.SQL_USER);
+			String password = accessProperties.get(SQLConnection.SQL_PASSWORD);
+
+			// get user+password values stores in System.properties. these values must be set before
+			if (isLoginNeeded()) user = System.getProperty(LOGIN_KEY+getName());
+			if (isPasswordNeeded()) password = System.getProperty(PASSWORD_KEY+getName());
+			
+			con = SQLConnection.createConnection(accessProperties.get(SQLConnection.SQL_ADDRESS), 
+					accessProperties.get(SQLConnection.SQL_DRIVER), 
+					user, 
+					password);
+			isConnected = true;
+			con.close();
+			return true;
+		} catch (Exception e) {
+			System.out.println("Fail to get SQL connection with "+accessProperties+", error="+e);
+		}
+		isConnected = false;
+		return false;
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/annotation/repository/SQLKnowledgeRepository.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/annotation/PropertiesRecoder.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/annotation/PropertiesRecoder.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/annotation/PropertiesRecoder.java	(revision 258)
@@ -0,0 +1,97 @@
+package org.txm.annotation;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+
+import javax.xml.stream.XMLStreamException;
+
+import org.txm.importer.StaxIdentityParser;
+
+public class PropertiesRecoder extends StaxIdentityParser {
+	
+	public PropertiesRecoder(File xmlFile, HashSet<String> fromProperties, HashSet<String> toProperties) {
+		super(xmlFile);
+	}
+	boolean startW = false, startAna = false;
+	ArrayList<String[]> anaValues = new ArrayList<String[]>();
+	String[] currentAnaValues = {"","",""};
+	StringBuilder anaValue = new StringBuilder();
+	String EMPTY = "";
+	
+	@Override
+	public void processStartElement() {
+		if (localname.equals("w")) {
+			startW = true;
+			anaValues.clear();
+			super.processStartElement();
+		} else if (localname.equals("ana")) {
+			if (startW) {
+				startAna = true;
+				anaValue.setLength(0);
+				currentAnaValues[0] = EMPTY;
+				currentAnaValues[1] = EMPTY;
+				currentAnaValues[2] = EMPTY;
+				for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
+					if (parser.getAttributeLocalName(i).equals("resp")) {
+						currentAnaValues[0] = parser.getAttributeValue(i);
+					} else if (parser.getAttributeLocalName(i).equals("type")) {
+						currentAnaValues[1] = parser.getAttributeValue(i);
+					}
+				}
+			}
+		} else {
+			super.processStartElement();
+		}
+	}
+	
+	@Override
+	public void processCharacters() {
+		if (startAna) {
+			anaValue.append(parser.getText());
+		} else {
+			super.processCharacters();
+		}
+	};
+	
+	@Override
+	public void processEndElement() {
+		if (localname.equals("w")) {
+			startW = false;
+			
+			for (String[] values : anaValues) {
+				try {
+					writer.writeStartElement("txm:ana");
+					writer.writeAttribute("resp", values[0]);
+					writer.writeAttribute("type", values[1]);
+					writer.writeCharacters(values[2]);
+					writer.writeEndElement();
+				} catch (XMLStreamException e) {
+					// TODO Auto-generated catch block
+					e.printStackTrace();
+				}
+			}
+			
+			super.processEndElement();
+		} else if (localname.equals("ana")) {
+			if (startW) {
+				currentAnaValues[2] = anaValue.toString();
+				anaValues.add(currentAnaValues);
+				startAna = false;
+			}
+		} else {
+			super.processEndElement();
+		}
+	}
+	
+	public static void main(String args[]) {
+		File xmlFile = new File("/home/mdecorde/TEMP/test.xml");
+		File outfile = new File("/home/mdecorde/TEMP/test-o.xml");
+		HashSet<String> fromProperties = new HashSet<String>();
+		HashSet<String> toProperties = new HashSet<String>();
+		
+		PropertiesRecoder recoder = new PropertiesRecoder(xmlFile, fromProperties, toProperties);
+		System.out.println("Result: "+recoder.process(outfile));
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/annotation/PropertiesRecoder.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/annotation/AnnotationComparator.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/annotation/AnnotationComparator.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/annotation/AnnotationComparator.java	(revision 258)
@@ -0,0 +1,48 @@
+package org.txm.annotation;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Comparator;
+import java.util.StringTokenizer;
+
+public class AnnotationComparator implements Comparator<Annotation> {
+
+	public int compare(Annotation a1, Annotation a2) {
+	    // comparer e1 et e2
+		
+		DateFormat dateformat =  new SimpleDateFormat("yyyy-MM-dd");
+		//System.out.println("Date 1 : "+a1.getDate() + " => "+dateformat.format(a1.getDate()));
+		//System.out.println("Date 2 : "+a2.getDate() + " => "+dateformat.format(a2.getDate()));
+		StringTokenizer tokenizer1 = new StringTokenizer(dateformat.format(a1.getDate()), "-");
+		StringTokenizer tokenizer2 = new StringTokenizer(dateformat.format(a2.getDate()), "-");
+		
+		for(int i = 0 ; i < 2 && tokenizer1.hasMoreTokens() && tokenizer2.hasMoreTokens() ; ++i) {
+			String token1 = tokenizer1.nextToken();
+			String token2 = tokenizer2.nextToken();
+			int valint1 = new Integer(token1).intValue();
+			int valint2 = new Integer(token2).intValue();
+			//System.out.println(valint1+" | "+valint2);
+			if (valint1<valint2){
+				return -1;
+			}else {
+				if(valint1>valint2){
+					return 1;
+				}else {
+					//System.out.println("idem ["+i+"]");
+				}
+				
+			}
+		}
+		
+		return 0;
+			
+	  }
+	
+	public static void main(String[] args) {
+		AnnotationComparator comp = new AnnotationComparator();
+		Annotation a1 = new Annotation("truc", "bidule", 3, 10);
+		Annotation a2 = new Annotation("truc", "bidule", 6, 8);
+		int ret = comp.compare(a1, a2);
+		System.out.println("Le retour est : "+ret);
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/annotation/AnnotationComparator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/annotation/DatabasePersistenceManager.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/annotation/DatabasePersistenceManager.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/annotation/DatabasePersistenceManager.java	(revision 258)
@@ -0,0 +1,51 @@
+package org.txm.annotation;
+
+import java.util.HashMap;
+
+import javax.persistence.EntityManager;
+
+public class DatabasePersistenceManager {
+
+	//Object can be Corpus or KnowledgeRepository
+	protected HashMap<Object, EntityManager> managers;
+	public static final String PERSISTENCE_UNIT_NAME = "MyPUWithHSQL";
+	public static String ACCESS_SQL = "sql";
+	public static String ACCESS_FILE = "file";
+	public static String ACCESS_SPARQL = "sparql";
+
+	/**
+	 * Instantiates a new database manager.
+	 */
+	public DatabasePersistenceManager() {
+		managers = new HashMap<Object, EntityManager>() ;
+	}
+
+	/**
+	 * The Object can be a Corpus or a KnowledgeRepository
+	 * @param obj
+	 * @return
+	 */
+	public EntityManager getJPAEntityManager(Object obj){
+		if (managers.containsKey(obj)) {
+			return managers.get(obj);
+		}
+		return null;
+	}
+
+	public void closeManager(Object key) {
+		if (!managers.keySet().contains(key)) return;
+
+		managers.get(key).close();
+		managers.remove(key);
+	}
+
+	public void closeAllManagers() {
+		for (Object key : managers.keySet()) {
+			EntityManager m = managers.get(key);
+			m.flush();
+			m.createNativeQuery("SHUTDOWN;");
+			m.close();
+		}
+		managers.clear();
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/annotation/DatabasePersistenceManager.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/annotation/storage/temporary/TemporaryAnnotationManager.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/annotation/storage/temporary/TemporaryAnnotationManager.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/annotation/storage/temporary/TemporaryAnnotationManager.java	(revision 258)
@@ -0,0 +1,559 @@
+package org.txm.annotation.storage.temporary;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.logging.Level;
+
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.TypedQuery;
+import javax.persistence.spi.PersistenceUnitTransactionType;
+
+import org.eclipse.persistence.config.PersistenceUnitProperties;
+import org.eclipse.persistence.internal.jpa.deployment.SEPersistenceUnitInfo;
+import org.eclipse.persistence.jpa.PersistenceProvider;
+//import org.eclipse.persistence.jpa.PersistenceProvider;
+import org.txm.Toolbox;
+import org.txm.annotation.Annotation;
+import org.txm.annotation.AnnotationPK;
+import org.txm.annotation.DatabasePersistenceManager;
+import org.txm.annotation.repository.AnnotationEffect;
+import org.txm.annotation.repository.AnnotationType;
+import org.txm.annotation.repository.TypedValue;
+import org.txm.searchengine.cqp.corpus.MainCorpus;
+import org.txm.searchengine.cqp.corpus.query.Match;
+import org.txm.utils.logger.Log;
+
+public class TemporaryAnnotationManager {
+
+	public static HashMap<String, Object> getInitialisationProperties(MainCorpus corpus) {
+		String path = corpus.getBaseDirectory().getAbsolutePath()+"/temporary_annotations/db";
+		
+		HashMap<String, Object> properties = new HashMap<String, Object>();
+		//System.out.println("CLASSLOADER: "+Toolbox.class.getClassLoader());
+		properties.put(PersistenceUnitProperties.CLASSLOADER, Toolbox.class.getClassLoader());
+		properties.put("javax.persistence.jdbc.driver", "org.hsqldb.jdbcDriver");
+		
+		String urlProperty = "jdbc:hsqldb:file:"+path+";shutdown=true;hsqldb.write_delay=false;hsqldb.lock_file=false;";
+		if (Log.getLevel().intValue() < Level.WARNING.intValue()) {
+			urlProperty += "";
+		} else {
+			urlProperty += "hsqldb.applog=0;hsqldb.sqllog=0";
+		}
+		properties.put("javax.persistence.jdbc.url", urlProperty);
+		properties.put("javax.persistence.jdbc.username", "SA");
+		properties.put(PersistenceUnitProperties.DDL_GENERATION_MODE, "database");
+		properties.put(PersistenceUnitProperties.DDL_GENERATION, "create-or-extend-tables"); // create&update table if needed
+		
+		if (Log.getLevel().intValue() < Level.WARNING.intValue()) {
+			properties.put(PersistenceUnitProperties.LOGGING_LEVEL, "WARNING");
+			properties.put(PersistenceUnitProperties.LOGGING_PARAMETERS, "true");
+		} else {
+			properties.put(PersistenceUnitProperties.LOGGING_LEVEL, "OFF");
+			properties.put(PersistenceUnitProperties.LOGGING_PARAMETERS, "false");
+		}
+		
+		
+		return properties;
+	}
+	private EntityManager em;
+
+	private MainCorpus corpus;
+	
+	public TemporaryAnnotationManager(MainCorpus corpus) {
+		this.corpus = corpus;
+		em = initTemporaryAnnotationDatabase();
+	}
+
+	public TemporaryAnnotationManager(MainCorpus corpus, HashMap<String, Object> properties) {
+		this.corpus = corpus;
+		em = initTemporaryAnnotationDatabase(properties);
+	}
+	
+	public void checkData() throws Exception{
+		List<Annotation> annots = getAnnotations();
+		System.out.println("ID \t Type \t Val \t startPos \t startEnd \t Text "); 
+		System.out.println("----------------------------------------------------");
+		for (Annotation an : annots){
+			System.out.print("\t "+ an.getPK().getRefType());
+			System.out.print("\t "+ an.getValue());
+			System.out.print("\t "+ an.getPK().getStartPosition());
+			System.out.print("\t "+ an.getPK().getEndPosition()+"\n");
+		}
+	}
+
+	public void close() {
+		if (em != null) {
+			em.close();
+		}
+	}
+
+	
+	public List<Annotation> createAnnotation(AnnotationType type, TypedValue value, int startPos, int endPos) throws Exception {
+		em.getTransaction().begin();
+		List<Annotation> a = createAnnotationNoCommit(type, value, startPos, endPos);
+		em.getTransaction().commit();
+		return a;
+	}
+
+	/**
+	 * update or create an annotation BUT em.getTransaction().begin(); and em.getTransaction().commit();
+	 * must be called before and after !!
+	 * 
+	 * @param type
+	 * @param value
+	 * @param startPos
+	 * @param endPos
+	 * @param authorizedOverlap
+	 * @return overlapping annotations
+	 * @throws Exception
+	 */
+	public List<Annotation> createAnnotationNoCommit(AnnotationType type, TypedValue value, int startPos, int endPos) throws Exception{
+		AnnotationPK pkannot = new AnnotationPK(startPos, endPos, type.getId());
+		Annotation annot = em.find(Annotation.class, pkannot);
+		List<Annotation> overlapingAnnotations = new ArrayList<Annotation>();
+		if (annot == null) { // create annotation
+
+			if (type.getEffect().equals(AnnotationEffect.SEGMENT)) {
+				//check if it does not already exist, with either one of the positions (overlaps)
+				//isOverlapAnnots = isOverlapAnnotationCritical(refType, refVal, startPos, endPos);
+				ArrayList<Match> matches = new ArrayList<Match>();
+				matches.add(new Match(startPos, endPos));
+				overlapingAnnotations = getAnnotations(null, matches, null, false, true); // getAll annotation ovelapping with startPos-endPos
+				for (int i = 0 ; i < overlapingAnnotations.size() ; i++) { // parse overlapping annotations to remove wrapping annotation with different type and annotation with same type and same position 
+					annot = overlapingAnnotations.get(i);
+					if (annot.getType().equals(type.getId())) {
+						if (annot.getStart() == startPos && annot.getEnd() == endPos) {
+							overlapingAnnotations.remove(i);
+							i--;
+						}
+					} else {
+						//System.out.println("Pas le même TYPE !!!!! DONC on exige que seuls  INNER et OUTTER overlaps sont admis");
+						if ((annot.getStart() <= startPos && endPos <= annot.getEnd() ||
+								(startPos <= annot.getStart() && annot.getEnd() <= endPos))) {
+							/*System.out.println("Taille du tableau annotations AVANT : "+overlapingAnnotations.size());
+							System.out.println(annot.getStart()+" <= " +startPos+" && "+endPos+" <= "+annot.getEnd()+" OU ");
+							System.out.println(startPos+" <= " +annot.getStart()+" && "+annot.getEnd()+" <= "+endPos);*/
+							overlapingAnnotations.remove(i);
+							//System.out.println("Taille du tableau annotations APRES : "+overlapingAnnotations.size());
+							i--;
+						}else {
+							//System.out.println(annot.getStart()+"-"+annot.getEnd()+" // "+startPos+"-"+endPos);
+							
+						}
+					}
+				}
+			} else {
+				// no need to check collision
+			}
+
+			if (overlapingAnnotations.size() > 0) { // don't create the annotation
+//				for (Annotation overlapAnnot : overlapingAnnotations) {
+//					System.out.println("---Overlap with : "+overlapAnnot.toString());
+//				}
+			} else { // we can create the annotation \o/
+				annot = new Annotation(type.getId(), value.getId(), startPos, endPos);
+				
+				em.persist(annot);
+				
+				//System.out.println("--- Create : "+annot.toString());
+			}	
+		} else { // update annotation
+			//UPDATE 
+			//System.out.println("--- Update annot : "+annot.toString()+" ----- ");
+			annot.setReferentielVal(value.getId());
+		}
+		return overlapingAnnotations;
+	}
+
+	/**
+	 * 
+	 * @param refType
+	 * @param refVal
+	 * @param CQPpositions
+	 * @return
+	 * @throws Exception
+	 */
+	public List<Annotation> createAnnotations(AnnotationType type, TypedValue value, List<Match> matches) throws Exception{
+		List<Annotation> isOverlappedWithAnnots = new ArrayList<Annotation>();
+		em.getTransaction().begin(); // mandatory ! :@
+		for (Match m : matches) {
+			int t = m.getTarget();
+			List<Annotation> annotsOverlapped = null;
+			if (t >= 0) {
+				annotsOverlapped = createAnnotationNoCommit(type, value, t,t);
+			} else {
+				annotsOverlapped = createAnnotationNoCommit(type, value, m.getStart(), m.getEnd());
+			}
+
+			if (annotsOverlapped != null) {
+				isOverlappedWithAnnots.addAll(annotsOverlapped);
+			}
+		}
+		em.getTransaction().commit(); // mandatory ! :@
+		return isOverlappedWithAnnots;
+	}
+
+	public void deleteAnnotation(AnnotationType type, int start, int end) throws Exception {
+		em.getTransaction().begin();
+		deleteAnnotationNoCommit(type, start, end);
+		em.getTransaction().commit();
+	}
+
+	public void deleteAnnotation(AnnotationType type, Match m) throws Exception {
+		deleteAnnotation(type, m.getStart(), m.getEnd());
+	}
+
+	/**
+	 * Warning this method must be called ONLY if a transaction has been start AND dont forget to call commit after
+	 * @param type
+	 * @param start
+	 * @param end
+	 */
+	public void deleteAnnotationNoCommit(AnnotationType type, int start, int end) {
+		List<Annotation> annots = getAnnotations(type, start, end);
+		for (Annotation annot : annots){
+			em.remove(annot);
+		}
+	}
+
+	public void deleteAnnotations() throws Exception {
+		List<Annotation> annots = getAnnotations();
+		em.getTransaction().begin();
+		for (Annotation annot : annots){
+			em.remove(annot);
+		}
+		em.getTransaction().commit();
+	}
+
+	public void deleteAnnotations(AnnotationType refType, List<Match> matches) throws Exception {	
+		em.getTransaction().begin();
+		for (Match m : matches) {
+			deleteAnnotationNoCommit(refType, m.getStart(), m.getEnd());
+		}
+		em.getTransaction().commit();
+	}
+
+	/**
+	 * returns all annotations with no particular constraints
+	 * @return
+	 * @throws Exception
+	 */
+	public List<Annotation> getAnnotations() throws Exception {
+
+		TypedQuery<Annotation> query = em.createQuery("SELECT annot FROM Annotation AS annot", Annotation.class);
+		return query.getResultList();
+	}
+
+
+	/**
+	 * returns all annotations with no particular constraints
+	 * @return
+	 * @throws Exception
+	 */
+	public List<Annotation> getAnnotations(AnnotationType type) throws Exception {
+		return getAnnotations(type, false);
+	}
+
+	/**
+	 * returns all annotations with no particular constraints
+	 * @return
+	 * @throws Exception
+	 */
+	public List<Annotation> getAnnotations(AnnotationType type, boolean ordered) throws Exception {
+		return getAnnotations(type, -1, -1, null);
+	}
+	
+	public List<Annotation> getAnnotations(AnnotationType type, int start, int end) {
+		return getAnnotations(type, start, end, null);
+	}
+
+	/**
+	 * returns annotation with all available constraints
+	 * 
+	 * @param typeId
+	 * @return
+	 * @throws Exception
+	 */
+	public List<Annotation> getAnnotations(AnnotationType refType, int startPosition, int endPosition, String value) {
+		String query = "SELECT annot FROM Annotation AS annot "
+				+ "WHERE annot.PK.refType LIKE '"+refType.getId()+"'";
+		if (startPosition >= 0)
+			query += " AND annot.PK.startpos = "+startPosition;
+		if (endPosition >= 0)
+			query += " AND annot.PK.endpos = "+endPosition;
+		if (value != null)
+			query += " AND annot.refVal LIKE ':"+value+"' ";
+	
+		TypedQuery<Annotation> typedQuery = em.createQuery(query, Annotation.class);
+		return typedQuery.getResultList();
+	}
+	
+	
+	/**
+	 * returns all annotations given a series of positions (start and end)
+	 * @return
+	 * @throws Exception
+	 */
+	public List<Annotation> getAnnotations(AnnotationType type, List<Match> matches, String value, boolean ordered, boolean overlap) throws Exception {
+		String query = "SELECT annot FROM Annotation AS annot";
+		boolean where = false; // TODO: fucking shit, need to replace this
+
+		String queryPos = " ";
+		int i = 0;
+
+		for (Match match : matches) {
+			if (i==0) {
+				if (overlap) {
+					queryPos+= " ( ("+overlapString(match.getStart(), match.getEnd(), 0)+")" 
+							+ " OR ("+overlapString(match.getStart(), match.getEnd(), 1)+") ";
+					//String overlapBesides = "annot.PK.endpos < "+match.getStart()+" OR annot.PK.startpos > "+match.getEnd()+"";
+					//queryPos += " AND NOT ( "+overlapBesides+" ) ) ";
+					queryPos += " OR ( annot.PK.startpos <= "+match.getStart()+ " AND "+match.getEnd()+" <= annot.PK.endpos ) )";
+				} else {
+					queryPos+= " (annot.PK.startpos = "+match.getStart()+" AND annot.PK.endpos = "+match.getEnd()+")";
+				}
+			} else {
+				if (overlap) {
+					queryPos+= " OR ( ("+overlapString(match.getStart(), match.getEnd(), 0)+")" 
+							+ " OR ("+overlapString(match.getStart(), match.getEnd(), 1)+") ";
+					//String overlapBesides = "annot.PK.endpos < "+match.getStart()+" OR annot.PK.startpos > "+match.getEnd()+"";
+					//queryPos += " AND NOT ( "+overlapBesides+" ) ) ";
+					queryPos += " OR ( annot.PK.startpos <= "+match.getStart()+ " AND "+match.getEnd()+" <= annot.PK.endpos ) )";
+				} else {
+					queryPos+= " OR (annot.PK.startpos = "+match.getStart()+" AND annot.PK.endpos = "+match.getEnd()+")";
+				}
+			}
+			++i;
+		}
+
+		if (matches.size() > 0) {
+			if (where)
+				query += " AND ( "+queryPos+" )";
+			else {
+				query += " WHERE ( "+queryPos+" )";
+				where = true;
+			}
+		}
+
+		if (type != null) {
+			if (where)
+				query += " AND annot.PK.refType LIKE '"+type.getId()+"'";
+			else {
+				query += " WHERE annot.PK.refType LIKE '"+type.getId()+"'";
+				where = true;
+			}
+		} 		
+
+		if (value!=null) {
+			if (where)
+				query += " AND annot.PK.refVal LIKE '"+value+"'";
+			else {
+				query += " WHERE annot.PK.refVal LIKE '"+value+"'";
+				where = true;
+			}
+		}
+		//System.out.println("Query : "+ query);
+		//System.out.println("STOP GET ANNOTATIONS @"+i);
+		TypedQuery<Annotation> typedQuery = em.createQuery(query, Annotation.class);
+		return typedQuery.getResultList();
+	}
+
+	public List<Annotation> getAnnotationsForMatches(List<Match> matches, List<Annotation> annotations, boolean overlap) {
+		List<Annotation> annotsList = new ArrayList<Annotation>();
+
+		int iMatch = 0;
+		int iAnnotation = 0;
+		int nMatch = matches.size();
+		int nAnnotations = annotations.size();
+
+		while (iMatch < nMatch && iAnnotation < nAnnotations) {
+			if (overlap) {
+				if (matches.get(iMatch).getEnd() < annotations.get(iAnnotation).getStart()) {
+					iMatch++;
+					annotsList.add(null); // nothing for this match
+				} else if (annotations.get(iAnnotation).getEnd() < matches.get(iMatch).getStart()) {
+					iAnnotation++;
+				} else {
+					annotsList.add(annotations.get(iAnnotation));
+					iMatch++;
+				}
+			} else {
+				if (matches.get(iMatch).getEnd() < annotations.get(iAnnotation).getStart()) {
+					iMatch++;
+					annotsList.add(null); // nothing for this match
+				} else if (annotations.get(iAnnotation).getEnd() < matches.get(iMatch).getStart()) {
+					iAnnotation++;
+				} else if (annotations.get(iAnnotation).getStart() == matches.get(iMatch).getStart() && 
+						annotations.get(iAnnotation).getEnd() == matches.get(iMatch).getEnd()) {
+					annotsList.add(annotations.get(iAnnotation));
+					iMatch++;
+					iAnnotation++;
+				} else {
+					iAnnotation++;
+				}
+			}
+		}
+
+		while (annotsList.size() < matches.size() ) annotsList.add(null); // fill matches that were not process due to no more annotations
+
+		return annotsList;
+	}
+
+	/**
+	 * You know what you're doing
+	 * @return the EntityManager that manages the DB
+	 */
+	public EntityManager getEntityManager() {
+		return em;
+	}
+	
+	public boolean hasChanges() {
+		try {
+			if (em == null) return false;
+			TypedQuery<Annotation> query = em.createQuery("SELECT annot FROM Annotation AS annot", Annotation.class);
+			//System.out.println("hasChanges query rez: "+query.getResultList());
+			return query.setMaxResults(1).getResultList().size() > 0;
+		} catch(Exception e) {
+			Log.info("Error while testing corpus annotations state: "+e);
+		}
+		return false;
+	}
+	
+	public EntityManager initTemporaryAnnotationDatabase(){	
+		HashMap<String, Object> properties = TemporaryAnnotationManager.getInitialisationProperties(corpus);
+
+		return initTemporaryAnnotationDatabase(properties);
+	}
+
+	public EntityManager initTemporaryAnnotationDatabase(HashMap<String, Object> properties){	
+		PersistenceProvider pp = new PersistenceProvider();
+	//	System.out.println("Check for provider: "+pp.checkForProviderProperty(properties));
+		
+		//System.out.println("Generate schema: "+pp.generateSchema(PERSISTENCE_UNIT_NAME, properties));
+//		SEPersistenceUnitInfo infos = new SEPersistenceUnitInfo();
+//		infos.setPersistenceUnitName(PERSISTENCE_UNIT_NAME);
+//		infos.setTransactionType(PersistenceUnitTransactionType.RESOURCE_LOCAL);
+//		infos.setPersistenceProviderClassName("org.eclipse.persistence.jpa.PersistenceProvider");
+//		infos.getManagedClassNames().add("org.txm.annotation.Annotation");
+//		infos.getManagedClassNames().add("org.txm.annotation.TypedValue");
+//		pp.generateSchema(infos, properties);
+		
+		EntityManagerFactory emf = pp.createEntityManagerFactory(DatabasePersistenceManager.PERSISTENCE_UNIT_NAME, properties);
+		
+		em = (EntityManager) emf.createEntityManager();
+
+		return em;
+	}
+
+	private String overlapString(int startPos, int endPos, int typeOverlap){
+		String overlap = "";
+		switch (typeOverlap) {
+			case 0 :  return overlap += "annot.PK.startpos >= "+startPos+" AND annot.PK.startpos <= "+endPos ; // OverlapOnStart
+			case 1 :  return overlap += "annot.PK.endpos >= "+startPos+" AND annot.PK.endpos <= "+endPos+""; // OverlapOnEnd
+			default : return overlap;
+		}
+
+	}
+
+	/**
+	 * returns annotation with all available constraints
+	 * 
+	 * @param typeId
+	 * @return
+	 * @throws Exception
+	 */
+	// A REVOIR avec le tuto : http://stackoverflow.com/questions/2772305/jpql-in-clause-java-arrays-or-lists-sets
+	/*public List<Annotation> getAnnotations(AnnotationType refType, int[] startPositions, int[] endPositions, String value, boolean ordered) {
+		EntityManager em = getJPAManager(corpus);
+		String query = "SELECT annot FROM Annotation AS annot "
+				+ "WHERE annot.PK.refType LIKE '"+refType.getId()+"'";
+		if (startPositions.length > 0)
+			query += " AND annot.PK.startpos IN :startpositions ";
+		if (endPositions.length > 0)
+			query += " AND annot.PK.endpos IN :endpositions ";
+		if (value != null)
+			query += " AND annot.refVal LIKE ':"+value+"' ";
+		if (ordered)
+			query += " ORDER BY annot.refVal, annot.PK.startpos ASC";
+
+		TypedQuery<Annotation> typedQuery = em.createQuery(query, Annotation.class);
+		List<String> positionsOfStart = Arrays.asList(startPositions.toString());
+		List<String> positionsOfEnd = Arrays.asList(endPositions.toString());
+		typedQuery.setParameter("startpositions", positionsOfStart);
+		typedQuery.setParameter("endpositions", positionsOfEnd);
+		return typedQuery.getResultList();
+	}*/
+
+//	/**
+//	 * Should not 
+//	 * @param corpus
+//	 * @param refType
+//	 * @param refVal
+//	 * @param startPos
+//	 * @param endPos
+//	 * @return
+//	 */
+//	public List<Annotation> isOverlapAnnotationCritical(AnnotationType refType, TypedValue refVal, int startPos, int endPos){	
+//		EntityManager em = getJPAManager(corpus);
+//
+//		String query = "SELECT annot FROM Annotation AS annot "
+//
+//					+ "WHERE ( annot.PK.refType not LIKE '"+refType.getId()+"' ";
+//		//String overlapInside = "annot.PK.startpos >= "+startPos+" OR annot.PK.endpos <= "+endPos+"";
+//		//String overlapOutside = "annot.PK.startpos <= "+startPos+" OR annot.PK.endpos >= "+endPos+"";
+//		//query += " AND ( ( "+overlapInside+" ) OR ( "+overlapOutside+" ) ) AND NOT ( "+overlapBesides+" ) ) ";
+//		String overlapOnEnd = "annot.PK.startpos >= "+startPos+" AND annot.PK.startpos <= "+endPos +" AND annot.PK.endpos >= "+endPos+"";
+//		String overlapOnStart = "annot.PK.startpos <= "+startPos+" AND  annot.PK.endpos >= "+startPos+" AND annot.PK.endpos <= "+endPos+"";
+//		String overlapBesides = "annot.PK.endpos < "+startPos+" OR annot.PK.startpos > "+endPos+"";
+//		query += " AND ( ( "+overlapOnEnd+" ) OR ( "+overlapOnStart+" ) ) ) ";
+//		query += " OR ( annot.PK.refType LIKE '"+refType.getId()+"' ";
+//		query += " AND NOT ( "+overlapBesides+" ) ) ";
+//
+//		System.out.println("Query for OVERLAP : "+query);
+//		TypedQuery<Annotation> typedQuery = em.createQuery(query, Annotation.class);
+//		return typedQuery.getResultList();
+//	}
+
+	// Not necessary for the moment (@finnishgazelle, 22/10/2015)
+
+	/*private void modifyAnnotations(int typeModif, List<int[]> positions, String refVal, String newrefVal, String refType, String newrefType) throws Exception{
+			switch(typeModif){
+				case MODIFY_TYPEVAL : modifyAnnotations(positions, refType, refVal, newrefType, newrefVal) ;
+									break;
+				case MODIFY_VAL : modifyAnnotations(positions, refVal, newrefVal);
+									break;
+				default: ;
+									break;
+			}
+		}
+
+
+		private void modifyAnnotations(List<int[]> positions, String refVal, String newrefVal) throws Exception{
+			//List<Annotation> annots = getAnnotationsByRefValue(refVal);
+			for (int[] position : positions){
+				Annotation annot = entityManager.find(Annotation.class, position[0]+"_"+position[1]);
+				if(annot.getReferentielVal().equals(refVal)){
+					entityManager.getTransaction().begin();
+					annot.setReferentielVal(newrefVal);
+					entityManager.getTransaction().commit();
+				}
+
+			}
+		}
+
+
+		private void modifyAnnotations(List<int[]> positions, String refType, String refVal, String newrefType, String newrefVal) throws Exception{
+			for (int[] position : positions){
+				Annotation annot = entityManager.find(Annotation.class, position[0]+"_"+position[1]);
+				if(annot.getReferentielVal().equals(refVal) && annot.getReferentielType().equals(refType)){
+					entityManager.getTransaction().begin();
+					annot.setReferentielVal(newrefVal);
+					annot.setReferentielVal(newrefType);
+					entityManager.getTransaction().commit();
+				}
+			}
+		}*/
+
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/annotation/storage/temporary/TemporaryAnnotationManager.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/stat/utils/ConsoleProgressBar.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/stat/utils/ConsoleProgressBar.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/stat/utils/ConsoleProgressBar.java	(revision 258)
@@ -0,0 +1,107 @@
+package org.txm.stat.utils;
+import org.txm.functions.ProgressWatcher;
+
+public class ConsoleProgressBar implements ProgressWatcher {
+	static int LINE_PROGRESS = 10; // number of tick to draw a line
+	static int TOTAL_PROGRESS = 100;
+	
+	double progress = 0.0d;
+	double progress_per_tick = 1.0d;
+	int point_progress = 0;
+	boolean done = false;
+	String mode = "%";
+	public ConsoleProgressBar(long amount) {
+		start(amount);
+	}
+	
+	public void start(long amount) {
+		progress = 0.0d;
+		point_progress = 0;
+		done = false;
+		progress_per_tick = 100f / amount;
+		
+		if (amount <= 100L) {
+			mode = " ";
+			progress_per_tick = 1;
+		}
+	}
+	
+	public void tick() {
+		if (done) return;
+		if (progress == 0.0d) System.out.print(mode);
+		
+		progress += progress_per_tick;
+		while (progress > point_progress) {
+			point_progress++;
+			if (point_progress%LINE_PROGRESS == 0) System.out.print("|");
+			else System.out.print(".");
+			
+			if (point_progress == TOTAL_PROGRESS) {
+				done = true;
+				System.out.println("");
+			}
+		}
+	}
+	
+	public static void main(String[] args) {
+		int[] amounts = {10,50,150,155,15000,150000};
+		for (int amount : amounts) {
+			System.out.println(""+amount+" ticks");
+			ConsoleProgressBar cpb = new ConsoleProgressBar(amount);
+			for (int i = 0 ; i < amount ; i++) cpb.tick();
+			System.out.println();
+		}
+	}
+
+	@Override
+	public void worked(int amount, String message) {
+		this.tick();
+		System.out.println(message);
+		
+	}
+
+	@Override
+	public void setMessage(String message) {
+		System.out.println(message);
+	}
+
+	@Override
+	public boolean isCanceled() {
+		return false;
+	}
+
+	@Override
+	public void done() {
+		done = true;
+		System.out.println("");
+	}
+
+	@Override
+	public void worked(int step) {
+		for (int i = 0 ; i < step ; i++) tick();
+	}
+	
+	@Override
+	public void worked() {
+		tick();
+	}
+
+	@Override
+	public void acquireSemaphore() {
+		
+	}
+
+	@Override
+	public boolean tryAcquireSemaphore() {
+		return false;
+	}
+
+	@Override
+	public void releaseSemaphore() { }
+
+	@Override
+	public void beginTask(String name, long l) {
+		System.out.println("Begining "+name);
+		this.start(l);
+	}
+}
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/java/org/txm/stat/utils/ConsoleProgressBar.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/test/TestConcordance.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/test/TestConcordance.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/test/TestConcordance.java	(revision 258)
@@ -0,0 +1,126 @@
+package org.txm.test;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.txm.functions.ReferencePattern;
+import org.txm.functions.concordances.Concordance;
+import org.txm.functions.concordances.comparators.LexicographicKeywordComparator;
+import org.txm.functions.concordances.comparators.LexicographicLeftContextComparator;
+import org.txm.functions.concordances.comparators.LexicographicRightContextComparator;
+import org.txm.functions.concordances.comparators.LineComparator;
+import org.txm.functions.concordances.comparators.NullComparator;
+import org.txm.functions.concordances.comparators.PropertiesReferenceComparator;
+import org.txm.searchengine.cqp.corpus.Corpus;
+import org.txm.searchengine.cqp.corpus.CorpusManager;
+import org.txm.searchengine.cqp.corpus.Property;
+import org.txm.searchengine.cqp.corpus.query.Query;
+
+/**
+ * Test class for the concordances
+ * 
+ * @author mdecorde
+ *
+ */
+public class TestConcordance {
+	/**
+	 * the corpus name to use
+	 */
+	static String CORPUS = "DISCOURS"; //$NON-NLS-1$
+	
+	public static boolean allTests(File outdir) {
+		TestConcordance tester = new TestConcordance();
+		return tester.test1(outdir);
+	}
+	
+	/**
+	 * First test
+	 * @param outdir : the out folder
+	 */
+	public boolean test1(File outdir) {
+		return test(new File(outdir, TestConcordance.class.getName()+"_test1.csv"), CORPUS, null, "je", //$NON-NLS-1$ //$NON-NLS-2$
+				Arrays.asList("word"), Arrays.asList("word"),Arrays.asList("word"),  //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+				Arrays.asList("word"), Arrays.asList("word"),Arrays.asList("word"),  //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+				Arrays.asList("text_id", "text_loc"), Arrays.asList("text_id"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+				10, 40, null);
+	}
+	
+	private boolean test(File outfile, String corpusname, String subcorpusname, String queryString,
+			List<String> leftCSortPropertiesString, List<String> rightCSortPropertiesString, List<String> keywordSortPropertiesString,
+			List<String> leftCViewPropertiesString, List<String> rightCViewPropertiesString, List<String> keywordViewPropertiesString,
+			List<String> refPatternsString, List<String> refAnalysePatternString, int leftContextSize, int rightContextSize, String sortBy) {
+		try {
+			Corpus corpus = CorpusManager.getCorpusManager().getCorpus(corpusname);
+			if (subcorpusname != null) {
+				corpus = corpus.getSubcorpusByName(subcorpusname);
+			}
+			Query query = new Query(Query.fixQuery(queryString));
+			
+			List<Property> leftCSortProperties = new ArrayList<Property>();
+			for (String p : leftCSortPropertiesString) leftCSortProperties.add(corpus.getProperty(p));
+			
+			List<Property> rightCSortProperties =  new ArrayList<Property>();
+			for (String p : rightCSortPropertiesString) rightCSortProperties.add(corpus.getProperty(p));
+			
+			List<Property> keywordSortProperties =  new ArrayList<Property>();
+			for (String p : keywordSortPropertiesString) keywordSortProperties.add(corpus.getProperty(p));
+			
+			List<Property> leftCViewProperties = new ArrayList<Property>();
+			for (String p : leftCViewPropertiesString) leftCViewProperties.add(corpus.getProperty(p));
+			
+			List<Property> rightCViewProperties =  new ArrayList<Property>();
+			for (String p : rightCViewPropertiesString) rightCViewProperties.add(corpus.getProperty(p));
+			
+			List<Property> keywordViewProperties =  new ArrayList<Property>();
+			for (String p : keywordViewPropertiesString) keywordViewProperties.add(corpus.getProperty(p));
+
+			ArrayList<Property> refPatterns = new ArrayList<Property>();
+			for (String p : refPatternsString) {
+				String[] split = p.split("_",2); //$NON-NLS-1$
+				if (split != null && split[0].length() > 0 && split[1].length() > 0) {
+					refPatterns.add(corpus.getStructuralUnit(split[0]).getProperty(split[1]));
+				} else {
+					refPatterns.add(corpus.getProperty(p));
+				}
+			}
+			ReferencePattern referencePattern = new ReferencePattern(refPatterns);
+			
+			refPatterns = new ArrayList<Property>();
+			for (String p : refAnalysePatternString) {
+				String[] split = p.split("_",2); //$NON-NLS-1$
+				if (split != null && split[0].length() > 0 && split[1].length() > 0) {
+					refPatterns.add(corpus.getStructuralUnit(split[0]).getProperty(split[1]));
+				} else {
+					refPatterns.add(corpus.getProperty(p));
+				}
+			}
+			ReferencePattern refAnalysePattern = new ReferencePattern(refPatterns);
+
+
+			Concordance conc = new Concordance(corpus, query,
+					leftCSortProperties, rightCSortProperties, keywordSortProperties,
+					leftCViewProperties, rightCViewProperties, keywordViewProperties,
+					referencePattern, refAnalysePattern, 
+					leftContextSize, rightContextSize);
+			conc.getLines(0, conc.getNLines());
+			
+			if (sortBy != null) {
+				LineComparator comparator;
+				if ("null".equals(sortBy)) comparator = new NullComparator(); //$NON-NLS-1$
+				else if ("lexicographic".equals(sortBy)) comparator = new LexicographicKeywordComparator(); //$NON-NLS-1$
+				else if ("leftcontext".equals(sortBy)) comparator = new LexicographicLeftContextComparator(); //$NON-NLS-1$
+				else if ("rightcontext".equals(sortBy)) comparator = new LexicographicRightContextComparator(); //$NON-NLS-1$
+				else if ("reference".equals(sortBy)) comparator = new PropertiesReferenceComparator(); //$NON-NLS-1$
+				else comparator = new NullComparator();
+				conc.sort(comparator);
+			}
+			conc.toTxt(outfile, "UTF-8", "\t", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+		} catch (Exception e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+			return false;
+		}
+		return true;
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/test/TestConcordance.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/test/package.html
===================================================================
--- tmp/org.txm.core/src/java/org/txm/test/package.html	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/test/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>First draft of tests for TXM</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/java/org/txm/test/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/test/TestSubcorpus.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/test/TestSubcorpus.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/test/TestSubcorpus.java	(revision 258)
@@ -0,0 +1,71 @@
+package org.txm.test;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Arrays;
+
+import org.txm.searchengine.cqp.NetCqiClient;
+import org.txm.searchengine.cqp.clientExceptions.UnexpectedAnswerException;
+import org.txm.searchengine.cqp.corpus.Corpus;
+import org.txm.searchengine.cqp.corpus.CorpusManager;
+import org.txm.searchengine.cqp.corpus.Subcorpus;
+import org.txm.searchengine.cqp.corpus.query.Query;
+import org.txm.searchengine.cqp.serverException.CqiServerError;
+
+public class TestSubcorpus {
+
+	public static String CORPUS = "DISCOURS"; //$NON-NLS-1$
+
+	public static boolean allTests(File outdir) {
+		TestSubcorpus tester = new TestSubcorpus();
+		return tester.test1(outdir) && tester.test2(outdir) && tester.test3(outdir);
+	}
+
+	public boolean test1(File outdir) {
+		try {
+			Corpus corpus = CorpusManager.getCorpusManager().getCorpus(CORPUS);
+			Subcorpus sub = corpus.createSubcorpus(new Query("\"je\" expand to p"), "JEP"); //$NON-NLS-1$ //$NON-NLS-2$
+
+			writePositions(sub, new File(outdir, TestSubcorpus.class.getName()+"_test1.csv")); //$NON-NLS-1$
+		} catch (Exception e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+			return false;
+		}
+		return true;
+	}
+
+	public boolean test2(File outdir) {
+		try {
+			Corpus corpus = CorpusManager.getCorpusManager().getCorpus(CORPUS);
+			Subcorpus sub = corpus.createSubcorpus(corpus.getStructuralUnit("text"), corpus.getStructuralUnit("text").getProperty("loc"), "De_Gaulle", "DG"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+
+			writePositions(sub, new File(outdir, TestSubcorpus.class.getName()+"_test2.csv")); //$NON-NLS-1$
+		} catch (Exception e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+			return false;
+		}
+		return true;
+	}
+
+	public boolean test3(File outdir) {
+		try {
+			Corpus corpus = CorpusManager.getCorpusManager().getCorpus(CORPUS);
+			Subcorpus sub = corpus.createSubcorpus(corpus.getStructuralUnit("text"), corpus.getStructuralUnit("text").getProperty("type"), Arrays.asList("Allocution radiotélévisée", "Conférence de presse"), "alloc+presse"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+
+			writePositions(sub, new File(outdir, TestSubcorpus.class.getName()+"_test3.csv")); //$NON-NLS-1$
+		} catch (Exception e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+			return false;
+		}
+		return true;
+	}
+
+	private void writePositions(Subcorpus sub, File outfile) throws UnexpectedAnswerException, IOException, CqiServerError {
+		int[] positions = CorpusManager.getCorpusManager().getCqiClient().dumpSubCorpus(sub.getQualifiedCqpId(), NetCqiClient.CQI_CONST_FIELD_MATCH, 0, sub.getNMatch());
+		PrintWriter writer = new PrintWriter(new FileWriter(outfile));
+		for(int i : positions) writer.println(i);
+		writer.close();
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/test/TestSubcorpus.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/toolbox/Activator.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/toolbox/Activator.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/toolbox/Activator.java	(revision 258)
@@ -0,0 +1,85 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2014-12-02 08:45:10 +0100 (Tue, 02 Dec 2014) $
+// $LastChangedRevision: 2912 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.toolbox;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle.
+ */
+public class Activator extends Plugin {
+
+	// The plug-in ID
+	/** The Constant PLUGIN_ID. */
+	public static final String PLUGIN_ID = "org.txm.core"; //$NON-NLS-1$
+
+	// The shared instance
+	/** The plugin. */
+	private static Activator plugin;
+
+	/**
+	 * The constructor.
+	 */
+	public Activator() {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+	 */
+	@Override
+	public void start(BundleContext context) throws Exception {
+		super.start(context);
+		plugin = this;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+	 */
+	@Override
+	public void stop(BundleContext context) throws Exception {
+		plugin = null;
+		super.stop(context);
+	}
+
+	/**
+	 * Returns the shared instance.
+	 *
+	 * @return the shared instance
+	 */
+	public static Activator getDefault() {
+		return plugin;
+	}
+
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/toolbox/Activator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/toolbox/package.html
===================================================================
--- tmp/org.txm.core/src/java/org/txm/toolbox/package.html	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/toolbox/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>RCP plugin classes</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/java/org/txm/toolbox/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/core/preferences/TXMPreferences.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/core/preferences/TXMPreferences.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/core/preferences/TXMPreferences.java	(revision 258)
@@ -0,0 +1,643 @@
+package org.txm.core.preferences;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.IScopeContext;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.osgi.service.prefs.BackingStoreException;
+
+
+
+/**
+ * Base preferences initializer and manager.
+ * Getters return either a value looking in this order:
+ * - local node linked to a TXM result if exists
+ * - command global value (InstanceScope)
+ * - command default value (DefaultScope)
+ * - alternative specified global value
+ * - alternative specified default value
+ * TODO: methods that puts a value in the local node does not check if the value is the the default value of the parent, it should be removed from the local node if it's the default value
+ * of command scope or alternative scope so the preference will not be saved in the local scope .prefs file if its a default value. 
+ * TODO: when we'll use IProject for managing Corporas, the local node should be stored in the ProjectScope instead of in the InstanceScope.
+ * TODO: need to determine if we'll use this class to persistence of TXM results. At this moment, we persist result by calling flush() that creates a file named by the result node qualifier,
+ *  eg. org.txm.partition.core.functions.PartitionDimensions@732982cb.prefs
+ * (We can also define a custom Scope to do that, for example to change the saved object location or the filename)
+ * 
+ * 
+ * @author sjacquot
+ *
+ */
+//FIXME: AFTER some tests, the local nodes are flushed when editing a Charts engine preference from the UI, actually the prefs are flushed if we change a charts engine preference and then it becomes
+// different from the local result, eg. "Show Legend" or "Rendering colors mode". See if it's what we want.
+// Otherwise, to avoid that we need to define our own Scope, but the problem will disappear when
+// we'll use the ProjectScope.
+public abstract class TXMPreferences extends AbstractPreferenceInitializer {
+	
+	// FIXME: here we must use a ProjectScope when we use IProject for the corporas of TXM
+	public static IScopeContext scope = InstanceScope.INSTANCE;
+	
+	
+	/**
+	 * Alternative nodes to look up when getting a preference.
+	 */
+	public static ArrayList<String> alternativeNodesQualifiers = new ArrayList<String>();
+	
+	
+	
+	/**
+	 * Stores a pairs of key / value in a local node dedicated to the specified result. The node qualifier is generated by the <code>Object.toString()</code> method.
+	 * @param result
+	 * @param key
+	 * @param value
+	 */
+	public static void putLocalBoolean(Object result, String key, boolean value)	{
+		scope.getNode(getId(result)).putBoolean(key, value);
+	}
+	
+	
+
+	/**
+	 * Looks for the value of the specified <code>key</code> in preference nodes.
+	 * Returns the value of the local result node if exists.
+	 * Otherwise try to get it from the specified node qualifier if exists.
+	 * Otherwise try to get it from the specified alternative node qualifiers defined in the list <code>TXMPreferences.alternativeNodesQualifiers</code>.
+	 * Returns <code>true</code> if no value has been found for the specified key.
+	 * @param nodeQualifier
+	 * @param result
+	 * @param key
+	 * @return
+	 */
+	public static boolean getBoolean(String nodeQualifier, Object result, String key)	{
+
+		boolean defaultValue = true;
+		boolean globalValue = defaultValue;
+		boolean keyExists = (result != null && resultScopeKeyExists(result, key));
+
+		// get the result scope preference
+		if(keyExists)	{
+			nodeQualifier = getId(result);
+		}
+		// look in the global alternative preferences nodes
+		else if(!keyExists(nodeQualifier, key))	{
+			for(int i = 0; i < alternativeNodesQualifiers.size(); i++) {
+				if(keyExists(alternativeNodesQualifiers.get(i), key))	{
+					nodeQualifier = alternativeNodesQualifiers.get(i);
+					break;
+				}
+			}
+		}
+		defaultValue = DefaultScope.INSTANCE.getNode(nodeQualifier).getBoolean(key, defaultValue);
+		globalValue = scope.getNode(nodeQualifier).getBoolean(key, defaultValue);
+		return globalValue;
+	}
+	
+	
+	/**
+	 * 
+	 * @param nodeQualifier
+	 * @param key
+	 * @return
+	 */
+	public static boolean getBoolean(String nodeQualifier, String key)	{
+		return getBoolean(nodeQualifier, null, key);
+	}
+	
+	/**
+	 * 
+	 * @param result
+	 * @param key
+	 * @return
+	 */
+	public static boolean getBoolean(Object result, String key)	{
+		return getBoolean(null, result, key);
+	}
+	
+	/**
+	 * Stores a pairs of key / value in a local node dedicated to the specified result. The node qualifier is generated by the <code>Object.toString()</code> method.
+	 * @param result
+	 * @param key
+	 * @param value
+	 */
+	public static void putLocalString(Object result, String key, String value)	{
+		scope.getNode(getId(result)).put(key, value);
+	}
+	
+
+	/**
+	 * Looks for the value of the specified <code>key</code> in preference nodes.
+	 * Returns the value of the local result node if exists.
+	 * Otherwise try to get it from the specified node qualifier if exists.
+	 * Otherwise try to get it from the specified alternative node qualifiers defined in the list <code>TXMPreferences.alternativeNodesQualifiers</code>.
+	 * Returns an empty <code>String</code> if no value has been found for the specified key.
+	 * @param nodeQualifier
+	 * @param result
+	 * @param key
+	 * @return
+	 */
+	public static String getString(String nodeQualifier, Object result, String key)	{
+
+		String defaultValue = "";
+		String globalValue = defaultValue;
+		boolean keyExists = (result != null && resultScopeKeyExists(result, key));
+
+		// get the result scope preference
+		if(keyExists)	{
+			nodeQualifier = getId(result);
+		}
+		// look in the global alternative preferences nodes
+		else if(!keyExists(nodeQualifier, key))	{
+			for(int i = 0; i < alternativeNodesQualifiers.size(); i++) {
+				if(keyExists(alternativeNodesQualifiers.get(i), key))	{
+					nodeQualifier = alternativeNodesQualifiers.get(i);
+					break;
+				}
+			}
+		}
+		defaultValue = DefaultScope.INSTANCE.getNode(nodeQualifier).get(key, defaultValue);
+		globalValue = scope.getNode(nodeQualifier).get(key, defaultValue);
+		return globalValue;
+	}
+	
+	/**
+	 * 
+	 * @param nodeQualifier
+	 * @param key
+	 * @return
+	 */
+	public static String getString(String nodeQualifier, String key)	{
+		return getString(nodeQualifier, null, key);
+	}
+	
+	
+	/**
+	 * 
+	 * @param result
+	 * @param key
+	 * @return
+	 */
+	public static String getString(Object result, String key)	{
+		return getString(null, result, key);
+	}
+
+	/**
+	 * Stores a pairs of key / value in a local node dedicated to the specified result. The node qualifier is generated by the <code>Object.toString()</code> method.
+	 * @param result
+	 * @param key
+	 * @param value
+	 */
+	public static void putLocalInt(Object result, String key, int value)	{
+		scope.getNode(getId(result)).putInt(key, value);
+	}
+	
+	/**
+	 * Looks for the value of the specified <code>key</code> in preference nodes.
+	 * Returns the value of the local result node if exists.
+	 * Otherwise try to get it from the specified node qualifier if exists.
+	 * Otherwise try to get it from the specified alternative node qualifiers defined in the list <code>TXMPreferences.alternativeNodesQualifiers</code>.
+	 * Returns -1 if no value has been found for the specified key.
+	 * @param nodeQualifier
+	 * @param result
+	 * @param key
+	 * @return
+	 */
+	public static int getInt(String nodeQualifier, Object result, String key)	{
+
+		int defaultValue = -1;
+		int globalValue = defaultValue;
+		boolean keyExists = (result != null && resultScopeKeyExists(result, key));
+
+		// get the result scope preference
+		if(keyExists)	{
+			nodeQualifier = getId(result);
+		}
+		// look in the global alternative preferences nodes
+		else if(!keyExists(nodeQualifier, key))	{
+			for(int i = 0; i < alternativeNodesQualifiers.size(); i++) {
+				if(keyExists(alternativeNodesQualifiers.get(i), key))	{
+					nodeQualifier = alternativeNodesQualifiers.get(i);
+					break;
+				}
+			}
+		}
+		defaultValue = DefaultScope.INSTANCE.getNode(nodeQualifier).getInt(key, defaultValue);
+		globalValue = scope.getNode(nodeQualifier).getInt(key, defaultValue);
+		return globalValue;
+	}
+
+	
+	/**
+	 * 
+	 * @param nodeQualifier
+	 * @param key
+	 * @return
+	 */
+	public static int getInt(String nodeQualifier, String key)	{
+		return getInt(nodeQualifier, null, key);
+	}
+
+	
+	/**
+	 * 
+	 * @param result
+	 * @param key
+	 * @return
+	 */
+	public static int getInt(Object result, String key)	{
+		return getInt(null, result, key);
+	}
+
+	
+	/**
+	 * Stores a pairs of key / value in a local node dedicated to the specified result. The node qualifier is generated by the <code>Object.toString()</code> method.
+	 * @param result
+	 * @param key
+	 * @param value
+	 */
+	public static void putLocalDouble(Object result, String key, double value)	{
+		scope.getNode(getId(result)).putDouble(key, value);
+	}
+	
+	/**
+	 * Looks for the value of the specified <code>key</code> in preference nodes.
+	 * Returns the value of the local result node if exists.
+	 * Otherwise try to get it from the specified node qualifier if exists.
+	 * Otherwise try to get it from the specified alternative node qualifiers defined in the list <code>TXMPreferences.alternativeNodesQualifiers</code>.
+	 * Returns -1 if no value has been found for the specified key.
+	 * @param nodeQualifier
+	 * @param result
+	 * @param key
+	 * @return
+	 */
+	public static double getDouble(String nodeQualifier, Object result, String key)	{
+
+		double defaultValue = -1;
+		double globalValue = defaultValue;
+		boolean keyExists = (result != null && resultScopeKeyExists(result, key));
+
+		// get the result scope preference
+		if(keyExists)	{
+			nodeQualifier = getId(result);
+		}
+		// look in the global alternative preferences nodes
+		else if(!keyExists(nodeQualifier, key))	{
+			for(int i = 0; i < alternativeNodesQualifiers.size(); i++) {
+				if(keyExists(alternativeNodesQualifiers.get(i), key))	{
+					nodeQualifier = alternativeNodesQualifiers.get(i);
+					break;
+				}
+			}
+		}
+		defaultValue = DefaultScope.INSTANCE.getNode(nodeQualifier).getDouble(key, defaultValue);
+		globalValue = scope.getNode(nodeQualifier).getDouble(key, defaultValue);
+		return globalValue;
+	}
+	
+	
+	/**
+	 * 
+	 * @param nodeQualifier
+	 * @param key
+	 * @return
+	 */
+	public static double getDouble(String nodeQualifier, String key)	{
+		return getDouble(nodeQualifier, null, key);
+	}
+
+	
+	/**
+	 * 
+	 * @param result
+	 * @param key
+	 * @return
+	 */
+	public static double getDouble(Object result, String key)	{
+		return getDouble(null, result, key);
+	}
+
+	
+	/**
+	 * Stores a pairs of key / value in a local node dedicated to the specified result. The node qualifier is generated by the <code>Object.toString()</code> method.
+	 * @param result
+	 * @param key
+	 * @param value
+	 */
+	public static void putLocalFloat(Object result, String key, float value)	{
+		scope.getNode(getId(result)).putFloat(key, value);
+	}
+	
+	/**
+	 * Looks for the value of the specified <code>key</code> in preference nodes.
+	 * Returns the value of the local result node if exists.
+	 * Otherwise try to get it from the specified node qualifier if exists.
+	 * Otherwise try to get it from the specified alternative node qualifiers defined in the list <code>TXMPreferences.alternativeNodesQualifiers</code>.
+	 * Returns -1 if no value has been found for the specified key.
+	 * @param nodeQualifier
+	 * @param result
+	 * @param key
+	 * @return
+	 */
+	public static float getFloat(String nodeQualifier, Object result, String key)	{
+
+		float defaultValue = -1;
+		float globalValue = defaultValue;
+		boolean keyExists = (result != null && resultScopeKeyExists(result, key));
+
+		// get the result scope preference
+		if(keyExists)	{
+			nodeQualifier = getId(result);
+		}
+		// look in the global alternative preferences nodes
+		else if(!keyExists(nodeQualifier, key))	{
+			for(int i = 0; i < alternativeNodesQualifiers.size(); i++) {
+				if(keyExists(alternativeNodesQualifiers.get(i), key))	{
+					nodeQualifier = alternativeNodesQualifiers.get(i);
+					break;
+				}
+			}
+		}
+		defaultValue = DefaultScope.INSTANCE.getNode(nodeQualifier).getFloat(key, defaultValue);
+		globalValue = scope.getNode(nodeQualifier).getFloat(key, defaultValue);
+		return globalValue;
+	}
+
+	
+	/**
+	 * 
+	 * @param nodeQualifier
+	 * @param key
+	 * @return
+	 */
+	public static float getFloat(String nodeQualifier, String key)	{
+		return getFloat(nodeQualifier, null, key);
+	}
+	
+	
+	/**
+	 * 
+	 * @param result
+	 * @param key
+	 * @return
+	 */
+	public static float getFloat(Object result, String key)	{
+		return getFloat(null, result, key);
+	}
+
+	
+	/**
+	 * Checks if a local node exists for the specified TXM result.
+	 * @param result
+	 * @return <code>true</code> if the node exists, otherwise <code>false</code>
+	 */
+	public static boolean resultScopeNodeExists(Object result)	{
+		if(result == null)	{
+			return false;
+		}
+		return scope.getNode(getId(result)) != null;
+	}
+	
+	/**
+	 * Checks if a key exists in the local node for the specified TXM result.
+	 * @param result
+	 * @param key
+	 * @return <code>true</code> if the node and the key exist, otherwise <code>false</code>
+	 */
+	public static boolean resultScopeKeyExists(Object result, String key)	{
+		return keyExists(getId(result), key);
+	}
+
+	/**
+	 * Checks if a key exists in a node.
+	 * @param nodeQualifier
+	 * @param key
+	 * @return <code>true</code> if the node and the key exist, otherwise <code>false</code>
+	 */
+	public static boolean keyExists(String nodeQualifier, String key)	{
+		if(scope.getNode(nodeQualifier) != null)	{
+			try {
+				return Arrays.asList(scope.getNode(nodeQualifier).keys()).contains(key);
+			}
+			catch(BackingStoreException e) {
+				e.printStackTrace();
+			}
+		}
+		return false;
+	}
+
+	
+	/**
+	 * Checks if a preference is defined as empty.
+	 * Can be used to determine whatever a functionality is available or not by overriding the preference as empty.
+	 * Essentially used for UI purpose, eg. to hide or disable a button that modify a preference.
+	 * @param nodeQualifier
+	 * @param key
+	 * @return
+	 */
+	public static boolean isEmpty(String nodeQualifier, String key)	{
+		return getString(nodeQualifier, key).equals("");
+	}
+
+	
+	/**
+	 * Sets a preference as empty.
+	 * Can be used to determine whatever a functionality is available or not by overriding the preference as empty.
+	 * Essentially used for UI purpose, eg. to hide or disable a button that modify a preference.
+	 * @param nodeQualifier
+	 * @param key
+	 */
+	public static void setEmpty(String nodeQualifier, String key)	{
+		scope.getNode(nodeQualifier).put(key, "");
+	}
+	
+	
+	/**
+	 * Dumps the keys and values of the specified node.
+	 * @param nodeQualifier
+	 */
+	public static void dump(String nodeQualifier)	{
+		IEclipsePreferences preferences = scope.getNode(nodeQualifier);
+		System.out.println("TXMPreferences.dump(): node qualifier = " + nodeQualifier);
+		try {
+			String[] keys = preferences.keys();
+			for(int i = 0; i < keys.length; i++) {
+				System.out.println("TXMPreferences.dump(): " + keys[i] + " = " + preferences.get(keys[i], ""));
+			}
+		}
+		catch(BackingStoreException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+	}
+	
+
+	/**
+	 * Dumps the keys and values of the specified node, of the specified result node and also of the alternative nodes.
+	 * @param nodeQualifier
+	 * @param result
+	 */
+	public static void dump(String nodeQualifier, Object result)	{
+		
+		// result scope node
+		if(result != null)	{
+			if(resultScopeNodeExists(result))	{
+				System.out.println("TXMPreferences.dump(): Result scope preferences for node " + getId(result) + ":");
+				dump(getId(result));
+			}
+			else	{
+				System.out.println("TXMPreferences.dump(): No result scope preferences was found for node" + getId(result) + ".");
+			}
+		}
+		// command scope node
+		if(nodeQualifier != null)	{
+			System.out.println("TXMPreferences.dump(): Command scope preferences for node " + nodeQualifier + ":");
+			dump(nodeQualifier);
+		}
+		else	{
+			System.out.println("TXMPreferences.dump(): No Command scope was asked to dump.");
+		}
+		
+		// alternative global scope nodes
+		for(int i = 0; i < alternativeNodesQualifiers.size(); i++) {
+			System.out.println("TXMPreferences.dump(): Alternative global scope preferences for node " + alternativeNodesQualifiers.get(i) + ":");
+			dump(alternativeNodesQualifiers.get(i));
+		}
+	}
+	
+	
+	/**
+	 * Save the local preferences to file.
+	 * @param result
+	 */
+	public static void flush(Object result)	{
+		try {
+			System.err.println("TXMPreferences.flush(): Local preferences for object " + getId(result) + " saved to file.");
+			// FIXME: useless?
+			//scope.getNode(getId(result)).sync();
+			scope.getNode(getId(result)).flush();
+		}
+		catch(BackingStoreException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+	}
+	
+	/**
+	 * Gets a unique Id for the object.
+	 * @param object
+	 */
+	public static String getId(Object object)	{
+		return object.getClass().getName() + '@' + Integer.toHexString(object.hashCode());
+	}
+
+	
+	
+	//FIXME: this code is dedicated to dynamically retrieve the static field PREFERENCES_NODE of the runtime subclass and use it super class to avoid to pass it to all methods.
+	// eg. to use ProgressionPreferences.getBoolean("test") instead of TXMPreferences..getBoolean(ProgressionPreferences.PREFERENCES_NODE, "test")
+	// but it doesn"t work, need to continue the tests...
+//	/**
+//	 * 
+//	 * @author sjacquot
+//	 *
+//	 */
+//	public static class CurrentClassGetter extends SecurityManager {
+//		  public Class getCurrentClass() {
+//			  //FIXME: debug
+//			  for(int i = 0; i < getClassContext().length; i++) {
+//				System.err.println("TXMPreferences.CurrentClassGetter.getCurrentClass() class " + i + " = " + getClassContext()[i]);
+//			}
+//		    return getClassContext()[2];
+//		  }
+//		}
+//	
+//
+//	/**
+//	 * Gets the static field PREFERENCES_NODE of the runtime subclass.
+//	 * Convenience method to avoid to pass it to all methods. 
+//	 * @return
+//	 */
+//	private static String getNodeQualifier()	{
+//        String runtimeSubClassNodeQualifier  = null;
+//        try {
+//        	Class c = new CurrentClassGetter().getCurrentClass();
+//        	System.out.println("TXMPreferences.getNodeQualifier(): class = " + c);
+//            Field f = c.getDeclaredField("PREFERENCES_NODE");
+//            f.setAccessible(true);
+//            if(f.isAccessible())	{
+//                runtimeSubClassNodeQualifier = (String) f.get(null);
+//            }
+//        }
+//        catch (NoSuchFieldException e) {
+//            // TODO Auto-generated catch block
+//            e.printStackTrace();
+//        }
+//        catch (SecurityException e) {
+//            // TODO Auto-generated catch block
+//            e.printStackTrace();
+//        }
+//        catch (IllegalArgumentException e) {
+//            // TODO Auto-generated catch block
+//            e.printStackTrace();
+//        }
+//        catch (IllegalAccessException e) {
+//            // TODO Auto-generated catch block
+//            e.printStackTrace();
+//        }
+//        return runtimeSubClassNodeQualifier;
+//	}
+//	
+//	
+//	/**
+//	 * 
+//	 * @param key
+//	 * @return
+//	 */
+//	public static String getString(String key)	{
+//		return getString(getNodeQualifier(), key);
+//	}
+//
+//
+//	/**
+//	 * 
+//	 * @param key
+//	 * @return
+//	 */
+//	public static boolean getBoolean(String key)	{
+//    	Class c = new CurrentClassGetter().getCurrentClass();
+//    	System.out.println("TXMPreferences.getBoolean(): class = " + c);
+//		return getBoolean(getNodeQualifier(), key);
+//	}
+//	
+//	
+//	/**
+//	 * 
+//	 * @param key
+//	 * @return
+//	 */
+//	public static int getInt(String key)	{
+//		return getInt(getNodeQualifier(), key);
+//	}
+//	
+//	/**
+//	 * 
+//	 * @param key
+//	 * @return
+//	 */
+//	public static double getDouble(String key)	{
+//		return getDouble(getNodeQualifier(), key);
+//	}
+//	
+//	
+//	/**
+//	 * 
+//	 * @param key
+//	 * @return
+//	 */
+//	public static float getFloat(String key)	{
+//		return getFloat(getNodeQualifier(), key);
+//	}
+	//end of fixme
+	
+}
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/java/org/txm/core/preferences/TXMPreferences.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/core/results/comparators/MultipleComparators.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/core/results/comparators/MultipleComparators.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/core/results/comparators/MultipleComparators.java	(revision 258)
@@ -0,0 +1,40 @@
+/**
+ * 
+ */
+package org.txm.core.results.comparators;
+
+import java.util.ArrayList;
+import java.util.Comparator;
+
+import org.txm.core.results.ITXMResult;
+
+/**
+ * Multiple chained TXM result comparisons management.
+ * 
+ * @author sjacquot
+ *
+ */
+public class MultipleComparators implements Comparator<ITXMResult> {
+	
+	protected ArrayList<Comparator<ITXMResult>> comparators;
+	 
+	/**
+	 * 
+	 * @param comparators
+	 */
+    public MultipleComparators(ArrayList<Comparator<ITXMResult>> comparators) {
+        this.comparators = comparators;
+    }
+ 
+	@Override
+	public int compare(ITXMResult o1, ITXMResult o2) {
+	   for(int i = 0; i < this.comparators.size(); i++) {
+            int result = this.comparators.get(i).compare(o1, o2);
+            if (result != 0) {
+                return result;
+            }
+        }
+        return 0;
+	}
+	
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/core/results/comparators/MultipleComparators.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/core/results/comparators/Comparators.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/core/results/comparators/Comparators.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/core/results/comparators/Comparators.java	(revision 258)
@@ -0,0 +1,91 @@
+/**
+ * 
+ */
+package org.txm.core.results.comparators;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+
+import org.txm.core.results.ITXMResult;
+
+/**
+ * Class to manage different comparators for a sorting type.
+ * @author sjacquot
+ *
+ */
+public class Comparators {
+
+	/**
+	 * Alphanumeric sorting on simple name.
+	 */
+	public final static int SIMPLE_NAME_ALPHANUM = 0;
+	
+	/**
+	 * Node weight sorting.
+	 */
+	public final static int NODE_WEIGHT = 1;
+	
+	
+	
+	/**
+	 * 
+	 */
+	private Comparators() {
+		// no instantiation
+	}
+
+	/**
+	 * Gets a comparator for TXM results according to the specified sorting type.
+	 * @param sorting
+	 * @return
+	 */
+	public static Comparator<ITXMResult> getComparator(int sorting)	{
+		//FIXME: to complete and improve to sort on more than one key
+		
+		switch(sorting) {
+		default:			
+		// NODE_WEIGHT
+		case 0:
+			new Comparator<ITXMResult>() {
+				@Override
+				public int compare(ITXMResult o1, ITXMResult o2) {
+					return o1.getWeight() - o2.getWeight();
+				}
+			};
+			break;
+		// SIMPLE_NAME_ALPHANUM
+		case 1:
+			new Comparator<ITXMResult>() {
+				@Override
+				public int compare(ITXMResult o1, ITXMResult o2) {
+					return o1.getSimpleName().compareTo(o2.getSimpleName());
+				}
+			};
+			break;
+		}
+		
+		return null;
+	}
+
+	
+	/**
+	 * Sorts some TXM results according to the specified sorting type and reverse order.
+	 * @param results
+	 * @param sorting
+	 * @param reversed
+	 */
+	public static void sort(ArrayList<ITXMResult> results, boolean reversed, int... sorting)	{
+		ArrayList<Comparator<ITXMResult>> comparators = new ArrayList<Comparator<ITXMResult>>();
+		for(int i = 0; i < sorting.length; i++) {
+			comparators.add(getComparator(sorting[i]));
+		}
+		Comparator<ITXMResult> comparator = new MultipleComparators(comparators);
+		if(reversed)	{
+			comparator = Collections.reverseOrder(comparator);
+		}
+		Collections.sort(results, comparator);
+	}
+	
+
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/core/results/comparators/Comparators.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/core/results/ITXMResult.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/core/results/ITXMResult.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/core/results/ITXMResult.java	(revision 258)
@@ -0,0 +1,143 @@
+package org.txm.core.results;
+
+import java.util.ArrayList;
+
+import org.txm.core.results.ITXMResult;
+
+/**
+ * 
+ * @author sjacquot
+ *
+ */
+//FIXME: this interface has been created to manage the result baed on interface AND implementation, for example: interface LexicalTable.
+// need to see if it's useful or not.
+public interface ITXMResult {
+
+	
+	/**
+	 * Deletes the object from its parent, also deletes the children.
+	 * The <code>TXMResult.clean()</code> methods of this result and children results are applied before the deletion.
+	 * @return
+	 */
+	public boolean delete();
+	
+	/**
+	 * Adds a child result to this result.
+	 * @param child
+	 * @return
+	 */
+	public boolean addResult(ITXMResult child);
+
+	/**
+	 * Adds a child result to this result.
+	 * @param index
+	 * @param child
+	 * @return
+	 */
+	public boolean addResult(int index, ITXMResult child);
+	
+	/**
+	 * Removes the specified child result. 
+	 * @param child
+	 * @return <code>true if the child has been removed, otherwise <code>false</code>
+	 */
+	public boolean removeResult(ITXMResult child);
+	
+	/**
+	 * Removes the child result specified by its index.
+	 * @param index
+	 * @return <code>true if the child has been removed, otherwise <code>false</code>
+	 */
+	public boolean removeResult(int index);
+	
+	
+	/**
+	 * Gets the children results.
+	 * @return
+	 */
+	public ArrayList<ITXMResult> getResults();
+	
+	
+	/**
+	 * Gets the children results specified by their class.
+	 * @param type
+	 * @return
+	 */
+	public ArrayList<ITXMResult> getResults(Class type);
+	
+	/**
+	 * Gets the children of all the branch in a flat list.
+	 * @return
+	 */
+	public ArrayList<ITXMResult> getDeepResults();
+	
+	/**
+	 * Gets the sibling nodes of this node result.
+	 */
+	public ArrayList<ITXMResult> getSiblings();
+	
+	/**
+	 * Gets the sibling nodes of this node result, specified by their class.
+	 */
+	public ArrayList<ITXMResult> getSiblings(Class type);
+
+	/**
+	 * Removes the parent.
+	 */
+	public void removeParent();
+
+	/**
+	 * Sets the parent.
+	 * @param parent
+	 */
+	public void setParent(ITXMResult parent);
+	
+	/**
+	 * Gets the parent.
+	 * @return the parent
+	 */
+	public ITXMResult getParent();
+	
+	/**
+	 * Gets the name of the result.
+	 * @return
+	 */
+	public abstract String getName();
+	
+	/**
+	 * Gets the simple name of the result.
+	 * @return
+	 */
+	public abstract String getSimpleName();
+	
+	/**
+	 * Gets some details about how the result has been computed (eg. additional parameters, etc.).
+	 * @return
+	 */
+	public abstract String getDetails();
+	
+	/**
+	 * Gets a string representing the result and that can be used as a file name.
+	 * @return
+	 */
+	//FIXME: to discuss and/or to move in export layer
+	public String getValidFileName();
+	
+	/**
+	 * Gets a string representing the concatenation of the simple names of the branch of this result.
+	 * @return
+	 */
+	public String getFullPathSimpleName();
+	/**
+	 * Gets the weight of the node. Essentially used for sorting purpose.
+	 * @return the weight
+	 */
+	public int getWeight();
+
+	/**
+	 * Cleans and free some resources if needed.
+	 * This methods is applied when calling <code>TXMResult.delete()</code>. 
+	 */
+	public abstract void clean();
+	
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/core/results/ITXMResult.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java	(revision 258)
@@ -0,0 +1,387 @@
+/**
+ * 
+ */
+package org.txm.core.results;
+
+import java.util.ArrayList;
+
+/**
+ * Root class of all TXM results.
+ * This class contains methods to get some different version of the name of the result and some additional computing information.
+ * It also contains methods to manage a tree hierarchy of result nodes.
+ * 
+ * @author mdecorde
+ * @author sjacquot
+ *
+ */
+//FIXME: temporary implements TXMREsult for compiling but need to remove that when TXMResult2 will be fully implemented
+// At this moment, an empty list is created for children, to not return null when calling getChildren() 
+public abstract class TXMResult implements ITXMResult, Cloneable {
+	
+	
+	/**
+	 * The weight, essentially used for sorting purpose.
+	 */
+	protected int weight;
+	
+	/**
+	 * Parent.
+	 */
+	protected ITXMResult parent;
+	
+	
+	/**
+	 * Children results.
+	 */
+	protected ArrayList<ITXMResult> children;
+	
+	
+
+	/**
+	 * Creates a new TXMResult with no parent.
+	 */
+	public TXMResult() {
+		this(null);
+	}
+
+	
+	/**
+	 * Creates a new TXMResult, child of the specified parent.
+	 * @param parent
+	 */
+	public TXMResult(ITXMResult parent) {
+		this.weight = 0;
+		if(parent != null)	{
+			parent.addResult(this);
+		}
+		this.children = new ArrayList<ITXMResult>(1);
+	}
+	
+
+
+	/**
+	 * Deletes the object from its parent, also deletes the children.
+	 * The <code>TXMResult.clean()</code> methods of this result and children results are applied before the deletion.
+	 * @return
+	 */
+	synchronized public boolean delete()	{
+
+		try {
+			//FIXME: debug
+			System.err.println("TXMResult.delete()");
+
+			
+			// remove children and clean resources
+			for(int i = 0; i < this.children.size(); i++) {
+				this.children.get(i).clean();
+				this.removeResult(i);
+			}
+			
+			this.clean();
+			
+			this.parent.removeResult(this);
+			this.parent = null;
+
+			return true;
+		}
+		catch(Exception e) {
+			e.printStackTrace();
+		}
+		return false;
+	}
+	
+	/**
+	 * Adds a child result to this result.
+	 * If the child already exists it will not be added.
+	 * @param child
+	 * @return
+	 */
+	synchronized public boolean addResult(ITXMResult child)	{
+		child.setParent(this);
+		if(!this.children.contains(child))	{
+			//FIXME: Debug
+			//System.err.println("TXMResult.addResult(); adding child " + child + " to parent " + this);
+			return this.children.add(child);	
+		}
+		return false;
+	}
+
+	
+	/**
+	 * Adds a child result to this result.
+	 * @param index
+	 * @param child
+	 * @return
+	 */
+	synchronized public boolean addResult(int index, ITXMResult child)	{
+		try {
+			child.setParent(this);
+			this.children.add(index, child);
+			return true;
+		}
+		catch(Exception e) {
+		}
+		return false;
+	}
+	
+	/**
+	 * Removes the specified child result. 
+	 * @param child
+	 * @return <code>true if the child has been removed, otherwise <code>false</code>
+	 */
+	synchronized public boolean removeResult(ITXMResult child)	{
+		try {
+			child.removeParent();
+			return this.children.remove(child);
+		}
+		catch(Exception e) {
+		}
+		return false;
+	}
+	
+	/**
+	 * Removes the child result specified by its index.
+	 * @param index
+	 * @return <code>true if the child has been removed, otherwise <code>false</code>
+	 */
+	public boolean removeResult(int index)	{
+		try {
+			return this.removeResult(this.children.get(index));
+		}
+		catch(Exception e) {
+		}
+		return false;
+	}
+	
+	
+	/**
+	 * Gets the children results.
+	 * @return
+	 */
+	public ArrayList<ITXMResult> getResults()	{
+		return this.children;
+	}
+	
+	
+	/**
+	 * Gets the children results specified by their class.
+	 * @param type
+	 * @return
+	 */
+	public ArrayList<ITXMResult> getResults(Class type)	{
+		return TXMResult.getNodes(this.children, type);
+	}
+	
+	
+	/**
+	 * Gets the children of all the branch in a flat list.
+	 * @return
+	 */
+	protected ArrayList<ITXMResult> getDeepResults(ITXMResult parent, ArrayList<ITXMResult> results)	{
+		//FIXME: need to prove this method
+		System.err.println("TXMResult2.getDeepResults(ITXMResult parent, ArrayList<ITXMResult> results): NEED TO VALIDATE THIS METHOD");
+		for(int i = 0; i < parent.getResults().size(); i++) {
+			results.addAll(parent.getResults().get(i).getDeepResults());
+		}
+		return results; 
+	}
+	
+	/**
+	 * Gets the children of all the branch in a flat list.
+	 * @return
+	 */
+	public ArrayList<ITXMResult> getDeepResults()	{
+		//FIXME: need to prove this method
+		System.err.println("TXMResult2.getDeepResults(): NEED TO VALIDATE THIS METHOD");
+		return this.getDeepResults(this, new ArrayList<ITXMResult>());
+	}
+	
+
+	
+	/**
+	 * Filters the nodes specified by their class.
+	 * @param type
+	 * @return
+	 */
+	public static ArrayList<ITXMResult> getNodes(ArrayList<ITXMResult> srcNodes, Class type)	{
+		ArrayList<ITXMResult> nodes = new ArrayList<ITXMResult>();
+		for(int i = 0; i < srcNodes.size(); i++) {
+			if(srcNodes.get(i).getClass().equals(type))	{
+				nodes.add(srcNodes.get(i));
+			}
+		}
+		return nodes;
+	}
+	
+	
+	
+	/**
+	 * Gets the sibling nodes of this node result.
+	 */
+	public ArrayList<ITXMResult> getSiblings()	{
+		ArrayList<ITXMResult> sibling = new ArrayList<ITXMResult>();
+		if(this.parent != null)	{
+			sibling.addAll(this.parent.getResults());
+			sibling.remove(this);
+		}
+		return sibling;
+	}
+	
+
+	/**
+	 * Gets the sibling nodes of this node result, specified by their class.
+	 */
+	public ArrayList<ITXMResult> getSiblings(Class type)	{
+		ArrayList<ITXMResult> sibling = new ArrayList<ITXMResult>();
+		if(this.parent != null)	{
+			sibling.addAll(TXMResult.getNodes(this.parent.getResults(), type));
+			sibling.remove(this);
+		}
+		return sibling;
+	}
+
+	
+	
+	/**
+	 * Removes the parent.
+	 */
+	public void removeParent() {
+		this.parent = null;
+	}
+
+	/**
+	 * Sets the parent.
+	 * @param parent
+	 */
+	public void setParent(ITXMResult parent)	{
+		this.parent = parent;
+	}
+	
+	
+	/**
+	 * Gets the parent.
+	 * @return the parent
+	 */
+	public ITXMResult getParent() {
+		return parent;
+	}
+	
+	
+	/**
+	 * Gets the name of the result.
+	 * @return
+	 */
+	public abstract String getName();
+	
+	/**
+	 * Gets the simple name of the result.
+	 * @return
+	 */
+	public abstract String getSimpleName();
+	
+	/**
+	 * Gets some details about how the result has been computed (eg. additional parameters, etc.).
+	 * @return
+	 */
+	public abstract String getDetails();
+	
+	/**
+	 * Gets a string representing the result and that can be used as a file name.
+	 * @return
+	 */
+	//FIXME: to discuss and/or to move in export layer
+	public String getValidFileName()	{
+		try {
+			return this.getName().replaceAll("[^a-zA-Z0-9\\._-]+", "_");
+		}
+		catch(Exception e) {
+		}	
+		return "";
+	}
+	
+	/**
+	 * Gets a string representing the concatenation of the simple names of the branch of this result.
+	 * @return
+	 */
+	synchronized public String getFullPathSimpleName()	{
+
+		// fill the branch
+		ArrayList<ITXMResult> branch = new ArrayList<ITXMResult>();
+		ITXMResult node = this;
+		do	{
+			branch.add(node);
+			node = node.getParent();
+		}
+		while(node != null);
+		
+		// create the reversed string
+		StringBuilder b = new StringBuilder();
+		for(int i = branch.size() - 1; i >= 0; i--) {
+			b.append(branch.get(i).getClass().getSimpleName() + ": " + branch.get(i).getSimpleName() + " / ");			
+		}
+		b.deleteCharAt(b.length() - 3);
+		b.deleteCharAt(b.length() - 2);
+		b.deleteCharAt(b.length() - 1);
+		
+		return b.toString();
+	}
+	
+	
+	
+	@Override
+	public String toString() {
+		StringBuilder b = new StringBuilder(super.toString());
+		b.append(": " + this.getName()); //$NON-NLS-1$
+		return b.toString();
+	}
+
+
+	/**
+	 * Gets the weight of the node. Essentially used for sorting purpose.
+	 * @return the weight
+	 */
+	public int getWeight() {
+		return weight;
+	}
+
+	/**
+	 * Cleans and free some resources if needed.
+	 * This methods is applied when calling <code>TXMResult.delete()</code>. 
+	 */
+	public abstract void clean();
+	
+	
+	/**
+	 * 
+	 * @param step
+	 */
+	//FIXME: proposals to computing
+	//public abstract void compute(int step);
+	//FIXME: proposals to computing
+//	public boolean compute(int start, int end)	{
+//		for(int i = start; i <= end; i++) {
+//			if(Thread.interrupted())	{
+//				this.clean();
+//				return false;
+//			}
+//			this.compute(i);
+//		}
+//		return true;
+//	}
+	
+	
+	@Override
+	public Object clone() {
+	    TXMResult clone = null;
+	    try {
+			clone = (TXMResult) super.clone();
+		    this.parent.addResult(clone);
+		}
+		catch(Exception e) {
+		}
+	    return clone;
+	}
+	
+}
+
+

Property changes on: tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/core/messages/messages.properties
===================================================================
--- tmp/org.txm.core/src/java/org/txm/core/messages/messages.properties	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/core/messages/messages.properties	(revision 258)
@@ -0,0 +1,455 @@
+
+AbsoluteFrequency_1 = Absolute Frequency
+
+AbstractCqiClient_2 = No error.
+
+Base_0  = Binary directory 
+Base_22 = 'corpora' element missing from 'base' element
+Base_3  = \ does not exist?
+Base_4  = Parent directory 
+Base_5  = \ does not exist?
+Base_6  = Error: linkGrp/link/@target malformed: 
+
+BuildCwbEncodeArgs_0 = The file ''{0}'' cannot be found.
+
+COMPUTE_DONE_NO_RESULT = Done: no result
+
+CONNECTING_CQI_CLIENT = Connecting to the Search Engine with the following parameters: {0}:{1}@{2}{3}
+
+CQI_CLIENT_CONNECTED = Connected to the Search Engine.
+
+CREATING_PART      = Part {0} created with query {1}
+CREATING_SUBCORPUS = Subcorpus {1} created from corpus {0} with the query {2}
+
+CatalogManager_0 = ** Manager Error during initialization: 
+CatalogManager_1 = \ does not exist.
+
+Catalog_0        = ** Catalog File Not found 
+
+CompositeComparator_0 = Composite: 
+
+Concordance_0  = \ 
+Concordance_1  = ** Failed to retrieve text_id property from lines
+Concordance_12 = ** Failed to export Concordance: 
+Concordance_13 = Reference
+Concordance_14 = LeftContext
+Concordance_15 = Keyword
+Concordance_16 = RightContext
+Concordance_17 = Reference
+Concordance_19 = Context
+Concordance_2  = undefined
+Concordance_3  = \ results retrieved in 
+Concordance_4  = Failed to remove QueryResult from CQP: 
+Concordance_6  = Retrieving 
+Concordance_7  = \ results
+Concordance_8  = Failed to get texts limits: 
+
+Contrasts_0 = Computing: 
+
+Convert5To6_1  = is missing
+Convert5To6_10 = 'registry' file is missing: 
+Convert5To6_11 = 'html' directory is missing: 
+Convert5To6_12 = processing...
+Convert5To6_15 = reorganizing files of 
+Convert5To6_19 = Read corpus infos from old import.xml file: 
+Convert5To6_30 = Fill import.xml with: 
+Convert5To6_46 = processing text: 
+Convert5To6_6  = checking binary format...
+Convert5To6_7  = 'txm' directory is missing: 
+Convert5To6_8  = 'html' directory is missing: 
+Convert5To6_9  = 'data' directory is missing: 
+
+CorpusManager_0 = ** CQi Client not initialized
+CorpusManager_1 = ** Error: This exception should not be thrown
+
+Corpus_12       = ** Failed to restore subcorpus 
+Corpus_13       = Corpus:getLocale: CQP is not ready to answer: 
+Corpus_14       = Warning: can't load corpus 
+Corpus_15       = informations from workspace (selfElement  null)
+Corpus_19       = ** Failed to restore partition 
+Corpus_2        = Corpus: 
+Corpus_3        = , Encoding : 
+Corpus_4        = , Language : 
+Corpus_5        = No values given
+Corpus_6        = ** Corpus: the reference to text 
+Corpus_7        = \ is broken
+Corpus_8        = \ in \	\	\	\	\	\	\	\	
+
+CqiClient_0  = Get Last CQP error
+CqiClient_1  = Read CQI CTRL LAST GENERAL ERROR
+CqiClient_3  = ** Failed to get last CQP error
+CqiClient_32 = Search Engine launched...
+CqiClient_33 = ** failed to connect to Search Engine.
+CqiClient_34 = Running SearchEngine in memory mode.
+
+CwbEncode_0  = The directory does not exists: 
+CwbEncode_21 = The "binary" directory does not exists: 
+CwbEncode_23 = The "registry" directory does not exists:  
+CwbEncode_25 = The "corpora" directory does not exists: 
+CwbEncode_27 = Processing corpus...
+CwbEncode_29 = The "data" directory does not exists: 
+CwbEncode_32 = Fixing registry file {0} with {1}
+
+CwbProcess_1 = Starting process with command: 
+CwbProcess_3 = Stopping process: 
+CwbProcess_4 = Process stoped: 
+CwbProcess_5 = ** Can't find CQP location : 
+
+DONE = Done.
+
+DOUBLE_VECTOR_ADDED_TO_WORKSPACE = Vector "{1}" ({0,number,integer} "doubles") transmitted to the Statistics Engine.
+
+DROP_PARTITION   = Deleting partition {0}
+DROP_QUERYRESULT = Deleting query results {0}
+DROP_SUBCORPUS   = Deleting subcorpus {0}
+
+Diagnostic_0  = * Structural Units properties\n
+Diagnostic_1  = ** Failed to access corpus 
+Diagnostic_10 = Partition name: 
+Diagnostic_11 = \ structures
+Diagnostic_12 = Number of parts: 
+Diagnostic_13 = Partition size: 
+Diagnostic_14 = Lexical Units properties (max {0} values)
+Diagnostic_15 = Part number: 
+Diagnostic_16 = Number of structural units 
+Diagnostic_17 = Part names: 
+Diagnostic_18 = Part sizes: 
+Diagnostic_19 = Part properties: 
+Diagnostic_2  = ** Error
+Diagnostic_20 = Parts queries: 
+Diagnostic_22 = Structural Units properties (max {0} values)
+Diagnostic_23 = \ values)
+Diagnostic_26 = No property
+Diagnostic_3  = Description of 
+Diagnostic_4  = \ properties
+Diagnostic_40 = * General Statistics\n
+Diagnostic_41 = - T 
+Diagnostic_43 = - Word properties 
+Diagnostic_49 = - S 
+Diagnostic_5  = General Statistics
+Diagnostic_6  = ** Failed to access corpus 
+Diagnostic_7  = Number of words 
+Diagnostic_8  = \ lexicon
+Diagnostic_9  = Number of word properties 
+
+END_SUBCORPUS_LEXICON = Lexicon of subcorpus {0} computed in {1} ms
+END_SUBCORPUS_SIZE    = size of subcorpus {0} ({1}) computed in {2} ms
+
+EVALUATED_EXPRESSION = Expression "{0}" evaluated.
+
+Error_CONNECTION_FAILED = ** Error : while connection to search engine, with the following parameters: 
+
+FAILED = Failed.
+
+FAILED_INIT_CONNECTION_R = ** Failed to connect to Statistics Engine.
+
+FMAX_1 = Fmax: 
+FMAX_2 = , fmax 
+
+FMIN_1 = Fmin: 
+FMIN_2 = , fmin 
+
+FilterManager_0 = ** Filter manager error : initialization 
+FilterManager_1 = \ does not exist.
+
+Filter_7        = ** Read error
+
+Focus_1 = ** The focus is empty or null.
+
+GroovyImportScriptRunner_0 = Initialization of GroovyImportScriptRunner
+GroovyImportScriptRunner_1 = > beginning execution of 
+GroovyImportScriptRunner_3 = > end of execution 
+
+INT_VECTOR_ADDED_TO_WORKSPACE = Vector "{1}" ({0,number,integer} "int") transmitted to Statistics Engine.
+
+Index_0 = ** Error while computing lexicon:\n 
+Index_1 = Console : 
+Index_7 = ** Failed to export Lexicon : 
+
+InternalView_3 = \  Structure informations: 
+InternalView_6 = InternalView: failed to retrieve struct properties values: 
+InternalView_7 = \  No structure informations
+
+LEXICON = Lexicon 
+
+LEXICON_ADDED = Lexicon "{1}" ({0,number,integer} entries) transmitted to Statistics Engine.
+
+LexicographicKeywordComparator_0 = Keyword
+
+LexicographicLeftContextComparator_0 = Left context
+
+LexicographicRightContextComparator_0 = Right context
+
+Lexicon_0 = Forms and frequencies tables must be of the same length.
+Lexicon_3 = Lexicon : 
+
+MATRIX_ADDED_TO_WORKSPACE = Matrix "{2}" ({0,number,integer} rows and {1,number,integer} columns) transmitted to Statistics Engine.
+
+MainCorpus_0 = \ is not a valid CQP ID for a corpus. It must be in uppercase characters.
+MainCorpus_1 = \ in 
+MainCorpus_2 = Delete binary directory: 
+
+MemCqiClient_0  = Internal CQi error: 
+MemCqiClient_1  = CL error: 
+MemCqiClient_10 = Unknown CQP codes : b1 
+MemCqiClient_11 = Query ERROR
+MemCqiClient_2  = CQP error: 
+MemCqiClient_3  = Unknown CQP error : b1 
+MemCqiClient_5  = Unknown CQP cqi error : b1 
+MemCqiClient_7  = Unknown CQP code : b1 
+MemCqiClient_9  = b2 
+
+NEW_PARTION = Creating new partion of corpus {0}: {1}
+
+NetCqiClient_1  = getLastCQiError: 
+NetCqiClient_3  = getLastCQPError: 
+NetCqiClient_5  = Could not reconnect to server: 
+NetCqiClient_97 = client.dumpSubCorpus(subcorpus, NetCqiClient.CQI_CONST_FIELD_MATCH, 1, 2) : 
+
+NetCqiServer_0 = ** cqpserver stdout: 
+NetCqiServer_1 = ** cqpserver stderr: 
+
+NullComparator_0 = None
+
+PACKAGE_LOADED = Library {0} loaded.
+
+PARTITION_CREATED = Partition {0} created in {1} ms
+
+PART_CREATED      = Part {0} created in {1} ms
+
+PROPERTY_1 = Property:
+
+Page_3 = ** Malformed URL, file 
+
+PartitionFocus_1 = The focus cannot be null or empty.
+PartitionFocus_2 = Focus is empty or null
+PartitionFocus_3 = The {0} part focus doesn''t belong to partition {1}.
+PartitionFocus_4 = ** Unknown partition name.
+
+Partition_1      = \ in 
+Partition_18     = Failed to get last CQP error: 
+Partition_2      = \ in 
+Partition_21     = Warning: the partition could not be saved in workspace: 
+Partition_4      = \ query: 
+Partition_9      = ** Failed to create part: 
+
+PatchCwbRegistry_0  = "{0}" corpus registry update
+PatchCwbRegistry_1  = ' corpus
+PatchCwbRegistry_13 = Source registry does not exists: 
+PatchCwbRegistry_16 = Can't find registry file
+PatchCwbRegistry_2  = Updating 
+PatchCwbRegistry_23 = encoding to 
+PatchCwbRegistry_27 = data directory 
+PatchCwbRegistry_28 = Could not patch registry
+PatchCwbRegistry_29 = could not be found in registry file 
+PatchCwbRegistry_3  = ** The target corpus doesn't exist
+PatchCwbRegistry_34 = Updating 
+PatchCwbRegistry_35 = language to 
+PatchCwbRegistry_4  = Add Alignment attribute to corpus 
+PatchCwbRegistry_5  = registry: 
+
+Project_0  = Use directory name to build corpus declaration
+Project_1  = The corpus declaration file is not found too: 
+Project_10 = Project.load: workspace XML file error: 
+Project_11 = Failed to load base parameters from file: 
+Project_12 = Loading {0} corpus...  
+Project_13 = Adding texts: 
+Project_14 = Error: no version in import.xml file
+Project_15 = Error: the corpus version is too old to be loaded.
+Project_16 = Corpus name has been changed from {0} to {1} 
+Project_17 = Error: skipping the loading of corpus: 
+Project_18 = PARAMS: 
+Project_2  = Warning in corpus definition: no name attribute defined in its XML file : {0}
+Project_25 = Error: registry directory does not exist ! 
+Project_26 = ** Error: ''{0}'' corpus directory is not conformant to TXM corpus binary format: corpus skipped." 
+Project_27 = Error while patching registry file: 
+Project_28 = TXM needs folders: 
+Project_3  = Project: load: malformed base node: duplicated 
+Project_31 = and file 
+Project_4  = Remove duplicate corpus from corpus list: 
+Project_5  = Analysing directory...
+Project_6  = Failed to load corpus with params: 
+Project_7  = Failed to load base with parameters file: 
+Project_8  = Can't read corpus parameters file: 
+Project_9  = base
+
+PropertiesReferenceComparator_0 = References
+
+QUERY = Query on {0} : {1} <- {2}
+
+QUERYING_PARTITION = Querying partition {0}
+
+QUERY_1            = Query:
+
+QueryIndex_2 = Warning : duplicate query entry : 
+QueryIndex_3 = Warning: query failed: 
+
+QueryResult_0 = \ is not a valid CQP Id for a subcorpus. It must be an uppercase characters followed by lowercase characters.
+
+READING_2D_INT_ARRAY_FROM_CQI_SERVER = Reading an integer table from the CQi server
+READING_BOOLEAN_FROM_CQI_SERVER      = Reading boolean from the CQi server
+READING_HEADER_FROM_CQI_SERVER       = Reading header from the CQi server
+READING_INTEGER_FROM_CQI_SERVER      = Reading integer from the CQi server
+READING_INT_ARRAY_FROM_CQI_SERVER    = Reading integer array from the CQi server
+READING_STRING_ARRAY_FROM_CQI_SERVER = Reading string array from the CQi server
+READING_STRING_FROM_CQI_SERVER       = Reading string from the CQi server
+
+READ_2D_INT_ARRAY_FROM_CQI_SERVER    = Read string 2D integer from the CQi server : {0}
+READ_BOOLEAN_FROM_CQI_SERVER         = Read boolean from the CQi server : {0}
+READ_BYTE_FROM_CQI_SERVER            = Read byte from the CQi server : {0}
+READ_HEADER_FROM_CQI_SERVER          = Read header from the CQi server : {0}
+READ_INTEGER_FROM_CQI_SERVER         = Read integer from the CQi server : {0}
+READ_INT_ARRAY_FROM_CQI_SERVER       = Read integer array from the CQi server : {0}
+READ_STRING_ARRAY_FROM_CQI_SERVER    = Read string array from the CQi server : {0}
+READ_STRING_FROM_CQI_SERVER          = Read string from the CQi server : {0}
+
+RETURNING_CACHED_LEXICON = Recycling the lexicon {0}
+
+RETURN_FROM_QUERY        = {0} matches found in {1} ms
+
+ReferencePattern_3 = Reference
+
+Referencer_1 = Referencer
+Referencer_2 = Referencer export failed: 
+
+RelativeFrequency_3 = Relative Frenquency %
+
+SERVER_STARTED = Search Engine started 
+SERVER_STOPED  = Search Engine stopped
+
+SORT_COLUMN = Sorting column
+SORT_DONE   = Sort done.
+
+STARTING_SERVER = Starting Search Engine : {0}
+
+STOPING_SERVER = Stopping the Search Engine
+
+SUBCORPUS_CREATED = Subcorpus {0} created in {1} ms
+SUBCORPUS_LEXICON = Computing the lexicon of subcorpus {0}
+SUBCORPUS_SIZE    = Computing the size of subcorpus {0}
+
+Selection_0  = \ number of words : 
+Selection_1  = \ number of texts : 
+Selection_2  = \ value : 
+Selection_26 = Failed to get sup values of 
+Selection_3  = Property : 
+Selection_4  = number of words : 
+Selection_5  = Text metadata: 
+Selection_6  = Selection error: the corpus 
+Selection_7  = has no base
+Selection_8  = Can't find structural unit for metadata with id: 
+Selection_9  = Error while getting metadatas from Base.importMetadatas: 
+
+StreamGobbler_0 = Initializing log recorder
+StreamGobbler_1 = Starting log recorder
+StreamGobbler_2 = Stopping log recorder
+StreamGobbler_3 = Interrupting log recorder
+
+StructuralUnitProperty_0 = ** Failed to access structural property values 
+
+Subcorpus_1 = \ in 
+Subcorpus_2 = Warning: the subcorpus could not be saved in workspace: 
+Subcorpus_3 = \ is not a valid CQP ID for a subcorpus. It must be an uppercase character followed by lowercase characters.
+
+Summary_13 = Error : text 
+Summary_14 = is null
+Summary_15 = Error : edition default is null
+Summary_16 = Error: textids
+Summary_17 = and wordids
+
+T = t 
+
+TSCmd_30 = Query was: 
+TSCmd_31 = matches found.
+
+TSCorpusManager_0 = Error reg dir: 
+TSCorpusManager_1 = Error configdir dir: 
+
+TSCorpus_0        = Couldn't read corpus: 
+
+TSResult_0  = Number of match 
+TSResult_13 = Cannot found tigerXml file: 
+TSResult_14 = Ts: conc: Failed to create xml file
+TSResult_18 = Starting injection
+TSResult_2  = Number of sub match 
+TSResult_7  = Can't find 
+TSResult_8  = in TS export methods 
+
+TigerXmlIndexing_2 = ERROR: !exists
+TigerXmlIndexing_3 = ERROR: !read
+TigerXmlIndexing_6 = IO: 
+TigerXmlIndexing_7 = SAX: 
+
+Toolbox_0                         = ** File
+Toolbox_1                         = ** Platform : the parameters SERVER_PATH_TO_EXECUTABLE, SERVER_PATH_TO_REGISTRY et SERVER_PATH_TO_INIT_FILE must be specified in a given '.properties' file.
+Toolbox_10                        = ** No worlspace found. Creating a new one.
+Toolbox_11                        = Updating with : 
+Toolbox_12                        = Loading workspace from file : 
+Toolbox_14                        = ** Error loadgin workspace from file : 
+Toolbox_15                        = ** Error : 
+Toolbox_16                        = \ does not exists
+Toolbox_17                        = End of CQP wait test
+Toolbox_18                        = ** Error while waiting for CQP
+Toolbox_2                         = ** Error: null value for key 
+Toolbox_21                        = \ R: 
+Toolbox_22                        = \ Workspace: 
+Toolbox_27                        = \ and 
+Toolbox_28                        = Failed to start MemCqiClient: 
+Toolbox_29                        = ** Error while connecting to search engine.
+Toolbox_3                         = true
+Toolbox_30                        = - wrong login or password or port : 
+Toolbox_31                        = Failed to exec 'taskkill /IM cqpserver.exe /F': 
+Toolbox_33                        = - or the engine was not started with the command line: 
+Toolbox_34                        = Failed to exec 'tskill cqpserver.exe': 
+Toolbox_37                        = kill `ps aux | grep cqpserver | awk '/-P 
+Toolbox_38                        = / {print $2}'`
+Toolbox_39                        = Failed to exec '
+Toolbox_4                         = With parameters: 
+Toolbox_40                        = ': 
+Toolbox_7                         = The path to R program is null
+Toolbox_8                         = Undefined keys : 
+Toolbox_9                         = Platform parameters: 
+Toolbox_connected_to_corpus_sever = connected
+Toolbox_wait_failed               = ** Failed to wait for the interrupted process
+Toolbox_workspace_init            = Reloading subcorpora and partitions...
+Toolbox_workspace_init_failed     = ** Error during workspace initialisation :
+Toolbox_wrong_port                = ** Error : the connexion to the server failed : wrong port format
+
+TxmObject_0 = ** Failed to get parent object
+TxmObject_1 = TxmObject: delete: parent object is null
+TxmObject_2 = Failed to save attribute 
+
+TxmRenderer_1 = TxmRenderer: error: no corpus found for result 
+TxmRenderer_5 = line: 
+TxmRenderer_6 = prop 
+TxmRenderer_7 = mdc: 
+
+V = , v 
+
+VARIABLE_REMOVED = R Variable "{0}" deleted.
+
+VMAX_1 = Vmax:
+
+ValidateXml_0 = XmlValidation: 
+ValidateXml_1 = is a directory
+ValidateXml_2 = does not exists
+ValidateXml_3 = is not read-able
+
+WORKSPACE_PURGED = Statistics Engine cleaned up.
+
+Workspace_0  = , index 
+Workspace_1  = \	\	\	Edition: 
+Workspace_10 = corpus: 
+Workspace_2  = ** Failed to load workspace: 
+Workspace_26 = \	\	\	\	Page: 
+Workspace_27 = \ wordid 
+Workspace_28 = \	\	Script: 
+Workspace_29 = , type:  
+Workspace_3  = Project: 
+Workspace_30 = \	Corpora: 
+Workspace_31 = \	\	Text: 
+Workspace_4  = \	Base: 
+Workspace_5  = \	\	Text: 
+Workspace_6  = ** Failed to create empty workspace file: 
+Workspace_7  = \ pages
+Workspace_8  = Workspace XML file is mal formed. We need to recreate one...

Property changes on: tmp/org.txm.core/src/java/org/txm/core/messages/messages.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/core/messages/Utf8NLS.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/core/messages/Utf8NLS.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/core/messages/Utf8NLS.java	(revision 258)
@@ -0,0 +1,46 @@
+package org.txm.core.messages;
+
+import java.lang.reflect.Field;
+
+import org.eclipse.osgi.util.NLS;
+
+
+/**
+ * Class that manages UTF-8 encoding for .properties messages files.
+ * @author sjacquot
+ *
+ */
+public class Utf8NLS extends NLS {
+
+
+	/**
+	 * Initializes messages using UTF-8 encoding.
+	 * @param baseName
+	 * @param clazz
+	 */
+	public static void initializeMessages(final String baseName, final Class<?> clazz) {
+		// initialize resource bundle
+		NLS.initializeMessages(baseName, clazz);
+
+		// reencode the fields
+		final Field[] fieldArray = clazz.getDeclaredFields();
+		final int len = fieldArray.length;
+		for(int i = 0; i < len; i++) {
+			final Field field = (Field) fieldArray[i];
+			if(field.getType() == java.lang.String.class) {
+				if(!field.isAccessible())
+					field.setAccessible(true);
+				try {
+					final String rawValue = (String) field.get(null);
+					field.set(null, new String(rawValue.getBytes("ISO-8859-1"), "UTF-8"));
+				}
+				catch(Exception e) {
+				//	e.printStackTrace();
+				}
+			}
+		}
+	}
+
+	
+	
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/core/messages/Utf8NLS.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/core/messages/messages_ru.properties
===================================================================
--- tmp/org.txm.core/src/java/org/txm/core/messages/messages_ru.properties	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/core/messages/messages_ru.properties	(revision 258)
@@ -0,0 +1,8 @@
+
+COMPUTE_DONE_NO_RESULT = Ни одного результата
+
+PROPERTY_1 = Свойство
+
+QUERY_1 = Запрос:
+
+SORT_DONE = Сортировка завершена.

Property changes on: tmp/org.txm.core/src/java/org/txm/core/messages/messages_ru.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/core/messages/TXMCoreMessages.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/core/messages/TXMCoreMessages.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/core/messages/TXMCoreMessages.java	(revision 258)
@@ -0,0 +1,390 @@
+package org.txm.core.messages;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * Toolbox core messages.
+ * 
+ * @author mdecorde
+ * @author sjacquot
+ *
+ */
+public class TXMCoreMessages extends NLS {
+
+	private static final String BUNDLE_NAME = "org.txm.core.messages.messages"; //$NON-NLS-1$
+	
+	
+	public static String PROPERTY_1;
+
+	public static String FMIN_1;
+	public static String FMIN_2;
+	public static String FMAX_1;
+	public static String FMAX_2;
+	public static String VMAX_1;
+	public static String QUERY_1;
+	public static String T;
+	public static String V;
+	public static String COMPUTE_DONE_NO_RESULT;
+
+	
+	
+	public static String FAILED;
+	public static String DONE;			
+	public static String AbsoluteFrequency_1;
+	public static String AbstractCqiClient_2;
+	public static String Base_0;
+	public static String Base_22;
+	public static String Base_3;
+	public static String Base_4;
+	public static String Base_5;
+	public static String Base_6;
+	public static String BuildCwbEncodeArgs_0;
+	public static String CONNECTING_CQI_CLIENT;
+	public static String CQI_CLIENT_CONNECTED;
+	public static String CREATING_PART;
+	public static String CREATING_SUBCORPUS;
+	public static String CatalogManager_0;
+	public static String CatalogManager_1;
+	public static String Catalog_0;
+	public static String CompositeComparator_0;
+	public static String Concordance_0;
+	public static String Concordance_1;
+	public static String Concordance_12;
+	public static String Concordance_13;
+	public static String Concordance_14;
+	public static String Concordance_15;
+	public static String Concordance_16;
+	public static String Concordance_17;
+	public static String Concordance_18;
+	public static String Concordance_19;
+	public static String Concordance_2;
+	public static String Concordance_3;
+	public static String Concordance_4;
+	public static String Concordance_5;
+	public static String Concordance_6;
+	public static String Concordance_7;
+	public static String Concordance_8;
+	public static String Contrasts_0;
+	public static String Convert5To6_1;
+	public static String Convert5To6_10;
+	public static String Convert5To6_11;
+	public static String Convert5To6_12;
+	public static String Convert5To6_15;
+	public static String Convert5To6_19;
+	public static String Convert5To6_30;
+	public static String Convert5To6_46;
+	public static String Convert5To6_6;
+	public static String Convert5To6_7;
+	public static String Convert5To6_8;
+	public static String Convert5To6_9;
+	public static String CorpusManager_0;
+	public static String CorpusManager_1;
+	public static String Corpus_12;
+	public static String Corpus_13;
+	public static String Corpus_14;
+	public static String Corpus_15;
+	public static String Corpus_19;
+	public static String Corpus_2;
+	public static String Corpus_3;
+	public static String Corpus_4;
+	public static String Corpus_5;
+	public static String Corpus_6;
+	public static String Corpus_7;
+	public static String Corpus_8;
+	public static String CqiClient_0;
+	public static String CqiClient_1;
+	public static String CqiClient_3;
+	public static String CqiClient_32;
+	public static String CqiClient_33;
+	public static String CqiClient_34;
+	public static String CwbEncode_0;
+	public static String CwbEncode_21;
+	public static String CwbEncode_23;
+	public static String CwbEncode_25;
+	public static String CwbEncode_27;
+	public static String CwbEncode_29;
+	public static String CwbEncode_32;
+	public static String CwbProcess_1;
+	public static String CwbProcess_3;
+	public static String CwbProcess_4;
+	public static String CwbProcess_5;
+	public static String DOUBLE_VECTOR_ADDED_TO_WORKSPACE;
+	public static String DROP_PARTITION;
+	public static String DROP_QUERYRESULT;
+	public static String DROP_SUBCORPUS;
+	public static String Diagnostic_0;
+	public static String Diagnostic_1;
+	public static String Diagnostic_10;
+	public static String Diagnostic_11;
+	public static String Diagnostic_12;
+	public static String Diagnostic_13;
+	public static String Diagnostic_14;
+	public static String Diagnostic_15;
+	public static String Diagnostic_16;
+	public static String Diagnostic_17;
+	public static String Diagnostic_18;
+	public static String Diagnostic_19;
+	public static String Diagnostic_2;
+	public static String Diagnostic_20;
+	public static String Diagnostic_22;
+	public static String Diagnostic_23;
+	public static String Diagnostic_26;
+	public static String Diagnostic_3;
+	public static String Diagnostic_4;
+	public static String Diagnostic_40;
+	public static String Diagnostic_41;
+	public static String Diagnostic_43;
+	public static String Diagnostic_49;
+	public static String Diagnostic_5;
+	public static String Diagnostic_6;
+	public static String Diagnostic_7;
+	public static String Diagnostic_8;
+	public static String Diagnostic_9;
+	public static String END_SUBCORPUS_LEXICON;
+	public static String END_SUBCORPUS_SIZE;
+	public static String EVALUATED_EXPRESSION;
+	public static String FAILED_INIT_CONNECTION_R;
+	public static String FilterManager_0;
+	public static String FilterManager_1;
+	public static String Filter_7;
+	public static String Focus_1;
+	public static String GroovyImportScriptRunner_0;
+	public static String GroovyImportScriptRunner_1;
+	public static String GroovyImportScriptRunner_3;
+	public static String INT_VECTOR_ADDED_TO_WORKSPACE;
+	public static String InternalView_3;
+	public static String InternalView_6;
+	public static String InternalView_7;
+	public static String LEXICON;
+	public static String LEXICON_ADDED;
+	public static String LexicographicKeywordComparator_0;
+	public static String LexicographicLeftContextComparator_0;
+	public static String LexicographicRightContextComparator_0;
+	public static String Lexicon_0;
+	public static String Lexicon_3;
+	public static String MATRIX_ADDED_TO_WORKSPACE;
+	public static String MainCorpus_0;
+	public static String MainCorpus_1;
+	public static String MainCorpus_2;
+	public static String MemCqiClient_0;
+	public static String MemCqiClient_1;
+	public static String MemCqiClient_10;
+	public static String MemCqiClient_11;
+	public static String MemCqiClient_2;
+	public static String MemCqiClient_3;
+	public static String MemCqiClient_5;
+	public static String MemCqiClient_7;
+	public static String MemCqiClient_9;
+	public static String NEW_PARTION;
+	public static String NetCqiClient_1;
+	public static String NetCqiClient_3;
+	public static String NetCqiClient_5;
+	public static String NetCqiClient_97;
+	public static String NetCqiServer_0;
+	public static String NetCqiServer_1;
+	public static String NullComparator_0;
+	public static String PACKAGE_LOADED;
+	public static String PARTITION_CREATED;
+	public static String PART_CREATED;
+	public static String Page_3;
+	public static String PartitionFocus_1;
+	public static String PartitionFocus_2;
+	public static String PartitionFocus_3;
+	public static String PartitionFocus_4;
+	public static String Partition_1;
+	public static String Partition_18;
+	public static String Partition_2;
+	public static String Partition_21;
+	public static String Partition_4;
+	public static String Partition_9;
+	public static String PatchCwbRegistry_0;
+	public static String PatchCwbRegistry_1;
+	public static String PatchCwbRegistry_13;
+	public static String PatchCwbRegistry_16;
+	public static String PatchCwbRegistry_2;
+	public static String PatchCwbRegistry_23;
+	public static String PatchCwbRegistry_27;
+	public static String PatchCwbRegistry_28;
+	public static String PatchCwbRegistry_29;
+	public static String PatchCwbRegistry_3;
+	public static String PatchCwbRegistry_34;
+	public static String PatchCwbRegistry_35;
+	public static String PatchCwbRegistry_4;
+	public static String PatchCwbRegistry_5;
+	public static String Project_0;
+	public static String Project_1;
+	public static String Project_10;
+	public static String Project_11;
+	public static String Project_12;
+	public static String Project_13;
+	public static String Project_14;
+	public static String Project_15;
+	public static String Project_16;
+	public static String Project_17;
+	public static String Project_18;
+	public static String Project_2;
+	public static String Project_25;
+	public static String Project_26;
+	public static String Project_27;
+	public static String Project_28;
+	public static String Project_3;
+	public static String Project_31;
+	public static String Project_4;
+	public static String Project_5;
+	public static String Project_6;
+	public static String Project_7;
+	public static String Project_8;
+	public static String Project_9;
+	public static String PropertiesReferenceComparator_0;
+	public static String QUERY;
+	public static String QUERYING_PARTITION;
+	public static String QueryIndex_2;
+	public static String QueryIndex_3;
+	public static String QueryResult_0;
+	public static String READING_2D_INT_ARRAY_FROM_CQI_SERVER;
+	public static String READING_BOOLEAN_FROM_CQI_SERVER;
+	public static String READING_HEADER_FROM_CQI_SERVER;
+	public static String READING_INTEGER_FROM_CQI_SERVER;
+	public static String READING_INT_ARRAY_FROM_CQI_SERVER;
+	public static String READING_STRING_ARRAY_FROM_CQI_SERVER;
+	public static String READING_STRING_FROM_CQI_SERVER;
+	public static String READ_2D_INT_ARRAY_FROM_CQI_SERVER;
+	public static String READ_BOOLEAN_FROM_CQI_SERVER;
+	public static String READ_BYTE_FROM_CQI_SERVER;
+	public static String READ_HEADER_FROM_CQI_SERVER;
+	public static String READ_INTEGER_FROM_CQI_SERVER;
+	public static String READ_INT_ARRAY_FROM_CQI_SERVER;
+	public static String READ_STRING_ARRAY_FROM_CQI_SERVER;
+	public static String READ_STRING_FROM_CQI_SERVER;
+	public static String RETURNING_CACHED_LEXICON;
+	public static String RETURN_FROM_QUERY;
+	public static String ReferencePattern_3;
+	public static String Referencer_1;
+	public static String Referencer_2;
+	public static String RelativeFrequency_3;
+	public static String SERVER_STARTED;
+	public static String SERVER_STOPED;
+	public static String STARTING_SERVER;
+	public static String STOPING_SERVER;
+	public static String SUBCORPUS_CREATED;
+	public static String SUBCORPUS_LEXICON;
+	public static String SUBCORPUS_SIZE;
+	public static String Selection_0;
+	public static String Selection_1;
+	public static String Selection_2;
+	public static String Selection_26;
+	public static String Selection_3;
+	public static String Selection_4;
+	public static String Selection_5;
+	public static String Selection_6;
+	public static String Selection_7;
+	public static String Selection_8;
+	public static String Selection_9;
+	public static String StreamGobbler_0;
+	public static String StreamGobbler_1;
+	public static String StreamGobbler_2;
+	public static String StreamGobbler_3;
+	public static String StructuralUnitProperty_0;
+	public static String Subcorpus_1;
+	public static String Subcorpus_2;
+	public static String Subcorpus_3;
+	public static String Summary_13;
+	public static String Summary_14;
+	public static String Summary_15;
+	public static String Summary_16;
+	public static String Summary_17;
+	public static String TSCmd_30;
+	public static String TSCmd_31;
+	public static String TSCorpusManager_0;
+	public static String TSCorpusManager_1;
+	public static String TSCorpus_0;
+	public static String TSResult_0;
+	public static String TSResult_13;
+	public static String TSResult_14;
+	public static String TSResult_18;
+	public static String TSResult_2;
+	public static String TSResult_7;
+	public static String TSResult_8;
+	public static String TigerXmlIndexing_2;
+	public static String TigerXmlIndexing_3;
+	public static String TigerXmlIndexing_6;
+	public static String TigerXmlIndexing_7;
+	public static String Toolbox_0;
+	public static String Toolbox_1;
+	public static String Toolbox_10;
+	public static String Toolbox_11;
+	public static String Toolbox_12;
+	public static String Toolbox_14;
+	public static String Toolbox_15;
+	public static String Toolbox_16;
+	public static String Toolbox_17;
+	public static String Toolbox_18;
+	public static String Toolbox_2;
+	public static String Toolbox_21;
+	public static String Toolbox_22;
+	public static String Error_CONNECTION_FAILED;
+
+	public static String Toolbox_27;
+	public static String Toolbox_28;
+	public static String Toolbox_29;
+	public static String Toolbox_3;
+	public static String Toolbox_30;
+	public static String Toolbox_31;
+	public static String Toolbox_33;
+	public static String Toolbox_34;
+	public static String Toolbox_37;
+	public static String Toolbox_38;
+	public static String Toolbox_39;
+	public static String Toolbox_4;
+	public static String Toolbox_40;
+	public static String Toolbox_7;
+	public static String Toolbox_8;
+	public static String Toolbox_9;
+	public static String Toolbox_connected_to_corpus_sever;
+	public static String Toolbox_wait_failed;
+	public static String Toolbox_workspace_init;
+	public static String Toolbox_workspace_init_failed;
+	public static String Toolbox_wrong_port;
+	public static String TxmObject_0;
+	public static String TxmObject_1;
+	public static String TxmObject_2;
+	public static String TxmRenderer_1;
+	public static String TxmRenderer_5;
+	public static String TxmRenderer_6;
+	public static String TxmRenderer_7;
+	public static String VARIABLE_REMOVED;
+	public static String ValidateXml_0;
+	public static String ValidateXml_1;
+	public static String ValidateXml_2;
+	public static String ValidateXml_3;
+	public static String Index_0;
+	public static String Index_1;
+	public static String Index_7;
+	public static String WORKSPACE_PURGED;
+	public static String Workspace_0;
+	public static String Workspace_1;
+	public static String Workspace_10;
+	public static String Workspace_2;
+	public static String Workspace_26;
+	public static String Workspace_27;
+	public static String Workspace_28;
+	public static String Workspace_29;
+	public static String Workspace_3;
+	public static String Workspace_30;
+	public static String Workspace_31;
+	public static String Workspace_4;
+	public static String Workspace_5;
+	public static String Workspace_6;
+	public static String Workspace_7;
+	public static String Workspace_8;
+	
+	
+	
+	static {
+		// initialize resource bundle
+		Utf8NLS.initializeMessages(BUNDLE_NAME, TXMCoreMessages.class);
+	}
+	
+	
+	
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/core/messages/TXMCoreMessages.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/core/messages/messages_fr.properties
===================================================================
--- tmp/org.txm.core/src/java/org/txm/core/messages/messages_fr.properties	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/core/messages/messages_fr.properties	(revision 258)
@@ -0,0 +1,447 @@
+﻿
+AbsoluteFrequency_1 = Fréquence absolue
+
+AbstractCqiClient_2 = Pas d'erreur à notifier.
+
+Base_0  = Dossier binaire 
+Base_22 = L'élément 'corpora' est absent de l'élément 'base'
+Base_3  = \ n'existe pas ?
+Base_4  = Le dossier parent 
+Base_5  = \ n'existe pas ?
+Base_6  = Erreur: linkGrp/link/@target mal formé : 
+
+BuildCwbEncodeArgs_0 = Le fichier ''{0}'' est introuvable.
+
+COMPUTE_DONE_NO_RESULT = Aucun résultat
+
+CONNECTING_CQI_CLIENT = Connexion au moteur de recherche avec les paramètres suivants : {0}:{1}@{2}{3}...
+
+CQI_CLIENT_CONNECTED = Connexion au moteur de recherche établie.
+
+CREATING_PART      = Partie {0} créée à partir de la requête {1}
+CREATING_SUBCORPUS = Création du sous-corpus {1} à partir du corpus {0} et de la requête {2}
+
+CatalogManager_0 = ** Erreur du gestionnaire de catalogue : initialisation 
+CatalogManager_1 = \ n'existe pas.
+
+Catalog_0        = ** Fichier de catalogue introuvable
+
+CompositeComparator_0 = Composé : 
+
+Concordance_0  = \ 
+Concordance_1  = ** Echec de récupération de la propriété 'text_id' des lignes 
+Concordance_12 = ** Echec de l'exportation de la concordance : 
+Concordance_13 = Référence
+Concordance_14 = ContexteGauche
+Concordance_15 = Pivot
+Concordance_16 = ContexteDroit
+Concordance_17 = Référence
+Concordance_19 = Contexte
+Concordance_2  = indéfini
+Concordance_3  = \ résultats obtenus en 
+Concordance_4  = Echec de la suppression du QueryResult de CQP: 
+Concordance_6  = Récupération 
+Concordance_7  = \ résultats
+Concordance_8  = Echec de la récupération des limites de texte : 
+
+Contrasts_0 = Calcul: 
+
+Convert5To6_1  = ''{0}'' est introuvable.
+Convert5To6_10 = le dossier 'registry' est manquant
+Convert5To6_11 = le dossier 'html' est manquant
+Convert5To6_12 = traitement en cours...
+Convert5To6_15 = Reorganisation des fichiers de 
+Convert5To6_19 = Lecture des informatins sur le corpus depuis le fichier import.xml : 
+Convert5To6_30 = Remplissage du fichier 'import.xml' avec : 
+Convert5To6_46 = traitement du fichier : 
+Convert5To6_6  = Vérification du format...
+Convert5To6_7  = le dossier 'txm' est manquant
+Convert5To6_8  = le dossier 'html' est manquant
+Convert5To6_9  = le dossier 'data' est manquant
+
+CorpusManager_0 = ** Le client CQi n'est pas initilialisé
+CorpusManager_1 = ** Erreur : Cette exception ne devrait pas se lever
+
+Corpus_12       = ** Echec de la restauration du sous-corpus
+Corpus_13       = Corpus: getLocale: CQP est pas prêt à répondre : 
+Corpus_14       = Attention: le corpus ne peut pas être chargé 
+Corpus_15       = informations from workspace (selfElement  null)
+Corpus_19       = ** Echec de la restauration de la partition
+Corpus_2        = Corpus : 
+Corpus_3        = , Encodage : 
+Corpus_4        = , Langue : 
+Corpus_5        = Pas de valeur donnée
+Corpus_6        = ** Corpus : la référence au texte 
+Corpus_7        = \ est manquante
+Corpus_8        = \ dans
+
+CqiClient_0  = Récupération de la dernière erreur CQP
+CqiClient_1  = Lecture de CQI CTRL LAST GENERAL ERROR
+CqiClient_3  = ** Echec de la lecture de la dernière erreur CQP
+CqiClient_32 = Moteur de recherche lancé...
+CqiClient_33 = ** La connexion au moteur de recherche a échoué.
+CqiClient_34 = Moteur de recherche lancé.
+
+CwbEncode_0  = le dossier n'existe pas :
+CwbEncode_21 = Le dossier "bin" n'existe pas : 
+CwbEncode_23 = Le dossier "registry" n'existe pas : 
+CwbEncode_25 = Le dossier "corpora" n'existe pas :
+CwbEncode_27 = Traitement du corpus 
+CwbEncode_29 = Le dossier "data" n'existe pas :
+CwbEncode_32 = Patch le fichier registry {0} avec {1}
+
+CwbProcess_1 = Démarrage avec la ligne de commande : 
+CwbProcess_3 = Arrêt en cours du processus : 
+CwbProcess_4 = Processus arrêté : 
+CwbProcess_5 = ** Echec de localisation de CQP : 
+
+DONE = Terminé.
+
+DOUBLE_VECTOR_ADDED_TO_WORKSPACE = Le vecteur "{1}" ({0,number,integer} valeurs numériques "doubles") a été transmis au Moteur Statistique.
+
+DROP_PARTITION   = Suppression de la partition {0}
+DROP_QUERYRESULT = Suppression du résultat de requête {0}
+DROP_SUBCORPUS   = Suppression du sous-corpus {0}
+
+Diagnostic_0  = <h3>Propriétés des structures\n
+Diagnostic_1  = ** Echec d'accès au corpus
+Diagnostic_10 = Nom de la partition : 
+Diagnostic_11 = \ structures
+Diagnostic_12 = Nombre de parties :
+Diagnostic_13 = Taille de la partition : 
+Diagnostic_14 = Propriétés des unités lexicales (max {0} valeurs)
+Diagnostic_15 = Numéro de la partie : 
+Diagnostic_16 = Nombre d'unités de structure 
+Diagnostic_17 = Nom des parties : 
+Diagnostic_18 = Taille des parties : 
+Diagnostic_19 = Propriétés des parties : 
+Diagnostic_2  = ** Erreur
+Diagnostic_20 = Requêtes de parties : 
+Diagnostic_22 = Propriétés des structures (max {0} valeurs)
+Diagnostic_23 = \ valeurs)
+Diagnostic_26 = Pas de propriété
+Diagnostic_3  = Description du corpus 
+Diagnostic_4  = \ propriétés
+Diagnostic_40 = * Statistiques Générales\n
+Diagnostic_41 = - T
+Diagnostic_43 = - Propriétés de mot 
+Diagnostic_49 = - S
+Diagnostic_5  = Statistiques Générales
+Diagnostic_6  = ** Echec d'accès au corpus
+Diagnostic_7  = Nombre de mots 
+Diagnostic_8  = \ lexique
+Diagnostic_9  = Nombre de propriétés de mot 
+
+END_SUBCORPUS_LEXICON = Lexique du sous-corpus {0} calculé en {1} ms
+END_SUBCORPUS_SIZE    = Taille du sous-corpus {0} ({1}) calculée en {2} ms
+
+EVALUATED_EXPRESSION = L''expression ''{0}'' a été évaluée.
+
+Error_CONNECTION_FAILED = ** Echec de connexion au moteur de recherche avec les paramètres suivants : 
+
+FAILED = Échec.
+
+FAILED_INIT_CONNECTION_R = ** Echec de connexion au serveur statistique.
+
+FMAX_1 = Fmax : 
+
+FMIN_1 = Fmin : 
+
+FilterManager_0 = ** Erreur du gestionnaire de filtre : initialisation 
+FilterManager_1 = \ n'existe pas.
+
+Filter_7        = ** Erreur de lecture
+
+Focus_1 = ** Le focus est vide ou nul.
+
+GroovyImportScriptRunner_0 = Initialisation de GroovyImportScriptRunner
+GroovyImportScriptRunner_1 = > début de l'exécution de 
+GroovyImportScriptRunner_3 = > fin de l'exécution
+
+INT_VECTOR_ADDED_TO_WORKSPACE = Le vecteur "{1}" ({0,number,integer} valeurs numériques "entières") a été transmis au Moteur Statistique.
+
+Index_0 = ** Erreur lors du calcul du lexique : \n
+Index_1 = console : 
+Index_7 = ** Echec de l'exportation du Lexique : 
+
+InternalView_3 = \  Information des structures :
+InternalView_6 = InternalView: erreur lors de la récupération des valeurs des propriétés de structure
+InternalView_7 = \  No d'informations sur les structures
+
+LEXICON = Lexique
+
+LEXICON_ADDED = Le lexique "{1}" ({0,number,integer} entrées) a été transmis au Moteur Statistique.
+
+LexicographicKeywordComparator_0 = Pivot
+
+LexicographicLeftContextComparator_0 = Contexte gauche
+
+LexicographicRightContextComparator_0 = Contexte droit
+
+Lexicon_0 = Le tableau des formes et des fréquences doivent avoir la même longueur.
+Lexicon_3 = Lexique :
+
+MATRIX_ADDED_TO_WORKSPACE = La matrice "{2}" ({0,number,integer} lignes et {1,number,integer} colonnes) a été transmise au Moteur Statistique.
+
+MainCorpus_0 = \ n'est pas un identifiant de corpus CQP valide. Il doit être en majuscule.
+MainCorpus_1 = \ dans
+MainCorpus_2 = Suppression du dossier de corpus binaire : 
+
+MemCqiClient_0  = Erreur interne CQi : 
+MemCqiClient_1  = Erreur 
+MemCqiClient_10 = Codes CQP inconnus : b1 
+MemCqiClient_11 = Erreur de requête
+MemCqiClient_2  = Attention 
+MemCqiClient_3  = Erreur CQP inconnue : b1 
+MemCqiClient_5  = Erreur CQP cqi inconnue : b1 
+MemCqiClient_7  = Code CQP inconnu : b1 
+MemCqiClient_9  = b2 
+
+NEW_PARTION = Création d''une nouvelle partition du corpus {0} : {1}
+
+NetCqiClient_1  = Dernière erreur Cqi : 
+NetCqiClient_3  = Dernière erreur CQP
+NetCqiClient_5  = Echec de la reconnexion auserveur : 
+NetCqiClient_97 = client.dumpSubCorpus(subcorpus, NetCqiClient.CQI_CONST_FIELD_MATCH, 1, 2) : 
+
+NetCqiServer_0 = ** cqpserver stdout: 
+NetCqiServer_1 = ** cqpserver stderr: 
+
+NullComparator_0 = Aucun
+
+PACKAGE_LOADED = Bibliothèque {0} chargée.
+
+PARTITION_CREATED = Partition {0} créée en {1} ms
+
+PART_CREATED      = Partie {0} créée en {1} ms
+
+PROPERTY_1 = Propriété :
+
+Page_3 = ** URL mal formée, fichier 
+
+PartitionFocus_1 = Le focus ne doit pas être vide ou nul.
+PartitionFocus_2 = Le focus est vide ou nul
+PartitionFocus_3 = Le focus de la partie {0} n''appartient pas à la partition {1}.
+PartitionFocus_4 = ** Nom de partition inconnu.
+
+Partition_1      = \ dans
+Partition_18     = Erreur lors de la récupération de la dernière erreur CQP : 
+Partition_2      = \ dans
+Partition_21     = Attention : la partition n'a pu être sauvegardée
+Partition_4      = \ requête : 
+Partition_9      = ** Echec de la création de la partie :
+
+PatchCwbRegistry_0  = Mise à jour du registre du corpus "{0}"
+PatchCwbRegistry_1  = '
+PatchCwbRegistry_13 = Le fichier registry source n'existe pas
+PatchCwbRegistry_16 = Le fichier 'registry' est introuvable
+PatchCwbRegistry_2  = Mise à jour du corpus 
+PatchCwbRegistry_23 = pour l'encodage 
+PatchCwbRegistry_27 = dossier 'data'
+PatchCwbRegistry_28 = Erreur lors de la reécriture du fichier 'registry'
+PatchCwbRegistry_29 = n'a pu être trouvé dans 
+PatchCwbRegistry_3  = ** Le corpus cible n'existe pas
+PatchCwbRegistry_34 = Mise à jour de la langue du corpus 
+PatchCwbRegistry_35 = à 
+PatchCwbRegistry_4  = Ajout au corpus 
+PatchCwbRegistry_5  = de l'attribut d'alignement 
+
+Project_0  = Utiliser le nom de dossier pour générer la déclaration de corpus
+Project_1  = Le fichier de déclaration de corpus n'a pas été trouvé
+Project_10 = Project.load: erreur dans le fichier XML du workspace: 
+Project_11 = Erreur lors  de la récupération des 
+Project_12 = Chargement du corpus {0}...
+Project_13 = Ajout des textes : 
+Project_14 = Erreur : le fichier 'import.xml' ne contient pas de version
+Project_15 = Erreur : la version du fichier 'import.xml' est trop ancienne pour que le corpus soit chargé
+Project_16 = Le nom de corpus a été changé de {0} à {1} 
+Project_17 = Erreur : le corpus ne sera pas chargé
+Project_18 = Paramètres : 
+Project_2  = Attention, l''attribut ''name'' du corpus n''est pas défini dans la définition XML du fichier {0}.
+Project_25 = Erreur : le dossier 'registry' n'existe pas
+Project_26 = ** Erreur : le dossier d'entrée n'est pas conforme au format de corpus binaire de TXM :  
+Project_27 = Erreur lors de la reécriture du fichier 'registry' : 
+Project_28 = TXM a besoin des dossiers suivants : 
+Project_3  = Attention : deux corpus partagent le même identifiant (@name) dans leur fichier de configuration : {0}
+Project_31 = et le fichier
+Project_4  = Suppression des doublons de la liste des corpus:
+Project_5  = Analyse du dossier...
+Project_6  = Erreur lors du chargement du corpus avec : 
+Project_7  = Erreur lors du chargement du corpus avec : 
+Project_8  = Le fichier de paramétrage de corpus est introuvable (ou illisible). : {0}. Le corpus correspondant ne sera pas disponible. 
+Project_9  = base
+
+PropertiesReferenceComparator_0 = Références
+
+QUERY = Requête sur {0} : {1} <- {2}
+
+QUERYING_PARTITION = Requête sur la partition {0}
+
+QUERY_1            = Requête :
+
+QueryIndex_2 = Attention : requête dupliquée : 
+QueryIndex_3 = Attention: échec de la requête:
+
+QueryResult_0 = \ n'est pas un identifiant de sous-corpus CQP valide. Il doit être en majuscules suivies de caractères minuscules.
+
+READING_2D_INT_ARRAY_FROM_CQI_SERVER = Lecture d'un tableau d'entiers du serveur CQi
+READING_BOOLEAN_FROM_CQI_SERVER      = Lecture d'un booléen du serveur CQi
+READING_HEADER_FROM_CQI_SERVER       = Lecture d'une entête du serveur CQi
+READING_INTEGER_FROM_CQI_SERVER      = Lecture d'un entier du serveur CQi
+READING_INT_ARRAY_FROM_CQI_SERVER    = Lecture d'un tableau d'entiers du serveur CQi
+READING_STRING_ARRAY_FROM_CQI_SERVER = Lecture d'un tableau de chaines du serveur CQi
+READING_STRING_FROM_CQI_SERVER       = Lecture d'une chaine du serveur CQi
+
+READ_2D_INT_ARRAY_FROM_CQI_SERVER    = Tableau d''entiers reçu du serveur CQi : {0}
+READ_BOOLEAN_FROM_CQI_SERVER         = Booléen reçu du serveur CQi : {0}
+READ_BYTE_FROM_CQI_SERVER            = Octet reçu du serveur CQi : {0}
+READ_HEADER_FROM_CQI_SERVER          = Entête reçue du serveur CQi : {0}
+READ_INTEGER_FROM_CQI_SERVER         = Entier reçu du serveur CQi : {0}
+READ_INT_ARRAY_FROM_CQI_SERVER       = Tableau d''entiers reçu du serveur CQi : {0}
+READ_STRING_ARRAY_FROM_CQI_SERVER    = Tableau de chaines reçu du serveur CQi : {0}
+READ_STRING_FROM_CQI_SERVER          = Chaine reçue du serveur CQi : {0}
+
+RETURNING_CACHED_LEXICON = Recyclage du lexique {0}
+
+RETURN_FROM_QUERY        = {0} occurrences trouvées en {1} ms
+
+ReferencePattern_3 = Référence
+
+Referencer_1 = Références
+Referencer_2 = Références : l'export a échoué :  
+
+RelativeFrequency_3 = Fréquence Relative %
+
+SERVER_STARTED = Moteur de recherche lancé 
+SERVER_STOPED  = Moteur de recherche arrêté
+
+SORT_COLUMN = Colonne à trier
+SORT_DONE   = Tri terminé.
+
+STARTING_SERVER = Lancement du moteur de recherche : {0}
+
+STOPING_SERVER = Arrêt du moteur de recherche
+
+SUBCORPUS_CREATED = Sous-corpus {0} créé en {1} ms
+SUBCORPUS_LEXICON = Calcul du lexique du sous-corpus {0}
+SUBCORPUS_SIZE    = Calcul de la taille du sous-corpus {0}
+
+Selection_0  = \ nombre de mots : 
+Selection_1  = \ nombre de textes : 
+Selection_2  = \ valeur : 
+Selection_26 = Echec de la récupération des valeurs de structures de
+Selection_3  = Propriété : 
+Selection_4  = nombre de mots : 
+Selection_5  = Métadonnées de textes : 
+Selection_6  = Erreur : le corpus
+Selection_7  = n'a pas de 'Base'
+Selection_8  = Erreur : pas de structures trouvées pour la métadonnée d'identifiant : 
+Selection_9  = Erreur lors de la récupération des metadonnées du corpus
+
+StreamGobbler_0 = Initialisation de l'enregistreur de journal
+StreamGobbler_1 = démarrage de l'enregistreur de journal
+StreamGobbler_2 = Arrêt de l'enregistreur de journal
+StreamGobbler_3 = Interruption de l'enregistreur de journal
+
+StructuralUnitProperty_0 = ** Echec de lecture des valeurs de la propriété de structure 
+
+Subcorpus_1 = \ dans
+Subcorpus_2 = Attention : le sous-corpus n'a pu être sauvegardé.
+Subcorpus_3 = \ n'est pas un identifiant de sous-corpus CQP valide. Il doit être en majuscules suivies de caractères minuscules.
+
+Summary_13 = Erreur : text
+Summary_14 = a pour valeur  'null'
+Summary_15 = Erreur : edition a pour valeur 'null'
+Summary_16 = Erreur : textids
+Summary_17 = et wordids
+
+TSCmd_30 = La requête était : 
+TSCmd_31 = résultats trouvés
+
+TSCorpusManager_0 = Erreur dans le dossier registre :
+TSCorpusManager_1 = Erreur dans le dossier de configuration : 
+
+TSCorpus_0        = Erreur : le corpus n'a pas les droits de lecture
+
+TSResult_0  = Nombre de match
+TSResult_13 = Erreur : le fichier tigerXML est introuvable : 
+TSResult_14 = Erreur : la concordance n'a pu être enregistré dans le fichier XML
+TSResult_18 = Début de l'injection
+TSResult_2  = Nombre de sous graph
+TSResult_7  = Erreur : la méthode d'export 
+TSResult_8  = est introuvable
+
+TigerXmlIndexing_2 = Erreur : n'existe pas
+TigerXmlIndexing_3 = Erreur : n'a pas les droits de lecture
+TigerXmlIndexing_6 = IO :
+TigerXmlIndexing_7 = SAX : 
+
+Toolbox_0                         = ** Le fichier 
+Toolbox_1                         = ** Plateforme : les paramètres SERVER_PATH_TO_EXECUTABLE, SERVER_PATH_TO_REGISTRY et SERVER_PATH_TO_INIT_FILE doivent être renseignés dans le fichier '.properties' donné à la plateforme 
+Toolbox_10                        = ** Pas d'espace de travail trouvé, création d'un nouvel espace de travail dans le dossier 
+Toolbox_11                        = Mis à jour avec : 
+Toolbox_12                        = Chargement de l'espace de travail à partir du fichier 
+Toolbox_14                        = ** Echec de lecture de l'espace de travail à partir du fichier 
+Toolbox_15                        = ** Erreur :
+Toolbox_16                        = \ n'existe pas.
+Toolbox_17                        = Fin du test d'attente de CQP
+Toolbox_18                        = ** Echec du test d'attente de CQP : 
+Toolbox_2                         = ** Erreur : valeur nulle pour la clé 
+Toolbox_21                        = \ R :
+Toolbox_22                        = \ Espace de travail : 
+Toolbox_27                        = \ et  
+Toolbox_28                        = Erreur lors du démarage du mode mémoire de CQP
+Toolbox_29                        = ** Échec de la connexion au moteur de recherche : 
+Toolbox_3                         = vrai
+Toolbox_30                        = - mauvais login/mot de passe/nom de machine/port :
+Toolbox_31                        = Echec de la commande 'taskkill /IM cqpserver.exe /F': 
+Toolbox_33                        = - ou le moteur de recherche n'a pas été lancé avec la ligne de commande : 
+Toolbox_34                        = Echec de la commande 'tskill cqpserver.exe': 
+Toolbox_37                        = kill `ps aux | grep cqpserver | awk '/-P 
+Toolbox_38                        = / {print $2}'`
+Toolbox_39                        = Echec de l'exécution de '
+Toolbox_4                         = Avec les paramètres suivants :
+Toolbox_40                        = ' :
+Toolbox_7                         = Le chemin vers le programme R est null
+Toolbox_8                         = Clés non définies :
+Toolbox_9                         = Paramètres de la plateforme :
+Toolbox_connected_to_corpus_sever = connecté.
+Toolbox_wait_failed               = ** Echec de l'attente du processus interrompu
+Toolbox_workspace_init            = Chargement des sous-corpus et des partitions...
+Toolbox_workspace_init_failed     = ** Echec de l'initialisation de l'espace de travail : 
+Toolbox_wrong_port                = ** La connexion au moteur de recherche a échoué : le port fourni en paramètre n'est pas un nombre entier
+
+TxmObject_0 = ** Echec de l'accès à l'objet parent
+TxmObject_1 = TxmObject : delete : l'objet parent est nul
+TxmObject_2 = Erreur de la sauvegarde de l'attribut
+
+TxmRenderer_1 = TxmRenderer: erreur: pas de corpus trouvé
+TxmRenderer_5 = ligne : 
+TxmRenderer_6 = prop
+TxmRenderer_7 = mdc :
+
+VARIABLE_REMOVED = La variable R "{0}" a été supprimée.
+
+ValidateXml_0 = Validation XML : 
+ValidateXml_1 = est un dossier
+ValidateXml_2 = n'existe pas
+ValidateXml_3 = n'a pas les bon droits de lecture
+
+WORKSPACE_PURGED = Moteur Statistique nettoyé.
+
+Workspace_0  = , index 
+Workspace_1  = \	\	\	Édition : 
+Workspace_10 = corpus :
+Workspace_2  = ** Echec du chargement de l'espace de travail :
+Workspace_26 = \	\	\	\	Page : 
+Workspace_27 = \ identifiant de mot 
+Workspace_28 = \	\	Script : 
+Workspace_29 = , type :  
+Workspace_3  = Projet : 
+Workspace_30 = \	Corpus : 
+Workspace_31 = \	\	Texte : 
+Workspace_4  = \	Base : 
+Workspace_5  = \	\	Texte : 
+Workspace_6  = ** Echec de la création du fichier d'espace de travail : 
+Workspace_7  = \ pages
+Workspace_8  = Le fichier XML d'espace de travail est mal formé. Un nouveau doit être regénéré...

Property changes on: tmp/org.txm.core/src/java/org/txm/core/messages/messages_fr.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/objects/BaseParameters.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/objects/BaseParameters.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/objects/BaseParameters.java	(revision 258)
@@ -0,0 +1,1213 @@
+package org.txm.objects;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Locale;
+
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.txm.annotation.repository.SQLKnowledgeRepository;
+import org.txm.importer.xtz.ImportKeys;
+import org.txm.sql.SQLConnection;
+import org.txm.utils.xml.DomUtils;
+import org.txm.utils.logger.Log;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+public class BaseParameters implements IParameters  {
+
+	public static final DateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd");
+	public static final DateFormat shortUKDateformat = new SimpleDateFormat("dd-MM-yy");
+
+	HashMap<String, Object> keyValueParameters = new HashMap<String, Object>();
+
+	public static final String ANNOTATE = "annotate";
+	public static final String CORPUS = "corpus";
+	public static final String CURRENTVERSION = "0.7.8";
+	public static final String DATE = "date";
+	public static final String DEFAULT = "default";
+	public static final String DESC = "desc";
+	public static final String ENCODING = "encoding";
+	public static final String LANG = "lang";
+	public static final String LINK = "link";
+	public static final String NAME = "name";
+	public static final String PARAM = "param";
+	public static final String QUERY = "query";
+	public static final String TARGET = "target";
+	public static final String TYPE = "BASE";
+	public static final String PARAMETERS = "parameters";
+	public static final String PARAMETERKEY = "key";
+	public static final String PARAMETERVALUE = "value";
+
+	public static final String TRUE = "true";
+	public static final String FALSE = "false";
+
+	public static String VALUE = "value";
+	public static void createEmptyParams(File paramFile, String basename) throws IOException
+	{
+		paramFile.getParentFile().mkdirs();
+		FileOutputStream fwriter = new FileOutputStream(paramFile);
+		BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(fwriter, "UTF-8"));
+
+		String AUTHOR = System.getProperty("user.name");
+		String DATE = dateformat.format(new Date());
+		DATE = DATE.replace("/", "-");
+
+		String description = "&lt;pre&gt;&lt;br/&gt;"+"- "+basename+"&lt;br/&gt;- "+AUTHOR+"&lt;br/&gt;- "+DATE+"&lt;/pre&gt;";
+		String path = paramFile.getParentFile().getAbsolutePath();
+		path = path.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll("\"", "&#34;");
+		writer.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
+		writer.write("<import version=\""+CURRENTVERSION+"\" author=\""+AUTHOR+"\" date=\""+DATE+"\" desc=\"\" name=\""+basename+"\" rootDir=\""+path+"\" script=\"\">\n");
+		writer.write(" <linkGrp type=\"align\"></linkGrp>\n");
+		writer.write(" <corpora>\n");
+		writer.write("    <corpus desc=\""+description+"\" cqpid=\"\" encoding=\""+System.getProperty("file.encoding")+"\" lang=\""+Locale.getDefault().getLanguage()+"\" font=\"\" annotate=\"true\" name=\""+basename.toUpperCase()+"\">\n");
+		writer.write("       <tokenizer onlyThoseTests=\"false\"></tokenizer>\n");
+		writer.write("       <xslt xsl=\"\"></xslt>\n");
+		writer.write("       <pattributes></pattributes>\n");
+		writer.write("       <sattributes></sattributes>\n");
+		writer.write("       <biblios></biblios>\n");
+		writer.write("       <uis></uis>\n");
+		writer.write("       <editions default=\"default\">\n");
+		writer.write("       	<edition name=\"default\" mode=\"groovy\" page_break_tag=\"pb\" words_per_page=\"500\" build_edition=\"true\" script=\"pager.groovy\"/>\n");
+		writer.write("       </editions>\n");
+		writer.write("       <texts></texts>\n");
+		writer.write("       <queries></queries>\n");
+		writer.write("       <knowledgeRepositories></knowledgeRepositories>\n");
+		writer.write("       <preBuild></preBuild>\n");
+		writer.write("       <parameters></parameters>\n");
+		writer.write("    </corpus>\n");
+		writer.write(" </corpora>\n");
+		writer.write("</import>\n");
+
+		writer.close();
+	}
+	
+	public static String getBaseName(File paramfile) throws ParserConfigurationException, SAXException, IOException {
+		Document root = DomUtils.load(paramfile);
+		return root.getDocumentElement().getAttribute("name");
+	}
+	
+	public static void main(String args[]) throws ParserConfigurationException, SAXException, IOException
+	{
+		String home = System.getProperty("user.home");
+		File paramFile = new File(home, "TXM/corpora/xmltxmpara/param.xml");
+		BaseParameters p = new BaseParameters(paramFile);
+		p.load();
+		System.out.println(p.toString());
+	}
+
+	public HashMap<String, Element> getCorpora() {
+		return corpora;
+	}
+
+	public String author;
+	String AVOIDXMLSTEPSDEFAULT = FALSE;
+	String CLEANTEMPDIRSDEFAULT = FALSE;
+	public HashMap<String, Element> corpora = new HashMap<String, Element>();
+	public Element corporaElement;
+	public Date date;
+	String DEFAULT_CQPLIMITS = "text";
+	boolean DEFAULT_DOEDITION = true;
+	String DEFAULT_PAGEELEMENT = "pb";
+
+	int DEFAULT_WORDSPERPAGE = 500;
+	public String description;
+
+	String DOEDITIONSTEPSDEFAULT = TRUE;
+	public HashMap<String, Element> links = new HashMap<String, Element>();
+
+	public String name;
+
+	public File paramFile;
+
+	public Element root;
+
+	public String rootDir;
+
+	public String scriptFile;
+
+	public String version;
+
+	public BaseParameters(File paramFile) throws ParserConfigurationException, SAXException, IOException
+	{
+		this.paramFile = paramFile;
+		this.root = DomUtils.load(paramFile).getDocumentElement();
+	}
+
+	public Element addCorpusNode(String name, String cqpid, String lang, String encoding, boolean annotate)
+	{
+		if(corporaElement == null)
+			return null;
+		Element corpusElem = root.getOwnerDocument().createElement(CORPUS);
+		corporaElement.appendChild(corpusElem);
+
+		corpusElem.setAttribute(NAME, name);
+		corpusElem.setAttribute("cqpid", cqpid);
+		corpusElem.setAttribute(LANG, lang);
+		corpusElem.setAttribute(ENCODING, encoding);
+		corpusElem.setAttribute(ANNOTATE, ""+annotate);
+
+		corpusElem.appendChild(corpusElem.getOwnerDocument().createElement("texts"));
+		corpusElem.appendChild(corpusElem.getOwnerDocument().createElement("queries"));
+		corpusElem.appendChild(corpusElem.getOwnerDocument().createElement("xslt"));
+		corpusElem.appendChild(corpusElem.getOwnerDocument().createElement("uis"));
+		corpusElem.appendChild(corpusElem.getOwnerDocument().createElement("preBuild"));
+		corpusElem.appendChild(corpusElem.getOwnerDocument().createElement("parameters"));
+		Element tokenizerElem = corpusElem.getOwnerDocument().createElement("tokenizer");
+		tokenizerElem.setAttribute("onlyThoseTests", FALSE);
+		corpusElem.appendChild(tokenizerElem);
+		corpusElem.appendChild(corpusElem.getOwnerDocument().createElement("biblios"));
+		corpusElem.appendChild(corpusElem.getOwnerDocument().createElement("pattributes"));
+		corpusElem.appendChild(corpusElem.getOwnerDocument().createElement("sattributes"));
+		Element editions = corpusElem.getOwnerDocument().createElement("editions");
+		editions.setAttribute(DEFAULT, DEFAULT);
+		corpusElem.appendChild(editions);
+
+		corpora.put(name, corpusElem);
+		return corpusElem;
+	}
+
+	/**
+	 * Add an edition (already declared in the 'editions' element to a text element
+	 * 
+	 * @param textElem
+	 * @param name the edition name to add
+	 * @param index the directory containing the edition pages
+	 * @param type default is 'html'
+	 * @return
+	 */
+	public Element addEdition(Element textElem, String name, String index, String type)
+	{
+		NodeList editionsList = textElem.getElementsByTagName("editions");
+		Element editions = null;
+		if (editionsList.getLength() == 0) {
+			editions = textElem.getOwnerDocument().createElement("editions");
+			textElem.appendChild(editions);
+		} else {
+			editions = (Element) editionsList.item(0);
+		}
+
+		Element editionElement = editions.getOwnerDocument().createElement("edition");
+		editionElement.setAttribute(NAME, name);
+		editionElement.setAttribute("index", index);
+		editionElement.setAttribute("type", type);
+		editions.appendChild(editionElement);
+
+		return editionElement;
+	}
+
+	/**
+	 * 
+	 * @param corpusElem the corpus Element. the new edition definition will be added to corpusElem/editions
+	 * @param name
+	 * @param mode groovy, xsl, etc.
+	 * @param script the script path
+	 */
+	public Element addEditionDefinition(Element corpusElem, String name, String mode, String script) {
+		Element editionsElement = getEditionsElement(corpusElem);
+		Element editionElement = editionsElement.getOwnerDocument().createElement("edition");
+		editionElement.setAttribute(NAME, name);
+		editionElement.setAttribute("build_edition", ""+DEFAULT_DOEDITION);
+		editionElement.setAttribute("page_break_tag", ""+DEFAULT_PAGEELEMENT);
+		editionElement.setAttribute("words_per_page", ""+DEFAULT_WORDSPERPAGE);
+		editionElement.setAttribute("mode", mode);
+		editionElement.setAttribute("script", script);
+		editionElement.setAttribute("type", "html");
+		editionElement.setAttribute("index", ".");
+		editionsElement.appendChild(editionElement);
+
+		return editionElement;
+	}
+
+	public Element addPage(Element edition, String idx, String wordid)
+	{
+		Element page = edition.getOwnerDocument().createElement("page");
+		page.setAttribute("id", idx);
+		page.setAttribute("wordid", wordid);
+		edition.appendChild(page);
+		return page;
+	}
+
+	public void addPartition(Element corpusElem, String name, String[] queries,
+			String[] names) {
+		Element preBuildElement = this.getPreBuildElement(corpusElem);
+		Element partitionElem = preBuildElement.getOwnerDocument().createElement("partition");
+		partitionElem.setAttribute(NAME, name);
+		for (int i = 0 ; i < queries.length ; i++) {
+			Element partElem = preBuildElement.getOwnerDocument().createElement("part");
+			partElem.setAttribute(NAME, names[i]);
+			partElem.setAttribute(QUERY, queries[i]);
+			partitionElem.appendChild(partElem);
+		}
+		preBuildElement.appendChild(partitionElem);
+	}
+
+	public Element addPAttribute(Element corpusElem, String name, String shortname, String longname, String type, String renderer, String tooltip, String pattern, String importB, String mandatory, String inputFormat, String outputFormat)
+	{
+		NodeList pattributesList = corpusElem.getElementsByTagName("pattributes");
+		if(pattributesList.getLength() == 0)
+			return null;
+
+		Element pattributes = (Element) pattributesList.item(0);
+		Element pattribute = pattributes.getOwnerDocument().createElement("pattribute");
+		pattribute.setAttribute("id", name);
+		pattribute.setAttribute("shortname", shortname);
+		pattribute.setAttribute("longname", longname);
+		pattribute.setAttribute("type", type);
+		pattribute.setAttribute("renderer", renderer);
+		pattribute.setAttribute("tooltip", tooltip);
+		pattribute.setAttribute("pattern", pattern);
+		pattribute.setAttribute("import", importB);
+		pattribute.setAttribute("mandatory", mandatory);
+		pattribute.setAttribute("inputFormat", inputFormat);
+		pattribute.setAttribute("outputFormat", outputFormat);
+		pattributes.appendChild(pattribute);
+
+		return pattribute;
+	}
+
+	public Element addPreBuildCorpus(Element corpusElem, String name, String query, String exemple)
+	{
+		NodeList prebuildsList = corpusElem.getElementsByTagName("preBuild");
+		if(prebuildsList.getLength() == 0)
+			return null;
+
+		Element preBuild = (Element) prebuildsList.item(0);
+		Element subcorpus = preBuild.getOwnerDocument().createElement("subcorpus");
+		subcorpus.setAttribute(NAME, name);
+		subcorpus.setAttribute(QUERY, query);
+
+		preBuild.appendChild(subcorpus);
+		return subcorpus;
+	}
+
+	public Element addQuery(Element corpusElem, String name, String query, String desc)
+	{
+		NodeList queriesList = corpusElem.getElementsByTagName("queries");
+		if(queriesList.getLength() == 0)
+			return null;
+
+		Element queries = (Element) queriesList.item(0);
+		Element queryElem = queries.getOwnerDocument().createElement(QUERY);
+		queryElem.setAttribute(NAME, name);
+		queryElem.setAttribute(QUERY, query);
+		queryElem.setAttribute(DESC, desc);
+
+		queries.appendChild(queryElem);
+		return queryElem;
+	}
+
+	public Element addSAttribute(Element corpusElem, String name, String shortname, String longname, String type, String renderer, String tooltip, String pattern, String importB, String mandatory, String inputFormat, String outputFormat)
+	{
+		NodeList sattributesList = corpusElem.getElementsByTagName("sattributes");
+		if(sattributesList.getLength() == 0)
+			return null;
+
+		Element sattributes = (Element) sattributesList.item(0);
+		Element sattribute = sattributes.getOwnerDocument().createElement("sattribute");
+		sattribute.setAttribute("id", name);
+		sattribute.setAttribute("shortname", shortname);
+		sattribute.setAttribute("longname", longname);
+		sattribute.setAttribute("type", type);
+		sattribute.setAttribute("renderer", renderer);
+		sattribute.setAttribute("tooltip", tooltip);
+		sattribute.setAttribute("pattern", pattern);
+		sattribute.setAttribute("import", importB);
+		sattribute.setAttribute("mandatory", mandatory);
+		sattribute.setAttribute("inputFormat", inputFormat);
+		sattribute.setAttribute("outputFormat", outputFormat);
+		sattributes.appendChild(sattribute);
+
+		return sattribute;
+	}
+
+	public void addSubcorpus(Element corpusElem, String name, String query,
+			String desc) {
+		Element preBuildElement = this.getPreBuildElement(corpusElem);
+		Element subcorpusElem = preBuildElement.getOwnerDocument().createElement("subcorpus");
+		subcorpusElem.setAttribute(NAME, name);
+		subcorpusElem.setAttribute(QUERY, query);
+		subcorpusElem.setAttribute(DESC, desc);
+		preBuildElement.appendChild(subcorpusElem);
+	}
+
+	/**
+	 * 
+	 * @param corpusElem
+	 * @param name the text ID
+	 * @param sourceFile the XML-TXM file
+	 * @return
+	 */
+	public Element addText(Element corpusElem, String name, File sourceFile)
+	{
+		NodeList textsList = corpusElem.getElementsByTagName("texts");
+		Element texts = null;
+		if (textsList.getLength() == 0) {
+			texts = corpusElem.getOwnerDocument().createElement("texts");
+			corpusElem.appendChild(texts);
+		} else {
+			texts = (Element) textsList.item(0);
+		}
+
+		Element text = texts.getOwnerDocument().createElement("text");
+		text.setAttribute(NAME, name);
+		texts.appendChild(text);
+
+		Element source = texts.getOwnerDocument().createElement("source");
+		source.setAttribute("file", sourceFile.getAbsolutePath());
+		source.setAttribute("type", ".xml");
+		text.appendChild(source);
+		text.appendChild(texts.getOwnerDocument().createElement("editions"));
+
+		return text;
+	}
+
+	public Element getKnowledgeRepositoriesElement(Element corpusElement) {
+		NodeList textsList = corpusElement.getElementsByTagName("knowledgeRepositories");
+		if (textsList.getLength() == 0) {
+			Element knowledgeRepositories = corpusElement.getOwnerDocument().createElement("knowledgeRepositories");
+			corpusElement.appendChild(knowledgeRepositories);
+			return knowledgeRepositories;
+		} else {
+			return (Element) textsList.item(0);
+		}
+	}
+
+	public Element getKnowledgeRepositoryElement(String name) {
+		Element rElement = getKnowledgeRepositoriesElement(this.getCorpusElement());
+		NodeList repositoriesList = rElement.getElementsByTagName("repository");
+		for (int i = 0 ; i < repositoriesList.getLength() ; i++) {
+			Element e = ((Element)repositoriesList.item(i));
+			if (name.equals(e.getAttribute("name"))) {
+				return e;
+			}
+		}
+
+		return null;
+	}
+	
+	public Element createKnowledgeRepositoryElement(String name) {
+		Element rElement = getKnowledgeRepositoriesElement(this.getCorpusElement());
+		Element e = rElement.getOwnerDocument().createElement("repository");
+		e.setAttribute("name", name);
+		e.setAttribute("mode", "file");
+		e.setAttribute("user", "false");
+		e.setAttribute("password", "false");
+		e.setAttribute("version", "0");
+		
+		rElement.appendChild(e);
+		return e;
+	}
+
+	/**
+	 * Utility method to get a knowledge repository configuration
+	 * 
+	 * @param name the repository name
+	 * @return
+	 */
+	public List<String> getKnowledgeRepositoryNames() {
+		ArrayList<String> names = new ArrayList<String>();
+		Element corpusElement = getCorpusElement();
+		if (corpusElement == null) return names;
+		
+		Element rElement = getKnowledgeRepositoriesElement(corpusElement);
+		if (rElement == null) return names;
+		
+		NodeList repositoriesList = rElement.getElementsByTagName("repository");
+		for (int i = 0 ; i < repositoriesList.getLength() ; i++) {
+			names.add(((Element)repositoriesList.item(i)).getAttribute("name"));
+		}
+		return names;
+	}
+
+	public static String KNOWLEDGE_ACCESS = "access";
+	public static String KNOWLEDGE_TYPEQUERIES = "queries";
+	public static String KNOWLEDGE_TYPES = "fields";
+	public static String KNOWLEDGE_STRINGS = "strings";
+	public static String KNOWLEDGE_TYPEWEBACCESS = "typeaccess";
+	
+	/**
+	 * Utility method to get a knowledge repository configuration
+	 * 
+	 * @param name the repository name
+	 * @return
+	 */
+	public static HashMap<String, HashMap<String, ?>> getKnowledgeRepositoryConfiguration(String name, Element e) {
+		HashMap<String, HashMap<String, ?>> repConfiguration = new HashMap<String, HashMap<String, ?>>();
+
+		HashMap<String, String> access = new HashMap<String, String>();
+		HashMap<String, HashMap<String, String>> strings = new HashMap<String, HashMap<String, String>>();
+		HashMap<String, HashMap<String, String>> fields = new HashMap<String, HashMap<String, String>>();
+
+		if (e == null) return null;
+
+		access.put(SQLKnowledgeRepository.NAME, e.getAttribute(SQLKnowledgeRepository.NAME));
+		access.put("version", e.getAttribute("version"));
+		access.put("mode", e.getAttribute("mode"));
+		access.put(SQLKnowledgeRepository.TYPE_URL, e.getAttribute(SQLKnowledgeRepository.TYPE_URL));
+		access.put(SQLKnowledgeRepository.TYPE_RESURL, e.getAttribute(SQLKnowledgeRepository.TYPE_RESURL));
+		access.put(SQLKnowledgeRepository.TYPE_TYPEURL, e.getAttribute(SQLKnowledgeRepository.TYPE_TYPEURL));
+		access.put(SQLConnection.SQL_ADDRESS, e.getAttribute(SQLConnection.SQL_ADDRESS));
+		access.put(SQLConnection.SQL_DRIVER, e.getAttribute(SQLConnection.SQL_DRIVER));
+		access.put(SQLConnection.SQL_PORT, e.getAttribute(SQLConnection.SQL_PORT));
+		access.put(SQLConnection.SQL_USER, e.getAttribute(SQLConnection.SQL_USER));
+		access.put(SQLConnection.SQL_PASSWORD, e.getAttribute(SQLConnection.SQL_PASSWORD));
+
+		//<type id="" name> ... </type>
+		NodeList typesList = e.getElementsByTagName("type");
+		for (int i = 0 ; i < typesList.getLength() ; i++) {
+			//<field type="xxx">yyy</field>
+			Element typeElement = (Element)typesList.item(i);
+			String type_id = ""+typeElement.getAttribute(SQLKnowledgeRepository.TYPE_ID);
+			
+			String type_name = typeElement.getAttribute(SQLKnowledgeRepository.NAME);
+			if (type_name == null || type_name.length() == 0) type_name = type_id;
+			
+			String type_url = ""+typeElement.getAttribute(SQLKnowledgeRepository.TYPE_URL);
+			
+			String type_size = typeElement.getAttribute(SQLKnowledgeRepository.TYPE_SIZE);
+			if (type_size == null || type_size.length() == 0) type_size = "SMALL"; // show all by default 
+			type_size = type_size.toUpperCase();
+			
+			String type_effect = typeElement.getAttribute(SQLKnowledgeRepository.TYPE_EFFECT);
+			if (type_effect == null || type_effect.length() == 0) type_effect = "SEGMENT"; // segment annotation by default 
+			type_effect = type_effect.toUpperCase();
+
+			HashMap<String, String> hashFields = new HashMap<String, String>();
+			NodeList fieldsList = typeElement.getElementsByTagName("field"); // contains KR type specific properties
+			for (int j = 0 ; j < fieldsList.getLength() ; j++) {
+				Element fieldElement = (Element)fieldsList.item(j);
+				hashFields.put(fieldElement.getAttribute("type"), fieldElement.getTextContent());
+			}
+
+			hashFields.put(SQLKnowledgeRepository.TYPE_URL, type_url);
+			hashFields.put(SQLKnowledgeRepository.NAME, type_name);
+			hashFields.put(SQLKnowledgeRepository.TYPE_SIZE, type_size);
+			hashFields.put(SQLKnowledgeRepository.TYPE_EFFECT, type_effect);
+			fields.put(type_id, hashFields);
+		}
+		
+		NodeList stringsList = e.getElementsByTagName("strings");
+		for (int i = 0 ; i < stringsList.getLength() ; i++) {
+			Element stringsElement = (Element)stringsList.item(i);
+			String lang = stringsElement.getAttribute("lang");
+			if (lang == null) lang = "en"; // default lang is "en"
+			
+			HashMap<String, String> values = new HashMap<String, String>();
+			strings.put(lang, values);
+			
+			NodeList stringList = stringsElement.getElementsByTagName("string");
+			for (int j = 0 ; j < stringList.getLength() ; j++) {
+				Element stringElement = (Element)stringList.item(j);
+				String key = stringElement.getAttribute("key");
+				if (key != null) {
+					values.put(key, stringElement.getTextContent());
+				}
+			}
+		}
+
+		repConfiguration.put(KNOWLEDGE_ACCESS, access);
+		repConfiguration.put(KNOWLEDGE_TYPES, fields);
+		repConfiguration.put(KNOWLEDGE_STRINGS, strings);
+		
+		return repConfiguration;
+	}
+
+	public Element getTextsElement(Element corpusElement) {
+		NodeList textsList = corpusElement.getElementsByTagName("texts");
+		if(textsList.getLength() == 0) {
+			Element texts = corpusElement.getOwnerDocument().createElement("texts");
+			corpusElement.appendChild(texts);
+			return texts;
+		} else {
+			Element texts = (Element) textsList.item(0);
+			return texts;
+		}
+	}
+
+	public Element getParametersElement(Element corpusElement) {
+		NodeList parametersList = corpusElement.getElementsByTagName(PARAMETERS);
+		if (parametersList.getLength() == 0) {
+			Element parametersElement = corpusElement.getOwnerDocument().createElement(PARAMETERS);
+			corpusElement.appendChild(parametersElement);
+			return parametersElement;
+		} else {
+			Element parametersElement = (Element) parametersList.item(0);
+			return parametersElement;
+		}
+	}
+
+	public Element getTextElement(Element textsElement, String name) {
+		NodeList textsList = textsElement.getElementsByTagName("text");
+
+		for (int i = 0 ; i < textsList.getLength() ;i++) {
+			Element text = (Element) textsList.item(i);
+			if (name.equals(text.getAttribute("name"))) return text;
+		}
+		return null;
+
+	}
+
+	public Element getEditionElement(Element textElement, String name) {
+		NodeList editionsList = textElement.getElementsByTagName("edition");
+
+		for (int i = 0 ; i < editionsList.getLength() ;i++) {
+			Element editionElement = (Element) editionsList.item(i);
+			if (name.equals(editionElement.getAttribute("name"))) {
+				return editionElement;
+			}
+		}
+		//System.out.println("Warning no edition found with name="+name);
+		return null;
+
+	}
+
+	public void addTokenizerParameter(Element corpusElem, String name, String value) {
+		Element tokenizer = getTokenizerElement(corpusElem);
+		// check if param already exists
+		NodeList paramList = tokenizer.getElementsByTagName(PARAM);
+		for (int i = 0 ; i < paramList.getLength() ; i++) {
+			String pname = ((Element)paramList.item(i)).getAttribute(NAME);
+			if (name.equals(pname)) {
+				((Element)paramList.item(i)).setTextContent(value);
+				return;
+			}
+		}
+		Element param = tokenizer.getOwnerDocument().createElement(PARAM);
+		param.setAttribute(NAME, name);
+		param.setTextContent(value);
+		tokenizer.appendChild(param);
+	}
+
+	public void addTokenizerTest(Element corpusElem, String regex,
+			String type, String before, String hit, String after) {
+		Element tokenizer = getTokenizerElement(corpusElem);
+		Element test = tokenizer.getOwnerDocument().createElement("test");
+		test.setAttribute(TYPE, type);
+		test.setAttribute(VALUE, regex);
+		test.setAttribute("before", before);
+		test.setAttribute("hit", hit);
+		test.setAttribute("after", after);
+		tokenizer.appendChild(test);
+	}
+
+	public void addXsltParameter(Element corpusElem, String name, String value) {
+		Element xslt = getXsltElement(corpusElem);
+		Element param = xslt.getOwnerDocument().createElement(PARAM);
+		param.setAttribute(NAME, name);
+		param.setAttribute(VALUE, value);
+		xslt.appendChild(param);
+	}
+
+	public boolean getAvoidXMLSteps(Element corpusElem) {
+		String str = corpusElem.getAttribute(Corpus.AVOIDXMLSTEPS);
+		if (str == null || str.length() == 0) str = AVOIDXMLSTEPSDEFAULT;
+		return TRUE.equals(str);
+	}
+
+	public Element getBibliosElement(Element corpusElem) {
+		return getElement(corpusElem, "biblios");
+	}
+
+	public boolean getCleanTEMPDirectories(Element corpusElem) {
+		String str = corpusElem.getAttribute(Corpus.CLEANTEMPDIRS);
+		if (str == null || str.length() == 0) str = CLEANTEMPDIRSDEFAULT;
+		return TRUE.equals(str);
+	}
+
+	public Element getCorpusElement() {
+		return corpora.get(getCorpusName());
+	}
+
+	/**
+	 * 
+	 * @return the first found corpus name
+	 */
+	public String getCorpusName()
+	{
+		if (corpora != null) {
+			for (String c : corpora.keySet()) {
+				return c;
+			}
+		}
+		
+		System.out.println("Warning param.xml has no corpus defined: "+paramFile);
+		return null;
+	}
+
+	public Element getCQLLimitElement(Element uiElement) {
+		NodeList uiList = uiElement.getElementsByTagName("context_limits");
+		if (uiList.getLength() > 0) {
+			return (Element)(uiList.item(0));
+		} else {
+			Element context_limitsElement = uiElement.getOwnerDocument().createElement("context_limits");
+			context_limitsElement.setAttribute("type", "list");
+			context_limitsElement.setTextContent(DEFAULT_CQPLIMITS);
+			uiElement.appendChild(context_limitsElement);
+			return context_limitsElement;
+		}
+	}
+
+	public Element getWordElement() {
+		Element textualPlanEelement = getTextualPlans();
+		NodeList uiList = textualPlanEelement.getElementsByTagName("word");
+		if (uiList.getLength() > 0) {
+			return (Element)(uiList.item(0));
+		} else {
+			Element wordElement = textualPlanEelement.getOwnerDocument().createElement("word");
+			wordElement.setTextContent("w");
+			textualPlanEelement.appendChild(wordElement);
+			return wordElement;
+		}
+	}
+
+
+	public Element getMilestonesElement() {
+		Element textualPlanEelement = getTextualPlans();
+		NodeList uiList = textualPlanEelement.getElementsByTagName("milestones");
+		if (uiList.getLength() > 0) {
+			return (Element)(uiList.item(0));
+		} else {
+			Element wordElement = textualPlanEelement.getOwnerDocument().createElement("milestones");
+			wordElement.setTextContent("");
+			textualPlanEelement.appendChild(wordElement);
+			return wordElement;
+		}
+	}
+
+	public Element setWordElement(String tag) {
+		if (tag == null) return null;
+		tag = tag.trim();
+		if (tag.length() == 0) return null;
+
+		getWordElement().setTextContent(tag);
+		return getWordElement();
+	}
+
+	public Element getOutSideTextTagsElement() {
+		Element textualPlanEelement = getTextualPlans();
+		NodeList uiList = textualPlanEelement.getElementsByTagName("outsidetexttags");
+		if (uiList.getLength() > 0) {
+			return (Element)(uiList.item(0));
+		} else {
+			Element context_limitsElement = textualPlanEelement.getOwnerDocument().createElement("outsidetexttags");
+			context_limitsElement.setAttribute("type", "list");
+			context_limitsElement.setTextContent("");
+			textualPlanEelement.appendChild(context_limitsElement);
+			return context_limitsElement;
+		}
+	}
+	
+	public Element getOutSideTextTagsAndKeepContentElement() {
+		Element textualPlanEelement = getTextualPlans();
+		NodeList uiList = textualPlanEelement.getElementsByTagName("outside_text_tags_and_keep_content");
+		if (uiList.getLength() > 0) {
+			return (Element)(uiList.item(0));
+		} else {
+			Element element = textualPlanEelement.getOwnerDocument().createElement("outside_text_tags_and_keep_content");
+			element.setAttribute("type", "list");
+			element.setTextContent("");
+			textualPlanEelement.appendChild(element);
+			return element;
+		}
+	}
+	
+	public Element getNoteElement() {
+		Element textualPlanElement = getTextualPlans();
+		NodeList noteList = textualPlanElement.getElementsByTagName("note");
+		if (noteList.getLength() > 0) {
+			return (Element)(noteList.item(0));
+		} else {
+			Element element = textualPlanElement.getOwnerDocument().createElement("note");
+			element.setAttribute("type", "list");
+			element.setTextContent("");
+			textualPlanElement.appendChild(element);
+			return element;
+		}
+	}
+
+	public boolean getDoEdition(String edition) {
+		Element corpusElement = getCorpusElement();
+		if (corpusElement == null) return DEFAULT_DOEDITION;
+		Element editionsElement = getEditionsElement(corpusElement);
+		if (editionsElement == null) return DEFAULT_DOEDITION;
+		Element editionElement = getEditionDefinitionElement(editionsElement, edition);
+		if (editionElement == null) return DEFAULT_DOEDITION;
+
+		String value = editionElement.getAttribute("build_edition");
+		if (value == null | value.length() == 0) return DEFAULT_DOEDITION;
+
+		return TRUE.equals(value);
+	}
+
+	/** 
+	 *  
+	 * @param editionsElem
+	 * @param name
+	 * @return
+	 */
+	public Element getEditionDefinitionElement(Element editionsElem, String name) {
+		NodeList editionList = editionsElem.getElementsByTagName("edition");
+		for (int i = 0 ; i < editionList.getLength() ; i++) {
+			Element elem = (Element)editionList.item(i);
+			if (name.equals(elem.getAttribute("name")))
+				return elem;
+		}
+		//
+		//		Element editionElement = editionsElem.getOwnerDocument().createElement("edition");
+		//		editionElement.setAttribute("name", name);
+		//		editionElement.setAttribute("build_edition", ""+DEFAULT_DOEDITION);
+		//		editionElement.setAttribute("page_break_tag", ""+DEFAULT_PAGEELEMENT);
+		//		editionElement.setAttribute("words_per_page", ""+DEFAULT_WORDSPERPAGE);
+		//		editionElement.setAttribute("mode", "groovy");
+		//		editionElement.setAttribute("script", "pager.groovy");
+		//		editionElement.setAttribute("type", "html");
+		//		editionElement.setAttribute("index", ".");
+		return null;
+	}
+
+	/**
+	 * returns the corpus "editions" element and creates it if missing
+	 * 
+	 * @param corpusElem
+	 * @return the element that list the declared editions in a corpus
+	 */
+	public Element getEditionsElement(Element corpusElem) {
+		Element elem = getElement(corpusElem, "editions");
+		if (elem == null) {
+			elem = corpusElem.getOwnerDocument().createElement("editions");
+		}
+		if (!elem.hasAttribute(DEFAULT))
+			elem.setAttribute(DEFAULT, DEFAULT);
+		return elem;
+	}
+
+	/**
+	 * Utility to get the first 'name' element from a node 'elem'
+	 * 
+	 * @param elem
+	 * @param tag
+	 * @return
+	 */
+	public Element getElement(Element elem, String tag) {
+		NodeList editionsList = elem.getElementsByTagName(tag);
+		if (editionsList.getLength() > 0)
+			return (Element) editionsList.item(0);
+
+		Element editionsElem = elem.getOwnerDocument().createElement(tag);
+		elem.appendChild(editionsElem);
+		return editionsElem;
+	}
+
+	public ArrayList<String> getExcludeXpaths() {
+		Element filter = getFilterElement();
+		ArrayList<String> xpaths = new ArrayList<String>();
+		NodeList excludeList = filter.getElementsByTagName("exclude");
+		for (int i = 0 ; i < excludeList.getLength() ; i++) {
+			Element exclude = (Element) excludeList.item(i);
+			if ("xpath".equals(exclude.getAttribute("type")))
+				xpaths.add(exclude.getTextContent().trim());
+		}
+		return xpaths;
+	}
+
+	public Element getFilterElement() {
+		Element corpusElem = corpora.get(getCorpusName());
+		return getElement(corpusElem, "xmlfilter");
+	}
+
+	public String getLang(Element corpusElem) {
+		String str = corpusElem.getAttribute(LANG);
+		if (str == null) str = System.getProperty("user.locale");
+		return str;
+	}
+
+	public String getPageElement(String edition) {
+		Element corpusElement = getCorpusElement();
+		if (corpusElement == null) return DEFAULT_PAGEELEMENT;
+		Element editionsElement = getEditionsElement(corpusElement);
+		if (editionsElement == null) return DEFAULT_PAGEELEMENT;
+		Element editionElement = getEditionDefinitionElement(editionsElement, edition);
+		if (editionElement == null) return DEFAULT_PAGEELEMENT;
+
+		String value = editionElement.getAttribute("page_break_tag");
+		if (value == null || value.length() == 0) return DEFAULT_PAGEELEMENT;
+
+		return value;
+	}
+
+	public NodeList getPAttributes(Element corpusElem) {
+		NodeList pattributesList = corpusElem.getElementsByTagName("pattributes");
+		if(pattributesList.getLength() == 0)
+			return null;
+		return ((Element)pattributesList.item(0)).getElementsByTagName("pattribute");
+	}
+
+	public Element getPAttributesElement(Element corpusElem) {
+		return getElement(corpusElem, "pattributes");
+	}
+
+	public Element getPreBuildElement() {
+		Element corpusElem = corpora.get(getCorpusName());
+		return getElement(corpusElem, "preBuild");
+	}
+
+	public Element getPreBuildElement(Element corpusElem) {
+		return getElement(corpusElem, "preBuild");
+	}
+
+	public Element getQueriesElement(Element corpusElem) {
+		return getElement(corpusElem, "queries");
+	}
+
+	public Element getSAttributesElement(Element corpusElem) {
+		return getElement(corpusElem, "sattributes");
+	}
+
+	public Element getTokenizerElement(Element corpusElem) {
+		return getElement(corpusElem, "tokenizer");
+	}
+
+	public Element getUIElement(Element corpusElem, String command) {
+		Element uisElement = getUIsElement(corpusElem);
+		Element uiElement = null;
+		NodeList uiList = uisElement.getElementsByTagName("ui");
+		if (uiList.getLength() > 0) {
+			for (int i = 0 ; i < uiList.getLength() ; i++ ) {
+				Element ui = (Element)(uiList.item(i));
+				if (command.equals(ui.getAttribute("command"))) {
+					return ui;
+				}
+			}
+		} 
+		if (uiElement == null){
+			uiElement = uisElement.getOwnerDocument().createElement("ui");
+			uiElement.setAttribute("command", command);
+			uisElement.appendChild(uiElement);
+		}
+		return uiElement;
+	}
+
+	public Element getUIsElement(Element corpusElem) {
+		return getElement(corpusElem, "uis");
+	}
+
+	public int getWordsPerPage(String edition) {
+		Element corpusElement = getCorpusElement();
+		if (corpusElement == null) return DEFAULT_WORDSPERPAGE;
+		Element editionsElement = getEditionsElement(corpusElement);
+		if (editionsElement == null) return DEFAULT_WORDSPERPAGE;
+		Element editionElement = getEditionDefinitionElement(editionsElement, edition);
+		if (editionElement == null) return DEFAULT_WORDSPERPAGE;
+
+		String value = editionElement.getAttribute("words_per_page");
+		if (value == null) return DEFAULT_WORDSPERPAGE;
+
+		try {
+			return Integer.parseInt(value);
+		} catch (NumberFormatException e) {
+			Log.warning("words_per_page value is not an Integer value: "+value);
+			return DEFAULT_WORDSPERPAGE;
+		}
+	}
+
+	public Element getXsltElement(Element corpusElem) {
+		Element elem = getElement(corpusElem, "xslt");
+		if (!elem.hasAttribute("xsl"))
+			elem.setAttribute("xsl", "");
+		return elem;
+	}
+
+	public HashMap<String, String> getXsltParams(Element corpusElem) {
+		Element elem = getElement(corpusElem, "xslt");
+		if (!elem.hasAttribute("xsl"))
+			elem.setAttribute("xsl", "");
+		HashMap<String, String> hash = new HashMap<String, String>();
+		NodeList params = elem.getElementsByTagName("param");
+		for(int i = 0 ; i < params.getLength() ; i++) {
+			Element paramElem = (Element) params.item(i);
+			String name = paramElem.getAttribute("name");
+			String value = paramElem.getAttribute("value");
+			if (name != null && value != null && name.length() > 0) {
+				hash.put(name, value);
+			}
+		}
+		return hash;
+	}
+
+	public void loadKeyValueParameters(Element parametersElem) {
+		//HashMap<String, String> hash = new HashMap<String, String>();
+		NodeList params = parametersElem.getElementsByTagName("param");
+		for (int i = 0 ; i < params.getLength() ; i++) {
+			Element paramElem = (Element) params.item(i);
+			String name = paramElem.getAttribute(PARAMETERKEY);
+			String value = paramElem.getAttribute(PARAMETERVALUE);
+			if (name != null && value != null && name.length() > 0) {
+				keyValueParameters.put(name, value);
+			}
+		}
+	}
+	
+	public void saveKeyValueParameters(Element parametersElem) {
+		//HashMap<String, String> hash = new HashMap<String, String>();
+		
+		NodeList params = parametersElem.getElementsByTagName("param");
+		HashSet<String> existingNames = new HashSet<String>();
+		for (int i = 0 ; i < params.getLength() ; i++) {
+			Element paramElem = (Element) params.item(i);
+			String name = paramElem.getAttribute(PARAMETERKEY);
+			existingNames.add(name);
+			if (keyValueParameters.containsKey(name)) { // update existing element
+				String value = keyValueParameters.get(name).toString();
+				paramElem.setAttribute(PARAMETERVALUE, value);
+			} else { // the parameter has been removed -> delete element
+				parametersElem.removeChild(paramElem);
+			}
+		}
+		
+		for (String name : keyValueParameters.keySet()) {
+			if (!existingNames.contains(name)) { // create the element
+				Element paramElem = parametersElem.getOwnerDocument().createElement("param");
+				paramElem.setAttribute(PARAMETERKEY, name);
+				paramElem.setAttribute(PARAMETERVALUE, keyValueParameters.get(name).toString());
+				parametersElem.appendChild(paramElem);
+			}
+		}
+	}
+
+
+	public  HashMap<String, Object> getKeyValueParameters() {
+		return keyValueParameters;
+	}
+
+	/**
+	 * Load import infos.
+	 *
+	 * @param root the root
+	 * @return true, if successful
+	 */
+	@Override
+	public boolean load() {
+		if (root == null) return false;
+		// import general infos
+		try {
+			if (root.getAttribute(DATE).matches("....-..-..")) {
+				this.date = dateformat.parse(root.getAttribute(DATE));
+			} else { // try with DateFormat.getDateInstance(DateFormat.SHORT, Locale.UK)
+				this.date = shortUKDateformat.parse(root.getAttribute(DATE));
+				//System.out.println("Warning in "+paramFile+": date format '"+root.getAttribute(DATE)+"' does not match '....-..-..', date is set to "+this.date);
+			}
+		} catch (ParseException e) {
+			this.date = new Date(0);
+			System.out.println("Warning: can't parse date '"+root.getAttribute(DATE)+"' in file "+paramFile+": "+e);
+		}
+		this.version = root.getAttribute("version");
+		this.name = root.getAttribute(NAME).toUpperCase();
+		root.setAttribute(NAME, name);// force UPPERCASED NAME
+		this.author = root.getAttribute("author");
+		this.description = root.getAttribute(DESC);
+		this.rootDir = root.getAttribute("rootDir");
+		this.scriptFile = root.getAttribute("script");
+
+		// get Alignements
+		NodeList alignNodes = root.getElementsByTagName("linkGrp");
+		if (alignNodes.getLength() > 0) {
+			Element alignNode = (Element) alignNodes.item(0);
+			NodeList linkNodes = alignNode.getElementsByTagName(LINK);
+			for (int i = 0 ; i < linkNodes.getLength() ; i++) {
+				Element link = (Element)linkNodes.item(i);
+				String target = link.getAttribute(TARGET);
+				String[] split = target.split("#");
+				if (split.length != 3) {
+					System.out.println("Error: linkGrp/link/@target malformed: "+target);
+					continue;
+				}
+				String from = split[1].trim();
+				String to = split[2].trim();
+
+				links.put("#"+to+" #"+from, link);
+			}
+		}
+
+		// corpora
+		NodeList corporaNodes = root.getElementsByTagName("corpora");
+		if (corporaNodes.getLength() > 0) {
+			corporaElement = (Element) corporaNodes.item(0);
+			NodeList corpusNodes = corporaElement.getElementsByTagName(CORPUS);
+			for (int i = 0 ; i < corpusNodes.getLength() ; i++) {
+
+				Element corpusElement = (Element)corpusNodes.item(i);
+				String id = corpusElement.getAttribute(NAME);
+				corpora.put(id, corpusElement);
+
+				// replace the properties file of some import module
+				Element parametersElement = getParametersElement(corpusElement);
+				loadKeyValueParameters(parametersElement);
+			}
+		}
+
+		return true;
+	}
+
+	public boolean save() {
+		return save(this.paramFile);
+	}
+
+	public boolean save(File paramFile) {
+		try {
+			this.saveToElement(); // save informations
+			this.saveKeyValueParameters(getParametersElement(getCorpusElement())); // save additional parameters
+			return DomUtils.save(root.getOwnerDocument(), paramFile);
+		} catch (Exception e) {
+			System.out.println("Fail to save parameters in "+paramFile+". Reason: "+e);
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+		return false;
+	}
+
+	public void saveToElement() {
+		root.setAttribute(NAME, name);
+		root.setAttribute(DESC, description);
+		root.setAttribute("script", scriptFile);
+		root.setAttribute("rootDir", rootDir);
+	}
+
+	/* (non-Javadoc)
+	 * @see java.lang.Object#toString()
+	 */
+	@Override
+	public String toString() {
+		return "BaseParameters [name=" + name + ", date=" + date + ", author="
+				+ author + ", version=" + version + ", description="
+				+ description + ",\n links=" + links + ", corpora=" + corpora
+				+ ",\n root=" + root + ", corporaElement=" + corporaElement + ", keyValueParameters="+super.toString()+"]";
+	}
+
+	public String getCQPLimits() {
+		Element concordanceElement = this.getUIElement(getCorpusElement(), "concordance");
+		if (concordanceElement != null) {
+			Element context_limitsElement = this.getCQLLimitElement(concordanceElement);
+			if (context_limitsElement != null) {
+				String value = context_limitsElement.getTextContent();
+				if (value == null || value.length() == 0) return DEFAULT_CQPLIMITS;
+				return value;
+			}
+		}
+		return DEFAULT_CQPLIMITS;
+	}
+	public Element getTextualPlans() {
+		Element uiElement = this.getUIElement(this.getCorpusElement(), "textualplans");
+		if (uiElement == null) {
+			Element uisElement = getUIsElement(this.getCorpusElement());
+			uiElement = uisElement.getOwnerDocument().createElement("ui");
+			uiElement.setAttribute("command", "textualplans");
+			uisElement.appendChild(uiElement);
+		}
+		return uiElement;
+	}
+	/**
+	 * 
+	 * @param edition
+	 * @return the images directory to use to build a facs Edition
+	 */
+	public String getFacsEditionImageDirectory() {
+		Element corpusElement = getCorpusElement();
+		if (corpusElement == null) return "";
+		Element editionsElement = getEditionsElement(corpusElement);
+		if (editionsElement == null) return "";
+		Element editionElement = getEditionDefinitionElement(editionsElement, "facs"); //$NON-NLS-1$
+		if (editionElement == null) return "";
+
+		String value = editionElement.getAttribute("images_directory");
+		if (value == null || value.length() == 0) return "";
+
+		return value;
+	}
+	
+	public boolean getDoFacsEdition() {
+		Element corpusElement = getCorpusElement();
+		if (corpusElement == null) return false;
+		Element editionsElement = getEditionsElement(corpusElement);
+		if (editionsElement == null) return false;
+		Element editionElement = getEditionDefinitionElement(editionsElement, "facs"); //$NON-NLS-1$
+		if (editionElement == null) return false;
+
+		String value = editionElement.getAttribute("build_edition");
+		if (value == null | value.length() == 0) return DEFAULT_DOEDITION;
+
+		return TRUE.equals(value);
+	}
+	
+	public boolean getSkipTokenization() {
+		return "true".equals(getTokenizerElement(getCorpusElement()).getAttribute("skip"));
+	}
+	
+	public void setSkipTokenization(boolean skip) {
+		getTokenizerElement(getCorpusElement()).setAttribute("skip", Boolean.toString(skip));
+	}
+	
+	public void setDoAnnotation(boolean annotate) {
+		getCorpusElement().setAttribute("annotate", Boolean.toString(annotate)); //$NON-NLS-1$
+	}
+	
+	public void setAnnotationLang(String lang) {
+		getCorpusElement().setAttribute("lang", lang); //$NON-NLS-1$
+	}
+	
+	public void setTextualPlans(String outsideTextElementsToEdit, String noteElements, String outsideTextElements, String milestoneElements) {
+		Element textualplansElement = getTextualPlans();
+		if (textualplansElement != null) {
+			Element outsideTextElement = getOutSideTextTagsElement();
+			outsideTextElement.setAttribute("type", "list"); //$NON-NLS-1$ //$NON-NLS-2$
+			outsideTextElement.setTextContent(outsideTextElements);
+			
+			Element noteElement = getNoteElement();
+			noteElement.setAttribute("type", "list"); //$NON-NLS-1$ //$NON-NLS-2$
+			noteElement.setTextContent(noteElements);
+			
+			Element outSideTextTagsAndKeepContentElement = getOutSideTextTagsAndKeepContentElement();
+			outSideTextTagsAndKeepContentElement.setAttribute("type", "list"); //$NON-NLS-1$ //$NON-NLS-2$
+			outSideTextTagsAndKeepContentElement.setTextContent(outsideTextElementsToEdit);
+			
+			Element milestonesElement = getMilestonesElement();
+			milestonesElement.setTextContent(milestoneElements.trim());
+		} else {
+			System.out.println("Error: Textual plan parameters not saved.");
+		}
+	}
+	
+	public void setWordsPerPage(int n) {
+		Element editionsElement = this.getEditionsElement(this.getCorpusElement());
+		if (editionsElement != null) {
+			Element defaultEditionElement = this.getEditionDefinitionElement(editionsElement, "default"); //$NON-NLS-1$
+
+			if (defaultEditionElement != null) {
+				defaultEditionElement.setAttribute("words_per_page", Integer.toString(n)); //$NON-NLS-1$
+			} 
+		}
+	}
+	
+	public void setPageBreakElement(String pageBreak) {
+		Element editionsElement = this.getEditionsElement(this.getCorpusElement());
+		if (editionsElement != null) {
+			Element defaultEditionElement = this.getEditionDefinitionElement(editionsElement, "default"); //$NON-NLS-1$
+
+			if (defaultEditionElement != null) {
+				defaultEditionElement.setAttribute("page_break_tag", pageBreak); //$NON-NLS-1$
+			} 
+		}
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/objects/BaseParameters.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/objects/Workspace.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/objects/Workspace.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/objects/Workspace.java	(revision 258)
@@ -0,0 +1,364 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2017-01-24 18:11:42 +0100 (Tue, 24 Jan 2017) $
+// $LastChangedRevision: 3400 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.objects;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.searchengine.cqp.corpus.MainCorpus;
+import org.txm.utils.io.FileCopy;
+import org.txm.utils.logger.Log;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class Workspace.
+ */
+public class Workspace extends TxmObject {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = -8059395782871546280L;
+
+	/** The bases. */
+	HashMap<String, Base> bases = new HashMap<String, Base>();
+	
+	/** The projects. */
+	HashMap<String, Project> projects = new HashMap<String, Project>();
+
+	/** The xmlfile. */
+	File xmlfile;
+	
+	/** The doc. */
+	Document doc;
+	
+	/** The projs. */
+	Element projs;
+
+	/**
+	 * Creates the empty workspace.
+	 *
+	 * @param xmlfile the xmlfile
+	 * @return the workspace
+	 */
+	public static Workspace createEmptyWorkspace(File xmlfile) {
+		writeEmptyWorkspaceFile(xmlfile);
+		return new Workspace(xmlfile);
+	}
+	
+	/**
+	 * Write empty workspace file.
+	 *
+	 * @param xmlfile the xmlfile
+	 * @return true, if successful
+	 */
+	public static boolean writeEmptyWorkspaceFile(File xmlfile)
+	{
+		xmlfile.getParentFile().mkdir();
+		try {
+			OutputStreamWriter writer = new OutputStreamWriter(
+					new FileOutputStream(xmlfile), "UTF-8"); //$NON-NLS-1$
+			writer.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); //$NON-NLS-1$
+			writer.write("<workspace>\n"); //$NON-NLS-1$
+			writer.write("<projects>\n"); //$NON-NLS-1$
+			writer.write("<project name=\"default\">\n"); //$NON-NLS-1$
+			writer.write("<bases/>\n"); //$NON-NLS-1$
+			writer.write("</project>\n"); //$NON-NLS-1$
+			writer.write("</projects>\n"); //$NON-NLS-1$
+			writer.write("</workspace>\n"); //$NON-NLS-1$
+			writer.close();
+		} catch (IOException e) {
+			System.out.println(TXMCoreMessages.Workspace_6+xmlfile.getAbsolutePath());
+			Log.severe(TXMCoreMessages.Workspace_6+xmlfile.getAbsolutePath()+" : "+e.getMessage()); //$NON-NLS-1$
+			return false;
+		}
+		return true;
+	}
+
+	/**
+	 * Instantiates a new workspace.
+	 *
+	 * @param xmlproject the xmlproject
+	 */
+	public Workspace(File xmlproject) {
+		name = xmlproject.getName();
+		this.setPath(xmlproject.getAbsolutePath()); 
+		this.xmlfile = xmlproject;
+		load();
+	}
+
+	/**
+	 * Adds the project.
+	 *
+	 * @param name the name
+	 * @return the project
+	 */
+	public Project addProject(String name) {
+		if (projects.containsKey(name))
+			return projects.get(name);
+		Element projRoot = (Element) selfElement.getElementsByTagName("projects").item(0); //$NON-NLS-1$
+		Element projElem = doc.createElement("project"); //$NON-NLS-1$
+		projElem.setAttribute("name", name); //$NON-NLS-1$
+		projRoot.appendChild(projElem);
+
+		Element baseRoot = doc.createElement("bases"); //$NON-NLS-1$
+		projElem.appendChild(baseRoot);
+
+		Project project = new Project(this, projElem);
+		projects.put(name, project);
+
+		return project;
+	}
+
+	/**
+	 * Removes the project.
+	 *
+	 * @param name the name
+	 * @return the project
+	 */
+	public Project removeProject(String name) {
+		Project p = projects.get(name);
+		if (p != null) {
+			Element projRoot = (Element) selfElement.getElementsByTagName(
+					"projects").item(0); //$NON-NLS-1$
+			projRoot.removeChild(p.selfElement);
+			projects.remove("name"); //$NON-NLS-1$
+		}
+		return p;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#load()
+	 */
+	@Override
+	public boolean load() {
+		DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+		DocumentBuilder db;
+		try {
+			db = dbf.newDocumentBuilder();
+			doc = db.parse(xmlfile);
+			selfElement = doc.getDocumentElement();
+			this.name = selfElement.getAttribute("name"); //$NON-NLS-1$
+
+			// System.out.println("build projects");
+			// projs = (Element)
+			// selfElement.getElementsByTagName("projects").item(0);
+			NodeList projList = selfElement.getElementsByTagName("project"); //$NON-NLS-1$
+			for (int i = 0; i < projList.getLength(); i++) {
+				Element project = (Element) projList.item(i);
+				Project p = new Project(this, project);
+				projects.put(p.getName(), p);
+			}
+
+			loadMetadata();
+			return true;
+		} catch (Exception e) {
+			System.out.println(TXMCoreMessages.Workspace_2 + e);
+			System.out.println(TXMCoreMessages.Workspace_8);
+			File copyFile = new File(xmlfile.getParentFile(), "copy_of_"+xmlfile.getName());
+			try {
+				System.out.println("Writing a copy in "+copyFile);
+				FileCopy.copy(xmlfile, copyFile);
+			} catch (IOException e1) {
+				System.out.println("Failed to write a copy of "+xmlfile);
+				Log.printStackTrace(e1);
+			}
+			
+			if (writeEmptyWorkspaceFile(xmlfile))
+				return load();
+			return false;
+		}
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#save()
+	 */
+	@Override
+	public boolean save() {
+		try {
+			for(Project p : projects.values())
+				p.save();
+			// Création de la source DOM
+			Source source = new DOMSource(doc);
+
+			// Création du fichier de sortie
+			Writer writer = new BufferedWriter(new OutputStreamWriter(
+					new FileOutputStream(xmlfile), "UTF-8")); //$NON-NLS-1$
+			Result resultat = new StreamResult(writer);
+
+			// Configuration du transformer
+			TransformerFactory fabrique = new net.sf.saxon.TransformerFactoryImpl();
+			Transformer transformer = fabrique.newTransformer();
+			transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$
+			transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); //$NON-NLS-1$
+
+			// Transformation
+			transformer.transform(source, resultat);
+			writer.close();
+		} catch (Exception e) {
+			Log.severe("Error while saving workspace: "+e.getLocalizedMessage());
+			return false;
+		}
+		return true;
+	}
+
+	/**
+	 * Describe.
+	 */
+	public void describe() {
+		Workspace w = this;
+		for (Project p : w.projects.values()) {
+			System.out.println(TXMCoreMessages.Workspace_3 + p.getName());
+			for (Base b : p.bases.values()) {
+				System.out.println(TXMCoreMessages.Workspace_4 + b.getName());
+				for (MainCorpus c : b.corpora.values()) {
+					System.out.println(TXMCoreMessages.Workspace_10+c);
+				}
+			}
+		}
+	}
+
+	/**
+	 * Gets the projects.
+	 *
+	 * @return the projects
+	 */
+	public Collection<Project> getProjects() {
+		return projects.values();
+	}
+
+	/**
+	 * Gets the project.
+	 *
+	 * @param name the name
+	 * @return the project
+	 */
+	public Project getProject(String name) {
+		return projects.get(name);
+	}
+
+	/**
+	 * Gets the file.
+	 *
+	 * @return the file
+	 */
+	public File getFile() {
+		return xmlfile;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#getChildren()
+	 */
+	public List<TxmObject> getChildren() {
+		return new ArrayList<TxmObject>(getProjects());
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#removeChildren(org.txm.objects.TxmObject)
+	 */
+	public TxmObject removeChildren(TxmObject o) {
+		if (o == null)
+			return null;
+		if (o instanceof Project) {
+			Project proj = (Project) o;
+			selfElement.removeChild(proj.selfElement);
+			return projects.remove(((Project) o).getName());
+		}
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#hasChildren(org.txm.objects.TxmObject)
+	 */
+	public boolean hasChildren(TxmObject o) {
+		if (o == null)
+			return false;
+		if (o instanceof Project)
+			return projects.containsKey(((Project) o).getName());
+		return false;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#getParent()
+	 */
+	@Override
+	public TxmObject getParent() {
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#delete()
+	 */
+	@Override
+	public boolean delete() {
+		return false;
+	}
+
+	public static final String DEFAULT = "default";
+	public Project getDefaultProject() {
+		return getProject(DEFAULT);
+	}
+
+	@Override
+	public String getSimpleName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public String getDetails() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public void clean() {
+		// TODO Auto-generated method stub
+		
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/objects/Workspace.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/objects/CorpusParameters.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/objects/CorpusParameters.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/objects/CorpusParameters.java	(revision 258)
@@ -0,0 +1,279 @@
+package org.txm.objects;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import org.txm.metadatas.DateMetadata;
+import org.txm.metadatas.Metadata;
+import org.txm.metadatas.MetadataGroup;
+import org.txm.metadatas.MinMaxDateGroup;
+import org.txm.searchengine.cqp.corpus.Alignement;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+public class CorpusParameters implements IParameters {
+
+	/** The importmetadatas. */
+	public ArrayList<Metadata> importmetadatas = new ArrayList<Metadata>();
+	public ArrayList<MetadataGroup> groupedMetadatas = new ArrayList<MetadataGroup>();
+
+	/** The p attribute info names. */
+	private static String[] attributeInfoNames = {"id", "shortname", "longname", "type", "renderer", "tooltip", "pattern", "import", "mandatory"};
+	private HashMap<String, HashMap<String, String>> pAttributesInfos = new HashMap<String, HashMap<String,String>>();
+	private HashMap<String, HashMap<String, String>> sAttributesInfos = new HashMap<String, HashMap<String,String>>();
+
+	/** The encoding. */
+	private String encoding;
+
+	/** The lang. */
+	private String lang;
+
+	/** The xslt. */
+	private String xslt;
+
+	private String font="Arial";
+
+	private ArrayList<String> refProperties = new ArrayList<String>();
+	private ArrayList<String> sortProperties = new ArrayList<String>();
+	private ArrayList<String> viewProperties = new ArrayList<String>();
+
+	private HashMap<String, Alignement> links = new HashMap<String, Alignement>();
+
+	private String defaultEditionName = null;
+
+	private ArrayList<String> editionNames = new ArrayList<String>();
+	private Corpus corpus;
+	private String srcdir;
+	private String script;
+	private Element root;
+	
+	public CorpusParameters(Corpus c, Element elem)
+	{
+		this.corpus = c;
+		this.root = elem;
+	}
+	
+	/**
+	 * Load import infos.
+	 *
+	 * @param root the root
+	 * @return true, if successful
+	 */
+	@Override
+	public boolean load() {
+		// import general infos
+		this.encoding = root.getAttribute("encoding");
+		this.lang = root.getAttribute("lang");
+		this.srcdir = root.getAttribute("rootdir");
+		this.script = root.getAttribute("script");
+		this.xslt = root.getAttribute("xslt");
+		this.font = root.getAttribute("font");
+
+		//Metadata definitions
+		NodeList metadatasNodes = root.getElementsByTagName("metadatas");
+		importmetadatas.clear();
+		groupedMetadatas.clear();
+		if (metadatasNodes.getLength() > 0) {
+			Element metadatasNode = (Element) metadatasNodes.item(0);
+			NodeList metadataNodes = metadatasNode.getElementsByTagName("metadata");
+			for(int i = 0 ; i < metadataNodes.getLength() ; i++) {
+				Element meta = (Element)metadataNodes.item(i);
+				if(meta.getAttribute("type").equals("Date"))
+				{// System.out.println("date metadata");
+					importmetadatas.add(new DateMetadata(meta));
+				}
+				else
+					importmetadatas.add(new Metadata(meta));
+			}
+
+			NodeList groupNodes = metadatasNode.getElementsByTagName("group");
+			for(int i = 0 ; i < groupNodes.getLength() ; i++) {
+				Element group = (Element)groupNodes.item(i);
+				if(group.getAttribute("type").equals("MinMaxDate"))
+					groupedMetadatas.add(new MinMaxDateGroup(corpus, group));
+			}
+		}
+
+		//Pattributes definitions
+		NodeList pAttributesNodes = root.getElementsByTagName("pattributes");
+		pAttributesInfos.clear();
+		if (pAttributesNodes.getLength() > 0) // only one
+		{
+			Element pattributesNode = (Element) pAttributesNodes.item(0);
+			NodeList pattributeNodes = pattributesNode.getElementsByTagName("pattribute");
+			for(int i = 0 ; i < pattributeNodes.getLength() ; i++)
+			{
+				Element pattribute = (Element)pattributeNodes.item(i);
+				HashMap<String, String> values = new HashMap<String, String>();
+				pAttributesInfos.put(pattribute.getAttribute("id"), values);
+
+				for(String name : attributeInfoNames)
+				{
+					if(pattribute.getAttribute(name) != null)
+						values.put(name, pattribute.getAttribute(name));
+					else
+						values.put(name, "");
+				}
+			}
+		}
+
+		//Sattributes definitions
+		NodeList sAttributesNodes = root.getElementsByTagName("sattributes");
+		sAttributesInfos.clear();
+		if (sAttributesNodes.getLength() > 0) // only one
+		{
+			Element sattributesNode = (Element) sAttributesNodes.item(0);
+			NodeList sattributeNodes = sattributesNode.getElementsByTagName("sattribute");
+			for(int i = 0 ; i < sattributeNodes.getLength() ; i++)
+			{
+				Element sattribute = (Element)sattributeNodes.item(i);
+				HashMap<String, String> values = new HashMap<String, String>();
+				sAttributesInfos.put(sattribute.getAttribute("id"), values);
+
+				for(String name : attributeInfoNames)
+				{
+					if(sattribute.getAttribute(name) != null)
+						values.put(name, sattribute.getAttribute(name));
+					else
+						values.put(name, "");
+				}
+			}
+		}
+		//System.out.println("pAttributes Infos : "+pAttributesInfos);
+
+		//UI: sort, view and ref properties to show
+		NodeList uisNodes = root.getElementsByTagName("ui");
+
+		if (uisNodes.getLength() > 0) // only one
+		{
+			Element uiNode = (Element) uisNodes.item(0);
+
+			NodeList viewsNodes = uiNode.getElementsByTagName("view");
+			viewProperties.clear();
+			if (viewsNodes.getLength() > 0) // only one
+			{
+				Element viewNode = (Element) viewsNodes.item(0);
+				for(int i = 0 ; i < viewNode.getChildNodes().getLength() ; i++)
+				{
+					try{
+						Element element = (Element)viewNode.getChildNodes().item(i);
+						viewProperties.add(element.getAttribute("id"));
+					}catch(Exception e){} // quick and dirty
+				}
+			}
+
+			NodeList sortsNodes = uiNode.getElementsByTagName("sort");
+			sortProperties.clear();
+			if (sortsNodes.getLength() > 0) // only one
+			{
+				Element sortNode = (Element) sortsNodes.item(0);
+				for(int i = 0 ; i < sortNode.getChildNodes().getLength() ; i++)
+				{
+					try{
+						Element element = (Element)sortNode.getChildNodes().item(i);
+						sortProperties.add(element.getAttribute("id"));
+					}catch(Exception e){} // quick and dirty
+				}
+			}
+
+			NodeList refsNodes = uiNode.getElementsByTagName("ref");
+			refProperties.clear();
+			if (refsNodes.getLength() > 0) // only one
+			{
+				Element refNode = (Element) refsNodes.item(0);
+				for(int i = 0 ; i < refNode.getChildNodes().getLength() ; i++)
+				{
+					try{
+						Element element = (Element)refNode.getChildNodes().item(i);
+						refProperties.add(element.getAttribute("id"));
+					}catch(Exception e){} // quick and dirty
+				}
+			}
+		}
+
+		// get available editions
+		NodeList editionsNodes = root.getElementsByTagName("editions");
+		if (editionsNodes.getLength() > 0) // only one
+		{
+			Element editionNode = (Element) editionsNodes.item(0);
+			this.defaultEditionName = editionNode.getAttribute("default");
+			NodeList editionNodes = editionNode.getElementsByTagName("edition");
+			for(int i = 0 ; i < editionNodes.getLength() ; i++)
+			{
+				Element edition = (Element)editionNodes.item(i);
+				String name = edition.getAttribute("name");
+				String corpus = edition.getAttribute("corpus");
+//				String mode = edition.getAttribute("mode");
+//				String script = edition.getAttribute("script");
+				if(corpus == null || corpus.equals(name.toUpperCase()))
+					this.editionNames.add(name);
+			}
+			if(!editionNames.contains(this.defaultEditionName) && editionNames.size() > 0)
+				this.defaultEditionName = editionNames.get(0);
+		}
+		
+		// Text biblio
+		NodeList bibliosNodes = root.getElementsByTagName("biblios");
+		if (bibliosNodes.getLength() > 0) { // only one 
+			Element biblioNode = (Element) bibliosNodes.item(0);
+			NodeList metadataNodes = biblioNode.getElementsByTagName("biblio");
+			for (int i = 0 ; i < metadataNodes.getLength() ; i++) {
+				Element biblio = (Element)metadataNodes.item(i);
+				String id = biblio.getAttribute("id");
+				String url = biblio.getTextContent();
+				Text text = corpus.getText(id);
+				if (text != null)
+					text.setBiblio(url);
+			}
+		}
+
+		// get Alignements
+		NodeList alignNodes = root.getElementsByTagName("linkGrp");
+		if (alignNodes.getLength() > 0) {
+			Element alignNode = (Element) alignNodes.item(0);
+			NodeList linkNodes = alignNode.getElementsByTagName("link");
+			for(int i = 0 ; i < linkNodes.getLength() ; i++)
+			{
+				Element link = (Element)linkNodes.item(i);
+
+				String target = link.getAttribute("target");
+				String[] split = target.split("#");
+				if(split.length != 3)
+				{
+					System.out.println("Error: linkGrp/link/@target malformed: "+target);
+					continue;
+				}
+				String from = split[1].trim();
+				String to = split[2].trim();
+
+				Alignement align = new Alignement(from, to, 
+						link.getAttribute("alignElement"), Integer.parseInt(link.getAttribute("alignLevel")));
+				links.put("#"+from+" #"+to, align);
+				
+				align = new Alignement(to, from, 
+						link.getAttribute("alignElement"), Integer.parseInt(link.getAttribute("alignLevel")));
+				links.put("#"+to+" #"+from, align);
+
+			}
+		}
+
+		//default surcorpus and partition
+		NodeList corporaNodes = root.getElementsByTagName("corpora");
+		if (corporaNodes.getLength() > 0)
+		{
+			Element corporaNode = (Element) corporaNodes.item(0);
+			NodeList corpusNodes = corporaNode.getElementsByTagName("corpus");
+			for(int i = 0 ; i < corpusNodes.getLength() ; i++)
+			{
+				Element corpus = (Element)corpusNodes.item(i);
+				/*String id = biblio.getAttribute("id");
+				String url = biblio.getTextContent();
+				Text text = this.getText(id);
+				if (text != null)
+					text.setBiblio(url);*/
+			}
+		}	
+		return true;
+	}
+
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/objects/CorpusParameters.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/objects/TxmObject.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/objects/TxmObject.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/objects/TxmObject.java	(revision 258)
@@ -0,0 +1,279 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-08-29 14:23:55 +0200 (jeu., 29 août 2013) $
+// $LastChangedRevision: 2519 $
+// $LastChangedBy: nilskredens $ 
+//
+package org.txm.objects;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.core.results.ITXMResult;
+import org.txm.core.results.TXMResult;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+// TODO: Auto-generated Javadoc
+/**
+ * The Class TxmObject.
+ */
+public abstract class TxmObject extends TXMResult implements Serializable {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 3926941521306059565L;
+
+	/** The name. */
+	protected String name;
+	
+	/** The self element. */
+	protected Element selfElement;
+	
+	/** The metadatas. */
+	protected Map<String, Property> metadatas;
+	
+	/** The path. */
+	private String path;
+
+	
+	/**
+	 * Creates a new TxmObject with no parent.
+	 */
+	public TxmObject() {
+		this(null);
+	}
+
+	/**
+	 * Creates a new TxmObject, child of the specified parent.
+	 * @param parent
+	 */
+	public TxmObject(ITXMResult parent) {
+		super(parent);
+		metadatas = new HashMap<String, Property>();
+	}
+	
+	/**
+	 * Gets the name.
+	 *
+	 * @return the name
+	 */
+	public String getName() {
+		return name;
+	}
+
+	/**
+	 * Gets the metadatas.
+	 *
+	 * @return the metadatas
+	 */
+	public Map<String, Property> getMetadatas() {
+		return metadatas;
+	}
+
+//	/**
+//	 * Gets the children.
+//	 *
+//	 * @return the children
+//	 */
+//	public abstract List<? extends TxmObject> getChildren();
+//
+//	/**
+//	 * Removes the children.
+//	 *
+//	 * @param children the children
+//	 * @return the txm object
+//	 */
+//	public abstract TxmObject removeChildren(TxmObject children);
+
+//	/**
+//	 * Checks for children.
+//	 *
+//	 * @param children the children
+//	 * @return true, if successful
+//	 */
+//	public abstract boolean hasChildren(TxmObject children);
+
+//	/**
+//	 * Gets the parent.
+//	 *
+//	 * @return the parent
+//	 */
+//	public abstract TxmObject getParent();
+
+	/**
+	 * Load.
+	 *
+	 * @return true, if successful
+	 */
+	public abstract boolean load();
+
+	/**
+	 * Save.
+	 *
+	 * @return true, if successful
+	 */
+	public abstract boolean save();
+
+//	/**
+//	 * Delete.
+//	 *
+//	 * @return true, if successful
+//	 */
+//	public boolean delete() {
+//		if (this.getTXMObjectParent() != null) {
+//			if (this.getTXMObjectParent().removeChildren(this) != null) {
+//				return true;
+//			}
+//		} else
+//			System.out.println(Messages.TxmObject_1);
+//		return false;
+//	}
+
+	/**
+	 * Sets the path.
+	 *
+	 * @param path the new path
+	 */
+	public void setPath(String path) {
+		this.path = path;
+	}
+
+	/**
+	 * Gets the path.
+	 *
+	 * @return the path
+	 */
+	public String getPath() {
+		return path;
+	}
+
+	/**
+	 * Propagate attribute.
+	 *
+	 * @param key the key
+	 */
+	public void propagateAttribute(String key) {
+		Serializable value = getAttribute(key);
+		if (value == null)
+			return;
+
+		for (ITXMResult o : getResults())	{
+			TxmObject typeObject = (TxmObject) o;
+			
+			if (!typeObject.metadatas.containsKey(key))	{
+				typeObject.setAttribute(key, value);
+			}
+		}
+	}
+
+	/**
+	 * Sets the attribute.
+	 *
+	 * @param key the key
+	 * @param value the value
+	 */
+	public void setAttribute(String key, Serializable value) {
+		try
+		{
+		Document doc = selfElement.getOwnerDocument();
+		Element prop = doc.createElement("prop"); //$NON-NLS-1$
+		prop.setAttribute("key", key); //$NON-NLS-1$
+		prop.setAttribute("type", "String"); //$NON-NLS-1$ //$NON-NLS-2$
+		prop.setTextContent(value.toString());
+		selfElement.appendChild(prop);
+		selfElement.appendChild(prop);
+		metadatas.put(key, new Property(key, value, "String", prop)); //$NON-NLS-1$
+		}
+		catch(Exception e){
+			System.out.println(TXMCoreMessages.TxmObject_2+key+":"+value); //$NON-NLS-1$
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+	}
+
+	/**
+	 * Gets the attribute.
+	 *
+	 * @param key the key
+	 * @return the attribute
+	 */
+	public Serializable getAttribute(String key) {
+		if (metadatas.containsKey(key)) {
+			return metadatas.get(key).getValue();
+		} else if (this.getParent() != null) {
+			return ((TxmObject) this.getParent()).getAttribute(key);
+		} else {
+			return null;
+		}
+	}
+
+	/**
+	 * Removes the property.
+	 *
+	 * @param key the key
+	 * @return true, if successful
+	 */
+	public boolean removeProperty(String key) {
+		Property prop = this.metadatas.get(key);
+		if (prop != null) {
+			selfElement.removeChild(prop.selfElement);
+			this.metadatas.remove(key);
+			return true;
+		}
+		return false;
+	}
+
+	/**
+	 * Load metadata.
+	 */
+	protected void loadMetadata() {
+		NodeList props = selfElement.getChildNodes();
+		if (props == null)
+			return;
+		for (int i = 0; i < props.getLength(); i++) {
+			if ((props.item(i).getNodeType() == 1)
+					&& props.item(i).getNodeName().equals("prop")) //$NON-NLS-1$
+			{
+				Element self = (Element) props.item(i);
+				String key = self.getAttribute("key"); //$NON-NLS-1$
+				String value = self.getTextContent();
+				String type = self.getAttribute("type"); //$NON-NLS-1$
+
+				Property p = new Property(key, value, type, self);
+				this.metadatas.put(key, p);
+			}
+		}
+	}
+
+	/**
+	 * Gets the self element.
+	 *
+	 * @return the self element
+	 */
+	public Node getSelfElement() {
+		return selfElement;
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/objects/TxmObject.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/objects/Script.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/objects/Script.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/objects/Script.java	(revision 258)
@@ -0,0 +1,187 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.objects;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.txm.importer.scripting.GroovyImportScriptRunner;
+import org.w3c.dom.Element;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class Script.
+ */
+public class Script extends TxmObject {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 7859574866199450672L;
+
+	/** The scriptfile. */
+	File scriptfile;
+
+	/**
+	 * The Enum Type.
+	 */
+	public enum Type {
+		
+		/** The edition. */
+		edition, 
+ /** The compilation. */
+ compilation, 
+ /** The importer. */
+ importer, 
+ /** The normalisation. */
+ normalisation
+	}
+
+	/** The base. */
+	Base base;
+	
+	/** The type. */
+	String type;
+
+	/**
+	 * Instantiates a new script.
+	 *
+	 * @param b the b
+	 * @param script the script
+	 */
+	public Script(Base b, Element script) {
+		this.setPath(b.getPath() + getName());
+		selfElement = script;
+		base = b;
+		load();
+	}
+
+	/**
+	 * Gets the base.
+	 *
+	 * @return the base
+	 */
+	public Base getBase() {
+		return base;
+	}
+
+	/**
+	 * Run.
+	 *
+	 * @param args the args
+	 */
+	public void run(Object[] args) {
+		new GroovyImportScriptRunner(scriptfile, args);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#load()
+	 */
+	@Override
+	public boolean load() {
+		this.scriptfile = new File(selfElement.getAttribute("file")); //$NON-NLS-1$
+		this.name = scriptfile.getName();
+		this.type = selfElement.getAttribute("type"); //$NON-NLS-1$
+		loadMetadata();
+		return false;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#save()
+	 */
+	@Override
+	public boolean save() {
+
+		return false;
+	}
+
+	/**
+	 * Gets the file.
+	 *
+	 * @return the file
+	 */
+	public File getFile() {
+		return this.scriptfile;
+	}
+
+	/**
+	 * Gets the type.
+	 *
+	 * @return the type
+	 */
+	public String getType() {
+		return this.type;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#getChildren()
+	 */
+	public List<TxmObject> getChildren() {
+		List<TxmObject> rez = new ArrayList<TxmObject>();
+		return rez;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#removeChildren(org.txm.objects.TxmObject)
+	 */
+	public TxmObject removeChildren(TxmObject o) {
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#hasChildren(org.txm.objects.TxmObject)
+	 */
+	public boolean hasChildren(TxmObject o) {
+		return false;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#getParent()
+	 */
+	@Override
+	public TxmObject getParent() {
+		return getBase();
+	}
+
+	@Override
+	public String getSimpleName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public String getDetails() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public void clean() {
+		// TODO Auto-generated method stub
+		
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/objects/Script.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/objects/Project.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/objects/Project.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/objects/Project.java	(revision 258)
@@ -0,0 +1,462 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2015-12-17 12:11:39 +0100 (Thu, 17 Dec 2015) $
+// $LastChangedRevision: 3087 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.objects;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.List;
+
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.eclipse.osgi.util.NLS;
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.importer.cwb.PatchCwbRegistry;
+import org.txm.utils.logger.Log;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+/**
+ * The Class Project.
+ */
+public class Project extends TxmObject {
+
+	String CURRENTCORPUSVERSION = "0.6"; //$NON-NLS-1$
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 9158349064157589887L;
+
+	/** The bases. */
+	LinkedHashMap<String, Base> bases = new LinkedHashMap<String, Base>();
+
+	/** The workspace. */
+	Workspace workspace;
+
+	private static String NAME = "name"; //$NON-NLS-1$
+
+	/** The bases elem. */
+	Element basesElem;
+
+	/**
+	 * Instantiates a new project.
+	 *
+	 * @param workspace the workspace
+	 * @param project the project
+	 */
+	public Project(Workspace workspace, Element project) {
+		this.workspace = workspace;
+		selfElement = project;
+		load();
+		this.setPath(workspace.getPath() + getName());
+	}
+
+	/**
+	 * Gets the workspace.
+	 *
+	 * @return the workspace
+	 */
+	public Workspace getWorkspace() {
+		return this.workspace;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#load()
+	 */
+	@Override
+	public boolean load() {
+		loadMetadata();
+		name = selfElement.getAttribute(NAME); 
+		// System.out.println(" build project "+name);
+
+		ArrayList<String> loaded = new ArrayList<String>();
+		basesElem = (Element) selfElement.getElementsByTagName("bases").item(0); //$NON-NLS-1$
+		NodeList basesList = basesElem.getElementsByTagName("base"); //$NON-NLS-1$
+
+		LinkedHashMap<String, Date> baseParametersDate = new LinkedHashMap<String, Date>();
+		LinkedHashMap<String, BaseParameters> basesToLoad = new LinkedHashMap<String, BaseParameters>();
+		LinkedHashMap<BaseParameters, Element> elementReadToCreateBaseParameter = new LinkedHashMap<BaseParameters, Element>();
+		//		for (int i = 0; i < basesList.getLength(); i++) {
+		//			Element baseElement = (Element) basesList.item(i);
+		//			String name = baseElement.getAttribute(NAME).toUpperCase();
+		//			
+		//			if (baseElementsToLoad.containsKey(name)) {
+		//				Element baseWithSameName = baseElementsToLoad.get(name);
+		//				//if (baseElement.getAttribute("date").compareTo(baseWithSameName.getAttribute("date")) > 0) { // baseWithSameName older than baseElement 
+		//				//baseElementsToLoad.put(name, baseElement);
+		//				System.out.println("Corpus directory name conflict detected using corpus with configuration file "+baseWithSameName.getAttribute("file"));
+		//				//}
+		//			} else {
+		//				baseElementsToLoad.put(name, baseElement);
+		//			}
+		//		}
+		HashSet<String> paramsFilesSeen = new HashSet<String>(); // manage case of corpus with the same parameter file  set in the "file" attribute in the workspace default.xml file
+		for (int i = 0; i < basesList.getLength(); i++) {
+			//for (String k : baseElementsToLoad.keySet()) {
+			try {
+				Element baseElement = (Element) basesList.item(i);
+				String name = baseElement.getAttribute(NAME).toUpperCase(); // force all binary corpus id to beUppercased
+				baseElement.setAttribute(NAME, name); // fix name 
+				File PARAMS = new File(baseElement.getAttribute("file")); // the base declaration is standoff //$NON-NLS-1$
+				if (paramsFilesSeen.contains(baseElement.getAttribute("file"))) {
+					System.out.println("Warning: duplicate corpus declaration in workspace file: "+PARAMS+". Ignoring corpus declaration.");
+					continue; // process next element
+				} else {
+					paramsFilesSeen.add(baseElement.getAttribute("file"));
+				}
+				
+				if (name == null || name.length() == 0) { // check name attribute
+					System.out.println(TXMCoreMessages.bind(TXMCoreMessages.Project_2, PARAMS));
+					if (PARAMS.exists() && PARAMS.canRead()) { // try fixing the name
+						System.out.println(TXMCoreMessages.Project_0);
+						name = PARAMS.getParentFile().getName().toUpperCase();
+						baseElement.setAttribute(NAME, name);
+					} else { // no luck :)
+						System.out.println(TXMCoreMessages.Project_1+PARAMS);
+						basesElem.removeChild(baseElement);
+					}
+				} 
+
+//TODO: errrkk why?
+//				int iname = 2;
+//				String originalName = name;
+//				while (loaded.contains(name) && iname < 10) { // building new name if duplicated
+//					name = originalName + (iname++);
+//				} 
+//				if (iname > 2) { // name was fixed
+//					System.out.println(Messages.bind(Messages.Project_3,name));
+//					if (iname > 10) { // too much duplicates
+//						System.out.println(Messages.Project_4+name);
+//						basesElem.removeChild(base);
+//					} else {
+//						base.setAttribute(NAME, name);
+//						System.out.println(Messages.Project_16+originalName+" "+name); //$NON-NLS-2$
+//					}
+//				}
+
+				if (PARAMS.exists() && PARAMS.canRead()) {
+
+					BaseParameters parameters = new BaseParameters(PARAMS);
+					if (parameters.load()) {
+						String upperCasedName = parameters.name.toUpperCase();
+						elementReadToCreateBaseParameter.put(parameters, baseElement);
+						//check base name conflict before adding the base
+						if (baseParametersDate.containsKey(upperCasedName)) {
+							Date dateStored = baseParametersDate.get(upperCasedName);
+							if (parameters.date.compareTo(dateStored) > 0) { // this base is more recent
+								System.out.println("Warning: removing corpus '"+basesToLoad.get(upperCasedName).name+"' described by "+basesToLoad.get(upperCasedName).paramFile+" seems to be a duplicated of corpus '"+parameters.name+"' described by "+ parameters.paramFile);
+								baseParametersDate.put(upperCasedName, parameters.date);
+								basesToLoad.put(upperCasedName, parameters);
+								
+								//remove the duplicated element
+								Element duplicate = elementReadToCreateBaseParameter.get(basesToLoad.get(upperCasedName));
+								if (duplicate != null) {
+									duplicate.getParentNode().removeChild(duplicate);
+								}
+							} else { // don't add the base since its date is older
+								System.out.println("Warning: removing corpus '"+parameters.name+"' described by "+parameters.paramFile+" seems to be a duplicated of corpus '"+basesToLoad.get(upperCasedName).name+"' described by "+ basesToLoad.get(upperCasedName).paramFile);
+								baseElement.getParentNode().removeChild(baseElement);
+							}
+						} else { // no prob, continue
+							baseParametersDate.put(upperCasedName, parameters.date);
+							basesToLoad.put(upperCasedName, parameters);
+						}
+					} else {
+						System.out.println(TXMCoreMessages.Project_6+PARAMS);
+					}
+				} else {
+					System.out.println(NLS.bind(TXMCoreMessages.Project_8, PARAMS));
+					baseElement.getParentNode().removeChild(baseElement);
+				}
+			} catch (Exception e1) {
+				System.out.println(TXMCoreMessages.Project_10+e1);
+			}
+		}
+		for (String k : basesToLoad.keySet()) {
+			BaseParameters parameters = basesToLoad.get(k);
+			File PARAMS = parameters.paramFile;
+
+			try {
+				
+				Base b = new Base(this, parameters);
+				b.load();
+				bases.put(b.getName(), b);
+			} catch (Exception e) {
+				System.out.println(TXMCoreMessages.Project_7+PARAMS);
+				org.txm.utils.logger.Log.printStackTrace(e);
+			}
+		}
+
+
+		return save();
+	}
+
+	/**
+	 * Gets the base.
+	 *
+	 * @param id the id
+	 * @return the base
+	 */
+	public Base getBase(String id) {
+		return this.bases.get(id);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#save()
+	 */
+	@Override
+	public boolean save() {
+		for (Base b : bases.values())
+			b.save();
+		return true;
+	}
+
+	/**
+	 * Scan directory: 
+	 * 1- check the binary corpus format
+	 * 2- register in the workspace
+	 *
+	 * @param binCorpusDir the base
+	 * @return the base
+	 * @throws IOException 
+	 * @throws SAXException 
+	 * @throws ParserConfigurationException 
+	 */
+	public Base scanDirectory(File binCorpusDir) throws ParserConfigurationException, SAXException, IOException {
+
+		//System.out.println(Messages.Project_5);
+		File HTMLs = new File(binCorpusDir, "HTML"); //$NON-NLS-1$
+		//File TXMs = new File(binCorpusDir, "txm"); //$NON-NLS-1$
+		File DATAs = new File(binCorpusDir, "data"); //$NON-NLS-1$
+		File REGISTRY = new File(binCorpusDir, "registry"); //$NON-NLS-1$
+		File PARAMS = new File(binCorpusDir, "import.xml"); //$NON-NLS-1$
+
+		if (HTMLs.exists() && DATAs.exists()
+				&& REGISTRY.exists() && PARAMS.exists())// && correspfile.exists())
+		{// minimal base data
+			BaseParameters parameters = new BaseParameters(PARAMS);
+			if (!parameters.load()) {
+				System.out.println(TXMCoreMessages.Project_11+PARAMS);
+				Log.severe(TXMCoreMessages.Project_11+PARAMS);
+				return null;
+			}
+
+			if (parameters.version == null || parameters.version.length() == 0) {
+				System.out.println(TXMCoreMessages.Project_14);
+				return null;
+			} else if (CURRENTCORPUSVERSION.compareTo(parameters.version) > 0) {
+				System.out.println(TXMCoreMessages.Project_15);
+				System.out.println(CURRENTCORPUSVERSION+" > "+parameters.version); //$NON-NLS-1$
+				return null;
+			}
+
+			if (this.bases.keySet().contains(parameters.name)) {
+				// remove element 
+				// remove base
+				this.removeBase(parameters.name);
+			}
+
+			//System.out.println(parameters.toString());
+			Base b = this.addBase(parameters, PARAMS);
+
+			//System.out.println("CREATE CORPORA? "+b.corpora.values());
+			for (Element c : parameters.corpora.values()) {
+				String corpusname = c.getAttribute(NAME);
+				//File TXMc = new File(TXMs, corpusname);
+				File HTMLc = new File(HTMLs, corpusname);
+				File REGISTRYc = new File(REGISTRY, corpusname.toLowerCase());
+				File DATAc = new File(DATAs, corpusname);
+
+				if (!(PARAMS.exists() && HTMLc.exists() && REGISTRYc.exists() && DATAc.exists())) {
+					System.out.println(TXMCoreMessages.Project_17+corpusname);
+					System.out.println(TXMCoreMessages.Project_18+PARAMS);
+					System.out.println("HTMLc: "+HTMLc+" : "+HTMLc.exists()); //$NON-NLS-1$ //$NON-NLS-2$
+					System.out.println("REGISTRYc: "+REGISTRYc+" : "+REGISTRYc.exists()); //$NON-NLS-1$ //$NON-NLS-2$
+					System.out.println("DATAc: "+DATAc+" : "+DATAc.exists()); //$NON-NLS-1$ //$NON-NLS-2$
+					continue;
+				}
+
+//				// patch registry // no more needed, CQP registry path is now a list of registry paths
+//				File txmregistry = new File(Toolbox.getParam(Toolbox.CQI_SERVER_PATH_TO_REGISTRY));
+//				if (!txmregistry.exists()) {
+//					System.out.println(Messages.Project_25+txmregistry);
+//					Log.severe(Messages.Project_25+txmregistry);
+//					return null;
+//				}
+				// the registry path need to be patched, because CQP does NOT manage relative paths (or we don't know how to manage it :))
+				System.out.println("Updating "+REGISTRYc+" with "+DATAc);
+				PatchCwbRegistry.patch(REGISTRYc, DATAc);
+			}
+
+			return b;
+		} else {
+			System.out.println(TXMCoreMessages.bind(TXMCoreMessages.Project_26, binCorpusDir));
+			System.out.println(TXMCoreMessages.Project_28+HTMLs+", "+DATAs+", "+REGISTRY+TXMCoreMessages.Project_31+PARAMS); //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-1$
+		}
+		return null;
+	}
+
+	/**
+	 * Adds the base.
+	 *
+	 * @param name the name
+	 * @param files the files
+	 * @return the base
+	 */
+	public Base addBase(BaseParameters params, File paramFile) {
+		// System.out.println("ADD BASE: "+params.name);
+		name = params.name;
+		this.removeBase(name);
+
+		// register the base in the workspace
+		Document doc = selfElement.getOwnerDocument();
+		Element baseRoot = (Element) selfElement.getElementsByTagName("bases").item(0); //$NON-NLS-1$
+		NodeList basesElem = baseRoot.getElementsByTagName("base"); //$NON-NLS-1$
+		for (int i = 0 ; i < basesElem.getLength() ;i++) {
+			Element baseE = (Element) basesElem.item(i);
+			if (name != null && name.equals(baseE.getAttribute(NAME))) {
+				baseRoot.removeChild(baseE);
+				i--;
+			}
+		}
+
+		Element baseElem = doc.createElement("base"); //$NON-NLS-1$
+		baseRoot.appendChild(baseElem);
+		baseElem.setAttribute(NAME, name); 
+		baseElem.setAttribute("file", paramFile.getAbsolutePath()); //$NON-NLS-1$
+
+		// create the base using params.root
+		Base b = new Base(this, params);
+		bases.put(name, b);
+		return b;
+	}
+
+	/**
+	 * Removes the base.
+	 *
+	 * @param name the name
+	 * @return the base
+	 */
+	public Base removeBase(String name) {
+		name = name.toUpperCase(); // force Name to be UPPERCASED
+		Base b = bases.remove(name);
+		if (b != null) {
+			Element baseRoot = (Element) selfElement.getElementsByTagName("bases").item(0); //$NON-NLS-1$
+			NodeList baseElems = baseRoot.getElementsByTagName("base"); //$NON-NLS-1$
+			for (int i = 0 ; i < baseElems.getLength() ; i++) {
+				Element baseElem = (Element) baseElems.item(i);
+				if (name.equals(baseElem.getAttribute(NAME))) {
+					baseRoot.removeChild(baseElem);
+					return bases.remove(name);
+				}
+			}
+		}
+		return b;
+	}
+
+	/**
+	 * Gets the bases.
+	 *
+	 * @return the bases
+	 */
+	public Collection<Base> getBases() {
+		return bases.values();
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#getChildren()
+	 */
+	public List<TxmObject> getChildren() {
+		List<TxmObject> rez = new ArrayList<TxmObject>();
+		rez.addAll(this.getBases());
+		return rez;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#removeChildren(org.txm.objects.TxmObject)
+	 */
+	public TxmObject removeChildren(TxmObject o) {
+		if (o == null)
+			return null;
+		if (o instanceof Base) {
+			removeBase(((Base)o).getName());
+		}
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#hasChildren(org.txm.objects.TxmObject)
+	 */
+	public boolean hasChildren(TxmObject o) {
+		if (o == null)
+			return false;
+		if (o instanceof Base)
+			return bases.containsKey(((Base) o).getName());
+		return false;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#getParent()
+	 */
+	@Override
+	public TxmObject getParent() {
+		return getWorkspace();
+	}
+
+	/**
+	 * Gets the base names.
+	 *
+	 * @return the base names
+	 */
+	public List<String> getBaseNames() {
+		return new ArrayList<String>(this.bases.keySet());
+	}
+
+	@Override
+	public String getSimpleName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public String getDetails() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public void clean() {
+		// TODO Auto-generated method stub
+		
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/objects/Project.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/objects/Partition.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/objects/Partition.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/objects/Partition.java	(revision 258)
@@ -0,0 +1,111 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.objects;
+
+import java.util.List;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class Partition.
+ */
+public class Partition extends TxmObject {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 1921103951325044667L;
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#getChildren()
+	 */
+	public List<TxmObject> getChildren() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#hasChildren(org.txm.objects.TxmObject)
+	 */
+	public boolean hasChildren(TxmObject children) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#load()
+	 */
+	@Override
+	public boolean load() {
+		// TODO Auto-generated method stub
+		loadMetadata();
+		return false;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#removeChildren(org.txm.objects.TxmObject)
+	 */
+	public TxmObject removeChildren(TxmObject children) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#save()
+	 */
+	@Override
+	public boolean save() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#getParent()
+	 */
+	@Override
+	public TxmObject getParent() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public String getSimpleName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public String getDetails() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public void clean() {
+		// TODO Auto-generated method stub
+		
+	}
+
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/objects/Partition.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/objects/Base.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/objects/Base.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/objects/Base.java	(revision 258)
@@ -0,0 +1,394 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2017-01-24 18:11:42 +0100 (Tue, 24 Jan 2017) $
+// $LastChangedRevision: 3400 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.objects;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.txm.Toolbox;
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.functions.ProgressWatcher;
+import org.txm.searchengine.cqp.corpus.Alignement;
+import org.txm.searchengine.cqp.corpus.CorpusManager;
+import org.txm.searchengine.cqp.corpus.MainCorpus;
+import org.txm.utils.logger.Log;
+import org.txm.utils.zip.Zip;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class Base.
+ */
+public class Base extends TxmObject {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = -4798832481060407512L;
+
+	/** The project. */
+	Project project;
+	BaseParameters params;
+
+	protected HashMap<String, MainCorpus> corpora = new HashMap<String, MainCorpus>();
+
+	private HashMap<String, Alignement> links = new HashMap<String, Alignement>();
+
+	/**
+	 * Instantiates a new base.
+	 *
+	 * @param project the project
+	 * @param parameters the b
+	 */
+	public Base(Project project, BaseParameters parameters) {
+		this.setPath(project.getPath() + getName());
+		params = parameters;
+		selfElement = params.root;
+		this.project = project;
+		//load();
+		this.name = params.name;
+		if (!name.equals(name.toUpperCase())) {
+			System.out.println("Warning in Base.init: binary corpus name contains lower case letters: "+this.name);
+		}
+	}
+
+	/**
+	 * Gets the project.
+	 *
+	 * @return the project
+	 */
+	public Project getProject() {
+		return this.project;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#save()
+	 */
+	@Override
+	public boolean save() {
+		//System.out.println("SAVE BASE: "+params.root+" "+params.paramFile);
+		try {
+			// Création de la source DOM
+			Source source = new DOMSource(params.root);
+
+			// Création du fichier de sortie
+			Writer writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(params.paramFile), "UTF-8")); //$NON-NLS-1$
+			Result resultat = new StreamResult(writer);
+
+			// Configuration du transformer
+			TransformerFactory fabrique = new net.sf.saxon.TransformerFactoryImpl();
+			Transformer transformer = fabrique.newTransformer();
+			transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$
+			transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); //$NON-NLS-1$
+			
+			// Transformation
+			transformer.transform(source, resultat);
+			writer.close();
+		} catch (Exception e) {
+			e.printStackTrace();
+			Log.severe("Error while saving corpus parameters: "+e.getLocalizedMessage());
+			return false;
+		}
+		return true;
+	}
+
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#load()
+	 */
+	@Override
+	public boolean load() {
+
+		loadMetadata(); // read the prop tags
+
+		// get Alignements
+		//System.out.println("Load alignement from params: "+params.links);
+		for (String alignname : params.links.keySet()) {
+			Element link = params.links.get(alignname);
+
+			String target = link.getAttribute("target"); //$NON-NLS-1$
+			String[] split = target.split("#"); //$NON-NLS-1$
+			if (split.length != 3) {
+				System.out.println(TXMCoreMessages.Base_6+target);
+				continue;
+			}
+			String from = split[1].trim();
+			String to = split[2].trim();
+
+			Alignement align = new Alignement(from, to, 
+					link.getAttribute("alignElement"), Integer.parseInt(link.getAttribute("alignLevel"))); //$NON-NLS-1$ //$NON-NLS-2$
+			links.put("#"+from+" #"+to, align); //$NON-NLS-1$ //$NON-NLS-2$
+
+			align = new Alignement(to, from, 
+					link.getAttribute("alignElement"), Integer.parseInt(link.getAttribute("alignLevel"))); //$NON-NLS-1$ //$NON-NLS-2$
+			links.put("#"+to+" #"+from, align); //$NON-NLS-1$ //$NON-NLS-2$
+		}
+
+		return true;
+	}
+
+	public boolean loadCQPCorpora() {
+		//System.out.println("Load corpus from params: "+params.corpora);
+		for (String corpusname : params.corpora.keySet()) {
+			Element c = params.corpora.get(corpusname);
+			try {
+				MainCorpus corp = CorpusManager.getCorpusManager().getCorpus(corpusname);
+				corp.selfElement = c;
+				corp.setParent(this);
+				corp.load(); // don't load corpus right now, wait for the search engine to be ready
+				corpora.put(corp.getName(), corp);
+				if (!corp.getMetadatas().containsKey("lang")) { //$NON-NLS-1$
+					corp.setAttribute("lang", c.getAttribute("lang")); //$NON-NLS-1$ //$NON-NLS-2$
+				}
+			} catch (Exception e) {
+				System.out.println(e.getLocalizedMessage());
+				org.txm.utils.logger.Log.printStackTrace(e);
+				return false;
+			}
+		}
+		return true;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#getChildren()
+	 */
+	public List<TxmObject> getChildren() {
+		List<TxmObject> rez = new ArrayList<TxmObject>();
+		rez.addAll(corpora.values());
+		return rez;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#removeChildren(org.txm.objects.TxmObject)
+	 */
+	public TxmObject removeChildren(TxmObject o) {
+		if (o == null)
+			return null;
+		if (o instanceof MainCorpus) {
+			params.corporaElement.removeChild(o.selfElement);
+			params.corpora.remove(o.getName());
+			//corpus.deleteFromCWB() already called
+			Toolbox.workspace.save();
+			return o;
+		}
+
+		return null;
+	}
+
+	/**
+	 * Removes the script.
+	 *
+	 * @param name the name
+	 * @return the script
+	 */
+	public MainCorpus removeCorpus(String name) {
+		MainCorpus corpus = corpora.get(name);
+		if (corpus != null) {
+			params.corporaElement.removeChild(corpus.selfElement);
+			params.corpora.remove(name);
+		}
+		return corpus;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#hasChildren(org.txm.objects.TxmObject)
+	 */
+	public boolean hasChildren(TxmObject o) {
+		if (o == null)
+			return false;
+		if (o instanceof MainCorpus)
+			return params.corpora.values().contains(o);
+		return false;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#getParent()
+	 */
+	@Override
+	public TxmObject getParent() {
+		return getProject();
+	}
+
+	/**
+	 * Register maincorpus.
+	 *
+	 * @param corpusName the corpus name
+	 */
+	public Element registerMaincorpus(String corpusName) {
+		Document doc = selfElement.getOwnerDocument();
+		Element maincorpus = doc.createElement("corpus"); //$NON-NLS-1$
+		maincorpus.setAttribute("name", corpusName); //$NON-NLS-1$
+		if (selfElement.getElementsByTagName("corpora").getLength() == 0) { //$NON-NLS-1$
+			Log.severe(TXMCoreMessages.Base_22);
+			return null;
+		}
+		Element corporaElem = (Element) selfElement.getElementsByTagName("corpora").item(0); //$NON-NLS-1$
+		corporaElem.appendChild(maincorpus); // append maincorpus
+		return maincorpus;
+	}
+
+	/**
+	 * Gets the corpus.
+	 *
+	 * @param name the name
+	 * @return the corpus
+	 */
+	public MainCorpus getCorpus(String name) {
+		return corpora.get(name);
+	}
+
+	/**
+	 * Gets the corpora.
+	 *
+	 * @return the corpora
+	 */
+	public HashMap<String, MainCorpus> getCorpora() {
+		return corpora;
+	}
+
+	public boolean export(File exportzip) {
+		return export(exportzip, null);
+	}
+	
+	/**
+	 * Export.
+	 *
+	 * @param exportzip the exportzip
+	 * @return true, if successful
+	 */
+	public boolean export(File exportzip, ProgressWatcher monitor) {
+		File binarydir = this.params.paramFile.getParentFile();
+
+		if (binarydir.exists() && exportzip.getParentFile().exists()) {
+			try {
+				Zip.compress(binarydir, exportzip, monitor);
+			} catch (IOException e) {
+				org.txm.utils.logger.Log.printStackTrace(e);
+				return false;
+			}
+			return true;
+		} else {
+			System.out.println(TXMCoreMessages.Base_0+binarydir+TXMCoreMessages.Base_3);
+			System.out.println(TXMCoreMessages.Base_4+exportzip.getParentFile()+TXMCoreMessages.Base_5);
+
+		}
+		return false;
+	}
+
+	/**
+	 * Gets the base directory.
+	 *
+	 * @return the base directory
+	 */
+	public File getBaseDirectory()
+	{
+		return this.params.paramFile.getParentFile();
+	}
+
+	public HashMap<String, Alignement> getLinks()
+	{
+		return links;
+	}
+
+	public ArrayList<Alignement> getLinksFrom(String from)
+	{
+		ArrayList<Alignement> rez = new ArrayList<Alignement>();
+		for(String key : links.keySet())
+			if(key.startsWith("#"+from+" ")) //$NON-NLS-1$ //$NON-NLS-2$
+				rez.add(links.get(key));
+		return rez;
+	}
+
+	public ArrayList<Alignement> getLinksTo(String to)
+	{
+		ArrayList<Alignement> rez = new ArrayList<Alignement>();
+		for(String key : links.keySet())
+			if(key.endsWith(" #"+to)) //$NON-NLS-1$
+				rez.add(links.get(key));
+		return rez;
+	}
+
+	public Alignement getLink(String from, String to)
+	{
+		return links.get("#"+from+" #"+to ); //$NON-NLS-1$ //$NON-NLS-2$
+	}
+
+	/**
+	 * Gets the author.
+	 *
+	 * @return the author
+	 */
+	public String getAuthor() {
+		return params.author;
+	}
+
+	/**
+	 * Gets the description.
+	 *
+	 * @return the description
+	 */
+	public String getDescription() {
+		return params.description;
+	}
+
+	public BaseParameters getBaseParameters() {
+		return params;
+	}
+
+	@Override
+	public String getSimpleName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public String getDetails() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public void clean() {
+		// TODO Auto-generated method stub
+		
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/objects/Base.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/objects/Corpus.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/objects/Corpus.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/objects/Corpus.java	(revision 258)
@@ -0,0 +1,1109 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2016-10-27 16:30:30 +0200 (Thu, 27 Oct 2016) $
+// $LastChangedRevision: 3331 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.objects;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+
+import javax.persistence.EntityManager;
+
+import org.txm.Toolbox;
+import org.txm.annotation.AnnotationManager;
+import org.txm.annotation.repository.KnowledgeRepository;
+import org.txm.annotation.repository.KnowledgeRepositoryManager;
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.functions.ProgressWatcher;
+import org.txm.metadatas.DateMetadata;
+import org.txm.metadatas.Metadata;
+import org.txm.metadatas.MetadataGroup;
+import org.txm.metadatas.MinMaxDateGroup;
+import org.txm.searchengine.cqp.corpus.Alignement;
+import org.txm.searchengine.cqp.corpus.query.Query;
+import org.txm.utils.logger.Log;
+import org.txm.utils.zip.Zip;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+/**
+ * The abstract Corpus class.
+ */
+public abstract class Corpus extends TxmObject {
+
+	/** serialVersionUID */
+	private static final long serialVersionUID = 6906032980183899327L;
+
+	/** The base. */
+	private Base base;
+
+	/** The texts element. */
+	Element textsElement;
+	/** The corpora element. */
+	Element corporaElement;
+	/** The scripts element. */
+	Element scriptsElement;
+	/** The queries element. */
+	private Element queriesElement;
+
+	public static final String TEXT = "text";
+	public static final String TEXTS = "texts";
+	public static final String BIBLIO = "biblio";
+	public static final String PDF = "pdf";
+	public static final String SOURCE = "source";
+	public static final String TYPE = "type";
+	public static final String FILE = "file";
+	public static final String EDITIONS = "editions";
+	public static final String EDITION = "edition";
+	public static final String NAME = "name";
+	public static final String LANG = "lang";
+	public static final String WORDSPERPAGE = "wordsperpage";
+	public static final String DOEDITIONSTEP = "doeditionstep";
+	public static final String AVOIDXMLSTEPS = "avoidxmlsteps";
+	public static final String CLEANTEMPDIRS = "cleantempdirectories";
+	public static final String CORPUS = "corpus";
+	public static final String CORPORA = "corpora";
+	public static final String ID = "id";
+	public static final String DEFAULT = "default";
+
+	/** The texts. */
+	HashMap<String, Text> texts = new HashMap<String, Text>();
+
+	/** The textnames. */
+	ArrayList<String> textnames = new ArrayList<String>();
+
+	/** The queries. */
+	HashMap<String,SavedQuery> queries = new HashMap<String, SavedQuery>();
+
+	/** The project. */
+	Project project;
+
+	/** The importmetadatas. */
+	public ArrayList<Metadata> importmetadatas = new ArrayList<Metadata>();
+	public ArrayList<MetadataGroup> groupedMetadatas = new ArrayList<MetadataGroup>();
+
+	/** The p attribute info names. */
+	private static String[] attributeInfoNames = {ID, "shortname", "longname", TYPE, "renderer", "tooltip", "pattern", "import", "mandatory", "inputFormat", "outputFormat"};
+	private HashMap<String, HashMap<String, String>> pAttributesInfos = new HashMap<String, HashMap<String,String>>();
+	private HashMap<String, HashMap<String, String>> sAttributesInfos = new HashMap<String, HashMap<String,String>>();
+
+	/** The encoding. */
+	private String encoding;
+
+	/** The lang. */
+	private String lang;
+
+	/** The srcdir. */
+	private String srcdir;
+
+	/** The xslt. */
+	private String xslt;
+
+	/** The author. */
+	private String author;
+
+	/** The script. */
+	private String script;
+
+	private String font="Arial";
+
+	private ArrayList<String> refProperties = new ArrayList<String>();
+	private ArrayList<String> sortProperties = new ArrayList<String>();
+	private ArrayList<String> viewProperties = new ArrayList<String>();
+
+	private HashMap<String, Alignement> links = new HashMap<String, Alignement>();
+
+	private String defaultEditionName = null;
+
+	private ArrayList<String> editionNames = new ArrayList<String>();
+
+	private String desc;
+
+	// The default properties to use
+	private String defaultRefProperty;
+	private String defaultSortProperty;
+	private String defaultViewProperty;
+
+	private int pageSize;
+	private boolean doEditionStep;
+	private boolean avoidXMLSteps;
+	private boolean cleanTempDirs;
+
+	protected String cql_limit_query = "<text>[]"; // read only
+	protected int conc_left_context = 8; // read only
+	protected int conc_right_context = 12; // read only
+
+	/** The persistence manager for annotations **/
+	private EntityManager jpaem;
+
+	/**
+	 * Gets the text.
+	 *
+	 * @param id the id
+	 * @return the text
+	 */
+	public Text getText(String id) {
+		return texts.get(id);
+	}
+
+	public String getCQLLimitQuery() {
+		return cql_limit_query;
+	}
+
+	public int getDefaultConcordanceLeftContextSize() {
+		return conc_left_context;
+	}
+
+	public int getDefaultConcordanceRightContextSize() {
+		return conc_right_context;
+	}
+
+	/**
+	 * Gets the texts.
+	 *
+	 * @return the texts
+	 */
+	public Collection<Text> getTexts() {
+		return texts.values();
+	}
+
+	/**
+	 * Gets the queries log.
+	 *
+	 * @return the queries log
+	 */
+	public Collection<SavedQuery> getQueriesLog() {
+		return queries.values();
+	}
+
+	/**
+	 * Gets the texts id.
+	 *
+	 * @return the texts id
+	 */
+	public List<String> getTextsID() {
+		return textnames;
+	}
+
+	/**
+	 * Adds the directory.
+	 *
+	 * @param directory the directory
+	 * @return true, if successful
+	 */
+	public boolean addDirectory(File directory) {
+		FileFilter filter = new FileFilter() {
+			@Override
+			public boolean	accept(File pathname) {
+				return !pathname.isHidden();
+			}
+		};
+		if (directory.isDirectory() && directory.exists()) {
+			File[] files = directory.listFiles(filter);
+			Arrays.sort(files);
+			for (File f : files) {
+				addText(f);
+			}
+		} else {
+			System.out.println(directory + " is not a directory.");
+			return false;
+		}
+		return true;
+	}
+
+	/**
+	 * Adds the text.
+	 *
+	 * @param file the file
+	 * @return the text
+	 */
+	public Text addText(File file) {
+		if (texts.containsKey(file.getName()))
+			return texts.get(file.getName());
+
+		String filename = file.getName();
+		int idx = filename.indexOf(".");
+		String txtname = filename;
+		if(idx > 0)
+			txtname = filename.substring(0, idx);
+
+		Document doc = selfElement.getOwnerDocument();
+		Element textRoot = (Element) selfElement.getElementsByTagName(TEXTS).item(0); //$NON-NLS-1$
+		Element textElem = doc.createElement(TEXT); 
+		textElem.setAttribute(NAME, txtname); 
+		textElem.setAttribute(BIBLIO, ""); //$NON-NLS-1$
+		textElem.setAttribute(PDF, ""); //$NON-NLS-1$
+		Element src = doc.createElement(SOURCE); 
+		src.setAttribute(TYPE, filename.substring(idx+1)); 
+		src.setAttribute(FILE, file.getAbsolutePath()); 
+
+		textElem.appendChild(src);
+		Element editions = doc.createElement(EDITIONS);
+		textElem.appendChild(editions);
+		textRoot.appendChild(textElem);
+
+		Text t = new Text(this, textElem);
+		if (texts.keySet().contains(txtname)) {
+			System.out.println("Warning corpus configuration file contains texts with the same ID: "+txtname+" (next ones are ignored).");
+			return null;
+		}
+		texts.put(txtname, t);
+		textnames.add(t.getName());
+		return t;
+	}
+
+	/**
+	 * Removes the text.
+	 *
+	 * @param name the name
+	 * @return the text
+	 */
+	public Text removeText(String name) {
+		Text text = texts.get(name);
+
+		if (text != null) {
+			Element textRoot = (Element) selfElement.getElementsByTagName(
+					TEXTS).item(0); //$NON-NLS-1$
+			textRoot.removeChild(text.selfElement);
+			texts.remove(name);
+			textnames.remove(name);
+		}
+		return text;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#load()
+	 */
+	@Override
+	public boolean load() {
+		this.name = selfElement.getAttribute(NAME); 
+		this.lang = selfElement.getAttribute(LANG);
+		// System.out.println("LOAD BASE "+this.name);
+		loadMetadata();
+
+		// get texts
+		NodeList textsNodes = selfElement.getElementsByTagName(TEXTS);
+		if (textsNodes.getLength() > 0) {
+			textsElement = (Element) textsNodes.item(0);
+			NodeList textsList = textsElement.getElementsByTagName(TEXT);
+			for (int i = 0; i < textsList.getLength(); i++) {
+				Element text = (Element) textsList.item(i);
+				Text t = new Text(this, text);
+				if (texts.keySet().contains(t.getName())) {
+					System.out.println("Warning "+this.name+" corpus configuration file contains duplicated with ID="+t.getName()+" (next ones are ignored).");
+				} else {
+					texts.put(t.getName(), t);
+					textnames.add(t.getName());
+				}
+			}
+		}
+
+		// get saved queries
+		if (selfElement.getElementsByTagName("queries").getLength() > 0) { //$NON-NLS-1$
+			queriesElement = (Element) selfElement.getElementsByTagName("queries").item(0); //$NON-NLS-1$
+			NodeList queryList = queriesElement.getElementsByTagName("query"); //$NON-NLS-1$
+			for (int i = 0; i < queryList.getLength(); i++) {
+				Element qelem = (Element) queryList.item(i);
+				SavedQuery q = new SavedQuery(this, qelem);
+				this.queries.put(q.getName(), q);
+			}
+		}
+
+		loadImportInfos(selfElement);
+
+		return false;
+	}
+
+	/**
+	 * Adds the query log.
+	 *
+	 * @param query the query
+	 * @param examples the examples
+	 * @return the query log
+	 */
+	public SavedQuery addQueryLog(Query query, List<String> examples) {
+		if (queries.containsKey(query.getQueryString()))
+			return queries.get(query.getQueryString());
+		if (selfElement == null) return null;
+
+		SavedQuery q = new SavedQuery(this, query, examples);
+
+		// q.selfElement = ;
+		Document doc = selfElement.getOwnerDocument();
+		Element queriesRoot;
+		if (selfElement.getElementsByTagName("queries").getLength() == 0) //$NON-NLS-1$
+		{
+			queriesRoot = doc.createElement("queries"); //$NON-NLS-1$
+			selfElement.appendChild(queriesRoot);
+		} else
+			queriesRoot = (Element) selfElement
+			.getElementsByTagName("queries").item(0); //$NON-NLS-1$
+
+		Element queryElem = doc.createElement("query"); //$NON-NLS-1$
+		queryElem.setAttribute(NAME, q.getName()); 
+		queryElem.setAttribute("query", q.getQuery().getQueryString()); //$NON-NLS-1$
+		Element examplesElem = doc.createElement("examples"); //$NON-NLS-1$
+		queryElem.appendChild(examplesElem);
+		for (String ex : q.getExamples()) {
+			Element exampleElem = doc.createElement("example"); //$NON-NLS-1$
+			exampleElem.setTextContent(ex);
+			examplesElem.appendChild(exampleElem);
+		}
+
+		queriesRoot.appendChild(queryElem);
+		queries.put(q.getName(), q);
+		return q;
+	}
+
+	/**
+	 * Removes the query.
+	 *
+	 * @param name the name
+	 * @return the query log
+	 */
+	public SavedQuery removeQuery(String name) {
+		SavedQuery query = queries.get(name);
+
+		if (query != null) {
+			Element queriesRoot = (Element) selfElement.getElementsByTagName(
+					"queries").item(0); //$NON-NLS-1$
+			queriesRoot.removeChild(query.selfElement);
+			queries.remove(name);
+		}
+		return query;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#removeChildren(org.txm.objects.TxmObject)
+	 */
+	public TxmObject removeChildren(TxmObject o) {
+		if (o == null)
+			return null;
+		if (o instanceof Text) {
+			textsElement.removeChild(o.selfElement);
+			textnames.remove(((Text) o).getName());
+			return texts.remove(((Text) o).getName());
+		} else if (o instanceof SavedQuery) {
+			queriesElement.removeChild(o.selfElement);
+			return queries.remove(((SavedQuery) o).getName());
+		}
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#hasChildren(org.txm.objects.TxmObject)
+	 */
+	public boolean hasChildren(TxmObject o) {
+		if (o == null)
+			return false;
+		if (o instanceof Text)
+			return texts.containsKey(((Text) o).getName());
+		return false;
+	}
+
+	/**
+	 * Gets the next text.
+	 *
+	 * @param t the t
+	 * @return the next text
+	 */
+	public Text getNextText(Text t) {
+		for (int i = 0; i < textnames.size(); i++) {
+			if (textnames.get(i).equals(t.getName())) {
+				if (i + 1 < textnames.size())
+					return getText(textnames.get(i + 1));
+				else
+					return null;
+			}
+		}
+		return null;
+	}
+
+	/**
+	 * Gets the previous text.
+	 *
+	 * @param t the t
+	 * @return the previous text
+	 */
+	public Text getPreviousText(Text t) {
+		for (int i = 0; i < textnames.size(); i++) {
+			if (textnames.get(i).equals(t.getName())) {
+				if (i - 1 >= 0)
+					return getText(textnames.get(i - 1));
+				else
+					return null;
+			}
+		}
+		return null;
+	}
+
+	/**
+	 * Gets the last text.
+	 *
+	 * @return the last text
+	 */
+	public Text getLastText() {
+		if (textnames.size() > 0)
+			return getText(textnames.get(textnames.size() - 1));
+		else
+			return null;
+	}
+
+	/**
+	 * Gets the first text.
+	 *
+	 * @return the first text
+	 */
+	public Text getFirstText() {
+		if (textnames.size() > 0)
+			return getText(textnames.get(0));
+		else
+			return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#getParent()
+	 */
+	@Override
+	public TxmObject getParent() {
+		return getProject();
+	}
+
+	/**
+	 * Register maincorpus.
+	 *
+	 * @param corpusName the corpus name
+	 */
+	public Element registerMaincorpus(String corpusName) {
+		Document doc = selfElement.getOwnerDocument();
+		Element maincorpus = doc.createElement(CORPUS);
+		maincorpus.setAttribute(NAME, corpusName);
+		if (selfElement.getElementsByTagName(CORPORA).getLength() == 0) {
+			Log.severe(TXMCoreMessages.Base_22);
+			return null;
+		}
+		Element corporaElem = (Element) selfElement.getElementsByTagName(CORPORA).item(0);
+		corporaElem.appendChild(maincorpus); // append maincorpus
+		return maincorpus;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#propagateAttribute(java.lang.String)
+	 */
+	@Override
+	public void propagateAttribute(String key) {
+		super.propagateAttribute(key);
+	}
+
+	public boolean export(File exportzip) {
+		return export(exportzip, null);
+	}
+	/**
+	 * Export.
+	 *
+	 * @param exportzip the exportzip
+	 * @return true, if successful
+	 */
+	public boolean export(File exportzip, ProgressWatcher monitor) {
+		File binarydir = this.getBaseDirectory();
+		if (binarydir.exists() && exportzip.getParentFile().exists()) {
+			try {
+				Zip.compress(binarydir, exportzip, monitor);
+			} catch (IOException e) {
+				org.txm.utils.logger.Log.printStackTrace(e);
+				return false;
+			}
+			return true;
+		} else {
+			System.out.println(TXMCoreMessages.Base_0+binarydir+TXMCoreMessages.Base_3);
+			System.out.println(TXMCoreMessages.Base_4+exportzip.getParentFile()+TXMCoreMessages.Base_5);
+
+		}
+		return false;
+	}
+
+	/**
+	 * Gets the base directory.
+	 *
+	 * @return the base directory
+	 */
+	public File getBaseDirectory()
+	{
+		String txmhome = Toolbox.getParam(Toolbox.USER_TXM_HOME);
+		Base base = this.getBase();
+		if (base != null)
+			return base.params.paramFile.getParentFile();
+		//return new File(new File(txmhome,"corpora"), getName());
+		return null;
+	}
+
+	/**
+	 * Gets the import metadata.
+	 *
+	 * @return the import metadata
+	 */
+	public ArrayList<Metadata> getImportMetadata()
+	{
+		return importmetadatas;
+	}
+
+	/**
+	 * Gets the import metadata.
+	 *
+	 * @return the import metadata
+	 */
+	public ArrayList<MetadataGroup> getMetadataGroups()
+	{
+		return groupedMetadatas;
+	}
+
+	/**
+	 * Load import infos.
+	 *
+	 * @param root the root
+	 * @return true, if successful
+	 */
+	private boolean loadImportInfos(Element root) {
+		// import general infos
+		//System.out.println("load import infos: "+root);
+		this.encoding = root.getAttribute("encoding");
+		this.lang = root.getAttribute(LANG);
+		String str = root.getAttribute(WORDSPERPAGE);
+		if (str == null || str.length() == 0) str = "500";
+		this.pageSize = Integer.parseInt(str);
+		str = root.getAttribute(DOEDITIONSTEP);
+		if (str == null || str.length() == 0) str = "true";
+		this.doEditionStep = "true".equals(str);
+		str = root.getAttribute(AVOIDXMLSTEPS);
+		if (str == null || str.length() == 0) str = "false";
+		this.avoidXMLSteps = "true".equals(str);
+		str = root.getAttribute(CLEANTEMPDIRS);
+		if (str == null || str.length() == 0) str = "false";
+		this.cleanTempDirs = "true".equals(str);
+		//this.srcdir = root.getAttribute("rootdir");
+		//this.script = root.getAttribute("script");
+		//this.xslt = root.getAttribute("xslt");
+		this.desc = root.getAttribute("desc");
+		this.setFont(root.getAttribute("font"));
+
+		//tokenizer infos
+		/*
+		NodeList tokenizerNodes = root.getElementsByTagName("tokenizer");
+		if (tokenizerNodes.getLength() > 0)
+		{
+			Element tokenizerNode = (Element) tokenizerNodes.item(0);
+			NodeList tokenizerparamNodes = tokenizerNode.getElementsByTagName("param");
+		}
+		 */
+
+		//Pattributes definitions
+		NodeList pAttributesNodes = root.getElementsByTagName("pattributes");
+		pAttributesInfos.clear();
+		if (pAttributesNodes.getLength() > 0) // only one
+		{
+			Element pattributesNode = (Element) pAttributesNodes.item(0);
+			NodeList pattributeNodes = pattributesNode.getElementsByTagName("pattribute");
+			for(int i = 0 ; i < pattributeNodes.getLength() ; i++)
+			{
+				Element pattribute = (Element)pattributeNodes.item(i);
+				HashMap<String, String> values = new HashMap<String, String>();
+				pAttributesInfos.put(pattribute.getAttribute(ID), values);
+
+				for(String name : attributeInfoNames) {
+					if(pattribute.getAttribute(name) != null)
+						values.put(name, pattribute.getAttribute(name));
+					else
+						values.put(name, "");
+				}
+			}
+		}
+
+		//Sattributes definitions
+		NodeList sAttributesNodes = root.getElementsByTagName("sattributes");
+		sAttributesInfos.clear();
+		if (sAttributesNodes.getLength() > 0) {
+			Element sattributesNode = (Element) sAttributesNodes.item(0);
+			NodeList sattributeNodes = sattributesNode.getElementsByTagName("sattribute");
+			for (int i = 0 ; i < sattributeNodes.getLength() ; i++) {
+				Element sattribute = (Element)sattributeNodes.item(i);
+				HashMap<String, String> values = new HashMap<String, String>();
+				sAttributesInfos.put(sattribute.getAttribute(ID), values);
+
+				for (String name : attributeInfoNames) {
+					if (sattribute.getAttribute(name) != null)
+						values.put(name, sattribute.getAttribute(name));
+					else
+						values.put(name, "");
+				}
+			}
+		}
+		//System.out.println("sAttributes Infos : "+sAttributesInfos);
+
+		//Metadata definitions
+		importmetadatas.clear();
+		groupedMetadatas.clear();
+
+		//UI: sort, view and ref properties to show
+		NodeList uisNodes = root.getElementsByTagName("uis");
+		if (uisNodes.getLength() > 0) { // only one
+			Element uisElem = (Element) uisNodes.item(0);
+			NodeList uiNodes = uisElem.getElementsByTagName("ui");
+			for (int c = 0 ; c < uiNodes.getLength() ; c++) {
+				Element uiElem = (Element) uiNodes.item(c);
+				if ("concordance".equals(uiElem.getAttribute("command").toLowerCase())) {
+					NodeList viewsNodes = uiElem.getElementsByTagName("view");
+					viewProperties.clear();
+					if (viewsNodes.getLength() > 0) // only one
+					{
+						Element viewNode = (Element) viewsNodes.item(0);
+						this.defaultViewProperty = viewNode.getAttribute(DEFAULT);
+						for (int i = 0 ; i < viewNode.getChildNodes().getLength() ; i++) {
+							try {
+								Element element = (Element)viewNode.getChildNodes().item(i);
+								viewProperties.add(element.getAttribute(ID));
+							} catch(Exception e){} // quick and dirty
+						}
+					}
+
+					NodeList sortsNodes = uiElem.getElementsByTagName("sort");
+					sortProperties.clear();
+					if (sortsNodes.getLength() > 0) // only one
+					{
+						Element sortNode = (Element) sortsNodes.item(0);
+						this.defaultSortProperty = sortNode.getAttribute(DEFAULT);
+						for (int i = 0 ; i < sortNode.getChildNodes().getLength() ; i++) {
+							try {
+								Element element = (Element)sortNode.getChildNodes().item(i);
+								sortProperties.add(element.getAttribute(ID));
+							} catch(Exception e){} // quick and dirty
+						}
+					}
+
+					NodeList refsNodes = uiElem.getElementsByTagName("ref");
+					refProperties.clear();
+					if (refsNodes.getLength() > 0) { // only one
+						Element refNode = (Element) refsNodes.item(0);
+						this.defaultRefProperty = refNode.getAttribute(DEFAULT);
+						for (int i = 0 ; i < refNode.getChildNodes().getLength() ; i++) {
+							try {
+								Element element = (Element)refNode.getChildNodes().item(i);
+								refProperties.add(element.getAttribute(ID));
+							}catch (Exception e){} // quick and dirty
+						}
+					}
+
+					NodeList cqlLimitNodes = uiElem.getElementsByTagName("context_limits");
+					//cql_limit_query = null;
+					if (cqlLimitNodes.getLength() > 0) { // only one node
+						Element context_limitsNode = (Element) cqlLimitNodes.item(0);
+						cql_limit_query = context_limitsNode.getTextContent();
+						if ("list".equals(context_limitsNode.getAttribute("type"))) {
+							String query = "";
+							String[] split = cql_limit_query.split(",");
+							if (split.length > 0) {
+								for (String s : split) {
+									query += "|<"+s.trim()+">[]";
+								}
+								cql_limit_query = query.substring(1);
+							}
+						}
+					}
+
+					NodeList cqlCtxSizeNodes = uiElem.getElementsByTagName("context_sizes");
+					//cql_limit_query = null;
+					if (cqlCtxSizeNodes.getLength() > 0) { // only one node
+						Element context_limitsNode = (Element) cqlCtxSizeNodes.item(0);
+						try {
+							conc_left_context = Integer.parseInt(context_limitsNode.getAttribute("left"));
+							conc_right_context = Integer.parseInt(context_limitsNode.getAttribute("right"));
+						} catch(Exception e) {
+							System.out.println("In uis/ui@command=concordance/context_sizes: context sizes number malformed: "+e);
+						}
+					}
+				} else if ("selection".equals(uiElem.getAttribute("command").toLowerCase())) {
+					NodeList sattributeNodes = uiElem.getElementsByTagName("sattribute");
+					for (int i = 0 ; i < sattributeNodes.getLength() ; i++) {
+						Element sattributeElem = (Element)sattributeNodes.item(i);
+						String ref = sattributeElem.getAttribute("ref");
+						//String id = ref.substring(5);
+						HashMap<String, String> infos = sAttributesInfos.get(ref);
+						if (infos == null) {
+							Log.warning("Malformed sattribute tag in "+this.getBase().getBaseParameters().paramFile+" at uis/command/selection: could not find s-attribute informations for @ref="+ref);
+						}
+						//System.out.println("REF: "+ref+" infos: "+infos);
+						if (infos != null)
+							if (ref.startsWith("text_")) {
+								//System.out.println("TEST: "+infos.get("type")+" =? 'Date'");
+								if (infos.get(TYPE).equals("Date")) {
+									importmetadatas.add(new DateMetadata(infos, sattributeElem));
+								} else
+									importmetadatas.add(new Metadata(infos, sattributeElem));
+							}
+					}
+					//System.out.println("Load groups: "+importmetadatas);
+					NodeList groupNodes = uiElem.getElementsByTagName("group");
+					for (int i = 0 ; i < groupNodes.getLength() ; i++) {
+						Element groupElem = (Element)groupNodes.item(i);
+						if (groupElem.getAttribute(TYPE).equals("MinMaxDate"))
+							groupedMetadatas.add(new MinMaxDateGroup(this, groupElem));
+					}
+				}
+			}
+		}
+
+		// get available editions
+		NodeList editionsNodes = root.getElementsByTagName(EDITIONS);
+		if (editionsNodes.getLength() > 0) // only one
+		{
+			Element editionNode = (Element) editionsNodes.item(0);
+			this.defaultEditionName = editionNode.getAttribute(DEFAULT);
+			NodeList editionNodes = editionNode.getElementsByTagName(EDITION);
+			for(int i = 0 ; i < editionNodes.getLength() ; i++)
+			{
+				Element edition = (Element)editionNodes.item(i);
+				String name = edition.getAttribute(NAME);
+				String built = edition.getAttribute("build_edition");
+				//System.out.println("declare edition: "+name);
+				//String corpus = edition.getAttribute("corpus");
+				//				String mode = edition.getAttribute("mode");
+				//				String script = edition.getAttribute("script");
+				if(!this.editionNames.contains(name) && !"false".equals(built))
+					this.editionNames.add(name);
+			}
+			if(!editionNames.contains(this.defaultEditionName) && editionNames.size() > 0)
+				this.defaultEditionName = editionNames.get(0);
+		}
+
+		// Text biblio
+		NodeList bibliosNodes = root.getElementsByTagName("biblios");
+		if (bibliosNodes.getLength() > 0) // only one
+		{
+			Element biblioNode = (Element) bibliosNodes.item(0);
+			NodeList metadataNodes = biblioNode.getElementsByTagName(BIBLIO);
+			for (int i = 0 ; i < metadataNodes.getLength() ; i++) {
+				Element biblio = (Element)metadataNodes.item(i);
+				String id = biblio.getAttribute(ID);
+				String url = biblio.getTextContent();
+				Text text = this.getText(id);
+				if (text != null)
+					text.setBiblio(url);
+			}
+		}
+
+		return true;
+	}
+
+	public HashMap<String, Alignement> getLinks()
+	{
+		return links;
+	}
+
+	public ArrayList<Alignement> getLinksFrom(String from)
+	{
+		ArrayList<Alignement> rez = new ArrayList<Alignement>();
+		for(String key : links.keySet())
+			if(key.startsWith("#"+from+" "))
+				rez.add(links.get(key));
+		return rez;
+	}
+
+	public ArrayList<Alignement> getLinksTo(String to)
+	{
+		ArrayList<Alignement> rez = new ArrayList<Alignement>();
+		for(String key : links.keySet())
+			if(key.endsWith(" #"+to))
+				rez.add(links.get(key));
+		return rez;
+	}
+
+	public Alignement getLink(String from, String to)
+	{
+		return links.get("#"+from+" #"+to );
+	}
+
+	public boolean hasEditions()
+	{
+		return defaultEditionName != null;
+	}
+
+	public String getDefaultEdition()
+	{
+		return defaultEditionName;
+	}
+
+	public ArrayList<String> getEditionNames()
+	{
+		return editionNames;
+	}
+
+	/**
+	 * Gets the p attributes info names.
+	 *
+	 * @return the p attributes info names
+	 */
+	public String[] getPAttributesInfoNames()
+	{
+		return attributeInfoNames;
+	}
+
+	/**
+	 * Gets the p attributes infos.
+	 *
+	 * @return the p attributes infos
+	 */
+	public HashMap<String, HashMap<String, String>> getPAttributesInfos()
+	{
+		return pAttributesInfos;
+	}
+
+	/**
+	 * Gets the s attributes infos.
+	 *
+	 * @return the s attributes infos
+	 */
+	public HashMap<String, HashMap<String, String>> getSAttributesInfos()
+	{
+		return sAttributesInfos;
+	}
+
+	/**
+	 * Gets the encoding.
+	 *
+	 * @return the encoding
+	 */
+	public String getEncoding() {
+		return encoding;
+	}
+
+	/**
+	 * Gets the lang.
+	 *
+	 * @return the lang
+	 */
+	public String getLang() {
+		return lang;
+	}
+
+	/**
+	 * Gets the srcdir.
+	 *
+	 * @return the srcdir
+	 */
+	public String getSrcdir() {
+		return srcdir;
+	}
+
+	/**
+	 * Gets the xslt.
+	 *
+	 * @return the xslt
+	 */
+	public String getXslt() {
+		return xslt;
+	}
+
+	/**
+	 * Gets the author.
+	 *
+	 * @return the author
+	 */
+	public String getAuthor() {
+		return author;
+	}
+
+	/**
+	 * Gets the description.
+	 *
+	 * @return the description
+	 */
+	public String getDescription() {
+		return this.desc;
+	}
+
+	/**
+	 * Gets the script.
+	 *
+	 * @return the script
+	 */
+	public String getScript() {
+		return script;
+	}
+
+	/**
+	 * @return the font
+	 */
+	public String getFont() {
+		return font;
+	}
+
+	/**
+	 * @param font the font to set
+	 */
+	public void setFont(String font) {
+		this.font = font;
+	}
+
+	public ArrayList<String> getRefProperties() {
+		return refProperties;
+	}
+
+	public void setRefProperties(ArrayList<String> refProperties) {
+		this.refProperties = refProperties;
+	}
+
+	public ArrayList<String> getSortProperties() {
+		return sortProperties;
+	}
+
+	public void setSortProperties(ArrayList<String> sortProperties) {
+		this.sortProperties = sortProperties;
+	}
+
+	public ArrayList<String> getViewProperties() {
+		return viewProperties;
+	}
+
+	public void setViewProperties(ArrayList<String> viewProperties) {
+		this.viewProperties = viewProperties;
+	}
+
+	/**
+	 * Instantiates a new corpus.
+	 *
+	 * @param base the base
+	 * @param c the c
+	 */
+	public Corpus(Base base, Element c) {
+		if(base != null && c != null)
+		{
+			this.base = base;
+			this.setPath(base.getPath() + getName());
+			selfElement = c;
+			load();
+		}
+	}
+
+	/**
+	 * Gets the project.
+	 *
+	 * @return the project
+	 */
+	public Project getProject() {
+		return base.getProject();
+	}
+
+	/**
+	 * Gets the base.
+	 *
+	 * @return the base
+	 */
+	public Base getBase() {
+		return base;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#save()
+	 */
+	@Override
+	public boolean save() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	/**
+	 * @return the defaultEditionName
+	 */
+	public String getDefaultEditionName() {
+		return defaultEditionName;
+	}
+
+	/**
+	 * @param defaultEditionName the defaultEditionName to set
+	 */
+	public void setDefaultEditionName(String defaultEditionName) {
+		this.defaultEditionName = defaultEditionName;
+	}
+
+	/**
+	 * @return the defaultRefProperty
+	 */
+	public String getDefaultRefProperty() {
+		return defaultRefProperty;
+	}
+
+	/**
+	 * @param defaultRefProperty the defaultRefProperty to set
+	 */
+	public void setDefaultRefProperty(String defaultRefProperty) {
+		this.defaultRefProperty = defaultRefProperty;
+	}
+
+	/**
+	 * @return the defaultSortProperty
+	 */
+	public String getDefaultSortProperty() {
+		return defaultSortProperty;
+	}
+
+	/**
+	 * @param defaultSortProperty the defaultSortProperty to set
+	 */
+	public void setDefaultSortProperty(String defaultSortProperty) {
+		this.defaultSortProperty = defaultSortProperty;
+	}
+
+	/**
+	 * @return the defaultSortProperty
+	 */
+	public String getDefaultViewProperty() {
+		return defaultViewProperty;
+	}
+
+	/**
+	 * @param defaultSortProperty the defaultSortProperty to set
+	 */
+	public void setDefaultViewProperty(String defaultViewProperty) {
+		this.defaultViewProperty = defaultViewProperty;
+	}
+
+	public abstract boolean canBeAnnotated();
+	public abstract KnowledgeRepository getKnowledgeRepository(String name);
+	public abstract  List<String> getKnowledgeRepositoryNames();
+	public abstract AnnotationManager getAnnotationManager();
+
+	@SuppressWarnings("unchecked")
+	public boolean[] mustLoginToKnowledgeRepository(String kr_name) {
+		return KnowledgeRepositoryManager.mustLoginToKnowledgeRepository(kr_name, this);
+	}
+
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/objects/Corpus.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/objects/IParameters.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/objects/IParameters.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/objects/IParameters.java	(revision 258)
@@ -0,0 +1,6 @@
+package org.txm.objects;
+
+
+public interface IParameters {
+	public boolean load();
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/objects/IParameters.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/objects/Page.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/objects/Page.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/objects/Page.java	(revision 258)
@@ -0,0 +1,234 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.objects;
+
+import java.io.File;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
+
+import org.txm.core.messages.TXMCoreMessages;
+import org.w3c.dom.Element;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class Page.
+ */
+public class Page extends TxmObject {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = -2577306118087593392L;
+	
+	/** The htmlfile. */
+	File htmlfile;
+	
+	/** The edition. */
+	Edition edition;
+	
+	/** The wordid. */
+	String firstWordId;
+
+	/**
+	 * Instantiates a new page.
+	 *
+	 * @param edition the edition
+	 * @param page the page
+	 */
+	public Page(Edition edition, Element page) {
+		this.setPath(edition.getPath() + getName());
+		selfElement = page;
+		this.edition = edition;
+		load();
+	}
+
+	/**
+	 * Gets the word id.
+	 *
+	 * @return the word id
+	 */
+	public String getWordId() {
+		return firstWordId;
+	}
+
+	/**
+	 * Gets the edition.
+	 *
+	 * @return the edition
+	 */
+	public Edition getEdition() {
+		return edition;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#load()
+	 */
+	@Override
+	public boolean load() {
+		name = selfElement.getAttribute("id"); //$NON-NLS-1$
+		htmlfile = new File(edition.getHtmlDir(), 
+				this.edition.getText().getName()+"_"+name+".html"); //$NON-NLS-1$ //$NON-NLS-2$
+		this.firstWordId = selfElement.getAttribute("wordid"); //$NON-NLS-1$
+		loadMetadata();
+		return false;
+	}
+	
+	/**
+	 * Gets the file.
+	 *
+	 * @return the file
+	 */
+	public File getFile() {
+		return this.htmlfile;
+	}
+
+	/**
+	 * To url.
+	 *
+	 * @return the string
+	 */
+	public String toURL() {
+		try {
+			return this.htmlfile.toURI().toURL().toString();
+		} catch (MalformedURLException e) {
+			System.err.println(TXMCoreMessages.Page_3 + htmlfile);
+			return ""; //$NON-NLS-1$
+		}
+	}
+
+	/**
+	 * Found first word id.
+	 *
+	 * @param page the page
+	 * @return the string
+	 * @throws Exception the exception
+	 */
+	public static String foundFirstWordId(File page) throws Exception {
+		InputStream inputData;
+		inputData = page.toURI().toURL().openStream();
+
+		XMLInputFactory factory = XMLInputFactory.newInstance();
+		XMLStreamReader parser = factory.createXMLStreamReader(inputData);
+
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+			if (event == XMLStreamConstants.START_ELEMENT) {
+				String localname = parser.getLocalName();
+				if (localname.matches("span")) //$NON-NLS-1$
+				{
+					String idattr = parser.getAttributeValue(null, "id"); //$NON-NLS-1$
+					if (idattr != null)
+					if (idattr.startsWith("w")) //$NON-NLS-1$
+					{
+						parser.close();
+						inputData.close();
+						return idattr;
+					}
+				}
+			}
+		}
+		parser.close();
+		inputData.close();
+		return null;
+	}
+
+	/**
+	 * Sets the name.
+	 *
+	 * @param name the new name
+	 */
+	public void setName(String name) {
+		this.name = name;
+		this.selfElement.setAttribute("id", name); //$NON-NLS-1$
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#getChildren()
+	 */
+	public List<TxmObject> getChildren() {
+		List<TxmObject> rez = new ArrayList<TxmObject>();
+		return rez;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#removeChildren(org.txm.objects.TxmObject)
+	 */
+	public TxmObject removeChildren(TxmObject o) {
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#hasChildren(org.txm.objects.TxmObject)
+	 */
+	public boolean hasChildren(TxmObject o) {
+		return false;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#getParent()
+	 */
+	@Override
+	public TxmObject getParent() {
+		return getEdition();
+	}
+
+	@Override
+	public boolean save() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	/* (non-Javadoc)
+	 * @see java.lang.Object#toString()
+	 */
+	@Override
+	public String toString() {
+		return "Page [name="+name+", htmlfile="+htmlfile +", firstWordId="+firstWordId+"]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+	}
+
+	@Override
+	public String getSimpleName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public String getDetails() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public void clean() {
+		// TODO Auto-generated method stub
+		
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/objects/Page.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/objects/package.html
===================================================================
--- tmp/org.txm.core/src/java/org/txm/objects/package.html	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/objects/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Defines all objects used in TXM</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/java/org/txm/objects/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/objects/Alignement.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/objects/Alignement.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/objects/Alignement.java	(revision 258)
@@ -0,0 +1,68 @@
+package org.txm.objects;
+
+import java.util.List;
+
+public class Alignement extends TxmObject{
+
+	String from, to , struct;
+	int level;
+	
+	public Alignement(String from2, String to2, String struct2, int level2) {
+		from = from2;
+		to = to2;
+		struct = struct2;
+		level= level2;
+	}
+
+	public List<? extends TxmObject> getChildren() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public TxmObject removeChildren(TxmObject children) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public boolean hasChildren(TxmObject children) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	@Override
+	public TxmObject getParent() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public boolean load() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	@Override
+	public boolean save() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	@Override
+	public String getSimpleName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public String getDetails() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public void clean() {
+		// TODO Auto-generated method stub
+		
+	}
+
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/objects/Alignement.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/objects/Property.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/objects/Property.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/objects/Property.java	(revision 258)
@@ -0,0 +1,123 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.objects;
+
+import java.io.Serializable;
+
+import org.w3c.dom.Element;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class Property.
+ */
+public class Property {
+	
+	/** The key. */
+	String key;
+	
+	/** The value. */
+	Serializable value;
+	
+	/** The type. */
+	String type;
+	
+	/** The self element. */
+	Element selfElement;
+
+	/**
+	 * Instantiates a new property.
+	 *
+	 * @param key the key
+	 * @param value the value
+	 * @param type the type
+	 * @param self the self
+	 */
+	public Property(String key, Serializable value, String type, Element self) {
+		this.key = key;
+		this.value = value;
+		this.type = type;
+		this.selfElement = self;
+	}
+
+	/**
+	 * Gets the value.
+	 *
+	 * @return the value
+	 */
+	public Serializable getValue() {
+		return value;
+	}
+
+	/**
+	 * Gets the type.
+	 *
+	 * @return the type
+	 */
+	public String getType() {
+		return type;
+	}
+
+	/**
+	 * Sets the value.
+	 *
+	 * @param value the new value
+	 */
+	public void setValue(Serializable value) {
+		this.value = value;
+		selfElement.setTextContent(value.toString());
+	}
+
+	/**
+	 * Sets the type.
+	 *
+	 * @param type the new type
+	 */
+	public void setType(String type) {
+		this.type = type;
+		selfElement.setAttribute("type", type); //$NON-NLS-1$
+	}
+
+	/**
+	 * Sets the key.
+	 *
+	 * @param key the new key
+	 */
+	public void setKey(String key) {
+		this.key = key;
+		selfElement.setAttribute("key", key); //$NON-NLS-1$
+	}
+	
+	/* (non-Javadoc)
+	 * @see java.lang.Object#toString()
+	 */
+	@Override
+	public String toString()
+	{
+		return (String) value;
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/objects/Property.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/objects/Text.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/objects/Text.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/objects/Text.java	(revision 258)
@@ -0,0 +1,294 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-06-11 16:23:51 +0200 (mar., 11 juin 2013) $
+// $LastChangedRevision: 2424 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.objects;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class Text.
+ */
+public class Text extends TxmObject {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = -5192107198327986096L;
+
+	/** The base. */
+	Corpus corpus;
+	
+	/** The editions. */
+	HashMap<String, Edition> editions = new HashMap<String, Edition>();
+	
+	/** The source path. */
+	File source;
+	
+	
+	/** The sourcetype (not used?). */
+	String sourcetype;
+	
+	/** The biblio path */
+	String biblio;
+
+	/** the pdf path **/
+	String pdf;
+	
+	/**
+	 * Instantiates a new text.
+	 *
+	 * @param corpus the base
+	 * @param text the text
+	 */
+	public Text(Corpus corpus, Element text) {
+		this.setPath(corpus.getPath() + getName());
+		this.corpus = corpus;
+		selfElement = text;
+		load();
+	}
+
+	/**
+	 * Gets the base.
+	 *
+	 * @return the base
+	 */
+	public Corpus getCorpus() {
+		return this.corpus;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#load()
+	 */
+	@Override
+	public boolean load() {
+		Element src = (Element) selfElement
+				.getElementsByTagName("source").item(0); //$NON-NLS-1$
+		source = new File(src.getAttribute("file")); //$NON-NLS-1$
+		sourcetype = src.getAttribute("type"); //$NON-NLS-1$
+		try {
+			biblio = selfElement.getAttribute("biblio"); //$NON-NLS-1$
+		} catch (Exception e) {	} 
+		try {
+			pdf = selfElement.getAttribute("pdf"); //$NON-NLS-1$
+		} catch (Exception e) {	} 
+		name = selfElement.getAttribute("name"); //$NON-NLS-1$
+
+		Element editionsnode = (Element) selfElement.getElementsByTagName("editions").item(0); //$NON-NLS-1$
+		NodeList editionList = editionsnode.getElementsByTagName("edition"); //$NON-NLS-1$
+
+		//System.out.println(" build text "+name+" nb editions: "+editionList.getLength());
+		for (int i = 0; i < editionList.getLength(); i++) {
+			Element edition = (Element) editionList.item(i);
+			Edition ed = new Edition(this, edition);
+			editions.put(ed.getName(), ed);
+		}
+
+		loadMetadata();
+		return true;
+	}
+	
+	/**
+	 * Gets the editions.
+	 *
+	 * @return the editions
+	 */
+	public Collection<Edition> getEditions() {
+		List<String> keys = new ArrayList<String>(editions.keySet());
+		Collections.sort(keys);
+		List<Edition> ret = new ArrayList<Edition>();
+		for (String s : keys)
+			ret.add(editions.get(s));
+		return ret;
+	}
+
+	/**
+	 * Gets the edition.
+	 *
+	 * @param name the name
+	 * @return the edition
+	 */
+	public Edition getEdition(String name) {
+		return editions.get(name);
+	}
+
+	/**
+	 * Adds the edition.
+	 *
+	 * @param name the name
+	 * @param type the type
+	 * @param index the index
+	 * @return the edition
+	 */
+	public Edition addEdition(String name, String type, File index) {
+		Document doc = selfElement.getOwnerDocument();
+		Element editionRoot = (Element) selfElement.getElementsByTagName(
+				"editions").item(0); //$NON-NLS-1$
+		Element editionElem = doc.createElement("edition"); //$NON-NLS-1$
+		editionElem.setAttribute("name", name); //$NON-NLS-1$
+		editionElem.setAttribute("type", type); //$NON-NLS-1$
+		editionElem.setAttribute("index", index.getAbsolutePath()); //$NON-NLS-1$
+		editionRoot.appendChild(editionElem);
+
+		Edition e = new Edition(this, editionElem);
+		e.setPath(this.getPath() + e.name);
+		editions.put(name, e);
+		return e;
+	}
+
+	/**
+	 * Removes the edition.
+	 *
+	 * @param name the name
+	 * @return the edition
+	 */
+	public Edition removeEdition(String name) {
+		Edition e = editions.get(name);
+		if (e != null) {
+			Element editionRoot = (Element) selfElement.getElementsByTagName(
+					"editions").item(0); //$NON-NLS-1$
+			editionRoot.removeChild(e.selfElement);
+			editions.remove(name);
+		}
+		return e;
+	}
+
+	/**
+	 * Gets the source.
+	 *
+	 * @return the source
+	 */
+	public File getSource() {
+		return source;
+	}
+	
+	/**
+	 * Gets the source.
+	 *
+	 * @return the source
+	 */
+	public String getPDFPath() {
+		return pdf;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#save()
+	 */
+	@Override
+	public boolean save() {
+		// TODO Auto-generated method stub
+		return true;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#getChildren()
+	 */
+	public List<TxmObject> getChildren() {
+		List<TxmObject> rez = new ArrayList<TxmObject>();
+		rez.addAll(this.getEditions());
+		return rez;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#removeChildren(org.txm.objects.TxmObject)
+	 */
+	public TxmObject removeChildren(TxmObject o) {
+		if (o == null)
+			return null;
+		if (o instanceof Edition) {
+			selfElement.removeChild(o.selfElement);
+			return editions.remove(((Edition) o).getName());
+		}
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#hasChildren(org.txm.objects.TxmObject)
+	 */
+	public boolean hasChildren(TxmObject o) {
+		if (o == null)
+			return false;
+		if (o instanceof Edition)
+			return editions.containsKey(((Edition) o).getName());
+		return false;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#getParent()
+	 */
+	@Override
+	public TxmObject getParent() {
+		return getCorpus();
+	}
+
+	/**
+	 * Gets the biblio.
+	 *
+	 * @return the biblio
+	 */
+	public String getBiblioPath()
+	{
+		return biblio;
+	}
+	
+	/**
+	 * Sets the biblio.
+	 *
+	 * @param url the url
+	 * @return true, if successful
+	 */
+	public boolean setBiblio(String url) {
+
+		this.biblio = url;
+		return true;
+	}
+
+	@Override
+	public String getSimpleName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public String getDetails() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public void clean() {
+		// TODO Auto-generated method stub
+		
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/objects/Text.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/objects/SavedQuery.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/objects/SavedQuery.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/objects/SavedQuery.java	(revision 258)
@@ -0,0 +1,197 @@
+// 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
+// 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.
+
+//
+// This file is part of the TXM platform.
+//
+// The TXM platform is free software: you can redistribute it and/or modif y
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 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/>.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.objects;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.txm.searchengine.cqp.corpus.query.Query;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+// TODO: Auto-generated Javadoc
+/**
+ * contains a query and examples of results @ author mdecorde.
+ */
+public class SavedQuery extends TxmObject {
+	
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 1L;
+	
+	/** The query. */
+	Query value;
+	
+	/** The examples. */
+	List<String> examples;
+	
+	/** The base. */
+	Corpus corpus;
+
+	/**
+	 * Instantiates a new query log.
+	 *
+	 * @param b the b
+	 * @param query the query
+	 * @param examples the examples
+	 */
+	public SavedQuery(Corpus c, Query query, List<String> examples) {
+		this.corpus = c;
+		this.value = query;
+		if (examples == null)
+			this.examples = new ArrayList<String>();
+		this.examples = examples;
+		this.name = query.getQueryString();
+	}
+
+	/**
+	 * Instantiates a new query log.
+	 *
+	 * @param corpus the b
+	 * @param e the e
+	 */
+	public SavedQuery(Corpus corpus, Element e) {
+		this.corpus = corpus;
+		this.selfElement = e;
+		this.load();
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#getChildren()
+	 */
+	public List<? extends TxmObject> getChildren() {
+		return new ArrayList<TxmObject>();
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#getParent()
+	 */
+	@Override
+	public TxmObject getParent() {
+		return corpus;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#hasChildren(org.txm.objects.TxmObject)
+	 */
+	public boolean hasChildren(TxmObject children) {
+		return false;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#load()
+	 */
+	@Override
+	public boolean load() {
+		this.name = selfElement.getAttribute("name"); //$NON-NLS-1$
+		this.value = new Query(selfElement.getAttribute("value")); //$NON-NLS-1$
+		this.examples = new ArrayList<String>();
+		NodeList examplesN = selfElement.getElementsByTagName("example"); //$NON-NLS-1$
+		for (int i = 0; i < examplesN.getLength(); i++) {
+			Element e = (Element) examplesN.item(i);
+			examples.add(e.getTextContent());
+		}
+		if (this.name == null || this.value == null)
+			return false;
+		return true;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#removeChildren(org.txm.objects.TxmObject)
+	 */
+	public TxmObject removeChildren(TxmObject children) {
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#save()
+	 */
+	@Override
+	public boolean save() {
+		return true;
+	}
+
+	/**
+	 * Gets the query.
+	 *
+	 * @return the query
+	 */
+	public Query getQuery() {
+		return value;
+	}
+
+	/**
+	 * Gets the examples.
+	 *
+	 * @return the examples
+	 */
+	public List<String> getExamples() {
+		return examples;
+	}
+
+	/* (non-Javadoc)
+	 * @see java.lang.Object#toString()
+	 */
+	@Override
+	public String toString() {
+		return this.name ;//+ " >> " + this.examples; 
+	}
+
+	@Override
+	public String getSimpleName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public String getDetails() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public void clean() {
+		// TODO Auto-generated method stub
+		
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/objects/SavedQuery.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/objects/Edition.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/objects/Edition.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/objects/Edition.java	(revision 258)
@@ -0,0 +1,388 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2016-07-19 15:36:55 +0200 (Tue, 19 Jul 2016) $
+// $LastChangedRevision: 3279 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.objects;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.regex.PatternSyntaxException;
+
+import org.txm.utils.logger.Log;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class Edition.
+ */
+public class Edition extends TxmObject {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = -3229827720648844957L;
+
+	/** The type. */
+	String type;
+	
+	/** The index. */
+	File index;
+		
+	/** The pages. */
+	ArrayList<Page> pages = new ArrayList<Page>();
+	ArrayList<String> keys = new ArrayList<String>();
+	
+	/** The numpages. */
+	Integer numpages;
+	
+	/** The text. */
+	Text text;
+
+	private File defaultHtmlDir;
+
+	/**
+	 * Instantiates a new edition.
+	 *
+	 * @param text the text
+	 * @param edition the edition
+	 */
+	public Edition(Text text, Element edition) {
+		this.setPath(text.getPath() + getName());
+		selfElement = edition;
+		this.text = text;
+		load();
+	}
+
+	/**
+	 * Gets the text.
+	 *
+	 * @return the text
+	 */
+	public Text getText() {
+		return text;
+	}
+
+	/**
+	 * Gets the num pages.
+	 *
+	 * @return the num pages
+	 */
+	public Integer getNumPages() {
+		return numpages;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#load()
+	 */
+	@Override
+	public boolean load() {
+		type = selfElement.getAttribute("type"); //$NON-NLS-1$
+		index = new File(selfElement.getAttribute("index")); //$NON-NLS-1$
+		name = selfElement.getAttribute("name"); //$NON-NLS-1$
+
+		// System.out.println("  build edition "+name);
+		NodeList pagesList = selfElement.getElementsByTagName("page"); //$NON-NLS-1$
+		numpages = pagesList.getLength();
+		for (int i = 0; i < numpages; i++) {
+			Element p = (Element) pagesList.item(i);
+			Page page = new Page(this, p);
+			pages.add(page);
+			keys.add(p.getAttribute("id")); //$NON-NLS-1$
+		}
+		loadMetadata();
+		return false;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#save()
+	 */
+	@Override
+	public boolean save() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	/**
+	 * The Class PageComparator.
+	 */
+	class PageComparator implements Comparator<Page> {
+
+		/* (non-Javadoc)
+		 * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+		 */
+		@Override
+		public int compare(Page arg0, Page arg1) {
+			return getInt(arg0.getWordId()) - getInt(arg1.getWordId());
+		}
+
+	}
+
+	/**
+	 * Gets the pages.
+	 *
+	 * @return the pages
+	 */
+	public ArrayList<Page> getPages() {
+		return this.pages;
+	}
+	
+	public Page get(String id)
+	{
+		int i = keys.indexOf(id);
+		if (i < 0) return null;
+		return pages.get(i);
+	}
+
+	/**
+	 * Gets the page.
+	 *
+	 * @param no the no
+	 * @return the page
+	 */
+	public Page getPage(int no) {
+		return pages.get(no);
+	}
+
+	/**
+	 * Gets the int.
+	 *
+	 * @param wordid the wordid
+	 * @return the int
+	 */
+	public static final Pattern findNumbersPattern = Pattern.compile("([0-9]+)"); //$NON-NLS-1$
+	private int getInt(String wordid) {
+		
+		int r = 0;
+		try {
+			Matcher m = findNumbersPattern.matcher(wordid);
+			while (m.find()) {
+				wordid = m.group(1);
+			}
+			r = Integer.parseInt(wordid);
+		} catch (PatternSyntaxException pse) { }
+		return r;
+	}
+
+	/**
+	 * Gets the page for word id.
+	 *
+	 * @param idx the idx
+	 * @return the page for word id
+	 */
+	public Page getPageForWordId(String idx) {
+		Log.info("Page.getPageForWordId(): "+idx);
+		Page lastpage = null;
+		for (Page p : pages) {
+			String s = p.getWordId();
+			Log.info(p.name+": "+s+" >? "+idx);
+//			if (getInt(s) > getInt(idx)) {
+			if (isFirstGTthanSecond(s, idx) > 0) {
+				Log.info("page found: "+lastpage);
+				return lastpage;
+			}
+
+			lastpage = p;
+		}
+		return lastpage;
+	}
+
+	private static int isFirstGTthanSecond(String s, String idx) {
+		Matcher m1 = findNumbersPattern.matcher(s);
+		Matcher m2 = findNumbersPattern.matcher(idx);
+		
+		boolean m1ok = m1.find();
+		boolean m2ok = m2.find();
+		
+		//boolean c = true;
+		while (true) {
+			if (m1ok && m2ok) {
+				int i1 = Integer.parseInt(m1.group(1));
+				int i2 = Integer.parseInt(m2.group(1));
+				if (i1 - i2 != 0) return i1 -i2;
+				
+				m1ok = m1.find();
+				m2ok = m2.find();
+			} else if (m1ok) {
+				return 1;
+			} else if (m2ok) {
+				return 1;
+			} else {
+				return 0;
+			}
+		}
+	}
+
+	/**
+	 * Gets the index.
+	 *
+	 * @return the index
+	 */
+	public File getIndex() {
+		return index;
+	}
+
+	// Navigation
+	/**
+	 * Gets the first page.
+	 *
+	 * @return the first page
+	 */
+	public Page getFirstPage() {
+		if (pages.size() > 0)
+			return pages.get(0);
+		return null;
+	}
+
+	/**
+	 * Gets the last page.
+	 *
+	 * @return the last page
+	 */
+	public Page getLastPage() {
+		if (pages.size() > 0)
+			return pages.get(pages.size() - 1);
+		return null;
+	}
+
+	/**
+	 * Gets the next page.
+	 *
+	 * @param p the p
+	 * @return the next page
+	 */
+	public Page getNextPage(Page p) {
+		int idx = pages.indexOf(p);
+		if (idx < pages.size() - 1)
+			return pages.get(idx + 1);
+		return p;
+	}
+
+	/**
+	 * Gets the previous page.
+	 *
+	 * @param p the p
+	 * @return the previous page
+	 */
+	public Page getPreviousPage(Page p) {
+		int idx = pages.indexOf(p);
+		if (idx > 0)
+			return pages.get(idx - 1);
+		return p;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#getChildren()
+	 */
+	public List<TxmObject> getChildren() {
+		List<TxmObject> rez = new ArrayList<TxmObject>();
+		rez.addAll(this.getPages());
+		return rez;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#removeChildren(org.txm.objects.TxmObject)
+	 */
+	public TxmObject removeChildren(TxmObject o) {
+		if (o == null)
+			return null;
+		if (o instanceof Page) {
+			selfElement.removeChild(o.selfElement);
+			if (pages.remove(o))
+				return o;
+			else
+				return null;
+		}
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#hasChildren(org.txm.objects.TxmObject)
+	 */
+	public boolean hasChildren(TxmObject o) {
+		if (o == null)
+			return false;
+		if (o instanceof Page)
+			return pages.contains(o);
+		return false;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#getParent()
+	 */
+	@Override
+	public TxmObject getParent() {
+		return getText();
+	}
+
+	public File getHtmlDir() {
+		if (defaultHtmlDir == null) {
+			String corpusname = getText().getCorpus().getName();
+			File binDir = getText().getCorpus().getBase().params.paramFile.getParentFile();
+			defaultHtmlDir = new File(binDir, "HTML/"+corpusname+"/"+getName()); //$NON-NLS-1$ //$NON-NLS-2$
+		}
+		return defaultHtmlDir;
+	}
+
+	/* (non-Javadoc)
+	 * @see java.lang.Object#toString()
+	 */
+	@Override
+	public String toString() {
+		return "Edition [type=" + type + ", index=" + index + ", \npages=" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+				+ pages + ", \nkeys=" + keys + ", \nnumpages=" + numpages //$NON-NLS-1$ //$NON-NLS-2$
+				+ "]"; //$NON-NLS-1$
+	}
+	
+	public static void main(String[] args) {
+		String[] strings = {"c_w_P1719_5_3", "c_w_P1719_5_6", "c_w_P1719_16_8", "c_w_P1719_32_3"};
+		for (String s1 : strings) {
+			for (String s2 : strings) {
+				System.out.println(s1+" - "+s2+" = "+Edition.isFirstGTthanSecond(s1, s2));
+			}
+		}
+	}
+
+	@Override
+	public String getSimpleName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public String getDetails() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public void clean() {
+		// TODO Auto-generated method stub
+		
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/objects/Edition.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/AbstractCqiServer.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/cqp/AbstractCqiServer.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/cqp/AbstractCqiServer.java	(revision 258)
@@ -0,0 +1,107 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2011-12-14 10:52:18 +0100 (mer., 14 déc. 2011) $
+// $LastChangedRevision: 2080 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+
+// TODO: Auto-generated Javadoc
+/**
+ * This class aims at handling a CQi server process. It is not a CQi server per
+ * se.
+ * 
+ * @author Jean-Philippe Magué
+ */
+public abstract class AbstractCqiServer implements ICqiServer {
+	
+	@Override
+	public abstract void setDebug(boolean val);
+
+	/**
+	 * Gets the last cmd line.
+	 *
+	 * @return the last cmd line
+	 */
+	public String getLastCmdLine() {
+		return ""; //$NON-NLS-1$
+	}
+
+	/**
+	 * Start.
+	 *
+	 * @return true, if successful
+	 */
+	@Override
+	public abstract Boolean start();
+	
+	/**
+	 * Convert stream to string.
+	 *
+	 * @param is the is
+	 * @return the string
+	 */
+	@Override
+	public abstract String convertStreamToString(InputStream is);
+	
+	/**
+	 * Stop the server.
+	 */
+	@Override
+	public abstract Boolean stop();
+
+	/**
+	 * Checks if the server is running.
+	 * 
+	 * @return true, if is running
+	 */
+	@Override
+	public abstract Boolean isRunning();
+
+	/**
+	 * Gets the error stream.
+	 *
+	 * @return the error stream
+	 */
+	@Override
+	public abstract InputStream getErrorStream();
+
+	/**
+	 * Gets the input stream.
+	 *
+	 * @return the input stream
+	 */
+	@Override
+	public abstract InputStream getInputStream();
+	/**
+	 * Gets the output stream.
+	 *
+	 * @return the output stream
+	 */
+	@Override
+	public abstract OutputStream getOutputStream();
+}
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/AbstractCqiServer.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/MemCqiClient.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/cqp/MemCqiClient.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/cqp/MemCqiClient.java	(revision 258)
@@ -0,0 +1,586 @@
+package org.txm.searchengine.cqp;
+
+import java.io.IOException;
+
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.searchengine.cqp.clientExceptions.UnexpectedAnswerException;
+import org.txm.searchengine.cqp.serverException.CqiClErrorCorpusAccess;
+import org.txm.searchengine.cqp.serverException.CqiClErrorInternal;
+import org.txm.searchengine.cqp.serverException.CqiClErrorNoSuchAttribute;
+import org.txm.searchengine.cqp.serverException.CqiClErrorOutOfMemory;
+import org.txm.searchengine.cqp.serverException.CqiClErrorOutOfRange;
+import org.txm.searchengine.cqp.serverException.CqiClErrorRegex;
+import org.txm.searchengine.cqp.serverException.CqiClErrorWrongAttributeType;
+import org.txm.searchengine.cqp.serverException.CqiCqpErrorErrorGeneral;
+import org.txm.searchengine.cqp.serverException.CqiCqpErrorInvalidField;
+import org.txm.searchengine.cqp.serverException.CqiCqpErrorNoSuchCorpus;
+import org.txm.searchengine.cqp.serverException.CqiCqpErrorOutOfRange;
+import org.txm.searchengine.cqp.serverException.CqiCqpErrorSyntax;
+import org.txm.searchengine.cqp.serverException.CqiErrorConnectRefused;
+import org.txm.searchengine.cqp.serverException.CqiErrorGeneralError;
+import org.txm.searchengine.cqp.serverException.CqiErrorSyntaxError;
+import org.txm.searchengine.cqp.serverException.CqiErrorUserAbort;
+import org.txm.searchengine.cqp.serverException.CqiServerError;
+import org.txm.utils.logger.Log;
+
+/**
+ * @author mdecorde
+ * Declares all the natives methods
+ */
+public class MemCqiClient extends AbstractCqiClient {
+
+	MemCqiServer server;
+
+	public MemCqiClient(MemCqiServer server) throws Exception {
+		super();
+		this.server= server;
+	}
+
+	public boolean start(String[] args) {
+		return true;
+	}
+
+	public void stop() {
+		server.stop();
+	}
+
+	public static final byte[] intToByteArray(int value) {
+		return new byte[] {
+				(byte)(value >>> 24),
+				(byte)(value >>> 16),
+				(byte)(value >>> 8),
+				(byte)value};
+	}
+
+
+	public byte[] throwExceptionFromCqi(int error) throws CqiServerError, UnexpectedAnswerException, IOException {
+		byte[] ret = intToByteArray(error);
+		
+		byte b = ret[2];
+		byte b2 = ret[3];
+		//System.out.println("bytes: "+ret[0]+" "+ret[1]+" "+ret[2]+" "+ret[3]);
+		//System.out.println("b1 "+b+ " b2 "+b2);
+		Log.finest(TXMCoreMessages.bind(TXMCoreMessages.READ_BYTE_FROM_CQI_SERVER, b));
+		switch (b) {
+		case 0x00:// cf cqi.h:29
+			return CQI_PADDING;
+		case 0x01:// cf cqi.h:37
+			Log.finest(TXMCoreMessages.bind(TXMCoreMessages.READ_BYTE_FROM_CQI_SERVER, b));
+			switch (b2) {
+			case 0x01:// cf cqi.h:39
+				return CQI_STATUS_OK;
+			case 0x02:// cf cqi.h:40
+				return CQI_STATUS_CONNECT_OK;
+			case 0x03:// cf cqi.h:41
+				return CQI_STATUS_BYE_OK;
+			case 0x04:// cf cqi.h:42
+				return CQI_STATUS_PING_OK;
+			default:
+				throw new CqiErrorGeneralError(TXMCoreMessages.MemCqiClient_3+b+TXMCoreMessages.MemCqiClient_9+b2); //$NON-NLS-2$
+			}
+		case 0x02:// cf cqi.h:45
+			Log.finest(TXMCoreMessages.bind(TXMCoreMessages.READ_BYTE_FROM_CQI_SERVER, b));
+
+			lastError = TXMCoreMessages.MemCqiClient_0+" CQI_ERROR ("+b+")";
+
+			switch (b2) {
+			case 0x01:// cf cqi.h:39
+				throw new CqiErrorGeneralError();
+			case 0x02:// cf cqi.h:40
+				throw new CqiErrorConnectRefused();
+			case 0x03:// cf cqi.h:41
+				throw new CqiErrorUserAbort();
+			case 0x04:// cf cqi.h:42
+				throw new CqiErrorSyntaxError();
+			default:
+				throw new CqiErrorGeneralError(TXMCoreMessages.MemCqiClient_5+b+TXMCoreMessages.MemCqiClient_9+b2); //$NON-NLS-2$
+			}
+		case 0x03:// cf cqi.h:53
+			Log.finest(TXMCoreMessages.bind(TXMCoreMessages.READ_BYTE_FROM_CQI_SERVER, b));
+			switch (b2) {
+			case 0x01:// cf cqi.h:39
+				return CQI_DATA_BYTE;
+			case 0x02:// cf cqi.h:40
+				return CQI_DATA_BOOL;
+			case 0x03:// cf cqi.h:41
+				return CQI_DATA_INT;
+			case 0x04:// cf cqi.h:42
+				return CQI_DATA_STRING;
+			case 0x05:// cf cqi.h:42
+				return CQI_DATA_BYTE_LIST;
+			case 0x06:// cf cqi.h:42
+				return CQI_DATA_BOOL_LIST;
+			case 0x07:// cf cqi.h:42
+				return CQI_DATA_INT_LIST;
+			case 0x08:// cf cqi.h:42
+				return CQI_DATA_STRING_LIST;
+			case 0x09:// cf cqi.h:42
+				return CQI_DATA_INT_INT;
+			case 0x0A:// cf cqi.h:42
+				return CQI_DATA_INT_INT_INT_INT;
+			case 0x0B:// cf cqi.h:42
+				return CQI_DATA_INT_TABLE;
+			default:
+				throw new CqiErrorGeneralError(TXMCoreMessages.MemCqiClient_7+b+TXMCoreMessages.MemCqiClient_9+b2); //$NON-NLS-2$
+			}
+		case 0x04:// cf cqi.h:67
+
+			lastError = TXMCoreMessages.MemCqiClient_1+"CL_ERROR ("+b+")";
+			Log.finest(TXMCoreMessages.bind(TXMCoreMessages.READ_BYTE_FROM_CQI_SERVER, b));
+			switch (b2) {
+			case 0x01:// cf cqi.h:39
+				lastError += ": NoSuchAttribute error";
+				throw new CqiClErrorNoSuchAttribute();
+			case 0x02:// cf cqi.h:40
+				lastError += ": WrongAttributeType error";
+				throw new CqiClErrorWrongAttributeType();
+			case 0x03:// cf cqi.h:41
+				lastError += ": OutOfRange error";
+				throw new CqiClErrorOutOfRange();
+			case 0x04:// cf cqi.h:42
+				lastError = this.getLastCqiError();
+				throw new CqiClErrorRegex();
+			case 0x05:// cf cqi.h:42
+				lastError += ": CorpusAccess error";
+				throw new CqiClErrorCorpusAccess();
+			case 0x06:// cf cqi.h:42
+				lastError += ": OutOfMemory error";
+				throw new CqiClErrorOutOfMemory();
+			case 0x07:// cf cqi.h:42
+				lastError += ": Internal error";
+				throw new CqiClErrorInternal();
+			default:
+				lastError += ": Unknown error";
+				throw new CqiErrorGeneralError(TXMCoreMessages.MemCqiClient_3+b+TXMCoreMessages.MemCqiClient_9+b2);
+			}
+
+		case 0x05:// cf cqi.h:94
+
+			lastError = TXMCoreMessages.MemCqiClient_2+"CQI_CQP_ERROR ("+b+")";
+			Log.finest(TXMCoreMessages.bind(TXMCoreMessages.READ_BYTE_FROM_CQI_SERVER, b));
+			switch (b2) {
+			case 0x01:// cf cqi.h:39
+				lastError += ": General error";
+				throw new CqiCqpErrorErrorGeneral();
+			case 0x02:// cf cqi.h:40
+				lastError += ": NoSuchCorpus error";
+				throw new CqiCqpErrorNoSuchCorpus();
+			case 0x03:// cf cqi.h:41
+				lastError += ": InvalidField error";
+				throw new CqiCqpErrorInvalidField();
+			case 0x04:// cf cqi.h:42
+				lastError += ": OutOfRange error";
+				throw new CqiCqpErrorOutOfRange();
+			case 0x05:// cf cqi.h:44
+				lastError = getLastCQPError();
+				throw new CqiCqpErrorSyntax();
+			default:
+				throw new CqiErrorGeneralError(TXMCoreMessages.MemCqiClient_3+b+TXMCoreMessages.MemCqiClient_9+b2);
+			}
+		default:
+			throw new CqiErrorGeneralError(TXMCoreMessages.MemCqiClient_10+b+TXMCoreMessages.MemCqiClient_9+b2);
+		}
+		//return null;
+	}
+
+	@Override
+	public int[] alg2Cpos(String arg0, int arg1) throws UnexpectedAnswerException, IOException, CqiServerError {
+		int[] rez = server.alg2Cpos(arg0, arg1);
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+
+	@Override
+	public int attributeSize(String arg0) throws IOException, UnexpectedAnswerException, CqiServerError {
+		Integer ret = server.attributeSize(arg0);
+		if (ret == null || ret == -1) {
+			throwExceptionFromCqi(server.getErrorCode());
+			// throw exception
+		}
+		return ret;
+	}
+
+	@Override
+	public boolean connect(String arg0, String arg1) { return server.isLoaded;} ;
+
+	@Override
+	public String[] corpusAlignementAttributes(String arg0) throws UnexpectedAnswerException, IOException, CqiServerError {
+		String[] rez = server.corpusAlignementAttributes(arg0);
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+
+	@Override
+	public String corpusCharset(String arg0) throws UnexpectedAnswerException, IOException, CqiServerError {
+		String rez = server.corpusCharset(arg0);
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+
+	@Override
+	public String corpusFullName(String arg0) throws UnexpectedAnswerException, IOException, CqiServerError {
+		String rez = server.corpusFullName(arg0);
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+
+	@Override
+	public String[] corpusInfo(String arg0) throws UnexpectedAnswerException, IOException, CqiServerError {
+		throw new UnsupportedOperationException();
+		/*String[] rez = server.corpusInfo(arg0);
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+		 */
+	}
+
+	@Override
+	public String[] corpusPositionalAttributes(String arg0) throws UnexpectedAnswerException, IOException, CqiServerError {
+		String[] rez = server.corpusPositionalAttributes(arg0);
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+
+	@Override
+	public String[] corpusProperties(String arg0) throws UnexpectedAnswerException, IOException, CqiServerError {
+		String[] rez = server.corpusProperties(arg0);
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+
+	@Override
+	public boolean corpusStructuralAttributeHasValues(String arg0) throws UnexpectedAnswerException, IOException, CqiServerError {
+		Boolean rez = server.corpusStructuralAttributeHasValues(arg0);
+		if (rez == null || !rez) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+
+	@Override
+	public String[] corpusStructuralAttributes(String arg0) throws UnexpectedAnswerException, IOException, CqiServerError {
+		String[] rez = server.corpusStructuralAttributes(arg0);
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+
+	@Override
+	public int[] cpos2Alg(String arg0, int[] arg1) throws UnexpectedAnswerException, IOException, CqiServerError {
+		int[] rez = server.cpos2Alg(arg0, arg1);
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+
+	@Override
+	public int[] cpos2Id(String arg0, int[] arg1) throws UnexpectedAnswerException, IOException, CqiServerError {
+		int[] rez = server.cpos2Id(arg0, arg1);
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+
+	@Override
+	public int[] cpos2LBound(String arg0, int[] arg1) throws UnexpectedAnswerException, IOException, CqiServerError {
+		int[] rez = server.cpos2LBound(arg0, arg1);
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+
+	@Override
+	public int[] cpos2RBound(String arg0, int[] arg1) throws UnexpectedAnswerException, IOException, CqiServerError {
+		int[] rez = server.cpos2RBound(arg0, arg1);
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+
+	@Override
+	public String[] cpos2Str(String arg0, int[] arg1) throws UnexpectedAnswerException, IOException, CqiServerError {
+		String[] rez = server.cpos2Str(arg0, arg1);
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+
+	@Override
+	public int[] cpos2Struc(String arg0, int[] arg1) throws UnexpectedAnswerException, IOException, CqiServerError {
+		int[] rez = server.cpos2Struc(arg0, arg1);
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+
+	@Override
+	public void cqpQuery(String arg0, String arg1, String arg2)
+			throws IOException, UnexpectedAnswerException, CqiServerError {
+		Boolean ret = server.cqpQuery(arg0, arg1, arg2);
+		//System.out.println("CQPSERVER return: "+ret);
+		if(ret == null || !ret) {
+			int e = server.getErrorCode();
+			//System.out.println("throw exception with cqp error code: "+e);
+			throwExceptionFromCqi(e);
+		}
+	}
+
+	public void query(String arg0)
+			throws IOException, UnexpectedAnswerException, CqiServerError {
+		Boolean ret = server.query(arg0);
+		if(ret == null || !ret) {
+			System.out.println(TXMCoreMessages.MemCqiClient_11);
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+	}
+
+	@Override
+	public boolean disconnect() { return true; };
+
+	@Override
+	public void dropAttribute(String arg0) throws IOException, UnexpectedAnswerException, CqiServerError {
+		throw new UnsupportedOperationException();
+		//		Boolean ret = server.dropAttribute(arg0);
+		//		if(ret == null || !ret) {
+		//			throwExceptionFromCqi(server.getErrorCode());
+		//		}
+	}
+
+	@Override
+	public void dropCorpus(String arg0) throws Exception {
+		Boolean ret = server.dropCorpus(arg0);
+		if(ret == null || !ret) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+	}
+
+	@Override
+	public void dropSubCorpus(String arg0) throws IOException, UnexpectedAnswerException, CqiServerError {
+		Boolean ret = server.dropSubCorpus(arg0);
+		if (ret == null || !ret) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+	}
+
+	@Override
+	public int[] dumpSubCorpus(String arg0, byte arg1, int arg2, int arg3)
+			throws IOException, UnexpectedAnswerException, CqiServerError {
+		int[] rez = server.dumpSubCorpus(arg0, arg1, arg2, arg3);
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+
+	@Override
+	public int[][] fdist1(String arg0, int arg1, byte arg2, String arg3)
+			throws IOException, UnexpectedAnswerException, CqiServerError {
+		int[] all = nfdist1(arg0, arg1, arg2, arg3);
+		if (all == null) {
+			return new int[0][0];
+		}
+		int[][] freqs = new int[all.length / 2][2];
+		int c = 0;
+		for (int i = 0 ; i < freqs.length ;i++) {
+			freqs[i][0] = all[c++];
+			freqs[i][1] = all[c++];
+		}
+		return freqs;
+
+	}
+
+	public int[] nfdist1(String arg0, int arg1, byte arg2, String arg3)
+			throws IOException, UnexpectedAnswerException, CqiServerError {
+		int[] rez = server.nfdist1(arg0, arg1, arg2, arg3);
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+
+	@Override
+	public int[][] fdist2(String arg0, int arg1, byte arg2, String arg3,
+			byte arg4, String arg5) throws IOException,
+			UnexpectedAnswerException, CqiServerError {
+		int[] all = nfdist2(arg0, arg1, arg2, arg3, arg4, arg5);
+		if (all == null) {
+			return new int[0][0];
+		}
+		int[][] freqs = new int[all.length / 2][3];
+		int c = 0;
+		for (int i = 0 ; i < freqs.length ;i++) {
+			freqs[i][0] = all[c++];
+			freqs[i][1] = all[c++];
+			freqs[i][2] = all[c++];
+		}
+		return freqs;
+	}
+
+	public int[] nfdist2(String arg0, int arg1, byte arg2, String arg3,
+			byte arg4, String arg5) throws IOException, UnexpectedAnswerException, CqiServerError {
+		int[] rez = server.nfdist2(arg0, arg1, arg2, arg3, arg4, arg5);
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+
+	@Override
+	public String getLastCQPError() throws UnexpectedAnswerException, IOException,	CqiServerError {
+		String rez = server.getLastCQPError();
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+
+	@Override
+	public String getLastCqiError() throws UnexpectedAnswerException, IOException, CqiServerError {
+		String rez = server.getLastCqiError();
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+
+	@Override
+	public int[] id2Cpos(String arg0, int arg1) throws UnexpectedAnswerException, IOException, CqiServerError {
+		int[] rez = server.id2Cpos(arg0, arg1);
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+
+	@Override
+	public int[] id2Freq(String arg0, int[] arg1) throws UnexpectedAnswerException, IOException, CqiServerError {
+		int[] rez = server.id2Freq(arg0, arg1);
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+
+	@Override
+	public String[] id2Str(String arg0, int[] arg1) throws UnexpectedAnswerException, IOException, CqiServerError {
+		String[] rez = server.id2Str(arg0, arg1);
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+
+	@Override
+	public int[] idList2Cpos(String arg0, int[] arg1) throws UnexpectedAnswerException, IOException, CqiServerError {
+		int[] rez = server.idList2Cpos(arg0, arg1);
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+
+	@Override
+	public int lexiconSize(String arg0) throws IOException, UnexpectedAnswerException, CqiServerError {
+		Integer rez = server.lexiconSize(arg0);
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+
+	@Override
+	public String[] listCorpora() throws UnexpectedAnswerException, IOException, CqiServerError {
+		String[] rez = server.listCorpora();
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+
+	@Override
+	public String[] listSubcorpora(String arg0) throws UnexpectedAnswerException, IOException, CqiServerError {
+		String[] rez = server.listSubcorpora(arg0);
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+
+	@Override
+	public boolean reconnect() { return true; } ;
+
+	@Override
+	public int[] regex2Id(String arg0, String arg1) throws UnexpectedAnswerException, IOException, CqiServerError {
+		int[] rez = server.regex2Id(arg0, arg1);
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+
+	@Override
+	public int[] str2Id(String arg0, String[] arg1) throws IOException, UnexpectedAnswerException, CqiServerError {
+		int[] rez = server.str2Id(arg0, arg1);
+		if (rez == null) {
+			//System.out.println("error: "+server.getErrorCode());
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+
+	@Override
+	public int[] struc2Cpos(String arg0, int arg1) throws UnexpectedAnswerException, IOException, CqiServerError {
+		int[] rez = server.struc2Cpos(arg0, arg1);
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+
+	@Override
+	public String[] struc2Str(String arg0, int[] arg1) throws UnexpectedAnswerException, IOException, CqiServerError {
+		String[] rez = server.struc2Str(arg0, arg1);
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+
+	@Override
+	public boolean subCorpusHasField(String arg0, byte arg1) throws IOException, UnexpectedAnswerException, CqiServerError {
+		Boolean rez = server.subCorpusHasField(arg0, arg1);
+		if (rez == null || !rez) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+
+	@Override
+	public int subCorpusSize(String arg0) throws IOException, UnexpectedAnswerException, CqiServerError {
+		Integer rez = server.subCorpusSize(arg0);
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/MemCqiClient.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/NetCqiServer.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/cqp/NetCqiServer.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/cqp/NetCqiServer.java	(revision 258)
@@ -0,0 +1,351 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-09-05 09:27:13 +0200 (jeu., 05 sept. 2013) $
+// $LastChangedRevision: 2529 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+
+import org.apache.commons.lang.ArrayUtils;
+import org.apache.commons.lang.StringUtils;
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.searchengine.cqp.clientExceptions.ServerNotFoundException;
+import org.txm.searchengine.cqp.clientExceptions.UnexpectedAnswerException;
+import org.txm.searchengine.cqp.serverException.CqiServerError;
+import org.txm.utils.logger.Log;
+
+// TODO: Auto-generated Javadoc
+/**
+ * This class aims at handling a CQi server process. It is not a CQi server per
+ * se.
+ * 
+ * @author Jean-Philippe Magué
+ */
+public class NetCqiServer extends AbstractCqiServer {
+
+	/** The cmd line. */
+	String[] cmdLine;
+
+	/**
+	 * Gets the last cmd line.
+	 *
+	 * @return the last cmd line
+	 */
+	@Override
+	public String getLastCmdLine() {
+		return StringUtils.join(cmdLine, " "); //$NON-NLS-1$
+	}
+
+	/** The additional options. */
+	String additionalOptions;
+
+	public boolean debug = false;
+	
+	/** The monitor output. */
+	boolean monitorOutput;
+	
+	/** The path to executable. */
+	String pathToExecutable;
+	
+	/** The path to init file. */
+	String pathToInitFile;
+	
+	/** The path to registry. */
+	String pathToRegistry;
+
+	/** The process. */
+	private Process process;
+	/**
+	 * Instantiates a new CQi server.
+	 * 
+	 * @param pathToExecutable
+	 *            the path to the executable
+	 * @param pathToRegistry
+	 *            the path to the registry
+	 * @param pathToInitFile
+	 *            the path to the init file
+	 * 
+	 * @throws ServerNotFoundException
+	 *             the server not found exception
+	 */
+	public NetCqiServer(String pathToExecutable, String pathToRegistry,
+			String pathToInitFile) throws ServerNotFoundException {
+		this(pathToExecutable, pathToRegistry, pathToInitFile, ""); //$NON-NLS-1$
+	}
+	/**
+	 ** Instantiates a new CQi server.
+	 * 
+	 * @param pathToExecutable
+	 *            the path to the executable
+	 * @param pathToRegistry
+	 *            the path to the registry
+	 * @param pathToInitFile
+	 *            the path to the init file
+	 * @param additionalOptions
+	 *            the additional command line options
+	 * 
+	 * @throws ServerNotFoundException
+	 *             the server not found exception
+	 */
+	public NetCqiServer(String pathToExecutable, String pathToRegistry,
+			String pathToInitFile, String additionalOptions)
+			throws ServerNotFoundException {
+		this(pathToExecutable, pathToRegistry, pathToInitFile,
+				additionalOptions, false);
+	}
+
+	/**
+	 * Instantiates a new cqi server.
+	 *
+	 * @param pathToExecutable the path to executable
+	 * @param pathToRegistry the path to registry
+	 * @param pathToInitFile the path to init file
+	 * @param additionalOptions the additional options
+	 * @param monitorOutput the monitor output
+	 */
+	public NetCqiServer(String pathToExecutable, String pathToRegistry,
+			String pathToInitFile, String additionalOptions,
+			boolean monitorOutput) {
+
+		this.pathToExecutable = pathToExecutable;
+		this.pathToRegistry = pathToRegistry;
+		this.pathToInitFile = pathToInitFile;
+		this.additionalOptions = additionalOptions;
+		this.monitorOutput = monitorOutput;
+	}
+
+	/**
+	 * Convert stream to string.
+	 *
+	 * @param is the is
+	 * @return the string
+	 */
+	@Override
+	public String convertStreamToString(InputStream is) {
+		BufferedReader reader = new BufferedReader(new InputStreamReader(is));
+		StringBuilder sb = new StringBuilder();
+
+		String line = null;
+		try {
+			while ((line = reader.readLine()) != null) {
+				sb.append(line);
+			}
+		} catch (IOException e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+		} finally {
+			try {
+				is.close();
+			} catch (IOException e) {
+				org.txm.utils.logger.Log.printStackTrace(e);
+			}
+		}
+
+		return sb.toString();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Object#finalize()
+	 */
+	@Override
+	protected void finalize() throws Throwable {
+		try {
+			this.stop();
+		} finally {
+			super.finalize();
+		}
+	}
+	
+	/**
+	 * Gets the error stream.
+	 *
+	 * @return the error stream
+	 */
+	@Override
+	public InputStream getErrorStream() {
+		return process.getErrorStream();
+	}
+
+	/**
+	 * Gets the input stream.
+	 *
+	 * @return the input stream
+	 */
+	@Override
+	public InputStream getInputStream() {
+		return process.getInputStream();
+	}
+
+	/**
+	 * Gets the output stream.
+	 *
+	 * @return the output stream
+	 */
+	@Override
+	public OutputStream getOutputStream() {
+		return process.getOutputStream();
+	}
+
+	/**
+	 * Checks if the server is running.
+	 * 
+	 * @return true, if is running
+	 */
+	@Override
+	public Boolean isRunning() {
+		try {
+			this.process.exitValue();// this throws an
+										// IllegalThreadStateException if te
+										// process is running
+			// The IllegalThreadStateException has not been thrown, the process
+			// is not running.
+			return false;
+		} catch (IllegalThreadStateException e) {
+			// The IllegalThreadStateException has been thrown, all good.
+			return true;
+		}
+	}
+
+	@Override
+	public void setDebug(boolean val)
+	{
+		debug = val;
+	}
+
+	/**
+	 * Start.
+	 *
+	 * @return true, if successful
+	 */
+	@Override
+	public Boolean start() {
+		String[] cmd = { pathToExecutable, "-I", pathToInitFile, "-r", pathToRegistry }; //$NON-NLS-1$ //$NON-NLS-2$
+		cmdLine = (String[]) ArrayUtils.addAll(cmd, additionalOptions.trim().split(" ")); //$NON-NLS-1$
+		
+		try {
+//			System.out.println(Messages.bind(Messages.STARTING_SERVER,
+//					StringUtils.join(cmdLine, " "))); //$NON-NLS-1$
+			ProcessBuilder processBuilder = new ProcessBuilder(cmdLine);
+			processBuilder.redirectErrorStream(true);
+			this.process = processBuilder.start();
+			
+			final InputStream stdout = this.process.getInputStream();
+			final InputStream stderr = this.process.getErrorStream();
+			
+			Thread t1 = new Thread(){
+				  @Override
+				public void run()
+				  {InputStreamReader isr = new InputStreamReader(stdout);
+					  BufferedReader br = new BufferedReader(isr);
+						String line = null;
+						try {
+							while ((line = br.readLine()) != null) {
+								if(debug)
+									System.out.println(TXMCoreMessages.NetCqiServer_0+line);
+							}
+						} catch (IOException e) {
+							// TODO Auto-generated catch block
+							Log.warning(Log.toString(e));
+						}
+				  }
+			};
+			t1.start();
+			
+			Thread t2 = new Thread(){
+				  @Override
+				public void run()
+				  {
+					  InputStreamReader isr = new InputStreamReader(stderr);
+					  BufferedReader br = new BufferedReader(isr);
+						String line = null;
+						try {
+							while ((line = br.readLine()) != null) {
+								if(debug)
+									System.out.println(TXMCoreMessages.NetCqiServer_1+line);
+							}
+						} catch (IOException e) {
+							// TODO Auto-generated catch block
+							org.txm.utils.logger.Log.printStackTrace(e);
+						}
+				  }
+			};
+			t2.start();
+
+			return isRunning();
+		} catch (IOException e) {
+			// System.err.println("CQP server failed to start with the following command line: "
+			// + StringUtils.join(cmd, " "));
+		}
+		return false;
+	}
+
+	/**
+	 * Stop the server.
+	 */
+	@Override
+	public Boolean stop() {
+		Log.finest(TXMCoreMessages.STOPING_SERVER);
+
+		try {
+			process.destroy();
+			process.waitFor();			
+		} catch (Exception e) {
+			Log.finest(Log.toString(e));
+			return false;
+		}
+		Log.finest(TXMCoreMessages.SERVER_STOPED);
+		return true;
+	}
+
+	public static void main(String args[]) {
+		try {
+			NetCqiServer server = new NetCqiServer("C:\\Program files\\TXM\\cwb\\bin\\cqpserver", "C:\\Documents and Settings\\mdecorde\\TXM\\registry", "C:\\Program files\\TXM\\cwb\\cqpserver.init", "-b 1000000 -d OFF -P 4877"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+			System.out.println(server.start());
+			
+			
+			NetCqiClient client = new NetCqiClient("localhost", 4877); //$NON-NLS-1$
+			System.out.println(client.connect("", "")); //$NON-NLS-1$ //$NON-NLS-2$
+			server.stop();
+		} catch (ServerNotFoundException e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		} catch (UnexpectedAnswerException e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		} catch (IOException e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		} catch (CqiServerError e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/NetCqiServer.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/Alignement.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/Alignement.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/Alignement.java	(revision 258)
@@ -0,0 +1,272 @@
+package org.txm.searchengine.cqp.corpus;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+
+import org.txm.Toolbox;
+import org.txm.objects.Edition;
+import org.txm.objects.Page;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.clientExceptions.InvalidCqpIdException;
+import org.txm.searchengine.cqp.corpus.query.Match;
+import org.txm.searchengine.cqp.corpus.query.Query;
+import org.txm.searchengine.cqp.serverException.CqiServerError;
+
+public class Alignement {
+	protected String from;
+	protected String to;
+	protected String struct;
+	protected int level;
+
+	public Alignement(String from , String to, String struct, int level)
+	{
+		this.from = from;
+		this.to = to;
+		this.struct = struct;
+		this.level = level;
+		if(level > 1)
+			this.struct = this.struct + level;
+	}
+
+	public Alignement(String from , String to)
+	{
+		this(from, to, "w", 1);
+	}
+
+	public Alignement(String from, String to, String struct)
+	{
+		this(from, to, struct, 1);
+	}
+
+	/**
+	 * 
+	 * @param wordid
+	 * @param txtid
+	 * @return the word id and text id of the [to] corpus.
+	 * @throws CqiClientException
+	 * @throws InvalidCqpIdException
+	 * @throws IOException
+	 * @throws CqiServerError
+	 */
+	public List<String> resolve(String wordid, String textid) throws CqiClientException, InvalidCqpIdException, IOException, CqiServerError
+	{
+		System.out.println("resolve "+wordid+" "+textid+" "+struct);
+		Corpus src = CorpusManager.getCorpusManager().getCorpus(from);
+		StructuralUnitProperty align_src = src.getStructuralUnit(struct).getProperty("align");
+		
+		Corpus dest = CorpusManager.getCorpusManager().getCorpus(to);
+		Property id_dest = dest.getProperty("id");
+		StructuralUnitProperty text_dest = dest.getStructuralUnit("text").getProperty("id");
+
+		if (struct.equals("w"))
+		{
+			QueryResult rez = src.query(new Query("[_.text_id=\""+textid+"\" & id=\""+wordid+"\"]"), "Align", false);
+			int[] position = {rez.getMatch(0).getStart()};
+			int[] struct_align_pos = Toolbox.getCqiClient().cpos2Struc(align_src.getQualifiedName(), position);
+			String[] struct_align_str = Toolbox.getCqiClient().struc2Str(align_src.getQualifiedName(), struct_align_pos);
+			if(struct_align_str.length > 0)
+			{
+				String aligned_struct = struct_align_str[0]; // the struct align value
+				// get the position of the first token of this struct
+				QueryResult rez2 = dest.query(new Query("<"+struct+"_align=\""+aligned_struct+"\">[]"), "Align", false);
+				int[] position2 = {rez2.getMatch(0).getStart()};
+				// get the id of this position
+				int[] struct_text_pos = Toolbox.getCqiClient().cpos2Struc(text_dest.getQualifiedName(), position2);
+				String[] struct_text_str = Toolbox.getCqiClient().struc2Str(text_dest.getQualifiedName(), struct_text_pos);
+				return Arrays.asList(wordid, struct_text_str[0]);
+			}
+			else
+			{
+				return null;
+			}
+		}
+		else
+		{
+			//get the position for the word id and the text
+			String query = "[_.text_id=\""+textid+"\" & id=\""+wordid+"\"]";
+			//System.out.println("query: "+query);
+			QueryResult rez = src.query(new Query(query), "Align", false);
+			//System.out.println(rez.getMatches());
+			int[] position = {rez.getMatch(0).getStart()};
+			//get the struct@align value for this position
+			int[] struct_align_pos = Toolbox.getCqiClient().cpos2Struc(align_src.getQualifiedName(), position);
+			String[] struct_align_str = Toolbox.getCqiClient().struc2Str(align_src.getQualifiedName(), struct_align_pos);
+			if(struct_align_str.length > 0)
+			{
+				String aligned_struct = struct_align_str[0]; // the struct align value
+				// get the position of the first token of this struct
+				query = "<"+struct+"_align=\""+aligned_struct+"\">[]";
+				QueryResult rez2 = dest.query(new Query(query), "Align", false);
+				int[] position2 = {rez2.getMatch(0).getStart()};
+				// get the id of this position
+				String[] ids = Toolbox.getCqiClient().cpos2Str(id_dest.getQualifiedName(), position2);
+
+				if(ids.length > 0)
+				{
+					int[] struct_text_pos = Toolbox.getCqiClient().cpos2Struc(text_dest.getQualifiedName(), position2);
+					String[] struct_text_str = Toolbox.getCqiClient().struc2Str(text_dest.getQualifiedName(), struct_text_pos);
+					return Arrays.asList(ids[0], struct_text_str[0]);
+				}
+				else
+					return null;
+			}
+			else
+			{
+				return null;
+			}
+		}
+	}
+
+	public List<String> resolve(Page p) throws CqiClientException, InvalidCqpIdException, IOException, CqiServerError
+	{	
+		System.out.println("resolve "+p);
+		return resolve(p.getWordId(), p.getEdition().getText().getName());
+	}
+	
+	public List<String> resolve(Match match) throws IOException, CqiServerError, CqiClientException, InvalidCqpIdException
+	{
+		return resolve(match.getStart());
+	} 
+	
+	/**
+	 * resolve alignemnt by a position:
+	 * 1) get seg
+	 * 2) resolve seg
+	 * @param idx
+	 * @return
+	 * @throws IOException
+	 * @throws CqiServerError
+	 * @throws CqiClientException
+	 * @throws InvalidCqpIdException
+	 */
+	public List<String> resolve(int idx) throws IOException, CqiServerError, CqiClientException, InvalidCqpIdException
+	{
+		Corpus src = CorpusManager.getCorpusManager().getCorpus(from);
+		StructuralUnitProperty align_src = src.getStructuralUnit(struct).getProperty("align");
+		int[] position = {idx};
+		int[] struct_align_pos = Toolbox.getCqiClient().cpos2Struc(align_src.getQualifiedName(), position);
+		String[] struct_align_str = Toolbox.getCqiClient().struc2Str(align_src.getQualifiedName(), struct_align_pos);
+		if (struct_align_str.length > 0) {
+			return resolveSeg(struct_align_str[0]);
+		}
+		return null;
+	}
+
+
+	public List<String> resolveSeg(String seg_id) throws IOException, CqiServerError, CqiClientException, InvalidCqpIdException
+	{
+		System.out.println("resolve seg "+seg_id);
+		Corpus dest = CorpusManager.getCorpusManager().getCorpus(to);
+		String query = "<"+struct+"_align=\""+seg_id+"\">[]";
+		//System.out.println("query: "+query);
+		QueryResult rez = dest.query(new Query(query), "Align", false);
+		//System.out.println("rez: "+rez.getMatches());
+		int[] position = {rez.getMatch(0).getStart()};
+
+		Property id_dest = dest.getProperty("id");
+		String[] ids = Toolbox.getCqiClient().cpos2Str(id_dest.getQualifiedName(), position);
+		String wordid = ids[0];
+
+		StructuralUnitProperty text_dest = dest.getStructuralUnit("text").getProperty("id");
+		int[] struct_text_pos = Toolbox.getCqiClient().cpos2Struc(text_dest.getQualifiedName(), position);
+		String[] struct_text_str = Toolbox.getCqiClient().struc2Str(text_dest.getQualifiedName(), struct_text_pos);
+		String textid = struct_text_str[0];
+		
+		return Arrays.asList(wordid, textid);
+	}
+
+	public Page getPage(String edition, String wordid, String txtid) throws CqiClientException, InvalidCqpIdException
+	{
+		System.out.println("get edition: from "+to+" : "+edition+" "+wordid+" "+txtid);
+		Corpus dest = CorpusManager.getCorpusManager().getCorpus(to);
+		Edition ed = dest.getText(txtid).getEdition(edition);
+		if(ed == null)
+			ed = dest.getText(txtid).getEdition("default");
+		
+		return ed.getPageForWordId(wordid);
+	}
+
+	/* (non-Javadoc)
+	 * @see java.lang.Object#hashCode()
+	 */
+	@Override
+	public int hashCode() {
+		final int prime = 31;
+		int result = 1;
+		result = prime * result + ((from == null) ? 0 : from.hashCode());
+		result = prime * result + level;
+		result = prime * result + ((struct == null) ? 0 : struct.hashCode());
+		result = prime * result + ((to == null) ? 0 : to.hashCode());
+		return result;
+	}
+
+	/* (non-Javadoc)
+	 * @see java.lang.Object#equals(java.lang.Object)
+	 */
+	@Override
+	public boolean equals(Object obj) {
+		if (this == obj)
+			return true;
+		if (obj == null)
+			return false;
+		if (getClass() != obj.getClass())
+			return false;
+		Alignement other = (Alignement) obj;
+		if (from == null) {
+			if (other.from != null)
+				return false;
+		} else if (!from.equals(other.from))
+			return false;
+		if (level != other.level)
+			return false;
+		if (struct == null) {
+			if (other.struct != null)
+				return false;
+		} else if (!struct.equals(other.struct))
+			return false;
+		if (to == null) {
+			if (other.to != null)
+				return false;
+		} else if (!to.equals(other.to))
+			return false;
+		return true;
+	}
+
+	/* (non-Javadoc)
+	 * @see java.lang.Object#toString()
+	 */
+	@Override
+	public String toString() {
+		return "Alignement [from=" + from + ", to=" + to + ", struct=" + struct
+				+ ", level=" + level + "]";
+	}
+
+	/**
+	 * @return the from
+	 */
+	public String getFrom() {
+		return from;
+	}
+
+	/**
+	 * @return the to
+	 */
+	public String getTo() {
+		return to;
+	}
+
+	/**
+	 * @return the struct
+	 */
+	public String getStruct() {
+		return struct;
+	}
+
+	/**
+	 * @return the level
+	 */
+	public int getLevel() {
+		return level;
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/Alignement.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/Property.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/Property.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/Property.java	(revision 258)
@@ -0,0 +1,115 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.corpus;
+
+// TODO: Auto-generated Javadoc
+/**
+ * A Property on the lexical units the corpus. Represents a
+ * <strong>type</strong>, not a the value for a specif ic unit.
+ * 
+ * @author Jean-Philippe Magué
+ */
+public class Property implements Comparable{
+
+	/** The name. */
+	private String name;
+
+	/** The corpus. */
+	private Corpus corpus;
+
+	/**
+	 * Instantiates a new property.
+	 * 
+	 * Not intended to be used directly. See {@link Corpus#getProperty(String)}
+	 * 
+	 * @param name
+	 *            the name
+	 * @param corpus
+	 *            the corpus
+	 */
+	protected Property(String name, Corpus corpus) {
+		this.name = name;
+		this.corpus = corpus;
+	}
+
+	/**
+	 * Gets the qualified name.
+	 * 
+	 * @return the qualified name
+	 */
+	public String getQualifiedName() {
+		return corpus.getCqpId() + "." + this.getName(); //$NON-NLS-1$
+	}
+
+	/**
+	 * Gets the name.
+	 * 
+	 * @return the name
+	 */
+	public String getName() {
+		return name;
+	}
+
+	/**
+	 * Gets the corpus over which the property is defined.
+	 * 
+	 * @return the name
+	 */
+	public Corpus getCorpus() {
+		return corpus;
+	}
+
+	/* (non-Javadoc)
+	 * @see java.lang.Object#toString()
+	 */
+	@Override
+	public String toString() {
+		return name;
+	}
+
+	/**
+	 * Equals.
+	 *
+	 * @param p the p
+	 * @return true, if successful
+	 */
+	public boolean equals(Property p) {
+		return name.equals(p.getQualifiedName())
+				&& corpus.equals(p.getQualifiedName());
+	}
+
+	/* (non-Javadoc)
+	 * @see java.lang.Comparable#compareTo(java.lang.Object)
+	 */
+	@Override
+	public int compareTo(Object arg0) {
+		if (arg0 instanceof Property)
+			return this.name.compareTo(((Property)arg0).name);
+		return 0;
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/Property.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/QueryResult.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/QueryResult.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/QueryResult.java	(revision 258)
@@ -0,0 +1,385 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2016-03-01 10:10:58 +0100 (Tue, 01 Mar 2016) $
+// $LastChangedRevision: 3133 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.corpus;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.searchengine.cqp.AbstractCqiClient;
+import org.txm.searchengine.cqp.NetCqiClient;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.clientExceptions.InvalidCqpIdException;
+import org.txm.searchengine.cqp.clientExceptions.UnexpectedAnswerException;
+import org.txm.searchengine.cqp.corpus.query.Match;
+import org.txm.searchengine.cqp.corpus.query.Query;
+import org.txm.searchengine.cqp.serverException.CqiServerError;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The result of a CQP query on a corpus.
+ * 
+ * @author jmague
+ */
+public class QueryResult implements CqpObject {
+
+	/** The cqp id. */
+	protected String cqpId;
+
+	/** The name. */
+	protected String name;
+
+	/** The size. */
+	protected int size = -1;
+	int[] starts;
+	int[] ends;
+	int[] targets;
+
+	/** The mother main corpus. */
+	protected MainCorpus motherMainCorpus;
+
+	/* (non-Javadoc)
+	 * @see org.txm.searchengine.cqp.corpus.CqpObject#getCqpId()
+	 */
+	@Override
+	public String getCqpId() {
+		return cqpId;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.searchengine.cqp.corpus.CqpObject#getName()
+	 */
+	@Override
+	public String getName() {
+		return name;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.searchengine.cqp.corpus.CqpObject#getMotherMainCorpus()
+	 */
+	@Override
+	public MainCorpus getMainCorpus() {
+		return motherMainCorpus;
+	}
+
+	/** The queried corpus. */
+	private Corpus queriedCorpus;
+
+	/** The n match. */
+	private int nMatch = -1;
+
+	/** The query. */
+	private Query query;
+
+	/**
+	 * Instantiates a new query result.
+	 * 
+	 * Not intended to be used directly. See {@link Corpus#query(Query, String)}
+	 * 
+	 * @param cqpId
+	 *            the cqp id
+	 * @param name
+	 *            the name
+	 * @param queriedCorpus
+	 *            the queried corpus
+	 * @param query
+	 *            the query
+	 * 
+	 * @throws InvalidCqpIdException
+	 *             the invalid cqp id exception
+	 */
+	public QueryResult(String cqpId, String name, Corpus queriedCorpus,
+			Query query) throws InvalidCqpIdException {
+		// super(cqpId);
+		checkCqpId(cqpId);
+		this.cqpId = cqpId;
+		this.name = name;
+		this.queriedCorpus = queriedCorpus;
+		if (queriedCorpus instanceof Subcorpus) {
+			this.motherMainCorpus = ((Subcorpus) queriedCorpus)
+					.getMainCorpus();
+		} else {
+			this.motherMainCorpus = ((MainCorpus) queriedCorpus);
+		}
+		this.query = query;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.txm.searchengine.cqp.corpus.CqpObject#checkCqpId(java.lang
+	 * .String)
+	 */
+	@Override
+	public boolean checkCqpId(String cqpId) throws InvalidCqpIdException {
+		if (!AbstractCqiClient.checkSubcorpusId(cqpId))
+			throw new InvalidCqpIdException(cqpId + TXMCoreMessages.QueryResult_0);
+		return true;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.txm.searchengine.cqp.corpus.CqpObject#getQualifiedCqpId()
+	 */
+	@Override
+	public String getQualifiedCqpId() {
+		return motherMainCorpus.getCqpId() + ":" + this.cqpId; //$NON-NLS-1$
+	}
+
+	/**
+	 * Gets the queried corpus.
+	 * 
+	 * @return the queried corpus
+	 */
+	public Corpus getQueriedCorpus() {
+		return queriedCorpus;
+	}
+
+	/**
+	 * Gets the number of matches.
+	 * 
+	 * @return the number of matches
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	public int getNMatch() throws CqiClientException {
+		//if (nMatch == -1) //
+			try {
+				nMatch = CorpusManager.getCorpusManager().getCqiClient()
+						.subCorpusSize(getQualifiedCqpId());
+			} catch (Exception e) {
+				return 0;
+			}
+		return nMatch;
+	}
+
+	/**
+	 * Retrieves some of the matches of a query
+	 * 
+	 * Not all the matches are returned, but only those between from and to. For
+	 * example, getMatches(0,9) returns the first 10 matches while
+	 * getMatches(0,getNMatches()) return them all.
+	 * 
+	 * @param from
+	 *            the from
+	 * @param to
+	 *            the to
+	 * 
+	 * @return the matches
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	/**
+	 * @return
+	 * @throws CqiClientException
+	 */
+	public int[] getStartMatches(int from, int to) throws CqiClientException {
+		int n = this.getNMatch();
+		if (to > n) to = n;
+		try {
+			return CorpusManager.getCorpusManager().getCqiClient()
+					.dumpSubCorpus(getQualifiedCqpId(),
+							NetCqiClient.CQI_CONST_FIELD_MATCH, from, to);
+		} catch (Exception e) {
+			throw new CqiClientException(e);
+		}
+	}
+
+	/**
+	 * Retrieves some of the matches of a query
+	 * 
+	 * Not all the matches are returned, but only those between from and to. For
+	 * example, getMatches(0,9) returns the first 10 matches while
+	 * getMatches(0,getNMatches()) return them all.
+	 * 
+	 * @param from
+	 *            the from
+	 * @param to
+	 *            the to
+	 * 
+	 * @return the matches
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	/**
+	 * @return
+	 * @throws CqiClientException
+	 */
+	public List<Match> getMatches(int from, int to) throws CqiClientException {
+		int[] starts, ends;
+		List<Match> res = new ArrayList<Match>();
+		try {
+			starts = getStarts(from, to);
+			ends = CorpusManager.getCorpusManager().getCqiClient()
+					.dumpSubCorpus(getQualifiedCqpId(),
+							NetCqiClient.CQI_CONST_FIELD_MATCHEND, from, to);
+			targets = CorpusManager.getCorpusManager().getCqiClient()
+					.dumpSubCorpus(getQualifiedCqpId(),
+							NetCqiClient.CQI_CONST_FIELD_TARGET, from, to);
+		} catch (Exception e) {
+			throw new CqiClientException(e);
+		}
+		for (int i = 0; i <= to - from; i++) {
+			res.add(new Match(starts[i], ends[i], targets[i]));
+		}
+		return res;
+	}
+	
+	
+
+	public int[] getEnds(int from, int to) throws UnexpectedAnswerException, IOException, CqiServerError
+	{
+		return CorpusManager.getCorpusManager().getCqiClient()
+					.dumpSubCorpus(getQualifiedCqpId(),
+							NetCqiClient.CQI_CONST_FIELD_MATCHEND, from, to);
+	}
+
+	public int[] getEnds() throws CqiClientException, IOException, CqiServerError {
+		int n = this.getNMatch();
+		if( n > 0)
+			return getEnds(0, n - 1);
+		else return new int[0];
+	}
+	
+	public int[] getStarts(int from, int to) throws UnexpectedAnswerException, IOException, CqiServerError
+	{
+		return CorpusManager.getCorpusManager().getCqiClient()
+					.dumpSubCorpus(getQualifiedCqpId(),
+							NetCqiClient.CQI_CONST_FIELD_MATCH, from, to);
+	}
+
+	public int[] getStarts() throws CqiClientException, IOException, CqiServerError {
+		int n = this.getNMatch();
+		if (n > 0)
+			return getStarts(0, n - 1);
+		else return new int[0];
+	}
+
+	/**
+	 * Gets all the matches.
+	 * 
+	 * WARNING: on win32 OS, this function may takes a long time if called with sockets
+	 * 
+	 * @return the matches
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	public List<Match> getMatches() throws CqiClientException {
+		int n = this.getNMatch();
+		if( n > 0)
+			return getMatches(0, n - 1);
+		else return new ArrayList<Match>();
+	}
+
+	//	/**
+	//	 * Gets all the matches.
+	//	 * WARNING: on win32 OS, this function may takesQUETE a long time
+	//	 * 
+	//	 * @return the matches
+	//	 * 
+	//	 * @throws CqiClientException
+	//	 *             the cqi client exception
+	//	 */
+	//	public List<Match> getRandomMatches(float perc) throws CqiClientException {
+	//		
+	//		ArrayList<Match> allmatches = new ArrayList<Match>(getMatches(0, getNMatch() - 1));
+	//		ArrayList<Match> sub = new ArrayList<Match>();
+	//		int count = 0;
+	//		for(Match m : allmatches)
+	//		{
+	//			if(count >= size)
+	//				return sub;
+	//			count++;
+	//			if(Math.random() > perc)
+	//				sub.add(m);
+	//		}
+	//		return sub;
+	//	}
+
+	/**
+	 * Drops the query results. More specifically, it drops its CQP counterpart.
+	 * 
+	 * This method has to be called when a query result is no longer usefull.
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	public void drop() throws CqiClientException {
+		try {
+			CorpusManager.getCorpusManager().getCqiClient().dropSubCorpus(this.getQualifiedCqpId());
+		} catch (Exception e) {
+			throw new CqiClientException(e);
+		}
+	}
+	
+	@Override
+	public void finalize() {
+//		try { drop(); }
+//		catch(Exception e) { }
+	}
+
+	/**
+	 * Gets the query.
+	 * 
+	 * @return the query
+	 */
+	public Query getQuery() {
+		return query;
+	}
+
+	/**
+	 * get the Nth match
+	 * 
+	 * @param i
+	 * @return
+	 * @throws UnexpectedAnswerException
+	 * @throws IOException
+	 * @throws CqiServerError
+	 */
+	public Match getMatch(int i) throws UnexpectedAnswerException, IOException, CqiServerError {
+		int[] starts = CorpusManager.getCorpusManager().getCqiClient()
+				.dumpSubCorpus(getQualifiedCqpId(),
+						NetCqiClient.CQI_CONST_FIELD_MATCH, i, i);
+		int[] ends = CorpusManager.getCorpusManager().getCqiClient()
+				.dumpSubCorpus(getQualifiedCqpId(),
+						NetCqiClient.CQI_CONST_FIELD_MATCHEND, i, i);
+		return new Match(starts[i], ends[i]);
+	}
+	
+	public String toString() {
+		return this.getQualifiedCqpId();
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/QueryResult.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/Subcorpus.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/Subcorpus.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/Subcorpus.java	(revision 258)
@@ -0,0 +1,610 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2015-12-01 16:28:17 +0100 (Tue, 01 Dec 2015) $
+// $LastChangedRevision: 3073 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.corpus;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.osgi.util.NLS;
+import org.txm.annotation.AnnotationManager;
+import org.txm.annotation.repository.KnowledgeRepository;
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.functions.selection.SelectionResult;
+import org.txm.lexicon.core.corpusengine.cqp.Lexicon;
+import org.txm.objects.Base;
+import org.txm.objects.TxmObject;
+import org.txm.searchengine.cqp.AbstractCqiClient;
+import org.txm.searchengine.cqp.ICqiClient;
+import org.txm.searchengine.cqp.NetCqiClient;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.clientExceptions.InvalidCqpIdException;
+import org.txm.searchengine.cqp.clientExceptions.UnexpectedAnswerException;
+import org.txm.searchengine.cqp.corpus.query.Match;
+import org.txm.searchengine.cqp.corpus.query.Query;
+import org.txm.searchengine.cqp.serverException.CqiServerError;
+import org.txm.utils.logger.Log;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class Subcorpus.
+ * 
+ * @author jmague
+ */
+public class Subcorpus extends Corpus {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+
+	/** The mother subcorpus. */
+	protected Subcorpus motherSubcorpus;
+
+	/** The query. */
+	protected Query query;
+
+	private SelectionResult selectionResult;
+	protected QueryResult qresult;
+
+	
+	
+	/**
+	 * Instantiates a new subcorpus and add it as child result of the specified parent corpus.
+	 * @param cqpId
+	 * @param name
+	 * @param parent
+	 * @param query
+	 * @throws InvalidCqpIdException
+	 */
+	protected Subcorpus(String cqpId, String name, Corpus parent, Query query) throws InvalidCqpIdException {
+		this(cqpId, name, parent, query, true);
+	}
+	
+	/**
+	 * Instantiates a new subcorpus.
+	 * 
+	 * Not intended to be used directly.
+	 *
+	 * @param cqpId the cqp id
+	 * @param name the name
+	 * @param parent the parent
+	 * @param query the query
+	 * @throws InvalidCqpIdException the invalid cqp id exception
+	 * {@link Corpus#createSubcorpus(Query, String)}
+	 */
+	protected Subcorpus(String cqpId, String name, Corpus parent, Query query, boolean addToParent) throws InvalidCqpIdException {
+		super(cqpId);
+		
+		// FIXME: to validate
+		if(addToParent)	{
+			parent.addResult(this);
+		}
+		
+		this.query = query;
+		this.name = name;
+		if (parent instanceof Subcorpus) {
+			this.motherMainCorpus = ((Subcorpus) parent).motherMainCorpus;
+			this.motherSubcorpus = ((Subcorpus) parent);
+		} else {
+			this.motherMainCorpus = ((MainCorpus) parent);
+			this.motherSubcorpus = null;
+		}
+
+		this.qresult = new QueryResult(this.cqpId, this.name, parent, query);
+	}
+
+	/**
+	 * Gets the mother subcorpus.
+	 * 
+	 * @return the mother subcorpus
+	 */
+	public Subcorpus getMotherSubcorpus() {
+		return motherSubcorpus;
+	}
+
+	/**
+	 * Returns the number of occurrences in the subcorpus.
+	 * 
+	 * @return the size
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 * 
+	 * @see org.txm.searchengine.cqp.corpus.Corpus#getSize()
+	 */
+	@Override
+	public int getSize() throws CqiClientException {
+		Log.finest(TXMCoreMessages.bind(TXMCoreMessages.SUBCORPUS_SIZE, new Object[]{this.name, "N/A"}));
+		long start = System.currentTimeMillis();
+		if (this.size == -1) {
+			try {
+				AbstractCqiClient cqiClient = CorpusManager.getCorpusManager().getCqiClient();
+				int nMatch = cqiClient.subCorpusSize(getQualifiedCqpId());
+				//System.out.println("n matchs: "+nMatch);
+				if (nMatch == 0) {
+					this.size = 0;
+				} else {
+					int[] match = cqiClient.dumpSubCorpus(getQualifiedCqpId(),
+							NetCqiClient.CQI_CONST_FIELD_MATCH, 0, nMatch - 1);
+					int[] matchend = cqiClient.dumpSubCorpus(getQualifiedCqpId(),
+							NetCqiClient.CQI_CONST_FIELD_MATCHEND, 0, nMatch - 1);
+					if (match.length != matchend.length)
+						throw new UnexpectedAnswerException();
+					this.size = 0;
+					
+					for (int i = 0; i < match.length; i++)
+						size += matchend[i] - match[i] + 1;
+				}
+			} catch (Exception e) {
+				throw new CqiClientException(e);
+			}
+		}
+		long end = System.currentTimeMillis();
+		Log.finest(NLS.bind(TXMCoreMessages.END_SUBCORPUS_SIZE, new Object[]{this.name, this.size, (end - start)})); //$NON-NLS-1$
+		return this.size;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.txm.searchengine.cqp.corpus.CqpObject#getQualifiedCqpId()
+	 */
+	@Override
+	public String getQualifiedCqpId() {
+		return motherMainCorpus.getCqpId() + ":" + this.cqpId; //$NON-NLS-1$
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.txm.searchengine.cqp.corpus.Corpus#getProperties()
+	 */
+	@Override
+	public List<Property> getProperties() throws CqiClientException {
+		return motherMainCorpus.getProperties();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.txm.searchengine.cqp.corpus.Corpus#getProperty(java.lang.
+	 * String)
+	 */
+	@Override
+	public Property getProperty(String name) throws CqiClientException {
+		return motherMainCorpus.getProperty(name);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.txm.searchengine.cqp.corpus.Corpus#getStructuralUnits()
+	 */
+	@Override
+	public List<StructuralUnit> getStructuralUnits() throws CqiClientException {
+		if (getParent() instanceof MainCorpus) {
+			this.structuralUnits = ((MainCorpus)getParent()).getStructuralUnits();
+		} else if (getParent() instanceof Subcorpus)
+			this.structuralUnits = ((Subcorpus)getParent()).getStructuralUnits();
+		else
+			return null;
+		return this.structuralUnits;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.txm.searchengine.cqp.corpus.Corpus#getStructuralUnit(java
+	 * .lang.String)
+	 */
+	@Override
+	public StructuralUnit getStructuralUnit(String name)
+			throws CqiClientException {
+		return motherMainCorpus.getStructuralUnit(name);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.txm.searchengine.cqp.corpus.CqpObject#checkCqpId(java.lang
+	 * .String)
+	 */
+	@Override
+	public boolean checkCqpId(String cqpId) throws InvalidCqpIdException {
+		if (!AbstractCqiClient.checkSubcorpusId(cqpId))
+			throw new InvalidCqpIdException(cqpId + TXMCoreMessages.Subcorpus_3);
+		return true;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.txm.searchengine.cqp.corpus.Corpus#getLexicon(org.txm
+	 * .searchengine.cqp.corpus.Property)
+	 */
+	@Override
+	public Lexicon getLexicon(Property property) throws CqiClientException {
+		// System.out.println("in "+this.getCqpId()+" look for cached lexicon "+property);
+		if (lexicons.containsKey(property.getName())
+				&& lexicons.get(property.getName()) != null) {
+			Log.finest(TXMCoreMessages.RETURNING_CACHED_LEXICON + this.name);
+			return lexicons.get(property.getName());
+		}
+		//System.out.println("not found");
+		Log.finest(TXMCoreMessages.SUBCORPUS_LEXICON + this.name);
+		long start = System.currentTimeMillis();
+		int[][] fdist = null;
+		Subcorpus tmp = null;
+		try {
+			tmp = createSubcorpus(new Query("[]"), "S"+getNextSubcorpusCounter(), true); //$NON-NLS-1$
+			if (tmp != null) {
+				fdist = CorpusManager.getCorpusManager().getCqiClient().fdist1(
+						tmp.getQualifiedCqpId(), 0,
+						ICqiClient.CQI_CONST_FIELD_MATCH, property.getName());
+			
+				dropSubcorpus(tmp); // drop the subcorpus only if correctly created
+			}
+			//System.out.println("nb lines: "+fdist.length);
+		} catch (Exception e) {
+			throw new CqiClientException(e);
+		} finally {
+			if (tmp != null) {
+				try {dropSubcorpus(tmp);}
+				catch (Exception e2) {}
+			}
+		}
+		int lexiconSize = fdist.length;
+
+		int[] freqs = new int[lexiconSize];
+		int[] ids = new int[lexiconSize];
+		for (int i = 0; i < fdist.length; i++) {
+			ids[i] = fdist[i][0];
+			freqs[i] = fdist[i][1];
+		}
+
+		Lexicon lexicon = new Lexicon(this, property, freqs, ids);
+
+		long end = System.currentTimeMillis();
+		Log.finest(TXMCoreMessages.END_SUBCORPUS_LEXICON + this.name
+				+ TXMCoreMessages.Subcorpus_1 + (end - start));
+
+		// System.out.println("add in "+this.getCqpId()+"cache "+property.getName());
+		lexicons.put(property.getName(), lexicon);
+		return lexicon;
+	}
+
+	// protected void finalize() throws Throwable {
+	// try {
+	// //
+	// CorpusManager.getCorpusManager().getCqiClient().dropSubCorpus(this.getQualifiedCqpId());
+	// //As finalize is run in a separate thread, we have problems of concurrent
+	// accesses to the cqi server if we drop the subcorpus here.
+	// //It as to be done manually
+	// } catch (Exception e) {
+	// Log.finest("Subcorpus failed to finalize", e);
+	// }
+	// finally {
+	// super.finalize();
+	// }
+	// }
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.txm.searchengine.cqp.corpus.Corpus#getLocale()
+	 */
+	@Override
+	public boolean load() {
+		if (selfElement != null) {
+			this.query = new Query(selfElement.getAttribute("query")); //$NON-NLS-1$
+
+			NodeList subcorpusElems = selfElement.getElementsByTagName("subcorpus"); //$NON-NLS-1$
+			for (int i = 0 ; i < subcorpusElems.getLength() ; i++) {
+				Element subcorpusElem = (Element) subcorpusElems.item(i);
+				try {
+					Subcorpus subcorp = this.createSubcorpus(subcorpusElem);
+					subcorp.selfElement = subcorpusElem;
+					subcorp.load();
+				} catch (CqiClientException e) {
+					Log.warning(this.name + TXMCoreMessages.Corpus_12 + name
+							+ " : " + e); //$NON-NLS-1$
+				}
+			}
+
+			NodeList partitionElems = selfElement.getElementsByTagName("partition"); //$NON-NLS-1$
+			for (int i = 0 ; i < partitionElems.getLength() ; i++) {
+				Element partitionElem = (Element) partitionElems.item(i);
+				String name = partitionElem.getAttribute("name"); //$NON-NLS-1$
+				List<String> names = new ArrayList<String>();
+				List<String> queries = new ArrayList<String>();
+
+				NodeList partElems = partitionElem.getElementsByTagName("part"); //$NON-NLS-1$
+				for (int j = 0; j < partElems.getLength(); j++) {
+					Element part = (Element) partElems.item(j);
+					names.add(part.getAttribute("name")); //$NON-NLS-1$
+					queries.add(part.getAttribute("query")); //$NON-NLS-1$
+				}
+				try {
+					//System.out.println("Create Partition with corpus "+this+" : "+name+", queries "+queries+", names "+names);
+					Partition partition = this.createPartition(name, queries, names, true);
+					partition.load(partitionElem);
+				} catch (CqiClientException e) {
+					Log.warning(this.name + TXMCoreMessages.Corpus_19 + name
+							+ " : " + e); //$NON-NLS-1$
+					//c.getParentNode().removeChild(c);
+				}
+			}
+		}
+		initSelectionResult();
+		//System.out.println("Subcorpus.load: Selection of "+this+" = "+selectionResult);
+		//return super.load();
+		return true;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#getParent()
+	 */
+	@Override
+	public TxmObject getParent() {
+		if (this.motherSubcorpus != null)
+			return this.motherSubcorpus;
+		else
+			return this.motherMainCorpus;
+	}
+
+	/**
+	 * Register to parent.
+	 *
+	 * @param subcorpusName the subcorpus name
+	 * @param query the query
+	 */
+	private void registerToParent(String subcorpusName, Query query) {
+		if (this.selfElement == null && this.getParent() != null)
+			try {
+				Element parentElem = (Element) this.getParent().getSelfElement();
+				if (parentElem == null) return;
+				Document doc = parentElem.getOwnerDocument();
+				Element subcorpusElem = doc.createElement("subcorpus"); //$NON-NLS-1$
+				subcorpusElem.setAttribute("name", subcorpusName); //$NON-NLS-1$
+				subcorpusElem.setAttribute("desc", subcorpusName); //$NON-NLS-1$
+				if (query != null)
+					subcorpusElem.setAttribute("query", query.getQueryString()); //$NON-NLS-1$
+				Element corporaElem;
+				if (this.getParent() instanceof MainCorpus) {
+					NodeList corporaList = parentElem.getElementsByTagName("preBuild"); //$NON-NLS-1$
+					corporaElem = (Element) corporaList.item(0);
+				} else {
+					corporaElem = parentElem;
+				}
+				corporaElem.appendChild(subcorpusElem);
+				this.selfElement = subcorpusElem;
+			} catch (Exception e) {
+				System.out.println(TXMCoreMessages.Subcorpus_2+Log.toString(e));
+			}
+
+		this.load();
+	}
+
+	/**
+	 * Register to parent.
+	 */
+	public void registerToParent() {
+		registerToParent(this.name, this.query);
+	}
+
+	/**
+	 * Gets the query.
+	 *
+	 * @return the query
+	 */
+	public Query getQuery() {
+		return query;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.searchengine.cqp.corpus.Corpus#getBase()
+	 */
+	@Override
+	public Base getBase() {
+		TxmObject o = getParent();
+		if (o instanceof Base)
+			return (Base)o;
+		else if (o instanceof Corpus)
+			return ((Corpus)o).getBase();
+		else 	
+			return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see java.lang.Object#toString()
+	 */
+	@Override
+	public String toString() {
+		return this.getName();
+	}
+
+	public void setSelectionResult(SelectionResult selectionResult) {
+		this.selectionResult = selectionResult;
+		if (this.selfElement != null) {
+			//remove old node if any
+			NodeList selectionList = selfElement.getElementsByTagName("selection"); //$NON-NLS-1$
+			for (int i = 0 ; i < selectionList.getLength() ; i++)
+				selfElement.removeChild(selectionList.item(i));
+
+			Document doc = this.getParent().getSelfElement().getOwnerDocument();
+			Element selectionElem = doc.createElement("selection"); // the selection element //$NON-NLS-1$
+			for (String txt : selectionResult) // the text ids
+			{
+				Element textElem = doc.createElement("selText"); //$NON-NLS-1$
+				textElem.setAttribute("id", txt); //$NON-NLS-1$
+				selectionElem.appendChild(textElem);
+			}
+			for (String crit : selectionResult.critera.keySet()) // the critera
+			{
+				ArrayList<String> values = selectionResult.critera.get(crit);
+				for (String value : values) {
+					Element criteraElem = doc.createElement("selCrit"); //$NON-NLS-1$
+					criteraElem.setAttribute("id", crit); //$NON-NLS-1$
+					criteraElem.setAttribute("value", value); //$NON-NLS-1$
+					selectionElem.appendChild(criteraElem);
+				}
+			}
+			selfElement.appendChild(selectionElem);// append selection elem to self
+		}
+	}
+
+	public SelectionResult initSelectionResult() {
+
+		if (selfElement != null) {
+			selectionResult = new SelectionResult();
+			NodeList selectionList = selfElement.getElementsByTagName("selection"); //$NON-NLS-1$
+			for (int i = 0 ; i < selectionList.getLength() ;) {
+				Element selection = (Element) selectionList.item(i); // the selection element
+
+				NodeList textList = selection.getElementsByTagName("selText"); // get text ids //$NON-NLS-1$
+				for (int j = 0 ; j < textList.getLength() ; j++) {
+					Element text = (Element) textList.item(j);
+					selectionResult.add(text.getAttribute("id")); //$NON-NLS-1$
+				}
+
+				NodeList critList = selection.getElementsByTagName("selCrit"); // get the criteria //$NON-NLS-1$
+				for (int j = 0 ; j < critList.getLength() ; j++) {
+					Element crit = (Element) critList.item(j);
+					String name = crit.getAttribute("id"); // the name of the critera //$NON-NLS-1$
+					if (!selectionResult.critera.containsKey(name)) // create new list if new critera
+						selectionResult.critera.put(name, new ArrayList<String>());
+					selectionResult.critera.get(name).add(crit.getAttribute("value")); // add the value //$NON-NLS-1$
+				}
+				break; // process only one selection node
+			}
+		}
+		return selectionResult;
+	}
+
+	public SelectionResult getSelectionResult() {
+		return selectionResult;
+	}
+
+	@Override
+	public int[] getTextEndLimits() throws CqiClientException, IOException,
+	CqiServerError, InvalidCqpIdException {
+		return this.getMainCorpus().getTextEndLimits();
+	}
+	
+	@Override
+	public int[] getTextStartLimits() throws CqiClientException, IOException,
+	CqiServerError, InvalidCqpIdException {
+		return this.getMainCorpus().getTextStartLimits();
+	}
+
+	@Override
+	public List<Match> getMatches() {
+		try {
+			return qresult.getMatches();
+		} catch (CqiClientException e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+			return new ArrayList<Match>();
+		}
+	}
+
+	public int getNMatch() {
+		try {
+			return qresult.getNMatch();
+		} catch (CqiClientException e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+			return 0;
+		}
+	}
+	
+	@Override
+	public boolean delete() {
+		if (selfElement != null) {
+			Node parent = selfElement.getParentNode();
+			if (parent != null) {
+				parent.removeChild(selfElement);
+			}
+		}
+		return super.delete();
+	}
+
+	@Override
+	public int[] getStartLimits(String sup) throws IOException,
+			CqiServerError, InvalidCqpIdException, CqiClientException {
+		return this.getMainCorpus().getStartLimits(sup);
+	}
+
+	@Override
+	public KnowledgeRepository getKnowledgeRepository(String name) {
+		return this.getMainCorpus().getKnowledgeRepository(name);
+	}
+
+	@Override
+	public List<String> getKnowledgeRepositoryNames() {
+		return this.getMainCorpus().getKnowledgeRepositoryNames();
+	}
+
+	@Override
+	public AnnotationManager getAnnotationManager() {
+		return this.getMainCorpus().getAnnotationManager();
+	}
+
+	@Override
+	public boolean canBeAnnotated() {
+		return this.getMainCorpus().canBeAnnotated();
+	}
+
+	@Override
+	public String getSimpleName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public String getDetails() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public void clean() {
+		// TODO Auto-generated method stub
+		
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/Subcorpus.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/query/Query.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/query/Query.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/query/Query.java	(revision 258)
@@ -0,0 +1,320 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2015-05-13 09:46:56 +0200 (Wed, 13 May 2015) $
+// $LastChangedRevision: 2967 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.corpus.query;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class Query.
+ * 
+ * @author sloiseau
+ * @author jpmague
+ * @author sheiden
+ */
+
+public class Query {
+
+	/** The Constant NoStrategy. */
+	private static final Integer NoStrategy = 0;
+	
+	/** The Constant JPMStrategy. */
+	private static final Integer JPMStrategy = 1;
+	
+	/** The Constant WLXStrategy. */
+	private static final Integer WLXStrategy = 2;
+	
+	/** The Constant ElectricStrategy. */
+	private static final Integer ElectricStrategy = 3;
+
+	/* (non-Javadoc)
+	 * @see java.lang.Object#equals(java.lang.Object)
+	 */
+	@Override
+	public boolean equals(Object obj) {
+		if (!(obj instanceof Query))
+			return false;
+		return this.getQueryString().equals(((Query) obj).getQueryString());
+	}
+
+	/** The query string. */
+	private String queryString;
+
+	/**
+	 * Instantiates a new query.
+	 */
+	protected Query() {
+	}
+
+	/**
+	 * Instantiates a new query.
+	 * 
+	 * @param queryString
+	 *            the query string
+	 * 
+	 *            public Query(String queryString){
+	 *            this.queryString=queryString.trim(); }
+	 */
+	public Query(String queryString) {
+		this.queryString = queryString.trim();
+	}
+
+	/**
+	 * Gets the query string.
+	 * 
+	 * @return the query string
+	 */
+	public String getQueryString() {
+		return queryString;
+	}
+
+	/* (non-Javadoc)
+	 * @see java.lang.Object#toString()
+	 */
+	@Override
+	public String toString() {
+		return queryString;
+	}
+
+	/**
+	 * Normalize white chars.
+	 *
+	 * @param str the str
+	 * @return the string with white chars normalized
+	 * @author sheiden
+	 */
+	public static String normalizeWhiteChars(String str) {
+
+		/*
+		 * - first normalize white chars : We don't know from where the query
+		 * comes from and how it was produced (pasted from a text editor after
+		 * having been double-clicked and copied, typed in the query input
+		 * field, etc.) The CQP syntax analyzer is sensible to white chars, so
+		 * we have to normalize what the user may have leaved inadvertently
+		 * because she may not see well the true query string (white chars are
+		 * invisible), and it is dif ficult to accept and manage a syntax error
+		 * when you can't "see" the source of the problem. That strategy decides
+		 * to interpret every white chars contiguous sequence as one space
+		 * character.
+		 * 
+		 * Please note that this may be compatible (or not) with other Search
+		 * Engines query scanners.
+		 * 
+		 * Please note also that this may be compatible (or not) with the
+		 * tokenization policy of a given corpus dealing with compound words.
+		 * That strategy is compatible with a policy which separates words in
+		 * compound words by one space character.
+		 * 
+		 * - then remove outer white chars : What is not seen should not be
+		 * there if no explicit expression deals with it from the user's point
+		 * of view. So white chars at the beginning or at the end of the query
+		 * are removed. Those characters often come from rapid copy/paste or
+		 * double-click/copy/paste (in a word processing software, the
+		 * double-click strategy can for example select the white chars on the
+		 * right of the selected strings to help the user move words around with
+		 * their delimiters).
+		 * 
+		 * That strategy may seem aggressive, but experience shows that this
+		 * little service helps silently users a lot and is rarely
+		 * inappropriate.
+		 * 
+		 * In case of doubt, the user should be able to switch to another
+		 * strategy.
+		 */
+
+		// normalize everything white to space
+		String str1 = str.replaceAll("\\s+", " "); //$NON-NLS-1$ //$NON-NLS-2$
+		// remove border whites
+		str1 = str1.replaceFirst("^ ", ""); //$NON-NLS-1$ //$NON-NLS-2$
+		str1 = str1.replaceFirst(" $", ""); //$NON-NLS-1$ //$NON-NLS-2$
+		return str1;
+	}
+
+	/**
+	 * Transforms a simplified query string into a proper CQP query string
+	 * 
+	 * Follows several different strategies to do that :
+	 * 
+	 * JPM Strategy : if the input query matches \w quote are added if the input
+	 * query matches \w*="\w*", square brackets are added if the input query
+	 * matches .\w=.\w (i.e. without quotes), quotes and square brackets are
+	 * added (i.e. -> [$1="$2"]) otherwise, the query is left as if 
+	 * 
+	 * Weblex Strategy : normalize white chars add double quotes if no double
+	 * quotes and no brackets
+	 * 
+	 * Electric Strategy : normalize white chars add double quote, equal,
+	 * brackets, etc. depending on the presence/absence of those chars in the
+	 * original query
+	 * 
+	 * No Strategy : do nothing
+	 * 
+	 * @param query
+	 *            The query string to fix
+	 * @return the fixed query string
+	 */
+	static public String fixQuery(String query) {
+
+		//if (query.startsWith("intersect ")) return query;
+
+		if ("\"".equals(query)) return "\"\\\"\""; //$NON-NLS-1$ //$NON-NLS-2$
+		
+		Integer QueryFixStrategy = WLXStrategy;
+
+		if (QueryFixStrategy == JPMStrategy) {
+
+			// query = abc -> put double quotes
+			Pattern simple = Pattern.compile("\\p{L}*"); //$NON-NLS-1$
+			if (simple.matcher(query).matches()) {
+				// System.out.println("match 1");
+				return '"' + query + '"'; //$NON-NLS-1$
+			}
+
+			// query = prop="abc" -> put square brackets
+			Pattern equalsWithQuotes = Pattern.compile("\\p{L}+=\"\\p{L}*\""); //$NON-NLS-1$
+			if (equalsWithQuotes.matcher(query).matches()) {
+				// System.out.println("match 2");
+				return '[' + query + ']';
+			}
+
+			// query = abc=def -> put brackets + equal sign + double quotes
+			Pattern equalsWithoutQuotes = Pattern
+					.compile("(\\p{L}*)=(\\p{L}*)"); //$NON-NLS-1$
+			Matcher matcher = equalsWithoutQuotes.matcher(query);
+			if (matcher.matches()) {
+				// System.out.println("match 2");
+				return '[' + matcher.group(1) + '=' + '"' + matcher.group(2)
+						+ '"' + ']';
+			}
+
+			// query doesn't start with ", ' and [ -> put double quotes
+			if (!query.startsWith("\"") && !query.startsWith("\'") && !query.startsWith("[")) //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+			{
+				return '"' + query + '"'; //$NON-NLS-1$
+			}
+
+			// do nothing
+			return query;
+
+		} else if (QueryFixStrategy == WLXStrategy) {
+
+			query = normalizeWhiteChars(query);
+
+			// query contains double quotes
+			if (query.contains("\"")) { //$NON-NLS-1$
+				return query;
+			} else
+			// query contains brackets
+			if (query.contains("[") && query.contains("]")) { //$NON-NLS-1$ //$NON-NLS-2$
+				return query; // probably [] or [...]
+			} else {
+				return '"' + query + '"'; //$NON-NLS-1$
+			}
+		} else if (QueryFixStrategy == ElectricStrategy) {
+
+			// DON'T USE THAT STRATEGY : CODE NEEDS TO BE FIXED
+			query = normalizeWhiteChars(query);
+
+			if (query.contains("\"")) { //$NON-NLS-1$
+				if (query.contains("=")) { //$NON-NLS-1$
+					if (query.contains("[")) { //$NON-NLS-1$
+						return query;
+					} else {
+						return '[' + query + ']';
+					}
+				} else {
+					return query;
+				}
+			} else {
+				if (query.contains("=")) { //$NON-NLS-1$
+					return query.replaceAll("=([^= \"]+)", "=\"$1\""); //$NON-NLS-1$ //$NON-NLS-2$
+				} else {
+					return '"' + query + '"'; //$NON-NLS-1$
+				}
+			}
+		} else if (QueryFixStrategy == NoStrategy) {
+
+			// no strategy to apply : do nothing
+			return query;
+
+		} else {
+
+			// we shouldn't be there
+			// let silently return the query for the moment
+			return query;
+		}
+	}
+
+	/**
+	 * Equals.
+	 *
+	 * @param query the query
+	 * @return true, if successful
+	 */
+	public boolean equals(Query query) {
+		return this.getQueryString().equals(query.getQueryString());
+	}
+
+	/** espace char |"{()}+*. */
+	private static String chars = "^$<>|\\\"{()}?+*."; //$NON-NLS-1$
+	
+	/**
+	 * Adds the back slash.
+	 *
+	 * @param squery the squery
+	 * @return the string
+	 */
+	public static String addBackSlash(String squery) {
+		if ("\"".equals(squery)) return "\"\\\"\""; //$NON-NLS-1$ //$NON-NLS-2$
+		StringBuffer buff = new StringBuffer();
+		//for(char c : chars.)
+		for(int i = 0 ; i < squery.length() ; i++)
+		{
+			int j = chars.indexOf(squery.charAt(i));
+			//System.out.println(""+i+" : "+squery.charAt(i)+ " >> "+j);
+			
+			if ( j >= 0 )
+				buff.append("\\"+squery.charAt(i)); //$NON-NLS-1$
+			else
+				buff.append(squery.charAt(i));
+		}
+		return buff.toString();
+	}
+	
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args)
+	{
+		String test = "^$sdf<>sdf|\\sdf\"{(sdf)}?+sdf*."; //$NON-NLS-1$
+		System.out.println(Query.addBackSlash(test));
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/query/Query.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/query/QueryFocus.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/query/QueryFocus.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/query/QueryFocus.java	(revision 258)
@@ -0,0 +1,56 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.corpus.query;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class QueryFocus.
+ */
+public class QueryFocus extends Query {
+
+	/** The focus. */
+	private final Focus focus;
+
+	/**
+	 * Instantiates a new query focus.
+	 *
+	 * @param focus the focus
+	 */
+	public QueryFocus(Focus focus) {
+		this.focus = focus;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.searchengine.cqp.corpus.query.Query#getQueryString()
+	 */
+	@Override
+	public String getQueryString() {
+		return this.focus.getQueryString();
+	}
+
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/query/QueryFocus.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/query/Occurrence.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/query/Occurrence.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/query/Occurrence.java	(revision 258)
@@ -0,0 +1,74 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.corpus.query;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class Occurrence.
+ */
+public class Occurrence {
+	
+	/** The position. */
+	int position;
+	
+	/** The signature. */
+	int[] signature;
+	
+	/** The signsum. */
+	int signsum = 0;
+
+	/**
+	 * Instantiates a new occurrence.
+	 *
+	 * @param p the p
+	 * @param props the props
+	 */
+	public Occurrence(int p, int[] props) {
+		position = p;
+		signature = props;
+		for (int i = 0; i < signature.length; i++)
+			signsum += signature[i];
+	}
+
+	/**
+	 * Equals.
+	 *
+	 * @param o the o
+	 * @return true, if successful
+	 */
+	public boolean equals(Occurrence o) {
+		if (signature.length != o.signature.length)
+			return false;
+		if (signsum != o.signsum)
+			return false;
+		for (int i = 0; i < signature.length; i++)
+			if (signature[i] != o.signature[i])
+				return false;
+		return true;
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/query/Occurrence.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/query/PartitionFocus.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/query/PartitionFocus.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/query/PartitionFocus.java	(revision 258)
@@ -0,0 +1,174 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-09-05 09:27:13 +0200 (jeu., 05 sept. 2013) $
+// $LastChangedRevision: 2529 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.corpus.query;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.searchengine.cqp.corpus.Part;
+import org.txm.searchengine.cqp.corpus.Partition;
+import org.txm.utils.logger.Log;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Denote a part in a partition.
+ * 
+ * @author sloiseau
+ */
+public class PartitionFocus {
+
+	/** The analysis property. */
+	private final Partition partition;
+
+	/** The modality. */
+	private final List<String> modality;
+	
+	/** The focus index. */
+	private int[] focusIndex = null;
+
+	/**
+	 * Instantiates a new focus.
+	 *
+	 * @param partition the partition
+	 * @param modality the modality
+	 */
+	public PartitionFocus(Partition partition, String modality) {
+		// this(analysisProperty, new ArrayList<String>().add(modality));
+		super();
+		this.partition = partition;
+		this.modality = new ArrayList<String>();
+		this.modality.add(modality);
+		checkModalityList();
+	}
+
+	/**
+	 * Instantiates a new focus.
+	 *
+	 * @param partition the partition
+	 * @param modality the modality
+	 */
+	public PartitionFocus(Partition partition, List<String> modality) {
+		super();
+		this.partition = partition;
+		this.modality = modality;
+		checkModalityList();
+	}
+
+	/**
+	 * Check modality list.
+	 */
+	private void checkModalityList() {
+		List<String> partNames = partition.getPartNames();
+		for (String mod : modality) {
+			if (mod == null || mod.equals("")) { //$NON-NLS-1$
+				Log.finest(TXMCoreMessages.PartitionFocus_1);
+				throw new IllegalArgumentException(TXMCoreMessages.PartitionFocus_2);
+			}
+			if (!partNames.contains(mod)) {
+				Log.finest(TXMCoreMessages.PartitionFocus_3 + mod
+						+ " " + partNames); //$NON-NLS-1$
+				throw new IllegalArgumentException(TXMCoreMessages.PartitionFocus_4);
+			}
+		}
+	}
+
+	/**
+	 * Gets the focused parts.
+	 *
+	 * @return the focused parts
+	 */
+	public List<Part> getFocusedParts() {
+		List<Part> focused = new ArrayList<Part>(modality.size());
+		for (int i = 0; i < partition.getParts().size(); i++) {
+			if (modality.contains(partition.getParts().get(i))) {
+				focused.add(partition.getParts().get(i));
+			}
+		}
+		return focused;
+	}
+
+	/**
+	 * Gets the not focused parts.
+	 *
+	 * @return the not focused parts
+	 */
+	public List<Part> getNotFocusedParts() {
+		List<Part> notFocused = new ArrayList<Part>(modality.size());
+		for (int i = 0; i < partition.getParts().size(); i++) {
+			if (!modality.contains(partition.getParts().get(i))) {
+				notFocused.add(partition.getParts().get(i));
+			}
+		}
+		return notFocused;
+	}
+
+	/**
+	 * Gets the analysis property.
+	 * 
+	 * @return the analysis property
+	 */
+	public Partition getPartition() {
+		return partition;
+	}
+
+	/**
+	 * Gets the modality.
+	 * 
+	 * @return the modality
+	 */
+	public List<String> getModality() {
+		return modality;
+	}
+
+	/**
+	 * Gets the focus index.
+	 *
+	 * @return the focus index
+	 */
+	public int[] getFocusIndex() {
+		if (focusIndex == null)
+			computeFocusIndex();
+		return focusIndex;
+	}
+
+	/**
+	 * Compute focus index.
+	 */
+	private void computeFocusIndex() {
+		focusIndex = new int[modality.size()];
+		List<String> partNames = partition.getPartNames();
+		int y = 0;
+		for (int i = 0; i < modality.size(); i++) {
+			if (partNames.contains(modality.get(i))) {
+				focusIndex[y] = i;
+				y++;
+			}
+		}
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/query/PartitionFocus.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/query/Match.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/query/Match.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/query/Match.java	(revision 258)
@@ -0,0 +1,287 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2016-04-04 14:59:04 +0200 (Mon, 04 Apr 2016) $
+// $LastChangedRevision: 3188 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.corpus.query;
+
+import groovy.lang.IntRange;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+
+import org.txm.searchengine.cqp.AbstractCqiClient;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.corpus.CorpusManager;
+import org.txm.searchengine.cqp.corpus.Property;
+import org.txm.searchengine.cqp.corpus.StructuralUnitProperty;
+
+// TODO: Auto-generated Javadoc
+/**
+ * A Match of a query on a corpus.
+ * 
+ * @author jmague, mdecorde
+ */
+public class Match implements Comparable<Match> {
+
+	/** The start. */
+	private int start;
+
+	/** The end. */
+	private int end;
+	
+	/** The target position */
+	private int target = -1;
+
+	/** The query result. */
+	//private QueryResult queryResult;
+
+	/**
+	 * Instantiates a new match.
+	 * 
+	 * @param queryResult
+	 *            the query result
+	 * @param start
+	 *            the cqp index of the start of the match
+	 * @param end
+	 *            the cqp index of the end of the match
+	 */
+	public Match(int start, int end) {
+		this.start = start;
+		this.end = end;
+		//this.queryResult = queryResult;
+	}
+
+	public Match(int start, int end, int target) {
+		this(start,end);
+		this.target = target;
+	}
+
+	/**
+	 * Gets the start.
+	 * 
+	 * @return the start
+	 */
+	public int getStart() {
+		return start;
+	}
+	
+	/**
+	 * Gets the start.
+	 * 
+	 * @return the start
+	 */
+	public int getTarget() {
+		return target;
+	}
+
+	/**
+	 * Gets the end.
+	 * 
+	 * @return the end
+	 */
+	public int getEnd() {
+		return end;
+	}
+	
+	public boolean contains(Match m) {
+		return (this.start <= m.start && m.end <= this.end);
+	}
+
+//	/**
+//	 * Gets the query result.
+//	 * 
+//	 * @return the query result
+//	 */
+//	public QueryResult getQueryResult() {
+//		return queryResult;
+//	}
+
+	/**
+	 * Gets the value for property for the first position of the match.
+	 * 
+	 * @param property
+	 *            the property
+	 * 
+	 * @return the value for property
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	public String getValueForProperty(Property property)
+			throws CqiClientException {
+		List<Match> match = new ArrayList<Match>();
+		match.add(this);
+		return Match.getValuesForProperty(property, match).get(0);
+	}
+
+	/**
+	 * Gets the values for property for all the positions of the match.
+	 * 
+	 * @param property
+	 *            the property
+	 * 
+	 * @return the value for property
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	public List<String> getValuesForProperty(Property property)
+			throws CqiClientException {
+		int[] positions = new int[this.end - this.start + 1];
+		for (int i = 0; i < this.end - this.start + 1; i++)
+			positions[i] = this.start + i;
+		return getValuesForProperty(property, positions);
+	}
+
+	/**
+	 * Gets the values for property.
+	 * 
+	 * @param property
+	 *            the property
+	 * @param matches
+	 *            the matches to get the values for
+	 * 
+	 * @return the values for property
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	public static List<String> getValuesForProperty(Property property,
+			List<Match> matches) throws CqiClientException {
+		int[] starts = new int[matches.size()];
+		for (int i = 0; i < matches.size(); i++)
+			starts[i] = matches.get(i).start;
+		return getValuesForProperty(property, starts);
+	}
+
+	/**
+	 * Gets the values for property.
+	 * 
+	 * @param property
+	 *            the property
+	 * @param positions
+	 *            the positions to get the values for
+	 * 
+	 * @return the values for property
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	public static List<String> getValuesForProperty(Property property,
+			int[] positions) throws CqiClientException {
+		AbstractCqiClient cqiClient = CorpusManager.getCorpusManager().getCqiClient();
+		try {
+			if (property instanceof StructuralUnitProperty) {
+				int[] struc = cqiClient.cpos2Struc(property.getQualifiedName(),
+						positions);
+				return Arrays.asList(cqiClient.struc2Str(property
+						.getQualifiedName(), struc));
+			} else {
+				return Arrays.asList(cqiClient.cpos2Str(property
+						.getQualifiedName(), positions));
+			}
+		} catch (Exception e) {
+			throw new CqiClientException(e);
+		}
+
+	}
+
+	/* (non-Javadoc)
+	 * @see java.lang.Comparable#compareTo(java.lang.Object)
+	 */
+	@Override
+	public int compareTo(Match m) {
+
+		if (m == null)
+			return -1;
+		if (this.start < m.start)
+			return -1;
+		else if (this.start > m.start)
+			return 1;
+		else if (this.end < m.end)
+			return -1;
+		else
+			return 1;
+
+	}
+
+	/* (non-Javadoc)
+	 * @see java.lang.Object#toString()
+	 */
+	@Override
+	public String toString() {
+		return "<" + start + ", " + end + ">"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+	}
+
+	/**
+	 * Gets the ids.
+	 *
+	 * @param property the property
+	 * @param positions the positions
+	 * @return the ids
+	 * @throws CqiClientException the cqi client exception
+	 */
+	public int[] getIds(Property property, int[] positions)
+			throws CqiClientException {
+		AbstractCqiClient cqiClient = CorpusManager.getCorpusManager().getCqiClient();
+
+		try {
+			if (property instanceof StructuralUnitProperty) {
+				int[] struc = cqiClient.cpos2Struc(property.getQualifiedName(),
+						positions);
+				return struc;
+			} else {
+				int[] ids = cqiClient.cpos2Id(property.getQualifiedName(),
+						positions);
+				return ids;
+			}
+		} catch (Exception e) {
+			throw new CqiClientException(e);
+		}
+	}
+
+	/**
+	 * Size.
+	 *
+	 * @return the int
+	 */
+	public int size() {
+		return getEnd() - getStart() + 1;
+	}
+	
+	public int getLength() {
+		return (end - start);
+	}
+
+	public Collection<? extends Integer> getRange() {
+		return new IntRange(start, end);
+	}
+
+	public void setEnd(int p) {
+		this.end = p;
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/query/Match.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/query/QueryPart.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/query/QueryPart.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/query/QueryPart.java	(revision 258)
@@ -0,0 +1,94 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2015-06-15 15:29:16 +0200 (Mon, 15 Jun 2015) $
+// $LastChangedRevision: 2989 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.corpus.query;
+
+import org.txm.searchengine.cqp.corpus.StructuralUnit;
+import org.txm.searchengine.cqp.corpus.StructuralUnitProperty;
+
+import static org.txm.searchengine.cqp.corpus.query.CqpQueryConstant.*;
+
+// TODO: Auto-generated Javadoc
+/**
+ * A query that extract a part from a corpus.
+ * 
+ * @author Jean Philippe Magué
+ * @author sloiseau
+ */
+public class QueryPart extends Query {
+
+	/** The structure. */
+	private StructuralUnit structure;
+
+	/** The property. */
+	private StructuralUnitProperty property;
+
+	/** The value. */
+	private String value;
+
+	/**
+	 * Instantiates a new query part.
+	 * 
+	 * @param structure
+	 *            the structure
+	 * @param property
+	 *            the property
+	 * @param value
+	 *            the value
+	 */
+	public QueryPart(StructuralUnit structure, StructuralUnitProperty property,
+			String value) {
+		this.structure = structure;
+		this.property = property;
+		this.value = value;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.txm.searchengine.cqp.corpus.query.Query#getQueryString()
+	 */
+	/*
+	 * Produce a query such as: [_.struct_property="value"] expand to struct
+	 *  
+	 * OLD VERSION: /region[TEI_type,a]::a.TEI_type="value"
+	 */
+	@Override
+	public String getQueryString() {
+		String tag = structure.getName() + TAG_ATTRIBUTE_SEPARATOR + property.getName();
+		String label = "a"; //$NON-NLS-1$
+		StringBuffer query = new StringBuffer();
+		query.append(REGION_MACRO + START_MACRO_ARGS);
+		query.append(tag + MACRO_ARGS_SEPARATOR + label + END_MACRO_ARGS);
+		query.append(START_GLOBAL_CONSTRAINT + label + DOT + tag + EQUALS
+				+ START_DOUBLE_QUOTE + value + END_DOUBLE_QUOTE);
+		return query.toString();
+		
+		// another way to query parts less restrictif but missleading
+		//return String.format("[_.%s=\"%s\"] expand to %s", tag, value, structure.getName());
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/query/QueryPart.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/query/MatchUtils.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/query/MatchUtils.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/query/MatchUtils.java	(revision 258)
@@ -0,0 +1,28 @@
+package org.txm.searchengine.cqp.corpus.query;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class MatchUtils {
+	/**
+	 * 
+	 * @param list the matches to cover
+	 * @param b the matches that covers
+	 * @return the indexes of 'b' matches that covers the 'a' matches
+	 */
+	public static ArrayList<Integer> matchesCoveredByB(List<Match> list, List<Match> b) {
+		int ai=0, bi=0;
+		ArrayList<Integer> result = new ArrayList<Integer>();
+
+		while (ai < list.size() && bi < b.size() ) {
+			if (b.get(bi).contains(list.get(ai))) { 
+				result.add(bi);
+				bi++; 
+			} else { 
+				ai++; 
+			} 
+		}
+
+		return result;
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/query/MatchUtils.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/query/package.html
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/query/package.html	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/query/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Classes representing a query, wrapping and hidding internal cqp query syntax.</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/query/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/query/Focus.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/query/Focus.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/query/Focus.java	(revision 258)
@@ -0,0 +1,146 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.corpus.query;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.searchengine.cqp.corpus.Property;
+
+// TODO: Auto-generated Javadoc
+/**
+ * A focus is a modality of an {@link Property}.
+ * 
+ * @author sloiseau
+ */
+public class Focus {
+
+	/** The analysis property. */
+	private final Property analysisProperty;
+
+	/** The modality. */
+	private final List<String> modality;
+
+	/**
+	 * Instantiates a new focus.
+	 * 
+	 * @param analysisProperty
+	 *            the analysis property
+	 * @param modality
+	 *            the modality
+	 */
+	public Focus(Property analysisProperty, String modality) {
+		// this(analysisProperty, new ArrayList<String>().add(modality));
+		super();
+		this.analysisProperty = analysisProperty;
+		this.modality = new ArrayList<String>();
+		this.modality.add(modality);
+		checkModalityList();
+	}
+
+	/**
+	 * Instantiates a new focus.
+	 * 
+	 * @param analysisProperty
+	 *            the analysis property
+	 * @param modality
+	 *            the modality
+	 */
+	public Focus(Property analysisProperty, List<String> modality) {
+		super();
+		this.analysisProperty = analysisProperty;
+		this.modality = modality;
+		checkModalityList();
+	}
+
+	/**
+	 * Check modality list.
+	 */
+	private void checkModalityList() {
+		for (String mod : modality) {
+			if (mod == null || mod.equals(""))throw new IllegalArgumentException(TXMCoreMessages.Focus_1); //$NON-NLS-1$
+		}
+	}
+
+	/**
+	 * Gets the analysis property.
+	 * 
+	 * @return the analysis property
+	 */
+	public Property getAnalysisProperty() {
+		return analysisProperty;
+	}
+
+	/**
+	 * Gets the modality.
+	 * 
+	 * @return the modality
+	 */
+	public List<String> getModality() {
+		return modality;
+	}
+
+	/**
+	 * Gets the query string.
+	 * 
+	 * @return the query string
+	 */
+	public String getQueryString() {
+		StringBuffer queryString = new StringBuffer();
+		queryString.append(CqpQueryConstant.START_ATTRIBUTE);
+		queryString.append(analysisProperty.getName());
+		queryString.append(CqpQueryConstant.EQUALS);
+		queryString.append(CqpQueryConstant.START_QUOTE);
+		if (modality.size() == 1) {
+			queryString.append(modality.get(0));
+		} else {
+			for (Iterator<String> iter = modality.iterator(); iter.hasNext();) {
+				String element = iter.next();
+				queryString.append(element);
+				if (iter.hasNext()) {
+					queryString.append(CqpQueryConstant.OR);
+				}
+			}
+		}
+		queryString.append(CqpQueryConstant.END_QUOTE);
+		queryString.append(CqpQueryConstant.END_ATTRIBUTE);
+		queryString.append(CqpQueryConstant.END_QUERY_EXPR);
+		return queryString.toString();
+	}
+
+	/* (non-Javadoc)
+	 * @see java.lang.Object#toString()
+	 */
+	@Override
+	public String toString() {
+		return getQueryString();
+	}
+
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/query/Focus.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/query/CqpQueryConstant.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/query/CqpQueryConstant.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/query/CqpQueryConstant.java	(revision 258)
@@ -0,0 +1,87 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.corpus.query;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class CqpQueryConstant.
+ */
+public class CqpQueryConstant {
+
+	/** The Constant OR. */
+	public final static String OR = "|"; //$NON-NLS-1$
+	
+	/** The Constant AND. */
+	public final static String AND = "&"; //$NON-NLS-1$
+	
+	/** The Constant EQUALS. */
+	public final static String EQUALS = "="; //$NON-NLS-1$
+	
+	/** The Constant START_ATTRIBUTE. */
+	public final static String START_ATTRIBUTE = "["; //$NON-NLS-1$
+	
+	/** The Constant END_ATTRIBUTE. */
+	public final static String END_ATTRIBUTE = "]"; //$NON-NLS-1$
+	
+	/** The Constant END_QUERY_EXPR. */
+	public final static String END_QUERY_EXPR = ";"; //$NON-NLS-1$
+	
+	/** The Constant START_QUOTE. */
+	public final static String START_QUOTE = "'"; //$NON-NLS-1$
+	
+	/** The Constant END_QUOTE. */
+	public final static String END_QUOTE = "'"; //$NON-NLS-1$
+	
+	/** The Constant START_DOUBLE_QUOTE. */
+	public final static String START_DOUBLE_QUOTE = "\""; //$NON-NLS-1$
+	
+	/** The Constant END_DOUBLE_QUOTE. */
+	public final static String END_DOUBLE_QUOTE = "\""; //$NON-NLS-1$
+	
+	/** The Constant DOT. */
+	public final static String DOT = "."; //$NON-NLS-1$
+	
+	/** The Constant TAG_ATTRIBUTE_SEPARATOR. */
+	public final static String TAG_ATTRIBUTE_SEPARATOR = "_"; //$NON-NLS-1$
+	
+	/** The Constant REGION_MACRO. */
+	public final static String REGION_MACRO = "/region"; //$NON-NLS-1$
+	
+	/** The Constant START_MACRO_ARGS. */
+	public final static String START_MACRO_ARGS = "["; //$NON-NLS-1$
+	
+	/** The Constant END_MACRO_ARGS. */
+	public final static String END_MACRO_ARGS = "]"; //$NON-NLS-1$
+	
+	/** The Constant MACRO_ARGS_SEPARATOR. */
+	public final static String MACRO_ARGS_SEPARATOR = ","; //$NON-NLS-1$
+	
+	/** The Constant START_GLOBAL_CONSTRAINT. */
+	public final static String START_GLOBAL_CONSTRAINT = "::"; //$NON-NLS-1$
+
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/query/CqpQueryConstant.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/CorpusManager.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/CorpusManager.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/CorpusManager.java	(revision 258)
@@ -0,0 +1,227 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2016-08-30 09:45:56 +0200 (Tue, 30 Aug 2016) $
+// $LastChangedRevision: 3283 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.corpus;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.persistence.annotations.Structure;
+import org.txm.Toolbox;
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.searchengine.cqp.AbstractCqiClient;
+import org.txm.searchengine.cqp.NetCqiClient;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.clientExceptions.InvalidCqpIdException;
+import org.txm.utils.logger.Log;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class CorpusManager provide access through a CQi client to the corpora
+ * managed by CQP.
+ * 
+ * The corpus manager is a singleton, and before the instance can be acceded via
+ * {@link #getCorpusManager()} it has to configured with
+ * {@link #setCqiClient(NetCqiClient)}.
+ * 
+ * The corpus manager must be used to create instances of {@link MainCorpus}
+ * (with {@link #getCorpus(String)}), instances of {@link Partition} (with
+ * {@link #createPartition(AbstractCorpus, Structure, Property, List)}), and
+ * instances of {@link Subcorpus} (with
+ * {@link #query(AbstractCorpus, String, String)}).
+ * 
+ * @author Jean-Philippe Magué
+ */
+public class CorpusManager {
+
+	/** The cqi client. */
+	private static AbstractCqiClient cqiClient;
+
+	/** The singleton. */
+	private static CorpusManager corpusManager = null;
+
+	/** the corpora. */
+	private static List<MainCorpus> corpora = null;
+
+	/**
+	 * Instantiates a new corpus manager.
+	 */
+	private CorpusManager() {
+	}
+
+	/**
+	 * Sets the cqi client.
+	 * 
+	 * @param cqiClient
+	 *            the new cqi client
+	 */
+	public static void setCqiClient(AbstractCqiClient cqiClient) {
+		CorpusManager.cqiClient = cqiClient;
+	}
+
+	/**
+	 * Gets the corpus manager.
+	 * 
+	 * @return the corpus manager
+	 */
+	public static CorpusManager getCorpusManager() {
+		if (cqiClient == null)
+			throw new RuntimeException(TXMCoreMessages.CorpusManager_0);
+		if (corpusManager == null)
+			corpusManager = new CorpusManager();
+		return corpusManager;
+	}
+
+	/**
+	 * Clean.
+	 */
+	public static void clean() {
+		cqiClient = null;
+		corpora = null;
+		corpusManager = null;
+	}
+
+	/**
+	 * Clean corpora : empty the 'corpora' member.
+	 */
+	public static void cleanCorpora() {
+		corpora = null;
+	}
+
+	/**
+	 * Gets a corpus.
+	 *
+	 * @param corpusName the corpus name
+	 * @return the corpus
+	 * @throws CqiClientException the cqi client exception
+	 * @throws InvalidCqpIdException the invalid cqp id exception
+	 */
+	public MainCorpus getCorpus(String corpusName) throws CqiClientException,
+			InvalidCqpIdException {
+		// return new MainCorpus(corpusName);
+		if (corpora == null) {
+			// System.out.println("error corpora is null ");
+			this.getCorpora();
+		}
+
+		for (MainCorpus corpus : CorpusManager.corpora) {
+			if (corpus.getName().equals(corpusName)) {
+				// System.out.println("found corpus "+corpusName);
+				return corpus;
+			}
+		}
+		//System.out.println("create corpus "+corpusName);
+		MainCorpus c = new MainCorpus(corpusName);
+		//this.corpora.add(c);
+		// corpora.add(c);
+		return c;
+	}
+
+	/**
+	 * Checks for corpus.
+	 *
+	 * @param name the name
+	 * @return true, if successful
+	 */
+	public boolean hasCorpus(String name) {
+		if (corpora == null)
+			return false;
+		for (MainCorpus c : corpora)
+			if (name.equals(c.getName()))
+				return true;
+		return false;
+	}
+
+	/**
+	 * Gets a list of the corpora managed by CQP.
+	 * 
+	 * @return the corpora
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	public List<MainCorpus> getCorpora() throws CqiClientException {
+		//System.out.println("get corpora");
+		if (corpora != null)
+			return corpora;
+
+		String[] corporaName;
+		try {
+			corporaName = cqiClient.listCorpora();
+		} catch (Exception e) {
+			throw new CqiClientException(e);
+		}
+
+		corpora = new ArrayList<MainCorpus>(corporaName.length);
+		for (int i = 0; i < corporaName.length; i++) {
+			try {
+				corpora.add(this.getCorpus(corporaName[i]));
+			} catch (InvalidCqpIdException e) {
+				throw new CqiClientException(TXMCoreMessages.CorpusManager_1, e);
+			}
+		}
+		
+		for (Corpus corpus : corpora) {
+			try {
+				corpus.setCharset(cqiClient.corpusCharset(corpus.getCqpId()));
+				// TODO : implements cqiClient.corpusLanguage
+				// corpus.setLanguage(cqiClient.corpusLanguage(corpus.getCqpId()));
+			} catch (Exception e) {
+				org.txm.utils.logger.Log.printStackTrace(e);
+			}
+		}
+		// System.out.println("END creating corpora");
+		return corpora;
+	}
+
+	/**
+	 * Gets the cqi client.
+	 * 
+	 * @return the cqi client
+	 */
+	public AbstractCqiClient getCqiClient() {
+		return cqiClient;
+	}
+
+	/**
+	 * Delete corpus.
+	 *
+	 * @param corpus the corpus
+	 */
+	public static void deleteCorpus(MainCorpus corpus) {
+		if (corpora != null)
+			corpora.remove(corpus);
+		if (Toolbox.isSearchEngineInitialized()) {
+			try {
+				Toolbox.getCqiClient().dropCorpus(corpus.getName());
+			} catch (Exception e) {
+				Log.warning("Warning while removing corpus: Failed to drop corpus "+corpus);
+				Log.printStackTrace(e);
+			}
+		}
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/CorpusManager.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/Part.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/Part.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/Part.java	(revision 258)
@@ -0,0 +1,171 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.corpus;
+
+import org.txm.objects.Base;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.clientExceptions.InvalidCqpIdException;
+import org.txm.searchengine.cqp.corpus.query.Query;
+import org.w3c.dom.Element;
+
+// TODO: Auto-generated Javadoc
+/**
+ * A Part is related to a {@link Partition} and mirror a CQP subcorpus.
+ *
+ * @author jmague
+ */
+public class Part extends Subcorpus implements Comparable<Part>{
+
+	/** The partition. */
+	private Partition partition;
+
+	/** The number of texts composing this part. */
+	private int nTexts = -1;
+
+	/** The short name. */
+	private String shortName;
+
+	/**
+	 * Instantiates a new part.
+	 *
+	 * @param cqpId the cqp id
+	 * @param partitionName the full complex partition name
+	 * @param shortName the short name
+	 * @param partition the partition
+	 * @param query the query
+	 * @throws InvalidCqpIdException the invalid cqp id exception
+	 */
+	protected Part(String cqpId, String partitionName, String shortName,
+			Partition partition, Query query) throws InvalidCqpIdException {
+		super(cqpId, partitionName + "_" + shortName, partition.getCorpus(), query, false); //$NON-NLS-1$
+		this.shortName = shortName;
+		this.name = shortName;
+		this.partition = partition;
+	}
+
+	/**
+	 * Gets the partition.
+	 * 
+	 * @return the partition
+	 */
+	public Partition getPartition() {
+		return partition;
+	}
+
+	/**
+	 * Gets the number of texts in this part.
+	 * 
+	 * @return the n texts
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	public int getNTexts() throws CqiClientException {
+		if (nTexts < 0)
+			try {
+				nTexts = CorpusManager.getCorpusManager().getCqiClient()
+						.subCorpusSize(getQualifiedCqpId());
+			} catch (Exception e) {
+				throw new CqiClientException(e);
+			}
+		return nTexts;
+	}
+
+	/**
+	 * Gets the short name.
+	 * 
+	 * @return the short name
+	 */
+	public String getShortName() {
+		return shortName;
+	}
+
+	/**
+	 * Sets the name.
+	 *
+	 * @param name the new name
+	 */
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	/**
+	 * Load.
+	 *
+	 * @param elem the elem
+	 * @return true, if successful
+	 */
+	public boolean load(Element elem) {
+		this.selfElement = elem;
+		return load();
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.searchengine.cqp.corpus.Subcorpus#load()
+	 */
+	@Override
+	public boolean load() {
+		this.shortName = selfElement.getAttribute("shortname"); //$NON-NLS-1$
+		return super.load();
+	}
+
+	/**
+	 * Sets the short name.
+	 *
+	 * @param pshortname the new short name
+	 */
+	public void setShortName(String pshortname) {
+		this.shortName = pshortname;
+	}
+
+	/**
+	 * Sets the query.
+	 *
+	 * @param pquery the new query
+	 */
+	public void setQuery(String pquery) {
+		this.query = new Query(pquery);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.searchengine.cqp.corpus.Subcorpus#getBase()
+	 */
+	@Override
+	public Base getBase() {
+		return this.partition.getCorpus().getBase();
+	}
+
+	/* (non-Javadoc)
+	 * @see java.lang.Comparable#compareTo(java.lang.Object)
+	 */
+	@Override
+	public int compareTo(Part o) {
+		return this.getName().compareTo(o.getName());
+	}
+
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/Part.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/PropertyHashMap.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/PropertyHashMap.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/PropertyHashMap.java	(revision 258)
@@ -0,0 +1,84 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.corpus;
+
+import java.lang.reflect.Constructor;
+import java.util.HashMap;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class PropertyHashMap.
+ *
+ * @param <E> the element type
+ */
+public class PropertyHashMap<E> extends HashMap<Property, E> {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = -6560650525642894582L;
+
+	/** The corpus. */
+	Corpus corpus;
+	
+	/** The clazz. */
+	Class<E> clazz;
+
+	/**
+	 * Instantiates a new property hash map.
+	 *
+	 * @param corpus the corpus
+	 * @param clazz the clazz
+	 */
+	public PropertyHashMap(Corpus corpus, Class<E> clazz) {
+		this.corpus = corpus;
+		this.clazz = clazz;
+	}
+
+	/**
+	 * Gets the.
+	 *
+	 * @param property the property
+	 * @return the e
+	 */
+	public E get(Property property) {
+		if (!this.containsKey(property)) {
+			//	
+			Object o = null;
+			for (Constructor<?> constructor : clazz.getConstructors()) {
+				try {
+					o = constructor.newInstance(corpus, property);
+					break;
+				} catch (Exception e) {
+				}
+			}
+			if (o == null)
+				return null;
+			this.put(property, (E) o);
+		}
+		return super.get(property);
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/PropertyHashMap.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/StructuralUnit.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/StructuralUnit.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/StructuralUnit.java	(revision 258)
@@ -0,0 +1,154 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.corpus;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+
+// TODO: Auto-generated Javadoc
+/**
+ * A structural units of a corpus Represents a <strong>type</strong>, not a
+ * specif ic unit.
+ * 
+ * @author jmague
+ * 
+ */
+public class StructuralUnit implements Comparable {
+
+	/** The name. */
+	private String name;
+
+	/** The corpus. */
+	private Corpus corpus;
+
+	/** The properties. */
+	private List<StructuralUnitProperty> properties;
+
+	/**
+	 * Instantiates a new StrucutalUnit.
+	 *
+	 * @param name the name
+	 * @param properties the properties
+	 * @param corpus the corpus
+	 * @throws CqiClientException the cqi client exception
+	 */
+	protected StructuralUnit(String name, List<String> properties, Corpus corpus)
+			throws CqiClientException {
+		this.name = name;
+		this.corpus = corpus;
+		this.properties = new ArrayList<StructuralUnitProperty>();
+		for (String property : properties)
+			this.properties.add(new StructuralUnitProperty(this, property, corpus));
+	}
+
+	/**
+	 * Gets the qualified name.
+	 * 
+	 * @return the qualified name
+	 */
+	public String getQualifiedName() {
+		return corpus.getCqpId() + "." + this.getName(); //$NON-NLS-1$
+	}
+
+	/**
+	 * Gets the name.
+	 * 
+	 * @return the name
+	 */
+	public String getName() {
+		return name;
+	}
+
+	/**
+	 * Gets the properties defined on this type of structural unit.
+	 * 
+	 * @return the properties
+	 */
+	public List<StructuralUnitProperty> getProperties() {
+		return properties;
+	}
+
+	/**
+	 * Gets a property from its name.
+	 * 
+	 * @param name
+	 *            the name
+	 * 
+	 * @return the property
+	 */
+	public StructuralUnitProperty getProperty(String name) {
+		for (StructuralUnitProperty property : properties)
+			if (property.getName().equals(name))
+				return property;
+		return null;
+
+	}
+
+	/* (non-Javadoc)
+	 * @see java.lang.Object#toString()
+	 */
+	@Override
+	public String toString() {
+		return name;
+	}
+
+	/**
+	 * Equals.
+	 *
+	 * @param su the su
+	 * @return true, if successful
+	 */
+	public boolean equals(StructuralUnit su) {
+		return name.equals(su.name) && corpus.equals(su.corpus);
+	}
+
+	/* (non-Javadoc)
+	 * @see java.lang.Comparable#compareTo(java.lang.Object)
+	 */
+	@Override
+	public int compareTo(Object arg0) {
+		if (arg0 instanceof StructuralUnit)
+			return this.getQualifiedName().compareTo(
+					((StructuralUnit) arg0).getQualifiedName());
+		return 0;
+	}
+
+	/**
+	 * Gets the ordered properties.
+	 *
+	 * @return the ordered properties
+	 */
+	public List<StructuralUnitProperty> getOrderedProperties() {
+		List<StructuralUnitProperty> props = this.getProperties();
+		Collections.sort(props);
+		return props;
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/StructuralUnit.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/Partition.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/Partition.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/Partition.java	(revision 258)
@@ -0,0 +1,716 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2016-11-17 17:01:31 +0100 (Thu, 17 Nov 2016) $
+// $LastChangedRevision: 3341 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.corpus;
+
+import java.text.Collator;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.TreeMap;
+
+import org.eclipse.osgi.util.NLS;
+import org.txm.Toolbox;
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.objects.TxmObject;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.corpus.query.Query;
+import org.txm.searchengine.cqp.corpus.query.QueryPart;
+import org.txm.utils.logger.Log;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+/**
+ * A partition on a corpus.
+ *
+ * @author sjacquot 
+ * @author Jean-Philippe Magué
+ * 
+ */
+public class Partition extends TxmObject {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 4420732757687971253L;
+
+	/** The parts. */
+	private List<Part> parts;
+
+	/** The structure. */
+	private StructuralUnit structure;
+
+	/** The property. */
+	private Property property;
+
+	/** An association between name of analysis property and lexical table. */
+//	private Map<String, LexicalTable> lexicalTables = new HashMap<String, LexicalTable>();
+
+	
+	/** The results stored by class. */
+	private TreeMap<String, List<Object>> results = new TreeMap<String, List<Object>>();
+
+	public static Integer SUBCORPUS_COUNTER = new Integer(0);
+	
+
+	
+	int totalsize = -1;
+	int[] partSizes;
+
+	
+	/**
+	 * Creates a new partition on a corpus given a structure, a property of this
+	 * structure and a liste of values this property can take
+	 * 
+	 * The partition has as many parts as the size of the list of value. The ith
+	 * part is composed by all the structure <code>structure</code> such as
+	 * <code>strucutre.getValue(property) == values.get(i)<code>
+	 * 
+	 * @param corpus
+	 *            the corpus
+	 * @param structure
+	 *            the structure
+	 * @param property
+	 *            the property
+	 * @param values
+	 *            the values
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	protected Partition(Corpus corpus, StructuralUnit structure, StructuralUnitProperty property, List<String> values)	throws CqiClientException {
+		super(corpus);
+		this.name = corpus.getName()+ "_" + structure.getName() + "_" + property.getName(); //$NON-NLS-1$ //$NON-NLS-2$
+		Log.finest(NLS.bind(TXMCoreMessages.NEW_PARTION, this.getCorpus(), this.name)); 
+		long start = System.currentTimeMillis();
+		this.structure = structure;
+		this.property = property;
+		this.parts = new ArrayList<Part>();
+		HashMap<String, String> infos = this.getCorpus().getSAttributesInfos().get(property.getFullName());
+		String type = "String"; //$NON-NLS-1$
+		if (infos != null) {
+			type = infos.get("type"); //$NON-NLS-1$
+		}
+		if (type == null || type.trim().length() == 0 || type.equals("String")) { //$NON-NLS-1$
+			Collections.sort(values, Collator.getInstance(Locale.getDefault())); // alpha sort
+		} else if (type.equals("Integer")) { //$NON-NLS-1$
+			Collections.sort(values, new Comparator<String>() {
+				@Override
+				public int compare(String arg0, String arg1) {
+					int i0 = Integer.parseInt(arg0);
+					int i1 = Integer.parseInt(arg1);
+					return i0-i1;
+				}
+			}); 
+		} else if (type.equals("Date")) { //$NON-NLS-1$
+			String format = infos.get("inputFormat"); //$NON-NLS-1$
+			final DateFormat formater = new SimpleDateFormat(format);
+			Collections.sort(values, new Comparator<String>() {
+				@Override
+				public int compare(String arg0, String arg1) {
+					try {
+						Date i0 = formater.parse(arg0);
+						Date i1 = formater.parse(arg1);
+						return i0.compareTo(i1);
+					} catch (ParseException e) {
+						return arg0.compareTo(arg1);
+					}
+				}
+			}); 
+		} else  if(type.contains("|")){ //$NON-NLS-1$
+			final List<String> sortedValues = Arrays.asList(type.split("\\|")); //$NON-NLS-1$
+			Collections.sort(values, new Comparator<String>() {
+				@Override
+				public int compare(String arg0, String arg1) {
+						int i0 = sortedValues.indexOf(arg0);
+						int i1 = sortedValues.indexOf(arg1);
+						return i0-i1;
+				}
+			}); 
+		}
+		//System.out.println("Parts sorted with type: "+type);
+		//System.out.println("values: "+values);
+		for (String value : values) {
+			String partitionName = this.getName();
+			String partName = value.replace("\\",""); //$NON-NLS-1$ //$NON-NLS-2$
+			//System.out.println("VALUE: "+value);
+			Query query = new QueryPart(structure, property, Query.addBackSlash(value));
+			Part part = createPart(partitionName, partName, query);
+			// System.out.println("part id: "+part.getQualifiedCqpId());
+			parts.add(part);
+		}
+		long end = System.currentTimeMillis();
+		Log.finest(NLS.bind(TXMCoreMessages.PARTITION_CREATED, this.name, (end - start)));
+	}
+
+	/**
+	 * Instantiates a new partition.
+	 *
+	 * @param corpus the corpus
+	 * @param structure the structure
+	 * @param property the property
+	 * @throws CqiClientException the cqi client exception
+	 */
+	protected Partition(Corpus corpus, StructuralUnit structure, StructuralUnitProperty property) throws CqiClientException {
+		this(corpus, structure, property, property.getValues(corpus));
+	}
+
+
+	/**
+	 * Create a partition with a set of raw queries.
+	 *
+	 * @param corpus the corpus
+	 * @param name the name
+	 * @param queries the queries
+	 * @throws CqiClientException the cqi client exception
+	 * @author Sylvain Loiseau
+	 */
+	protected Partition(Corpus corpus, String name, List<String> queries) throws CqiClientException {
+		super(corpus);
+		this.structure = null;
+		this.property = null;
+		if (name == null || name.trim().length() == 0)
+			name = "noname"; //$NON-NLS-1$
+		this.name = name;
+		Log.info(NLS.bind(TXMCoreMessages.NEW_PARTION, this.getCorpus(), this.name));
+		long start = System.currentTimeMillis();
+		this.parts = new ArrayList<Part>();
+		for (int i = 0; i < queries.size(); i++) {
+			String queryS = queries.get(i);
+			String partitionName = this.getName();
+			String partName = String.valueOf(i);
+			if (partName.length() == 0) partName = "-"; //$NON-NLS-1$
+			Part part = createPart(partitionName, partName, queryS);
+			parts.add(part);
+		}
+		long end = System.currentTimeMillis();
+		Log.info(NLS.bind(TXMCoreMessages.PARTITION_CREATED, this.name, (end - start)));
+	}
+
+	/**
+	 * Instantiates a new partition.
+	 *
+	 * @param corpus the corpus
+	 * @param name the name
+	 * @param queries the queries
+	 * @param partnames the partnames
+	 * @throws CqiClientException the cqi client exception
+	 */
+	public Partition(Corpus corpus, String name, List<String> queries, List<String> partnames) throws CqiClientException {
+		super(corpus);
+		this.structure = null;
+		this.property = null;
+		if (name == null || name.trim().length() == 0)
+			name = "noname"; //$NON-NLS-1$
+		this.name = name;
+		Log.info(NLS.bind(TXMCoreMessages.NEW_PARTION, this.getCorpus(), this.name));
+		long start = System.currentTimeMillis();
+		this.parts = new ArrayList<Part>();
+		for (int i = 0; i < queries.size(); i++) {
+			String queryS = queries.get(i);
+			String partitionName = this.getName();
+			String partName = partnames.get(i);
+			if (partName.trim().length() == 0) partName = "-"; //$NON-NLS-1$
+			Part part = createPart(partitionName, partName, queryS);
+			parts.add(part);
+		}
+		long end = System.currentTimeMillis();
+		Log.info(NLS.bind(TXMCoreMessages.PARTITION_CREATED, this.name, (end - start)));
+	}
+
+	
+	/**
+	 * Get the safe values (spacial char regexp safe).
+	 *
+	 * @param property the property
+	 * @param corpus the corpus
+	 * @return the safe values
+	 * @throws CqiClientException the cqi client exception
+	 */
+	private static List<String> getSafeValues(StructuralUnitProperty property, Corpus corpus) throws CqiClientException
+	{
+		List<String> values = property.getValues(corpus);
+		//System.out.println("CORPUS: "+corpus);
+		//System.out.println("VALUES: "+values);
+		for(int i = 0 ; i < values.size() ; i++)
+			values.set(i, Query.addBackSlash(values.get(i)));
+		return values;
+	}
+
+	
+	/**
+	 * Create a part with a raw query.
+	 *
+	 * @param partitionName the partition name
+	 * @param partName the part name
+	 * @param query the query
+	 * @return the part
+	 * @throws CqiClientException the cqi client exception
+	 * 
+	 * @author Sylvain Loiseau, mdecorde
+	 */
+	public Part createPart(String partitionName, String partName, String query)
+	throws CqiClientException {
+		Part part;
+		String partCqpId = CqpObject.partNamePrefix + Corpus.getNextSubcorpusCounter();
+		Log.finest(NLS.bind(TXMCoreMessages.CREATING_PART,partName, query));
+		long start = System.currentTimeMillis();
+		try {
+			CorpusManager.getCorpusManager().getCqiClient().cqpQuery(
+					this.getCorpus().getQualifiedCqpId(), partCqpId, query);
+			part = new Part(partCqpId, partitionName, partName, this,
+					new Query(query));
+		} catch (Exception e) {
+			try {
+				throw new CqiClientException(TXMCoreMessages.Partition_9 + partitionName
+						+ "_" + partName+ e +" last error: "+Toolbox.getCqiClient().getLastCQPError()); //$NON-NLS-1$ //$NON-NLS-2$
+			} catch (Exception e1) {
+				System.out.println(TXMCoreMessages.Partition_18+e1);
+				org.txm.utils.logger.Log.printStackTrace(e1);
+				return null;
+			}
+		}
+		long end = System.currentTimeMillis();
+		Log.finest(NLS.bind(TXMCoreMessages.PART_CREATED, partitionName
+				+ "_" + partName, (end - start))); //$NON-NLS-1$//$NON-NLS-2$
+		return part;
+	}
+
+	/**
+	 * Creates the part.
+	 *
+	 * @param partitionName the partition name
+	 * @param partName the part name
+	 * @param query the query
+	 * @return the part
+	 * @throws CqiClientException the cqi client exception
+	 */
+	private Part createPart(String partitionName, String partName, Query query)
+	throws CqiClientException {
+		if (partName.length() == 0) partName = "-"; //$NON-NLS-1$
+		return createPart(partitionName, partName, query.getQueryString());
+	}
+
+	/**
+	 * Gets the corpus.
+	 * 
+	 * @return the corpus
+	 */
+	public Corpus getCorpus() {
+		return (Corpus) this.parent;
+	}
+
+	//FIXME: useless?
+//	/**
+//	 * Gets the parts.
+//	 * 
+//	 * @return the parts
+//	 */
+//	public List<Part> getOrderedParts() {
+//		List<Part> sparts = parts;
+//		Collections.sort(sparts);
+//		return sparts;
+//	}
+
+	/**
+	 * Gets the parts.
+	 * 
+	 * @return the parts
+	 */
+	public List<Part> getParts() {
+		return parts;
+	}
+
+	/**
+	 * Gets the name of the parts.
+	 * 
+	 * @return the part names
+	 */
+	public List<String> getPartNames() {
+		List<String> partNames = new ArrayList<String>(parts.size());
+		for (Subcorpus part : parts)
+			partNames.add(part.getName());
+		return partNames;
+	}
+
+	//FIXME: useless?
+//	/**
+//	 * Gets the ordered name of the parts.
+//	 * 
+//	 * @return the part names
+//	 */
+//	public List<String> getOrderedPartNames() {
+//		List<String> partNames = getPartNames();
+//		Collections.sort(partNames);
+//		return partNames;
+//	}
+
+	/**
+	 * Gets the short name of the parts.
+	 * 
+	 * @return the part names
+	 */
+	public List<String> getPartShortNames() {
+		List<String> partNames = new ArrayList<String>(parts.size());
+		for (Part part : parts)
+			partNames.add(part.getShortName());
+		return partNames;
+	}
+
+	/**
+	 * Run a query on all the parts of this partition.
+	 * 
+	 * @param query
+	 *            the query
+	 * @param name
+	 *            the name
+	 * 
+	 * @return the list< subcorpus>
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	public List<QueryResult> query(Query query, String name)
+	throws CqiClientException {
+		Log.finest(TXMCoreMessages.QUERYING_PARTITION + this.name);
+		List<QueryResult> results = new ArrayList<QueryResult>(parts.size());
+		for (Subcorpus part : parts)
+			results.add(part.query(query, part.getName() + "_" + name, false)); //$NON-NLS-1$
+		return results;
+	}
+
+	/**
+	 * Gets the number of parts.
+	 * 
+	 * @return the the number of parts.
+	 */
+	public int getNPart() {
+		try {
+			return parts.size();
+		}
+		catch(Exception e) {
+		}
+		return 0;
+	}
+
+	/**
+	 * Gets the structure.
+	 *
+	 * @return the structure
+	 */
+	public StructuralUnit getStructure() {
+		return structure;
+	}
+
+	/**
+	 * Gets the property.
+	 *
+	 * @return the property
+	 */
+	public Property getProperty() {
+		return property;
+	}
+
+
+//
+//	/**
+//	 * Stores the result of textometric computation in this corpus.
+//	 *
+//	 * @param result the result
+//	 */
+//	public void storeResult(Object result) {
+//		if (!results.containsKey(result.getClass().getName())) results.put(result.getClass().getName(), new ArrayList<Object>());
+//		if(!results.get(result.getClass().getName()).contains(result))	{
+//			results.get(result.getClass().getName()).add(result);	
+//		}
+//	}
+//
+//	/**
+//	 * Removes a result stored in this corpus.
+//	 *
+//	 * @param result the result
+//	 * @return true, if successful
+//	 */
+//	@Override
+//	public boolean removeResult(Object result) {
+//		if (!results.containsKey(result.getClass().getName())) return false;
+//		
+//		boolean ret = results.get(result.getClass().getName()).remove(result);
+//		return ret;
+//	}
+//
+//	/**
+//	 * Gets the results of textometric computation stored in the corpus.
+//	 *
+//	 * @return the results
+//	 */
+//	@Override
+//	public List<Object> getResults() {
+//		ArrayList<Object> tmp = new ArrayList<Object>();
+//		for (String k : results.keySet()) {
+//			tmp.addAll(results.get(k));
+//		}
+//		return tmp;
+//	}
+
+	/**
+	 * Sets the name.
+	 *
+	 * @param name2 the new name
+	 */
+	public void setName(String name2) {
+		this.name = name2;
+		if(this.selfElement != null)
+			this.selfElement.setAttribute("name", name); //$NON-NLS-1$
+	}
+
+//	/* (non-Javadoc)
+//	 * @see org.txm.objects.TxmObject#getChildren()
+//	 */
+//	@Override
+//	public List<? extends TxmObject> getChildren() {
+//		return parts;
+//	}
+
+//	/* (non-Javadoc)
+//	 * @see org.txm.objects.TxmObject#getParent()
+//	 */
+//	@Override
+//	public TxmObject getParent() {
+//		return this.corpus;
+//	}
+
+	/**
+	 * Register to parent.
+	 *
+	 * @param partitionName the partition name
+	 */
+	private void registerToParent(String partitionName) {
+		if (this.selfElement == null && this.getParent() != null)
+		try {
+			Element parentElem = (Element) this.getCorpus().getSelfElement();
+			if (parentElem == null) return;
+			Document doc = parentElem.getOwnerDocument();
+			Element corporaElem;
+			if (this.getParent() instanceof MainCorpus) {
+				NodeList corporaList = parentElem.getElementsByTagName("preBuild"); //$NON-NLS-1$
+				corporaElem = (Element) corporaList.item(0);
+			} else {
+				corporaElem = parentElem;
+			}
+			Element partitionElem = doc.createElement("partition"); //$NON-NLS-1$
+			partitionElem.setAttribute("name", partitionName); //$NON-NLS-1$
+			corporaElem.appendChild(partitionElem);
+			this.selfElement = partitionElem;
+			for (Part p : parts) {
+				Element partElem = doc.createElement("part"); //$NON-NLS-1$
+				partElem.setAttribute("name", p.getName()); //$NON-NLS-1$
+				partElem.setAttribute("shortname", p.getShortName()); //$NON-NLS-1$
+				partElem.setAttribute("query", p.getQuery().getQueryString()); //$NON-NLS-1$
+				partitionElem.appendChild(partElem);
+			}
+		} catch (Exception e) {
+			System.out.println(TXMCoreMessages.Partition_21+e);
+		}
+		this.load();
+	}
+
+	/**
+	 * Register to parent.
+	 */
+	public void registerToParent() {
+		registerToParent(this.name);
+	}
+
+//	/* (non-Javadoc)
+//	 * @see org.txm.objects.TxmObject#hasChildren(org.txm.objects.TxmObject)
+//	 */
+//	@Override
+//	public boolean hasChildren(TxmObject children) {
+//		return parts.size() > 0;
+//	}
+
+	/**
+	 * Load.
+	 *
+	 * @param e the e
+	 * @return true, if successful
+	 */
+	public boolean load(Element e) {
+		this.selfElement = e;
+		return this.load();
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#load()
+	 */
+	@Override
+	public boolean load() {
+		if (this.selfElement != null && this.getParent() != null) {
+			NodeList partList = selfElement.getChildNodes();
+			for (int i = 0; i < partList.getLength(); i++) {
+				if (partList.item(i).getNodeType() == 1) {
+					Element c = (Element) partList.item(i);
+					if (c.getNodeName().equals("part")) //$NON-NLS-1$
+					{
+						String pname = c.getAttribute("name"); //$NON-NLS-1$
+						String pshortname = c.getAttribute("shortname"); //$NON-NLS-1$
+						String pquery = c.getAttribute("query"); //$NON-NLS-1$
+						for (Part part : parts)
+							if (part.getName().equals(pname)) {
+								part.setName(pname);
+								part.setShortName(pshortname);
+								part.setQuery(pquery);
+							}
+					}
+				}
+			}
+			this.loadMetadata();
+			return true;
+		}
+
+		return false;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#removeChildren(org.txm.objects.TxmObject)
+	 */
+	public TxmObject removeChildren(TxmObject children) {
+		if (children instanceof Part) {
+			if (children.getSelfElement() != null && children.getSelfElement().getParentNode() == selfElement)
+				selfElement.removeChild(children.getSelfElement());
+			parts.remove(children);
+			return children;
+		}
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#save()
+	 */
+	@Override
+	public boolean save() {
+		return false;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#delete()
+	 */
+	@Override
+	public boolean delete() {
+		try {
+			this.getCorpus().dropPartition(this);
+			super.delete();
+			this.selfElement.getParentNode().removeChild(selfElement);
+			return true;
+		} catch (CqiClientException e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+		return false;
+	}
+
+//	/* (non-Javadoc)
+//	 * @see org.txm.HasResults#getSubHasResults()
+//	 */
+//	@Override
+//	public List<HasResults> getSubHasResults() {
+//		return new ArrayList<HasResults>(0);
+//	}
+
+	/**
+	 * Gets the total of all part sizes.
+	 * @return
+	 * @throws CqiClientException
+	 */
+	public int getTotalSize() throws CqiClientException {
+		if (totalsize == -1) {
+			totalsize = 0;
+			for (Part p : parts) {
+				totalsize += p.getSize();
+			}
+		}
+		return totalsize;
+	}
+
+	/**
+	 * Gets the part sizes as int array.
+	 * @return
+	 * @throws CqiClientException
+	 */
+	public int[] getPartSizes() throws CqiClientException {
+		if (partSizes != null)
+			return partSizes;
+		partSizes = new int[getParts().size()];
+		for (int i = 0 ; i < getParts().size() ; i++) {
+			Part p = getParts().get(i);
+			partSizes[i] = p.getSize();
+		}
+		return partSizes;
+	}
+	
+	/**
+	 * Remove the specified <code>Part</code> from the partition.
+	 * @param p
+	 * @throws CqiClientException
+	 */
+	public void removePart(Part p) throws CqiClientException {
+		parts.remove(p);
+		p.dropSubcorpus(p);
+	}
+
+	@Override
+	public String getName() {
+		return this.name + ": "+ this.getNPart();
+	}
+
+
+	@Override
+	public String getSimpleName() {
+		return this.name;
+	}
+
+	@Override
+	public String getDetails() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public void clean() {
+		// TODO Auto-generated method stub
+		
+	}
+
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/Partition.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/CqpObject.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/CqpObject.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/CqpObject.java	(revision 258)
@@ -0,0 +1,125 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.corpus;
+
+import org.txm.searchengine.cqp.clientExceptions.InvalidCqpIdException;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The top class for all object having a counterpart in CQP.
+ * 
+ * @author Jean-Philippe Magué
+ */
+public interface CqpObject {
+
+	/** The Constant subcorpusNamePrefix. */
+	public static final String subcorpusNamePrefix = "S"; //$NON-NLS-1$
+
+	/** The Constant partNamePrefix. */
+	public static final String partNamePrefix = "P"; //$NON-NLS-1$
+
+	/** The Constant queryResultNamePrefix. */
+	public static final String queryResultNamePrefix = "Q"; //$NON-NLS-1$
+
+	/**
+	 * The cqp id.
+	 *
+	 * @param cqpId the cqp id
+	 * @return true, if successful
+	 * @throws InvalidCqpIdException the invalid cqp id exception
+	 */
+	// protected String cqpId;
+
+	/** The name. */
+	// protected String name;
+
+	/** The size. */
+	// protected int size = -1;
+
+	/** The mother main corpus. */
+	// protected MainCorpus motherMainCorpus;
+
+	/**
+	 * Instantiates a new cqp object mirroring the corpus in CQP with the given
+	 * id.
+	 * 
+	 * @param cqpId
+	 *            the cqp id
+	 * 
+	 * @throws InvalidCqpIdException
+	 *             the invalid cqp id exception
+	 */
+	// public void CqpObject(String cqpId);// throws InvalidCqpIdException;/*{
+
+	/**
+	 * Check whether the ID is a valid CQP ID.
+	 * 
+	 * @param cqpId
+	 *            the cqp id
+	 * 
+	 * @return true, if cqpId is a valid CQP ID.
+	 * 
+	 * @throws InvalidCqpIdException
+	 *             the invalid cqp id exception
+	 */
+	public boolean checkCqpId(String cqpId) throws InvalidCqpIdException;
+
+	/**
+	 * Gets the cqp id.
+	 * 
+	 * @return the cqp id
+	 */
+	public String getCqpId();/*
+							 * { return cqpId; }
+							 */
+
+	/**
+	 * Gets the name.
+	 * 
+	 * @return the name
+	 */
+	public String getName();/*
+							 * { return name; }
+							 */
+
+	/**
+	 * Gets the qualified cqp id.
+	 * 
+	 * @return the qualified cqp id
+	 */
+	public String getQualifiedCqpId();
+
+	/**
+	 * Gets the mother corpus.
+	 * 
+	 * @return the mother corpus
+	 */
+	public MainCorpus getMainCorpus();/*
+											 * { return motherMainCorpus; }
+											 */
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/CqpObject.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/Corpus.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/Corpus.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/Corpus.java	(revision 258)
@@ -0,0 +1,1357 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2016-11-29 16:47:07 +0100 (Tue, 29 Nov 2016) $
+// $LastChangedRevision: 3349 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.corpus;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import org.eclipse.osgi.util.NLS;
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.core.results.ITXMResult;
+import org.txm.functions.selection.SelectionResult;
+import org.txm.lexicon.core.corpusengine.cqp.Lexicon;
+import org.txm.objects.Base;
+import org.txm.objects.TxmObject;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.clientExceptions.InvalidCqpIdException;
+import org.txm.searchengine.cqp.corpus.query.Match;
+import org.txm.searchengine.cqp.corpus.query.Query;
+import org.txm.searchengine.cqp.corpus.query.QueryPart;
+import org.txm.searchengine.cqp.serverException.CqiServerError;
+import org.txm.statsengine.r.core.RWorkspace;
+import org.txm.utils.logger.Log;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class Corpus. A corpus is either a whole corpus, as managed by CQP or a
+ * subcorpus.
+ * 
+ * @see org.txm.searchengine.cqp.corpus.MainCorpus
+ * @see org.txm.searchengine.cqp.corpus.Subcorpus
+ * 
+ * @author Jean-Philippe Magué, Sylvain Loiseau
+ */
+public abstract class Corpus extends org.txm.objects.Corpus implements CqpObject {
+
+	public static String getNextQueryCounter() {
+		QUERY_COUNTER++;
+		return QUERY_COUNTER.toString();
+	}
+	public static String getNextSubcorpusCounter() {
+		SUBCORPUS_COUNTER++;
+		return SUBCORPUS_COUNTER.toString();
+	}
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = -2484830241553310773L;
+
+	/** The cqp id. */
+	protected String cqpId;
+
+	/** The size. */
+	protected int size = -1;
+
+	/** The mother main corpus. */
+	protected MainCorpus motherMainCorpus;
+	/** The corpus structural units. */
+	protected List<StructuralUnit> structuralUnits;
+
+	/** The corpus lexical units properties. */
+	protected List<Property> lexicalUnitsProperties;
+
+	protected int[] textLimits;
+
+	/** All the subcorpora that have been created from this corpus. */
+	protected List<Subcorpus> subcorpora;
+
+	/** All partitions that have been created from this corpus. */
+	protected List<Partition> partitions;
+
+	/** The results of textometric computation ran on this corpus. */
+//	private ArrayList<Object> results = new ArrayList<Object>();
+
+	/** An association between name of analysis property and lexical table. */
+	Map<String, Lexicon> lexicons = new HashMap<String, Lexicon>();
+
+	/** All private infos of the corpus. */
+	private String charset = "latin1"; //$NON-NLS-1$
+
+	/** The language. */
+	private String language = "???"; //$NON-NLS-1$
+	
+	
+	/**
+	 * Gets the locale of the corpus.
+	 * 
+	 * @return the locale
+	 */
+	String lang = null;
+
+	/** The nocorpus. */
+	protected static int nocorpus = 1;
+
+	/** The prefix r. */
+	protected static String prefixR = "Corpus"; //$NON-NLS-1$
+
+	/** The symbol. */
+	private String symbol;
+
+	protected static String WORD = "word"; //$NON-NLS-1$
+
+	protected Property wordProperty = null;
+
+	protected static Integer SUBCORPUS_COUNTER = new Integer(0);
+
+	private static Integer QUERY_COUNTER = new Integer(0);
+
+	/**
+	 * Creates a new object mapping a CQP corpus. This constructor is not
+	 * intended to be used directly. Use {@link CorpusManager#getCorpus(String)}
+	 * .
+	 * 
+	 * @param cqpId
+	 *            the id of the cqp corpus
+	 * 
+	 * @throws InvalidCqpIdException
+	 *             the invalid cqp id exception
+	 */
+	protected Corpus(String cqpId) throws InvalidCqpIdException {
+		super(null, null);
+		checkCqpId(cqpId);
+		this.cqpId = cqpId;
+		subcorpora = new ArrayList<Subcorpus>();
+		partitions = new ArrayList<Partition>();
+	}
+
+	
+	
+	/**
+	 * Creates a partition using a list of CQP queries.
+	 *
+	 * @param name the name
+	 * @param queries the queries
+	 * @return the partition
+	 * @throws CqiClientException the cqi client exception
+	 */
+	public Partition createPartition(String name, List<String> queries)
+			throws CqiClientException {
+		Partition partition = createPartition(name, queries, false);
+		return partition;
+	}
+
+	/**
+	 * Creates a partition using a list of CQP queries and save the Partition configuration in Workspace.
+	 * 
+	 * <strong>warning</strong> : this partition is not guaranteed to cover the
+	 * whole corpus neither to be non-intersecting.
+	 *
+	 * @param name the name
+	 * @param queries the queries
+	 * @param registered the registered
+	 * @return the partition
+	 * @throws CqiClientException the cqi client exception
+	 */
+	public Partition createPartition(String name, List<String> queries,
+			boolean registered) throws CqiClientException {
+		Partition partition = new Partition(this, name, queries);
+		partitions.add(partition);
+		if (!registered)
+			partition.registerToParent();
+		return partition;
+	}
+
+	/**
+	 * Create a partition from a set of queries and names.
+	 * 
+	 * <strong>warning</strong> : this partition is not guaranteed to cover the
+	 * whole corpus neither to be non-intersecting.
+	 *
+	 * @param name the name
+	 * @param queries the queries
+	 * @param partnames the partnames
+	 * @return the partition
+	 * @throws CqiClientException the cqi client exception
+	 */
+	public Partition createPartition(String name, List<String> queries,
+			List<String> partnames) throws CqiClientException {
+		Partition p = createPartition(name, queries, partnames, false);
+		return p;
+	}
+
+	/**
+	 * Creates a partition using a list of CQP queries and names each part.
+	 *
+	 * @param name the name
+	 * @param queries the queries
+	 * @param partnames the partnames
+	 * @param registered the registered
+	 * @return the partition
+	 * @throws CqiClientException the cqi client exception
+	 */
+	public Partition createPartition(String name, List<String> queries,
+			List<String> partnames, boolean registered)
+					throws CqiClientException {
+		Partition partition = new Partition(this, name, queries, partnames);
+		partitions.add(partition);
+		if (!registered)
+			partition.registerToParent();
+		return partition;
+	}
+
+	/**
+	 * Create a partition with all values of a structural unit property.
+	 *
+	 * @param name the name
+	 * @param structure the structure
+	 * @param property the property
+	 * @return the partition
+	 * @throws CqiClientException the cqi client exception
+	 */
+	public Partition createPartition(String name, StructuralUnit structure,
+			StructuralUnitProperty property) throws CqiClientException {
+		Partition partition = createPartition(structure, property);
+		partition.setName(name);
+		return partition;
+	}
+
+	/**
+	 * Create a partition with a set of values of a structural unit property.
+	 *
+	 * @param name the name
+	 * @param structure the structure
+	 * @param property the property
+	 * @param values the values
+	 * @return the partition
+	 * @throws CqiClientException the cqi client exception
+	 */
+	public Partition createPartition(String name, StructuralUnit structure,
+			StructuralUnitProperty property, List<String> values)
+					throws CqiClientException {
+		Partition partition = createPartition(name, structure, property,
+				values, false);
+		return partition;
+	}
+
+	/**
+	 * Create a partition with a set of values of a structural unit property.
+	 * save result configuration in Workspace
+	 *
+	 * @param name the name
+	 * @param structure the structure
+	 * @param property the property
+	 * @param values the values
+	 * @param registered the registered
+	 * @return the partition
+	 * @throws CqiClientException the cqi client exception
+	 */
+	public Partition createPartition(String name, StructuralUnit structure,
+			StructuralUnitProperty property, List<String> values,
+			boolean registered) throws CqiClientException {
+		Partition partition = createPartition(structure, property, values,
+				registered);
+		if (name != null)
+			partition.setName(name);
+		return partition;
+	}
+
+	/**
+	 * Creates a new partition from a structural unit and a property of this
+	 * structural unit. One part is created for each possible value of the
+	 * property.
+	 * 
+	 * @param structure
+	 *            the structure
+	 * @param property
+	 *            the property
+	 * 
+	 * @return the partition
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 * 
+	 * @see org.txm.searchengine.cqp.corpus.partition.core.corpusengine.cqp.corpus.Partition#Partition
+	 */
+	public Partition createPartition(StructuralUnit structure,
+			StructuralUnitProperty property) throws CqiClientException {
+		Partition partition = createPartition(structure, property, false);
+		return partition;
+	}
+	/**
+	 * Creates the partition.
+	 *
+	 * @param structure the structure
+	 * @param property the property
+	 * @param registered the registered
+	 * @return the partition
+	 * @throws CqiClientException the cqi client exception
+	 */
+	public Partition createPartition(StructuralUnit structure,
+			StructuralUnitProperty property, boolean registered)
+					throws CqiClientException {
+		Partition partition = new Partition(this, structure, property);
+		partitions.add(partition);
+		if (!registered)
+			partition.registerToParent();
+		return partition;
+	}
+	
+
+	/**
+	 * Creates a new partition from a structural unit, a property of this
+	 * structural unit and a list of possible values for the property. One part
+	 * per value is created. <strong>warning</strong> : this partition is not
+	 * guaranteed to cover the whole corpus
+	 * 
+	 * @param structure
+	 *            the structure
+	 * @param property
+	 *            the property
+	 * @param values
+	 *            the values
+	 * 
+	 * @return the partition
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 * 
+	 * @see org.txm.searchengine.cqp.corpus.partition.core.corpusengine.cqp.corpus.Partition#Partition
+	 */
+	public Partition createPartition(StructuralUnit structure,
+			StructuralUnitProperty property, List<String> values)
+					throws CqiClientException {
+		Partition partition = createPartition(structure, property, values,
+				false);
+		return partition;
+	}
+
+	/**
+	 * Creates the partition.
+	 *
+	 * @param structure the structure
+	 * @param property the property
+	 * @param values the values
+	 * @param registered the registered
+	 * @return the partition
+	 * @throws CqiClientException the cqi client exception
+	 */
+	public Partition createPartition(StructuralUnit structure,
+			StructuralUnitProperty property, List<String> values,
+			boolean registered) throws CqiClientException {
+		Partition partition = new Partition(this, structure, property, values);
+		partitions.add(partition);
+		if (!registered)
+			partition.registerToParent();
+		return partition;
+	}
+
+	/**
+	 * Creates a subcorpus using workspace definition.
+	 *
+	 * @param elem the XML element
+	 * @return the subcorpus
+	 * @throws CqiClientException the cqi client exception
+	 */
+	public Subcorpus createSubcorpus(Element elem) throws CqiClientException {
+		Query query = new Query(elem.getAttribute("query")); //$NON-NLS-1$
+		String subcorpusName = elem.getAttribute("name"); //$NON-NLS-1$
+
+		Subcorpus subcorpus;
+		String subcorpusCqpId = subcorpusNamePrefix	+ getNextSubcorpusCounter();
+
+		// long start = System.currentTimeMillis();
+		try {
+			CorpusManager.getCorpusManager().getCqiClient().cqpQuery(this.getQualifiedCqpId(), subcorpusCqpId,
+					query.getQueryString());
+			subcorpus = new Subcorpus(subcorpusCqpId, subcorpusName, this, query);
+			subcorpus.selfElement = elem;
+			subcorpora.add(subcorpus);
+		} catch (Exception e) {
+			throw new CqiClientException(e);
+		}
+
+		return subcorpus;
+	}
+
+	/**
+	 * Create a named subcorpus from a query on this corpus.
+	 * 
+	 * @param query
+	 *            the query
+	 * @param subcorpusName
+	 *            the resulting subcorpus name
+	 * 
+	 * @return the resulting subcorpus
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	public Subcorpus createSubcorpus(Query query, String subcorpusName)
+			throws CqiClientException {
+		Subcorpus sc = createSubcorpus(query, subcorpusName, false);
+		return sc;
+	}
+
+	/**
+	 * Creates a subcorpus and save configuration in the workspace.
+	 *
+	 * @param query the query
+	 * @param subcorpusName the subcorpus name
+	 * @param registered the registered
+	 * @return the subcorpus
+	 * @throws CqiClientException the cqi client exception
+	 */
+	public Subcorpus createSubcorpus(Query query, String subcorpusName,
+			boolean registered) throws CqiClientException {
+		Subcorpus subcorpus;
+		String subcorpusCqpId = subcorpusNamePrefix + getNextSubcorpusCounter().toString();
+		Log.finest(TXMCoreMessages.CREATING_SUBCORPUS + this.getQualifiedCqpId()
+				+ " " + subcorpusName + " " + query.getQueryString()); //$NON-NLS-1$ //$NON-NLS-2$
+
+		long start = System.currentTimeMillis();
+		try {
+			CorpusManager.getCorpusManager().getCqiClient().cqpQuery(
+					this.getQualifiedCqpId(), subcorpusCqpId,
+					query.getQueryString());
+			//System.out.println("SUBCORPUS: "+subcorpusCqpId+" q="+query.getQueryString());
+			subcorpus = new Subcorpus(subcorpusCqpId, subcorpusName, this, query);
+			subcorpora.add(subcorpus);
+		} catch (Exception e) {
+			throw new CqiClientException(e);
+		}
+		long end = System.currentTimeMillis();
+		Log.finest(TXMCoreMessages.SUBCORPUS_CREATED + subcorpusName
+				+ TXMCoreMessages.Corpus_8 + (end - start));
+
+		if (!registered) subcorpus.registerToParent();
+		return subcorpus;
+	}
+
+	public Subcorpus createSubcorpus(String name, QueryResult queryResult) throws InvalidCqpIdException {
+		Subcorpus sub = new Subcorpus(queryResult.getCqpId(), name, this, null);
+		subcorpora.add(sub);
+		return sub;
+	}
+
+	public Subcorpus createSubcorpus(String name, String cqpid) throws InvalidCqpIdException {
+		Subcorpus sub = new Subcorpus(cqpid, name, this, null);
+		subcorpora.add(sub);
+		return sub;
+	}
+	
+	/**
+	 * Creates the subcorpus.
+	 *
+	 * @param elem the elem
+	 * @return the subcorpus
+	 * @throws CqiClientException the cqi client exception
+	 */
+	public Subcorpus createSubcorpus(String name, SelectionResult selectionResult) throws CqiClientException {
+		Subcorpus sub = createSubcorpus(this.getStructuralUnit("text"), this.getStructuralUnit("text").getProperty("id"), selectionResult, name); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+		sub.setSelectionResult(selectionResult);
+		return sub;
+	}
+	
+	/**
+	 * Creates the subcorpus.
+	 *
+	 * @param structuralUnit the structural unit
+	 * @param structuralUnitProperty the structural unit property
+	 * @param values the values
+	 * @param subcorpusName the subcorpus name
+	 * @return the subcorpus
+	 * @throws CqiClientException the cqi client exception
+	 */
+	public Subcorpus createSubcorpus(StructuralUnit structuralUnit,
+			StructuralUnitProperty structuralUnitProperty, List<String> values,
+			String subcorpusName) throws CqiClientException {
+		if (values.size() == 0) {
+			Log.warning(TXMCoreMessages.Corpus_5);
+			return null;
+		}
+		String value = ""; //$NON-NLS-1$
+		for (String v : values)
+			value += Query.addBackSlash(v) + "|"; //$NON-NLS-1$
+		value = value.substring(0, value.length() - 1);
+		
+		Query query = new QueryPart(structuralUnit, structuralUnitProperty, value);
+		return createSubcorpus(query, subcorpusName);
+		//return createSubcorpus(structuralUnit, structuralUnitProperty, value, subcorpusName);
+	}
+
+	/**
+	 * Create a subcorpus from a structural unit, a property on this structural
+	 * unit and a value for this property.
+	 *
+	 * @param structuralUnit the structural unit
+	 * @param structuralUnitProperty the structural unit property
+	 * @param value the value
+	 * @param subcorpusName the subcorpus name
+	 * @return the subcorpus
+	 * @throws CqiClientException the cqi client exception
+	 * @author Sylvain Loiseau
+	 */
+	public Subcorpus createSubcorpus(StructuralUnit structuralUnit,
+			StructuralUnitProperty structuralUnitProperty, String value,
+			String subcorpusName) throws CqiClientException {
+		Query query = new QueryPart(structuralUnit, structuralUnitProperty,
+				Query.addBackSlash(value));
+		// System.out.println("forged query : "+query.getQueryString());
+		return createSubcorpus(query, subcorpusName);
+	}
+
+	/**
+	 * Create a subcorpus from a structural unit, a property on this structural
+	 * unit and a value for this property.
+	 *
+	 * @param structuralUnit the structural unit
+	 * @param structuralUnitProperty the structural unit property
+	 * @param value the value
+	 * @param subcorpusName the subcorpus name
+	 * @return the subcorpus
+	 * @throws CqiClientException the cqi client exception
+	 * @author Sylvain Loiseau
+	 */
+	public Subcorpus createSubcorpusWithQueryString(StructuralUnit structuralUnit,
+			StructuralUnitProperty structuralUnitProperty, String value,
+			String subcorpusName) throws CqiClientException {
+		Query query = new QueryPart(structuralUnit, structuralUnitProperty,
+				value);
+		// System.out.println("forged query : "+query.getQueryString());
+		return createSubcorpus(query, subcorpusName);
+	}
+
+	/**
+	 * Drop all the partitions.
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	public void dropAllPartitions() throws CqiClientException {
+		List<Partition> _partitions = new ArrayList<Partition>();
+		_partitions.addAll(partitions);
+		for (Partition partition : _partitions)
+			this.dropPartition(partition);
+		_partitions = null;
+	}
+
+	/**
+	 * Drop all the subcorpora.
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	public void dropAllSubcorpora() throws CqiClientException {
+		//System.out.println("!! drop all subcorpora: "+subcorpora.size());
+		while(subcorpora.size() > 0)
+			this.dropSubcorpus(subcorpora.get(0));
+	}
+
+	/**
+	 * Drop a lexicon from the cache. Return the dropped lexicon, or
+	 * <code>null</code> if no lexicon was existing for this analysis property.
+	 * 
+	 * @param analysisProperty
+	 *            the analysis property
+	 * 
+	 * @return the lexicon
+	 * 
+	 * @author sloiseau
+	 */
+	public Lexicon dropLexicon(Property analysisProperty) {
+		return lexicons.remove(analysisProperty.getName());
+	}
+
+	/**
+	 * Drops a partition.
+	 * 
+	 * @param partition
+	 *            the partition
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	public void dropPartition(Partition partition) throws CqiClientException {
+		Log.finest(TXMCoreMessages.DROP_PARTITION + partition.getName());
+		for (Part part : partition.getParts())
+			try {
+				CorpusManager.getCorpusManager().getCqiClient().dropSubCorpus(part.getQualifiedCqpId());
+			} catch (Exception e) {
+				throw new CqiClientException(e);
+			}
+		partitions.remove(partition);
+	}
+
+	/**
+	 * Drop query result.
+	 * 
+	 * @param queryResult
+	 *            the query result
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	public void dropQueryResult(QueryResult queryResult)
+			throws CqiClientException {
+		Log.finest(TXMCoreMessages.DROP_QUERYRESULT + queryResult.getName());
+		try {
+			CorpusManager.getCorpusManager().getCqiClient().dropSubCorpus(queryResult.getQualifiedCqpId());
+		} catch (Exception e) {
+			throw new CqiClientException(e);
+		}
+	}
+
+	/**
+	 * Drops a subcorpus in CQP also its subcorpus and partitions.
+	 * 
+	 * @param subcorpus
+	 *            the subcorpus
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	public boolean dropSubcorpus(Corpus subcorpus) throws CqiClientException {
+		Log.finest(NLS.bind(TXMCoreMessages.DROP_SUBCORPUS, subcorpus.getName()));
+		subcorpus.dropAllSubcorpora();
+		subcorpus.dropAllPartitions();
+		try {
+			CorpusManager.getCorpusManager().getCqiClient().dropSubCorpus(
+					subcorpus.getQualifiedCqpId());
+		} catch (Exception e) {
+			throw new CqiClientException(e);
+		}
+		return subcorpora.remove(subcorpus);
+	}
+
+	/**
+	 * Test if 2 corpus have the same CQP id.
+	 *
+	 * @param c the c
+	 * @return true, if successful
+	 */
+	public boolean equals(Corpus c) {
+		return cqpId.equals(c.cqpId);
+	}
+
+	/**
+	 * Gets the base.
+	 *
+	 * @return the base
+	 */
+	@Override
+	public abstract Base getBase();
+
+	/**
+	 * Get the charset using CQP registry.
+	 *
+	 * @return the charset
+	 */
+	public String getCharset() {
+		if (this.charset.matches("latin1")) //$NON-NLS-1$
+			return "ISO-8859-1"; //$NON-NLS-1$
+		else if (this.charset.matches("latin2")) //$NON-NLS-1$
+			return "ISO-8859-2"; //$NON-NLS-1$
+		else if (this.charset.matches("latin3")) //$NON-NLS-1$
+			return "ISO-8859-3"; //$NON-NLS-1$
+		else if (this.charset.matches("latin4")) //$NON-NLS-1$
+			return "ISO-8859-4"; //$NON-NLS-1$
+		else if (this.charset.matches("latin5")) //$NON-NLS-1$
+			return "ISO-8859-5"; //$NON-NLS-1$
+		else if (this.charset.matches("latin6")) //$NON-NLS-1$
+			return "ISO-8859-6"; //$NON-NLS-1$
+		else if (this.charset.matches("latin7")) //$NON-NLS-1$
+			return "ISO-8859-7"; //$NON-NLS-1$
+		else if (this.charset.matches("latin8")) //$NON-NLS-1$
+			return "ISO-8859-8"; //$NON-NLS-1$
+		else if (this.charset.matches("latin9")) //$NON-NLS-1$
+			return "ISO-8859-9"; //$NON-NLS-1$
+		return charset;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#getChildren()
+	 */
+	public List<? extends TxmObject> getChildren() {
+		List<? extends TxmObject> ret = subcorpora;
+		return ret;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.searchengine.cqp.corpus.CqpObject#getCqpId()
+	 */
+	@Override
+	public String getCqpId() {
+		return cqpId;
+	}
+
+	/**
+	 * Gets the corpus informations using CQP registry.
+	 *
+	 * @return the infos
+	 */
+	public String getInfos() {
+		return TXMCoreMessages.Corpus_2 + this.name + TXMCoreMessages.Corpus_3 + getCharset()
+				+ TXMCoreMessages.Corpus_4 + getLanguage();
+	}
+
+	/**
+	 * Gets the language.
+	 *
+	 * @return the language
+	 */
+	public String getLanguage() {
+		return language;
+	}
+
+	/**
+	 * Gets the lexicon relative to a given property.
+	 * 
+	 * @param property
+	 *            the property
+	 * 
+	 * @return the lexicon
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	public abstract Lexicon getLexicon(Property property)
+			throws CqiClientException;
+
+	/**
+	 * Get the corpus locale using txmcorpus_lang property
+	 * @return
+	 */
+	public Locale getLocale() {
+		/*Serializable lang = this.getAttribute("lang"); //$NON-NLS-1$
+		if (lang != null) {
+			return new Locale(lang.toString());
+		} else
+			return Locale.getDefault();*/
+		//System.out.println("getLang1: "+lang);
+		if(lang == null) {
+			try {
+				StructuralUnit su = this.getStructuralUnit("txmcorpus"); //$NON-NLS-1$
+				StructuralUnitProperty prop = su.getProperty("lang"); //$NON-NLS-1$
+				List<String> values = prop.getValues();
+				if(values.size() > 0)
+					lang = values.get(0);
+				//System.out.println("get lang: "+lang);
+			} catch (Exception e) {
+				// TODO Auto-generated catch block
+				//org.txm.utils.logger.Log.printStackTrace(e);
+				System.out.println(TXMCoreMessages.Corpus_13+e);
+			}
+		}
+		if(lang != null)
+			return new Locale(lang);
+		else
+			return Locale.getDefault();
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.searchengine.cqp.corpus.CqpObject#getMotherMainCorpus()
+	 */
+	@Override
+	public MainCorpus getMainCorpus() {
+		if (this instanceof MainCorpus) return (MainCorpus) this;
+
+		if (this.getParent() == null) return null;
+		if (motherMainCorpus == null) {
+			if (this.getParent() instanceof MainCorpus)
+				motherMainCorpus = (MainCorpus) this.getParent();
+			else
+				motherMainCorpus = ((Subcorpus)this.getParent()).getMainCorpus();
+		}
+		return motherMainCorpus;
+	}
+
+	abstract public List<Match> getMatches();
+
+
+	
+	@Override
+	public String getName() {
+		return name;
+	}
+	
+	@Override
+	public String getSimpleName() {
+		return name;
+	}
+	
+	/**
+	 * Get the ordered properties (by name).
+	 *
+	 * @return the ordered properties
+	 * @throws CqiClientException the cqi client exception
+	 */
+	@SuppressWarnings("unchecked") //$NON-NLS-1$
+	public List<Property> getOrderedProperties() throws CqiClientException {
+		List<Property> props = this.getProperties();
+		Collections.sort(props);
+		return props;
+	}
+
+	/**
+	 * Get the ordered Structural unit properties (by name)
+	 * @return
+	 * @throws CqiClientException
+	 */
+	public Collection<? extends Property> getOrderedStructuralUnitProperties()
+			throws CqiClientException {
+		List<StructuralUnitProperty> properties = new ArrayList<StructuralUnitProperty>();
+		for (StructuralUnit su : this.getOrderedStructuralUnits())
+			if (su.getProperties() != null)
+				properties.addAll(su.getProperties());
+
+		return properties;
+	}
+
+	/**
+	 * Get the ordered structural units.
+	 *
+	 * @return the ordered structural units
+	 * @throws CqiClientException the cqi client exception
+	 */
+	@SuppressWarnings("unchecked") //$NON-NLS-1$
+	public List<StructuralUnit> getOrderedStructuralUnits() throws CqiClientException {
+		List<StructuralUnit> units = this.getStructuralUnits();
+		Collections.sort(units);
+		return units;
+	}
+
+	/**
+	 * Get all the partitions defined on a given corpus.
+	 *
+	 * @param name the name
+	 * @return the partitions
+	 */
+	public Partition getPartition(String name) {
+		for (Partition p : partitions)
+			if (p.getName().equals(name))
+				return p;
+		return null;
+	}
+
+	/**
+	 * Gets all the partitions defined on a given corpus.
+	 * 
+	 * @return the partitions
+	 */
+	public List<Partition> getPartitions() {
+		return partitions;
+	}
+
+	/**
+	 * Gets the properties defined for the lexical units of this corpus.
+	 * 
+	 * @return the properties
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	public abstract List<Property> getProperties() throws CqiClientException;
+
+	/**
+	 * Gets a property from its name.
+	 * 
+	 * @param name
+	 *            the name
+	 * 
+	 * @return the property
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	public abstract Property getProperty(String name) throws CqiClientException;
+
+	/**
+	 * Gets the results of textometric computation stored in the corpus.
+	 * 
+	 * @return the results
+	 */
+	@Override
+	public ArrayList<ITXMResult> getResults() {
+		ArrayList<ITXMResult> allResults = new ArrayList<ITXMResult>();
+		allResults.addAll(this.children);
+		allResults.addAll(this.lexicons.values());
+		return allResults;
+	}
+
+	/**
+	 * Gets the CQP size of the corpus.
+	 *
+	 * @return the size
+	 * @throws CqiClientException the cqi client exception
+	 */
+	public abstract int getSize() throws CqiClientException;
+
+	/**
+	 * Gets a structural unit from its name.
+	 *
+	 * @param name the name
+	 * @return the structural unit
+	 * @throws CqiClientException the cqi client exception
+	 */
+	public abstract StructuralUnit getStructuralUnit(String name)
+			throws CqiClientException;
+
+	/**
+	 * Gets all structural units property of a corpus.
+	 *
+	 * @return the structural unit properties
+	 * @throws CqiClientException the cqi client exception
+	 */
+	public List<StructuralUnitProperty> getStructuralUnitProperties()
+			throws CqiClientException {
+		if (this.structuralUnits == null)
+			getStructuralUnits();
+
+		List<StructuralUnitProperty> properties = new ArrayList<StructuralUnitProperty>();
+		if (this.structuralUnits != null)
+			for (StructuralUnit su : this.structuralUnits)
+				if (su.getProperties() != null)
+					properties.addAll(su.getProperties());
+
+		return properties;
+	}
+
+	/**
+	 * Gets a structural units property of a structural unit by its name.
+	 *
+	 * @param name the name
+	 * @return the structural unit properties
+	 * @throws CqiClientException the cqi client exception
+	 */
+	public List<StructuralUnitProperty> getStructuralUnitProperties(String name)
+			throws CqiClientException {
+		StructuralUnit su = this.getStructuralUnit(name);
+
+		return su.getProperties();
+	}
+
+	/**
+	 * Gets the structural units defined on this corpus.
+	 * 
+	 * @return the structural units
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	public abstract List<StructuralUnit> getStructuralUnits()
+			throws CqiClientException;
+
+	/**
+	 * Gets all the subcorpora defined on a given corpus.
+	 * 
+	 * @return the subcorpora
+	 */
+	public List<Subcorpus> getSubcorpora() {
+		return subcorpora;
+	}
+
+	/**
+	 * Gets the subcorpus by name.
+	 *
+	 * @param name the name
+	 * @return the subcorpus by name
+	 */
+	public Corpus getSubcorpusByName(String name)
+	{
+		for (Corpus corpus : subcorpora) {
+			if (corpus.getName().equals(name))
+				return corpus;
+		}
+
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.HasResults#getSubHasResults()
+	 */
+	public ArrayList<ITXMResult> getSubHasResults() {
+		ArrayList<ITXMResult> subresults = new ArrayList<ITXMResult>();
+		subresults.addAll(this.getSubcorpora());
+		subresults.addAll(this.getPartitions());
+		return subresults;
+	}
+	/**
+	 * Gets the R symbol is corpus was sent in R Workspace.
+	 *
+	 * @return the symbol
+	 */
+	public String getSymbol()
+	{
+		return symbol;
+	}
+
+	abstract public int[] getTextEndLimits() throws CqiClientException, IOException, CqiServerError, InvalidCqpIdException;
+
+	/*public List<Property> getPreferedOrderedProperties() throws CqiClientException {
+		if (this.getAttribute("viewprops_order"))
+		List<Property> props = this.getProperties();
+		Collections.sort(props);
+		return props;
+	}*/
+
+	abstract public int[] getTextStartLimits() throws CqiClientException, IOException, CqiServerError, InvalidCqpIdException;
+
+	abstract public int[] getStartLimits(String structural_unit_property) throws IOException, CqiServerError, InvalidCqpIdException, CqiClientException;
+	
+	public Property getWordProperty() throws CqiClientException {
+		if (wordProperty == null)
+			wordProperty = getProperty(WORD);
+		return wordProperty;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#hasChildren(org.txm.objects.TxmObject)
+	 */
+	@Override
+	public boolean hasChildren(TxmObject children) {
+		return this.subcorpora.size() > 0;
+	}
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#load()
+	 */
+	@Override
+	public boolean load() {
+		//System.out.println("*** Load corpus: "+name);
+		if (selfElement == null) {
+			System.out.println(TXMCoreMessages.Corpus_14+this+TXMCoreMessages.Corpus_15);
+			return false;
+		}
+
+		// 1- texts queries then
+		// 2- get metadatas, pattributes, sattributes, editions, biblios,  uis,
+		super.load();  
+		// System.out.println("Load corpus : "+this.name);
+		this.loadMetadata(); // read <prop>s
+
+		// 3- build saved subcorpus and partition
+		//System.out.println("restore subcorpora: "+selfElement);
+		NodeList preBuildElems = selfElement.getElementsByTagName("preBuild"); //$NON-NLS-1$
+		if (preBuildElems.getLength() > 0) {
+			Element preBuildElem = (Element) preBuildElems.item(0);
+			NodeList subcorpusElems = preBuildElem.getElementsByTagName("subcorpus"); //$NON-NLS-1$
+			for (int i = 0 ; i < subcorpusElems.getLength() ; i++) {
+				Element subcorpusElem = (Element) subcorpusElems.item(i);
+				if (!subcorpusElem.getParentNode().equals(preBuildElem)) continue; //level 1 elements
+				//System.out.println("subcorpus "+subcorpusElem.getAttribute("name"));
+				try {
+					Subcorpus subcorp = this.createSubcorpus(subcorpusElem);
+					subcorp.selfElement = subcorpusElem;
+					subcorp.load();
+				} catch (CqiClientException e) {
+					Log.warning(this.name + TXMCoreMessages.Corpus_12 + name
+							+ " : " + e); //$NON-NLS-1$
+				}
+			}
+
+			NodeList partitionElems = preBuildElem.getElementsByTagName("partition"); //$NON-NLS-1$
+			for (int i = 0 ; i < partitionElems.getLength() ; i++) {
+				Element partitionElem = (Element) partitionElems.item(i);
+				if (!partitionElem.getParentNode().equals(preBuildElem)) continue; //level 1 elements
+				String name = partitionElem.getAttribute("name"); //$NON-NLS-1$
+				List<String> names = new ArrayList<String>();
+				List<String> queries = new ArrayList<String>();
+
+				NodeList partElems = partitionElem.getElementsByTagName("part"); //$NON-NLS-1$
+				for (int j = 0; j < partElems.getLength(); j++) {
+					Element part = (Element) partElems.item(j);
+					names.add(part.getAttribute("name")); //$NON-NLS-1$
+					queries.add(part.getAttribute("query")); //$NON-NLS-1$
+				}
+				try {
+					//System.out.println("Create Partition with corpus "+this+" : "+name+", queries "+queries+", names "+names);
+					Partition partition = this.createPartition(name, queries, names, true);
+					partition.load(partitionElem);
+				} catch (CqiClientException e) {
+					Log.warning(this.name + TXMCoreMessages.Corpus_19 + name
+							+ " : " + e); //$NON-NLS-1$
+					//c.getParentNode().removeChild(c);
+				}
+			}
+		}
+
+		// 4- initialize JPA persistence of annotations
+//		try {
+//			AnnotationManager.getInstance().initTemporaryAnnotationDatabase(this);
+//		} catch(Exception e) {
+//			System.out.println("Fail to load annotation service: "+e);
+//			Log.printStackTrace(e);
+//		}
+//		
+		return false;
+	}
+
+	/**
+	 * Runs a query on the corpus and store the result in a QueryResult.
+	 * 
+	 * !! each working query is store in the Base of the corpus !!
+	 * 
+	 * @param query
+	 *            the query
+	 * @param queryResultName
+	 *            the resulting subcorpus name
+	 * 
+	 * @return the resulting query result
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	public QueryResult query(Query query, String queryResultName, boolean save)
+			throws CqiClientException {
+		QueryResult queryResult = null;
+		//String queryResultId = queryResultNamePrefix + UUID.randomUUID().toString();
+		String queryResultId = queryResultNamePrefix + getNextQueryCounter();
+		Log.finest(NLS.bind(TXMCoreMessages.QUERY, new String[]{this.getQualifiedCqpId(), queryResultId, query.getQueryString()})); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
+		// long start = System.currentTimeMillis();
+		try {
+			CorpusManager.getCorpusManager().getCqiClient().cqpQuery(
+					this.getQualifiedCqpId(), queryResultId,
+					query.getQueryString());
+			queryResult = new QueryResult(queryResultId, queryResultName, this,	query);
+			if (save) this.addQueryLog(query, new ArrayList<String>());
+		} catch (Exception e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+			throw new CqiClientException(e);
+		}
+		// long end = System.currentTimeMillis();
+		// Log.finest(Messages.RETURN_FROM_QUERY+ " " + queryResult.getNMatch() + " " + (end - start)); //$NON-NLS-1$ //$NON-NLS-2$
+
+		return queryResult;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#removeChildren(org.txm.objects.TxmObject)
+	 */
+	@Override
+	public TxmObject removeChildren(TxmObject children) {
+		Element preBuildElement = this.getBase().getBaseParameters().getPreBuildElement();
+		if (children instanceof Subcorpus) {
+			try {
+				if (children.getSelfElement() != null && 
+						children.getSelfElement().getParentNode() == selfElement)
+					preBuildElement.removeChild(children.getSelfElement());
+
+				if (!dropSubcorpus((Corpus) children)) {
+					System.out.println("Corpus.removeChildren: dropSubcorpus returned false.");
+					return null;
+				}
+				return children;
+			} catch (CqiClientException e) {
+				return null;
+			}
+		} else if (children instanceof Partition) {
+			if (children.getSelfElement() != null && 
+					children.getSelfElement().getParentNode() == selfElement) {
+				preBuildElement.removeChild(children.getSelfElement());
+			}
+			partitions.remove(children);
+			try {
+				dropPartition((Partition) children);
+				return children;
+			} catch (CqiClientException e) {
+				return null;
+			}
+
+		}
+		return null;
+	}
+
+//	/**
+//	 * Removes a result stored in this corpus.
+//	 *
+//	 * @param result the result
+//	 * @return true, if successful
+//	 */
+//	public Object removeResult(int idx) {
+//		return results.remove(idx);
+//	}
+
+//	/**
+//	 * Removes a result stored in thsi corpus.
+//	 *
+//	 * @param result the result
+//	 * @return true, if successful
+//	 */
+//	@Override
+//	public boolean removeResult(Object result) {
+//		return results.remove(result);
+//	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#save()
+	 */
+	@Override
+	public boolean save() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	
+	
+	/**
+	 * Send the Corpus indexes to R.
+	 * 
+	 * Only the word properties are send.
+	 * TODO: send structural unit properties too
+	 *
+	 * @return the string
+	 * @throws Exception the exception
+	 */
+	public String SendToR() throws Exception
+	{
+		int initialPosition = 0;
+		if (this.getMatches() != null && this.getMatches().size() > 0)
+			initialPosition = this.getMatches().get(0).getStart();
+		
+		// cols name to export
+		List<Property> props = this.getProperties();
+		String[] colnames = new String[this.getProperties().size()];
+
+		// compute positions list
+		int length = 0;
+		for (Match match : getMatches()) { // 1) get number of positions
+			length += match.getLength();
+		}
+		int[] positions = new int[length];
+		int iPosition = 0;
+		for (Match match : getMatches()) { // 2) append positions
+			int p_end = match.getEnd();
+			for (int p = match.getStart() ; p < p_end ; p++)
+				positions[iPosition] = p;
+		}
+
+		// 0- create the R object
+		this.symbol = prefixR + (nocorpus++);
+		RWorkspace rw = RWorkspace.getRWorkspaceInstance();
+		rw.eval(symbol +" <- matrix(ncol="+colnames.length+", nrow="+positions.length+")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+
+		for(int i = 0 ; i < props.size() ; i++) {
+			Property prop = props.get(i);
+			colnames[i] = prop.getName();
+			// send positions to R
+			int[] idx = CorpusManager.getCorpusManager().getCqiClient().cpos2Id(prop.getQualifiedName(), positions);
+			rw.addVectorToWorkspace("tmp", idx); //$NON-NLS-1$
+			//if (initialPosition > 0) rw.eval("tmp <- tmp - "+initialPosition);
+			//System.out.println("lengths "+prop.getName()+" : idx="+idx.length+" mat "+positions.length);
+			rw.eval(symbol+"[,"+(i+1)+"] <- tmp"); //$NON-NLS-1$ //$NON-NLS-2$
+		}
+
+		//set matrix col names
+		rw.addVectorToWorkspace("tmpcol", colnames); //$NON-NLS-1$
+		rw.eval("colnames("+symbol+") <- tmpcol"); //$NON-NLS-1$ //$NON-NLS-2$
+
+		rw.eval(symbol+" <- list(data="+symbol+")"); //$NON-NLS-1$ //$NON-NLS-2$
+
+		// create lexicons
+		for (Property prop : this.getProperties()) {
+			Lexicon lex = this.getLexicon(prop);
+			rw.addVectorToWorkspace("tmp", lex.getForms()); //$NON-NLS-1$
+			rw.eval(symbol+"$lex$"+prop.getName()+" <- tmp"); //$NON-NLS-1$ //$NON-NLS-2$
+		}
+		
+		StructuralUnit text_su = this.getStructuralUnit("text");
+		if (text_su != null) {
+			StructuralUnitProperty text_id = text_su.getProperty("id");
+			if (text_id != null) {
+				int[] textlimits = this.getTextStartLimits();
+				rw.addVectorToWorkspace("text_limits", textlimits);
+				if (initialPosition > 0) rw.eval("text_limits <- text_limits - "+initialPosition);
+				rw.eval(symbol+"$structs$text$start <- text_limits"); //$NON-NLS-1$ //$NON-NLS-2$
+				
+				textlimits = this.getTextEndLimits();
+				rw.addVectorToWorkspace("text_limits", textlimits);
+				if (initialPosition > 0) rw.eval("text_limits <- text_limits - "+initialPosition);
+				//System.out.println("lengths "+prop.getName()+" : idx="+idx.length+" mat "+positions.length);
+				rw.eval(symbol+"$structs$text$end <- text_limits"); //$NON-NLS-1$ //$NON-NLS-2$
+			}
+		}
+
+		return symbol;
+	}
+
+	/**
+	 * set the corpus charset name, to be able to print it well.
+	 *
+	 * @param corpusCharset the new charset
+	 */
+	public void setCharset(String corpusCharset) {
+		this.charset = corpusCharset;
+	}
+
+	/**
+	 * set the corpus language name, to be able to sort it well.
+	 *
+	 * @param corpusLanguage the new language
+	 */
+	public void setLanguage(String corpusLanguage) {
+		this.language = corpusLanguage;
+	}
+	
+	
+//	/**
+//	 * Stores the result of textometric computation in this corpus.
+//	 * 
+//	 * @param result
+//	 *            the result
+//	 */
+//	public void storeResult(int idx, Object result) {
+//		results.add(idx, result);
+//	}
+//	/**
+//	 * Stores the result of textometric computation in this corpus.
+//	 * 
+//	 * @param result
+//	 *            the result
+//	 */
+//	public void storeResult(Object result) {
+//		results.add(result);
+//	}
+	
+	@Override
+	public String getCQLLimitQuery() {
+		return cql_limit_query;
+	}
+
+	public ArrayList<ITXMResult> clearResults() {
+		ArrayList<ITXMResult> old = this.children;
+		this.children = new ArrayList<ITXMResult>();
+		return old;
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/Corpus.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/StructuralUnitProperty.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/StructuralUnitProperty.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/StructuralUnitProperty.java	(revision 258)
@@ -0,0 +1,243 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-09-05 09:27:13 +0200 (jeu., 05 sept. 2013) $
+// $LastChangedRevision: 2529 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.corpus;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.UUID;
+
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.searchengine.cqp.AbstractCqiClient;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.corpus.query.Query;
+import org.txm.utils.logger.Log;
+// TODO: Auto-generated Javadoc
+/**
+ * A Property on the structural units the corpus. Represents a
+ * <strong>type</strong>, not a the value for a specif ic unit.
+ * 
+ * @author Jean-Philippe Magué
+ */
+public class StructuralUnitProperty extends Property implements Comparable {
+
+	/** The values. */
+	List<String> values;
+
+	/** The strucutral unit. */
+	private StructuralUnit strucutralUnit;
+
+	/**
+	 * Instantiates a new structural unit property.
+	 * 
+	 * Not intended to be used directly. See
+	 *
+	 * @param structuralUnit the structural unit
+	 * @param name the name
+	 * @param corpus the corpus
+	 * {@link StructuralUnit#getProperty(String)}
+	 */
+	protected StructuralUnitProperty(StructuralUnit structuralUnit,
+			String name, Corpus corpus) {
+		super(name, corpus);
+		this.strucutralUnit = structuralUnit;
+	}
+
+	/**
+	 * Gets the structural unit on wich the property is defined.
+	 * 
+	 * @return the structural unit
+	 */
+	public StructuralUnit getStructuralUnit() {
+		return strucutralUnit;
+	}
+
+	/**
+	 * Gets the qualified name.
+	 * 
+	 * @return the qualified name
+	 */
+	@Override
+	public String getQualifiedName() {
+		return strucutralUnit.getQualifiedName() + "_" + this.getName(); //$NON-NLS-1$
+	}
+
+	/**
+	 * Gets the full name: struct_propname
+	 *
+	 * @return the full name
+	 */
+	public String getFullName() {
+		return strucutralUnit.getName() + "_" + this.getName(); //$NON-NLS-1$
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.searchengine.cqp.corpus.Property#toString()
+	 */
+	@Override
+	public String toString() {
+		return this.getName();
+	}
+
+	/**
+	 * Gets a list of all the values this structural property takes in the
+	 * subcorpus.
+	 *
+	 * @param subcorpus The subcorpus in which the search is restricted
+	 * @return a List of values
+	 * @throws CqiClientException the cqi client exception
+	 */
+	public List<String> getValues(Corpus subcorpus) throws CqiClientException {
+		try {
+			AbstractCqiClient cqiClient = CorpusManager.getCorpusManager().getCqiClient();
+			return cqiClient.getData(this, subcorpus);
+		} catch (Exception e) {
+			Log.severe(TXMCoreMessages.StructuralUnitProperty_0
+					+ this.getFullName()+" : "+e); //$NON-NLS-1$
+		}
+		return new ArrayList<String>();
+
+		/*
+		 * //if (values == null) { QueryResult tmp = subcorpus.query(new
+		 * Query("<"+this.getFullName()+">[]"), UUID.randomUUID().toString());
+		 * //$NON-NLS-1$ //$NON-NLS-2$ List<Match> matches = tmp.getMatches();
+		 * tmp.drop(); values = new ArrayList<String>(new
+		 * HashSet<String>(Match.getValuesForProperty(this,matches))); } return
+		 * new ArrayList<String>(values);
+		 */
+	}
+	
+	/**
+	 * Gets a list of all the values this structural property takes in the
+	 * subcorpus
+	 * 
+	 * return an abstract of values.
+	 *
+	 * @param subcorpus The subcorpus in which the search is restricted
+	 * @param number the number
+	 * @return a List of values
+	 * @throws CqiClientException the cqi client exception
+	 */
+	public List<String> getValues(Corpus subcorpus, int number) throws CqiClientException {
+		try {
+			AbstractCqiClient cqiClient = CorpusManager.getCorpusManager().getCqiClient();
+			return cqiClient.getData(this, number);
+		} catch (Exception e) {
+			Log.severe(TXMCoreMessages.StructuralUnitProperty_0
+					+ this.getFullName()+" : "+e); //$NON-NLS-1$
+		}
+		return new ArrayList<String>();
+
+		/*
+		 * //if (values == null) { QueryResult tmp = subcorpus.query(new
+		 * Query("<"+this.getFullName()+">[]"), UUID.randomUUID().toString());
+		 * //$NON-NLS-1$ //$NON-NLS-2$ List<Match> matches = tmp.getMatches();
+		 * tmp.drop(); values = new ArrayList<String>(new
+		 * HashSet<String>(Match.getValuesForProperty(this,matches))); } return
+		 * new ArrayList<String>(values);
+		 */
+	}
+
+	/**
+	 * Gets a list of all the values this structural property takes in the main
+	 * corpus.
+	 *
+	 * @return a List of values
+	 * @throws CqiClientException the cqi client exception
+	 */
+	public List<String> getValues() throws CqiClientException {
+		return getValues(this.getCorpus());
+	}
+	
+	/**
+	 * Gets a list of all the values this structural property takes in the main
+	 * corpus.
+	 *
+	 * @return a List of values
+	 * @throws CqiClientException the cqi client exception
+	 */
+	public List<String> getOrderedValues() throws CqiClientException {
+		List<String> values = getValues(this.getCorpus());
+		Collections.sort(values);
+		return values;
+	}
+	
+	/**
+	 * Gets a list of all the values this structural property takes in the main
+	 * corpus.
+	 *
+	 * @param corpus the corpus
+	 * @return a List of values
+	 * @throws CqiClientException the cqi client exception
+	 */
+	public List<String> getOrderedValues(Corpus corpus) throws CqiClientException {
+		List<String> values = getValues(corpus);
+		Collections.sort(values);
+		return values;
+	}
+
+	/**
+	 * Equals.
+	 *
+	 * @param p the p
+	 * @return true, if successful
+	 */
+	public boolean equals(StructuralUnitProperty p) {
+		return super.equals(p) && this.strucutralUnit.equals(p.strucutralUnit);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.searchengine.cqp.corpus.Property#compareTo(java.lang.Object)
+	 */
+	@Override
+	public int compareTo(Object o) {
+		if (o instanceof StructuralUnitProperty)
+			return (this.getQualifiedName().compareTo(
+					((StructuralUnitProperty) o).getQualifiedName()));
+		return 0;
+	}
+
+	/**
+	 * Gets the number of values.
+	 *
+	 * @param corpus the corpus
+	 * @return the number of values in this corpus, -1 if an error occured
+	 */
+	public Integer getNumberOfValues(Corpus corpus) {
+		try {
+			QueryResult tmp = corpus.query(
+					new Query("<" + this.getFullName() + ">[]"), UUID.randomUUID().toString(), false); //$NON-NLS-1$ //$NON-NLS-2$
+			int ret = tmp.getNMatch();
+			tmp.drop();
+			return ret;
+		} catch (CqiClientException e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+		} 
+		return -1;// error
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/StructuralUnitProperty.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/package.html
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/package.html	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Classes representing corpus and corpus-like data structures wrapping and abstracting cqp objects and functions.</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/MainCorpus.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/MainCorpus.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/MainCorpus.java	(revision 258)
@@ -0,0 +1,684 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2017-01-24 18:11:42 +0100 (Tue, 24 Jan 2017) $
+// $LastChangedRevision: 3400 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.corpus;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+
+import org.txm.Toolbox;
+import org.txm.annotation.AnnotationManager;
+import org.txm.annotation.repository.KnowledgeRepository;
+import org.txm.annotation.repository.KnowledgeRepositoryManager;
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.functions.ProgressWatcher;
+import org.txm.lexicon.core.corpusengine.cqp.Lexicon;
+import org.txm.objects.Base;
+import org.txm.objects.BaseParameters;
+import org.txm.objects.TxmObject;
+import org.txm.searchengine.cqp.AbstractCqiClient;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.clientExceptions.InvalidCqpIdException;
+import org.txm.searchengine.cqp.corpus.query.Match;
+import org.txm.searchengine.cqp.corpus.query.Query;
+import org.txm.searchengine.cqp.serverException.CqiServerError;
+import org.txm.utils.DeleteDir;
+import org.txm.utils.logger.Log;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class MainCorpus for mirroring CQP corpora.
+ *
+ * @author jmague, mdecorde
+ */
+public class MainCorpus extends Corpus {
+	
+	AnnotationManager am;
+
+	private static final long serialVersionUID = 6776153557376588804L;
+
+	/**
+	 * Instantiates a new corpus. This constructor is not intended to be used
+	 * directly. Use {@link CorpusManager#getCorpus(String)}.
+	 * 
+	 * @param cqpId
+	 *            the cqp id
+	 * 
+	 * @throws InvalidCqpIdException
+	 *             the invalid cqp id exception
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	protected MainCorpus(String cqpId) throws InvalidCqpIdException,
+	CqiClientException {
+		super(cqpId);
+		this.motherMainCorpus = this;
+		this.name = cqpId;
+	}
+
+	/**
+	 * Check whether the ID is a valid CQP ID.
+	 * 
+	 * @param cqpId
+	 *            the cqp id
+	 * 
+	 * @return true, if cqpId is a valid CQP ID.
+	 * 
+	 * @throws InvalidCqpIdException
+	 *             the invalid cqp id exception
+	 */
+	@Override
+	public boolean checkCqpId(String cqpId) throws InvalidCqpIdException {
+		if (!cqpId.equals(cqpId.toUpperCase()))
+			throw new InvalidCqpIdException(cqpId + TXMCoreMessages.MainCorpus_0);
+		return true;
+	}
+	
+	public boolean equals(MainCorpus corpus) {
+		if (corpus == null) return false;
+		return this.getQualifiedCqpId().equals(corpus.getQualifiedCqpId());
+	}
+
+	/**
+	 * Gets the lexicon relative to a given property.
+	 * 
+	 * @param property
+	 *            the property
+	 * 
+	 * @return the lexicon
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	@Override
+	public Lexicon getLexicon(Property property) throws CqiClientException {
+		// System.out.println("in "+this.getCqpId()+" look for cached lexicon "+property);
+		if (lexicons.containsKey(property.getName())
+				&& lexicons.get(property.getName()) != null) {
+			Log.finest(TXMCoreMessages.RETURNING_CACHED_LEXICON + this.name);
+			return lexicons.get(property.getName());
+		}
+		// System.out.println("not found");
+		Log.finest(TXMCoreMessages.LEXICON + this.name);
+		long start = System.currentTimeMillis();
+		int lexiconSize;
+		try {
+			lexiconSize = CorpusManager.getCorpusManager().getCqiClient()
+					.lexiconSize(property.getQualifiedName());
+		} catch (Exception e) {
+			throw new CqiClientException(e);
+		}
+
+		int[] ids = new int[lexiconSize];
+		for (int i = 0; i < ids.length; i++) {
+			ids[i] = i;
+		}
+
+		/*
+		 * String[] forms = null; try { forms =
+		 * CorpusManager.getCorpusManager().
+		 * getCqiClient().id2Str(property.getQualifiedName(), ids); } catch
+		 * (IOException e) { throw new CqiClientException(e); } catch
+		 * (CqiServerError e) { throw new CqiClientException(e); }
+		 */
+
+		int[] freqs;
+		try {
+			freqs = CorpusManager.getCorpusManager().getCqiClient().id2Freq(
+					property.getQualifiedName(), ids);
+		} catch (Exception e) {
+			throw new CqiClientException(e);
+		}
+
+		Lexicon lexicon = new Lexicon(this, property, freqs, ids);
+
+		long end = System.currentTimeMillis();
+		Log.finest(TXMCoreMessages.END_SUBCORPUS_LEXICON + this.name + TXMCoreMessages.MainCorpus_1 + (end - start));
+
+		// System.out.println("add in "+this.getCqpId()+"cache "+property.getName());
+		lexicons.put(property.getName(), lexicon);
+		return lexicon;
+	}
+
+	/**
+	 * Export.
+	 *
+	 * @param exportzip the exportzip
+	 * @return true, if successful
+	 */
+	@Override
+	public boolean export(File exportzip, ProgressWatcher monitor)
+	{
+		if (this.getBase() != null)
+			return this.getBase().export(exportzip, monitor);
+		return false;
+	}
+	
+	/**
+	 * Export.
+	 *
+	 * @param exportzip the exportzip
+	 * @return true, if successful
+	 */
+	@Override
+	public boolean export(File exportzip)
+	{
+		return export(exportzip, null);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.txm.searchengine.cqp.corpus.CqpObject#getQualifiedCqpId()
+	 */
+	@Override
+	public String getQualifiedCqpId() {
+		return cqpId;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.txm.searchengine.cqp.corpus.Corpus#getSize()
+	 */
+	@Override
+	public int getSize() throws CqiClientException {
+		if (this.size == -1) {
+			try {
+				this.size = CorpusManager.getCorpusManager().getCqiClient()
+						.attributeSize(this.cqpId + ".word"); //$NON-NLS-1$
+			} catch (Exception e) {
+				throw new CqiClientException(e);
+			}
+		}
+		return this.size;
+	}
+
+	/**
+	 * Gets the properties available in this corpus.
+	 * 
+	 * @return the properties
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	@Override
+	public List<Property> getProperties() throws CqiClientException {
+		if (this.lexicalUnitsProperties != null)
+			return this.lexicalUnitsProperties;
+		String[] propertiesName;
+		CorpusManager cm = null;
+		AbstractCqiClient cc = null;
+		try {
+			cm = CorpusManager.getCorpusManager();
+			cc = cm.getCqiClient();
+
+			// if (cc != null)
+			// System.out.println("cqiclient OK");
+
+		} catch (Exception e) {
+			throw new CqiClientException(e);
+		}
+		try {
+			// System.out.println(this.cqpId); // temp : toLowerCAse
+			propertiesName = cc.corpusPositionalAttributes(this.cqpId);
+		} catch (Exception e) {
+			throw new CqiClientException(e);
+		}
+		List<Property> properties = new ArrayList<Property>(
+				propertiesName.length);
+		for (int i = 0; i < propertiesName.length; i++)
+			properties.add(new Property(propertiesName[i], this));
+		this.lexicalUnitsProperties = properties;
+		return properties;
+	}
+
+	/**
+	 * Gets the structural attributes available in this corpus.
+	 * 
+	 * @return the properties
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	@Override
+	public List<StructuralUnit> getStructuralUnits() throws CqiClientException {
+		if (this.structuralUnits != null)
+			return this.structuralUnits;
+
+		// get structures' name
+		Set<String> cqpNames;
+		try {
+			String[] names = CorpusManager.getCorpusManager().getCqiClient()
+					.corpusStructuralAttributes(this.cqpId);
+			cqpNames = new HashSet<String>(Arrays.asList(names));
+		} catch (Exception e) {
+			throw new CqiClientException(e);
+		}
+		// What we call a structural unit is called a structural attribute by
+		// cqp and what we call
+		// an attribute of a strucutural unit has no corresponding concept in
+		// cqp :
+		// if a structural unit, say 's', has 2 attributes, say 'n' and
+		// 'length', the 2 attributes
+		// are stored by cqp as embedded structural units names 's_n' and
+		// 's_length' (see the cqp documentation)
+		// Here, we go through all the structural attribute known by cqp to
+		// decide which is a structural unit and which
+		// an attribute of a structural unit
+
+		Map<String, List<String>> attributes = new HashMap<String, List<String>>();
+
+		for (String name : cqpNames) {
+			if (!attributes.containsKey(name)) {
+				int _ = name.lastIndexOf("_"); //$NON-NLS-1$
+				if (_ == -1 || !cqpNames.contains(name.substring(0, _))) {
+					attributes.put(name, new ArrayList<String>());
+				} else {
+					String unitName = name.substring(0, _);
+					String attributeName = name.substring(_ + 1);
+					if (!attributes.containsKey(unitName)) {
+						attributes.put(unitName, new ArrayList<String>());
+					}
+					attributes.get(unitName).add(attributeName);
+				}
+			}
+		}
+
+		this.structuralUnits = new ArrayList<StructuralUnit>();
+		for (String strucuralUnit : attributes.keySet())
+			this.structuralUnits.add(new StructuralUnit(strucuralUnit,
+					attributes.get(strucuralUnit), this));
+
+		return this.structuralUnits;
+	}
+
+	/**
+	 * Gets the full name.
+	 * 
+	 * @return the full name
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	public String getFullName() throws CqiClientException {
+		try {
+			return CorpusManager.getCorpusManager().getCqiClient()
+					.corpusFullName(this.cqpId);
+		} catch (Exception e) {
+			throw new CqiClientException(e);
+		}
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.txm.searchengine.cqp.corpus.Corpus#getProperty(java.lang.
+	 * String)
+	 */
+	@Override
+	public Property getProperty(String name) throws CqiClientException {
+		if (this.lexicalUnitsProperties == null)
+			getProperties();
+		for (Property property : this.lexicalUnitsProperties)
+			if (property.getName().equals(name))
+				return property;
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.txm.searchengine.cqp.corpus.Corpus#getStructuralUnit(java
+	 * .lang.String)
+	 */
+	@Override
+	public StructuralUnit getStructuralUnit(String name)
+			throws CqiClientException {
+		if (this.structuralUnits == null)
+			getStructuralUnits();
+		for (StructuralUnit unit : this.structuralUnits)
+			if (unit.getName().equals(name))
+				return unit;
+		return null;
+	}
+
+
+
+
+	/* (non-Javadoc)
+	 * @see java.lang.Object#toString()
+	 */
+	@Override
+	public String toString() {
+		return name;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.searchengine.cqp.corpus.Corpus#load()
+	 */
+	@Override
+	public boolean load() {
+		boolean ret = super.load();
+		return ret;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#getParent()
+	 */
+	@Override
+	public TxmObject getParent() {
+		return (TxmObject) this.parent;
+	}
+
+	/**
+	 * Sets the parent.
+	 *
+	 * @param base the new parent
+	 */
+	public void setParent(Base base) {
+		this.parent = base;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#delete()
+	 */
+	@Override
+	public boolean delete() {
+		closeAnnotationManager();
+		removeFromCWB();
+		Base b = this.getBase();
+		b.delete();
+		return super.delete();
+	}
+
+	/**
+	 * Removes the from cwb.
+	 *
+	 * @return true, if successful
+	 */
+	public boolean removeFromCWB() {
+		try {
+			if (Toolbox.isSearchEngineInitialized()) {
+				this.dropAllSubcorpora();
+				this.dropAllPartitions();
+			}
+		} catch (CqiClientException e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+		CorpusManager.deleteCorpus(this);
+
+		// delete binaries
+		File binaries = this.getBaseDirectory();
+		System.out.println(TXMCoreMessages.MainCorpus_2+binaries);
+		return DeleteDir.deleteDirectory(binaries);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.searchengine.cqp.corpus.Corpus#getBase()
+	 */
+	@Override
+	public Base getBase() {
+		return (Base) getParent();
+	}
+
+
+
+	/** The nbtext. */
+	int nbtext = -1;
+
+	/**
+	 * Gets the nb texts.
+	 *
+	 * @return the nb texts
+	 * @throws CqiClientException the cqi client exception
+	 */
+	public int getNbTexts() throws CqiClientException
+	{
+		if (nbtext == -1) {
+			StructuralUnit text_su = this.getStructuralUnit("text"); //$NON-NLS-1$
+			StructuralUnitProperty text_id_sup = text_su.getProperty("id"); //$NON-NLS-1$
+
+			List<String> textids = text_id_sup.getValues();
+			nbtext = textids.size();
+		}
+		return nbtext;
+	}
+
+	/** The textids. */
+	HashMap<String, Integer> textids = null;
+	private int[] textEndLimits;
+
+	/**
+	 * Gets the texts ids.
+	 *
+	 * @return the texts ids
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 * @throws CqiClientException the cqi client exception
+	 */
+	public HashMap<String, Integer>  getTextsIds() throws IOException, CqiServerError, CqiClientException
+	{
+		if (textids == null)
+		{
+			textids = new HashMap<String, Integer>();
+			int nbtext = getNbTexts();
+			int[] structs = new int[nbtext];
+			for(int i = 0 ; i < nbtext ; i++)
+				structs[i] = i;
+
+			StructuralUnit text_su = this.getStructuralUnit("text"); //$NON-NLS-1$
+			StructuralUnitProperty text_id_sup = text_su.getProperty("id"); //$NON-NLS-1$
+
+			String[] ids = CorpusManager.getCorpusManager().getCqiClient().struc2Str(text_id_sup.getQualifiedName(), structs);
+			for(int i = 0 ; i < ids.length ; i++)
+			{
+				textids.put(ids[i], structs[i]);
+			}
+		}
+		return textids;
+	}
+
+	/**
+	 * Find text no.
+	 *
+	 * @param textid the textid
+	 * @return the int
+	 * @throws CqiClientException the cqi client exception
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	public int findTextNo(String textid) throws CqiClientException, IOException, CqiServerError
+	{
+		HashMap<String, Integer> idsmap = this.getTextsIds();
+		if (idsmap.containsKey(textid))
+			return idsmap.get(textid);
+		else
+			return -1;
+	}
+
+	/**
+	 * Gets the first position.
+	 *
+	 * @return the first position
+	 */
+	public int getFirstPosition() {
+		return 0;
+	}
+
+	/**
+	 * Return the CQP END positions of the main corpus texts
+	 */
+	@Override
+	public int[] getTextEndLimits() throws CqiClientException, IOException, CqiServerError, InvalidCqpIdException {
+		if (textEndLimits == null) {
+			String queryResultId = queryResultNamePrefix
+					+ UUID.randomUUID().toString();
+			CorpusManager.getCorpusManager().getCqiClient().cqpQuery(
+					this.getQualifiedCqpId(), queryResultId, "<text>[] expand to text"); //$NON-NLS-1$
+			QueryResult queryResult = new QueryResult(queryResultId, queryResultId, this,	new Query("<text>[] expand to text")); //$NON-NLS-1$
+			textEndLimits = queryResult.getEnds();
+		}
+		return textEndLimits;
+	}
+	
+	/**
+	 * Return the CQP START positions of the main corpus texts
+	 */
+	@Override
+	public int[] getTextStartLimits() throws CqiClientException, IOException, CqiServerError, InvalidCqpIdException {
+		if (textLimits == null) {
+			textLimits = getStartLimits("<text>[]");
+		}
+		return textLimits;
+	}
+	
+	/**
+	 * Return the CQP START positions of the result matches of the 'cql_limit' query 
+	 */
+	@Override
+	public int[] getStartLimits(String cql_limit) throws IOException, CqiServerError, InvalidCqpIdException, CqiClientException {
+		String queryResultId = queryResultNamePrefix + UUID.randomUUID().toString();
+		CorpusManager.getCorpusManager().getCqiClient().cqpQuery(
+				this.getQualifiedCqpId(), queryResultId, cql_limit); //$NON-NLS-1$
+		QueryResult queryResult = new QueryResult(queryResultId, queryResultId, this,	new Query(cql_limit));
+		
+		int[] rez =  queryResult.getStarts();
+		queryResult.drop();
+		return rez;
+	}
+
+	@Override
+	public List<Match> getMatches() {
+		List<Match> rez = new ArrayList<Match>();
+		try {
+			rez.add(new Match(0, this.getSize()));
+			return rez;
+		} catch (CqiClientException e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+		return null;
+	}
+
+	public int getNMatch() {
+		return 1;
+	}
+
+
+	
+	public AnnotationManager getAnnotationManager() {
+		//return null;
+		if (am == null) {
+			if (this.getKnowledgeRepositoryNames().size() > 0)
+			am = new AnnotationManager(this);
+		}
+		return am;
+	}
+	
+	protected boolean modified = false;
+	public boolean isModified() { return modified; }
+	public void setIsModified(boolean b) { modified = b; }
+	public String getNameForCorporaView() {	
+		if (modified)
+			return getName()+"*";
+		else
+			return getName();
+	}
+	
+	public boolean needToSaveAnnotations() {
+		if (getAnnotationManager() != null)
+			return am.hasChanges();
+		else
+			return false;
+	}
+
+	public boolean canBeAnnotated() {
+		return getKnowledgeRepositoryNames().size() > 0;
+	}
+
+	/**
+	 * 
+	 * Lazy load KR
+	 * 
+	 * @param name KnowledgeRepository's name
+	 * @return may return null if the KnowledgeRepository does not exist
+	 */
+	public KnowledgeRepository getKnowledgeRepository(String name) {
+		return KnowledgeRepositoryManager.getKnowledgeRepository(name, this);
+		
+//		if (kr != null) return kr; // \o/
+//		
+//		BaseParameters params = this.getBase().getBaseParameters();
+//		HashMap<String, HashMap<String, ?>> conf = params.getKnowledgeRepository(name);
+//		
+//		if (conf == null) return null;
+//
+//		return KnowledgeRepositoryManager.createKnowledgeRepository(name, conf);
+	}
+
+	/**
+	 * 
+	 * @param name KnowledgeRepository's name
+	 * @return may return null if the KnowledgeRepository does not exist
+	 */
+	public List<String> getKnowledgeRepositoryNames() {
+		BaseParameters params = this.getBase().getBaseParameters();
+		return params.getKnowledgeRepositoryNames();
+	}
+
+	public void closeAnnotationManager() {
+		if (am != null) {
+			//System.out.println("  Closing AM...");
+			am.closeAll();
+		}
+	}
+
+
+	@Override
+	public String getDetails() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public void clean() {
+		// TODO Auto-generated method stub
+		
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/MainCorpus.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/ICqiServer.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/cqp/ICqiServer.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/cqp/ICqiServer.java	(revision 258)
@@ -0,0 +1,90 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2011-12-14 10:52:18 +0100 (mer., 14 déc. 2011) $
+// $LastChangedRevision: 2080 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+
+// TODO: Auto-generated Javadoc
+/**
+ * This class aims at handling a CQi server process. It is not a CQi server per
+ * se.
+ * 
+ * @author Jean-Philippe Magué
+ */
+public interface ICqiServer {
+
+	public void setDebug(boolean val);
+
+	/**
+	 * Start.
+	 *
+	 * @return true, if successful
+	 */
+	public Boolean start();
+
+	/**
+	 * Convert stream to string.
+	 *
+	 * @param is the is
+	 * @return the string
+	 */
+	public String convertStreamToString(InputStream is);
+
+	/**
+	 * Stop the server.
+	 */
+	public Boolean stop();
+
+	/**
+	 * Checks if the server is running.
+	 * 
+	 * @return true, if is running
+	 */
+	public Boolean isRunning();
+
+	/**
+	 * Gets the error stream.
+	 *
+	 * @return the error stream
+	 */
+	public InputStream getErrorStream();
+
+	/**
+	 * Gets the input stream.
+	 *
+	 * @return the input stream
+	 */
+	public InputStream getInputStream();
+	/**
+	 * Gets the output stream.
+	 *
+	 * @return the output stream
+	 */
+	public OutputStream getOutputStream();
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/ICqiServer.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/package.html
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/cqp/package.html	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/cqp/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Implementation of full text indexing and querying using the CQP engine.</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/AbstractCqiClient.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/cqp/AbstractCqiClient.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/cqp/AbstractCqiClient.java	(revision 258)
@@ -0,0 +1,780 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2012-03-01 08:14:11 +0100 (jeu., 01 mars 2012) $
+// $LastChangedRevision: 2134 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.SortedMap;
+import java.util.TreeMap;
+import java.util.UUID;
+import java.util.regex.Pattern;
+
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.clientExceptions.UnexpectedAnswerException;
+import org.txm.searchengine.cqp.corpus.Corpus;
+import org.txm.searchengine.cqp.corpus.CorpusManager;
+import org.txm.searchengine.cqp.corpus.Property;
+import org.txm.searchengine.cqp.corpus.QueryResult;
+import org.txm.searchengine.cqp.corpus.StructuralUnitProperty;
+import org.txm.searchengine.cqp.corpus.query.Match;
+import org.txm.searchengine.cqp.corpus.query.Query;
+import org.txm.searchengine.cqp.serverException.CqiCqpErrorNoSuchCorpus;
+import org.txm.searchengine.cqp.serverException.CqiServerError;
+import org.txm.utils.logger.Log;
+
+/**
+ * This class implements a Java Interface CQi client.
+ *
+ * @author mdecorde
+ */
+public abstract class AbstractCqiClient implements ICqiClient{
+
+	static Pattern pattern = Pattern.compile("\\p{Upper}(\\p{Upper}|\\p{Digit}|[_-])*"); //$NON-NLS-1$
+	static Pattern pattern2 = Pattern.compile("\\p{Upper}(\\p{Lower}|\\p{Digit}|[_-])*"); //$NON-NLS-1$
+	/**
+	 * Check wether <code>id</code> is a valid CQi for a corpus.
+	 *
+	 * @param id the id
+	 * @return true if <code>id</code> is in uppercase chararcters
+	 */
+	public static synchronized boolean checkCorpusId(String id) {
+		//System.out.println("Pattern: "+pattern+" test with "+id);
+		return pattern.matcher(id).matches();
+	}
+
+	/**
+	 * Check whether <code>id</code> is a valid CQi for a subcorpus.
+	 *
+	 * @param id the id
+	 * @return true if <code>id</code> is an uppercase character followed by
+	 * lowercase characters
+	 */
+	public static synchronized boolean checkSubcorpusId(String id) {
+		//System.out.println("Pattern: "+pattern+" test with "+id);
+		return pattern2.matcher(id).matches();
+	}
+	
+	String lastError;
+	public synchronized String getLastError(){	
+		if(lastError != null && lastError.length() > 0)
+			return lastError;
+		return TXMCoreMessages.AbstractCqiClient_2;
+	}
+	
+	public List<String> getSingleData(Property prop) throws IOException, CqiServerError, CqiClientException {
+		boolean isWordProperty = !(prop instanceof StructuralUnitProperty);
+		String qname = prop.getQualifiedName();
+		AbstractCqiClient cqiClient = CorpusManager.getCorpusManager().getCqiClient();
+		
+		if (!isWordProperty) {
+			StructuralUnitProperty sprop = (StructuralUnitProperty) prop;
+			QueryResult qresult = prop.getCorpus().query(new Query("<"+sprop.getFullName()+">[] expand to "+sprop.getName()), "TMP", false); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+			int[] strucs = this.cpos2Struc(qname, qresult.getStarts());
+			return Arrays.asList(cqiClient.struc2Str(qname, strucs));
+		} else {
+			int[] positions = {0,1,2,3};
+			return Arrays.asList(cqiClient.cpos2Str(qname,positions));
+		}
+	}
+	
+	public List<String> getSingleData(Property prop, int[] positions) throws UnexpectedAnswerException, IOException, CqiServerError {
+		boolean isWordProperty = !(prop instanceof StructuralUnitProperty);
+		String qname = prop.getQualifiedName();
+		AbstractCqiClient cqiClient = CorpusManager.getCorpusManager().getCqiClient();
+		if (!isWordProperty) {
+			int[] strucs = cqiClient.cpos2Struc(qname, positions);
+			return Arrays.asList(cqiClient.struc2Str(qname, strucs));
+			
+		} else {
+			return Arrays.asList(cqiClient.cpos2Str(qname,positions));
+		}
+	}
+	
+	public List<List<String>> getData(Property prop, List<Integer> positions,
+			List<Integer> nWords) throws CqiClientException, IOException, CqiServerError {
+		
+		//System.out.println("START prop: "+prop);
+		//System.out.println("positions : "+positions);
+		//System.out.println("nwords    : "+nWords);
+		
+		List<List<String>> result = new ArrayList<List<String>>();
+		
+		// get all the positions needed, possible overlap
+		HashSet<Integer> allPositionsNeeded = new HashSet<Integer>();
+		for (int i = 0; i < positions.size(); i++) {
+			int n = nWords.get(i);
+			for (int j = 0; j < n; j++) {
+				allPositionsNeeded.add(positions.get(i) + j);
+			}
+		}
+		
+		// conversion from List<Integer> to int[]
+		int[] cpos = new int[allPositionsNeeded.size()];
+		int c = 0;
+		for (int i : allPositionsNeeded) cpos[c++] = i;
+		
+		// get values for positions
+		String[] values;
+		boolean isWordProperty = !(prop instanceof StructuralUnitProperty);
+		if (!isWordProperty) {
+			String qname = ((StructuralUnitProperty)prop).getQualifiedName();
+			int[] structs = this.cpos2Struc(qname, cpos);
+			values = this.struc2Str(qname, structs);
+		} else {
+			String qname = prop.getQualifiedName();
+			values = this.cpos2Str(qname, cpos);
+		}
+		
+		// sort results by position
+		TreeMap<Integer, String> map = new TreeMap<Integer, String>();
+		for (int i = 0 ; i < values.length ; i++) {
+			map.put(cpos[i], values[i]);
+		}
+		
+		// fill results
+		int start, end;
+		SortedMap<Integer, String> smap;
+		for (int i = 0 ; i < positions.size() ; i++) {
+			start = positions.get(i);
+			end = positions.get(i) + nWords.get(i);
+			if (start > end) {
+				Log.warning("Error: trying to get "+prop+" values from "+start+" to "+end);
+				result.add(new ArrayList<String>());
+			} else {
+				smap = map.subMap(start, end);
+				result.add(new ArrayList<String>(smap.values()));
+			}
+		}
+
+		return result;
+	}
+
+	/**
+	 * Return lists of strings.
+	 *
+	 * @return the data
+	 * @throws CqiClientException the cqi client exception
+	 */
+	public List<String> getData(StructuralUnitProperty property, Corpus corpus) throws CqiClientException {
+			QueryResult tmp = corpus.query(new Query("<" + property.getFullName() + ">[]"), UUID.randomUUID().toString(), false); //$NON-NLS-1$ //$NON-NLS-2$
+			List<Match> matches = tmp.getMatches();
+			tmp.drop();
+			ArrayList<String> ret =  new ArrayList<String>(new HashSet<String>(Match
+					.getValuesForProperty(property, matches)));
+			return ret;
+	}
+	
+	/**
+	 * Gets the data.
+	 *
+	 * @param number the number
+	 * @return return an abstract of values
+	 * @throws CqiClientException the cqi client exception
+	 */
+	public List<String> getData(StructuralUnitProperty prop, int number) throws CqiClientException {
+		
+			QueryResult tmp = prop.getCorpus()
+					.query(
+							new Query("<" + prop.getFullName() + ">[] expand to "+prop.getName()), UUID.randomUUID().toString(), false); //$NON-NLS-1$ //$NON-NLS-2$
+			if (number > tmp.getNMatch()) number = tmp.getNMatch();
+			List<Match> matches = tmp.getMatches(0, number);
+			tmp.drop();
+			return new ArrayList<String>(new HashSet<String>(Match
+					.getValuesForProperty(prop, matches)));
+			// System.out.println("Data "+property.getQualifiedName()+": "+data);
+		
+	}
+	
+	// CQI_ERROR_CONNECT_REFUSED
+	/**
+	 * Connect the client to a server.
+	 *
+	 * @param username the username
+	 * @param password the password
+	 * @return true, if successful
+	 */
+	@Override
+	public abstract boolean connect(String username, String password) throws UnexpectedAnswerException, IOException, CqiServerError ;
+
+	// None
+	/**
+	 * Disconnect.
+	 * 
+	 * @return true, if successful
+	 */
+	@Override
+	public abstract boolean disconnect() throws UnexpectedAnswerException, CqiServerError, IOException;
+
+	// CQI_CTRL_LAST_GENERAL_ERROR
+	/**
+	 * return the last CQP error.
+	 *
+	 * @return the last error
+	 */
+	@Override
+	public abstract String getLastCqiError() throws UnexpectedAnswerException, IOException,	CqiServerError;
+
+	// CQI_CTRL_LAST_CQP_ERROR
+	/**
+	 * return the last CQP error.
+	 *
+	 * @return the last error
+	 */
+	@Override
+	public abstract String getLastCQPError() throws UnexpectedAnswerException, IOException,	CqiServerError;
+
+	// None
+	/**
+	 * Lists the corpora available on the server.
+	 *
+	 * @return the name of the corpora
+	 */
+	@Override
+	public abstract String[] listCorpora() throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	// None
+	/**
+	 * Gives the corpus charset.
+	 *
+	 * @param corpus the corpus
+	 * @return the name of the charset
+	 */
+	@Override
+	public abstract String corpusCharset(String corpus) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	// None (not really implemented anyway)
+	/**
+	 * Gives the corpus properties.
+	 *
+	 * @param corpus the corpus
+	 * @return the properties
+	 */
+	@Override
+	public abstract String[] corpusProperties(String corpus) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	// CQI_CQP_ERROR_NO_SUCH_CORPUS
+	/**
+	 * Gives the corpus positional attributes.
+	 *
+	 * @param corpusID the corpus id
+	 * @return the name of the attributes
+	 */
+	@Override
+	public abstract String[] corpusPositionalAttributes(String corpusID) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	// CQI_CQP_ERROR_NO_SUCH_CORPUS
+	/**
+	 * Gives the corpus structural attributes.
+	 *
+	 * @param corpus the corpus
+	 * @return the name of the attributes
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	@Override
+	public abstract String[] corpusStructuralAttributes(String corpus) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	// CQI_CQP_ERROR_NO_SUCH_CORPUS, CQI_CL_ERROR_NO_SUCH_ATTRIBUTE,
+	// CQI_CL_ERROR_WRONG_ATTRIBUTE_TYPE
+	/**
+	 * Check wether a structural attribute has values.
+	 *
+	 * @param attribute the attribute
+	 * @return true, if it has values
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	@Override
+	public abstract boolean corpusStructuralAttributeHasValues(String attribute) throws UnexpectedAnswerException, IOException,
+	CqiServerError;
+
+	// CQI_CQP_ERROR_NO_SUCH_CORPUS
+	/**
+	 * Gives the corpus alignement attributes.
+	 *
+	 * @param corpus the corpus
+	 * @return the name of attributes
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	@Override
+	public abstract String[] corpusAlignementAttributes(String corpus) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	// CQI_CQP_ERROR_NO_SUCH_CORPUS
+	/**
+	 * Gives the corpus full name.
+	 *
+	 * @param corpus the corpus
+	 * @return the full name
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	@Override
+	public abstract String corpusFullName(String corpus) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	/**
+	 * Gives the corpus info listed in the .INFO file.
+	 *
+	 * @param corpus the corpus
+	 * @return the info
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	@Override
+	public abstract String[] corpusInfo(String corpus) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	/**
+	 * Drop a corpus.
+	 * 
+	 * @param corpus
+	 *            the corpus
+	 */
+	@Override
+	public abstract void dropCorpus(String corpus) throws Exception;
+
+	// CQI_CQP_ERROR_NO_SUCH_CORPUS, CQI_CL_ERROR_NO_SUCH_ATTRIBUTE,
+	// CQI_CL_ERROR_WRONG_ATTRIBUTE_TYPE, CQI_CL_ERROR_CORPUS_ACCESS
+	/**
+	 * Gives an attribute size (the number of token).
+	 *
+	 * @param attribute the attribute
+	 * @return the size
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	@Override
+	public abstract int attributeSize(String attribute) throws IOException, UnexpectedAnswerException, CqiServerError;
+
+	// CQI_CQP_ERROR_NO_SUCH_CORPUS, CQI_CL_ERROR_NO_SUCH_ATTRIBUTE,
+	// CQI_CL_ERROR_WRONG_ATTRIBUTE_TYPE, CQI_CL_ERROR_CORPUS_ACCESS
+	/**
+	 * Gives the lexicon size of an attribute.
+	 *
+	 * @param attribute the attribute
+	 * @return the int
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 * @returns the number of entries in the lexicon of a positional attribute
+	 */
+	@Override
+	public abstract int lexiconSize(String attribute) throws IOException, UnexpectedAnswerException, CqiServerError;
+
+	/**
+	 * Drop attribute.
+	 *
+	 * @param attribute the attribute
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	@Override
+	public abstract void dropAttribute(String attribute) throws IOException, UnexpectedAnswerException, CqiServerError;
+
+	/**
+	 * Converts an array of attribute values to their ID.
+	 *
+	 * @param attribute the attribute
+	 * @param strings the values
+	 * @return the IDs
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	@Override
+	public abstract int[] str2Id(String attribute, String[] strings) throws IOException, UnexpectedAnswerException, CqiServerError;
+
+	/**
+	 * Converts an array of attribute ID to their values.
+	 *
+	 * @param attribute the attribute
+	 * @param ids the ids
+	 * @return the values
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	@Override
+	public abstract String[] id2Str(String attribute, int[] ids) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	/**
+	 * Converts an array of attribute IDs to their frequency.
+	 *
+	 * @param attribute the attribute
+	 * @param ids the ids
+	 * @return the frequencies
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	@Override
+	public abstract int[] id2Freq(String attribute, int[] ids) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	/**
+	 * Converts an array of position to their ID given an attribute.
+	 *
+	 * @param attribute the attribute
+	 * @param cpos the positions
+	 * @return the IDs
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	@Override
+	public abstract int[] cpos2Id(String attribute, int[] cpos) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	/**
+	 * Converts an array of position to their value given an attribute.
+	 *
+	 * @param attribute the attribute
+	 * @param cpos the cpos
+	 * @return the values
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	@Override
+	public abstract String[] cpos2Str(String attribute, int[] cpos) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	/**
+	 * Computes for each position of an array the Id of the enclosing structural
+	 * attribute.
+	 *
+	 * @param attribute the attribute
+	 * @param cpos the positions
+	 * @return the IDs
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	@Override
+	public abstract int[] cpos2Struc(String attribute, int[] cpos) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	/**
+	 * Computes for each position of an array the position of the left boundary
+	 * of the enclosing structural attribute.
+	 *
+	 * @param attribute the attribute
+	 * @param cpos the cpos
+	 * @return the positions of the left boundaries
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	@Override
+	public abstract int[] cpos2LBound(String attribute, int[] cpos) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	/**
+	 * Computes for each position of an array the position of the right boundary
+	 * of the enclosing structural attribute.
+	 *
+	 * @param attribute the attribute
+	 * @param cpos the cpos
+	 * @return the positions of the right boundaries
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	@Override
+	public abstract int[] cpos2RBound(String attribute, int[] cpos) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	/**
+	 * Computes for each position of an array the Id of the enclosing alignment
+	 * attribute.
+	 *
+	 * @param attribute the attribute
+	 * @param cpos the cpos
+	 * @return the int[]
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	@Override
+	public abstract int[] cpos2Alg(String attribute, int[] cpos) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	/**
+	 * Retrieves annotated string values of structure regions in <strucs>; "" if
+	 * out of range.
+	 *
+	 * @param attribute the attribute
+	 * @param strucs the strucs
+	 * @return the string[]
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	@Override
+	public abstract String[] struc2Str(String attribute, int[] strucs) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	/**
+	 * Retrieves all corpus positions where the given token occurs.
+	 *
+	 * @param attribute the attribute
+	 * @param id the id
+	 * @return the position
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	@Override
+	public abstract int[] id2Cpos(String attribute, int id) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	/**
+	 * Retrieves all corpus positions where one of the tokens in <id_list>
+	 * occurs; the returned list is sorted as a whole, not per token id.
+	 *
+	 * @param attribute the attribute
+	 * @param ids the ids
+	 * @return the positions
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	@Override
+	public abstract int[] idList2Cpos(String attribute, int[] ids) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	/**
+	 * Retrieves the lexicon IDs of all tokens that match <regex>; the returned
+	 * list may be empty (size 0).
+	 *
+	 * @param attribute the attribute
+	 * @param regex the regex
+	 * @return the IDs
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	@Override
+	public abstract int[] regex2Id(String attribute, String regex) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	/**
+	 * Retrieves the start and end corpus positions of structure region <struc>.
+	 *
+	 * @param attribute the attribute
+	 * @param struc the struc
+	 * @return an array of size 2 containing the start and end positions
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	@Override
+	public abstract int[] struc2Cpos(String attribute, int struc) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	/**
+	 * Retrieves start and end corpus positions of an alignement region in the
+	 * source and target corpora<struc>.
+	 *
+	 * @param attribute the attribute
+	 * @param struc the struc
+	 * @return an array of size 4 containing (src_start, src_end, target_start,
+	 * target_end)
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	@Override
+	public abstract int[] alg2Cpos(String attribute, int struc) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	/**
+	 * Runs a CQP query.
+	 *
+	 * @param motherCorpus the mother corpus
+	 * @param subcorpus the subcorpus
+	 * @param query the query
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError the cqi server error
+	 */
+	@Override
+	public abstract void cqpQuery(String motherCorpus, String subcorpus, String query) throws IOException, UnexpectedAnswerException, CqiServerError;
+
+	/**
+	 * Lists all the subcorpora of a corpus.
+	 *
+	 * @param corpus the corpus
+	 * @return the name of the subcorpora
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiCqpErrorNoSuchCorpus the cqi cqp error no such corpus
+	 */
+	@Override
+	public abstract String[] listSubcorpora(String corpus) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	/**
+	 * Gives the size of a subcorpus .
+	 * 
+	 * @param subcorpus
+	 *            the subcorpus
+	 * 
+	 * @return the size
+	 * 
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException
+	 *             Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError
+	 *             the cqi server error
+	 */
+	@Override
+	public abstract int subCorpusSize(String subcorpus) throws IOException,
+	UnexpectedAnswerException, CqiServerError;
+
+	/**
+	 * Checks wether a subcorpus has a field.
+	 * 
+	 * @param subcorpus
+	 *            the subcorpus
+	 * @param field
+	 *            the field
+	 * 
+	 * @return true, if the subcorpus has the field
+	 * 
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException
+	 *             Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError
+	 *             the cqi server error
+	 */
+	@Override
+	public abstract boolean subCorpusHasField(String subcorpus, byte field) throws IOException, UnexpectedAnswerException, CqiServerError;
+
+	/**
+	 * Dumps the values of <field> for match ranges <first> .. <last> in
+	 * <subcorpus>. <field> is one of the CQI_CONST_FIELD_* constants.
+	 * 
+	 * @param subcorpus
+	 *            the subcorpus
+	 * @param field
+	 *            the field
+	 * @param first
+	 *            the first
+	 * @param last
+	 *            the last
+	 * 
+	 * @return the values
+	 * 
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException
+	 *             Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError
+	 *             the cqi server error
+	 */
+	@Override
+	public abstract int[] dumpSubCorpus(String subcorpus, byte field, int first, int last) throws IOException, UnexpectedAnswerException,
+	CqiServerError;
+
+	/**
+	 * Drops a subcorpus.
+	 * 
+	 * @param subcorpus
+	 *            the subcorpus
+	 * 
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException
+	 *             Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError
+	 *             the cqi server error
+	 */
+	@Override
+	public abstract void dropSubCorpus(String subcorpus) throws IOException,
+	UnexpectedAnswerException, CqiServerError;
+
+	/**
+	 * Returns <n> (id, frequency) pairs flattened into a list of size 2*<n> NB:
+	 * pairs are sorted by frequency desc.
+	 * 
+	 * @param subcorpus
+	 *            the subcorpus
+	 * @param cutoff
+	 *            the cutoff
+	 * @param field
+	 *            the field : one of CQI_CONST_FIELD_MATCH,
+	 *            CQI_CONST_FIELD_TARGET, CQI_CONST_FIELD_KEYWORD
+	 * @param attribute
+	 *            the attribute
+	 * 
+	 * @return the int[][]
+	 * 
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException
+	 *             Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError
+	 *             the cqi server error
+	 */
+	@Override
+	public abstract int[][] fdist1(String subcorpus, int cutoff,
+			byte field, String attribute) throws IOException,
+			UnexpectedAnswerException, CqiServerError;
+
+	/**
+	 * Returns <n> (id1, id2, frequency) pairs flattened into a list of size
+	 * 3*<n> NB: triples are sorted by frequency desc. .
+	 * 
+	 * @param subcorpus
+	 *            the subcorpus
+	 * @param cutoff
+	 *            the cutoff
+	 * @param field1
+	 *            the field1
+	 * @param attribute1
+	 *            the attribute1
+	 * @param field2
+	 *            the field2
+	 * @param attribute2
+	 *            the attribute2
+	 * 
+	 * @return the int[]
+	 * 
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException
+	 *             Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError
+	 *             the cqi server error
+	 */
+	@Override
+	public abstract int[][] fdist2(String subcorpus, int cutoff,
+			byte field1, String attribute1, byte field2, String attribute2) throws IOException, UnexpectedAnswerException, CqiServerError;
+
+	@Override
+	public abstract boolean reconnect() ;
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/AbstractCqiClient.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/CqpDataProxy.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/cqp/CqpDataProxy.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/cqp/CqpDataProxy.java	(revision 258)
@@ -0,0 +1,203 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.commons.lang.ArrayUtils;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.corpus.Property;
+import org.txm.searchengine.cqp.corpus.StructuralUnitProperty;
+import org.txm.utils.SparseList;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class CqpDataProxy.
+ */
+public class CqpDataProxy {
+	/**
+	 * Data is cached in a sparse list which give for each position the
+	 * corresponding string (given the property it is dedicated to).
+	 */
+	private SparseList<String> data;
+
+	/** The property getQualifiedName. */
+	private String property;
+	private boolean isWordProperty = true;
+	private NetCqiClient netCqiClient;
+	/**
+	 * Instantiates a new cqp data proxy.
+	 *
+	 * @param property the property getQualifiedName
+	 */
+	public CqpDataProxy(NetCqiClient netCqiClient, String property) {
+		this(netCqiClient,  property, true);
+	}
+	
+	public CqpDataProxy(NetCqiClient netCqiClient, Property property) {
+		this(netCqiClient,  property.getQualifiedName(), !(property instanceof StructuralUnitProperty));
+	}
+	
+	/**
+	 * Instantiates a new cqp data proxy.
+	 *
+	 * @param property the property getQualifiedName
+	 * @param isWordProperty true is the default value
+	 */
+	public CqpDataProxy(NetCqiClient netCqiClient, String property, boolean isWordProperty) {
+		this.data = new SparseList<String>();
+		this.property = property;
+		this.isWordProperty = isWordProperty;
+		this.netCqiClient = netCqiClient;
+	}
+
+	/**
+	 * Return lists of strings. The positions parameter gives a list of starting
+	 * points, and the nWords parameter gives a list of sizes: The i^th string
+	 * starts at the position positions.get(i) and is nWords.get(i)
+	 *
+	 * @param positions the positions
+	 * @param nWords the n words
+	 * @return the data
+	 * @throws CqiClientException the cqi client exception
+	 */
+	public List<List<String>> getData(List<Integer> positions,
+			List<Integer> nWords) throws CqiClientException {
+		List<List<String>> lines = new ArrayList<List<String>>();
+		for (int i = 0; i < positions.size(); i++)
+			lines.add(data.getRange(positions.get(i), positions.get(i)
+					+ nWords.get(i)));
+		List<Integer> allPositionsNeeded = new ArrayList<Integer>();
+		// the position in the corpus of the missing values
+		
+		for (int i = 0; i < lines.size(); i++) {
+			List<String> line = lines.get(i);
+			for (int j = 0; j < line.size(); j++) {
+				if (line.get(j) == null)
+					allPositionsNeeded.add(positions.get(i) + j);
+			}
+		}
+		if (allPositionsNeeded.size() > 0) {
+			String[] missingValues;
+			try {
+				if (!isWordProperty) {
+					//System.out.println("DataProxy: "+allPositionsNeeded);
+					int[] strucs = netCqiClient.cpos2Struc(
+									property,
+									ArrayUtils
+											.toPrimitive(allPositionsNeeded
+													.toArray(new Integer[0])));
+					//System.out.println("structs: "+Arrays.toString(strucs));
+					missingValues = netCqiClient._struc2Str(
+									property, strucs);
+					//System.out.println("missingValues: "+missingValues);
+				} else {
+					missingValues = netCqiClient._cpos2Str(
+									property,
+									ArrayUtils
+											.toPrimitive(allPositionsNeeded
+													.toArray(new Integer[0])));
+				}
+			} catch (Exception e) {
+				throw new CqiClientException(e);
+			}
+			for (int i = 0; i < missingValues.length; i++)
+				data.add(allPositionsNeeded.get(i), missingValues[i]);
+			// There is no more missing values in data, we can query it again
+			// This is is pretty ugly since all the non missing values have
+			// already been retrieved...
+			lines = new ArrayList<List<String>>();
+			for (int i = 0; i < positions.size(); i++)
+				lines.add(data.getRange(positions.get(i), positions.get(i)
+						+ nWords.get(i)));
+		}
+		return lines;
+	}
+
+	public List<String> getData(List<Integer> positions) throws CqiClientException {
+		int [] ipositions = new int[positions.size()];
+		for(int i = 0 ; i < positions.size() ; i++)
+			ipositions[i] = positions.get(i);
+		return getData(ipositions);
+	}
+	
+	/**
+	 * Gets the data.
+	 *
+	 * @param positions the positions
+	 * @return the data
+	 * @throws CqiClientException the cqi client exception
+	 */
+	public List<String> getData(int[] positions) throws CqiClientException {
+		//System.out.println("CqpDataProxy: start "+property);
+		//System.out.println("positions: "+Arrays.toString(positions));
+		List<String> lines = new ArrayList<String>();
+		for (int i = 0; i < positions.length; i++)
+			lines.add(data.getRange(positions[i], positions[i] + 1).get(0));
+		//System.out.println("lines: "+lines);
+		List<Integer> missingValuePositions = new ArrayList<Integer>();// the position in the corpus of the missing values
+		for (int i = 0; i < lines.size(); i++) {
+			String line = lines.get(i);
+			if (line == null)
+				missingValuePositions.add(positions[i]);
+		}
+		//System.out.println("missingValuePositions: "+missingValuePositions);
+		if (missingValuePositions.size() > 0) {
+			String[] missingValues;
+			try {
+				if (!isWordProperty) {
+					int[] strucs = netCqiClient.cpos2Struc(
+									property,
+									ArrayUtils.toPrimitive(missingValuePositions
+													.toArray(new Integer[0])));
+					//System.out.println("structs: "+Arrays.toString(strucs));
+					missingValues = netCqiClient._struc2Str(property, strucs);
+				} else {
+					missingValues = netCqiClient._cpos2Str(
+									property,
+									ArrayUtils.toPrimitive(missingValuePositions
+													.toArray(new Integer[0])));
+					//System.out.println("missingValues: "+missingValues);
+				}
+			} catch (Exception e) {
+				throw new CqiClientException(e);
+			}
+			for (int i = 0; i < missingValues.length; i++)
+				data.add(missingValuePositions.get(i), missingValues[i]);
+			// There is no more missing values in data, we can query it again
+			// This is is pretty ugly since all the non missing values have
+			// already been retrieved...
+			lines = new ArrayList<String>();
+			for (int i = 0; i < positions.length; i++)
+				lines.add(data.getRange(positions[i], positions[i] + 1).get(0));
+		}
+		return lines;
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/CqpDataProxy.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/clientExceptions/InvalidCqpIdException.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/cqp/clientExceptions/InvalidCqpIdException.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/cqp/clientExceptions/InvalidCqpIdException.java	(revision 258)
@@ -0,0 +1,77 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.clientExceptions;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class InvalidCqpIdException.
+ */
+public class InvalidCqpIdException extends Exception {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * Instantiates a new invalid cqp id exception.
+	 */
+	public InvalidCqpIdException() {
+		// TODO Auto-generated constructor stub
+	}
+
+	/**
+	 * Instantiates a new invalid cqp id exception.
+	 *
+	 * @param arg0 the arg0
+	 */
+	public InvalidCqpIdException(String arg0) {
+		super(arg0);
+		// TODO Auto-generated constructor stub
+	}
+
+	/**
+	 * Instantiates a new invalid cqp id exception.
+	 *
+	 * @param arg0 the arg0
+	 */
+	public InvalidCqpIdException(Throwable arg0) {
+		super(arg0);
+		// TODO Auto-generated constructor stub
+	}
+
+	/**
+	 * Instantiates a new invalid cqp id exception.
+	 *
+	 * @param arg0 the arg0
+	 * @param arg1 the arg1
+	 */
+	public InvalidCqpIdException(String arg0, Throwable arg1) {
+		super(arg0, arg1);
+		// TODO Auto-generated constructor stub
+	}
+
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/clientExceptions/InvalidCqpIdException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/clientExceptions/CqiClientException.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/cqp/clientExceptions/CqiClientException.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/cqp/clientExceptions/CqiClientException.java	(revision 258)
@@ -0,0 +1,95 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.clientExceptions;
+
+import org.txm.Toolbox;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Base class for the Exception raised by the CQi client itself (i.e. not
+ * recieved from the CQi server)
+ * 
+ * @author Jean-Philippe Magué
+ */
+public class CqiClientException extends Exception {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * Instantiates a new cqi client exception.
+	 * 
+	 * @param message
+	 *            the message
+	 */
+	public CqiClientException(String message) {
+		super(message);
+	}
+
+	static int counter = 0;
+	/**
+	 * Instantiates a new cqi client exception.
+	 * 
+	 * @param cause
+	 *            the cause
+	 */
+	public CqiClientException(Throwable cause) {
+		super(cause);
+		if(cause instanceof java.net.SocketException){
+			if (counter++ < 5) {
+				if(!Toolbox.getCqiClient().reconnect())
+					Toolbox.restartSearchEngine();
+			}
+		}
+	}
+
+	/**
+	 * Instantiates a new cqi client exception.
+	 * 
+	 * @param message
+	 *            the message
+	 * @param cause
+	 *            the cause
+	 */
+	public CqiClientException(String message, Throwable cause) {
+		super(message, cause);
+		if(cause instanceof java.net.SocketException)
+		{
+			if(!Toolbox.getCqiClient().reconnect())
+				Toolbox.restartSearchEngine();
+		}
+	}
+
+	/**
+	 * Instantiates a new cqi client exception.
+	 */
+	public CqiClientException() {
+		super();
+	}
+
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/clientExceptions/CqiClientException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/clientExceptions/package.html
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/cqp/clientExceptions/package.html	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/cqp/clientExceptions/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Exception during communication between the cqp server and the cqp client.</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/clientExceptions/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/clientExceptions/ServerNotFoundException.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/cqp/clientExceptions/ServerNotFoundException.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/cqp/clientExceptions/ServerNotFoundException.java	(revision 258)
@@ -0,0 +1,75 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.clientExceptions;
+
+import java.io.IOException;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Thrown to indicates that client do not find the server.
+ *
+ * @author Jean-Philippe Magué
+ */
+public class ServerNotFoundException extends CqiClientException {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * Instantiates a new server not found exception.
+	 * 
+	 * @param string
+	 *            the message
+	 * @param e
+	 *            the cause
+	 */
+	public ServerNotFoundException(String string, IOException e) {
+		super(string, e);
+	}
+
+	/**
+	 * Instantiates a new server not found exception.
+	 * 
+	 * @param string
+	 *            the message
+	 */
+	public ServerNotFoundException(String string) {
+		super(string);
+	}
+
+	/**
+	 * Instantiates a new server not found exception.
+	 * 
+	 * @param e
+	 *            the cause
+	 */
+	public ServerNotFoundException(Throwable e) {
+		super(e);
+	}
+
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/clientExceptions/ServerNotFoundException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/clientExceptions/UnexpectedAnswerException.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/cqp/clientExceptions/UnexpectedAnswerException.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/cqp/clientExceptions/UnexpectedAnswerException.java	(revision 258)
@@ -0,0 +1,80 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.clientExceptions;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Thrown to indicates that client recieved unexpected data from the server.
+ *
+ * @author Jean-Philippe Magué
+ */
+public class UnexpectedAnswerException extends CqiClientException {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * Instantiates a new unexpected answer exception.
+	 */
+	public UnexpectedAnswerException() {
+		super();
+	}
+
+	/**
+	 * Instantiates a new unexpected answer exception.
+	 * 
+	 * @param arg0
+	 *            the message
+	 */
+	public UnexpectedAnswerException(String arg0) {
+		super(arg0);
+	}
+
+	/**
+	 * Instantiates a new unexpected answer exception.
+	 * 
+	 * @param arg0
+	 *            the cause
+	 */
+	public UnexpectedAnswerException(Throwable arg0) {
+		super(arg0);
+	}
+
+	/**
+	 * Instantiates a new unexpected answer exception.
+	 * 
+	 * @param arg0
+	 *            the message
+	 * @param arg1
+	 *            the cause
+	 */
+	public UnexpectedAnswerException(String arg0, Throwable arg1) {
+		super(arg0, arg1);
+	}
+
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/clientExceptions/UnexpectedAnswerException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/MemCqiServer.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/cqp/MemCqiServer.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/cqp/MemCqiServer.java	(revision 258)
@@ -0,0 +1,1097 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2011-12-14 10:52:18 +0100 (mer., 14 déc. 2011) $
+// $LastChangedRevision: 2080 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.lang.reflect.Field;
+import java.util.Arrays;
+
+import org.apache.commons.lang.ArrayUtils;
+import org.apache.commons.lang.StringUtils;
+import org.txm.Toolbox;
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.searchengine.cqp.clientExceptions.ServerNotFoundException;
+import org.txm.searchengine.cqp.clientExceptions.UnexpectedAnswerException;
+import org.txm.searchengine.cqp.serverException.CqiCqpErrorNoSuchCorpus;
+import org.txm.searchengine.cqp.serverException.CqiServerError;
+import org.txm.utils.ExecTimer;
+import org.txm.utils.logger.Log;
+
+// TODO: Auto-generated Javadoc
+/**
+ * This class aims at handling a CQi server process. It is not a CQi server per
+ * se.
+ * 
+ * @author Jean-Philippe Magué
+ */
+public class MemCqiServer extends AbstractCqiServer {
+
+	/**
+	 * Instantiates a new CQi server.
+	 * 
+	 * @param pathToExecutable
+	 *            the path to the executable
+	 * @param pathToRegistry
+	 *            the path to the registry
+	 * @param pathToInitFile
+	 *            the path to the init file
+	 * 
+	 * @throws ServerNotFoundException
+	 *             the server not found exception
+	 */
+	public MemCqiServer(String pathToExecutable, String pathToRegistry,
+			String pathToInitFile) throws ServerNotFoundException {
+		this(pathToExecutable, pathToRegistry, pathToInitFile, ""); //$NON-NLS-1$
+	}
+
+	/**
+	 ** Instantiates a new CQi server.
+	 * 
+	 * @param pathToExecutable
+	 *            the path to the executable
+	 * @param pathToRegistry
+	 *            the path to the registry
+	 * @param pathToInitFile
+	 *            the path to the init file
+	 * @param additionalOptions
+	 *            the additional command line options
+	 * 
+	 * @throws ServerNotFoundException
+	 *             the server not found exception
+	 */
+	public MemCqiServer(String pathToExecutable, String pathToRegistry,
+			String pathToInitFile, String additionalOptions)
+					throws ServerNotFoundException {
+
+	}
+
+	/** The path to executable. */
+	String pathToExecutable;
+
+	/** The path to registry. */
+	String pathToRegistry;
+
+	/** The path to init file. */
+	String pathToInitFile;
+
+	/** The additional options. */
+	String additionalOptions;
+
+	/** The monitor output. */
+	boolean monitorOutput;
+
+	/** The cmd line. */
+	static String[] cmdLine;
+	public boolean debug = false;
+
+	public void setDebug(boolean val)
+	{
+		debug = val;
+	}
+
+	public native int getErrorCode();
+
+
+	/**
+	 * Instantiates a new cqi server.
+	 *
+	 * @param pathToExecutable the path to executable
+	 * @param pathToRegistry the path to registry
+	 * @param pathToInitFile the path to init file
+	 * @param additionalOptions the additional options
+	 * @param monitorOutput the monitor output
+	 * @throws Exception 
+	 */
+	public MemCqiServer(String pathToExecutable, String pathToRegistry,
+			String pathToInitFile, String additionalOptions,
+			boolean monitorOutput) throws Exception {
+
+		this.pathToExecutable = pathToExecutable;
+		this.pathToRegistry = pathToRegistry;
+		this.pathToInitFile = pathToInitFile;
+		this.additionalOptions = additionalOptions;
+		this.monitorOutput = monitorOutput;
+
+		if (!isLoaded) {
+			
+			Field LIBRARIES = ClassLoader.class.getDeclaredField("loadedLibraryNames");
+			LIBRARIES.setAccessible(true);
+			
+			try {
+				String path = System.getProperty("java.library.path");
+				String libpath = System.getProperty("path.separator")+Toolbox.getParam(Toolbox.CQI_SERVER_PATH_TO_CQPLIB);
+				if (!path.contains(libpath)) {
+					path += libpath;
+				}
+				System.setProperty("java.library.path", path);
+				//System.out.println("Current java.library.path "+System.getProperty("java.library.path"));
+
+				// this is a hack to force the JVM to reload java.library.path
+				Field fieldSysPath = ClassLoader.class.getDeclaredField( "sys_paths" );
+				fieldSysPath.setAccessible( true );
+				fieldSysPath.set( null, null );
+				
+				System.loadLibrary("cqpjni");
+				Log.info("cqpjni loaded from dirs "+path);
+				isLoaded = true;
+
+			} catch (Throwable e) {
+				System.err.println("Failed to load CQP lib with exception: "+e);
+				System.err.println("Looking for Cqi libs in : "+System.getProperty("java.library.path")); 
+				System.err.println("Current directory: "+new File(".").getAbsolutePath());
+				throw new Exception(e);
+			}
+		}
+	}
+
+	/**
+	 * Gets the last cmd line.
+	 *
+	 * @return the last cmd line
+	 */
+
+	public String getLastCmdLine() {
+		return StringUtils.join(cmdLine, " "); //$NON-NLS-1$
+	}
+
+	/**
+	 * Start.
+	 *
+	 * @return true, if successful
+	 */
+	public Boolean start() {
+		String[] cmd = { pathToExecutable, "-I", pathToInitFile, "-r", pathToRegistry }; //$NON-NLS-1$ //$NON-NLS-2$
+		cmdLine = (String[]) ArrayUtils.addAll(cmd, additionalOptions.trim().split(" ")); //$NON-NLS-1$
+		Log.info("Starting NullSearchEngineServer: "+Arrays.toString(cmdLine)+" ... ");
+
+		//try {
+			isLoaded = start(cmdLine);
+			//System.out.println("IS LOADED: "+isLoaded);
+			if (isLoaded) {
+				System.out.println(TXMCoreMessages.CqiClient_34);
+			} else {
+				System.out.println("Failed to start SearchEngine in memory mode.");
+			}
+			return isLoaded;
+//		} catch(Exception e) {
+//			System.out.println("Failed to start MemCqiServer: "+e+ " (error code: "+getErrorCode()+")");
+//			return false;
+//		}
+	}
+
+	/**
+	 * Convert stream to string.
+	 *
+	 * @param is the is
+	 * @return the string
+	 */
+
+	public String convertStreamToString(InputStream is) {
+		BufferedReader reader = new BufferedReader(new InputStreamReader(is));
+		StringBuilder sb = new StringBuilder();
+		String line = null;
+		try {
+			while ((line = reader.readLine()) != null) {
+				sb.append(line);
+			}
+		} catch (IOException e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+		} finally {
+			try {
+				is.close();
+			} catch (IOException e) {
+				org.txm.utils.logger.Log.printStackTrace(e);
+			}
+		}
+
+		return sb.toString();
+	}
+
+	/**
+	 * Checks if the server is running.
+	 * 
+	 * @return true, if is running
+	 */
+
+	public Boolean isRunning() {
+		return isLoaded;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Object#finalize()
+	 */
+	protected void finalize() throws Throwable {
+
+	}
+
+	/**
+	 * Gets the error stream.
+	 *
+	 * @return the error stream
+	 */
+
+	public InputStream getErrorStream() {
+		return null;
+	}
+
+	/**
+	 * Gets the input stream.
+	 *
+	 * @return the input stream
+	 */
+
+	public InputStream getInputStream() {
+		return new InputStream() {
+			public int read() throws IOException {
+				return 0;
+			}
+		};
+	}
+
+	/**
+	 * Gets the output stream.
+	 *
+	 * @return the output stream
+	 */
+
+	public OutputStream getOutputStream() {
+		return new OutputStream() {
+			public void write(int arg0) throws IOException {
+			}
+		};
+	}
+
+	static Boolean isLoaded = false;
+
+	public native Boolean start(String[] args);
+
+	public native Boolean stop();
+
+	public native int[] alg2Cpos(String arg0, int arg1) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	public native Integer attributeSize(String arg0) throws IOException, UnexpectedAnswerException, CqiServerError ;
+
+	public boolean connect(String arg0, String arg1) { return true;} ;
+
+	public native String[] corpusAlignementAttributes(String arg0) throws UnexpectedAnswerException, IOException, CqiServerError ;
+
+	public native String corpusCharset(String arg0) throws UnexpectedAnswerException, IOException, CqiServerError ;
+
+	public native String corpusFullName(String arg0) throws UnexpectedAnswerException, IOException, CqiServerError ;
+
+	public native String[] corpusInfo(String arg0) throws UnexpectedAnswerException, IOException, CqiServerError ;
+
+	public native String[] corpusPositionalAttributes(String arg0) throws UnexpectedAnswerException, IOException, CqiServerError ;
+
+	public native String[] corpusProperties(String arg0) throws UnexpectedAnswerException, IOException, CqiServerError ;
+
+	public native Boolean corpusStructuralAttributeHasValues(String arg0) throws UnexpectedAnswerException, IOException, CqiServerError ;
+
+	public native String[] corpusStructuralAttributes(String arg0) throws UnexpectedAnswerException, IOException, CqiServerError ;
+
+	public native int[] cpos2Alg(String arg0, int[] arg1) throws UnexpectedAnswerException, IOException, CqiServerError ;
+
+	public native int[] cpos2Id(String arg0, int[] arg1) throws UnexpectedAnswerException, IOException, CqiServerError ;
+
+	public native int[] cpos2LBound(String arg0, int[] arg1) throws UnexpectedAnswerException, IOException, CqiServerError ;
+
+	public native int[] cpos2RBound(String arg0, int[] arg1) throws UnexpectedAnswerException, IOException, CqiServerError ;
+
+	public native String[] cpos2Str(String arg0, int[] arg1) throws UnexpectedAnswerException, IOException, CqiServerError ;
+
+	public native int[] cpos2Struc(String arg0, int[] arg1) throws UnexpectedAnswerException, IOException, CqiServerError ;
+
+	public native Boolean cqpQuery(String arg0, String arg1, String arg2)
+			throws IOException, UnexpectedAnswerException, CqiServerError ;
+
+	public native Boolean query(String arg0)
+			throws IOException, UnexpectedAnswerException, CqiServerError ;
+
+	public Boolean disconnect() { return true; };
+
+	public native Boolean dropAttribute(String arg0) throws IOException, UnexpectedAnswerException, CqiServerError ;
+
+	public native Boolean dropCorpus(String arg0) throws Exception ;
+
+	public native Boolean dropSubCorpus(String arg0) throws IOException, UnexpectedAnswerException, CqiServerError ;
+
+	public native int[] dumpSubCorpus(String arg0, byte arg1, int arg2, int arg3)
+			throws IOException, UnexpectedAnswerException, CqiServerError ;
+
+	public int[][] fdist1(String arg0, int arg1, byte arg2, String arg3)
+			throws IOException, UnexpectedAnswerException, CqiServerError {
+		int[] all = nfdist1(arg0, arg1, arg2, arg3);
+		if (all == null) {
+			return new int[0][0];
+		}
+		int[][] freqs = new int[all.length / 2][2];
+		int c = 0;
+		for (int i = 0 ; i < freqs.length ;i++) {
+			freqs[i][0] = all[c++];
+			freqs[i][1] = all[c++];
+		}
+		return freqs;
+
+	}
+
+	public native int[] nfdist1(String arg0, int arg1, byte arg2, String arg3)
+			throws IOException, UnexpectedAnswerException, CqiServerError;
+
+	public int[][] fdist2(String arg0, int arg1, byte arg2, String arg3,
+			byte arg4, String arg5) throws IOException,
+			UnexpectedAnswerException, CqiServerError {
+		int[] all = nfdist2(arg0, arg1, arg2, arg3, arg4, arg5);
+		if (all == null) {
+			return new int[0][0];
+		}
+		int[][] freqs = new int[all.length / 2][3];
+		int c = 0;
+		for (int i = 0 ; i < freqs.length ; i++) {
+			freqs[i][0] = all[c++];
+			freqs[i][1] = all[c++];
+			freqs[i][2] = all[c++];
+		}
+		return freqs;
+	}
+
+	public native int[] nfdist2(String arg0, int arg1, byte arg2, String arg3,
+			byte arg4, String arg5) throws IOException, UnexpectedAnswerException, CqiServerError;
+
+	public native String getLastCQPError() ;
+
+	public native String getLastCqiError() throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	public native int[] id2Cpos(String arg0, int arg1) throws UnexpectedAnswerException, IOException, CqiServerError ;
+
+	public native int[] id2Freq(String arg0, int[] arg1) throws UnexpectedAnswerException, IOException, CqiServerError ;
+
+	public native String[] id2Str(String arg0, int[] arg1) throws UnexpectedAnswerException, IOException, CqiServerError ;
+
+	public native int[] idList2Cpos(String arg0, int[] arg1) throws UnexpectedAnswerException, IOException, CqiServerError ;
+
+	public native Integer lexiconSize(String arg0) throws IOException, UnexpectedAnswerException, CqiServerError ;
+
+	public native String[] listCorpora() throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	public native String[] listSubcorpora(String arg0) throws UnexpectedAnswerException, IOException, CqiCqpErrorNoSuchCorpus ;
+
+	public Boolean reconnect() { return true; } ;
+
+	public native int[] regex2Id(String arg0, String arg1) throws UnexpectedAnswerException, IOException, CqiServerError ;
+
+	public native int[] str2Id(String arg0, String[] arg1) throws IOException, UnexpectedAnswerException, CqiServerError ;
+
+	public native int[] struc2Cpos(String arg0, int arg1) throws UnexpectedAnswerException, IOException, CqiServerError ;
+
+	public native String[] struc2Str(String arg0, int[] arg1) throws UnexpectedAnswerException, IOException, CqiServerError ;
+
+	public native Boolean subCorpusHasField(String arg0, byte arg1) throws IOException, UnexpectedAnswerException, CqiServerError ;
+
+	public native Integer subCorpusSize(String arg0) throws IOException, UnexpectedAnswerException, CqiServerError ;
+
+	/**
+	 * @param args
+	 * @throws Exception 
+	 */
+	public static void main(String[] args) throws Exception {
+		String pathToExecutable = "/home/mdecorde/workspace37/CWB-lib/src/cqp/";
+		String cqpserverPathToExecutable = "/home/mdecorde/workspace37/CWB-lib/src/cqp/cqpserver";
+		String pathToRegistry = "/home/mdecorde/TXM/registry";
+		String pathToInitFile = "/usr/lib/TXM/cwb/cqpserver.init";
+
+		String corpus = "DISCOURS";
+		String subcorpusname = "SUB";
+		String subcorpusid = corpus+":"+subcorpusname;
+		String query = "[word=\"j.*\"]";
+		String regex = "j.*";
+		String pattribute1 = corpus+".word";
+		String pattribute2 = corpus+".frpos";
+		String pattribute3 = corpus+".frlemma";
+		String sattribute1 = corpus+".text_id";
+		String sattribute2 = corpus+".p_id";
+		String sattribute3 = corpus+".s_id";
+
+		String align_attr = "p_id";
+
+		int[] cpos = {0,10000,2,3,4,5,6,7,8,9,10};
+		//	int id = 1;
+		int[] ids = {0,1,2,3,4,5,6,7,8,9,10};
+		String[] strings = {"je", "jamais"};
+		int[] strucpos = {0, 1, 2, 3 , 4};
+
+		Toolbox.setParam(Toolbox.CQI_SERVER_PATH_TO_CQPLIB, pathToExecutable);
+
+		MemCqiServer server = new MemCqiServer(pathToExecutable, pathToRegistry, pathToInitFile, " -b 10000000 -d OFF", false);
+		if (server.start()) System.out.println("Mem Server ok");
+		MemCqiClient client = new MemCqiClient(server);
+		if (client.connect("anonymous", "")) System.out.println("Mem Client ok");
+
+		NetCqiServer netServer = new NetCqiServer(cqpserverPathToExecutable, pathToRegistry, pathToInitFile, "", false);
+		if (netServer.start()) System.out.println("Net Server ok");
+		NetCqiClient netClient = new NetCqiClient("127.0.0.1", 4877);
+		if (netClient.connect("anonymous", "")) System.out.println("Net Client ok");
+
+		ExecTimer.start();
+
+		try {
+			System.out.println("client.alg2Cpos(sattribute, struct_id) : "+Arrays.toString(client.alg2Cpos(sattribute1, 0)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.alg2Cpos(sattribute, struct_id) : "+Arrays.toString(netClient.alg2Cpos(sattribute1, 0)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.attributeSize(sattribute1) : "+client.attributeSize(sattribute1));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.attributeSize(sattribute1) : "+netClient.attributeSize(sattribute1));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+
+		try {
+			System.out.println("client.attributeSize(sattribute2) : "+client.attributeSize(sattribute2));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.attributeSize(sattribute2) : "+netClient.attributeSize(sattribute2));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+
+		try {
+			System.out.println("client.attributeSize(sattribute3) : "+client.attributeSize(sattribute3));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.attributeSize(sattribute3) : "+netClient.attributeSize(sattribute3));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+
+		try {
+			System.out.println("client.corpusAlignementAttributes(corpus) : "+Arrays.toString(client.corpusAlignementAttributes(corpus)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.corpusAlignementAttributes(corpus) : "+Arrays.toString(netClient.corpusAlignementAttributes(corpus)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.corpusCharset(corpus) : "+client.corpusCharset(corpus));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.corpusCharset(corpus) : "+netClient.corpusCharset(corpus));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+
+		try {
+			System.out.println("client.corpusFullName(corpus) : "+client.corpusFullName(corpus));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.corpusFullName(corpus) : "+netClient.corpusFullName(corpus));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.corpusInfo(corpus) : "+client.corpusInfo(corpus));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.corpusInfo(corpus) : "+netClient.corpusInfo(corpus));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+
+		try {
+			System.out.println("client.corpusPositionalAttributes(corpus) : "+Arrays.toString(client.corpusPositionalAttributes(corpus)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.corpusPositionalAttributes(corpus) : "+Arrays.toString(netClient.corpusPositionalAttributes(corpus)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+
+		try {
+			System.out.println("client.corpusProperties(corpus) : "+Arrays.toString(client.corpusProperties(corpus)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.corpusProperties(corpus) : "+Arrays.toString(netClient.corpusProperties(corpus)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+
+		try {
+			System.out.println("client.corpusStructuralAttributeHasValues(sattribute1) : "+client.corpusStructuralAttributeHasValues(sattribute1));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.corpusStructuralAttributeHasValues(sattribute1) : "+netClient.corpusStructuralAttributeHasValues(sattribute1));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.corpusStructuralAttributeHasValues(sattribute2) : "+client.corpusStructuralAttributeHasValues(sattribute2));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.corpusStructuralAttributeHasValues(sattribute2) : "+netClient.corpusStructuralAttributeHasValues(sattribute2));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.corpusStructuralAttributeHasValues(sattribute3) : "+client.corpusStructuralAttributeHasValues(sattribute3));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.corpusStructuralAttributeHasValues(sattribute3) : "+netClient.corpusStructuralAttributeHasValues(sattribute3));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.corpusStructuralAttributes(corpus) : "+Arrays.toString(client.corpusStructuralAttributes(corpus)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.corpusStructuralAttributes(corpus) : "+Arrays.toString(netClient.corpusStructuralAttributes(corpus)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.cpos2Alg(align_attr, cpos) : "+Arrays.toString(client.cpos2Alg(align_attr, cpos)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.cpos2Alg(align_attr, cpos) : "+Arrays.toString(netClient.cpos2Alg(align_attr, cpos)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.cpos2Id(pattribute1, cpos) : "+Arrays.toString(client.cpos2Id(pattribute1, cpos)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.cpos2Id(pattribute1, cpos) : "+Arrays.toString(netClient.cpos2Id(pattribute1, cpos)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.cpos2Id(pattribute2, cpos) : "+Arrays.toString(client.cpos2Id(pattribute2, cpos)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.cpos2Id(pattribute2, cpos) : "+Arrays.toString(netClient.cpos2Id(pattribute2, cpos)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.cpos2Id(pattribute3, cpos) : "+Arrays.toString(client.cpos2Id(pattribute3, cpos)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.cpos2Id(pattribute3, cpos) : "+Arrays.toString(netClient.cpos2Id(pattribute3, cpos)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.cpos2LBound(sattribute1, cpos) : "+Arrays.toString(client.cpos2LBound(sattribute1, cpos)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.cpos2LBound(sattribute1, cpos) : "+Arrays.toString(netClient.cpos2LBound(sattribute1, cpos)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.cpos2LBound(sattribute2, cpos) : "+Arrays.toString(client.cpos2LBound(sattribute2, cpos)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.cpos2LBound(sattribute2, cpos) : "+Arrays.toString(netClient.cpos2LBound(sattribute2, cpos)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.cpos2LBound(sattribute3, cpos) : "+Arrays.toString(client.cpos2LBound(sattribute3, cpos)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.cpos2LBound(sattribute3, cpos) : "+Arrays.toString(netClient.cpos2LBound(sattribute3, cpos)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.cpos2RBound(sattribute1, cpos) : "+Arrays.toString(client.cpos2RBound(sattribute1, cpos)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.cpos2RBound(sattribute1, cpos) : "+Arrays.toString(netClient.cpos2RBound(sattribute1, cpos)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.cpos2RBound(sattribute2, cpos) : "+Arrays.toString(client.cpos2RBound(sattribute2, cpos)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.cpos2RBound(sattribute2, cpos) : "+Arrays.toString(netClient.cpos2RBound(sattribute2, cpos)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.cpos2RBound(sattribute3, cpos) : "+Arrays.toString(client.cpos2RBound(sattribute3, cpos)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.cpos2RBound(sattribute3, cpos) : "+Arrays.toString(netClient.cpos2RBound(sattribute3, cpos)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.cpos2Str(pattribute1, cpos) : "+Arrays.toString(client.cpos2Str(pattribute1, cpos)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.cpos2Str(pattribute1, cpos) : "+Arrays.toString(netClient.cpos2Str(pattribute1, cpos)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.cpos2Str(pattribute2, cpos) : "+Arrays.toString(client.cpos2Str(pattribute2, cpos)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.cpos2Str(pattribute2, cpos) : "+Arrays.toString(netClient.cpos2Str(pattribute2, cpos)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.cpos2Str(pattribute3, cpos) : "+Arrays.toString(client.cpos2Str(pattribute3, cpos)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.cpos2Str(pattribute3, cpos) : "+Arrays.toString(netClient.cpos2Str(pattribute3, cpos)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.cpos2Struc(sattribute1, cpos) : "+Arrays.toString(client.cpos2Struc(sattribute1, cpos)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.cpos2Struc(sattribute1, cpos) : "+Arrays.toString(netClient.cpos2Struc(sattribute1, cpos)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.cpos2Struc(sattribute2, cpos) : "+Arrays.toString(client.cpos2Struc(sattribute2, cpos)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.cpos2Struc(sattribute2, cpos) : "+Arrays.toString(netClient.cpos2Struc(sattribute2, cpos)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.cpos2Struc(sattribute3, cpos) : "+Arrays.toString(client.cpos2Struc(sattribute3, cpos)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.cpos2Struc(sattribute3, cpos) : "+Arrays.toString(netClient.cpos2Struc(sattribute3, cpos)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.cqpQuery(corpus, subcorpus, query)");client.cqpQuery(corpus, subcorpusname, query);
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.cqpQuery(corpus, subcorpus, query)");netClient.cqpQuery(corpus, subcorpusname, query);
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.dropAttribute(pattribute1)");client.dropAttribute(pattribute1);
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.dropAttribute(pattribute1)");netClient.dropAttribute(pattribute1);
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.dropAttribute(pattribute2)");client.dropAttribute(pattribute2);
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.dropAttribute(pattribute2)");netClient.dropAttribute(pattribute2);
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.dropAttribute(pattribute3)");client.dropAttribute(pattribute3);
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.dropAttribute(pattribute3)");netClient.dropAttribute(pattribute3);
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.dropCorpus(corpus)");client.dropCorpus(corpus);
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.dropCorpus(corpus)");netClient.dropCorpus(corpus);
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.dumpSubCorpus(subcorpus, CQI_CONST_FIELD_MATCH, 1, 2) : "+Arrays.toString(client.dumpSubCorpus(subcorpusid, NetCqiClient.CQI_CONST_FIELD_MATCH, 1, 10)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.dumpSubCorpus(subcorpus, CQI_CONST_FIELD_MATCH, 1, 2) : "+Arrays.toString(netClient.dumpSubCorpus(subcorpusid, NetCqiClient.CQI_CONST_FIELD_MATCH, 1, 10)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.dumpSubCorpus(subcorpus, CQI_CONST_FIELD_MATCHEND, 1, 2) : "+Arrays.toString(client.dumpSubCorpus(subcorpusid, NetCqiClient.CQI_CONST_FIELD_MATCHEND, 1, 10)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.dumpSubCorpus(subcorpus, CQI_CONST_FIELD_MATCHEND, 1, 2) : "+Arrays.toString(netClient.dumpSubCorpus(subcorpusid, NetCqiClient.CQI_CONST_FIELD_MATCHEND, 1, 10)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		//		try {
+		//			System.out.println("client.fdist1(arg0, arg1, arg2, arg3) : "+client.fdist1(arg0, arg1, arg2, arg3));
+		//		} catch(Exception e) { System.out.println("Exception : "+e);}
+		//		try {
+		//			System.out.println("netClient.fdist1(arg0, arg1, arg2, arg3) : "+netClient.fdist1(arg0, arg1, arg2, arg3));
+		//		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		//		try {
+		//			System.out.println("//client.fdist2(arg0, arg1, arg2, arg3, arg4, arg5) : "+client.fdist2(arg0, arg1, arg2, arg3, arg4, arg5));
+		//		} catch(Exception e) { System.out.println("Exception : "+e);}
+		//		try {
+		//			System.out.println("//netClient.fdist2(arg0, arg1, arg2, arg3, arg4, arg5) : "+netClient.fdist2(arg0, arg1, arg2, arg3, arg4, arg5));
+		//		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.getLastCqiError() : "+client.getLastCqiError());
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.getLastCqiError() : "+netClient.getLastCqiError());
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.getLastCQPError() : "+client.getLastCQPError());
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.getLastCQPError() : "+netClient.getLastCQPError());
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.id2Cpos(pattribute1, 0) : "+Arrays.toString(client.id2Cpos(pattribute1, 0)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.id2Cpos(pattribute1, 0) : "+Arrays.toString(netClient.id2Cpos(pattribute1, 0)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.id2Cpos(pattribute2, 0) : "+Arrays.toString(client.id2Cpos(pattribute2, 0)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.id2Cpos(pattribute2, 0) : "+Arrays.toString(netClient.id2Cpos(pattribute2, 0)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.id2Cpos(pattribute3, 0) : "+Arrays.toString(client.id2Cpos(pattribute3, 0)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.id2Cpos(pattribute3, 0) : "+Arrays.toString(netClient.id2Cpos(pattribute3, 0)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.id2Cpos(pattribute1, 1) : "+Arrays.toString(client.id2Cpos(pattribute1, 1)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.id2Cpos(pattribute1, 1) : "+Arrays.toString(netClient.id2Cpos(pattribute1, 1)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.id2Cpos(pattribute2, 1) : "+Arrays.toString(client.id2Cpos(pattribute2, 1)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.id2Cpos(pattribute2, 1) : "+Arrays.toString(netClient.id2Cpos(pattribute2, 1)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.id2Cpos(pattribute3, 1) : "+Arrays.toString(client.id2Cpos(pattribute3, 1)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.id2Cpos(pattribute3, 1) : "+Arrays.toString(netClient.id2Cpos(pattribute3, 1)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.id2Cpos(pattribute1, 2) : "+Arrays.toString(client.id2Cpos(pattribute1, 2)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.id2Cpos(pattribute1, 2) : "+Arrays.toString(netClient.id2Cpos(pattribute1, 2)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.id2Cpos(pattribute2, 2) : "+Arrays.toString(client.id2Cpos(pattribute2, 2)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.id2Cpos(pattribute2, 2) : "+Arrays.toString(netClient.id2Cpos(pattribute2, 2)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.id2Cpos(pattribute3, 2) : "+Arrays.toString(client.id2Cpos(pattribute3, 2)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.id2Cpos(pattribute3, 2) : "+Arrays.toString(netClient.id2Cpos(pattribute3, 2)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.id2Freq(pattribute1, ids) : "+Arrays.toString(client.id2Freq(pattribute1, ids)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.id2Freq(pattribute1, ids) : "+Arrays.toString(netClient.id2Freq(pattribute1, ids)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.id2Freq(pattribute2, ids) : "+Arrays.toString(client.id2Freq(pattribute2, ids)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.id2Freq(pattribute2, ids) : "+Arrays.toString(netClient.id2Freq(pattribute2, ids)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.id2Freq(pattribute3, ids) : "+Arrays.toString(client.id2Freq(pattribute3, ids)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.id2Freq(pattribute3, ids) : "+Arrays.toString(netClient.id2Freq(pattribute3, ids)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.id2Str(pattribute1, ids) : "+Arrays.toString(client.id2Str(pattribute1, ids)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.id2Str(pattribute1, ids) : "+Arrays.toString(netClient.id2Str(pattribute1, ids)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.id2Str(pattribute2, ids) : "+Arrays.toString(client.id2Str(pattribute2, ids)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.id2Str(pattribute2, ids) : "+Arrays.toString(netClient.id2Str(pattribute2, ids)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.id2Str(pattribute3, ids) : "+Arrays.toString(client.id2Str(pattribute3, ids)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.id2Str(pattribute3, ids) : "+Arrays.toString(netClient.id2Str(pattribute3, ids)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.idList2Cpos(pattribute1, ids) : "+Arrays.toString(client.idList2Cpos(pattribute1, ids)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.idList2Cpos(pattribute1, ids) : "+Arrays.toString(netClient.idList2Cpos(pattribute1, ids)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.idList2Cpos(pattribute2, ids) : "+Arrays.toString(client.idList2Cpos(pattribute2, ids)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.idList2Cpos(pattribute2, ids) : "+Arrays.toString(netClient.idList2Cpos(pattribute2, ids)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.idList2Cpos(pattribute3, ids) : "+Arrays.toString(client.idList2Cpos(pattribute3, ids)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.idList2Cpos(pattribute3, ids) : "+Arrays.toString(netClient.idList2Cpos(pattribute3, ids)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.lexiconSize(pattribute1) : "+client.lexiconSize(pattribute1));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.lexiconSize(pattribute1) : "+netClient.lexiconSize(pattribute1));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.lexiconSize(pattribute2) : "+client.lexiconSize(pattribute2));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.lexiconSize(pattribute2) : "+netClient.lexiconSize(pattribute2));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.lexiconSize(pattribute3) : "+client.lexiconSize(pattribute3));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.lexiconSize(pattribute3) : "+netClient.lexiconSize(pattribute3));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.listCorpora() : "+Arrays.toString(client.listCorpora()));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.listCorpora() : "+Arrays.toString(netClient.listCorpora()));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.listSubcorpora(corpus) : "+Arrays.toString(client.listSubcorpora(corpus)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.listSubcorpora(corpus) : "+Arrays.toString(netClient.listSubcorpora(corpus)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.regex2Id(pattribute1, regex) : "+Arrays.toString(client.regex2Id(pattribute1, regex)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.regex2Id(pattribute1, regex) : "+Arrays.toString(netClient.regex2Id(pattribute1, regex)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.regex2Id(pattribute2, regex) : "+Arrays.toString(client.regex2Id(pattribute2, regex)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.regex2Id(pattribute2, regex) : "+Arrays.toString(netClient.regex2Id(pattribute2, regex)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.regex2Id(pattribute3, regex) : "+Arrays.toString(client.regex2Id(pattribute3, regex)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.regex2Id(pattribute3, regex) : "+Arrays.toString(netClient.regex2Id(pattribute3, regex)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.str2Id(pattribute1, strings) : "+Arrays.toString(client.str2Id(pattribute1, strings)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.str2Id(pattribute1, strings) : "+Arrays.toString(netClient.str2Id(pattribute1, strings)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.str2Id(pattribute2, strings) : "+Arrays.toString(client.str2Id(pattribute2, strings)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.str2Id(pattribute2, strings) : "+Arrays.toString(netClient.str2Id(pattribute2, strings)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.str2Id(pattribute3, strings) : "+Arrays.toString(client.str2Id(pattribute3, strings)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.str2Id(pattribute3, strings) : "+Arrays.toString(netClient.str2Id(pattribute3, strings)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.struc2Cpos(sattribute1, 0) : "+Arrays.toString(client.struc2Cpos(sattribute1, 0)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.struc2Cpos(sattribute1, 0) : "+Arrays.toString(netClient.struc2Cpos(sattribute1, 0)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.struc2Cpos(sattribute2, 0) : "+Arrays.toString(client.struc2Cpos(sattribute2, 0)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.struc2Cpos(sattribute2, 0) : "+Arrays.toString(netClient.struc2Cpos(sattribute2, 0)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.struc2Cpos(sattribute3, 0) : "+Arrays.toString(client.struc2Cpos(sattribute3, 0)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.struc2Cpos(sattribute3, 0) : "+Arrays.toString(netClient.struc2Cpos(sattribute3, 0)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.struc2Cpos(sattribute1, 1) : "+Arrays.toString(client.struc2Cpos(sattribute1, 1)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.struc2Cpos(sattribute1, 1) : "+Arrays.toString(netClient.struc2Cpos(sattribute1, 1)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.struc2Cpos(sattribute2, 1) : "+Arrays.toString(client.struc2Cpos(sattribute2, 1)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.struc2Cpos(sattribute2, 1) : "+Arrays.toString(netClient.struc2Cpos(sattribute2, 1)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.struc2Cpos(sattribute3, 1) : "+Arrays.toString(client.struc2Cpos(sattribute3, 1)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.struc2Cpos(sattribute3, 1) : "+Arrays.toString(netClient.struc2Cpos(sattribute3, 1)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.struc2Cpos(sattribute1, 2) : "+Arrays.toString(client.struc2Cpos(sattribute1, 2)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.struc2Cpos(sattribute1, 2) : "+Arrays.toString(netClient.struc2Cpos(sattribute1, 2)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.struc2Cpos(sattribute2, 2) : "+Arrays.toString(client.struc2Cpos(sattribute2, 2)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.struc2Cpos(sattribute2, 2) : "+Arrays.toString(netClient.struc2Cpos(sattribute2, 2)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.struc2Cpos(sattribute3, 2) : "+Arrays.toString(client.struc2Cpos(sattribute3, 2)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.struc2Cpos(sattribute3, 2) : "+Arrays.toString(netClient.struc2Cpos(sattribute3, 2)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.struc2Cpos(sattribute1, 3) : "+Arrays.toString(client.struc2Cpos(sattribute1, 3)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.struc2Cpos(sattribute1, 3) : "+Arrays.toString(netClient.struc2Cpos(sattribute1, 3)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.struc2Cpos(sattribute2, 3) : "+Arrays.toString(client.struc2Cpos(sattribute2, 3)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.struc2Cpos(sattribute2, 3) : "+Arrays.toString(netClient.struc2Cpos(sattribute2, 3)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.struc2Cpos(sattribute3, 3) : "+Arrays.toString(client.struc2Cpos(sattribute3, 3)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.struc2Cpos(sattribute3, 3) : "+Arrays.toString(netClient.struc2Cpos(sattribute3, 3)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.struc2Str(sattribute1, strucpos) : "+Arrays.toString(client.struc2Str(sattribute1, strucpos)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.struc2Str(sattribute1, strucpos) : "+Arrays.toString(netClient.struc2Str(sattribute1, strucpos)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.struc2Str(sattribute2, strucpos) : "+Arrays.toString(client.struc2Str(sattribute2, strucpos)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.struc2Str(sattribute2, strucpos) : "+Arrays.toString(netClient.struc2Str(sattribute2, strucpos)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.struc2Str(sattribute3, strucpos) : "+Arrays.toString(client.struc2Str(sattribute3, strucpos)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.struc2Str(sattribute3, strucpos) : "+Arrays.toString(netClient.struc2Str(sattribute3, strucpos)));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.subCorpusHasField(subcorpus, (byte)0) : "+client.subCorpusHasField(subcorpusid, (byte)0));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.subCorpusHasField(subcorpus, (byte)0) : "+netClient.subCorpusHasField(subcorpusid, (byte)0));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.subCorpusSize(subcorpus) : "+client.subCorpusSize(subcorpusid));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.subCorpusSize(subcorpus) : "+netClient.subCorpusSize(subcorpusid));
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		try {
+			System.out.println("client.dropSubCorpus(subcorpus)"); client.dropSubCorpus(subcorpusid);
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+		try {
+			System.out.println("netClient.dropSubCorpus(subcorpus)"); netClient.dropSubCorpus(subcorpusid);
+		} catch(Exception e) { System.out.println("Exception : "+e);}
+
+		System.out.println("TIME: "+ExecTimer.stop());
+		System.out.println("STOP MEM CLIENT "+client.disconnect());
+		System.out.println("STOP MEM SERVER "+server.stop());
+		System.out.println("STOP NET CLIENT "+netClient.disconnect());
+		System.out.println("STOP NET SERVER "+netServer.stop());
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/MemCqiServer.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/NetCqiClient.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/cqp/NetCqiClient.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/cqp/NetCqiClient.java	(revision 258)
@@ -0,0 +1,1956 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2015-05-13 09:46:56 +0200 (Wed, 13 May 2015) $
+// $LastChangedRevision: 2967 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp;
+
+import java.io.ByteArrayOutputStream;
+import java.io.DataInput;
+import java.io.DataInputStream;
+import java.io.DataOutput;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.InetSocketAddress;
+import java.net.Socket;
+import java.net.SocketAddress;
+import java.util.Arrays;
+import java.util.HashMap;
+
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.clientExceptions.ServerNotFoundException;
+import org.txm.searchengine.cqp.clientExceptions.UnexpectedAnswerException;
+import org.txm.searchengine.cqp.serverException.CqiClErrorCorpusAccess;
+import org.txm.searchengine.cqp.serverException.CqiClErrorInternal;
+import org.txm.searchengine.cqp.serverException.CqiClErrorNoSuchAttribute;
+import org.txm.searchengine.cqp.serverException.CqiClErrorOutOfMemory;
+import org.txm.searchengine.cqp.serverException.CqiClErrorOutOfRange;
+import org.txm.searchengine.cqp.serverException.CqiClErrorRegex;
+import org.txm.searchengine.cqp.serverException.CqiClErrorWrongAttributeType;
+import org.txm.searchengine.cqp.serverException.CqiCqpErrorErrorGeneral;
+import org.txm.searchengine.cqp.serverException.CqiCqpErrorInvalidField;
+import org.txm.searchengine.cqp.serverException.CqiCqpErrorNoSuchCorpus;
+import org.txm.searchengine.cqp.serverException.CqiCqpErrorOutOfRange;
+import org.txm.searchengine.cqp.serverException.CqiCqpErrorSyntax;
+import org.txm.searchengine.cqp.serverException.CqiErrorConnectRefused;
+import org.txm.searchengine.cqp.serverException.CqiErrorGeneralError;
+import org.txm.searchengine.cqp.serverException.CqiErrorSyntaxError;
+import org.txm.searchengine.cqp.serverException.CqiErrorUserAbort;
+import org.txm.searchengine.cqp.serverException.CqiServerError;
+import org.txm.utils.ExecTimer;
+import org.txm.utils.logger.Log;
+
+// TODO: Auto-generated Javadoc
+/**
+ * This class implements a Java CQi client.
+ *
+ * @author Jean-Philippe Magué
+ */
+public class NetCqiClient extends AbstractCqiClient {
+
+	/** The socket. */
+	private Socket socket;
+
+	/** The server address. */
+	private SocketAddress serverAddress;
+
+	/** The stream to write data on the socket. */
+	private DataOutput streamToServer;
+
+	/** The stream to read data from the socket. */
+	private DataInput streamFromServer;
+
+	/** The host. */
+	private String host;
+
+	/** The port. */
+	private int port;
+
+	private String username;
+
+	private String password;
+	
+	//key 1 : property name
+	private HashMap<String,CqpDataProxy> corporacache = new HashMap<String, CqpDataProxy>();
+
+	/**
+	 * Write a string on the socket.
+	 * 
+	 * @param string
+	 *            the string
+	 * 
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 */
+	private synchronized void writeString(String string) throws IOException {
+		byte[] bytes = string.getBytes("UTF-8"); //$NON-NLS-1$
+		this.streamToServer.writeShort(bytes.length);
+		this.streamToServer.write(bytes);
+
+		// short length = (short) string.length();
+
+		// long start = System.currentTimeMillis();
+		// this.streamToServer.writeShort(length);
+		// this.streamToServer.write(string.getBytes("UTF-8"));
+		// long end = System.currentTimeMillis();
+		// System.out.println("String \"" + string + "\" writen at " +
+		// (string.getBytes("ISO-8859-1").length/(1+end-start)) +"kb/s");
+
+	}
+
+	/**
+	 * Write a string array on the socket.
+	 * 
+	 * @param strings
+	 *            the string array
+	 * 
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 */
+	private synchronized void writeStringArray(String[] strings)
+			throws IOException {
+		int length = strings.length;
+		this.streamToServer.writeInt(length);
+		for (int i = 0; i < length; i++)
+			writeString(strings[i]);
+	}
+
+	/**
+	 * Write int array on the socket.
+	 * 
+	 * @param ints
+	 *            the int array
+	 * 
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 */
+	private synchronized void writeIntArray(int[] ints) throws IOException {
+		int length = ints.length;
+		this.streamToServer.writeInt(length);
+		for (int i = 0; i < length; i++) {
+			// System.out.println(i+"/"+length);
+			this.streamToServer.writeInt(ints[i]);
+		}
+	}
+
+	/**
+	 * Read a string from the socket.
+	 * 
+	 * @return the string
+	 * 
+	 * @throws UnexpectedAnswerException
+	 *             Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError
+	 *             Signals that the cqi server raised an error
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 */
+	private synchronized String readString() throws UnexpectedAnswerException,
+	CqiServerError, IOException {
+		Log.finest(TXMCoreMessages.READING_STRING_FROM_CQI_SERVER);
+		if (readHeaderFromServer() != CQI_DATA_STRING) {
+			throw new UnexpectedAnswerException();
+		}
+		short length = this.streamFromServer.readShort();
+		byte[] bytes = new byte[length];
+		this.streamFromServer.readFully(bytes);
+		String res = new String(bytes, "UTF-8"); //$NON-NLS-1$
+		Log.finest(TXMCoreMessages.bind(TXMCoreMessages.READ_STRING_FROM_CQI_SERVER, res));
+		return res;
+	}
+
+	/**
+	 * Read a boolean from the socket.
+	 * 
+	 * @return the boolean
+	 * 
+	 * @throws UnexpectedAnswerException
+	 *             Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError
+	 *             Signals that the cqi server raised an error
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 */
+	private synchronized boolean readBoolean()
+			throws UnexpectedAnswerException, CqiServerError, IOException {
+		byte b = 0;
+		Log.finest(TXMCoreMessages.READING_BOOLEAN_FROM_CQI_SERVER);
+		if (readHeaderFromServer() != CQI_DATA_BOOL) {
+			throw new UnexpectedAnswerException();
+		}
+		b = this.streamFromServer.readByte();
+		boolean res = (b == 1);
+		Log.finest(TXMCoreMessages.READ_BOOLEAN_FROM_CQI_SERVER);
+		return res;
+	}
+
+	/**
+	 * Read an int from the socket.
+	 * 
+	 * @return the int
+	 * 
+	 * @throws UnexpectedAnswerException
+	 *             Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError
+	 *             Signals that the cqi server raised an error
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 */
+	private synchronized int readInt() throws UnexpectedAnswerException,
+	CqiServerError, IOException {
+		Log.finest(TXMCoreMessages.READING_INTEGER_FROM_CQI_SERVER);
+		if (readHeaderFromServer() != CQI_DATA_INT) {
+			throw new UnexpectedAnswerException();
+		}
+		int res = this.streamFromServer.readInt();
+		Log.finest(TXMCoreMessages.READ_INTEGER_FROM_CQI_SERVER + res);
+		return res;
+	}
+
+	/**
+	 * Read a string array from the socket.
+	 * 
+	 * @return the string array
+	 * 
+	 * @throws UnexpectedAnswerException
+	 *             Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError
+	 *             Signals that the cqi server raised an error
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 */
+	private synchronized String[] readStringArray()
+			throws UnexpectedAnswerException, CqiServerError, IOException {
+		Log.finest(TXMCoreMessages.READING_STRING_ARRAY_FROM_CQI_SERVER);
+		byte[] header = readHeaderFromServer();
+		if (header != CQI_DATA_STRING_LIST) {
+			throw new UnexpectedAnswerException();
+		}
+		// long start = System.currentTimeMillis();
+		int arrayLength = this.streamFromServer.readInt();
+		int nByteRead = 4;
+		String[] strings = new String[arrayLength];
+		/*
+		 * System.out.println("Available: "+this.socket.getInputStream().available
+		 * ()); byte[] allb = readInByte(this.socket.getInputStream());
+		 * 
+		 * System.out.println("count = "+allb.length);
+		 * System.out.println("array length = "+arrayLength);
+		 * 
+		 * int readindex = 0; for(int i=0; i<arrayLength; i++){ short
+		 * stringLength = bytesToShort(allb[readindex],allb[readindex+1]);
+		 * readindex += 2;
+		 * 
+		 * byte[] strbytes = new byte[stringLength]; System.arraycopy(allb,
+		 * readindex, strbytes, 0, stringLength); strings[i] = new
+		 * String(strbytes,"UTF-8");
+		 * //System.out.println(""+i+" Str len "+stringLength
+		 * +" >> "+strings[i]); readindex += stringLength; }
+		 */
+		for (int i = 0; i < arrayLength; i++) {
+			short stringLength = this.streamFromServer.readShort();
+			nByteRead += 2;
+			byte[] bytes = new byte[stringLength];
+			// long start2 = System.currentTimeMillis();
+			this.streamFromServer.readFully(bytes);
+			// long end2 = System.currentTimeMillis();
+			// System.out.println("Reading at " +
+			// (stringLength/(1+end2-start2))+ "kb/s");
+			nByteRead += stringLength;
+			strings[i] = new String(bytes, "UTF-8");//, "ISO-8859-1"); //$NON-NLS-1$
+		}
+		// System.out.println("read : "+nByteRead);
+		// long end = System.currentTimeMillis();
+		// System.out.println(nByteRead + " bytes read in " +(end-start)+ "ms ("
+		// + (nByteRead/(1+end-start)) + "kb/s)");
+		Log.finest(TXMCoreMessages.READ_STRING_ARRAY_FROM_CQI_SERVER
+				+ Arrays.asList(strings));
+		return strings;
+	}
+
+	/**
+	 * Read in byte.
+	 *
+	 * @param in the in
+	 * @return the byte[]
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 */
+	private synchronized byte[] readInByte(InputStream in) throws IOException {
+		int count;
+		byte[] buffer = new byte[8192];
+		ByteArrayOutputStream out = new ByteArrayOutputStream();
+		while ((count = in.read(buffer)) > 0) {
+			out.write(buffer, 0, count);
+		}
+		out.close();
+		return out.toByteArray();
+	}
+
+	/**
+	 * Byte array to string.
+	 *
+	 * @param b the b
+	 * @return the string
+	 */
+	private synchronized String byteArrayToString(byte[] b) {
+		StringBuffer res = new StringBuffer("["); //$NON-NLS-1$
+		if (b.length > 0) {
+			res.append(b[0]);
+			for (int i = 1; i < b.length; i++)
+				res.append("; " + b[i]); //$NON-NLS-1$
+		}
+		res.append("]"); //$NON-NLS-1$
+		return res.toString();
+	}
+
+	/**
+	 * Read an int array from the socket.
+	 * 
+	 * @return the int array
+	 * 
+	 * @throws UnexpectedAnswerException
+	 *             Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError
+	 *             Signals that the cqi server raised an error
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 */
+	private synchronized int[] readIntList() throws UnexpectedAnswerException,
+	CqiServerError, IOException {
+		Log.finest(TXMCoreMessages.READING_INT_ARRAY_FROM_CQI_SERVER);
+		if ((readHeaderFromServer()) != CQI_DATA_INT_LIST) {
+			throw new UnexpectedAnswerException();
+		}
+		int arrayLength = this.streamFromServer.readInt();
+		int bsize = arrayLength * 4;
+
+		int[] ints = new int[arrayLength];
+		byte[] b = new byte[bsize];// int size
+
+		// System.out.println("bsize : "+bsize);
+		streamFromServer.readFully(b);
+		// System.out.println("read "+ ((DataInputStream)
+		// streamFromServer).readFully(b));
+		int nbline = 0;
+		for (int i = 0; i + 3 < bsize; i += 4) {
+			ints[nbline++] = bytesToInt(b[i], b[i + 1], b[i + 2], b[i + 3]);
+		}
+		/*
+		 * for(int i=0; i<arrayLength; i++){ ints[i] =
+		 * this.streamFromServer.readInt(); }
+		 */
+		// Log.finest(Messages.READ_INT_ARRAY_FROM_CQI_SERVER+Arrays.asList(ints));
+		return ints;
+	}
+
+	/**
+	 * Bytes to int.
+	 *
+	 * @param bytes the bytes
+	 * @return the int
+	 */
+	protected synchronized static int bytesToInt(byte[] bytes) {
+		int value = 0;
+
+		for (int i = 0; i < bytes.length; i++) {
+			value = value << 8;
+			value += bytes[i] & 0xff;
+		}
+
+		return value;
+	}
+
+	/**
+	 * Bytes to int.
+	 *
+	 * @param a the a
+	 * @param b the b
+	 * @param c the c
+	 * @param d the d
+	 * @return the int
+	 */
+	protected synchronized static int bytesToInt(byte a, byte b, byte c, byte d) {
+		return (((a & 0xff) << 24) | ((b & 0xff) << 16) | ((c & 0xff) << 8) | (d & 0xff));
+	}
+
+	/**
+	 * Bytes to short.
+	 *
+	 * @param hi the hi
+	 * @param lo the lo
+	 * @return the short
+	 */
+	protected synchronized static short bytesToShort(byte hi, byte lo) {
+		return (short) (((hi & 0xFF) << 8) | (lo & 0xFF));
+	}
+
+	/**
+	 * Read an int array from the socket.
+	 * 
+	 * @return the int array
+	 * 
+	 * @throws UnexpectedAnswerException
+	 *             Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError
+	 *             Signals that the cqi server raised an error
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 */
+	private synchronized int[][] readIntTable()
+			throws UnexpectedAnswerException, CqiServerError, IOException {
+		Log.finest(TXMCoreMessages.READING_2D_INT_ARRAY_FROM_CQI_SERVER);
+		if ((readHeaderFromServer()) != CQI_DATA_INT_TABLE) {
+			throw new UnexpectedAnswerException();
+		}
+		int nRow = this.streamFromServer.readInt();
+		int nCol = this.streamFromServer.readInt();
+		int[][] ints = new int[nRow][nCol];
+		for (int i = 0; i < nRow; i++)
+			for (int j = 0; j < nCol; j++)
+				ints[i][j] = this.streamFromServer.readInt();
+		Log.finest(TXMCoreMessages.READ_2D_INT_ARRAY_FROM_CQI_SERVER
+				+ Arrays.asList(ints));
+		return ints;
+	}
+
+	/**
+	 * Read two successive ints from the socket.
+	 *
+	 * @return an array of size 2 containing the int
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	private synchronized int[] readIntInt() throws IOException,
+	UnexpectedAnswerException, CqiServerError {
+		Log.finest(TXMCoreMessages.READING_INT_ARRAY_FROM_CQI_SERVER);
+		if (readHeaderFromServer() != CQI_DATA_INT_INT) {
+			throw new UnexpectedAnswerException();
+		}
+		int[] res = new int[2];
+		res[0] = this.streamFromServer.readInt();
+		res[1] = this.streamFromServer.readInt();
+		Log.finest(TXMCoreMessages.READ_INT_ARRAY_FROM_CQI_SERVER
+				+ Arrays.asList(res));
+		return res;
+	}
+
+	/**
+	 * Read four successive ints from the socket.
+	 *
+	 * @return an array of size 4 containing the int
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	private synchronized int[] readIntIntIntInt() throws IOException,
+	UnexpectedAnswerException, CqiServerError {
+		Log.finest(TXMCoreMessages.READING_INT_ARRAY_FROM_CQI_SERVER);
+		if (readHeaderFromServer() != CQI_DATA_INT_INT_INT_INT) {
+			throw new UnexpectedAnswerException();
+		}
+		int[] res = new int[4];
+		res[0] = this.streamFromServer.readInt();
+		res[1] = this.streamFromServer.readInt();
+		res[2] = this.streamFromServer.readInt();
+		res[3] = this.streamFromServer.readInt();
+		Log.finest(TXMCoreMessages.READ_INT_ARRAY_FROM_CQI_SERVER
+				+ Arrays.asList(res));
+		return res;
+	}
+
+	/**
+	 * Read the header of the data send by the server.
+	 * 
+	 * @return the header
+	 * 
+	 * @throws UnexpectedAnswerException
+	 *             Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError
+	 *             Signals that the cqi server raised an error
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 */
+	private synchronized byte[] readHeaderFromServer()
+			throws UnexpectedAnswerException, CqiServerError, IOException {
+		Log.finest(TXMCoreMessages.READING_HEADER_FROM_CQI_SERVER);
+		byte b = this.streamFromServer.readByte();
+		Log.finest(TXMCoreMessages.bind(TXMCoreMessages.READ_BYTE_FROM_CQI_SERVER, b));
+		switch (b) {
+		case 0x00:// cf cqi.h:29
+			return CQI_PADDING;
+		case 0x01:// cf cqi.h:37
+			b = this.streamFromServer.readByte();
+			Log.finest(TXMCoreMessages.bind(TXMCoreMessages.READ_BYTE_FROM_CQI_SERVER, b));
+			switch (b) {
+			case 0x01:// cf cqi.h:39
+				return CQI_STATUS_OK;
+			case 0x02:// cf cqi.h:40
+				return CQI_STATUS_CONNECT_OK;
+			case 0x03:// cf cqi.h:41
+				return CQI_STATUS_BYE_OK;
+			case 0x04:// cf cqi.h:42
+				return CQI_STATUS_PING_OK;
+			}
+		case 0x02:// cf cqi.h:45
+			b = this.streamFromServer.readByte();
+			Log.finest(TXMCoreMessages.bind(TXMCoreMessages.READ_BYTE_FROM_CQI_SERVER, b));
+			lastError = TXMCoreMessages.MemCqiClient_0+b;
+			switch (b) {
+			case 0x01:// cf cqi.h:39
+				throw new CqiErrorGeneralError();
+			case 0x02:// cf cqi.h:40
+				throw new CqiErrorConnectRefused();
+			case 0x03:// cf cqi.h:41
+				throw new CqiErrorUserAbort();
+			case 0x04:// cf cqi.h:42
+				throw new CqiErrorSyntaxError();
+			}
+		case 0x03:// cf cqi.h:53
+			b = this.streamFromServer.readByte();
+			Log.finest(TXMCoreMessages.bind(TXMCoreMessages.READ_BYTE_FROM_CQI_SERVER, b));
+			switch (b) {
+			case 0x01:// cf cqi.h:39
+				return CQI_DATA_BYTE;
+			case 0x02:// cf cqi.h:40
+				return CQI_DATA_BOOL;
+			case 0x03:// cf cqi.h:41
+				return CQI_DATA_INT;
+			case 0x04:// cf cqi.h:42
+				return CQI_DATA_STRING;
+			case 0x05:// cf cqi.h:42
+				return CQI_DATA_BYTE_LIST;
+			case 0x06:// cf cqi.h:42
+				return CQI_DATA_BOOL_LIST;
+			case 0x07:// cf cqi.h:42
+				return CQI_DATA_INT_LIST;
+			case 0x08:// cf cqi.h:42
+				return CQI_DATA_STRING_LIST;
+			case 0x09:// cf cqi.h:42
+				return CQI_DATA_INT_INT;
+			case 0x0A:// cf cqi.h:42
+				return CQI_DATA_INT_INT_INT_INT;
+			case 0x0B:// cf cqi.h:42
+				return CQI_DATA_INT_TABLE;
+			}
+		case 0x04:// cf cqi.h:67
+
+			b = this.streamFromServer.readByte();
+			lastError = TXMCoreMessages.MemCqiClient_1+b;
+			Log.finest(TXMCoreMessages.bind(TXMCoreMessages.READ_BYTE_FROM_CQI_SERVER, b));
+			switch (b) {
+			case 0x01:// cf cqi.h:39
+				throw new CqiClErrorNoSuchAttribute();
+			case 0x02:// cf cqi.h:40
+				throw new CqiClErrorWrongAttributeType();
+			case 0x03:// cf cqi.h:41
+				throw new CqiClErrorOutOfRange();
+			case 0x04:// cf cqi.h:42
+				lastError = getLastCqiError();
+				throw new CqiClErrorRegex();
+			case 0x05:// cf cqi.h:42
+				throw new CqiClErrorCorpusAccess();
+			case 0x06:// cf cqi.h:42
+				throw new CqiClErrorOutOfMemory();
+			case 0x07:// cf cqi.h:42
+				throw new CqiClErrorInternal();
+			}
+		case 0x05:// cf cqi.h:94
+
+			b = this.streamFromServer.readByte();
+			lastError = TXMCoreMessages.MemCqiClient_2+b;
+			Log.finest(TXMCoreMessages.bind(TXMCoreMessages.READ_BYTE_FROM_CQI_SERVER, b));
+			switch (b) {
+			case 0x01:// cf cqi.h:39
+				throw new CqiCqpErrorErrorGeneral();
+			case 0x02:// cf cqi.h:40
+				throw new CqiCqpErrorNoSuchCorpus();
+			case 0x03:// cf cqi.h:41
+				throw new CqiCqpErrorInvalidField();
+			case 0x04:// cf cqi.h:42
+				throw new CqiCqpErrorOutOfRange();
+			case 0x05:// cf cqi.h:44
+				lastError = getLastCQPError();
+				throw new CqiCqpErrorSyntax();
+			}
+		}
+		return null;
+	}
+
+	/**
+	 * Ask the server to execute a function with a String->String signature.
+	 *
+	 * @param string the argument
+	 * @param function the function to be executed
+	 * @return the result
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	private synchronized String genericStringToString(String string,
+			byte[] function) throws UnexpectedAnswerException, IOException,
+			CqiServerError {
+		this.streamToServer.write(function);
+		this.writeString(string);
+		return readString();
+	}
+
+	/**
+	 * Ask the server to execute a function with a String->StringArray signature.
+	 *
+	 * @param string the argument
+	 * @param function the function to be executed
+	 * @return the result
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	private synchronized String[] genericStringToStringArray(String string,
+			byte[] function) throws UnexpectedAnswerException, IOException,
+			CqiServerError {
+		this.streamToServer.write(function);
+		this.writeString(string);
+		return readStringArray();
+	}
+
+	/**
+	 * Ask the server to execute a function with a String x int[]->String[]
+	 * signature.
+	 *
+	 * @param string the string argument
+	 * @param ints the int[] argument
+	 * @param function the function to be executed
+	 * @return the result
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	private synchronized String[] genericStringXIntArraytoStringArray(
+			String string, int[] ints, byte[] function) throws IOException,
+			UnexpectedAnswerException, CqiServerError {
+		// long start = System.currentTimeMillis();
+		this.streamToServer.write(function);
+		// System.out.println(System.currentTimeMillis()-start);
+		this.writeString(string);
+		// System.out.println(System.currentTimeMillis()-start);
+		this.writeIntArray(ints);
+		// System.out.println(System.currentTimeMillis()-start);
+		String[] res = readStringArray();
+		// System.out.println(System.currentTimeMillis()-start);
+		return res;
+	}
+
+	/**
+	 * Ask the server to execute a function with a String x int[]->int[]
+	 * signature.
+	 *
+	 * @param string the string argument
+	 * @param ints the int[] argument
+	 * @param function the function to be executed
+	 * @return the result
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 */
+	private synchronized int[] genericStringXIntArraytoIntArray(String string,
+			int[] ints, byte[] function) throws UnexpectedAnswerException,
+			CqiServerError, IOException {
+		this.streamToServer.write(function);
+		this.writeString(string);
+		this.writeIntArray(ints);
+		return readIntList();
+	}
+
+	/**
+	 * Instantiates a new cqi client.
+	 * 
+	 * @param host
+	 *            the host of the CQI server
+	 * @param port
+	 *            the port of the CQI server
+	 * 
+	 * @throws ServerNotFoundException
+	 *             the server not found exception
+	 */
+	public NetCqiClient(String host, int port) throws ServerNotFoundException {
+		try {
+			Thread.sleep(500);
+		} catch (InterruptedException ix) {
+		}
+
+		int attempts = 10;
+		while (attempts > 0) {
+			try {
+				this.host = host;
+				this.port = port;
+				this.socket = new Socket();
+				this.serverAddress = new InetSocketAddress(host, port);
+				this.socket.connect(serverAddress);
+				this.streamToServer = new DataOutputStream(this.socket
+						.getOutputStream());
+				this.streamFromServer = new DataInputStream(this.socket
+						.getInputStream());
+				System.out.print(TXMCoreMessages.CqiClient_32);
+				return;
+			} catch (IOException e) {
+				System.err.print("."); //$NON-NLS-1$
+				try {
+					Thread.sleep(2000);
+				} catch (InterruptedException ix) {
+				}
+			}
+
+			attempts--;
+		}
+		throw new ServerNotFoundException(TXMCoreMessages.CqiClient_33);
+	}
+
+	// CQI_ERROR_CONNECT_REFUSED
+	/**
+	 * Connect the client to a server.
+	 *
+	 * @param username the username
+	 * @param password the password
+	 * @return true, if successful
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	@Override
+	public synchronized boolean connect(String username, String password)
+			throws UnexpectedAnswerException, IOException, CqiServerError {
+		this.username = username;
+		this.password = password;
+		Log.finest(TXMCoreMessages.CONNECTING_CQI_CLIENT + username
+				+ ":" + password + "@" + host + ":" + port); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+		this.streamToServer.write(CQI_CTRL_CONNECT);
+		this.writeString(username);
+		this.writeString(password);
+		try {
+			readHeaderFromServer();
+			Log.finest(TXMCoreMessages.CQI_CLIENT_CONNECTED);
+			return true;
+		} catch (CqiErrorConnectRefused e) {
+			return false;
+		} catch (CqiServerError e) {
+			return false;
+		}
+	}
+
+	// None
+	/**
+	 * Disconnect.
+	 * 
+	 * @return true, if successful
+	 * 
+	 * @throws UnexpectedAnswerException
+	 *             Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError
+	 *             Signals that the cqi server raised an error
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 */
+	@Override
+	public synchronized boolean disconnect() throws UnexpectedAnswerException,
+	CqiServerError, IOException {
+		this.streamToServer.write(CQI_CTRL_BYE);
+		return (readHeaderFromServer() == CQI_STATUS_BYE_OK);
+	}
+
+	String lastError;
+	@Override
+	public synchronized String getLastError(){	
+		if(lastError != null && lastError.length() > 0)
+			return lastError;
+		return TXMCoreMessages.AbstractCqiClient_2;
+	}
+
+	// CQI_CTRL_LAST_GENERAL_ERROR
+	/**
+	 * return the last CQP error.
+	 *
+	 * @return the last error
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	@Override
+	public synchronized String getLastCqiError() throws UnexpectedAnswerException, IOException,
+	CqiServerError {
+		Log.severe(TXMCoreMessages.CqiClient_0);
+		this.streamToServer.write(CQI_CTRL_LAST_GENERAL_ERROR);
+
+		try {
+			String ret = readString();
+			return getLastCQPError()+"\t"+ret; //$NON-NLS-1$
+		} catch (CqiServerError e) {
+			System.out.println(TXMCoreMessages.NetCqiClient_1+e);
+			return "error"; //$NON-NLS-1$
+		}
+	}
+
+	// CQI_CTRL_LAST_CQP_ERROR
+	/**
+	 * return the last CQP error.
+	 *
+	 * @return the last error
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	@Override
+	public synchronized String getLastCQPError() {
+		try {
+			this.streamToServer.write(CQI_CTRL_LAST_CQP_ERROR);
+			String ret = readString();
+			return ret;
+		} catch (Exception e) {
+			System.out.println(TXMCoreMessages.NetCqiClient_3+e);
+			return "error"; //$NON-NLS-1$
+		}
+	}
+
+	// None
+	/**
+	 * Lists the corpora available on the server.
+	 *
+	 * @return the name of the corpora
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	@Override
+	public synchronized String[] listCorpora()
+			throws UnexpectedAnswerException, IOException, CqiServerError {
+		this.streamToServer.write(CQI_CORPUS_LIST_CORPORA);
+		return readStringArray();
+	}
+
+	// None
+	/**
+	 * Gives the corpus charset.
+	 *
+	 * @param corpus the corpus
+	 * @return the name of the charset
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	@Override
+	public synchronized String corpusCharset(String corpus)
+			throws UnexpectedAnswerException, IOException, CqiServerError {
+		return genericStringToString(corpus, CQI_CORPUS_CHARSET);
+	}
+
+	// None (not really implemented anyway)
+	/**
+	 * Gives the corpus properties.
+	 *
+	 * @param corpus the corpus
+	 * @return the properties
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	@Override
+	public synchronized String[] corpusProperties(String corpus)
+			throws UnexpectedAnswerException, IOException, CqiServerError {
+		return genericStringToStringArray(corpus, CQI_CORPUS_PROPERTIES);
+	}
+
+	// CQI_CQP_ERROR_NO_SUCH_CORPUS
+	/**
+	 * Gives the corpus positional attributes.
+	 *
+	 * @param corpusID the corpus id
+	 * @return the name of the attributes
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	@Override
+	public synchronized String[] corpusPositionalAttributes(String corpusID)
+			throws UnexpectedAnswerException, IOException, CqiServerError {
+		return genericStringToStringArray(corpusID,
+				CQI_CORPUS_POSITIONAL_ATTRIBUTES);
+	}
+
+	// CQI_CQP_ERROR_NO_SUCH_CORPUS
+	/**
+	 * Gives the corpus structural attributes.
+	 *
+	 * @param corpus the corpus
+	 * @return the name of the attributes
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	@Override
+	public synchronized String[] corpusStructuralAttributes(String corpus)
+			throws UnexpectedAnswerException, IOException, CqiServerError {
+		return genericStringToStringArray(corpus,
+				CQI_CORPUS_STRUCTURAL_ATTRIBUTES);
+	}
+
+	// CQI_CQP_ERROR_NO_SUCH_CORPUS, CQI_CL_ERROR_NO_SUCH_ATTRIBUTE,
+	// CQI_CL_ERROR_WRONG_ATTRIBUTE_TYPE
+	/**
+	 * Check wether a structural attribute has values.
+	 *
+	 * @param attribute the attribute
+	 * @return true, if it has values
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	@Override
+	public synchronized boolean corpusStructuralAttributeHasValues(
+			String attribute) throws UnexpectedAnswerException, IOException,
+			CqiServerError {
+		this.streamToServer.write(CQI_CORPUS_STRUCTURAL_ATTRIBUTE_HAS_VALUES);
+		this.writeString(attribute);
+		return readBoolean();
+	}
+
+	// CQI_CQP_ERROR_NO_SUCH_CORPUS
+	/**
+	 * Gives the corpus alignement attributes.
+	 *
+	 * @param corpus the corpus
+	 * @return the name of attributes
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	@Override
+	public synchronized String[] corpusAlignementAttributes(String corpus)
+			throws UnexpectedAnswerException, IOException, CqiServerError {
+		return genericStringToStringArray(corpus,
+				CQI_CORPUS_ALIGNMENT_ATTRIBUTES);
+	}
+
+	// CQI_CQP_ERROR_NO_SUCH_CORPUS
+	/**
+	 * Gives the corpus full name.
+	 *
+	 * @param corpus the corpus
+	 * @return the full name
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	@Override
+	public synchronized String corpusFullName(String corpus)
+			throws UnexpectedAnswerException, IOException, CqiServerError {
+		return genericStringToString(corpus, CQI_CORPUS_FULL_NAME);
+	}
+
+	/**
+	 * Gives the corpus info listed in the .INFO file.
+	 *
+	 * @param corpus the corpus
+	 * @return the info
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	@Override
+	public synchronized String[] corpusInfo(String corpus)
+			throws UnexpectedAnswerException, IOException, CqiServerError {
+		throw new UnsupportedOperationException();
+	}
+
+	/**
+	 * Drop a corpus.
+	 * 
+	 * @param corpus
+	 *            the corpus
+	 */
+	@Override
+	public synchronized void dropCorpus(String corpus) {
+		throw new UnsupportedOperationException();
+	}
+
+	// CQI_CQP_ERROR_NO_SUCH_CORPUS, CQI_CL_ERROR_NO_SUCH_ATTRIBUTE,
+	// CQI_CL_ERROR_WRONG_ATTRIBUTE_TYPE, CQI_CL_ERROR_CORPUS_ACCESS
+	/**
+	 * Gives an attribute size (the number of token).
+	 *
+	 * @param attribute the attribute
+	 * @return the size
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	@Override
+	public synchronized int attributeSize(String attribute) throws IOException,
+	UnexpectedAnswerException, CqiServerError {
+		this.streamToServer.write(CQI_CL_ATTRIBUTE_SIZE);
+		this.writeString(attribute);
+		return readInt();
+	}
+
+	// CQI_CQP_ERROR_NO_SUCH_CORPUS, CQI_CL_ERROR_NO_SUCH_ATTRIBUTE,
+	// CQI_CL_ERROR_WRONG_ATTRIBUTE_TYPE, CQI_CL_ERROR_CORPUS_ACCESS
+	/**
+	 * Gives the lexicon size of an attribute.
+	 *
+	 * @param attribute the attribute
+	 * @return the int
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 * @returns the number of entries in the lexicon of a positional attribute
+	 */
+	@Override
+	public synchronized int lexiconSize(String attribute) throws IOException,
+	UnexpectedAnswerException, CqiServerError {
+		this.streamToServer.write(CQI_CL_LEXICON_SIZE);
+		this.writeString(attribute);
+		return readInt();
+	}
+
+	/**
+	 * Drop attribute.
+	 *
+	 * @param attribute the attribute
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	@Override
+	public synchronized void dropAttribute(String attribute)
+			throws IOException, UnexpectedAnswerException, CqiServerError {
+		throw new UnsupportedOperationException();
+	}
+
+	/**
+	 * Converts an array of attribute values to their ID.
+	 *
+	 * @param attribute the attribute
+	 * @param strings the values
+	 * @return the IDs
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	@Override
+	public synchronized int[] str2Id(String attribute, String[] strings)
+			throws IOException, UnexpectedAnswerException, CqiServerError {
+		this.streamToServer.write(CQI_CL_STR2ID);
+		this.writeString(attribute);
+		this.writeStringArray(strings);
+		return readIntList();
+	}
+
+	/**
+	 * Converts an array of attribute ID to their values.
+	 *
+	 * @param attribute the positional attribute
+	 * @param ids the ids
+	 * @return the values
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	@Override
+	public synchronized String[] id2Str(String attribute, int[] ids)
+			throws UnexpectedAnswerException, IOException, CqiServerError {
+
+		return genericStringXIntArraytoStringArray(attribute, ids,
+				CQI_CL_ID2STR);
+	}
+
+	/**
+	 * Converts an array of attribute IDs to their frequency.
+	 *
+	 * @param attribute the attribute
+	 * @param ids the ids
+	 * @return the frequencies
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	@Override
+	public synchronized int[] id2Freq(String attribute, int[] ids)
+			throws UnexpectedAnswerException, IOException, CqiServerError {
+		return genericStringXIntArraytoIntArray(attribute, ids, CQI_CL_ID2FREQ);
+	}
+
+	/**
+	 * Converts an array of position to their ID given an attribute.
+	 *
+	 * @param attribute the attribute
+	 * @param cpos the positions
+	 * @return the IDs
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	@Override
+	public synchronized int[] cpos2Id(String attribute, int[] cpos)
+			throws UnexpectedAnswerException, IOException, CqiServerError {
+		return genericStringXIntArraytoIntArray(attribute, cpos, CQI_CL_CPOS2ID);
+	}
+
+	/**
+	 * Converts an array of position to their value given an attribute.
+	 *
+	 * @param attribute the attribute
+	 * @param cpos the cpos
+	 * @return the values
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	@Override
+	public synchronized String[] cpos2Str(String attribute, int[] cpos)
+			throws UnexpectedAnswerException, IOException, CqiServerError {
+		
+		if (corporacache.get(attribute) == null) {
+			corporacache.put(attribute, new CqpDataProxy(this, attribute, true));
+		}
+		
+		try {
+			return corporacache.get(attribute).getData(cpos).toArray(new String[cpos.length]);
+		} catch (CqiClientException e) {
+			throw new CqiServerError(e.getMessage());
+		}
+//		return genericStringXIntArraytoStringArray(attribute, cpos,
+//				CQI_CL_CPOS2STR);
+	}
+	
+	public synchronized String[] _cpos2Str(String attribute, int[] cpos)
+			throws UnexpectedAnswerException, IOException, CqiServerError {
+		return genericStringXIntArraytoStringArray(attribute, cpos,
+				CQI_CL_CPOS2STR);
+	}
+
+	/**
+	 * Computes for each position of an array the Id of the enclosing structural
+	 * attribute.
+	 *
+	 * @param attribute the attribute
+	 * @param cpos the positions
+	 * @return the IDs
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	@Override
+	public synchronized int[] cpos2Struc(String attribute, int[] cpos)
+			throws UnexpectedAnswerException, IOException, CqiServerError {
+		return genericStringXIntArraytoIntArray(attribute, cpos,
+				CQI_CL_CPOS2STRUC);
+	}
+
+	/**
+	 * Computes for each position of an array the position of the left boundary
+	 * of the enclosing structural attribute.
+	 *
+	 * @param attribute the attribute
+	 * @param cpos the cpos
+	 * @return the positions of the left boundaries
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	@Override
+	public synchronized int[] cpos2LBound(String attribute, int[] cpos)
+			throws UnexpectedAnswerException, IOException, CqiServerError {
+		return genericStringXIntArraytoIntArray(attribute, cpos,
+				CQI_CL_CPOS2LBOUND);
+	}
+
+	/**
+	 * Computes for each position of an array the position of the right boundary
+	 * of the enclosing structural attribute.
+	 *
+	 * @param attribute the attribute
+	 * @param cpos the cpos
+	 * @return the positions of the right boundaries
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	@Override
+	public synchronized int[] cpos2RBound(String attribute, int[] cpos)
+			throws UnexpectedAnswerException, IOException, CqiServerError {
+		return genericStringXIntArraytoIntArray(attribute, cpos,
+				CQI_CL_CPOS2RBOUND);
+	}
+
+	/**
+	 * Computes for each position of an array the Id of the enclosing alignment
+	 * attribute.
+	 *
+	 * @param attribute the attribute
+	 * @param cpos the cpos
+	 * @return the int[]
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	@Override
+	public synchronized int[] cpos2Alg(String attribute, int[] cpos)
+			throws UnexpectedAnswerException, IOException, CqiServerError {
+		return genericStringXIntArraytoIntArray(attribute, cpos,
+				CQI_CL_CPOS2ALG);
+	}
+
+	/**
+	 * Retrieves annotated string values of structure regions in <strucs>; "" if
+	 * out of range.
+	 *
+	 * @param attribute the attribute
+	 * @param strucs the strucs
+	 * @return the string[]
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	@Override
+	public synchronized String[] struc2Str(String attribute, int[] strucs)
+			throws UnexpectedAnswerException, IOException, CqiServerError {
+		return _struc2Str(attribute, strucs);
+	}
+	
+	/**
+	 * Retrieves annotated string values of structure regions in <strucs>; "" if
+	 * out of range.
+	 *
+	 * @param attribute the attribute
+	 * @param strucs the strucs
+	 * @return the string[]
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	public synchronized String[] _struc2Str(String attribute, int[] strucs)
+			throws UnexpectedAnswerException, IOException, CqiServerError {
+		return genericStringXIntArraytoStringArray(attribute, strucs,
+				CQI_CL_STRUC2STR);
+	}
+
+	/**
+	 * Retrieves all corpus positions where the given token occurs.
+	 *
+	 * @param attribute the attribute
+	 * @param id the id
+	 * @return the position
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	@Override
+	public synchronized int[] id2Cpos(String attribute, int id)
+			throws UnexpectedAnswerException, IOException, CqiServerError {
+		this.streamToServer.write(CQI_CL_ID2CPOS);
+		this.writeString(attribute);
+		this.streamToServer.writeInt(id);
+		return readIntList();
+	}
+
+	/**
+	 * Retrieves all corpus positions where one of the tokens in <id_list>
+	 * occurs; the returned list is sorted as a whole, not per token id.
+	 *
+	 * @param attribute the attribute
+	 * @param ids the ids
+	 * @return the positions
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	@Override
+	public synchronized int[] idList2Cpos(String attribute, int[] ids)
+			throws UnexpectedAnswerException, IOException, CqiServerError {
+		return genericStringXIntArraytoIntArray(attribute, ids,
+				CQI_CL_IDLIST2CPOS);
+	}
+
+	/**
+	 * Retrieves the lexicon IDs of all tokens that match <regex>; the returned
+	 * list may be empty (size 0);.
+	 *
+	 * @param attribute the attribute
+	 * @param regex the regex
+	 * @return the IDs
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	@Override
+	public synchronized int[] regex2Id(String attribute, String regex)
+			throws UnexpectedAnswerException, IOException, CqiServerError {
+		this.streamToServer.write(CQI_CL_REGEX2ID);
+		this.writeString(attribute);
+		this.writeString(regex);
+		return readIntList();
+	}
+
+	/**
+	 * Retrieves the start and end corpus positions of structure region <struc>.
+	 *
+	 * @param attribute the attribute
+	 * @param struc the struc
+	 * @return an array of size 2 containing the start and end positions
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	@Override
+	public synchronized int[] struc2Cpos(String attribute, int struc)
+			throws UnexpectedAnswerException, IOException, CqiServerError {
+		this.streamToServer.write(CQI_CL_STRUC2CPOS);
+		this.writeString(attribute);
+		this.streamToServer.writeInt(struc);
+		return this.readIntInt();
+	}
+
+	/**
+	 * Retrieves start and end corpus positions of an alignement region in the
+	 * source and target corpora<struc>.
+	 *
+	 * @param attribute the attribute
+	 * @param struc the struc
+	 * @return an array of size 4 containing (src_start, src_end, target_start,
+	 * target_end)
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	@Override
+	public synchronized int[] alg2Cpos(String attribute, int struc)
+			throws UnexpectedAnswerException, IOException, CqiServerError {
+		this.streamToServer.write(CQI_CL_ALG2CPOS);
+		this.writeString(attribute);
+		this.streamToServer.writeInt(struc);
+		return readIntIntIntInt();
+	}
+
+	/**
+	 * Runs a CQP query.
+	 *
+	 * @param motherCorpus the mother corpus
+	 * @param subcorpus the subcorpus
+	 * @param query the query
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError the cqi server error
+	 */
+	@Override
+	public synchronized void cqpQuery(String motherCorpus, String subcorpus,
+			String query) throws IOException, UnexpectedAnswerException, CqiServerError {
+		//System.out.println("CQPQUERY: Mother: "+motherCorpus+", sub:"+subcorpus+", "+query);
+		this.streamToServer.write(CQI_CQP_QUERY);
+		this.writeString(motherCorpus);
+		this.writeString(subcorpus);
+		this.writeString(query);
+		this.readHeaderFromServer(); // may receive a CQI_CQP_ERROR_GENERAL
+
+	}
+	
+	/**
+	 * Evaluate and run a raw CQP query.
+	 *
+	 * @param motherCorpus the mother corpus
+	 * @param subcorpus the subcorpus
+	 * @param query the query
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError the cqi server error
+	 */
+	public synchronized void query(String query) throws IOException, UnexpectedAnswerException, CqiServerError {
+		//System.out.println("CQPQUERY: Mother: "+motherCorpus+", sub:"+subcorpus+", "+query);
+		this.streamToServer.write(CQI_CQP_QUERY_EVAL);
+		this.writeString(query);
+		this.readHeaderFromServer(); // may receive a CQI_CQP_ERROR_GENERAL
+
+	}
+
+	/**
+	 * Lists all the subcorpora of a corpus.
+	 *
+	 * @param corpus the corpus
+	 * @return the name of the subcorpora
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiCqpErrorNoSuchCorpus the cqi cqp error no such corpus
+	 */
+	@Override
+	public synchronized String[] listSubcorpora(String corpus)
+			throws UnexpectedAnswerException, IOException, CqiCqpErrorNoSuchCorpus {
+		try {
+			return genericStringToStringArray(corpus, CQI_CQP_LIST_SUBCORPORA);
+		} catch (CqiCqpErrorNoSuchCorpus e) {
+			throw e;
+		} catch (CqiServerError e) {
+			throw new UnexpectedAnswerException(e);
+		}
+	}
+
+	/**
+	 * Gives the size of a subcorpus .
+	 * 
+	 * @param subcorpus
+	 *            the subcorpus
+	 * 
+	 * @return the size
+	 * 
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException
+	 *             Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError
+	 *             the cqi server error
+	 */
+	@Override
+	public synchronized int subCorpusSize(String subcorpus) throws IOException,
+	UnexpectedAnswerException, CqiServerError {
+		this.streamToServer.write(CQI_CQP_SUBCORPUS_SIZE);
+		this.writeString(subcorpus);
+		return this.readInt();
+	}
+
+	/**
+	 * Checks wether a subcorpus has a field.
+	 * 
+	 * @param subcorpus
+	 *            the subcorpus
+	 * @param field
+	 *            the field
+	 * 
+	 * @return true, if the subcorpus has the field
+	 * 
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException
+	 *             Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError
+	 *             the cqi server error
+	 */
+	@Override
+	public synchronized boolean subCorpusHasField(String subcorpus, byte field)
+			throws IOException, UnexpectedAnswerException, CqiServerError {
+		this.streamToServer.write(CQI_CQP_SUBCORPUS_HAS_FIELD);
+		this.writeString(subcorpus);
+		this.streamToServer.writeByte(field);
+		return this.readBoolean();
+	}
+
+	/**
+	 * Dumps the values of <field> for match ranges <first> .. <last> in
+	 * <subcorpus>. <field> is one of the CQI_CONST_FIELD_* constants.
+	 * 
+	 * @param subcorpus
+	 *            the subcorpus
+	 * @param field
+	 *            the field
+	 * @param first
+	 *            the first
+	 * @param last
+	 *            the last
+	 * 
+	 * @return the values
+	 * 
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException
+	 *             Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError
+	 *             the cqi server error
+	 */
+	@Override
+	public synchronized int[] dumpSubCorpus(String subcorpus, byte field,
+			int first, int last) throws IOException, UnexpectedAnswerException,
+			CqiServerError {
+		this.streamToServer.write(CQI_CQP_DUMP_SUBCORPUS);
+		this.writeString(subcorpus);
+		this.streamToServer.writeByte(field);
+		this.streamToServer.writeInt(first);
+		this.streamToServer.writeInt(last);
+		return this.readIntList();
+	}
+
+	/**
+	 * Drops a subcorpus.
+	 * 
+	 * @param subcorpus
+	 *            the subcorpus
+	 * 
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException
+	 *             Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError
+	 *             the cqi server error
+	 */
+	@Override
+	public synchronized void dropSubCorpus(String subcorpus) throws IOException,
+	UnexpectedAnswerException, CqiServerError {
+		this.streamToServer.write(CQI_CQP_DROP_SUBCORPUS);
+		this.writeString(subcorpus);
+		this.readHeaderFromServer();
+	}
+
+	/**
+	 * Returns <n> (id, frequency) pairs flattened into a list of size 2*<n> NB:
+	 * pairs are sorted by frequency desc.
+	 * 
+	 * @param subcorpus
+	 *            the subcorpus
+	 * @param cutoff
+	 *            the cutoff
+	 * @param field
+	 *            the field : one of CQI_CONST_FIELD_MATCH,
+	 *            CQI_CONST_FIELD_TARGET, CQI_CONST_FIELD_KEYWORD
+	 * @param attribute
+	 *            the attribute
+	 * 
+	 * @return the int[][]
+	 * 
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException
+	 *             Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError
+	 *             the cqi server error
+	 */
+	@Override
+	public synchronized int[][] fdist1(String subcorpus, int cutoff,
+			byte field, String attribute) throws IOException,
+			UnexpectedAnswerException, CqiServerError {
+		this.streamToServer.write(CQI_CQP_FDIST_1);
+		this.writeString(subcorpus);
+		this.streamToServer.writeInt(cutoff);
+		this.streamToServer.writeByte(field);
+		this.writeString(attribute);
+		return this.readIntTable();
+	}
+
+	/**
+	 * Returns <n> (id1, id2, frequency) pairs flattened into a list of size
+	 * 3*<n> NB: triples are sorted by frequency desc. .
+	 * 
+	 * @param subcorpus
+	 *            the subcorpus
+	 * @param cutoff
+	 *            the cutoff
+	 * @param field1
+	 *            the field1
+	 * @param attribute1
+	 *            the attribute1
+	 * @param field2
+	 *            the field2
+	 * @param attribute2
+	 *            the attribute2
+	 * 
+	 * @return the int[]
+	 * 
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException
+	 *             Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError
+	 *             the cqi server error
+	 */
+	@Override
+	public synchronized int[][] fdist2(String subcorpus, int cutoff,
+			byte field1, String attribute1, byte field2, String attribute2)
+					throws IOException, UnexpectedAnswerException, CqiServerError {
+		this.streamToServer.write(CQI_CQP_FDIST_1);
+		this.writeString(subcorpus);
+		this.streamToServer.writeInt(cutoff);
+		this.streamToServer.writeByte(field1);
+		this.writeString(attribute1);
+		this.streamToServer.writeByte(field2);
+		this.writeString(attribute2);
+		return this.readIntTable();
+	}
+
+	@Override
+	public boolean reconnect() {
+		try {
+			return connect(username, password);
+		} catch (Exception e) {
+			System.out.println(TXMCoreMessages.NetCqiClient_5+e);
+			return false;
+		}
+	}
+
+	/**
+	 * @param args
+	 * @throws Exception 
+	 */
+	public static void main(String[] args) throws Exception {
+		String pathToExecutable = "/usr/lib/TXM/cwb/bin/cqpserver"; //$NON-NLS-1$
+		String pathToRegistry = "/home/mdecorde/TXM/registry"; //$NON-NLS-1$
+		String pathToInitFile = "/usr/lib/TXM/cwb/cqpserver.init"; //$NON-NLS-1$
+
+		String corpus = "DISCOURS"; //$NON-NLS-1$
+		String subcorpusname = "SUB"; //$NON-NLS-1$
+		String subcorpusid = corpus+":"+subcorpusname; //$NON-NLS-1$
+		String query = "[word=\"j.*\"]"; //$NON-NLS-1$
+		String regex = "j.*"; //$NON-NLS-1$
+		String pattribute1 = corpus+".word"; //$NON-NLS-1$
+		String pattribute2 = corpus+".frpos"; //$NON-NLS-1$
+		String pattribute3 = corpus+".frlemma"; //$NON-NLS-1$
+		String sattribute1 = corpus+".text_id"; //$NON-NLS-1$
+		String sattribute2 = corpus+".p_id"; //$NON-NLS-1$
+		String sattribute3 = corpus+".s_id"; //$NON-NLS-1$
+		
+		String align_attr = "p_id"; //$NON-NLS-1$
+
+		int[] cpos = {0,1,2,3,4,5,6,7,8,9,10};
+//		int id = 1;
+		int[] ids = {0,1,2,3,4,5,6,7,8,9,10};
+		String[] strings = {"je", "jamais"}; //$NON-NLS-1$ //$NON-NLS-2$
+		int[] strucpos = {0, 1, 2, 3 , 4};
+
+		NetCqiServer server = new NetCqiServer(pathToExecutable, pathToRegistry, pathToInitFile, "", false); //$NON-NLS-1$
+		if (server.start()) System.out.println("Server ok"); //$NON-NLS-1$
+		NetCqiClient client = new NetCqiClient("127.0.0.1", 4877); //$NON-NLS-1$
+		if (client.connect("anonymous", "")) System.out.println("Client ok"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+
+		ExecTimer.start();
+		try {
+			System.out.println("client.alg2Cpos(sattribute, struct_id) : "+Arrays.toString(client.alg2Cpos(sattribute1, 0))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.attributeSize(sattribute1) : "+client.attributeSize(sattribute1)); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.attributeSize(sattribute2) : "+client.attributeSize(sattribute2)); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		
+		try {
+			System.out.println("client.attributeSize(sattribute3) : "+client.attributeSize(sattribute3)); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		
+		try {
+			System.out.println("client.corpusAlignementAttributes(corpus) : "+Arrays.toString(client.corpusAlignementAttributes(corpus))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.corpusCharset(corpus) : "+client.corpusCharset(corpus)); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.corpusFullName(corpus) : "+client.corpusFullName(corpus)); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.corpusInfo(corpus) : "+client.corpusInfo(corpus)); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.corpusPositionalAttributes(corpus) : "+Arrays.toString(client.corpusPositionalAttributes(corpus))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.corpusProperties(corpus) : "+Arrays.toString(client.corpusProperties(corpus))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.corpusStructuralAttributeHasValues(sattribute1) : "+client.corpusStructuralAttributeHasValues(sattribute1)); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.corpusStructuralAttributeHasValues(sattribute2) : "+client.corpusStructuralAttributeHasValues(sattribute2)); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.corpusStructuralAttributeHasValues(sattribute3) : "+client.corpusStructuralAttributeHasValues(sattribute3)); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		
+		try {
+			System.out.println("client.corpusStructuralAttributes(corpus) : "+Arrays.toString(client.corpusStructuralAttributes(corpus))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.cpos2Alg(align_attr, cpos) : "+Arrays.toString(client.cpos2Alg(align_attr, cpos))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.cpos2Id(pattribute1, cpos) : "+Arrays.toString(client.cpos2Id(pattribute1, cpos))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.cpos2Id(pattribute2, cpos) : "+Arrays.toString(client.cpos2Id(pattribute2, cpos))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.cpos2Id(pattribute3, cpos) : "+Arrays.toString(client.cpos2Id(pattribute3, cpos))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.cpos2LBound(sattribute1, cpos) : "+Arrays.toString(client.cpos2LBound(sattribute1, cpos))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.cpos2LBound(sattribute2, cpos) : "+Arrays.toString(client.cpos2LBound(sattribute2, cpos))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.cpos2LBound(sattribute3, cpos) : "+Arrays.toString(client.cpos2LBound(sattribute3, cpos))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.cpos2RBound(sattribute1, cpos) : "+Arrays.toString(client.cpos2RBound(sattribute1, cpos))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.cpos2RBound(sattribute2, cpos) : "+Arrays.toString(client.cpos2RBound(sattribute2, cpos))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.cpos2RBound(sattribute3, cpos) : "+Arrays.toString(client.cpos2RBound(sattribute3, cpos))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.cpos2Str(pattribute1, cpos) : "+Arrays.toString(client.cpos2Str(pattribute1, cpos))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.cpos2Str(pattribute2, cpos) : "+Arrays.toString(client.cpos2Str(pattribute2, cpos))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.cpos2Str(pattribute3, cpos) : "+Arrays.toString(client.cpos2Str(pattribute3, cpos))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.cpos2Struc(sattribute1, cpos) : "+Arrays.toString(client.cpos2Struc(sattribute1, cpos))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.cpos2Struc(sattribute2, cpos) : "+Arrays.toString(client.cpos2Struc(sattribute2, cpos))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.cpos2Struc(sattribute3, cpos) : "+Arrays.toString(client.cpos2Struc(sattribute3, cpos))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.cqpQuery(corpus, subcorpus, query)");client.cqpQuery(corpus, subcorpusname, query); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.dropAttribute(pattribute1)");client.dropAttribute(pattribute1); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.dropAttribute(pattribute2)");client.dropAttribute(pattribute2); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.dropAttribute(pattribute3)");client.dropAttribute(pattribute3); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.dropCorpus(corpus)");client.dropCorpus(corpus); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println(TXMCoreMessages.NetCqiClient_97+Arrays.toString(client.dumpSubCorpus(subcorpusid, NetCqiClient.CQI_CONST_FIELD_MATCH, 1, 10)));
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.dumpSubCorpus(subcorpus, NetCqiClient.CQI_CONST_FIELD_MATCHEND, 1, 2) : "+Arrays.toString(client.dumpSubCorpus(subcorpusid, NetCqiClient.CQI_CONST_FIELD_MATCHEND, 1, 10))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			//System.out.println("//client.fdist1(arg0, arg1, arg2, arg3) : "+client.fdist1(arg0, arg1, arg2, arg3));
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			//System.out.println("//client.fdist2(arg0, arg1, arg2, arg3, arg4, arg5) : "+client.fdist2(arg0, arg1, arg2, arg3, arg4, arg5));
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.getLastCqiError() : "+client.getLastCqiError()); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.getLastCQPError() : "+client.getLastCQPError()); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.id2Cpos(pattribute1, 0) : "+Arrays.toString(client.id2Cpos(pattribute1, 0))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.id2Cpos(pattribute2, 0) : "+Arrays.toString(client.id2Cpos(pattribute2, 0))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.id2Cpos(pattribute3, 0) : "+Arrays.toString(client.id2Cpos(pattribute3, 0))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		
+		try {
+			System.out.println("client.id2Cpos(pattribute1, 1) : "+Arrays.toString(client.id2Cpos(pattribute1, 1))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.id2Cpos(pattribute2, 1) : "+Arrays.toString(client.id2Cpos(pattribute2, 1))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.id2Cpos(pattribute3, 1) : "+Arrays.toString(client.id2Cpos(pattribute3, 1))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		
+		try {
+			System.out.println("client.id2Cpos(pattribute1, 2) : "+Arrays.toString(client.id2Cpos(pattribute1, 2))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.id2Cpos(pattribute2, 2) : "+Arrays.toString(client.id2Cpos(pattribute2, 2))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.id2Cpos(pattribute3, 2) : "+Arrays.toString(client.id2Cpos(pattribute3, 2))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.id2Freq(pattribute1, ids) : "+Arrays.toString(client.id2Freq(pattribute1, ids))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.id2Freq(pattribute2, ids) : "+Arrays.toString(client.id2Freq(pattribute2, ids))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.id2Freq(pattribute3, ids) : "+Arrays.toString(client.id2Freq(pattribute3, ids))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.id2Str(pattribute1, ids) : "+Arrays.toString(client.id2Str(pattribute1, ids))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.id2Str(pattribute2, ids) : "+Arrays.toString(client.id2Str(pattribute2, ids))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.id2Str(pattribute3, ids) : "+Arrays.toString(client.id2Str(pattribute3, ids))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.idList2Cpos(pattribute1, ids) : "+Arrays.toString(client.idList2Cpos(pattribute1, ids))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.idList2Cpos(pattribute2, ids) : "+Arrays.toString(client.idList2Cpos(pattribute2, ids))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.idList2Cpos(pattribute3, ids) : "+Arrays.toString(client.idList2Cpos(pattribute3, ids))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.lexiconSize(pattribute1) : "+client.lexiconSize(pattribute1)); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.lexiconSize(pattribute2) : "+client.lexiconSize(pattribute2)); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.lexiconSize(pattribute3) : "+client.lexiconSize(pattribute3)); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.listCorpora() : "+Arrays.toString(client.listCorpora())); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.listSubcorpora(corpus) : "+Arrays.toString(client.listSubcorpora(corpus))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.regex2Id(pattribute1, regex) : "+Arrays.toString(client.regex2Id(pattribute1, regex))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.regex2Id(pattribute2, regex) : "+Arrays.toString(client.regex2Id(pattribute2, regex))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.regex2Id(pattribute3, regex) : "+Arrays.toString(client.regex2Id(pattribute3, regex))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.str2Id(pattribute1, strings) : "+Arrays.toString(client.str2Id(pattribute1, strings))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.str2Id(pattribute2, strings) : "+Arrays.toString(client.str2Id(pattribute2, strings))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.str2Id(pattribute3, strings) : "+Arrays.toString(client.str2Id(pattribute3, strings))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.struc2Cpos(sattribute1, 0) : "+Arrays.toString(client.struc2Cpos(sattribute1, 0))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.struc2Cpos(sattribute2, 0) : "+Arrays.toString(client.struc2Cpos(sattribute2, 0))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.struc2Cpos(sattribute3, 0) : "+Arrays.toString(client.struc2Cpos(sattribute3, 0))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		
+		try {
+			System.out.println("client.struc2Cpos(sattribute1, 1) : "+Arrays.toString(client.struc2Cpos(sattribute1, 1))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.struc2Cpos(sattribute2, 1) : "+Arrays.toString(client.struc2Cpos(sattribute2, 1))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.struc2Cpos(sattribute3, 1) : "+Arrays.toString(client.struc2Cpos(sattribute3, 1))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		
+		try {
+			System.out.println("client.struc2Cpos(sattribute1, 2) : "+Arrays.toString(client.struc2Cpos(sattribute1, 2))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.struc2Cpos(sattribute2, 2) : "+Arrays.toString(client.struc2Cpos(sattribute2, 2))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.struc2Cpos(sattribute3, 2) : "+Arrays.toString(client.struc2Cpos(sattribute3, 2))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		
+		try {
+			System.out.println("client.struc2Cpos(sattribute1, 3) : "+Arrays.toString(client.struc2Cpos(sattribute1, 3))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.struc2Cpos(sattribute2, 3) : "+Arrays.toString(client.struc2Cpos(sattribute2, 3))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.struc2Cpos(sattribute3, 3) : "+Arrays.toString(client.struc2Cpos(sattribute3, 3))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		
+		try {
+			System.out.println("client.struc2Str(sattribute1, strucpos) : "+Arrays.toString(client.struc2Str(sattribute1, strucpos))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.struc2Str(sattribute2, strucpos) : "+Arrays.toString(client.struc2Str(sattribute2, strucpos))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.struc2Str(sattribute3, strucpos) : "+Arrays.toString(client.struc2Str(sattribute3, strucpos))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.subCorpusHasField(subcorpus, (byte)0) : "+client.subCorpusHasField(subcorpusid, (byte)0)); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.subCorpusSize(subcorpus) : "+client.subCorpusSize(subcorpusid)); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.dropSubCorpus(subcorpus)"); client.dropSubCorpus(subcorpusid); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		System.out.println("TIME: "+ExecTimer.stop()); //$NON-NLS-1$
+
+		server.stop();
+		
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/NetCqiClient.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/CqpPropertyDataProxy.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/cqp/CqpPropertyDataProxy.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/cqp/CqpPropertyDataProxy.java	(revision 258)
@@ -0,0 +1,64 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp;
+
+import java.util.List;
+
+import org.txm.searchengine.cqp.corpus.Corpus;
+import org.txm.searchengine.cqp.corpus.StructuralUnitProperty;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class CqpPropertyDataProxy.
+ */
+public class CqpPropertyDataProxy {
+	/**
+	 * Data is cached in a sparse list which give for each position the
+	 * corresponding string (given the property it is dedicated to).
+	 */
+	private List<String> data = null;
+
+	/** The property. */
+	private StructuralUnitProperty property;
+
+	/** the corpus. */
+	private Corpus corpus;
+
+	/**
+	 * The Constructor.
+	 *
+	 * @param corpus the corpus
+	 * @param property The property the dataProxy is dedicated to
+	 */
+	public CqpPropertyDataProxy(Corpus corpus, StructuralUnitProperty property) {
+		this.property = property;
+		this.corpus = corpus;
+	}
+
+
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/CqpPropertyDataProxy.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/ICqiClient.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/cqp/ICqiClient.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/cqp/ICqiClient.java	(revision 258)
@@ -0,0 +1,820 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2012-03-01 08:14:11 +0100 (jeu., 01 mars 2012) $
+// $LastChangedRevision: 2134 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp;
+
+import java.io.IOException;
+
+import org.txm.searchengine.cqp.clientExceptions.UnexpectedAnswerException;
+import org.txm.searchengine.cqp.serverException.CqiCqpErrorNoSuchCorpus;
+import org.txm.searchengine.cqp.serverException.CqiServerError;
+
+/**
+ * This class implements a Java Interface CQi client.
+ *
+ * @author mdecorde
+ */
+public interface ICqiClient {
+
+	/** The Constant CQI_PADDING. */
+	final static public byte[] CQI_PADDING = { (byte) 0x00 };
+
+	/** The Constant CQI_STATUS_OK. */
+	final static public byte[] CQI_STATUS_OK = { (byte) 0x01, (byte) 0x01 };
+
+	/** The Constant CQI_STATUS_CONNECT_OK. */
+	final static public byte[] CQI_STATUS_CONNECT_OK = { (byte) 0x01, (byte) 0x02 };
+
+	/** The Constant CQI_STATUS_BYE_OK. */
+	final static public byte[] CQI_STATUS_BYE_OK = { (byte) 0x01, (byte) 0x03 };
+
+	/** The Constant CQI_STATUS_PING_OK. */
+	final static public byte[] CQI_STATUS_PING_OK = { (byte) 0x01, (byte) 0x04 };
+
+	/** The Constant CQI_ERROR_GENERAL_ERROR. */
+	final static public byte[] CQI_ERROR_GENERAL_ERROR = { (byte) 0x02, (byte) 0x01 };
+
+	/** The Constant CQI_ERROR_CONNECT_REFUSED. */
+	final static public byte[] CQI_ERROR_CONNECT_REFUSED = { (byte) 0x02, (byte) 0x02 };
+
+	/** The Constant CQI_ERROR_USER_ABORT. */
+	final static public byte[] CQI_ERROR_USER_ABORT = { (byte) 0x02, (byte) 0x03 };
+
+	/** The Constant CQI_ERROR_SYNTAX_ERROR. */
+	final static public byte[] CQI_ERROR_SYNTAX_ERROR = { (byte) 0x02, (byte) 0x04 };
+
+	/** The Constant CQI_DATA_BYTE. */
+	final static public byte[] CQI_DATA_BYTE = { (byte) 0x03, (byte) 0x01 };
+
+	/** The Constant CQI_DATA_BOOL. */
+	final static public byte[] CQI_DATA_BOOL = { (byte) 0x03, (byte) 0x02 };
+
+	/** The Constant CQI_DATA_INT. */
+	final static public byte[] CQI_DATA_INT = { (byte) 0x03, (byte) 0x03 };
+
+	/** The Constant CQI_DATA_STRING. */
+	final static public byte[] CQI_DATA_STRING = { (byte) 0x03, (byte) 0x04 };
+
+	/** The Constant CQI_DATA_BYTE_LIST. */
+	final static public byte[] CQI_DATA_BYTE_LIST = { (byte) 0x03, (byte) 0x05 };
+
+	/** The Constant CQI_DATA_BOOL_LIST. */
+	final static public byte[] CQI_DATA_BOOL_LIST = { (byte) 0x03, (byte) 0x06 };
+
+	/** The Constant CQI_DATA_INT_LIST. */
+	final static public byte[] CQI_DATA_INT_LIST = { (byte) 0x03, (byte) 0x07 };
+
+	/** The Constant CQI_DATA_STRING_LIST. */
+	final static public byte[] CQI_DATA_STRING_LIST = { (byte) 0x03, (byte) 0x08 };
+
+	/** The Constant CQI_DATA_INT_INT. */
+	final static public byte[] CQI_DATA_INT_INT = { (byte) 0x03, (byte) 0x09 };
+
+	/** The Constant CQI_DATA_INT_INT_INT_INT. */
+	final static public byte[] CQI_DATA_INT_INT_INT_INT = { (byte) 0x03, (byte) 0x0A };
+
+	/** The Constant CQI_DATA_INT_TABLE. */
+	final static public byte[] CQI_DATA_INT_TABLE = { (byte) 0x03, (byte) 0x0B };
+
+	/** The Constant CQI_CL_ERROR_NO_SUCH_ATTRIBUTE. */
+	final static public byte[] CQI_CL_ERROR_NO_SUCH_ATTRIBUTE = { (byte) 0x04,
+		(byte) 0x01 };
+
+	/** The Constant CQI_CL_ERROR_WRONG_ATTRIBUTE_TYPE. */
+	final static public byte[] CQI_CL_ERROR_WRONG_ATTRIBUTE_TYPE = { (byte) 0x04,
+		(byte) 0x02 };
+
+	/** The Constant CQI_CL_ERROR_OUT_OF_RANGE. */
+	final static public byte[] CQI_CL_ERROR_OUT_OF_RANGE = { (byte) 0x04, (byte) 0x03 };
+
+	/** The Constant CQI_CL_ERROR_REGEX. */
+	final static public byte[] CQI_CL_ERROR_REGEX = { (byte) 0x04, (byte) 0x04 };
+
+	/** The Constant CQI_CL_ERROR_CORPUS_ACCESS. */
+	final static public byte[] CQI_CL_ERROR_CORPUS_ACCESS = { (byte) 0x04, (byte) 0x05 };
+
+	/** The Constant CQI_CL_ERROR_OUT_OF_MEMORY. */
+	final static public byte[] CQI_CL_ERROR_OUT_OF_MEMORY = { (byte) 0x04, (byte) 0x06 };
+
+	/** The Constant CQI_CL_ERROR_INTERNAL. */
+	final static public byte[] CQI_CL_ERROR_INTERNAL = { (byte) 0x04, (byte) 0x07 };
+
+	/** The Constant CQI_CQP_ERROR_GENERAL. */
+	final static public byte[] CQI_CQP_ERROR_GENERAL = { (byte) 0x05, (byte) 0x01 };
+
+	/** The Constant CQI_CQP_ERROR_NO_SUCH_CORPUS. */
+	final static public byte[] CQI_CQP_ERROR_NO_SUCH_CORPUS = { (byte) 0x05,
+		(byte) 0x02 };
+
+	/** The Constant CQI_CQP_ERROR_INVALID_FIELD. */
+	final static public byte[] CQI_CQP_ERROR_INVALID_FIELD = { (byte) 0x05,
+		(byte) 0x03 };
+
+	/** The Constant CQI_CQP_ERROR_OUT_OF_RANGE. */
+	final static public byte[] CQI_CQP_ERROR_OUT_OF_RANGE = { (byte) 0x05, (byte) 0x04 };
+
+	/** The Constant CQI_CQP_ERROR_OUT_OF_RANGE. */
+	final static public byte[] CQI_CQP_ERROR_SYNTAX = { (byte) 0x05, (byte) 0x05 };
+
+	/** The Constant CQI_CTRL_CONNECT. */
+	final static public byte[] CQI_CTRL_CONNECT = { (byte) 0x11, (byte) 0x01 };
+
+	/** The Constant CQI_CTRL_BYE. */
+	final static public byte[] CQI_CTRL_BYE = { (byte) 0x11, (byte) 0x02 };
+
+	/** The Constant CQI_CTRL_USER_ABORT. */
+	final static public byte[] CQI_CTRL_USER_ABORT = { (byte) 0x11, (byte) 0x03 };
+
+	/** The Constant CQI_CTRL_PING. */
+	final static public byte[] CQI_CTRL_PING = { (byte) 0x11, (byte) 0x04 };
+
+	/** The Constant CQI_CTRL_LAST_GENERAL_ERROR. */
+	final static public byte[] CQI_CTRL_LAST_GENERAL_ERROR = { (byte) 0x11,
+		(byte) 0x05 };
+
+	/** The Constant CQI_CTRL_LAST_CQP_ERROR. */
+	final static public byte[] CQI_CTRL_LAST_CQP_ERROR = { (byte) 0x11,
+		(byte) 0x06 };
+
+	/** The Constant CQI_CORPUS_LIST_CORPORA. */
+	final static public byte[] CQI_CORPUS_LIST_CORPORA = { (byte) 0x13, (byte) 0x01 };
+
+	/** The Constant CQI_CORPUS_CHARSET. */
+	final static public byte[] CQI_CORPUS_CHARSET = { (byte) 0x13, (byte) 0x03 };
+
+	/** The Constant CQI_CORPUS_PROPERTIES. */
+	final static public byte[] CQI_CORPUS_PROPERTIES = { (byte) 0x13, (byte) 0x04 };
+
+	/** The Constant CQI_CORPUS_POSITIONAL_ATTRIBUTES. */
+	final static public byte[] CQI_CORPUS_POSITIONAL_ATTRIBUTES = { (byte) 0x13,
+		(byte) 0x05 };
+
+	/** The Constant CQI_CORPUS_STRUCTURAL_ATTRIBUTES. */
+	final static public byte[] CQI_CORPUS_STRUCTURAL_ATTRIBUTES = { (byte) 0x13,
+		(byte) 0x06 };
+
+	/** The Constant CQI_CORPUS_STRUCTURAL_ATTRIBUTE_HAS_VALUES. */
+	final static public byte[] CQI_CORPUS_STRUCTURAL_ATTRIBUTE_HAS_VALUES = {
+		(byte) 0x13, (byte) 0x07 };
+
+	/** The Constant CQI_CORPUS_ALIGNMENT_ATTRIBUTES. */
+	final static public byte[] CQI_CORPUS_ALIGNMENT_ATTRIBUTES = { (byte) 0x13,
+		(byte) 0x08 };
+
+	/** The Constant CQI_CORPUS_FULL_NAME. */
+	final static public byte[] CQI_CORPUS_FULL_NAME = { (byte) 0x13, (byte) 0x09 };
+
+	/** The Constant CQI_CORPUS_INFO. */
+	final static public byte[] CQI_CORPUS_INFO = { (byte) 0x13, (byte) 0x0A };
+
+	/** The Constant CQI_CORPUS_DROP_CORPUS. */
+	final static public byte[] CQI_CORPUS_DROP_CORPUS = { (byte) 0x13, (byte) 0x0B };
+
+	/** The Constant CQI_CL_ATTRIBUTE_SIZE. */
+	final static public byte[] CQI_CL_ATTRIBUTE_SIZE = { (byte) 0x14, (byte) 0x01 };
+
+	/** The Constant CQI_CL_LEXICON_SIZE. */
+	final static public byte[] CQI_CL_LEXICON_SIZE = { (byte) 0x14, (byte) 0x02 };
+
+	/** The Constant CQI_CL_DROP_ATTRIBUTE. */
+	final static public byte[] CQI_CL_DROP_ATTRIBUTE = { (byte) 0x14, (byte) 0x03 };
+
+	/** The Constant CQI_CL_STR2ID. */
+	final static public byte[] CQI_CL_STR2ID = { (byte) 0x14, (byte) 0x04 };
+
+	/** The Constant CQI_CL_ID2STR. */
+	final static public byte[] CQI_CL_ID2STR = { (byte) 0x14, (byte) 0x05 };
+
+	/** The Constant CQI_CL_ID2FREQ. */
+	final static public byte[] CQI_CL_ID2FREQ = { (byte) 0x14, (byte) 0x06 };
+
+	/** The Constant CQI_CL_CPOS2ID. */
+	final static public byte[] CQI_CL_CPOS2ID = { (byte) 0x14, (byte) 0x07 };
+
+	/** The Constant CQI_CL_CPOS2STR. */
+	final static public byte[] CQI_CL_CPOS2STR = { (byte) 0x14, (byte) 0x08 };
+
+	/** The Constant CQI_CL_CPOS2STRUC. */
+	final static public byte[] CQI_CL_CPOS2STRUC = { (byte) 0x14, (byte) 0x09 };
+
+	/** The Constant CQI_CL_CPOS2LBOUND. */
+	final static public byte[] CQI_CL_CPOS2LBOUND = { (byte) 0x14, (byte) 0x20 };
+
+	/** The Constant CQI_CL_CPOS2RBOUND. */
+	final static public byte[] CQI_CL_CPOS2RBOUND = { (byte) 0x14, (byte) 0x21 };
+
+	/** The Constant CQI_CL_CPOS2ALG. */
+	final static public byte[] CQI_CL_CPOS2ALG = { (byte) 0x14, (byte) 0x0A };
+
+	/** The Constant CQI_CL_STRUC2STR. */
+	final static public byte[] CQI_CL_STRUC2STR = { (byte) 0x14, (byte) 0x0B };
+
+	/** The Constant CQI_CL_ID2CPOS. */
+	final static public byte[] CQI_CL_ID2CPOS = { (byte) 0x14, (byte) 0x0C };
+
+	/** The Constant CQI_CL_IDLIST2CPOS. */
+	final static public byte[] CQI_CL_IDLIST2CPOS = { (byte) 0x14, (byte) 0x0D };
+
+	/** The Constant CQI_CL_REGEX2ID. */
+	final static public byte[] CQI_CL_REGEX2ID = { (byte) 0x14, (byte) 0x0E };
+
+	/** The Constant CQI_CL_STRUC2CPOS. */
+	final static public byte[] CQI_CL_STRUC2CPOS = { (byte) 0x14, (byte) 0x0F };
+
+	/** The Constant CQI_CL_ALG2CPOS. */
+	final static public byte[] CQI_CL_ALG2CPOS = { (byte) 0x14, (byte) 0x10 };
+
+	/** The Constant CQI_CQP_QUERY. */
+	final static public byte[] CQI_CQP_QUERY = { (byte) 0x15, (byte) 0x01 };
+
+	/** The Constant CQI_CQP_LIST_SUBCORPORA. */
+	final static public byte[] CQI_CQP_LIST_SUBCORPORA = { (byte) 0x15, (byte) 0x02 };
+
+	/** The Constant CQI_CQP_SUBCORPUS_SIZE. */
+	final static public byte[] CQI_CQP_SUBCORPUS_SIZE = { (byte) 0x15, (byte) 0x03 };
+
+	/** The Constant CQI_CQP_SUBCORPUS_HAS_FIELD. */
+	final static public byte[] CQI_CQP_SUBCORPUS_HAS_FIELD = { (byte) 0x15,
+		(byte) 0x04 };
+
+	/** The Constant CQI_CQP_DUMP_SUBCORPUS. */
+	final static public byte[] CQI_CQP_DUMP_SUBCORPUS = { (byte) 0x15, (byte) 0x05 };
+
+	/** The Constant CQI_CQP_DROP_SUBCORPUS. */
+	final static public byte[] CQI_CQP_DROP_SUBCORPUS = { (byte) 0x15, (byte) 0x09 };
+
+	/** The Constant CQI_CQP_FDIST_1. */
+	final static public byte[] CQI_CQP_FDIST_1 = { (byte) 0x15, (byte) 0x10 };
+
+	/** The Constant CQI_CQP_FDIST_2. */
+	final static public byte[] CQI_CQP_FDIST_2 = { (byte) 0x15, (byte) 0x11 };
+
+	/** The Constant CQI_CQP_QUERY. */
+	final static public byte[] CQI_CQP_QUERY_EVAL = { (byte) 0x15, (byte) 0x01 };
+	
+	/** The Constant CQI_CONST_FIELD_MATCH. */
+	final public static byte CQI_CONST_FIELD_MATCH = (byte) 0x10;
+
+	/** The Constant CQI_CONST_FIELD_MATCHEND. */
+	final public static byte CQI_CONST_FIELD_MATCHEND = (byte) 0x11;
+	
+	/** The Constant CQI_CONST_FIELD_TARGET. */
+	final public static byte CQI_CONST_FIELD_TARGET = (byte) 0x00;
+	/** The Constant CQI_CONST_FIELD_KEYWORD. */
+	final public static byte CQI_CONST_FIELD_KEYWORD = (byte) 0x09;
+	
+	final public static byte CQI_CONST_FIELD_TARGET_0 = (byte) 0x00;
+	final public static byte CQI_CONST_FIELD_TARGET_1 = (byte) 0x01;
+	final public static byte CQI_CONST_FIELD_TARGET_2 = (byte) 0x02;
+	final public static byte CQI_CONST_FIELD_TARGET_3 = (byte) 0x03;
+	final public static byte CQI_CONST_FIELD_TARGET_4 = (byte) 0x04;
+	final public static byte CQI_CONST_FIELD_TARGET_5 = (byte) 0x05;
+	final public static byte CQI_CONST_FIELD_TARGET_6 = (byte) 0x06;
+	final public static byte CQI_CONST_FIELD_TARGET_7 = (byte) 0x07;
+	final public static byte CQI_CONST_FIELD_TARGET_8 = (byte) 0x08;
+	final public static byte CQI_CONST_FIELD_TARGET_9 = (byte) 0x09;
+	
+	// CQI_ERROR_CONNECT_REFUSED
+	/**
+	 * Connect the client to a server.
+	 *
+	 * @param username the username
+	 * @param password the password
+	 * @return true, if successful
+	 */
+	public boolean connect(String username, String password) throws UnexpectedAnswerException, IOException, CqiServerError ;
+
+	// None
+	/**
+	 * Disconnect.
+	 * 
+	 * @return true, if successful
+	 */
+	public boolean disconnect() throws UnexpectedAnswerException, CqiServerError, IOException;
+
+	// CQI_CTRL_LAST_GENERAL_ERROR
+	/**
+	 * return the last CQP error.
+	 *
+	 * @return the last error
+	 */
+	public String getLastCqiError() throws UnexpectedAnswerException, IOException,	CqiServerError;
+
+	// CQI_CTRL_LAST_CQP_ERROR
+	/**
+	 * return the last CQP error.
+	 *
+	 * @return the last error
+	 */
+	public String getLastCQPError() throws UnexpectedAnswerException, IOException,	CqiServerError;
+
+	// None
+	/**
+	 * Lists the corpora available on the server.
+	 *
+	 * @return the name of the corpora
+	 */
+	public String[] listCorpora() throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	// None
+	/**
+	 * Gives the corpus charset.
+	 *
+	 * @param corpus the corpus
+	 * @return the name of the charset
+	 */
+	public String corpusCharset(String corpus) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	// None (not really implemented anyway)
+	/**
+	 * Gives the corpus properties.
+	 *
+	 * @param corpus the corpus
+	 * @return the properties
+	 */
+	public String[] corpusProperties(String corpus) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	// CQI_CQP_ERROR_NO_SUCH_CORPUS
+	/**
+	 * Gives the corpus positional attributes.
+	 *
+	 * @param corpusID the corpus id
+	 * @return the name of the attributes
+	 */
+	public String[] corpusPositionalAttributes(String corpusID) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	// CQI_CQP_ERROR_NO_SUCH_CORPUS
+	/**
+	 * Gives the corpus structural attributes.
+	 *
+	 * @param corpus the corpus
+	 * @return the name of the attributes
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	public String[] corpusStructuralAttributes(String corpus) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	// CQI_CQP_ERROR_NO_SUCH_CORPUS, CQI_CL_ERROR_NO_SUCH_ATTRIBUTE,
+	// CQI_CL_ERROR_WRONG_ATTRIBUTE_TYPE
+	/**
+	 * Check wether a structural attribute has values.
+	 *
+	 * @param attribute the attribute
+	 * @return true, if it has values
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	public boolean corpusStructuralAttributeHasValues(String attribute) throws UnexpectedAnswerException, IOException,
+	CqiServerError;
+
+	// CQI_CQP_ERROR_NO_SUCH_CORPUS
+	/**
+	 * Gives the corpus alignement attributes.
+	 *
+	 * @param corpus the corpus
+	 * @return the name of attributes
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	public String[] corpusAlignementAttributes(String corpus) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	// CQI_CQP_ERROR_NO_SUCH_CORPUS
+	/**
+	 * Gives the corpus full name.
+	 *
+	 * @param corpus the corpus
+	 * @return the full name
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	public String corpusFullName(String corpus) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	/**
+	 * Gives the corpus info listed in the .INFO file.
+	 *
+	 * @param corpus the corpus
+	 * @return the info
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	public  String[] corpusInfo(String corpus) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	/**
+	 * Drop a corpus.
+	 * 
+	 * @param corpus
+	 *            the corpus
+	 */
+	public void dropCorpus(String corpus) throws Exception;
+
+	// CQI_CQP_ERROR_NO_SUCH_CORPUS, CQI_CL_ERROR_NO_SUCH_ATTRIBUTE,
+	// CQI_CL_ERROR_WRONG_ATTRIBUTE_TYPE, CQI_CL_ERROR_CORPUS_ACCESS
+	/**
+	 * Gives an attribute size (the number of token).
+	 *
+	 * @param attribute the attribute
+	 * @return the size
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	public int attributeSize(String attribute) throws IOException, UnexpectedAnswerException, CqiServerError;
+
+	// CQI_CQP_ERROR_NO_SUCH_CORPUS, CQI_CL_ERROR_NO_SUCH_ATTRIBUTE,
+	// CQI_CL_ERROR_WRONG_ATTRIBUTE_TYPE, CQI_CL_ERROR_CORPUS_ACCESS
+	/**
+	 * Gives the lexicon size of an attribute.
+	 *
+	 * @param attribute the attribute
+	 * @return the int
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 * @returns the number of entries in the lexicon of a positional attribute
+	 */
+	public int lexiconSize(String attribute) throws IOException, UnexpectedAnswerException, CqiServerError;
+
+	/**
+	 * Drop attribute.
+	 *
+	 * @param attribute the attribute
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	public void dropAttribute(String attribute) throws IOException, UnexpectedAnswerException, CqiServerError;
+
+	/**
+	 * Converts an array of attribute values to their ID.
+	 *
+	 * @param attribute the attribute
+	 * @param strings the values
+	 * @return the IDs
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	public int[] str2Id(String attribute, String[] strings) throws IOException, UnexpectedAnswerException, CqiServerError;
+
+	/**
+	 * Converts an array of attribute ID to their values.
+	 *
+	 * @param attribute the attribute
+	 * @param ids the ids
+	 * @return the values
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	public String[] id2Str(String attribute, int[] ids) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	/**
+	 * Converts an array of attribute IDs to their frequency.
+	 *
+	 * @param attribute the attribute
+	 * @param ids the ids
+	 * @return the frequencies
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	public int[] id2Freq(String attribute, int[] ids) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	/**
+	 * Converts an array of position to their ID given an attribute.
+	 *
+	 * @param attribute the attribute
+	 * @param cpos the positions
+	 * @return the IDs
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	public int[] cpos2Id(String attribute, int[] cpos) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	/**
+	 * Converts an array of position to their value given an attribute.
+	 *
+	 * @param attribute the attribute
+	 * @param cpos the cpos
+	 * @return the values
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	public String[] cpos2Str(String attribute, int[] cpos) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	/**
+	 * Computes for each position of an array the Id of the enclosing structural
+	 * attribute.
+	 *
+	 * @param attribute the attribute
+	 * @param cpos the positions
+	 * @return the IDs
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	public int[] cpos2Struc(String attribute, int[] cpos) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	/**
+	 * Computes for each position of an array the position of the left boundary
+	 * of the enclosing structural attribute.
+	 *
+	 * @param attribute the attribute
+	 * @param cpos the cpos
+	 * @return the positions of the left boundaries
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	public int[] cpos2LBound(String attribute, int[] cpos) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	/**
+	 * Computes for each position of an array the position of the right boundary
+	 * of the enclosing structural attribute.
+	 *
+	 * @param attribute the attribute
+	 * @param cpos the cpos
+	 * @return the positions of the right boundaries
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	public int[] cpos2RBound(String attribute, int[] cpos) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	/**
+	 * Computes for each position of an array the Id of the enclosing alignment
+	 * attribute.
+	 *
+	 * @param attribute the attribute
+	 * @param cpos the cpos
+	 * @return the int[]
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	public int[] cpos2Alg(String attribute, int[] cpos) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	/**
+	 * Retrieves annotated string values of structure regions in <strucs>; "" if
+	 * out of range.
+	 *
+	 * @param attribute the attribute
+	 * @param strucs the strucs
+	 * @return the string[]
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	public String[] struc2Str(String attribute, int[] strucs) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	/**
+	 * Retrieves all corpus positions where the given token occurs.
+	 *
+	 * @param attribute the attribute
+	 * @param id the id
+	 * @return the position
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	public int[] id2Cpos(String attribute, int id) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	/**
+	 * Retrieves all corpus positions where one of the tokens in <id_list>
+	 * occurs; the returned list is sorted as a whole, not per token id.
+	 *
+	 * @param attribute the attribute
+	 * @param ids the ids
+	 * @return the positions
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	public int[] idList2Cpos(String attribute, int[] ids) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	/**
+	 * Retrieves the lexicon IDs of all tokens that match <regex>; the returned
+	 * list may be empty (size 0).
+	 *
+	 * @param attribute the attribute
+	 * @param regex the regex
+	 * @return the IDs
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	public int[] regex2Id(String attribute, String regex) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	/**
+	 * Retrieves the start and end corpus positions of structure region <struc>.
+	 *
+	 * @param attribute the attribute
+	 * @param struc the struc
+	 * @return an array of size 2 containing the start and end positions
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	public int[] struc2Cpos(String attribute, int struc) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	/**
+	 * Retrieves start and end corpus positions of an alignement region in the
+	 * source and target corpora<struc>.
+	 *
+	 * @param attribute the attribute
+	 * @param struc the struc
+	 * @return an array of size 4 containing (src_start, src_end, target_start,
+	 * target_end)
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	public int[] alg2Cpos(String attribute, int struc) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	/**
+	 * Runs a CQP query.
+	 *
+	 * @param motherCorpus the mother corpus
+	 * @param subcorpus the subcorpus
+	 * @param query the query
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError the cqi server error
+	 */
+	public void cqpQuery(String motherCorpus, String subcorpus, String query) throws IOException, UnexpectedAnswerException, CqiServerError;
+
+	/**
+	 * Lists all the subcorpora of a corpus.
+	 *
+	 * @param corpus the corpus
+	 * @return the name of the subcorpora
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiCqpErrorNoSuchCorpus the cqi cqp error no such corpus
+	 */
+	public String[] listSubcorpora(String corpus) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	/**
+	 * Gives the size of a subcorpus .
+	 * 
+	 * @param subcorpus
+	 *            the subcorpus
+	 * 
+	 * @return the size
+	 * 
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException
+	 *             Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError
+	 *             the cqi server error
+	 */
+	public int subCorpusSize(String subcorpus) throws IOException,
+	UnexpectedAnswerException, CqiServerError;
+
+	/**
+	 * Checks wether a subcorpus has a field.
+	 * 
+	 * @param subcorpus
+	 *            the subcorpus
+	 * @param field CQI_CONST_FIELD_MATCH, CQI_CONST_FIELD_MATCHEND or CQI_CONST_FIELD_TARGET
+	 * 
+	 * @return true, if the subcorpus has the field
+	 * 
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException
+	 *             Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError
+	 *             the cqi server error
+	 */
+	public boolean subCorpusHasField(String subcorpus, byte field) throws IOException, UnexpectedAnswerException, CqiServerError;
+
+	/**
+	 * Dumps the values of <field> for match ranges <first> .. <last> in
+	 * <subcorpus>. <field> is one of the CQI_CONST_FIELD_* constants.
+	 * 
+	 * @param subcorpus
+	 *            the subcorpus
+	 * @param field CQI_CONST_FIELD_MATCH, CQI_CONST_FIELD_MATCHEND or CQI_CONST_FIELD_TARGET
+	 * @param first
+	 *            the first
+	 * @param last
+	 *            the last
+	 * 
+	 * @return the values
+	 * 
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException
+	 *             Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError
+	 *             the cqi server error
+	 */
+	public int[] dumpSubCorpus(String subcorpus, byte field, int first, int last) throws IOException, UnexpectedAnswerException,
+	CqiServerError;
+
+	/**
+	 * Drops a subcorpus.
+	 * 
+	 * @param subcorpus
+	 *            the subcorpus
+	 * 
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException
+	 *             Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError
+	 *             the cqi server error
+	 */
+	public void dropSubCorpus(String subcorpus) throws IOException,
+	UnexpectedAnswerException, CqiServerError;
+
+	/**
+	 * Returns <n> (id, frequency) pairs flattened into a list of size 2*<n> NB:
+	 * pairs are sorted by frequency desc.
+	 * 
+	 * @param subcorpus
+	 *            the subcorpus
+	 * @param cutoff
+	 *            the cutoff
+	 * @param field
+	 *            the field : one of CQI_CONST_FIELD_MATCH, CQI_CONST_FIELD_MATCHEND or CQI_CONST_FIELD_TARGET
+	 * @param attribute
+	 *            the attribute
+	 * 
+	 * @return the int[][]
+	 * 
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException
+	 *             Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError
+	 *             the cqi server error
+	 */
+	public int[][] fdist1(String subcorpus, int cutoff,
+			byte field, String attribute) throws IOException,
+			UnexpectedAnswerException, CqiServerError;
+
+	/**
+	 * Returns <n> (id1, id2, frequency) pairs flattened into a list of size
+	 * 3*<n> NB: triples are sorted by frequency desc. .
+	 * 
+	 * @param subcorpus
+	 *            the subcorpus
+	 * @param cutoff
+	 *            the cutoff
+	 * @param field1
+	 *            the field1
+	 * @param attribute1
+	 *            the attribute1
+	 * @param field2
+	 *            the field2
+	 * @param attribute2
+	 *            the attribute2
+	 * 
+	 * @return the int[]
+	 * 
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException
+	 *             Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError
+	 *             the cqi server error
+	 */
+	public int[][] fdist2(String subcorpus, int cutoff,
+			byte field1, String attribute1, byte field2, String attribute2) throws IOException, UnexpectedAnswerException, CqiServerError;
+
+	public boolean reconnect() ;
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/ICqiClient.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiCqpError.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiCqpError.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiCqpError.java	(revision 258)
@@ -0,0 +1,40 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.serverException;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class CqiCqpError.
+ */
+public class CqiCqpError extends CqiServerError {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 1L;
+	public CqiCqpError(){super();}
+	public CqiCqpError(String msg){super(msg);}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiCqpError.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiErrorGeneralError.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiErrorGeneralError.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiErrorGeneralError.java	(revision 258)
@@ -0,0 +1,40 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.serverException;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class CqiErrorGeneralError.
+ */
+public class CqiErrorGeneralError extends CqiServerError {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 1L;
+	public CqiErrorGeneralError(){super();}
+	public CqiErrorGeneralError(String msg){super(msg);}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiErrorGeneralError.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiClErrorOutOfRange.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiClErrorOutOfRange.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiClErrorOutOfRange.java	(revision 258)
@@ -0,0 +1,40 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.serverException;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class CqiClErrorOutOfRange.
+ */
+public class CqiClErrorOutOfRange extends CqiClError {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 1L;
+	public CqiClErrorOutOfRange(){super();}
+	public CqiClErrorOutOfRange(String msg){super(msg);}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiClErrorOutOfRange.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiClErrorRegex.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiClErrorRegex.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiClErrorRegex.java	(revision 258)
@@ -0,0 +1,40 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.serverException;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class CqiClErrorRegex.
+ */
+public class CqiClErrorRegex extends CqiClError {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 1L;
+	public CqiClErrorRegex(){super();}
+	public CqiClErrorRegex(String msg){super(msg);}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiClErrorRegex.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiCqpErrorSyntax.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiCqpErrorSyntax.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiCqpErrorSyntax.java	(revision 258)
@@ -0,0 +1,40 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2011-05-09 14:58:28 +0200 (lun., 09 mai 2011) $
+// $LastChangedRevision: 1839 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.serverException;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class CqiCqpErrorErrorGeneral.
+ */
+public class CqiCqpErrorSyntax extends CqiCqpError {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 1L;
+	public CqiCqpErrorSyntax(){super();}
+	public CqiCqpErrorSyntax(String msg){super(msg);}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiCqpErrorSyntax.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiClErrorInternal.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiClErrorInternal.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiClErrorInternal.java	(revision 258)
@@ -0,0 +1,40 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.serverException;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class CqiClErrorInternal.
+ */
+public class CqiClErrorInternal extends CqiClError {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 1L;
+	public CqiClErrorInternal(){super();}
+	public CqiClErrorInternal(String msg){super(msg);}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiClErrorInternal.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiCqpErrorErrorGeneral.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiCqpErrorErrorGeneral.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiCqpErrorErrorGeneral.java	(revision 258)
@@ -0,0 +1,40 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.serverException;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class CqiCqpErrorErrorGeneral.
+ */
+public class CqiCqpErrorErrorGeneral extends CqiCqpError {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 1L;
+	public CqiCqpErrorErrorGeneral(){super();}
+	public CqiCqpErrorErrorGeneral(String msg){super(msg);}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiCqpErrorErrorGeneral.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiClError.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiClError.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiClError.java	(revision 258)
@@ -0,0 +1,43 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.serverException;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The base class for all exceptions wrapping a CL based error sent by the CQi
+ * server.
+ *
+ * @author Jean-Philippe Magué
+ */
+public class CqiClError extends CqiServerError {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 1L;
+	public CqiClError(){super();}
+	public CqiClError(String msg){super(msg);}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiClError.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiCqpErrorInvalidField.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiCqpErrorInvalidField.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiCqpErrorInvalidField.java	(revision 258)
@@ -0,0 +1,40 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.serverException;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class CqiCqpErrorInvalidField.
+ */
+public class CqiCqpErrorInvalidField extends CqiCqpError {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 1L;
+	public CqiCqpErrorInvalidField(){super();}
+	public CqiCqpErrorInvalidField(String msg){super(msg);}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiCqpErrorInvalidField.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiCqpErrorNoSuchCorpus.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiCqpErrorNoSuchCorpus.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiCqpErrorNoSuchCorpus.java	(revision 258)
@@ -0,0 +1,40 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.serverException;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class CqiCqpErrorNoSuchCorpus.
+ */
+public class CqiCqpErrorNoSuchCorpus extends CqiCqpError {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 1L;
+	public CqiCqpErrorNoSuchCorpus(){super();}
+	public CqiCqpErrorNoSuchCorpus(String msg){super(msg);}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiCqpErrorNoSuchCorpus.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiErrorSyntaxError.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiErrorSyntaxError.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiErrorSyntaxError.java	(revision 258)
@@ -0,0 +1,40 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.serverException;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class CqiErrorSyntaxError.
+ */
+public class CqiErrorSyntaxError extends CqiServerError {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 1L;
+	public CqiErrorSyntaxError(){super();}
+	public CqiErrorSyntaxError(String msg){super(msg);}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiErrorSyntaxError.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiClErrorWrongAttributeType.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiClErrorWrongAttributeType.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiClErrorWrongAttributeType.java	(revision 258)
@@ -0,0 +1,40 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.serverException;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class CqiClErrorWrongAttributeType.
+ */
+public class CqiClErrorWrongAttributeType extends CqiClError {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 1L;
+	public CqiClErrorWrongAttributeType(){super();}
+	public CqiClErrorWrongAttributeType(String msg){super(msg);}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiClErrorWrongAttributeType.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiClErrorNoSuchAttribute.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiClErrorNoSuchAttribute.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiClErrorNoSuchAttribute.java	(revision 258)
@@ -0,0 +1,40 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.serverException;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class CqiClErrorNoSuchAttribute.
+ */
+public class CqiClErrorNoSuchAttribute extends CqiClError {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 1L;
+	public CqiClErrorNoSuchAttribute() {super();}
+	public CqiClErrorNoSuchAttribute(String msg) {super(msg);}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiClErrorNoSuchAttribute.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiClErrorOutOfMemory.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiClErrorOutOfMemory.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiClErrorOutOfMemory.java	(revision 258)
@@ -0,0 +1,40 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.serverException;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class CqiClErrorOutOfMemory.
+ */
+public class CqiClErrorOutOfMemory extends CqiClError {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 1L;
+	public CqiClErrorOutOfMemory(){super();}
+	public CqiClErrorOutOfMemory(String msg){super(msg);}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiClErrorOutOfMemory.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiErrorUserAbort.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiErrorUserAbort.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiErrorUserAbort.java	(revision 258)
@@ -0,0 +1,40 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.serverException;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class CqiErrorUserAbort.
+ */
+public class CqiErrorUserAbort extends CqiServerError {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 1L;
+	public CqiErrorUserAbort(){super();}
+	public CqiErrorUserAbort(String msg){super(msg);}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiErrorUserAbort.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiServerError.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiServerError.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiServerError.java	(revision 258)
@@ -0,0 +1,42 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.serverException;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The base class for all exceptions wrapping an error sent by teh CQi server.
+ *
+ * @author Jean-Philippe Magué
+ */
+public class CqiServerError extends Exception {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 1L;
+	public CqiServerError(){super();}
+	public CqiServerError(String msg){super(msg);}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiServerError.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/package.html
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/package.html	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Exceptions due to pure internal cqp server unexpected behaviour.</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiErrorConnectRefused.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiErrorConnectRefused.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiErrorConnectRefused.java	(revision 258)
@@ -0,0 +1,40 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.serverException;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class CqiErrorConnectRefused.
+ */
+public class CqiErrorConnectRefused extends CqiServerError {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 1L;
+	public CqiErrorConnectRefused(){super();}
+	public CqiErrorConnectRefused(String msg){super(msg);}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiErrorConnectRefused.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiClErrorCorpusAccess.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiClErrorCorpusAccess.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiClErrorCorpusAccess.java	(revision 258)
@@ -0,0 +1,40 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.serverException;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class CqiClErrorCorpusAccess.
+ */
+public class CqiClErrorCorpusAccess extends CqiClError {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 1L;
+	public CqiClErrorCorpusAccess(){super();}
+	public CqiClErrorCorpusAccess(String msg){super(msg);}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiClErrorCorpusAccess.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiCqpErrorOutOfRange.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiCqpErrorOutOfRange.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiCqpErrorOutOfRange.java	(revision 258)
@@ -0,0 +1,40 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.serverException;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class CqiCqpErrorOutOfRange.
+ */
+public class CqiCqpErrorOutOfRange extends CqiCqpError {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 1L;
+	public CqiCqpErrorOutOfRange(){super();}
+	public CqiCqpErrorOutOfRange(String msg){super(msg);}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/cqp/serverException/CqiCqpErrorOutOfRange.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/searchengine/package.html
===================================================================
--- tmp/org.txm.core/src/java/org/txm/searchengine/package.html	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/searchengine/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>All full text indexing, retrieving and querying functions of the toolbox.</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/java/org/txm/searchengine/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/kohsuke/args4j/Messages.java
===================================================================
--- tmp/org.txm.core/src/java/org/kohsuke/args4j/Messages.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/kohsuke/args4j/Messages.java	(revision 258)
@@ -0,0 +1,35 @@
+package org.kohsuke.args4j;
+
+import java.text.MessageFormat;
+import java.util.ResourceBundle;
+
+/**
+ * @author Kohsuke Kawaguchi
+ */
+enum Messages {
+    MISSING_OPERAND,
+    UNDEFINED_OPTION,
+    NO_ARGUMENT_ALLOWED,
+    REQUIRED_OPTION_MISSING,
+    TOO_MANY_ARGUMENTS,
+    REQUIRED_ARGUMENT_MISSING,
+    METADATA_ERROR,
+    MULTIPLE_USE_OF_ARGUMENT,
+    MULTIPLE_USE_OF_OPTION,
+    UNKNOWN_HANDLER,
+    NO_OPTIONHANDLER,
+    NO_CONSTRUCTOR_ON_HANDLER,
+    FORMAT_ERROR_FOR_MAP,
+    MAP_HAS_NO_KEY, UNDEFINNED_WIDGET
+    ;
+
+    private static ResourceBundle rb;
+
+    public String format( Object... args ) {
+        synchronized(Messages.class) {
+            if(rb==null)
+                rb = ResourceBundle.getBundle(Messages.class.getName());
+            return MessageFormat.format(rb.getString(name()),args);
+        }
+    }
+}

Property changes on: tmp/org.txm.core/src/java/org/kohsuke/args4j/Messages.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/kohsuke/args4j/Option.java
===================================================================
--- tmp/org.txm.core/src/java/org/kohsuke/args4j/Option.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/kohsuke/args4j/Option.java	(revision 258)
@@ -0,0 +1,178 @@
+package org.kohsuke.args4j;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.io.File;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+import java.lang.reflect.AccessibleObject;
+import java.util.ResourceBundle;
+
+import org.kohsuke.args4j.spi.OptionHandler;
+
+/**
+ * Marks a field/setter that receives a command line switch value.
+ *
+ * <p>
+ * This annotation can be placed on a field of type T or the method
+ * of the form <tt>void <i>methodName</i>(T value)</tt>. Its access
+ * modified can be anything, but if it's not public, your application
+ * needs to run in a security context that allows args4j to access
+ * the field/method (see {@link AccessibleObject#setAccessible(boolean)}.
+ *
+ * <p>
+ * The behavior of the annotation differs depending on T --- the type
+ * of the field or the parameter of the method.
+ *
+ * <h2>Boolean Switch</h2>
+ * <p>
+ * When T is boolean , it represents
+ * a boolean option that takes the form of "-OPT". When this option is set,
+ * the property will be set to true.
+ *
+ * <h2>String Switch</h2>
+ * <p>
+ * When T is {@link String}, it represents
+ * an option that takes one operand. The value of the operand is set
+ * to the property.
+ *
+ * <h2>Enum Switch</h2>
+ * <p>
+ * When T is derived from {@link Enum}, it represents an option that takes
+ * an operand, which must be one of the enum constant. The comparion between
+ * the operand and the enum constant name is done in a case insensitive fashion.
+ * <p>
+ * For example, the following definition will represent command line options
+ * like "-coin penny" or "-coin DIME" but things like "-coin" or "-coin abc" are
+ * errors.
+ *
+ * <pre>
+ * enum Coin { PENNY,NICKEL,DIME,QUARTER }
+ *
+ * class Option {
+ *   &#64;Option(name="-coin")
+ *   public Coin coin;
+ * }
+ * </pre>
+ *
+ * <h2>File Switch</h2>
+ * <p>
+ * When T is a {@link File}, it represents an option that takes a file/directory
+ * name as an operand.
+ *
+ * @author Kohsuke Kawaguchi
+ */
+@Retention(RUNTIME)
+@Target({FIELD,METHOD,PARAMETER})
+public @interface Option {
+    /**
+     * Name of the option, such as "-foo" or "-bar".
+     */
+    String name();
+    
+    /**
+     * Widget to use in an UI, such as Query, File, Folder, String, Text, Boolean, Integer, Float et Date.
+     */
+    String widget() default "String";
+    
+    /**
+     * default value as String
+     */
+	String def() default "";
+    
+    /**
+     * Aliases for the options, such as "--long-option-name".
+     */
+    String[] aliases() default { };
+
+    /**
+     * Help string used to display the usage screen.
+     *
+     * <p>
+     * This parameter works in two ways. For a simple use,
+     * you can just encode the human-readable help string directly,
+     * and that will be used as the message. This is easier,
+     * but it doesn't support localization.
+     *
+     * <p>
+     * For more advanced use, this property is set to a key of a
+     * {@link ResourceBundle}. The actual message is obtained
+     * by querying a {@link ResourceBundle} instance supplied to
+     * {@link CmdLineParser} by this key. This allows the usage
+     * screen to be properly localized.
+     *
+     * <p>
+     * If this value is empty, the option will not be displayed
+     * in the usage screen.
+     */
+    String usage() default "";
+
+    /**
+     * When the option takes an operand, the usage screen will show something like this:
+     * <pre>
+     * -x FOO  : blah blah blah
+     * </pre>
+     * You can replace the 'FOO' token by using this parameter.
+     *
+     * <p>
+     * If left unspecifiied, this value is infered from the type of the option.
+     *
+     * <p>
+     * Just like {@link #usage()}, normally, this value is printed as is.
+     * But if a {@link ResourceBundle} is given to the {@link CmdLineParser},
+     * it will be used to obtain the locale-specific value.
+     */
+    String metaVar() default "";
+
+    /**
+     * Specify that the option is mandatory.
+     *
+     * <p>
+     * At the end of {@link CmdLineParser#parseArgument(String...)},
+     * a {@link CmdLineException} will be thrown if a required option
+     * is not present.
+     *
+     * <p>
+     * Note that in most of the command line interface design principles,
+     * options should be really optional. So use caution when using this
+     * flag.
+     */
+    boolean required() default false;
+
+    /**
+     * Specify the {@link OptionHandler} that processes the command line arguments.
+     *
+     * <p>
+     * The default value {@link OptionHandler} indicates that
+     * the {@link OptionHandler} will be infered from
+     * the type of the field/method where a {@link Option} annotation
+     * is placed.
+     *
+     * <p>
+     * If this annotation element is used, it overrides the inference
+     * and determines the handler to be used. This is convenient for
+     * defining a non-standard option parsing semantics.
+     *
+     * <h3>Example</h3>
+     * <pre>
+     * // this is a normal "-r" option
+     * &#64;Option(name="-r")
+     * boolean value;
+     *
+     * // this causes arg4j to use MyHandler, not the default
+     * // handler provided for boolean
+     * &#64;Option(name="-b",handler=MyHandler.class)
+     * boolean value;
+     * </pre>
+     */
+    Class<? extends OptionHandler> handler() default OptionHandler.class;
+    
+    /**
+     * Whether the option is multi-valued.
+     * For mappings to List<...>, this defaults to true, otherwise false 
+     */
+    boolean multiValued() default false;
+}

Property changes on: tmp/org.txm.core/src/java/org/kohsuke/args4j/Option.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/ArgumentImpl.java
===================================================================
--- tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/ArgumentImpl.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/ArgumentImpl.java	(revision 258)
@@ -0,0 +1,13 @@
+package org.kohsuke.args4j.spi;
+
+import org.kohsuke.args4j.Argument;
+
+/**
+ * Implementation of @Argument so we can instantiate it.
+ * @author Jan Materne
+ */
+public class ArgumentImpl extends AnnotationImpl implements Argument {
+	public ArgumentImpl(ConfigElement ce) throws ClassNotFoundException {
+		super(Argument.class,ce);
+	}
+}
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/ArgumentImpl.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/MapOptionHandler.java
===================================================================
--- tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/MapOptionHandler.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/MapOptionHandler.java	(revision 258)
@@ -0,0 +1,32 @@
+package org.kohsuke.args4j.spi;
+
+import java.util.Map;
+
+import org.kohsuke.args4j.CmdLineException;
+import org.kohsuke.args4j.CmdLineParser;
+import org.kohsuke.args4j.MapSetter;
+import org.kohsuke.args4j.OptionDef;
+
+public class MapOptionHandler extends OptionHandler<Map<?,?>> {
+
+	public MapOptionHandler(CmdLineParser parser, OptionDef option, Setter<? super Map<?,?>> setter) {
+		super(parser, option, setter);
+	}
+
+	@Override
+	public String getDefaultMetaVariable() {
+		return null;
+	}
+
+	@Override
+	public int parseArguments(Parameters params) throws CmdLineException {
+		MapSetter mapSetter = (MapSetter)setter;
+		try {
+			mapSetter.addValue(params.getParameter(0));
+		} catch (RuntimeException e) {
+			throw new CmdLineException(owner, e.getMessage());
+		}
+        return 1;
+	}
+
+}

Property changes on: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/MapOptionHandler.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/BooleanOptionHandler.java
===================================================================
--- tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/BooleanOptionHandler.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/BooleanOptionHandler.java	(revision 258)
@@ -0,0 +1,43 @@
+package org.kohsuke.args4j.spi;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.kohsuke.args4j.CmdLineException;
+import org.kohsuke.args4j.CmdLineParser;
+import org.kohsuke.args4j.OptionDef;
+
+/**
+ * Boolean {@link OptionHandler}.
+ * 
+ * @author Kohsuke Kawaguchi
+ */
+public class BooleanOptionHandler extends OptionHandler<Boolean> {
+	private static final List<String> ACCEPTABLE_VALUES = Arrays.asList(new String[] { "true", "on", "yes", "1", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+			"false", "off", "no", "0" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+	
+	public BooleanOptionHandler(CmdLineParser parser, OptionDef option, Setter<? super Boolean> setter) {
+        super(parser, option, setter);
+    }
+
+    @Override
+    public int parseArguments(Parameters params) throws CmdLineException {
+    	if (option.isArgument()) {
+    		String valueStr = params.getParameter(0).toLowerCase();
+    		int index = ACCEPTABLE_VALUES.indexOf(valueStr);
+    		if (index == -1) {
+    			throw new CmdLineException(owner, Messages.ILLEGAL_BOOLEAN.format(valueStr));
+    		}
+    		setter.addValue(index < ACCEPTABLE_VALUES.size() / 2);
+    		return 1;
+    	} else {
+    		setter.addValue(true);
+    		return 0;
+    	}
+    }
+
+    @Override
+    public String getDefaultMetaVariable() {
+        return null;
+    }
+}

Property changes on: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/BooleanOptionHandler.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/Messages.java
===================================================================
--- tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/Messages.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/Messages.java	(revision 258)
@@ -0,0 +1,27 @@
+package org.kohsuke.args4j.spi;
+
+import java.text.MessageFormat;
+import java.util.ResourceBundle;
+
+/**
+ * @author Kohsuke Kawaguchi
+ */
+enum Messages {
+    ILLEGAL_OPERAND,
+    ILLEGAL_CHAR,
+    ILLEGAL_BOOLEAN,
+    ILLEGAL_METHOD_SIGNATURE,
+    ILLEGAL_FIELD_SIGNATURE,
+    ILLEGAL_LIST
+    ;
+
+    private static ResourceBundle rb;
+
+    public String format( Object... args ) {
+        synchronized(Messages.class) {
+            if(rb==null)
+                rb = ResourceBundle.getBundle(Messages.class.getName());
+            return MessageFormat.format(rb.getString(name()),args);
+        }
+    }
+}

Property changes on: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/Messages.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/FieldSetter.java
===================================================================
--- tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/FieldSetter.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/FieldSetter.java	(revision 258)
@@ -0,0 +1,42 @@
+package org.kohsuke.args4j.spi;
+
+import org.kohsuke.args4j.spi.Setter;
+
+import java.lang.reflect.Field;
+
+/**
+ * {@link Setter} that sets to a {@link Field}.
+ *
+ * @author Kohsuke Kawaguchi
+ */
+final class FieldSetter implements Setter {
+    private final Field f;
+    private final Object bean;
+
+    public FieldSetter(Object bean, Field f) {
+        this.bean = bean;
+        this.f = f;
+    }
+
+    public Class getType() {
+        return f.getType();
+    }
+    
+    public boolean isMultiValued() {
+    	return false;
+    }
+
+    public void addValue(Object value) {
+        try {
+            f.set(bean,value);
+        } catch (IllegalAccessException _) {
+            // try again
+            f.setAccessible(true);
+            try {
+                f.set(bean,value);
+            } catch (IllegalAccessException e) {
+                throw new IllegalAccessError(e.getMessage());
+            }
+        }
+    }
+}

Property changes on: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/FieldSetter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/OneArgumentOptionHandler.java
===================================================================
--- tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/OneArgumentOptionHandler.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/OneArgumentOptionHandler.java	(revision 258)
@@ -0,0 +1,47 @@
+package org.kohsuke.args4j.spi;
+
+import org.kohsuke.args4j.CmdLineException;
+import org.kohsuke.args4j.CmdLineParser;
+import org.kohsuke.args4j.OptionDef;
+
+/**
+ * OptionHandler which handles an option with exactly one argument, like "-foo bar".
+ * @author Jan Materne
+ * @since 2.0.9
+ * @param <T> Type of the Setter-class
+ */
+public abstract class OneArgumentOptionHandler<T> extends OptionHandler<T> {
+
+	public OneArgumentOptionHandler(CmdLineParser parser, OptionDef option, Setter<? super T> setter) {
+		super(parser, option, setter);
+	}
+	
+	@Override
+	public String getDefaultMetaVariable() {
+		return "N"; //$NON-NLS-1$
+	}
+
+	@Override
+	public int parseArguments(Parameters params) throws CmdLineException {
+        String token = params.getParameter(0);
+        try {
+            T value = parse(token);
+            setter.addValue(value);
+        }
+        catch (NumberFormatException ex) {
+            throw new CmdLineException(owner, Messages.ILLEGAL_OPERAND.format(params.getParameter(-1),token));
+        }
+        return 1;
+	}	
+	
+	/**
+	 * Parses a string to a real value of Type &lt;T&gt;.
+	 * @param argument String value to parse
+	 * @return the parsed value
+	 * @throws NumberFormatException if parsing is not possible
+     * @throws CmdLineException
+     *      if the parsing encounters a failure that should be reported to the user.
+	 */
+	protected abstract T parse(String argument) throws NumberFormatException, CmdLineException;
+
+}

Property changes on: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/OneArgumentOptionHandler.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/StopOptionHandler.java
===================================================================
--- tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/StopOptionHandler.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/StopOptionHandler.java	(revision 258)
@@ -0,0 +1,49 @@
+package org.kohsuke.args4j.spi;
+
+import org.kohsuke.args4j.CmdLineException;
+import org.kohsuke.args4j.CmdLineParser;
+import org.kohsuke.args4j.OptionDef;
+
+/**
+ * {@link OptionHandler} for the option terminator "--".
+ *
+ * <p>
+ * This {@link OptionHandler} can be used to implement the special token
+ * "--" that indicates that the rest of tokens are not options, but arguments.
+ *
+ * <p>
+ * For example, if you have the following class:
+ *
+ * <pre>
+ * class Foo {
+ *   &#64;Argument
+ *   &#64;Option(name="--",handler={@link StopOptionHandler}.class)
+ *   List&lt;String> args;
+ *
+ *   &#64;Option(name="-n")
+ *   int n;
+ * }
+ * </pre>
+ *
+ * <p>
+ * The command line {@code -n 5 abc def} would parse into n=5, args={"abc",def"},
+ * but {@code -- -n 5 abc def} would parse into n=0, args={"-n","5","abc","def"}.
+ *
+ * @author Kohsuke Kawaguchi
+ */
+public class StopOptionHandler extends OptionHandler<String> {
+    public StopOptionHandler(CmdLineParser parser, OptionDef option, Setter<? super String> setter) {
+        super(parser, option, setter);
+    }
+
+    @Override
+    public int parseArguments(Parameters params) throws CmdLineException {
+    	owner.stopOptionParsing();
+    	return 0;
+    }
+
+    @Override
+    public String getDefaultMetaVariable() {
+        return "ARGUMENTS"; //$NON-NLS-1$
+    }
+}

Property changes on: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/StopOptionHandler.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/package.html
===================================================================
--- tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/package.html	(revision 0)
+++ tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html><body>
+<p>
+Classes for extending the behavior of args4j.
+</p>
+</body></html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/MultiValueFieldSetter.java
===================================================================
--- tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/MultiValueFieldSetter.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/MultiValueFieldSetter.java	(revision 258)
@@ -0,0 +1,70 @@
+package org.kohsuke.args4j.spi;
+
+import org.kohsuke.args4j.spi.Setter;
+import org.kohsuke.args4j.*;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * {@link Setter} that sets multiple values to a collection {@link Field}.
+ *
+ * @author Kohsuke Kawaguchi
+ */
+final class MultiValueFieldSetter  implements Setter {
+    private final Object bean;
+    private final Field f;
+
+    public MultiValueFieldSetter(Object bean, Field f) {
+        this.bean = bean;
+        this.f = f;
+
+        if(!List.class.isAssignableFrom(f.getType()))
+            throw new IllegalAnnotationError(Messages.ILLEGAL_FIELD_SIGNATURE.format(f.getType()));
+    }
+
+    public boolean isMultiValued() {
+    	return true;
+    }
+
+    public Class getType() {
+        // TODO: compute this correctly
+        Type t = f.getGenericType();
+        if(t instanceof ParameterizedType) {
+            ParameterizedType pt = (ParameterizedType)t;
+            t = pt.getActualTypeArguments()[0];
+            if(t instanceof Class)
+                return (Class)t;
+        }
+        return Object.class;
+    }
+
+    public void addValue(Object value) {
+        try {
+            doAddValue(bean, value);
+        } catch (IllegalAccessException _) {
+            // try again
+            f.setAccessible(true);
+            try {
+                doAddValue(bean,value);
+            } catch (IllegalAccessException e) {
+                throw new IllegalAccessError(e.getMessage());
+            }
+        }
+    }
+
+    private void doAddValue(Object bean, Object value) throws IllegalAccessException {
+        Object o = f.get(bean);
+        if(o==null) {
+            o = new ArrayList();
+            f.set(bean,o);
+        }
+        if(!(o instanceof List))
+            throw new IllegalAnnotationError(Messages.ILLEGAL_LIST.format(f));
+
+        ((List)o).add(value);
+    }
+}

Property changes on: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/MultiValueFieldSetter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/Messages.properties
===================================================================
--- tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/Messages.properties	(revision 0)
+++ tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/Messages.properties	(revision 258)
@@ -0,0 +1,12 @@
+ILLEGAL_OPERAND = \
+    "{1}" is not a valid value for "{0}"
+ILLEGAL_BOOLEAN = \
+	"{0}" is not a legal boolean value
+ILLEGAL_CHAR = \
+    "{0}" must be a single character
+ILLEGAL_METHOD_SIGNATURE = \
+    Method {0} takes more than one parameter
+ILLEGAL_FIELD_SIGNATURE = \
+    Field of type {0} isn''t supported by args4j
+ILLEGAL_LIST = \
+    type of {0} is not a List
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/Messages.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/ShortOptionHandler.java
===================================================================
--- tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/ShortOptionHandler.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/ShortOptionHandler.java	(revision 258)
@@ -0,0 +1,24 @@
+package org.kohsuke.args4j.spi;
+
+import org.kohsuke.args4j.CmdLineParser;
+import org.kohsuke.args4j.OptionDef;
+
+/**
+ * {@link Short}
+ * {@link OptionHandler}
+ * {@link OneArgumentOptionHandler}
+ * @author Jan Materne
+ * @since 2.0.9
+ */
+public class ShortOptionHandler extends OneArgumentOptionHandler<Short> {
+
+	public ShortOptionHandler(CmdLineParser parser, OptionDef option, Setter<? super Short> setter) {
+		super(parser, option, setter);
+	}
+
+	@Override
+	protected Short parse(String argument) throws NumberFormatException {
+		return Short.parseShort(argument);
+	}
+
+}

Property changes on: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/ShortOptionHandler.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/Messages_de.properties
===================================================================
--- tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/Messages_de.properties	(revision 0)
+++ tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/Messages_de.properties	(revision 258)
@@ -0,0 +1,20 @@
+# Unicode for Umlauts
+#   Ae, ae     \u00c4, \u00e4
+#   Oe, oe     \u00d6, \u00f6
+#   Ue, ue     \u00dc, \u00fc
+#   ss         \u00df
+
+
+
+ILLEGAL_METHOD_SIGNATURE = \
+    Methode {0} ben\u00f6tigt mehr als einen Parameter
+ILLEGAL_FIELD_SIGNATURE = \
+    Der Datentyp {0} wird von args4j nicht unterst\u00fctzt
+ILLEGAL_OPERAND = \
+    "{1}" ist kein g\u00fcltiger Wert f\u00fcr "{0}"
+ILLEGAL_BOOLEAN = \
+	"{0}" ist kein g\u00fcltiger Boolscher Wert
+ILLEGAL_CHAR = \
+    "{0}" muss ein einzelnes Zeichen sein
+ILLEGAL_LIST = \
+    Der Typ von {0} ist keine List
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/Messages_de.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/OptionImpl.java
===================================================================
--- tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/OptionImpl.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/OptionImpl.java	(revision 258)
@@ -0,0 +1,28 @@
+package org.kohsuke.args4j.spi;
+
+import org.kohsuke.args4j.Option;
+
+/**
+ * Implementation of @Option so we can instantiate it.
+ * @author Jan Materne
+ */
+public class OptionImpl extends AnnotationImpl implements Option {
+	public OptionImpl(ConfigElement ce) throws ClassNotFoundException {
+		super(Option.class,ce);
+		name = ce.name;
+	}
+	public String name;
+	public String name() {
+		return name;
+	}
+	@Override
+	public String widget() {
+		// TODO Auto-generated method stub
+		return ""; //$NON-NLS-1$
+	}
+	@Override
+	public String def() {
+		// TODO Auto-generated method stub
+		return ""; //$NON-NLS-1$
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/OptionImpl.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/FloatOptionHandler.java
===================================================================
--- tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/FloatOptionHandler.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/FloatOptionHandler.java	(revision 258)
@@ -0,0 +1,26 @@
+package org.kohsuke.args4j.spi;
+
+import org.kohsuke.args4j.CmdLineParser;
+import org.kohsuke.args4j.OptionDef;
+
+/**
+ * {@link Float} 
+ * {@link OptionHandler}
+ * {@link OneArgumentOptionHandler}
+ * 
+ * @author Jan Materne
+ * @since 2.0.9
+ */
+public class FloatOptionHandler extends OneArgumentOptionHandler<Float> {
+
+	public FloatOptionHandler(CmdLineParser parser, OptionDef option,
+			Setter<? super Float> setter) {
+		super(parser, option, setter);
+	}
+
+	@Override
+	protected Float parse(String argument) throws NumberFormatException {
+		return Float.parseFloat(argument);
+	}
+
+}

Property changes on: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/FloatOptionHandler.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/StringArrayOptionHandler.java
===================================================================
--- tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/StringArrayOptionHandler.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/StringArrayOptionHandler.java	(revision 258)
@@ -0,0 +1,79 @@
+package org.kohsuke.args4j.spi;
+
+import org.kohsuke.args4j.CmdLineException;
+import org.kohsuke.args4j.CmdLineParser;
+import org.kohsuke.args4j.OptionDef;
+
+import java.util.ArrayList;
+
+/**
+ * <p>
+ * An {@link OptionHandler} for handling {@link String[]} types. Can handle arrays of strings.
+ * </p>
+ * <p>
+ * <h1>How it works:</h1>
+ * Example for parameter -s, which is String[] type:<br>
+ * java -jar aaa.jar -s banan hruska jablko<br>
+ * java -jar aaa.jar -s banan "hruska jablko"<br>
+ * java -jar aaa.jar -s "banan hruska jablko"<br>
+ * java -jar aaa.jar -s banan hruska jablko -l 4 -r<br>
+ * java -jar aaa.jar -t 222 -s banan hruska jablko -r<br><br>
+ * It will handle all of these posibilites. This OptionHandler scans for parameter which begins
+ * with "-". If it found it, it will stop.
+ * </p>
+ *
+ * @author PlainText,LuVar
+ *
+ */
+public class StringArrayOptionHandler extends OptionHandler<String[]> {
+
+	public StringArrayOptionHandler(CmdLineParser parser, OptionDef option, Setter<? super String[]> setter) {
+		super(parser, option, setter);
+	}
+
+	/**
+	 * <p>
+	 * Returns "STRING[]".
+	 * </p>
+	 *
+	 * @return	return "STRING[]";
+	 */
+	@Override
+	public String getDefaultMetaVariable() {
+		return "STRING[]"; //$NON-NLS-1$
+	}
+
+	/**
+	 * <p>
+	 * Tryies to parse String[] argument from {@link Parameters}.
+	 * </p>
+	 */
+	@Override
+	public int parseArguments(Parameters params) throws CmdLineException {
+		int counter = 0;
+		ArrayList<String> values = new ArrayList<String>();
+		while(true) {
+			String param;
+			try {
+				param = params.getParameter(counter);
+			} catch (CmdLineException ex) {
+				break;
+			}
+			if(param.startsWith("-")) { //$NON-NLS-1$
+				break;
+			}
+
+			for (String str : param.split(" ")) { //$NON-NLS-1$
+				values.add(str);
+			}
+			counter++;
+		}//while true
+
+        // to work around a javac bug in Java1.5, we need to first assign this to
+        // the raw type.
+        Setter s = this.setter;
+        s.addValue(values.toArray(new String[values.size()]));
+		return counter;
+	}
+
+}

Property changes on: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/StringArrayOptionHandler.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/DoubleOptionHandler.java
===================================================================
--- tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/DoubleOptionHandler.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/DoubleOptionHandler.java	(revision 258)
@@ -0,0 +1,21 @@
+package org.kohsuke.args4j.spi;
+
+import org.kohsuke.args4j.CmdLineParser;
+import org.kohsuke.args4j.OptionDef;
+
+/**
+ * {@link Double} 
+ * {@link OptionHandler}.
+ * {@link OneArgumentOptionHandler}
+ * @author Leif Wickland
+ */
+public class DoubleOptionHandler extends OneArgumentOptionHandler<Double> {
+    public DoubleOptionHandler(CmdLineParser parser, OptionDef option, Setter<? super Double> setter) {
+        super(parser, option, setter);
+    }
+
+    @Override
+    protected Double parse(String argument) throws NumberFormatException {
+    	return Double.parseDouble(argument);
+    }
+}

Property changes on: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/DoubleOptionHandler.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/CharOptionHandler.java
===================================================================
--- tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/CharOptionHandler.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/CharOptionHandler.java	(revision 258)
@@ -0,0 +1,28 @@
+package org.kohsuke.args4j.spi;
+
+import org.kohsuke.args4j.CmdLineParser;
+import org.kohsuke.args4j.OptionDef;
+import org.kohsuke.args4j.CmdLineException;
+
+import java.text.MessageFormat;
+
+/**
+ * {@link Char}
+ * {@link OptionHandler}
+ * {@link OneArgumentOptionHandler}
+ * @author Jan Materne
+ * @since 2.0.9
+ */
+public class CharOptionHandler extends OneArgumentOptionHandler<Character> {
+
+	public CharOptionHandler(CmdLineParser parser, OptionDef option, Setter<? super Character> setter) {
+		super(parser, option, setter);
+	}
+
+	@Override
+	protected Character parse(String argument) throws NumberFormatException, CmdLineException {
+        if (argument.length() != 1)
+            throw new CmdLineException(owner, Messages.ILLEGAL_CHAR.format(argument));
+        return argument.charAt(0);
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/CharOptionHandler.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/DateOptionHandler.java
===================================================================
--- tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/DateOptionHandler.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/DateOptionHandler.java	(revision 258)
@@ -0,0 +1,33 @@
+package org.kohsuke.args4j.spi;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import org.kohsuke.args4j.CmdLineParser;
+import org.kohsuke.args4j.OptionDef;
+
+/**
+ * {@link Date} 
+ * {@link OptionHandler}.
+ * {@link OneArgumentOptionHandler}
+ * 
+ * @author Kohsuke Kawaguchi
+ */
+public class DateOptionHandler extends OneArgumentOptionHandler<Date> {
+	public static SimpleDateFormat formater = new SimpleDateFormat("yyyy-MM-dd"); //$NON-NLS-1$
+	public DateOptionHandler(CmdLineParser parser, OptionDef option, Setter<? super Date> setter) {
+		super(parser, option, setter);
+	}
+
+	@Override
+	protected Date parse(String argument) throws NumberFormatException {
+		try {
+			return formater.parse(argument);
+		} catch (ParseException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+			return new Date();
+		}
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/DateOptionHandler.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/Setter.java
===================================================================
--- tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/Setter.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/Setter.java	(revision 258)
@@ -0,0 +1,29 @@
+package org.kohsuke.args4j.spi;
+
+import org.kohsuke.args4j.CmdLineException;
+
+/**
+ * Abstraction of the value setter.
+ *
+ * @author Kohsuke Kawaguchi
+ */
+public interface Setter<T> {
+    /**
+     * Adds/sets a value to the property of the option bean.
+     *
+     * <p>
+     * A {@link Setter} object has an implicit knowledge about the property it's setting,
+     * and the instance of the option bean.
+     */
+    void addValue(T value) throws CmdLineException;
+
+    /**
+     * Gets the type of the underlying method/field.
+     */
+    Class<T> getType();
+    
+    /**
+     * Whether this setter is instrinsically multi-valued.
+     */
+    boolean isMultiValued();
+}

Property changes on: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/Setter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/OptionHandler.java
===================================================================
--- tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/OptionHandler.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/OptionHandler.java	(revision 258)
@@ -0,0 +1,94 @@
+package org.kohsuke.args4j.spi;
+
+import java.util.ResourceBundle;
+
+import org.kohsuke.args4j.OptionDef;
+import org.kohsuke.args4j.CmdLineException;
+import org.kohsuke.args4j.CmdLineParser;
+import org.kohsuke.args4j.NamedOptionDef;
+
+
+/**
+ * Code that parses operands of an option into Java.
+ *
+ * <p>
+ * This class can be extended by application to support additional Java datatypes in option operands.
+ *
+ * <p>
+ * Implementation of this class needs to be registered to args4j by using
+ * {@link CmdLineParser#registerHandler(Class,Class)} 
+ *
+ * @param <T>
+ *      The type of the field that this {@link OptionHandler} works with.
+ *
+ * @author Kohsuke Kawaguchi
+ */
+public abstract class OptionHandler<T> {
+    /**
+     * The annotation.
+     */
+    public final OptionDef option;
+    /**
+     * Object to be used for setting value.
+     */
+    public final Setter<? super T> setter;
+    /**
+     * The owner to which this handler belongs to.
+     */
+    public final CmdLineParser owner;
+
+    protected OptionHandler(CmdLineParser parser, OptionDef option, Setter<? super T> setter) {
+        this.owner = parser;
+        this.option = option;
+        this.setter = setter;
+    }
+
+    /**
+     * Called if the option that this owner recognizes is found.
+     *
+     * @param params
+     *      The rest of the arguments. This method can use this
+     *      object to access the arguments of the option if necessary.
+     *
+     *      The object is valid only during the method call.
+     *
+     * @return
+     *      The number of arguments consumed. For example, return 0
+     *      if this option doesn't take any parameter.
+     */
+    public abstract int parseArguments( Parameters params ) throws CmdLineException;
+
+    /**
+     * Gets the default meta variable name used to print the usage screen.
+     *
+     * @return null to hide a meta variable.
+     */
+    public abstract String getDefaultMetaVariable();
+
+    public final String getMetaVariable(ResourceBundle rb) {
+        String token = option.metaVar();
+        if(token.length()==0)
+            token = getDefaultMetaVariable();
+        if(token==null) return null;
+
+        if(rb!=null) {
+            String localized = rb.getString(token);
+            if(localized!=null)
+                token = localized;
+        }
+
+        return token;
+    }
+    
+    public final String getNameAndMeta(ResourceBundle rb) {
+    	String str = option.isArgument() ? "" : option.toString();  //$NON-NLS-1$
+    	String meta = getMetaVariable(rb);
+    	if (meta != null) {
+    		if (str.length() > 0) {
+    			str += " "; //$NON-NLS-1$
+    		}
+    		str += meta;
+    	}
+    	return str;
+    }
+}

Property changes on: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/OptionHandler.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/FileOptionHandler.java
===================================================================
--- tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/FileOptionHandler.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/FileOptionHandler.java	(revision 258)
@@ -0,0 +1,29 @@
+package org.kohsuke.args4j.spi;
+
+import java.io.File;
+
+import org.kohsuke.args4j.OptionDef;
+import org.kohsuke.args4j.CmdLineException;
+import org.kohsuke.args4j.CmdLineParser;
+
+/**
+ * {@link File} {@link OptionHandler}.
+ *
+ * @author Kohsuke Kawaguchi
+ */
+public class FileOptionHandler extends OptionHandler<File> {
+    public FileOptionHandler(CmdLineParser parser, OptionDef option, Setter<? super File> setter) {
+        super(parser, option, setter);
+    }
+
+    @Override
+    public int parseArguments(Parameters params) throws CmdLineException {
+        setter.addValue(new File(params.getParameter(0)));
+        return 1;
+    }
+
+    @Override
+    public String getDefaultMetaVariable() {
+        return "FILE"; //$NON-NLS-1$
+    }
+}

Property changes on: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/FileOptionHandler.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/MethodSetter.java
===================================================================
--- tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/MethodSetter.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/MethodSetter.java	(revision 258)
@@ -0,0 +1,64 @@
+package org.kohsuke.args4j.spi;
+
+import org.kohsuke.args4j.spi.Setter;
+import org.kohsuke.args4j.*;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+/**
+ * {@link Setter} that sets to a {@link Method}.
+ *
+ * @author Kohsuke Kawaguchi
+ */
+public final class MethodSetter implements Setter {
+    private final CmdLineParser parser;
+    private final Object bean;
+    private final Method m;
+
+    public MethodSetter(CmdLineParser parser, Object bean, Method m) {
+        this.parser = parser;
+        this.bean = bean;
+        this.m = m;
+        if(m.getParameterTypes().length!=1)
+            throw new IllegalAnnotationError(Messages.ILLEGAL_METHOD_SIGNATURE.format(m));
+    }
+
+    public Class getType() {
+        return m.getParameterTypes()[0];
+    }
+
+    public boolean isMultiValued() {
+    	return false;
+    }
+
+    public void addValue(Object value) throws CmdLineException {
+        try {
+            try {
+                m.invoke(bean,value);
+            } catch (IllegalAccessException _) {
+                // try again
+                m.setAccessible(true);
+                try {
+                    m.invoke(bean,value);
+                } catch (IllegalAccessException e) {
+                    throw new IllegalAccessError(e.getMessage());
+                }
+            }
+        } catch (InvocationTargetException e) {
+            Throwable t = e.getTargetException();
+            if(t instanceof RuntimeException)
+                throw (RuntimeException)t;
+            if(t instanceof Error)
+                throw (Error)t;
+            if(t instanceof CmdLineException)
+                throw (CmdLineException)t;
+
+            // otherwise wrap
+            if(t!=null)
+                throw new CmdLineException(parser, t);
+            else
+                throw new CmdLineException(parser, e);
+        }
+    }
+}

Property changes on: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/MethodSetter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/ExplicitBooleanOptionHandler.java
===================================================================
--- tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/ExplicitBooleanOptionHandler.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/ExplicitBooleanOptionHandler.java	(revision 258)
@@ -0,0 +1,64 @@
+package org.kohsuke.args4j.spi;
+
+import static java.lang.Boolean.FALSE;
+import static java.lang.Boolean.TRUE;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.kohsuke.args4j.CmdLineException;
+import org.kohsuke.args4j.CmdLineParser;
+import org.kohsuke.args4j.OptionDef;
+
+/**
+ * Boolean {@link OptionHandler} that (unlike the standard {@link BooleanOptionHandler}
+ * allows values to be set to false explicitly (using e.g. '-myOpt false') rather
+ * than only returning false when the option is <em>omitted</em>.
+ */
+public class ExplicitBooleanOptionHandler extends OptionHandler<Boolean> {
+    // same values as BooleanOptionHandler
+    private static final Map<String, Boolean> ACCEPTABLE_VALUES;
+    
+    static {
+        // I like the trick in BooleanOptionHandler but find this explicit map more readable
+        ACCEPTABLE_VALUES = new HashMap<String, Boolean>();
+        ACCEPTABLE_VALUES.put("true", TRUE); //$NON-NLS-1$
+        ACCEPTABLE_VALUES.put("on", TRUE); //$NON-NLS-1$
+        ACCEPTABLE_VALUES.put("yes", TRUE); //$NON-NLS-1$
+        ACCEPTABLE_VALUES.put("1", TRUE); //$NON-NLS-1$
+        ACCEPTABLE_VALUES.put("false", FALSE); //$NON-NLS-1$
+        ACCEPTABLE_VALUES.put("off", FALSE); //$NON-NLS-1$
+        ACCEPTABLE_VALUES.put("no", FALSE); //$NON-NLS-1$
+        ACCEPTABLE_VALUES.put("0", FALSE); //$NON-NLS-1$
+    }
+        
+    public ExplicitBooleanOptionHandler(CmdLineParser parser,
+            OptionDef option, Setter<? super Boolean> setter) {
+        super(parser, option, setter);
+    }
+
+    @Override
+    public int parseArguments(Parameters params) throws CmdLineException {
+        // end of arg list or next arg is another option
+        if ((params.size() == 0) || params.getParameter(0).startsWith("-")) { //$NON-NLS-1$
+            setter.addValue(TRUE);
+            return 0;
+        } else {
+            setter.addValue(getBoolean(params.getParameter(0)));
+            return 1;
+        }
+    }
+
+    private Boolean getBoolean(String parameter) throws CmdLineException {
+        String valueStr = parameter.toLowerCase();
+        if (!ACCEPTABLE_VALUES.containsKey(valueStr)) {
+            throw new CmdLineException(owner, Messages.ILLEGAL_BOOLEAN.format(valueStr));
+        }
+        return ACCEPTABLE_VALUES.get(valueStr);
+    }
+
+    @Override
+    public String getDefaultMetaVariable() {
+        return "[VAL]"; //$NON-NLS-1$
+    }
+}

Property changes on: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/ExplicitBooleanOptionHandler.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/ConfigElement.java
===================================================================
--- tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/ConfigElement.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/ConfigElement.java	(revision 258)
@@ -0,0 +1,25 @@
+package org.kohsuke.args4j.spi;
+
+/**
+ * The ConfigElement is an <tt>&lt;option></tt> or <tt>&lt;argument></tt> tag
+ * in the xml configuration file.
+ * @author Jan Materne
+ */
+public class ConfigElement {
+	public String field;
+	public String method;
+	public String name;
+	public String usage = ""; //$NON-NLS-1$
+	public String handler;
+	public String metavar = ""; //$NON-NLS-1$
+	public String[] aliases = {};
+	public boolean multiValued = false;
+	public boolean required = false;
+	/**
+	 * Ensures that only a field XOR a method is set.
+	 * @return
+	 */
+	public boolean isInvalid() {
+		return field == null && method == null || field != null && method != null;
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/ConfigElement.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/IntOptionHandler.java
===================================================================
--- tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/IntOptionHandler.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/IntOptionHandler.java	(revision 258)
@@ -0,0 +1,22 @@
+package org.kohsuke.args4j.spi;
+
+import org.kohsuke.args4j.CmdLineParser;
+import org.kohsuke.args4j.OptionDef;
+
+/**
+ * {@link Integer} 
+ * {@link OptionHandler}.
+ * {@link OneArgumentOptionHandler}
+ * 
+ * @author Kohsuke Kawaguchi
+ */
+public class IntOptionHandler extends OneArgumentOptionHandler<Integer> {
+	public IntOptionHandler(CmdLineParser parser, OptionDef option, Setter<? super Integer> setter) {
+		super(parser, option, setter);
+	}
+
+	@Override
+	protected Integer parse(String argument) throws NumberFormatException {
+		return Integer.parseInt(argument);
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/IntOptionHandler.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/URIOptionHandler.java
===================================================================
--- tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/URIOptionHandler.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/URIOptionHandler.java	(revision 258)
@@ -0,0 +1,37 @@
+package org.kohsuke.args4j.spi;
+
+import org.kohsuke.args4j.CmdLineException;
+import org.kohsuke.args4j.CmdLineParser;
+import org.kohsuke.args4j.OptionDef;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URI;
+import java.net.URISyntaxException;
+
+/**
+ * {@link URI} {@link OptionHandler}.
+ *
+ * @author Kohsuke Kawaguchi
+ */
+public class URIOptionHandler extends OptionHandler<URI> {
+    public URIOptionHandler(CmdLineParser parser, OptionDef option, Setter<? super URI> setter) {
+        super(parser, option, setter);
+    }
+
+    @Override
+    public int parseArguments(Parameters params) throws CmdLineException {
+        String param = params.getParameter(0);
+        try {
+            setter.addValue(new URI(param));
+            return 1;
+        } catch (URISyntaxException e) {
+            throw new CmdLineException(owner, Messages.ILLEGAL_OPERAND.format(params.getParameter(-1),param));
+        }
+    }
+
+    @Override
+    public String getDefaultMetaVariable() {
+        return "URI"; //$NON-NLS-1$
+    }
+}

Property changes on: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/URIOptionHandler.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/RestOfArgumentsHandler.java
===================================================================
--- tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/RestOfArgumentsHandler.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/RestOfArgumentsHandler.java	(revision 258)
@@ -0,0 +1,33 @@
+package org.kohsuke.args4j.spi;
+
+import org.kohsuke.args4j.Argument;
+import org.kohsuke.args4j.CmdLineParser;
+import org.kohsuke.args4j.OptionDef;
+import org.kohsuke.args4j.CmdLineException;
+
+/**
+ * Eagerly grabs all the arguments.
+ *
+ * <p>
+ * Used with {@link Argument}, this implements a semantics where
+ * non-option token causes the option parsing to terminate.
+ * An example of this is ssh(1), where "ssh -p 222 abc" will treat "-p" as an option
+ * to ssh but "ssh abc -p 222" is considered to have no option for ssh.
+ *
+ * @author Kohsuke Kawaguchi
+ */
+public class RestOfArgumentsHandler extends OptionHandler<String> {
+    public RestOfArgumentsHandler(CmdLineParser cmdLineParser, OptionDef optionDef, Setter<String> setter) {
+        super(cmdLineParser, optionDef, setter);
+    }
+
+    public int parseArguments(Parameters parameters) throws CmdLineException {
+        for (int i=0; i<parameters.size(); i++)
+            setter.addValue(parameters.getParameter(i));
+        return parameters.size();
+    }
+
+    public String getDefaultMetaVariable() {
+        return "ARGS"; //$NON-NLS-1$
+    }
+}

Property changes on: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/RestOfArgumentsHandler.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/LongOptionHandler.java
===================================================================
--- tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/LongOptionHandler.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/LongOptionHandler.java	(revision 258)
@@ -0,0 +1,24 @@
+package org.kohsuke.args4j.spi;
+
+import org.kohsuke.args4j.CmdLineParser;
+import org.kohsuke.args4j.OptionDef;
+
+/**
+ * {@link Long}
+ * {@link OptionHandler}
+ * {@link OneArgumentOptionHandler}
+ * @author Jan Materne
+ * @since 2.0.9
+ */
+public class LongOptionHandler extends OneArgumentOptionHandler<Long> {
+
+	public LongOptionHandler(CmdLineParser parser, OptionDef option, Setter<? super Long> setter) {
+		super(parser, option, setter);
+	}
+
+	@Override
+	protected Long parse(String argument) throws NumberFormatException {
+		return Long.parseLong(argument);
+	}
+
+}

Property changes on: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/LongOptionHandler.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/Messages_ru.properties
===================================================================
--- tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/Messages_ru.properties	(revision 0)
+++ tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/Messages_ru.properties	(revision 258)
@@ -0,0 +1,12 @@
+
+ILLEGAL_METHOD_SIGNATURE = \u041C\u0435\u0442\u043E\u0434 {0} \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0431\u043E\u043B\u0435\u0435 \u043E\u0434\u043D\u043E\u0433\u043E \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u0430
+
+ILLEGAL_FIELD_SIGNATURE = \u041F\u043E\u043B\u0435 \u0442\u0438\u043F\u0430 {0} \u043D\u0435 \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044F args4j
+
+
+# For Translation
+#-------------------
+# ILLEGAL_OPERAND =     "{1}" is not a valid value for "{0}"
+# ILLEGAL_BOOLEAN = 	"{0}" is not a legal boolean value
+# ILLEGAL_CHAR =     "{0}" must be a single character
+# ILLEGAL_LIST =     type of {0} is not a List
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/Messages_ru.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/URLOptionHandler.java
===================================================================
--- tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/URLOptionHandler.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/URLOptionHandler.java	(revision 258)
@@ -0,0 +1,36 @@
+package org.kohsuke.args4j.spi;
+
+import org.kohsuke.args4j.CmdLineException;
+import org.kohsuke.args4j.CmdLineParser;
+import org.kohsuke.args4j.OptionDef;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+/**
+ * {@link URL} {@link OptionHandler}.
+ *
+ * @author Kohsuke Kawaguchi
+ */
+public class URLOptionHandler extends OptionHandler<URL> {
+    public URLOptionHandler(CmdLineParser parser, OptionDef option, Setter<? super URL> setter) {
+        super(parser, option, setter);
+    }
+
+    @Override
+    public int parseArguments(Parameters params) throws CmdLineException {
+        String param = params.getParameter(0);
+        try {
+            setter.addValue(new URL(param));
+            return 1;
+        } catch (MalformedURLException e) {
+            throw new CmdLineException(owner, Messages.ILLEGAL_OPERAND.format(
+                    params.getParameter(-1),param));
+        }
+    }
+
+    @Override
+    public String getDefaultMetaVariable() {
+        return "URL"; //$NON-NLS-1$
+    }
+}

Property changes on: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/URLOptionHandler.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/Setters.java
===================================================================
--- tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/Setters.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/Setters.java	(revision 258)
@@ -0,0 +1,34 @@
+package org.kohsuke.args4j.spi;
+
+import org.kohsuke.args4j.MapSetter;
+import org.kohsuke.args4j.CmdLineParser;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.Method;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Factory of {@link Setter}s.
+ *
+ * @author Kohsuke Kawaguchi
+ */
+public class Setters {
+    public static Setter create(CmdLineParser parser, AccessibleObject fieldOrMethod, Object bean) {
+        if (fieldOrMethod instanceof Method) {
+            return new MethodSetter(parser,bean,(Method) fieldOrMethod);
+        } else {
+            return create((Field)fieldOrMethod,bean);
+        }
+    }
+
+    public static Setter create(Field f, Object bean) {
+        if(List.class.isAssignableFrom(f.getType()))
+            return new MultiValueFieldSetter(bean,f);
+        else if(Map.class.isAssignableFrom(f.getType()))
+            return new MapSetter(bean,f);
+        else
+            return new FieldSetter(bean,f);
+    }
+}

Property changes on: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/Setters.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/ByteOptionHandler.java
===================================================================
--- tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/ByteOptionHandler.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/ByteOptionHandler.java	(revision 258)
@@ -0,0 +1,24 @@
+package org.kohsuke.args4j.spi;
+
+import org.kohsuke.args4j.CmdLineParser;
+import org.kohsuke.args4j.OptionDef;
+
+/**
+ * {@link Byte}
+ * {@link OptionHandler}
+ * {@link OneArgumentOptionHandler}
+ * @author Jan Materne
+ * @since 2.0.9
+ */
+public class ByteOptionHandler extends OneArgumentOptionHandler<Byte> {
+
+	public ByteOptionHandler(CmdLineParser parser, OptionDef option, Setter<? super Byte> setter) {
+		super(parser, option, setter);
+	}
+
+	@Override
+	protected Byte parse(String argument) throws NumberFormatException {
+		return Byte.parseByte(argument);
+	}
+
+}

Property changes on: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/ByteOptionHandler.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/EnumOptionHandler.java
===================================================================
--- tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/EnumOptionHandler.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/EnumOptionHandler.java	(revision 258)
@@ -0,0 +1,58 @@
+package org.kohsuke.args4j.spi;
+
+import org.kohsuke.args4j.CmdLineException;
+import org.kohsuke.args4j.CmdLineParser;
+import org.kohsuke.args4j.OptionDef;
+
+/**
+ * {@link Enum} {@link OptionHandler}.
+ *
+ * @author Kohsuke Kawaguchi
+ */
+public class EnumOptionHandler<T extends Enum<T>> extends OptionHandler<T> {
+
+    private final Class<T> enumType;
+
+    public EnumOptionHandler(CmdLineParser parser, OptionDef option, Setter<? super T> setter, Class<T> enumType) {
+        super(parser, option, setter);
+        this.enumType = enumType;
+    }
+
+    @Override
+    public int parseArguments(Parameters params) throws CmdLineException {
+        String s = params.getParameter(0).replaceAll("-", "_");
+        T value = null;
+        for( T o : enumType.getEnumConstants() )
+            if(o.name().equalsIgnoreCase(s)) {
+                value = o;
+                break;
+            }
+
+        if(value==null) {
+            if (option.isArgument()) {
+                throw new CmdLineException(owner, Messages.ILLEGAL_OPERAND.format(option.toString(),s));
+            } else {
+                throw new CmdLineException(owner, Messages.ILLEGAL_OPERAND.format(params.getParameter(-1),s));
+            }
+        }
+        setter.addValue(value);
+        return 1;
+    }
+
+    /* 
+     * Returns all values of an enum type split by pipe.
+     * <tt>[ one | two | three]</tt>
+     * @see org.kohsuke.args4j.spi.OptionHandler#getDefaultMetaVariable()
+     */
+    @Override
+    public String getDefaultMetaVariable() {
+    	StringBuffer rv = new StringBuffer();
+    	rv.append("[");
+    	for (T t : enumType.getEnumConstants()) {
+			rv.append(t).append(" | ");
+		}
+    	rv.delete(rv.length()-3, rv.length());
+    	rv.append("]");
+    	return rv.toString();
+    }
+}

Property changes on: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/EnumOptionHandler.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/AnnotationImpl.java
===================================================================
--- tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/AnnotationImpl.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/AnnotationImpl.java	(revision 258)
@@ -0,0 +1,63 @@
+package org.kohsuke.args4j.spi;
+
+import java.lang.annotation.Annotation;
+
+
+/**
+ * Base class for the @Option and @Argument implementation classes.
+ * @author Jan Materne
+ */
+public abstract class AnnotationImpl implements Annotation {
+    private final Class<? extends Annotation> annotationType;
+
+    protected AnnotationImpl(Class<? extends Annotation> annotationType) {
+        this.annotationType = annotationType;
+    }
+
+    protected AnnotationImpl(Class<? extends Annotation> annotationType, ConfigElement ce) throws ClassNotFoundException {
+        this(annotationType);
+
+		aliases = ce.aliases != null ? ce.aliases : new String[0];
+		if (ce.handler != null) {
+			handler = (Class<? extends OptionHandler>) Class.forName(ce.handler);
+		} else {
+			handler = OptionHandler.class;
+		}
+		metaVar = ce.metavar != null ? ce.metavar : ""; //$NON-NLS-1$
+		multiValued = ce.multiValued;
+		required = ce.required;
+		usage = ce.usage != null ? ce.usage : ""; //$NON-NLS-1$
+	}
+
+	public String[] aliases;
+	public String[] aliases() {
+		return aliases;
+	}
+	public Class<? extends OptionHandler> handler;
+	public Class<? extends OptionHandler> handler() {
+		return handler;
+	}
+	public String metaVar;
+	public String metaVar() {
+		return metaVar;
+	}
+	public boolean multiValued;
+	public boolean multiValued() {
+		return multiValued;
+	}
+	public boolean required;
+	public boolean required() {
+		return required;
+	}
+	public String usage;
+	public String usage() {
+		return usage;
+	}
+	public Class<? extends Annotation> annotationType() {
+		return annotationType;
+	}
+	public int index;
+	public int index() {
+		return index;
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/AnnotationImpl.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/QueryOptionHandler.java
===================================================================
--- tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/QueryOptionHandler.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/QueryOptionHandler.java	(revision 258)
@@ -0,0 +1,25 @@
+package org.kohsuke.args4j.spi;
+
+import java.util.Date;
+
+import org.kohsuke.args4j.CmdLineParser;
+import org.kohsuke.args4j.OptionDef;
+import org.txm.searchengine.cqp.corpus.query.Query;
+
+/**
+ * {@link Date} 
+ * {@link OptionHandler}.
+ * {@link OneArgumentOptionHandler}
+ * 
+ * @author mdecorde
+ */
+public class QueryOptionHandler extends OneArgumentOptionHandler<Query> {
+	public QueryOptionHandler(CmdLineParser parser, OptionDef option, Setter<? super Query> setter) {
+		super(parser, option, setter);
+	}
+
+	@Override
+	protected Query parse(String argument) throws NumberFormatException {
+		return new Query(argument);
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/QueryOptionHandler.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/StringOptionHandler.java
===================================================================
--- tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/StringOptionHandler.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/StringOptionHandler.java	(revision 258)
@@ -0,0 +1,27 @@
+package org.kohsuke.args4j.spi;
+
+import org.kohsuke.args4j.OptionDef;
+import org.kohsuke.args4j.CmdLineException;
+import org.kohsuke.args4j.CmdLineParser;
+
+/**
+ * String {@link OptionHandler}.
+ *
+ * @author Kohsuke Kawaguchi
+ */
+public class StringOptionHandler extends OptionHandler<String> {
+    public StringOptionHandler(CmdLineParser parser, OptionDef option, Setter<? super String> setter) {
+        super(parser, option, setter);
+    }
+
+    @Override
+    public int parseArguments(Parameters params) throws CmdLineException {
+        setter.addValue(params.getParameter(0));
+        return 1;
+    }
+
+    @Override
+    public String getDefaultMetaVariable() {
+        return "VAL"; //$NON-NLS-1$
+    }
+}

Property changes on: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/StringOptionHandler.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/ObjectOptionHandler.java
===================================================================
--- tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/ObjectOptionHandler.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/ObjectOptionHandler.java	(revision 258)
@@ -0,0 +1,24 @@
+package org.kohsuke.args4j.spi;
+
+import org.kohsuke.args4j.CmdLineParser;
+import org.kohsuke.args4j.OptionDef;
+
+/**
+ * {@link Object}
+ * {@link OptionHandler}
+ * {@link OneArgumentOptionHandler}
+ * @author Jan Materne
+ * @since 2.0.9
+ */
+public class ObjectOptionHandler extends OneArgumentOptionHandler<Object> {
+
+	public ObjectOptionHandler(CmdLineParser parser, OptionDef option, Setter<? super Object> setter) {
+		super(parser, option, setter);
+	}
+
+	@Override
+	protected Object parse(String argument) throws NumberFormatException {
+		return argument;
+	}
+
+}

Property changes on: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/ObjectOptionHandler.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/Parameters.java
===================================================================
--- tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/Parameters.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/Parameters.java	(revision 258)
@@ -0,0 +1,34 @@
+package org.kohsuke.args4j.spi;
+
+import org.kohsuke.args4j.CmdLineException;
+
+/**
+ * List of arguments.
+ *
+ * <p>
+ * Object of this interface is passed to
+ * {@link OptionHandler}s to make it easy/safe to parse
+ * additional parameters for options.
+ */
+public interface Parameters  {
+    /**
+     * Gets the additional parameter to this option.
+     *
+     * @param idx
+     *      specifying 0 will retrieve the token next to the option.
+     *      For example, if the command line looks like "-o abc -d x",
+     *      then <code>getParameter(0)</code> for "-o" returns "abc"
+     *      and <code>getParameter(1)</code> will return "-d".
+     *
+     * @return
+     *      Always return non-null valid String. If an attempt is
+     *      made to access a non-existent index, this method throws
+     *      appropriate {@link org.kohsuke.args4j.CmdLineException}.
+     */
+    String getParameter(int idx) throws CmdLineException;
+
+    /**
+     * Number of remaining tokens.
+     */
+    int size();
+}

Property changes on: tmp/org.txm.core/src/java/org/kohsuke/args4j/spi/Parameters.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/kohsuke/args4j/XmlParser.java
===================================================================
--- tmp/org.txm.core/src/java/org/kohsuke/args4j/XmlParser.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/kohsuke/args4j/XmlParser.java	(revision 258)
@@ -0,0 +1,91 @@
+package org.kohsuke.args4j;
+
+import java.lang.reflect.AccessibleObject;
+import java.net.URL;
+
+import org.kohsuke.args4j.spi.ArgumentImpl;
+import org.kohsuke.args4j.spi.ConfigElement;
+import org.kohsuke.args4j.spi.OptionImpl;
+import org.kohsuke.args4j.spi.Setters;
+import org.xml.sax.InputSource;
+
+/**
+ * Parses an XML-file specifying the 'annotations'.
+ * The XML must have the structure:
+ * <pre>
+ * &lt;args>
+ *     &lt;option field="" method="" name="" usage="" metavar="" handler=""/>
+ *     &lt;argument field="" method="" usage="" metavar="" handler=""/>
+ * &lt;/args>
+ * </pre>
+ * Exactly one of the attributes 'field' or 'method' must be set.
+ * The 'handler' value specifies a full qualified class name.
+ *
+ * <h3>Example</h3>
+ * <pre>
+ * &lt;args>
+ *     &lt;option field="recursive" name="-r" usage="recursively run something"/>
+ *     &lt;option field="out" name="-o" usage="output to this file" metavar="OUTPUT"/>
+ *     &lt;option method="setStr(String)" name="-str"/>
+ *     &lt;option field="data" name="-custom" handler="org.kohsuke.args4j.spi.BooleanOptionHandler" usage="boolean value for checking the custom handler"/>
+ *     &lt;argument field="arguments"/>
+ * &lt;args>
+ * </pre>
+ *
+ * @author Jan Materne
+ */
+public class XmlParser {
+    public void parse(URL xml, CmdLineParser parser, Object bean) {
+        parse(new InputSource(xml.toExternalForm()),parser,bean);
+    }
+
+	public void parse(InputSource xml, CmdLineParser parser, Object bean) {
+		try {
+			Config config = Config.parse(xml);
+			for(ConfigElement ce : config.options) {
+				Option option = new OptionImpl(ce);
+                parser.addOption(Setters.create(parser, findMethodOrField(bean, ce.field, ce.method),bean), option);
+			}
+			for (ConfigElement ce : config.arguments) {
+				Argument argument = new ArgumentImpl(ce);
+				parser.addArgument(Setters.create(parser, findMethodOrField(bean, ce.field, ce.method),bean), argument);
+			}
+		} catch (Exception e) {
+			throw new RuntimeException(Messages.METADATA_ERROR.format(), e);
+		}
+	}
+
+
+	/**
+	 * Finds a {@link java.lang.reflect.Method} or {@link java.lang.reflect.Method} in the bean
+	 * instance with the requested name.
+	 * @param bean    bean instance
+	 * @param field   name of the field (field XOR method must be specified)
+	 * @param method  name of the method (field XOR method must be specified)
+	 * @return the reflection reference
+	 * @throws SecurityException
+	 * @throws NoSuchFieldException
+	 * @throws NoSuchMethodException
+	 * @throws ClassNotFoundException
+	 */
+	private AccessibleObject findMethodOrField(Object bean, String field, String method) throws SecurityException, NoSuchFieldException, NoSuchMethodException, ClassNotFoundException {
+		AccessibleObject rv;
+		if (field != null) {
+			rv = bean.getClass().getDeclaredField(field);
+		} else {
+			String methodName = method.substring(0, method.indexOf("("));
+			String[] params = method.substring(method.indexOf("(")+1, method.indexOf(")")).split(",");
+			Class[] paramTypes = new Class[params.length];
+			for(int i=0; i<params.length; i++) {
+				String className = params[i];
+				if (className.indexOf('.') < 0) {
+					className = "java.lang." + className;
+				}
+				paramTypes[i] = Class.forName(className);
+			}
+			rv = bean.getClass().getMethod(methodName, paramTypes);
+		}
+		return rv;
+	}
+
+}

Property changes on: tmp/org.txm.core/src/java/org/kohsuke/args4j/XmlParser.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/kohsuke/args4j/IllegalAnnotationError.java
===================================================================
--- tmp/org.txm.core/src/java/org/kohsuke/args4j/IllegalAnnotationError.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/kohsuke/args4j/IllegalAnnotationError.java	(revision 258)
@@ -0,0 +1,27 @@
+package org.kohsuke.args4j;
+
+/**
+ * Signals an incorrect use of args4j annotations.
+ *
+ * <p>
+ * This only happens when there's something wrong with the way you use
+ * args4j in your code, not when the arguments supplied by the user is
+ * wrong. Hence this class is an {@link Error}.
+ *
+ * @author Kohsuke Kawaguchi
+ */
+public class IllegalAnnotationError extends Error {
+	private static final long serialVersionUID = 2397757838147693218L;
+
+	public IllegalAnnotationError(String message) {
+        super(message);
+    }
+
+    public IllegalAnnotationError(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public IllegalAnnotationError(Throwable cause) {
+        super(cause);
+    }
+}

Property changes on: tmp/org.txm.core/src/java/org/kohsuke/args4j/IllegalAnnotationError.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/kohsuke/args4j/package.html
===================================================================
--- tmp/org.txm.core/src/java/org/kohsuke/args4j/package.html	(revision 0)
+++ tmp/org.txm.core/src/java/org/kohsuke/args4j/package.html	(revision 258)
@@ -0,0 +1,84 @@
+<html><body>
+<p>Core classes of the Args4J command line parser.</p>
+
+<h1>What is Args4J</h1>
+<p>Args4J is a command line parser. As such a parser its job is to parse the String-array passed to the main() method
+and transfer the values to a java object, which includes type conversion. The entry point into this parsing is
+the CmdLineParser class with its parse() Method.</p>
+<p>Args4J must know the mapping between the flag from the command line and the target for the value.
+There are multiple ways for Args4J: <ul>
+    <li>place an @Option or @Argument annotation at a setter or on a field</li>
+    <li>provide a XML configuration file</li>
+    <li>make all fields public available</li>
+</ul> 
+depending on what you want, you have to do a configuration step before starting the parsing.</p>
+
+<h1>Examples</h1>
+
+<p><tt>java Main -text newText</tt></p>
+
+<p>The standard use case is having a bean class and providing the annotations.
+This feature is available since the first Args4J release:
+<!-- TODO: 
+Javadoc stops when reaching the at-sign. When I load the package.html directly into Firefox,
+all is fine. But when creating the javadoc it stops copying the content at that sign.
+(a) is a compromise here ...
+Does anyone know how to handle that?
+-->
+<pre>
+public class Bean {
+    (a)Option(name="-text")
+    String text;
+}
+public class Main {
+    public static void main(String[] args) throws CmdLineException {
+        Object bean = new Bean();
+        CmdLineParser parser = new CmdLineParser(bean);
+        parser.parse(args);
+    }
+}
+</pre>
+
+<p>An easy way for initializing fields and not touching the bean source code
+is using the FieldParser. The FieldParser scans all fields of the bean class
+(including inheritance) and makes them public available as options with 
+a '-' prefix in the name.
+This feature is available since Args4J release 2.0.16:
+<pre>
+public class Bean {
+    String text;
+}
+public class Main {
+    public static void main(String[] args) throws CmdLineException {
+        Object bean = new Bean();
+        CmdLineParser parser = new CmdLineParser(null);
+        new FieldParser().parse(parser, bean);
+        parser.parse(args);
+    }
+}
+</pre>
+
+<p>While the FieldParser is easier to use, the XmlParser supports more features. 
+That said it supports all features which are available via annotations: usage text, specifying handlers and more.
+You have to provide an XML InputSource or an URL to the XML file. 
+This feature is available since Args4J release 2.0.16:
+<pre>
+public class Bean {
+    String text;
+}
+public class Main {
+    public static void main(String[] args) throws CmdLineException {
+        Object bean = new Bean();
+        CmdLineParser parser = new CmdLineParser(null);
+        new XmlParser().parse(getClass().getResource(bean.getClass().getName() + ".xml"), parser, bean);
+        parser.parse(args);
+    }
+}
+&lt;args>
+  &lt;option field="text" name="-text" usage="Output text"/>
+&lt;/args>
+</pre>
+</p>
+
+
+</body></html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/java/org/kohsuke/args4j/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/kohsuke/args4j/Argument.java
===================================================================
--- tmp/org.txm.core/src/java/org/kohsuke/args4j/Argument.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/kohsuke/args4j/Argument.java	(revision 258)
@@ -0,0 +1,62 @@
+package org.kohsuke.args4j;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import org.kohsuke.args4j.spi.OptionHandler;
+
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+
+/**
+ * Argument of the command line.
+ *
+ * This works mostly like {@link Option} except the following differences.
+ *
+ * <ol>
+ *  <li>Arguments have an index about their relative position on the command line.
+ * </ol>
+ * 
+ * @author Kohsuke Kawaguchi
+ * @author Mark Sinke
+ */
+@Retention(RUNTIME)
+@Target({FIELD,METHOD,PARAMETER})
+public @interface Argument {
+    /**
+     * See {@link Option#usage()}.
+     */
+    String usage() default ""; //$NON-NLS-1$
+    /**
+     * See {@link Option#metaVar()}.
+     */
+    String metaVar() default ""; //$NON-NLS-1$
+    /**
+     * See {@link Option#required()}.
+     */
+    boolean required() default false;
+
+    /**
+     * See {@link Option#handler()}.
+     */
+    Class<? extends OptionHandler> handler() default OptionHandler.class;
+
+    /**
+     * Position of the argument.
+     *
+     * <p>
+     * If you define multiple single value properties to bind to arguments,
+     * they should have index=0, index=1, index=2, ... and so on.
+     *
+     * <p>
+     * Multi value properties bound to arguments must be always the last entry.
+     */
+    int index() default 0;
+
+    /**
+     * See {@link Option#multiValued()}.
+     */
+    boolean multiValued() default false;
+}

Property changes on: tmp/org.txm.core/src/java/org/kohsuke/args4j/Argument.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/kohsuke/args4j/ClassParser.java
===================================================================
--- tmp/org.txm.core/src/java/org/kohsuke/args4j/ClassParser.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/kohsuke/args4j/ClassParser.java	(revision 258)
@@ -0,0 +1,43 @@
+package org.kohsuke.args4j;
+
+import org.kohsuke.args4j.spi.MethodSetter;
+import org.kohsuke.args4j.spi.Setters;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+/**
+ * Parser for analyzing Args4J annotations in the class hierarchy.
+ *
+ * This can be used to feed option bindings that span across multiple instances.
+ *
+ * @author Jan Materne
+ */
+public class ClassParser {
+    public void parse(Object bean, CmdLineParser parser) {
+        // recursively process all the methods/fields.
+        for( Class c=bean.getClass(); c!=null; c=c.getSuperclass()) {
+            for( Method m : c.getDeclaredMethods() ) {
+                Option o = m.getAnnotation(Option.class);
+                if(o!=null) {
+                	parser.addOption(new MethodSetter(parser,bean,m), o);
+                }
+                Argument a = m.getAnnotation(Argument.class);
+                if(a!=null) {
+                    parser.addArgument(new MethodSetter(parser,bean,m), a);
+                }
+            }
+
+            for( Field f : c.getDeclaredFields() ) {
+                Option o = f.getAnnotation(Option.class);
+                if(o!=null) {
+                	parser.addOption(Setters.create(f,bean),o);
+                }
+                Argument a = f.getAnnotation(Argument.class);
+                if(a!=null) {
+                	parser.addArgument(Setters.create(f,bean), a);
+                }
+            }
+        }
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/kohsuke/args4j/ClassParser.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/kohsuke/args4j/Messages.properties
===================================================================
--- tmp/org.txm.core/src/java/org/kohsuke/args4j/Messages.properties	(revision 0)
+++ tmp/org.txm.core/src/java/org/kohsuke/args4j/Messages.properties	(revision 258)
@@ -0,0 +1,44 @@
+MISSING_OPERAND = \
+    Option "{0}" takes an operand
+
+UNDEFINED_OPTION = \
+    "{0}" is not a valid option
+
+NO_ARGUMENT_ALLOWED = \
+    No argument is allowed: {0}
+
+REQUIRED_OPTION_MISSING = \
+    Option "{0}" is required
+    
+REQUIRED_ARGUMENT_MISSING = \
+    Argument "{0}" is required
+    
+TOO_MANY_ARGUMENTS = \
+    Too many arguments: {0}
+
+METADATA_ERROR = \
+    Problems while reading the args-confguration.
+
+MULTIPLE_USE_OF_ARGUMENT = \
+    Argument with index {0} is used more than once
+
+MULTIPLE_USE_OF_OPTION = \
+    Option name {0} is used more than once
+
+UNKNOWN_HANDLER = \
+    No OptionHandler is registered to handle {0}
+
+NO_OPTIONHANDLER = \
+    Not an OptionHandler class
+
+NO_CONSTRUCTOR_ON_HANDLER = \
+    {0} does not have the proper constructor
+
+FORMAT_ERROR_FOR_MAP = \
+    An argument for setting a Map must contain a "="
+    
+UNDEFINNED_WIDGET = \
+    Undefined widget {0}. Choose between {1}
+
+MAP_HAS_NO_KEY = \
+    A key must be set.
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/java/org/kohsuke/args4j/Messages.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/kohsuke/args4j/Starter.java
===================================================================
--- tmp/org.txm.core/src/java/org/kohsuke/args4j/Starter.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/kohsuke/args4j/Starter.java	(revision 258)
@@ -0,0 +1,109 @@
+package org.kohsuke.args4j;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+/**
+ * Starter class which uses reflection to instantiate the business
+ * class, parse the command line parameters, sets the fields of the
+ * business class and doing the help message handling.
+ *  
+ * @author Jan Materne
+ */
+public class Starter {
+	
+	/**
+	 * The name of the JavaVM property which stores the class name of
+	 * the business class.
+	 * {@value} 
+	 */
+	public static final String PARAMETER_NAME = "mainclass";
+
+	public static void main(String[] args) {
+		String classname = System.getProperty(PARAMETER_NAME);
+		CmdLineParser parser = null;
+		boolean classHasArgument = false;
+		boolean classHasOptions  = false;
+		
+		// Check the requirement: must specify the class to start
+		if (classname == null || "".equals(classname)) {
+			System.err.println("The system property '" 
+					+ PARAMETER_NAME
+					+ "' must contain the classname to start.");
+			System.exit(-1);
+		}
+		
+		try {
+			Class clazz = Class.forName(classname);
+			Object bean = clazz.newInstance();
+			parser = new CmdLineParser(bean);
+			
+			// for help output
+			classHasArgument = hasAnnotation(clazz, Argument.class);
+			classHasOptions  = hasAnnotation(clazz, Option.class);
+			
+			parser.parseArgument(args);
+			
+			// try starting   run()
+			Method m;
+			boolean couldInvoke = false;
+			try {
+				m = clazz.getMethod("run", (Class[]) null);
+				m.invoke(bean, (Object[]) null);
+				couldInvoke = true;
+			} catch (SecurityException e) {
+			} catch (IllegalArgumentException e) {
+			} catch (NoSuchMethodException e) {
+			} catch (IllegalAccessException e) {
+			} catch (InvocationTargetException e) {
+			}
+
+			// try starting   run(String[])
+			if (!couldInvoke) try {
+				m = clazz.getMethod("run", String[].class);		
+				m.invoke(bean, new Object[]{args});
+				couldInvoke = true;
+			} catch (SecurityException e) {
+			} catch (IllegalArgumentException e) {
+				e.printStackTrace();
+			} catch (NoSuchMethodException e) {
+			} catch (IllegalAccessException e) {
+			} catch (InvocationTargetException e) {
+			}
+		} catch (ClassNotFoundException e) {
+			// wrong classpath setting
+			System.err.println("Cant find the class '" 
+					+ classname
+					+ "' as specified in the system property '"
+					+ PARAMETER_NAME + "'.");
+		} catch (CmdLineException e) {
+			// wrong argument enteres, so print the usage message as
+			// supplied by args4j
+			System.err.println(e.getMessage());
+			System.err.print(classname);
+			if (classHasOptions)  System.err.print(" [options]");
+			if (classHasArgument) System.err.print(" arguments");
+			System.err.println();
+			if (parser != null)
+				parser.printUsage(System.err);
+		} catch (Exception e) {
+			// Must be an unhandled business exception, so we can only
+			// print stacktraces.
+			e.printStackTrace();
+		}
+	}
+
+	public static boolean hasAnnotation(Class clazz, Class<? extends Annotation> annotation) {
+		if (clazz.getAnnotation(annotation)!=null) return true;
+		for (Field f : clazz.getFields()) {
+			if (f.getAnnotation(annotation)!=null) return true;
+		}
+		for (Method m : clazz.getMethods()) {
+			if (m.getAnnotation(annotation)!=null) return true;
+		}
+		return false;
+	}
+	
+}

Property changes on: tmp/org.txm.core/src/java/org/kohsuke/args4j/Starter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/kohsuke/args4j/OptionDef.java
===================================================================
--- tmp/org.txm.core/src/java/org/kohsuke/args4j/OptionDef.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/kohsuke/args4j/OptionDef.java	(revision 258)
@@ -0,0 +1,59 @@
+package org.kohsuke.args4j;
+
+import org.kohsuke.args4j.spi.OptionHandler;
+
+/**
+ * Run-time copy of the Option or Argument annotation. By definition, unnamed options
+ * are arguments (and instances of this class). Named options are actually a subclass.
+ * 
+ * @author Mark Sinke
+ */
+public class OptionDef {
+	private final String usage;
+	private final String metaVar;
+	private final boolean required;
+	private final boolean multiValued;
+	private final Class<? extends OptionHandler> handler;
+
+	public OptionDef(Argument a, boolean forceMultiValued) {
+		this(a.usage(), a.metaVar(), a.required(), a.handler(), a.multiValued() || forceMultiValued);
+	}
+
+	protected OptionDef(String usage, String metaVar, boolean required,
+			Class<? extends OptionHandler> handler, boolean multiValued) {
+		this.usage = usage;
+		this.metaVar = metaVar;
+		this.required = required;
+		this.handler = handler;
+		this.multiValued = multiValued;
+	}
+
+	public String usage() {
+		return usage;
+	}
+
+	public String metaVar() {
+		return metaVar;
+	}
+
+	public boolean required() {
+		return required;
+	}
+
+	public Class<? extends OptionHandler> handler() {
+		return handler;
+	}
+
+	public boolean isMultiValued() {
+		return multiValued;
+	}
+	
+	public boolean isArgument() {
+		return true;
+	}
+
+	@Override
+	public String toString() {
+		return metaVar() != null ? metaVar() : "ARG"; //$NON-NLS-1$
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/kohsuke/args4j/OptionDef.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/kohsuke/args4j/CmdLineParser.java
===================================================================
--- tmp/org.txm.core/src/java/org/kohsuke/args4j/CmdLineParser.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/kohsuke/args4j/CmdLineParser.java	(revision 258)
@@ -0,0 +1,642 @@
+package org.kohsuke.args4j;
+
+import java.io.File;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.io.Writer;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.net.URI;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.ResourceBundle;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.logging.Logger;
+
+import org.kohsuke.args4j.spi.BooleanOptionHandler;
+import org.kohsuke.args4j.spi.ByteOptionHandler;
+import org.kohsuke.args4j.spi.CharOptionHandler;
+import org.kohsuke.args4j.spi.DateOptionHandler;
+import org.kohsuke.args4j.spi.DoubleOptionHandler;
+import org.kohsuke.args4j.spi.EnumOptionHandler;
+import org.kohsuke.args4j.spi.FileOptionHandler;
+import org.kohsuke.args4j.spi.FloatOptionHandler;
+import org.kohsuke.args4j.spi.IntOptionHandler;
+import org.kohsuke.args4j.spi.LongOptionHandler;
+import org.kohsuke.args4j.spi.MapOptionHandler;
+import org.kohsuke.args4j.spi.ObjectOptionHandler;
+import org.kohsuke.args4j.spi.OptionHandler;
+import org.kohsuke.args4j.spi.Parameters;
+import org.kohsuke.args4j.spi.QueryOptionHandler;
+import org.kohsuke.args4j.spi.Setter;
+import org.kohsuke.args4j.spi.ShortOptionHandler;
+import org.kohsuke.args4j.spi.StringOptionHandler;
+import org.kohsuke.args4j.spi.URIOptionHandler;
+import org.kohsuke.args4j.spi.URLOptionHandler;
+import org.txm.searchengine.cqp.corpus.query.Query;
+
+
+/**
+ * Command line argument owner.
+ *
+ * <p>
+ * For a typical usage, see <a href="https://args4j.dev.java.net/source/browse/args4j/args4j/examples/SampleMain.java?view=markup">this example</a>.
+ *
+ * @author
+ *     Kohsuke Kawaguchi (kk@kohsuke.org)
+ */
+public class CmdLineParser {
+    /**
+     * Discovered {@link OptionHandler}s for options.
+     */
+    private final List<OptionHandler> options = new ArrayList<OptionHandler>();
+
+    /**
+     * Discovered {@link OptionHandler}s for arguments.
+     */
+    private final List<OptionHandler> arguments = new ArrayList<OptionHandler>();
+
+    private boolean parsingOptions = true;
+    private OptionHandler currentOptionHandler = null;
+
+	/**
+	 *  The length of a usage line.
+	 *  If the usage message is longer than this value, the parser
+	 *  wraps the line. Defaults to 80.
+	 */
+	private int usageWidth = 80;
+
+    /**
+     * Creates a new command line owner that
+     * parses arguments/options and set them into
+     * the given object.
+     *
+     * @param bean
+     *      instance of a class annotated by {@link Option} and {@link Argument}.
+     *      this object will receive values. If this is null, the processing will
+     *      be skipped, which is useful if you'd like to feed metadata from other sources.
+     *
+     * @throws IllegalAnnotationError
+     *      if the option bean class is using args4j annotations incorrectly.
+     */
+    public CmdLineParser(Object bean) {
+        // A 'return' in the constructor just skips the rest of the implementation
+        // and returns the new object directly.
+        if (bean==null) return;
+
+        // Parse the metadata and create the setters
+        new ClassParser().parse(bean,this);
+
+        // for display purposes, we like the arguments in argument order, but the options in alphabetical order
+        /*Collections.sort(options, new Comparator<OptionHandler>() {
+			public int compare(OptionHandler o1, OptionHandler o2) {
+				return o1.option.toString().compareTo(o2.option.toString());
+			}
+		});*/
+    }
+
+    /**
+     * Programmatically defines an argument (instead of reading it from annotations like you normally do.)
+     *
+     * @param setter the setter for the type
+     * @param a the Argument
+     */
+    public void addArgument(Setter setter, Argument a) {
+        OptionHandler h = createOptionHandler(new OptionDef(a,setter.isMultiValued()),setter);
+    	int index = a.index();
+    	// make sure the argument will fit in the list
+    	while (index >= arguments.size()) {
+    		arguments.add(null);
+    	}
+    	if(arguments.get(index)!=null) {
+            throw new IllegalAnnotationError(Messages.MULTIPLE_USE_OF_ARGUMENT.format(index));
+        }
+    	arguments.set(index,h);
+    }
+
+    /**
+     * Programmatically defines an option (instead of reading it from annotations like you normally do.)
+     *
+     * @param setter the setter for the type
+     * @param o the Option
+     */
+    public void addOption(Setter setter, Option o) {
+        checkOptionNotInMap(o.name());
+        checkWidgetNotInMap(o.widget());
+        for (String alias : o.aliases()) {
+        	checkOptionNotInMap(alias);
+        }
+        options.add(createOptionHandler(new NamedOptionDef(o, setter.isMultiValued()), setter));
+    }
+    
+    public List<OptionHandler> getArguments() {
+        return arguments;
+    }
+    
+    public List<OptionHandler> getOptions() {
+        return options;
+    }
+
+	private void checkOptionNotInMap(String name) throws IllegalAnnotationError {
+		if(findOptionByName(name)!=null) {
+            throw new IllegalAnnotationError(Messages.MULTIPLE_USE_OF_OPTION.format(name));
+        }
+	}
+	
+	public static List<String> widgets = Arrays.asList("Query", "Integer", "File", "CreateFile", "FileSave", "FileOpen", "Folder", "StringArray", "StringArrayMultiple", "StructuralUnits" , "String", "Text", "Float", "Boolean", "Date", "Date-Time");
+	private void checkWidgetNotInMap(String widget) throws IllegalAnnotationError {
+		if(!widgets.contains(widget)) {
+            throw new IllegalAnnotationError(Messages.UNDEFINNED_WIDGET.format(widget, widgets));
+        }
+	}
+
+    /**
+     * Creates an {@link OptionHandler} that handles the given {@link Option} annotation
+     * and the {@link Setter} instance.
+     */
+   @SuppressWarnings("unchecked")
+    protected OptionHandler createOptionHandler(OptionDef o, Setter setter) {
+
+        Constructor<? extends OptionHandler> handlerType;
+        Class<? extends OptionHandler> h = o.handler();
+
+        if(h==OptionHandler.class) {
+            // infer the type
+
+            // enum is the special case
+            Class t = setter.getType();
+            if(Enum.class.isAssignableFrom(t))
+                return new EnumOptionHandler(this,o,setter,t);
+
+            handlerType = handlerClasses.get(t);
+            if(handlerType==null)
+                throw new IllegalAnnotationError(Messages.UNKNOWN_HANDLER.format(t));
+        } else {
+            handlerType = getConstructor(h);
+        }
+
+        try {
+            return handlerType.newInstance(this,o,setter);
+        } catch (InstantiationException e) {
+            throw new IllegalAnnotationError(e);
+        } catch (IllegalAccessException e) {
+            throw new IllegalAnnotationError(e);
+        } catch (InvocationTargetException e) {
+            throw new IllegalAnnotationError(e);
+        }
+    }
+
+    /**
+     * Formats a command line example into a string.
+     *
+     * See {@link #printExample(ExampleMode, ResourceBundle)} for more details.
+     *
+     * @param mode
+     *      must not be null.
+     * @return
+     *      always non-null.
+     */
+    public String printExample(ExampleMode mode) {
+        return printExample(mode,null);
+    }
+
+    /**
+     * Formats a command line example into a string.
+     *
+     * <p>
+     * This method produces a string like " -d &lt;dir> -v -b",
+     * which is useful for printing a command line example, perhaps
+     * as a part of the usage screen.
+     *
+     *
+     * @param mode
+     *      One of the {@link ExampleMode} constants. Must not be null.
+     *      This determines what option should be a part of the returned string.
+     * @param rb
+     *      If non-null, meta variables (&lt;dir> in the above example)
+     *      is treated as a key to this resource bundle, and the associated
+     *      value is printed. See {@link Option#metaVar()}. This is to support
+     *      localization.
+     *
+     *      Passing <tt>null</tt> would print {@link Option#metaVar()} directly.
+     * @return
+     *      always non-null. If there's no option, this method returns
+     *      just the empty string "". Otherwise, this method returns a
+     *      string that contains a space at the beginning (but not at the end.)
+     *      This allows you to do something like:
+     *
+     *      <pre>System.err.println("java -jar my.jar"+parser.printExample(REQUIRED)+" arg1 arg2");</pre>
+     */
+    public String printExample(ExampleMode mode,ResourceBundle rb) {
+        StringBuilder buf = new StringBuilder();
+
+        for (OptionHandler h : options) {
+            OptionDef option = h.option;
+            if(option.usage().length()==0)  continue;   // ignore
+            if(!mode.print(option))         continue;
+
+            buf.append(' ');
+            buf.append(h.getNameAndMeta(rb));
+        }
+
+        return buf.toString();
+    }
+
+    /**
+     * Prints the list of options and their usages to the screen.
+     *
+     * <p>
+     * This is a convenience method for calling {@code printUsage(new OutputStreamWriter(out),null)}
+     * so that you can do {@code printUsage(System.err)}.
+     */
+    public void printUsage(OutputStream out) {
+        printUsage(new OutputStreamWriter(out),null);
+    }
+
+    /**
+     * Prints the list of options and their usages to the screen.
+     *
+     * @param rb
+     *      if this is non-null, {@link Option#usage()} is treated
+     *      as a key to obtain the actual message from this resource bundle.
+     */
+    public void printUsage(Writer out, ResourceBundle rb) {
+        PrintWriter w = new PrintWriter(out);
+        // determine the length of the option + metavar first
+        int len = 0;
+        for (OptionHandler h : arguments) {
+            int curLen = getPrefixLen(h, rb);
+            len = Math.max(len,curLen);
+        }
+        for (OptionHandler h: options) {
+            int curLen = getPrefixLen(h, rb);
+            len = Math.max(len,curLen);
+        }
+
+        // then print
+        for (OptionHandler h : arguments) {
+        	printOption(w, h, len, rb);
+        }
+        for (OptionHandler h : options) {
+        	printOption(w, h, len, rb);
+        }
+
+        w.flush();
+    }
+
+    /**
+     * Prints the usage information for a given option.
+     * @param out      Writer to write into
+     * @param handler  handler where to receive the informations
+     * @param len      Maximum length of metadata column
+     * @param rb       ResourceBundle for I18N
+     */
+    private void printOption(PrintWriter out, OptionHandler handler, int len, ResourceBundle rb) {
+    	// Hiding options without usage information
+    	if (handler.option.usage() == null || handler.option.usage().length() == 0) {
+    		return;
+    	}
+
+    	// What is the width of the two data columns
+    	int widthMetadata = Math.min(len, (usageWidth - 4) / 2);
+    	int widthUsage    = usageWidth - 4 - widthMetadata;
+
+    	// Line wrapping
+    	List<String> namesAndMetas = wrapLines(handler.getNameAndMeta(rb), widthMetadata);
+    	List<String> usages        = wrapLines(localize(handler.option.usage(),rb), widthUsage);
+
+    	// Output
+    	for(int i=0; i<Math.max(namesAndMetas.size(), usages.size()); i++) {
+    		String nameAndMeta = (i >= namesAndMetas.size()) ? "" : namesAndMetas.get(i);
+			String usage       = (i >= usages.size())        ? "" : usages.get(i);
+			String format      = (nameAndMeta.length() > 0)
+			                   ? " %1$-" + widthMetadata + "s : %2$-1s"
+			                   : " %1$-" + widthMetadata + "s   %2$-1s";
+			String output = String.format(format, nameAndMeta, usage);
+			out.println(output);
+    	}
+    }
+
+    private String localize(String s, ResourceBundle rb) {
+        if(rb!=null)    return rb.getString(s);
+        return s;
+    }
+
+    /**
+     * Wraps a line so that the resulting parts are not longer than a given maximum length.
+     * @param line       Line to wrap
+     * @param maxLength  maximum length for the resulting parts
+     * @return list of all wrapped parts
+     */
+    private List<String> wrapLines(String line, final int maxLength) {
+    	List<String> rv = new ArrayList<String>();
+        for (String restOfLine : line.split("\\n")) {
+            while (restOfLine.length() > maxLength) {
+                // try to wrap at space, but don't try too hard as some languages don't even have whitespaces.
+                int lineLength;
+                String candidate = restOfLine.substring(0, maxLength);
+                int sp=candidate.lastIndexOf(' ');
+                if(sp>maxLength*3/4)    lineLength=sp;
+                else                    lineLength=maxLength;
+                rv.add(restOfLine.substring(0, lineLength));
+                restOfLine = restOfLine.substring(lineLength).trim();
+            }
+            rv.add(restOfLine);
+        }
+    	return rv;
+    }
+
+	private int getPrefixLen(OptionHandler h, ResourceBundle rb) {
+		if(h.option.usage().length()==0)
+			return 0;
+
+		return h.getNameAndMeta(rb).length();
+	}
+
+    /**
+     * Essentially a pointer over a {@link String} array.
+     * Can move forward, can look ahead.
+     */
+    private class CmdLineImpl implements Parameters {
+        private final String[] args;
+        private int pos;
+
+        CmdLineImpl( String[] args ) {
+            this.args = args;
+            pos = 0;
+        }
+
+        protected boolean hasMore() {
+            return pos<args.length;
+        }
+
+        protected String getCurrentToken() {
+            return args[pos];
+        }
+
+        private void proceed( int n ) {
+            pos += n;
+        }
+
+        public String getParameter(int idx) throws CmdLineException {
+			if( pos+idx>=args.length )
+                throw new CmdLineException(CmdLineParser.this, Messages.MISSING_OPERAND.format(getOptionName()));
+            return args[pos+idx];
+        }
+
+        public int size() {
+            return args.length-pos;
+        }
+    }
+
+    private String getOptionName() {
+        return currentOptionHandler.option.toString();
+    }
+
+    /**
+     * Same as {@link #parseArgument(String[])} 
+     */
+    public void parseArgument(Collection<String> args) throws CmdLineException {
+        parseArgument(args.toArray(new String[args.size()]));
+    }
+
+    /**
+     * Parses the command line arguments and set them to the option bean
+     * given in the constructor.
+     *
+     * @param args arguments to parse
+     *
+     * @throws CmdLineException
+     *      if there's any error parsing arguments, or if
+     *      {@link Option#required() required} option was not given.
+     */
+    public void parseArgument(final String... args) throws CmdLineException {
+        CmdLineImpl cmdLine = new CmdLineImpl(args);
+
+        Set<OptionHandler> present = new HashSet<OptionHandler>();
+        int argIndex = 0;
+
+        while( cmdLine.hasMore() ) {
+            String arg = cmdLine.getCurrentToken();
+            if( isOption(arg) ) {
+            	boolean isKeyValuePair = arg.indexOf('=')!=-1;
+                // parse this as an option.
+                currentOptionHandler = isKeyValuePair ? findOptionHandler(arg) : findOptionByName(arg);
+
+                if(currentOptionHandler==null) {
+                    // TODO: insert dynamic handler processing
+                    throw new CmdLineException(this, Messages.UNDEFINED_OPTION.format(arg));
+                }
+
+                // known option; skip its name
+                cmdLine.proceed(1);
+            } else {
+            	if (argIndex >= arguments.size()) {
+            		Messages msg = arguments.size() == 0 ? Messages.NO_ARGUMENT_ALLOWED : Messages.TOO_MANY_ARGUMENTS;
+                    throw new CmdLineException(this, msg.format(arg));
+            	}
+
+            	// known argument
+            	currentOptionHandler = arguments.get(argIndex);
+            	if (!currentOptionHandler.option.isMultiValued())
+            		argIndex++;
+            }
+        	int diff = currentOptionHandler.parseArguments(cmdLine);
+        	cmdLine.proceed(diff);
+        	present.add(currentOptionHandler);
+        }
+
+        // make sure that all mandatory options are present
+        for (OptionHandler handler : options)
+            if(handler.option.required() && !present.contains(handler))
+                throw new CmdLineException(this, Messages.REQUIRED_OPTION_MISSING.format(handler.option.toString()));
+
+        // make sure that all mandatory arguments are present
+        for (OptionHandler handler : arguments)
+            if(handler.option.required() && !present.contains(handler))
+                throw new CmdLineException(this, Messages.REQUIRED_ARGUMENT_MISSING.format(handler.option.toString()));
+    }
+
+	private OptionHandler findOptionHandler(String name) {
+		OptionHandler handler = findOptionByName(name);
+		if (handler==null) {
+			// Have not found by its name, maybe its a property?
+			// Search for parts of the name (=prefix) - most specific first
+			for (int i=name.length(); i>1; i--) {
+				String prefix = name.substring(0, i);
+				Map<String,OptionHandler> possibleHandlers = filter(options, prefix);
+				handler = possibleHandlers.get(prefix);
+				if (handler!=null) return handler;
+			}
+		}
+		return handler;
+	}
+
+	/**
+	 * Finds a registered OptionHandler by its name or its alias.
+	 * @param name name
+	 * @return the OptionHandler or <tt>null</tt>
+	 */
+	private OptionHandler findOptionByName(String name) {
+		for (OptionHandler h : options) {
+			NamedOptionDef option = (NamedOptionDef)h.option;
+			if (name.equals(option.name())) {
+				return h;
+			}
+			for (String alias : option.aliases()) {
+				if (name.equals(alias)) {
+					return h;
+				}
+			}
+		}
+		return null;
+	}
+
+
+	private Map<String,OptionHandler> filter(List<OptionHandler> opt, String keyFilter) {
+		Map<String,OptionHandler> rv = new TreeMap<String,OptionHandler>();
+		for (OptionHandler h : opt) {
+			if (opt.toString().startsWith(keyFilter)) rv.put(opt.toString(), h);
+		}
+		return rv;
+	}
+
+
+    /**
+     * Returns true if the given token is an option
+     * (as opposed to an argument.)
+     */
+    protected boolean isOption(String arg) {
+        return parsingOptions && arg.startsWith("-");
+    }
+
+
+    /**
+     * All {@link OptionHandler}s known to the {@link CmdLineParser}.
+     *
+     * Constructors of {@link OptionHandler}-derived class keyed by their supported types.
+     */
+    private static final Map<Class,Constructor<? extends OptionHandler>> handlerClasses =
+            Collections.synchronizedMap(new HashMap<Class,Constructor<? extends OptionHandler>>());
+
+    /**
+     * Registers a user-defined {@link OptionHandler} class with args4j.
+     *
+     * <p>
+     * This method allows users to extend the behavior of args4j by writing
+     * their own {@link OptionHandler} implementation.
+     *
+     * @param valueType
+     *      The specified handler is used when the field/method annotated by {@link Option}
+     *      is of this type.
+     * @param handlerClass
+     *      This class must have the constructor that has the same signature as
+     *      {@link OptionHandler#OptionHandler(CmdLineParser, OptionDef, Setter)}
+     */
+    public static void registerHandler( Class valueType, Class<? extends OptionHandler> handlerClass ) {
+        if(valueType==null || handlerClass==null)
+            throw new IllegalArgumentException();
+        if(!OptionHandler.class.isAssignableFrom(handlerClass))
+            throw new IllegalArgumentException(Messages.NO_OPTIONHANDLER.format());
+
+        Constructor<? extends OptionHandler> c = getConstructor(handlerClass);
+        handlerClasses.put(valueType,c);
+    }
+
+    private static Constructor<? extends OptionHandler> getConstructor(Class<? extends OptionHandler> handlerClass) {
+        try {
+            return handlerClass.getConstructor(CmdLineParser.class, OptionDef.class, Setter.class);
+        } catch (NoSuchMethodException e) {
+            throw new IllegalArgumentException(Messages.NO_CONSTRUCTOR_ON_HANDLER.format(handlerClass));
+        }
+    }
+
+    static {
+        registerHandler(Boolean.class,BooleanOptionHandler.class);
+        registerHandler(boolean.class,BooleanOptionHandler.class);
+        registerHandler(File.class,FileOptionHandler.class);
+        registerHandler(URL.class, URLOptionHandler.class);
+        registerHandler(URI.class, URIOptionHandler.class);
+        registerHandler(Integer.class,IntOptionHandler.class);
+        registerHandler(int.class,IntOptionHandler.class);
+        registerHandler(Double.class, DoubleOptionHandler.class);
+        registerHandler(double.class,DoubleOptionHandler.class);
+        registerHandler(String.class,StringOptionHandler.class);
+        registerHandler(Byte.class, ByteOptionHandler.class);
+        registerHandler(byte.class, ByteOptionHandler.class);
+        registerHandler(Character.class, CharOptionHandler.class);
+        registerHandler(char.class, CharOptionHandler.class);
+        registerHandler(Float.class, FloatOptionHandler.class);
+        registerHandler(float.class, FloatOptionHandler.class);
+        registerHandler(Long.class, LongOptionHandler.class);
+        registerHandler(long.class, LongOptionHandler.class);
+        registerHandler(Short.class, ShortOptionHandler.class);
+        registerHandler(short.class, ShortOptionHandler.class);
+        registerHandler(Date.class, DateOptionHandler.class);
+        registerHandler(Query.class, QueryOptionHandler.class);
+        registerHandler(Object.class, ObjectOptionHandler.class);
+        // enum is a special case
+        registerHandler(Map.class,MapOptionHandler.class);
+    }
+
+	public void setUsageWidth(int usageWidth) {
+		this.usageWidth = usageWidth;
+	}
+
+	public void stopOptionParsing() {
+		parsingOptions = false;
+	}
+
+    /**
+     * Prints a single-line usage to the screen.
+     *
+     * <p>
+     * This is a convenience method for calling {@code printUsage(new OutputStreamWriter(out),null)}
+     * so that you can do {@code printUsage(System.err)}.
+     */
+	public void printSingleLineUsage(OutputStream out) {
+		printSingleLineUsage(new OutputStreamWriter(out),null);
+	}
+
+    /**
+     * Prints a single-line usage to the screen.
+     *
+     * @param rb
+     *      if this is non-null, {@link Option#usage()} is treated
+     *      as a key to obtain the actual message from this resource bundle.
+     */
+	public void printSingleLineUsage(Writer w, ResourceBundle rb) {
+		PrintWriter pw = new PrintWriter(w);
+		for (OptionHandler h : arguments) {
+			printSingleLineOption(pw, h, rb);
+		}
+		for (OptionHandler h : options) {
+			printSingleLineOption(pw, h, rb);
+		}
+		pw.flush();
+	}
+
+	private void printSingleLineOption(PrintWriter pw, OptionHandler h, ResourceBundle rb) {
+		pw.print(' ');
+		if (!h.option.required())
+			pw.print('[');
+		pw.print(h.getNameAndMeta(rb));
+		if (h.option.isMultiValued()) {
+			pw.print(" ...");
+		}
+		if (!h.option.required())
+			pw.print(']');
+	}
+
+    private static final Logger LOGGER = Logger.getLogger(CmdLineParser.class.getName());
+}

Property changes on: tmp/org.txm.core/src/java/org/kohsuke/args4j/CmdLineParser.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/kohsuke/args4j/CmdLineException.java
===================================================================
--- tmp/org.txm.core/src/java/org/kohsuke/args4j/CmdLineException.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/kohsuke/args4j/CmdLineException.java	(revision 258)
@@ -0,0 +1,64 @@
+package org.kohsuke.args4j;
+
+import org.kohsuke.args4j.spi.OptionHandler;
+
+/**
+ * Signals an error in the user input.
+ *
+ * @author Kohsuke Kawaguchi
+ */
+public class CmdLineException extends Exception {
+	private static final long serialVersionUID = -8574071211991372980L;
+
+    private CmdLineParser parser;
+
+    /**
+     * @deprecated
+     *      Use {@link #CmdLineException(CmdLineParser, String)}
+     */
+    public CmdLineException(String message) {
+        super(message);
+    }
+
+    /**
+     * @deprecated
+     *      Use {@link #CmdLineException(CmdLineParser, String, Throwable)}
+     */
+    public CmdLineException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    /**
+     * @deprecated
+     *      Use {@link #CmdLineException(CmdLineParser, Throwable)}
+     */
+    public CmdLineException(Throwable cause) {
+        super(cause);
+    }
+
+    public CmdLineException(CmdLineParser parser, String message) {
+        super(message);
+        this.parser = parser;
+    }
+
+    public CmdLineException(CmdLineParser parser, String message, Throwable cause) {
+        super(message, cause);
+        this.parser = parser;
+    }
+
+    public CmdLineException(CmdLineParser parser, Throwable cause) {
+        super(cause);
+        this.parser = parser;
+    }
+
+    /**
+     * Obtains the {@link CmdLineParser} that triggered an exception.
+     *
+     * <p>
+     * Unless you have legacy {@link OptionHandler} that doesn't pass in this information
+     * when it throws an exception, this method should always return a non-null value. a
+     */
+    public CmdLineParser getParser() {
+        return parser;
+    }
+}

Property changes on: tmp/org.txm.core/src/java/org/kohsuke/args4j/CmdLineException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/kohsuke/args4j/NamedOptionDef.java
===================================================================
--- tmp/org.txm.core/src/java/org/kohsuke/args4j/NamedOptionDef.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/kohsuke/args4j/NamedOptionDef.java	(revision 258)
@@ -0,0 +1,56 @@
+package org.kohsuke.args4j;
+
+/**
+ * Run-time copy of the Option or Argument annotation.
+ */
+public final class NamedOptionDef extends OptionDef {
+    private final String name;
+    private final String def;
+    private final String widget;
+	private final String[] aliases;
+    
+    public NamedOptionDef(Option o, boolean forceMultiValued) {
+    	super(o.usage(),o.metaVar(),o.required(),o.handler(),o.multiValued() || forceMultiValued);
+    	
+    	this.name = o.name();
+    	this.def = o.def();
+    	this.widget = o.widget();
+    	this.aliases = o.aliases();
+    }
+    
+    public String name() {
+    	return name;
+    }
+    
+    public String def() {
+    	return def;
+    }
+    
+    public String widget() {
+    	return widget;
+    }
+    
+    public String[] aliases() {
+    	return aliases;
+    }
+    
+    @Override
+    public String toString() {
+    	if (aliases.length > 0) {
+    		String str = ""; //$NON-NLS-1$
+    		for (String alias : aliases) {
+    			if (str.length() > 0) {
+    				str += ", "; //$NON-NLS-1$
+    			}
+    			str += alias;
+    		}
+    		return name() + " widget="+widget()+" (" + str + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    	}
+    	return name();
+    }
+    
+    @Override
+    public boolean isArgument() {
+    	return false;
+    }
+}

Property changes on: tmp/org.txm.core/src/java/org/kohsuke/args4j/NamedOptionDef.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/kohsuke/args4j/Messages_ru_RU.properties
===================================================================
--- tmp/org.txm.core/src/java/org/kohsuke/args4j/Messages_ru_RU.properties	(revision 0)
+++ tmp/org.txm.core/src/java/org/kohsuke/args4j/Messages_ru_RU.properties	(revision 258)
@@ -0,0 +1,22 @@
+MISSING_OPERAND = \u041E\u043F\u0446\u0438\u044F "{0}" \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043E\u043F\u0435\u0440\u0430\u043D\u0434
+UNDEFINED_OPTION = "{0}" \u043D\u0435\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043B\u044C\u043D\u0430\u044F \u043E\u043F\u0446\u0438\u044F
+NO_ARGUMENT_ALLOWED = \u041D\u0435\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043B\u044C\u043D\u044B\u0439 \u0430\u0440\u0433\u0443\u043C\u0435\u043D\u0442\: {0}
+REQUIRED_OPTION_MISSING = \u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044F \u043E\u043F\u0446\u0438\u044F "{0}"
+REQUIRED_ARGUMENT_MISSING = \u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044F \u0430\u0440\u0433\u0443\u043C\u0435\u043D\u0442 "{0}"
+TOO_MANY_ARGUMENTS = \u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u043D\u043E\u0433\u043E \u0430\u0440\u0433\u0443\u043C\u0435\u043D\u0442\u043E\u0432\: {0}
+
+
+# For translation
+#------------------
+# METADATA_ERROR =     Problems while reading the args-confguration.
+# MULTIPLE_USE_OF_ARGUMENT =     Argument with index {0} is used more than once
+# MULTIPLE_USE_OF_OPTION =     Option name {0} is used more than once
+# UNKNOWN_HANDLER =     No OptionHandler is registered to handle {0}
+# NO_OPTIONHANDLER =     Not an OptionHandler class
+# NO_CONSTRUCTOR_ON_HANDLER =     {0} does not have the proper constructor
+# FORMAT_ERROR_FOR_MAP =     An argument for setting a Map must contain a ''=''
+# MAP_HAS_NO_KEY =     A key must be set.
+
+
+
+

Property changes on: tmp/org.txm.core/src/java/org/kohsuke/args4j/Messages_ru_RU.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/kohsuke/args4j/ExampleMode.java
===================================================================
--- tmp/org.txm.core/src/java/org/kohsuke/args4j/ExampleMode.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/kohsuke/args4j/ExampleMode.java	(revision 258)
@@ -0,0 +1,33 @@
+package org.kohsuke.args4j;
+
+/**
+ * Used with {@link CmdLineParser#printExample(ExampleMode)}.
+ *
+ * @author Kohsuke Kawaguchi
+ */
+public enum ExampleMode {
+    /**
+     * Print all defined options in the example.
+     *
+     * <p>
+     * This would be useful only when you have small number of options.
+     */
+    ALL() {
+    	@Override
+        /*package*/ boolean print(OptionDef o) {
+            return true;
+        }
+    },
+
+    /**
+     * Print all {@link Option#required() required} option.
+     */
+    REQUIRED() {
+    	@Override
+        /*package*/ boolean print(OptionDef o) {
+            return o.required();
+        }
+    };
+
+    /*package*/ abstract boolean print(OptionDef o);
+}

Property changes on: tmp/org.txm.core/src/java/org/kohsuke/args4j/ExampleMode.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/kohsuke/args4j/FieldParser.java
===================================================================
--- tmp/org.txm.core/src/java/org/kohsuke/args4j/FieldParser.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/kohsuke/args4j/FieldParser.java	(revision 258)
@@ -0,0 +1,33 @@
+package org.kohsuke.args4j;
+
+import java.lang.reflect.Field;
+
+import org.kohsuke.args4j.spi.ConfigElement;
+import org.kohsuke.args4j.spi.OptionImpl;
+import org.kohsuke.args4j.spi.Setters;
+
+/**
+ * This metadata parser makes all field available to the CmdLineParser.
+ * @author Jan Materne
+ *
+ */
+public class FieldParser {
+
+	public void parse(CmdLineParser parser, Object bean) throws ClassNotFoundException {
+        for(Class c=bean.getClass(); c!=null; c=c.getSuperclass()) {
+        	System.out.println("Class: " + c); //$NON-NLS-1$
+        	for( Field f : c.getDeclaredFields() ) {
+        		Option o = new OptionImpl(createConfigElement(f));
+				parser.addOption(Setters.create(f, bean), o );
+        	}
+        }
+	}
+
+	private ConfigElement createConfigElement(Field f) {
+		ConfigElement rv = new ConfigElement();
+		rv.field = f.getName();
+		rv.name = "-" + f.getName(); //$NON-NLS-1$
+		return rv;
+	}
+
+}

Property changes on: tmp/org.txm.core/src/java/org/kohsuke/args4j/FieldParser.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/kohsuke/args4j/Messages_de_DE.properties
===================================================================
--- tmp/org.txm.core/src/java/org/kohsuke/args4j/Messages_de_DE.properties	(revision 0)
+++ tmp/org.txm.core/src/java/org/kohsuke/args4j/Messages_de_DE.properties	(revision 258)
@@ -0,0 +1,49 @@
+# Unicode for Umlauts
+#   Ae, ae     \u00c4, \u00e4
+#   Oe, oe     \u00d6, \u00f6
+#   Ue, ue     \u00dc, \u00fc
+#   ss         \u00df
+
+
+
+MISSING_OPERAND = \
+    Option "{0}" ben\u00f6tigt einen Operanden
+
+UNDEFINED_OPTION = \
+    "{0}" ist keine g\u00fcltige Option
+
+NO_ARGUMENT_ALLOWED = \
+    Kein Argument erlaubt: {0}
+
+REQUIRED_OPTION_MISSING = \
+    Option "{0}" wird ben\u00f6tigt
+    
+REQUIRED_ARGUMENT_MISSING = \
+    Argument "{0}" wird ben\u00f6tigt
+    
+TOO_MANY_ARGUMENTS = \
+    Zu viele Argumente: {0}
+
+METADATA_ERROR = \
+    Kann die Args4J-Metadaten nicht lesen
+
+MULTIPLE_USE_OF_ARGUMENT = \
+    Das Argument mit Index {0} ist mehr als einmal verwendet
+
+MULTIPLE_USE_OF_OPTION = \
+    Die Option ''{0}'' ist mehr als einmal verwendet
+
+UNKNOWN_HANDLER = \
+    Es ist kein OptionHandler f�r ''{0}'' registriert
+
+NO_OPTIONHANDLER = \
+    Ist keine OptionHandler Klasse
+
+NO_CONSTRUCTOR_ON_HANDLER = \
+    {0} hat nicht den notwendigen Konstruktor
+
+FORMAT_ERROR_FOR_MAP = \
+    Ein Argument f�r eine Map muss ein "=" enthalten
+
+MAP_HAS_NO_KEY = \
+    A Schl\u00fcssel muss gesetzt sein
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/java/org/kohsuke/args4j/Messages_de_DE.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/kohsuke/args4j/MapSetter.java
===================================================================
--- tmp/org.txm.core/src/java/org/kohsuke/args4j/MapSetter.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/kohsuke/args4j/MapSetter.java	(revision 258)
@@ -0,0 +1,71 @@
+package org.kohsuke.args4j;
+
+import java.lang.reflect.Field;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.kohsuke.args4j.spi.Setter;
+
+/**
+ * This setter adds a new entry to a Map.
+ * The value which is passed is split into the Map-key and Map-value by a "=".
+ * <p>
+ * <tt>-map key=value</tt></p>
+ */
+public class MapSetter implements Setter {
+    private final Field f;
+    private final Object bean;
+
+
+    public MapSetter(Object bean, Field f) {
+		super();
+		this.f = f;
+		this.bean = bean;
+	}
+
+	public Class getType() {
+        return f.getType();
+    }
+
+    public boolean isMultiValued() {
+    	return false;
+    }
+
+    public void addValue(Object value) {
+    	if (String.valueOf(value).indexOf('=') == -1) {
+    		throw new RuntimeException(Messages.FORMAT_ERROR_FOR_MAP.format());
+    	}
+
+    	String[] parts = String.valueOf(value).split("="); //$NON-NLS-1$
+    	String mapKey   = parts[0];
+    	String mapValue = (parts.length > 1) ? parts[1] : null;
+
+    	if (mapKey == null || mapKey.length()==0) {
+    		throw new RuntimeException(Messages.MAP_HAS_NO_KEY.format());
+    	}
+
+        try {
+            addValue(mapKey, mapValue);
+        } catch (IllegalAccessException _) {
+            // try again
+            f.setAccessible(true);
+            try {
+                addValue(mapKey, mapValue);
+            } catch (IllegalAccessException e) {
+                throw new IllegalAccessError(e.getMessage());
+            }
+        }
+    }
+
+    private void addValue(Object key, Object value) throws IllegalArgumentException, IllegalAccessException {
+    	Map map = (Map) f.get(bean);
+    	if (map == null) {
+    		// Field is null so set it to an empty Map
+    		map = new HashMap();
+    		// and reset the field on the bean not just the local reference
+    		f.set(bean,	map);
+    	}
+    	map.put(key, value);
+    }
+
+}

Property changes on: tmp/org.txm.core/src/java/org/kohsuke/args4j/MapSetter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/kohsuke/args4j/Config.java
===================================================================
--- tmp/org.txm.core/src/java/org/kohsuke/args4j/Config.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/kohsuke/args4j/Config.java	(revision 258)
@@ -0,0 +1,84 @@
+package org.kohsuke.args4j;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.kohsuke.args4j.spi.ConfigElement;
+import org.xml.sax.Attributes;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.DefaultHandler;
+import org.xml.sax.helpers.XMLReaderFactory;
+
+
+/**
+ * Metadataconfiguration.
+ * This class holds all metadata for a class, mainly a list of @Options and @Arguments.
+ *
+ * @author Jan Materne
+ */
+public class Config {
+
+	/** All @Options. */
+	public List<ConfigElement> options = new ArrayList<ConfigElement>();;
+
+	/** All @Arguments. */
+	public List<ConfigElement> arguments = new ArrayList<ConfigElement>();
+
+
+	/**
+	 * SAX-Handler for reading the configuration file.
+	 * @author Jan Materne
+	 */
+	public class ConfigHandler extends DefaultHandler {
+		public ConfigHandler(Config config) {
+			super();
+			this.config = config;
+		}
+
+		Config config;
+		ConfigElement currentCE;
+
+		@Override
+		public void startElement(String uri, String localName, String qName,
+				Attributes attributes) throws SAXException {
+			if (qName.equals("option") || qName.equals("argument")) {
+				currentCE = new ConfigElement();
+				currentCE.field = attributes.getValue("field");
+				currentCE.handler = attributes.getValue("handler");
+				currentCE.metavar = attributes.getValue("metavar");
+				currentCE.method = attributes.getValue("method");
+				currentCE.name = attributes.getValue("name");
+				currentCE.usage = attributes.getValue("usage");
+				currentCE.multiValued = Boolean.getBoolean(attributes.getValue("multiValued"));
+				currentCE.required = Boolean.getBoolean(attributes.getValue("required"));
+				if (attributes.getValue("aliases") != null) {
+					currentCE.aliases = attributes.getValue("aliases").split(",");
+				} else {
+					currentCE.aliases = new String[]{};
+				}
+				(qName.equals("option") ? config.options : config.arguments).add(currentCE);
+			}
+		}
+	}
+
+	/**
+	 * Parses a XML file and returns a Config object holding the information.
+	 * @param xml source of the xml data
+	 * @return
+	 * @throws IOException
+	 * @throws SAXException
+	 */
+	public static Config parse(InputSource xml) throws IOException, SAXException {
+		Config rv = new Config();
+		XMLReader reader = XMLReaderFactory.createXMLReader();
+		ConfigHandler handler = rv.new ConfigHandler(rv);
+		reader.setContentHandler(handler);
+		reader.parse(xml);
+		return rv;
+	}
+
+}

Property changes on: tmp/org.txm.core/src/java/org/kohsuke/args4j/Config.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/tests/tests_groovy.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/tests/tests_groovy.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/tests/tests_groovy.groovy	(revision 258)
@@ -0,0 +1 @@
+print(Progression5)
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/tests/advancedPartition.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/tests/advancedPartition.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/tests/advancedPartition.groovy	(revision 258)
@@ -0,0 +1,719 @@
+package tests
+
+import org.txm.rcpapplication.views.*
+import org.txm.searchengine.cqp.corpus.*
+
+
+/*
+import java.awt.Dimension
+import java.util.UUID;
+
+import javax.swing.JFrame;
+import javax.swing.JOptionPane;
+
+import org.txm.Toolbox
+import org.txm.searchengine.cqp.MemCqiClient
+import org.txm.searchengine.cqp.MemCqiServer
+import org.txm.searchengine.cqp.corpus.*
+import org.txm.functions.ReferencePattern
+import org.txm.rcpapplication.views.CorporaView
+import org.txm.searchengine.cqp.corpus.query.Query
+*/
+
+
+/**
+ * Create partition with advanced CQL queries and autoname the parts.
+ * Can create partitions by defining a multi-level structural units hierarchy or by defining several properties values for one structural unit.
+ * Can define some structural units to remove from the resulting parts subcorpus.
+ *
+ */
+
+// TODO : Log
+println "******************************** Starting ********************************************";
+
+
+// *************************** User parameters ************************************************************
+
+
+// Test 1 : partition en excluant des sections
+def CORPUS_NAME = "LIVRETOPERA2"								// The name of the corpus to partition
+
+def SUBCORPUS_NAME = null										// The name of the subcorpus to partition
+//def SUBCORPUS_NAME = "TEST"										// The name of the subcorpus to partition if needed
+// FIXME: subcorpus management is bugged, when trying to create a CA on a Partition created on a subcorpus, it doesn't work because of the getLexicon() method which throws a CqiCqpErrorErrorGeneral exception
+
+PartitionQueriesGenerator.STRUCTURAL_UNITS = ['sp']; 					// Applying the partition on these structural units
+PartitionQueriesGenerator.STRUCTURAL_UNITS_PROPERTIES = ['who'];		// Applying the partition on these properties of structural units defined above
+
+PartitionQueriesGenerator.STRUCTURAL_UNITS_TO_IGNORE = ['speaker'];	// These structural units will be removed from the partition. NOTE : If doing that you need to define an EXPAND_TARGET
+																		// if you want some subcorpus parts that will manage sequential positions queries
+
+PartitionQueriesGenerator.EXPAND_TARGET = 'lg'; 						// Expand the results to this structural unit parent target. If some structural units to ignore are defined
+																		// and the expand target is upper on the hierarchy than them, the structural units to ignore WON'T be ignored
+
+//PartitionQueriesGenerator.PARTITION_NAME = 'gugu';					// The partition name. If empty or not defined, the partition will be autonamed regarding of the structural units and properties
+
+
+
+
+// Test 2 : partition sur arborescence (multi-niveau sur 2 niveaux)
+//def CORPUS_NAME = "LIVRETOPERA10TEXTES"
+//PartitionQueriesGenerator.STRUCTURAL_UNITS = ['text', 'div1'];
+//PartitionQueriesGenerator.STRUCTURAL_UNITS_PROPERTIES = ['id', 'name'];
+
+
+// Test 3 : partition sur arborescence (multi-niveau sur 3 niveaux)
+//def CORPUS_NAME = "LIVRETOPERA10TEXTES"
+//PartitionQueriesGenerator.STRUCTURAL_UNITS = ['text', 'div1', 'div2'];
+//PartitionQueriesGenerator.STRUCTURAL_UNITS_PROPERTIES = ['id', 'name', 'name'];
+
+
+// Test 4 : partition sur arborescence (multi-niveau sur 4 niveaux)
+// Ajouter le 'n' permet par exemple ici de trier les parties par ordre de scène car sinon le tri est problématique, ex : "SCENE II" passe avant "SCENE PREMIERE"
+//def CORPUS_NAME = "LIVRETOPERA2"
+//PartitionQueriesGenerator.STRUCTURAL_UNITS = ['text', 'div1', 'div2', 'div2'];
+//PartitionQueriesGenerator.STRUCTURAL_UNITS_PROPERTIES = ['id', 'name', 'n', 'name'];
+
+
+// Test 5 : partitions croisées (sur plusieurs propriétés d'une même structure)
+//def CORPUS_NAME = "DISCOURS"
+//PartitionQueriesGenerator.STRUCTURAL_UNITS = ['text', 'text'];
+//PartitionQueriesGenerator.STRUCTURAL_UNITS_PROPERTIES = ['loc', 'type'];
+
+
+
+// Tests
+//def CORPUS_NAME = "LIVRETOPERA10TEXTES"
+//PartitionQueriesGenerator.STRUCTURAL_UNITS = ['div1', 'sp'];
+//PartitionQueriesGenerator.STRUCTURAL_UNITS_PROPERTIES = ['name', 'who'];
+
+// Tests
+//def CORPUS_NAME = "LIVRETOPERA10TEXTES"
+//PartitionQueriesGenerator.STRUCTURAL_UNITS = ['div1'];
+//PartitionQueriesGenerator.STRUCTURAL_UNITS_PROPERTIES = ['n'];
+//PartitionQueriesGenerator.PART_NAMES_PREFIX = 'act_';
+
+
+
+
+// *************************** Debug parameters ************************************************************
+
+
+PartitionQueriesGenerator.DEBUG = 0; 	// If DEBUG != 0 then partition is not created,
+										// script only outputs the created queries and part names strings in console
+
+
+
+// *************************** End of parameters ************************************************************
+
+
+
+
+
+
+
+// Running
+def partition = PartitionQueriesGenerator.createPartition(CORPUS_NAME, SUBCORPUS_NAME);
+
+
+// Refreshing the RCP component
+if(partition != null)	{
+	monitor.syncExec(new Runnable() {
+			public void run() {
+				CorporaView.refresh();
+				CorporaView.expand(partition.getParent());
+			}
+		});
+}
+
+
+
+
+
+/**
+ * Create a list of queries and part names regarding the structural units, structural units properties, structural units to ignore user defined lists and expand target value specified.
+ * @author s
+ *
+ */
+public class PartitionQueriesGenerator	{
+
+	public static int DEBUG = 0;								// si DEBUG != 0, alors les requêtes sont affichées mais la partition n'est pas créée
+
+	public static String PARTITION_NAME = '';
+	public static String[] STRUCTURAL_UNITS = [];				// Liste des unités structurelles sur lesquelles effectuer la partition, ex: ['text', 'div1']
+	public static String[] STRUCTURAL_UNITS_PROPERTIES = [];	// Propriétés des unités structurelles sur lesquelles effectuer la partition, ex : ['id', 'name']
+	public static String[] STRUCTURAL_UNITS_TO_IGNORE = [];		// Structure à ignorer, ex. CQL : !speaker
+	public static String PART_NAMES_PREFIX = '';
+	public static String EXPAND_TARGET = null;					// Expand to target, englobe les empans jusqu'à la balise parente spécifiée. NOTE : Le expand entre en conflit avec les sections à ignorer.
+																// Si la target est à un niveau supérieur aux balises à ignorer, il les remet dans liste de résultats CWB et elles ne sont donc pas ignorées
+
+
+
+	public static ArrayList<String> queries = new ArrayList<String>();
+	public static ArrayList<String> partNames = new ArrayList<String>();
+
+
+	/**
+	 * Init the generator and process.
+	 * @param corpusName
+	 */
+	public static Partition createPartition(String corpusName, String subcorpusName)	{
+
+		if(STRUCTURAL_UNITS.size() > 0 && STRUCTURAL_UNITS.size() == STRUCTURAL_UNITS_PROPERTIES.size())	{
+
+			// TODO : Log
+			println '**************************************************************************************************************'
+			println 'Creating the queries on corpus "' + corpusName + "'" ;
+
+			Corpus corpus = CorpusManager.getCorpusManager().getCorpus(corpusName);
+
+
+			// Subcorpora
+			if(subcorpusName != null)	{
+				corpus = corpus.getSubcorpusByName(subcorpusName);
+			}
+
+
+
+			// Recursing through the corpus and subcorpus
+			process(corpus, 0, '', '');
+
+			// Finalizing the queries
+			finalizeQueries();
+
+
+			// TODO : Debug
+			// Displaying the partition name
+			println '';
+			println 'PARTITION_NAME: ' + PartitionQueriesGenerator.PARTITION_NAME;
+
+			// Displaying the queries
+			println 'Queries (count = ' + PartitionQueriesGenerator.queries.size() + '):';
+			for(query in PartitionQueriesGenerator.queries)	{
+				println query;
+			}
+			// Displaying the part names
+			println 'Partnames (count = ' + PartitionQueriesGenerator.partNames.size() + '):';
+			for(partName in PartitionQueriesGenerator.partNames)	{
+				print partName + ' / ';
+			}
+
+
+			// TODO : Log
+			println 'Queries created.';
+
+			// Creating the partition
+			if(DEBUG == 0 && queries.size() == partNames.size()) {
+				return corpus.createPartition(PARTITION_NAME, queries, partNames);
+			}
+
+		}
+		else	{
+			// TODO : Log
+			println 'Structural units count or structural units properties count error.';
+			return null
+		}
+
+	}
+
+
+
+
+	/**
+	 * Recurse through structural units and structural units properties of corpus and create the queries and the part names.
+	 * @param corpus the corpus or subcorpus
+	 * @param index the index for recursion
+	 * @param tmpQuery the temporary query for creating subcorpus part
+	 * @param tmpPartName the temporary part name of the subcorpus part
+	 */
+	protected static void process(Corpus corpus, int index, String tmpQuery, String tmpPartName)	{
+
+
+		// End of array
+		if(index >= STRUCTURAL_UNITS.size())	{
+
+			queries.add(tmpQuery);
+			partNames.add(PART_NAMES_PREFIX + tmpPartName);
+
+			return;
+		}
+
+		StructuralUnit su = corpus.getStructuralUnit(STRUCTURAL_UNITS[index]);
+		StructuralUnitProperty sup = su.getProperty(STRUCTURAL_UNITS_PROPERTIES[index]);
+
+		// TODO : Log
+		println ''
+		if(index == 0)	{
+			println 'Pocessing Structural Unit Property "' + sup.getFullName() + '" on mother corpus "' + corpus.getName() + '"';
+		}
+		else	{
+			println 'Pocessing Structural Unit Property "' + sup.getFullName() + '" on subcorpus part "' + tmpPartName + '"';
+		}
+		println ''
+
+
+		// Creating the queries parts for each structural units properties values
+		//for (supValue in sup.getOrderedValues()) { // TODO : signaler bug Matthieu, on ne devrait pas être obligé de repasser le sous-corpus à la méthode car sup a déjà été créée depuis le sous-corpus ? getValues() bugge aussi
+		for (supValue in sup.getOrderedValues(corpus)) {
+
+			// TODO : Log
+			println ''
+			println 'Value "' + supValue + '"';
+			println ''
+
+
+			// Getting the subcorpus linked to the structural unit property value
+			Subcorpus tmpSubcorpus = corpus.createSubcorpusWithQueryString(su, sup, supValue, "tmp" + UUID.randomUUID());
+
+			// Partition conditions and part name separators
+			String and = '';
+			String underscore = '';
+			if(tmpQuery != '')	{
+				underscore = '_';
+				and = ' & ';
+			}
+
+
+			process(tmpSubcorpus, index + 1, (tmpQuery + and + '_.' + sup.getFullName() + '="' + supValue + '"'), tmpPartName + underscore + supValue);
+
+			// Deleting the temporary subcorpus
+			// TODO : bug : cette méthode ne supprime pas le corpus sans doute car il faut que le sous-corpus ne contienne pas d'autres sous-corpus ? le delete() en revanche fonctionne.
+//			corpus.dropSubcorpus(tmpSubcorpus);
+			tmpSubcorpus.delete();
+
+		}
+	}
+
+
+	/**
+	 * 	Autoname the partition.
+	 * @param partitionName
+	 */
+	protected static void autoNamePartition(String partitionName)	{
+
+		// Structural units names and properties
+		for(int i = 0; i < STRUCTURAL_UNITS.size(); i++)	{
+			partitionName +=  STRUCTURAL_UNITS[i] + '_' + STRUCTURAL_UNITS_PROPERTIES[i] + '.';
+		}
+
+		// Structural units to ignore
+		for(int i = 0; i < STRUCTURAL_UNITS_TO_IGNORE.size(); i++)	{
+			partitionName +=  'NOT_' + STRUCTURAL_UNITS_TO_IGNORE[i] + '.';
+		}
+
+
+		// Removing last point in name
+		PARTITION_NAME = partitionName.substring(0, partitionName.length() - 1);
+	}
+
+
+	/**
+	 * Finalize the queries.
+	 */
+	protected static void finalizeQueries()	{
+
+		String expandTo = '';
+		// Expanding to user defined target
+		if(EXPAND_TARGET != null && EXPAND_TARGET != '')	{
+			expandTo = ' expand to ' + EXPAND_TARGET;
+		}
+		// Expanding to last child structural unit in user defined hierarchy
+		else if(STRUCTURAL_UNITS_TO_IGNORE.size() == 0)	{
+			expandTo = ' expand to ' + STRUCTURAL_UNITS[STRUCTURAL_UNITS.size() - 1];
+		}
+
+		// Autonaming the partition
+		if(PARTITION_NAME == '')	{
+			autoNamePartition(PARTITION_NAME);
+			// Finalizing partition name
+			PARTITION_NAME += expandTo.replace(' expand to', '.EXPAND TO').replace(' ', '_');
+		}
+
+
+		// Finalizing queries
+		for(int j = 0; j < queries.size(); j++)	{
+
+			String queryEnd = '';
+
+			// Removing some sections
+			for(sectionToIgnore in STRUCTURAL_UNITS_TO_IGNORE)	{
+				queryEnd += ' & !' + sectionToIgnore;
+			}
+
+			queryEnd += ']' + expandTo;
+
+			queries.set(j, '[' +  queries.get(j) + queryEnd);
+		}
+	}
+
+}
+
+
+
+
+
+
+/*
+// Test dialogue de confirmation avant création de la partition
+JFrame frame = new JFrame('test');
+//frame.setMinimumSize(new Dimension(400, 400));
+//frame.setVisible(true);
+//frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+int n = JOptionPane.showConfirmDialog(
+	frame, "Would you like green eggs and ham?",
+	"An Inane Question",
+	JOptionPane.YES_NO_OPTION);
+if (n == JOptionPane.YES_OPTION) {
+frame.setTitle("Ewww!");
+} else if (n == JOptionPane.NO_OPTION) {
+frame.setTitle("Me neither!");
+} else {
+frame.setTitle("Come on -- tell me!");
+}*/
+
+
+
+
+
+//// Récupération des unités structurelles et création de la liste des requêtes CQL
+//int i = 0;
+//ArrayList<String> queries = new ArrayList<String>();
+//ArrayList<String> partNames = new ArrayList<String>();
+//
+//
+//int currentQueriesCount;
+//if(STRUCTURAL_UNITS.size() > 0 && STRUCTURAL_UNITS.size() == STRUCTURAL_UNITS_PROPERTIES.size())	{
+//
+//	// Parcours des unités strcuturelles à traiter
+//	for (suName in STRUCTURAL_UNITS) {
+//
+//		// Définition auto du nom de partition
+//		PARTITION_NAME += suName + '_';
+//
+//
+//		StructuralUnit su = corpus.getStructuralUnit(suName);
+//
+//
+//		// TODO : Debug
+//		println ''
+//		println 'Structural Unit Name: ' + su.getName();
+//
+//
+//		// Récupération des propriétés d'unités structurelles
+//		for (StructuralUnitProperty sup in su.getProperties())	{
+//
+//
+//			if(STRUCTURAL_UNITS_PROPERTIES[i] != '' && sup.getName() == STRUCTURAL_UNITS_PROPERTIES[i])	{
+//
+//				// Définition auto du nom de partition
+//				PARTITION_NAME += STRUCTURAL_UNITS_PROPERTIES[i] + ".";
+//
+//				// TODO : Debug
+//				println "Structural Unit Property: " + sup.getName() + " ";
+//
+//
+//				// Récupération des valeurs des propriétés d'unités structurelles
+//
+//				//for (supValue in sup.getOrderedValues()) {
+//				for (supValue in sup.getOrderedValues()) {
+//
+//					// Récupération du sous-corpus lié à la valeur de propriété de structure
+//					Subcorpus tmpSubcorpus = corpus.createSubcorpusWithQueryString(su, sup, supValue, "tmp");
+//
+//					String query = suName + '_' + STRUCTURAL_UNITS_PROPERTIES[i] + '="' + supValue + '"';
+//
+//
+//					queries.add(query);
+//					partNames.add(supValue);
+//
+//					// TODO : Debug
+//					print supValue + " ";
+//
+//					// Suppression du sous-corpus temporaire
+//					corpus.dropSubcorpus(tmpSubcorpus);
+//
+//				}
+//
+//			}
+//		}
+//
+//
+////		// Ajout des niveaux inférieurs
+////		for(int i = 1; i < STRUCTURAL_UNITS.size(); i++)	{
+////
+////			for(int j = 0; j < queries.size(); j++)	{
+////				queries.set(j, queries.get(j) + ' & _.' + STRUCTURAL_UNITS[i] + '_' + STRUCTURAL_UNITS_PROPERTIES[i] + '=".*"');
+////
+////				// Noms de partitions
+////				partNames.set(j, partNames.get(j) + '_' + STRUCTURAL_UNITS[i] + '_'  + STRUCTURAL_UNITS_PROPERTIES[i]);
+////			}
+////		}
+//
+//
+//
+//
+//
+//
+//		i++;
+//	//	}
+//	//	else	{
+//	//
+//	//	}
+//
+//	}
+//
+//
+//
+//
+//
+//	// Clôture des requêtes
+//	for(int j = 0; j < queries.size(); j++)	{
+//
+//		String queryEnd = '';
+//
+//		// Suppression de sections
+//		for(sectionToIgnore in STRUCTURAL_UNITS_TO_IGNORE)	{
+//			queryEnd += ' & !' + sectionToIgnore;
+//		}
+//
+//		queryEnd += ']';
+//
+//		// Expand to target
+//		if(EXPAND_TARGET != null && EXPAND_TARGET != '')	{
+//			queryEnd += ' expand to ' + EXPAND_TARGET;
+//		}
+//
+//		queries.set(j, '[_.' +  queries.get(j) + queryEnd);
+//	}
+//}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+////for (suName in STRUCTURAL_UNITS) {
+//if(STRUCTURAL_UNITS.size() > 0 && STRUCTURAL_UNITS.size() == STRUCTURAL_UNITS_PROPERTIES.size())	{
+//
+//	suName = STRUCTURAL_UNITS[0]
+//	//if(STRUCTURAL_UNITS.size() > 1)	{
+//
+//	// Définition auto du nom de partition
+//	PARTITION_NAME += suName + '_';
+//
+//
+//	// TODO : Debug
+//	println ''
+//	println "Structural Unit Name: $suName"
+//
+//	// Récupération des valeurs des propriétés d'unités structurelles
+//	for (sup in discours.getStructuralUnitProperties(suName.asType(String)))	{
+//
+//		supName = STRUCTURAL_UNITS_PROPERTIES[0];
+//
+//		if(supName != '' && sup.getName() == supName)	{
+//
+//			// Définition auto du nom de partition
+//			PARTITION_NAME += supName + ".";
+//
+//			// TODO : Debug
+//			println "Structural Unit Property: " + supName + " ";
+//
+//			for (supValue in sup.getOrderedValues()) {
+//
+//				String query = '[_.' + suName + '_' + supName + '="' + supValue + '"';
+//
+//				// Suppression de sections
+//				for(sectionToIgnore in STRUCTURAL_UNITS_TO_IGNORE)	{
+//					query += ' & !' + sectionToIgnore;
+//				}
+//
+//
+//
+//				queries.add(query);
+//				partNames.add(supValue);
+//
+//				// TODO : Debug
+//				print supValue + " ";
+//			}
+//		}
+//	}
+//
+//
+//	// Ajout des niveaux inférieurs
+//	for(int i = 1; i < STRUCTURAL_UNITS.size(); i++)	{
+//
+//		for(int j = 0; j < queries.size(); j++)	{
+//			queries.set(j, queries.get(j) + ' & _.' + STRUCTURAL_UNITS[i] + '_' + STRUCTURAL_UNITS_PROPERTIES[i] + '=".*"');
+//
+//			// Noms de partitions
+//			partNames.set(j, partNames.get(j) + '_' + STRUCTURAL_UNITS[i] + '_'  + STRUCTURAL_UNITS_PROPERTIES[i]);
+//		}
+//	}
+//
+//
+//	// Clôture des requêtes
+//	for(int j = 0; j < queries.size(); j++)	{
+//
+//		String queryEnd = ']';
+//
+//		// Expand to target
+//		if(EXPAND_TARGET != null && EXPAND_TARGET != '')	{
+//			queryEnd += ' expand to ' + EXPAND_TARGET;
+//		}
+//
+//		queries.set(j, queries.get(j) + queryEnd);
+//	}
+//
+//
+//
+//	//i++;
+////	}
+////	else	{
+////
+////	}
+//
+////}
+//}
+
+
+
+// Fonctionnelle pour 1 niveau de hiérarchie
+//// Récupération des unités structurelles et création de la liste des requêtes CQL
+//int i = 0;
+//String supName;
+//ArrayList queries = new ArrayList();
+//ArrayList partNames = new ArrayList();
+//
+//for (suName in STRUCTURAL_UNITS) {
+//
+//
+//	// Définition auto du nom de partition
+//	NAME += suName + '_';
+//
+//
+//
+//	println "Structural Unit Name: $suName"
+//
+//	// Récupération des valeurs des propriétés d'unités structurelles
+//	for (sup in discours.getStructuralUnitProperties(suName.asType(String)))	{
+//
+//		supName = STRUCTURAL_UNITS_PROPERTIES[i];
+//
+//		if(supName != '' && sup.getName() == supName)	{
+//
+//			// Définition auto du nom de partition
+//			NAME += supName + ".";
+//
+//			// TODO : Debug
+//			println "Structural Unit Property: " + supName + " ";
+//
+//			for (supValue in sup.getOrderedValues()) {
+//
+//				String query = '[_.' + suName + '_' + supName + '="' + supValue + '"';
+//
+//				// Suppression de sections
+//				for(sectionToIgnore in STRUCTURAL_UNITS_TO_IGNORE)	{
+//					query += ' & !' + sectionToIgnore;
+//				}
+//
+//				 query += ']';
+//
+//				// Expand to target
+//				if(EXPAND_TARGET != null && EXPAND_TARGET != '')	{
+//					query += ' expand to ' + EXPAND_TARGET;
+//				}
+//
+//
+//				queries.add(query);
+//				partNames.add(supValue);
+//
+//				// TODO : Debug
+//				print supValue + " ";
+//			}
+//		}
+//	}
+//	i++;
+//}
+
+
+
+
+//// start
+//if (queries.size() == partnames.size()) {
+////	def discours = CorpusManager.getCorpusManager().getCorpus(CORPUS)
+//	def partition;
+//	if (SUBCORPUS == null) {
+//		println "partition build with $discours"
+//		partition = discours.createPartition(NAME, queries.as, PARTNAMES)
+//	} else {
+//		def subcorpus
+//		if (SUBCORPUSQUERY == null) {
+//			println "partition build with subcorpus by name $SUBCORPUS"
+//			subcorpus = discours.getSubcorpusByName(SUBCORPUS)
+//			if (subcorpus == null) {
+//				println "Error: SUBCORPUS NOT FOUND with name : $SUBCORPUS"
+//			}
+//		} else {
+//			println "partition build with subcorpus with query $SUBCORPUSQUERY"
+//			subcorpus = discours.createSubcorpus(new Query(SUBCORPUSQUERY), SUBCORPUS)
+//		}
+//		partition = subcorpus.createPartition(NAME, QUERIES, PARTNAMES)
+//	}
+//
+//	def list = Arrays.asList(partition.getPartSizes())
+//	println "Partition created $NAME: "+list+" parts"
+//	// println "Total size: "+list.sum()+" - is equal to (sub)corpus size : "+(list.sum() == partition.getCorpus().getSize())
+//    println "Total size: "+list.sum()+" - (sub)corpus size : "+(partition.getCorpus().getSize())
+//
+//	monitor.syncExec(new Runnable() {
+//	public void run() {
+//		CorporaView.refresh();
+//		CorporaView.expand(partition.getParent());
+//	}
+//});
+//} else {
+//	println "QUERIES.size() != PARTNAMES.size() = "+QUERIES.size()+" != "+PARTNAMES.size()
+//}
+
+
+
+
+// parameters
+//def CORPUS_NAME = "LIVRETOPERA10TEXTES"
+////def SUBCORPUS = "NOMDUSOUSCORPUS"
+//def SUBCORPUS = null // si partition sur corpus
+////def SUBCORPUSQUERY = '"je" expand to s'
+//def SUBCORPUSQUERY = null // si sous-corpus par nom
+
+
+
+
+
+
+//def TEXT = "01_ACHILLE ET POLYXENE"
+// def TEXT = "02_ZEPHIRE ET FLORE"
+/*def QUERIES = [
+'<lg>[_.text_id="' + TEXT + '" & _.div1_n="1" & _.sp_who=".*"]+</lg>',
+'<lg>[_.text_id="' + TEXT + '" & _.div1_n="2" & _.sp_who=".*"]+</lg>',
+'<lg>[_.text_id="' + TEXT + '" & _.div1_n="3" & _.sp_who=".*"]+</lg>',
+'<lg>[_.text_id="' + TEXT + '" & _.div1_n="4" & _.sp_who=".*"]+</lg>',
+'<lg>[_.text_id="' + TEXT + '" & _.div1_n="5" & _.sp_who=".*"]+</lg>',
+]
+def PARTNAMES = [
+"acte_1",
+"acte_2",
+"acte_3",
+"acte_4",
+"acte_5",
+]*/
Index: tmp/org.txm.core/src/groovy/tests/tests_cql.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/tests/tests_cql.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/tests/tests_cql.groovy	(revision 258)
@@ -0,0 +1,318 @@
+package tests
+import java.util.UUID;
+
+import org.txm.Toolbox
+import org.txm.searchengine.cqp.MemCqiClient
+import org.txm.searchengine.cqp.MemCqiServer
+import org.txm.searchengine.cqp.corpus.*
+import org.txm.functions.ReferencePattern
+import org.txm.rcpapplication.views.*
+import org.txm.searchengine.cqp.corpus.query.Query
+
+// Debug
+println "******************************** Starting ********************************************";
+
+
+// Tests suite de requêtes directement sur le serveur et création manuelle du sous-corpus
+
+// parameters
+def CORPUS = "LIVRETOPERA10TEXTES"
+//def SUBCORPUS = "NOMDUSOUSCORPUS"
+// def SUBCORPUS = null // si partition sur corpus
+//def SUBCORPUSQUERY = '"je" expand to s'
+//def SUBCORPUSQUERY = null // si sous-corpus par nom
+
+
+def discours = CorpusManager.getCorpusManager().getCorpus(CORPUS)
+def subcorpusCqpId = 'S' + UUID.randomUUID().toString();
+
+try {
+	def server = (MemCqiServer)Toolbox.getCqiServer();
+	
+//	server.query('show corpora;');
+//	server.query("info " + CORPUS + ";");
+	
+	server.query(CORPUS + ";");
+	
+	//client.query(SUBCORPUSQUERY);
+
+	// Suppression de variable de résultats
+//	server.query("discard A;");
+//	server.query("discard B;");
+//	server.query("discard C;");
+	
+//	server.query('C = /region[sp,a]::a.sp_who="IPHIS";');
+
+	
+// Test mono ligne : ne fonctionne pas en mode server
+//	server.query('A = /region[sp]; B = /region[speaker]; C = difference B A;');
+		
+	
+		
+//	server.query('A = /region[sp];');
+//	server.query('B = /region[speaker];');
+//	server.query('C = difference A B;');
+
+	// Tests options d'affichage
+	server.query('show cd;');
+	server.query('show +div1 +div2 +sp +lg +l +speaker;'); // Affichage des balises XML dans les listes de résultats
+	//server.query('set ShowTagAttributes on;');
+	
+	// Tests
+//	server.query('A = /region[sp,a]::a.sp_who="THALIE";');
+//	server.query('B = /region[speaker];');
+//	server.query(subcorpusCqpId + ' = diff A B;');
+
+	
+	//server.query(subcorpusCqpId + ' = B;');
+	
+	
+	
+//	server.query(subcorpusCqpId + ' = <sp>[(_.) != "speaker"]+</sp>;');
+	//server.query(subcorpusCqpId + ' = <div1>[]*<sp>[]+</sp>[]*</div1>;');
+
+	//server.query(subcorpusCqpId + ' = <div1>[!speaker]*</div1>;');
+	
+// server.query(subcorpusCqpId + ' = <lg>[_.div1_n=".*" & _.sp_who="THALIE"]+</lg>;');	
+//	server.query(subcorpusCqpId + ' = /region[i];');
+	
+
+	// Tests de requête sur le sous-corpus créé
+	//server.query('set MatchingStrategy shortest;'); // standard, shortest, longest, traditional
+	//server.query(subcorpusCqpId + ' = [div1 & _.sp_who="THALIE" & !speaker];');
+	//server.query(subcorpusCqpId + ' = [_.div1_name=".*" & !speaker];');
+	//server.query(subcorpusCqpId + ' = [_.div1_name=".*" & !speaker] expand to lg;');
+	server.query(subcorpusCqpId + ' = [div1 & !speaker] expand to lg;');
+	
+	
+	//server.query('group ' + subcorpusCqpId + ' match word;');
+
+	server.query(subcorpusCqpId + ';');
+	
+		
+	//server.query(subcorpusCqpId + ' = [] !;');
+	//server.query(subcorpusCqpId + ';');
+	//server.query(subcorpusCqpId + ' = [] !;');
+//	server.query(subcorpusCqpId + ' = [] expand to div1 & !speaker;');
+	
+	
+	
+	//server.query(subcorpusCqpId + ' = [div1 & !speaker];');
+	//server.query(subcorpusCqpId + ' = [div1 & !speaker] expand to lg;');
+	//server.query(subcorpusCqpId + ' = [div1 & !speaker] expand to lg;');
+	
+	//server.query(subcorpusCqpId + ' = [div1 & !speaker];');
+	
+	//server.query(subcorpusCqpId + ' = [div1 &_.sp_who="THALIE" & !speaker];');
+	
+	//server.query(subcorpusCqpId + ' = [div1 &_.sp_who="THALIE" & !speaker];');
+	//server.query(subcorpusCqpId + ' = "fin" [];');
+	//server.query(subcorpusCqpId + ' = [div1 & _.sp_who="THALIE" & !speaker];');
+	
+	// Affichage du sous-corpus
+	//server.query("cat " + subcorpusCqpId + " 0 10;")
+	server.query("cat " + subcorpusCqpId + ";")
+	
+	//server.cqpQuery(discours.getCqpId(), 'subcorpusid', SUBCORPUSQUERY);
+
+		
+	
+	// Affichage des erreurs
+	try {
+		System.out.println("client.getLastCqiError() : "+server.getLastCqiError());
+	} catch(Exception e) { System.out.println("Exception : "+e);}
+	try {
+		System.out.println("client.getLastCQPError() : "+server.getLastCQPError());
+	} catch(Exception e) { System.out.println("Exception : "+e);}
+
+	
+	
+	// Création manuelle du sous-corpus
+//	Subcorpus subcorpus = new Subcorpus(subcorpusCqpId, "subcorpus" + subcorpusCqpId.toString().substring(0, 5), discours, new Query()); // FIXME : est-ce que cela pose un problème de passer une Query() vide ici ?
+//	discours.subcorpora.add(subcorpus);
+//	subcorpus.registerToParent();
+	
+	// Création manuelle d'une partition
+//	subcorpus.createPartition(NAME, QUERIES, PARTNAMES)
+	
+	
+}
+ catch(Exception e) {
+	  System.out.println("Exception : "+e);
+  }
+
+
+
+// Refresh de l'interface
+monitor.syncExec(new Runnable() {
+	public void run() {
+		CorporaView.refresh();
+		//CorporaView.expand(partition.getParent());
+	}
+});
+
+
+
+
+
+
+//// parameters
+//def CORPUS = "LIVRETOPERA10TEXTES"
+////def SUBCORPUS = "NOMDUSOUSCORPUS"
+//def SUBCORPUS = null // si partition sur corpus
+////def SUBCORPUSQUERY = '"je" expand to s'
+//def SUBCORPUSQUERY = null // si sous-corpus par nom
+//
+//
+//
+//// Liste des unités strcuturelles
+////def HIERARCHY = ['text_id', 'div1_n', 'sp_who', 'lg'];
+//def STRUCTURAL_UNITS = ['text', 'div1', 'sp'];
+//def STRUCTURAL_UNITS_PROPERTIES = ['id', 'n', 'who'];
+////def TARGET = 'lg';
+//
+//String NAME = '';
+
+
+
+
+//def TEXT = "01_ACHILLE ET POLYXENE"
+// def TEXT = "02_ZEPHIRE ET FLORE"
+/*def QUERIES = [
+'<lg>[_.text_id="' + TEXT + '" & _.div1_n="1" & _.sp_who=".*"]+</lg>',
+'<lg>[_.text_id="' + TEXT + '" & _.div1_n="2" & _.sp_who=".*"]+</lg>',
+'<lg>[_.text_id="' + TEXT + '" & _.div1_n="3" & _.sp_who=".*"]+</lg>',
+'<lg>[_.text_id="' + TEXT + '" & _.div1_n="4" & _.sp_who=".*"]+</lg>',
+'<lg>[_.text_id="' + TEXT + '" & _.div1_n="5" & _.sp_who=".*"]+</lg>',
+]
+def PARTNAMES = [
+"acte_1",
+"acte_2",
+"acte_3",
+"acte_4",
+"acte_5",
+]*/
+
+
+//def discours = CorpusManager.getCorpusManager().getCorpus(CORPUS)
+//
+//
+//// Récupération des unités structurelles
+//def i = 0;
+//def supName;
+//def QUERIES;
+//def query;
+//
+//for (suName in STRUCTURAL_UNITS) {
+//
+//
+//	// Définition auto du nom de partition
+//	NAME += suName + '_';
+//
+//	//query = '';
+//	
+//	
+//	println "Structural Unit Name: $suName"
+//	
+//	// Récupération des valeurs des propriétés d'unités structurelles
+//	for (sup in discours.getStructuralUnitProperties(suName.asType(String)))	{
+//		
+//		supName = STRUCTURAL_UNITS_PROPERTIES[i];
+//		
+//		if(supName != '' && sup.getName() == supName)	{
+//			
+//			// Définition auto du nom de partition
+//			NAME += supName + ".";
+//			
+//			println "Structural Unit Property: $supName";
+//			
+//			for (supValue in sup.getOrderedValues()) {
+//			
+//				//query += '<' + TARGET + '>' + supName;
+//				
+//				
+//				print "$supValue "
+//			}
+//		}
+//	}
+//	i++;
+//}
+//
+//// Suppression du dernier underscore ou point
+//NAME = NAME.substring(0, NAME.length() - 1);
+//// Debug
+//println "NAME: " + NAME;
+
+
+
+
+
+
+
+
+// start
+/*if (QUERIES.size() == PARTNAMES.size()) {
+
+	def partition;
+
+	
+	// Test unités structurelles
+	for (t in discours.getStructuralUnits()) {
+		println "Structural Unit: $t"
+		
+		// Test propriétés d'unités structurelles
+		for (g in discours.getStructuralUnitProperties(t.asType(String))) {
+			
+			println "\tStructural Unit Property: $g"
+			
+			// Test valeurs des propriétés d'unités structurelles
+			for (h in g.getOrderedValues()) {
+				
+				print "$h, "
+				
+			}
+			
+		}
+		
+	}
+	
+		
+	// Test propriétés
+	for (t in discours.getProperties()) {
+		println "Property: $t"
+	}
+	
+	
+	if (SUBCORPUS == null) {
+		println "partition build with $discours"
+		partition = discours.createPartition(NAME, QUERIES, PARTNAMES)
+	} else {
+		def subcorpus
+		if (SUBCORPUSQUERY == null) {
+			println "partition build with subcorpus by name $SUBCORPUS"
+			subcorpus = discours.getSubcorpusByName(SUBCORPUS)
+			if (subcorpus == null) {
+				println "Error: SUBCORPUS NOT FOUND with name : $SUBCORPUS"
+			}
+		} else {
+			println "partition build with subcorpus with query $SUBCORPUSQUERY"
+			subcorpus = discours.createSubcorpus(new Query(SUBCORPUSQUERY), SUBCORPUS)
+		}
+		partition = subcorpus.createPartition(NAME, QUERIES, PARTNAMES)
+	}
+	
+	def list = Arrays.asList(partition.getPartSizes())
+	println "Partition created $NAME: "+list+" parts"
+	// println "Total size: "+list.sum()+" - is equal to (sub)corpus size : "+(list.sum() == partition.getCorpus().getSize())
+    println "Total size: "+list.sum()+" - (sub)corpus size : "+(partition.getCorpus().getSize())
+	
+	monitor.syncExec(new Runnable() {
+	public void run() {
+		CorporaView.refresh();
+		CorporaView.expand(partition.getParent());
+	}
+});
+} else {
+	println "QUERIES.size() != PARTNAMES.size() = "+QUERIES.size()+" != "+PARTNAMES.size()
+}*/
+
Index: tmp/org.txm.core/src/groovy/org/txm/doc/DocumentToTei.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/doc/DocumentToTei.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/doc/DocumentToTei.groovy	(revision 258)
@@ -0,0 +1,175 @@
+// 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
+// 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.
+//
+//
+//
+// $LastChangedDate: 2016-03-14 17:07:32 +0100 (Mon, 14 Mar 2016) $
+// $LastChangedRevision: 3165 $
+// $LastChangedBy: mdecorde $
+//
+package org.txm.doc
+
+import java.io.File;
+
+import org.txm.importer.ApplyXsl2;
+import org.txm.importer.ConvertDocument;
+import org.txm.utils.zip.Zip;
+
+/**
+ * The Class DocumentToTei.
+ */
+class DocumentToTei {
+
+	static boolean DEBUG = true;
+
+	public static boolean processFiles(def files, File outdir, File xsldir) {
+		boolean ret = true;
+
+		File xslOdtTei = new File(xsldir, "tei/odt/odttotei.xsl");
+
+		if (!xsldir.exists()) { println "XslDir does not exists: "+xsldir; return false;}
+		if (!xslOdtTei.exists()) { println "xslOdtTei file does not exists: "+xslOdtTei; return false;}
+
+		ConvertDocument converter;
+		for (File file : files) {
+			print "."
+			String name = file.getName();
+			if (file.getName().endsWith(".odt")) {
+				name = name.substring(0, name.indexOf(".odt"));
+				File teifile = new File(outdir, name+".xml");
+				try {
+					if (!new DocumentToTei().run(file, xslOdtTei, teifile)) {
+						println "ODT to TEI failed: "+file
+						//						ret = false;
+						//						break;
+					}
+				} catch(Exception e) { println "ODT to TEI failed: $file: $e"; }
+			} else if (file.getName().endsWith(".docx")) {
+				name = name.substring(0, name.indexOf(".docx"));
+				File teifile = new File(outdir, name+".xml");
+				File odtFile = File.createTempFile("workflowdocx", "sfsdf.odt", outdir);
+				
+				try {
+					converter = new ConvertDocument();
+					converter.setDebug(DEBUG)
+					converter.autoFile(file, odtFile, "odt")
+					if (!new DocumentToTei().run(odtFile, xslOdtTei, teifile)) {
+						println "Docx to Odt to Tei failed: "+file
+						odtFile.delete();
+					}
+				} catch(Exception e) { println "DOCX to ODT to TEI failed: $file: $e"; }
+				finally { 
+					odtFile.delete();
+					if (converter != null) converter.stop();
+				}
+				
+			} else if (file.getName().endsWith(".doc")) {
+				name = name.substring(0, name.indexOf(".doc"));
+				File teifile = new File(outdir, name+".xml");
+				File odtFile = File.createTempFile("workflowdoc", "sfsdf.odt", outdir);
+				
+				try {
+					converter = new ConvertDocument();
+					converter.setDebug(DEBUG)
+					converter.autoFile(file, odtFile, "odt")
+					if (!new DocumentToTei().run(odtFile, xslOdtTei, teifile)) {
+						println "Doc to ODT to TEI failed: "+file
+						odtFile.delete();
+					}
+				} catch(Exception e) { println "DOC to ODT to TEI failed: $file: $e"; }
+				finally {
+					odtFile.delete();
+					if (converter != null) converter.stop();
+				}
+				
+			}
+		}
+
+		return ret;
+	}
+
+	/**
+	 * Run.
+	 *
+	 * @param odtfile the odtfile
+	 * @param xslfile the xslfile
+	 * @param teifile the teifile
+	 * @return true, if successful
+	 */
+	public boolean run(File odtfile, File xslfile, File teifile)
+	{
+		println "** ODT TO TEI $odtfile $teifile"
+		File unzipdir = new File(teifile.getParent(), "files-"+teifile.getName());
+		unzipdir.deleteDir()
+		Zip.decompress(odtfile.getAbsolutePath(), unzipdir.getAbsolutePath(), false);
+
+		//println "get content.xml"
+		File content = new File(unzipdir, "content.xml");
+		if (!content.exists()) {
+			println "OdtToTei: failed to get 'content.xml' file from "+unzipdir
+			return false;
+		}
+
+		//println "apply xsl oo-to-tei"
+		ApplyXsl2 a = new ApplyXsl2(xslfile.getAbsolutePath());
+		a.process(content.getAbsolutePath(), teifile.getAbsolutePath());
+
+		//unzipdir.deleteDir()
+		return true;
+	}
+
+	/**
+	 * Run.
+	 *
+	 * @param odtfile the odtfile
+	 * @param xslfile the xslfile
+	 * @param teifile the teifile
+	 * @return true, if successful
+	 */
+	public boolean rundocx(File docxfile, File xslfile, File teifile)
+	{
+		//println "** ODT TO TEI $docxfile $teifile"
+		File unzipdir = new File(docxfile.getParent(), "files-"+teifile.getName());
+		unzipdir.deleteDir()
+		Zip.decompress(docxfile.getAbsolutePath(), unzipdir.getAbsolutePath(), false);
+
+		//println "get content.xml"
+		File content = new File(unzipdir, "word/document.xml");
+		if (!content.exists()) {
+			println "failed to get $content"
+			return false;
+		}
+
+		//println "apply xsl oo-to-tei"
+		ApplyXsl2 a = new ApplyXsl2(xslfile.getAbsolutePath());
+		a.setParam("word-directory", unzipdir.getAbsolutePath())
+		a.process(content.getAbsolutePath(), teifile.getAbsolutePath());
+
+		return true;
+	}
+	
+	public static void main(String[] args) {
+		File odtfile = new File("/home/mdecorde/xml/manual/Manuel de TXM 0.7 FR.odt")
+		File xslfile = new File("/home/mdecorde/TXM/xsl/tei/odt/odttotei.xsl")
+		File teifile = new File("/home/mdecorde/xml/manual/Manuel de TXM 0.7 FR.odt.xml")
+		new DocumentToTei().run(odtfile, xslfile, teifile)
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/doc/TeiCorrector.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/doc/TeiCorrector.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/doc/TeiCorrector.groovy	(revision 258)
@@ -0,0 +1,51 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.doc
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class TeiCorrector.
+ */
+class TeiCorrector {
+	
+	/**
+	 * Run.
+	 *
+	 * @param teifile the teifile
+	 * @param headerfile the headerfile
+	 * @return true, if successful
+	 */
+	public boolean run(File teifile, File headerfile)
+	{
+		println "** TEICORRECTOR $teifile"
+		println "get header file"
+		println "paste header"
+		println "remove false header (up to <div rend=\"P92\">"
+		return true;
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/doc/TeiToHtml.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/doc/TeiToHtml.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/doc/TeiToHtml.groovy	(revision 258)
@@ -0,0 +1,77 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.doc
+
+import java.io.File;
+import org.txm.importer.ApplyXsl;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class TeiToHtml.
+ */
+class TeiToHtml {
+	
+	/** The imgdirname. */
+	static String imgdirname = "ImagesTXM"
+		
+	/**
+	 * Run.
+	 *
+	 * @param teifile the teifile
+	 * @param xslfile the xslfile
+	 * @param htmloutdir the htmloutdir
+	 * @return true, if successful
+	 */
+	public boolean run(File teifile, File xslfile, File htmloutdir)
+	{
+		println "** TEI TO HTML $teifile $htmloutdir"
+		
+		println "Check Pictures directory"
+		if(!new File(htmloutdir.getParentFile(), imgdirname).exists())
+		{
+			println "$imgdirname directory does not exists: "+new File(htmloutdir.getParentFile(), imgdirname).getAbsolutePath()
+			return false;
+		}
+		
+		println "create html outdirectory with folders HTML and ImgTXM"
+		if(!htmloutdir.mkdir())
+		{
+			if(!htmloutdir.exists())
+			{println "Failed to create "+htmloutdir.getAbsolutePath();
+			return false;
+			}
+		}
+		
+		println "apply xsl tei to HTML"
+		ApplyXsl a = new ApplyXsl(xslfile.getAbsolutePath());
+		String[] args = ["outputDir",htmloutdir];
+		a.process(teifile.getAbsolutePath(), "./HTML",args);
+
+		return true;
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/doc/Workflow.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/doc/Workflow.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/doc/Workflow.groovy	(revision 258)
@@ -0,0 +1,92 @@
+/**
+ * Main.
+ *
+ * @param args the args
+ */
+// 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
+// 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.
+//
+//
+//
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $
+//
+package org.txm.doc
+
+import org.txm.importer.ConvertDocument;
+
+// TODO: Auto-generated Javadoc
+/* (non-Javadoc)
+ * @see groovy.lang.Script#run()
+ */
+String home = System.getProperty("user.home");
+File srcdir = new File(home, "xml/txmrefman")
+File outdir = new File(home, "xml/txmrefman/TEI")
+File xsldir = new File(home, "xsl")
+File xslOdtTei = new File(xsldir, "tei/odt/odttotei.xsl");
+File xslDocxTei = new File(xsldir, "tei/docx/from/docxtotei.xsl");
+
+if (!xslOdtTei.exists()) {
+	println "$xslOdtTei file does not exists"
+	return;
+}
+
+outdir.deleteDir()
+outdir.mkdirs()
+
+println "start"
+for (File file : srcdir.listFiles()) {
+	ConvertDocument converter = new ConvertDocument();
+	try {
+		File teifile = new File(outdir, file.getName()+".xml");
+		if (file.getName().endsWith(".odt")) {
+			if (!new DocumentToTei().run(file, xslOdtTei, teifile)) {
+				println "Odt to Tei failed"
+				return;
+			}
+		} else if (file.getName().endsWith(".docx")) {
+			File odtFile = File.createTempFile("workflowodt", "sfsdf.odt", srcdir);
+			// convert doc to odt
+			converter.autoFile(file, odtFile, "odt")
+			if (!new DocumentToTei().run(odtFile, xslOdtTei, teifile)) {
+				println "Docx to Odt to Tei failed: "+file
+				odtFile.delete();
+				return;
+			}
+			odtFile.delete();
+		} else if (file.getName().endsWith(".doc")) {
+			File odtFile = File.createTempFile("workflowodt", "sfsdf.odt", srcdir);
+			// convert doc to odt
+			converter.autoFile(file, odtFile, "odt")
+			if (!new DocumentToTei().run(odtFile, xslOdtTei, teifile)) {
+				println "Doc to Odt to Tei failed: "+file
+				odtFile.delete();
+				return;
+			}
+			odtFile.delete();
+		}
+	}
+	catch(Exception e) { e.printStackTrace() }
+	finally { converter.stop(); }
+}
+
+println "--Done"
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/doc/package.html
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/doc/package.html	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/doc/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Contains scripts to manipulates Word or ODT or RTF files</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/org/txm/doc/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/macroproto/CollatorTesterMacro.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/macroproto/CollatorTesterMacro.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/macroproto/CollatorTesterMacro.groovy	(revision 258)
@@ -0,0 +1,37 @@
+package org.txm.macroproto;
+import org.kohsuke.args4j.*
+import groovy.transform.Field
+import org.txm.rcpapplication.swt.widget.parameters.*
+import java.text.Collator
+
+// BEGINNING OF PARAMETERS
+@Field @Option(name="string", usage="an example string", widget="String", required=false, def="δὲ ξυνεχὴς εἶχε εἶχεν βληχρός ἐπέβαλε ἔλαβε οὐ ἐπέλαβε ἐπεγίνετο")
+def string
+
+@Field @Option(name="localeName", usage="an example string", widget="String", required=false, def="el")
+def localeName
+
+@Field @Option(name="strengh", usage="0 1 or 2 for PRIMARY, SECONDARY and TERTIARY", widget="Integer", required=false, def="2")
+def strengh
+
+@Field @Option(name="decomposition", usage="0 1 or 2 for NO_DECOMPOSITION, CANONICAL_DECOMPOSITION, FULL_DECOMPOSITION", widget="Integer", required=false, def="2")
+def decomposition
+
+if (!ParametersDialog.open(this)) return;
+// END OF PARAMETERS
+
+Locale locale = new Locale(localeName)
+
+def collator = Collator.getInstance(locale)
+
+if (strengh < 0) strengh = 0
+if (strengh > 2) strengh = 2
+collator.setStrength(strengh)
+
+if (decomposition < 0) decomposition = 0
+if (decomposition > 2) decomposition = 2
+collator.setDecomposition(decomposition)
+
+println "RESULT"
+Collections.sort(string.tokenize(), collator);
+println tokenize
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/macroproto/SelectSpecifMacro.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/macroproto/SelectSpecifMacro.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/macroproto/SelectSpecifMacro.groovy	(revision 258)
@@ -0,0 +1,94 @@
+package org.txm.macroproto;
+import org.txm.Toolbox
+import org.txm.functions.ca.*
+import org.txm.searchengine.cqp.clientExceptions.*
+import org.txm.searchengine.cqp.corpus.*
+import org.txm.searchengine.cqp.corpus.query.*
+import org.txm.stat.*
+import org.txm.stat.data.*
+import org.txm.stat.engine.r.*
+import org.txm.functions.specificities.*
+import org.kohsuke.args4j.*
+import groovy.transform.Field
+import org.txm.rcpapplication.swt.widget.parameters.*
+
+//TODO temporary uncommented
+//if (!(corpusViewSelection instanceof SpecificitesResult)) {
+//	println "Selection if not a Specificites Result"
+//	return;
+//}
+
+@Field @Option(name="seuil", usage="score limit", widget="Integer", required=false, def="2.0")
+def seuil;// = 1.0
+
+@Field @Option(name="NombreDeMots", usage="Use the row sums : y/n", widget="Integer", required=false, def="10")
+def NombreDeMots;
+
+// END OF PARAMETERS
+if (!ParametersDialog.open(this)) return;
+
+if (NombreDeMots <= 0) {
+	println "Error: le nombre de mots est insuffisant."
+	return
+}
+println "seuil $seuil"
+println "NombreDeMots $NombreDeMots"
+
+
+def specif = corpusViewSelection
+def indices = specif.getSpecificitesIndex()
+def rownames = specif.getTypeNames();
+def colnames = specif.getPartShortNames() ;
+
+def result = new HashSet<String>();
+
+// for each specif column find the N first indices
+for (int i = 0; i < colnames.size() ; i++) {
+	
+	// get indices
+	def idx = []
+	for (int i2 = 0 ; i2 < rownames.length ; i2++) {
+		idx << [indices[i2][i], rownames[i2]];
+	}
+	
+	// sort indices
+//	idx = idx.sort(true, new Comparator() {
+//		int compare(def o1, def o2) {
+//			if (o1 == o2) return 0;
+//			return o1[0] - o2[0]
+//		}
+//	});
+//	
+//	idx = idx.reverse();
+	
+	def idxsorted = [];
+	for (def o : idx) {
+		//if (idxsorted.size() > 0)
+		for (int i4 = 0 ; i4 < idxsorted.size() ; i4++) {
+			if (idxsorted[i4][0] < o[0]) {
+				idxsorted.add(i4, o)
+				break;
+			}
+		}
+		idxsorted << o
+	}
+	idx = idxsorted
+	
+	//println idx
+	// get N first indices
+	int N = 0
+	for (def i3 : idx) {
+		result.add(i3[1]) // add index in result
+		N++
+		if (N >= NombreDeMots) break;
+		if (i3[0] < seuil) break;
+	}
+	println "Selection de $N dans "+colnames[i]
+}
+
+println "Fin de la sélection des spécificités : "+result.size()
+StringBuffer buffer = new StringBuffer();
+for (def s : result.sort()) {
+	buffer.append("|"+s.replace(".", "\\.").replace("|", "\\|"))
+}
+println buffer.toString().substring(1)
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/macroproto/txt/CharListDirectoryMacro.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/macroproto/txt/CharListDirectoryMacro.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/macroproto/txt/CharListDirectoryMacro.groovy	(revision 258)
@@ -0,0 +1,55 @@
+package org.txm.macroproto.txt;
+// STANDARD DECLARATIONS
+
+import org.kohsuke.args4j.*
+import groovy.transform.Field
+import org.txm.rcpapplication.swt.widget.parameters.*
+
+// BEGINNING OF PARAMETERS
+
+// Declare each parameter here
+// (available widget types: Query, File, Folder, String, Text, Boolean, Integer, Float and Date)
+
+@Field @Option(name="inputFile", usage="The file to read", widget="File", required=true, def="C:/Temp/foo.txt")
+def inputFile
+
+@Field @Option(name="inputDir", usage="The file to read", widget="Folder", required=false, def="")
+def inputDir
+
+
+// Open the parameters input dialog box
+if (!ParametersDialog.open(this)) return;
+
+def dic = [:]
+
+// END OF PARAMETERS
+if (inputDir != null && inputDir.exists()) {
+if (inputDir.listFiles() == null) {println "no files..."; return;}
+	println "processing "+inputDir.listFiles().size()+" files"
+	for (def f : inputDir.listFiles()) {
+		if (f.isDirectory()) continue;
+		print "."
+		count(f, dic)
+	}
+	println ""
+} else {
+	count(inputFile, dic)
+}
+int total = 0
+for (def e : dic.sort()) {
+	println(sprintf("%c\t%d", [e.getKey(), e.getValue()]))
+	total += e.getValue()
+}
+println "TOTAL\t$total"
+
+def count(def f, def dic) {
+	String s = f.getText()
+	for (char c : s) {
+		if (c == '\r' || c == '\n' || c == '\t' || c == ' ' || c == ' ') continue;
+		if (!dic.containsKey(c)) { dic[c] = 0 }
+		dic[c]++
+	}
+
+	return dic
+}
+
Index: tmp/org.txm.core/src/groovy/org/txm/macroproto/txt/MultiLineSearchReplaceInDirectoryMacro.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/macroproto/txt/MultiLineSearchReplaceInDirectoryMacro.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/macroproto/txt/MultiLineSearchReplaceInDirectoryMacro.groovy	(revision 258)
@@ -0,0 +1,87 @@
+package org.txm.macroproto.txt
+// Copyright © - ENS de Lyon - http://textometrie.ens-lyon.fr
+// @author sheiden
+//
+// This file is part of the TXM platform.
+//
+// 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 3 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/>.
+//
+// $LastChangedDate: 2013-05-02 11:28:42 +0200 (jeu., 02 mai 2013) $
+// $LastChangedRevision: 2378 $
+// $LastChangedBy: sheiden $
+//
+
+// STANDARD DECLARATIONS
+
+// imports
+import org.kohsuke.args4j.*
+import groovy.transform.Field
+import org.txm.rcpapplication.swt.widget.parameters.*
+
+// PARAMETERS
+
+// **change this parameter**
+@Field @Option(name="inputDirectory", usage="Dossier contenant les fichiers à modifier", widget="Folder", required=true, def='/home')
+		inputDirectory = new File(System.getProperty("user.home"), "Bureau/voeux")
+
+// **change this parameter**
+@Field @Option(name="extension", usage="extension des fichiers à modifier (expression régulière)", widget="String", required=true, def='\\.txt')
+		extension = "\\.txt"
+
+// **change this parameter**
+@Field @Option(name="find", usage="Expression régulière à chercher", widget="String", required=true, def='’')
+		find = "’"
+
+// **change this parameter**
+@Field @Option(name="replaceWith", usage="Chaîne de remplacement", widget="String", required=false, def='\'')
+		replaceWith = "'"
+
+// **change this parameter**
+@Field @Option(name="encoding", usage="Encodage des caractères des fichiers", widget="String", required=true, def='UTF-8')
+		encoding = "utf-8"
+
+// PARAMETERS DIALOG
+
+if (!ParametersDialog.open(this)) return;
+
+// SANITY CHECK
+
+if (inputDirectory==null || find==null || replaceWith==null) { println "** MultiLineSearchReplaceInDirectoryMacro: the input directory, the regular expression to search and replacement must be specified."; return}
+
+if (!inputDirectory.exists()) { println "** MultiLineSearchReplaceInDirectoryMacro: impossible to access the '$inputDirectory' input directory."; return}
+
+// MAIN BODY
+
+println "-- working in $inputDirectory directory with files of '$extension' extension"
+println "-- replacing '$find' with '$replaceWith'"
+
+// find = /date="([0-9]+)-([0-9]+-[0-9]+)"/
+// **change this parameter**
+// replaceWith = 'date="$1-$2" year="$1"'
+// **change this parameter** (warning: '$1', '$2'... can be interpreted by Groovy in "..." strings)
+//
+// RECETTE
+// <tei:pb [^>]+>\n   <tei:p>[0-9]+</tei:p>\n   <tei:p>[^ ]+ 18[5-6][0-9]\.</tei:p>\n
+
+def p = /$find/
+
+inputDirectory.eachFileMatch(~/.*$extension/) { file ->               // for each file matching extension
+	println "\n-- processing: "+file.getName()
+	def tmp = File.createTempFile("SearchReplaceInDirectoryTemp", ".tmp", file.getParentFile()) // create temporary file
+	tmp.withWriter(encoding) { writer ->
+		writer.print(file.getText(encoding).replaceAll(p, replaceWith))
+	}
+	file.delete()
+	tmp.renameTo(file)
+}
Index: tmp/org.txm.core/src/groovy/org/txm/macroproto/RenameFilesMacro.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/macroproto/RenameFilesMacro.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/macroproto/RenameFilesMacro.groovy	(revision 258)
@@ -0,0 +1,37 @@
+// STANDARD DECLARATIONS
+package org.txm.macroproto
+
+import org.kohsuke.args4j.*
+import groovy.transform.Field
+import org.txm.rcpapplication.swt.widget.parameters.*
+
+// BEGINNING OF PARAMETERS
+
+@Field @Option(name="inputDirectory", usage="TXT directory", widget="Folder", required=false, def="txt")
+File inputDirectory;
+
+// **change this parameter**
+@Field @Option(name="extension", usage="Regexp de l'extension des fichiers à modifier", widget="String", required=true, def='\\.txt')
+def extension = "\\.trs"
+
+// **change this parameter**
+@Field @Option(name="find", usage="Expression régulière", widget="String", required=true, def='’')
+def find = "Bobine"
+
+// **change this parameter**
+@Field @Option(name="replaceWith", usage="Chaîne de remplacement", widget="String", required=false, def='\'')
+def replaceWith = ""
+
+
+// Open the parameters input dialog box
+if (!ParametersDialog.open(this)) return;
+
+// END OF PARAMETERS
+
+println "In $inputDirectory..."
+inputDirectory.eachFileMatch(~/.*$extension/) { file ->               // for each file matching extension
+		println " renaming: "+file.getName()
+		String name = file.getName()
+		name = name.replaceAll(find, replaceWith)
+		file.renameTo(new File(file.getParentFile(), name))
+	}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/macroproto/StanfordSegmenterMacro.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/macroproto/StanfordSegmenterMacro.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/macroproto/StanfordSegmenterMacro.groovy	(revision 258)
@@ -0,0 +1,121 @@
+package org.txm.macroproto;
+// STANDARD DECLARATIONS
+/*
+import org.kohsuke.args4j.*
+import groovy.transform.Field
+import org.txm.rcpapplication.swt.widget.parameters.*
+import edu.stanford.nlp.international.arabic.process.*
+import edu.stanford.nlp.international.arabic.*
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.io.Serializable;
+import java.io.StringReader;
+import java.io.UnsupportedEncodingException;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import edu.stanford.nlp.ie.crf.CRFClassifier;
+import edu.stanford.nlp.io.IOUtils;
+import edu.stanford.nlp.ling.CoreLabel;
+import edu.stanford.nlp.ling.HasWord;
+import edu.stanford.nlp.ling.Sentence;
+import edu.stanford.nlp.ling.TaggedWord;
+import edu.stanford.nlp.ling.CoreAnnotations;
+import edu.stanford.nlp.objectbank.ObjectBank;
+import edu.stanford.nlp.process.TokenizerFactory;
+import edu.stanford.nlp.process.WordSegmenter;
+import edu.stanford.nlp.sequences.DocumentReaderAndWriter;
+import edu.stanford.nlp.sequences.SeqClassifierFlags;
+import edu.stanford.nlp.stats.ClassicCounter;
+import edu.stanford.nlp.stats.Counter;
+import edu.stanford.nlp.trees.Tree;
+import edu.stanford.nlp.util.Generics;
+import edu.stanford.nlp.util.PropertiesUtils;
+import edu.stanford.nlp.util.StringUtils;
+import edu.stanford.nlp.util.concurrent.MulticoreWrapper;
+import edu.stanford.nlp.util.concurrent.ThreadsafeProcessor;
+
+@Field @Option(name="inputDir", usage="input directory", widget="Folder", required=true, def="/home/mdecorde/xml/testarabe")
+File inputDir
+@Field @Option(name="outputDir", usage="output directory", widget="Folder", required=true, def="/home/mdecorde/xml/testarabe/out-s")
+File outputDir
+
+@Field @Option(name="model", usage="'.tagger' model file", widget="File", required=false, def="data/arabic-segmenter-atbtrain.ser.gz")
+File model
+@Field @Option(name="extension", usage="Regexp de l'extension des fichiers à modifier", widget="String", required=true, def='\\.txt')
+String extension = "\\.txt"
+
+// Open the parameters input dialog box
+if (!ParametersDialog.open(this)) return;
+
+outputDir.mkdir()
+if (!outputDir.exists()) {
+	println("Could not create $outputDir")
+	return;
+}
+
+// END OF PARAMETERS
+//File inputFile = new File("/home/mdecorde/xml/testarabe/test.txt")
+inputDir.eachFileMatch(~/.*$extension/) { inputFile ->
+println "Processing file: $inputFile"
+File outputFile = new File(outputDir, inputFile.getName())
+//File model = new File("/home/mdecorde/LIBRAIRIES/stanford-segmenter-2014-01-04/data/arabic-segmenter-atbtrain.ser.gz")
+Properties options = new Properties();
+//options.put("prefixMarker", "#")
+//options.put("suffixMarker", "#")
+options.put("loadClassifier", model.getAbsolutePath())
+ArabicSegmenter segmenter = new ArabicSegmenter(options);
+segmenter.flags.inputEncoding = "UTF-8";
+segmenter.loadSegmenter(segmenter.flags.loadClassifier, options);
+
+def br = inputFile.newReader("UTF-8")
+OutputStreamWriter out = new OutputStreamWriter( new FileOutputStream(outputFile), "UTF-8");
+PrintWriter pw = new PrintWriter(out, true);
+double charsPerSec = decode(segmenter, br, pw, 5);
+IOUtils.closeIgnoringExceptions(br);
+System.err.printf("Done! Processed input text at %.2f input characters/second%n", charsPerSec);
+
+}
+
+def decode(ArabicSegmenter segmenter, BufferedReader br,
+                               PrintWriter pwOut, int nThreads) {
+    assert nThreads > 0;
+    long nChars = 0;
+    final long startTime = System.nanoTime();
+    if (nThreads > 1) {
+      MulticoreWrapper<String,String> wrapper = new MulticoreWrapper<String,String>(nThreads, segmenter);
+      try {
+        for (String line; (line = br.readLine()) != null;) {
+          nChars += line.length();
+          wrapper.put(line);
+          while (wrapper.peek()) {
+            pwOut.println(wrapper.poll());
+          }
+        }
+
+        wrapper.join();
+        while (wrapper.peek()) {
+          pwOut.println(wrapper.poll());
+        }
+
+      } catch (IOException e) {
+        e.printStackTrace();
+      }
+
+    } else {
+      nChars = segmenter.segment(br, pwOut);
+    }
+    long duration = System.nanoTime() - startTime;
+    double charsPerSec = (double) nChars / (duration / 1000000000.0);
+    return charsPerSec;
+  }
+*/
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/macroproto/StanfordTaggerMacro.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/macroproto/StanfordTaggerMacro.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/macroproto/StanfordTaggerMacro.groovy	(revision 258)
@@ -0,0 +1,67 @@
+package org.txm.macroproto;
+/*
+
+import edu.stanford.nlp.ling.*
+import edu.stanford.nlp.process.*
+import edu.stanford.nlp.tagger.maxent.*;
+
+// STANDARD DECLARATIONS
+
+import org.kohsuke.args4j.*
+import groovy.transform.Field
+import org.txm.rcpapplication.swt.widget.parameters.*
+
+@Field @Option(name="inputDir", usage="input directory", widget="Folder", required=true, def="/home/mdecorde/xml/testarabe/out-s")
+File inputDir
+@Field @Option(name="outputDir", usage="output directory", widget="Folder", required=true, def="/home/mdecorde/xml/testarabe/out-t")
+File outputDir
+
+@Field @Option(name="model", usage="'.tagger' model file", widget="File", required=false, def="taggers/arabic-train.tagger")
+File model
+@Field @Option(name="extension", usage="Regexp de l'extension des fichiers à modifier", widget="String", required=true, def='\\.txt')
+String extension = "\\.txt"
+
+// Open the parameters input dialog box
+if (!ParametersDialog.open(this)) return;
+def modelPath = model.getAbsolutePath()
+
+outputDir.mkdir()
+if (!outputDir.exists()) {
+	println("Could not create $outputDir")
+	return;
+}
+
+inputDir.eachFileMatch(~/.*$extension/) { inputFile ->
+	String name = inputFile.getName()
+	int idx = name.indexOf(".")
+	if (idx > 0) name = name.substring(0, idx)
+	
+	new File(outputDir, name+".xml").withWriter("UTF-8") { writer ->
+		
+		writer.println('<?xml version="1.0" encoding="UTF-8"?>')
+		writer.println('<text>')
+		
+		MaxentTagger tagger = new MaxentTagger(modelPath);
+		TokenizerFactory<CoreLabel> ptbTokenizerFactory = PTBTokenizer.factory(new CoreLabelTokenFactory(),
+				"untokenizable=noneKeep");
+	
+		DocumentPreprocessor documentPreprocessor = new DocumentPreprocessor(inputFile.newReader());
+		documentPreprocessor.setTokenizerFactory(ptbTokenizerFactory);
+		int n = 0
+		
+		for (List<HasWord> sentence : documentPreprocessor) {
+			writer.println("<s n=\"$n\">")
+			n++;
+			List<TaggedWord> tSentence = tagger.tagSentence(sentence);
+			//println(Sentence.listToString(tSentence, false));
+			for (def TaggedWord w : tSentence) {
+				def form = w.word();
+				def pos = w.tag();
+				writer.println("<w pos=\"$pos\">$form</w>")
+			}
+			writer.println('</s>')
+		}
+		writer.println('</text>')
+	}
+}
+*/
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/macroproto/SelectBanal.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/macroproto/SelectBanal.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/macroproto/SelectBanal.groovy	(revision 258)
@@ -0,0 +1,84 @@
+package org.txm.macroproto;
+import org.txm.*
+import org.txm.functions.ca.*
+import org.txm.searchengine.cqp.clientExceptions.*
+import org.txm.searchengine.cqp.corpus.*
+import org.txm.searchengine.cqp.corpus.query.*
+import org.txm.stat.StatException
+import org.txm.stat.data.*
+import org.txm.stat.engine.r.*
+import org.txm.functions.specificities.*
+import org.kohsuke.args4j.*
+import groovy.transform.Field
+import org.txm.rcpapplication.swt.widget.parameters.*
+
+//TODO: temporary uncommented
+//if (!(corpusViewSelection instanceof SpecificitesResult)) {
+//	println "Selection if not a Specificites Result"
+//	return;
+//}
+
+// PARAMETERS
+@Field @Option(name="outfile", usage="CSV result file ", widget="File", required=true, def="result.csv")
+def outfile;// = new File("/home/mdecorde/Bureau/test.csv")
+
+@Field @Option(name="MAX", usage="score limit", widget="Integer", required=false, def="1")
+def MAX;// = 1.0
+
+@Field @Option(name="suseSum", usage="Use the row sums : y/n", widget="String", required=false, def="n")
+String suseSum;// = false
+
+// END OF PARAMETERS
+if (!ParametersDialog.open(this)) return;
+
+if (suseSum == null || suseSum.length() == 0) suseSum = "n"
+boolean useSum = suseSum.toLowerCase().charAt(0) == "y"
+println "useSum $useSum"
+
+def writer = outfile.newWriter("UTF-8")
+def specif = corpusViewSelection
+def indices = specif.getSpecificitesIndex()
+def freqs = specif.getFrequency()
+def rownames = specif.getTypeNames();
+def colnames = specif.getPartShortNames() ;
+
+def selected = []
+
+writer.print "unit"
+writer.print "\tF"
+for (int j = 0; j < colnames.size() ; j++) {
+	writer.print "\t"+colnames[j]
+	writer.print "\tscore"
+}
+writer.println ""
+
+for (int i = 0; i < rownames.length ; i++) {
+	boolean add = true
+	def totF = 0;
+	def totscore = 0.0
+
+	for (int j = 0; j < colnames.size() ; j++) {
+		if (Math.abs(indices[i][j]) >= MAX) add = false
+		totF += freqs[i][j]
+		totscore += Math.abs(indices[i][j])
+	}
+	
+	if (useSum) {
+		if (totscore >= MAX) add = false
+		else add = true
+	}
+	
+	if (add) {
+		selected << rownames[i]
+		writer.print rownames[i]
+		writer.print "\t$totF"
+		for (int j = 0; j < colnames.size() ; j++) {
+			writer.print "\t"+freqs[i][j]
+			writer.print "\t"+indices[i][j]
+		}
+		writer.println ""
+	}
+}
+println selected
+println "Saved in $outfile"
+writer.close()
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/macroproto/export/ExportTextsMetadataMacro.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/macroproto/export/ExportTextsMetadataMacro.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/macroproto/export/ExportTextsMetadataMacro.groovy	(revision 258)
@@ -0,0 +1,83 @@
+// STANDARD DECLARATIONS
+package org.txm.macroproto.export
+
+import org.kohsuke.args4j.*
+import groovy.transform.Field
+import org.txm.rcpapplication.swt.widget.parameters.*
+import org.txm.searchengine.cqp.corpus.*
+import org.txm.Toolbox
+
+if (!(corpusViewSelection instanceof Corpus)) {
+	println "Please select a corpus first"
+	return
+}
+
+// PARAMETERS
+
+@Field @Option(name="tsvFile", usage="CSV file path", widget="File", required=true, def="/tmp/metadata.csv")
+def File tsvFile
+
+@Field @Option(name="columnSeparator", usage="column columnSeparator", widget="String", required=false, def="\t")
+def columnSeparator
+
+if (!ParametersDialog.open(this)) return
+
+// BEGINNING
+def Corpus corpus = corpusViewSelection
+def CQI = Toolbox.getCqiClient()
+def writer = tsvFile.newWriter("UTF-8")
+def internalTextProperties = ["project", "base", "path"]
+
+println "Exporting $corpus metadata to $tsvFile file."
+
+def text = corpus.getStructuralUnit("text")
+def properties = text.getProperties()
+
+// putting the "id" property in the first position
+def idi = properties.findIndexOf { prop -> prop.toString()=="id" }
+if (idi != 0 && idi > 0) {
+	def tmp = properties[0]
+	properties[0] = properties[idi]
+	properties[idi] = tmp
+} else if (idi == -1) {
+println sprintf("** Warning: incoherent metadata content found for %s corpus - no 'id' metadata found", corpus)
+println "** Aborting"
+return
+}
+
+// getting values for all texts and all text metadata
+def propertyValues = [:]
+def numberOfTexts = CQI.attributeSize(properties[0].getQualifiedName())
+def int[] struct_pos = new int[numberOfTexts]
+
+struct_pos.eachWithIndex { c, i -> struct_pos[i] = i }
+
+properties.each { property ->
+	def values = CQI.struc2Str(property.getQualifiedName(), struct_pos)
+	propertyValues[property] = values
+}
+
+// writing result to tsvFile
+def c = 0
+properties.each { property ->
+	if (!internalTextProperties.contains(property.getName())) {
+		if (c++ > 0) writer.print columnSeparator
+		writer.print "$property"
+	}
+}
+writer.println ""
+
+numberOfTexts.times {
+	c = 0
+	properties.each { property ->
+		if (!internalTextProperties.contains(property.getName())) {
+			if (c++ > 0) writer.print columnSeparator
+			writer.print propertyValues[property][it]
+		}
+	}
+	writer.println ""
+}
+
+writer.close()
+println sprintf("Wrote %d different metadata for %d texts.", c, numberOfTexts)
+
Index: tmp/org.txm.core/src/groovy/org/txm/macroproto/export/ExportTextsContentMacro.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/macroproto/export/ExportTextsContentMacro.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/macroproto/export/ExportTextsContentMacro.groovy	(revision 258)
@@ -0,0 +1,80 @@
+// STANDARD DECLARATIONS
+package org.txm.macroproto.export
+
+import org.txm.searchengine.cqp.corpus.*
+import org.txm.searchengine.cqp.corpus.query.Query
+import org.txm.Toolbox
+import org.txm.utils.i18n.LangFormater;
+import org.apache.commons.lang.StringUtils;
+import org.kohsuke.args4j.*
+import groovy.transform.Field
+import org.txm.rcpapplication.swt.widget.parameters.*
+
+println "corpora selection: "+corpusViewSelection
+
+if (!(corpusViewSelection instanceof Corpus)) {
+	println "Please select a corpus"
+	return;
+}
+
+// PARAMETERS
+
+@Field @Option(name="exportDir", usage="Result directory ", widget="Folder", required=true, def="export")
+File exportDir
+
+@Field @Option(name="lineSeparatorStructureName", usage="line separator structure", widget="String", required=false, def="p")
+def lineSeparatorStructureName
+
+if (!ParametersDialog.open(this)) return
+
+// BEGINNING
+
+if (!exportDir.exists()) exportDir.mkdirs()
+
+Corpus corpus = corpusViewSelection
+CQI = Toolbox.getCqiClient();
+
+def lineSeparatorStructure = corpus.getStructuralUnit(lineSeparatorStructureName)
+
+if (lineSeparatorStructure == null) {
+	println "The $lineSeparatorStructureName structure does not exists in the $corpus corpus"
+	return;
+}
+
+def breaks_pos = Arrays.asList(corpus.query(new Query("[]</"+lineSeparatorStructureName+">"),"test", false).getEnds())
+println breaks_pos
+
+println "Exporting $corpus text content to $exportDir"
+
+def wordProperty = corpus.getWordProperty()
+def textidProperty = corpus.getStructuralUnit("text").getProperty("id")
+def textStartBoundaries = corpus.getTextStartLimits();
+def textEndBoundaries = corpus.getTextEndLimits();
+int[] struct_pos = CQI.cpos2Struc(textidProperty.getQualifiedName(), textStartBoundaries)
+String[] textids =  CQI.struc2Str(textidProperty.getQualifiedName(), struct_pos)
+println ""+textStartBoundaries.size()+" texts"
+
+for (int i = 0 ; i < textStartBoundaries.size() ; i++) {
+	int start = textStartBoundaries[i];
+	int end = textEndBoundaries[i]
+
+	File txtFile = new File(exportDir, textids[i]+".txt")
+	print ".."
+	def writer = txtFile.newWriter("UTF-8")
+	int[] positions = new int[end - start + 1]
+	int c = 0;
+	for (int p : start..end) {
+		positions[c++] = p
+	}
+	int[] idx = CQI.cpos2Id(wordProperty.getQualifiedName(), positions)
+	def words = CQI.id2Str(wordProperty.getQualifiedName(), idx)
+	for (int j = 0 ; j < positions.length ; j++) {
+		int p = positions[j]
+		if (breaks_pos.contains(p)) words[j] = words[j] +"\n" 
+	}
+	writer.println LangFormater.format(StringUtils.join(words, " "),
+				corpus.getAttribute("lang"));
+	writer.close();
+}  
+
+println "\nDone, result saved in "+exportDir.getAbsolutePath()
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/macroproto/importer/XTZImporterMacro.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/macroproto/importer/XTZImporterMacro.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/macroproto/importer/XTZImporterMacro.groovy	(revision 258)
@@ -0,0 +1,384 @@
+// 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
+// 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.
+//
+//
+//
+// $LastChangedDate: 2013-05-15 14:30:48 +0200 (mer., 15 mai 2013) $
+// $LastChangedRevision: 2392 $
+// $LastChangedBy: mdecorde $
+//
+package org.txm.macroproto.importer;
+
+import groovy.transform.Field
+
+import javax.xml.stream.*
+
+import org.kohsuke.args4j.*
+import org.txm.*
+import org.txm.importer.ApplyXsl2
+import org.txm.importer.ValidateXml
+import org.txm.importer.xml.compiler
+import org.txm.importer.xml.importer
+import org.txm.importer.xml.pager
+import org.txm.metadatas.*
+import org.txm.objects.*
+import org.txm.rcpapplication.commands.*
+import org.txm.rcpapplication.commands.workspace.*
+import org.txm.rcpapplication.swt.widget.parameters.*
+import org.txm.scripts.teitxm.*
+import org.txm.tokenizer.TokenizerClasses
+import org.txm.utils.*
+import org.txm.utils.i18n.*
+import org.txm.utils.xml.DomUtils
+import org.w3c.dom.Element
+
+String userDir = System.getProperty("user.home");
+
+// BEGINNING OF PARAMETERS
+@Field @Option(name="srcDirectory", usage="the directory containing the DOC/ODT/RTF files to convert", widget="Folder", required=true, def="srcDirectory")
+File srcDirectory
+
+@Field @Option(name="SpannedEdition", usage="edition xsl", widget="Boolean", required=false, def="true")
+Boolean SpannedEdition // call EditionUpdater
+// calls EditionUpdater : 
+// Defaults corpus=imported corpus, xslEdition:XTZ xsl, xslPages=XTZ xsl2, editionname=default, useTokenizedDirectory=false
+
+@Field @Option(name="synoptic", usage="syn", widget="Boolean", required=false, def="true")
+Boolean synoptic 
+// calls AddFacsAttribute + FacsEditionBuilder. 
+// Defaults AddFacsAttribute : imageDirectory=$SRC/img, outputDirectory=temp, element=pb, attribute=n, prefix=mediaPath
+// Default FacsEditionBuilder : editionName=facs, element=pb, attribute=facs
+ 
+@Field @Option(name="mediaPath", usage="absolute or relative path to images directory", widget="String", required=false, def="img")
+String mediaPath
+
+@Field @Option(name="facsEditionName", usage="facs edition name to create", widget="String", required=false, def="facs")
+String facsEditionName
+
+// Open the parameters input dialog box
+if (!ParametersDialog.open(this)) return;
+
+if (!mediaPath.endsWith("/")) mediaPath += "/"
+
+println "Parameters: "
+println "	srcDirectory: $srcDirectory"
+println "	SpannedEdition: $SpannedEdition"
+println "	synoptic: $synoptic"
+println "	mediaPath: $mediaPath"
+println "	facsEditionName: $facsEditionName"
+
+def MONITOR;
+boolean debug = false;
+File importFile = new File(srcDirectory, "import.xml")
+if (!importFile.exists()) {
+	println "No import.xml file found in $srcDirectory"
+	println "Aborting."
+	return;
+}
+BaseParameters params = new BaseParameters(importFile);
+params.load()
+params.rootDir = srcDirectory.getAbsolutePath();
+TokenizerClasses.loadFromNode(params.getTokenizerElement(params.getCorpusElement()));
+if (params == null) { println "no parameters. Aborting"; return; }
+
+String corpusname = params.getCorpusName();
+Element corpusElem = params.corpora.get(corpusname);
+String basename = params.name;
+String rootDir = params.rootDir;
+String lang = corpusElem.getAttribute("lang");
+String model = lang
+String encoding = corpusElem.getAttribute("encoding");
+boolean annotate = "true" == corpusElem.getAttribute("annotate");
+String xsl = params.getXsltElement(corpusElem).getAttribute("xsl")
+def xslParams = params.getXsltParams(corpusElem);
+
+File srcDir = new File(rootDir);
+File binDir = new File(Toolbox.getParam(Toolbox.USER_TXM_HOME), "corpora/"+basename);
+binDir.deleteDir();
+binDir.mkdirs();
+if (!binDir.exists()) {
+	println "Could not create binDir "+binDir
+	return;
+}
+
+File txmDir = new File(binDir, "txm/$corpusname");
+txmDir.deleteDir();
+txmDir.mkdirs();
+
+File propertyFile = new File(rootDir, "import.properties")//default
+Properties props = new Properties();
+String[] metadatasToKeep;
+
+String textSortAttribute = null;
+String paginationElement = "pb";
+boolean normalizeMetadata = false;
+String ignoredElements = null;
+boolean stopIfMalformed = false;
+
+println "Trying to read import properties file: "+propertyFile
+if (propertyFile.exists() && propertyFile.canRead()) {
+	InputStreamReader input = new InputStreamReader(new FileInputStream(propertyFile) , "UTF-8");
+	props.load(input);
+	input.close();
+	if(props.getProperty("sortmetadata") != null)
+		textSortAttribute = props.get("sortmetadata").toString();
+	if (props.getProperty("editionpage") != null)
+		paginationElement = props.get("editionpage").toString();
+	if (props.getProperty("normalizemetadata") != null)
+		normalizeMetadata = Boolean.parseBoolean(props.get("normalizemetadata").toString());
+	if (props.getProperty("ignoredelements") != null)
+		ignoredElements = props.get("ignoredelements").toString();
+	if (props.getProperty("stopifmalformed") != null)
+		stopIfMalformed = Boolean.parseBoolean(props.get("stopifmalformed").toString());
+
+	println "import properties: "
+	println " sort metadata: "+textSortAttribute
+	println " edition page tag: "+paginationElement
+	println " normalize attributes: "+normalizeMetadata
+	println " ignored elements: "+ignoredElements
+	println " stop if a XML source is malformed: "+stopIfMalformed
+}
+
+File allmetadatasfile = new File(srcDir, "metadata.csv");
+
+// Apply XSL
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+if (MONITOR != null) MONITOR.worked(1, "APPLYING XSL")
+if (xsl != null && xslParams != null && xsl.trim().length() > 0) {
+	if (ApplyXsl2.processImportSources(new File(xsl), srcDir, new File(binDir, "src"), xslParams))
+	// return; // error during process
+	srcDir = new File(binDir, "src");
+	println ""
+}
+
+String[] roots = [ System.getProperty("user.home")+"/TXM/scripts/macro/" ];
+GroovyScriptEngine gse = new GroovyScriptEngine(roots, monitor.getClass().getClassLoader());
+File jardir = new File(System.getProperty("user.home")+"/TXM/scripts/lib"); //$NON-NLS-1$
+if (jardir.exists() && jardir.isDirectory()) {
+	for (File f: jardir.listFiles(new FilenameFilter() {
+		public boolean accept(File dir, String name) {
+			return name.endsWith(".jar"); //$NON-NLS-1$
+		}
+	})) {
+		gse.getGroovyClassLoader().addURL(f.toURI().toURL());
+	}
+}
+// Call AddFacsAttribute - must be called before starting the importer step
+// Defaults AddFacsAttribute : imageDirectory=$SRC/img, outputDirectory=temp, element=pb, attribute=facs, prefix=mediaPath
+if (synoptic) {
+	println "-- Adding the $paginationElement@facs attributes"
+	File srcDirTemp = new File(binDir, "facs_src")
+	srcDirTemp.mkdir() // create a new src directory that contains the modified src files
+	Binding b = new Binding();
+	b.setVariable("args", ["monitor":monitor, "sourceDirectory":srcDir, "imageDirectory":new File(srcDir, "img"), "outputDirectory":srcDirTemp, "element":paginationElement, "attribute":"facs", "prefix":mediaPath]);
+	gse.run "org/txm/macro/edition/AddFacsAttributeMacro.groovy", b
+	println "switching srcDir to $srcDirTemp"
+	srcDir = srcDirTemp;
+}
+
+// copy xml+dtd files
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+List<File> srcfiles = srcDir.listFiles();
+if (srcfiles != null)
+for (int i = 0 ; i < srcfiles.size() ; i++) {// check XML format, and copy file into binDir
+	File f = srcfiles.get(i)
+	if (f.getName().equals("import.xml") || f.getName().equals("metadata.csv") || f.getName().endsWith(".properties")) {
+		srcfiles.remove(i);
+		i--;
+		continue;
+	}
+	if (ValidateXml.test(f)) {
+		FileCopy.copy(f, new File(txmDir, f.getName()));
+	} else {
+		println "Won't process file "+f;
+	}
+}
+
+if (txmDir.listFiles() == null) {
+	println "No txm file to process"
+	return;
+}
+
+//get metadatas values from CSV
+Metadatas metadatas; // text metadatas
+
+println "Trying to read metadatas from: "+allmetadatasfile
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+if (allmetadatasfile.exists()) {
+	File copy = new File(binDir, "metadata.csv")
+	if (!FileCopy.copy(allmetadatasfile, copy)) {
+		println "Error: could not create a copy of metadata file "+allmetadatasfile.getAbsoluteFile();
+		return;
+	}
+	metadatas = new Metadatas(copy, Toolbox.getParam(Toolbox.METADATA_ENCODING), Toolbox.getParam(Toolbox.METADATA_COLSEPARATOR), Toolbox.getParam(Toolbox.METADATA_TXTSEPARATOR), 1)
+} else {
+	println "no metadata file: "+allmetadatasfile
+}
+
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+if (MONITOR != null) MONITOR.worked(5, "IMPORTER")
+println "-- IMPORTER - Reading source files"
+def imp = new importer();
+imp.doValidation(true) // change this to not validate xml
+imp.doTokenize(true) // change this, to not tokenize xml
+imp.setStopIfMalformed(stopIfMalformed);
+if (!imp.run( srcDir, binDir, txmDir, basename, ignoredElements, lang)) {
+	println "import process stopped";
+	return;
+}
+
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+if (MONITOR != null) MONITOR.worked(20, "INJECTING METADATA")
+if (metadatas != null) {
+	println("-- INJECTING METADATA - "+metadatas.getHeadersList()+" in texts of directory "+new File(binDir,"txm"))
+	for (File infile : txmDir.listFiles()) {
+		print "."
+		File outfile = File.createTempFile("temp", ".xml", infile.getParentFile());
+		if (!metadatas.injectMetadatasInXml(infile, outfile, "text", null)) {
+			outfile.delete();
+		} else {
+			if (!(infile.delete() && outfile.renameTo(infile))) println "Warning can't rename file "+outfile+" to "+infile
+			if (!infile.exists()) {
+				println "Error: could not replace $infile by $outfile"
+				return false;
+			}
+		}
+	}
+	println ""
+}
+List<File> files = txmDir.listFiles()
+if (files == null || files.size() == 0) {
+	return;
+}
+
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+if (MONITOR != null) MONITOR.worked(20, "ANNOTATE")
+println "-- ANNOTATE - Running NLP tools"
+boolean annotationSuccess = false;
+if (annotate && new Annotate().run(binDir, txmDir, model+".par")) {
+	annotationSuccess = true;
+}
+
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+if (MONITOR != null) MONITOR.worked(25, "COMPILING")
+println "-- COMPILING - Building Search Engine indexes"
+def c = new compiler();
+if(debug) c.setDebug();
+//c.setCwbPath("~/TXM/cwb/bin");
+c.setOptions(textSortAttribute, normalizeMetadata);
+c.setAnnotationSuccess(annotationSuccess)
+c.setLang(lang);
+if (!c.run(binDir, txmDir, corpusname, null, srcfiles, metadatas)) {
+	println "import process stopped";
+	return;
+}
+
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+if (MONITOR != null) MONITOR.worked(25, "EDITION")
+println "-- EDITION - Building edition"
+new File(binDir,"HTML/$corpusname").deleteDir();
+new File(binDir,"HTML/$corpusname").mkdirs();
+File outdir = new File(binDir,"/HTML/$corpusname/default/");
+outdir.mkdirs();
+List<File> filelist = txmDir.listFiles();
+Collections.sort(filelist);
+def second = 0
+
+println "Paginating texts: "+filelist
+for (File txmFile : filelist) {
+	print "."
+	String txtname = txmFile.getName();
+	int i = txtname.lastIndexOf(".");
+	if(i > 0) txtname = txtname.substring(0, i);
+
+	List<String> NoSpaceBefore = LangFormater.getNoSpaceBefore(lang);
+	List<String> NoSpaceAfter = LangFormater.getNoSpaceAfter(lang);
+
+	Element text = params.addText(corpusElem, txtname, txmFile);
+
+	def ed = new pager(txmFile, outdir, txtname, NoSpaceBefore, NoSpaceAfter, 30000, basename, paginationElement);
+	Element edition = params.addEdition(text, "default", outdir.getAbsolutePath(), "html");
+
+	for (i = 0 ; i < ed.getPageFiles().size();) {
+		File f = ed.getPageFiles().get(i);
+		String wordid = ed.getIdx().get(i);
+		params.addPage(edition, ""+(++i), wordid);
+	}
+}
+
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+if (MONITOR != null) MONITOR.worked(20, "FINALIZING")
+File paramFile = new File(binDir, "import.xml");
+DomUtils.save(params.root.getOwnerDocument(), paramFile);readyToLoad = true;
+
+// Call FacsEditionBuilder
+// Default FacsEditionBuilder : editionName=facs, element=pb, attribute=facs
+if (synoptic) {
+	println "-- Building the '$facsEditionName' image edition..."
+	b = new Binding();
+	b.setVariable("args", ["monitor":monitor,"params":params, "binDirectory":binDir, "txmDirectory":txmDir,"corpus":srcDirectory, "editionName":facsEditionName, "tag":paginationElement, "attribute":"facs"]);
+	gse.run "org/txm/macro/edition/FacsEditionBuilderMacro.groovy", b
+	
+	//copy images into the binary corpus
+	if (mediaPath.length() > 0 && !mediaPath.startsWith("http")) {
+		File binImageDirectory = new File(binDir,"HTML/$basename/$facsEditionName/$mediaPath")
+		println "copying images into binary corpus: $binImageDirectory ..."
+		FileCopy.copyFiles(new File(srcDirectory, "img"), binImageDirectory)
+		println "copy done"
+	} else {
+		println "Note: the $facsEditionName edition images are not embedded in the binary corpus"
+	}
+}
+
+// Call EditionUpdater
+// corpus=imported corpus, xslEdition:XTZ xsl, xslPages=XTZ xsl2, editionname=default, useTokenizedDirectory=false
+if (SpannedEdition) {
+	println "-- Building Spanned edition..."
+	
+	Binding b = new Binding();
+	b.setVariable("args", ["monitor":monitor,"params":params, "binDirectory":binDir, "txmDirectory":txmDir,"corpus":srcDirectory, "xslEdition":"txm-edition-xtz.xsl", "xslPages":"txm-edition-page-split.xsl", "editionname":"default", "useTokenizedDirectory":false]);
+	gse.run "org/txm/macro/edition/EditionUpdaterMacro.groovy", b
+}
+// // create the ".txm" file
+// try {
+// 	File exportzip = new File(binDir.getParent(), binDir.getName()+".txm")
+// 	println "creating the $exportzip binary corpus file..."
+// 	Zip.compress(binDir, exportzip);
+// 	println "done."
+// } catch (IOException e) {
+// 	println "Error during binary file creation: $e"
+// }
+
+// load corpus
+println "Loading corpus..."
+try {LoadBinaryCorpus.loadBase(binDir)} catch(Exception e777){AddBases.loadBase(binDir, monitor)} // LoadBinaryCorpus does not exist if TXM version is < 0.7.7
+
+Toolbox.restartWorkspace();
+Toolbox.restartSearchEngine();
+
+monitor.syncExec(new Runnable() {
+	@Override
+	public void run() {
+		println "Reloading corpora view..."
+		RestartTXM.reloadViews();
+		println "import done."
+	}
+});
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/macroproto/FindMultiLineRegExpMacro.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/macroproto/FindMultiLineRegExpMacro.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/macroproto/FindMultiLineRegExpMacro.groovy	(revision 258)
@@ -0,0 +1,80 @@
+package org.txm.macroproto
+// Copyright © 2015 - ENS de Lyon - http://textometrie.ens-lyon.fr
+// @author sheiden
+//
+// This file is part of the TXM platform.
+//
+// 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 3 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/>.
+//
+// $LastChangedDate: 2013-05-02 11:28:42 +0200 (jeu., 02 mai 2013) $
+// $LastChangedRevision: 2378 $
+// $LastChangedBy: sheiden $
+//
+
+// STANDARD DECLARATIONS
+
+import org.kohsuke.args4j.*
+
+import groovy.transform.Field
+
+import java.nio.charset.Charset
+
+import org.txm.rcpapplication.swt.widget.parameters.*
+import org.txm.utils.*
+
+import javax.xml.stream.*
+
+import java.net.URL
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+// PARAMETERS
+
+@Field @Option(name="inputDirectory", usage="TXT directory", widget="Folder", required=false, def="")
+File inputDirectory;
+@Field @Option(name="regexp", usage="Regular expression to match", widget="String", required=false, def="")
+String regexp;
+@Field @Option(name="encoding", usage="File encoding", widget="String", required=false, def="UTF-8")
+String encoding;
+
+// PARAMETERS
+
+if (inputDirectory == null) {
+	if (!ParametersDialog.open(this)) return;
+}
+
+// SANITY CHECK
+
+if (inputDirectory==null || regexp==null) { println "** FindMultiLineRegExpMacro: the input directory and the regular expression must be specified."; return}
+
+if (!inputDirectory.exists()) { println "** FindMultiLineRegExpMacro: impossible to access the '$inputDirectory' input directory."; return}
+
+// MAIN BODY
+
+def p = /$regexp/
+
+println "-- looking for: $regexp"
+
+for (File inputfile : inputDirectory.listFiles()) {
+
+	if (inputfile.isDirectory()) continue // ignore
+
+	def matcher = inputfile.getText() =~ p
+	
+	println "\n-- file:"+inputfile.getName() + " "+matcher.size() + " match" +((matcher.size() > 1)?"s":"")
+
+	if (matcher.size() > 0) {
+		matcher.each { println it }
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/macroproto/RunImportMacro.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/macroproto/RunImportMacro.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/macroproto/RunImportMacro.groovy	(revision 258)
@@ -0,0 +1,85 @@
+package org.txm.macroproto
+import groovy.transform.Field
+
+import org.kohsuke.args4j.*
+import org.txm.Toolbox
+import org.txm.objects.BaseParameters
+import org.txm.rcpapplication.commands.*
+import org.txm.rcpapplication.swt.widget.parameters.*
+
+// PARAMETERS
+@Field @Option(name="inputDirectory", usage="Dossier qui contient les fichiers à importer", widget="Folder", required=true, def='')
+File inputDirectory
+
+@Field @Option(name="importName", usage="Nom du module d'import", widget="String", required=true, def='TXT+CSV | XML/w+CSV | XML-Factiva | XML-TEI-BFM | XML-TEI-Frantext | XML-TEI-TXM | XML-Transcriber+CSV | XML-TMX | CNR+CSV | Hyperbase | Alceste | CWB | DOC')
+// choose between : 
+def importName
+
+if (!ParametersDialog.open(this)) return;
+// END OF PARAMETERS
+// TXT+CSV | XML/w+CSV | XML-Factiva | XML-TEI-BFM | XML-TEI-Frantext | XML-TEI-TXM | XML-Transcriber+CSV | XML-TMX | CNR+CSV | Hyperbase | Alceste | CWB
+
+// fix possible miss write
+importName = importName.toUpperCase()
+importName = importName.replaceAll(" ", "")
+importName = importName.trim()
+importName = importName.replaceAll("\\+", "")
+importName = importName.replaceAll("-", "")
+importName = importName.replaceAll("/", "")
+
+def scripts = [:]; // 12
+scripts["TXTCSV"] = "quickLoader.groovy"
+scripts["XMLWCSV"] = "xmlLoader.groovy"
+scripts["XMLFACTIVA"] = "factivaLoader.groovy"
+scripts["XMLTEIBFM"] = "bfmLoader.groovy"
+scripts["XMLTEIFrantex"] = "frantextLoader.groovy"
+scripts["XMLTEITXM"] = "xmltxmLoader.groovy"
+scripts["XMLTranscriberCSV"] = "transcriberLoader.groovy"
+scripts["XMLTMX"] = "tmxLoader.groovy"
+scripts["CNRCSV"] = "discoursLoader.groovy"
+scripts["HYPERBASE"] = "hyperbaseLoader.groovy"
+scripts["ALCESTE"] = "alcesteLoader.groovy"
+scripts["CWB"] = "wtcLoader.groovy"
+scripts["DOC"] = "docLoader.groovy"
+
+def scriptName = scripts.get(importName)
+if (scriptName == null) {
+	println "Error: no import script for name $importName"
+	return
+}
+
+String txmhome = Toolbox.getParam(Toolbox.USER_TXM_HOME);
+File scriptsdir = new File(txmhome, "scripts/import")
+File script = new File(scriptsdir, scriptName)
+
+if (!script.exists()) {
+	println "Error: no script found for import name ${importName}: $script"
+	return
+}
+
+if (inputDirectory.exists()) {
+	File paramFile = new File(inputDirectory, "import.xml")
+	if (!paramFile.exists()) { // create, if it does not exists
+		BaseParameters.createEmptyParams(paramFile, inputDirectory.getName())
+	}
+
+	final BaseParameters params = new BaseParameters(paramFile);
+	params.load();
+	params.rootDir = inputDirectory.getAbsolutePath(); // fix
+	params.saveToElement();
+
+	if (!params.save()) {
+		System.out.println("ERROR: could not save import configuration: "+ params.paramFile);
+		return;
+	}
+
+	monitor.syncExec(new Runnable() {
+		public void run() {
+			ExecuteImportScript.executeScript(script.getAbsolutePath(), params);
+		}
+	});
+} else {
+	System.out.println("Warning: Missing inputDirectory directory: "+ inputDirectory);
+}
+
+	
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/macroproto/partition/CreatePartitionByMetadataMacro.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/macroproto/partition/CreatePartitionByMetadataMacro.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/macroproto/partition/CreatePartitionByMetadataMacro.groovy	(revision 258)
@@ -0,0 +1,62 @@
+// STANDARD DECLARATIONS
+package org.txm.macroproto.partition
+
+import org.kohsuke.args4j.*
+
+import groovy.transform.Field
+
+import org.txm.rcpapplication.swt.widget.parameters.*
+import org.txm.searchengine.cqp.corpus.*
+import org.txm.utils.logger.Log;
+import org.txm.rcpapplication.views.*
+import org.txm.stat.engine.r.*
+import org.txm.Toolbox
+
+//BEGINNING OF PARAMETERS
+def corpus = corpusViewSelection
+if (!(corpus instanceof Corpus)) {
+	println "Error: this macro should be run with a Corpus selected"
+	return
+}
+
+@Field @Option(name="values_file", usage="txt file", widget="File", required=true, def="C:\\Users\\Fanny\\Desktop\\values.txt")
+def values_file
+
+@Field @Option(name="property", usage="the structural Unit properties list separated with commas", widget="String", required=true, def="emotionalfeelingthe911")
+def property = "emotionalfeelingthe911"
+
+@Field @Option(name="expand_struct", usage="expand_struct", widget="String", required=true, def="question")
+def expand_struct = "question"
+
+// Open the parameters input dialog box
+if (!ParametersDialog.open(this)) return;
+
+println "Partition du corpus '$corpus' à partir de la métadonnée '$property' "
+
+def domain = []
+for (def s :  values_file.getText("UTF-8").split("\n")) domain << s.trim()
+
+def uniq_domain = new HashSet(domain).sort() 
+println "domain size "+domain.size()
+println "uniq domain size "+uniq_domain.size()
+
+def names = []
+def queries = []
+
+for (def d : uniq_domain) {
+	queries <<  "[_.text_"+property+"=\"$d\"] expand to $expand_struct"
+	names << d	
+}
+
+corpus.createPartition(property+"_non_balanced", queries, names);
+
+println queries
+println names
+
+//display the graphic
+monitor.syncExec(new Runnable() {
+	@Override
+	public void run() {	
+	org.txm.rcpapplication.commands.RestartTXM.reloadViews();
+	}
+});
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/macroproto/partition/CreateCrossedPartitionByMetadataMacro.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/macroproto/partition/CreateCrossedPartitionByMetadataMacro.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/macroproto/partition/CreateCrossedPartitionByMetadataMacro.groovy	(revision 258)
@@ -0,0 +1,67 @@
+// STANDARD DECLARATIONS
+package org.txm.macroproto.partition
+
+import org.kohsuke.args4j.*
+
+import groovy.transform.Field
+
+import org.txm.rcpapplication.swt.widget.parameters.*
+import org.txm.searchengine.cqp.corpus.*
+import org.txm.utils.logger.Log;
+import org.txm.rcpapplication.views.*
+import org.txm.stat.engine.r.*
+import org.txm.Toolbox
+
+//BEGINNING OF PARAMETERS
+def corpus = corpusViewSelection
+if (!(corpus instanceof Corpus)) {
+	println "Error: this macro should be run with a Corpus selected"
+	return
+}
+
+def struct_property2 = "survey_type"
+def struct_property_values = ["t1","t2","t3","t4"]
+
+@Field @Option(name="values_file", usage="txt file", widget="File", required=true, def="C:\\Users\\Fanny\\Desktop\\values.txt")
+def values_file
+
+@Field @Option(name="property", usage="the structural Unit properties list separated with commas", widget="String", required=true, def="emotionalfeelingthe911")
+def property = "emotionalfeelingthe911"
+
+
+
+@Field @Option(name="expand_struct", usage="expand_struct", widget="String", required=true, def="question")
+def expand_struct = "question"
+
+// Open the parameters input dialog box
+if (!ParametersDialog.open(this)) return;
+
+println "Partition du corpus '$corpus' à partir de la métadonnée '$property' "
+
+def domain = []
+for (def s :  values_file.getText("UTF-8").split("\n")) domain << s.trim()
+
+def uniq_domain = new HashSet(domain).sort() 
+println "domain size "+domain.size()
+println "uniq domain size "+uniq_domain.size()
+
+def names = []
+def queries = []
+for (def d2 : struct_property_values) {
+	for (def d : uniq_domain) {
+		queries <<  "[_."+struct_property2+"=\"$d2\" & _.text_"+property+"=\"$d\"] expand to $expand_struct"
+		names << d2+"_"+d	
+	}
+}
+corpus.createPartition(struct_property2+" x "+property+"_non_balanced", queries, names);
+
+println queries
+println names
+
+//display the graphic
+monitor.syncExec(new Runnable() {
+	@Override
+	public void run() {	
+	org.txm.rcpapplication.commands.RestartTXM.reloadViews();
+	}
+});
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/macroproto/partition/CreatePartitionByNumericMetadataMacro.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/macroproto/partition/CreatePartitionByNumericMetadataMacro.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/macroproto/partition/CreatePartitionByNumericMetadataMacro.groovy	(revision 258)
@@ -0,0 +1,131 @@
+// STANDARD DECLARATIONS
+package org.txm.macroproto.partition
+
+import org.kohsuke.args4j.*
+
+import groovy.transform.Field
+
+import org.txm.rcpapplication.swt.widget.parameters.*
+import org.txm.searchengine.cqp.corpus.*
+import org.txm.utils.logger.Log;
+import org.txm.rcpapplication.views.*
+import org.txm.stat.engine.r.RWorkspace
+import org.txm.Toolbox
+
+//BEGINNING OF PARAMETERS
+def corpus = corpusViewSelection
+if (!(corpus instanceof Corpus)) {
+	println "Error: this macro should be run with a Corpus selected"
+	return
+}
+
+@Field @Option(name="property", usage="the structural Unit properties list separated with commas", widget="String", required=true, def="sadnesst1")
+def property = "sadnesst1"
+
+@Field @Option(name="values_file", usage="txt file", widget="File", required=true, def="C:\\Users\\Fanny\\Desktop\\values_num.txt")
+def values_file
+
+@Field @Option(name="balance", usage="the structural Unit properties list separated with commas", widget="Boolean", required=true, def="true")
+def balance = false
+
+@Field @Option(name="expand_struct", usage="expand_struct", widget="String", required=true, def="question")
+def expand_struct = "question"
+
+// Open the parameters input dialog box
+if (!ParametersDialog.open(this)) return;
+
+def property_values = values_file.getText("UTF-8").replaceAll("\n", ",").replaceAll("\r", "")
+
+println "Balance de la métadonnée '$property' du corpus '$corpus'"
+
+def domain = []
+for (def s : property_values.split(",")) {
+	s = s.trim()
+	try {
+		domain << Integer.parseInt(s)
+	} catch(Exception e) {
+		domain << Float.parseFloat(s)
+	}
+}
+def uniq_domain = new HashSet(domain).sort() 
+println "domain size "+domain.size()
+
+def names = []
+def queries = []
+def p = 2
+String values = ""
+
+if (!balance) {
+
+for (def d : uniq_domain) {
+	if (d < p) {
+		values += "|$d"
+	} else {
+		if (values.startsWith("|")) values = values.substring(1)
+		queries <<  "[_.text_"+property+"=\"$values\"] expand to $expand_struct"
+		names << values
+		values = d
+		p++
+	}
+}
+queries <<  "[_.text_"+property+"=\"$values\"] expand to $expand_struct"
+names << values
+
+
+corpus.createPartition(property+"_non_balanced", queries, names);
+
+} else {
+//String v = domain.toString()
+//v = "c("+v.substring(1, v.length() -1) + ")"
+String v  = "c($property_values)"
+println "=========================="
+//RWorkspace.getRWorkspaceInstance().addVectorToWorkspace("domain", domain.toArray(new double[domain.size()]))
+def res = RWorkspace.getRWorkspaceInstance().eval("quantile($v)")
+def ranges = res.asDoubles()
+println "quantiles : $ranges"
+values = ""
+p = ranges[1]
+i = 1
+names = []
+queries = []
+for (def d : uniq_domain) {
+	//println "d=$d, p=$p"
+	if (d < p) {
+		values += "|$d"
+	} else {
+		if (values.startsWith("|")) values = values.substring(1)
+		println """[_.text_${property}="$values"]"""
+		queries <<  "[_.text_"+property+"=\"$values\"] expand to $expand_struct"
+		names << values
+		values = d
+		i++
+		p = ranges[i]
+	}
+}
+
+queries <<  "[_.text_"+property+"=\"$values\"] expand to $expand_struct"
+names << values
+
+corpus.createPartition(property+"_balanced", queries, names);
+}
+
+
+println queries
+println names
+
+
+//display the graphic
+monitor.syncExec(new Runnable() {
+	@Override
+	public void run() {	
+	org.txm.rcpapplication.commands.RestartTXM.reloadViews();
+	}
+});
+
+/*
+int[] counts = new int[51]
+for (def d : domain) {
+	counts[(int)(10*d)]++
+}
+println counts
+*/
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/macroproto/GetXPathMacro.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/macroproto/GetXPathMacro.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/macroproto/GetXPathMacro.groovy	(revision 258)
@@ -0,0 +1,84 @@
+package org.txm.macroproto
+// Copyright © 2015 - ENS de Lyon - http://textometrie.ens-lyon.fr
+// @author sheiden
+//
+// This file is part of the TXM platform.
+//
+// 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 3 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/>.
+//
+// $LastChangedDate: 2013-05-02 11:28:42 +0200 (jeu., 02 mai 2013) $
+// $LastChangedRevision: 2378 $
+// $LastChangedBy: sheiden $
+//
+
+// STANDARD DECLARATIONS
+
+import org.kohsuke.args4j.*
+import groovy.transform.Field
+import org.txm.rcpapplication.swt.widget.parameters.*
+
+import org.txm.importer.*
+
+// BEGINNING OF PARAMETERS
+
+// Declare each parameter here
+// (available widget types: Query, File, Folder, String, Text, Boolean, Integer, Float and Date)
+
+@Field @Option(name="srcDirectory", usage="XML source directory", widget="Folder", required=false, def="")
+def srcDirectory
+
+@Field @Option(name="srcFile", usage="XML source file", widget="File", required=false, def="")
+def srcFile
+
+@Field @Option(name="xPath", usage="XPath expression", widget="String", required=true, def="//tei:title/text()")
+def xPath
+
+// Open the parameters input dialog box
+if (!ParametersDialog.open(this)) return;
+
+// END OF PARAMETERS
+
+if (srcDirectory==null && srcFile==null) { println "** GetXPathMacro: at least a source file or a source directory must be specified."; return}
+
+if (srcDirectory!=null && srcDirectory.exists()) {
+
+	def files = srcDirectory.listFiles()
+	if (files == null || files.size() == 0) {
+		println "No files in $srcDirectory"
+		return;
+	}
+	files.sort()
+
+	for (File xmlFile : files) {
+		String name = xmlFile.getName();
+		if (!name.endsWith(".xml")) continue;
+	
+		println "-- file '$xmlFile':"
+		
+		XPathResult xpathProcessor = new XPathResult(xmlFile)
+		def value = xpathProcessor.getXpathResponse(xPath)
+		if (value != null) { println(value) }
+}
+
+} else if (srcFile!=null && srcFile.exists()) {
+	def xmlFile = srcFile
+	String name = xmlFile.getName();
+	if (!name.endsWith(".xml")) { println "** GetXPathMacro: source file extension must be '.xml'."; return}
+		
+	println "-- file '$xmlFile':"
+
+	XPathResult xpathProcessor = new XPathResult(xmlFile)
+	def value = xpathProcessor.getXpathResponse(xPath)
+	if (value != null) { println(value) } else { println "No result." }
+}
Index: tmp/org.txm.core/src/groovy/org/txm/macroproto/XMLText2MetadataCSVMacro.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/macroproto/XMLText2MetadataCSVMacro.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/macroproto/XMLText2MetadataCSVMacro.groovy	(revision 258)
@@ -0,0 +1,83 @@
+package org.txm.macroproto
+
+// STANDARD DECLARATIONS
+
+import org.kohsuke.args4j.*
+import groovy.transform.Field
+import org.txm.rcpapplication.swt.widget.parameters.*
+
+import org.txm.importer.*
+
+// BEGINNING OF PARAMETERS
+
+// Declare each parameter here
+// (available widget types: Query, File, Folder, String, Text, Boolean, Integer, Float and Date)
+
+@Field @Option(name="xpathFile", usage="'.properties' file", widget="File", required=true, def="metadata.properties")
+def xpathFile
+
+@Field @Option(name="srcDirectory", usage="XML source directory", widget="Folder", required=false, def="srcDirectory")
+def srcDirectory
+
+@Field @Option(name="metadataFile", usage="'.properties' file", widget="File", required=false, def="metadata.csv")
+def metadataFile
+
+@Field @Option(name="columnSeparator", usage="", widget="String", required=false, def=",")
+def columnSeparator
+
+@Field @Option(name="txtSeparator", usage="", widget="String", required=false, def="\"")
+def txtSeparator
+
+// Open the parameters input dialog box
+if (!ParametersDialog.open(this)) return;
+
+// END OF PARAMETERS
+
+if (!srcDirectory.exists()) { println "$srcDirectory does not exist"; return}
+if (!xpathFile.exists()) { println "$xpathFile does not exist"; return}
+
+// get Xpath queries
+def xpaths = [:]
+for (String line : xpathFile.readLines("UTF-8")) {
+	def split = line.split("=", 2);
+	if (split.size() == 2) {
+		xpaths[split[0]] = split[1]
+	}
+}
+println "XPATH queries: $xpaths"
+
+if (metadataFile == null)
+	metadataFile = new File(srcDirectory, "metadata.csv")
+
+def writer = metadataFile.newWriter("UTF-8")
+println "Creating file: $metadataFile"
+writer.print "id"
+for (String p : xpaths.keySet()) {writer.print columnSeparator+p}
+writer.println ""
+
+def files = srcDirectory.listFiles()
+if (files == null || files.size() == 0) {
+	println "No files in $srcDirectory"
+	return;
+}
+files.sort()
+
+for (File xmlFile : files) {
+	String name = xmlFile.getName();
+	if (!name.endsWith(".xml")) continue;
+	
+	println "Processing file $xmlFile..."
+	name = name.substring(0, name.indexOf(".xml"))
+	
+	writer.print "$name"
+	
+	XPathResult xpathProcessor = new XPathResult(xmlFile)
+	for (String p : xpaths.keySet()) {
+		def value = xpathProcessor.getXpathResponse(xpaths[p]);
+		if (value == null) value = "N/A"
+		writer.print columnSeparator+txtSeparator+value.replaceAll(txtSeparator,txtSeparator+txtSeparator)+txtSeparator
+	}
+	writer.println ""
+}
+
+writer.close()
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/macroproto/edition/XTZEditionBuilderMacro.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/macroproto/edition/XTZEditionBuilderMacro.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/macroproto/edition/XTZEditionBuilderMacro.groovy	(revision 258)
@@ -0,0 +1,160 @@
+package org.txm.macroproto.edition
+
+// STANDARD DECLARATIONS
+
+import groovy.transform.Field
+
+import javax.xml.parsers.*
+import javax.xml.transform.*
+import javax.xml.transform.dom.DOMSource
+import javax.xml.transform.stream.StreamResult
+
+import org.kohsuke.args4j.*
+import org.txm.Toolbox
+import org.txm.macro.edition.BuildFacsEditions
+import org.txm.macro.edition.RemoveTag
+import org.txm.objects.*
+import org.txm.rcpapplication.commands.*
+import org.txm.rcpapplication.swt.widget.parameters.*
+import org.txm.searchengine.cqp.corpus.*
+import org.w3c.dom.*
+
+println "Corpus view selection is: "+corpusViewSelection
+if (!(corpusViewSelection instanceof MainCorpus)) {
+	println "This marcro works with a MainCorpus selection. Aborting"
+	return;
+}
+def corpus = corpusViewSelection
+debug = false
+def editionName = corpus.getDefaultEdition()
+
+// PARAMETERS
+@Field @Option(name="wordsPerPage", usage="Number of words per page", widget="Integer", required=true, def="500")
+int wordsPerPage
+if (!ParametersDialog.open(this)) return;
+// END OF PARAMETERS
+
+File binDirectory = corpus.getBase().getBaseDirectory()
+File txmDirectory = new File(binDirectory, "txm/"+corpus.getName().toUpperCase())
+
+File HTMLDirectory = new File(binDirectory, "HTML")
+File newEditionDirectory = new File(HTMLDirectory, corpus.getName().toUpperCase()+"/"+editionName)
+
+BaseParameters parameters = corpus.getBase().params
+
+if (!HTMLDirectory.exists()) {
+	println "ERROR: can't find this corpus 'HTML' directory: $HTMLDirectory. Aborting"
+	return false;
+}
+
+File workDirectory = txmDirectory
+if (!workDirectory.exists()) {
+	println "XML-TXM directory ($txmDirectory) not found. Using XML tokenized directory instead: "+tokenizedDirectory
+	workDirectory = tokenizedDirectory
+}
+if (!workDirectory.exists()) {
+	println "XML tokenized directory not found: "+tokenizedDirectory
+	println "Aborting."
+	return false
+}
+
+println "Work directory=$workDirectory"
+
+//0- clean previous edition if any : html files, import.xml
+if (newEditionDirectory.exists()) {
+	println "** Old version of $editionName edition found."
+	println " removing the 'edition' reference from the corpus configuration."
+	File tempParam = new File(binDirectory, "import.xml.cpy")
+	RemoveTag rt = new RemoveTag(
+			parameters.root.getOwnerDocument(), // will be updated
+			null, // don't create a new import.xml
+			"//edition[@name='$editionName']"
+			)
+	println " delete $newEditionDirectory"
+	newEditionDirectory.deleteDir()
+	
+	printDOM(parameters.root.getOwnerDocument())
+}
+
+//2- fix import.xml
+println "** Updating corpus configuration..."
+// for edition list
+def corpusElem = parameters.getCorpusElement()
+parameters.addEditionDefinition(corpusElem, editionName, "groovy", "FacsEditionBuilderMacro");
+
+//1- create HTML files
+println "** Building new edition HTML files..."
+
+println " Creating edition $editionName directory: $newEditionDirectory"
+newEditionDirectory.mkdir()
+for (def xmlFile : workDirectory.listFiles()) {
+	if (xmlFile.isHidden() || xmlFile.isDirectory()) continue // ignore
+	String txtname = xmlFile.getName()
+	int idx = txtname.indexOf(".")
+	if (idx > 0) txtname = txtname.substring(0,idx)
+
+	println " Build HTML pages of text=$txtname"
+	BuildFacsEditions builder = new BuildFacsEditions(xmlFile, newEditionDirectory, parameters.name, txtname, wordsPerPage);
+	def newPages = builder.process()
+	if (newPages == null || newPages.size() == 0) {
+		println "WARNING: no edition files created with $xmlFile"
+	} 
+		
+	println " Build edition references in corpus configuration"
+	
+	Element textElem = corpus.getText(txtname).getSelfElement()
+	Element editionElem = parameters.addEdition(textElem, editionName, newEditionDirectory.getAbsolutePath(), "html");
+	//println "$textElem $editionElem"
+	for (def pagedef : newPages) {
+		parameters.addPage(editionElem, pagedef[0], pagedef[1]);
+	}
+}
+
+	printDOM(parameters.root.getOwnerDocument())
+
+//3- Save and reload the corpus
+println " Saving corpus configuration..."
+File paramFile = new File(binDirectory, "import.xml");
+DomUtils.save(parameters.root.getOwnerDocument(), paramFile);
+
+
+//4- Reload Corpora
+Toolbox.restart();
+monitor.syncExec(new Runnable() {
+			public void run() {
+				println "RELOAD VIEWS"
+				RestartTXM.reloadViews();
+				println "RELOAD VIEWS2"
+			}
+		});
+
+//5- Done
+println "New edition created. Be sure to copy images files in $newEditionDirectory"
+
+printDOM(parameters.root.getOwnerDocument())
+
+def printDOM(def doc) {
+	if (!debug) return;
+	try {
+		// Création de la source DOM
+		Source source = new DOMSource(doc);
+		
+		// Création du fichier de sortie
+		StreamResult resultat = new StreamResult(new PrintWriter(System.out));
+		
+		// Configuration du transformer
+		TransformerFactory fabrique = new net.sf.saxon.TransformerFactoryImpl();
+		Transformer transformer = fabrique.newTransformer();
+		transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$
+		transformer.setOutputProperty(OutputKeys.INDENT, "yes");  //$NON-NLS-1$
+		transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");  //$NON-NLS-1$
+		
+		// Transformation
+		transformer.transform(source, resultat);
+		// writer.close();
+		return true;
+	} catch (Exception e) {
+		e.printStackTrace();
+		return false;
+	}
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/svn/package.html
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/svn/package.html	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/svn/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Contains Groovy scripts used to manipulate SVN repositories</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/org/txm/svn/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/scripts/i18n/ReverseI18nDict.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/i18n/ReverseI18nDict.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/i18n/ReverseI18nDict.groovy	(revision 258)
@@ -0,0 +1,125 @@
+package org.txm.scripts.i18n
+
+import org.txm.utils.BiHashMap
+
+/**
+ * Bihashmap 
+ * Check any missing key in both of messages.properties and Message.java files
+ * @author mdecorde
+ *
+ */
+class ReverseI18nDict extends BiHashMap<String, String> {
+	File propFile;
+	File messageFile;
+	
+	def messageKeys = new HashSet<String>()
+	
+	public ReverseI18nDict(File propFile) {
+		this(propFile, null)
+	}
+	
+	public ReverseI18nDict(File propFile, File messageFile) {
+		this.propFile = propFile
+		this.messageFile = messageFile
+		BufferedReader reader = new BufferedReader(new InputStreamReader(
+				new FileInputStream(propFile), "iso-8859-1"));
+		String line = reader.readLine();
+		while (line != null) {
+			if (!line.startsWith("#")) {
+				String[] split = line.split("=", 2);
+				if (split.length == 2) {
+					this.put(split[0], split[1]);
+				}
+			}
+			line = reader.readLine();
+		}
+		
+		if (messageFile != null) {
+			BufferedReader reader2 = new BufferedReader(new InputStreamReader(new FileInputStream(messageFile), "iso-8859-1"));
+			String line2 = reader2.readLine();
+			while (line2 != null) {
+				line2 = line2.trim();
+				if (line2.startsWith("public static String")) {
+					line2 = line2.substring(21, line2.length() -1);
+					messageKeys << line2
+				}
+				line2 = reader2.readLine();
+			}
+		}
+	}
+	
+	public def getMissingsMessageKeys() {
+		def missing = []
+		for (String pKey : this.getKeys())
+			if (!messageKeys.contains(pKey))
+				missing << pKey
+				
+		return missing
+	}
+	
+	public getMissingPropKeys() {
+		def missing = []
+		def pKeys = this.getKeys()
+		for (String mKey : messageKeys)
+			if (!pKeys.contains(mKey))
+				missing << mKey
+				
+		return missing
+	}
+	
+	public void saveChanges() {
+
+		//Write prop File
+		File oldFile = new File(propFile.getParentFile(), propFile.getName()+".cpy");
+		propFile.renameTo(oldFile);
+		propFile.withWriter("iso-8859-1") { out ->
+			for(String key : this.getKeys().sort()) {
+				out.println(key+"="+this.get(key))
+			}
+		}
+		
+		// write message File
+		if (messageFile == null) return;
+		
+		File oldFile2 = new File(messageFile.getParentFile(), messageFile.getName()+".cpy");
+		messageFile.renameTo(oldFile2); // back up
+		messageFile.withWriter("iso-8859-1") { out ->
+			// write start
+			out.println('''package org.txm;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+	
+	// The Constant BUNDLE_NAME. 
+	private static final String BUNDLE_NAME = "org.txm.messages"; //$NON-NLS-1$
+				''')
+			
+			//write keys
+			for(String key : this.getKeys().sort())
+				out.println("\tpublic static String $key;");
+			
+			// write end
+			out.println('''
+	static {
+		// initialize resource bundle
+		NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+	}
+
+	private Messages() {
+	}
+}
+				''')
+		}
+	}
+	
+	public static void main(String[] args) {
+		File propFile = new File("/home/mdecorde/workspace43/org.txm.toolbox/src/java/org/txm/messages.properties")
+		File messageFile = new File("/home/mdecorde/workspace43/org.txm.toolbox/src/java/org/txm/Messages.java")
+		ReverseI18nDict dict = new ReverseI18nDict(propFile, messageFile);
+		println dict.getMissingsMessageKeys()
+		println dict.getMissingPropKeys();
+		println dict.toString();
+		//dict.saveChanges();
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/scripts/i18n/ExternalizeStringFile.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/i18n/ExternalizeStringFile.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/i18n/ExternalizeStringFile.groovy	(revision 258)
@@ -0,0 +1,263 @@
+package org.txm.scripts.i18n
+
+import javax.swing.*;
+
+/**
+ * Scan a java file to find unexternalized Strings
+ * create the Messages.java entries and the *.properties entries too
+ * replace externalized Strings in the java file
+ * 
+ * uses a ReverseI18nDict
+ * 
+ * @author mdecorde
+ */
+class ExternalizeStringFile {
+
+	File propFile;
+	File messageFile
+
+	ReverseI18nDict dict
+
+	String prefix
+	int iprefix = 0;
+	
+	boolean mustSaveChanges = false;
+
+	public ExternalizeStringFile(File propFile, File messageFile) {
+		dict = new ReverseI18nDict(propFile, messageFile);		
+	}
+	
+	private ArrayList<String> getLineStrings(String l) {
+		def strings = []
+		boolean inS = false;
+		int start = 0;
+		int comment = 0;
+		for(int i = 0 ; i < l.length() ; i++) {
+			def c = l[i]
+			if (inS) {
+				comment = 0
+				if (c == "\\") {
+					i++;
+				} else if (c == "\"") {
+					inS = false;
+					strings << l.substring(start, i+1);
+				}
+			} else {
+				if (c == "\"") {
+					inS = true;
+					start = i;
+					comment = 0
+				} else if (c == "/") {
+					comment++;
+					if (comment == 2) break;
+				} else {
+					comment = 0
+				}
+			}
+		}
+		return strings;
+	}
+	
+	BufferedReader reader;
+	String line;
+	String previousLine;
+	boolean ignore = false;
+	int nline = 1;
+
+	def nlserrors = []
+	def linesToWrite = []
+
+	int nTotalChanges = 0;
+	
+	def strings;
+	def nonnls;
+	def toExternalize = []
+	def toNLSize = []
+	
+	private int processSourceFile(File sourceFile, boolean processMode) {
+		
+		prefix = sourceFile.getName();
+		prefix = prefix.substring(0, prefix.indexOf("."))+"_" ;
+		iprefix = 0;
+		
+		reader = new BufferedReader(new InputStreamReader(new FileInputStream(sourceFile), "UTF-8"));
+		line = reader.readLine();
+		previousLine;
+		ignore = false;
+		nline = 1;
+
+		nlserrors = []
+		linesToWrite = []
+
+		nTotalChanges = 0;
+		
+		while (line != null) {
+			String l = line.trim()
+			if (ignore) {
+				if (l.startsWith("*/") || l.endsWith("*/")) {
+					ignore = false
+				} else if (l.startsWith("*")) {
+
+				} else {
+//					println "ERROR LINE $nline : not a comment ? "+l
+//					return -1;
+				}
+			} else {
+				if (l.startsWith("//")) {
+					// ignore
+				} else if (l.startsWith("@")) {
+					// ignore
+				} else if (l.startsWith("/*")) {
+					ignore = true;
+					if (l.endsWith("*/")) ignore=false
+				} else {
+					strings = getLineStrings(l);
+					nonnls = getNONNLS(l);
+					toExternalize = []
+					toNLSize = []
+
+					// fix NON-NLS
+					if (nonnls.size() > 0 && nonnls.size() != strings.size()) {
+						println "NLS error line $nline: "+l
+						nlserrors << nline
+					}
+
+					if (nlserrors.size() == 0) {
+						// quick pre process
+						for (int i = 0 ; i < strings.size() ; i++) {
+							if (nonnls.contains(i)) continue; // ignore
+
+							if (strings[i] == "\"\"" || strings[i] == "\" \"" || strings[i] == "\"\\n\"") {
+								toNLSize << i;
+							} else {
+								toExternalize << i
+							}
+						}
+
+						if (processMode) {
+							nTotalChanges += processLine();
+						} else {
+							nTotalChanges += (toExternalize.size() + toNLSize.size());
+						}
+					}
+				}
+			}
+
+			linesToWrite << line
+			previousLine = line;
+			line = reader.readLine();
+			nline++;
+		}
+
+		if (nlserrors.size() > 0) {
+			println "NLS ERROR "+sourceFile.getName()+" lines $nlserrors"
+			return -1;
+		} else if (processMode && nTotalChanges > 0) {
+			mustSaveChanges = true;
+			File oldFile = new File(sourceFile.getParentFile(), sourceFile.getName()+".cpy");
+			if (!sourceFile.renameTo(oldFile)) {
+				println "Failed to backup old source file $sourceFile to $oldFile"
+				return 0;
+			} else {
+				sourceFile.withWriter("UTF-8") { writer ->
+					for(String l : linesToWrite) {
+						writer.println l
+					}
+				}
+			}
+		}
+		return nTotalChanges
+	}
+	
+	private int processLine() {
+		int nChanges = 0;
+		int ichar = 0;
+		for (int i = 0 ; i < strings.size() ; i++) {
+			ichar = line.indexOf(strings[i], ichar);
+			if (toExternalize.contains(i)) {
+				println "Line $nline : $strings $nonnls $toNLSize $toExternalize"
+				nChanges++;
+				String value = strings[i].substring(1,strings[i].length() -1)
+				if (dict.containsValue(value)) {
+					String str = "Messages."+dict.getKey(value)
+					println " automatic replace "+strings[i]+" with Messages."+dict.getKey(value);
+					String p1 = line.substring(0, ichar);
+					String p2 = line.substring(ichar+strings[i].length(), line.length())
+					println " old: $line"
+					line = p1+str+p2
+					println " new: $line"
+				} else {
+					String key = getNextKey();
+					String ok = JOptionPane.showInputDialog(null, "Key for value=$value\n\n$previousLine\n$line\n", key);
+					if(ok == null) {
+						println " add new NON-NLS "+(i+1)
+						println " old: $line"
+						line += " //\$NON-NLS-"+(i+1)+"\$"
+						println " new: $line"
+					} else {
+						println " add new key: $key"
+						dict.put(key, value);
+
+						String p1 = line.substring(0, ichar);
+						String p2 = line.substring(ichar+strings[i].length(), line.length())
+						String str = "Messages."+key
+						println " old: $line"
+						line = p1+str+p2
+						println " new: $line"
+					}
+				}
+			} else if (toNLSize.contains(i)) {
+				println "Line $nline : $strings $nonnls $toNLSize $toExternalize"
+				nChanges++;
+				println " add automatic new NON-NLS "+(i+1)
+				println " old: $line"
+				line += " //\$NON-NLS-"+(i+1)+"\$"
+				println " new: $line"
+			}
+		}
+		return nChanges;
+	}
+
+	private def getNONNLS(String l) {
+		def idx = []
+		def m = l =~ /\/\/.NON-NLS-[0-9]\$/
+		m.each { idx << Integer.parseInt(it[11])-1 }
+		return idx.sort()
+	}
+
+	private def getNextKey() {
+		String tmp = prefix+(iprefix++);
+		while (dict.containsKey(tmp)) {
+			tmp = prefix+(iprefix++);
+		}
+		return tmp;
+	}
+	
+	int getNbOfChanges(File sourceFile) {
+		return processSourceFile(sourceFile, false);
+	}
+	
+	int process(File sourceFile) {
+		return processSourceFile(sourceFile, true);
+	}
+	
+	public boolean saveChanges() {
+		if (mustSaveChanges ) {
+			mustSaveChanges = false;
+			dict.saveChanges();
+			return true;
+		}
+		return false;
+	}
+
+	public static void main(String[] args) {
+		File sourceFile = new File("/home/mdecorde/workspace37/org.txm.toolbox/src/java/org/txm/functions/cooccurrences/Cooccurrence.java");
+		File propFile = new File("/home/mdecorde/workspace37/org.txm.toolbox/src/java/org/txm/messages.properties")
+		File messageFile = new File("/home/mdecorde/workspace37/org.txm.toolbox/src/java/org/txm/Messages.java")
+
+		ExternalizeStringFile externalizer = new ExternalizeStringFile(propFile, messageFile)
+		println externalizer.getNbOfChanges(sourceFile);
+		println externalizer.process(sourceFile);
+		externalizer.saveChanges();
+	}
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/scripts/i18n/IsStringMissingInPlugin.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/i18n/IsStringMissingInPlugin.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/i18n/IsStringMissingInPlugin.groovy	(revision 258)
@@ -0,0 +1,54 @@
+package org.txm.scripts.i18n
+
+/**
+ * Display the missing i18n keys of the plugin.xml file 
+ * 
+ * @author mdecorde
+ *
+ */
+class IsStringMissingInPlugin {
+	
+	public static void main(String[] args) {
+		String userhome = System.getProperty("user.home")
+		File propertyFile = new File(userhome, "workspace43/org.txm.rcp/OSGI-INF/l10n/bundle_fr.properties");
+		File copyFile = new File(userhome, "workspace43/org.txm.rcp/OSGI-INF/l10n/bundle_copy.properties");
+		File pluginFile = new File(userhome, "workspace43/org.txm.rcp/plugin.xml");
+		if (!(propertyFile.exists() && propertyFile.canRead() && propertyFile.canWrite() && propertyFile.isFile()))
+		{
+			println "error file : "+propertyFile
+			return
+		}
+
+		println "Get properties of "+propertyFile
+		Properties props = new Properties();
+		propertyFile.withReader("iso-8859-1") { input->
+			props.load(input);
+			input.close()
+		}
+
+		
+		String pluginXMLcontent = pluginFile.getText();
+		def pluginKeys = [];
+		def matcher = pluginXMLcontent =~ /"%([.A-Za-z0-9]+)+"/ // %key.of.the.field
+		println "Comparing keys "+matcher.pattern() +" of "+pluginFile+" with those declared"
+		matcher.each { // iterates of %key in the plugin.xml content
+			def key = it[1]
+			pluginKeys << key
+			if (!props.containsKey(key)) {
+				println "Prop file does not contains the key: $key"
+				//println " adding default value."
+				props.setProperty(key, "NA")
+			}
+		} 
+		
+		for (String key : props.keySet()) {
+			if (!pluginKeys.contains(key)) {
+				println "plugin.xml does not use the key: "+key
+			}
+		}
+		
+		propertyFile.withWriter("iso-8859-1") { output ->
+			props.store(output, "")
+		}
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/scripts/i18n/ExternalizationFilesUpdater.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/i18n/ExternalizationFilesUpdater.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/i18n/ExternalizationFilesUpdater.groovy	(revision 258)
@@ -0,0 +1,312 @@
+// 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
+// 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.
+
+//
+// This file is part of the TXM platform.
+//
+// The TXM platform is free software: you can redistribute it and/or modif y
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 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/>.
+// 
+// 
+// 
+// $LastChangedDate: 2013-07-25 16:24:13 +0200 (jeu., 25 juil. 2013) $
+// $LastChangedRevision: 2490 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.scripts.i18n;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStreamReader;
+import java.util.LinkedList;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Tool to update the key of externalization files xxxx_fr.properties
+ * adds _NA to missing keys
+ * 
+ * @author mdecorde
+ * 
+ */
+class ExternalizationFilesUpdater {
+
+	/** The dirfiles. */
+	LinkedList<File> dirfiles = new LinkedList<File>();
+	
+	/** The propertyfiles. */
+	HashMap<String, File> propertyfiles = new HashMap<String, File>();
+	
+	/** The fileentries. */
+	HashMap<File, List<String>> fileentries = new HashMap<String, List<String>>();
+	
+	/** The fileentriesvalues. */
+	HashMap<File, HashMap<String, String>> fileentriesvalues = new HashMap<String, HashMap<String, String>>();
+
+	/**
+	 * Gets the entries.
+	 *
+	 * @param file the file
+	 * @return the entries
+	 */
+	public List<String> getEntries(File file)
+	{
+		List<String> entries = [];
+		BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file) , "iso-8859-1"));
+		String line = reader.readLine();
+		while (line != null) {
+			String[] split = line.split("=", 2);
+			if (split.length > 0) {
+				String key = split[0];
+				entries.add(key);
+			}
+			line = reader.readLine();
+		}
+		return entries;
+	}
+
+	/**
+	 * Gets the values.
+	 *
+	 * @param file the file
+	 * @return the values
+	 */
+	public HashMap<String, String> getValues(File file) {
+		HashMap<String, String> values = new HashMap<String, String>();
+		BufferedReader reader = new BufferedReader(new InputStreamReader(
+				new FileInputStream(file), "iso-8859-1"));
+		String line = reader.readLine();
+		while (line != null) {
+			String[] split = line.split("=");
+			if (split.length > 0) {
+				String key = split[0];
+				String concat = "";
+				for (int i = 1; i < split.length; i++)
+					concat += split[i];
+				values.put(key, concat);
+			}
+			line = reader.readLine();
+		}
+		return values;
+	}
+
+	/**
+	 * Process found directories.
+	 */
+	public void processFoundDirectories()
+	{
+		for (String dirfile : dirfiles) {
+			println "DIRECTORY : "+dirfile
+			List<File> files = propertyfiles.get(dirfile)
+			for (File f : files) {
+				this.fileentries.put(f, getEntries(f));
+				this.fileentriesvalues.put(f, getValues(f));
+			}
+			File reference = null;
+			if (files.get(0).getName().startsWith("m")) {
+				reference = new File(dirfile,"messages.properties");
+			}
+			else if (files.get(0).getName().startsWith("b"))
+				reference = new File(dirfile,"bundle.properties");
+			
+			if (reference != null && reference.exists()) {
+				for (File f : files) {
+					if (f != reference) {
+						List<String> refentries = this.fileentries.get(reference).clone();
+						List<String> tmp1 = this.fileentries.get(f).clone();
+						tmp1.removeAll(refentries);
+						
+						refentries = this.fileentries.get(reference).clone();
+						List<String> tmp = this.fileentries.get(f);
+						refentries.removeAll(tmp);
+						for (String missing : refentries) {
+							this.fileentriesvalues.get(f).put(missing,"N/A_"+this.fileentriesvalues.get(reference).get(missing)); // put entry's value
+						}
+						
+						this.fileentries.put(f, this.fileentries.get(reference)); // update file entries
+						
+						if (tmp1.size() > 0 || refentries.size() > 0)
+							println " "+f.getName()
+						if (tmp1.size() > 0)
+							println "  Removed keys : "+tmp1;
+						if (refentries.size() > 0)
+							println "  Added keys : "+refentries;
+					}
+				}
+			}
+		}
+	}
+
+	/**
+	 * Update files.
+	 */
+	public void updateFiles()
+	{
+		for(String dirfile : dirfiles)
+		{
+			List<File> files = propertyfiles.get(dirfile);
+			for(File f : files)
+			{
+				List<String> entries =  this.fileentries.get(f);
+				HashMap<String, String> values = this.fileentriesvalues.get(f);
+				
+				Writer writer = new OutputStreamWriter(new FileOutputStream(f) , "iso-8859-1");
+				for(String entry : entries)
+				{
+					writer.write(entry+"="+values.get(entry)+"\n");
+				}
+				writer.close()
+			}
+		}
+	}
+
+	/**
+	 * Creates the missing files.
+	 *
+	 * @param suffix the suffix
+	 */
+	public void createMissingFiles(String suffix)
+	{
+		println "Looking for missing messages files "+ suffix;
+		for(String dirfile : dirfiles)
+		{
+			//println "DIRECTORY : "+dirfile
+			File reference = null;
+			String lookingname = "";
+			List<File> files = propertyfiles.get(dirfile)
+			if(files.get(0).getName().startsWith("m"))
+			{
+				reference = new File(dirfile,"messages.properties");
+				lookingname = "messages_"+suffix+".properties"
+			}
+			else if (files.get(0).getName().startsWith("b"))
+			{
+				reference = new File(dirfile,"bundle.properties");
+				lookingname = "bundle_"+suffix+".properties"
+			}
+			
+			boolean create = true;
+			if(reference != null && reference.exists())
+			{
+				for(File f : files)
+				{
+					if(f.getName() == lookingname)
+						create = false;
+				}
+			}
+			if(create)
+			{
+				new File(dirfile,lookingname).createNewFile();
+				println "Create file " +new File(dirfile,lookingname)
+			}
+		}
+	}
+
+	/* (non-Javadoc)
+	 * @see java.lang.Object#toString()
+	 */
+	public String toString()
+	{
+		String rez = "";
+		for(String dirfile : dirfiles)
+		{
+			rez += dirfile+"\n";
+			for(File f : propertyfiles.get(dirfile))
+				rez += "  "+f.getName()+"\n"
+		}
+		return rez;
+	}
+
+	/**
+	 * Scan directory.
+	 *
+	 * @param directory the directory
+	 */
+	public void scanDirectory(File directory)
+	{
+		if(!directory.exists())
+		{
+			println "directory '$directory' does not exists"
+			return;
+		}
+		
+		println "scan directory : "+directory.getAbsolutePath();
+		LinkedList<File> files = new LinkedList<File>();
+		files.add(directory);
+		
+		while(!files.isEmpty())
+		{
+			File current = files.removeFirst();
+			if(current.isDirectory())
+			{
+				List<String> currentpfiles = [];
+				for(File sfile : current.listFiles())
+				{
+					if(sfile.isDirectory())
+						files.add(sfile);
+					else if(sfile.getName().endsWith(".properties") && ( sfile.getName().startsWith("messages") || sfile.getName().startsWith("bundle")) )
+						currentpfiles.add(sfile)
+				}
+				if(currentpfiles.size() > 0)
+				{
+					dirfiles.add(current.getAbsolutePath());
+					propertyfiles.put(current.getAbsolutePath(), currentpfiles);
+				}
+			}
+		}
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args)
+	{
+		String userdir = System.getProperty("user.home");
+
+		println "\nRCP\n";
+		
+		ExternalizationFilesUpdater scanner = new ExternalizationFilesUpdater();
+//		scanner.scanDirectory(new File(userdir, "workspace37/org.txm.rcp")); // find directories with a messages.properties file
+//		scanner.createMissingFiles("fr"); // create messages_fr.properties files when a messages.properties is found
+//		scanner.processFoundDirectories(); // find missing and obsolets keys
+//		scanner.updateFiles(); // update messages files content
+		
+		println "\nTOOLBOX\n";
+		
+		scanner = new ExternalizationFilesUpdater();
+		scanner.scanDirectory(new File(userdir, "workspace43/org.txm.rcp/src/main/java"));
+		scanner.createMissingFiles("ru");
+		scanner.processFoundDirectories();
+		scanner.updateFiles();
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/scripts/i18n/I18nDiff.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/i18n/I18nDiff.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/i18n/I18nDiff.groovy	(revision 258)
@@ -0,0 +1,84 @@
+package org.txm.scripts.i18n
+
+import java.io.File;
+import java.util.HashMap;
+/**
+ * Display a diff of 2 message files
+ * 
+ * @author mdecorde
+ *
+ */
+class I18nDiff {
+	Properties values1, values2;
+	File file1;
+	File file2;
+
+	def notInValues1, notInValues2
+	I18nDiff(File file1, File file2) {
+		this.file1 = file1
+		this.file2 = file2
+		values1 = getValues(file1)
+		values2 = getValues(file2)
+
+		def inter = values1.keySet().intersect(values2.keySet());
+		notInValues1 = values2.keySet().minus(values1.keySet());
+		notInValues2 = values1.keySet().minus(values2.keySet());
+
+		println "not in $file1"
+		for(String key : notInValues1)
+			if (key.trim().length() > 0)
+				println key+" = "+values2.get(key)
+
+		println "not in $file2"
+		for(String key : notInValues2)
+			if (key.trim().length() > 0)
+				println key+" = "+values1.get(key)
+
+		//		println "values diff"
+		//
+		//		for(String key : inter ) {
+		//			if(values1.get(key) != values2.get(key))
+		//				println key+" = "+values1.get(key)+" != "+values2.get(key)
+		//		}
+	}
+
+	public void synchronizeFromF1toF2() {
+		
+		for(String key : notInValues2) {
+			if (key.trim().length() > 0)
+				values2.setProperty(key, "NA_"+values1.get(key));
+		}
+		
+		for(String key : notInValues1)
+			if (key.trim().length() > 0)
+				values2.remove(key)
+				
+		file2.withWriter("iso-8859-1") { writer ->
+			values2.store(writer, "")
+		}
+	}
+
+	/**
+	 * Gets the values.
+	 *
+	 * @param file the file
+	 * @return the values
+	 */
+	public Properties getValues(File file) {
+		Properties props = new Properties();
+		file.withReader("iso-8859-1") { input->
+			props.load(input);
+			input.close()
+		}
+		return props;
+	}
+
+	public static void main(String[] args) {
+		String userhome = System.getProperty("user.home");
+		File f1 = new File(userhome, "workspace43/org.txm.rcp/OSGI-INF/l10n/bundle.properties")
+		File f2 = new File(userhome, "workspace43/org.txm.rcp/OSGI-INF/l10n/bundle_fr.properties")
+		
+		I18nDiff diff = new I18nDiff(f1, f2);
+		diff.synchronizeFromF1toF2()
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/scripts/i18n/MergeExternalizedStringFiles.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/i18n/MergeExternalizedStringFiles.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/i18n/MergeExternalizedStringFiles.groovy	(revision 258)
@@ -0,0 +1,293 @@
+package org.txm.scripts.i18n
+
+import java.io.File;
+import org.eclipse.osgi.util.NLS;
+import org.txm.utils.DeleteDir;
+
+/**
+ * Scan for *.properties files and merge them into one
+ * @author mdecorde
+ *
+ */
+class MergeExternalizedStringFiles {
+	
+	ArrayList<File> alldirs;
+	LinkedHashMap<File, ArrayList> data = [:];
+	
+	public MergeExternalizedStringFiles(File projectDir)
+	{
+		alldirs = scanDirectory(projectDir);
+		alldirs.sort{it.getAbsolutePath();}
+		//System.out.println("All dirs size: "+alldirs.size);
+		findMessageClasses();
+		mergeAll()
+	}
+	
+	public findMessageClasses()
+	{
+		File messageClass;
+		ArrayList<File> externalizeMessages;
+		for(int i = 0 ; i < alldirs.size() ; i++) {
+			File dir = alldirs.get(i)
+			if (!dir.isDirectory())
+				continue;
+			//System.out.println("Dir: "+dir);
+			externalizeMessages = new ArrayList<File>();
+			for (File f : dir.listFiles()) {
+				if (f.getName() == "Messages.java")
+					messageClass = f
+				if (f.getName() =~ "messages(_..)?\\.properties")
+					externalizeMessages << f
+			}
+			
+			if (messageClass != null) {
+				String bundle = findBundle(messageClass);
+				data.put(dir, [messageClass, bundle, externalizeMessages])
+			} else {
+				alldirs.remove(i);
+				i--;
+			}
+		}
+		println "all dirs size: "+alldirs.size()
+		//		for(def f : alldirs)
+		//			println f
+	}
+	
+	public String findBundle(File message)
+	{
+		String ret;
+		message.eachLine("iso-8859-1") {
+			if (it.contains("private static final String BUNDLE_NAME = ")) {
+				int start = it.indexOf("\"")
+				int end = it.lastIndexOf("\"")
+				ret = it.substring(start+1, end)
+			}
+		}
+		return ret;
+	}
+	
+	/**
+	 * Scan directory.
+	 *
+	 * @param directory the directory
+	 */
+	public ArrayList<File> scanDirectory(File directory)
+	{
+		ArrayList<File> dirfiles = [];
+		
+		if (!directory.exists()) {
+			println "directory '$directory' does not exists"
+			return;
+		}
+		
+		println "scan directory : "+directory.getAbsolutePath();
+		LinkedList<File> files = new LinkedList<File>();
+		files.add(directory);
+		
+		while (!files.isEmpty()) {
+			File current = files.removeFirst();
+			if (current.isDirectory() && !current.getName().startsWith(".")) {
+				//println "add dir: "+current
+				List<String> currentpfiles = [];
+				for (File sfile : current.listFiles()) {
+					if (sfile.isDirectory())
+						files.add(sfile);
+				}
+				
+				dirfiles.add(current);
+			}
+		}
+		return dirfiles;
+	}
+	
+	public void mergeAll()
+	{
+		def files = new ArrayList<File>(data.keySet());
+		println files
+		if (files.size() < 1)
+			return;
+		
+		File refDir = files.get(0);
+		File refClass = data.get(refDir)[0];
+		String refBundle = data.get(refDir)[1];
+		def externalized = data.get(refDir)[2];
+		
+		System.out.println("ref dir: "+refDir);
+		System.out.println("ref class: "+refClass);
+		System.out.println("ref bundle: "+refBundle);
+		System.out.println("ref files: "+externalized);
+		
+		// get externalized ref strings
+		//      Lang            Key     externalized string 
+		HashMap<String, HashMap<String, String>> externalizedLines = [:];
+		for (File source : externalized) {
+			def lines = new HashMap<String, String>();
+			externalizedLines.put(source.getName(), lines);
+			source.eachLine("iso-8859-1"){
+				if (it =~ ".+=.+") {
+					int idx = it.indexOf("=");
+					lines.put(it.substring(0, idx), it.substring(idx+1))
+				} else if(it =~ ".+=\$") {
+					int idx = it.indexOf("=")
+					String key = it.substring(0, idx)
+					String value = ""
+					lines.put(key, value)
+				}
+			}
+		}
+		
+		// get references keys
+		HashSet<String> refKeys = new HashSet<String>();
+		refClass.eachLine("iso-8859-1") {
+			if (it =~ ".+public static String .+")
+				refKeys << it.trim()
+		}
+		
+		println "BEFORE"
+		println "refKeys size: "+refKeys.size();
+		println "fr externalizedLines size: "+externalizedLines.get("messages_fr.properties").size();
+		println "en externalizedLines size: "+externalizedLines.get("messages.properties").size();
+		
+		// for all sub dir
+		for (int i = 1 ; i < files.size() ; i++) {
+			File srcDir = files.get(i);
+			File srcClass = data.get(srcDir)[0];
+			String srcBundle = data.get(srcDir)[1];
+			
+			def srcExternalized = data.get(srcDir)[2];
+			// merge externalized strings
+			for (File source : srcExternalized) {
+				def lines = externalizedLines.get(source.getName());
+				source.eachLine("iso-8859-1") {
+					if (it =~ ".+=.+") {
+						int idx = it.indexOf("=")
+						String key = it.substring(0, idx)
+						String value = it.substring(idx+1)
+						if (lines.containsKey(key) && lines.get(key) != value)
+							println "merged message of "+source.getName()+": "+it+ " >> "+lines.get(key)
+						lines.put(key, value)
+					} else if(it =~ ".+=\$") {
+						int idx = it.indexOf("=")
+						String key = it.substring(0, idx)
+						String value = ""
+						lines.put(key, value)
+					}
+				}
+				source.delete(); // bye bye *.properties files
+			}
+						
+			// merge static String
+			if(!srcClass.exists())
+			{
+				println "file removed: "+srcClass
+				println  srcDir
+				println  srcClass
+				println  srcBundle
+				println  srcExternalized
+				continue;
+			}
+			srcClass.eachLine("iso-8859-1"){
+				if(it =~ ".+public static String .+")
+				{
+//					if(refKeys.contains(it.trim()))
+//						println "Externalized key merged: "+it
+					refKeys << it.trim()
+				}
+			}
+			srcClass.delete(); // bye bye Messages.java
+		}
+		
+		println "AFTER"
+		println "refKeys size: "+refKeys.size();
+		println "fr externalizedLines size: "+externalizedLines.get("messages_fr.properties").size();
+		println "en externalizedLines size: "+externalizedLines.get("messages.properties").size();
+		
+		//check unused externalized strings
+		def keysDeclared = refKeys.collect{it.substring(21, it.length() -1) };
+		System.out.println("number of keys declared in Message.java: "+keysDeclared.size());
+		def missingDeclarations = new HashMap<String, HashSet<String>>();
+		def missingExternalizations = new HashMap<String, HashSet<String>>();
+		for(def lang : externalizedLines.keySet())
+		{
+			def keys = externalizedLines.get(lang).keySet(); // keys  in propeties files
+			missingExternalizations.put(lang, new HashSet<String>());
+			missingDeclarations.put(lang, new HashSet<String>());
+			for(String key : keys)
+				if(!keysDeclared.contains(key))
+					missingDeclarations.get(lang) << key
+					
+			for(String key : keysDeclared)
+				if(!keys.contains(key))
+					missingExternalizations.get(lang) << key
+		}
+		
+		println "fix missing key declaration and externalization"
+		for(String lang: missingExternalizations.keySet())
+		{
+			println "Lang: "+lang
+			println " missingDeclarations: "+missingDeclarations.get(lang)
+			for(String key : missingDeclarations.get(lang))
+				refKeys << "public static String "+key+";"
+			println " missingExternalizations: "+missingExternalizations.get(lang)
+			for(String key : missingExternalizations.get(lang))
+				externalizedLines.get(lang).put(key, "N/A")
+		}
+		
+		println "AFTER FIX"
+		println "refKeys size: "+refKeys.size();
+		println "fr externalizedLines size: "+externalizedLines.get("messages_fr.properties").size();
+		println "en externalizedLines size: "+externalizedLines.get("messages.properties").size();
+		
+	
+		// write externalized lines
+		for(File source : externalized)
+		{
+			source.withWriter("iso-8859-1") { out ->
+				def hash = externalizedLines.get(source.getName())
+				def keys = hash.keySet();
+				keys = keys.sort()
+				keys.each() { 
+					out.writeLine(it+"="+hash.get(it))
+				}
+			}
+		}
+
+		// write classRef File
+		refClass.withWriter("iso-8859-1") { out ->			
+			// write start
+			out.writeLine('''
+package org.txm.;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+
+	// The Constant BUNDLE_NAME. 
+	private static final String BUNDLE_NAME = "org.txm.messages"; //$NON-NLS-1$
+	
+				''')
+			
+			//write keys
+			for(String key : refKeys.sort())
+				out.writeLine("\t"+key);
+			
+			// write end
+			out.writeLine('''
+	static {
+		// initialize resource bundle
+		NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+	}
+
+	private Messages() {
+	}
+}
+				''')
+		}
+	}
+	
+	public static void main(String[] args)
+	{
+		File projectdir = new File("/home/mdecorde/workspace37/org.txm.toolbox/src/java")
+		def rez = new MergeExternalizedStringFiles(projectdir);
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/scripts/i18n/IsStringUsedInPlugin.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/i18n/IsStringUsedInPlugin.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/i18n/IsStringUsedInPlugin.groovy	(revision 258)
@@ -0,0 +1,63 @@
+package org.txm.scripts.i18n
+
+/**
+ * Display the String and key not used in the plugin messages
+ * @author mdecorde
+ *
+ */
+class IsStringUsedInPlugin {
+	Properties props;
+
+	public boolean scan(File propertyFile, File pluginFile) {
+		if(!(propertyFile.exists() && propertyFile.canRead() && propertyFile.canWrite() && propertyFile.isFile()))
+		{
+			println "error file : "+propertyFile
+			return false;
+		}
+
+		props = new Properties();
+		propertyFile.withReader("iso-8859-1") { input->
+			props.load(input);
+			input.close()
+		}
+
+		String content = pluginFile.getText();
+		def toRemove = [];
+		for(def key : props.keySet()) {
+			if (!content.contains("\"%"+key+"\"")) {
+				println "not used $key "+props.get(key);
+				toRemove << key
+			}
+		}
+
+		for(String key : toRemove) {
+			props.remove(key);
+		}
+
+
+		if (toRemove == 0) {
+			println "nothing to do"
+			return false;
+		}
+		return true
+	}
+
+	public boolean writeFixes(File propertyFile) {
+		if (props == null) return false;
+		propertyFile.withWriter("iso-8859-1") { output ->
+			props.store(output, "")
+		}
+		return true;
+	}
+
+	public static void main(String[] args) {
+		String userhome = System.getProperty("user.home")
+		File propertyFile = new File(userhome, "workspace43/org.txm.rcp/OSGI-INF/l10n/bundle.properties");
+		File pluginFile = new File(userhome, "workspace43/org.txm.rcp/plugin.xml");
+		IsStringUsedInPlugin fixer = new IsStringUsedInPlugin();
+		//uncomment to remove unused Strings
+		if (fixer.scan(propertyFile, pluginFile)) {
+			fixer.writeFixes(propertyFile)
+		}
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/scripts/i18n/ExternalizerUI.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/i18n/ExternalizerUI.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/i18n/ExternalizerUI.groovy	(revision 258)
@@ -0,0 +1,145 @@
+package org.txm.scripts.i18n;
+
+import java.awt.*;
+import javax.swing.*;
+import javax.swing.table.*
+import java.awt.GridLayout
+import java.awt.event.*
+
+import org.txm.utils.LS;
+/**
+ * This replace the eclipse externalisation interface
+ * Scan the java files for not translated Strings and update the messages.properties file
+ * 
+ * uses ExternalizeStringFile
+ * @author mdecorde
+ *
+ */
+class ExternalizeUI extends JPanel {
+	ExternalizeStringFile externalizer;
+
+	ExternalizeUI() {
+		super(new FlowLayout());
+		File userDir = new File(System.getProperty("user.home"))
+		File srcDir = new File(userDir, "workspace43/org.txm.rcp/src/main/java")
+		File propFile = new File(srcDir, "org/txm/rcpapplication/messages.properties")
+		File messageFile = new File(srcDir, "org/txm/rcpapplication/Messages.java")
+
+		println userDir
+		println srcDir
+		println propFile
+		println messageFile
+
+		String[] columnNames = ["Files in "+srcDir.getPath(), "Nb of changes"];
+
+
+		def files = LS.list(srcDir, true, false);
+		files = files.findAll { file -> file.getName().endsWith(".java") }
+		files = files.sort()
+		println files
+
+		externalizer = new ExternalizeStringFile(propFile, messageFile);
+		println "externalizer ready"
+		def data = []
+		def selectedFiles = []
+		for (File file : files) {
+			int count = externalizer.getNbOfChanges(file)
+			if (count != 0)	{
+				selectedFiles << file
+				data << [file.getPath().substring(srcDir.getPath().length()), count]
+			}
+		}
+		Object[][] arrayData = data;
+		JTable table = new JTable(arrayData, columnNames);
+		table.getColumnModel().getColumn(0).setPreferredWidth(600);
+		table.getColumnModel().getColumn(1).setPreferredWidth(100);
+
+		table.addMouseListener(new MouseAdapter() {
+					@Override
+					public void mouseClicked(MouseEvent e) {
+						if (SwingUtilities.isLeftMouseButton(e) && e.getClickCount() == 1) {
+							int selectedRowIndex = table.getSelectedRow();
+							int c = externalizer.process(selectedFiles[selectedRowIndex])
+							println ""+c
+							int after = table.getValueAt(table.getSelectedRow(), 1);
+							table.setValueAt(after - c, table.getSelectedRow(), 1);
+							//show your dialog with the selected row's contents
+						}
+					}
+				});
+
+		JScrollPane scrollPane = new JScrollPane(table);
+		table.setFillsViewportHeight(true);
+
+		add(scrollPane)
+
+		JButton cancelButton = new JButton("CANCEL");
+		JButton okButton = new JButton("OK + SAVE");
+		okButton.addActionListener(new ActionListener() {
+			public void actionPerformed(ActionEvent e)
+			{
+				ExternalizeUI.this.doSave();
+				System.exit(0);
+			}
+		});
+		
+		cancelButton.addActionListener(new ActionListener() {
+			public void actionPerformed(ActionEvent e)
+			{
+				println "Changes not saved: "
+				System.exit(0);
+			}
+		});
+		cancelButton.setSize(100, 20);
+		okButton.setSize(100, 20);
+		add(cancelButton)
+		add(okButton)
+
+		println "end of constructor"
+	}
+
+	public void doSave() {
+		if (externalizer != null && externalizer.saveChanges()) {
+			JOptionPane.showMessageDialog(this, "Changes saved");
+		}
+	}
+
+	/**
+	 * Create the GUI and show it.  For thread safety,
+	 * this method should be invoked from the
+	 * event-dispatching thread.
+	 */
+	private static void createAndShowGUI() {
+		//Create and set up the window.
+		JFrame frame = new JFrame("ExternalizeUI");
+		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+
+		//Create and set up the content pane.
+		ExternalizeUI newContentPane = new ExternalizeUI();
+		newContentPane.setOpaque(true); //content panes must be opaque
+
+		//		frame.addWindowListener(new java.awt.event.WindowAdapter() {
+		//			public void windowClosing(WindowEvent winEvt) {
+		//				newContentPane.doSave();
+		//				System.exit(0);
+		//			}
+		//		});
+		frame.setContentPane(newContentPane);
+
+		println "display"
+		//Display the window.
+		frame.pack();
+		frame.setVisible(true);
+	}
+
+
+	public static void main(String[] args) {
+		//Schedule a job for the event-dispatching thread:
+		//creating and showing this application's GUI.
+		javax.swing.SwingUtilities.invokeLater(new Runnable() {
+					public void run() {
+						createAndShowGUI();
+					}
+				});
+	}
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/scripts/i18n/FixExternalizedDuplicatedStrings.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/i18n/FixExternalizedDuplicatedStrings.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/i18n/FixExternalizedDuplicatedStrings.groovy	(revision 258)
@@ -0,0 +1,135 @@
+package org.txm.scripts.i18n
+
+import org.txm.utils.DeleteDir;
+
+/**
+ * Browse messages files and look for duplicated values
+ * @author mdecorde
+ *
+ */
+class FixExternalizedDuplicatedStrings {
+	
+	static main(args) {
+//		File propertyFile = new File("/home/mdecorde/Bureau/Experiences/rcpapplication/messages.properties");
+//		File messageClass = new File("/home/mdecorde/Bureau/Experiences/rcpapplication/Messages.java");
+//		File srcdirectory = new File("/home/mdecorde/Bureau/Experiences/rcpapplication");
+		File propertyFile = new File("/home/mdecorde/workspace37/org.txm.rcp/src/main/java/org/txm/rcpapplication/messages.properties");
+		File messageClass = new File("/home/mdecorde/workspace37/org.txm.rcp/src/main/java/org/txm/rcpapplication/Messages.java");
+		File srcdirectory = new File("/home/mdecorde/workspace37/org.txm.rcp/src/main/java/org/txm/rcpapplication");
+		if (!(propertyFile.exists() && propertyFile.canRead() && propertyFile.canWrite() && propertyFile.isFile())) {
+			println "error file : "+propertyFile
+			return
+		}
+		
+		// build hash of externalised Strings
+		//						  key	  externalized string
+		def entries = new HashMap<String, String>()
+		propertyFile.eachLine("iso-8859-1"){
+			if(it =~ ".+=.+")
+			{
+				int idx = it.indexOf("=")
+				String key = it.substring(0, idx)
+				String value = it.substring(idx+1)
+				entries.put(key, value)
+			}
+			else if(it =~ ".+=\$")
+			{
+				int idx = it.indexOf("=")
+				String key = it.substring(0, idx)
+				String value = ""
+				entries.put(key, value)
+			}
+		}
+		
+		// invert hash
+		def hash = entries
+		def reverse = [:]
+		hash.each{
+			if(reverse[it.value] == null)
+				reverse[it.value] = []
+			reverse[it.value] << it.key
+		};
+		
+		for(def key : reverse.keySet())
+			if(reverse[key].size() > 1)
+				println "doublons of $key: "+reverse[key]
+		
+		// translate dictionnary
+		def dictionnary = [:]
+		for(def value : reverse.keySet())
+		{
+			def keys = reverse[value];
+			def first = keys[0];
+			for(int i = 1 ; i < keys.size() ; i++) // the first key will not be removed
+			{
+				def key = keys.get(i)
+				if(key != first)
+				{
+					dictionnary.put(key , first)
+					println key+ " >> "+first
+				}
+			}
+		}
+		
+		// patch source files : iterates over all java files
+		
+		/*def files = DeleteDir.scanDirectory(srcdirectory, true);
+		for(File f : files)
+		{
+			if(f.getName().endsWith(".java") && f.getName() != "Messages.java")
+			{
+				def lines = f.readLines("UTF-8")
+				f.withWriter("UTF-8"){ writer ->
+					
+					for(String line : lines)
+					{
+						for(String key : dictionnary.keySet())
+						{
+							String old = line;
+							//line = line.replaceAll(, "Messages."+dictionnary[key]);
+							line = (line =~ /Messages\.$key([^0-9]|$)/).replaceAll("Messages."+dictionnary[key]+'$1')
+
+							if(old != line)
+								System.out.println(f.getAbsolutePath()+":"+old+": replaced "+"Messages\\."+key+"[^0-9] Messages."+dictionnary[key]);
+						}
+						writer.writeLine(line);
+					}	
+				}
+			}
+		}
+		
+		// remove key declaration from Messages.java
+		String txt = messageClass.getText("UTF-8")
+		String[] split = txt.split("\n");
+		messageClass.withWriter "UTF-8", { writer -> 
+			for(String line : split)
+			{
+				if(line.contains("public static String "))
+				{
+					for(String key : dictionnary.keySet())
+					{
+						if(line.contains("public static String "+key+";"))
+						{
+							line = line.trim()
+							line = null
+							println "remove key: "+key
+							break;
+						}
+					}
+					if(line != null)
+						writer.writeLine(line);
+				}
+				else
+					writer.writeLine(line);
+			}
+		}*/
+		
+		// rewrite messages.properties
+		def keytoRemove = dictionnary.keySet();
+		propertyFile.withWriter("UTF-8") { writer ->
+			for(String key : entries.keySet().sort())
+				if(!keytoRemove.contains(key))
+					writer.writeLine(key+"="+entries[key])
+		}
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/scripts/i18n/Merge2PropertiesFile.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/i18n/Merge2PropertiesFile.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/i18n/Merge2PropertiesFile.groovy	(revision 258)
@@ -0,0 +1,20 @@
+package org.txm.scripts.i18n
+
+File propFile1 = new File("/home/mdecorde/workspace43/org.eclipse.equinox.p2.ui.nl_fr/org/eclipse/equinox/internal/p2/ui/messages_fr.properties")
+File propFile2 = new File("/home/mdecorde/workspace43/org.txm.rcp.p2.ui/src/org/eclipse/equinox/internal/p2/ui/messages_fr.properties")
+
+Properties props1 = new Properties()
+props1.load(propFile1.newReader("iso-8859-1"))
+Properties props2 = new Properties()
+props2.load(propFile2.newReader("iso-8859-1"))
+
+println "props1.size = "+props1.size()
+println "props2.size = "+props2.size()
+
+for( def key : props1.keySet()) {
+	println "update: "+key
+	props2.put(key, props1.get(key))
+}
+
+println "props2.size AFTER = "+props2.size()
+props2.store(propFile2.newWriter("iso-8859-1"), "$propFile1 + $propFile2")
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/scripts/TTrezToXml.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/TTrezToXml.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/TTrezToXml.groovy	(revision 258)
@@ -0,0 +1,212 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.scripts;
+
+// TODO: Auto-generated Javadoc
+/** The person. @deprecated @author mdecorde tranform Ttrez into a stand-off file */
+class TTrezToXml {
+	String person = ""; // used for respStmt/resp/name(person)
+	
+	/** The software. */
+	String software = ""; // used for respStmt/resp/name(software)
+	
+	/** The cmd line. */
+	String cmdLine = "";// used for respStmt/resp/name(software)/p
+	
+	/** The title. */
+	String title = "";// used for <title>
+	
+	/** The types. */
+	def types;// used for linkGrp type
+	
+	/** The idform. */
+	String idform = "";
+	
+	/** The comments. */
+	String comments = "...";// used for linkGrp type comments
+
+	/** The writer. */
+	Writer writer;
+
+	/**
+	 * Process.
+	 *
+	 * @param TTrez the t trez
+	 * @param xmlform the xmlform
+	 * @param encoding the encoding
+	 */
+	public void process(File TTrez,File xmlform, String encoding )
+	{
+		writer = new FileWriter(xmlform);
+		writeHead();	
+		writeBody(TTrez,encoding)
+		writeTail();
+		writer.close();
+	}
+
+	/**
+	 * Write head.
+	 */
+	private void writeHead() {
+		writer.write("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n");
+		writer.write("<!DOCTYPE TEI SYSTEM \"tei_bfm_v1.dtd\">\n");
+		writer.write("<TEI xmlns:txm=\"http://textometrie.ens-lyon.fr/1.0\">\n");
+		writer.write("<teiHeader xml:lang=\"eng\">\n");
+		writer.write("<fileDesc>\n");
+		writer.write("<titleStmt>\n");
+		for (int i = 0; i < types.size(); i++)
+			writer.write("<title>" + types[i] + "</title>\n");
+		writer.write("<respStmt>\n");
+		writer.write("<resp>produced by</resp>\n");
+		writer.write("<name type=\"person\">" + person + "</name>\n");
+		writer.write("<name type=\"software\">" + software + "</name>\n");
+		writer.write("<p>" + cmdLine + "</p>\n");
+		writer.write("</respStmt>\n");
+		writer.write("</titleStmt>\n");
+		writer.write("<publicationStmt>\n");
+		writer
+				.write("<distributor>BFM project - http://bfm.ens-lsh.fr</distributor>\n");
+		writer.write("<availability>\n");
+		writer.write("<p>(c) 2010 Projet BFM - CNRS/ENS-LSH.\n");
+		writer.write("<hi>Conditions d'utilisation</hi> : \n");
+		writer
+				.write("Sous licence <ref target=\"http://creativecommons.org/licenses/by-sa/2.0/fr/\">Creative Commons</ref>.\n");
+		writer.write("</p>\n");
+		writer.write("</availability>\n");
+		writer.write("</publicationStmt>\n");
+		writer.write("<sourceDesc>\n");
+		writer
+				.write("<p>born digital : TXM project - http://textometrie.org</p>\n");
+		writer.write("</sourceDesc>\n");
+		writer.write("</fileDesc>\n");
+		writer.write("</teiHeader>\n");
+		writer.write("<text xml:lang=\"fr\" type=\"standoff\">\n");
+		writer.write("<body>\n");
+		writer.write("<div>\n");
+	}
+
+	/**
+	 * Write body.
+	 *
+	 * @param TTrez the t trez
+	 * @param encoding the encoding
+	 * @return the java.lang. object
+	 */
+	private writeBody(File TTrez, String encoding)
+	{
+		
+		String targets= "w_"+idform+"_";
+		
+		def content = TTrez.getText(encoding) 
+		def separator= "\t"
+		
+		for(int i=0 ; i< types.size() ; i++)
+		{
+			int id=1;
+			writer.write("<linkGrp type=\""+types[i]+"\">\n");
+			content.splitEachLine(separator) {fields ->
+				if(! ((String)fields[0]).substring( 0,1).matches("<"))
+				{
+					writer.write("<link targets=\"#"+targets+id+" #"+ fields[i+1]+"\"/>\n");
+					id++;
+				}
+			}
+			writer.write("</linkGrp>\n");
+		}
+	}
+
+	/**
+	 * Write tail.
+	 */
+	private void writeTail() {
+
+		writer.write("</div>\n");
+		writer.write(" </body>\n");
+		writer.write("</text>\n");
+		writer.write("</TEI>\n");
+	}
+
+	/**
+	 * Sets the annotation types.
+	 *
+	 * @param types the types
+	 * @param idform the idform
+	 */
+	public void setAnnotationTypes(def types, String idform) {
+		this.types = types;
+		this.idform = idform;
+	}
+
+	/**
+	 * Sets the resp.
+	 *
+	 * @param person the person
+	 * @param software the software
+	 * @param cmdLine the cmd line
+	 */
+	public void setResp(String person, String software, String cmdLine) {
+		this.person = person;
+		this.software = software;
+		this.cmdLine = cmdLine;
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args)
+	{
+		String rootDir = "~/xml/rgaqcj/";
+		new File(rootDir+"/pos/").mkdir();
+		
+		
+		def ttfiles = ["roland-tt.txt","artu-tt.txt","qjm-tt.txt","commyn1-tt.txt","jehpar-tt.txt"];
+		def posfiles = ["roland-pos.xml","artu-pos.xml","qjm-pos.xml","commyn1-pos.xml","jehpar-pos.xml"];
+		
+		String encoding ="ISO-8859-1";
+		String person ="Serge Heiden"; 
+		String software = "tree-tagger cmd line with options ..."; 
+		String cmdLine = "tree-tagger -token ...";
+		String title ="POS annotation";
+		def types = ["POS","lemma"];
+		String idform ="fro";
+		
+		for(int i=0; i < ttfiles.size();i++)
+		{
+			File ttfile = new File(rootDir+"/tt/",ttfiles[i]);
+			File posfile = new File(rootDir+"/pos/",posfiles[i]);
+			println("Process file : "+ttfile+" to : "+posfile );
+			
+			def transfo = new TTrezToXml();
+			transfo.setAnnotationTypes( types, idform);
+			transfo.setResp( person, software, cmdLine);
+			transfo.process( ttfile, posfile, encoding );
+		}	
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/scripts/Grep.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/Grep.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/Grep.groovy	(revision 258)
@@ -0,0 +1,86 @@
+package org.txm.scripts
+// Copyright © - ENS de Lyon - http://textometrie.ens-lyon.fr
+//
+// This file is part of the TXM platform.
+//
+// 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 3 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/>.
+//
+// $LastChangedDate: 2012-02-01 17:58:45 +0100 (mer., 01 févr. 2012) $
+// $LastChangedRevision: 2122 $
+// $LastChangedBy: mdecorde $
+//
+
+// PARAMETERS //
+outfile = new File("/home/mdecorde/xml/test/grep")
+dir = new File("/home/mdecorde/xml/test/")			// **change this parameter**
+ext = "\\.xml"                                      // **change this parameter**
+find = /(<...+)/           							// **change this parameter**
+replaceWith = 'gp1=$1'             				// **change this parameter**
+
+// MAIN //
+
+grep(dir, outfile, ext, find, replaceWith) // process a directory
+//grep(dir, outfile, null, find, replaceWith) // process a directory with no constraint on files
+//grep(dir, outfile, ext, find, null) // directory + don't replace
+
+//grep(infile, outfile, find, replaceWith) // process a file
+//grep(dir, outfile, find, null) // file + don't replace
+
+// PUBLIC METHODS //
+
+// to process a directory
+def grep(File dir, File outfile, def ext, def regex, def replace) {
+	if (dir.isDirectory()) {
+		outfile.createNewFile()
+		if (ext == null) ext = /.+/
+		outfile.write('')                            // create empty file
+		outfile.withWriter { writer ->
+			dir.eachFileMatch(~/.*$ext/){ file ->    // for each file matching extension
+				_grep(file, writer, regex, replace)
+			}
+		}
+		return true;
+	} else {
+		println "$outfile is not a directory"
+		return false;
+	}
+}
+
+// to process a file with outfile
+def grep(File file, File outfile, def regex, def replace) {
+	if (file.isDirectory()) return false;
+	outfile.withWriter { writer ->
+		_grep(file, writer, regex, replace)
+	}
+	return true;
+}
+
+// PRIVATE METHODS //
+
+// to process a file with writer
+private def _grep(def file, def writer, def regex, def replace) {
+	file.eachLine { line ->
+		_testLine(line, writer, regex, replace)
+	}
+}
+
+private def _testLine(String line, def writer, def regex, def replace) {
+	if (replace == null) {
+		if (line.matches(find))
+			writer.println line
+	} else {
+		if (line.matches(find))
+			writer.println line.replaceAll(regex, replace)
+	}	
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/scripts/JoinCaesura.java
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/JoinCaesura.java	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/JoinCaesura.java	(revision 258)
@@ -0,0 +1,226 @@
+package org.txm.scripts;
+
+import java.io.File;
+import java.util.ArrayList;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.txm.utils.xml.DomUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * Process tokenized text to find caesura and merge words
+ */
+class JoinCaesura{
+	String caesuraTag = "lb|br"; // caesura
+	String caesuraString = "-|$";
+	String wordTag = "w";
+	String intraWordTag = "hi";
+	String extraWordTag = "p|s";
+
+	public boolean process(Element root)
+	{
+		// find caesuraTags
+		ArrayList<Element> currentNodes = new ArrayList<Element>();
+		currentNodes.add(root);
+		Element currentNode;
+		while(currentNodes.size() > 0)
+		{
+			System.out.println(currentNodes);
+			currentNode = currentNodes.remove(0);
+			NodeList children = currentNode.getChildNodes();
+
+			if(currentNode.getNodeName().matches(caesuraTag))
+			{
+				processCaesuraTag(currentNode);
+			}
+
+			//System.out.println("children: "+children.getLength());
+			int c = 0;
+			for(int i = 0 ; i < children.getLength() ; i++)
+			{
+				if(children.item(i).getNodeType() == Node.ELEMENT_NODE)
+				{
+					Element child = (Element)children.item(i);
+					//System.out.println("child: "+child.getNodeName());
+					if(!child.getNodeName().matches(wordTag)) // don't look in the words
+					{
+						currentNodes.add(c++, child);
+					}
+				}
+			}
+
+		}
+		return true;
+	}
+
+	protected Node getPreviousWord(Element node)
+	{
+		int count = 0;
+		Node previous = node.getPreviousSibling();
+		while(previous != null)
+		{
+			
+			if(previous.getNodeType() == Node.ELEMENT_NODE && previous.getNodeName().matches(wordTag))
+			{
+				//System.out.print("W:"+previous);
+				return previous;
+			}
+			else if(previous.getNodeType() == Node.ELEMENT_NODE && previous.getNodeName().matches(intraWordTag))
+			{
+				//System.out.print("P:"+previous);
+				if(isLastChildrenWord(previous))
+				{
+					//System.out.println("P: "+previous+" has a word");
+					return previous;
+				}
+				else
+				{
+					//System.out.println("P: "+previous+" has no word");
+				}
+			}
+			else if(previous.getNodeType() == Node.ELEMENT_NODE && previous.getNodeName().matches(extraWordTag))
+			{
+				return null;
+			}
+			previous = previous.getPreviousSibling();
+			if(count++ >= 10)
+				return null;
+		}
+		return null;
+	}
+
+	protected boolean isLastChildrenWord(Node node)
+	{
+		//System.out.println("test "+node);
+		NodeList children = node.getChildNodes();
+		for(int i = children.getLength() -1 ; i >= 0 ; i--) // begin by the last child
+		{
+			Node child = children.item(i);
+			//System.out.println(" child "+child);
+			if(child.getNodeType() == Node.ELEMENT_NODE && child.getNodeName().matches(wordTag))
+				return true; // return the parent node
+			else if(child.getNodeType() == Node.ELEMENT_NODE && child.getNodeName().matches(intraWordTag))
+				return isLastChildrenWord(child);
+		}
+		return false;
+	}
+	
+	protected boolean isFirstChildrenWord(Node node)
+	{
+		NodeList children = node.getChildNodes();
+		for(int i = 0 ; i < children.getLength() ; i++) // begin by the last child
+		{
+			Node child = children.item(i);
+			if(child.getNodeType() == Node.ELEMENT_NODE && child.getNodeName().matches(wordTag))
+				return true; // return the parent node
+			else if(child.getNodeType() == Node.ELEMENT_NODE && child.getNodeName().matches(intraWordTag))
+				return isLastChildrenWord(child);
+		}
+		return false;
+	}
+	
+	protected Node getNextWord(Element node)
+	{
+		int count = 0;
+		Node next = node.getNextSibling();
+		while(next != null)
+		{
+			if(next.getNodeType() == Node.ELEMENT_NODE && next.getNodeName().matches(wordTag))
+				return next;
+			else if(next.getNodeType() == Node.ELEMENT_NODE)
+			{
+				//System.out.print("P:"+previous);
+				if(isFirstChildrenWord(next))
+				{
+					System.out.println("N: "+next+" has a word");
+					return next;
+				}
+				else
+				{
+					System.out.println("N: "+next+" has no word");
+				}
+			}
+			else if(next.getNodeType() == Node.ELEMENT_NODE && next.getNodeName().matches(extraWordTag))
+			{
+				return null;
+			}
+			next = next.getNextSibling();
+			if(count++ >= 10)
+				return null;
+		}
+		return null;
+	}
+
+	protected boolean processCaesuraTag(Element caesura)
+	{
+		Node previous = getPreviousWord(caesura);
+		
+		if(previous != null)
+		{
+			Node next = getNextWord(caesura);
+			print(previous);
+			print(caesura);
+			print(next);
+			if(next != null)
+			{
+				// process !!
+			}
+		}
+
+		System.out.println("\n");
+		return true;
+	}
+
+	protected void print(Node n)
+	{
+		if(n != null)
+			switch(n.getNodeType())
+			{
+			case Node.ELEMENT_NODE:
+				if(n.getNodeName().matches(wordTag))
+					System.out.print("<"+n.getNodeName()+">"+n.getTextContent()+"</"+n.getNodeName()+">");
+				else
+					System.out.print("<"+n.getNodeName()+">");//+n.getTextContent()+"</"+n.getNodeName()+">");
+				break;
+			case Node.TEXT_NODE:
+				n.getNodeValue();
+				break;
+			default:
+			}
+	}
+
+	public static void main(String[] args)
+	{
+		File infile = new File(System.getProperty("user.home"), "xml/caesura/test.xml");
+		File outfile = new File(System.getProperty("user.home"), "xml/caesura/test-c.xml");
+		try {
+			DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+			DocumentBuilder constructeur;
+
+			constructeur = factory.newDocumentBuilder();
+
+			Document document = constructeur.parse(infile);
+			Element root = document.getDocumentElement();
+			//process the text
+			JoinCaesura builder = new JoinCaesura();
+			if(builder.process(root))
+			{
+				System.out.println("done");
+			}
+			else
+			{
+				System.out.println("error");
+			}
+
+			DomUtils.save(document, outfile);
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+	}
+}

Property changes on: tmp/org.txm.core/src/groovy/org/txm/scripts/JoinCaesura.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/scripts/FixEditionPageIds.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/FixEditionPageIds.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/FixEditionPageIds.groovy	(revision 258)
@@ -0,0 +1,63 @@
+package org.txm.scripts
+
+
+String corpus = "qgraal"
+File PARAMS = new File("/home/mdecorde/TXM/corpora/$corpus/import.xml")
+File PARAMS2 = new File("/home/mdecorde/TXM/corpora/$corpus/params2.xml")
+File HTMLs = new File("/home/mdecorde/TXM/corpora/$corpus/HTML/QGRAALFRO")
+
+def doc = DomUtils.load(PARAMS)
+def root = doc.getDocumentElement();
+
+def corporaList = root.getElementsByTagName("corpora");
+def corporaElem = corporaList.item(0)
+
+def corpusList = corporaElem.getElementsByTagName("corpus");
+def corpusElem = corpusList.item(0)
+
+def textsList = corpusElem.getElementsByTagName("texts")
+def textsElem = textsList.item(0);
+
+def textList = textsElem.getElementsByTagName("text")
+for(int i = 0 ; i < textList.getLength() ; i++)
+{
+	def textElem = textList.item(i)
+	String textname = textElem.getAttribute("name");
+	println "process text: "+textname
+	def editionsList = textElem.getElementsByTagName("editions")
+	def editionsElem = editionsList.item(0)
+
+	def editionList = editionsElem.getElementsByTagName("edition")
+
+	for(int j = 0 ; j < editionList.getLength() ; j++)
+	{
+		def editionElem = editionList.item(j)
+		String editionName = editionElem.getAttribute("name");
+
+		def pages = new File(HTMLs, editionName).listFiles();
+		pages.sort();
+
+		def pageList = editionElem.getElementsByTagName("page")
+		println pageList.getLength()
+		println pages.size()
+		for(int k = 0 ; k < pageList.getLength() ; k++)
+		{
+			def pageElem = pageList.item(k);
+			String id = pages[k].getName();
+			int idx1 = id.lastIndexOf("_");
+			int idx2 = id.lastIndexOf(".html");
+			id = id.substring(idx1 + 1, idx2)
+			pageElem.setAttribute("id", id);
+		}
+
+		if(pageList.getLength() != pages.size())
+		{
+			println "Error size pageList.getLength() != pages.size()"+pageList.getLength()+", "+pages.size()
+		}
+	}
+}
+
+DomUtils.save(doc, PARAMS2);
+
+if (!(PARAMS.delete() && PARAMS2.renameTo(PARAMS))) println "Warning can't rename file "+PARAMS2+" to "+PARAMS
+
Index: tmp/org.txm.core/src/groovy/org/txm/scripts/HSQLFunctions.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/HSQLFunctions.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/HSQLFunctions.groovy	(revision 258)
@@ -0,0 +1,740 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2016-07-04 16:11:30 +0200 (Mon, 04 Jul 2016) $
+// $LastChangedRevision: 3257 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.scripts;
+
+import java.util.LinkedList;
+
+import groovy.sql.Sql;
+
+import java.sql.*;
+import java.util.HashMap;
+import java.util.LinkedHashSet;
+import java.util.logging.Level;
+
+import org.txm.utils.logger.Log;
+
+// TODO: Auto-generated Javadoc
+/**
+ * set of Sql function for HSQL.
+ *
+ * @return the connection
+ * @author mdecorde
+ */
+class HSQLFunctions {
+	
+	Connection c
+	String path;
+	
+	public HSQLFunctions(String path) {
+		this.path = path;
+		
+		String urlProperty = "jdbc:hsqldb:file:"+path+"/db;shutdown=true;hsqldb.write_delay=false;"
+		if (Log.getLevel().intValue() < Level.WARNING.intValue()) {
+			urlProperty += "";
+		} else {
+			urlProperty += "hsqldb.applog=0;hsqldb.sqllog=0";
+		}
+		
+		this.c = DriverManager.getConnection(urlProperty, "SA", "")
+	}
+
+	public Connection getConnection() {
+		return c;
+	}
+	
+	/**
+	 * Creates the table.
+	 *
+	 * @param name the name
+	 * @param argsname the argsname
+	 * @param types the types
+	 */
+	public void CreateTable(String name)
+	{
+		Statement statement = c.createStatement();
+		String query ="CREATE TABLE "+name+";";
+		
+		println("query : "+query);
+		statement.executeUpdate(query);
+		
+		statement.close();
+		c.commit();
+	}
+	
+	/**
+	 * Creates the table.
+	 *
+	 * @param name the name
+	 * @param argsname the argsname
+	 * @param types the types
+	 */
+	public void CreateTable(String name, String idColumn)
+	{
+		Statement statement = c.createStatement();
+		String query = "CREATE TABLE \""+name+"\" (\""+idColumn+"\" INTEGER IDENTITY PRIMARY KEY);";
+	
+		println("query : "+query);
+		statement.executeUpdate(query);
+		
+		statement.close();
+		c.commit();
+	}
+	
+	public boolean IsTableExisting(String name) {
+		boolean e = false;
+		
+		DatabaseMetaData dbm = c.getMetaData();
+		ResultSet tables = dbm.getTables(null, null, name, null);
+		e = tables.next();
+		tables.close()
+		
+		return e;		
+	}
+	
+	
+	/**
+	 * Creates the table.
+	 *
+	 * @param name the name
+	 * @param argsname the argsname
+	 * @param types the types
+	 */
+	public void CreateTable(String name, def argsname, def types)
+	{
+		assert(argsname.size() == types.size());
+		
+		Statement statement = c.createStatement();
+		String query ="CREATE TABLE "+name+" ( ";
+		for (int i=0; i < types.size() ; i++) {
+			query += argsname[i]+" "+types[i]
+			if (i < types.size()-1)	{query += ",";}
+		}
+		query +=")";
+		
+		println("query : "+query);
+		statement.executeUpdate(query);
+		
+		statement.close();
+		c.commit();
+	}
+	
+	
+	public void DeleteTable(String name) {
+		Statement statement = c.createStatement();
+		statement.executeUpdate("DROP TABLE entries;");
+		statement.close();
+		c.commit();
+	}
+
+	/**
+	 * Insert csv col.
+	 *
+	 * @param TableName the table name
+	 * @param argsnames the argsnames
+	 * @param types the types
+	 * @param csvFile the csv file
+	 * @param separator the separator
+	 * @param encoding the encoding
+	 */
+	public void InsertCsvCol(String TableName, def argsnames, def types, File csvFile, String separator, String encoding)
+	{
+		Statement statement = c.createStatement();
+		statement.setEscapeProcessing(true);
+		Reader reader = new InputStreamReader(new FileInputStream(csvFile),encoding);
+		reader.splitEachLine(separator) {fields ->
+			//println("fields size "+fields.size())
+			String query ="INSERT INTO "+TableName+" (";
+			for(int i=0;i< argsname.size; i++)
+			{
+				query+= argsname[i];
+				if(i < argsnames.size-1)	{query += ",";}
+			}
+			query +=") VALUES (";
+			for(int i=0;i< fields.size(); i++)
+			{
+				if(fields[i].contains("'"))
+					query+= "'"+fields[i].replace("'","''")+"'";
+				else
+					query+= "'"+fields[i]+"'";
+				
+				if(i < argsnames.size-1)	{query += ",";}
+			}
+			query +=")";
+			
+			//println("query : "+query);
+			statement.executeUpdate(query);
+		}
+		statement.close();
+		c.commit();
+	}
+
+	/**
+	 * Import ordered csv table.
+	 *
+	 * @param TableName the table name
+	 * @param argsname the argsname
+	 * @param types the types
+	 * @param csvFile the csv file
+	 * @param separator the separator
+	 * @param encoding the encoding
+	 * @return the int
+	 */
+	public int ImportOrderedCSVTable(String TableName, List<String> argsname, List<String> types, File csvFile, String separator, String encoding)
+	{
+		argsname.add("n");
+		types.add("INT");
+		HSQLFunctions.CreateTable( TableName, argsname, types);
+		argsname.remove("n");
+		types.remove("INT");
+		Statement statement = c.createStatement();
+		statement.setEscapeProcessing(true);
+		Reader reader = new InputStreamReader(new FileInputStream(csvFile),encoding);
+		int n=0;
+		reader.splitEachLine(separator) {fields ->
+			n++;
+			//println("fields size "+fields.size())
+			String query ="INSERT INTO "+TableName+" (n,";
+			for(int i=0;i< argsname.size(); i++)
+			{
+				query+= argsname[i];
+				if(i < argsname.size()-1)	{query += ",";}
+			}
+			query +=") VALUES ('"+n+"',";
+			for(int i=0;i< argsname.size(); i++)
+			{
+				if( i >= fields.size())
+				{
+					query+= "''";
+				}
+				else
+				{
+					if(fields[i].contains("'"))
+						query+= "'"+fields[i].replace("'","''")+"'";
+					else
+						query+= "'"+fields[i]+"'";
+				}
+				if(i < argsname.size()-1)	{query += ",";}
+			}
+			query +=")";
+			
+			//println("query : "+query);
+			statement.executeUpdate(query);
+		}
+		statement.close();
+		c.commit();
+		return n;
+	}
+
+	/**
+	 * Import csv table.
+	 *
+	 * @param TableName the table name
+	 * @param argsname the argsname
+	 * @param types the types
+	 * @param csvFile the csv file
+	 * @param separator the separator
+	 * @param encoding the encoding
+	 */
+	public void ImportCSVTable(String TableName, def argsname, def types, File csvFile, String separator, String encoding)
+	{
+		HSQLFunctions.CreateTable( TableName, argsname, types);
+		
+		Statement statement = c.createStatement();
+		statement.setEscapeProcessing(true);
+		Reader reader = new InputStreamReader(new FileInputStream(csvFile),encoding);
+		reader.splitEachLine(separator) {fields ->
+			//println("fields size "+fields.size())
+			String query ="INSERT INTO "+TableName+" (";
+			for(int i=0;i< argsname.size; i++)
+			{
+				query+= argsname[i];
+				if(i < argsname.size-1)	{query += ",";}
+			}
+			query +=") VALUES (";
+			for(int i=0;i< argsname.size; i++)
+			{
+				if( i >= fields.size())
+				{
+					query+= "''";
+				}
+				else
+				{
+					if(fields[i].contains("'"))
+						query+= "'"+fields[i].replace("'","''")+"'";
+					else
+						query+= "'"+fields[i]+"'";
+				}
+				if(i < argsname.size-1)	{query += ",";}
+			}
+			query +=")";
+			
+			//println("query : "+query);
+			statement.executeUpdate(query);
+		}
+		statement.close();
+		c.commit();
+	}
+
+	// word column val column val2 column val3
+	
+	/**
+	 * Import ref table.
+	 *
+	 * @param TableName the table name
+	 * @param argsname the argsname
+	 * @param types the types
+	 * @param csvFile the csv file
+	 * @param separator the separator
+	 * @param encoding the encoding
+	 */
+	public void ImportRefTable(String TableName, def argsname, def types, File csvFile, String separator, String encoding)
+	{
+		HSQLFunctions.CreateTable( TableName, argsname, types);
+		
+		Statement statement = c.createStatement();
+		statement.setEscapeProcessing(true);
+		Reader reader = new InputStreamReader(new FileInputStream(csvFile),encoding);
+		reader.splitEachLine(separator) 
+				{fields ->
+					String ref;
+					if(fields[0].contains("'"))
+						ref= "'"+fields[0].replace("'","''")+"'";
+					else
+						ref= "'"+fields[0]+"'";
+					
+					for(int j=1 ; j < fields.size() ; j +=argsname.size -1)
+					{
+						String query ="INSERT INTO "+TableName+" (";
+						for(int i=0;i< argsname.size; i++)
+						{
+							query+= argsname[i];
+							if(i < types.size-1)	{query += ",";}
+						}
+						query +=") VALUES (";
+						query+= ref+",";
+						for(int i=j;i < j+argsname.size -1; i++)
+						{
+							if(fields[i].contains("'"))
+								query+= "'"+fields[i].replace("'","''")+"'";
+							else
+								query+= "'"+fields[i]+"'";
+							
+							if(i < j+argsname.size -2)	{query += ",";}
+						}
+						query +=")";
+						
+						//println("query : "+query);
+						statement.executeUpdate(query);
+					}
+				}
+		statement.close();
+		c.commit();
+	}
+
+	/**
+	 * Creates the simple table.
+	 *
+	 * @param TableName the table name
+	 * @param argsname the argsname
+	 * @param type the type
+	 * @param values the values
+	 */
+	public void CreateSimpleTable(String TableName, String argsname , String type, def values)
+	{
+		def argsnames = [argsname];
+		def types = [type]
+		HSQLFunctions.CreateTable( TableName, argsnames, types);
+		
+		Statement statement = c.createStatement();
+		for(int i=0; i < values.size; i++)
+		{
+			String query ="INSERT INTO "+TableName+" (";
+			query+= argsname;
+			query +=") VALUES ('";
+			query+= values[i];
+			query +="')";
+			
+			println("query : "+query);
+			statement.executeUpdate(query);
+		}
+		statement.close();
+		c.commit();
+	}
+
+	/**
+	 * Test.
+	 *
+	 * @param table the table
+	 * @param file the file
+	 * @return the java.lang. object
+	 */
+	public test(String table, String file) {
+		Statement statement = c.createStatement();
+
+		statement.execute("SET TABLE " + table + " SOURCE \"" + file
+				+ ";ignore_first=false;all_quoted=false\"");
+		statement.close();
+		c.commit();
+	}
+
+	// fonction temporaire, j'ai rien trouvé de mieux -_-
+	
+	/**
+	 * Gets the column number.
+	 *
+	 * @param TableName the table name
+	 * @return the column number
+	 */
+	public int getColumnNumber(String TableName)
+	{
+		Sql sql = Sql.newInstance(c)
+		int i =0;
+		try {
+			sql.eachRow("select * from "+TableName) {
+				for(i=0;;i++)
+					it.getAt(i);
+			}
+		}
+		catch(Exception e)
+		{
+			return i;
+		}
+		
+		c.close();
+		return 0;
+	}
+
+	/**
+	 * Prints the table.
+	 *
+	 * @param TableName the table name
+	 */
+	public void printTable(String TableName)
+	{
+		Sql sql = Sql.newInstance(c)
+		int colnum = getColumnNumber(TableName);
+		sql.eachRow("select * from "+TableName) {
+			for(int i=0;i< colnum; i++)
+			{
+				print(it.getAt(i));
+				if(i < colnum -1)print("\t");
+			}
+			println();
+		}
+		
+		c.commit();
+	}
+
+	/**
+	 * Execute query.
+	 *
+	 * @param query the query
+	 */
+	public void executeQuery(String query) {
+		Statement statement = c.createStatement();
+		statement.setEscapeProcessing(true);
+		println("query : " + query);
+		statement.execute(query);
+		statement.close();
+		c.commit();
+	}
+
+	/**
+	 * Gets the groovy sql.
+	 *
+	 * @return the groovy sql
+	 */
+	public Sql getGroovySql() {
+		return Sql.newInstance(c)
+	}
+
+	/**
+	 * To cvs file.
+	 *
+	 * @param TableName the table name
+	 * @param outfile the outfile
+	 */
+	public void toCVSFile(String TableName, String outfile) {
+		def sql = Sql.newInstance(c)
+		
+		Writer writer = new FileWriter(outfile);
+		
+		int colnum = getColumnNumber(TableName);
+		sql.eachRow("select * from "+TableName) {
+			for(int i=0;i< colnum; i++)
+			{
+				//println('get at '+i)
+				writer.write(it.getAt(i));
+				if(i < colnum -1)writer.write("\t");
+			}
+			writer.write("\n");
+		}
+		
+		writer.close();
+		c.commit();
+	}
+
+	// only for sql result with 3 columns
+	
+	/**
+	 * To ref file.
+	 *
+	 * @param TableName the table name
+	 * @param outfile the outfile
+	 * @param groupcolumn the groupcolumn
+	 * @param argname the argname
+	 * @param encoding the encoding
+	 * @return the int
+	 */
+	public int toRefFile(String TableName, String outfile, String groupcolumn,def argname, String encoding)
+	{
+		assert(argname.size() == 2);
+		def sql = Sql.newInstance(c)
+		LinkedList<String> linkset;
+		File f = new File(outfile);
+		Writer writer = new BufferedWriter(new OutputStreamWriter(new PrintStream(new FileOutputStream(f),true,encoding)));
+		def content = new File(outfile).getText(encoding) 
+		int colnum = getColumnNumber(TableName);
+		String ref = "";
+		String line ="";
+		boolean firstline = true;
+		HashMap<String,LinkedList<String>> reftable = new HashMap<String,LinkedList<String>>();
+		HashMap<String,LinkedList<String>> lemmetable = new HashMap<String,LinkedList<String>>();
+		
+		String query = "SELECT "+groupcolumn;
+		for (String s : argname)
+			query +=","+s
+		//System.out.println(query+" FROM "+TableName)
+		sql.eachRow(query+" FROM "+TableName){
+			String currentref = it.getAt(0);
+			if (!reftable.containsKey(currentref)) {
+				linkset = new LinkedHashSet<String>();
+				reftable.put(currentref,linkset)
+				linkset = new LinkedHashSet<String>();
+				lemmetable.put(currentref,linkset)
+			}
+			
+			linkset = reftable.get(currentref)
+			if (!linkset.contains(it.getAt(1))) {
+				linkset.add(""+it.getAt(1))
+				linkset = lemmetable.get(currentref)
+				linkset.add(""+it.getAt(2))
+			}
+		}
+		//println("ref : "+reftable)
+		for (String key : reftable.keySet()) {
+			writer.write (key)
+			for (int i = 0 ; i < reftable.get(key).size(); i++) {
+				String s = (reftable.get(key)).get(i);
+				String l = (lemmetable.get(key)).get(i);
+				writer.write ("\t"+s+"\t"+l);
+			}
+			writer.write ("\n")
+		}
+		
+		writer.close();
+		c.commit();
+		return reftable.size();
+	}
+
+	/**
+	 * To ref hierarchical file.
+	 *
+	 * @param TableName the table name
+	 * @param outfile the outfile
+	 * @param groupcolumn the groupcolumn
+	 * @param argname the argname
+	 * @param encoding the encoding
+	 * @return the int
+	 */
+	public int toRefHierarchicalFile(String TableName, String outfile, String groupcolumn,def argname, String encoding)
+	{
+		assert(argname.size() == 2);
+		def sql = Sql.newInstance(c);
+		LinkedList<String> linkset;
+		File f = new File(outfile);
+		Writer writer = new BufferedWriter(new OutputStreamWriter(new PrintStream(new FileOutputStream(f),true,encoding)));
+		def content = new File(outfile).getText(encoding);
+		int colnum = getColumnNumber(TableName);
+		String ref = "";
+		String line ="";
+		boolean firstline = true;
+		HashMap<String,LinkedList<String>> reftable = new HashMap<String,LinkedList<String>>();
+		//HashMap<String,HashMap<String,Integer>> counttable = new HashMap<String,HashMap<String,Integer>>();
+		HashMap<String,LinkedList<Integer>> counttable = new HashMap<String,LinkedList<Integer>>();
+		HashMap<String,LinkedList<String>> lemmetable = new HashMap<String,LinkedList<String>>();
+		
+		String query = "SELECT "+groupcolumn;
+		for(String s : argname)
+			query +=","+s;
+		//System.out.println(query+" FROM "+TableName)
+		sql.eachRow(query+" FROM "+TableName){
+			String currentref = it.getAt(0);
+			if (!reftable.containsKey(currentref)) {
+				linkset = new LinkedHashSet<String>();
+				reftable.put(currentref,linkset);
+				linkset = new LinkedHashSet<String>();
+				lemmetable.put(currentref,linkset);
+			}
+			
+			linkset = reftable.get(currentref);
+			if (!linkset.contains(it.getAt(1))) {
+				linkset.add(""+it.getAt(1));
+				linkset = lemmetable.get(currentref);
+				linkset.add(""+it.getAt(2));
+			}
+			
+			
+			//if(it.getAt(2) != "-")
+			//{
+			if(!counttable.containsKey(currentref))
+				counttable.put(currentref, new HashMap<String,Integer>());
+			
+			HashMap<String,Integer> ht = counttable.get(currentref);
+			if(!ht.containsKey(it.getAt(1)))
+				ht.put(it.getAt(1),0);
+			
+			ht.put(it.getAt(1),ht.get(it.getAt(1)) +1)	
+			
+			//}
+		}
+		//println("countable : "+counttable)
+		for (String key : counttable.keySet()) {
+			HashMap<String,Integer> ht = counttable.get(key);
+			LinkedList<String> indexorder = new LinkedList<Integer>();
+			
+			for(String cat : counttable.get(key).keySet())
+			{
+				if(indexorder.size() == 0)
+				{
+					indexorder.add(cat)
+				}
+				else
+				{
+					boolean inserted= false;
+					for(int j = 0 ; j < indexorder.size();j++)
+					{
+						String comp = indexorder.get(j);
+						if(ht.get(cat) > ht.get(comp))
+						{
+							indexorder.add(j, cat);
+							inserted=true;
+							break;
+						}
+					}
+					if(!inserted)
+						indexorder.addLast(cat);
+				}
+			}
+			writer.write(key);
+			for (String cat : indexorder) {
+				
+				int i=0;
+				for(int r=0; r < reftable.get(key).size();r++)
+					if((reftable.get(key)).get(r) == cat)
+					{
+						i=r;
+						break;
+					}
+				String s = (reftable.get(key)).get(i);
+				String l = (lemmetable.get(key)).get(i);
+				writer.write ("\t"+s+"\t"+l);
+			}
+			writer.write ("\n")
+		}
+		
+		writer.close();
+		c.commit();
+		return reftable.size();
+	}
+
+	/**
+	 * Clear all.
+	 */
+	public void clearAll() {
+		new File(path, "db.script").delete();
+		new File(path, "db.properties").delete();
+		new File(path, "db.log").delete();
+		new File(path, "db.tmp").deleteDir();
+	}
+	
+	/**
+	 * Clear all.
+	 */
+	public void close() {
+		c.close();
+	}
+
+	/**
+	 * Main.
+	 *
+	 * @param args the args
+	 */
+	public static void main(String[] args)
+	{
+		HSQLFunctions hsql = new HSQLFunctions("/home/mdecorde/TEMP")
+		//hsql.clearAll();
+		
+	//	hsql.executeQuery("SELECT col1 from test where col1 LIKE '@'' ESCAPE '@' ")
+		
+		def argsname = ["n","col1","col2"];
+		def types = ["INT","VARCHAR(30)","VARCHAR(30)"];
+		
+		hsql.CreateTable( "test", argsname, types);
+		hsql.CreateTable( "test2", argsname, types);
+		hsql.executeQuery("INSERT INTO test VALUES (1,'poeut',1)");
+		hsql.executeQuery("INSERT INTO test VALUES (2,'poeut',2)");
+		hsql.executeQuery("INSERT INTO test VALUES (3,'poeut',3)");
+		hsql.executeQuery("INSERT INTO test VALUES (4,'poeut',4)");
+		hsql.executeQuery("INSERT INTO test VALUES (5,'poeut',5)");
+		hsql.executeQuery("INSERT INTO test VALUES (5,'poeut',1)");
+		
+		hsql.executeQuery("INSERT INTO test2 VALUES (11,'poeut',52)");
+		hsql.executeQuery("INSERT INTO test2 VALUES (22,'poeut',42)");
+		hsql.executeQuery("INSERT INTO test2 VALUES (33,'poeut',32)");
+		hsql.executeQuery("INSERT INTO test2 VALUES (44,'poeut',22)");
+		hsql.executeQuery("INSERT INTO test2 VALUES (45,'poeut',22)");
+		hsql.executeQuery("INSERT INTO test2 VALUES (55,'poeut',12)");
+		
+		hsql.printTable("test")
+		hsql.printTable("test2")
+
+		hsql.close();
+		
+		//
+		//hsql.CreateTable( "test", argsname, types);
+		//	hsql.ImportOrderedCSVTable( "test", argsname, types, new File("~/xml/rgaqcj/lexicon/lex_R"),"\t","UTF-8");
+		//hsql.test("test","test.csv");
+		//def forms=["hello","pouet","truc"]
+		//hsql.CreateSimpleTable("test","form","VARCHAR(20)",forms)
+		//hsql.printTable("test");
+		//hsql.executeQuery("SELECT col1 from test where col1 LIKE '@'' ESCAPE '@' ");
+		
+
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/scripts/PatchAfrlex.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/PatchAfrlex.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/PatchAfrlex.groovy	(revision 258)
@@ -0,0 +1,85 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.scripts;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Patch.
+ *
+ * @param correspondanceFile the correspondance file
+ * @param afrlex the afrlex
+ * @param afrlexfixed the afrlexfixed
+ * @param encoding the encoding
+ * @deprecated
+ * @author mdecorde patch a cvs file replace POS name with the
+ * correspondanceFile
+ */
+class PatchAfrlex {
+	public static void patch(File correspondanceFile,File afrlex,File afrlexfixed, String encoding )
+	{
+		HashMap<String,String> correspondances = new HashMap<String,String>();
+		
+		def content = correspondanceFile.getText(encoding) 
+		
+		String separator= "\t"
+		content.splitEachLine(separator) {fields ->
+			correspondances.put( fields[0], fields[1]);
+		}
+		println(correspondances);
+		
+		
+		Writer writer = new FileWriter(afrlexfixed);
+		
+		content = afrlex.getText(encoding) 
+		separator= "\t"
+		content.splitEachLine(separator) {fields ->
+			writer.write(fields[0]);
+			for(int i = 1 ; i< fields.size(); i = i+2)
+			{
+				writer.write("\t"+ correspondances.get(fields[i])+"\t"+fields[i+1]); 				
+			}
+			writer.write("\n")
+		}
+		writer.close();
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args)
+	{
+		File afrlex = new File('afrlex.txt');
+		File afrlexfixed = new File('afrlex-patched.txt');
+		File correspondanceFile = new File('TTnca_2_CTX9.txt');
+		String encoding ="ISO-8859-1"
+		
+		PatchAfrlex.patch( correspondanceFile, afrlex, afrlexfixed, encoding );
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/scripts/TxmToHSQL.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/TxmToHSQL.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/TxmToHSQL.groovy	(revision 258)
@@ -0,0 +1,77 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.scripts;
+
+import org.txm.lexicon.core.corpusengine.cqp.Lexicon;
+import org.txm.searchengine.cqp.corpus.Corpus
+import org.txm.searchengine.cqp.corpus.CorpusManager
+import org.txm.searchengine.cqp.corpus.Property
+// TODO: Auto-generated Javadoc
+
+/**
+ * temporary class.
+ *
+ * @author mdecorde
+ */
+class TxmToSQL 
+{
+	
+	/**
+	 * Lexicon to sql.
+	 *
+	 * @param corpus the corpus
+	 * @param lexproperties the lexproperties
+	 * @return the string
+	 */
+	static String LexiconToSQL(Corpus corpus, Property lexproperties)
+	{
+		
+		Lexicon lex = corpus.getLexicon(lexproperties);
+		
+		String[] forms = lex.getForms();
+		
+		HSQLFunctions.CreateSimpleTable(lex.getName(),"form","VARCHAR(50)",forms)
+		return lex.getName();
+	}
+	
+	/**
+	 * Main.
+	 *
+	 * @param args the args
+	 */
+	static main(args) 
+	{
+		//lexicon example
+		CorpusManager cm = CorpusManager.getCorpusManager();
+		Corpus corpus = cm.getCorpus("RGAQCJ");
+		Property p = corpus.getProperty("word");
+		
+		String table = TxmToSQL.LexiconToSQL(corpus,p);
+		HSQLFunctions.printTable(table);
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/scripts/TnT.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/TnT.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/TnT.groovy	(revision 258)
@@ -0,0 +1,778 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.scripts;
+
+import java.util.Date;
+import java.util.Locale;
+import java.text.DateFormat;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+
+// Trigrams'n'Tags : part-of-speach tagger
+// TODO: Auto-generated Javadoc
+
+/**
+ * The Class TnT.
+ */
+class TnT {
+	
+	/** The binpath. */
+	String binpath = "";
+
+	/**
+	 * Instantiates a new tn t.
+	 *
+	 * @param binpath the binpath
+	 */
+	public TnT(String binpath) {
+		this.binpath = binpath;
+	}
+
+	/** The version. */
+	String version = "0.0.0";
+	
+	/** The desc. */
+	String desc = "Trigrams'n'Tags : part-of-speach tagger";
+	
+	/** The debug. */
+	boolean debug = false;
+
+	/**
+	 * Debug.
+	 *
+	 * @param b the b
+	 */
+	public void debug(boolean b) {
+		debug = b;
+	};
+
+	// use suffix trie with max. suffix length = len; default = 10
+	
+	/** The isa. */
+	private Boolean isa = false;
+	
+	/** The a. */
+	private int a;
+
+	/**
+	 * Sets the a.
+	 *
+	 * @param arg the new a
+	 */
+	public void seta(int arg) {
+		this.isa = true;
+		this.a = arg;
+	}
+
+	/**
+	 * Unseta.
+	 */
+	public void unseta() {
+		this.isa = false;
+	}
+
+	// use fil as backup lexicon
+	
+	/** The isb. */
+	private Boolean isb = false;
+	
+	/** The b. */
+	private File b;
+
+	/**
+	 * Sets the b.
+	 *
+	 * @param arg the new b
+	 */
+	public void setb(File arg) {
+		this.isb = true;
+		this.b = arg;
+	}
+
+	/**
+	 * Unsetb.
+	 */
+	public void unsetb() {
+		this.isb = false;
+	}
+
+	// backup mode : 0=main only, 1=mix, 2=backup only (default: 1)
+	
+	/** The is b. */
+	private Boolean isB = false;
+	
+	/** The B. */
+	private int B;
+
+	/**
+	 * Sets the b.
+	 *
+	 * @param arg the new b
+	 */
+	public void setB(int arg) {
+		this.isB = true;
+		this.B = arg;
+	}
+
+	/**
+	 * Unset b.
+	 */
+	public void unsetB() {
+		this.isB = false;
+	}
+
+	// sparse data mode
+	
+	/** The isd. */
+	private Boolean isd = false;
+	
+	/** The d. */
+	private String d;
+
+	/**
+	 * Sets the d.
+	 *
+	 * @param arg the new d
+	 */
+	public void setd(String arg) {
+		this.isd = true;
+		this.d = arg;
+	}
+
+	/**
+	 * Unsetd.
+	 */
+	public void unsetd() {
+		this.isd = false;
+	}
+
+	// copy HTML tags to output (without tagging)
+	
+	/** The is h. */
+	private Boolean isH = false;
+
+	/**
+	 * Sets the h.
+	 */
+	public void setH() {
+		this.isH = true;
+	}
+
+	/**
+	 * Unset h.
+	 */
+	public void unsetH() {
+		this.isH = false;
+	}
+
+	// mark unknown words in output with an asterisk (*)
+	
+	/** The ism. */
+	private Boolean ism = false;
+
+	/**
+	 * Setm.
+	 */
+	public void setm() {
+		this.ism = true;
+	}
+
+	/**
+	 * Unsetm.
+	 */
+	public void unsetm() {
+		this.ism = false;
+	}
+
+	// use num-grams, num = 1, 2, 3, default = 3
+	
+	/** The isn. */
+	private Boolean isn = false;
+	
+	/** The n. */
+	private int n;
+
+	/**
+	 * Sets the n.
+	 *
+	 * @param arg the new n
+	 */
+	public void setn(int arg) {
+		this.isn = true;
+		this.n = arg;
+	}
+
+	/**
+	 * Unsetn.
+	 */
+	public void unsetn() {
+		this.isn = false;
+	}
+
+	// unknown word count, default = 3
+	
+	/** The isu. */
+	private Boolean isu = false;
+	
+	/** The u. */
+	private int u;
+
+	/**
+	 * Sets the u.
+	 *
+	 * @param arg the new u
+	 */
+	public void setu(int arg) {
+		this.isu = true;
+		this.u = arg;
+	}
+
+	/**
+	 * Unsetu.
+	 */
+	public void unsetu() {
+		this.isu = false;
+	}
+
+	// set verbosity level num: (default = 3)
+	
+	/** The isv. */
+	private Boolean isv = false;
+	
+	/** The v. */
+	private int v;
+
+	/**
+	 * Sets the v.
+	 *
+	 * @param arg the new v
+	 */
+	public void setv(int arg) {
+		this.isv = true;
+		this.v = arg;
+	}
+
+	/**
+	 * Unsetv.
+	 */
+	public void unsetv() {
+		this.isv = false;
+	}
+
+	// output tag if prob is in beam num, default =0 (means infinity)
+	
+	/** The isz. */
+	private Boolean isz = false;
+	
+	/** The z. */
+	private int z;
+
+	/**
+	 * Sets the z.
+	 *
+	 * @param arg the new z
+	 */
+	public void setz(int arg) {
+		this.isz = true;
+		this.z = arg;
+	}
+
+	/**
+	 * Unsetz.
+	 */
+	public void unsetz() {
+		this.isz = false;
+	}
+
+	// cut off path if prob is not in beam num (default 1000)
+	
+	/** The is z. */
+	private Boolean isZ = false;
+	
+	/** The Z. */
+	private int Z;
+
+	/**
+	 * Sets the z.
+	 *
+	 * @param arg the new z
+	 */
+	public void setZ(int arg) {
+		this.isZ = true;
+		this.Z = arg;
+	}
+
+	/**
+	 * Unset z.
+	 */
+	public void unsetZ() {
+		this.isZ = false;
+	}
+
+	// tagging. the language model is loaded from model.lex and model.123. if
+	// model.map exists, it is used for output mapping compressed files are
+	// recognized by suffix .gz, .bz2, or .Z
+	
+	/**
+	 * Tnt.
+	 *
+	 * @param model the model
+	 * @param corpus the corpus
+	 */
+	public void tnt(String model, File corpus) throws IOException
+	// arg : model name, will be searched in current dir or in the path
+	// specified in the env var TNT_MODELS
+	// arg : corpus file ?
+	{
+		ArrayList<String> args = new ArrayList<String>();
+		args.add(binpath + "tnt");
+		if (isa) {
+			args.add("-a");
+			args.add("" + a);
+		}
+		if (isb) {
+			args.add("-b");
+			args.add("" + b);
+		}
+		if (isB) {
+			args.add("-B");
+			args.add("" + B);
+		}
+		if (isd) {
+			args.add("-d");
+			args.add("" + d);
+		}
+		if (isH)
+			args.add("-H");
+		if (ism)
+			args.add("-m");
+		if (isn) {
+			args.add("-n");
+			args.add("" + n);
+		}
+		if (isu) {
+			args.add("-u");
+			args.add("" + u);
+		}
+		if (isv) {
+			args.add("-v");
+			args.add("" + v);
+		}
+		if (isz) {
+			args.add("-z");
+			args.add("" + z);
+		}
+		if (isZ) {
+			args.add("-Z");
+			args.add("" + Z);
+		}
+		args.add("" + model);
+		args.add("" + corpus);
+
+		ProcessBuilder pb = new ProcessBuilder(args);
+		// pb.redirectErrorStream(true);
+		Process process = null;
+		try {
+			process = pb.start();
+		} catch (IOException e) {
+			System.err.println(e);
+		}
+		InputStream is = process.getInputStream();
+		InputStreamReader isr = new InputStreamReader(is);
+		BufferedReader br = new BufferedReader(isr);
+		String line;
+		while ((line = br.readLine()) != null) {
+			System.out.println(line);
+		}
+		int e = 0;
+		try {
+			e = process.waitFor();
+		} catch (Exception err) {
+		}
+		if (e != 0) {
+			System.err.println("Process exited abnormally with code "
+					+ e
+					+ " at "
+					+ DateFormat.getDateInstance(DateFormat.FULL, Locale.UK)
+							.format(new Date()));
+
+			for (int c = 0; c < args.size(); c++)
+				System.out.print("" + args.get(c) + " ");
+			System.out.println();
+		}
+	}
+
+	// print accuracy vs. frequency, max freq = max
+	
+	/** The isf. */
+	private Boolean isf = false;
+	
+	/** The f. */
+	private int f;
+
+	/**
+	 * Sets the f.
+	 *
+	 * @param arg the new f
+	 */
+	public void setf(int arg) {
+		this.isf = true;
+		this.f = arg;
+	}
+
+	/**
+	 * Unsetf.
+	 */
+	public void unsetf() {
+		this.isf = false;
+	}
+
+	// ignore upper/lower case of tokens
+	
+	/** The isi. */
+	private Boolean isi = false;
+
+	/**
+	 * Seti.
+	 */
+	public void seti() {
+		this.isi = true;
+	}
+
+	/**
+	 * Unseti.
+	 */
+	public void unseti() {
+		this.isi = false;
+	}
+
+	// lexicon to account for known/unknown words
+	
+	/** The isl. */
+	private Boolean isl = false;
+	
+	/** The l. */
+	private File l;
+
+	/**
+	 * Sets the l.
+	 *
+	 * @param arg the new l
+	 */
+	public void setl(File arg) {
+		this.isl = true;
+		this.l = arg;
+	}
+
+	/**
+	 * Unsetl.
+	 */
+	public void unsetl() {
+		this.isl = false;
+	}
+
+	// counting differences
+	
+	/**
+	 * Tntdiff.
+	 *
+	 * @param originalfile the originalfile
+	 * @param resultfile the resultfile
+	 */
+	public void tntdiff(File originalfile, File resultfile) throws IOException
+	// arg : model file
+	// arg : corpus file ?
+	{
+		ArrayList<String> args = new ArrayList<String>();
+		args.add(binpath + "tnt-diff");
+		if (isa)
+			args.add("-a");
+		if (isf) {
+			args.add("-f");
+			args.add("" + f);
+		}
+		if (isi)
+			args.add("-i");
+		if (isl) {
+			args.add("-l");
+			args.add("" + l);
+		}
+		if (ism) {
+			args.add("-m");
+			args.add("" + m);
+		}
+		args.add("" + originalfile);
+		args.add("" + resultfile);
+
+		ProcessBuilder pb = new ProcessBuilder(args);
+		pb.redirectErrorStream(true);
+		Process process = null;
+		try {
+			process = pb.start();
+		} catch (IOException e) {
+			System.err.println(e);
+		}
+		InputStream is = process.getInputStream();
+		InputStreamReader isr = new InputStreamReader(is);
+		BufferedReader br = new BufferedReader(isr);
+		String line;
+		while ((line = br.readLine()) != null) {
+			System.out.println(line);
+		}
+		int e = 0;
+		try {
+			e = process.waitFor();
+		} catch (Exception err) {
+		}
+		if (e != 0) {
+			System.err.println("Process exited abnormally with code "
+					+ e
+					+ " at "
+					+ DateFormat.getDateInstance(DateFormat.FULL, Locale.UK)
+							.format(new Date()));
+
+			for (int c = 0; c < args.size(); c++)
+				System.out.print("" + args.get(c) + " ");
+			System.out.println();
+		}
+	}
+
+	// encode capitalization in tag
+	
+	/** The isc. */
+	private Boolean isc = false;
+
+	/**
+	 * Setc.
+	 */
+	public void setc() {
+		this.isc = true;
+	}
+
+	/**
+	 * Unsetc.
+	 */
+	public void unsetc() {
+		this.isc = false;
+	}
+
+	// base name for output files, default=basename of corpus
+	
+	/** The iso. */
+	private Boolean iso = false;
+	
+	/** The o. */
+	private String o;
+
+	/**
+	 * Sets the o.
+	 *
+	 * @param arg the new o
+	 */
+	public void seto(String arg) {
+		this.iso = true;
+		this.o = arg;
+	}
+
+	/**
+	 * Unseto.
+	 */
+	public void unseto() {
+		this.iso = false;
+	}
+
+	// parameters generation
+	
+	/**
+	 * Tntpara.
+	 *
+	 * @param corpus the corpus
+	 */
+	public void tntpara(File corpus) throws IOException
+	// arg : corpus file ?
+	{
+		ArrayList<String> args = new ArrayList<String>();
+		args.add(binpath + "tnt-para");
+		if (isc)
+			args.add("-c");
+		if (isH)
+			args.add("-H");
+		if (isi)
+			args.add("-i");
+		if (isl)
+			args.add("-l");
+		if (isn)
+			args.add("-n");
+		if (iso) {
+			args.add("-o");
+			args.add("" + o);
+		}
+		if (isv)
+			args.add("-v");
+		args.add("" + corpus);
+
+		ProcessBuilder pb = new ProcessBuilder(args);
+		pb.redirectErrorStream(true);
+		Process process = null;
+		try {
+			process = pb.start();
+		} catch (IOException e) {
+			System.err.println(e);
+		}
+		InputStream is = process.getInputStream();
+		InputStreamReader isr = new InputStreamReader(is);
+		BufferedReader br = new BufferedReader(isr);
+		String line;
+		while ((line = br.readLine()) != null) {
+			System.out.println(line);
+		}
+		int e = 0;
+		try {
+			e = process.waitFor();
+		} catch (Exception err) {
+		}
+		if (e != 0) {
+			System.err.println("Process exited abnormally with code "
+					+ e
+					+ " at "
+					+ DateFormat.getDateInstance(DateFormat.FULL, Locale.UK)
+							.format(new Date()));
+
+			for (int c = 0; c < args.size(); c++)
+				System.out.print("" + args.get(c) + " ");
+			System.out.println();
+		}
+	}
+
+	// count tags
+	
+	/** The ist. */
+	private Boolean ist = false;
+
+	/**
+	 * Sett.
+	 */
+	public void sett() {
+		this.ist = true;
+	}
+
+	/**
+	 * Unsett.
+	 */
+	public void unsett() {
+		this.ist = false;
+	}
+
+	// count words tokens
+	
+	/** The isw. */
+	private Boolean isw = false;
+
+	/**
+	 * Setw.
+	 */
+	public void setw() {
+		this.isw = true;
+	}
+
+	/**
+	 * Unsetw.
+	 */
+	public void unsetw() {
+		this.isw = false;
+	}
+
+	// counting tokens and types
+	
+	/**
+	 * Tntwc.
+	 *
+	 * @param corpus the corpus
+	 */
+	public void tntwc(File corpus) throws IOException
+	// arg : corpus file ?
+	{
+		ArrayList<String> args = new ArrayList<String>();
+		args.add(binpath + "tnt-wc");
+		if (isH)
+			args.add("-H");
+		if (isi)
+			args.add("-i");
+		if (isl)
+			args.add("-l");
+		if (ist)
+			args.add("-t");
+		if (isw)
+			args.add("-w");
+		args.add("" + corpus);
+
+		ProcessBuilder pb = new ProcessBuilder(args);
+		pb.redirectErrorStream(true);
+		Process process = null;
+		try {
+			process = pb.start();
+		} catch (IOException e) {
+			System.err.println(e);
+		}
+		InputStream is = process.getInputStream();
+		InputStreamReader isr = new InputStreamReader(is);
+		BufferedReader br = new BufferedReader(isr);
+		String line;
+		while ((line = br.readLine()) != null) {
+			System.out.println(line);
+		}
+		int e = 0;
+		try {
+			e = process.waitFor();
+		} catch (Exception err) {
+		}
+		if (e != 0) {
+			System.err.println("Process exited abnormally with code "
+					+ e
+					+ " at "
+					+ DateFormat.getDateInstance(DateFormat.FULL, Locale.UK)
+							.format(new Date()));
+
+			for (int c = 0; c < args.size(); c++)
+				System.out.print("" + args.get(c) + " ");
+			System.out.println();
+		}
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args) {
+		TnT tt = new TnT("");
+	}
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/scripts/testTnT.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/testTnT.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/testTnT.groovy	(revision 258)
@@ -0,0 +1,507 @@
+/**
+ * Main.
+ *
+ * @param args the args
+ */
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2016-03-29 09:51:35 +0200 (Tue, 29 Mar 2016) $
+// $LastChangedRevision: 3185 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.scripts;
+
+/**
+ * test tnt Wrapper :
+ *  add NLP annotations
+ *  build result matrix
+ *  
+ */
+
+import org.txm.utils.*;
+import org.txm.importer.*;
+import org.txm.importer.RGAQCJ.*;
+
+// TODO: Auto-generated Javadoc
+/* (non-Javadoc)
+ * @see groovy.lang.Script#run()
+ */
+String rootDir = "~/xml/rgaqcj/TnT/";
+String modelsDir = rootDir+"models/";
+String textsDir = rootDir+"texts/";
+String projsDir = rootDir+"proj/";
+String srcDir = rootDir+"src/"
+String xslDir = rootDir+"xsl/"
+String anaDir = rootDir+"anainline/"
+new File(modelsDir).mkdir();
+new File(textsDir).mkdir();
+new File(projsDir).mkdir();
+
+def texts =["roland","artu","qjm","commyn1","jehpar","rgaqcj"]
+//def texts =["commyn1","jehpar"]
+String initiales = "RAQCJZ"
+
+//import src
+def srcfiles = ["roland.xml","artu.xml","qjm.xml","commyn1.xml","jehpar.xml"];
+def anafiles = ["roland-ana.xml","artu-ana.xml","qjm-ana.xml","commyn1-ana.xml","jehpar-ana.xml"];
+def xslfiles = ["bfm2txm-w.xsl","bfm2txm-w.xsl","bfm2txm-w.xsl","bfm2txm-w.xsl","bfm2txm-w.xsl"];
+/*
+ for(int i=0 ; i < xslfiles.size() ; i++)
+ {
+ String xslfile = xslDir+xslfiles[i];
+ String infile = srcDir+srcfiles[i];
+ String outfile = anaDir+anafiles[i];
+ println("create xml-txm from "+srcfiles[i]);
+ ApplyXsl a = new ApplyXsl(xslfile);
+ a.process(infile,outfile);
+ }
+ //Import to CWB
+ def cwbLoc ="~/Bureau/textometrie/CWB/cwb-3.0/utils/";//chemin vers executable cqp
+ BuildXmlRGAQCJ.process( anafiles,  rootDir, cwbLoc)
+ */
+//build CWBDecode wrapper
+ProcessBuilderBuilder.build(new File("src/groovy/org/txm/scripts/cwb-decode-wrapper-definition.xml"), new File("src/groovy/org/textometrie/scripts/CwbDecode.groovy"));
+GroovyClassLoader gcl = new GroovyClassLoader();
+gcl.addClasspath(".");
+
+String registryPath = rootDir+"/registry";
+String cwbdecodeexecDir = "~/Bureau/trunkCWB/cwb-3.0/utils/"
+
+Class clazz = gcl.parseClass(new File("src/groovy/org/txm/scripts/CwbDecode.groovy"));
+def cwbdecodewrapper = clazz.newInstance(cwbdecodeexecDir);
+def pAttributesTrain = ["word","cat"];
+def pAttributesTag = ["word"];
+def sAttributes = ["s"];
+cwbdecodewrapper.setC();
+cwbdecodewrapper.setP(pAttributesTag);
+cwbdecodewrapper.setS(sAttributes);
+cwbdecodewrapper.setr(registryPath);
+cwbdecodewrapper.debug(true);
+int[] nbmots = [0,35306,134170,173526,198929,228149];
+
+//create file to proj on
+for(int i = 0 ; i < texts.size() ; i++)
+{
+	String text = texts[i];
+	println("creation TTsrc "+text);
+	
+	//build src files
+	cwbdecodewrapper.setP(pAttributesTag);
+	
+	if(!(initiales[i]+"").equals("Z"))
+	{
+		if(i > 0)
+			cwbdecodewrapper.sets(nbmots[i]+1)
+		else
+			cwbdecodewrapper.sets(nbmots[i])
+		cwbdecodewrapper.sete(nbmots[i+1])
+	}
+	else
+	{
+		cwbdecodewrapper.unsets();
+		cwbdecodewrapper.unsete();
+	}
+	FileOutputStream fos = new FileOutputStream(textsDir+texts[i]+".t");
+	PrintStream ps = new PrintStream(fos);
+	def out = System.out;
+	System.setOut(ps);
+	
+	if(System.getProperty("os.name").contains("Windows"))
+		cwbdecodewrapper.cwbdecodeexe("RGAQCJ")
+	else
+		cwbdecodewrapper.cwbdecode("RGAQCJ")
+	System.setOut(out);
+	
+	//build train files
+	cwbdecodewrapper.setP(pAttributesTrain);
+	
+	fos = new FileOutputStream(modelsDir+texts[i]+".t");
+	ps = new PrintStream(fos);
+	System.setOut(ps);
+	
+	if(System.getProperty("os.name").contains("Windows"))
+		cwbdecodewrapper.cwbdecodeexe("RGAQCJ")
+	else
+		cwbdecodewrapper.cwbdecode("RGAQCJ")
+	System.setOut(out);
+	
+}
+
+//need to replace <s> by nothing and </s> by \n
+String encoding = "UTF-8"
+for(String text : texts)
+{
+	//patch src files
+	File f = new File(textsDir,text+".t");
+	File temp = new File("tempFileCVScleaner")
+	println("patch texts files "+f+": rmv <s> and replace </s>");
+	Reader reader = new InputStreamReader(new FileInputStream(f),encoding);
+	Writer writer = new FileWriter(temp);
+	reader.eachLine 
+			{
+				if(it.trim().startsWith("</s"))
+					writer.write("\n")
+				else if(it.trim().startsWith("<s"))
+					writer.write("")
+				else
+					writer.write(it+"\n")
+			}
+	reader.close();
+	writer.close();
+	if (!(f.delete() && temp.renameTo(f))) println "Warning can't rename file "+temp+" to "+f
+}
+//need to replace <s> by nothing and </s> by \n
+for(String text : texts)
+{
+	//patch training files
+	File f = new File(modelsDir,text+".t");
+	File temp = new File("tempFileCVScleaner")
+	println("patch models files "+f+": rmv <s> and replace </s>");
+	Reader reader = new InputStreamReader(new FileInputStream(f),encoding);
+	Writer writer = new FileWriter(temp);
+	reader.eachLine 
+			{
+				if(it.trim().startsWith("</s"))
+					writer.write("\n")
+				else if(it.trim().startsWith("<s"))
+					writer.write("")
+				else
+					writer.write(it+"\n")
+			}
+	reader.close();
+	writer.close();
+	if (!(f.delete() && temp.renameTo(f))) println "Warning can't rename file "+temp+" to "+f
+}
+
+//build Tnt Wrapper
+//ProcessBuilderBuilder.build(new File("src/groovy/org/txm/scripts/tnt-wrapper-definition.xml"), new File("src/groovy/org/textometrie/scripts/TnT.groovy"));
+gcl = new GroovyClassLoader();
+gcl.addClasspath(".");
+String tntexecDir = "~/Bureau/tnt/"
+clazz = gcl.parseClass(new File("src/groovy/org/txm/scripts/TnT.groovy"));
+def tntwrapper = clazz.newInstance(tntexecDir);
+
+def ttrezfiles = [];
+for(String text : texts)
+{
+	println "Apprentissage de "+text+"..."
+	tntwrapper.tntpara(new File(modelsDir,text+".t"));
+	//new File(text+".123").renameTo(new File(modelsDir,text+".123"));
+	//new File(text+".lex").renameTo(new File(modelsDir,text+".lex"));
+	for(String target : texts)
+	{
+		println "Projection de "+target+" sur "+target+"..."
+		for(int mode=3 ; mode <=3 ; mode++)
+		{
+			println("Mode "+mode+"...")
+			tntwrapper.setu(2);
+			
+			FileOutputStream fos = new FileOutputStream(projsDir+"model_"+text+"_target_"+target+"_mode"+mode+".t");
+			ttrezfiles.add("model_"+text+"_target_"+target+"_mode"+mode+".t")
+			PrintStream ps = new PrintStream(fos);
+			def out = System.out;
+			System.setOut(ps);
+			
+			tntwrapper.tnt(text,new File(textsDir,target+".t"));
+			
+			System.setOut(out);	
+		}
+	}
+}
+
+//def ttrezfiles = ["model_roland_targetroland_mode2.t", "model_roland_targetroland_mode3.t", "model_roland_targetartu_mode2.t", "model_roland_targetartu_mode3.t", "model_roland_targetqjm_mode2.t", "model_roland_targetqjm_mode3.t", "model_roland_targetcommyn1_mode2.t", "model_roland_targetcommyn1_mode3.t", "model_roland_targetjehpar_mode2.t", "model_roland_targetjehpar_mode3.t", "model_roland_targetrgaqcj_mode2.t", "model_roland_targetrgaqcj_mode3.t", "model_artu_targetroland_mode2.t","model_artu_targetroland_mode3.t", "model_artu_targetartu_mode2.t", "model_artu_targetartu_mode3.t", "model_artu_targetqjm_mode2.t", "model_artu_targetqjm_mode3.t", "model_artu_targetcommyn1_mode2.t", "model_artu_targetcommyn1_mode3.t", "model_artu_targetjehpar_mode2.t", "model_artu_targetjehpar_mode3.t", "model_artu_targetrgaqcj_mode2.t", "model_artu_targetrgaqcj_mode3.t", "model_qjm_targetroland_mode2.t, model_qjm_targetroland_mode3.t, model_qjm_targetartu_mode2.t, model_qjm_targetartu_mode3.t, model_qjm_targetqjm_mode2.t, model_qjm_targetqjm_mode3.t, model_qjm_targetcommyn1_mode2.t, model_qjm_targetcommyn1_mode3.t, model_qjm_targetjehpar_mode2.t, model_qjm_targetjehpar_mode3.t, model_qjm_targetrgaqcj_mode2.t, model_qjm_targetrgaqcj_mode3.t, model_commyn1_targetroland_mode2.t, model_commyn1_targetroland_mode3.t, model_commyn1_targetartu_mode2.t, model_commyn1_targetartu_mode3.t, model_commyn1_targetqjm_mode2.t, model_commyn1_targetqjm_mode3.t, model_commyn1_targetcommyn1_mode2.t, model_commyn1_targetcommyn1_mode3.t, model_commyn1_targetjehpar_mode2.t, model_commyn1_targetjehpar_mode3.t, model_commyn1_targetrgaqcj_mode2.t, model_commyn1_targetrgaqcj_mode3.t, model_jehpar_targetroland_mode2.t, model_jehpar_targetroland_mode3.t, model_jehpar_targetartu_mode2.t, model_jehpar_targetartu_mode3.t, model_jehpar_targetqjm_mode2.t, model_jehpar_targetqjm_mode3.t, model_jehpar_targetcommyn1_mode2.t, model_jehpar_targetcommyn1_mode3.t, model_jehpar_targetjehpar_mode2.t, model_jehpar_targetjehpar_mode3.t, model_jehpar_targetrgaqcj_mode2.t, model_jehpar_targetrgaqcj_mode3.t, model_rgaqcj_targetroland_mode2.t, model_rgaqcj_targetroland_mode3.t, model_rgaqcj_targetartu_mode2.t, model_rgaqcj_targetartu_mode3.t, model_rgaqcj_targetqjm_mode2.t, model_rgaqcj_targetqjm_mode3.t, model_rgaqcj_targetcommyn1_mode2.t, model_rgaqcj_targetcommyn1_mode3.t", "model_rgaqcj_targetjehpar_mode2.t", "model_rgaqcj_targetjehpar_mode3.t", "model_rgaqcj_targetrgaqcj_mode2.t", "model_rgaqcj_targetrgaqcj_mode3.t"];
+println ttrezfiles;
+//Build process infos
+//remove lines which starts with %%
+for(String text : ttrezfiles)
+{
+	//def encoding ="UTF-8"
+	println "patch proj file"+text+" : remove %% lines and blank lines AND replace n\t by only one \t";
+	File f = new File(projsDir,text);
+	File temp = new File("tempFileCVScleaner")
+	Reader reader = new InputStreamReader(new FileInputStream(f),encoding);
+	Writer writer = new FileWriter(temp);
+	reader.eachLine 
+			{
+				if(it.trim().startsWith("%%") || it.length() == 0)
+					writer.write("")
+				else
+					writer.write(it.replaceAll("(\t)+","\t")+"\n")
+			}
+	reader.close();
+	writer.close();
+	if (!(f.delete() && temp.renameTo(f))) println "Warning can't rename file "+temp+" to "+f
+}
+
+for(String text : texts)
+{
+	//def encoding ="UTF-8"
+	println "patch model file"+text+" : remove blank lines";
+	File f = new File(modelsDir,text+".t");
+	File temp = new File("tempFileCVScleaner")
+	Reader reader = new InputStreamReader(new FileInputStream(f),encoding);
+	Writer writer = new FileWriter(temp);
+	reader.eachLine 
+			{
+				if(it.length() == 0)
+					writer.write("")
+				else
+					writer.write(it+"\n")
+			}
+	reader.close();
+	writer.close();
+	if (!(f.delete() && temp.renameTo(f))) println "Warning can't rename file "+temp+" to "+f
+}
+
+HSQLFunctions.clearAll();
+//import proj table into hsql
+for(int i=0; i < ttrezfiles.size();i++)
+{
+	String csvfile = rootDir+"proj/"+ttrezfiles[i];
+	def argsname = ["form","cat"];
+	def types = ["VARCHAR(30)","VARCHAR(30)"];
+	int linenumber = HSQLFunctions.ImportOrderedCSVTable(ttrezfiles[i].replace(".",""), argsname,types,new File(csvfile),"\t","UTF-8");
+	println("create Table "+ttrezfiles[i].replace(".","")+" : "+linenumber+" lines");
+}
+
+for(String text : texts)
+{
+	File f = new File(modelsDir,text+".t");
+	def argsname = ["form","cat"];
+	def types = ["VARCHAR(30)","VARCHAR(30)"];
+	int linenumber = HSQLFunctions.ImportOrderedCSVTable("lexbrut_"+text.replace(".",""), argsname,types,f,"\t","UTF-8");
+	println("create Table lexbrut_"+text.replace(".","")+" : "+linenumber+" lines");
+}
+
+//calc richesses lexicales
+LinkedHashMap<String,ArrayList<String>> richesses = new LinkedHashMap<String,ArrayList<String>>();
+richesses.put("Text", ["TTrola","TTartu","TTqjm","TTcomm","TTjehpar","TTrgaqcj"]);
+
+LinkedHashMap<String,ArrayList<String>> richessesCat = new LinkedHashMap<String,ArrayList<String>>();
+richessesCat.put("Text", ["TTrola","TTartu","TTqjm","TTcomm","TTjehpar","TTrgaqcj"]);
+
+LinkedHashMap<String,ArrayList<String>> richessesocc = new LinkedHashMap<String,ArrayList<String>>();
+richessesocc.put("Text", ["TTrola","TTartu","TTqjm","TTcomm","TTjehpar","TTrgaqcj"]);
+
+LinkedHashMap<String,ArrayList<String>> richessesoccCat = new LinkedHashMap<String,ArrayList<String>>();
+richessesoccCat.put("Text", ["TTrola","TTartu","TTqjm","TTcomm","TTjehpar","TTrgaqcj"]);
+for(String text : texts)
+{
+	richesses.put(text, new ArrayList<String>());
+	richessesCat.put(text, new ArrayList<String>());
+	richessesocc.put(text, new ArrayList<String>());
+	richessesoccCat.put(text, new ArrayList<String>());
+}
+
+for(String text : texts)
+{
+	for(String model : texts)
+	{
+		if(text.matches(model))
+		{
+			richesses.get(text).add( "0" ) ;
+			richessesCat.get(text).add( "0") ;	
+			richessesocc.get(text).add( "0" ) ;	
+			richessesoccCat.get(text).add( "0" ) ;	
+		}
+		else
+		{
+			String query = "SELECT count(*) FROM ((SELECT DISTINCT form FROM lexbrut_"+text+" ) MINUS (SELECT DISTINCT form FROM lexbrut_"+model+"))"
+			println(query);
+			String query2 = "SELECT count(*) FROM ((SELECT DISTINCT cat FROM lexbrut_"+text+" ) MINUS (SELECT DISTINCT cat FROM lexbrut_"+model+"))"
+			println(query2);
+			String query3 = "SELECT count(form) FROM lexbrut_"+text+" WHERE form NOT IN (SELECT form FROM lexbrut_"+model+")"
+			println(query3);
+			String query4 = "SELECT count(cat) FROM lexbrut_"+text+" WHERE cat NOT IN (SELECT cat FROM lexbrut_"+model+")"
+			println(query4);
+			HSQLFunctions.getGroovySql().eachRow(query) {
+				def rich = it.getAt(0);
+				println("rich form :"+ rich);
+				richesses.get(text).add( ""+rich ) ;	
+			}
+			
+			HSQLFunctions.getGroovySql().eachRow(query2) {
+				def rich = it.getAt(0);
+				println("rich cat :"+ rich);
+				richessesCat.get(text).add( ""+rich ) ;	
+			}
+			
+			
+			HSQLFunctions.getGroovySql().eachRow(query3) {
+				def rich = it.getAt(0);
+				println("richocc form :"+ rich);
+				richessesocc.get(text).add( ""+rich ) ;	
+			}
+			
+			HSQLFunctions.getGroovySql().eachRow(query4) {
+				def rich = it.getAt(0);
+				println("richocc cat :"+ rich);
+				richessesoccCat.get(text).add( ""+rich ) ;	
+			}
+		}
+	}
+}
+
+LinkedHashMap<String,ArrayList<String>> matrix = new LinkedHashMap<String,ArrayList<String>>();
+
+matrix.put("Text", ["T    ","Vf    ","Vc    ","TTrola","TTartu","TTqjm","TTcomm","TTjehpar","TTrgaqcj"]);
+for(String text : texts)
+{
+	matrix.put(text, new ArrayList<String>());
+}
+
+ArrayList<Integer> countOccForm = new ArrayList<Integer>();
+ArrayList<Integer> countOccCat = new ArrayList<Integer>();
+ArrayList<Integer> countLexForm = new ArrayList<Integer>();
+ArrayList<Integer> countLexCat = new ArrayList<Integer>();
+
+for(String text : texts)
+{
+	println("count occ and voc : lexbrut_"+text)
+	String query1 = "SELECT count(*) FROM (SELECT form from lexbrut_"+text+")";
+	String query2 = "SELECT count(*) FROM (SELECT cat from lexbrut_"+text+")";
+	String query3 = "SELECT count(*) FROM (SELECT DISTINCT form from lexbrut_"+text+")";
+	String query4 = "SELECT count(*) FROM (SELECT DISTINCT cat from lexbrut_"+text+")";
+	
+	HSQLFunctions.getGroovySql().eachRow(query1) {
+		def rich = it.getAt(0);
+		println("count occ form :"+ rich);
+		countOccForm.add( ""+rich ) ;	
+	}
+	HSQLFunctions.getGroovySql().eachRow(query2) {
+		def rich = it.getAt(0);
+		println("coutn occ cat :"+ rich);
+		countOccCat.add( ""+rich ) ;	
+	}
+	HSQLFunctions.getGroovySql().eachRow(query3) {
+		def rich = it.getAt(0);
+		println("count lex form :"+ rich);
+		countLexForm.add( ""+rich ) ;	
+	}
+	HSQLFunctions.getGroovySql().eachRow(query4) {
+		def rich = it.getAt(0);
+		println("count lex cat :"+ rich);
+		countLexCat.add( ""+rich ) ;	
+	}
+	//println("col1 et 2 : "+nbOccurencesTxt.get("lexbrut_"+text)+" "+nbFormLexique.get("lex_"+text))
+	matrix.get(text).add( "0") ;
+	matrix.get(text).add( "0") ;
+	matrix.get(text).add( "0") ;
+}
+
+for(String text : texts)
+{
+	int textindex = 0;
+	for(String target : texts)
+	{
+		//get occurences ordonnées de la gold
+			//get occurences ordonnées de la projection
+			//compar
+		String proj = "model_"+text+"_target_"+target+"_mode"+3+"t"
+		println("comp "+proj+" VS lexbrut_"+target);
+		String query = "SELECT count(*) FROM ((SELECT n,form,cat FROM lexbrut_"+target+" ) MINUS (SELECT n,form,cat FROM "+proj+"))"
+		//HSQLFunctions.executeQuery(query);
+		//println(query)
+		int ttotal=0;
+		int total ;
+		HSQLFunctions.getGroovySql().eachRow(query) {
+			def dif = it.getAt(0);
+			/*if((""+initiales[id]) != "Z")
+			 {
+			 total = nbmots[id+1] - nbmots[id];
+			 ttotal += total;
+			 }
+			 else
+			 total= ttotal;
+			 */
+			
+			//total = nbOccurencesTxt.get("lexbrut_"+initiales[id])
+			println("textindex : "+textindex);
+			total = Integer.parseInt(countOccForm[textindex]);
+			println("dif "+dif+"/ tot "+total+" = "+((float)dif/(float)total));
+			Float perf = ((float)dif/(float)total)*100f;			
+			matrix.get(target).add( ""+perf ) ;
+		}
+		textindex++;
+	}
+	
+}
+
+println("Matrice d'erreur : ");
+for(String k : matrix.keySet())
+{
+	print(k)
+	for(String f : matrix.get(k))
+		print("\t"+f)
+	println()
+}
+println("richesse lexiques en Form : ");
+for(String k : richesses.keySet())
+{
+	print(k)
+	for(String f : richesses.get(k))
+		print("\t"+f)
+	println()
+}
+println("richesse lexiques en Cat : ");
+for(String k : richessesCat.keySet())
+{
+	print(k)
+	for(String f : richessesCat.get(k))
+		print("\t"+f)
+	println()
+}
+
+println("richesse occurance en Form : ");
+for(String k : richessesocc.keySet())
+{
+	print(k)
+	for(String f : richessesocc.get(k))
+		print("\t"+f)
+	println()
+}
+println("richesse occurance en Cat : ");
+for(String k : richessesoccCat.keySet())
+{
+	print(k)
+	for(String f : richessesoccCat.get(k))
+		print("\t"+f)
+	println()
+}
+
+println("RichBrutes	roland	artu	qjm	comm	jehpar	rgaqcj");
+print("Focc")
+for(int i=0;i < countOccForm.size() ; i++)
+	print("\t"+countOccForm[i]); 
+print("\nCocc")
+for(int i=0;i < countOccCat.size() ; i++)
+	print("\t"+countOccCat[i]); 
+print("\nFvoc")
+for(int i=0;i < countLexForm.size() ; i++)
+	print("\t"+countLexForm[i]); 
+print("\nCvoc")
+for(int i=0;i < countLexCat.size() ; i++)
+	print("\t"+countLexCat[i]); 
+println()
+
Index: tmp/org.txm.core/src/groovy/org/txm/scripts/Sh.java
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/Sh.java	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/Sh.java	(revision 258)
@@ -0,0 +1,194 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-09-05 09:27:13 +0200 (jeu., 05 sept. 2013) $
+// $LastChangedRevision: 2529 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.scripts;
+
+import java.util.Date;
+import java.util.Locale;
+import java.text.DateFormat;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+
+import org.txm.utils.logger.Log;
+
+// TODO: Auto-generated Javadoc
+// Shell
+/**
+ * The Class Sh.
+ */
+public class Sh {
+	
+	/** The binpath. */
+	String binpath = "";
+
+	/** The version. */
+	String version = "0.0.0";
+	
+	/** The desc. */
+	String desc = "Shell";
+
+	/**
+	 * Instantiates a new sh.
+	 *
+	 * @param binpath the binpath
+	 */
+	public Sh(String binpath) {
+		// System.out.println("set binpath "+binpath);
+		this.binpath = binpath;
+	}
+
+	// execute command line in argument
+	/** The isc. */
+	private Boolean isc = false;
+	
+	/** The c. */
+	private String c;
+
+	/**
+	 * Sets the isc.
+	 *
+	 * @param arg the new isc
+	 */
+	public void setIsc(String arg) {
+		this.isc = true;
+		this.c = arg;
+	}
+
+	/**
+	 * Unset isc.
+	 */
+	public void unsetIsc() {
+		this.isc = false;
+	}
+
+	// Sh
+	/**
+	 * Shexe.
+	 *
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 */
+	public void shexe() throws IOException {
+		ArrayList<String> args = new ArrayList<String>();
+		args.add(binpath + "sh.exe");
+		if (isc)
+			args.add("-c " + c);
+		System.out.println(args);
+		ProcessBuilder pb = new ProcessBuilder(args);
+		pb.redirectErrorStream(true);
+		Process process = null;
+		try {
+			process = pb.start();
+		} catch (IOException e) {
+			System.err.println(e);
+		}
+		InputStream is = process.getInputStream();
+		InputStreamReader isr = new InputStreamReader(is);
+		BufferedReader br = new BufferedReader(isr);
+		String line;
+		while ((line = br.readLine()) != null) {
+			System.out.println(line);
+		}
+		int e = 0;
+		try {
+			e = process.waitFor();
+		} catch (InterruptedException e1) {
+			// TODO Auto-generated catch block
+			e1.printStackTrace();
+		}
+		if (e != 0) {
+			System.err.println("Process exited abnormally with code "
+					+ e
+					+ " at "
+					+ DateFormat.getDateInstance(DateFormat.FULL, Locale.UK)
+							.format(new Date()));
+		}
+	}
+
+	// Sh
+	/**
+	 * Sh.
+	 *
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 */
+	public void sh() throws IOException {
+		ArrayList<String> args = new ArrayList<String>();
+		args.add(binpath + "sh");
+		if (isc) {
+			args.add("-c");
+			args.add(c);
+		}
+		// System.out.println(args);
+		ProcessBuilder pb = new ProcessBuilder(args);
+		pb.redirectErrorStream(true);
+		Process process = null;
+		try {
+			process = pb.start();
+		} catch (IOException e) {
+			Log.info(Log.toString(e));
+		}
+		InputStream is = process.getInputStream();
+		InputStreamReader isr = new InputStreamReader(is);
+		BufferedReader br = new BufferedReader(isr);
+		String line;
+		while ((line = br.readLine()) != null) {
+			Log.info(line);
+		}
+		int e = 0;
+		try {
+			e = process.waitFor();
+		} catch (InterruptedException e1) {
+			// TODO Auto-generated catch block
+			e1.printStackTrace();
+		}
+		if (e != 0) {
+			Log.info("Process exited abnormally with code "
+					+ e
+					+ " at "
+					+ DateFormat.getDateInstance(DateFormat.FULL, Locale.UK)
+							.format(new Date()));
+		}
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args) {
+		// Sh tt = new Sh("");
+		// tt.setIsc("kill `ps aux | grep cqpserver | awk '/-P 4877/ {print \\$2}'`");//
+		// try {
+		// tt.sh();
+		// } catch (IOException e) {
+		// // TODO Auto-generated catch block
+		// e.printStackTrace();
+		// }
+	}
+}
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/org/txm/scripts/Sh.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/scripts/FindUnclosedTag.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/FindUnclosedTag.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/FindUnclosedTag.groovy	(revision 258)
@@ -0,0 +1,63 @@
+package org.txm.scripts
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamConstants;
+
+File xmlFile = new File("/home/mdecorde/xml/errorxml/error.xml")
+
+def inputurl = xmlFile.toURI().toURL();
+def inputData = inputurl.openStream();
+def factory = XMLInputFactory.newInstance();
+def parser = factory.createXMLStreamReader(inputData);
+
+opened = []
+locations = []
+structPath = "/"
+
+try {
+for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+	switch (event) {
+		case XMLStreamConstants.START_ELEMENT:
+		String localname = parser.getLocalName();
+			startElement(localname, parser.getLocation().getLineNumber());
+		break;
+		case XMLStreamConstants.END_ELEMENT:
+			String localname = parser.getLocalName();
+			endElement(localname);
+		break
+	}
+}
+} catch(Exception e) {
+	println "** Error while parsing: "+e
+	println "** Error occured at : "+structPath+" line "+parser.getLocation().getLineNumber()
+	println "** Opened tags: "+opened
+	println "** at lines: "+locations
+}
+
+public boolean startElement(String localname, def loc) {
+	println structPath
+	structPath += localname+"/"
+	opened << localname
+	locations << loc
+	return true;
+}
+
+public boolean endElement(String localname) {
+	if (structPath.length() > 1) {
+		def lastTag = opened[-1]
+		if (localname != lastTag) {
+			println "ERROR: closing tag '$localname' does not match last opened tag '$lastTag'"
+			println opened
+			return false;
+		}
+	
+		int idx = structPath.substring(0,structPath.length()-1).lastIndexOf("/");
+		if (idx > 0)
+			structPath = structPath.substring(0, idx+1)
+		//
+		opened.pop()
+		locations.pop()
+			
+		return true
+	}
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/scripts/package.html
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/package.html	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Contains various Groovy scripts not yet classified</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/org/txm/scripts/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/scripts/BuildAfrLexicon.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/BuildAfrLexicon.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/BuildAfrLexicon.groovy	(revision 258)
@@ -0,0 +1,140 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.scripts;
+
+import groovy.lang.GroovyClassLoader
+
+import java.io.File
+
+import org.txm.utils.ProcessBuilderBuilder
+// TODO: Auto-generated Javadoc
+
+/**
+ * build an afr lexicon in a SQL table.
+ *
+ * @author mdecorde
+ */
+class BuildAfrLexicon 
+{
+	
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	static void main(String[] args)
+	{
+		HSQLFunctions.clearAll();
+		
+		//get lexicon from TXM RGAQCJ
+		ProcessBuilderBuilder.build(new File("src/groovy/org/txm/scripts/cwb-decode-wrapper-definition.xml"), new File("src/groovy/org/textometrie/scripts/CwbDecode.groovy"));
+
+		GroovyClassLoader gcl = new GroovyClassLoader();
+		gcl.addClasspath(".");
+
+		String registryPath = "~/Bureau/trunkCWB/corpora/registry";
+		//String registryPath = "C:/Documents and Settings/sheiden/.txm/registry"
+		 String cwbdecodeexecDir = "~/Bureau/trunkCWB/cwb-3.0/utils/"
+		//String cwbdecodeexecDir = "C:/Projets/Textom�trie/Logiciel/Toolbox/0.4.5/toolbox/src/main/C/cwb-3.0/utils/"
+
+		Class clazz = gcl.parseClass(new File("src/groovy/org/txm/scripts/CwbDecode.groovy"));
+		def aScript = clazz.newInstance(cwbdecodeexecDir);
+
+		aScript.setC()
+		def pAttributes = ["word","CATTEX2009","LEMMA"];
+		def sAttributes = ["s"];
+		aScript.setP(pAttributes)
+		//aScript.setS(sAttributes)
+		aScript.setr(registryPath)
+		
+String rootdir = "~/xml/rgaqcj/lexicon";
+File lexRGAQCJFile = new File(rootdir, "lexRGAQCJ.txt");
+FileOutputStream fos = new FileOutputStream(lexRGAQCJFile);
+PrintStream ps = new PrintStream(fos);
+def out = System.out;
+System.setOut(ps);
+
+		if(System.getProperty("os.name").contains("Windows"))
+			aScript.cwbdecodeexe("RGAQCJ")
+		else
+			aScript.cwbdecode("RGAQCJ")
+System.setOut(out);	
+println("fin")
+		//Load lexRGAQCJ.txt >> lexRGAQCJ(form,cat,val)
+		String[] argsname = ["form","cat","val"];
+		String[] types = ["VARCHAR(30)","VARCHAR(30)","VARCHAR(100)"];
+
+		HSQLFunctions.ImportRefTable("lexRGAQCJ", argsname,types,lexRGAQCJFile,"\t","ISO-8859-1");
+		
+		//load afrlex.txt >> afrlex(form,cat,val)
+		File afrlexFile = new File(rootdir, "afrlex.txt");
+		HSQLFunctions.ImportRefTable("afrlex", argsname,types,afrlexFile,"\t","ISO-8859-1")
+
+		//Load TTcna_2_CTX9.txt >> TTcna_2_CTX9(catcna,catctx9)
+		File correspFile = new File(rootdir, "TTnca_2_CTX9.txt");
+		argsname = ["catcna","catctx9"];
+		types = ["VARCHAR(20)","VARCHAR(20)"];
+		HSQLFunctions.ImportCSVTable("TTnca_2_CTX9", argsname,types,correspFile,"\t","ISO-8859-1")
+
+		//Union(lexRGAQCJ, afrlex) >> lextotal(form,cat,val)
+		//HSQLFunctions.CreateTable( "lextotal", argsname, types);
+		String query = 	"INSERT INTO afrlex " +
+						"SELECT * from lexRGAQCJ "+
+						"WHERE " +
+						"form NOT IN (SELECT form FROM afrlex) " +
+						"AND cat NOT IN (SELECT cat FROM afrlex) ";  
+		HSQLFunctions.executeQuery( query );
+
+		
+		//check for missing cat correspondence
+		String query2 = "SELECT cat from afrlex WHERE cat NOT IN (SELECT catcna FROM TTnca_2_CTX9);"
+		int numberOfCatNotSpecif = 0
+		def addedCat = [];
+		HSQLFunctions.getGroovySql().eachRow(query2) {
+			if(!addedCat.contains(it.getAt(0)))
+			{
+				addedCat.add(it.getAt(0));
+				println("!! No correspondance for "+ it.getAt(0));
+				HSQLFunctions.executeQuery("INSERT INTO TTnca_2_CTX9 VALUES ('"+it.getAt(0)+"','"+it.getAt(0)+"ERROR')");
+				numberOfCatNotSpecif++;
+			}
+		}
+		
+		//Substitution des cat >> lexRGAQCJ(form,cat,val)
+		String query3 = "UPDATE afrlex " +
+				"SET cat = (SELECT catctx9 FROM TTnca_2_CTX9 WHERE cat=catcna)";				
+		HSQLFunctions.executeQuery( query3 );
+		
+		HSQLFunctions.printTable "afrlex";
+	
+		//export lexRGAQCJ >> lexRGAQCJ.txt
+		File rezlexRGAQCJFile = new File(rootdir, "lexfra-rgaqcj.txt");
+		HSQLFunctions.toRefFile( "afrlex", rezlexRGAQCJFile.getAbsolutePath(),"form");
+		
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/scripts/RegexCounter.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/RegexCounter.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/RegexCounter.groovy	(revision 258)
@@ -0,0 +1,49 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.scripts
+// TODO: Auto-generated Javadoc
+
+/**
+ * TODO.
+ *
+ * @param sourcedir the sourcedir
+ * @param regex the regex
+ * @author mdecorde
+ */
+class RegexCounter {
+	public RegexCounter(File sourcedir, String encoding, String regex)
+	{
+		String text = sourcedir.getText(encoding);
+		java.util.regex.Matcher m = text =~ regex;
+		println m.count;
+	}
+	
+	public static void main(String[] args) {
+		new RegexCounter(new File("/home/mdecorde/xml/discours/01_DeGaulle.cnr"), "UTF-8", "je")
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/scripts/clix/cwb-align-wrapper-definition.xml
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/clix/cwb-align-wrapper-definition.xml	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/clix/cwb-align-wrapper-definition.xml	(revision 258)
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<application name="CwbAlign" version="3.2" desc="Align a corpus with an other">
+	<progs>
+		<prog exec="cwb-align" version="3.2" desc="create align file">
+			<args>
+				<arg state="optional" type="String" name="P" desc="use positional attribute [word]"/>
+				<arg state="optional" type="String" name="S" desc="ordered prealignment"/>
+				<arg state="optional" type="String" name="V" desc="ordered prealignment with annotations, ex : seg_id"/>
+				<arg state="optional" type="String" name="o" desc="outfile file [out.align]"/>
+				<arg state="optional" type="String" name="s" desc="set 2:2 alignment split factor [1.2]"/>
+				<arg state="optional" type="String" name="w" desc="use best path search beam of width [50]"/>
+				<arg state="optional" type="String" name="r" desc="use registry directory"/>
+				<arg state="optional" type="none" name="v" desc="verbose mode"/>
+				<arg state="optional" type="none" name="h" desc="show help"/>
+				<arg state="must" type="String" name="source" desc="source corpus identifier"/>
+				<arg state="must" type="String" name="target" desc="target corpus identifier"/>
+				<arg state="must" type="String" name="sattrib" desc="the aligned structure, ex : seg"/>
+			</args>
+		</prog>
+		<prog exec="cwb-align-encode" version="3.2" desc="create corpus align data">
+			<args>
+				<arg state="optional" type="String" name="d" desc="write data file to directory"/>
+				<arg state="optional" type="none" name="D" desc="write data files to corpus data directory"/>
+				<arg state="optional" type="none" name="C" desc="compatibility mode (creates .alg file)"/>
+				<arg state="optional" type="String" name="r" desc="set registry directory"/>
+				<arg state="optional" type="none" name="v" desc="verbose mode"/>
+				<arg state="optional" type="none" name="h" desc="show help"/>
+				<arg state="must" type="String" name="alignmentfile" desc="the align file created by cwb-align"/>
+			</args>
+		</prog>
+	</progs>
+</application>	

Property changes on: tmp/org.txm.core/src/groovy/org/txm/scripts/clix/cwb-align-wrapper-definition.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/scripts/clix/printenv-wrapper-definition.xml
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/clix/printenv-wrapper-definition.xml	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/clix/printenv-wrapper-definition.xml	(revision 258)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<application name="Printenv" version="0.0.0" desc="Print Environment">
+	<progs>
+		<prog exec="printenv.exe" version="0.0.0" desc="Printenv">
+			<args>
+			</args>
+		</prog>
+	</progs>
+</application>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/org/txm/scripts/clix/printenv-wrapper-definition.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/scripts/clix/tnt-wrapper-definition.xml
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/clix/tnt-wrapper-definition.xml	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/clix/tnt-wrapper-definition.xml	(revision 258)
@@ -0,0 +1,59 @@
+<?xml version="1.0">
+<application name="TnT" version="0.0.0" desc="Trigrams'n'Tags : part-of-speach tagger">
+	<progs>
+	
+		<prog exec="tnt" version="0.0.0" desc="tagging. the language model is loaded from model.lex and model.123. if model.map exists, it is used for output mapping compressed files are recognized by suffix .gz, .bz2, or .Z">
+			<args>
+				<arg state="optional" type="int" name="a" desc="use suffix trie with max. suffix length = len; default = 10"/>
+				<arg state="optional" type="File" name="b" desc="use fil as backup lexicon"/>
+				<arg state="optional" type="int" name="B" desc="backup mode : 0=main only, 1=mix, 2=backup only (default: 1)"/>
+				<arg state="optional" type="String" name="d" desc="sparse data mode"/>
+				<arg state="optional" type="none" name="H" desc="copy HTML tags to output (without tagging)"/>
+				<arg state="optional" type="none" name="m" desc="mark unknown words in output with an asterisk (*)"/>
+				<arg state="optional" type="int" name="n" desc="use num-grams, num = 1, 2, 3, default = 3"/>
+				<arg state="optional" type="int" name="u" desc="unknown word count, default = 3"/>
+				<arg state="optional" type="int" name="v" desc="set verbosity level num: (default = 3)"/>
+				<arg state="optional" type="int" name="z" desc="output tag if prob is in beam num, default =0 (means infinity)"/>
+				<arg state="optional" type="int" name="Z" desc="cut off path if prob is not in beam num (default 1000)"/>
+				<arg state="must" type="String" name="model" desc="model name, will be searched in current dir or in the path specified in the env var TNT_MODELS"/>
+				<arg state="must" type="File" name="corpus" desc="corpus file ?"/>
+			</args>
+		</prog>
+		
+		<prog exec="tnt-diff" version="0.0.0" desc="counting differences">
+			<args>
+				<arg state="optional" type="none" name="a" desc="print accuracy vs. ambiguity"/>
+				<arg state="optional" type="int" name="f" desc="print accuracy vs. frequency, max freq = max"/>
+				<arg state="optional" type="none" name="i" desc="ignore upper/lower case of tokens"/>
+				<arg state="optional" type="File" name="l" desc="lexicon to account for known/unknown words"/>
+				<arg state="optional" type="File" name="m" desc="use tagset mapping in file"/>
+				<arg state="must" type="File" name="originalfile" desc="model file"/>
+				<arg state="must" type="File" name="resultfile" desc="corpus file ?"/>
+			</args>
+		</prog>
+		
+		<prog exec="tnt-para" version="0.0.0" desc="parameters generation">
+			<args>
+				<arg state="optional" type="none" name="c" desc="encode capitalization in tag"/>
+				<arg state="optional" type="none" name="H" desc="ignore HTML tags for parameter generation"/>
+				<arg state="optional" type="none" name="i" desc="ignore case"/>
+				<arg state="optional" type="none" name="l" desc="generate lexicon only"/>
+				<arg state="optional" type="none" name="n" desc="generate ngrams only"/>
+				<arg state="optional" type="String" name="o" desc="base name for output files, default=basename of corpus"/>
+				<arg state="optional" type="none" name="v" desc="generate verbose ngrams"/>
+				<arg state="must" type="File" name="corpus" desc="corpus file ?"/>
+			</args>
+		</prog>
+		
+		<prog exec="tnt-wc" version="0.0.0" desc="counting tokens and types">
+			<args>
+				<arg state="optional" type="none" name="H" desc="ignore HTML tags for parameter generation"/>
+				<arg state="optional" type="none" name="i" desc="ignore case"/>
+				<arg state="optional" type="none" name="l" desc="count word types"/>
+				<arg state="optional" type="none" name="t" desc="count tags"/>
+				<arg state="optional" type="none" name="w" desc="count words tokens"/>
+				<arg state="must" type="File" name="corpus" desc="corpus file ?"/>
+			</args>
+		</prog>
+	</progs>
+</application>

Property changes on: tmp/org.txm.core/src/groovy/org/txm/scripts/clix/tnt-wrapper-definition.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/scripts/clix/testPrintenv.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/clix/testPrintenv.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/clix/testPrintenv.groovy	(revision 258)
@@ -0,0 +1,84 @@
+/**
+ * Main.
+ *
+ * @param args the args
+ */
+// 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
+// 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.
+
+//
+// This file is part of the TXM platform.
+//
+// The TXM platform is free software: you can redistribute it and/or modif y
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 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/>.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.scripts.clix;
+import java.io.File;
+import java.util.Properties;
+
+import org.txm.importer.filters.Filter;
+import org.txm.utils.ProcessBuilderBuilder;
+import groovy.lang.GroovyClassLoader;
+
+import org.txm.Toolbox
+/**
+ * test Printenv wrapper
+ */
+//ProcessBuilderBuilder.build(new File("src/groovy/org/txm/scripts/printenv-wrapper-definition.xml"), new File("src/groovy/org/textometrie/scripts/Printenv.groovy"));
+
+// TODO: Auto-generated Javadoc
+/* (non-Javadoc)
+ * @see groovy.lang.Script#run()
+ */
+GroovyClassLoader gcl = new GroovyClassLoader();
+
+def aScript
+
+try
+{
+	gcl.addClasspath(".");
+	Class clazz = gcl.parseClass(new File("src/groovy/org/txm/scripts/Printenv.groovy"));
+	aScript = clazz.newInstance("C:/unx/usr/local/wbin/");
+	
+}
+catch(Exception e)
+{	System.err.println(e);
+	return null;
+}
+
+aScript.printenvexe()
+
Index: tmp/org.txm.core/src/groovy/org/txm/scripts/clix/diff-wrapper-definition.xml
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/clix/diff-wrapper-definition.xml	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/clix/diff-wrapper-definition.xml	(revision 258)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<application name="Diff" version="0.0.0" desc="Diff src and target">
+	<progs>
+		<prog exec="diff" version="0.0.0" desc="Diff">
+			<args>
+				<arg prefix="-" name="nb" type="int" state="optional" desc="number of context lines"/>
+				<arg prefix="-" name="a" type="none" state="optional" desc="process files as text files"/>
+				<arg prefix="-" name="b" type="none" state="optional" desc="don't check whitespaces"/>
+				<arg prefix="-" name="B" type="none" state="optional" desc="don't check empty lines"/>
+				<arg prefix="-" name="c" type="none" state="optional" desc="Utiliser le format de sortie contextuel."/>
+				<arg prefix="-" name="C" type="int" state="optional" desc="number of line displayed."/>
+				<arg prefix="-" name="d" type="none" state="optional" desc="makes diff slower but change the algorithm to find more small differences"/>
+				<arg prefix="-" name="D" type="String" state="optional" desc="outfile of the merged texts"/>
+				<arg prefix="-" name="e" type="none" state="optional" desc="valid output for ed."/>
+				<arg prefix="" name="source" type="String" state="must" desc="the source file"/>
+				<arg prefix="" name="target" type="String" state="must" desc="the target file"/>
+			</args>
+		</prog>
+	</progs>
+</application>

Property changes on: tmp/org.txm.core/src/groovy/org/txm/scripts/clix/diff-wrapper-definition.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/scripts/clix/treetagger-wrapper-definition.xml
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/clix/treetagger-wrapper-definition.xml	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/clix/treetagger-wrapper-definition.xml	(revision 258)
@@ -0,0 +1,48 @@
+<?xml version="1.0">
+<application name="TreeTagger" version="0.0.0" desc="Tag files">
+	<progs>
+		<prog exec="tree-tagger" version="0.4.6" desc="Tag">
+			<args>
+				<arg state="optional" type="none" name="token" desc="Print the token"/>
+				<arg state="optional" type="none" name="lemma" desc="Print the lemma"/>
+				<arg state="optional" type="none" name="sgml" desc="Don't tag SGML annotations"/>
+				<arg state="optional" type="float" name="threshold" desc="Print all tags of a word with a probability higher than p times the largest probability"/>
+				<arg state="optional" type="none" name="prob" desc="Print tag probabilities"/>
+				<arg state="optional" type="none" name="ignore-prefix" desc=" Ignore prefix when guessing pos for unknown words"/>
+				<arg state="optional" type="none" name="no-unknown" desc="Print the token rather than [unknown] for unknown lemmas"/>
+				<arg state="optional" type="none" name="cap-heuristics" desc="Look up unknown capitalized words in the list of lower-case words"/>
+				<arg state="optional" type="none" name="hyphen-heuristics" desc="Turn on the heuristics fur guessing the parts of speech of unknown hyphenated words"/>
+				<arg state="optional" type="none" name="quiet" desc="quiet mode"/>
+				<arg state="optional" type="none" name="pt-with-prob" desc="pretagging with probabilities"/>
+				<arg state="optional" type="none" name="pt-with-lemma" desc="pretagging with lemmata"/>
+				<arg state="optional" type="none" name="proto" desc="Print lexical information for each word"/>
+				<arg state="optional" type="none" name="base" desc="Use only lexical probabilities for tagging"/>
+				<arg state="optional" type="float" name="eps" desc="Set minimal tag frequency to [epsilon]"/>
+				<arg state="optional" type="String" name="lex" desc="Read auxiliary lexicon entries from file "/>
+				<arg state="optional" type="String" name="wc" desc="Read a word-class automaton from file"/>
+				<arg state="optional" type="String" name="eos-tag" desc="The SGML tag [tag] signals the end of a sentence. this function implies the -sgml option"/>
+				<arg state="must" type="String" name="modelfile" desc="The model file"/>
+				<arg state="must" type="String" name="infile" desc="The In file"/>
+				<arg state="must" type="String" name="outfile" desc="The Out file"/>
+			</args>
+		</prog>
+
+		<prog exec="train-tree-tagger" version="0.0.0" desc="Train">
+			<args>
+				<arg state="optional" type="int" name="cl" desc="number of preceding words"/>
+				<arg state="optional" type="float" name="dtg" desc="min. decision tree gain"/>
+				<arg state="optional" type="float" name="sw" desc="A smoothing weight parameter"/>
+				<arg state="optional" type="float" name="atg" desc="affix tree gain"/>
+				<arg state="optional" type="String" name="st" desc="the end-of-sentence part-of-speech tag"/>
+				<arg state="optional" type="float" name="ecw" desc="weight of the equivalence class based probability estimates"/>
+				<arg state="optional" type="float" name="lt" desc="probability for lexical entries. default 0.001"/>
+				<arg state="optional" type="none" name="utf8" desc="assume that the data is encoded with UTF8"/>
+				<arg state="optional" type="none" name="quiet" desc="quiet mode"/>
+				<arg state="must" type="String" name="lexiconfile" desc="The lexicon file"/>
+				<arg state="must" type="String" name="openclassfile" desc="The open class file"/>
+				<arg state="must" type="String" name="infile" desc="The In file"/>
+				<arg state="must" type="String" name="outfile" desc="The Out file"/>
+			</args>
+		</prog>
+	</progs>
+</application>	

Property changes on: tmp/org.txm.core/src/groovy/org/txm/scripts/clix/treetagger-wrapper-definition.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/scripts/clix/sh-wrapper-definition.xml
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/clix/sh-wrapper-definition.xml	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/clix/sh-wrapper-definition.xml	(revision 258)
@@ -0,0 +1,15 @@
+<?xml version="1.0">
+<application name="Sh" version="0.0.0" desc="Shell">
+	<progs>
+		<prog exec="sh.exe" version="0.0.0" desc="Sh">
+			<args>
+				<arg state="optional" type="String" name="c" desc="execute command line in argument"/>
+			</args>
+		</prog>
+		<prog exec="sh" version="0.0.0" desc="Sh">
+			<args>
+				<arg state="optional" type="String" name="c" desc="execute command line in argument"/>
+			</args>
+		</prog>
+	</progs>
+</application>	

Property changes on: tmp/org.txm.core/src/groovy/org/txm/scripts/clix/sh-wrapper-definition.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/scripts/clix/package.html
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/clix/package.html	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/clix/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Contains various Groovy scripts generated with the CLIX module</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/org/txm/scripts/clix/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/scripts/clix/testSh.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/clix/testSh.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/clix/testSh.groovy	(revision 258)
@@ -0,0 +1,93 @@
+/**
+ * Main.
+ *
+ * @param args the args
+ */
+// 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
+// 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.
+
+//
+// This file is part of the TXM platform.
+//
+// The TXM platform is free software: you can redistribute it and/or modif y
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 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/>.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.scripts.clix;
+import java.io.File;
+import java.util.Properties;
+
+import org.txm.importer.filters.Filter;
+import org.txm.utils.ProcessBuilderBuilder;
+import groovy.lang.GroovyClassLoader;
+
+import org.txm.Toolbox
+
+/**
+ * test sh wrapper
+ */
+
+//ProcessBuilderBuilder.build(new File("src/groovy/org/txm/scripts/sh-wrapper-definition.xml"), new File("src/groovy/org/textometrie/scripts/Sh.groovy"));
+// TODO: Auto-generated Javadoc
+
+/* (non-Javadoc)
+ * @see groovy.lang.Script#run()
+ */
+ProcessBuilderBuilder.build(new File("groovy/org/txm/scripts/sh-wrapper-definition.xml"), new File("groovy/org/textometrie/scripts/Sh.groovy"));
+
+GroovyClassLoader gcl = new GroovyClassLoader();
+
+def aScript
+
+try
+{
+	gcl.addClasspath(".");
+	//Class clazz = gcl.parseClass(new File("src/groovy/org/txm/scripts/Sh.groovy"));
+	Class clazz = gcl.parseClass(new File("groovy/org/txm/scripts/Sh.groovy"));
+	aScript = clazz.newInstance("/bin/");
+
+}
+catch(Exception e)
+{	System.err.println(e);
+	return null;
+}
+String regpath ="~/.txm/registry";
+//String regpath ="C:/Documents and Settings/sheiden/.txm/registry";
+String execpath = "~/Bureau/trunkCWB/cwb-3.0/cqp/";
+//String execpath ="C:/Projets/Textom�trie/Logiciel/Toolbox/0.4.5/toolbox/src/main/C/cwb-3.0/utils/cwb-decode.exe";
+aScript.setc("\""+execpath+" -C -s 0 -e 5 -r '"+regpath+"' DISCOURS -P word\"")
+//aScript.shexe()
+aScript.sh()
Index: tmp/org.txm.core/src/groovy/org/txm/scripts/clix/cwb-decode-wrapper-definition.xml
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/clix/cwb-decode-wrapper-definition.xml	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/clix/cwb-decode-wrapper-definition.xml	(revision 258)
@@ -0,0 +1,51 @@
+<?xml version="1.0"?>
+<application name="CwbDecode" version="0.0.0" desc="Decode CWB indexes">
+	<progs>
+		<prog exec="cwb-decode.exe" version="0.0.0" desc="Decode">
+			<args>
+				<arg state="optional" type="none" name="L" desc="Lisp output mode"/>
+				<arg state="optional" type="none" name="H" desc="concordance line ('horizonta'l) output mode"/>
+				<arg state="optional" type="none" name="C" desc="compact output mode (suitable for encode)"/>
+				<arg state="optional" type="none" name="Cx" desc="XML-compatible compact output (for {encode -x ...}))"/>
+				<arg state="optional" type="none" name="X" desc="XML output mode"/>
+				<arg state="optional" type="none" name="n" desc="show corpus position ('numbers')"/>
+				<arg state="optional" type="int" name="s" desc="first token to print (at corpus position {n})"/>
+				<arg state="optional" type="int" name="e" desc="last token to print (at corpus position {n})"/>
+				<arg state="optional" type="String" name="r" desc="set registry directory"/>
+				<arg state="optional" type="none" name="p" desc="matchlist mode (input from stdin)"/>
+				<arg state="optional" type="String" name="f" desc="matchlist mode (input from {file})"/>
+				<arg state="must" type="String" name="corpus" desc="corpus name"/>
+				<arg state="optional" type="none" name="h" desc="this help page"/>
+				<arg state="multiple" type="String" name="P" desc="print p-attribute {att}"/>
+				<arg state="multiple" type="String" name="S" desc="print s-attribute {att} (possibly including annotations)"/>
+				<arg state="multiple" type="String" name="V" desc="show s-attribute annotation for each range in matchlist mode"/>
+				<arg state="multiple" type="String" name="A" desc="print alignment attribute {att}"/>
+				<arg state="optional" type="none" name="ALL" desc="print all p-attributes and s-attributes"/>
+				<arg state="optional" type="String" name="c" desc="expand ranges to full {att} region (matchlist mode)"/>
+			</args>
+		</prog>
+		<prog exec="cwb-decode" version="0.0.0" desc="Decode">
+			<args>
+				<arg state="optional" type="none" name="L" desc="Lisp output mode"/>
+				<arg state="optional" type="none" name="H" desc="concordance line ('horizonta'l) output mode"/>
+				<arg state="optional" type="none" name="C" desc="compact output mode (suitable for encode)"/>
+				<arg state="optional" type="none" name="Cx" desc="XML-compatible compact output (for {encode -x ...}))"/>
+				<arg state="optional" type="none" name="X" desc="XML output mode"/>
+				<arg state="optional" type="none" name="n" desc="show corpus position ('numbers')"/>
+				<arg state="optional" type="int" name="s" desc="first token to print (at corpus position {n})"/>
+				<arg state="optional" type="int" name="e" desc="last token to print (at corpus position {n})"/>
+				<arg state="optional" type="String" name="r" desc="set registry directory"/>
+				<arg state="optional" type="none" name="p" desc="matchlist mode (input from stdin)"/>
+				<arg state="optional" type="String" name="f" desc="matchlist mode (input from {file})"/>
+				<arg state="must" type="String" name="corpus" desc="corpus name"/>
+				<arg state="optional" type="none" name="h" desc="this help page"/>
+				<arg state="multiple" type="String" name="P" desc="print p-attribute {att}"/>
+				<arg state="multiple" type="String" name="S" desc="print s-attribute {att} (possibly including annotations)"/>
+				<arg state="multiple" type="String" name="V" desc="show s-attribute annotation for each range in matchlist mode"/>
+				<arg state="multiple" type="String" name="A" desc="print alignment attribute {att}"/>
+				<arg state="optional" type="none" name="ALL" desc="print all p-attributes and s-attributes"/>
+				<arg state="optional" type="String" name="c" desc="expand ranges to full {att} region (matchlist mode)"/>
+			</args>
+		</prog>
+	</progs>
+</application>	

Property changes on: tmp/org.txm.core/src/groovy/org/txm/scripts/clix/cwb-decode-wrapper-definition.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/scripts/clix/ls-wrapper-definition.xml
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/clix/ls-wrapper-definition.xml	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/clix/ls-wrapper-definition.xml	(revision 258)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<application name="Ls" version="0.0.0" desc="List directory">
+	<progs>
+		<prog exec="ls" version="0.0.0" desc="Ls">
+			<args>
+				<arg prefix="-" name="l" type="none" state="optional" desc="use a long listing format"/>
+				<arg prefix="-" name="a" type="none" state="optional" desc="do not ignore entries starting with '.'"/>
+				<arg prefix="-" name="d" type="String" state="optional" desc="list directory entries instead of contents"/>
+				
+			</args>
+		</prog>
+	</progs>
+</application>

Property changes on: tmp/org.txm.core/src/groovy/org/txm/scripts/clix/ls-wrapper-definition.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/scripts/clix/Ls.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/clix/Ls.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/clix/Ls.groovy	(revision 258)
@@ -0,0 +1,127 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.scripts.clix;
+
+import java.util.Date;
+import java.text.DateFormat;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+
+// List directory
+// TODO: Auto-generated Javadoc
+
+/**
+ * The Class Ls.
+ */
+class Ls {
+	
+	/** The binpath. */
+	String binpath = "";
+
+	/**
+	 * Instantiates a new ls.
+	 *
+	 * @param binpath the binpath
+	 */
+	public Ls(String binpath) {
+		this.binpath = binpath;
+	}
+
+	/** The version. */
+	String version = "0.0.0";
+	
+	/** The desc. */
+	String desc = "List directory";
+
+	// use a long listing format
+	
+	/** The isl. */
+	private Boolean isl = false;
+
+	/**
+	 * Sets the isl.
+	 */
+	public void setIsl() {
+		this.isl = true;
+	}
+
+	/**
+	 * Unset isl.
+	 */
+	public void unsetIsl() {
+		this.isl = false;
+	}
+
+	// Ls
+	
+	/**
+	 * Lsexe.
+	 */
+	public void lsexe() throws IOException {
+		ArrayList<String> args = new ArrayList<String>();
+		args.add(binpath + "ls.exe");
+		if (isl)
+			args.add("-l");
+
+		ProcessBuilder pb = new ProcessBuilder(args);
+		pb.redirectErrorStream(true);
+		Process process = null;
+		try {
+			process = pb.start();
+		} catch (IOException e) {
+			System.err.println(e);
+		}
+		InputStream is = process.getInputStream();
+		InputStreamReader isr = new InputStreamReader(is);
+		BufferedReader br = new BufferedReader(isr);
+		String line;
+		while ((line = br.readLine()) != null) {
+			System.out.println(line);
+		}
+		int e = process.waitFor();
+		if (e != 0) {
+			System.err.println("Process exited abnormally with code "
+					+ e
+					+ " at "
+					+ DateFormat.getDateInstance(DateFormat.LONG).format(
+							new Date()));
+		}
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args) {
+		Ls tt = new Ls("");
+	}
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/scripts/clix/testLs.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/clix/testLs.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/clix/testLs.groovy	(revision 258)
@@ -0,0 +1,85 @@
+/**
+ * Main.
+ *
+ * @param args the args
+ */
+// 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
+// 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.
+
+//
+// This file is part of the TXM platform.
+//
+// The TXM platform is free software: you can redistribute it and/or modif y
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 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/>.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.scripts.clix;
+import java.io.File;
+import java.util.Properties;
+
+import org.txm.importer.filters.Filter;
+import org.txm.utils.ProcessBuilderBuilder;
+import groovy.lang.GroovyClassLoader;
+
+import org.txm.Toolbox
+// TODO: Auto-generated Javadoc
+
+/**
+ * test Ls wrapper.
+ *
+ * @return the java.lang. object
+ */
+ProcessBuilderBuilder.build(new File("src/groovy/org/txm/scripts/ls-wrapper-definition.xml"), new File("src/groovy/org/textometrie/scripts/Ls.groovy"));
+
+GroovyClassLoader gcl = new GroovyClassLoader();
+
+def aScript
+
+try
+{
+	gcl.addClasspath(".");
+	Class clazz = gcl.parseClass(new File("src/groovy/org/txm/scripts/Ls.groovy"));
+	aScript = clazz.newInstance("C:/Program Files/UnxUtils/usr/local/wbin/");
+	
+}
+catch(Exception e)
+{	System.err.println(e);
+	return null;
+}
+
+aScript.setl()
+aScript.lsexe()
+
Index: tmp/org.txm.core/src/groovy/org/txm/scripts/clix/xmlstarlet-wrapper-definition.xml
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/clix/xmlstarlet-wrapper-definition.xml	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/clix/xmlstarlet-wrapper-definition.xml	(revision 258)
@@ -0,0 +1,26 @@
+<?xml version="1.0">
+<!-- TO BE FINISHED, WORK IN PROGRESS : SLH 2010-04-10 -->
+<application name="XMLStarlet" version="1.0.1" desc="XMLStarlet Toolkit: Command line utilities for XML">
+	<progs>
+		<prog exec="xml.exe ed" version="1.0.1" desc="XMLStarlet Toolkit: Edit XML document(s), Usage: xml ed <global-options> {<action>} [ <xml-file-or-uri> ... ], where <global-options>  - global options for editing, <xml-file-or-uri> - input XML document file name/uri (stdin otherwise)">
+			<args>
+				<arg state="optional" type="none" name="P" desc="-P (or --pf)        - preserve original formatting"/>
+				<arg state="optional" type="none" name="S" desc="-S (or --ps)        - preserve non-significant spaces"/>
+				<arg state="optional" type="none" name="O" desc="-O (or --omit-decl) - omit XML declaration (&lt;?xml ...?>)"/>
+				<arg state="optional" type="String" name="N" desc="-N &lt;name>=&lt;value>   - predefine namespaces (name without 'xmlns:'), ex: xsql=urn:oracle-xsql, Multiple -N options are allowed., -N options must be last global options."/>
+				<arg state="optional" type="none" name="h" desc="--help or -h        - display help"/>
+				<arg state="optional" type="String" name="d" desc="-d or --delete &lt;xpath>"/>
+				<arg state="optional" type="String" name="i" desc="-i or --insert &lt;xpath> -t (--type) elem|text|attr -n &lt;name> -v (--value) &lt;value>"/>
+				<arg state="optional" type="String" name="t" desc="-t (--type) elem|text|attr"/>
+				<arg state="optional" type="String" name="n" desc="-n &lt;name>"/>
+				<arg state="optional" type="String" name="v" desc="-v (--value) &lt;value>"/>
+				<arg state="optional" type="String" name="a" desc="-a or --append &lt;xpath> -t (--type) elem|text|attr -n &lt;name> -v (--value) &lt;value>"/>
+				<arg state="optional" type="String" name="s" desc="-s or --subnode &lt;xpath> -t (--type) elem|text|attr -n &lt;name> -v (--value) &lt;value>"/>
+				<arg state="optional" type="String" name="m" desc="-m or --move &lt;xpath1> &lt;xpath2>"/>
+				<arg state="optional" type="String" name="r" desc="-r or --rename &lt;xpath1> -v &lt;new-name>"/>
+				<arg state="optional" type="String" name="u" desc="-u or --update &lt;xpath> -v (--value) &lt;value>"/>
+				<arg state="optional" type="String" name="x" desc="-x (--expr) &lt;xpath> (-x is not implemented yet)"/>
+			</args>
+		</prog>
+	</progs>
+</application>

Property changes on: tmp/org.txm.core/src/groovy/org/txm/scripts/clix/xmlstarlet-wrapper-definition.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/scripts/XMLStatistics.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/XMLStatistics.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/XMLStatistics.groovy	(revision 258)
@@ -0,0 +1,207 @@
+package org.txm.scripts
+
+import java.text.Collator;
+import java.util.Locale;
+
+import org.txm.importer.StaxIdentityParser;
+
+class XMLStatistics extends StaxIdentityParser {
+
+	static String UNICATTRS = "id|src|name|href"
+	String path = "";
+	def paths = [:];
+
+	boolean usePaths=false, useAttributes=false, useAttributeValues=false;
+
+	public XMLStatistics(URL url) {
+		super(url);
+	}
+
+	public void setUsePaths(boolean b) {
+		this.usePaths = b
+	}
+
+	public void setUseAttributes(boolean b) {
+		this.useAttributes = b
+	}
+
+	public void setUseAttributeValues(boolean b) {
+		this.useAttributeValues = b;
+	}
+
+	public void processCharacters() {
+		//super.processCharacters()// don't write :)
+	}
+	
+	public void processEndElement() {
+		if (usePaths) {
+			path = path.substring(0, path.lastIndexOf("/"))
+		}
+		//super.processEndElement()// don't write :)
+	}
+
+	public void processStartElement() {
+		String localname = this.parser.getLocalName();
+		if (usePaths) {
+			path = path + "/$localname"
+		} else {
+			path = localname;
+		}
+
+		if (this.useAttributes) {
+			if (this.useAttributeValues) {
+				for(int i = 0 ; i < parser.getAttributeCount() ; i++)
+					if (!parser.getAttributeLocalName(i).matches(UNICATTRS))
+						path += "@"+parser.getAttributeLocalName(i)+"="+parser.getAttributeValue(i)
+			} else {
+				for(int i = 0 ; i < parser.getAttributeCount() ; i++)
+					path += "@"+parser.getAttributeLocalName(i)
+			}
+		}
+
+
+		plusOne()
+		//super.processStartElement() // don't write :)
+	}
+
+	public void process() {
+		File tmp = File.createTempFile("sdfs", "sdfsdf")
+		process(tmp)
+		tmp.delete();
+	}
+
+	private void plusOne() {
+		if (!paths.containsKey(path)) {
+			paths.put(path, 1)
+		} else {
+			paths.put(path, paths.get(path)+1)
+		}
+	}
+
+	public void printCounts(boolean sortByPath) {
+		def keys = new ArrayList(paths.keySet());
+		if (sortByPath) {
+			Collator collator = Collator.getInstance(new Locale("en", "US"));
+			collator.setStrength(Collator.TERTIARY);
+			Collections.sort(keys, collator)
+		} else {
+			keys.sort() { key -> -paths.get(key) }
+		}
+		for (String key : keys) {
+			println "$key\t"+paths.get(key)
+		}
+	}
+
+	public static void processDirectory(File srcdir, File outfile, String ext, boolean usePaths, boolean useAttributes, boolean useAttributeValues) {
+
+		def results = [:]
+		def allkeys = new HashSet<String>()
+
+		// counts
+		for (File infile : srcdir.listFiles()) {
+			if (!infile.getName().endsWith(".xml")) continue
+
+				XMLStatistics diag = new XMLStatistics(infile.toURI().toURL())
+			diag.setUsePaths(usePaths)
+			diag.setUseAttributes(useAttributes)
+			diag.setUseAttributeValues(useAttributeValues)
+			diag.process();
+			results.put(infile.getName(), diag.getPaths())
+			allkeys.addAll(diag.getPaths().keySet())
+			println ""
+		}
+
+		allkeys = new ArrayList(allkeys)
+		def table = [:]
+		def files = new ArrayList<String>(results.keySet())
+
+		// create table header
+		def header = []
+		header.addAll(files)
+		header << "TOTAL"
+		table["", header]
+
+		// Create empty cells
+		for (int i = 0 ; i < allkeys.size() ; i++) {
+			table[allkeys.get(i)] = new ArrayList(files.size())
+		}
+
+		// fill cells
+		for (int i = 0 ; i < allkeys.size() ; i++) {
+			String key = allkeys.get(i)
+			for (int j = 0 ; j < files.size() ; j++) {
+				def c = results.get(files.get(j)).get(key)
+				if (c != null) {
+					table[key][j] = c
+				} else {
+					table[key][j] = 0
+				}
+			}
+		}
+
+		// compute column margins
+		def colmargins = [];
+		allkeys << "TOTAL"
+		table["TOTAL"] = colmargins
+		for (int i = 0 ; i < files.size() ; i++) {
+			colmargins[i] = 0;
+			for (String key : allkeys) {
+				colmargins[i] += table[key].get(i)
+			}
+		}
+
+		// compute line margins
+		for (int i = 0 ; i < allkeys.size() ; i++) {
+			String key = allkeys.get(i)
+			int total = 0;
+			for (int j = 0 ; j < files.size() ; j++) {
+				total += table[key][j]
+			}
+			table[key][files.size()] = total
+		}
+
+		// sort keys
+		allkeys.sort() { it -> -table[it][files.size()] }
+		allkeys.remove(0)
+		allkeys << "TOTAL"
+
+		// print
+		outfile.withWriter("UTF-8") { writer ->
+			for(def h : header)
+				writer.print "\t"+h
+			writer.println ""
+			for (int i = 0 ; i < allkeys.size() ; i++) {
+				writer.print allkeys[i]
+				for (def c : table.get(allkeys[i])) {
+					if (c == 0) { writer.print "\t " }
+					else { writer.print "\t"+c }
+				}
+				writer.println ""
+			}
+		}
+	}
+	public static void main(String[] args) {
+		File srcdir = new File("/home/mdecorde/xml/temoignagesnice/corpus Matrice - fichiers xmlisés/");
+		File outdir = new File("/home/mdecorde/xml/temoignagesnice/corpus Matrice - fichiers xmlisés/stats");
+
+		// Process a directory
+		outdir.deleteDir()
+		outdir.mkdir()
+		processDirectory(srcdir, new File(outdir,"FFF.csv"), ".xml", false, false, false);
+		processDirectory(srcdir, new File(outdir,"FTF.csv"), ".xml", false, true, false);
+		processDirectory(srcdir, new File(outdir,"FTT.csv"), ".xml", false, true, true);
+		processDirectory(srcdir, new File(outdir,"TFF.csv"), ".xml", true, false, false);
+		processDirectory(srcdir, new File(outdir,"TTF.csv"), ".xml", true, true, false);
+		processDirectory(srcdir, new File(outdir,"TTT.csv"), ".xml", true, true, true);
+
+//		// Process one file
+//		File xmlfile = new File("/home/mdecorde/Bureau/matrice/témoignages/CONVERSIONS/ratz/odt-ratz.xml");
+//		XmlStatistics diag = new XmlStatistics(xmlfile.toURI().toURL());
+//		diag.setUsePaths(true)
+//		diag.setUseAttributes(false)
+//		diag.setUseAttributeValues(false)
+//		diag.process();
+//		diag.printCounts(true); 
+	}
+}
+
Index: tmp/org.txm.core/src/groovy/org/txm/scripts/tigersearch/BuildTTFile.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/tigersearch/BuildTTFile.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/tigersearch/BuildTTFile.groovy	(revision 258)
@@ -0,0 +1,193 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2017-01-24 18:11:42 +0100 (Tue, 24 Jan 2017) $
+// $LastChangedRevision: 3400 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.scripts.tigersearch;
+
+import java.text.DateFormat;
+import java.util.Date;
+import java.util.ArrayList;
+import javax.xml.stream.*;
+import java.net.URL;
+import org.txm.importer.filters.*;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class BuildTTFile.
+ *
+ * @author mdecorde
+ * 
+ * build the TT source for tigerSearch
+ */
+
+public class BuildTTFile {
+	
+	/** The url. */
+	private def url;
+	
+	/** The input data. */
+	private def inputData;
+	
+	/** The factory. */
+	private def factory;
+	
+	/** The parser. */
+	private XMLStreamReader parser;
+
+	/** The output. */
+	private def output;
+
+	/** The solotags. */
+	ArrayList<String> solotags;
+
+	/**
+	 * Instantiates a new builds the tt file.
+	 *
+	 * @param url the url
+	 * @param solotags the solotags
+	 */
+	public BuildTTFile(URL url, ArrayList<String> solotags) {
+		try {
+			this.url = url;
+			this.solotags = solotags;
+			inputData = url.openStream();
+			factory = XMLInputFactory.newInstance();
+			parser = factory.createXMLStreamReader(inputData);
+
+		} catch (XMLStreamException ex) {
+			System.out.println(ex);
+		} catch (IOException ex) {
+			System.out.println("IOException while parsing ");
+		}
+	}
+
+	/**
+	 * Creates the output.
+	 *
+	 * @param outfile the outfile
+	 * @return true, if successful
+	 */
+	private boolean createOutput(File outfile) {
+		try {
+			File f = outfile;
+			output = new OutputStreamWriter(new FileOutputStream(f), "UTF-8");
+
+			return true;
+		} catch (Exception e) {
+			System.out.println(e.getLocalizedMessage());
+			return false;
+		}
+	}
+
+	/**
+	 * Process.
+	 *
+	 * @param outfile the outfile
+	 * @param targetbalise the targetbalise
+	 * @return true, if successful
+	 */
+	public boolean process(File outfile, String targetbalise) {
+		if (createOutput(outfile)) {
+
+			String lastopenlocalname = "";
+			String localname = "";
+			try {
+				for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser
+						.next()) {
+
+					switch (event) {
+
+					case XMLStreamConstants.START_ELEMENT:
+						localname = parser.getLocalName();
+						switch (localname) {
+						case targetbalise:
+							String word = parser
+									.getAttributeValue(null, "word");
+							output.write(word + "\n");
+							break;
+						case "s":
+							output.write("<s>\n");
+							break;
+						}
+
+					case XMLStreamConstants.END_ELEMENT:
+						localname = parser.getLocalName();
+						switch (localname) {
+
+						case targetbalise:
+
+							break;
+						case "s":
+							output.write("</s>\n");
+							break;
+						}
+						break;
+
+					case XMLStreamConstants.CHARACTERS:
+						// output.write(parser.getText().trim());
+						break;
+					}
+				}
+				output.close();
+				parser.close();
+			} catch (XMLStreamException ex) {
+				System.out.println(ex);
+			} catch (IOException ex) {
+				System.out.println("IOException while parsing " + inputData);
+			}
+		}
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args) {
+
+		String rootDir = "~/xml/beroul/";
+		// new File(rootDir+"/identity/").mkdir();
+
+		ArrayList<String> milestones = new ArrayList<String>();// the tags who
+		// you want them
+		// to stay
+		// milestones
+		milestones.add("tagUsage");
+		milestones.add("pb");
+		milestones.add("lb");
+		milestones.add("catRef");
+
+		File srcfile = new File(rootDir, "beroul.xml");
+		File resultfile = new File(rootDir, "beroul.tt");
+		println("identity file : " + srcfile + " to : " + resultfile);
+
+		def builder = new BuildTTFile(srcfile.toURL(), milestones);
+		builder.process(resultfile, "t");
+
+		return;
+	}
+
+}
Index: tmp/org.txm.core/src/groovy/org/txm/scripts/tigersearch/InjectAnnotations.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/tigersearch/InjectAnnotations.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/tigersearch/InjectAnnotations.groovy	(revision 258)
@@ -0,0 +1,255 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2017-01-24 18:11:42 +0100 (Tue, 24 Jan 2017) $
+// $LastChangedRevision: 3400 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.scripts.tigersearch;
+
+import java.text.DateFormat;
+import java.util.Date;
+import java.util.ArrayList;
+import javax.xml.stream.*;
+import java.net.URL;
+import org.txm.importer.filters.*;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class InjectAnnotations.
+ *
+ * @author mdecorde
+ * 
+ * inject annotations into ONE file
+ */
+
+public class InjectAnnotations {
+	
+	/** The url. */
+	private def url;
+	
+	/** The input data. */
+	private def inputData;
+	
+	/** The factory. */
+	private def factory;
+	
+	/** The parser. */
+	private XMLStreamReader parser;
+
+	/** The reader. */
+	private Reader reader;
+
+	/** The output. */
+	private def output;
+
+	/** The solotags. */
+	ArrayList<String> solotags;
+	
+	/** The lespos. */
+	HashSet<String> lespos = new HashSet<String>();
+
+	/**
+	 * Instantiates a new inject annotations.
+	 *
+	 * @param url the url
+	 * @param annotations the annotations
+	 * @param solotags the solotags
+	 */
+	public InjectAnnotations(URL url, File annotations,
+			ArrayList<String> solotags) {
+		try {
+			this.url = url;
+			this.solotags = solotags;
+			inputData = url.openStream();
+			factory = XMLInputFactory.newInstance();
+			parser = factory.createXMLStreamReader(inputData);
+
+			reader = new FileReader(annotations);
+
+		} catch (XMLStreamException ex) {
+			System.out.println(ex);
+		} catch (IOException ex) {
+			System.out.println("IOException while parsing ");
+		}
+	}
+
+	/**
+	 * Creates the output.
+	 *
+	 * @param outfile the outfile
+	 * @return true, if successful
+	 */
+	private boolean createOutput(File outfile) {
+		try {
+			File f = outfile;
+			output = new OutputStreamWriter(new FileOutputStream(f), "UTF-8");
+
+			return true;
+		} catch (Exception e) {
+			System.out.println(e.getLocalizedMessage());
+			return false;
+		}
+	}
+
+	/**
+	 * Gets the next annotation.
+	 *
+	 * @return the next annotation
+	 */
+	private String getNextAnnotation() {
+		String line = reader.readLine();
+		while (line.startsWith("<"))
+			line = reader.readLine();
+		lespos.add(line.split("\t")[1]);
+		return line = line.split("\t")[1];
+	}
+
+	/**
+	 * Process.
+	 *
+	 * @param outfile the outfile
+	 * @return true, if successful
+	 */
+	public boolean process(File outfile) {
+		if (createOutput(outfile)) {
+
+			String lastopenlocalname = "";
+			String localname = "";
+			try {
+				for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser
+						.next()) {
+
+					switch (event) {
+					case XMLStreamConstants.START_ELEMENT:
+						localname = parser.getLocalName();
+						String prefix = parser.getPrefix();
+						if (prefix == null || prefix == "")
+							prefix = "";
+						else
+							prefix += ":";
+
+						lastopenlocalname = localname;
+						output.write("\n<" + prefix + localname);
+
+						for (int i = 0; i < parser.getAttributeCount(); i++)
+							output.write(" " + parser.getAttributeLocalName(i)
+									+ "=\"" + parser.getAttributeValue(i)
+									+ "\"");
+
+						// get annotation
+						if (localname.equals("t"))
+							output.write(" pos=\"" + getNextAnnotation()
+											+ "\"");
+
+						if (solotags.contains(localname))
+							output.write("/>");
+						else
+							output.write(">");
+						break;
+
+					case XMLStreamConstants.END_ELEMENT:
+
+						localname = parser.getLocalName();
+						String prefix = parser.getPrefix();
+						if (prefix == null || prefix == "")
+							prefix = "";
+						else
+							prefix += ":";
+
+						switch (localname) {
+
+						default:
+							if (!solotags.contains(localname))
+								if (lastopenlocalname.equals(localname))
+									output.write("</" + prefix + localname
+											+ ">");
+								else
+									output.write("\n</" + prefix + localname
+											+ ">");
+						}
+						break;
+
+					case XMLStreamConstants.CHARACTERS:
+						output.write(parser.getText().trim());
+						break;
+					}
+				}
+				output.close();
+				parser.close();
+			} catch (XMLStreamException ex) {
+				System.out.println(ex);
+			} catch (IOException ex) {
+				System.out.println("IOException while parsing " + inputData);
+			}
+		}
+	}
+
+	/**
+	 * Gets the feature.
+	 *
+	 * @param f the f
+	 * @return the feature
+	 */
+	public void getFeature(File f)
+	{
+		Writer writer = new OutputStreamWriter(new FileOutputStream(f) , "UTF-8");
+		writer.write("<feature name=\"pos\" domain=\"T\">\n")
+		for(String pos : lespos)
+			writer.write("<value name=\""+pos+"\"></value>\n");
+		writer.write("</feature>\n")
+		writer.close();
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args) {
+
+		String rootDir = "~/xml/beroul/";
+		new File(rootDir + "/identity/").mkdir();
+
+		ArrayList<String> milestones = new ArrayList<String>();// the tags who
+		// you want them
+		// to stay
+		// milestones
+		milestones.add("tagUsage");
+		milestones.add("pb");
+		milestones.add("lb");
+		milestones.add("catRef");
+
+		File srcfile = new File(rootDir, "beroul.xml");
+		File annotationsfiles = new File(rootDir, "result.tt");
+		File resultfile = new File(rootDir, "beroul-result.xml");
+		println("identity file : " + srcfile + " to : " + resultfile);
+
+		def builder = new InjectAnnotations(srcfile.toURL(), annotationsfiles,
+				milestones);
+		builder.process(resultfile);
+
+		return;
+	}
+
+}
Index: tmp/org.txm.core/src/groovy/org/txm/scripts/tigersearch/package.html
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/tigersearch/package.html	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/tigersearch/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Manage tigerSearch source file</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/org/txm/scripts/tigersearch/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/scripts/tigersearch/InsertAnnotationsBeroul.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/tigersearch/InsertAnnotationsBeroul.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/tigersearch/InsertAnnotationsBeroul.groovy	(revision 258)
@@ -0,0 +1,110 @@
+/**
+ * Main.
+ *
+ * @param args the args
+ */
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.scripts.tigersearch;
+
+import org.txm.utils.treetagger.TreeTagger;
+import org.txm.scripts.teitxm.*;
+
+// TODO: Auto-generated Javadoc
+/**
+ * script to insert annotation into beroul file.
+ *
+ * @return the java.lang. object
+ */
+
+String home = System.getProperty("user.home")
+File rootDir = new File(home, "xml/fullberoul/")
+
+ArrayList<String> milestones = new ArrayList<String>();//the tags who you want them to stay milestones
+milestones.add("tagUsage");
+milestones.add("pb");
+milestones.add("lb");
+milestones.add("catRef");
+
+//transform xml tiger >> TTsrc
+File srcfile = new File(rootDir,"beroul.xml");
+File resultfile = new File(rootDir,"beroul.tt");
+println("xml>>TT from : "+srcfile+" to : "+resultfile );
+
+def builder = new BuildTTFile(srcfile.toURL(), milestones);
+builder.process(resultfile, "t");
+
+//tag TT
+String infile = resultfile;
+String modelfile = home+"/treetagger/models/fro.par";
+String outfile = rootDir.getAbsolutePath()+"/result.tt";
+
+println("proj "+modelfile+ " on " +resultfile +" >> "+outfile);
+
+TreeTagger tt = new TreeTagger(home+"/treetagger/bin/");
+tt.settoken();
+tt.setquiet();
+tt.setsgml();
+tt.seteostag("<s>");
+tt.treetagger( modelfile, infile, outfile)
+
+//inject new TTattributes
+//File srcfile = new File(rootDir,"beroul.xml");
+File annotationsfiles = new File(rootDir,"result.tt");
+File lastresultfile = new File(rootDir,"beroul-result.xml");
+println("insert TT annotations : "+srcfile+" to : "+resultfile );
+
+builder = new InjectAnnotations(srcfile.toURL(),annotationsfiles, milestones);
+builder.process(lastresultfile);
+
+builder.getFeature(new File(rootDir,"feature.xml"));
+/*
+//TAG with TnT
+//need to replace <s> by nothing and </s> by \n
+String encoding = "UTF-8"
+for(String text : texts)
+{
+	//patch src files
+	File f = new File(textsDir,text+".t");
+	File temp = new File("tempFileCVScleaner")
+	println("patch texts files "+f+": rmv <s> and replace </s>");
+	Reader reader = new InputStreamReader(new FileInputStream(f),encoding);
+	Writer writer = new FileWriter(temp);
+	reader.eachLine 
+			{
+				if(it.trim().startsWith("</s"))
+					writer.write("\n")
+				else if(it.trim().startsWith("<s"))
+					writer.write("")
+				else
+					writer.write(it+"\n")
+			}
+	reader.close();
+	writer.close();
+	if (!(f.delete() && temp.renameTo(f))) println "Warning can't rename file "+temp+" to "+f
+}*/
Index: tmp/org.txm.core/src/groovy/org/txm/scripts/tigersearch/SubCorpusToSimpleCorpus.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/tigersearch/SubCorpusToSimpleCorpus.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/tigersearch/SubCorpusToSimpleCorpus.groovy	(revision 258)
@@ -0,0 +1,146 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+package org.txm.scripts.tigersearch;
+
+import org.txm.sw.ReplaceXmlDomNode;
+
+import java.io.File;
+import java.util.ArrayList;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class SubCorpusToSimpleCorpus.
+ */
+class SubCorpusToSimpleCorpus
+{
+	
+	/** The srcdir. */
+	File srcdir;
+	
+	/** The outdir. */
+	File outdir;
+	
+	/** The files. */
+	ArrayList<File> files = new ArrayList<File>();
+	
+	/** The master. */
+	File master;
+	
+	/**
+	 * Instantiates a new sub corpus to simple corpus.
+	 *
+	 * @param srcdir the srcdir
+	 * @param outdir the outdir
+	 */
+	public SubCorpusToSimpleCorpus(File srcdir, File outdir)
+	{
+		this.srcdir = srcdir;
+		this.outdir = outdir;
+	}
+	
+	/**
+	 * Scan.
+	 *
+	 * @return true, if successful
+	 */
+	public boolean scan()
+	{
+		if(!srcdir.exists())
+		{
+			System.out.println("Cant find srcdir: "+srcdir);			
+		}
+		
+		outdir.mkdir();
+		if(!outdir.exists())
+		{
+			System.out.println("Cant find outdir: "+srcdir);			
+		}	
+		
+		master = new File(srcdir, "master.xml");
+		def root = new XmlParser().parse(master);
+		for(def subcorpus : root.body.subcorpus)
+		{
+			String filename = subcorpus.@external
+			filename = filename.substring(5);
+			File f = new File(srcdir, filename);
+			if(f.exists())
+				files.add(f);
+			else
+				println("Missing file : "+f);
+		}
+		return true;
+	}
+	
+	/**
+	 * Fusion.
+	 *
+	 * @return true, if successful
+	 */
+	public boolean fusion()
+	{
+		for(File f : files)
+		{
+			println "replace "+f.getName();
+			String filename = f.getName();
+			File target = master;
+			
+			String xpathsrc = "//subcorpus"
+				
+			String xpathtarget = "//subcorpus[@external=\"file:"+filename+"\"]"
+			
+			new ReplaceXmlDomNode(f, target, xpathsrc, xpathtarget)
+		}
+	}
+	
+	/**
+	 * Gets the files.
+	 *
+	 * @return the files
+	 */
+	public ArrayList<File> getFiles()
+	{
+		return files;
+	}
+	
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args)
+	{
+		File srcdir = new File("/home/mdecorde/xml/beroul_bp")
+		File outdir = new File("/home/mdecorde/xml/beroul_bp/merged") // not used
+		def fusioner = new SubCorpusToSimpleCorpus(srcdir, outdir);
+		if(fusioner.scan())
+		{
+			println "subcorpus files : "+fusioner.getFiles()
+			fusioner.fusion();
+		}
+	}
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/scripts/FixPortalProfiles.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/FixPortalProfiles.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/FixPortalProfiles.groovy	(revision 258)
@@ -0,0 +1,125 @@
+package org.txm.scripts
+
+import groovy.xml.StreamingMarkupBuilder
+
+def importxml = new File("/home/mdecorde/TEMP/import.xml")
+def usersdir = new File("/home/mdecorde/TEMP/users")
+def usersdir2 = new File("/home/mdecorde/TEMP/users2")
+usersdir2.deleteDir()
+usersdir2.mkdir()
+
+// 1- get subcorpus & partitions per user
+def entities = [:];
+corpusInfo = [:];
+def root = new XmlSlurper().parse(importxml)
+
+def corpusNode = null
+for (def tmp : root.corpora.corpus) corpusNode = tmp
+def prefix = "/"+corpusNode.@name.toString()
+
+for (def preBuild : corpusNode.preBuild) {
+	for (def child : preBuild.children()) {
+		def tmp_entities = getEntities(prefix, child)
+		def user = "";
+		for (def entity : tmp_entities) {
+			String name = entity;
+			user = entity.substring(prefix.length()+1, entity.indexOf(":"))
+			//println user
+			break;
+		}
+
+		if (!entities.keySet().contains(user)) entities[user] = new HashSet<String>();
+		for (def entity : tmp_entities) {
+			entities[user] << entity
+		}
+	}
+}
+println entities
+println corpusInfo
+
+// 2- fix user_xxxx.xml
+for (def file : usersdir.listFiles()) {
+	if (!file.getName().endsWith(".xml")) continue;
+
+	def rootuser = new XmlParser().parse(file);
+	String login = rootuser.@login
+	if (entities.keySet().contains(login)) {
+		def user_entities = entities[login]
+
+		def existingEntities = new HashSet();
+		for (def entityNode : rootuser.permissions.entity) {
+			existingEntities << entityNode.@path.toString()
+		}
+		println "FIXING $file with $user_entities existing: $existingEntities"
+		for (def newentity : user_entities) {
+			if (!existingEntities.contains(newentity)) {
+				def permissionNode = null
+				for( def tmp : rootuser.permissions) permissionNode = tmp
+				// new
+				println " append $newentity "
+				def newnode = new Node(null, "entity");
+				newnode.@path = newentity
+				addPermissions(newnode, corpusInfo[newentity])
+				permissionNode.children().add(newnode)
+			}
+		}
+
+		new File(usersdir2, file.getName()).withWriter("UTF-8") { writer ->
+			new XmlNodePrinter(new PrintWriter(writer)).print(rootuser)
+		}
+	}
+}
+
+
+
+
+def addPermissions(def node, def type) {
+	
+	def subcorpusPerm = ["EditionPermission", "SpecificitiesPermission","IndexPermission","DictionnaryPermission",
+		"TextSelectionPermission", "CreateSubcorpusPermission", "DeletePermission", "DimensionsPermission",
+		"CreatePartitionPermission","DisplayPermission"]
+	
+	def partitionPerm = ["SpecificitiesPermission","IndexPermission","DictionnaryPermission",
+		"AFCPermission", "DeletePermission", "DimensionsPermission","DisplayPermission"]
+	
+	def children = node.children();
+
+	if (type == "partition") {
+		for( def perm : partitionPerm) {
+			def newnode = new Node(null, "permission");
+			newnode.@anti = "false"
+			newnode.@value = perm
+			children.add(newnode);
+		}
+	} else if (type == "subcorpus") {
+		def concnode = new Node(null, "permission");
+		concnode.@anti = "false"
+		concnode.@value = "ConcordancePermission"
+		concnode.@leftContext = 9999
+		concnode.@rightContext = 9999
+		children.add(concnode);
+		for( def perm : subcorpusPerm) {
+			def newnode = new Node(null, "permission");
+			newnode.@anti = "false"
+			newnode.@value = perm
+			children.add(newnode);
+		}
+	}
+}
+
+def getEntities(String prefix, def node) {
+	def list = []
+
+	String name = node.@name
+	String tmp = prefix +"/"+name
+	list << tmp
+
+	corpusInfo[tmp] = node.name()
+
+	for (def child : node.children()) {
+		if (child.name().toString() == "partition" | child.name().toString() == "subcorpus") {
+			list.addAll(getEntities(tmp,child))
+		}
+	}
+	return list
+}
Index: tmp/org.txm.core/src/groovy/org/txm/scripts/CwbDecode.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/CwbDecode.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/CwbDecode.groovy	(revision 258)
@@ -0,0 +1,691 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.scripts;
+
+import java.util.Date;
+import java.util.Locale;
+import java.text.DateFormat;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+
+// Decode CWB indexes
+// TODO: Auto-generated Javadoc
+
+/**
+ * The Class CwbDecode.
+ */
+class CwbDecode {
+	
+	/** The binpath. */
+	String binpath = "";
+
+	/**
+	 * Instantiates a new cwb decode.
+	 *
+	 * @param binpath the binpath
+	 */
+	public CwbDecode(String binpath) {
+		this.binpath = binpath;
+	}
+
+	/** The version. */
+	String version = "0.0.0";
+	
+	/** The desc. */
+	String desc = "Decode CWB indexes";
+	
+	/** The debug. */
+	boolean debug = false;
+
+	/**
+	 * Debug.
+	 *
+	 * @param b the b
+	 */
+	public void debug(boolean b) {
+		debug = b;
+	};
+
+	// Lisp output mode
+	
+	/** The is l. */
+	private Boolean isL = false;
+
+	/**
+	 * Sets the l.
+	 */
+	public void setL() {
+		this.isL = true;
+	}
+
+	/**
+	 * Unset l.
+	 */
+	public void unsetL() {
+		this.isL = false;
+	}
+
+	// concordance line ('horizonta'l) output mode
+	
+	/** The is h. */
+	private Boolean isH = false;
+
+	/**
+	 * Sets the h.
+	 */
+	public void setH() {
+		this.isH = true;
+	}
+
+	/**
+	 * Unset h.
+	 */
+	public void unsetH() {
+		this.isH = false;
+	}
+
+	// compact output mode (suitable for encode)
+	
+	/** The is c. */
+	private Boolean isC = false;
+
+	/**
+	 * Sets the c.
+	 */
+	public void setC() {
+		this.isC = true;
+	}
+
+	/**
+	 * Unset c.
+	 */
+	public void unsetC() {
+		this.isC = false;
+	}
+
+	// XML-compatible compact output (for {encode -x ...}))
+	
+	/** The is cx. */
+	private Boolean isCx = false;
+
+	/**
+	 * Sets the cx.
+	 */
+	public void setCx() {
+		this.isCx = true;
+	}
+
+	/**
+	 * Unset cx.
+	 */
+	public void unsetCx() {
+		this.isCx = false;
+	}
+
+	// XML output mode
+	
+	/** The is x. */
+	private Boolean isX = false;
+
+	/**
+	 * Sets the x.
+	 */
+	public void setX() {
+		this.isX = true;
+	}
+
+	/**
+	 * Unset x.
+	 */
+	public void unsetX() {
+		this.isX = false;
+	}
+
+	// show corpus position ('numbers')
+	
+	/** The isn. */
+	private Boolean isn = false;
+
+	/**
+	 * Setn.
+	 */
+	public void setn() {
+		this.isn = true;
+	}
+
+	/**
+	 * Unsetn.
+	 */
+	public void unsetn() {
+		this.isn = false;
+	}
+
+	// first token to print (at corpus position {n})
+	
+	/** The iss. */
+	private Boolean iss = false;
+	
+	/** The s. */
+	private int s;
+
+	/**
+	 * Sets the s.
+	 *
+	 * @param arg the new s
+	 */
+	public void sets(int arg) {
+		this.iss = true;
+		this.s = arg;
+	}
+
+	/**
+	 * Unsets.
+	 */
+	public void unsets() {
+		this.iss = false;
+	}
+
+	// last token to print (at corpus position {n})
+	
+	/** The ise. */
+	private Boolean ise = false;
+	
+	/** The e. */
+	private int e;
+
+	/**
+	 * Sets the e.
+	 *
+	 * @param arg the new e
+	 */
+	public void sete(int arg) {
+		this.ise = true;
+		this.e = arg;
+	}
+
+	/**
+	 * Unsete.
+	 */
+	public void unsete() {
+		this.ise = false;
+	}
+
+	// set registry directory
+	
+	/** The isr. */
+	private Boolean isr = false;
+	
+	/** The r. */
+	private String r;
+
+	/**
+	 * Sets the r.
+	 *
+	 * @param arg the new r
+	 */
+	public void setr(String arg) {
+		this.isr = true;
+		this.r = arg;
+	}
+
+	/**
+	 * Unsetr.
+	 */
+	public void unsetr() {
+		this.isr = false;
+	}
+
+	// matchlist mode (input from stdin)
+	
+	/** The isp. */
+	private Boolean isp = false;
+
+	/**
+	 * Setp.
+	 */
+	public void setp() {
+		this.isp = true;
+	}
+
+	/**
+	 * Unsetp.
+	 */
+	public void unsetp() {
+		this.isp = false;
+	}
+
+	// matchlist mode (input from {file})
+	
+	/** The isf. */
+	private Boolean isf = false;
+	
+	/** The f. */
+	private String f;
+
+	/**
+	 * Sets the f.
+	 *
+	 * @param arg the new f
+	 */
+	public void setf(String arg) {
+		this.isf = true;
+		this.f = arg;
+	}
+
+	/**
+	 * Unsetf.
+	 */
+	public void unsetf() {
+		this.isf = false;
+	}
+
+	// this help page
+	
+	/** The ish. */
+	private Boolean ish = false;
+
+	/**
+	 * Seth.
+	 */
+	public void seth() {
+		this.ish = true;
+	}
+
+	/**
+	 * Unseth.
+	 */
+	public void unseth() {
+		this.ish = false;
+	}
+
+	// print p-attribute {att}
+	
+	/** The is p. */
+	private Boolean isP = false;
+	
+	/** The P. */
+	private List<String> P;
+
+	/**
+	 * Sets the p.
+	 *
+	 * @param arg the new p
+	 */
+	public void setP(List<String> arg) {
+		this.isP = true;
+		this.P = arg;
+	}
+
+	/**
+	 * Unset p.
+	 */
+	public void unsetP() {
+		this.isP = false;
+	}
+
+	// print s-attribute {att} (possibly including annotations)
+	
+	/** The is s. */
+	private Boolean isS = false;
+	
+	/** The S. */
+	private List<String> S;
+
+	/**
+	 * Sets the s.
+	 *
+	 * @param arg the new s
+	 */
+	public void setS(List<String> arg) {
+		this.isS = true;
+		this.S = arg;
+	}
+
+	/**
+	 * Unset s.
+	 */
+	public void unsetS() {
+		this.isS = false;
+	}
+
+	// show s-attribute annotation for each range in matchlist mode
+	
+	/** The is v. */
+	private Boolean isV = false;
+	
+	/** The V. */
+	private List<String> V;
+
+	/**
+	 * Sets the v.
+	 *
+	 * @param arg the new v
+	 */
+	public void setV(List<String> arg) {
+		this.isV = true;
+		this.V = arg;
+	}
+
+	/**
+	 * Unset v.
+	 */
+	public void unsetV() {
+		this.isV = false;
+	}
+
+	// print alignment attribute {att}
+	
+	/** The is a. */
+	private Boolean isA = false;
+	
+	/** The A. */
+	private List<String> A;
+
+	/**
+	 * Sets the a.
+	 *
+	 * @param arg the new a
+	 */
+	public void setA(List<String> arg) {
+		this.isA = true;
+		this.A = arg;
+	}
+
+	/**
+	 * Unset a.
+	 */
+	public void unsetA() {
+		this.isA = false;
+	}
+
+	// print all p-attributes and s-attributes
+	
+	/** The is all. */
+	private Boolean isALL = false;
+
+	/**
+	 * Sets the all.
+	 */
+	public void setALL() {
+		this.isALL = true;
+	}
+
+	/**
+	 * Unset all.
+	 */
+	public void unsetALL() {
+		this.isALL = false;
+	}
+
+	// expand ranges to full {att} region (matchlist mode)
+	
+	/** The isc. */
+	private Boolean isc = false;
+	
+	/** The c. */
+	private String c;
+
+	/**
+	 * Sets the c.
+	 *
+	 * @param arg the new c
+	 */
+	public void setc(String arg) {
+		this.isc = true;
+		this.c = arg;
+	}
+
+	/**
+	 * Unsetc.
+	 */
+	public void unsetc() {
+		this.isc = false;
+	}
+
+	// Decode
+	
+	/**
+	 * Cwbdecodeexe.
+	 *
+	 * @param corpus the corpus
+	 */
+	public void cwbdecodeexe(String corpus) throws IOException
+	// arg : corpus name
+	{
+		ArrayList<String> args = new ArrayList<String>();
+		args.add(binpath + "cwb-decode.exe");
+		if (isL)
+			args.add("-L");
+		if (isH)
+			args.add("-H");
+		if (isC)
+			args.add("-C");
+		if (isCx)
+			args.add("-Cx");
+		if (isX)
+			args.add("-X");
+		if (isn)
+			args.add("-n");
+		if (iss) {
+			args.add("-s");
+			args.add("" + s);
+		}
+		if (ise) {
+			args.add("-e");
+			args.add("" + e);
+		}
+		if (isr) {
+			args.add("-r");
+			args.add("" + r);
+		}
+		if (isp)
+			args.add("-p");
+		if (isf) {
+			args.add("-f");
+			args.add("" + f);
+		}
+		args.add("" + corpus);
+		if (ish)
+			args.add("-h");
+		if (isP)
+			for (int c = 0; c < P.size(); c++) {
+				args.add("-P");
+				args.add("" + P.get(c));
+			}
+		if (isS)
+			for (int c = 0; c < S.size(); c++) {
+				args.add("-S");
+				args.add("" + S.get(c));
+			}
+		if (isV)
+			for (int c = 0; c < V.size(); c++) {
+				args.add("-V");
+				args.add("" + V.get(c));
+			}
+		if (isA)
+			for (int c = 0; c < A.size(); c++) {
+				args.add("-A");
+				args.add("" + A.get(c));
+			}
+		if (isALL)
+			args.add("-ALL");
+		if (isc) {
+			args.add("-c");
+			args.add("" + c);
+		}
+
+		ProcessBuilder pb = new ProcessBuilder(args);
+		pb.redirectErrorStream(true);
+		Process process = null;
+		try {
+			process = pb.start();
+		} catch (IOException e) {
+			System.err.println(e);
+		}
+		InputStream is = process.getInputStream();
+		InputStreamReader isr = new InputStreamReader(is);
+		BufferedReader br = new BufferedReader(isr);
+		String line;
+		while ((line = br.readLine()) != null) {
+			System.out.println(line);
+		}
+		int e = 0;
+		try {
+			e = process.waitFor();
+		} catch (Exception err) {
+		}
+		if (e != 0) {
+			System.err.println("Process exited abnormally with code "
+					+ e
+					+ " at "
+					+ DateFormat.getDateInstance(DateFormat.FULL, Locale.UK)
+							.format(new Date()));
+
+			for (int c = 0; c < args.size(); c++)
+				System.out.print("" + args.get(c) + " ");
+			System.out.println();
+		}
+	}
+
+	// Decode
+	
+	/**
+	 * Cwbdecode.
+	 *
+	 * @param corpus the corpus
+	 */
+	public void cwbdecode(String corpus) throws IOException
+	// arg : corpus name
+	{
+		ArrayList<String> args = new ArrayList<String>();
+		args.add(binpath + "cwb-decode");
+		if (isL)
+			args.add("-L");
+		if (isH)
+			args.add("-H");
+		if (isC)
+			args.add("-C");
+		if (isCx)
+			args.add("-Cx");
+		if (isX)
+			args.add("-X");
+		if (isn)
+			args.add("-n");
+		if (iss) {
+			args.add("-s");
+			args.add("" + s);
+		}
+		if (ise) {
+			args.add("-e");
+			args.add("" + e);
+		}
+		if (isr) {
+			args.add("-r");
+			args.add("" + r);
+		}
+		if (isp)
+			args.add("-p");
+		if (isf) {
+			args.add("-f");
+			args.add("" + f);
+		}
+		args.add("" + corpus);
+		if (ish)
+			args.add("-h");
+		if (isP)
+			for (int c = 0; c < P.size(); c++) {
+				args.add("-P");
+				args.add("" + P.get(c));
+			}
+		if (isS)
+			for (int c = 0; c < S.size(); c++) {
+				args.add("-S");
+				args.add("" + S.get(c));
+			}
+		if (isV)
+			for (int c = 0; c < V.size(); c++) {
+				args.add("-V");
+				args.add("" + V.get(c));
+			}
+		if (isA)
+			for (int c = 0; c < A.size(); c++) {
+				args.add("-A");
+				args.add("" + A.get(c));
+			}
+		if (isALL)
+			args.add("-ALL");
+		if (isc) {
+			args.add("-c");
+			args.add("" + c);
+		}
+
+		ProcessBuilder pb = new ProcessBuilder(args);
+		pb.redirectErrorStream(true);
+		Process process = null;
+		try {
+			process = pb.start();
+		} catch (IOException e) {
+			System.err.println(e);
+		}
+		InputStream is = process.getInputStream();
+		InputStreamReader isr = new InputStreamReader(is);
+		BufferedReader br = new BufferedReader(isr);
+		String line;
+		while ((line = br.readLine()) != null) {
+			System.out.println(line);
+		}
+		int e = 0;
+		try {
+			e = process.waitFor();
+		} catch (Exception err) {
+		}
+		if (e != 0) {
+			System.err.println("Process exited abnormally with code "
+					+ e
+					+ " at "
+					+ DateFormat.getDateInstance(DateFormat.FULL, Locale.UK)
+							.format(new Date()));
+
+			for (int c = 0; c < args.size(); c++)
+				System.out.print("" + args.get(c) + " ");
+			System.out.println();
+		}
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args) {
+		CwbDecode tt = new CwbDecode("");
+	}
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/scripts/EmptyFiles.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/EmptyFiles.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/EmptyFiles.groovy	(revision 258)
@@ -0,0 +1,63 @@
+/**
+ * Main.
+ *
+ * @param args the args
+ */
+// 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
+// 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.
+
+//
+// This file is part of the TXM platform.
+//
+// The TXM platform is free software: you can redistribute it and/or modif y
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 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/>.
+// 
+// 
+// 
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+package org.txm.scripts;
+
+// TODO: Auto-generated Javadoc
+/* (non-Javadoc)
+ * @see groovy.lang.Script#run()
+ */
+File orig = new File ("/home/mdecorde/TXM/corpora/temoignages-bin/txm/TEMOIGNAGES/")
+/*File dest = new File ("chemin2")
+dest.mkdir()*/
+for (File f:orig.listFiles()) {
+	//File copy = new File (dest,f.getName())
+	//copy.createNewFile()
+	f.delete()
+	f.createNewFile()
+}
Index: tmp/org.txm.core/src/groovy/org/txm/scripts/CountNumberOfChar.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/CountNumberOfChar.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/CountNumberOfChar.groovy	(revision 258)
@@ -0,0 +1,104 @@
+package org.txm.scripts
+
+
+import java.util.HashMap;
+import java.util.ArrayList;
+import java.io.File;
+import javax.xml.stream.*;
+import java.net.URL;
+
+import org.txm.importer.*;
+
+/**
+ * Counts the number of chars in tokens in a specific element
+ * NB: Tokens are separated by whitespaces
+ * 
+ * Can set attribute filter
+ * @author mdecorde
+ */
+class CountNumberOfChar {
+	int total = 0;
+	int nbWords = 0;
+	String elem = "w";
+	String attribute = null;
+	String regex = null;
+
+	/**
+	 * @param dir a directory
+	 * @param elem the element to focus on
+	 */
+	public CountNumberOfChar(File dir, String elem, String attribute, String regex) {
+		this.elem = elem;
+		this.attribute  = attribute;
+		this.regex = regex;
+
+		for (File f : dir.listFiles())
+			if (ValidateXml.test(f))
+				countInXML(f)
+	}
+
+	protected void countInXML(File f)
+	{
+		println "count: "+f
+		boolean startCount = false
+		try {
+			URL url = f.toURI().toURL();
+			def inputData = url.openStream();
+			def factory = XMLInputFactory.newInstance();
+			XMLStreamReader parser = factory.createXMLStreamReader(inputData);
+			for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next())
+			{
+				switch (event) {
+					case XMLStreamConstants.START_ELEMENT:
+
+						if (parser.getLocalName() == elem) {
+							if (attribute == null || regex == null) {
+								startCount = true;
+								nbWords++
+							} else {
+								String attrvalue = parser.getAttributeValue(null, attribute)
+								if (attrvalue != null && attrvalue.matches(regex)) {
+									startCount = true;
+									nbWords++
+								}
+							}
+						}
+						break;
+					case XMLStreamConstants.END_ELEMENT:
+						if (parser.getLocalName() == elem) {
+							startCount = false
+						}
+						break;
+					case XMLStreamConstants.CHARACTERS:
+						if (startCount) {
+							for (String tok : parser.getText().trim()) {
+								total += tok.length()
+							}
+							
+						}
+				}
+			}
+
+		}
+		catch(Exception e){e.printStackTrace();}
+	}
+
+	public float getMean() {
+		return ((float)total)/(float)nbWords;
+	}
+
+	public int getNbWords() {
+		return nbWords;
+	}
+
+	public int getTotal() {
+		return total;
+	}
+
+	public static void main(def args)
+	{
+		CountNumberOfChar c = new CountNumberOfChar(new File(System.getProperty("user.home")+"/TXM/corpora/bfm1/txm"), "form", null, null)
+		//CountNumberOfChar c = new CountNumberOfChar(new File(System.getProperty("user.home")+"/TXM/corpora/bfm1/txm"), "form", "type", "pon")
+		System.out.println("Moyenne: "+c.getMean());
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/scripts/trainTT.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/trainTT.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/trainTT.groovy	(revision 258)
@@ -0,0 +1,57 @@
+package org.txm.scripts;
+
+import java.util.ArrayList;
+import org.txm.utils.treetagger.TreeTagger;
+import org.txm.utils.*;
+import org.txm.importer.*;
+import org.txm.importer.RGAQCJ.*;
+import java.io.File;
+import java.text.DateFormat;
+import java.util.Date;
+import java.text.DecimalFormat;
+/**
+ * test TT wrapper
+ * add NLP annotation
+ * build result matrix
+ * 
+ */
+rootDir = "C:/Documents and Settings/alavrent/Mes documents/Projets/Morpho MultiDim/bfm3_2011";
+new File(rootDir+"/models/").mkdir();
+new File(rootDir+"/lexicon/").mkdir();
+//new File(rootDir+"/proj/").mkdir();
+new File(rootDir+"/ttlearn/").mkdir();
+//new File(rootDir+"/ttsrc/").mkdir();
+//new File(rootDir+"/pos/").mkdir();
+//new File(rootDir+"/injection/").mkdir();
+//new File(rootDir+"/anainline/").mkdir();
+//new File(rootDir+"/xml-txm/").mkdir();
+
+
+//train
+def ttlearnfiles = ["bfm3_2011-learn.tt"];
+def modelfiles = ["bfm3_2011.par"];
+
+def lexfiles = ["bfm3_2011-lex-fus.txt"];
+def openclassfiles = ["cattex2009_open_class.txt"];
+//def lexiconfile = rootDir+"/lexicon/"+"lexfra-rgaqcj.txt";
+
+
+for(int i=0; i < ttlearnfiles.size();i++)
+{
+	String infile = rootDir+"/ttlearn/"+ttlearnfiles[i];
+	String outfile = rootDir+"/models/"+modelfiles[i];
+	String lexiconfile = rootDir+"/lexicon/"+lexfiles[i];
+	String openclassfile = rootDir+"/lexicon/"+openclassfiles[i];
+	TreeTagger tt = new TreeTagger("C:/Program Files/treetagger/bin/");
+	println("learn "+ttlearnfiles[i] +" >> "+modelfiles[i]);
+	tt.settoken();
+	tt.setquiet();
+	//tt.setlemma();
+	tt.setsgml();
+	tt.setst("PONfrt");
+	tt.setproto();
+	tt.setutf8();
+	tt.traintreetagger( lexiconfile, openclassfile, infile, outfile)
+}
+
+//
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/scripts/teitxm/AnnotateWTC.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/teitxm/AnnotateWTC.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/teitxm/AnnotateWTC.groovy	(revision 258)
@@ -0,0 +1,172 @@
+// 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
+// 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.
+//
+//
+//
+// $LastChangedDate: 2013-12-06 16:57:35 +0100 (Fri, 06 Dec 2013) $
+// $LastChangedRevision: 2583 $
+// $LastChangedBy: mdecorde $
+//
+package org.txm.scripts.teitxm
+
+import org.txm.Toolbox
+import org.txm.importer.*
+import org.txm.importer.cwb.*
+import org.txm.objects.*
+import org.txm.stat.utils.ConsoleProgressBar
+import org.txm.utils.treetagger.TreeTagger
+
+// TODO: Auto-generated Javadoc
+/**
+ * Annotate and replace the TEI-TXM files of the folder $rootDirFile/txm with TreeTagger.
+ * creates $rootDirFile/interp and $rootDirFile/treetagger
+ *
+ */
+class AnnotateWTC {
+
+	/** The debug. */
+	boolean debug = true;
+
+	/**
+	 * Sets the debug.
+	 */
+	public void setDebug() { debug=true; }
+
+	String id;
+
+	/**
+	 * Apply tt.
+	 *
+	 * @param ttsrcfile the ttsrcfile
+	 * @param ttoutfile the ttoutfile
+	 * @param modelfile the modelfile
+	 * @return true, if successful
+	 */
+	public boolean applyTT(File ttsrcfile, File ttoutfile, File modelfile)
+	{
+		try {
+			File infile = ttsrcfile;
+			File outfile = ttoutfile;
+
+			// TODO: why org.txm.utils.treetagger.TreeTagger tt = ..., throw IllegalAccessError ???
+			String opt = Toolbox.getParam(Toolbox.TREETAGGER_OPTIONS);
+			if (opt == null) opt = "";
+			String[] options = opt.split("  ");
+			def tt = new TreeTagger(Toolbox.getParam(Toolbox.TREETAGGER_INSTALL_PATH)+"/bin/", options);
+			tt.settoken();
+			tt.setlemma();
+			tt.setquiet();
+			tt.setsgml();
+			tt.setnounknown();
+			tt.seteostag("<s>");
+			tt.treetagger(modelfile.getAbsolutePath(), infile.getAbsolutePath(), outfile.getAbsolutePath())
+			//infile.delete();
+		}
+		catch(Exception e)
+		{
+			e.printStackTrace();
+			return false;
+		}
+		return true;
+	}
+
+	/**
+	 * Run.
+	 *
+	 * @param rootDirFile the root dir file
+	 * @param modelfilename the modelfilename
+	 * @return true, if successful
+	 */
+	public boolean run(File binDir, File txmDir,  String modelfilename)
+	{
+		//test if modelfile exists
+		if(debug) {
+			println "rootDirFile "+binDir
+			println "txmDir "+txmDir
+			println "TREETAGGER INSTALL PATH : "+Toolbox.getParam(Toolbox.TREETAGGER_INSTALL_PATH)
+			println "TREETAGGER MODELS PATH : "+Toolbox.getParam(Toolbox.TREETAGGER_MODELS_PATH)
+		}
+
+		//test if the Toolbox know TreeTagger
+		if (!new File(Toolbox.getParam(Toolbox.TREETAGGER_INSTALL_PATH)+"/bin/").exists())
+		{
+			println("Could not find TreeTagger binaries in "+Toolbox.getParam(Toolbox.TREETAGGER_INSTALL_PATH)+"/bin/")
+			return false;
+		}
+
+		//cleaning
+		File annotDir = new File(binDir, "annotations")
+		annotDir.mkdir();
+
+		//BUILD TT FILE READY TO BE TAGGED
+		//println "Re "+Toolbox.getParam(Toolbox.TREETAGGER_APOSTROPHE)
+		List<File> files = txmDir.listFiles()
+
+		// get model file and check it
+		File modelfile = new File(Toolbox.getParam(Toolbox.TREETAGGER_MODELS_PATH), modelfilename);
+		if (debug)
+			println "model file : "+modelfile;
+
+		if (!modelfile.exists()) {
+			println "Skipping ANNOTATE: Incorrect modelfile path: "+modelfile;
+			if(System.getProperty("os.name").startsWith("Windows"))
+				println "Windows users: Windows might be hiding files extension. To see them, in the explorer parameters."
+			return false;
+		}
+
+		//APPLY TREETAGGER
+		println("Applying $modelfilename TreeTagger model on dir: "+txmDir+ " ("+files.size()+" files)")
+		if (files == null || files.size() == 0)
+			return false;
+
+		ConsoleProgressBar cpb = new ConsoleProgressBar(files.size());
+		for (File f : files) {
+			cpb.tick();
+			
+			File infile = f;
+			File outfile = new File(new File(binDir, "annotations"), f.getName());
+			if (outfile.exists() && // outfile exists
+				outfile.lastModified() >= infile.lastModified() && // outfile is more recent 
+				outfile.length() > infile.length()) { // outfile is bigger
+				// skip
+			} else {
+				if (!applyTT(infile, outfile, modelfile)) {
+					System.out.println("Failed to apply treetagger on file "+f);
+					return false;
+				}
+			}
+		}
+		println("")
+
+//		if (DeleteDir.deleteDirectory(txmDir)) {
+//			if (annotDir.renameTo(txmDir)) {
+//
+//			} else {
+//				println "Could not rename  'annotations' directory to 'txm' directory"
+//				return false
+//			}
+//		} else {
+//			println "Could not delete txmDir: $txmDir (and could not copy 'annotations' directory"
+//		}
+
+		return true;
+	}
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/scripts/teitxm/WLX2TXMTEI.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/teitxm/WLX2TXMTEI.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/teitxm/WLX2TXMTEI.groovy	(revision 258)
@@ -0,0 +1,286 @@
+// 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
+// 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.
+//
+//
+//
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $
+//
+package org.txm.scripts.teitxm;
+
+import java.util.ArrayList;
+import javax.xml.stream.*;
+import java.net.URL;
+import org.txm.importer.filters.*;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class AnnotationInliner.
+ *
+ * @author mdecorde build a xml-tei-txm from a weblex xml file
+ * @deprecated
+ */
+
+public class WLX2TXMTEI {
+
+	/** The input data. */
+	private def inputData;
+
+	/** The factory. */
+	private def factory;
+
+	/** The parser. */
+	private def parser;
+
+	/** The dir. */
+	private def dir;
+
+	/** The output. */
+	private def output;
+
+	/** The url. */
+	private def url;
+
+	/** The solotags. */
+	ArrayList<String> solotags;
+
+	/**
+	 * initialize.
+	 *
+	 * @param url the url to the file to transform
+	 * @param solotags temporary list of milestones tags
+	 */
+	public WLX2TXMTEI(URL url, ArrayList<String> solotags) {
+		try {
+			this.url = url;
+			this.solotags = solotags;
+			inputData = url.openStream();
+			factory = XMLInputFactory.newInstance();
+			parser = factory.createXMLStreamReader(inputData);
+		} catch (XMLStreamException ex) {
+			System.out.println(ex);
+		} catch (IOException ex) {
+			System.out.println("IOException while parsing ");
+		}
+	}
+
+	/**
+	 * create output FileWriter.
+	 *
+	 * @param dirPathName the dir path name
+	 * @param fileName the file name
+	 * @return true, if successful
+	 */
+	private boolean createOutput(String dirPathName, String fileName){
+		try {
+			dir = new File(dirPathName)
+			File f = new File(dir, fileName);
+			output = new java.io.FileWriter(f)
+
+			return true;
+		} catch (Exception e) {
+			System.out.println("la?"+e);
+			return false;
+		}
+	}
+
+	/**
+	 * process !!!.
+	 *
+	 * @param dirPathName the dir path name
+	 * @param fileName the file name
+	 * @return true, if successful
+	 */
+	public boolean transfomFile(String dirPathName, String fileName){
+		if(createOutput(dirPathName, fileName)){
+
+			int idPb = 0;
+			def idLb = "";
+			String idLinesuiv;
+			int charcount=0;
+			String lastopenlocalname= "";
+
+			boolean flagWord = false;
+			boolean flagNorm = false;
+			String vWordNorm = "";
+			String anabalises = "";
+			String vP2 = "";
+			int idcount=1;
+			String targets= "w_fro_"
+
+			try {
+				File inputfile = new File(this.url.getFile());
+				for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+					switch (event) {
+						case XMLStreamConstants.START_ELEMENT:
+							switch (parser.getLocalName()) {
+								case "w":
+								output.write("\n<w xml:id=\""+targets+idcount+"\"");
+								idcount++;
+								anabalises = "";
+								for(int i= 0 ; i < parser.getAttributeCount() ;i++ )
+								{
+									switch(parser.getAttributeLocalName(i))
+									{
+										case "p2":
+											anabalises += "<txm:ana ref=\"#TT1\" type=\"#t1\">" + parser.getAttributeValue(i)+"</txm:ana>\n"
+											break
+										case "p3":
+											anabalises += "<txm:ana ref=\"#TT1\" type=\"#lemma\">" + parser.getAttributeValue(i)+"</txm:ana>\n"
+											break
+										case "p4":
+											anabalises += "<txm:ana ref=\"#TT1\" type=\"#lasla\">" + parser.getAttributeValue(i)+"</txm:ana>\n"
+											break
+										case "p5":
+											anabalises += "<txm:ana ref=\"#TT1\" type=\"#grace\">" + parser.getAttributeValue(i)+"</txm:ana>\n"
+											break
+										case "p6":
+											anabalises += "<txm:ana ref=\"#TT1\" type=\"#t5\">" + parser.getAttributeValue(i)+"</txm:ana>\n"
+											break
+										case "p7":
+											anabalises += "<txm:ana ref=\"#TT1\" type=\"#tt\">" + parser.getAttributeValue(i)+"</txm:ana>\n"
+											break
+										case "p8":
+											anabalises += "<txm:ana ref=\"#TT1\" type=\"#tt\">" + parser.getAttributeValue(i)+"</txm:ana>\n"
+											break
+										case "p9":
+											anabalises += "<txm:ana ref=\"#TT1\" type=\"#tt\">" + parser.getAttributeValue(i)+"</txm:ana>\n"
+											break
+										case "p10":
+											anabalises += "<txm:ana ref=\"#TT1\" type=\"#tt\">" + parser.getAttributeValue(i)+"</txm:ana>\n"
+											break
+										case "p11":
+											anabalises += "<txm:ana ref=\"#TT1\" type=\"#tt\">" + parser.getAttributeValue(i)+"</txm:ana>\n"
+											break
+										case "p12":
+											anabalises += "<txm:ana ref=\"#TT1\" type=\"#tt\">" + parser.getAttributeValue(i)+"</txm:ana>\n"
+											break
+										case "p13":
+											anabalises += "<txm:ana ref=\"#TT1\" type=\"#tt\">" + parser.getAttributeValue(i)+"</txm:ana>\n"
+											break
+										default:
+											output.write(" "+parser.getAttributeLocalName(i)+"=\""+parser.getAttributeValue(i)+"\"" );
+									}
+								}
+
+								output.write(">\n");
+								flagWord = true;
+								break;
+
+								case "TEI":
+								output.write("\n<TEI");
+								for(int i= 0 ; i < parser.getAttributeCount() ;i++ )
+									output.write(" "+parser.getAttributeLocalName(i)+"=\""+parser.getAttributeValue(i)+"\"" );
+								output.write(" xmlns:txm=\"http://textometrie.ens-lyon.fr/1.0\"" );
+								output.write(">\n");
+								break;
+								default:
+								lastopenlocalname = parser.getLocalName();
+								output.write("\n<"+parser.getLocalName());
+								for(int i= 0 ; i < parser.getAttributeCount() ;i++ )
+									output.write(" "+parser.getAttributeLocalName(i)+"=\""+parser.getAttributeValue(i)+"\"" );
+								if(solotags.contains(lastopenlocalname))
+									output.write("/>");
+								else
+									output.write(">");
+								charcount=0;
+							}
+							break;
+
+						case XMLStreamConstants.END_ELEMENT:
+							switch (parser.getLocalName()) {
+								case "w":
+								output.write("<txm:form>"+vWordNorm+"</txm:form>")
+								output.write("\n"+anabalises);
+								output.write("</w>");
+								vWordNorm = "";
+								anabalises ="";
+								flagWord = false;
+								break;
+								default:
+								//if(charcount > 0)
+								//output.write("\n");
+								if(!solotags.contains(parser.getLocalName()))
+									if(lastopenlocalname.equals(parser.getLocalName()))
+										output.write("</"+parser.getLocalName()+">");
+									else
+										output.write("\n</"+parser.getLocalName()+">");
+							}
+							break;
+
+						case XMLStreamConstants.CHARACTERS:
+							if (flagWord) {
+
+								vWordNorm += parser.getText().trim();
+
+							} else
+							{
+								String txt = parser.getText().trim();
+								output.write(txt);
+								charcount += txt.length();
+							}
+							break;
+					}
+				}
+
+				output.close();
+				parser.close();
+			}
+			catch (XMLStreamException ex) {
+				System.out.println(ex);
+			}
+			catch (IOException ex) {
+				System.out.println("IOException while parsing " + inputData);
+			}
+		}
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args) {
+
+		String rootDir = "~/xml/rgaqcj/";
+		new File(rootDir+"/anainline/").mkdir();
+
+		def files = ["roland.xml","qgraal_cm.xml","artu.xml","qjm.xml","commyn1.xml","jehpar.xml"];
+		def anafiles = ["roland-ana.xml","qgraal_cm-ana.xml","artu-ana.xml","qjm-ana.xml","commyn1-ana.xml","jehpar-ana.xml"];
+		ArrayList<String> solotags = new ArrayList<String>();
+		solotags.add("tagUsage");
+		solotags.add("pb");
+		solotags.add("lb");
+		solotags.add("catRef");
+
+		for(int i=0; i < files.size();i++)
+		{
+			String file = files[i];
+			String anafile = anafiles[i];
+			def builder = new WLX2TXMTEI(new File(rootDir+"/src/",file).toURL(),solotags);
+			builder.transfomFile(rootDir+"/anainline/",anafile);
+		}
+
+
+		return
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/scripts/teitxm/InlineCleaner.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/teitxm/InlineCleaner.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/teitxm/InlineCleaner.groovy	(revision 258)
@@ -0,0 +1,205 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2016-03-29 09:51:35 +0200 (Tue, 29 Mar 2016) $
+// $LastChangedRevision: 3185 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.scripts.teitxm;
+
+import java.text.DateFormat;
+import java.util.Date;
+import java.util.ArrayList;
+import javax.xml.stream.*;
+import java.net.URL;
+import org.txm.importer.filters.*;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class InlineCleaner.
+ *
+ * @author mdecorde
+ * remove all ana tags of a xml-tei-txm file it supose you have
+ * the stand-off version
+ */
+
+public class InlineCleaner {
+	
+	/** The url. */
+	private def url;
+	
+	/** The input data. */
+	private def inputData;
+	
+	/** The factory. */
+	private def factory;
+	
+	/** The parser. */
+	private XMLStreamReader parser;
+
+	/** The output. */
+	private def output;
+	
+	/** The solotags. */
+	ArrayList<String> solotags;
+
+	/**
+	 * Instantiates a new inline cleaner.
+	 *
+	 * @param url the url
+	 * @param outfile the outfile
+	 * @param solotags the solotags
+	 */
+	public InlineCleaner(URL url, File outfile, ArrayList<String> solotags) {
+		try {
+			this.url = url;
+			this.solotags = solotags;
+			inputData = url.openStream();
+			factory = XMLInputFactory.newInstance();
+
+			parser = factory.createXMLStreamReader(inputData);
+
+			this.transformFile(outfile);
+
+		} catch (XMLStreamException ex) {
+			System.out.println(ex);
+		} catch (IOException ex) {
+			System.out.println("IOException while parsing ");
+		}
+	}
+
+	/**
+	 * Creates the output.
+	 *
+	 * @param outfile the outfile
+	 * @return true, if successful
+	 */
+	private boolean createOutput(File outfile) {
+		output = new OutputStreamWriter(new FileOutputStream(outfile), "UTF-8");
+		return true;
+	}
+
+	/**
+	 * Transform file.
+	 *
+	 * @param outfile the outfile
+	 * @return true, if successful
+	 */
+	public boolean transformFile(File outfile) {
+		boolean shouldwrite = true;
+		boolean isW = false;
+		String lastopenlocalname = "";
+
+		if (!createOutput(outfile))
+			return false;
+
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser
+				.next()) {
+			String prefix = parser.getPrefix();
+			if (prefix == null)
+				prefix = "";
+			else
+				prefix += ":";
+
+			switch (event) {
+			case XMLStreamConstants.START_ELEMENT:
+				
+				if (parser.getLocalName().equals("w")) {
+					isW = true;
+				} 
+				
+				if (parser.getLocalName().equals("ana") && isW) {
+					shouldwrite = false;
+				} else {
+					lastopenlocalname = parser.getLocalName();
+					output.write("\n<" + prefix + parser.getLocalName());
+					if (parser.getLocalName().equals("TEI"))
+						output
+								.write(" xmlns:txm=\"http://textometrie.ens-lyon.fr/1.0\"");
+					for (int i = 0; i < parser.getAttributeCount(); i++) {
+						String attname = parser.getAttributeLocalName(i);
+						output.write(" " + attname + "=\""
+								+ parser.getAttributeValue(i) + "\"");
+					}
+					if (solotags.contains(lastopenlocalname))
+						output.write("/>");
+					else
+						output.write(">");
+				}
+				break;
+			case XMLStreamConstants.END_ELEMENT:
+				switch (parser.getLocalName()) {
+				case "ana":
+					if(isW)
+						shouldwrite = true;
+					break;
+				case "w":
+					isW = false;
+					//do default
+				default:
+					if (!solotags.contains(parser.getLocalName()))
+						if (lastopenlocalname.equals(parser.getLocalName()))
+							output.write("</" + prefix + parser.getLocalName()+ ">");
+						else
+							output.write("\n</" + prefix
+									+ parser.getLocalName() + ">");
+				}
+				break;
+
+			case XMLStreamConstants.CHARACTERS:
+				if (shouldwrite) {
+					String txt = parser.getText().trim();
+					output.write(txt);
+				}
+				break;
+			}
+		}
+		output.close();
+		parser.close();
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args) {
+
+		String rootDir = "~/xml/rgaqcj/";
+		new File(rootDir + "/cleaner/").mkdir();
+
+		ArrayList<String> milestones = new ArrayList<String>();// the tags who stay milestones
+		milestones.add("tagUsage");
+		milestones.add("pb");
+		milestones.add("lb");
+		milestones.add("catRef");
+
+		File srcfile = new File(rootDir + "/anainline/", "roland-ana.xml");
+		File cleanfile = new File(rootDir + "/cleaner/", "roland-off.xml");
+
+		System.out.println("clean file " + srcfile);
+		def builder = new InlineCleaner(srcfile.toURL(), cleanfile, milestones);
+		return;
+	}
+
+}
Index: tmp/org.txm.core/src/groovy/org/txm/scripts/teitxm/Annotate.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/teitxm/Annotate.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/teitxm/Annotate.groovy	(revision 258)
@@ -0,0 +1,550 @@
+// 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
+// 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.
+//
+//
+//
+// $LastChangedDate: 2016-10-03 15:30:36 +0200 (Mon, 03 Oct 2016) $
+// $LastChangedRevision: 3313 $
+// $LastChangedBy: mdecorde $
+//
+package org.txm.scripts.teitxm
+
+import java.text.DateFormat
+import java.util.concurrent.*
+
+import org.txm.Toolbox
+import org.txm.importer.*
+import org.txm.importer.cwb.*
+import org.txm.objects.*
+import org.txm.stat.utils.ConsoleProgressBar
+import org.txm.utils.LangDetector
+import org.txm.utils.logger.Log
+import org.txm.utils.treetagger.TreeTagger
+
+// TODO: Auto-generated Javadoc
+/**
+ * Annotate and replace the TEI-TXM files of the folder $rootDirFile/txm with TreeTagger.
+ * creates $rootDirFile/interp and $rootDirFile/treetagger
+ *
+ */
+class Annotate
+{
+	boolean cancelNow = false;
+
+	/** The report file. */
+	File reportFile;//contains the txm:application tag content
+
+	/** The resp person. */
+	String respPerson;
+
+	/** The resp id. */
+	String respId;
+
+	/** The resp desc. */
+	String respDesc;
+
+	/** The resp date. */
+	String respDate;
+
+	/** The resp when. */
+	String respWhen;
+
+	/** The app ident. */
+	String appIdent;
+
+	/** The app version. */
+	String appVersion;
+
+	/** The distributor. */
+	String distributor;
+
+	/** The publi stmt. */
+	String publiStmt;
+
+	/** The source stmt. */
+	String sourceStmt;
+
+	/** The types. */
+	def types;
+
+	/** The types title. */
+	def typesTITLE;
+
+	/** The types desc. */
+	def typesDesc;
+
+	/** The types tagset. */
+	def typesTAGSET;
+
+	/** The types web. */
+	def typesWEB;
+
+	/** The idform. */
+	String idform;
+
+	/** The debug. */
+	boolean debug = false;
+
+	File modelsDirectory;
+	
+	public Annotate() {
+		modelsDirectory = new File(Toolbox.getParam(Toolbox.TREETAGGER_MODELS_PATH)); // default models directory is set in the Toolbox
+	}
+		
+	/**
+	 * Sets the debug.
+	 */
+	public void setDebug() {
+		debug = true;
+	}
+
+	String id;
+	/**
+	 * Inits the tt outfile infos.
+	 *
+	 * @param rootDirFile the root dir file
+	 * @param modelfile the modelfile
+	 */
+	public void initTTOutfileInfos(File rootDirFile, File modelfile, String modelfilename)
+	{
+		initTTOutfileInfos(rootDirFile, modelfile, modelfilename, null);
+	}
+	
+	/**
+	 * Inits the tt outfile infos.
+	 *
+	 * @param rootDirFile the root dir file
+	 * @param modelfile the modelfile
+	 * @param properties : 2 element array that contains the word properties to create. It can be null (the modelfilename will be used)
+	 */
+	public void initTTOutfileInfos(File rootDirFile, File modelfile, String modelfilename, String[] properties)
+	{
+		id = modelfilename;
+		String[] split = id.split("\\.");
+		if (split.length > 0) id = split[0];
+		if (id.equals("??")) id = "xx"
+
+		reportFile = new File(rootDirFile,"NLPToolsParameters.xml");
+
+		respPerson = System.getProperty("user.name");
+		respId = "txm";
+		respDesc = "NLP annotation tool";
+		respDate = DateFormat.getDateInstance(DateFormat.SHORT, Locale.UK).format(new Date());
+		respWhen = DateFormat.getDateInstance(DateFormat.FULL, Locale.UK).format(new Date());
+
+		appIdent = "TreeTagger";
+		appVersion = "3.2";
+
+		distributor = "";
+		publiStmt = """""";
+		sourceStmt = """""";
+
+		if (properties != null && properties.length == 2) {
+			types = [properties[0],properties[1]];
+			typesTITLE = [properties[0],properties[1]];
+		} else {
+			types = [id+"pos",id+"lemma"];
+			typesTITLE = [id+"pos",id+"lemma"];
+		}
+		
+		//TODO: the tagset, website and description should be referenced in the model catalog
+		if(modelfile.getName() == "rgaqcj.par") {
+			typesDesc = ["CATTEX pos tagset built with BFM texts","fr lemma of the model "+modelfile+" - "]
+			typesTAGSET = ["http://bfm.ens-lyon.fr/IMG/pdf/Cattex2009_Manuel.pdf",""]
+			typesWEB = ["http://bfm.ens-lyon.fr/",""]
+		} else {
+			typesDesc = ["pos tagset built from model "+modelfile,id+" lemma of the model "+modelfile+" - "]
+			typesTAGSET = ["",""]
+			typesWEB = ["",""]
+		}
+		
+		idform ="w";
+	}
+
+	/**
+	 * Apply tt.
+	 *
+	 * @param ttsrcfile the ttsrcfile
+	 * @param ttoutfile the ttoutfile
+	 * @param modelfile the modelfile
+	 * @return true, if successful
+	 */
+	public boolean applyTT(File ttsrcfile, File ttoutfile, File modelfile)
+	{
+		applyTT(ttsrcfile, ttoutfile, modelfile, null)
+	}
+	
+	/**
+	 * Apply tt.
+	 *
+	 * @param ttsrcfile the ttsrcfile
+	 * @param ttoutfile the ttoutfile
+	 * @param modelfile the modelfile
+	 * @param options, if null use value set in Toolbox preferences
+	 * @return true, if successful
+	 */
+	public boolean applyTT(File ttsrcfile, File ttoutfile, File modelfile, String[] options)
+	{
+		try {
+			File infile = ttsrcfile;
+			File outfile = ttoutfile;
+
+			// TODO: why org.txm.utils.treetagger.TreeTagger tt = ..., throw IllegalAccessError ???
+			String opt = Toolbox.getParam(Toolbox.TREETAGGER_OPTIONS);
+			if (options == null) {
+				if (opt == null) opt = "";
+				options = opt.split("  ");
+			}
+			
+			def tt = new TreeTagger(Toolbox.getParam(Toolbox.TREETAGGER_INSTALL_PATH)+"/bin/", options);
+			tt.settoken();
+			tt.setlemma();
+			tt.setquiet();
+			tt.setsgml();
+			tt.setnounknown();
+			tt.seteostag("<s>");
+			tt.debug(debug);
+			tt.treetagger(modelfile.getAbsolutePath(), infile.getAbsolutePath(), outfile.getAbsolutePath())
+			infile.delete();
+		} catch(Exception e) {
+			Log.printStackTrace(e);
+			System.out.println("Failed to apply TreeTagger on $f input file with the $modelfile model file.");
+			return false;
+		}
+		return true;
+	}
+
+	/**
+	 * Write standoff file.
+	 *
+	 * @param ttoutfile the ttoutfile
+	 * @param posfile the posfile
+	 * @return true, if successful
+	 */
+	public boolean writeStandoffFile(File ttoutfile, File posfile)
+	{
+		def encoding ="UTF-8";
+		def transfo = new CSV2W_ANA();
+		//println("build w-interp "+ttfile.getName()+ ">>"+posfile.getName())
+		transfo.setAnnotationTypes( types, typesDesc, typesTAGSET, typesWEB, idform);
+		transfo.setResp(respId, respDesc, respDate, respPerson, respWhen);
+		transfo.setApp(appIdent, appVersion);
+		transfo.setTarget(ttoutfile.getAbsolutePath(), reportFile);
+		transfo.setInfos(distributor,  publiStmt, sourceStmt);
+		return transfo.process( ttoutfile, posfile, encoding );
+	}
+
+	/**
+	 * Run step by step : build TT src files, run TT, build xml-standoff files, inject standoff annotations
+	 *
+	 * @param rootDirFile the root dir file
+	 * @param modelfilename the modelfilename
+	 * @return true, if successful
+	 */
+	public boolean run(File binDir, File txmDir,  String modelfilename)
+	{
+		//test if modelfile exists
+		if (debug) {
+			println "rootDirFile "+binDir
+			println "txmDir "+txmDir
+			println "TREETAGGER INSTALL PATH : "+Toolbox.getParam(Toolbox.TREETAGGER_INSTALL_PATH)
+			println "TREETAGGER MODELS PATH : "+Toolbox.getParam(Toolbox.TREETAGGER_MODELS_PATH)
+		}
+
+		//test if the Toolbox know TreeTagger
+		if (!new File(Toolbox.getParam(Toolbox.TREETAGGER_INSTALL_PATH)+"/bin/").exists()) {
+			println("Could not find TreeTagger binaries in "+Toolbox.getParam(Toolbox.TREETAGGER_INSTALL_PATH)+"/bin/")
+			return false;
+		}
+		String langAll = null
+		String lang;
+		if (modelfilename.startsWith("??")) {
+			langAll = new LangDetector(binDir).getLang();
+			println "General lang $langAll"
+		}
+
+		//cleaning
+		new File(binDir, "annotations").deleteDir();
+		new File(binDir, "annotations").mkdir();
+		new File(binDir, "treetagger").deleteDir();
+		new File(binDir, "treetagger").mkdir();
+
+		ArrayList<String> milestones = [];
+
+		//BUILD TT FILE READY TO BE TAGGED
+		//println "Re "+Toolbox.getParam(Toolbox.TREETAGGER_APOSTROPHE)
+		List<File> files = txmDir.listFiles()
+
+		println("Building TT source files ("+files.size()+") from directory "+txmDir)
+		ConsoleProgressBar cpb = new ConsoleProgressBar(files.size())
+		for (File f : files) {
+			cpb.tick()
+			File srcfile = f;
+			File resultfile = new File(binDir, "treetagger/"+f.getName()+".tt");
+			if(debug)
+				println "build tt src : "+srcfile+" >> "+resultfile
+			def ttsrcbuilder = new BuildTTSrc(srcfile.toURI().toURL())
+			if (!ttsrcbuilder.process(resultfile, null))
+				System.out.println("Failed to build tt src file of "+srcfile);
+		}
+
+		if (cancelNow) return;
+
+		File modelDirectory = new File(Toolbox.getParam(Toolbox.TREETAGGER_MODELS_PATH));
+		if (!modelDirectory.exists()) {
+			println "Skipping ANNOTATE: TreeTagger language model file directory not found: "+modelDirectory.getAbsolutePath();
+			return false;
+		} else 	if (!modelDirectory.canRead()) {
+			println "Skipping ANNOTATE: impossible to access the TreeTagger language model file directory: "+modelDirectory.getAbsolutePath();
+			return false;
+		}
+		println("")
+		//Convert encoding if needed
+
+		//APPLY TREETAGGER
+		files = new File(binDir, "treetagger").listFiles()
+		println("Applying $modelfilename TreeTagger model on dir: "+new File(binDir, "treetagger")+ " ("+files.size()+" files)")
+		if (files == null || files.size() == 0)
+			return false;
+		File modelfile;
+		cpb = new ConsoleProgressBar(files.size())
+		for (File f : files) {
+			String tmpModelFileName = modelfilename
+			if (modelfilename.startsWith("??")) {
+				lang = langAll;
+				if (f.length() > LangDetector.MINIMALSIZE) {
+					lang = new LangDetector(f).getLang();
+					//println "guessing lang $f : $lang"
+				}
+				tmpModelFileName = lang+".par"
+			}
+			modelfile = new File(modelsDirectory, tmpModelFileName);
+			if (debug)
+				println "model file : "+modelfile;
+
+			File
+
+			if (!modelfile.exists()) {
+				println "Skipping ANNOTATE: '$modelfile' TreeTagger language model file not found."
+				if(System.getProperty("os.name").startsWith("Windows") || System.getProperty("os.name").startsWith("Mac"))
+					println "Windows&Mac users: the operating system might be hiding file extensions. Use your file explorer to check the file name."
+				return false;
+			} else if (!modelfile.canRead()) {
+				println "Skipping ANNOTATE: impossible to access the '$modelfile' TreeTagger language model file."
+				return false;
+			}
+
+			//			if (modelfile.getName().equals("sp.par")) {//UTF >> Latin1
+			//				if(debug)
+			//					println "fix encoding for model "+modelfile
+			//				new EncodingConverter(f, "UTF-8", "ISO-8859-1")
+			//			}
+
+			cpb.tick()
+			File infile = f;
+			File outfile = new File(f.getParent(),f.getName()+"-out.tt");
+			if (!applyTT(infile, outfile, modelfile)) {
+				return false;
+			}
+
+			//			//Reconvert encoding if needed
+			//			if (modelfile.getName().equals("sp.par")) {
+			//				if(debug)
+			//					println "convert "+f+" latin1 >> UTF-8"
+			//				new EncodingConverter(f, "ISO-8859-1", "UTF-8")
+			//			}
+		}
+		println("")
+
+		if (cancelNow) return;
+
+		//BUILD STAND-OFF FILES
+		if (modelfile == null) {
+			println "no model applied"
+			return false;
+		}
+
+		initTTOutfileInfos(binDir, modelfile, modelfilename);
+		files = new File(binDir, "treetagger").listFiles()// now contains the result files of TT
+		println "Building stdoff files ("+files.size()+") from dir:"+new File(binDir, "treetagger")+" to "+new File(binDir, "annotations");
+		if (files == null || files.size() == 0)
+			return false;
+		cpb = new ConsoleProgressBar(files.size())
+		for (File ttrezfile : files) {
+			cpb.tick()
+			File annotfile = new File(binDir, "annotations/"+ttrezfile.getName()+"-STOFF.xml");
+			if (!writeStandoffFile(ttrezfile, annotfile))
+				println("Failed to build standoff file of "+ttrezfile);
+		}
+		println("")
+
+		if (cancelNow) return;
+
+		//INJECT ANNOTATIONS
+		List<File> interpfiles = new File(binDir, "annotations").listFiles();
+		List<File> txmfiles = txmDir.listFiles();
+		if (txmfiles == null) {
+			println "No file to annotate in "+txmDir.getAbsolutePath()
+			return false;
+		}
+		interpfiles.sort(); // same order
+		txmfiles.sort(); //same order
+		println "Injecting stdoff files ("+interpfiles.size()+") data from "+new File(binDir, "annotations")+ " to xml-txm files of "+txmDir;
+		if (interpfiles == null || interpfiles.size() == 0)
+			return false;
+		cpb = new ConsoleProgressBar(interpfiles.size())
+		for (int i = 0 ; i < interpfiles.size() ; i++) {
+			cpb.tick()
+			File srcfile = txmfiles.get(i);
+			File pos1file = interpfiles.get(i);
+			File temp = File.createTempFile("Annotate", "temp", srcfile.getParentFile());
+			def builder = new AnnotationInjection(srcfile.toURI().toURL(), pos1file.toURI().toURL());
+			if (!builder.process(temp)) {
+				return false;
+			}
+			builder = null;
+
+			//println "renaming files..."
+			if (!(srcfile.delete() && temp.renameTo(srcfile)))
+				println "Warning can't rename file "+temp+" to "+srcfile
+		}
+		println("")
+		return true;
+	}
+	
+	public void setModelsDirectory(File modelsDirectory) {
+		this.modelsDirectory = modelsDirectory;
+	}
+
+	/**
+	 * Run file by file. Allow to have one different lang per file. Default behavior add new word properties
+	 *
+	 * @param binDir
+	 * @param txmDir
+	 * @param lang associate a file name with a model filename
+	 * @return true, if successful
+	 */
+	public boolean run(File binDir, File txmDir, HashMap<String, String> langs)
+	{
+		return run(binDir, txmDir, langs, false, new String[0], new String[0]);
+	}
+	
+	/**
+	 * Run file by file. Allow to have one different lang per file
+	 *
+	 * @param binDir 
+	 * @param txmDir
+	 * @param lang associate a file name with a model filename
+	 * @param replace, replace or create a word property
+	 * @return true, if successful
+	 */
+	public boolean run(File binDir, File txmDir, HashMap<String, String> langs, boolean replace, String[] properties, String[] options)
+	{
+		if (!new File(Toolbox.getParam(Toolbox.TREETAGGER_INSTALL_PATH)+"/bin/").exists()) {
+			println("Path to TreeTagger is wrong "+Toolbox.getParam(Toolbox.TREETAGGER_INSTALL_PATH)+"/bin/")
+			return true;
+		}
+
+		List<File> listfiles = txmDir.listFiles();
+
+		//cleaning
+		File annotDir = new File(binDir,"annotations");
+		annotDir.deleteDir();
+		annotDir.mkdir();
+		File ptreetaggerDir = new File(binDir,"ptreetagger");
+		ptreetaggerDir.deleteDir();
+		ptreetaggerDir.mkdir();
+		File treetaggerDir = new File(binDir,"treetagger");
+		treetaggerDir.deleteDir();
+		treetaggerDir.mkdir();
+
+		int cores = Runtime.getRuntime().availableProcessors()
+		int coresToUse = Math.max(1.0, cores * 0.7)
+		ExecutorService pool = Executors.newFixedThreadPool(coresToUse)
+
+		def files = txmDir.listFiles()
+		ConsoleProgressBar cpb = new ConsoleProgressBar(files.size())
+		for (File teiFile : files) {
+			int counter = 1;
+			ThreadFile t = new ThreadFile("TT_"+counter++, teiFile) {
+
+						public void run() {
+
+							if (cancelNow) return;
+
+							if (langs.get(f.getName()) == null) {
+								println "Error: no lang defined for file $f"
+								return;
+							}
+
+							String model = langs.get(f.getName());
+							File modelfile = new File(modelsDirectory, model+".par");
+							if (!modelfile.exists()) {
+								println "Error: No Modelfile available for lang "+modelfile+". Continue import process ";
+								return;
+							}
+							File annotfile = new File(annotDir, f.getName()+"-STDOFF.xml");
+							File ttsrcfile = new File(ptreetaggerDir, f.getName()+"-src.tt");
+							File ttrezfile = new File(treetaggerDir, f.getName()+"-out.tt");
+							//println ("TT with $model "+f+"+"+annotfile+" > "+ttsrcfile+" > "+ttrezfile);
+
+							//BUILD TT FILE READY TO BE TAGGED
+							def builder = new BuildTTSrc(f.toURL());
+							builder.process(ttsrcfile, null);
+
+							//Apply TT
+							applyTT(ttsrcfile, ttrezfile, modelfile, options);
+
+							//CREATE STANDOFF FILES
+							initTTOutfileInfos(binDir, modelfile, model, properties);
+							writeStandoffFile(ttrezfile, annotfile)
+
+							//INJECT ANNOTATIONS
+							File tmpFile = new File(txmDir, "temp_"+f.getName())
+							builder = new AnnotationInjection(f.toURL(), annotfile.toURL(), replace);
+							builder.process(tmpFile);
+							if (!(f.delete() && tmpFile.renameTo(f))) println "Warning can't rename file "+tmpFile+" to "+f
+
+							cpb.tick();
+						}
+					};
+
+			pool.execute(t)
+		}
+
+		pool.shutdown()
+		pool.awaitTermination(10, TimeUnit.HOURS)
+		println ""
+		return true;
+	}
+
+	public void setCancelNow() {
+		cancelNow = true;
+	}
+
+	public class ThreadFile extends Thread {
+		File f;
+		public ThreadFile(String name, File f) {
+			this.setName(name)
+			this.f = f;
+		}
+	}
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/scripts/teitxm/AnnotationInjectionFromTTOutput.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/teitxm/AnnotationInjectionFromTTOutput.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/teitxm/AnnotationInjectionFromTTOutput.groovy	(revision 258)
@@ -0,0 +1,358 @@
+// 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
+// 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.
+//
+//
+//
+// $LastChangedDate: 2016-03-02 14:17:06 +0100 (mer., 02 mars 2016) $
+// $LastChangedRevision: 3134 $
+// $LastChangedBy: mdecorde $
+//
+package org.txm.scripts.teitxm;
+import javax.xml.stream.*
+
+import org.txm.importer.StaxIdentityParser
+import org.txm.importer.filters.*
+import org.txm.importer.graal.PersonalNamespaceContext
+// TODO: Auto-generated Javadoc
+/**
+ * The Class AnnotationInjection.
+ *
+ * @author mdecorde
+ * 
+ * inject annotation from a stand-off file into a xml-tei-txm
+ * file
+ */
+
+public class AnnotationInjectionFromTTOutput extends StaxIdentityParser {
+
+	public static String TXMNS = "http://textometrie.org/1.0"
+
+	/** The xml reader factory. */
+	private def factory;
+
+	/** The links. */
+	private List<String> links;
+
+	/** The linkparsers. key=type*/
+	private HashMap<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.
+	 *
+	 * @param url the xml-tei-txm file
+	 * @param anaurl the stand-off file
+	 */
+	public AnnotationInjectionFromTTOutput(URL url, URL anaurl) {
+		super(url); // init reader and writer
+		try {
+			this.anaurl = anaurl;
+			factory = XMLInputFactory.newInstance();
+			this.buildLinkParsers();// build a parser per linkgroup
+		} catch (XMLStreamException ex) {
+			System.out.println(ex);
+		} catch (IOException ex) {
+			System.out.println("IOException while parsing ");
+		}
+	}
+
+	private void getHeaderInfos(String containertag, boolean captureTheTag)
+	{
+		anainputData = new BufferedInputStream(anaurl.openStream());
+		headerparser = anafactory.createXMLStreamReader(anainputData);
+		boolean start = false;
+		String localname;
+		for (int event = headerparser.next(); event != XMLStreamConstants.END_DOCUMENT; event = headerparser.next())
+		{
+			//String prefix = headerparser.getNamespaceURI();
+			if (event == XMLStreamConstants.START_ELEMENT) {
+				localname = headerparser.getLocalName();
+				if (captureTheTag && localname == containertag) // start copy  after the tag
+					start = true;
+				if (start) { // copy header
+					String prefix = headerparser.getPrefix();
+					if (prefix.length() > 0)
+						writer.writeStartElement(Nscontext.getNamespaceURI(prefix), localname)
+					else
+						writer.writeStartElement(localname);
+					for (int i = 0 ; i < headerparser.getNamespaceCount(); i++)
+						writer.writeNamespace(headerparser.getNamespacePrefix(i), headerparser.getNamespaceURI(i));
+					for (int i = 0 ; i < headerparser.getAttributeCount(); i++)
+						writer.writeAttribute(headerparser.getAttributeLocalName(i), headerparser.getAttributeValue(i));
+				}
+				if (!captureTheTag && localname == containertag) // start copy  after the tag
+					start = true;
+			} else if (event == XMLStreamConstants.END_ELEMENT) {
+				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) {
+				if (start)
+					writer.writeCharacters(headerparser.getText());
+			} else if (event == XMLStreamConstants.COMMENT) {
+				if (start)
+					writer.writeComment(headerparser.getText());
+			}
+		}
+		headerparser.close();
+	}
+
+	/**
+	 * find all refs.
+	 *
+	 * @return the list of link parser
+	 */
+	private List<String> findGrpLink()
+	{
+		ArrayList<String> links = new ArrayList<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().matches("linkGrp")) {
+					String targetsvalue = 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 {
+						links.add(targetsvalue); // add the taxonomy type
+					}
+				} else if (anaparser.getLocalName().matches("respStmt")) {
+					respStmtID = anaparser.getAttributeValue(0); // one attribute (id) only
+				}
+			}
+		}
+		anaparser.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
+	 */
+	private void buildLinkParsers()
+	{
+		// link group of the standoff file
+		links = findGrpLink();
+		linkparsers = new HashMap<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)
+						if (targetsvalue.equals(link))
+							break; // next element is a link start tag
+					}
+				}
+			}
+		}
+	}
+
+	/**
+	 * get the next tei:link value of a tei:LinkGrp.
+	 *
+	 * @param link the link
+	 * @return the next ana
+	 */
+	private String getNextAnaValue(String link, String wordId)
+	{
+		anaparser = linkparsers.get(link);
+		def m;
+		for (int event = anaparser.next(); event != XMLStreamConstants.END_DOCUMENT; event = anaparser.next()) {
+			if (event == XMLStreamConstants.START_ELEMENT) {
+				if (anaparser.getLocalName().matches("link")) {
+					String targetsvalue = anaparser.getAttributeValue(0)
+					if ((m = targetsvalue =~ /#(.*) #(.*)/)) { // balise externe
+						def g1 = m[0][1];
+						def g2 = m[0][2];
+
+						String anavalue = g2;
+						anavalue = anavalue.replace("&lt;", "<")
+						return anavalue;
+					} else {
+						System.err.println("Error: getNextAna(): link target is not well formed:  = "+anaparser.getAttributeValue(0));
+					}
+				}
+			}
+		}
+		return "";
+	}
+
+	/**
+	 * build the ana tags of a word.
+	 *
+	 * @param wordId the word id
+	 * @return the ana tag
+	 */
+	private void writeAnaTag(String wordId)
+	{
+		String anabalises ="\n";
+		for (String link : links) {
+			writer.writeStartElement(TXMNS, "ana");
+			writer.writeAttribute("resp", "#"+respStmtID);
+			writer.writeAttribute("type", "#"+link);
+			writer.writeCharacters(getNextAnaValue(link, wordId));
+			writer.writeEndElement(); // txm:ana
+		}
+	}
+
+	String wordId;
+	boolean flagSourceDesc = false;
+	protected void processStartElement()
+	{
+		if (parser.getLocalName().matches("taxonomy")) {
+			String taxo = parser.getAttributeValue(0) // taxonomy type
+			presentTaxonomies.add(taxo);
+		}
+
+		for (int i= 0 ; i < parser.getAttributeCount() ;i++ ) {
+			if (parser.getAttributeLocalName(i) == "id") {
+				wordId = parser.getAttributeValue(i);
+				break
+			}
+		}
+		super.processStartElement();
+	}
+
+	boolean applicationWritten = false;
+	boolean taxonomiesWritten = false;
+	protected void processEndElement() {
+		switch (parser.getLocalName()) {
+			case "w":
+				writeAnaTag(wordId);
+				break;
+
+			case "appInfo":
+				applicationWritten = true;
+				getHeaderInfos("appInfo", false);
+				break;
+
+			case "classDecl":
+				taxonomiesWritten = true;
+				getHeaderInfos("classDecl", false);
+				break;
+
+			case "encodingDesc":
+				if (!applicationWritten) {
+					writer.writeStartElement("appInfo");
+					getHeaderInfos("appInfo", false);
+					writer.writeEndElement(); // appInfo
+				}
+				if (!taxonomiesWritten) {
+					writer.writeStartElement("classDecl");
+					getHeaderInfos("classDecl", false);
+					writer.writeEndElement(); // classDecl
+				}
+				break;
+				
+			case "titleStmt":
+				if (flagSourceDesc) {
+					//output.write(this.respStmt+"\n")
+					getHeaderInfos("respStmt", true);
+					flagSourceDesc = false;
+					break;
+				}
+				break;
+		}
+		super.processEndElement();
+	}
+
+	/** The declarenamespace. */
+	boolean declarenamespace = false;
+
+	/**
+	 * Declare namespace.
+	 *
+	 * @return the java.lang. object
+	 */
+	private declareNamespace() {
+		if (!declarenamespace) {
+			writer.writeDefaultNamespace("http://www.tei-c.org/ns/1.0");
+			writer.writeNamespace("txm", TXMNS);
+			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
+
+		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 AnnotationInjectionFromTTOutput(srcfile.toURI().toURL(),
+				pos1file.toURI().toURL(), milestones);
+		builder.transfomFile(new File(rootDir + "/injection/", "roland.xml"));
+
+		println("process file : " + src2file + " with : " + pos1file);
+		builder = new AnnotationInjectionFromTTOutput(src2file.toURI().toURL(), pos2file.toURI().toURL(),
+				milestones);
+		builder.transfomFile(rootDir + "/injection/", "roland-FINAL.xml");
+
+		return;
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/scripts/teitxm/package.html
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/teitxm/package.html	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/teitxm/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Manages xml-tei-txm files</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/org/txm/scripts/teitxm/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/scripts/teitxm/AnnotationExtraction.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/teitxm/AnnotationExtraction.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/teitxm/AnnotationExtraction.groovy	(revision 258)
@@ -0,0 +1,358 @@
+// 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
+// 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.
+//
+//
+//
+// $LastChangedDate: 2017-01-24 18:11:42 +0100 (Tue, 24 Jan 2017) $
+// $LastChangedRevision: 3400 $
+// $LastChangedBy: mdecorde $
+//
+package org.txm.scripts.teitxm;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import javax.xml.stream.*;
+import java.net.URL;
+import org.txm.importer.filters.*;
+// TODO: Auto-generated Javadoc
+
+/**
+ * The Class AnnotationExtraction.
+ *
+ * @author mdecorde
+ * 
+ * Extract ana tags from a xml-tei-txm file
+ * saved into a stand-off file
+ */
+public class AnnotationExtraction
+{
+	/** The input data. */
+	private def inputData;
+
+	/** The factory. */
+	private def factory;
+
+	/** The parser. */
+	private XMLStreamReader parser;
+
+	/** The dir. */
+	private def dir;
+
+	/** The writer. */
+	private Writer writer;
+
+	/** The url. */
+	private def url;
+
+	/** The posfile. */
+	private def posfile;
+
+	/** The anafile. */
+	private def anafile;
+
+	/** The encoding. */
+	private def encoding;
+
+	/** The extract types. */
+	private List<String> extractTypes;
+
+	/** The resp stmt. */
+	private String respStmt;
+
+	/** The solotags. */
+	ArrayList<String> solotags;
+
+	/**
+	 * initialize.
+	 *
+	 * @param anafile the path to the xml-tei-txm file
+	 * @param posfile the output stand-off file
+	 * @param encoding the encoding of the xml-tei-txm file
+	 * @param milestones milestones tags (temporary)
+	 */
+	public AnnotationExtraction(File anafile, File posfile,String encoding,milestones) {
+		this.url = anafile.toURI().toURL();
+		this.posfile = posfile;
+		this.encoding = encoding;
+		this.solotags = milestones;
+
+		inputData = url.openStream();
+		factory = XMLInputFactory.newInstance();
+	}
+
+	/**
+	 * process !!!.
+	 */
+	public void process() {
+		assert(extractTypes != null);
+		if (this.createOutput(posfile,encoding)) {
+			this.writeHead();
+			this.writeBody( posfile, encoding);
+			this.writeTail();
+		}
+		writer.close();
+	}
+
+	/**
+	 * Creates the output.
+	 *
+	 * @param outfile the outfile
+	 * @param encoding the encoding
+	 * @return true, if successful
+	 */
+	private boolean createOutput(File outfile, String encoding){
+		try {
+			writer = new OutputStreamWriter(new FileOutputStream(outfile) , "UTF-8");
+			return true;
+		} catch (Exception e) {
+			System.out.println(e.getLocalizedMessage());
+			return false;
+		}
+	}
+
+	/**
+	 * set the respStmt tag of the stand-off file by reading the respstmt of the xml-tei-txm file.
+	 */
+	private void setResp()
+	{
+		this.respStmt = "";
+		boolean begincapture = false;
+		String lastopenlocalname= "";
+
+		inputData = url.openStream();
+		parser = factory.createXMLStreamReader(inputData);
+
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next())
+		{
+			String prefix = parser.getPrefix();
+			if (prefix == null || prefix == "")
+				prefix = "";
+			else
+				prefix +=":";
+			if (event == XMLStreamConstants.START_ELEMENT) {
+				if (parser.getLocalName().matches("resp")) {
+					String id = parser.getAttributeValue("xml","id")
+					if (id == null)
+						id = parser.getAttributeValue(null,"id")
+					if (extractTypes.contains(id)) {
+						this.respStmt = "<respStmt>\n";
+						begincapture= true;
+					}
+				}
+				if (begincapture) {
+					lastopenlocalname = parser.getLocalName();
+					respStmt += ("\n<"+prefix+parser.getLocalName());
+					for (int i= 0 ; i < parser.getAttributeCount() ;i++ )
+						respStmt += (" "+parser.getAttributeLocalName(i)+"=\""+parser.getAttributeValue(i)+"\"" );
+					if (solotags.contains(lastopenlocalname))
+						respStmt += ("/>");
+					else
+						respStmt += (">");
+				}
+			}
+			else if (event == XMLStreamConstants.END_ELEMENT) {
+				if (parser.getLocalName().matches("respStmt")) {
+					begincapture= false;
+					this.respStmt += "\n</respStmt>"
+					System.out.println(this.respStmt);
+					parser.close();
+					return;
+				} else {
+					if (!solotags.contains(parser.getLocalName()))
+						if (lastopenlocalname.equals(parser.getLocalName()))
+							respStmt += ("</"+prefix+parser.getLocalName()+">");
+						else
+							respStmt += ("\n</"+prefix+parser.getLocalName()+">");
+				}
+			} else if (event == XMLStreamConstants.CHARACTERS) {
+				String txt = parser.getText().trim();
+				respStmt += txt;
+			}
+		}
+	}
+
+	/**
+	 * write the header of the stand-off ile.
+	 */
+	private void writeHead() {
+		this.setResp();
+
+		writer.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
+		writer.write("<!DOCTYPE TEI SYSTEM \"tei_bfm_v1.dtd\">\n");
+		writer.write("<TEI xmlns:txm=\"http://textometrie.ens-lyon.fr/1.0\">\n");
+		writer.write("<teiHeader xml:lang=\"eng\">\n");
+		writer.write("<fileDesc>\n");
+		writer.write("<titleStmt>\n");
+		for (int i=0;i < extractTypes.size(); i++)
+			writer.write("<title>"+extractTypes[i]+"</title>\n");
+		writer.write(this.respStmt+"\n");
+		writer.write("</titleStmt>\n");
+		writer.write("<publicationStmt>\n");
+		writer.write("<distributor>BFM project - http://bfm.ens-lsh.fr</distributor>\n");
+		writer.write("<availability>\n");
+		writer.write("<p>(c) 2010 Projet BFM - CNRS/ENS-LSH.\n");
+		writer.write("<hi>Conditions d'utilisation</hi> : \n");
+		writer.write("Sous licence <ref target=\"http://creativecommons.org/licenses/by-sa/2.0/fr/\">Creative Commons</ref>.\n");
+		writer.write("</p>\n");
+		writer.write("</availability>\n");
+		writer.write("</publicationStmt>\n");
+		writer.write("<sourceDesc>\n");
+		writer.write("<p>born digital : TXM project - http://textometrie.org</p>\n");
+		writer.write("</sourceDesc>\n");
+		writer.write("</fileDesc>\n");
+		writer.write("</teiHeader>\n");
+		writer.write("<text xml:lang=\"fr\" type=\"standoff\">\n");
+		writer.write("<body>\n");
+		writer.write("<div>\n");
+	}
+
+	/**
+	 * write the group of ana tags with the attribute type = type.
+	 *
+	 * @param type the type
+	 */
+	private void writeGroup(String type)
+	{
+		System.out.println("write group : "+type);
+		inputData = url.openStream();
+		factory = XMLInputFactory.newInstance();
+		parser = factory.createXMLStreamReader(inputData);
+
+		boolean flagAna = false;
+		boolean flagForm = false;
+		boolean flagW = false;
+		String wordid="";
+		String vAna="";
+		String currentType;
+
+		writer.write("<linkGrp type=\""+type+"\">\n")
+
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next())
+		{
+			switch (event) {
+				case XMLStreamConstants.START_ELEMENT:
+					switch (parser.getLocalName()) {
+						case "w":
+						wordid = parser.getAttributeValue(null,"id");
+						flagW = true;
+						break;
+						case "ana":
+						if (flagW) {
+							currentType = (parser.getAttributeValue(null,"type"));
+							if (currentType.matches(type)) {
+								flagAna = true;
+								vAna ="";
+							}
+						}
+						break;
+					}
+					break;
+
+				case XMLStreamConstants.END_ELEMENT:
+					switch (parser.getLocalName()) {
+						case "w":
+						flagW = false;
+						break;
+
+						case "ana":
+						if (flagW) {
+							writer.write("<link targets=\"#"+wordid+" #"+vAna+"\"/>\n")
+							flagAna = false;
+						}
+						break;
+					}
+					break;
+
+				case XMLStreamConstants.CHARACTERS:
+					if (flagAna)
+						vAna += parser.getText().trim();//catch interp text
+					break;
+			}
+		}
+		writer.write("</linkGrp>\n");
+		parser.close();
+		inputData.close();
+	}
+
+	/**
+	 * write a group per ana type to extract from the anafile.
+	 *
+	 * @param TTrez the t trez
+	 * @param encoding the encoding
+	 * @return the java.lang. object
+	 */
+	private writeBody(File TTrez, String encoding)
+	{
+		for (String type : extractTypes) {
+			writeGroup(type);
+		}
+	}
+
+	/**
+	 * write the tail of the stand-off file = close body, text and TEI tags.
+	 */
+	private void writeTail()
+	{
+		writer.write("</div>\n");
+		writer.write("</body>\n");
+		writer.write("</text>\n");
+		writer.write("</TEI>\n");
+	}
+
+	/**
+	 * define the types to extract.
+	 *
+	 * @param types the new types to extract
+	 */
+	public void setTypesToExtract(List<String> types)
+	{
+		extractTypes = types;
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args) {
+
+		String rootDir = "~/xml/rgaqcj/"
+		new File(rootDir+"/extract/").mkdir()
+
+		File anafile = new File(rootDir+"/injection/","roland-ana.xml")
+		File posfile =  new File(rootDir+"/extract/","roland-pos.xml")
+		String encoding = "UTF-8"
+		//extrait les txm:ana dont la ref est dans cette liste
+		List<String> types = ["#t1","#POS"]
+
+		ArrayList<String> milestones = new ArrayList<String>()
+		//the tags you want to keep as milestones
+		milestones.add("tagUsage")
+		milestones.add("pb")
+		milestones.add("lb")
+		milestones.add("catRef")
+
+		AnnotationExtraction builder = new AnnotationExtraction(anafile,posfile,encoding,milestones)
+		builder.setTypesToExtract(types)
+		builder.process()
+		return
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/scripts/teitxm/AnnotationInjection.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/teitxm/AnnotationInjection.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/teitxm/AnnotationInjection.groovy	(revision 258)
@@ -0,0 +1,414 @@
+// 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
+// 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.
+//
+//
+//
+// $LastChangedDate: 2016-03-29 09:51:35 +0200 (Tue, 29 Mar 2016) $
+// $LastChangedRevision: 3185 $
+// $LastChangedBy: mdecorde $
+//
+package org.txm.scripts.teitxm;
+import javax.xml.stream.*
+
+import org.txm.importer.StaxIdentityParser
+import org.txm.importer.filters.*
+import org.txm.importer.graal.PersonalNamespaceContext
+// TODO: Auto-generated Javadoc
+/**
+ * The Class AnnotationInjection.
+ *
+ * @author mdecorde
+ * 
+ * inject annotation from a stand-off file into a xml-tei-txm
+ * file
+ */
+
+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;
+	boolean replace
+
+	/** 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.
+	 *
+	 * @param url the xml-tei-txm file
+	 * @param anaurl the stand-off file
+	 */
+	public AnnotationInjection(URL url, URL anaurl) {
+		this(url, anaurl, false)
+	}
+
+	/**
+	 * Instantiates a new annotation injection.
+	 *
+	 * @param url the xml-tei-txm file
+	 * @param anaurl the stand-off file
+	 */
+	public AnnotationInjection(URL url, URL anaurl, boolean replace) {
+		super(url); // init reader and writer
+		try {
+			this.anaurl = anaurl;
+			this.replace = replace
+			factory = XMLInputFactory.newInstance();
+			this.buildLinkParsers();// build a parser per linkgroup
+		} catch (XMLStreamException ex) {
+			System.out.println(ex);
+		} catch (IOException ex) {
+			System.out.println("IOException while parsing ");
+		}
+	}
+
+	private void getHeaderInfos(String containertag, boolean captureTheTag)
+	{
+		anainputData = new BufferedInputStream(anaurl.openStream());
+		headerparser = anafactory.createXMLStreamReader(anainputData);
+		boolean start = false;
+		String localname;
+		for (int event = headerparser.next(); event != XMLStreamConstants.END_DOCUMENT; event = headerparser.next())
+		{
+			//String prefix = headerparser.getNamespaceURI();
+			if (event == XMLStreamConstants.START_ELEMENT) {
+				localname = headerparser.getLocalName();
+				if (captureTheTag && localname == containertag) // start copy  after the tag
+					start = true;
+				if (start) { // copy header
+					String prefix = headerparser.getPrefix();
+					if (prefix.length() > 0)
+						writer.writeStartElement(Nscontext.getNamespaceURI(prefix), localname)
+					else
+						writer.writeStartElement(localname);
+					for (int i = 0 ; i < headerparser.getNamespaceCount(); i++)
+						writer.writeNamespace(headerparser.getNamespacePrefix(i), headerparser.getNamespaceURI(i));
+					for (int i = 0 ; i < headerparser.getAttributeCount(); i++)
+						writer.writeAttribute(headerparser.getAttributeLocalName(i), headerparser.getAttributeValue(i));
+				}
+				if (!captureTheTag && localname == containertag) // start copy  after the tag
+					start = true;
+			} else if (event == XMLStreamConstants.END_ELEMENT) {
+				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) {
+				if (start)
+					writer.writeCharacters(headerparser.getText());
+			} else if (event == XMLStreamConstants.COMMENT) {
+				if (start)
+					writer.writeComment(headerparser.getText());
+			}
+		}
+		headerparser.close();
+	}
+
+	/**
+	 * find all refs.
+	 *
+	 * @return the list of link parser
+	 */
+	private LinkedHashSet<String> findGrpLink()
+	{
+		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)
+
+					if (links.contains(targetsvalue)) {
+						System.err.println("Warning: Multiple group declaration : "+targetsvalue+" has already been added, the first one will be used")
+					} else {
+						links.add(targetsvalue); // add the taxonomy type
+					}
+				} else if (anaparser.getLocalName().equals("respStmt")) {
+					respStmtID = anaparser.getAttributeValue(0); // one attribute (id) only
+				}
+			}
+		}
+		anaparser.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
+	 */
+	private void buildLinkParsers()
+	{
+		// 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)
+						if (targetsvalue.equals(link))
+							break; // next element is a link start tag
+					}
+				}
+			}
+		}
+	}
+
+	/**
+	 * get the next tei:link value of a tei:LinkGrp.
+	 *
+	 * @param link the link
+	 * @return the next ana
+	 */
+	private String getNextAnaValue(String link, String wordId)
+	{
+		anaparser = linkparsers.get(link);
+		def m;
+		for (int event = anaparser.next(); event != XMLStreamConstants.END_DOCUMENT; event = anaparser.next()) {
+			if (event == XMLStreamConstants.START_ELEMENT) {
+				if (anaparser.getLocalName().equals("link")) {
+					String targetsvalue = anaparser.getAttributeValue(0)
+					if ((m = targetsvalue =~ /#(.*) #(.*)/)) { // balise externe
+						def g1 = m[0][1];
+						def g2 = m[0][2];
+
+						String anavalue = g2;
+						anavalue = anavalue.replace("&lt;", "<")
+						return anavalue;
+					} else {
+						System.err.println("Error: getNextAna(): link target is not well formed:  = "+anaparser.getAttributeValue(0));
+					}
+				}
+			}
+		}
+		return "";
+	}
+
+	/**
+	 * build the ana tags of a word.
+	 *
+	 * @param wordId the word id
+	 * @return the ana tag
+	 */
+	private void writeAnaTag(String wordId)
+	{
+		String anabalises ="\n";
+		for (String link : links) {
+			writer.writeStartElement(TXMNS, "ana");
+			writer.writeAttribute("resp", "#"+respStmtID);
+			writer.writeAttribute("type", "#"+link);
+			if (replace) {
+				if (linkparsers.containsKey(link)) { // order is important
+					writer.writeCharacters(getNextAnaValue(link, wordId));
+				} else {
+					writer.writeCharacters(anaValues.get(link));
+				}
+			} else { // ok no problem
+				writer.writeCharacters(getNextAnaValue(link, wordId));
+			}
+			
+			writer.writeEndElement(); // txm:ana
+		}
+	}
+
+	String wordId;
+	HashMap<String, String> anaValues = new HashMap<String, String>();
+	boolean flagSourceDesc = false, flagW = false, flagAna = false;
+	String type = null, resp = null, anaValue= "";
+	protected void processStartElement()
+	{
+		if (localname.equals("taxonomy")) {
+			String taxo = parser.getAttributeValue(0) // taxonomy type
+			presentTaxonomies.add(taxo);
+		} else if (flagW && replace && localname.equals("ana")) {
+			flagAna = true
+			anaValue= ""
+			type = null
+			resp = null
+			for (int i= 0 ; i < parser.getAttributeCount() ; i++ ) {
+				if (parser.getAttributeLocalName(i) == "resp") {
+					resp = parser.getAttributeValue(i);
+				} else if (parser.getAttributeLocalName(i) == "type") {
+					type = parser.getAttributeValue(i);
+				}
+			}
+			if (type != null) type = type.substring(1);
+			if (resp != null) resp = resp.substring(1);
+			return; // don't write the "ana" start element
+		} else if (localname.equals("w")) {
+			for (int i= 0 ; i < parser.getAttributeCount() ; i++ ) {
+				if (parser.getAttributeLocalName(i) == "id") {
+					wordId = parser.getAttributeValue(i);
+					break
+				}
+			}
+			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() {
+		switch (parser.getLocalName()) {
+			case "w":
+				writeAnaTag(wordId);
+				flagW = false
+				break;
+			case "ana":
+				if (flagAna && replace && type != null && resp != null && anaValue != null) {
+					anaValues.put(type, anaValue)
+					links.add(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");
+					getHeaderInfos("appInfo", false);
+					writer.writeEndElement(); // appInfo
+				}
+				if (!taxonomiesWritten) {
+					writer.writeStartElement("classDecl");
+					getHeaderInfos("classDecl", false);
+					writer.writeEndElement(); // classDecl
+				}
+				break;
+
+			case "titleStmt":
+				if (flagSourceDesc) {
+					//output.write(this.respStmt+"\n")
+					getHeaderInfos("respStmt", true);
+					flagSourceDesc = false;
+					break;
+				}
+				break;
+		}
+		super.processEndElement();
+	}
+
+	/** The declarenamespace. */
+	boolean declarenamespace = false;
+
+	/**
+	 * Declare namespace.
+	 *
+	 * @return the java.lang. object
+	 */
+	private declareNamespace() {
+		if (!declarenamespace) {
+			writer.writeDefaultNamespace("http://www.tei-c.org/ns/1.0");
+			writer.writeNamespace("txm", TXMNS);
+			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
+
+		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.core/src/groovy/org/txm/scripts/teitxm/BuildTTSrc.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/teitxm/BuildTTSrc.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/teitxm/BuildTTSrc.groovy	(revision 258)
@@ -0,0 +1,217 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2017-01-24 18:11:42 +0100 (Tue, 24 Jan 2017) $
+// $LastChangedRevision: 3400 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.scripts.teitxm;
+
+import java.text.DateFormat;
+import java.util.Date;
+import java.util.ArrayList;
+import javax.xml.stream.*;
+import java.net.URL;
+
+import org.txm.Toolbox;
+import org.txm.importer.filters.*;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class BuildTTSrc.
+ *
+ * @author mdecorde
+ * build the TT source for tigerSearch
+ */
+
+public class BuildTTSrc {
+	
+	/** The url. */
+	private def url;
+	
+	/** The input data. */
+	private def inputData;
+	
+	/** The factory. */
+	private def factory;
+	
+	/** The parser. */
+	private XMLStreamReader parser;
+	
+	/** The output. */
+	private BufferedWriter output;
+	
+	/**
+	 * Instantiates a new builds the tt src.
+	 * uses XML-TXM V2
+	 *
+	 * @param url the url of the file to process
+	 */
+	public BuildTTSrc(URL url) {
+		try {
+			this.url = url;
+			inputData = url.openStream();
+			factory = XMLInputFactory.newInstance();
+			parser = factory.createXMLStreamReader(inputData);
+			
+		} catch (XMLStreamException ex) {
+			System.out.println(ex);
+		} catch (IOException ex) {
+			System.out.println("IOException while parsing ");
+		}
+	}
+	
+	/**
+	 * Creates the output.
+	 *
+	 * @param outfile the outfile
+	 * @return true, if successful
+	 */
+	private boolean createOutput(File outfile) {
+		try {
+			File f = outfile;
+			output = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outfile),
+					"UTF-8"));
+			return true;
+		} catch (Exception e) {
+			System.out.println(e.getLocalizedMessage());
+			return false;
+		}
+	}
+	
+	/**
+	 * Process.
+	 *
+	 * @param outfile the outfile
+     * @param formtype, if multiple form, use this param to choose the correct one, if null takes the first form found
+	 * @return true, if successful
+	 */
+	public boolean process(File outfile, String formtype) {
+		if (!createOutput(outfile))
+			return false;
+		
+		boolean flagform = false; // to catch the content of the form tag
+		boolean firstform = false; // to know if its the first form of the w element
+		String form = ""; // the content of the form tag
+		String lastopenlocalname = "";
+		String localname = "";
+		StringBuffer buffer = new StringBuffer();
+		try {
+			for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+				switch (event) {
+					case XMLStreamConstants.START_ELEMENT:
+						localname = parser.getLocalName();
+						switch (localname) {
+							case "w":
+								//firstform = true;
+								break;
+							case "form":
+//								if (firstform) {
+//									if (formtype != null) {
+//										if(parser.getAttributeCount() > 0 
+//											&& parser.getAttributeValue(0).equals(formtype)) // only one attribute in form, type
+//											flagform = true;
+//									}
+//									else
+									flagform = true;
+									form = "";
+									firstform = false;
+								//}
+								break;
+							case "s": // TreeTagger can use s tags
+								buffer.append("<s>\n");
+								break;
+						}
+						break;
+					case XMLStreamConstants.END_ELEMENT:
+						localname = parser.getLocalName();
+						switch (localname) {
+							case "form":
+								flagform = false;
+								form = form.trim()
+								if (form.length() == 0) buffer.append("__EMPTY__\n");
+								else buffer.append(form.replace("\n", "").replace("<", "&lt;")+ "\n");
+								//buffer.append(form+ "\n"); // its a txt file no need to use entities
+								break;
+							
+							case "s":
+								buffer.append("</s>\n");
+								break;
+						}
+						break;
+					
+					case XMLStreamConstants.CHARACTERS:
+						if (flagform) {
+							if (parser.getText().length() > 0)
+								form += parser.getText();
+						}
+						break;
+				}
+			}
+
+			String str = buffer.toString()
+			if ("false".equals(Toolbox.getParam(Toolbox.TREETAGGER_APOSTROPHE))) {
+				str = str.replace("’", "'").replace("‘", "'");
+			}
+			output.write(str)
+			output.close();
+			parser.close();
+			inputData.close();
+		} catch (Exception ex) {
+			System.out.println(ex);
+			return false;
+		} 
+		
+		return true;
+	}
+	
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args) {
+		
+		String rootDir = "~/xml/rgaqcj/";
+		// new File(rootDir+"/identity/").mkdir();
+		
+		ArrayList<String> milestones = new ArrayList<String>();// the tags who
+		// you want them
+		// to stay
+		// milestones
+		milestones.add("tagUsage");
+		milestones.add("pb");
+		milestones.add("lb");
+		milestones.add("catRef");
+		
+		File srcfile = new File(rootDir + "anainline/", "roland-p5.xml");
+		File resultfile = new File(rootDir + "ttsrc/", "roland-p5.tt");
+		println("build ttsrc file : " + srcfile + " to : " + resultfile);
+		
+		def builder = new BuildTTSrc(srcfile.toURL(), milestones);
+		builder.process(resultfile);
+		
+		return;
+	}
+	
+}
Index: tmp/org.txm.core/src/groovy/org/txm/scripts/teitxm/Xml2Ana.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/teitxm/Xml2Ana.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/teitxm/Xml2Ana.groovy	(revision 258)
@@ -0,0 +1,567 @@
+// 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
+// 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.
+//
+//
+//
+// $LastChangedDate: 2016-06-14 10:33:10 +0200 (Tue, 14 Jun 2016) $
+// $LastChangedRevision: 3234 $
+// $LastChangedBy: mdecorde $
+//
+package org.txm.scripts.teitxm;
+
+import org.txm.importer.HasElement;
+import org.txm.importer.StaxIdentityParser;
+import java.text.DateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Locale;
+import javax.xml.stream.*;
+import java.net.URL;
+import org.txm.importer.filters.*;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class Xml2Ana.
+ *
+ * @author mdecorde
+ * transform : pre xml-tei file >> xml-tei-txm file
+ * The pre xml-tei file must contains a minimal teiHeader with classDecl, encodingDesc and titleStmt
+ * 
+ * you must specify the correspondance between word attributs and ana types&respStmtIDs
+ * then the attributes of w tags will be transformed into interp tag
+ */
+public class Xml2Ana extends StaxIdentityParser
+{
+	/** 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;
+
+	/** 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;
+	String wtag = "w";
+	
+	public static final String TEXT = "text"
+	public static final String ID = "id"
+
+	/**
+	 * Instantiates a new xml2 ana.
+	 *
+	 * @param url the url
+	 * @param wordprefix the wordprefix
+	 */
+	public Xml2Ana(File file) {
+		super(file.toURI().toURL());
+		//File file = new File(url.getFile()).getAbsoluteFile()
+		textname = file.getName();
+		int idx = textname.indexOf(".");
+		if (idx > 0)
+			textname = textname.substring(0, idx)
+
+		checkTags = new HashMap<String,Boolean>();
+		checkTags.put("respStmt",false);
+		checkTags.put("titleStmt",false);
+		checkTags.put("appInfo",false);
+
+		hasText = new HasElement(file, TEXT).process();
+	}
+
+	/**
+	 * Sets the convert all atrtibutes.
+	 *
+	 * @param value the value
+	 * @return the java.lang. object
+	 */
+	public setConvertAllAtrtibutes(boolean value) {
+		convertAllAttributes = value;
+	}
+	
+	/**
+	 * Sets the convert all atrtibutes.
+	 *
+	 * @param value the value
+	 * @return the java.lang. object
+	 */
+	public setWordTag(String wtag) {
+		this.wtag = wtag
+	}
+
+	int idcount = 0;
+	boolean flagWord = false;
+	int firstElement = 0;
+	boolean teiElementAdded = false;
+	boolean teiHeaderElementAdded = false;
+	boolean hasText = false;
+	boolean textElementAdded = false;
+	def anabalises = [];
+	protected void processStartElement()
+	{
+		//String localname = parser.getLocalName();
+		firstElement++;
+		if (checkTags.containsKey(parser.getLocalName()))
+			checkTags.put(parser.getLocalName(), true);
+
+		switch (parser.getLocalName()) {
+			case wtag:
+				if (!hasText) {
+					writer.writeStartElement(TEXT);
+					writer.writeAttribute(ID, textname);
+					textElementAdded = true;
+					hasText = true;
+				}
+				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 attribute id
+						String wordid = value
+						if (wordid.startsWith("w")) {
+							if (!wordid.startsWith("w_"))
+								wordid = "w_"+wordid.substring(1)
+						} 
+//						else {
+//							wordid = "w_"+textname+"_"+wordid;
+//						}
+
+						writer.writeAttribute(type, wordid);
+					} else { // add attributes that was in the original <w>
+						if (convertAllAttributes)
+							anabalises.add(["none","#"+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;
+				boolean hasTXMNs = false;
+				for (int i = 0 ; i < parser.getNamespaceCount() ; i++) {
+					if (parser.getNamespaceURI(i) == TXMNS)
+						hasTXMNs = true;
+					else if (parser.getNamespaceURI(i) == TEINS)
+						hasTeiNS = true;
+				}
+				if (!hasTeiNS) {
+					writer.writeDefaultNamespace(TEINS);
+				}
+				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
+						teiElementAdded = true;
+						addTEIElement();
+					} else if (!hasText) {
+						writer.writeStartElement(TEXT);
+						writer.writeAttribute(ID, textname);
+						textElementAdded = true;
+						hasText = true;
+					}
+				}
+				if (firstElement == 2 && teiElementAdded != true) {
+					//println "second tag: "+parser.getLocalName()
+					if (localname != "teiHeader") { // teiHeader is missing
+						writeTeiHeader();
+						hasTeiHeader = true
+						teiHeaderElementAdded = true
+					}
+				} else if (!hasText & (teiElementAdded | teiHeaderElementAdded)) {
+					writer.writeStartElement(TEXT);
+					writer.writeAttribute(ID, textname);
+					textElementAdded = true;
+					hasText = true;
+				}
+
+				super.processStartElement();
+				if (TEXT.equals(localname)) {
+					if (!parser.getAttributeValue(null, ID)) {
+						writer.writeAttribute(ID, textname);
+					}
+				}
+		}
+	}
+
+	protected void after()
+	{
+		if (textElementAdded) {
+			writer.writeEndElement(); // text
+		}
+		if (teiElementAdded) {
+			writer.writeEndElement(); // TEI
+		}
+		super.after(); // close writer, parser, etc
+	}
+
+	protected void addTEIElement()
+	{
+		writer.writeStartElement("TEI");
+		writer.writeDefaultNamespace(TEINS);
+		writer.writeNamespace(TXM, TXMNS);
+		writer.writeNamespace(TEI, TEINS);
+		writeTeiHeader();
+	}
+
+	protected void processCharacters()
+	{
+		if (flagWord) {
+			writer.writeCharacters(parser.getText().trim()); // keep form in 1 line
+		} else {
+			super.processCharacters();
+		}
+	}
+	
+	boolean hasClassDecl = false;
+	boolean hasFileDesc = false;
+	boolean hasEncodingDesc = false;
+	boolean hasTeiHeader = false;
+	boolean hasTEI = false;
+	public static String ANA = "ana"
+	public static String RESP = "resp"
+	public static String TYPE = "type"
+	protected void processEndElement()
+	{
+		switch (parser.getLocalName()) {
+			case wtag:
+				writer.writeEndElement(); // txm:form
+				for (def values : anabalises)
+				{// <txm:ana resp=ref type=corresptype>value</txm:ana>
+					writer.writeStartElement(TXMNS, ANA);
+					writer.writeAttribute(RESP, values[0]);
+					writer.writeAttribute(TYPE, values[1]);
+					writer.writeCharacters(values[2]);
+					writer.writeEndElement(); // txm:ana
+				}
+
+				flagWord = false;
+				break;
+
+			case "fileDesc":
+				hasFileDesc = true;
+				this.writeTXMResps();
+				break;
+
+			case "classDecl":
+				hasClassDecl=true;
+				this.writeTXMTaxonomies();
+				break;
+			case "encodingDesc":
+				hasEncodingDesc = true;
+				writeContentOfEncodingDesc();
+				break;
+
+			case "teiHeader":
+				hasTeiHeader = true
+				if (!hasEncodingDesc) {
+					writer.writeStartElement("encodingDesc");
+					writeContentOfEncodingDesc();
+					writer.writeEndElement();
+				}
+
+				break;
+			case "TEI":
+				hasTEI = true;
+				if (!hasTeiHeader) {
+					writeTeiHeader();
+				}
+				break;
+		}
+
+		super.processEndElement();
+	}
+
+	protected void writeTeiHeader()
+	{
+		writer.writeStartElement("teiHeader");
+		writer.writeStartElement("fileDesc")
+		this.writeTXMResps();
+		writer.writeStartElement("titleStmt")
+		writer.writeStartElement("title")
+		writer.writeEndElement(); // title
+		writer.writeEndElement(); // titleStmt
+		writer.writeStartElement("publicationStmt")
+		writer.writeEndElement(); // publicationStmt
+		writer.writeStartElement("sourceDesc")
+		writer.writeEndElement(); // sourceDesc
+		writer.writeEndElement(); // fileDesc
+		writer.writeStartElement("encodingDesc");
+		writeContentOfEncodingDesc();
+		writer.writeEndElement(); // encodingDesc
+		writer.writeEndElement(); // teiHeader
+	}
+
+	protected void writeContentOfEncodingDesc()
+	{
+		writer.writeStartElement("appInfo")
+		this.writeTXMApps();
+		writer.writeEndElement(); // appInfo
+		if (!hasClassDecl) {
+			writer.writeStartElement("classDecl");
+			this.writeTXMTaxonomies();
+			writer.writeEndElement(); // classDecl
+		}
+	}
+
+	/**
+	 * Check resp.
+	 *
+	 * @return the string
+	 */
+	public String checkResp()
+	{
+		String rez ="found tags : \n";
+		for (String key : checkTags)
+			rez += "\t"+key+"\n";
+		return rez;
+	}
+
+	/**
+	 * Sets the correspondances.
+	 *
+	 * @param correspRef the corresp ref
+	 * @param correspType the corresp type
+	 */
+	public void setCorrespondances(correspRef, correspType)
+	{
+		this.correspRef = correspRef;
+		this.correspType = correspType;
+	}
+
+	/**
+	 * Sets the header infos.
+	 *
+	 * @param respId the resp id
+	 * @param resps the resps
+	 * @param applications the applications
+	 * @param taxonomies the taxonomies
+	 * @param items the items
+	 */
+	public void setHeaderInfos(respId,resps, applications, taxonomies, items)
+	{
+		this.respId = respId
+		this.resps = resps
+		this.applications = applications
+		this.taxonomies = taxonomies;
+		this.items = items;
+	}
+
+	/**
+	 * Write txm resps.
+	 */
+	public void writeTXMResps()
+	{
+		for (String ref : respId) {
+			String[] infos = resps.get(ref);
+			writer.writeStartElement("respStmt");
+			writer.writeStartElement(RESP);
+			writer.writeAttribute(ID,ref);
+			writer.writeCharacters(infos[0]);
+			writer.writeStartElement("date");
+			writer.writeAttribute("when",infos[2]);
+			writer.writeCharacters(infos[3]);
+			writer.writeEndElement(); // date
+			writer.writeEndElement(); //resp
+			writer.writeStartElement("name");
+			writer.writeAttribute(TYPE, "person");
+			writer.writeCharacters(infos[1])
+			writer.writeEndElement(); // name
+			writer.writeEndElement(); //respStmt
+		}
+	}
+
+	/**
+	 * Write txm apps.
+	 */
+	public void writeTXMApps()
+	{
+		for (String ref : respId) {
+			List<String> list= applications.get(ref);
+			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();
+				Reader reader = new FileReader(report);
+				String line = reader.readLine();
+				while (line != null) {
+					if (line.length() != 0)
+						output.write(line+"\n");
+					line = reader.readLine();
+				}
+				reader.close();
+			}
+
+			writer.writeStartElement("ab");
+			writer.writeAttribute(TYPE, "annotation");
+			for (String item : taxonomies.get(ref)) {
+				writer.writeStartElement("list");
+				writer.writeEmptyElement("ref");
+				writer.writeAttribute(TYPE, "tagset");
+				writer.writeAttribute("target", item);
+				writer.writeEndElement(); // list
+			}
+			writer.writeEndElement(); // ab
+			writer.writeEndElement(); // txm:application
+		}
+	}
+
+	/**
+	 * Write txm taxonomies.
+	 */
+	public void writeTXMTaxonomies()
+	{
+		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);
+				writer.writeAttribute("target", items.get(tax).get(type));
+			}
+			writer.writeEndElement(); // bibl
+			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"])
+
+		//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/groovy/org/txm/scripts/teitxm/CSV2W_ANA.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/teitxm/CSV2W_ANA.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/teitxm/CSV2W_ANA.groovy	(revision 258)
@@ -0,0 +1,491 @@
+// 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
+// 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.
+//
+//
+//
+// $LastChangedDate: 2016-03-29 09:51:35 +0200 (Tue, 29 Mar 2016) $
+// $LastChangedRevision: 3185 $
+// $LastChangedBy: mdecorde $
+//
+package org.txm.scripts.teitxm;
+
+import java.io.File;
+import java.io.Writer;
+
+import org.txm.importer.graal.PersonalNamespaceContext;
+import org.txm.utils.treetagger.TreeTagger;
+import java.util.Iterator;
+
+import javax.xml.namespace.NamespaceContext;
+
+import java.io.FileInputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.nio.charset.Charset;
+import java.util.Iterator;
+
+import javax.xml.stream.*;
+// TODO: Auto-generated Javadoc
+/**  
+ * @author mdecorde  
+ * 
+ * Take a CVS file with columns [word, pos1, pos2, ...] Build xml-pos With given infos : - setAnnotationTypes( types, idform); - setResp( person, software, cmdLine);  types : list of type [pos1, pos2, ...] idform : the ___ of the words' id person : the resp software : the software which creates annotations cmdline : the used cmd line 
+ * 
+ */
+class CSV2W_ANA {
+	String encoding;
+
+	/** The target. */
+	String target = "" // ana file targeted
+
+	/** The distributor. */
+	String distributor= "";
+
+	/** The publi chat. */
+	String publiChat= "";
+
+	/** The source chat. */
+	String sourceChat= "";
+
+	/** The reportfile. */
+	File reportfile;
+
+	/** The resp person. */
+	String respPerson; // used for respStmt/resp/name(person)
+
+	/** The resp id. */
+	String respId;
+
+	/** The resp chat. */
+	String respChat;
+
+	/** The resp date. */
+	String respDate;
+
+	/** The resp when. */
+	String respWhen;
+
+	/** The app ident. */
+	String appIdent;
+
+	/** The app version. */
+	String appVersion;
+
+	/** The types. */
+	def types ;// used for linkGrp type
+
+	/** The types desc. */
+	def typesDesc ;// used for types' description
+
+	/** The types uri. */
+	def typesURI; // used for types' URI
+
+	/** The types web. */
+	def typesWEB;//used for types siteweb
+
+	/** The idform. */
+	String idform ="";
+
+	/** The writer. */
+	XMLOutputFactory factory = XMLOutputFactory.newInstance();
+	BufferedOutputStream output;
+	XMLStreamWriter writer;
+
+	public static String TXMNS = "http://textometrie.org/1.0";
+	public static String TEINS = "http://www.tei-c.org/ns/1.0";
+
+	/**
+	 * Process.
+	 *
+	 * @param TTrez the tt result file
+	 * @param xmlform the xmlform the standoff file created
+	 * @param encoding the encoding of the result file
+	 * @return true, if successful
+	 */
+	public boolean process(File TTrez,File xmlform, String encoding )
+	{
+		try {
+			this.encoding = encoding;
+			output = new BufferedOutputStream(new FileOutputStream(xmlform));
+			writer = factory.createXMLStreamWriter(output, "UTF-8"); // create a new file
+			writer.setNamespaceContext(new PersonalNamespaceContext());
+			writeHead();
+			writeBody(TTrez,encoding)
+			writeTail();
+			writer.close();
+			output.close();
+		} catch(Exception e) {
+			e.printStackTrace();
+			writer.close();
+			output.close();
+			return false;
+		}
+		return true;
+	}
+
+	/**
+	 * Write head.
+	 */
+	private void writeHead()
+	{
+		Charset UTF8 = Charset.forName("UTF8");
+		writer.writeStartDocument(encoding, "1.0");
+		writer.writeStartElement("TEI");
+		writer.writeDefaultNamespace(TEINS);
+		writer.writeNamespace("txm", TXMNS);
+		writer.writeStartElement("teiHeader");
+		writer.writeStartElement("fileDesc");
+		writer.writeStartElement("titleStmt");
+		writer.writeStartElement("title");
+		writer.writeCharacters("Standoff annotation file for "+target);
+		writer.writeEndElement(); // title
+		writer.writeStartElement("respStmt");
+		writer.writeAttribute("xml:id", respId);
+		writer.writeStartElement("resp");
+		writer.writeCharacters(respChat)
+		writer.writeStartElement("date");
+		writer.writeAttribute("when", respWhen);
+		writer.writeCharacters(respDate);
+		writer.writeEndElement(); // date
+		writer.writeEndElement(); // resp
+		writer.writeStartElement("name");
+		writer.writeAttribute("type", "person");
+		writer.writeCharacters(respPerson+"\n");
+		writer.writeEndElement(); // name
+		writer.writeEndElement(); // respStmt
+		writer.writeEndElement(); // titleStmt
+		writer.writeStartElement("publicationStmt")
+		writer.writeCharacters("\n");
+		writer.writeStartElement("distributor");
+		writer.writeCharacters("\n");
+		writer.flush();
+		output.write(distributor.getBytes(UTF8))
+		output.flush()
+		writer.writeEndElement(); // distributor
+		writer.writeCharacters("\n");
+		writer.flush();
+		output.write(publiChat.getBytes(UTF8));
+		output.flush()
+		writer.writeEndElement(); // publicationStmt
+		writer.writeStartElement("sourceDesc");
+		writer.writeCharacters("\n");
+		writer.flush();
+		output.write(sourceChat.getBytes(UTF8));
+		output.flush()
+		writer.writeEndElement(); // sourceDesc
+		writer.writeEndElement(); // fileDesc
+		writer.writeStartElement("encodingDesc");
+		writer.writeStartElement("appInfo");
+		writer.writeStartElement(TXMNS,"application");
+		writer.writeAttribute("ident",appIdent);
+		writer.writeAttribute("version", appVersion);
+		writer.writeAttribute("resp", respId);
+		writer.writeCharacters("\n");
+		writer.flush();
+		def report = this.reportfile;
+		if (report != null) {
+			//System.out.println("read report : "+report);
+			Reader reader = new FileReader(report);
+			String line = reader.readLine();
+			while (line != null) {
+				if (line.length() != 0)
+					output.write((line.replace("&","&amp;")+"\n").getBytes(UTF8));
+				line = reader.readLine();
+			}
+			reader.close();
+			output.flush()
+		} else {
+			writer.writeEmptyElement(TXMNS, "commandLine");
+			writer.writeCharacters("\n");
+		}
+
+		writer.writeStartElement("ab");
+		writer.writeAttribute("type", "annotation");
+		writer.writeCharacters("\n");
+		writer.writeStartElement("list");
+		writer.writeCharacters("\n");
+		for (int i = 0; i < types.size(); i++) {
+			writer.writeStartElement("item");
+			writer.writeEmptyElement("ref");
+			writer.writeAttribute("type", "tagset");
+			writer.writeAttribute("target","#"+types[i])
+			writer.writeEndElement(); // item
+			writer.writeCharacters("\n");
+		}
+		writer.writeEndElement(); // list
+		writer.writeEndElement(); // ab
+		writer.writeEndElement(); // txm:application
+		writer.writeEndElement(); // appInfo
+		writer.writeStartElement("classDecl");
+		for (int i = 0; i < types.size(); i++) {
+			writer.writeStartElement("taxonomy");
+			writer.writeAttribute("xml:id", types[i]);
+			writer.writeStartElement("bibl");
+			writer.writeStartElement("title");
+			writer.writeCharacters(typesDesc[i]);
+			writer.writeEndElement(); // title
+			if (!typesURI[i].equals("")) {
+				writer.writeEmptyElement("ref");
+				writer.writeAttribute("type", "tagset");
+				writer.writeAttribute("target", typesURI[i]);
+				writer.writeCharacters("\n");
+			}
+			if (!typesWEB[i].equals("")) {
+				writer.writeEmptyElement("ref");
+				writer.writeAttribute("type", "siteweb");
+				writer.writeAttribute("target", typesWEB[i]);
+				writer.writeCharacters("\n");
+			}
+			writer.writeEndElement(); // bibl
+			writer.writeCharacters("\n");
+			writer.writeEndElement(); // taxonomy
+			writer.writeCharacters("\n");
+		}
+		writer.writeEndElement(); // classDecl
+		writer.writeCharacters("\n");
+		writer.writeEndElement(); // encodingDesc
+		writer.writeCharacters("\n");
+		writer.writeEndElement(); // teiHeader
+
+		writer.writeStartElement("text");
+		writer.writeAttribute("type", "standoff");
+		writer.writeStartElement("body");
+		writer.writeCharacters("\n");
+		writer.writeStartElement("div");
+		writer.writeCharacters("");
+	}
+
+	/**
+	 * Write body.
+	 *
+	 * @param TTrez the tt result file
+	 * @param encoding the encoding
+	 * @return the java.lang. object
+	 */
+	private writeBody(File TTrez, String encoding) {
+		String tmp = "";
+		String targets= idform+"";
+
+		//def content = TTrez.getText(encoding)
+		//content = content.replace("&lt;", "<")
+
+		def separator= "\t"
+		def maxsize = types.size()+1;
+		for (int i = 0 ; i< types.size() ; i++) {
+			int id = 1;
+			//output.write("<linkGrp type=\""+types[i]+"\">\n");
+			writer.writeStartElement("linkGrp");
+			writer.writeAttribute("type", types[i]);
+			TTrez.eachLine("UTF-8") { line ->
+				line = line.replaceAll("&lt;", "<")
+				def fields = line.split(separator);
+				//content.splitEachLine(separator) {fields ->
+					if (fields.size() == maxsize)
+						if (!(fields[0].startsWith("<s>") || fields[0].startsWith("</s>")))// don't use the sentence tags
+					{
+						writer.writeEmptyElement("link");
+						writer.writeAttribute("targets", "#"+targets+id+" #"+ fields[i+1]);
+						id++;
+						writer.writeCharacters("\n");
+					}
+				//}
+			}
+			writer.writeEndElement(); // linkGrp
+		}
+	}
+
+	/**
+	 * Write tail.
+	 */
+	private void writeTail() {
+		writer.writeEndElement(); // div
+		writer.writeEndElement(); // body
+		writer.writeEndElement(); // text
+		writer.writeEndElement(); // TEI
+	}
+
+	/**
+	 * Sets the annotation types.
+	 *
+	 * @param types the types
+	 * @param typesDesc the types desc
+	 * @param typesURI the types uri
+	 * @param typesWEB the types web
+	 * @param idform the idform
+	 */
+	public void setAnnotationTypes(def types,def typesDesc,def typesURI,def typesWEB, String idform) {
+		this.types = types;
+		this.typesDesc = typesDesc;
+		this.typesURI = typesURI;
+		this.typesWEB = typesWEB;
+		this.idform = idform;
+	}
+
+	/**
+	 * Sets the resp.
+	 *
+	 * @param respId the resp id
+	 * @param respChat the resp chat
+	 * @param respDate the resp date
+	 * @param respPerson the resp person
+	 * @param respWhen the resp when
+	 */
+	public void setResp(respId, respChat,respDate, respPerson,respWhen) {
+		this.respId = respId;
+		this.respChat = respChat;
+		this.respDate = respDate
+		this.respPerson = respPerson;
+		this.respWhen = respWhen;
+	}
+
+	/**
+	 * Sets the target.
+	 *
+	 * @param target the target
+	 * @param reportFile the report file
+	 */
+	public void setTarget(target, reportFile) {
+		this.target = target;
+		this.reportfile = reportFile;
+	}
+
+	/**
+	 * Sets the app.
+	 *
+	 * @param appIdent the app ident
+	 * @param appVersion the app version
+	 */
+	public void setApp(String appIdent, String appVersion) {
+		this.appIdent = appIdent;
+		this.appVersion = appVersion;
+	}
+
+	/**
+	 * Sets the infos.
+	 *
+	 * @param distributor the distributor
+	 * @param publiChat the publi chat
+	 * @param sourceChat the source chat
+	 */
+	public void setInfos(distributor,  publiChat, sourceChat) {
+		this.distributor = distributor;
+		this.publiChat = publiChat;
+		this.sourceChat = sourceChat;
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args) {
+
+		String rootDir = "~/xml/rgaqcj/";
+		new File(rootDir,"proj").mkdir();
+
+		//targeted file for annotations
+		String target = "roland.xml"
+		//contains txm:application/txm:commandLine
+		File reportFile = new File("~/xml/rgaqcj/tt1_REPORT.xml");
+
+		String respPerson ="slh";
+		String respId = "TT1";
+		String respDesc = "NLP annotation tool";
+		String respDate = "Tue Mar  11 1:02:55 Paris, Madrid 2010";
+		String respWhen="2010-03-11"
+
+		String appIdent = "TreeTagger";
+		String appVersion = "3.2";
+
+		String distributor = "BFM project - http://bfm.ens-lsh.fr";
+		String publiStmt = """<availability>
+			  <p>(c) 2010 Projet BFM - CNRS/ENS-LSH.
+			  <hi>Conditions d'utilisation</hi> : 
+			  Sous licence <ref target="http://creativecommons.org/licenses/by-sa/2.0/fr/">Creative Commons</ref>.
+			  </p>
+			</availability>""";
+
+		String sourceStmt = """<p>Born digital: TXM project - http://textometrie.org</p>
+			<p>Automatically generated on <date when=" """+respWhen+"""">"""+respDate+"""</date>
+			from <ref target="#"""+respId+"""">Tree Tagger</ref> applied on the text roland-tt.
+			</p>""";
+
+		def types = ["CATTEX2009"];
+		def typesTITLE = ["CATTEX2009"];
+		def typesDesc = ["CATTEX2009 POS description"]
+		def typesTAGSET = ["http://bfm.ens-lsh.fr/IMG/xml/cattex2009.xml"]
+		def typesWEB = ["http://bfm.ens-lsh.fr/article.php3?id_article=176"]
+		String idform ="w_fro_";
+
+		File ttfile = new File(rootDir+"/proj/","rol_rga.tt");
+		File posfile = new File(rootDir+"/pos/","rolandTT1-w-ana.xml");
+		String encoding ="UTF-8";
+		println("Process file : "+ttfile+" to : "+posfile );
+
+		def transfo = new CSV2W_ANA();
+		transfo.setAnnotationTypes( types, typesDesc, typesTAGSET, typesWEB, idform);
+		transfo.setResp(respId, respDesc,respDate, respPerson, respWhen);
+		transfo.setApp(appIdent, appVersion);
+		transfo.setTarget(target, reportFile);
+		transfo.setInfos(distributor,  publiStmt, sourceStmt);
+		transfo.process( ttfile, posfile, encoding );
+
+		//create annotation file for afrpar on roalnd.xml
+		String infile = rootDir+"/ttsrc/roland-learn.tt";
+		String modelfile =  rootDir+"/models/afr.par";
+		String outfile = rootDir+"/proj/afr_rol.tt";
+
+		println("proj "+modelfile+ " on " +infile +" >> "+outfile);
+
+		TreeTagger tt = new TreeTagger("~/Bureau/treetagger/bin/");
+		tt.settoken();
+		tt.setquiet();
+		tt.setsgml();
+		tt.seteostag("<s>");
+		tt.treetagger( modelfile, infile, outfile)
+
+		reportFile = new File("~/xml/rgaqcj/tt2_REPORT.xml");
+		respPerson ="slh";
+		respId = "TT2";
+		respDesc = "NLP annotation tool";
+		respDate = "Tue Mar  15 1:02:55 Paris, Madrid 2010";
+		respWhen = "2010-03-15"
+
+		types = ["AFRPOS"];
+		typesDesc = ["AFRPOS description"]
+		typesWEB = ["http://www.uni-stuttgart.de/lingrom/stein/forschung/resource.html"]
+		typesTAGSET = [""]
+		idform ="w_fro_";
+
+		ttfile = new File(rootDir+"/proj/","afr_rol.tt");
+		posfile = new File(rootDir+"/pos/","rolandTT2-w-ana.xml");
+		encoding ="UTF-8";
+		println("Process file : "+ttfile+" to : "+posfile );
+
+		transfo = new CSV2W_ANA();
+		transfo.setAnnotationTypes( types, typesDesc, typesTAGSET, typesWEB, idform);
+		transfo.setResp(respId, respDesc,respDate, respPerson,respWhen);
+		transfo.setTarget(target, reportFile);
+		transfo.setApp(appIdent, appVersion);
+		transfo.setInfos(distributor,  publiStmt, sourceStmt);
+		transfo.process( ttfile, posfile, encoding );
+	}
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/scripts/testTT.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/testTT.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/testTT.groovy	(revision 258)
@@ -0,0 +1,549 @@
+/**
+ * Main.
+ *
+ * @param args the args
+ */
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.scripts;
+
+import java.util.ArrayList;
+import org.txm.utils.treetagger.TreeTagger;
+import org.txm.utils.*;
+import org.txm.importer.*;
+import org.txm.importer.RGAQCJ.*;
+import java.io.File;
+import java.text.DateFormat;
+import java.util.Date;
+import java.text.DecimalFormat;
+// TODO: Auto-generated Javadoc
+
+/**
+ * test TT wrapper
+ * add NLP annotation
+ * build result matrix.
+ *
+ * @return the java.lang. object
+ */
+String rootDir = "~/xml/rgaqcj/";
+new File(rootDir+"/models/").mkdir();
+new File(rootDir+"/lexicon/").mkdir();
+new File(rootDir+"/proj/").mkdir();
+new File(rootDir+"/ttlearn/").mkdir();
+new File(rootDir+"/ttsrc/").mkdir();
+new File(rootDir+"/pos/").mkdir();
+new File(rootDir+"/injection/").mkdir();
+new File(rootDir+"/anainline/").mkdir();
+new File(rootDir+"/xml-txm/").mkdir();
+
+//create srcana.xml from src.xml
+def srcfiles = ["roland.xml","artu.xml","qjm.xml","commyn1.xml","jehpar.xml"];
+def anafiles = ["roland-ana.xml","artu-ana.xml","qjm-ana.xml","commyn1-ana.xml","jehpar-ana.xml"];
+def xslfiles = ["bfm2txm-w.xsl","bfm2txm-w.xsl","bfm2txm-w.xsl","bfm2txm-w.xsl","bfm2txm-w.xsl"];
+//bfmgraal2txm-w.xsl
+for(int i=0 ; i < xslfiles.size() ; i++)
+{
+	String xslfile = rootDir+"xsl/"+xslfiles[i];
+	String infile = rootDir+"src/"+srcfiles[i];
+	String outfile = rootDir+"anainline/"+anafiles[i];
+	println("create xml-txm from "+srcfiles[i]);
+	ApplyXsl a = new ApplyXsl(xslfile);
+	a.process(infile,outfile);
+}
+
+//Import to CWB
+def cwbLoc ="~/Bureau/textometrie/CWB/cwb-3.0/utils/";//chemin vers executable cqp
+BuildXmlRGAQCJ.process( anafiles,  rootDir, cwbLoc)
+println("build wtc RGAQCJ");
+println("encode + makeall");
+
+//create TT TRAIN files
+def ttlearnfiles = ["roland-learn.tt","artu-learn.tt","qjm-learn.tt","commyn1-learn.tt","jehpar-learn.tt","rgaqcj-learn.tt"];
+String initiales = "RAQCJZ"
+
+//ProcessBuilderBuilder.build(new File("src/groovy/org/txm/scripts/cwb-decode-wrapper-definition.xml"), new File("src/groovy/org/textometrie/scripts/CwbDecode.groovy"));
+GroovyClassLoader gcl = new GroovyClassLoader();
+gcl.addClasspath(".");
+
+String registryPath = rootDir+"/registry";
+String cwbdecodeexecDir = "~/Bureau/trunkCWB/cwb-3.0/utils/"
+
+Class clazz = gcl.parseClass(new File("src/groovy/org/txm/scripts/CwbDecode.groovy"));
+def aScript = clazz.newInstance(cwbdecodeexecDir);
+
+aScript.setC()
+def pAttributesTrain = ["word","cat"];
+def pAttributesLex = ["word","cat","LEMMA"];
+def pAttributesTag = ["word"];
+def sAttributes = ["s"];
+aScript.setP(pAttributesTag)
+aScript.setS(sAttributes)
+aScript.setr(registryPath)
+aScript.debug(true);
+int[] nbmots = [0,35306,134170,173526,198929,228149]
+
+for(int i=0 ; i < initiales.length() ; i++)
+{
+	println("creation TTsrc "+ttlearnfiles[i]);
+	FileOutputStream fos = new FileOutputStream(rootDir+"/ttsrc/"+ttlearnfiles[i]);
+	PrintStream ps = new PrintStream(fos);
+	def out = System.out;
+	if(!(initiales[i]+"").matches("Z"))
+	{
+		if(i > 0)
+			aScript.sets(nbmots[i]+1)
+		else
+			aScript.sets(nbmots[i])
+		aScript.sete(nbmots[i+1])
+	}
+	else
+	{
+		aScript.unsets();
+		aScript.unsete();
+	}
+	System.setOut(ps);
+	
+	if(System.getProperty("os.name").contains("Windows"))
+		aScript.cwbdecodeexe("RGAQCJ")
+	else
+		aScript.cwbdecode("RGAQCJ")
+	
+	System.setOut(out);
+}
+
+
+aScript.unsetS()
+aScript.setP(pAttributesTrain)
+for(int i=0 ; i < initiales.length() ; i++)
+{
+	println("creation TTlearn "+ttlearnfiles[i]);
+	FileOutputStream fos = new FileOutputStream(rootDir+"/ttlearn/"+ttlearnfiles[i]);
+	PrintStream ps = new PrintStream(fos);
+	def out = System.out;
+	if(!(initiales[i]+"").matches("Z"))
+	{
+		if(i > 0)
+			aScript.sets(nbmots[i]+1)
+		else
+			aScript.sets(nbmots[i])
+		aScript.sete(nbmots[i+1])
+	}
+	else
+	{
+		aScript.unsets();
+		aScript.unsete();
+	}
+	System.setOut(ps);
+	
+	if(System.getProperty("os.name").contains("Windows"))
+		aScript.cwbdecodeexe("RGAQCJ")
+	else
+		aScript.cwbdecode("RGAQCJ")
+	
+	System.setOut(out);
+}
+aScript.setP(pAttributesLex)
+HSQLFunctions.clearAll();
+HashMap<String,Integer> nbFormLexique = new HashMap<String,Integer>()
+HashMap<String,Integer> nbOccurencesTxt = new HashMap<String,Integer>()
+for(int i=0 ; i < initiales.length() ; i++)
+{
+	println("creation lex brut lex_"+initiales[i]);
+	FileOutputStream fos = new FileOutputStream(rootDir+"lexicon/lex_"+initiales[i]);
+	PrintStream ps = new PrintStream(fos);
+	def out = System.out;
+	if(!(initiales[i]+"").matches("Z"))
+	{
+		if(i > 0)
+			aScript.sets(nbmots[i]+1)
+		else
+			aScript.sets(nbmots[i])
+		aScript.sete(nbmots[i+1])
+	}
+	else
+	{
+		aScript.unsets();
+		aScript.unsete();
+	}
+	System.setOut(ps);
+	
+	if(System.getProperty("os.name").contains("Windows"))
+		aScript.cwbdecodeexe("RGAQCJ")
+	else
+		aScript.cwbdecode("RGAQCJ")
+	
+	System.setOut(out);
+	def argsname = ["form","cat","lemme"];
+	def types = ["VARCHAR(30)","VARCHAR(30)","VARCHAR(30)"];
+	File lexfile = new File(rootDir+"lexicon/lex_"+initiales[i]);
+	int nbMot = HSQLFunctions.ImportOrderedCSVTable("lexbrut_"+initiales[i], argsname,types,lexfile,"\t","UTF-8");
+	nbOccurencesTxt.put("lexbrut_"+initiales[i],nbMot);
+	//HSQLFunctions.ImportCSVTable("lex_"+initiales[i], argsname,types,lexfile,"\t","ISO-8859-1");
+	
+	argsname = ["cat","lemme"];
+	int nbForm = HSQLFunctions.toRefHierarchicalFile( "lexbrut_"+initiales[i], lexfile.getAbsolutePath(),"form",argsname,"UTF-8");
+	nbFormLexique.put("lex_"+initiales[i],nbForm);
+}
+aScript.unsets();
+aScript.unsete();
+println("creation lex brut RGAQCJ");
+FileOutputStream fos = new FileOutputStream(rootDir+"/lexicon/rgaqcj-brut");
+PrintStream ps = new PrintStream(fos);
+def out = System.out;
+System.setOut(ps);
+
+if(System.getProperty("os.name").contains("Windows"))
+	aScript.cwbdecodeexe("RGAQCJ")
+else
+	aScript.cwbdecode("RGAQCJ")
+
+System.setOut(out);
+
+println("create lexiq from csv");
+
+//train
+//def ttlearnfiles = ["roland-learn.tt","qgraal_cm-learn.tt","artu-learn.tt","qjm-learn.tt","commyn1-learn.tt","jehpar-learn.tt","rgaqcj-learn.tt"];
+def modelfiles = ["roland.par","artu.par","qjm.par","commyn1.par","jehpar.par","rgaqcj.par"];
+
+def lexfiles = ["lex_R","lex_A","lex_Q","lex_C","lex_J","lex_Z"];
+def openclassfiles = ["open_class_R.txt","open_class_A.txt","open_class_Q.txt","open_class_C.txt","open_class_J.txt","open_class_Z.txt"];
+//def lexiconfile = rootDir+"/lexicon/"+"lexfra-rgaqcj.txt";
+
+
+for(int i=0; i < ttlearnfiles.size();i++)
+{
+	String infile = rootDir+"/ttlearn/"+ttlearnfiles[i];
+	String outfile = rootDir+"/models/"+modelfiles[i];
+	String lexiconfile = rootDir+"/lexicon/"+lexfiles[i];
+	String openclassfile = rootDir+"/lexicon/"+openclassfiles[i];
+	TreeTagger tt = new TreeTagger("~/Bureau/treetagger/bin/");
+	println("learn "+ttlearnfiles[i] +" >> "+modelfiles[i]);
+	tt.settoken();
+	tt.setquiet();
+	//tt.setlemma();
+	tt.setsgml();
+	tt.setst("PONfrt");
+	tt.setproto();
+	tt.setutf8();
+	tt.traintreetagger( lexiconfile, openclassfile, infile, outfile)
+}
+
+//projection
+def ttsrcfiles = ["roland-learn.tt","artu-learn.tt","qjm-learn.tt","commyn1-learn.tt","jehpar-learn.tt","rgaqcj-learn.tt"];
+def ttrezfiles = [];
+for(int i=0; i < ttsrcfiles.size();i++)
+{
+	for(int j=0; j < modelfiles.size();j++)
+	{
+		String infile = rootDir+"/ttsrc/"+ttsrcfiles[i];
+		String modelfile =  rootDir+"/models/"+modelfiles[j];
+		String outfile = ttsrcfiles[i].substring(0,3)+"_"+modelfiles[j].substring(0,3)+".tt";
+		ttrezfiles.add(outfile);
+		println("proj "+modelfiles[j]+ " on " +ttsrcfiles[i] +" >> "+outfile);
+		
+		TreeTagger tt = new TreeTagger("~/Bureau/treetagger/bin/");
+		tt.settoken();
+		tt.setquiet();
+		tt.setsgml();
+		tt.seteostag("<s>");
+		tt.treetagger( modelfile, infile, rootDir+"proj/"+outfile)
+	}
+}
+
+
+
+/*
+ //create ana-pos.xml files
+ def posfiles = ["roland-pos","artu-pos","qjm-pos","commyn1-pos","jehpar-pos","rgaqcj-pos"];
+ String encoding ="ISO-8859-1";
+ String person ="Serge Heiden"; 
+ String software = "tree-tagger cmd line with options ..."; 
+ String cmdLine = "tree-tagger -token ...";
+ String title ="POS annotation";
+ def types = ["POS","lemma"];
+ String idform ="fro";
+ for(int i=0; i < ttsrcfiles.size();i++)
+ {
+ for(int j = 0; j< ttsrcfiles.size();j++)
+ {
+ int c = j +i*ttsrcfiles.size(); // id ttrez
+ File ttfile = new File(rootDir+"/tt/",ttrezfiles[c]);
+ File posfile = new File(rootDir+"/pos/",posfiles[i]+"-"+modelfiles[j].substring(0,3)+".xml");
+ println("TTrez > ana-pos : "+ttfile+" to : "+posfile );
+ c++;
+ def transfo = new TTrezToXml();
+ transfo.setAnnotationTypes( types, idform);
+ transfo.setResp( person, software, cmdLine);
+ transfo.process( ttfile, posfile, encoding );
+ }
+ }	
+ //injection annotations
+ String respPerson ="sheiden"
+ String respId = "";
+ String respDate = DateFormat.getDateInstance(DateFormat.FULL, Locale.UK).format(new Date());
+ String respCDATA = "";
+ for(int i=0; i < anafiles.size();i++)
+ {
+ for(int j = 0; j < 6 ; j++)
+ {
+ File srcfile = new File(rootDir+"/anainline/",anafiles[i]);
+ File posfile = new File(rootDir+"/pos/",posfiles[i]+"-"+modelfiles[j].substring(0,3)+".xml");
+ println("annote file : "+srcfile+" with : "+posfile );
+ def builder = new AnnotationInjection(srcfile.toURL(), posfile.toURL(), solotags);
+ builder.setResp(respId,respPerson, respDate, respCDATA);
+ builder.transfomFile(rootDir+"/injection/",anafiles[i]);
+ }
+ }	
+ */
+//remove <s> from ttrezfiles
+String encoding = "UTF-8"
+for(int i=0; i < ttrezfiles.size();i++)
+{
+	String csvfile = rootDir+"proj/"+ttrezfiles[i];
+	File f = new File(csvfile);
+	File temp = new File("tempFileCVScleaner")
+	println("fix <s> "+f);
+	Reader reader = new InputStreamReader(new FileInputStream(csvfile),encoding);
+	Writer writer = new FileWriter(temp);
+	reader.eachLine 
+			{
+				if(!it.startsWith("<s") && !it.startsWith("</s"))
+					writer.write(it+"\n")
+			}
+	reader.close();
+	writer.close();
+	if (!(f.delete() && temp.renameTo(f))) println "Warning can't rename file "+temp+" to "+f
+}
+
+//Build process infos
+//import table into hsql
+for(int i=0; i < ttrezfiles.size();i++)
+{
+	String csvfile = rootDir+"proj/"+ttrezfiles[i];
+	def argsname = ["form","cat"];
+	def types = ["VARCHAR(30)","VARCHAR(30)"];
+	HSQLFunctions.ImportOrderedCSVTable(ttrezfiles[i].replace(".",""), argsname,types,new File(csvfile),"\t","UTF-8");
+	println("create Table "+ttrezfiles[i].replace(".",""));
+}
+
+//calc richesses lexicales
+LinkedHashMap<String,ArrayList<String>> richesses = new LinkedHashMap<String,ArrayList<String>>();
+richesses.put("Text", ["TTrola","TTartu","TTqjm","TTcomm","TTjehpar","TTrgaqcj"]);
+
+LinkedHashMap<String,ArrayList<String>> richessesCat = new LinkedHashMap<String,ArrayList<String>>();
+richessesCat.put("Text", ["TTrola","TTartu","TTqjm","TTcomm","TTjehpar","TTrgaqcj"]);
+
+LinkedHashMap<String,ArrayList<String>> richessesocc = new LinkedHashMap<String,ArrayList<String>>();
+richesses.put("Text", ["TTrola","TTartu","TTqjm","TTcomm","TTjehpar","TTrgaqcj"]);
+
+LinkedHashMap<String,ArrayList<String>> richessesoccCat = new LinkedHashMap<String,ArrayList<String>>();
+richessesCat.put("Text", ["TTrola","TTartu","TTqjm","TTcomm","TTjehpar","TTrgaqcj"]);
+for(int i=0;i < initiales.size();i++)
+{
+	richesses.put(""+initiales[i], new ArrayList<String>());
+	richessesCat.put(""+initiales[i], new ArrayList<String>());
+	richessesocc.put(""+initiales[i], new ArrayList<String>());
+	richessesoccCat.put(""+initiales[i], new ArrayList<String>());
+}
+for(int i=0; i < initiales.size();i++)
+{
+	for(int j=0; j < initiales.size();j++)
+	{
+		String query = "SELECT count(*) FROM ((SELECT DISTINCT form FROM lexbrut_"+initiales[i]+" ) MINUS (SELECT DISTINCT form FROM lexbrut_"+initiales[j]+"))"
+		println(query);
+		String query2 = "SELECT count(*) FROM ((SELECT DISTINCT cat FROM lexbrut_"+initiales[i]+" ) MINUS (SELECT DISTINCT cat FROM lexbrut_"+initiales[j]+"))"
+		println(query2);
+		String query3 = "SELECT count(form) FROM lexbrut_"+initiales[i]+" WHERE form NOT IN (SELECT form FROM lexbrut_"+initiales[j]+")"
+		println(query3);
+		String query4 = "SELECT count(cat) FROM lexbrut_"+initiales[i]+" WHERE cat NOT IN (SELECT cat FROM lexbrut_"+initiales[j]+")"
+		println(query4);
+		HSQLFunctions.getGroovySql().eachRow(query) {
+			def rich = it.getAt(0);
+			println("rich form :"+ rich);
+			richesses.get(""+initiales[i]).add( ""+rich ) ;	
+		}
+		
+		HSQLFunctions.getGroovySql().eachRow(query2) {
+			def rich = it.getAt(0);
+			println("rich cat :"+ rich);
+			richessesCat.get(""+initiales[i]).add( ""+rich ) ;	
+		}
+		
+		
+		HSQLFunctions.getGroovySql().eachRow(query3) {
+			def rich = it.getAt(0);
+			println("richocc form :"+ rich);
+			richessesocc.get(""+initiales[i]).add( ""+rich ) ;	
+		}
+		
+		HSQLFunctions.getGroovySql().eachRow(query4) {
+			def rich = it.getAt(0);
+			println("richocc cat :"+ rich);
+			richessesoccCat.get(""+initiales[i]).add( ""+rich ) ;	
+		}
+	}
+}
+
+LinkedHashMap<String,ArrayList<String>> matrix = new LinkedHashMap<String,ArrayList<String>>();
+
+matrix.put("Text", ["T    ","Vf    ","Vc    ","TTrola","TTartu","TTqjm","TTcomm","TTjehpar","TTrgaqcj"]);
+for(int i=0;i < initiales.size();i++)
+{
+	matrix.put(""+initiales[i], new ArrayList<String>());
+}
+
+ArrayList<Integer> countOccForm = new ArrayList<Integer>();
+ArrayList<Integer> countOccCat = new ArrayList<Integer>();
+ArrayList<Integer> countLexForm = new ArrayList<Integer>();
+ArrayList<Integer> countLexCat = new ArrayList<Integer>();
+
+for(int i=0;i < initiales.size() ; i++ )
+{
+	String query1 = "SELECT count(*) FROM (SELECT form from lexbrut_"+initiales[i]+")";
+	String query2 = "SELECT count(*) FROM (SELECT cat from lexbrut_"+initiales[i]+")";
+	String query3 = "SELECT count(*) FROM (SELECT DISTINCT form from lexbrut_"+initiales[i]+")";
+	String query4 = "SELECT count(*) FROM (SELECT DISTINCT cat from lexbrut_"+initiales[i]+")";
+	
+	HSQLFunctions.getGroovySql().eachRow(query1) {
+		def rich = it.getAt(0);
+		println("count occ form :"+ rich);
+		countOccForm.add( ""+rich ) ;	
+	}
+	HSQLFunctions.getGroovySql().eachRow(query2) {
+		def rich = it.getAt(0);
+		println("coutn occ cat :"+ rich);
+		countOccCat.add( ""+rich ) ;	
+	}
+	HSQLFunctions.getGroovySql().eachRow(query3) {
+		def rich = it.getAt(0);
+		println("count lex form :"+ rich);
+		countLexForm.add( ""+rich ) ;	
+	}
+	HSQLFunctions.getGroovySql().eachRow(query4) {
+		def rich = it.getAt(0);
+		println("count lex cat :"+ rich);
+		countLexCat.add( ""+rich ) ;	
+	}
+	println("col1 et 2 : "+nbOccurencesTxt.get("lexbrut_"+initiales[i])+" "+nbFormLexique.get("lex_"+initiales[i]))
+	matrix.get(""+initiales[i]).add( ""+nbOccurencesTxt.get("lexbrut_"+initiales[i]) ) ;
+	matrix.get(""+initiales[i]).add( ""+nbFormLexique.get("lex_"+initiales[i]) ) ;
+	matrix.get(""+initiales[i]).add( "0" ) ;
+}
+for(int i=0; i < ttrezfiles.size();i++)
+{
+	//get occurences ordonnées de la gold
+		//get occurences ordonnées de la projection
+		//compare
+	
+	int id = i/ttsrcfiles.size();
+	
+	println("comp "+ttrezfiles[i]+" VS lexbrut_"+initiales[id]);
+	String query = "SELECT count(*) FROM ((SELECT n,form,cat FROM lexbrut_"+initiales[id]+" ) MINUS (SELECT n,form,cat FROM "+ttrezfiles[i].replace(".","")+"))"
+	//HSQLFunctions.executeQuery(query);
+	//println(query)
+	int ttotal=0;
+	int total ;
+	HSQLFunctions.getGroovySql().eachRow(query) {
+		def dif = it.getAt(0);
+		if((""+initiales[id]) != "Z")
+		{
+			total = nbmots[id+1] - nbmots[id];
+			ttotal += total;
+		}
+		else
+			total= ttotal;
+		
+		total = nbOccurencesTxt.get("lexbrut_"+initiales[id])
+		println("dif "+dif+"/ tot "+total+" = "+((float)dif/(float)total));
+		Float perf = ((float)dif/(float)total)*100f;			
+		matrix.get(""+initiales[id]).add( ""+perf ) ;
+	}
+	
+	/*	HSQLFunctions.getGroovySql().eachRow("SELECT count(*) from "+table+" WHERE form NOT IN (SELECT form FROM "+ttrezfiles[i].replace(".","")+")") {
+	 def dif = it.getAt(0);
+	 int total = nbmots[i+1] - nbmots[i];
+	 richesses.put(""+initiales[i],""+(dif/total)) ;
+	 }*/
+}
+println("Matrice d'erreur : ");
+for(String k : matrix.keySet())
+{
+	print(k)
+	for(String f : matrix.get(k))
+		print("\t"+f)
+	println()
+}
+println("richesse lexiques en Form : ");
+for(String k : richesses.keySet())
+{
+	print(k)
+	for(String f : richesses.get(k))
+		print("\t"+f)
+	println()
+}
+println("richesse lexiques en Cat : ");
+for(String k : richessesCat.keySet())
+{
+	print(k)
+	for(String f : richessesCat.get(k))
+		print("\t"+f)
+	println()
+}
+
+println("richesse occurance en Form : ");
+for(String k : richessesocc.keySet())
+{
+	print(k)
+	for(String f : richessesocc.get(k))
+		print("\t"+f)
+	println()
+}
+println("richesse occurance en Cat : ");
+for(String k : richessesoccCat.keySet())
+{
+	print(k)
+	for(String f : richessesoccCat.get(k))
+		print("\t"+f)
+	println()
+}
+
+println("RichBrutes	roland	artu	qjm	comm	jehpar	rgaqcj");
+print("Focc")
+for(int i=0;i < countOccForm.size() ; i++)
+	print("\t"+countOccForm[i]); 
+print("\nCocc")
+for(int i=0;i < countOccCat.size() ; i++)
+	print("\t"+countOccCat[i]); 
+print("\nFvoc")
+for(int i=0;i < countLexForm.size() ; i++)
+	print("\t"+countLexForm[i]); 
+print("\nCvoc")
+for(int i=0;i < countLexCat.size() ; i++)
+	print("\t"+countLexCat[i]); 
+println()
+
Index: tmp/org.txm.core/src/groovy/org/txm/scripts/Distance.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/Distance.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/Distance.groovy	(revision 258)
@@ -0,0 +1,124 @@
+// 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
+// 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.
+//  
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+package org.txm.scripts;
+
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class Distance.
+ */
+public class Distance {
+	
+	//****************************
+	// Get minimum of three values
+	//****************************
+	
+	/**
+	 * Minimum.
+	 *
+	 * @param a the a
+	 * @param b the b
+	 * @param c the c
+	 * @return the int
+	 */
+	private static int Minimum (int a, int b, int c) {
+		int mi;
+		
+		mi = a;
+		if (b < mi) {
+			mi = b;
+		}
+		if (c < mi) {
+			mi = c;
+		}
+		return mi;
+		
+	}
+	
+	//*****************************
+	// Compute Levenshtein distance
+	//*****************************
+	
+	/**
+	 * LD.
+	 *
+	 * @param s the s
+	 * @param t the t
+	 * @return the int
+	 */
+	public static int LD (String s, String t) 
+	{
+		int[][] d; // matrix
+		int n; // length of s
+		int m; // length of t
+		int i; // iterates through s
+		int j; // iterates through t
+		char s_i; // ith character of s
+		char t_j; // jth character of t
+		int cost; // cost
+		
+		// Step 1
+		n = s.length ();
+		m = t.length ();
+		if (n == 0) {
+			return m;
+		}
+		if (m == 0) {
+			return n;
+		}
+		d = new int[n+1][m+1];
+		
+		// Step 2
+		for (i = 0; i <= n; i++) {
+			d[i][0] = i;
+		}
+		for (j = 0; j <= m; j++) {
+			d[0][j] = j;
+		}
+		
+		// Step 3
+		for (i = 1; i <= n; i++) {	
+			s_i = s.charAt (i - 1);
+			// Step 4
+			for (j = 1; j <= m; j++) {
+				t_j = t.charAt (j - 1);
+				
+				// Step 5
+				if (s_i == t_j) {
+					cost = 0;
+				}
+				else {
+					cost = 1;
+				}	
+				
+				// Step 6
+				d[i][j] = Minimum (d[i-1][j]+1, d[i][j-1]+1, d[i-1][j-1] + cost);				
+			}
+		}
+		// Step 7	
+		return d[n][m];
+	}	
+}
Index: tmp/org.txm.core/src/groovy/org/txm/scripts/ParseAndInject.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/scripts/ParseAndInject.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/scripts/ParseAndInject.groovy	(revision 258)
@@ -0,0 +1,292 @@
+// 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
+// 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.
+
+//
+// This file is part of the TXM platform.
+//
+// The TXM platform is free software: you can redistribute it and/or modif y
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 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/>.
+// 
+// 
+// 
+// $LastChangedDate: 2015-12-17 12:11:39 +0100 (Thu, 17 Dec 2015) $
+// $LastChangedRevision: 3087 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.scripts;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStreamWriter;
+import java.io.Reader;
+import java.io.StreamTokenizer;
+import java.io.UnsupportedEncodingException;
+import java.io.Writer;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Read a list of word from a txt file and inject them in w elements
+ *
+ * @author mdecorde
+ */
+class ParseAndInject {
+	
+	/** The writer. */
+	XMLStreamWriter writer;
+	def output;
+	
+	/** The lang. */
+	String lang;
+	
+	/** The type. */
+	String type;
+	
+	/** The brutreader. */
+	BufferedReader brutreader;
+	
+	/** The line. */
+	String line;
+	
+	/** The current. */
+	int current;
+	
+	/** The split. */
+	String[] split;
+	
+	/** The token. */
+	String token;
+	
+	/** The is ex. */
+	boolean isEx;
+	
+	/** The is w. */
+	boolean isW;
+	
+	/**
+	 * start the processing.
+	 *
+	 * @param brutfile the brutfile
+	 * @param xmlfile the xmlfile
+	 * @param outfile the outfile
+	 */
+	public void run(File brutfile, File xmlfile,  File outfile) throws Exception
+	{
+		String localname;
+		
+		// create XML writer
+		XMLOutputFactory factory = XMLOutputFactory.newInstance();
+		output = new FileOutputStream(outfile);
+		writer = factory.createXMLStreamWriter(output, "UTF-8");
+		
+		// create XML reader
+		InputStream inputData = xmlfile.toURI().toURL().openStream();
+		XMLInputFactory inputfactory = XMLInputFactory.newInstance();
+		XMLStreamReader parser = inputfactory.createXMLStreamReader(inputData);
+		
+		//create Exbrut whitespace tokenizer
+		brutreader = new BufferedReader(new FileReader(brutfile));
+		
+		writer.writeStartDocument("UTF-8","1.0");
+		
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next())
+		{
+			switch (event) {
+				case XMLStreamConstants.START_ELEMENT:
+					localname = parser.getLocalName();
+				
+					if (localname == "w") {
+						isW=true;
+					}
+					writer.writeStartElement(localname); // create text tag in each xml file
+					for (int i= 0 ; i < parser.getAttributeCount() ; i++ ) {
+						writer.writeAttribute(parser.getAttributeLocalName(i), parser.getAttributeValue(i));
+					}
+					break;
+				
+				case XMLStreamConstants.END_ELEMENT:
+					localname = parser.getLocalName();
+					if (localname == "w") {
+						isW=false;
+					}
+					writer.writeEndElement();
+				
+					break;
+				
+				case XMLStreamConstants.CHARACTERS:
+					if (isW) {
+						token = this.getNextToken();
+						//System.err.println("next token "+token);
+						if (token == null) {
+							System.err.println("error getting next word");
+							return;
+						}
+						String text = parser.getText();
+						int dist = Distance.LD(token, text);// check integrity
+						int max = 0;
+						if (token.contains("(("))
+						 max += 2
+						if (token.contains("))"))
+							max += 2
+						if (dist > max) {
+							writer.writeComment("Warning !! Distance($token, $text) > 4")
+						}
+						
+						processToken();
+						//writer.writeCharacters(token);
+					} else {
+						writer.writeCharacters(parser.getText());
+					}
+					break;
+			}
+		}
+		
+		writer.close();
+		output.close();
+		parser.close();
+		inputData.close();
+	}
+	
+	/**
+	 * Process token.
+	 */
+	public void processToken()
+	{
+		//System.err.println("process $token");
+		if (token.length() == 0)
+			return;
+		int idxopen = token.indexOf("((")
+		int idxclose = token.indexOf("))")
+		if (isEx) {
+			if (idxopen != -1)
+			if (idxopen < idxclose) {
+				System.err.println("Error: isEx $isEx token: $token : $idxopen < $idxclose");
+				return;
+			}
+			if (idxclose == -1) {
+				writer.writeStartElement("ex");
+				writer.writeCharacters(token);
+				writer.writeEndElement();
+				return;
+			}
+			
+			String ok = token.substring(0, idxclose);
+			
+			writer.writeStartElement("ex");
+			writer.writeCharacters(ok);
+			writer.writeEndElement();
+			isEx = !isEx;
+			
+			token = token.substring(idxclose+2);
+			processToken();
+		} else {
+			if (idxclose != -1)
+			if (idxclose < idxopen) {
+				System.err.println("Error: isEx $isEx token: $token : $idxclose < $idxopen");
+				return;
+			}
+			if (idxopen == -1) {
+				//System.out.println("write "+token);
+				writer.writeCharacters(token);
+				return;
+			}
+			
+			String ok = token.substring(0, idxopen);
+			writer.writeCharacters(ok);
+			isEx = !isEx;
+			token = token.substring(idxopen+2);
+			processToken();
+		}		
+	}
+	
+	/**
+	 * Gets the next token.
+	 *
+	 * @return the next token
+	 */
+	public String getNextToken() throws IOException
+	{
+		if (split == null) {
+			line = brutreader.readLine();
+			if (line == null)
+				return null;
+			
+			split = line.split(" ");
+			if (split == null || split.length == 1) {
+				split = null;
+				return line;
+			} else {
+				current = 0;
+				return split[current++];
+			}
+		} else {
+			if (current < split.length) {
+				return split[current++];
+			} else {
+				split = null;
+				return getNextToken();
+			}
+		}
+	}
+	
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args)
+	{
+		File xmlfile = new File(System.getProperty("user.home"),"xml/injectEx/test.xml");
+		File brutfile = new File(System.getProperty("user.home"),"xml/injectEx/brut.txt");
+		File outfile = new File(System.getProperty("user.home"),"xml/injectEx/test-out.xml");
+		try {
+			new ParseAndInject().run(brutfile, xmlfile, outfile);
+			System.out.println("done");
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+}
+
+
+
+
Index: tmp/org.txm.core/src/groovy/org/txm/functions/mesures/Diversity.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/functions/mesures/Diversity.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/functions/mesures/Diversity.groovy	(revision 258)
@@ -0,0 +1,60 @@
+package org.txm.functions.mesures;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+
+import org.txm.Toolbox;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.corpus.Corpus;
+import org.txm.searchengine.cqp.corpus.Property;
+import org.txm.searchengine.cqp.corpus.QueryResult;
+import org.txm.searchengine.cqp.corpus.query.Query;
+import org.txm.searchengine.cqp.serverException.CqiServerError;
+
+public class Diversity extends Mesure {
+
+	private static final long serialVersionUID = -375293299211271669L;
+	
+	public static List<Synthese> SUPORTED = Arrays.asList(Synthese.SUM);
+	private String query;
+	private String property;
+
+	public Diversity(String domaine, String query, String property) {
+		this.domaine = domaine;
+		this.query = query;
+		this.property = property;
+	}
+
+	@Override
+	public boolean compute(ArrayList<Corpus> corpora) {
+		this.corpora = corpora;
+		Integer[] rez = new Integer[corpora.size()];
+		for (int icorpus = 0 ; icorpus < corpora.size() ; icorpus++) {
+			try {
+				Corpus corpus = corpora.get(icorpus);
+				rez[icorpus] = computeForCorpus(corpus);
+			} catch (Exception e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+				return false;
+			}	
+		}
+		this.add(new MesureResult(this, rez, "Diversite: "+query+" "+property));
+		return true;
+	}
+	
+	private Integer computeForCorpus(Corpus corpus) throws CqiClientException, IOException, CqiServerError {
+		if (domaine != null) corpus = corpus.createSubcorpus(new Query(domaine), "DOMAINE");
+		
+		Property p = corpus.getProperty(property);
+		QueryResult result = corpus.query(new Query(query), "TMP", false);
+		int[] starts = result.getStarts();
+		int[] ids = Toolbox.getCqiClient().cpos2Id(p.getQualifiedName(), starts);
+		HashSet<Integer> set = new HashSet<Integer>();
+		for (int i : ids) set.add(i); // no double
+		return set.size();
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/functions/mesures/Synthese.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/functions/mesures/Synthese.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/functions/mesures/Synthese.groovy	(revision 258)
@@ -0,0 +1,17 @@
+package org.txm.functions.mesures;
+
+public enum Synthese {
+	
+	NONE,
+	COUNTMATCHES,
+	SUM,
+	MEAN,
+	MIN,
+	QUARTILE1,
+	MEDIAN,
+	QUARTILE3,
+	MAX,
+	FIRST,
+	LAST,
+	MIDDLE,
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/functions/mesures/Mesures.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/functions/mesures/Mesures.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/functions/mesures/Mesures.groovy	(revision 258)
@@ -0,0 +1,164 @@
+package org.txm.functions.mesures;
+
+import java.text.DecimalFormat
+
+import org.txm.searchengine.cqp.corpus.Corpus
+import org.txm.searchengine.cqp.corpus.Partition
+
+/**
+ * Container of mesures
+ * 
+ * @author mdecorde
+ *
+ */
+public class Mesures extends ArrayList<Mesure>{
+
+	private static final long serialVersionUID = 324346022230541761L;
+
+	ArrayList<Corpus> data = new ArrayList<Corpus>();
+
+	public Mesures(Corpus corpus) {
+		data = new ArrayList<Corpus>();
+		data.add(corpus);
+	}
+
+	public Mesures(ArrayList<Corpus> corpora) {
+		data = corpora;
+		println "hello TXM"
+	}
+
+	public Mesures(Partition partition) {
+		data.addAll(partition.getParts());
+	}
+
+	public boolean add(Mesure mesure) {
+		if (!mesure.compute(data)) {
+			return false;
+		}
+
+		return super.add(mesure);
+	}
+
+	public boolean export(Writer writer, String encoding, String colseparator, String txtseparator) throws IOException {
+		String line = "Mesures";
+		for (Corpus c : data) {
+			line += colseparator+txtseparator+c.getName().replaceAll(txtseparator,txtseparator+txtseparator)+txtseparator;
+		}
+		writer.write(line+"\n");
+
+		for (Mesure m : this) {
+			for (MesureResult r : m) {
+				line = r.name;
+				for (int i = 0 ; i < r.data.length ; i++)
+					line += colseparator+r.data[i];
+				writer.write(line+"\n");
+			}
+		}
+
+		return true;
+	}
+
+	public boolean export(File outfile, String encoding, String colseparator, String txtseparator) throws IOException {
+		Writer writer = new OutputStreamWriter(
+				new FileOutputStream(outfile), encoding); //$NON-NLS-1$
+		boolean rez = export(writer, encoding, colseparator, txtseparator);
+		writer.close();
+		return rez;
+	}
+
+	DecimalFormat floatFormatter = new DecimalFormat("###,###.##");
+	DecimalFormat intFormatter = new DecimalFormat("###,###,###");
+	public void prettyPrint() {	
+		ArrayList<String[]> lines = new ArrayList<String[]>();
+		int[] maxx = new int[data.size()+1];
+		int[] maxxDecimales = new int[data.size()+1];
+
+
+		String[] line = new String[data.size() + 1];
+		line[0] = "Mesures";
+		maxx[0] = line[0].length();
+		for (int i = 1 ; i <= data.size() ; i++) {
+			line[i] = data.get(i-1).getName();
+			maxx[i] = line[i].length();
+		}
+		lines.add(line);
+
+		// fill lines
+		for (Mesure m : this) {
+			for(MesureResult r : m) {
+				line = new String[data.size()+1];
+				line[0] = r.name;
+				if (maxx[0] < r.name.length())
+					maxx[0] = r.name.length();
+
+				int i = 1;
+				for (Object o : r.data) {
+					String str = ""+o;
+					if (o instanceof Integer) str = intFormatter.format(o);
+					else if (o instanceof Float) str = floatFormatter.format(o);
+
+					line[i] = str;
+
+//					if (maxx[i] < str.length())
+//						maxx[i] = str.length();
+
+					int idxDecimal = str.indexOf(",");
+					if (idxDecimal > 0) {
+						idxDecimal = str.length() - idxDecimal;
+						if (maxxDecimales[i] < idxDecimal)
+							maxxDecimales[i] = idxDecimal;
+					}
+					i++;
+				}
+				lines.add(line);
+			}
+		}
+
+//		System.out.println("maxx: "+Arrays.toString(maxx));
+//		System.out.println("maxxDecimales: "+Arrays.toString(maxxDecimales));
+
+		// fix cells right lengths (decimals)
+		boolean notfirst = false;
+		for (String[] l : lines) {
+			for (int i = 1 ; i < data.size() +1; i++) {
+				String str = l[i];
+				int nbDecimalToAdd = 0;
+
+				if (str.indexOf(",") < 0) {
+					nbDecimalToAdd = maxxDecimales[i];
+				} else {
+					nbDecimalToAdd = maxxDecimales[i] - (str.length() - str.indexOf(","));
+				}
+
+				if (notfirst)
+				for (int j = 0 ; j < nbDecimalToAdd ; j++)
+					str += " ";
+
+				if (maxx[i] < str.length())
+					maxx[i] = str.length();
+				
+				l[i] = str;
+			}
+			notfirst = true;
+		}
+		
+		// fix cells left lengths (alignment)
+		for (String[] l : lines) {
+			for (int i = 0 ; i < data.size() +1; i++) {
+				while (l[i].length() < maxx[i]) {
+					if (i == 0)	l[i] = ""+l[i]+" ";
+					else l[i] = " "+l[i];
+				}
+			}
+		}
+
+		// print cells
+		for (String[] l : lines) {
+			for (int i = 0 ; i < data.size() +1; i++) {
+				if (i == 0) System.out.print(l[i]);
+				else  System.out.print(" "+l[i]);
+			}
+			System.out.println("");
+		}
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/functions/mesures/SyntheseBuilder.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/functions/mesures/SyntheseBuilder.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/functions/mesures/SyntheseBuilder.groovy	(revision 258)
@@ -0,0 +1,157 @@
+package org.txm.functions.mesures;
+
+import java.util.Arrays;
+
+import org.apache.tools.ant.types.resources.selectors.InstanceOf;
+
+public class SyntheseBuilder {
+	private Integer[] isrc;
+	private Integer[] isorted;
+	private Float[] fsrc;
+	private Float[] fsorted;
+
+	public SyntheseBuilder(Integer[] rez) {
+		assert(rez.length > 0);
+		isrc = rez;
+		isorted = new Integer[rez.length];
+		System.arraycopy(rez, 0, isorted, 0, rez.length);
+		Arrays.sort(isorted);
+	}
+
+	public SyntheseBuilder(Float[] rez) {
+		assert(rez.length > 0);
+		fsrc = rez;
+		fsorted = new Float[rez.length];
+		System.arraycopy(rez, 0, fsorted, 0, rez.length);
+		Arrays.sort(fsorted);
+	}
+
+	public Number doSynthese(Synthese synt) {
+		if (isorted != null) {
+			return doSynthese(synt, isrc);
+		} else {
+			return doSynthese(synt, fsrc);
+		}
+	}
+
+	private Integer[] getSorted(Integer[] rez) {
+		return isorted;
+	}
+
+	private Float[] getSorted(Float[] rez) {
+		return fsorted;
+	}
+
+	private Number[] getSorted(Number[] rez) {
+		if (isorted != null) return isorted;
+		return fsorted;
+	}
+
+	public Number doSynthese(Synthese synt, Number[] rez) {
+		if (rez instanceof Integer[])
+			return doISynthese(synt, rez);
+		else if  (rez instanceof Float[])
+			return doFSynthese(synt, rez);
+
+		println "Error: doSynthese unsuported array type: "+rez.getClass();
+		return -1;
+	}
+
+	public Number doISynthese(Synthese synt, Integer[] rez) {
+		switch (synt) {
+			case Synthese.MIN: return min(rez);
+			case Synthese.MAX: return max(rez);
+			case Synthese.MEAN: return mean(rez);
+			case Synthese.QUARTILE1: return quartile1(rez);
+			case Synthese.MEDIAN: return median(rez);
+			case Synthese.QUARTILE3: return quartile3(rez);
+			case Synthese.SUM: return sum(rez);
+			case Synthese.COUNTMATCHES: return rez.length;
+			case Synthese.FIRST:
+				if (rez.length > 0) return rez[0];
+				else return -1;
+			case Synthese.LAST:
+				if (rez.length > 0) return rez[(int)rez.length -1];
+				else return -1;
+			case Synthese.MIDDLE:
+				if (rez.length > 0) return rez[(int)rez.length/2];
+				else return -1;
+		}
+		return null;
+	}
+
+	public Number doFSynthese(Synthese synt, Float[] rez) {
+		switch (synt) {
+			case Synthese.MIN: return min(rez);
+			case Synthese.MAX: return max(rez);
+			case Synthese.MEAN: return mean(rez);
+			case Synthese.QUARTILE1: return quartile1(rez);
+			case Synthese.MEDIAN: return median(rez);
+			case Synthese.QUARTILE3: return quartile3(rez);
+			case Synthese.SUM: return sum(rez);
+			case Synthese.COUNTMATCHES: return rez.length;
+			case Synthese.FIRST:
+				if (rez.length > 0) return rez[0];
+				else return -1;
+			case Synthese.LAST:
+				if (rez.length > 0) return rez[(int)rez.length -1];
+				else return -1;
+			case Synthese.MIDDLE:
+				if (rez.length > 0) return rez[(int)rez.length/2];
+				else return -1;
+		}
+		return null;
+	}
+
+	public Number min(Number[] obj) {
+		obj = getSorted(obj);
+		return obj[0];
+	}
+
+	public Number max(Number[] obj) {
+		obj = getSorted(obj);
+		return obj[obj.length - 1];
+	}
+
+	public Number sum(Float[] obj) {
+		Float sum = 0.0f;
+		for (int i = 0 ; i < obj.length ; i++)
+			sum += obj[i];
+		return sum;
+	}
+
+	public Number sum(Integer[] obj) {
+		Integer sum = 0;
+		for (int i = 0 ; i < obj.length ; i++)
+			sum += obj[i];
+		return sum;
+	}
+
+	public Number mean(Integer[] obj) {
+		Integer i = (Integer) sum(obj);
+		return (float) i / (float)obj.length;
+	}
+
+	public Number mean(Float[] obj) {
+		Float f = (Float) sum(obj);
+		return (float) f / obj.length;
+	}
+
+	public Number quartile1(Number[] obj) {
+		obj = getSorted(obj);
+		int len = obj.length;
+		return obj[(int)len/4];
+	}
+
+	public Number quartile3(Number[] obj) {
+		obj = getSorted(obj);
+		int len = obj.length;
+		return obj[(int)len/4 + len/2];
+	}
+
+	public Number median(Number[] obj) {
+		obj = getSorted(obj);
+		int len = obj.length;
+		return obj[(int)len/2];
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/functions/mesures/package.html
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/functions/mesures/package.html	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/functions/mesures/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Prototype scripts of the "Mesures" functionnality</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/org/txm/functions/mesures/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/functions/mesures/Proportion.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/functions/mesures/Proportion.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/functions/mesures/Proportion.groovy	(revision 258)
@@ -0,0 +1,200 @@
+package org.txm.functions.mesures;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.corpus.Corpus;
+import org.txm.searchengine.cqp.corpus.QueryResult;
+import org.txm.searchengine.cqp.corpus.query.Match;
+import org.txm.searchengine.cqp.corpus.query.Query;
+
+public class Proportion extends Mesure {
+
+	private static final long serialVersionUID = -3160461437451974147L;
+
+	public static List<Synthese> SUPORTED = Arrays.asList(Synthese.COUNTMATCHES, 
+			Synthese.SUM);
+
+	protected String all;
+	protected List<String> cas;
+
+	public Proportion(String domaine, String unit, def syntheses, String all, List<String> cas) {
+		this.domaine = domaine;
+		this.unit= unit;
+		this.syntheses = syntheses;
+
+		this.all = all;
+		this.cas = cas;
+	}
+
+	@Override
+	public boolean compute(ArrayList<Corpus> arg0) {
+		this.corpora = arg0;
+		//		switch (synthese) {
+		//		case COUNTMATCHES:
+		//			return computeMatches();
+		//		case SUM:
+		//			return computeSum();
+		//		default:
+		//			System.out.println("UNSUPPORTED SYNTHESIS: "+synthese);
+		//			return false;
+		//		}
+		return computeSynthese();
+	}
+
+	HashMap<Synthese, ArrayList<Object[]>> rezsPerSynt = new HashMap<Synthese, ArrayList<Object[]>>();
+	private boolean computeSynthese() {
+
+		// initialize list of results 
+		for (Synthese synt : syntheses) {
+			ArrayList<Object[]> rezs = new ArrayList<Object[]>();
+			for (String c : cas) {
+				rezs.add(new Number[corpora.size()]);
+			}
+			rezsPerSynt.put(synt, rezs);
+		}
+
+		for (int icorpus = 0 ; icorpus < corpora.size() ; icorpus++) {
+			computeForCorpus(icorpus, corpora.get(icorpus)); // one cell per cas
+			//			Object[] r = compute(icorpus, corpora.get(icorpus)); // one cell per cas
+			//			for( int i = 0 ; i < cas.size() ; i++)
+			//				rezs.get(i)[icorpus] = r[i];
+		}
+
+		// register results
+		for (Synthese synt : syntheses) {
+			ArrayList<Object[]> rezs = rezsPerSynt.get(synt);
+			for (int i = 0 ; i < cas.size() ; i++) {
+				Object[] rez = rezs.get(i);
+				this.add(new MesureResult(this, rez, "Proportion synt="+synt+" domaine="+domaine+" cas="+cas.get(i)+" all="+all+")"));
+			}
+		}
+		return true;
+	}
+
+	private Integer[] countMatchesInMatches(List<Match> domaine, List<Match> cas) {
+		//		System.out.println("count dom.size "+domaine.size()+" cas.size "+cas.size());
+		//		System.out.println(domaine);
+		//		System.out.println(cas);
+
+		Integer[] rez = new Integer[domaine.size()];
+		int iCas = 0;
+		int iDom = 0;
+		rez[0] = 0;
+
+		int firsterror = 0;
+		while(iCas < cas.size() & iDom < domaine.size()) {
+			Match mDom = domaine.get(iDom);
+			Match mCas = cas.get(iCas);
+
+			if (mDom.getStart() <= mCas.getStart() & mCas.getEnd() <= mDom.getEnd()) {
+				rez[iDom] = rez[iDom] + 1; 
+				iCas++;
+			} else if ( mCas.getStart() < mDom.getStart()) {
+				iCas++;
+			} else if ( mDom.getEnd() < mCas.getEnd()) {
+				iDom++;
+				rez[iDom] = 0;
+			} else {
+				if (firsterror++ == 0)
+					System.out.println("ERROR MATCH COUNT: dom="+domaine+" cas="+cas);
+				System.out.println("ERROR idom="+iDom+" icas="+iCas);
+			}
+		}
+		//		for(int i = 0 ; i < rez.length ; i++) {
+		//			Match m = domaine.get(i);
+		//			while (currentMatchCas != null) {
+		//				if (m.contains(currentMatchCas)) {
+		//					rez[i] = rez[i]+1;
+		//				} else {
+		//					break; // next domaine match
+		//				}
+		//				// next cas match
+		//				if (iCas == cas.size()) break;
+		//				else currentMatchCas = cas.get(iCas++);
+		//			}
+		//		}
+
+		// complete counts
+		for (int i = 0 ; i < rez.length ; i++)
+			if (rez[i] == null) rez[i] = 0;
+
+		return rez;
+	}
+
+	private void computeForCorpus(int icorpus, Corpus corpus) {
+		HashMap<Synthese, Number> allSyntheses = new HashMap<Synthese, Number>();
+		HashMap<Synthese, Number[]> casSyntheses = new HashMap<Synthese, Number[]>();
+		for (Synthese synt : syntheses) {
+			casSyntheses.put(synt, new Number[cas.size()]);
+		}
+		//Object[] rez = new Object[cas.size()];
+		try {
+			Corpus domaineSub = corpus;
+			if (domaine != null && domaine.length() > 0)
+				domaineSub = corpus.createSubcorpus(new Query(domaine), "domaine");
+			else 
+				domaine = corpus.getName();
+			//System.out.println("domaineSub.name "+ domaineSub.getName());
+			//System.out.println("domaine "+ domaine);
+			List<Match> domaineMatches = domaineSub.getMatches();
+			//System.out.println("domaineMatches.size"+ domaineMatches.size());
+			// first process the all case
+
+			QueryResult allSub = domaineSub.query(new Query(all), "all", false);
+			Integer[] allCounts = countMatchesInMatches(domaineMatches, allSub.getMatches());
+			//System.out.println("allCounts.length "+allCounts.length+" count : "+Arrays.toString(allCounts));
+			builder = new SyntheseBuilder(allCounts);
+			for( Synthese synt : syntheses) {
+				Synthese s = synt;
+				if (s.equals(Synthese.NONE)) s = Synthese.SUM;
+				allSyntheses.put(synt, builder.doSynthese(s));
+			}
+
+			// then process each cas
+			for (int iCas = 0 ; iCas < cas.size() ; iCas++) {
+				String c = cas.get(iCas);
+				QueryResult result = domaineSub.query(new Query(c), "TMP", false);
+				Integer[] counts = countMatchesInMatches(domaineMatches, result.getMatches());
+
+				Float[] rapports = new Float[counts.length];
+				for (int i = 0 ; i < rapports.length ; i++) {
+					if (allCounts[i] == 0) rapports[i] = 0.0f;
+					else rapports[i] = (float)counts[i] / (float)allCounts[i];
+				}
+				
+				for (Synthese synt : syntheses) {
+					
+					if (synt.equals(Synthese.NONE)) {
+						int allTotal = 0;
+						for( int i : allCounts) allTotal += i;
+						int casTotal = 0;
+						for( int i : counts) casTotal += i;
+								
+						ArrayList<Object[]> rez = rezsPerSynt.get(synt);
+						rez.get(iCas)[icorpus] = (float)casTotal / (float)allTotal;
+					} else {
+						
+						builder = new SyntheseBuilder(rapports);
+
+						Synthese s = synt;
+						if (s.equals(Synthese.NONE)) s = Synthese.SUM;
+
+						ArrayList<Object[]> rez = rezsPerSynt.get(synt);
+						rez.get(iCas)[icorpus] = builder.doSynthese(s);
+					}
+				}
+			}
+
+			if (!domaineSub.equals(corpus)) { // cleaning
+				domaineSub.delete();
+			}
+		} catch (CqiClientException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/functions/mesures/Magnitude.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/functions/mesures/Magnitude.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/functions/mesures/Magnitude.groovy	(revision 258)
@@ -0,0 +1,127 @@
+package org.txm.functions.mesures;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.corpus.Corpus;
+import org.txm.searchengine.cqp.corpus.QueryResult;
+import org.txm.searchengine.cqp.corpus.query.Match;
+import org.txm.searchengine.cqp.corpus.query.Query;
+
+/**
+ * 
+ * Magnitude synonymes
+extent	Magnitude, importance, extension, superficie, longueur
+magnitude	Magnitude, grandeur, magnitude
+amplitude	amplitude, Magnitude, largeur
+fullness	plénitude, Magnitude, abondance
+width	largeur, Magnitude
+fulness	plénitude, Magnitude, abondance
+richness	richesse, abondance, Magnitude, luxe, fertilité
+ampleness	Magnitude
+thoroughness	minutie, Magnitude
+roundness	rondeur, circularité, Magnitude, franchise
+
+ * @author mdecorde
+ *
+ */
+public class Magnitude extends Mesure {
+
+	private static final long serialVersionUID = 3317066047569716511L;
+
+	private static String TMP = "TMP";
+	
+	public Magnitude(String domaine, String unit, Synthese[] syntheses) {
+		this.domaine = domaine;
+		this.unit= unit;
+		this.syntheses = syntheses;
+
+		//if (synthese.equals(Synthese.NONE)) this.synthese = Synthese.SUM; // NO synthese will sum the matches size
+	}
+
+	@Override
+	public boolean compute(ArrayList<Corpus> corpora) {
+		this.corpora = corpora;
+
+		//		switch (synthese) {
+		//		case COUNTMATCHES:
+		//			return computeCounts();
+		//		case MAX:
+		//		case MIN:
+		//		case MEAN:
+		//		case QUARTILE1:
+		//		case QUARTILE3:
+		//		case MEDIAN:
+		//		case NONE:
+		//		case SUM:
+		return computeSynthese();
+		//		default:
+		//			System.out.println("UNSUPPORTED SYNTHESIS: "+synthese);
+		//			return false;
+		//		}
+	}
+
+	//	private boolean computeCounts() {
+	//		Integer[] rez = new Integer[corpora.size()];
+	//		for (int i = 0 ; i < corpora.size() ; i++) {
+	//			Corpus corpus = corpora.get(i);
+	//			try {
+	//				rez[i] = computeCount(corpus);
+	//			} catch (CqiClientException e) {
+	//				e.printStackTrace();
+	//				return false;
+	//			}
+	//		}
+	//		this.add(new MesureResult(this, rez, "Magnitude synt="+synthese+" unit="+unit+" dom="+domaine));
+	//		return true;
+	//	}
+
+	//	private int computeCount(Corpus corpus) throws CqiClientException {
+	//		QueryResult result = corpus.query(new Query(domaine), TMP);
+	//		return result.getNMatch();
+	//	}
+	HashMap<Synthese, Object[]> rezPerSynthese = new HashMap<Synthese, Object[]>();
+	private boolean computeSynthese() {
+
+		for (Synthese synt : syntheses) {
+			rezPerSynthese.put(synt, new Object[corpora.size()]);
+		}
+
+		for (int i = 0 ; i < corpora.size() ; i++) {
+			Corpus corpus = corpora.get(i);
+			try {
+				computeSynthese(i, corpus);
+			} catch (CqiClientException e) {
+				e.printStackTrace();
+				return false;
+			}
+		}
+		for ( Synthese synt : syntheses) {
+			this.add(new MesureResult(this, rezPerSynthese.get(synt), "Magnitude synt="+synt+" unit="+unit+" dom="+domaine));
+		}
+		return true;
+	}
+
+	private void computeSynthese(int icorpus, Corpus corpus) throws CqiClientException {
+        QueryResult result = corpus.query(new Query(domaine), TMP, false);		
+		List<Match> matches = result.getMatches();
+		Integer[] sizes = new Integer[matches.size()];
+		for (int i = 0 ; i < matches.size() ; i++) {
+			Match m  = matches.get(i);
+			sizes[i] = m.getEnd() - m.getStart() + 1;
+		}
+		
+		builder = new SyntheseBuilder(sizes);
+		for (Synthese synt : syntheses) {
+			Object[] rez = rezPerSynthese.get(synt);
+			if (synt.equals(Synthese.NONE)) {
+				rez[icorpus] = builder.doSynthese(Synthese.SUM);
+			} else {
+				rez[icorpus] = builder.doSynthese(synt);
+			}
+		}
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/functions/mesures/MesureResult.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/functions/mesures/MesureResult.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/functions/mesures/MesureResult.groovy	(revision 258)
@@ -0,0 +1,13 @@
+package org.txm.functions.mesures;
+
+public class MesureResult {
+	public Mesure from;
+	public Object[] data;
+	public String name;
+	
+	public MesureResult(Mesure from, Object[] data, String name) {
+		this.from = from;
+		this.data = data;
+		this.name = name;
+	}
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/functions/mesures/Mesure.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/functions/mesures/Mesure.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/functions/mesures/Mesure.groovy	(revision 258)
@@ -0,0 +1,19 @@
+package org.txm.functions.mesures;
+
+import java.util.ArrayList;
+
+import org.txm.searchengine.cqp.corpus.Corpus;
+
+public abstract class Mesure extends ArrayList<MesureResult> {
+	
+	private static final long serialVersionUID = 4804073482551008502L;
+	
+	protected String domaine;
+	protected String unit;
+	protected Synthese[] syntheses;
+	protected SyntheseBuilder builder;
+
+	protected ArrayList<Corpus> corpora;
+	
+	public abstract boolean compute(ArrayList<Corpus> subcorpora);
+}
Index: tmp/org.txm.core/src/groovy/org/txm/functions/mesures/PresenceRate.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/functions/mesures/PresenceRate.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/functions/mesures/PresenceRate.groovy	(revision 258)
@@ -0,0 +1,10 @@
+package org.txm.functions.mesures;
+import java.util.Arrays;
+
+public class PresenceRate extends Proportion {
+	public PresenceRate(String unit, def syntheses, String all, String cas) {
+		super(all, unit, syntheses, all, Arrays.asList(cas));
+//remplace momentanément la ligne suivante, pour pouvoir tourner sur une liste de corpus
+//		super(null, unit, syntheses, all, Arrays.asList(cas));
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/sw/SplitFileRegExp.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/sw/SplitFileRegExp.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/sw/SplitFileRegExp.groovy	(revision 258)
@@ -0,0 +1,58 @@
+package org.txm.sw
+
+// PARAMETERS //
+
+infile = new File("/home/mdecorde/xml/test/grep")			// the file to process
+outdir = new File("/home/mdecorde/xml/test/result")			// the directory which received result files
+regex = /(<\?(.+))/           						// matching line test
+prefix = "prefix"							// result files prefix
+replace = '$2'								// use the matching line to build the filename
+ext = ".xml"                                     			// result files extension
+includeSeparatorLine = true						// should include matching line in result files
+writeAtStartup = false							// should create files only if a matching line is found
+encoding = "UTF-8"
+// CALL //
+splitByRegExp(infile, outdir, 
+//	regex, prefix, replace, ext,
+	regex, prefix, null, ext, 
+	includeSeparatorLine, writeAtStartup)
+
+
+// PUBLIC METHODS //
+def splitByRegExp(def infile, def outdir, def regex, def prefix, def replace, def ext, def includeSeparatorLine, def writeAtStartup) {
+	int count = 1;
+	outdir.deleteDir()
+	outdir.mkdirs()
+	if (!outdir.exists()) return false
+	if (!infile.isFile()) return false
+
+	File outfile = null;
+	def writer = null
+
+	if (writeAtStartup) {
+		if (replace == null) {
+			outfile = new File(outdir, prefix+(count++)+ext)
+		}
+		writer = outfile.newWriter(encoding)
+	}
+	infile.eachLine(encoding) { line ->
+		if (line ==~ regex) { // new file
+			if (replace == null) {
+				outfile = new File(outdir, prefix+(count++)+ext)
+			} else {
+				String name = prefix+line.replaceAll(regex, replace)+ext
+				outfile = new File(outdir, name)
+			}
+			if (writer != null)	writer.close() // close previous writer
+			writer = outfile.newWriter(encoding)
+			println "new file $outfile"
+			if (includeSeparatorLine) {
+				writer.println line
+			}
+		} else {
+			if (writer != null)
+				writer.println line
+		}
+	}
+	if (writer != null)	writer.close()
+}
Index: tmp/org.txm.core/src/groovy/org/txm/sw/RemoveTag.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/sw/RemoveTag.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/sw/RemoveTag.groovy	(revision 258)
@@ -0,0 +1,101 @@
+package org.txm.sw
+
+import javax.xml.parsers.*
+import javax.xml.transform.*
+import javax.xml.xpath.*
+
+import org.txm.importer.graal.PersonalNamespaceContext
+import org.txm.utils.xml.DomUtils
+import org.w3c.dom.Document
+import org.w3c.dom.Element
+
+class RemoveTag {
+
+	public static boolean xpath(File xmlfile, String xpath)
+	{
+		if (!xmlfile.exists()) {
+			println "Error: $xmlfile does not exists"
+		}
+
+		if (!(xmlfile.canRead() && xmlfile.canWrite())) {
+			println "Error: $xmlfile is not readable or writable"
+		}
+
+		DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
+		domFactory.setNamespaceAware(true); // never forget this!
+		DocumentBuilder builder = domFactory.newDocumentBuilder();
+		Document doc = builder.parse(xmlfile);
+
+		XPathFactory xpathfactory = XPathFactory.newInstance();
+		def _xpath = xpathfactory.newXPath();
+		_xpath.setNamespaceContext(new PersonalNamespaceContext());
+		def expr = _xpath.compile(xpath);
+		def nodes = expr.evaluate(doc, XPathConstants.NODESET);
+
+		for(Element node : nodes) {
+			def parent = node.getParentNode();
+			if (parent != null)
+				parent.removeChild(node)
+		}
+		return DomUtils.save(doc, xmlfile)
+	}
+
+	public static boolean xpath(File xmlfile, def xpaths)
+	{
+		if (!xmlfile.exists()) {
+			println "Error: $xmlfile does not exists"
+		}
+
+		if (!(xmlfile.canRead() && xmlfile.canWrite())) {
+			println "Error: $xmlfile is not readable or writable"
+		}
+
+		DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
+		domFactory.setNamespaceAware(true); // never forget this!
+		DocumentBuilder builder = domFactory.newDocumentBuilder();
+		Document doc = builder.parse(xmlfile);
+		XPathFactory xpathfactory = XPathFactory.newInstance();
+
+		for (String xpath : xpaths) {
+			def _xpath = xpathfactory.newXPath();
+			_xpath.setNamespaceContext(new PersonalNamespaceContext());
+			def expr = _xpath.compile(xpath);
+			def nodes = expr.evaluate(doc, XPathConstants.NODESET);
+
+			for (Element node : nodes) {
+				def parent = node.getParentNode();
+				if (parent != null)
+					parent.removeChild(node)
+			}
+		}
+		return DomUtils.save(doc, xmlfile)
+
+	}
+	public static void main(String[] args) {
+		File dir = new File("/home/mdecorde/Bureau/matrice/témoignages")
+		File infile = new File(dir, "tei2.xml")
+		File outfile = new File(dir, "tei2-out.xml")
+
+		def doc = DomUtils.load(infile);
+		def addList = doc.getDocumentElement().getElementsByTagName("add")
+		println "nb <add> to delete: "+addList.getLength()
+		for(int i = 0 ; i < addList.getLength() ; i++) {
+			Element node = addList.item(i);
+			String text = node.getTextContent().trim();
+			Element parent = node.getParentNode();
+			parent.insertBefore(doc.createTextNode(text), node)
+			parent.removeChild(node);
+			i--
+		}
+
+		def delList = doc.getDocumentElement().getElementsByTagName("del")
+		println "nb <del> to delete: "+delList.getLength()
+		for(int i = 0 ; i < delList.getLength() ; i++) {
+			Element node = delList.item(i);
+			node.getParentNode().removeChild(node);
+			i--
+		}
+
+		DomUtils.save(doc, outfile);
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/sw/RenameFilesInDirectoryByXpathElementContentTrace.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/sw/RenameFilesInDirectoryByXpathElementContentTrace.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/sw/RenameFilesInDirectoryByXpathElementContentTrace.groovy	(revision 258)
@@ -0,0 +1,38 @@
+package org.txm.sw
+// Copyright © - ENS de Lyon - http://textometrie.ens-lyon.fr
+//
+// This file is part of the TXM platform.
+//
+// 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 3 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/>.
+//
+// $LastChangedDate: 2013-05-02 10:05:14 +0200 (jeu., 02 mai 2013) $
+// $LastChangedRevision: 2377 $
+// $LastChangedBy: sheiden $
+//
+
+import org.txm.importer.*
+
+// parameters
+													// **change this parameter**
+dir = new File(System.getProperty("user.home"), "TXM/sources/Factiva")
+													// **change this parameter**
+xpath = "/article/@date"
+
+print "Renaming"
+// main body
+dir.eachFileMatch(~/.*.xml/){ file ->               // for each file
+	file.renameTo(new File(file.getParent(), XPathResult.getXpathResponse(file, xpath)+"_"+file.name));
+	print "."
+}
+println "Done."
Index: tmp/org.txm.core/src/groovy/org/txm/sw/package.html
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/sw/package.html	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/sw/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Contains Groovy scripts that will be included in the Source Workbench</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/org/txm/sw/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/sw/RenameFilesInDirectoryByXpathElementContent.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/sw/RenameFilesInDirectoryByXpathElementContent.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/sw/RenameFilesInDirectoryByXpathElementContent.groovy	(revision 258)
@@ -0,0 +1,36 @@
+package org.txm.sw
+// Copyright © - ENS de Lyon - http://textometrie.ens-lyon.fr
+//
+// This file is part of the TXM platform.
+//
+// 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 3 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/>.
+//
+// $LastChangedDate: 2013-05-02 10:05:14 +0200 (jeu., 02 mai 2013) $
+// $LastChangedRevision: 2377 $
+// $LastChangedBy: sheiden $
+//
+import org.txm.importer.*
+
+// parameters
+
+// **change this parameter**
+dir = new File(System.getProperty("user.home"), "TXM/sources/Factiva")
+
+// **change this parameter**
+xpath = "/article/@date"
+
+// main body
+dir.eachFileMatch(~/.*.xml/){ file -> // for each file
+	file.renameTo(new File(file.getParent(), XPathResult.getXpathResponse(file, xpath)+"_"+file.name));
+}
Index: tmp/org.txm.core/src/groovy/org/txm/sw/ChangeEncoding.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/sw/ChangeEncoding.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/sw/ChangeEncoding.groovy	(revision 258)
@@ -0,0 +1,47 @@
+package org.txm.sw
+// Copyright © - ENS de Lyon - http://textometrie.ens-lyon.fr
+//
+// This file is part of the TXM platform.
+//
+// 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 3 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/>.
+//
+// $LastChangedDate: 2012-02-01 17:58:45 +0100 (mer., 01 févr. 2012) $
+// $LastChangedRevision: 2122 $
+// $LastChangedBy: mdecorde $
+//
+
+// PARAMETERS
+
+File dir = new File("/home/mdecorde/TEMP/atelier") // the directory containing the files
+String fromEncoding = "UTF-8" // the sources encoding
+String toEncoding = "windows-1252" // the final encoding
+
+// END OF PARAMETERS
+
+def processDirectory(File dir, String fromEncoding, String toEncoding) {
+	dir.eachFileMatch(~/.*.txt/){ file -> // for each file with the "txt" extension
+		processFile(file, fromEncoding, toEncoding)
+	}
+}
+
+def processFile(File file, String fromEncoding, String toEncoding) {
+	println "Convert file: $file"
+	String text = file.getText(fromEncoding);
+	file.withWriter(toEncoding) {writer -> // read with the "fromEncoding"
+		writer.write(text) // write with the "toEncoding"
+	}
+}
+
+processDirectory(dir, fromEncoding, toEncoding)
+println "Done"
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/sw/RenameFilesInDirectoryByRegExp.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/sw/RenameFilesInDirectoryByRegExp.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/sw/RenameFilesInDirectoryByRegExp.groovy	(revision 258)
@@ -0,0 +1,39 @@
+package org.txm.sw
+// Copyright © - ENS de Lyon - http://textometrie.ens-lyon.fr
+//
+// This file is part of the TXM platform.
+//
+// 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 3 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/>.
+//
+// $LastChangedDate: 2012-02-01 17:58:45 +0100 (mer., 01 févr. 2012) $
+// $LastChangedRevision: 2122 $
+// $LastChangedBy: mdecorde $
+//
+import org.txm.importer.*
+
+// PARAMETERS
+
+File dir = new File("/home/mdecorde/TEMP/atelier")
+String searchRegexp = "(.+).txt"
+String replaceRegexp = 't$1.txt' // WARNING: Use simple quotes only
+
+// END OF PARAMETERS
+
+// main body
+dir.eachFileMatch(~/.*.txt/){ file -> // for each file with extension "txt"
+	String filename = file.getName()
+	filename = filename.replaceAll(searchRegexp, replaceRegexp)
+	println "Rename file '$file' to '$filename'"
+	file.renameTo(new File(file.getParent(), filename))
+}
Index: tmp/org.txm.core/src/groovy/org/txm/sw/SearchReplaceInDirectoryTrace.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/sw/SearchReplaceInDirectoryTrace.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/sw/SearchReplaceInDirectoryTrace.groovy	(revision 258)
@@ -0,0 +1,56 @@
+package org.txm.sw
+// Copyright © - ENS de Lyon - http://textometrie.ens-lyon.fr
+//
+// This file is part of the TXM platform.
+//
+// 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 3 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/>.
+//
+// $LastChangedDate$
+// $LastChangedRevision$
+// $LastChangedBy$
+//
+
+// parameters
+
+dir = new File("/home/sheiden/TXM/sources/Factiva") // **change this parameter**
+ext = "\\.xml"                                      // **change this parameter**
+find = /date="([0-9]+)-([0-9]+-[0-9]+)"/            // **change this parameter**
+replaceWith = 'date="$1-$2" year="$1"'              // **change this parameter**
+encoding = "cp1252"
+test = false // XML Validation
+
+// main body
+println "SearchReplaceInDirectory: processing directory '$dir'..."
+dir.eachFileMatch(~/.*$ext/) { file ->               // for each file matching extension
+    println "SearchReplaceInDirectory: processing file '$file'..."
+    println "XML syntax initial check"
+    if (org.txm.importer.ValidateXml.test(file)) {
+        println "Search&Replace"
+        def tmp = File.createTempFile("SearchReplaceInDirectoryTemp", ".xml", dir) // create temporary file
+        tmp.withWriter(encoding) { writer ->
+            file.eachLine(encoding) { line ->                  // for each line
+                writer.println line.replaceAll(find, replaceWith) // find&replace and print
+            }
+        }
+        file.delete()
+        tmp.renameTo(file)                           // save results
+        
+        println "XML syntax final check"
+        if (test && !org.txm.importer.ValidateXml.test(file)) {
+            println "** Warning: bad XML syntax for result file '$file'"
+        }
+    } else {
+        println "Skipping file '$file'"
+    }
+}
Index: tmp/org.txm.core/src/groovy/org/txm/sw/SearchReplaceInDirectory.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/sw/SearchReplaceInDirectory.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/sw/SearchReplaceInDirectory.groovy	(revision 258)
@@ -0,0 +1,73 @@
+package org.txm.sw
+// Copyright © - ENS de Lyon - http://textometrie.ens-lyon.fr
+// @author sheiden
+//
+// This file is part of the TXM platform.
+//
+// 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 3 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/>.
+//
+// $LastChangedDate: 2013-05-02 11:28:42 +0200 (jeu., 02 mai 2013) $
+// $LastChangedRevision: 2378 $
+// $LastChangedBy: sheiden $
+//
+
+// parameters
+
+// **change this parameter**
+dir = new File(System.getProperty("user.home"), "Bureau/voeux")
+
+// **change this parameter**
+ext = "\\.txt"
+
+// **change this parameter**
+find = "’"
+
+// **change this parameter**
+replaceWith = "'"
+
+// **change this parameter**
+encoding = "utf-8"
+
+// **change this parameter**
+// 'true' = only display matching lines, 'false' = replace in matching files
+showMatchingFilesOnly = false
+
+
+//find = /date="([0-9]+)-([0-9]+-[0-9]+)"/
+		      // **change this parameter**
+//replaceWith = 'date="$1-$2" year="$1"'
+		      // **change this parameter** (warning: '$1', '$2'... can be interpreted by Groovy in "..." strings)
+
+// main body
+println "in $dir ... "+/.*$ext/
+dir.eachFileMatch(~/.*$ext/) { file ->               // for each file matching extension
+	println file.getName()
+	
+if (showMatchingFilesOnly) {
+	
+       file.eachLine(encoding) { line ->                  // for each line
+           if (line.matches(".*$find.*")) { println " *match* : "+line }
+	   }
+} else {
+       def tmp = File.createTempFile("SearchReplaceInDirectoryTemp", ".tmp", dir) // create temporary file
+       tmp.write('')                                // create empty file
+       tmp.withWriter(encoding) { writer ->
+           file.eachLine(encoding) { line ->                  // for each line
+           	writer.println line.replaceAll(find, replaceWith) // find&replace and print
+           }
+       }
+       file.delete()
+       tmp.renameTo(file)                           // save results
+ }
+}
Index: tmp/org.txm.core/src/groovy/org/txm/sw/SearchReplaceXMLInDirectoryTrace.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/sw/SearchReplaceXMLInDirectoryTrace.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/sw/SearchReplaceXMLInDirectoryTrace.groovy	(revision 258)
@@ -0,0 +1,53 @@
+package org.txm.sw
+// Copyright © - ENS de Lyon - http://textometrie.ens-lyon.fr
+//
+// This file is part of the TXM platform.
+//
+// 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 3 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/>.
+//
+// $LastChangedDate: 2013-05-02 10:05:14 +0200 (jeu., 02 mai 2013) $
+// $LastChangedRevision: 2377 $
+// $LastChangedBy: sheiden $
+//
+
+// parameters
+
+dir = new File("/home/sheiden/TXM/sources/Factiva") // **change this parameter**
+ext = "\\.xml"                                      // **change this parameter**
+find = /date="([0-9]+)-([0-9]+-[0-9]+)"/            // **change this parameter**
+replaceWith = 'date="$1-$2" year="$1"'              // **change this parameter**
+
+// main body
+println "SearchReplaceInDirectory: processing directory '$dir'..."
+dir.eachFileMatch(~/.*$ext/){ file ->               // for each file matching extension
+    println "SearchReplaceInDirectory: processing file '$file'..."
+    println "XML syntax initial check"
+    if (org.txm.importer.ValidateXml.test(file)) {
+        println "Search&Replace"
+        def tmp = File.createTempFile("SearchReplaceInDirectoryTemp", ".xml", dir) // create temporary file
+        tmp.write('')                                // create empty file
+        tmp.withWriter { writer ->
+            file.eachLine { line ->                  // for each line
+                writer.println line.replaceAll(find, replaceWith) // find&replace and print
+            }
+        }
+        tmp.renameTo(file)                           // save results
+        println "XML syntax final check"
+        if (!org.txm.importer.ValidateXml.test(file)) {
+            println "** Warning: bad XML syntax for result file '$file'"
+        }
+    } else {
+        println "Skipping file '$file'"
+    }
+}
Index: tmp/org.txm.core/src/groovy/org/txm/sw/AddHeadTailInDirectory.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/sw/AddHeadTailInDirectory.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/sw/AddHeadTailInDirectory.groovy	(revision 258)
@@ -0,0 +1,68 @@
+package org.txm.sw
+// Copyright © - ENS de Lyon - http://textometrie.ens-lyon.fr
+// @author sheiden
+//
+// This file is part of the TXM platform.
+//
+// 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 3 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/>.
+//
+// $LastChangedDate: 2012-02-01 17:58:45 +0100 (mer., 01 févr. 2012) $
+// $LastChangedRevision: 2122 $
+// $LastChangedBy: mdecorde $
+//
+
+import static groovy.io.FileType.*
+
+// PARAMETERS
+
+// dir
+def dir = new File("/home/mdecorde/TEMP/atelier")
+
+// inputEncoding
+def inputEncoding = "UTF-8"
+
+// outputEncoding
+def outputEncoding = "UTF-8"
+
+// head
+def head = "<?xml version=\"1.0\" encoding=\"${outputEncoding}\"?>\n<discours>\n" // can be empty
+
+// tail
+def tail = "</discours>\n"; // can be empty
+
+// fileExtension
+def fileExtension = "txt"
+
+//END OF PARAMETERS
+
+// filePattern
+def filePattern = ".*\\.$fileExtension\$"
+
+// main body
+dir.eachFileMatch(~/$filePattern/) { inputFile ->				// for each file matching extension
+    def outputTmp = File.createTempFile("AddHeadInDirectoryTemp", '.tmp', dir) // create temporary file
+    outputTmp.withWriter(outputEncoding) { writer ->
+    if (head != null && head.length() > 0)
+    	writer.print(head)
+	inputFile.withReader(inputEncoding) { reader ->
+			reader.eachLine { inputLine ->               		// for each line
+				writer.println inputLine
+			}
+		}
+	if (tail != null && tail.length() > 0)
+		writer.print(tail)
+	writer.close()
+    }
+	assert outputTmp.renameTo(inputFile)						// save results
+}		
Index: tmp/org.txm.core/src/groovy/org/txm/sw/SearchReplaceFromList.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/sw/SearchReplaceFromList.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/sw/SearchReplaceFromList.groovy	(revision 258)
@@ -0,0 +1,57 @@
+package org.txm.sw
+// Copyright © - ENS de Lyon - http://textometrie.ens-lyon.fr
+// @author mdecorde
+//
+// This file is part of the TXM platform.
+//
+// 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 3 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/>.
+//
+// $LastChangedDate: 2012-10-01 08:24:58 +0200 (lun., 01 oct. 2012) $
+// $LastChangedRevision: 2269 $
+// $LastChangedBy: sheiden $
+//
+
+// parameters
+
+file = new File("/home/mdecorde/xml/apollinaire/apollinaire.xml")
+out = new File("/home/mdecorde/xml/apollinaire/apo/apollinaire.xml")
+def changesFind = [ "</recueil>",	"<paragraphe>", "</paragraphe>", "<racine>",	"</racine>", "<interp",	"</interp>", "<TEI xmlns=\"http://www.tei-c.org/ns/1.0\" xmlns:txm=\"http://textometrie.org/1.0\">"	]
+def changesReplace = [ "</recueil><pb/>", "<p>", "</p><lb/>", '<text id ="apollinaire">', '</text',	'<txm:ana',	'</txm:ana>', """<TEI xmlns="http://www.tei-c.org/ns/1.0" xmlns:txm="http://textometrie.org/1.0">
+<teiHeader type="text">
+<fileDesc>
+<titleStmt>
+<title>null</title>
+<respStmt>
+<resp id="cordial">initial tagging</resp></respStmt>
+</titleStmt>
+</fileDesc>
+<encodingDesc>
+<classDecl>
+<taxonomy id="pos"><bibl type="tagset"/></taxonomy>
+<taxonomy id="func"><bibl type="tagset"/></taxonomy>
+<taxonomy id="lemma"><bibl type="tagset"/></taxonomy>
+</classDecl>
+</encodingDesc>
+</teiHeader>""" ]
+
+// main body
+out.write('')                                // create empty file
+out.withWriter { writer ->
+	String text = file.getText("UTF-8");
+	for (int i = 0 ; i < changesFind.size() ; i++) {
+		println "loop $i: "+changesFind[i] +" >> "+ changesReplace[i]
+		text = text.replaceAll(changesFind[i], changesReplace[i])
+	}
+	out.write(text)
+}
Index: tmp/org.txm.core/src/groovy/org/txm/sw/ReplaceXmlDomNode.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/sw/ReplaceXmlDomNode.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/sw/ReplaceXmlDomNode.groovy	(revision 258)
@@ -0,0 +1,161 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+package org.txm.sw;
+
+import java.io.File;
+
+import javax.xml.namespace.NamespaceContext;
+import org.w3c.dom.*;
+import javax.xml.parsers.*;
+import org.xml.sax.SAXException;
+import javax.xml.stream.*;
+import javax.xml.xpath.*;
+
+import org.txm.sw.ReplaceXmlDomNode;
+import org.txm.importer.graal.PersonalNamespaceContext;
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.transform.*;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class ReplaceXmlDomNode.
+ */
+class ReplaceXmlDomNode
+{
+	
+	/** The ns context. */
+	NamespaceContext nsContext = new PersonalNamespaceContext();
+	
+	/**
+	 * Instantiates a new replace xml dom node.
+	 *
+	 * @param src the src
+	 * @param target the target
+	 * @param xpathsrc the xpathsrc
+	 * @param xpathtarget the xpathtarget
+	 */
+	public ReplaceXmlDomNode(File src, File target, String xpathsrc, String xpathtarget)
+	{
+		def builder = DocumentBuilderFactory.newInstance().newDocumentBuilder()
+		
+		def docsrc = builder.parse(src);
+		def doctarget = builder.parse(target);
+		
+		Node srcnode = null;
+		Node targetnode = null;
+		
+		XPathFactory factory = XPathFactory.newInstance();
+		XPath XpathObj = factory.newXPath();
+		XpathObj.setNamespaceContext(nsContext);
+		
+		XPathExpression expr = XpathObj.compile(xpathsrc);
+		for(Node node : (NodeList) expr.evaluate(docsrc, XPathConstants.NODESET))
+		{
+			srcnode = node;
+			break;
+		}
+		
+		XPathExpression expr2 = XpathObj.compile(xpathtarget);
+		for(Node node : (NodeList) expr2.evaluate(doctarget, XPathConstants.NODESET))
+		{
+			targetnode = node;
+			break;
+		}
+		
+		//println "replace : "+targetnode
+		//println "by : "+srcnode
+		if(targetnode != null && srcnode != null)
+		{
+			Node parent = targetnode.getParentNode();
+			parent.removeChild(targetnode);
+			parent.appendChild(doctarget.importNode(srcnode, true));
+			
+			save(doctarget, target);
+		}
+		else
+		{
+			println "Error: "
+			println "target node = "+targetnode
+			println "src node = "+srcnode
+		}
+		
+	}
+	
+	/**
+	 * Save.
+	 *
+	 * @param doc the doc
+	 * @param outfile the outfile
+	 * @return true, if successful
+	 */
+	private boolean save(def doc, File outfile)
+	{
+		try {
+			// Création de la source DOM
+				Source source = new DOMSource(doc);
+			
+			// Création du fichier de sortie
+				Writer writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outfile), "UTF-8")); 
+			Result resultat = new StreamResult(writer);
+			
+			// Configuration du transformer
+			TransformerFactory fabrique = new net.sf.saxon.TransformerFactoryImpl();
+			Transformer transformer = fabrique.newTransformer();
+			transformer.setOutputProperty(OutputKeys.INDENT, "yes");
+			transformer.setOutputProperty(OutputKeys.METHOD, "xml");
+			transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
+			
+			// Transformation
+			transformer.transform(source, resultat);
+			writer.close();
+			doc = null;
+			return true;
+		} catch (Exception e) {
+			e.printStackTrace();
+			return false;
+		}
+	}
+	
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args)
+	{
+		String home = System.getProperty("user.home")
+		File src = new File(home, "xml/subberoul/subcorpus0000.xml")
+		File target = new File(home, "xml/subberoul/master.xml")
+		String xpathsrc = "//subcorpus"
+		String xpathtarget = "//subcorpus[@name=\"subcorpus0000\"]"
+		
+		new ReplaceXmlDomNode(src, target, xpathsrc, xpathtarget)
+	}
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/tokenizer/TTest.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/tokenizer/TTest.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/tokenizer/TTest.groovy	(revision 258)
@@ -0,0 +1,39 @@
+package org.txm.tokenizer
+
+public class TTest {
+	def regex;
+	def type = "w";
+	def before=1, hit=2, after=3;
+	public TTest(def regex, String type, int before, int hit, int after) {
+		this.regex = regex
+		this.type = type
+		this.before = before
+		this.hit = hit
+		this.after = after
+	}
+
+	public TTest(def regex, int before, int hit, int after) {
+		this.regex = regex
+		this.before = before
+		this.hit = hit
+		this.after = after
+	}
+
+	public TTest(def regex, String type) {
+		this.regex = regex
+		this.type= type
+	}
+
+	public TTest(def regex) {
+		this.regex = regex
+	}
+
+	/* (non-Javadoc)
+	 * @see java.lang.Object#toString()
+	 */
+	@Override
+	public String toString() {
+		return "[regex=" + regex + ", type=" + type + ", before="+ before + ", hit=" + hit + ", after=" + after + "]";
+	}
+}
+
Index: tmp/org.txm.core/src/groovy/org/txm/tokenizer/TokenizerClasses.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/tokenizer/TokenizerClasses.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/tokenizer/TokenizerClasses.groovy	(revision 258)
@@ -0,0 +1,620 @@
+// 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
+// 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.
+//
+//
+//
+// $LastChangedDate: 2016-10-03 15:30:36 +0200 (Mon, 03 Oct 2016) $
+// $LastChangedRevision: 3313 $
+// $LastChangedBy: mdecorde $
+//
+package org.txm.tokenizer
+
+import java.util.regex.Pattern
+
+import javax.xml.stream.*
+
+import org.txm.utils.xml.DomUtils
+import org.w3c.dom.Document
+import org.w3c.dom.Element
+import org.w3c.dom.Node
+import org.w3c.dom.NodeList
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class TokenizerClasses.
+ */
+class TokenizerClasses {
+
+	//// ROOTS ? ////
+	public static boolean debug = false;
+	/** The tag_all. */
+	public static String tag_all = "<[A-Za-z][^>]+>";
+	
+	/** The Weblex enclitics. */
+	public static String enclitics = "je|m[eo]i|tu|t[eo]i|il|lui|luy|ilz|ils|no?u?s|vo?u?s|on|ce|ci|là|elles?"; // FRO
+	public static String encliticsFR = "je|tu|il|elle|on|nous|vous|ils|elles|toi|moi|en|y|t|leur|lui|le|la|les"; // FR
+
+	/** The TT enclitics. */
+	public static String FClitic_en = "'(s|re|ve|d|m|em|ll)|n['‘’]t";
+	public static String PClitic_fr = '[dcjlmnstDCJLNMST][\'‘’]|[Qq]u[\'‘’]|[Jj]usqu[\'‘’]|[Ll]orsqu[\'‘’]';
+	public static String FClitic_fr = '-t-elles?|-t-ils?|-t-on|-ce|-elles?|-ils?|-je|-la|-les?|-leur|-lui|-mmes?|-m[\'‘’]|-moi|-nous|-on|-toi|-tu|-t[\'‘’]|-vous|-en|-y|-ci|-là';
+	public static String PClitic_it = '[dD][ae]ll[\'‘’]|[nN]ell[\'‘’]|[Aa]ll[\'‘’]|[lLDd][\'‘’]|[Ss]ull[\'‘’]|[Qq]uest[\'‘’]|[Uu]n[\'‘’]|[Ss]enz[\'‘’]|[Tt]utt[\'‘’]';
+	public static String FClitic_gl = '-la|-las|-lo|-los|-nos';
+	
+	/** The div_tags. */
+	public static String div_tags = "TEI|text|front|body|div|div1|div2|div3|div4|div5|div6|back|head|trailer|p|ab|sp|speaker|list|notice|bibl|opener|dateline";
+
+	/** The q_tags. */
+	public static String q_tags = "q|quote|said|item|stage|cit|label|heraldry";
+
+	/** The extraword_tags. */
+	public static String extraword1_tags = "expan|pb|lb|milestone|gap|note|s|locus|title|ref|hi|witDetail";
+
+	/** The corr_tags_no_seg. */
+	public static String corr_tags_no_seg = "expan|unclear|choice|corr|sic|reg|orig|foreign|hi|title|name|supplied|subst|add|del|damage|date|idno|surplus";
+
+	/** The word_tags. */
+	public static String word_tags = "w|abbr|num";
+
+	/** The intraword_tags. */
+	public static String intraword_tags = "c|ex|caesura";
+
+	/** The punct_quotes. */
+	public static String punct_quotes = "'‘’’"
+
+	/** The punct_strong1. */
+	public static String punct_strong1 = ".!?";
+
+	/** The punct_strong2. */
+	public static String punct_strong2 = "\\.\\.|\\.\\.\\.|…|\\|";
+
+	/** The punct_paren_open1. */
+	public static String punct_paren_open1 = "«";
+
+	/** The punct_paren_open2. */
+	public static String punct_paren_open2 = "``|\\(|\\[|\\{";
+
+	/** The punct_paren_close1. */
+	public static String punct_paren_close1 = "»";
+
+	/** The punct_paren_close2. */
+	public static String punct_paren_close2 = "''|‘‘|’’|\\)|\\]|\\}";
+
+	/** The punct_weak. */
+	public static String punct_weak = "\\-,;∼ˆ·*:\"“”\\+±=/\\≤≥<>\\—ν√μ•@≈→αγ∞≡σ&%|#¼½Θĩ†φθΓ§ẽə∈";
+
+	public static String entity = "&[^;]+;";
+
+	public static String seg_tags = "seg"
+
+	//// COMBINAISONS ////
+
+	/** The corr_tags. */
+	public static String corr_tags = "$corr_tags_no_seg|$seg_tags";
+	/** The extraword_tags. */
+	public static String extraword_tags = "$div_tags|$q_tags|$extraword1_tags";
+
+	/** The punct_strong. */
+	public static String punct_strong = "[$punct_strong1]+|$punct_strong2";
+
+	/** The punct_paren_open. */
+	public static String punct_paren_open = "$punct_paren_open1|$punct_paren_open2";
+
+	/** The punct_paren_close. */
+	public static String punct_paren_close = "$punct_paren_close1|$punct_paren_close2";
+
+	/** The punct_paren. */
+	public static String punct_paren = "$punct_paren_open|$punct_paren_close";
+
+	/** The punct_all. */
+	public static String punct_all = "$punct_strong|$punct_paren|[$punct_weak]";
+
+	/** The word_chars. */
+	public static String word_chars = "[^ $punct_quotes$punct_strong1$punct_paren_open1$punct_paren_close1$punct_weak]|$entity";
+
+	public static def tests = [
+		new TTest(/\A(.*-)(je|m[eo]i|tu|t[eo]i|lui|luy|ilz|ils?|no?u?s|vo?u?s|on|leurs|ce|ci|là|elles?)(.*)\Z/),
+		new TTest(/\A(.*)(-)()\Z/, "pon"),
+		//new TTest(/\A(.*)(Bande dessinée|eau de vie|machine à écrire|Moyen Âge|petit pois|poule d'eau|Avoir l'air|se rendre compte|faire semblant|prendre froid|s'en aller|Comme il faut|bon marché|bon enfant|en retard|en colère|à la mode|de bonne humeur|hors de propos|de travers|en vacances|de standing|à l'abandon|sans défense|pieds nus|Tout à fait|d'ores et déjà|de temps en temps|tout de suite|de gré ou de force|ne pas|ne jamais|ne plus|sans doute|on ne peut plus|Quelque chose|ce dernier|n'importe quoi|N'importe quel|beaucoup de|plus d'un|peu de|un tas de|un groupe de|je ne sais quel|De sorte que|bien que|parce que|c'est pourquoi|de même que|depuis que|Quant à|au-dessus de|par rapport à|à côté de|grâce à|hors de|le long de|Par ma barbe !|Mon dieu !|Eh bien !|Bonne nuit !|Pas de panique !)(.*)\Z/),
+		new TTest(/\A([Aa]ujourd'hui)(.*)/,0,1,2),
+		
+		// BFM ONLY
+//		new TTest(/\A()([.·][^ .·]+[.·])(.*)\Z/, "num"), 
+
+		// TXM REFMAN ONLY
+//		new TTest(/\A(.*)($tag_all)(.*)\Z/, "tag"),
+//		new TTest(/\A(.*)([0-9][0-9][\/][0-9][0-9][\/][0-9][0-9])(.*)\Z/, "date", 1,2,3),
+//		new TTest(/\A(.*)([0-9][0-9]:[0-9][0-9]:[0-9][0-9])(.*)\Z/, "time", 1,2,3),
+//		new TTest(/\A([^0-9]*)([0-9]+(\.[0-9]+[a-z]+))(.*)\Z/, "version", 1,2,4),
+//		new TTest(/\A([^0-9]*)([0-9]+(\.[0-9]+)(\.[0-9]+)+)(\.[0-9]+[a-z]+)?(.*)\Z/, "version", 1,2,6),
+//		new TTest(/\A()([a-z]++:\/\/)(.*)\Z/, "protocol", 1,2,3),
+//		new TTest(/\A()([0-9]+([.,][0-9]+)?)()\Z/, "num", 1,2,4),
+//		new TTest(/\A()(([A-Z]:)?([\/\\][^\/\\]+)+)()\Z/, "path", 1,2,5),
+		
+		new TTest(/\A([\p{Ps}|\p{Pe}|\p{Pi}|\p{Pf}|\p{Po}|\p{S}]*)(\p{L}++['‘’])(.*)\Z/, "w", 1, 2, 3),
+		new TTest(/\A(.*)(\.\.\.)(.*)\Z/, "pon"),
+		new TTest(/\A(.*)(\p{Ps}|\p{Pe}|\p{Pi}|\p{Pf}|\p{Po}|\p{S})(.*)\Z/, "pon")
+		
+	];
+	//tag_all = "<[^>]+>";
+	//enclitics = "je|m[eo]i|tu|t[eo]i|il|lui|luy|ilz|ils|no?u?s|vo?u?s|on|ce|ci|là|elles?"; // FRO
+	//encliticsFR = "je|tu|il|elle|on|nous|vous|ils|elles|toi|moi|en|y|t|leur|lui|le|la|les"; // FR
+	//div_tags = "TEI|text|front|body|div|div1|div2|div3|div4|div5|div6|back|head|trailer|p|ab|sp|speaker|list|notice|bibl";
+	//q_tags = "q|quote|item|stage";
+	//extraword_tags = "$div_tags|$q_tags|expan|pb|lb|milestone|gap|note|s|locus|title|ref|hi|witDetail";
+	//corr_tags_no_seg = "expan|unclear|choice|corr|sic|reg|orig|foreign|hi|title|name|supplied|subst|add|del|damage|date|idno";
+	//corr_tags = "$corr_tags_no_seg|seg";
+	//word_tags = "w|abbr|num";
+	//intraword_tags = "c|ex";
+
+	public static String whitespaces = "[\\p{Z}\\p{C}]+";
+	public static String regElision = "['‘’]" // obsolete
+	public static String regPunct = "[\\p{Ps}\\p{Pe}\\p{Pi}\\p{Pf}\\p{Po}\\p{S}]"
+
+	//punct_strong1 = ".!?";
+	//punct_strong2 = "\\.\\.|\\.\\.\\.|…|\\|";
+	//punct_strong = "[$punct_strong1]|$punct_strong2";
+	//punct_paren_open1 = "«";
+	//punct_paren_open2 = "<<|``|\\(|\\[|\\{";
+	//punct_paren_open = "$punct_paren_open1|$punct_paren_open2";
+	//punct_paren_close1 = "»";
+	//punct_paren_close2 = ">>|''|‘‘|’’|\\)|\\]|\\}";
+	//punct_paren_close = "$punct_paren_close1|$punct_paren_close2";
+	//punct_paren = "$punct_paren_open|$punct_paren_close";
+	//punct_weak = ",;∼ˆ·*:\"`'“”\\+±=/\\-≤≥<>\\—_ν√μ•@≈→αγ∞≡σ&¼½Θĩ†φθΓ§ẽə∈";
+	//punct_all = "$punct_strong|$punct_paren|[$punct_weak]";
+	//word_chars = "[^ $punct_strong1$punct_paren_open1$punct_paren_close1$punct_weak]|&[^;]+;";
+
+	public static reset() {
+		tag_all = "<[^>]+>";
+		enclitics = "je|m[eo]i|tu|t[eo]i|il|lui|luy|ilz|ils|no?u?s|vo?u?s|on|ce|ci|là|elles?"; // FRO
+		encliticsFR = "je|tu|il|elle|on|nous|vous|ils|elles|toi|moi|en|y|t|leur|lui|le|la|les"; // FR
+		div_tags = "TEI|text|front|body|div|div1|div2|div3|div4|div5|div6|back|head|trailer|p|ab|sp|speaker|list|notice|bibl";
+		q_tags = "q|quote|item|stage|cit";
+		extraword1_tags = "expan|pb|lb|milestone|gap|note|s|locus|title|ref|hi|witDetail";
+		corr_tags_no_seg = "expan|unclear|choice|corr|sic|reg|orig|foreign|hi|title|name|supplied|subst|add|del|damage|date|idno|surplus";
+		word_tags = "w|abbr|num";
+		intraword_tags = "c|ex|caesura";
+		punct_quotes = "'‘’’"
+		punct_strong1 = ".!?";
+		punct_strong2 = "\\.\\.|\\.\\.\\.|…|\\|";
+		punct_paren_open1 = "«";
+		punct_paren_open2 = "``|\\(|\\[|\\{";
+		punct_paren_close1 = "»";
+		punct_paren_close2 = "''|‘‘|’’|\\)|\\]|\\}";
+		punct_weak = "\\-,;∼ˆ·*:\"“”\\+±=/\\-≤≥<>\\—ν√μ•@≈→αγ∞≡σ&¼½Θĩ†φθΓ§ẽə∈";
+		entity = "&[^;]+;";
+		seg_tags = "seg"
+		
+		whitespaces = "[\\p{Z}\\p{C}]+";
+		regElision = "['‘’]"
+		regPunct = "[\\p{Ps}\\p{Pe}\\p{Pi}\\p{Pf}\\p{Po}\\p{S}]"
+
+		recombine();
+	}
+
+	public static recombine() {
+		corr_tags = "$corr_tags_no_seg|$seg_tags";
+		extraword_tags = "$div_tags|$q_tags|$extraword1_tags";
+		punct_strong = "[$punct_strong1]|$punct_strong2";
+		punct_paren_open = "$punct_paren_open1|$punct_paren_open2";
+		punct_paren_close = "$punct_paren_close1|$punct_paren_close2";
+		punct_paren = "$punct_paren_open|$punct_paren_close";
+		punct_all = "$punct_strong|$punct_paren|[$punct_weak]";
+		word_chars = "[^ $punct_quotes$punct_strong1$punct_paren_open1$punct_paren_close1$punct_weak]|$entity";
+	}
+
+	/**
+	 * To dom.
+	 *
+	 * @param doc the doc
+	 * @param parent the parent
+	 * @return the java.lang. object
+	 */
+	public static toDom(Document doc, Node parent) {
+		Element tokenizer = doc.createElement("tokenizer");
+		tokenizer.setAttribute("onlyThoseTests", "false")
+		parent.appendChild(tokenizer)
+		
+		//String tag_all = "<[^>]+>";
+		Element p = doc.createElement("param");
+		p.setAttribute("key","tag_all");
+		p.setTextContent(tag_all);
+		tokenizer.appendChild(p)
+		//String enclitics = "je|m[eo]i|tu|t[eo]i|il|lui|luy|ilz|ils|no?u?s|vo?u?s|on|ce|ci|là|elles?"; // FRO
+		p = doc.createElement("param");
+		p.setAttribute("key","enclitics");
+		p.setTextContent(enclitics);
+		tokenizer.appendChild(p)
+		//String encliticsFR = "je|tu|il|elle|on|nous|vous|ils|elles|toi|moi|en|y|t|leur|lui|le|la|les"; // FR
+		p = doc.createElement("param");
+		p.setAttribute("key","encliticsFR");
+		p.setTextContent(encliticsFR);
+		tokenizer.appendChild(p)
+		//String div_tags = "TEI|text|front|body|div|div1|div2|div3|div4|div5|div6|back|head|trailer|p|ab|sp|speaker|list|notice|bibl";
+		p = doc.createElement("param");
+		p.setAttribute("key","div_tags");
+		p.setTextContent(div_tags);
+		tokenizer.appendChild(p)
+		//String q_tags = "q|quote|item|stage";
+		p = doc.createElement("param");
+		p.setAttribute("key","q_tags");
+		p.setTextContent(q_tags);
+		tokenizer.appendChild(p)
+		//String extraword_tags = "$div_tags|$q_tags|expan|pb|lb|milestone|gap|note|s|locus|title|ref|hi|witDetail";
+		p = doc.createElement("param");
+		p.setAttribute("key","extraword_tags");
+		p.setTextContent(extraword_tags);
+		tokenizer.appendChild(p)
+		//String corr_tags_no_seg = "expan|unclear|choice|corr|sic|reg|orig|foreign|hi|title|name|supplied|subst|add|del|damage|date|idno";
+		p = doc.createElement("param");
+		p.setAttribute("key","enclitics");
+		p.setTextContent(enclitics);
+		tokenizer.appendChild(p)
+		//String corr_tags = "$corr_tags_no_seg|seg";
+		p = doc.createElement("param");
+		p.setAttribute("key","corr_tags");
+		p.setTextContent(corr_tags);
+		tokenizer.appendChild(p)
+		//String word_tags = "w|abbr|num";
+		p = doc.createElement("param");
+		p.setAttribute("key","word_tags");
+		p.setTextContent(word_tags);
+		tokenizer.appendChild(p)
+		//String intraword_tags = "c|ex";
+		p = doc.createElement("param");
+		p.setAttribute("key","intraword_tags");
+		p.setTextContent(intraword_tags);
+		tokenizer.appendChild(p)
+
+		//String punct_strong1 = ".!?";
+		p = doc.createElement("param");
+		p.setAttribute("key","punct_strong1");
+		p.setTextContent(punct_strong1);
+		tokenizer.appendChild(p)
+		//String punct_strong2 = "\\.\\.|\\.\\.\\.|…|\\|";
+		p = doc.createElement("param");
+		p.setAttribute("key","punct_strong2");
+		p.setTextContent(punct_strong2);
+		tokenizer.appendChild(p)
+		//String punct_strong = "[$punct_strong1]|$punct_strong2";
+		p = doc.createElement("param");
+		p.setAttribute("key","punct_strong");
+		p.setTextContent(punct_strong);
+		tokenizer.appendChild(p)
+		//String punct_paren_open1 = "«";
+		p = doc.createElement("param");
+		p.setAttribute("key","punct_paren_open1");
+		p.setTextContent(punct_paren_open1);
+		tokenizer.appendChild(p)
+		//String punct_paren_open2 = "<<|``|\\(|\\[|\\{";
+		p = doc.createElement("param");
+		p.setAttribute("key","punct_paren_open2");
+		p.setTextContent(punct_paren_open2);
+		tokenizer.appendChild(p)
+		//String punct_paren_open = "$punct_paren_open1|$punct_paren_open2";
+		p = doc.createElement("param");
+		p.setAttribute("key","punct_paren_open");
+		p.setTextContent(punct_paren_open);
+		tokenizer.appendChild(p)
+		//String punct_paren_close1 = "»";
+		p = doc.createElement("param");
+		p.setAttribute("key","punct_paren_close1");
+		p.setTextContent(punct_paren_close1);
+		tokenizer.appendChild(p)
+		//String punct_paren_close2 = ">>|''|‘‘|’’|\\)|\\]|\\}";
+		p = doc.createElement("param");
+		p.setAttribute("key","punct_paren_close2");
+		p.setTextContent(punct_paren_close2);
+		tokenizer.appendChild(p)
+		//String punct_paren_close = "$punct_paren_close1|$punct_paren_close2";
+		p = doc.createElement("param");
+		p.setAttribute("key","punct_paren_close");
+		p.setTextContent(punct_paren_close);
+		tokenizer.appendChild(p)
+		//String punct_paren = "$punct_paren_open|$punct_paren_close";
+		p = doc.createElement("param");
+		p.setAttribute("key","punct_paren");
+		p.setTextContent(punct_paren);
+		tokenizer.appendChild(p)
+		//String punct_weak = ",;∼ˆ·*:\"`'“”\\+±=/\\-≤≥<>\\—_ν√μ•@≈→αγ∞≡σ&¼½Θĩ†φθΓ§ẽə∈";
+		p = doc.createElement("param");
+		p.setAttribute("key","punct_weak");
+		p.setTextContent(punct_weak);
+		tokenizer.appendChild(p)
+		//String punct_all = "$punct_strong|$punct_paren|[$punct_weak]";
+		p = doc.createElement("param");
+		p.setAttribute("key","punct_all");
+		p.setTextContent(punct_all);
+		tokenizer.appendChild(p)
+		//String word_chars = "[^ $punct_strong1$punct_paren_open1$punct_paren_close1$punct_weak]|&[^;]+;";
+		p = doc.createElement("param");
+		p.setAttribute("key","word_chars");
+		p.setTextContent(word_chars);
+		tokenizer.appendChild(p)
+		//whitespaces = "[\\p{Z}\\p{C}]+";
+		p = doc.createElement("param");
+		p.setAttribute("key","whitespaces");
+		p.setTextContent(whitespaces);
+		tokenizer.appendChild(p)
+		//regElision = "['‘’]"
+		p = doc.createElement("param");
+		p.setAttribute("key","regElision");
+		p.setTextContent(regElision);
+		tokenizer.appendChild(p)
+		//regPunct = "[\\p{Ps}\\p{Pe}\\p{Pi}\\p{Pf}\\p{Po}\\p{S}]"
+		p = doc.createElement("param");
+		p.setAttribute("key","regPunct");
+		p.setTextContent(regPunct);
+		tokenizer.appendChild(p)
+	}
+
+	/**
+	 * Dump.
+	 */
+	public static void dump() {
+		println "BRUT"
+		println "tag_all = $tag_all"
+		println "enclitics = $enclitics"
+		println "encliticsFR = $encliticsFR"
+		println "div_tags = $div_tags"
+		println "q_tags = $q_tags"
+		println "extraword1_tags = $extraword1_tags"
+		println "corr_tags_no_seg = $corr_tags_no_seg"
+		println "word_tags = $word_tags"
+		println "intraword_tags = $intraword_tags"
+		println "punct_quotes = $punct_quotes"
+		println "punct_strong1 = $punct_strong1"
+		println "punct_strong2 = $punct_strong2"
+		println "punct_paren_open1 = $punct_paren_open1"
+		println "punct_paren_open2 = $punct_paren_open2"
+		println "punct_paren_close1 = $punct_paren_close1"
+		println "punct_paren_close2 = $punct_paren_close2"
+		println "punct_weak = $punct_weak"
+		println "entity = $entity"
+		println "seg_tags = $seg_tags"
+		println "COMBINED"
+		println "corr_tags = $corr_tags"
+		println "extraword_tags = $extraword_tags"
+		println "punct_strong = $punct_strong"
+		println "punct_paren_open = $punct_paren_open"
+		println "punct_paren_close = $punct_paren_close"
+		println "punct_paren = $punct_paren"
+		println "punct_all = $punct_all"
+		println "word_chars = $word_chars"
+		println "whitespaces = $whitespaces"
+		println "regElision = $regElision"
+		println "regPunct = $regPunct"
+		println "TESTS"
+		for(def test : tests)
+			println " $test"
+	}
+
+	public static boolean isValid() {
+		try { Pattern.compile(tag_all) }
+		catch (Exception e) { println "tag_all=${tag_all}: "+e;return false; }
+
+		try { Pattern.compile(enclitics) }
+		catch (Exception e) { println "enclitics=${enclitics}: "+e;return false; }
+
+		try { Pattern.compile(encliticsFR) }
+		catch (Exception e) { println "encliticsFR=${encliticsFR}: "+e;return false; }
+
+		try { Pattern.compile(div_tags) }
+		catch (Exception e) { println "div_tags=${div_tags}: "+e;return false; }
+
+		try { Pattern.compile(q_tags) }
+		catch (Exception e) { println "q_tags=${q_tags}: "+e;return false; }
+
+		try { Pattern.compile(extraword1_tags) }
+		catch (Exception e) { println "extraword1_tags=${extraword1_tags}: "+e;return false; }
+
+		try { Pattern.compile(corr_tags_no_seg) }
+		catch (Exception e) { println "corr_tags_no_seg=${corr_tags_no_seg}: "+e;return false; }
+
+		try { Pattern.compile(word_tags) }
+		catch (Exception e) { println "word_tags=${word_tags}: "+e;return false; }
+
+		try { Pattern.compile(intraword_tags) }
+		catch (Exception e) { println "intraword_tags=${intraword_tags}: "+e;return false; }
+
+		try { Pattern.compile(punct_quotes) }
+		catch (Exception e) { println "punct_quotes=${punct_quotes}: "+e;return false; }
+
+		try { Pattern.compile(punct_strong1) }
+		catch (Exception e) { println "punct_strong1=${punct_strong1}: "+e;return false; }
+
+		try { Pattern.compile(punct_strong2) }
+		catch (Exception e) { println "punct_strong2=${punct_strong2}: "+e;return false; }
+
+		try { Pattern.compile(punct_paren_open1) }
+		catch (Exception e) { println "punct_paren_open1=${punct_paren_open1}: "+e;return false; }
+
+		try { Pattern.compile(punct_paren_open2) }
+		catch (Exception e) { println "punct_paren_open2=${punct_paren_open2}: "+e;return false; }
+
+		try { Pattern.compile(punct_paren_close1) }
+		catch (Exception e) { println "punct_paren_close1=${punct_paren_close1}: "+e;return false; }
+
+		try { Pattern.compile(punct_paren_close2) }
+		catch (Exception e) { println "punct_paren_close2=${punct_paren_close2}: "+e;return false; }
+
+		try { Pattern.compile(punct_weak) }
+		catch (Exception e) { println "punct_weak=${punct_weak}: "+e;return false; }
+
+		try { Pattern.compile(entity) }
+		catch (Exception e) { println "entity=${entity}: "+e;return false; }
+
+		try { Pattern.compile(seg_tags) }
+		catch (Exception e) { println "seg_tags=${seg_tags}: "+e;return false; }
+
+		try { Pattern.compile(corr_tags) }
+		catch (Exception e) { println "corr_tags: "+e;return false; }
+
+		try { 	Pattern.compile(extraword_tags) }
+		catch (Exception e) { println "extraword_tags: "+e;return false; }
+
+		if (punct_strong != null)
+		try { 	Pattern.compile(punct_strong) }
+		catch (Exception e) { println "punct_strong: "+e;return false; }
+
+		try { Pattern.compile(punct_paren_open) }
+		catch (Exception e) { println "punct_paren_open: "+e;return false; }
+
+		try { Pattern.compile(punct_paren_close) }
+		catch (Exception e) { println "punct_paren_close: "+e;return false; }
+
+		try { Pattern.compile(punct_paren) }
+		catch (Exception e) { println "punct_paren: "+e;return false; }
+
+		try { Pattern.compile(punct_all) }
+		catch (Exception e) { println "punct_all: "+e;return false; }
+
+		try { Pattern.compile(word_chars) }
+		catch (Exception e) { println "word_chars: "+e;return false; }
+		
+		if (regPunct != null)
+		try { Pattern.compile(regPunct) }
+		catch (Exception e) { println "regPunct=${regPunct}: "+e;return false; }
+
+		if (regElision != null)
+		try { Pattern.compile(regElision) }
+		catch (Exception e) { println "regElision=${regElision}: "+e;return false; }
+
+		if (whitespaces != null)
+		try { Pattern.compile(whitespaces) }
+		catch (Exception e) { println "whitespaces=${whitespaces}: "+e;return false; }
+
+		for(TTest test : tests) {
+			try { Pattern.compile(test.regex) }
+			catch (Exception e) { println test.regex+": "+e;return false; }
+		}
+		return true;
+	}
+
+	public static boolean loadFromNode(Element tokenizerElement) {
+		//load params
+		String tmp_strong_punct;
+		NodeList params = tokenizerElement.getElementsByTagName("param");
+		for (int i = 0 ; i < params.getLength() ; i++) {
+			Element param = params.item(i);
+			String key = param.getAttribute("name")
+			String value = param.getAttribute("value")
+			if (value == null || value.length() == 0) value = param.getTextContent()
+			if (value.length() == 0) value = null;
+			
+			if (debug) println (" Tokenizer parametrized with $key=$value.")
+			if (key == "tag_all")
+				tag_all = value
+			else if (key == "enclitics")
+				enclitics = value
+			else if (key == "encliticsFR")
+				encliticsFR = value
+			else if (key == "div_tags")
+				div_tags = value
+			else if (key == "q_tags")
+				q_tags = value
+			else if (key == "extraword1_tags")
+				extraword1_tags = value
+			else if (key == "corr_tags_no_seg")
+				corr_tags_no_seg = value
+			else if (key == "word_tags")
+				word_tags = value
+			else if (key == "intraword_tags")
+				intraword_tags = value
+			else if (key == "punct_quotes")
+				punct_quotes = value
+			else if (key == "punct_strong1")
+				punct_strong1 = value
+			else if (key == "punct_strong2")
+				punct_strong2 = value
+			else if (key == "punct_paren_open1")
+				punct_paren_open1 = value
+			else if (key == "punct_paren_open2")
+				punct_paren_open2 = value
+			else if (key == "punct_paren_close1")
+				punct_paren_close1 = value
+			else if (key == "punct_paren_close2")
+				punct_paren_close2 = value
+			else if (key == "punct_weak")
+				punct_weak = value
+			else if (key == "entity")
+				entity = value
+			else if (key == "seg_tags")
+				seg_tags = value
+			else if (key == "regPunct")
+				regPunct = value
+			else if (key == "regElision")
+				regElision = value
+			else if (key == "whitespaces")
+				whitespaces = value
+			else if (key == "punct_strong") // this is temporary
+				tmp_strong_punct = value // this is temporary
+			else
+				println "MISSING TOKENIZER KEY: "+key
+		}
+		//recombine
+		recombine();
+		if (tmp_strong_punct != null) punct_strong = tmp_strong_punct;  // this is temporary
+		
+		String shouldResetTests = tokenizerElement.getAttribute("onlyThoseTests")
+		if ("true".equals(shouldResetTests)) {
+			println "Warning: tokenizer only using import parameters tests"
+			tests = []
+		}
+			
+		NodeList testsList = tokenizerElement.getElementsByTagName("test");
+		if (testsList.getLength() > 0) {
+			//println "Add "+testsList.getLength()+" tests to the tokenizer"
+			for (int i = 0 ; i < testsList.getLength() ; i++) {
+				Element test = testsList.item(i);
+				tests.add(i, new TTest(test.getTextContent(), test.getAttribute("type"),
+						Integer.parseInt(test.getAttribute("before")),
+						Integer.parseInt(test.getAttribute("hit")),
+						Integer.parseInt(test.getAttribute("after")))
+						)
+			}
+			//println "Tests: "+tests
+		}
+
+		if (isValid())
+			return true
+		else {
+			reset();
+			recombine();
+			return false;
+		}
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args) {
+
+		Document doc = DomUtils.load(new File("/home/mdecorde/xml/discours/import.xml"));
+		Node corpora = doc.getDocumentElement().getElementsByTagName("corpora").item(0);
+		Node corpus = ((Element)corpora).getElementsByTagName("corpus").item(0)
+		Node tokenizer = ((Element)corpus).getElementsByTagName("tokenizer").item(0)
+		println "OK? "+ TokenizerClasses.loadFromNode(tokenizer)
+	}
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/tokenizer/package.html
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/tokenizer/package.html	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/tokenizer/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>All necessary classes to tokenize XML-TEI</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/org/txm/tokenizer/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/test/mesuresBP.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/test/mesuresBP.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/test/mesuresBP.groovy	(revision 258)
@@ -0,0 +1,39 @@
+package org.txm.test;
+import org.txm.functions.mesures.*;
+import org.txm.searchengine.cqp.corpus.Corpus;
+import org.txm.Toolbox
+import org.txm.searchengine.cqp.corpus.*
+import org.txm.searchengine.cqp.corpus.query.*
+
+def corpus1 = CorpusManager.getCorpusManager().getCorpus("MESURES")
+
+Mesures mesures = new Mesures([corpus1]);
+// Taille en mot des textes
+mesures.add(new Magnitude('<text> [] expand to text', "word", false, Synthese.SUM));
+// Qurtiles des discours direct
+mesures.add(new Magnitude('<q> [_.q_type="DD"] expand to q', "word", true, Synthese.QUARTILE));
+// Quartiles des paragraphes (ici div1, j'ai pas de paragraphes -_-)
+mesures.add(new Magnitude('<div1> [] expand to div1', "word", true, Synthese.QUARTILE));
+// moyenne de la taille en mot des paragraphes
+//mesures.add(new Magnitude('<p> [] expand to p', "word", true, Synthese.MOYENNE));
+
+// proportion des ! et ? dans le discours direct
+mesures.add(new Proportion('[_.q_type="DD"]', "word", true, Synthese.COUNTMATCHES, '[word=".*[.!?].*"]', ['[word=".*\\?*"]', '[word=".*!.*"]']));
+// proportion de discours direct avec tiret ou guillemet
+mesures.add(new Proportion(null, "word", true, Synthese.COUNTMATCHES, '[_.q_type="DD"] expand to q', ['[_.q_type="DD" & _.q_rend="tiret"] expand to q', '[_.q_type="DD" & _.q_rend="guillemet"] expand to q']));
+// Proportion de discours direct avec incise de dire / verbe introducteur
+mesures.add(new Proportion(null, "word", true, Synthese.COUNTMATCHES, '[_.q_type="DD"] expand to q', ['[_.q_type="DD" & _.seg_ana="incise_di"] expand to q', '[_.seg_ana="int_DD"] </seg> []{0,10} <q> [_.q_type="DD"]']));
+//mesures.add(new Proportion('"j.*"%c expand to text', "word", true, Synthese.SUM, '"j.*" expand to text', ['"j.....*"%c expand to text', '"j........*"%c expand to text']));
+
+// Taux de présence linéaire de ponctuation forte dans le DD
+mesures.add(new PresenceRate('[_.q_type="DD"] expand to q', "word", true, Synthese.SUM, '[word=".*[;!?].*"]'));
+// Taux de présence linéaire de DD
+mesures.add(new PresenceRate(null, "word", true, Synthese.SUM, '[_.q_type="DD"]'));
+// Taux de présence Linéaire de PR 
+mesures.add(new PresenceRate(null, "word", true, Synthese.SUM, '<pr> [] expand to pr'));
+
+// Diversité (en lemmes) des verbes introducteurs
+mesures.add(new Diversity(null, "word", true, Synthese.SUM, '[_.seg_ana="int.*" & frpos="V.*"]', "frlemma"));
+//mesures.add(new Diversity('[_.q_type="DD"] expand to q', "word", true, Synthese.SUM, '"j.*"', "frpos"));
+
+mesures.prettyPrint();
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/test/WGet.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/test/WGet.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/test/WGet.groovy	(revision 258)
@@ -0,0 +1,20 @@
+URL url = new URL("http://docs.codehaus.org/display/GROOVY/Simple+file+download+from+URL");
+File outFile = new File("test.out")
+
+static def download(def file, def url) {
+		url.withInputStream() {is->
+			 file.withOutputStream() {os->
+				 def bs = new BufferedOutputStream( os )
+				 bs << is
+			 }
+		 }
+}
+
+// if proxy , uncomment this and set up properties
+//System.properties.putAll( ["http.proxyHost":"proxy-host",
+//							 "http.proxyPort":"proxy-port",
+//							 "http.proxyUserName":"user-name",
+//							 "http.proxyPassword":"proxy-passwd"] )
+
+WGet.download(outFile, url);
+println outFile.getText()
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/test/Informations.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/test/Informations.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/test/Informations.groovy	(revision 258)
@@ -0,0 +1,64 @@
+/**
+ * Main.
+ *
+ * @param args the args
+ */
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.test
+
+
+// imports des fonctions que l'on va utiliser
+import org.txm.Toolbox
+import org.txm.searchengine.cqp.corpus.*
+import org.txm.functions.diagnostic.Diagnostic
+import org.txm.objects.*
+
+// TODO: Auto-generated Javadoc
+/* (non-Javadoc)
+ * @see groovy.lang.Script#run()
+ */
+def manualInit = false
+if (!org.txm.Toolbox.isInitialized())
+{
+	manualInit = true
+	org.txm.Toolbox.initialize(new File(System.getProperty("user.home")+"/TXM/install.prefs"))
+}
+
+def corpus = CorpusManager.getCorpusManager().getCorpus("QUETE")
+
+try
+{
+	def d = new Diagnostic(corpus, 20)
+	d.process();
+	println d.htmldump()
+} catch(Exception e){	e.printStackTrace() }
+
+if(manualInit)
+	org.txm.Toolbox.shutdown()
+
Index: tmp/org.txm.core/src/groovy/org/txm/test/CooccurencesAndReferenceCorpus.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/test/CooccurencesAndReferenceCorpus.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/test/CooccurencesAndReferenceCorpus.groovy	(revision 258)
@@ -0,0 +1,73 @@
+//package org.txm.test
+//import org.txm.Toolbox
+//import org.txm.searchengine.cqp.corpus.*
+//import org.txm.searchengine.cqp.corpus.query.*
+//import org.txm.functions.cooccurrences.*
+//import org.txm.stat.engine.r.RWorkspace;
+//import org.txm.stat.engine.r.data.*;
+//import org.txm.functions.cooccurrences.comparators.*;
+//
+///////////////////PARAMS/////////////////////
+//
+//def corpusname = "DANS16FRANTEXT"
+//def PROP = "word"
+//def QUERY ="""
+//[type="expFound"]
+//"""
+//
+//def minleft = 0
+//def maxleft = 10
+//def minright = 0
+//def maxright = 10
+//
+//def minf = 1
+//def mincof = 1
+//def minscore = 0
+//
+//File refFile = new File("/home/mdecorde/TEMP/lexiqueFrantext16.txt");
+//def file = new File("/home/mdecorde/TEMP/cooc_dans_ref.tsv")
+//
+/////////////////////////////////////////////
+//
+//minleft++
+//maxleft++
+//minright++
+//maxright++
+//if (!refFile.exists()) { println "ref file does not exists: $refFile"; return;}
+//QUERY = QUERY.trim();
+//MainCorpus corpus = CorpusManager.getCorpusManager().getCorpus(corpusname)
+//Property property = corpus.getProperty(PROP)
+//
+//// Build the reference corpus
+//println "building reference corpus."
+//def ref_lt = LexicalTableImpl.createLexicalTableImpl(refFile);
+//
+//// Build the cooccurrences
+//def limit = null
+//def query = new Query(Query.fixQuery(QUERY))
+//print "building cooc"
+//def cooccurrence = new Cooccurrence(corpus, query, [property], limit, maxleft, minleft, minright, maxright, minf, mincof, minscore, false)
+//System.out.println("cooc: "+corpus+" "+query+" "+[property]+" "+null+" "+maxleft+" "+minleft+" "+minright+" "+maxright+" "+minf+" "+mincof+" "+minscore+" "+false);
+//print "."
+//if (refFile != null)
+//	cooccurrence.setReferenceCorpus(ref_lt.getSymbol()) // SET THE REFERENCE CORPUS
+//print "."
+//cooccurrence.stepQueryLimits();
+//print "."
+//cooccurrence.stepGetMatches();
+//print "."
+//cooccurrence.stepBuildSignatures();
+//print "."
+//cooccurrence.stepCount();
+//print "."
+//cooccurrence.stepBuildLexicalTable();
+//print "."
+//cooccurrence.stepGetScores();
+//print "."
+//cooccurrence.getLines();
+//cooccurrence.sort(new OccComparator())
+//println ""
+//
+//println "exporting."
+//cooccurrence.toTxt(file, "UTF-8", "\t", "")
+//println "printed cooccurrents in "+file.getAbsolutePath()
Index: tmp/org.txm.core/src/groovy/org/txm/test/ExecuteRscript.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/test/ExecuteRscript.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/test/ExecuteRscript.groovy	(revision 258)
@@ -0,0 +1,67 @@
+package org.txm.test;
+/**
+ * Main.
+ *
+ * @param args the args
+ */
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+import org.txm.stat.engine.r.RWorkspace
+// import org.txm.rcpapplication.commands.*
+// uncomment for test
+
+// get a connection to R
+// TODO: Auto-generated Javadoc
+
+/* (non-Javadoc)
+ * @see groovy.lang.Script#run()
+ */
+def r = RWorkspace.getRWorkspaceInstance()
+
+// start logging R output in the console
+r.setLog(true)
+
+// a sample plotting script
+def script = new File(System.getProperty("user.home")+"/TXM/scripts/samples/R/plot100.R")
+// we need this for Windows
+def scriptpath = script.getAbsolutePath().replace("\\","\\\\")
+// use a temporary file to transfert the graphic
+def f = File.createTempFile("txm", ".svg", script.getParentFile())
+
+// generate the graphic
+r.plot(f, "source(\""+scriptpath+"\")")
+
+// draw the graphic in a new window of TXM
+monitor.syncExec(new Runnable() {
+	@Override
+	public void run() {	OpenSVGGraph.OpenSVGFile(f.getAbsolutePath(), "sample plot") }
+});
+
+
+// stop logging R output
+r.setLog(false)
Index: tmp/org.txm.core/src/groovy/org/txm/test/tables.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/test/tables.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/test/tables.groovy	(revision 258)
@@ -0,0 +1,52 @@
+//package org.txm.test
+//
+//import org.txm.stat.engine.r.*
+//import org.txm.stat.engine.r.data.*
+//
+//def r = RWorkspace.getRWorkspaceInstance()
+//r.setLog(true)
+//
+//int[][] data = [[1,2,3,4,0], [78,64,18,3,0], [2,84,7,168,0], [5,7,6,0,0], [12,4,88,1668,0], [0,0,0,0,1]]
+//String[] lineNames = ["L1", "L2", "L3", "L4", "L5", "L6"]
+//String[] colNames = ["C1", "C2", "C3", "C4", "C5"]
+//
+//MatrixImpl matrix = new MatrixImpl(data, lineNames, colNames)
+//matrix.print()
+//
+////println "remove rows 1"
+////matrix.removeRows([1], true)
+////matrix.print()
+//
+////println "remove cols 4"
+////matrix.removeCols([4], true)
+////matrix.print()
+//
+////println "merge rows 0 1"
+////int[] rows = [0,1]
+////matrix.mergeRows(rows);
+////matrix.print()
+//
+////println "merge cols 0 1"
+////int[] cols = [0,1]
+////matrix.mergeCols(cols);
+////matrix.print()
+//
+////println "sortByFreqs"
+////matrix.sortByFreqs();
+////matrix.print()
+//
+////println "filter fmin=100 nlines=4"
+////matrix.filter(5,100);
+////matrix.print()
+//
+//println "save data in test.txt"
+//matrix.exportData(new File("test.txt"), ";", "\"")
+//println "do something: delete col 4"
+//matrix.removeCols([4], true)
+//matrix.print()
+//
+//println "reload data from test.txt"
+//matrix.importData(new File("test.txt"))
+//matrix.print()
+//
+//r.setLog(false)
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/test/package.html
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/test/package.html	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/test/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Scripts to test the platform. All theses scripts can be executed in TXM too</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/org/txm/test/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/test/HelloWorld.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/test/HelloWorld.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/test/HelloWorld.groovy	(revision 258)
@@ -0,0 +1,48 @@
+/**
+ * Main.
+ *
+ * @param args the args
+ */
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.test
+
+// TODO: Auto-generated Javadoc
+/* (non-Javadoc)
+ * @see groovy.lang.Script#run()
+ */
+println "Hello World !"
+for(File f : new File("/home/mdecorde/Bureau/bioling").listFiles())
+{
+	if(f.getName().endsWith(" corpus.txt"))
+	{
+		String name = f.getName();
+		name = name.substring(0, name.length()- 11)+".txt"
+		f.renameTo(new File(f.getParent(), name))
+	}
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/test/ParaContexts.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/test/ParaContexts.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/test/ParaContexts.groovy	(revision 258)
@@ -0,0 +1,24 @@
+package org.txm.test
+
+import java.util.ArrayList;
+import org.txm.functions.parallelcontexts.ParallelContexts
+import org.txm.searchengine.cqp.corpus.Corpus;
+import org.txm.Toolbox
+import org.txm.searchengine.cqp.corpus.*
+import org.txm.searchengine.cqp.corpus.query.*
+
+
+ArrayList<String> queries = ["je", "je"]
+String struct = "text_id"
+ArrayList<Corpus> corpora = ["QGRAAL", "QGRAAL"]
+ArrayList<String> props = ["word", "frlemma"]
+ArrayList<String> refs = ["text_id", "text_titre"]
+ArrayList<Integer> CGs = [30, 10]
+ArrayList<Integer> CDs = [10, 1]
+ArrayList<Boolean> participates = [true, true]
+
+ParallelContexts ctx = new ParallelContexts();
+
+println "starts-ends: "+ctx.getKeywordsStartsEnds()
+println "keywords: "+ctx.getKeywordsStrings()
+println "seg keys; "+ctx.getSegKeys()
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/test/ProgressionSample.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/test/ProgressionSample.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/test/ProgressionSample.groovy	(revision 258)
@@ -0,0 +1,57 @@
+//package org.txm.test;
+//import org.txm.functions.progression.*
+//import org.txm.searchengine.cqp.corpus.*
+//import org.txm.searchengine.cqp.corpus.query.*
+//import org.txm.stat.engine.r.*
+//
+//def discours = CorpusManager.getCorpusManager().getCorpus("DISCOURS");
+//
+//def q1 = new Query(Query.fixQuery("je|j'"))
+//def q2 = new Query(Query.fixQuery("tu"))
+//def q3 = new Query(Query.fixQuery("il"))
+//def q4 = new Query(Query.fixQuery("elle"))
+//def q5 = new Query(Query.fixQuery("on"))
+//def q6 = new Query(Query.fixQuery("nous"))
+//def q7 = new Query(Query.fixQuery("vous"))
+//def q8 = new Query(Query.fixQuery("ils"))
+//def q9 = new Query(Query.fixQuery("elles"))
+//def q10 = new Query(Query.fixQuery("eux"))
+//def q11 = new Query(Query.fixQuery("ceux"))
+//def q12 = new Query(Query.fixQuery("autre|autres"))
+//def q13 = new Query(Query.fixQuery("monde"))
+//def q14 = new Query(Query.fixQuery("France"))
+//def q15 = new Query(Query.fixQuery("Algérie"))
+//def q16 = new Query(Query.fixQuery("Europe"))
+//
+////Progression(Corpus corpus, List<Query> queries,
+////			StructuralUnit structure, StructuralUnitProperty property, String propertyregex,
+////			boolean doCumulative, boolean monochrome, boolean monostyle, 
+////			int linewidth, boolean repeat, float bandemultiplier) {
+//		
+//int linewidth = 2;
+//float bandewidth = 1.0f
+//Progression progression5 = new Progression(discours, [q1, q2, q3, q4, q5],
+//	null, null,	"", 
+//	true, false, false, 
+//	linewidth, false, bandewidth);
+//___Progression progression10 = new Progression(discours, [q1, q2, q3, q4, q5, q6, q7, q8, q9, q10],
+//	null, null,	"", 
+//	true, false, false, 
+//	linewidth, false, bandewidth);
+//___Progression progression16 = new Progression(discours, [q1, q2, q3, q4, q5, q6, q7, q8, q9, q10, q11, q12, q13, q14, q15, q16],
+//	null, null,	"", 
+//	true, false, false, 
+//	linewidth, false, bandewidth);
+//
+//File outputdir = new File("/home/mdecorde/Bureau")
+//File svgFile5 = new File(outputdir, "progression5");
+//File svgFile10 = new File(outputdir, "progression10");
+//File svgFile16 = new File(outputdir, "progression16");
+//
+//progression5.toSvg(svgFile5, __RDevice.SVG);
+//progression10.toSvg(svgFile10, __RDevice.SVG);
+//progression16.toSvg(svgFile16, __RDevice.SVG);
+//
+//OpenSVGGraph.OpenSVGFile(svgFile5.getAbsolutePath(), "progression5")
+//OpenSVGGraph.OpenSVGFile(svgFile10.getAbsolutePath(), "progression10")
+//OpenSVGGraph.OpenSVGFile(svgFile16.getAbsolutePath(), "progression16")
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/test/ControlUI.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/test/ControlUI.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/test/ControlUI.groovy	(revision 258)
@@ -0,0 +1,44 @@
+package org.txm.test
+
+//import org.txm.rcpapplication.views.*
+
+// Bindings
+println "The current job monitor: "+monitor
+println "The current editor: "+editor
+println "The current selection: "+selection
+
+// Interact with SWT Objects
+monitor.syncExec(new Runnable() {
+	public void run() {
+		//CorporaView.reload()
+		println "corpora view refreshed !"
+	}
+})
+
+// Move the progress bar and cancel if necessary
+println "waiting..."
+Thread.sleep(1000)
+monitor.worked(20)
+if (monitor.isCanceled()) {monitor.done(); return}
+
+println "waiting..."
+Thread.sleep(1000)
+monitor.worked(20)
+if (monitor.isCanceled()) {monitor.done(); return}
+
+println "waiting..."
+Thread.sleep(1000)
+monitor.worked(20)
+if (monitor.isCanceled()) {monitor.done(); return}
+
+println "waiting..."
+Thread.sleep(1000)
+monitor.worked(20)
+if (monitor.isCanceled()) {monitor.done(); return}
+
+println "waiting..."
+Thread.sleep(1000)
+monitor.worked(20)
+if (monitor.isCanceled()) {monitor.done(); return}
+
+println "Done."
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/test/groovy4editor.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/test/groovy4editor.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/test/groovy4editor.groovy	(revision 258)
@@ -0,0 +1,7 @@
+package org.txm.test;
+
+File currentFile = editor.getEditedFile()
+String text = currentFile.getText("UTF-8")
+currentFile.withWriter("UTF-8") { writer ->
+	writer.write(text.replaceAll("e", "E"));
+}
Index: tmp/org.txm.core/src/groovy/org/txm/test/SomeRCode.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/test/SomeRCode.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/test/SomeRCode.groovy	(revision 258)
@@ -0,0 +1,76 @@
+/**
+ * Main.
+ *
+ * @param args the args
+ */
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+package org.txm.test
+
+import org.rosuda.REngine.REXP;
+import org.txm.Toolbox;
+import org.txm.stat.engine.r.RWorkspace;
+
+// TODO: Auto-generated Javadoc
+/* (non-Javadoc)
+ * @see groovy.lang.Script#run()
+ */
+RWorkspace rw = RWorkspace.getRWorkspaceInstance();//get the RWorkspace instance
+rw.setLog(true);//start R log
+
+//execute a simple line of code
+rw.eval("print(2+2)")
+println "-"
+
+//execute a file
+/*
+ * script.R:
+a <- 2+2
+print(a)
+b <- 4+4
+print(b)
+c <- 6+6
+print(c)
+ */
+File scriptR = new File("script.R")// get a File
+String filepath = scriptR.getAbsolutePath().replace("\\","\\\\")//We need to to it for Windows OS
+rw.eval("source(\""+filepath+"\")")
+println "-"
+
+//execute a file line per line
+Reader reader = new FileReader(scriptR);// create a file reader
+String line = reader.readLine();// read next line
+while(line != null)//continue until the end of the file
+{
+	rw.eval(line)//evaluate line in R
+	line = reader.readLine();//read next line
+}
+println "-"
+
+println "Last log line : "+rw.getLastLogLine();// get the last log
+rw.setLog(false);//stop R log
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/test/Quotes.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/test/Quotes.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/test/Quotes.groovy	(revision 258)
@@ -0,0 +1,37 @@
+ package org.txm.test
+
+println "Pre-balisage du discours direct"
+
+List<String> containers = ["p","ab"]; // elements qui contiennent des <s>
+
+File infile = new File(System.getProperty("user.home"), "TXM-SRC/quote-orig/perceval2.xml")
+File outfile = new File(System.getProperty("user.home"), "TXM-SRC/quote-orig/perceval2-q.xml")
+
+def doc = new XmlParser().parse (infile)
+List<Node> nodesToInspect = doc.text.body.div
+// nodesToInspect << doc.text.body.div // on en rajoute
+
+/*************************/
+new org.txm.importer.EncodeTEIQuotes(nodesToInspect, containers, "\"", "pon");
+
+//copy the doc in "outfile" File  
+String encoding = "UTF-8"
+OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(outfile) , encoding);
+//writer.write("<?xml version=\"1.0\" encoding=\""+encoding+"\"?>");
+//writer.write ("<?xml-stylesheet type=\"text/css\" href=\"tei-graal.css\"?>\n")
+def pwriter = new PrintWriter(writer, true)
+XmlNodePrinter xmlwriter = new XmlNodePrinter(pwriter)
+xmlwriter.setPreserveWhitespace(false)
+xmlwriter.print(doc)
+pwriter.close()
+writer.close()
+xmlwriter = null
+//println "write output file "+outfile
+
+//update counts
+if(outfile.exists())
+{
+	String txtid = org.txm.importer.WordCounter.findTextId(infile, "s"); // retrouve l'id du text qui a été concaténé aux id des S originels (ex : s19_12 >> 19)
+	new org.txm.importer.WordCounter(outfile, "s", txtid);
+	new org.txm.importer.WordCounter(outfile, "q", txtid);
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/test/References.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/test/References.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/test/References.groovy	(revision 258)
@@ -0,0 +1,88 @@
+/**
+ * Main.
+ *
+ * @param args the args
+ */
+// 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
+// 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.
+
+//
+// This file is part of the TXM platform.
+//
+// The TXM platform is free software: you can redistribute it and/or modif y
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 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/>.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.test
+
+//we import the packages containing the functions we are going to use
+import org.txm.Toolbox
+import org.txm.searchengine.cqp.corpus.*
+import org.txm.searchengine.cqp.corpus.query.*
+import org.txm.functions.referencer.*
+import org.txm.functions.ReferencePattern
+
+// TODO: Auto-generated Javadoc
+/* (non-Javadoc)
+ * @see groovy.lang.Script#run()
+ */
+Corpus discours = CorpusManager.getCorpusManager().getCorpus("DISCOURS")
+
+// we get some properties
+Property word = discours.getProperty("word")
+StructuralUnit text = discours.getStructuralUnit("text")
+StructuralUnitProperty text_id = text.getProperty("id")
+
+// we create a query to find the positions
+Query query = new Query(Query.fixQuery("j.*"))
+
+// what the index must show
+ReferencePattern referencePattern = new ReferencePattern().addProperty(text_id)
+
+//define the referencer
+// We want the references of the words who matche the query "je" in the discours corpus
+long time = System.currentTimeMillis()
+Referencer ref = new Referencer(discours, query, word, referencePattern.getProperties())
+ref.compute()
+println "time get positions : "+(System.currentTimeMillis()-time)
+
+time = System.currentTimeMillis()
+def lines =ref.getLines()
+println "time get "+lines.size()+" lines : "+(System.currentTimeMillis()-time)
+
+File file = new File("ref.txt")
+ref.toTxt(file, "UTF-8")
+println "writen in : "+file.getAbsolutePath()
Index: tmp/org.txm.core/src/groovy/org/txm/test/mesures.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/test/mesures.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/test/mesures.groovy	(revision 258)
@@ -0,0 +1,32 @@
+package org.txm.test
+
+import org.txm.functions.mesures.*;
+import org.txm.searchengine.cqp.corpus.Corpus;
+import org.txm.Toolbox
+import org.txm.searchengine.cqp.corpus.*
+import org.txm.searchengine.cqp.corpus.query.*
+//import org.txm.rcpapplication.commands.*;
+
+def corpus1 = CorpusManager.getCorpusManager().getCorpus("ALCESTE")
+def corpus2 = CorpusManager.getCorpusManager().getCorpus("DISCOURS")
+def corpus3 = CorpusManager.getCorpusManager().getCorpus("RENOUEE")
+Mesures mesures = new Mesures([corpus1, corpus2, corpus3]);
+mesures.add(new Magnitude('"je"%c expand to text', "word", false, Synthese.COUNTMATCHES));
+mesures.add(new Magnitude('"je"%c expand to text', "word", false, Synthese.SUM));
+mesures.add(new Magnitude('"je"%c expand to text', "word", true, Synthese.MEAN));
+mesures.add(new Magnitude('"je"%c expand to text', "word", true, Synthese.QUARTILE));
+mesures.add(new Proportion('"j.*"%c expand to text', "word", true, Synthese.COUNTMATCHES, '"j.*" expand to text', ['"j.....*"%c expand to text', '"j........*"%c expand to text']));
+mesures.add(new Proportion('"j.*"%c expand to text', "word", true, Synthese.SUM, '"j.*" expand to text', ['"j.....*"%c expand to text', '"j........*"%c expand to text']));
+mesures.add(new PresenceRate('"j.*" expand to text', "word", true, Synthese.SUM, '"je"'));
+mesures.add(new PresenceRate('"j.*" expand to text', "word", true, Synthese.MIN, '"je"'));
+
+File csvFile = new File("mesures.txt");
+mesures.export(csvFile, "UTF-8", "\t", "");
+
+monitor.syncExec(new Runnable() {
+	public void run() {
+	//	EditFile.openfile(csvFile);
+	}
+})
+
+mesures.prettyPrint();
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/test/ReleaseFunctionsValidation.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/test/ReleaseFunctionsValidation.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/test/ReleaseFunctionsValidation.groovy	(revision 258)
@@ -0,0 +1,159 @@
+//package org.txm.test
+//import org.txm.*
+//import org.txm.functions.*
+//import org.txm.functions.ca.*
+//import org.txm.functions.classification.*
+//import org.txm.functions.concordances.*
+//import org.txm.functions.concordances.comparators.*
+//import org.txm.functions.cooccurrences.Cooccurrence
+//import org.txm.functions.diagnostic.*
+//import org.txm.functions.index.*
+//import org.txm.functions.referencer.Referencer
+//import org.txm.functions.specificities.*
+//import org.txm.searchengine.cqp.corpus.*
+//import org.txm.searchengine.cqp.corpus.query.*
+//import org.txm.stat.data.LexicalTable
+//import org.txm.utils.DeleteDir
+//
+//File exporttestdir = new File(System.getProperty("user.home"), "TXM/testrelease");
+//DeleteDir.deleteDirectory exporttestdir;
+//exporttestdir.mkdir()
+//println "Results are saved in dir: "+ exporttestdir
+//
+////diag corpus
+//def corpora = CorpusManager.getCorpusManager().getCorpora()
+//MainCorpus discours = CorpusManager.getCorpusManager().getCorpus("DISCOURS")
+//println "CORPUS: "+discours
+//
+//// word properties
+//def word_property = discours.getProperty("word")
+//def pos_property = discours.getProperty("pos")
+//def lemma_property = discours.getProperty("lemma")
+//def func_property = discours.getProperty("func")
+//println "props: $word_property, $pos_property, $lemma_property and $func_property"
+//
+//// structure properties
+//StructuralUnit text_su = discours.getStructuralUnit("text")
+//StructuralUnit s_su = discours.getStructuralUnit("s")
+//println "structs: $text_su and $s_su"
+//
+//Property text_id_property = text_su.getProperty("id")
+//Property text_type_property = text_su.getProperty("type")
+//Property text_date_property = text_su.getProperty("date")
+//Property text_loc_property = text_su.getProperty("loc")
+//println "struct props: $text_id_property, $text_type_property, $text_date_property and $text_loc_property"
+//ReferencePattern referencePattern = new ReferencePattern().addProperty(text_id_property)
+//
+//long time;
+//
+//// INFORMATIONS
+//time = System.currentTimeMillis();
+//Diagnostic diag = new Diagnostic(discours, 20)
+//diag.stepGeneralInfos();
+//diag.stepLexicalProperties();
+//diag.stepStructuralUnits();
+//diag.toHTML(new File(exporttestdir, "discours_diag"))
+//println("Diag: "+(System.currentTimeMillis()-time)/1000)
+//
+//// LEXICON
+//time = System.currentTimeMillis();
+//discours.getLexicon(lemma_property).toTxt(new File(exporttestdir, "discours_lexpos"), "UTF-8", "\t", "");
+//println("Lex: "+(System.currentTimeMillis()-time)/1000)
+//
+//// INDEX
+//time = System.currentTimeMillis();
+//Query query = new Query(Query.fixQuery("j.*"))
+//IndexSample index = new IndexSample(discours, query, [lemma_property, func_property])
+////index.sortLines(LineComparator.SortMode.FREQUNIT, true)
+////index.filterLines(2, 3000)
+//index.toTxt(new File(exporttestdir, "discours_indexlemmafuncj"), "UTF-8", "\t", "")
+//println("Ind: "+(System.currentTimeMillis()-time)/1000)
+//
+//// REFERENCER
+//time = System.currentTimeMillis();
+//Referencer referencer = new Referencer(discours, query, lemma_property, [text_type_property], true);
+//referencer.getQueryMatches()
+//referencer.getQueryindexes()
+//referencer.groupPositionsbyId()
+//referencer.toTxt(new File(exporttestdir, "discours_referencer"), "UTF-8")
+//println("Ref: "+(System.currentTimeMillis()-time)/1000)
+//
+//// CONCORDANCE
+//time = System.currentTimeMillis();
+//Concordance concordance = new Concordance(discours, query, word_property, [word_property, pos_property], referencePattern, referencePattern, 15, 15)
+//LexicographicLeftContextComparator comparator = new LexicographicLeftContextComparator()
+//comparator.initialize(discours)
+//concordance.sort(comparator)
+//concordance.setViewProperties([word_property])
+//concordance.toTxt(new File(exporttestdir,"discours_concj"), Concordance.Format.CONCORDANCE)
+//println("Conc: "+(System.currentTimeMillis()-time)/1000)
+//
+//// COOCCURRENCE WORD WINDOW
+//time = System.currentTimeMillis();
+//Cooccurrence cooc = new Cooccurrence(discours, query, [word_property], null, 21, 1, 1, 11, 2, 3, 1, false);
+//cooc.process();
+//cooc.toTxt(new File(exporttestdir, "discours_cooc_wordwindow"), "UTF-8")
+//println("Cooc1: "+(System.currentTimeMillis()-time)/1000)
+//
+//// COOCCURRENCE SENTENCE WINDOW
+//time = System.currentTimeMillis();
+//Cooccurrence cooc2 = new Cooccurrence(discours, query, [word_property], s_su,2, 1, 1, 1, 2, 3,1, false);
+//cooc2.process();
+//cooc2.toTxt(new File(exporttestdir, "discours_cooc_swindow"), "UTF-8")
+//println("Cooc2: "+(System.currentTimeMillis()-time)/1000)
+//
+//// SUBCORPORA
+//time = System.currentTimeMillis();
+//Corpus DGcorpus = discours.createSubcorpus(text_su, text_loc_property, "de Gaulle", "dgsubcorpus")
+//println("sub: "+(System.currentTimeMillis()-time)/1000)
+//
+//// PARTITIONS
+//time = System.currentTimeMillis();
+//Partition discours_types = discours.createPartition(text_su, text_type_property)
+//Partition discours_dates = discours.createPartition(text_su, text_date_property)
+//println("partitions: "+(System.currentTimeMillis()-time)/1000)
+//
+//// LEXICAL TABLE
+//time = System.currentTimeMillis();
+//LexicalTable table = discours_types.getLexicalTable(word_property, 2);
+//table.exportData(new File(exporttestdir, "discours_type_LT"), "\t", "");
+//println("lex table: "+(System.currentTimeMillis()-time)/1000)
+//
+////// SPECIF PARTITION
+////time = System.currentTimeMillis();
+////SpecificitesResult specifresult = org.txm.functions.specificities.Specificites.specificites(discours_types, word_property, [], [], 1);
+////specifresult.toTxt(new File(exporttestdir,"discours_speciftype"), "UTF-8", "\t", "")
+////println("sepcif part: "+(System.currentTimeMillis()-time)/1000)
+////
+////// SPECIF SUBCORPUS
+////time = System.currentTimeMillis();
+////SpecificitesResult specifresult2 = org.txm.functions.specificities.Specificites.specificites(DGcorpus.getParent(), DGcorpus, word_property)
+////specifresult2.toTxt(new File(exporttestdir,"discours_dgsub_specifloc"), "UTF-8", "\t", "")
+////println("specif sub: "+(System.currentTimeMillis()-time)/1000)
+////
+////// SPECIF LEXICAL TABLE
+////time = System.currentTimeMillis();
+////SpecificitesResult specifresult3 = org.txm.functions.specificities.Specificites.specificites(table);
+////specifresult3.toTxt(new File(exporttestdir,"discours_speciftype"), "UTF-8", "\t", "")
+////println("specif LT: "+(System.currentTimeMillis()-time)/1000)
+////
+////// AFC PARTITION
+////time = System.currentTimeMillis();
+////CA ca = new CA(discours_dates, lemma_property)
+////ca.toSVGFactorialMap(new File(exporttestdir,"discours_cadates"), true, true)
+////ca.toSVGSingularValues(new File(exporttestdir,"discours_cadates_singularvalues"))
+////println("CA part: "+(System.currentTimeMillis()-time)/1000)
+////
+////// AFC LEXICAL TABLE
+////time = System.currentTimeMillis();
+////CA ca2 = new CA(table);
+////ca2.toSVGFactorialMap(new File(exporttestdir,"discours_cadates"), true, true)
+////ca2.toSVGSingularValues(new File(exporttestdir,"discours_cadates_singularvalues"))
+////println("CA LT: "+(System.currentTimeMillis()-time)/1000)
+////
+////// CAH
+////time = System.currentTimeMillis();
+////CAH cah = new CAH(ca, true, CAH.getDefaultMethod(), CAH.getDefaultMetric(), 4, false)
+////cah.stepCompute()
+////cah.toSVG(new File(exporttestdir, "discours_dates_cah"),__RDevice.SVG);
+////println("CAH: "+(System.currentTimeMillis()-time)/1000)
Index: tmp/org.txm.core/src/groovy/org/txm/test/OpenAnEditor.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/test/OpenAnEditor.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/test/OpenAnEditor.groovy	(revision 258)
@@ -0,0 +1,18 @@
+package org.txm.test
+
+//import org.eclipse.ui.*;
+//import org.txm.rcpapplication.*;
+//
+//import org.txm.rcpapplication.editors.input.*;
+//import org.txm.rcpapplication.editors.queryindex.*;
+
+final def sel = corpusViewSelection
+
+monitor.syncExec(new Runnable() {
+	public void run() {
+//		def page = TXMWindows.getActiveWindow().getActivePage();
+//		def editorInput = new QueryIndexEditorInput(sel);
+//		def editor = (QueryIndexEditor) page.openEditor(editorInput, QueryIndexEditor.ID); //$NON-NLS-1$
+//		editor.initializeFields();
+	}
+})
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/test/ShowSpecifHistogram.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/test/ShowSpecifHistogram.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/test/ShowSpecifHistogram.groovy	(revision 258)
@@ -0,0 +1,81 @@
+/**
+ * Main.
+ *
+ * @param args the args
+ */
+// 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
+// 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.
+
+//
+// This file is part of the TXM platform.
+//
+// The TXM platform is free software: you can redistribute it and/or modif y
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 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/>.
+// 
+// 
+// 
+// $LastChangedDate: 2011-05-09 14:58:28 +0200 (lun., 09 mai 2011) $
+// $LastChangedRevision: 1839 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.test
+
+// imports des fonctions que l'on va utiliser
+import org.txm.functions.specificities.*
+import org.txm.searchengine.cqp.corpus.*
+
+def corpusname = "DISCOURS"
+def struct = "text"
+def structprop = "date"
+
+MainCorpus discours = CorpusManager.getCorpusManager().getCorpus(corpusname)
+println "Building partition..."
+Partition discours_dates = discours.createPartition( discours.getStructuralUnit(struct), discours.getStructuralUnit(struct).getProperty(structprop))
+	
+// on récupère ses propriétés
+Property pos = discours.getProperty("pos")
+Property lemme = discours.getProperty("lemma")
+Property word = discours.getProperty("word")
+
+def Fmin = 2
+def Vmax = 10
+
+println "Building lexical table..."
+def table = discours_dates.getLexicalTable(lemme, Fmin)
+//for(int i = 0 ; i table.get)
+table.cut(Vmax)
+
+println "Computing specificities..." 
+def	result = Specificites.specificites(table)
+
+File outfile = new File("specif.txt")
+result.toTxt(outfile, "UTF-8")
+println "Saved in file "+outfile.getAbsolutePath()
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/test/InjectMetadataCSV.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/test/InjectMetadataCSV.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/test/InjectMetadataCSV.groovy	(revision 258)
@@ -0,0 +1,29 @@
+package org.txm.test;
+import org.txm.metadatas.*;
+
+def txmfilesdir = new File("C:\\Documents and Settings\\alavrent\\xml\\metadata")
+def outdir = new File("C:\\Documents and Settings\\alavrent\\xml\\metadata\\meta")
+outdir.mkdir()
+def allmetadatasfile = new File("C:\\Documents and Settings\\alavrent\\xml\\metadata\\metadata.csv");
+println "-- INJECT METADATA - from csv file: "+allmetadatasfile+" in directory: "+txmfilesdir
+def metadatas = new Metadatas(allmetadatasfile, "UTF-8", ",","\"", 1)
+if(metadatas != null)
+{
+	println("Injecting metadata: "+metadatas.getHeadersList()+" in texts of directory "+txmfilesdir)
+	for (File infile : txmfilesdir.listFiles()) {
+		if(!infile.isFile() || infile.getName().endsWith(".csv.xml") || !infile.getName().endsWith(".xml"))
+			continue;
+		
+		print "."
+		File outfile = new File(outdir, infile.getName());
+		String tag = "text";
+		
+		if(!metadatas.injectMetadatasInXmlTXM(infile, outfile))
+		{
+			outfile.delete();
+			println "Error: Injection failed, stop import"
+			return;
+		}
+	}
+	println ""
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/test/AFC.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/test/AFC.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/test/AFC.groovy	(revision 258)
@@ -0,0 +1,181 @@
+///**
+// * Main.
+// *
+// * @param args the args
+// */
+//// 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
+//// 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.
+//// 
+//// 
+//// 
+//// $LastChangedDate:$
+//// $LastChangedRevision:$
+//// $LastChangedBy:$ 
+////
+//package org.txm.test
+//
+//import org.txm.Toolbox
+//import org.txm.functions.ca.*
+//import org.txm.searchengine.cqp.clientExceptions.CqiClientException
+//import org.txm.searchengine.cqp.clientExceptions.InvalidCqpIdException
+//import org.txm.searchengine.cqp.corpus.*
+//import org.txm.searchengine.cqp.corpus.query.*
+//import org.txm.stat.StatException
+//import org.txm.stat.data.LexicalTable
+//import org.apache.commons.lang.time.StopWatch
+//
+//// TODO: Auto-generated Javadoc
+///* (non-Javadoc)
+// * @see groovy.lang.Script#run()
+// */
+//def timer = new StopWatch()
+//
+//		// on récupère le corpus VOEUX
+//		//EN: let's get the VOEUX corpus
+//		def voeux = CorpusManager.getCorpusManager().getCorpus("VOEUX")
+//
+//timer.start()
+//
+//		// on crée une partition sur les textes avec comme propriété discriminante l'id du texte
+//		//EN: let create a partition on texts with their ID's
+//		def text_su = voeux.getStructuralUnit("text")
+//		def text_id = text_su.getProperty("id")
+//		def textes = voeux.createPartition(text_su, text_id)
+//		
+//timer.stop()
+//println "Création de la partition : "+timer.toString()	
+//timer.reset()
+//
+//		// choisir la propriété lexicale pour construire la table lexicale
+//		//EN: choose the lexical property to build the lexical table
+//		def prop = voeux.getProperty("lemme") 
+//
+//timer.start()
+//
+//		// on crée une table lexicale sans les hapax
+//		//EN: let create a lexical table without hapax legomenon
+//		def table = textes.getLexicalTable(prop, 2)
+//		
+//timer.stop()
+//println "Création de la table lexicale des lemmes : "+timer.toString()
+//timer.reset()		
+//	
+//timer.start()
+//		// on fait une afc
+//		//EN: compute the CA
+//		def ca = new CA(table)
+//		ca.processFromTable();
+//
+//timer.stop()
+//println "calcul de l'AFC 1 : "+timer.toString()		
+//timer.reset()
+//
+//timer.start()
+//
+//		// les valeurs propres
+//		//EN: singular values
+//		ca.getSingularValues()
+//		
+//timer.stop()
+//println "récupération des valeurs propres SV1 : "+timer.toString()	
+//timer.reset()	
+//
+//timer.start()
+//
+//		// les données de colonnes produites par le package CA de R
+//		//EN: column data produced by the CA R package
+//		ca.getColsCoords() 
+//		ca.getColsDist()
+//		ca.getColsInertia()
+//		ca.getColsMass()
+//		
+//timer.stop()
+//println "récupération de toutes les infos de colonnes1 : "+timer.toString()
+//timer.reset()
+//
+//timer.start()
+//
+//		// les données de lignes produites par le package CA de R
+//		//EN: row data produced by the CA R package
+//		ca.getRowsCoords()
+//		ca.getRowsDist()
+//		ca.getRowsInertia()
+//		ca.getRowsMass()
+//		
+//timer.stop()
+//println "récupération de toutes les infos de lignes1 : "+timer.toString()
+//timer.reset()
+//
+//timer.start()
+//
+//// on joue un peu avec la table EN: let's play with the table
+//table.cut(3000) 						// pas plus de 3000 valeurs, EN: not more than 3000 values
+//table.filter(table.getFreqs(), 2000, 5) // coupe a 2000 valeurs et Fmin=5, EN: cut to 2000 values and Fmin=5
+//
+//timer.stop()
+//println "On filtre la table lexicale en fréquence et en nombre de lignes : "+timer.toString()
+//timer.reset()
+//
+//timer.start()
+//
+//// on fait une afc
+////EN: we compute a CA
+//def ca2 = new CA(table)
+//ca2.processFromTable();
+//timer.stop()
+//println "calcul de la deuxième AFC : "+timer.toString()		
+//timer.reset()
+//
+//timer.start()
+//
+//// les valeurs propres
+////EN: singular values
+//ca2.getSingularValues()
+//
+//timer.stop()
+//println "récupération des valeurs propres SV2 : "+timer.toString()	
+//timer.reset()	
+//
+//timer.start()
+//
+//// les données de colonnes produites par le package CA de R
+////EN: column data produced by the CA R package
+//ca2.getColsCoords() 
+//ca2.getColsDist()
+//ca2.getColsInertia()
+//ca2.getColsMass()
+//
+//timer.stop()
+//println "récupération de toutes les infos de colonnes2 : "+timer.toString()
+//timer.reset()
+//
+//timer.start()
+//
+//// les données de lignes produites par le package CA de R
+////EN: row data produced by the CA R package
+//ca2.getRowsCoords()
+//ca2.getRowsDist()
+//ca2.getRowsInertia()
+//ca2.getRowsMass()
+//
+//timer.stop()
+//println "récupération de toutes les infos de lignes2 : "+timer.toString()
+//timer.reset()
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/test/textselection.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/test/textselection.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/test/textselection.groovy	(revision 258)
@@ -0,0 +1,13 @@
+package org.txm.test
+
+
+//import the packages containing the functions we are going to use
+import org.txm.Toolbox
+import org.txm.searchengine.cqp.corpus.*
+import org.txm.searchengine.cqp.corpus.query.*
+import org.txm.functions.selection.*
+
+MainCorpus corpus = CorpusManager.getCorpusManager().getCorpus("DISCOURS")
+
+Selection sel = new Selection(corpus);
+sel.fullDump()
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/test/HelloWorldR.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/test/HelloWorldR.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/test/HelloWorldR.groovy	(revision 258)
@@ -0,0 +1,48 @@
+package org.txm.test;
+
+/**
+ * 
+Main.
+ *
+ * @param args the args
+ */
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+import org.txm.stat.engine.r.RWorkspace
+
+// TODO: Auto-generated Javadoc
+/* (non-Javadoc)
+ * @see groovy.lang.Script#run()
+ */
+def r = RWorkspace.getRWorkspaceInstance() 	// get the R connection
+
+r.setLog(true)								// start R logging
+
+r.eval("print(\"Hello World!\")")			// do it
+
+r.setLog(false) 							// stop R log
Index: tmp/org.txm.core/src/groovy/org/txm/test/Cooccurrences.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/test/Cooccurrences.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/test/Cooccurrences.groovy	(revision 258)
@@ -0,0 +1,75 @@
+///**
+// * Main.
+// *
+// * @param args the args
+// */
+//// 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
+//// 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.
+//// 
+//// 
+//// 
+//// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+//// $LastChangedRevision: 2386 $
+//// $LastChangedBy: mdecorde $ 
+////
+//package org.txm.test
+//
+//// we import the packages containing the functions we are going to use
+//import org.txm.Toolbox
+//import org.txm.searchengine.cqp.corpus.*
+//import org.txm.searchengine.cqp.corpus.query.*
+//import org.txm.functions.cooccurrences.*
+//
+//// TODO: Auto-generated Javadoc
+///* (non-Javadoc)
+// * @see groovy.lang.Script#run()
+// */
+//def discours = CorpusManager.getCorpusManager().getCorpus("DISCOURS")
+//
+//def word = discours.getProperty("word")
+//def pos = discours.getProperty("pos")
+//
+//def limit = discours.getStructuralUnit("s")
+//def minleft = 1
+//def maxleft = 2
+//def minright = 1
+//def maxright = 2
+//
+//def minf = 0
+//def mincof = 0
+//def minscore = 0
+//
+//def query = new Query(Query.fixQuery("je"))
+//
+////long time = System.currentTimeMillis()
+//
+//def cooccurrence = new Cooccurrence(discours, query, [word], limit, minleft, maxleft, minright, maxright, minf, mincof, minscore)
+//cooccurrence.process();
+////cooccurrence.compute()
+//
+////println("Compute time : "+(System.currentTimeMillis()-time)+" ms")
+//
+//
+//def file = new File("cooc.txt")
+//cooccurrence.toTxt(file)
+//
+//println "printed cooccurrents in "+file.getAbsolutePath()
+//
Index: tmp/org.txm.core/src/groovy/org/txm/test/testSummary.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/test/testSummary.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/test/testSummary.groovy	(revision 258)
@@ -0,0 +1,12 @@
+package org.txm.test
+
+import org.txm.Toolbox
+import org.txm.searchengine.cqp.corpus.*
+import org.txm.functions.summary.*
+
+def discours = CorpusManager.getCorpusManager().getCorpus("DISCOURS")
+Summary summary = new Summary(discours);
+if(summary.init())
+	println "success";
+else
+	pritnln "fail";
Index: tmp/org.txm.core/src/groovy/org/txm/test/CQPBenchmark.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/test/CQPBenchmark.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/test/CQPBenchmark.groovy	(revision 258)
@@ -0,0 +1,324 @@
+//package org.txm.test
+//
+//import org.txm.*
+//import org.txm.functions.*
+////import org.txm.functions.ca.*
+////import org.txm.functions.classification.CAH
+//import org.txm.functions.concordances.*
+//import org.txm.functions.concordances.comparators.*
+//import org.txm.functions.cooccurrences.*
+//import org.txm.functions.diagnostic.*
+//import org.txm.functions.index.*
+//import org.txm.functions.referencer.Referencer
+//import org.txm.functions.specificities.*
+//import org.txm.searchengine.cqp.corpus.*
+//import org.txm.searchengine.cqp.corpus.query.*
+//import org.txm.stat.data.LexicalTable
+//import org.txm.utils.DeleteDir
+//
+//
+//testDir = new File(System.getProperty("user.home"), "TXM/testrelease");
+//DeleteDir.deleteDirectory testDir;
+//testDir.mkdir()
+//
+////get corpus
+//csv = [];
+//firstExecution = 0;
+//
+//def process(String CORPUSNAME, String QUERY1, String QUERY2) {
+//	
+//	String ENCODING = "UTF-8"
+//	String COLSEPARATOR = "\t"
+//	String TXTSEPARATOR = ""
+//	int i = 0;
+//	def corpora = CorpusManager.getCorpusManager().getCorpora()
+//	MainCorpus corpus = CorpusManager.getCorpusManager().getCorpus(CORPUSNAME)
+//	//println "CORPUS: "+corpus
+//
+//	Query query = new Query(QUERY1) //"\"..............*\"", "\"..........*\""
+//	Query query2 = new Query(QUERY2)
+//
+//	File exporttestdir = new File(testDir, corpus.getName());
+//	File reportFile = new File(exporttestdir, "report.csv")
+//	DeleteDir.deleteDirectory exporttestdir;
+//	exporttestdir.mkdir()
+//	//println "Results are saved in dir: "+ exporttestdir
+//
+//	// word properties
+//	def word_property = corpus.getProperty("word")
+//
+//	// structure properties
+//	StructuralUnit text_su = corpus.getStructuralUnit("text")
+//	StructuralUnit s_su = corpus.getStructuralUnit("s")
+//	Property text_id_property = text_su.getProperty("id")
+//	ReferencePattern referencePattern = new ReferencePattern().addProperty(text_id_property)
+//
+//	long time;
+//	// START START START START
+//	if (firstExecution == 0)
+//		csv << ["object", "size", "nPart", "command", "query", "query freq", "$CORPUSNAME $QUERY1 $QUERY2 mode "+Toolbox.getParam(Toolbox.CQI_NETWORK_MODE)]
+//	else
+//		csv[i++] << "$CORPUSNAME $QUERY1 $QUERY2 mode "+Toolbox.getParam(Toolbox.CQI_NETWORK_MODE)
+//	
+//	// INFORMATIONS
+//	print " INFO"
+//	time = System.currentTimeMillis();
+//	Diagnostic diag = new Diagnostic(corpus, 20)
+//	diag.stepGeneralInfos();
+//	diag.stepLexicalProperties();
+//	diag.stepStructuralUnits();
+//	diag.toHTML(new File(exporttestdir, "diag"))
+//	if (firstExecution == 0)
+//		csv << [corpus.getName(), corpus.getSize(), 1, "Informations", "no query", "no freq", (System.currentTimeMillis()-time)/1000]
+//	else
+//		csv[i++] << (System.currentTimeMillis()-time)/1000
+//
+//	// LEXICON
+//	print " LEX"
+//	time = System.currentTimeMillis();
+//	corpus.getLexicon(word_property).toTxt(new File(exporttestdir, "lexpos"), ENCODING, COLSEPARATOR, TXTSEPARATOR);
+//	if (firstExecution == 0)
+//		csv << [corpus.getName(), corpus.getSize(), 1, "Lexicon", "no query", "no freq", (System.currentTimeMillis()-time)/1000]
+//	else
+//		csv[i++] << (System.currentTimeMillis()-time)/1000
+//		
+//	// INDEX
+//	print " INDEX"
+//	time = System.currentTimeMillis();
+//	IndexSample index = new IndexSample(corpus, query, [word_property])
+//	index.toTxt(new File(exporttestdir, "indexlemmafuncj"), ENCODING, COLSEPARATOR, TXTSEPARATOR)
+//	if (firstExecution == 0)
+//		csv << [corpus.getName(), corpus.getSize(), 1, "Index", query, index.getT(), (System.currentTimeMillis()-time)/1000]
+//	else
+//		csv[i++] << (System.currentTimeMillis()-time)/1000
+//
+//	// REFERENCER
+//	print " REF"
+//	time = System.currentTimeMillis();
+//	Referencer referencer = new Referencer(corpus, query, word_property, [text_id_property], true);
+//	referencer.getQueryMatches()
+//	referencer.getQueryindexes()
+//	referencer.groupPositionsbyId()
+//	referencer.toTxt(new File(exporttestdir, "referencer"), ENCODING)
+//	if (firstExecution == 0)
+//		csv << [corpus.getName(), corpus.getSize(), 1, "Referencer", query, index.getT(), (System.currentTimeMillis()-time)/1000]
+//	else
+//		csv[i++] << (System.currentTimeMillis()-time)/1000
+//
+//	// CONCORDANCE
+//	print " CONC"
+//	time = System.currentTimeMillis();
+//	Concordance concordance = new Concordance(corpus, query, word_property, [word_property, word_property], referencePattern, referencePattern, 15, 15)
+//	concordance.toTxt(new File(exporttestdir,"concj"), Concordance.Format.CONCORDANCE)
+//	if (firstExecution == 0)
+//		csv << [corpus.getName(), corpus.getSize(), 1, "Concordances", query, index.getT(), (System.currentTimeMillis()-time)/1000]
+//	else
+//		csv[i++] << (System.currentTimeMillis()-time)/1000
+//
+//	// COOCCURRENCE WORD WINDOW
+//	print " COOC"
+//	time = System.currentTimeMillis();
+//	Cooccurrence cooc = new Cooccurrence(corpus, query, [word_property], null, 21, 1, 1, 11, 2, 3, 1, false);
+//	cooc.process();
+//	cooc.toTxt(new File(exporttestdir, "cooc_wordwindow"), ENCODING)
+//	if (firstExecution == 0)
+//		csv << [corpus.getName(), corpus.getSize(), 1, "Cooccurrences words", query, index.getT(), (System.currentTimeMillis()-time)/1000]
+//	else
+//		csv[i++] << (System.currentTimeMillis()-time)/1000
+//
+//	// COOCCURRENCE SENTENCE WINDOW
+//	print " COOC"
+//	time = System.currentTimeMillis();
+//	Cooccurrence cooc2 = new Cooccurrence(corpus, query, [word_property], s_su,2, 1, 1, 1, 2, 3,1, false);
+//	cooc2.process();
+//	cooc2.toTxt(new File(exporttestdir, "cooc_swindow"), ENCODING)
+//	if (firstExecution == 0)
+//		csv << [corpus.getName(), corpus.getSize(), 1, "Cooccurrences structures", query, index.getT(), (System.currentTimeMillis()-time)/1000]
+//	else
+//		csv[i++] << (System.currentTimeMillis()-time)/1000
+//
+//	// INDEX
+//	print " INDEX"
+//	time = System.currentTimeMillis();
+//	index = new IndexSample(corpus, query2, [word_property])
+//	index.toTxt(new File(exporttestdir, "indexlemmafuncj"), ENCODING, COLSEPARATOR, TXTSEPARATOR)
+//	if (firstExecution == 0)
+//		csv << [corpus.getName(), corpus.getSize(), 1, "Index", query2, index.getT(), (System.currentTimeMillis()-time)/1000]
+//	else
+//		csv[i++] << (System.currentTimeMillis()-time)/1000
+//
+//	// REFERENCER
+//	print " REF"
+//	time = System.currentTimeMillis();
+//	referencer = new Referencer(corpus, query2, word_property, [text_id_property], true);
+//	referencer.getQueryMatches()
+//	referencer.getQueryindexes()
+//	referencer.groupPositionsbyId()
+//	referencer.toTxt(new File(exporttestdir, "referencer"), ENCODING)
+//	if (firstExecution == 0)
+//		csv << [corpus.getName(), corpus.getSize(), 1, "Referencer", query, index.getT(), (System.currentTimeMillis()-time)/1000]
+//	else
+//		csv[i++] << (System.currentTimeMillis()-time)/1000
+//
+//	// CONCORDANCE
+//	print " CONC"
+//	time = System.currentTimeMillis();
+//	concordance = new Concordance(corpus, query2, word_property, [word_property, word_property], referencePattern, referencePattern, 15, 15)
+//	concordance.toTxt(new File(exporttestdir,"concj"), Concordance.Format.CONCORDANCE)
+//	if (firstExecution == 0)
+//		csv << [corpus.getName(), corpus.getSize(), 1, "Concordances", query, index.getT(), (System.currentTimeMillis()-time)/1000]
+//	else
+//		csv[i++] << (System.currentTimeMillis()-time)/1000
+//
+//	// COOCCURRENCE WORD WINDOW
+//	print " COOC"
+//	time = System.currentTimeMillis();
+//	cooc = new Cooccurrence(corpus, query2, [word_property], null, 21, 1, 1, 11, 2, 3, 1, false);
+//	cooc.process();
+//	cooc.toTxt(new File(exporttestdir, "cooc_wordwindow"), ENCODING)
+//	if (firstExecution == 0)
+//		csv << [corpus.getName(), corpus.getSize(), 1, "Cooccurrences words", query, index.getT(), (System.currentTimeMillis()-time)/1000]
+//	else
+//		csv[i++] << (System.currentTimeMillis()-time)/1000
+//
+//	// COOCCURRENCE SENTENCE WINDOW
+//	print " COOC"
+//	time = System.currentTimeMillis();
+//	cooc2 = new Cooccurrence(corpus, query2, [word_property], s_su,2, 1, 1, 1, 2, 3,1, false);
+//	cooc2.process();
+//	cooc2.toTxt(new File(exporttestdir, "cooc_swindow"), ENCODING)
+//	if (firstExecution == 0)
+//		csv << [corpus.getName(), corpus.getSize(), 1, "Cooccurrences structures", query, index.getT(), (System.currentTimeMillis()-time)/1000]
+//	else
+//		csv[i++] << (System.currentTimeMillis()-time)/1000
+//
+//	// SUBCORPORA
+//	print " SUBCORPUS"
+//	time = System.currentTimeMillis();
+//	Corpus DGcorpus = corpus.createSubcorpus(text_su, text_id_property, "01_DeGaulle", "dgsubcorpus")
+//	if (firstExecution == 0)
+//		csv << [corpus.getName(), corpus.getSize(), 1, "Subcorpus", "no query", "no freqs", (System.currentTimeMillis()-time)/1000]
+//	else
+//		csv[i++] << (System.currentTimeMillis()-time)/1000
+//
+//	// PARTITIONS
+//	print " PARTITIONS"
+//	time = System.currentTimeMillis();
+//	Partition discours_types = corpus.createPartition(text_su, text_id_property)
+//	Partition discours_dates = corpus.createPartition(text_su, text_id_property)
+//	if (firstExecution == 0)
+//		csv << [corpus.getName(), corpus.getSize(), 1, "Partition 2x", "no query", "no freqs", (System.currentTimeMillis()-time)/1000]
+//	else
+//		csv[i++] << (System.currentTimeMillis()-time)/1000
+//
+//	// LEXICAL TABLE
+//	print " LT"
+//	time = System.currentTimeMillis();
+//	LexicalTable table = discours_types.getLexicalTable(word_property, 2);
+//	table.exportData(new File(exporttestdir, "type_LT"), COLSEPARATOR, TXTSEPARATOR);
+//	if (firstExecution == 0)
+//		csv << [discours_types.getName(), corpus.getSize(), discours_types.getNPart(), "LT part", "no query", "no freqs", (System.currentTimeMillis()-time)/1000]
+//	else
+//		csv[i++] << (System.currentTimeMillis()-time)/1000
+//
+////	// SPECIF SUBCORPUS
+////	time = System.currentTimeMillis();
+////	print " SPECIF"
+////	SpecificitesResult specifresult2 = org.txm.functions.specificities.Specificites.specificites(DGcorpus.getParent(), DGcorpus, word_property)
+////	specifresult2.toTxt(new File(exporttestdir,"dgsub_specifloc"), ENCODING, COLSEPARATOR, TXTSEPARATOR)
+////	if (firstExecution == 0)
+////		csv << [DGcorpus.getName(), corpus.getSize(), 1, "Specif sub", "no query", "no freqs", (System.currentTimeMillis()-time)/1000]
+////	else
+////		csv[i++] << (System.currentTimeMillis()-time)/1000
+////
+////	// SPECIF LEXICAL TABLE
+////	print " SPECIF"
+////	time = System.currentTimeMillis();
+////	SpecificitesResult specifresult3 = org.txm.functions.specificities.Specificites.specificites(table);
+////	specifresult3.toTxt(new File(exporttestdir,"speciftype"), ENCODING, COLSEPARATOR, TXTSEPARATOR)
+////	if (firstExecution == 0)
+////		csv << [table.getName(), corpus.getSize(), table.getNColumns(), "specif LT", "no query", "no freqs", (System.currentTimeMillis()-time)/1000]
+////	else
+////		csv[i++] << (System.currentTimeMillis()-time)/1000
+////
+////	// AFC PARTITION
+////	print " AFC"
+////	time = System.currentTimeMillis();
+////	CA ca = new CA(discours_dates, word_property, 0 ,9999999)
+////	ca.stepLexicalTable();
+////	ca.stepSortTableLexical();
+////	ca.stepCompute()
+////	ca.toSVGFactorialMap(new File(exporttestdir,"cadates"), true, true)
+////	ca.toSVGSingularValues(new File(exporttestdir,"cadates_singularvalues"))
+////	if (firstExecution == 0)
+////		csv << [discours_dates.getName(), corpus.getSize(), discours_dates.getNPart(), "AFC part", "no query", "no freqs", (System.currentTimeMillis()-time)/1000]
+////	else
+////		csv[i++] << (System.currentTimeMillis()-time)/1000
+////
+////	// AFC LEXICAL TABLE
+////	print " AFC"
+////	time = System.currentTimeMillis();
+////	CA ca2 = new CA(table);
+////	ca2.stepCompute()
+////	ca2.toSVGFactorialMap(new File(exporttestdir,"cadates"), true, true)
+////	ca2.toSVGSingularValues(new File(exporttestdir,"cadates_singularvalues"))
+////	if (firstExecution == 0)
+////		csv << [table.getName(), corpus.getSize(), table.getNColumns(), "specif LT", "no query", "no freqs", (System.currentTimeMillis()-time)/1000]
+////	else
+////		csv[i++] << (System.currentTimeMillis()-time)/1000
+////
+////	// CAH
+////	print " CAH"
+////	time = System.currentTimeMillis();
+////	CAH cah = new CAH(ca, true, CAH.getDefaultMethod(), CAH.getDefaultMetric(), 4, false)
+////	cah.stepCompute()
+////	cah.toSVG(new File(exporttestdir, "dates_cah"),__RDevice.SVG);
+////	if (firstExecution == 0)
+////		csv << [discours_dates.getName(), corpus.getSize(), discours_dates.getNPart(), "CAH ca table", "no query", "no freqs", (System.currentTimeMillis()-time)/1000]
+////	else
+////		csv[i++] << (System.currentTimeMillis()-time)/1000
+////
+////	firstExecution++;
+////	println ""
+//
+//}
+//
+//
+//
+//println "restarting TBX..."
+//Toolbox.setParam(Toolbox.CQI_NETWORK_MODE, "false")
+//println "MEMORY MODE: "+Toolbox.restart();
+//process("DISCOURS", "\"..............*\"", "\"..........*\"") // first time
+//println "MEMORY MODE: "+Toolbox.restart();
+//process("DISCOURS", "\"..............*\"", "\"..........*\"")
+//
+//println "restarting TBX..."
+//Toolbox.setParam(Toolbox.CQI_NETWORK_MODE, "true")
+//println "NETWORK MODE: "+Toolbox.restart();
+//process("DISCOURS", "\"..............*\"", "\"..........*\"")
+//println "NETWORK MODE: "+Toolbox.restart();
+//process("DISCOURS", "\"..............*\"", "\"..........*\"")
+//
+//
+//
+//
+//// add TOTAL line
+//int[] totaux = ["","","","","","",""]
+//for (int i = 7 ; i < csv.size() ; i++) {
+//	int total = 0;
+//	for (def line : csv) {
+//		total += line[i]
+//	}
+//	totaux << total
+//}
+//csv << totaux;
+//
+//// WRITE ALL RESULTS
+//for (def line : csv) {
+//	for (int i = 0 ; i < firstExecution ; i++) {
+//		def item = line[i]
+//		if (i > 0) print "\t"+item
+//		else print item
+//	}
+//	println ""
+//}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/test/ClixTest.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/test/ClixTest.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/test/ClixTest.groovy	(revision 258)
@@ -0,0 +1,86 @@
+/**
+ * Main.
+ *
+ * @param args the args
+ */
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.test
+
+/**
+ * How to use ProcessBuilder to wrap an external program
+ * 
+ * 
+ * ======= Definition file =======
+<?xml version="1.0" encoding="UTF-8"?>
+<application name="Ls" version="0.0.0" desc="List directory">
+	<progs>
+		<prog exec="ls" version="0.0.0" desc="Ls">
+			<args>
+				<arg state="optional" type="none" name="l" desc="use a long listing format"/>
+				<arg state="optional" type="none" name="a" desc="do not ignore entries starting with '.'"/>
+				<arg state="optional" type="String" name="d" desc="list directory entries instead of contents"/>
+			</args>
+		</prog>
+	</progs>
+</application>
+ * 
+ */
+
+/**
+ * the file containing the declaration of the Ls program : ls-wrapper-definition.xml
+ *
+ */
+def definitionFile = new File("~/workspace/org.txm.toolbox/src/groovy/org/textometrie/scripts/ls-wrapper-definition.xml")
+
+/**
+ * The file which will contain the code : Ls.groovy
+ */
+def classFile = new File("~/Ls.groovy")
+
+/**
+ * the directory containing the binaries which will be called: /bin/
+ */
+def binariesDirectory = new File("/bin/")
+
+/**
+ * build wrapping code
+ */
+def aProgram = org.txm.utils.processbuilder.ProcessBuilder.wrapProgram(definitionFile, classFile, binariesDirectory)
+
+/**
+ * set call parameters
+ */
+aProgram.setl()
+aProgram.seta()
+
+/**
+ * call the ls external program
+ */
+aProgram.ls()
+
Index: tmp/org.txm.core/src/groovy/org/txm/test/Concordances.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/test/Concordances.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/test/Concordances.groovy	(revision 258)
@@ -0,0 +1,83 @@
+/**
+ * Main.
+ *
+ * @param args the args
+ */
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2015-10-22 10:13:24 +0200 (Thu, 22 Oct 2015) $
+// $LastChangedRevision: 3041 $
+// $LastChangedBy: finnishgazelle $ 
+//
+
+package org.txm.test
+
+// import the packages containing the functions we are going to use
+import org.txm.Toolbox
+import org.txm.searchengine.cqp.corpus.*
+import org.txm.searchengine.cqp.corpus.query.*
+import org.txm.functions.concordances.*
+import org.txm.functions.concordances.comparators.*
+import org.txm.functions.ReferencePattern
+
+	// get the DISCOURS corpus
+	// TODO: Auto-generated Javadoc
+
+	/* (non-Javadoc)
+	 * @see groovy.lang.Script#run()
+	 */
+	def discours = CorpusManager.getCorpusManager().getCorpus("VOEUX")
+	
+	// get some properties
+	def pos = discours.getProperty("pos")
+	def word = discours.getProperty("word")
+	def text = discours.getStructuralUnit("text")
+	def text_id = text.getProperty("id")
+
+	// create a query. Here the concordance keyword will be the French word "Je" (the "I" pronoun in English)
+	def query = new Query(Query.fixQuery("je"))
+	
+	// define the references pattern for each concordance line
+	def referencePattern = new ReferencePattern().addProperty(text_id)
+	def sortReferencePattern = new ReferencePattern().addProperty(text_id)
+
+	// compute the concordance with contexts of 15 words on each side of the keyword
+	def concordance = new Concordance(discours, query, word, [word, pos], referencePattern,sortReferencePattern, 15, 15)
+
+	// get a builtin sort function
+	def comparator = new LexicographicLeftContextComparator()
+	comparator.initialize(discours)
+
+	
+	// sort the concordance
+	concordance.sort(comparator)
+	
+	// define which occurrence properties will be displayed
+	concordance.setViewProperties([word])
+	
+	// write all the concordance in a text file
+	def file = new File("conc.txt")
+	concordance.toTxt(file, "UTF-8")
+	
+	println("Concordance written in file: "+ file.getAbsolutePath())
Index: tmp/org.txm.core/src/groovy/org/txm/setup/BuildFeatureFromProduct.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/setup/BuildFeatureFromProduct.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/setup/BuildFeatureFromProduct.groovy	(revision 258)
@@ -0,0 +1,72 @@
+package org.txm.setup
+
+import groovy.xml.*
+
+String home = System.getProperty("user.home")
+File rcpSrc = new File(home, "workspace43/org.txm.rcp")
+File rcpFeatureSrc = new File(home, "workspace43/org.txm.rcp.feature")
+File productFile = new File(rcpSrc, "rcpapplication.product")
+File featureFile = new File(rcpFeatureSrc, "feature.xml")
+//File featureFileBackUp = new File(rcpFeatureSrc, "feature_back.xml")
+
+
+def slurper = new XmlParser();
+def product = slurper.parse(productFile.toURI().toString())
+
+def plugins = product.plugins.plugin
+def toSend = []
+for (def plugin : plugins) { // set @os @ws @arch and @nl
+	boolean remove = false;
+	String id = plugin.@id
+	if (id.contains(".linux")) plugin.@os = "linux"
+	else if (id.contains(".win32")) plugin.@os = "win32"
+	else if (id.contains(".macosx")) plugin.@os = "macosx"
+	else if (id.contains(".aix")) remove = true
+	else if (id.contains(".hpux")) remove = true
+	else if (id.contains(".qnx")) remove = true
+	else if (id.contains(".solaris")) remove = true
+	
+	if (id.contains(".wpf")) plugin.@ws = "wpf"
+	else if (id.contains(".win32")) plugin.@ws = "win32"
+	else if (id.contains(".photon")) remove = true
+	else if (id.contains(".motif")) remove = true
+	else if (id.contains(".gtk")) plugin.@ws = "gtk"
+	else if (id.contains(".cocoa")) plugin.@ws = "cocoa"
+	else if (id.contains(".carbon")) plugin.@ws = "carbon"
+	else if (id.contains(".s390")) remove = true
+	else if (id.contains(".s390x")) remove = true
+	
+	if (id.contains(".x86_64")) plugin.@arch = "x86_64"
+	else if (id.contains(".x86")) plugin.@arch = "x86"
+	else if (id.contains(".ia64_32")) remove = true
+	else if (id.contains(".ia64")) remove = true
+	else if (id.contains(".spark")) remove = true
+	else if (id.contains(".ppc")) remove = true
+	else if (id.contains(".PA_RISC")) remove = true
+	
+//	def m = id =~ /.+\.nl_(..)/
+//	if (m.size() > 0) {
+//		if (m[0].size() > 1) {
+//			plugin.@nl = m[0][1]
+//		}
+//	}
+	
+	plugin."@download-size"="0"
+	plugin."@install-size"="0"
+	plugin.@version="0.0.0"
+	plugin.@unpack="false"
+	
+	if (!remove) {
+		toSend << plugin
+	}
+}
+
+println "FEATURE"
+
+def feature = slurper.parse(featureFile.toURI().toString())
+
+for (def plugin : toSend) {
+	feature.append(plugin)
+}
+//println XmlUtil.serialize(feature)
+featureFile.write(XmlUtil.serialize(feature))
Index: tmp/org.txm.core/src/groovy/org/txm/setup/BuildSplashVersion.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/setup/BuildSplashVersion.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/setup/BuildSplashVersion.groovy	(revision 258)
@@ -0,0 +1,54 @@
+package org.txm.setup;
+
+import java.awt.*;
+import java.awt.image.*;
+import java.io.File;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import javax.imageio.ImageIO;
+import org.txm.importer.XPathResult;
+
+// Update splash screen using the RCP project version set in the product file
+// The BMP image must be 32bit encoded
+
+int img_width = 316;
+
+File rcpDir = new File(System.getProperty("user.home"), "workspace442/org.txm.rcp")
+File product = new File(rcpDir, "rcpapplication.product");
+File imgFile = new File(rcpDir, "splash_sansversion.bmp");
+File imgFile2 = new File(rcpDir,"splash.bmp");
+
+String modifier = ""
+
+//String version =  org.txm.rcpapplication.Activator.getDefault().getBundle().getVersion().toString(); // "0.7.7.201412160925";
+String version = XPathResult.getXpathResponse(product, "//product/@version")
+//def date = " ("+new SimpleDateFormat("yyyy-MM-dd").format(new Date())+")"
+def date = ""
+version = "TXM "+version.replaceAll(".qualifier", date);
+
+if (modifier.length() > 0 ) version = version + " - "+modifier
+
+println "VERSION: '$version'"
+
+BufferedImage img = null;
+img = ImageIO.read(imgFile);
+Graphics g = img.getGraphics();
+g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+
+File imgMascot = new File(System.getProperty("user.home"),"Images/splashs/"+version+".png");
+println imgMascot
+if (imgMascot.exists()) {
+	println "write mascot"
+	g.drawImage(ImageIO.read(imgMascot), 0, 0, img_width, 360, null, null);
+}
+
+Font font = new Font("Arial", Font.BOLD, 20);
+g.setColor(new Color(109,139,0)); //
+g.setFont(font);
+FontMetrics fontMetrics = g.getFontMetrics();
+int width = fontMetrics.stringWidth(version);
+g.drawString(version, img_width - width - 20, 300);
+
+ImageIO.write(img, "BMP", imgFile2);
+
+println "Done: "+imgFile2.getAbsoluteFile()
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/setup/MessagesToArchMessages.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/setup/MessagesToArchMessages.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/setup/MessagesToArchMessages.groovy	(revision 258)
@@ -0,0 +1,162 @@
+package org.txm.setup
+rootDir = new File("/home/mdecorde/paquets")
+linuxMessagesDir = new File(rootDir, "shared/debian/DEBIAN")
+windowsMessagesDir = new File(rootDir, "archs/win")
+macMessagesDir = new File(rootDir, "shared/mac")
+
+windowsMessages = ";START OF LANG MESSAGES\n"
+win_langs = ["en": "ENGLISH" , "fr":"FRENCH"]
+
+needed_keys = [
+	"InfosTitle", "InfosText", "WelcomeTitle", "WelcomeText",
+	"InstallRLibrariesTitle", "InstallRLibrariesText", "FinishTitle",
+	"FinishTextWindows", "FinishTextLinux", "FinishTextMac",
+	"ErrorArch32", "ErrorArch64", "UninstallWindows", "InstallTreeTagger"]
+
+if (!(writeLangFiles("en") && writeLangFiles("fr"))) {
+	println "Stoping process"
+	return;
+} 
+
+windowsMessages += ";END OF LANG MESSAGES\n"
+
+File nsis32 = new File(windowsMessagesDir, "32bit/txm.nsi")
+File nsis64 = new File(windowsMessagesDir, "64bit/txm.nsi")
+
+if (!(patchNSIS(nsis32) && patchNSIS(nsis64))) {
+	println "Error while patching nsis files"
+}
+
+def patchNSIS(File nsis) {
+	String text = nsis.getText("Windows-1252")
+	boolean startReplacing = false;
+	nsis.withWriter("Windows-1252") { writer ->
+		for (String line : text.split("\n")) {
+			if (";START OF LANG MESSAGES" == line.trim()) {
+				startReplacing = true
+				line = windowsMessages
+				writer.println line
+			}
+			if (";END OF LANG MESSAGES" == line.trim())  {
+				startReplacing = false
+				continue
+			}
+
+			if (!startReplacing) {
+				writer.println line
+			}
+		}
+	}
+	return true;
+}
+def checkProps(def props) {
+	def missing = []
+	for (String prop : needed_keys)
+		if (!props.containsKey(prop))
+			missing << prop
+	return missing
+}
+
+def writeLangFiles(String lang) {
+	println "Writing lang files for $lang"
+	File propFile = new File(rootDir, "SetupMessages_${lang}.properties")
+
+	Properties props = new Properties()
+	InputStreamReader input = new InputStreamReader(new FileInputStream(propFile) , "UTF-8")
+	props.load(input)
+	input.close()
+
+	def missingProps = checkProps(props)
+	if (missingProps.size() > 0) {
+		println "Error missings keys $lang: "+missingProps
+		return false;
+	}
+
+	String ext = ""
+	if (lang.length() > 0) ext = "."+lang
+
+	// LINUX
+	File template = new File(linuxMessagesDir, "templates"+ext)
+	template.withWriter("UTF-8") { writer ->
+		writer.println(
+"""Template: TXM/showinfos
+Type: note
+Description:"""+props.get("InfosTitle"))
+		writer.println(
+				" .\n  "+props.get("InfosText").replaceAll("\n\n", '\n .\n').replaceAll("\n([^ ])", '\n  $1').replaceAll("\n", '\n '))
+		writer.println()
+		writer.println(
+"""Template: TXM/showwelcome
+Type: note
+Description:"""+props.get("WelcomeTitle"))
+		writer.println(
+				" .\n  "+props.get("WelcomeText").replaceAll("\n\n", '\n .\n').replaceAll("\n([^ ])", '\n  $1').replaceAll("\n", '\n '))
+		writer.println()
+		writer.println(
+"""Template: TXM/askr
+Type: boolean
+Default: true
+Description:"""+props.get("InstallRLibrariesTitle"))
+		writer.println(
+				" .\n  "+props.get("InstallRLibrariesText").replaceAll("\n\n", '\n .\n').replaceAll("\n([^ ])", '\n  $1').replaceAll("\n", '\n '))
+		writer.println()
+		writer.println(
+"""Template: TXM/finish
+Type: note
+Description:"""+props.get("FinishTitle"))
+	writer.println(
+		" .\n  "+props.get("FinishTextLinux").replaceAll("\n\n", '\n .\n').replaceAll("\n([^ ])", '\n  $1').replaceAll("\n", '\n '))
+	writer.println(
+		" .\n  "+props.get("InstallTreeTagger").replaceAll("\n\n", '\n .\n').replaceAll("\n([^ ])", '\n  $1').replaceAll("\n", '\n '))
+	}
+
+	//WINDOWS NSIS
+	if (lang.length() > 0) ext = "_"+lang
+
+	StringWriter swriter = new StringWriter();
+	swriter.println(";Lang Strings "+win_langs[lang])
+	swriter.println('LangString InfosTitleMessage ${LANG_'+win_langs[lang]+'} "'+props.get("InfosTitle").replaceAll("\"", "'")+'"')
+	swriter.println('LangString InfosTextMessage ${LANG_'+win_langs[lang]+'} "'+props.get("InfosText").replaceAll("\n", '\\$\\\\n').replaceAll("\"", "'")+'"')
+	swriter.println('LangString WelcomeTitleMessage ${LANG_'+win_langs[lang]+'} "'+props.get("WelcomeTitle").replaceAll("\"", "'")+'"')
+	swriter.println('LangString WelcomeTextMessage ${LANG_'+win_langs[lang]+'} "'+props.get("WelcomeText").replaceAll("\n", '\\$\\\\n').replaceAll("\"", "'")+'"')
+	// no R libs question
+	swriter.println('LangString FinishTitleMessage ${LANG_'+win_langs[lang]+'} "'+props.get("FinishTitle".replaceAll("\"", "'"))+'"')
+	swriter.println('LangString FinishTextMessage ${LANG_'+win_langs[lang]+'} "'+(props.get("FinishTextWindows") + '$\\n' + props.get("InstallTreeTagger")).replaceAll("\n", '\\$\\\\n').replaceAll("\"", "'")+'"')
+	// Windows specific messages
+	swriter.println('LangString ErrorArch32Message ${LANG_'+win_langs[lang]+'} "'+props.get("ErrorArch32").replaceAll("\"", "'")+'"')
+	swriter.println('LangString ErrorArch64Message ${LANG_'+win_langs[lang]+'} "'+props.get("ErrorArch64").replaceAll("\"", "'")+'"')
+	swriter.println('LangString UninstallWindowsMessage ${LANG_'+win_langs[lang]+'} "'+props.get("UninstallWindows").replaceAll("\n", '\\$\\\\n').replaceAll("\"", "'")+'"')
+	swriter.close();
+
+	windowsMessages += "\n"+swriter.toString()+"\n"
+
+	//MAC 3 FILES : Intro, ReadMe and Finish
+	File intromac = new File(macMessagesDir, "intro${ext}.txt")
+	intromac.withWriter("x-MacRoman") { writer ->
+		writer.println("")
+		writer.println(props.get("InfosText"))
+	}
+	File readmemac = new File(macMessagesDir, "readme${ext}.txt")
+	readmemac.withWriter("x-MacRoman") { writer ->
+		writer.println("")
+		writer.println(props.get("WelcomeText"))
+	}
+	File rlibsmac = new File(macMessagesDir, "rlibs${ext}.txt")
+	rlibsmac.withWriter("x-MacRoman") { writer ->
+		writer.println(props.get("InstallRLibrariesTitle"))
+		writer.println(props.get("InstallRLibrariesText"))
+	}
+	File finishmac = new File(macMessagesDir, "finish${ext}.txt")
+	finishmac.withWriter("x-MacRoman") { writer ->
+		writer.println("")
+		writer.println(props.get("FinishTextMac"))
+		writer.println("")
+		writer.println(props.get("InstallTreeTagger"))
+	}
+	
+	return true;
+}
+
+
+
+
Index: tmp/org.txm.core/src/groovy/org/txm/setup/BuildTXMHTMLDoc.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/setup/BuildTXMHTMLDoc.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/setup/BuildTXMHTMLDoc.groovy	(revision 258)
@@ -0,0 +1,55 @@
+import java.io.File;
+
+import org.txm.macro.txt.SearchReplaceInDirectoryMacro;
+import org.txm.utils.io.FileCopy;
+
+String home = System.getProperty("user.home")
+String svnpath = "SVN/TXMSVN/trunk/doc/user manuals"
+File svnDir = new File(home, svnpath)
+File svnImagesDir = new File(svnDir, "ImagesTXM")
+//File odtFile = new File(home, "SVN/TXMSVN/trunk/doc/user manuals/Manuel de TXM 0.7 FR.odt")
+File htmlDir = new File(home, "TEMP/manuel")
+
+if (!htmlDir.listFiles()) {
+	println "Error: you must empty $htmlDir before. Aborting."
+	return;
+}
+
+if (!svnDir.exists()) {
+	println "Error: Cannot find SVN files $svnDir. Aborting"
+	return
+}
+
+//// Update SVN // marche pas :(
+//String cmd = "svn update \"$svnDir\""
+//println "SVN update: "+cmd
+//def proc = cmd.execute()
+//proc.in.getText()
+//proc.waitFor()
+//if (proc.exitValue() != 0) {
+//	println "SVN update error code: "+proc.exitValue()
+//	println "Error: "+proc.err.getText()
+//	return;
+//} 
+
+// Copy images
+File htmlImagesDir = new File(htmlDir, svnImagesDir.getName())
+FileCopy.copyFiles(svnImagesDir, htmlImagesDir)
+if (!htmlImagesDir.exists()) {
+	println "Failed to copy $htmlImagesDir"
+	return
+}
+
+// Fix HTML files
+// fix images source directory - remove SVN absolute path
+svnpath = svnpath.replaceAll(" ", "%20")
+new SearchReplaceInDirectoryMacro().process(htmlDir, "\\.xhtml", "UTF-8",
+	 / src="\.\.\/\.\.\/$svnpath\//, 
+	 ' src="', false)
+// fix images source directory - remove "/" of some image paths
+new SearchReplaceInDirectoryMacro().process(htmlDir, "\\.xhtml", "UTF-8",
+	/\/ImagesTXM/,
+	'ImagesTXM', false)
+new SearchReplaceInDirectoryMacro().process(htmlDir, "\\.xhtml", "UTF-8",
+	/<style media="all" type="text\/css">/, 
+	'<link rel="stylesheet" type="text/css" href="style.css"/>\n<style media="all" type="text/css">', false)
Index: tmp/org.txm.core/src/groovy/org/txm/setup/SVNStats.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/setup/SVNStats.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/setup/SVNStats.groovy	(revision 258)
@@ -0,0 +1,142 @@
+package org.txm.setup
+
+File svnLog = new File("/home/mdecorde/SVN/ALLTXMSVN/txm/log.xml");
+File outRev = new File("/home/mdecorde/TEMP/stats_rev.tsv")
+File outPeriode = new File("/home/mdecorde/TEMP/stats_periode.tsv")
+def periodes = [1624, 1771, 1823, 2095, 2299]
+def SVNROOT = new File("/home/mdecorde/SVN/ALLTXMSVN/txm")
+def composants = ["/trunk/CWB/", "/trunk/doc/", "/trunk/groovy-all/", "/trunk/RCP/", "/trunk/textometrieR/", "/trunk/Toolbox/", "/trunk/WEB/", ""]
+
+def logs = new XmlParser().parse(svnLog);
+def revisions = new LinkedHashMap<String, Object>();
+def allPackages = new HashSet<String>();
+def allFiles = new HashSet<String>();
+
+println "Counting revisions..."
+for (def logEntry : logs.logentry) {
+	// SVN log.xml infos
+	def commitAuthor = logEntry.author.text();
+	def commitDate = logEntry.date.text();
+	def nUpdate = 0;
+	def nAdd = 0
+	def nDelete = 0;
+	def newPackages = new HashSet<String>()
+	def newFiles = new HashSet<String>()
+
+	for (def path : logEntry.paths.path) {
+		String file = path.text();
+		switch(path.'@action') {
+			case "M":
+				nUpdate++
+				break;
+			case "A":
+				nAdd++
+				if (file.matches(".+\\.[A-Za-z]{1,10}")) {
+					newFiles << file;
+				} else {
+					newPackages << file;
+				}
+				break;
+			case "D":
+				nDelete++;
+				break;
+			default:
+				break;
+		}
+	}
+
+	// SVN file explore
+	def nLines = 0;
+	def authors = [commitAuthor]
+	// count lines
+	// get @author
+
+	revisions[Integer.parseInt(logEntry.'@revision')] = [commitDate, authors, nUpdate, nAdd, nDelete, newPackages.size(), newPackages, newFiles.size(), newFiles]
+}
+
+def periodesStats = new LinkedHashMap<String, Object>()
+int currentPeriode = 0
+def nCommit = 0
+def nUpdate = 0
+def nAdd = 0
+def nDelete = 0
+def authors = new HashSet<String>()
+def newPackages = new HashSet<String>()
+def newFiles = new HashSet<String>()
+
+println "Counting periodes..."
+def revKeys = revisions.keySet().sort()
+def previousRev = revKeys[0]
+for( def rev : revKeys) {
+	if (rev >= periodes[currentPeriode]) {
+		//println "end of periode "+periodes[currentPeriode]+ " at rev "+rev
+		periodesStats[periodes[currentPeriode]] = [revisions[previousRev][0], authors, nCommit, nUpdate, nAdd, nDelete, newPackages.size(), newFiles.size(), newPackages]
+
+		currentPeriode++
+		authors = new HashSet<String>()
+		nCommit = 0;
+		nUpdate = 0;
+		nAdd = 0
+		nDelete = 0;
+		newPackages = new HashSet<String>()
+		newFiles = new HashSet<String>()
+	}
+	def infos = revisions[rev]
+	nCommit++
+	authors.addAll(infos[1])
+	nUpdate += infos[2]
+	nAdd += infos[3]
+	nDelete += infos[4]
+	newPackages.addAll(infos[6])
+	newFiles.addAll(infos[8])
+	
+	previousRev = rev
+}
+//periodesStats[2299] = [nCommit, authors, nUpdate, nAdd, nDelete, newPackages.size(), newPackages, newFiles.size(), newFiles]
+
+
+println "Counting composants of periodes..."
+for(def p : periodesStats.keySet()) {
+	def infos = periodesStats[p]
+	//println infos.size()
+	newPackages = infos[8]
+	def newPackagesComp = [:]
+
+	for (String path : newPackages) {
+	for (int i = 0 ; i < composants.size() ; i++) {
+		def comp = composants[i]
+		
+			if (path.startsWith(comp)) {
+				if (newPackagesComp[comp] == null) newPackagesComp[comp] = new HashSet<String>();
+				newPackagesComp[comp] << path.substring(comp.length())
+				break;
+			}
+		}
+	}
+	for (int i = 0 ; i < composants.size() ; i++) {
+		def comp = composants[i]
+		if (newPackagesComp[comp] != null)
+			newPackagesComp[comp] = newPackagesComp[comp] .size()
+	}
+	infos[8] = newPackagesComp;
+}
+
+println "revisions stat size: "+revisions.size()
+println "periodes stat size: "+periodesStats.size()
+
+println "writing outRev"
+outRev.withWriter("UTF-8") { writer ->
+	writer.println "rev\tdate\tauthors\tnUpdate\tnAdd\tnDelete\tnNewPackages\tnewPackages\tnNewFiles\tnewFiles"
+	for( def rev : revisions.keySet()) {
+		writer.println rev+"\t"+revisions[rev].join ("\t")
+	}
+}
+//[revisions[previousRev][0], authors, nCommit, nUpdate, nAdd, nDelete, newPackages.size(), newFiles.size(), newPackages]
+println "writing outPeriode"
+outPeriode.withWriter("UTF-8") { writer ->
+	writer.println "periode\tdate\tauthors\tnCommit\tnUpdate\tnAdd\tnDelete\tnNewPackages\tnNewFiles\tnewPackagesPerComp"
+	for(def p : periodesStats.keySet()) {
+		writer.println p+"\t"+periodesStats[p].join ("\t")
+		writer.flush()
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/setup/ChangeLog.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/setup/ChangeLog.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/setup/ChangeLog.groovy	(revision 258)
@@ -0,0 +1,80 @@
+package org.txm.setup
+
+import org.txm.importer.ApplyXsl2;
+
+// build log.xml
+// cd /home/mdecorde/workspace37/org.txm.toolbox
+// svn log --xml --verbose > /home/mdecorde/workspace37/org.txm.toolbox/log.xml
+String home = System.getProperty("user.home")
+File rootDir = new File(home, "SVN/TXMSVN")
+File xsl = new File(home, "xsl/svn2cl.xsl")
+File rawLogs = new File(home, "TEMP/portal_hist.txt")
+File log = new File(home, "TEMP/log.txt")
+File tbx = new File(home, "SVN/TXMSVN")
+
+println "** FILES:"
+println home
+println rootDir
+println xsl
+println rawLogs
+println log
+println tbx
+
+String dateLimit = "2014-01"
+String revLimit = "1"
+
+String cmd = """svn log --xml --verbose $tbx"""
+println "\n** SVN LOG: "+cmd
+def proc = cmd.execute()
+rawLogs.withWriter("UTF-8") { writer -> writer.write(proc.in.getText()) }
+proc.waitFor()
+if (proc.exitValue() != 0) {
+	println "SVN LOG error code: "+proc.exitValue()
+	println "Error: "+proc.err.getText()
+	return;
+} 
+
+println "** Filter XML : by date=$dateLimit and rev=$revLimit"
+def slurper = new XmlParser();
+def root = slurper.parse(rawLogs.toURI().toString())
+log.withWriter("UTF-8") { writer ->
+	for (def entry : root.logentry) {
+		String rev = entry.@revision
+		if (rev.compareTo(revLimit) < 0) continue
+		def msgs = entry.msg
+		
+		for (def date : entry.date) {
+			String sdate = date.text()
+			if (sdate.compareTo(dateLimit) < 0) {
+				return
+			}
+			writer.print("* "+sdate.substring(0, 10) + " - " + (sdate.substring(11, 19)))+ " REV "+rev
+		}
+		
+		boolean first = true;
+		for (def msg : msgs) {
+			String smsg = msg.text().trim()
+			if (smsg.length() == 0) continue;
+			if (first) { first = false; smsg = "\n"+smsg; }
+			smsg = smsg.replace("\nRCP", "\n** RCP")
+			smsg = smsg.replace("\nTBX", "\n** TBX")
+			smsg = smsg.replace("\nPLUGIN", "\n** PLUGIN")
+			smsg = smsg.replace("\nWEB", "\n** WEB")
+			smsg = smsg.replace("\nSETUP", "\n** SETUP")
+			smsg = smsg.replace("\nDOC", "\n** DOC")
+			smsg = smsg.replace("\nTRA", "\n** TRA")
+			smsg = smsg.replace("\nCQP", "\n** CQP")
+			smsg = smsg.replace("\nCWB", "\n** CQP")
+			smsg = smsg.replace("\nINSTALL", "\n** INSTALL")
+			smsg = smsg.replace("\nR textometry", "\n** R textometry")
+			smsg = smsg.replace(" :", ":") // hahaha
+			smsg = smsg.replace("textoemtry", "textometry") // hohoho
+			smsg = smsg.replace("# ", "*** ")
+			smsg = smsg.replace("#([0-9]+)", "[https://forge.cbp.ens-lyon.fr/redmine/issues/${1} #{1}]")
+			writer.print smsg
+		}
+		writer.println ""
+	}
+}
+
+println "RESULT SAVED IN : "+log.toURI()
Index: tmp/org.txm.core/src/groovy/org/txm/setup/FixFeaturePluginDeclaration.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/setup/FixFeaturePluginDeclaration.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/setup/FixFeaturePluginDeclaration.groovy	(revision 258)
@@ -0,0 +1,92 @@
+package org.txm.setup
+
+import org.txm.utils.io.FileCopy;
+
+import groovy.xml.*
+
+
+String home = System.getProperty("user.home")
+File rcpSrc = new File(home, "workspace441/org.txm.rcp")
+File productFile = new File(rcpSrc, "rcpapplication.product")
+
+//File dir = new File("/home/mdecorde/ECLIPSE/babel/babel-kepler/features/org.eclipse.babel.nls_eclipse_ru_4.3.0.v20131123020001")
+File dir = new File("/home/matthieu/ECLIPSE/eclipse_babel/features/org.eclipse.babel.nls_eclipse_ru_4.4.0.v20150804100819")
+
+File origFeatureFile = new File(dir, "feature_orig.xml") // will be created if not, and parsed
+File featureFile = new File(dir, "feature.xml")
+File featureResultFile = new File(dir, "result_feature.xml")
+
+if (!origFeatureFile.exists()) { // backup feature file if not already done
+	FileCopy.copy(featureFile, origFeatureFile)
+}
+
+def slurper = new XmlParser();
+
+// get used plugin IDs
+def product = slurper.parse(productFile.toURI().toString())
+def usedPlugins = new HashSet<String>()
+for (def plugin : product.plugins.plugin) {
+	usedPlugins.add(plugin.@id)
+}
+println "Number of plugins declared in product: "+usedPlugins.size()
+
+// Fix feature : remove unused plugins and fix @os @ws @arch and @nl attributes
+def feature = slurper.parse(origFeatureFile.toURI().toString())
+def plugins = feature.plugin
+def toSend = []
+for (def plugin : plugins) { // set @os @ws @arch and @nl
+	boolean remove = false;
+	String id = plugin.@id
+	
+	String hostid = id.substring(0, id.lastIndexOf(".nl_")) // remove the nl_xx.yyyyyyy part
+	println "$id >> $hostid"
+	
+	// set os
+	if (id.contains(".linux")) plugin.@os = "linux"
+	else if (id.contains(".win32")) plugin.@os = "win32"
+	else if (id.contains(".macosx")) plugin.@os = "macosx"
+	else if (id.contains(".aix")) remove = true
+	else if (id.contains(".hpux")) remove = true
+	else if (id.contains(".qnx")) remove = true
+	else if (id.contains(".solaris")) remove = true
+	
+	// set ws
+	if (id.contains(".wpf")) plugin.@ws = "wpf"
+	else if (id.contains(".win32")) plugin.@ws = "win32"
+	else if (id.contains(".photon")) remove = true
+	else if (id.contains(".motif")) remove = true
+	else if (id.contains(".gtk")) plugin.@ws = "gtk"
+	else if (id.contains(".cocoa")) plugin.@ws = "cocoa"
+	else if (id.contains(".carbon")) plugin.@ws = "carbon"
+	
+	if (id.contains(".s390")) remove = true
+	else if (id.contains(".s390x")) remove = true
+	
+	// set arch
+	if (id.contains(".x86_64")) plugin.@arch = "x86_64"
+	else if (id.contains(".x86")) plugin.@arch = "x86"
+	else if (id.contains(".ia64_32")) remove = true
+	else if (id.contains(".ia64")) remove = true
+	else if (id.contains(".spark")) remove = true
+	else if (id.contains(".ppc")) remove = true
+	else if (id.contains(".PA_RISC")) remove = true
+	
+	// set nl
+//	def m = id =~ /.+\.nl_(..)/
+//	if (m.size() > 0) {
+//		if (m[0].size() > 1) {
+//			plugin.@nl = m[0][1]
+//		}
+//	}
+	
+	if (remove) {
+		plugin.replaceNode {}
+	}
+//	if (!usedPlugins.contains(hostid)) {
+//		plugin.replaceNode {}
+//	}
+}
+
+println "WRITE RESULT FEATURE"
+//println XmlUtil.serialize(feature)
+featureResultFile.write(XmlUtil.serialize(feature))
Index: tmp/org.txm.core/src/groovy/org/txm/setup/package.html
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/setup/package.html	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/setup/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Contains Groovy scripts used to update&build TXM setups</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/org/txm/setup/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/setup/FixQuotesInProperties.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/setup/FixQuotesInProperties.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/setup/FixQuotesInProperties.groovy	(revision 258)
@@ -0,0 +1,20 @@
+package org.txm.setup
+
+File propDirFile = new File("/home/mdecorde/workspace441/org.txm.toolbox/src/java/org/txm")
+
+for (File propFile : propDirFile.listFiles()) {
+	if (!propFile.getName().endsWith(".properties")) continue;
+
+	println "FILE: $propFile"
+	String text = propFile.getText("iso-8859-1")
+
+	propFile.withWriter("iso-8859-1") { writer->
+		for (String line : text.split("\n")) {
+			if (line.contains("{0}") || line.contains("{1}") || line.contains("{2}") || line.contains("{3}")) {
+				writer.println line.replaceAll("''", "'").replaceAll("''", "'").replaceAll("'", "''")
+			} else {
+				writer.println line
+			}
+		}
+	}
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/tal/melt/MElt.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/tal/melt/MElt.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/tal/melt/MElt.groovy	(revision 258)
@@ -0,0 +1,105 @@
+
+package org.txm.tal.melt
+
+import java.io.File;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+import org.txm.tal.Tagger
+import org.txm.tal.SlashFile2TTRez
+import org.txm.utils.StreamHog;
+
+class MElt extends Tagger {
+	
+	Process process = null;
+	InputStream meltis
+	OutputStream meltos
+	boolean debug = false
+	
+	BufferedReader reader
+	StringBuffer buffer = new StringBuffer();
+	
+	public MElt(File executablePath, File modelPath, String lang) {
+		super(executablePath, modelPath, lang);
+	}
+	
+	public boolean start() {
+		// Call Melt
+		def args = [];
+		args << "MElt"
+		//args << "-L"
+		ProcessBuilder pb = new ProcessBuilder(args);
+		try {
+			process = pb.start();
+		} catch (IOException e) {
+			System.err.println(e);
+			return false
+		}
+		meltis = process.getInputStream();
+		meltos = process.getOutputStream();
+		
+		new StreamHog(process.getErrorStream(), debug) // read Error Stream
+		//new StreamHog(process.getInputStream(), true) // read Error Stream
+		reader = new BufferedReader(new InputStreamReader(meltis));
+		return true;
+	}
+	
+	public boolean processText(String text) {
+		if (debug) println "Send text: $text"
+		process << text
+		process << "\n"
+		meltos.flush()
+		return true;
+	}
+	
+	public def readStream() {
+		if (debug) println "reading lines..."
+		
+		try {
+			String line = null;
+			while ((line = reader.readLine()) != null) {
+				buffer << line
+				buffer << "\n"
+			}
+		} catch (IOException e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+		
+		return "end"
+	}
+	
+	public boolean stop() {
+		meltos.close()
+		readStream()
+		
+		int e = 0;
+		try {
+			e = process.waitFor();
+		} catch (Exception err) {	}
+
+		if (e != 0) {
+			System.err .println("Process exited abnormally with code " + e )
+		}
+	}
+	
+	public def getResult() {
+		return SlashFile2TTRez.processString(buffer.toString())
+	}
+	
+	
+	public static void main(String[] args) {
+		MElt melt = new MElt(new File(""), new File(""), "fr")
+		melt.start()
+		melt.processText("""Il va.
+Un autre bout, de texte""")
+		melt.stop()
+
+		println "\nMELT DONE\n"
+		for (def r : melt.getResult()) {
+			for (def rr : r)
+				print rr+"\t"
+			println ""
+		}
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/tal/melt/SxPipe.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/tal/melt/SxPipe.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/tal/melt/SxPipe.groovy	(revision 258)
@@ -0,0 +1,164 @@
+
+package org.txm.tal.melt
+
+import java.io.File;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+import org.txm.tal.Tagger
+import org.txm.tal.SlashFile2TTRez
+import org.txm.utils.StreamHog;
+
+class SxPipe {
+
+	Process process = null;
+	InputStream meltis
+	OutputStream meltos
+	boolean debug = false
+
+	BufferedReader reader
+	StringBuffer buffer = new StringBuffer();
+
+	public SxPipe() {
+	}
+
+	public boolean start() {
+		// Call Melt
+		def args = [];
+		args << "MElt"
+		args << "-t"
+		args << "-C"
+		ProcessBuilder pb = new ProcessBuilder(args);
+		try {
+			process = pb.start();
+		} catch (IOException e) {
+			System.err.println(e);
+			return false
+		}
+		meltis = process.getInputStream();
+		meltos = process.getOutputStream();
+
+		new StreamHog(process.getErrorStream(), debug) // read Error Stream
+		//new StreamHog(process.getInputStream(), true) // read Error Stream
+		reader = new BufferedReader(new InputStreamReader(meltis));
+		return true;
+	}
+
+	public boolean processText(String text) {
+		if (debug) println "Send text: $text"
+		process << text
+		process << "\n"
+		meltos.flush()
+		return true;
+	}
+
+	public def readStream() {
+		if (debug) println "reading lines..."
+
+		try {
+			String line = null;
+			while ((line = reader.readLine()) != null) {
+				buffer << line
+				buffer << "\n"
+			}
+		} catch (IOException e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+
+		return "end"
+	}
+
+	public boolean stop() {
+		meltos.close()
+		readStream()
+
+		int e = 0;
+		try {
+			e = process.waitFor();
+		} catch (Exception err) {	}
+
+		if (e != 0) {
+			System.err .println("Process exited abnormally with code " + e )
+		}
+	}
+
+	public def getResult() {
+		return buffer.toString()
+		//return SlashFile2TTRez.processString(buffer.toString())
+	}
+
+	public void printResult() {
+		def segs = getResult().split("\n")// \\{\\\$\\\$\\\$\\\$\\} \\\$\\\$\\\$\\\$
+
+		int i = 0;
+		for (def seg : segs) {
+			def tokens = []
+			for(def str :  seg.replaceAll("\\{", "\n{").tokenize("\n")) {
+				if (str.startsWith("{"))
+					println str.substring(1, str.indexOf("}")).replace("_ACC_O", "{").replace("_ACC_F", "}")
+			}
+		}
+	}
+
+	public def getResultTokens() {
+		def segs = getResult().split("\n")
+		def tokens = []
+
+		int i = 0, idx = -1;
+		for (def seg : segs) {
+			for(def str :  seg.replaceAll("\\{", "\n{").tokenize("\n")) {
+				if (str.startsWith("{")) {
+					idx = str.indexOf("}")
+					try{
+						tokens << [str.substring(1, idx).replace("_ACC_O", "{").replace("_ACC_F", "}"),
+							str.substring(idx+1)]
+					} catch(Exception e) {e.printStackTrace();println "STRING IS : '$str'"}
+				}
+			}
+
+		}
+		return tokens
+	}
+
+	public def getResultSegments() {
+		def segs = getResult().split("\n")
+		def segsFinal = []
+
+		int i = 0, idx = -1;
+		for (def seg : segs) {
+			def tokens = []
+			for(def str :  seg.replaceAll("\\{", "\n{").tokenize("\n")) {
+				if (str.startsWith("{")) {
+					idx = str.indexOf("}")
+					try{
+						tokens << [str.substring(1, idx).replace("_ACC_O", "{").replace("_ACC_F", "}"),
+							str.substring(idx+1)]
+					} catch(Exception e) {e.printStackTrace();println "STRING IS : '$str'"}
+				}
+			}
+			segsFinal << tokens
+		}
+		return segsFinal
+	}
+
+
+	public static void main(String[] args) {
+		SxPipe melt = new SxPipe()
+		melt.start()
+		melt.processText("""Il y a {du} pain \$\$\$\$ c'était bon. Y a-t-il assez ?
+Un autre bout, de texte : fin.""")
+		melt.stop()
+
+		melt.printResult()
+
+
+
+		//		println "\nMELT DONE\n"
+		//		for (def r : melt.getResult()) {
+		//			for (def rr : r)
+		//				print rr+"\t"
+		//			println ""
+		//		}
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/tal/melt/MEltAnnotate.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/tal/melt/MEltAnnotate.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/tal/melt/MEltAnnotate.groovy	(revision 258)
@@ -0,0 +1,153 @@
+// 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
+// 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.
+//
+//
+//
+// $LastChangedDate: 2013-11-08 13:38:06 +0100 (Fri, 08 Nov 2013) $
+// $LastChangedRevision: 2569 $
+// $LastChangedBy: mdecorde $
+//
+package org.txm.tal.melt
+
+import java.text.DateFormat
+
+import org.txm.Toolbox
+import org.txm.importer.*
+import org.txm.importer.cwb.*
+import org.txm.objects.*
+import org.txm.scripts.teitxm.Annotate
+import org.txm.tal.SlashFile2TTRez
+
+// TODO: Auto-generated Javadoc
+/**
+ * Annotate and replace the TEI-TXM files of the folder $rootDirFile/txm with TreeTagger.
+ * creates $rootDirFile/interp and $rootDirFile/treetagger
+ *
+ */
+class MEltAnnotate extends Annotate {
+
+	public void initTTOutfileInfos(File rootDirFile, File modelfile)
+	{
+		reportFile = new File(rootDirFile,"NLPToolsParameters.xml");
+
+		respPerson = System.getProperty("user.name");
+		respId = "txm";
+		respDesc = "NLP annotation tool";
+		respDate = DateFormat.getDateInstance(DateFormat.SHORT, Locale.UK).format(new Date());
+		respWhen = DateFormat.getDateInstance(DateFormat.FULL, Locale.UK).format(new Date());
+
+		appIdent = "MElt";
+		appVersion = "2.0";
+
+		distributor = "";
+		publiStmt = """""";
+		sourceStmt = """""";
+
+		types = ["frpos"];
+		typesTITLE = ["frpos"];
+
+		typesDesc = ["pos tagset built from MElt"]
+		typesTAGSET = ["",""]
+		typesWEB = ["",""]
+
+		idform ="w";
+	}
+
+	/**
+	 * Apply tt.
+	 *
+	 * @param ttsrcfile the ttsrcfile
+	 * @param ttoutfile the ttoutfile
+	 * @param modelfile the modelfile
+	 * @return true, if successful
+	 */
+	public boolean applyTT(File ttsrcfile, File ttoutfile, File modelfile) {
+		return applyMElt(ttsrcfile, ttoutfile)
+	}
+
+	public boolean applyMElt(File ttsrcfile, File ttoutfile) {
+		// Call Melt
+		def args = [];
+		args << "MElt"
+		args
+		ProcessBuilder pb = new ProcessBuilder(args);
+		Process process = null;
+		try {
+			process = pb.start();
+		} catch (IOException e) {
+			System.err.println(e);
+		}
+		InputStream is = process.getInputStream();
+		OutputStream os = process.getOutputStream();
+		InputStreamReader isr = new InputStreamReader(is);
+		BufferedReader br = new BufferedReader(isr);
+		ttsrcfile.eachLine ("UTF-8") { line ->
+			println "> $line"
+			os.println line
+		}
+		
+		ttoutfile.withWriter("UTF-8") { writer ->
+			String line;
+			println "getting result"
+			while ((line = br.readLine()) != null) {
+				println "< $line"
+				writer.println(line);
+			}
+			println "end of result"
+			int e = 0;
+			try {
+				e = process.waitFor();
+			} catch (Exception err) {	}
+
+			if (e != 0) {
+				System.err .println("Process exited abnormally with code " + e + " at " + DateFormat.getDateInstance(DateFormat.FULL, Locale.UK).format(new Date())); //$NON-NLS-1$ //$NON-NLS-2$
+
+				for (int c = 0; c < args.size(); c++)
+					System.out.print("" + args.get(c) + " "); //$NON-NLS-1$ //$NON-NLS-2$
+				System.out.println();
+			}
+		}
+
+		// Reformat MElt output
+		File tmpFile = new File(ttoutfile.getParentFile(),ttoutfile.getName()+".tmp")
+		new SlashFile2TTRez(ttoutfile, tmpFile, "UTF-8")
+	}
+	
+	public boolean run(File binDir, File txmDir) {
+		return run(binDir, txmDir, "fr.par")
+	}
+
+	public static void main(def args) {
+		Toolbox.setParam(Toolbox.INSTALL_DIR,new File("C:/Program Files/TXM"));
+		Toolbox.setParam(Toolbox.TREETAGGER_INSTALL_PATH, new File("/home/mdecorde/treetagger"));
+		Toolbox.setParam(Toolbox.TREETAGGER_MODELS_PATH, new File("/home/mdecorde/treetagger/models"));
+		Toolbox.setParam(Toolbox.METADATA_ENCODING, "UTF-8");
+		Toolbox.setParam(Toolbox.METADATA_COLSEPARATOR, ",");
+		Toolbox.setParam(Toolbox.METADATA_TXTSEPARATOR, "\"");
+		Toolbox.setParam(Toolbox.USER_TXM_HOME, new File("/home/mdecorde/TXM"));
+		
+		println "-- ANNOTATE - Running MElt tool"
+
+		File binDir = new File("/home/mdecorde/xml/melt-out")
+		File txmDir = new File("/home/mdecorde/xml/melt-in")
+		new MEltAnnotate().run(binDir, txmDir);
+	}
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/tal/melt/MEltTokenizer.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/tal/melt/MEltTokenizer.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/tal/melt/MEltTokenizer.groovy	(revision 258)
@@ -0,0 +1,22 @@
+package org.txm.tal.melt
+
+import org.txm.tal.XMLStaxTokenizerAdapter;
+
+class MEltTokenizer extends XMLStaxTokenizerAdapter {
+	
+	public MEltTokenizer(File infile, def xpaths) {
+		super(infile, xpaths);
+	}
+	
+	protected List<CharSequence> tokenize(String str) {
+		def ret = str.tokenize()
+		return ret;
+	}
+	
+	public static void main(String[] args) {
+		File inputXMLFile = new File("/home/mdecorde/xml/xmltest/txt1.xml");
+		File outputXMLFile = new File("/home/mdecorde/xml/xmltest/txt1-o.xml");
+		
+		new MEltTokenizer(inputXMLFile, ["/root/subtruc/submachin/"]).process(outputXMLFile)
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/tal/XMLStaxTokenizerAdapter2.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/tal/XMLStaxTokenizerAdapter2.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/tal/XMLStaxTokenizerAdapter2.groovy	(revision 258)
@@ -0,0 +1,160 @@
+package org.txm.tal
+
+import java.net.URL;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.txm.importer.StaxIdentityParser;
+import org.txm.importer.graal.PersonalNamespaceContext;
+import org.txm.tal.melt.SxPipe
+
+
+/**
+ * Test of tokenizer that tokenize parts of a XML file using XPath resolved with the Stax parser
+ * 
+ * @author mdecorde
+ *
+ */
+class XMLStaxTokenizerAdapter2 {
+	def xpaths;
+	boolean debug = false;
+	boolean doTokenize = false
+	def segments = []
+	String str;
+
+	protected URL inputurl;
+	protected def inputData;
+	protected XMLInputFactory factory;
+	protected XMLStreamReader parser;
+
+	public static String TXMNS = "http://textometrie.org/1.0";
+	public static String TEINS = "http://www.tei-c.org/ns/1.0";
+	protected static PersonalNamespaceContext Nscontext = new PersonalNamespaceContext();
+
+	String currentXPath = "/"
+	String localname;
+
+	public XMLStaxTokenizerAdapter2(File infile, def xpaths) {
+		this.inputurl = infile.toURI().toURL();
+		inputData = inputurl.openStream();
+		factory = XMLInputFactory.newInstance();
+		parser = factory.createXMLStreamReader(inputData);
+		this.xpaths = xpaths
+	}
+
+	public boolean process() {
+		try {
+			for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+				switch (event) {
+					case XMLStreamConstants.START_ELEMENT:
+						localname = parser.getLocalName();
+						currentXPath += localname+"/"
+						processStartElement();
+						break;
+					case XMLStreamConstants.CHARACTERS:
+						processCharacters();
+						break;
+					case XMLStreamConstants.END_ELEMENT:
+						localname = parser.getLocalName();
+						processEndElement();
+						currentXPath = currentXPath.substring(0, currentXPath.length() - localname.length() -1)
+						break;
+
+				}
+			}
+		} catch(Exception e) {
+			println("Error while parsing file "+inputurl);
+			println("Location "+parser.getLocation());
+			org.txm.utils.logger.Log.printStackTrace(e);
+			parser.close();
+			return false;
+		}
+
+		if (parser !=null) parser.close();
+		return true;
+	}
+
+	protected void processStartElement() {
+		String localname = parser.getLocalName();
+		if (debug) println "start element $currentXPath"
+		if (doTokenize) {
+			if (debug) println "Found text element $currentXPath"
+			tokenizeCurrentText();
+		} else {
+			if (xpaths.contains(currentXPath)) {
+				doTokenize = true;
+				str = "";
+			}
+		}
+	}
+
+	protected void processEndElement() {
+		if (xpaths.contains(currentXPath)) {
+			tokenizeCurrentText()
+			doTokenize = false;
+			if (debug) println "Found text element: stop tokenizing"
+		}
+	}
+
+	protected void processCharacters() {
+		if (doTokenize) {
+			str += parser.getText();
+		}
+	}
+
+	int nsegments = 0;
+	protected tokenizeCurrentText() {
+		if (str.length() == 0) return;
+
+		segments << str
+		nsegments++;
+		str = "" // continue tokenizing
+	}
+
+	/**
+	 * Best tokenizer ever.
+	 * Extends this function
+	 * 
+	 * @param str
+	 * @return
+	 */
+	protected List<CharSequence> tokenize(String str) {
+		return str.tokenize();
+	}
+
+	public static void main(String[] args) {
+		File inputXMLFile = new File("/home/mdecorde/xml/comere/cmrclavardage/cmr-getalp_org-actu-tei-v1.xml");
+		def firstPass = new XMLStaxTokenizerAdapter2(inputXMLFile, ["/TEI/text/body/div/post/p/"]);
+
+		println "FIRST PASS"
+		firstPass.process()
+		println firstPass.getSegments().size()
+
+		println "TOKENIZING..."
+		StringBuffer buffer = new StringBuffer();
+		for(def segment : firstPass.getSegments()) {
+			buffer << segment.replaceAll("\n", " ") + "\n"
+		}
+		new File("/home/mdecorde/Bureau/test1.txt").withWriter {writer -> writer.println(buffer)}
+
+		SxPipe sxpipe = new SxPipe()
+		sxpipe.start()
+		sxpipe.processText(buffer.toString())
+		sxpipe.stop()
+
+		new File("/home/mdecorde/Bureau/test.txt").withWriter {writer -> writer.println(sxpipe.getResult())}
+		def tokenizedSegments = sxpipe.getResultSegments()
+		println "tokenizedSegments size "+tokenizedSegments.size()
+		//		for(def segment : firstPass.getSegments()) {
+		//			tokenizedSegments << segment.tokenize()
+		//		}
+
+		//		println "SECOND PASS"
+		//		def secondPass = new XMLStaxTokenizerAdapter(inputXMLFile, ["/TEI/text/body/div/post/p/"], tokenizedSegments);
+		//		secondPass.process(new File("/home/mdecorde/xml/comere/cmrclavardage/tmp.xml"))
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/tal/SlashFile2TTRez.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/tal/SlashFile2TTRez.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/tal/SlashFile2TTRez.groovy	(revision 258)
@@ -0,0 +1,45 @@
+package org.txm.tal
+
+class SlashFile2TTRez {
+	public static boolean debug = true;
+
+	public SlashFile2TTRez(File inputFile, File outputFile, String encoding) {
+		outputFile.withWriter("UTF-8") { writer ->
+			int nline = 1;
+			inputFile.eachLine(encoding) { line ->
+				def rez = processString(line)
+				for (def l : rez) {
+					//if (debug) println "result: $l"
+					writer.println(l[0] + "\t" + l[1])
+				}
+				nline++;
+			}
+		}
+	}
+
+	def static empty = [null,null]
+	public static def processString(String line) {
+		def rez = [];
+		if (debug) println "process line $line"
+		if (line.length() == 0) {
+			return []
+		} else {
+			for (String str : line.tokenize()) {
+				if (debug) println " process str $str"
+				int idx = str.lastIndexOf("/")
+				if (idx > 0) {
+					rez << [str.substring(0, idx), str.substring(idx+1)]
+				} else {
+					if (debug) println "ERROR line $line"
+				}
+			}
+		}
+		return rez
+	}
+
+	public static void main(def args) {
+		File inputFile = new File("/home/mdecorde/Taggers/melt-2.0b2/txtbrut-o.txt");
+		File outputFile = new File("/home/mdecorde/Taggers/melt-2.0b2/txtbrut-tt.txt");
+		new SlashFile2TTRez(inputFile, outputFile, "UTF-8")
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/tal/Tagger.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/tal/Tagger.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/tal/Tagger.groovy	(revision 258)
@@ -0,0 +1,13 @@
+package org.txm.tal
+
+class Tagger {
+	File executablePath
+	File modelPath
+	String lang
+	
+	public Tagger(File executablePath, File modelPath, String lang) {
+		this.executablePath = executablePath
+		this.modelPath = modelPath
+		this.lang = lang
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/tal/XMLDomTokenizerAdapter.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/tal/XMLDomTokenizerAdapter.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/tal/XMLDomTokenizerAdapter.groovy	(revision 258)
@@ -0,0 +1,38 @@
+package org.txm.tal
+
+import org.txm.importer.StaxIdentityParser;
+import org.txm.importer.XPathResult;
+import org.w3c.dom.*;
+
+class XMLDomTokenizerAdapter {
+	String xpath;
+	boolean debug = true;
+	def nodes = []
+	
+	File infile, outfile;
+	public XMLDomTokenizerAdapter(File infile, def xpath) {
+		this.infile = infile
+		this.xpath = xpath
+	}
+	
+	public boolean process(File outfile) {
+		this.outfile = outfile
+		
+		XPathResult rez = new XPathResult(infile)
+		def nodes = rez.getNodes(xpath)
+		println nodes.size()
+//		for (Node node : rez.getNodes(xpath)) {
+//			println "Found $node"
+//			//nodes << [node, ""]
+//		}
+	}
+	
+	
+	public static void main(String[] args) {
+		File inputXMLFile = new File("/home/mdecorde/xml/comere/cmrclavardage/cmr-getalp_org-actu-tei-v1.xml");
+		File outputXMLFile = new File("/home/mdecorde/xml/comere/cmrclavardage/tmp.xml");
+		def processor = new XMLDomTokenizerAdapter(inputXMLFile, "/tei:TEI/tei:text/tei:body/tei:div/tei:post") //tei:div/tei:post/tei:p
+		processor.process(outputXMLFile)
+		//println processor.getNodes()
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/tal/XMLStaxTokenizerAdapter.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/tal/XMLStaxTokenizerAdapter.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/tal/XMLStaxTokenizerAdapter.groovy	(revision 258)
@@ -0,0 +1,87 @@
+package org.txm.tal
+
+import org.txm.importer.StaxIdentityParser;
+
+/**
+ * Experiment of Tokenizer that targets XPath results text
+ * 
+ * @author mdecorde
+ *
+ */
+class XMLStaxTokenizerAdapter extends StaxIdentityParser {
+	def xpaths;
+	boolean debug = false;
+	boolean doTokenize = false
+	String str; // string to tokenize
+	def tokenizeResults = []
+	def nsegments = 0
+	
+	public XMLStaxTokenizerAdapter(File infile, def xpaths, def tokenizeResults) {
+		super(infile.toURI().toURL());
+		this.xpaths = xpaths
+		this.tokenizeResults = tokenizeResults
+	}
+	
+	protected void processStartElement() {
+		String localname = parser.getLocalName();
+		if (debug) println "start element $currentXPath"
+		if (doTokenize) {
+			if (debug) println "Found text element $currentXPath"
+			tokenizeCurrentText();
+		} else {
+			if (xpaths.contains(currentXPath.toString())) {
+				doTokenize = true;
+				str = "";
+			}
+		}
+		super.processStartElement()
+	}
+	
+	protected void processEndElement() {
+		if (xpaths.contains(currentXPath.toString())) {
+			tokenizeCurrentText()
+			doTokenize = false;
+			if (debug) println "Found text element: stop tokenizing"
+		}
+		
+		super.processEndElement();
+	}
+	
+	protected void processCharacters() {
+		if (doTokenize) {
+			str += parser.getText();
+		} else {
+			super.processCharacters();
+		}
+	}
+	
+	protected tokenizeCurrentText() {
+		if (str.length() == 0) return;
+		def tokens = tokenizeResults[nsegments]
+		for (def token : tokens) {
+			writer.writeStartElement("w");
+			writer.writeCharacters(token);
+			writer.writeEndElement();
+			writer.writeCharacters(" ");
+		}
+
+		nsegments++;
+	}
+		
+	/**
+	 * Best tokenizer ever.
+	 * Extends this function
+	 * 
+	 * @param str
+	 * @return
+	 */
+	protected List<CharSequence> tokenize(String str) {
+		return str.tokenize();
+	}
+	
+	public static void main(String[] args) {
+		File inputXMLFile = new File("/home/mdecorde/xml/comere/cmrclavardage/cmr-getalp_org-actu-tei-v1.xml");
+		File outputXMLFile = new File("/home/mdecorde/xml/comere/cmrclavardage/tmp.xml");
+		new XMLStaxTokenizerAdapter(inputXMLFile, ["/TEI/text/body/div/post/p/"]).process(outputXMLFile)
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/tal/stanford/StanfordSegmenterMacro.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/tal/stanford/StanfordSegmenterMacro.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/tal/stanford/StanfordSegmenterMacro.groovy	(revision 258)
@@ -0,0 +1,120 @@
+// STANDARD DECLARATIONS
+
+import org.kohsuke.args4j.*
+import groovy.transform.Field
+import org.txm.rcpapplication.swt.widget.parameters.*
+import edu.stanford.nlp.international.arabic.process.*
+import edu.stanford.nlp.international.arabic.*
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.io.Serializable;
+import java.io.StringReader;
+import java.io.UnsupportedEncodingException;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import edu.stanford.nlp.ie.crf.*;
+import edu.stanford.nlp.io.*;
+import edu.stanford.nlp.ling.*;
+import edu.stanford.nlp.objectbank.*;
+import edu.stanford.nlp.process.*;
+import edu.stanford.nlp.sequences.*;
+import edu.stanford.nlp.stats.*;
+import edu.stanford.nlp.trees.*;
+import edu.stanford.nlp.util.*;
+import edu.stanford.nlp.util.concurrent.*;
+
+@Field @Option(name="inputDir", usage="input directory", widget="Folder", required=true, def="/home/mdecorde/xml/testarabe")
+File inputDir
+@Field @Option(name="outputDir", usage="output directory", widget="Folder", required=true, def="/home/mdecorde/xml/testarabe/out-s")
+File outputDir
+
+@Field @Option(name="model", usage="'.tagger' model file", widget="File", required=false, def="data/arabic-segmenter-atbtrain.ser.gz")
+File model
+@Field @Option(name="extension", usage="Regexp de l'extension des fichiers à modifier", widget="String", required=true, def='\\.txt')
+String extension = "\\.txt"
+
+// Open the parameters input dialog box
+if (!ParametersDialog.open(this)) return;
+
+outputDir.mkdir()
+if (!outputDir.exists()) {
+	println("Could not create $outputDir")
+	return;
+}
+
+// END OF PARAMETERS
+//File inputFile = new File("/home/mdecorde/xml/testarabe/test.txt")
+inputDir.eachFileMatch(~/.*$extension/) { inputFile ->
+println "Processing file: $inputFile"
+File outputFile = new File(outputDir, inputFile.getName())
+//File model = new File("/home/mdecorde/LIBRAIRIES/stanford-segmenter-2014-01-04/data/arabic-segmenter-atbtrain.ser.gz")
+Properties options = new Properties();
+//options.put("prefixMarker", "#")
+//options.put("suffixMarker", "#")
+options.put("loadClassifier", model.getAbsolutePath())
+//TODO: uncommend me
+//ArabicSegmenter segmenter = new ArabicSegmenter(options);
+segmenter.flags.inputEncoding = "UTF-8";
+segmenter.loadSegmenter(segmenter.flags.loadClassifier, options);
+
+def br = inputFile.newReader("UTF-8")
+OutputStreamWriter out = new OutputStreamWriter( new FileOutputStream(outputFile), "UTF-8");
+PrintWriter pw = new PrintWriter(out, true);
+double charsPerSec = decode(segmenter, br, pw, 5);
+IOUtils.closeIgnoringExceptions(br);
+System.err.printf("Done! Processed input text at %.2f input characters/second%n", charsPerSec);
+
+}
+
+/**
+   * Segment input and write to output stream.
+   *
+   * @param segmenter
+   * @param br
+   * @param pwOut
+   * @param nThreads
+   * @return input characters processed per second
+   */
+def decode(def segmenter, BufferedReader br,
+                               PrintWriter pwOut, int nThreads) {
+    assert nThreads > 0;
+    long nChars = 0;
+    final long startTime = System.nanoTime();
+    if (nThreads > 1) {
+		//TODO: uncommend me
+		//      MulticoreWrapper<String,String> wrapper = new MulticoreWrapper<String,String>(nThreads, segmenter);
+      try {
+        for (String line; (line = br.readLine()) != null;) {
+          nChars += line.length();
+          wrapper.put(line);
+          while (wrapper.peek()) {
+            pwOut.println(wrapper.poll());
+          }
+        }
+
+        wrapper.join();
+        while (wrapper.peek()) {
+          pwOut.println(wrapper.poll());
+        }
+
+      } catch (IOException e) {
+        e.printStackTrace();
+      }
+
+    } else {
+      nChars = segmenter.segment(br, pwOut);
+    }
+    long duration = System.nanoTime() - startTime;
+    double charsPerSec = (double) nChars / (duration / 1000000000.0);
+    return charsPerSec;
+  }
Index: tmp/org.txm.core/src/groovy/org/txm/tal/stanford/StanfordTaggerMacro.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/tal/stanford/StanfordTaggerMacro.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/tal/stanford/StanfordTaggerMacro.groovy	(revision 258)
@@ -0,0 +1,64 @@
+import edu.stanford.nlp.ling.*
+import edu.stanford.nlp.process.*
+import edu.stanford.nlp.tagger.maxent.*;
+
+// STANDARD DECLARATIONS
+
+import org.kohsuke.args4j.*
+import groovy.transform.Field
+import org.txm.rcpapplication.swt.widget.parameters.*
+
+@Field @Option(name="inputDir", usage="input directory", widget="Folder", required=true, def="/home/mdecorde/xml/testarabe/out-s")
+File inputDir
+@Field @Option(name="outputDir", usage="output directory", widget="Folder", required=true, def="/home/mdecorde/xml/testarabe/out-t")
+File outputDir
+
+@Field @Option(name="model", usage="'.tagger' model file", widget="File", required=false, def="taggers/arabic-train.tagger")
+File model
+@Field @Option(name="extension", usage="Regexp de l'extension des fichiers à modifier", widget="String", required=true, def='\\.txt')
+String extension = "\\.txt"
+
+// Open the parameters input dialog box
+if (!ParametersDialog.open(this)) return;
+def modelPath = model.getAbsolutePath()
+
+outputDir.mkdir()
+if (!outputDir.exists()) {
+	println("Could not create $outputDir")
+	return;
+}
+
+inputDir.eachFileMatch(~/.*$extension/) { inputFile ->
+	String name = inputFile.getName()
+	int idx = name.indexOf(".")
+	if (idx > 0) name = name.substring(0, idx)
+	
+	new File(outputDir, name+".xml").withWriter("UTF-8") { writer ->
+		
+		writer.println('<?xml version="1.0" encoding="UTF-8"?>')
+		writer.println('<text>')
+		//TODO: uncomment me
+	//	def tagger = new MaxentTagger(modelPath);
+	//	def ptbTokenizerFactory = PTBTokenizer.factory(new CoreLabelTokenFactory(),	"untokenizable=noneKeep");
+	
+			//TODO: uncomment me
+//		def documentPreprocessor = new DocumentPreprocessor(inputFile.newReader());
+		documentPreprocessor.setTokenizerFactory(ptbTokenizerFactory);
+		int n = 0
+		
+		for (def sentence : documentPreprocessor) {
+			writer.println("<s n=\"$n\">")
+			n++;
+			def tSentence = tagger.tagSentence(sentence);
+			//println(Sentence.listToString(tSentence, false));
+			for (def taggedWord : tSentence)
+			{
+				def form = w.word();
+				def pos = w.tag();
+				writer.println("<w pos=\"$pos\">$form</w>")
+			}
+			writer.println('</s>')
+		}
+		writer.println('</text>')
+	}
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/export/ParaConc.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/export/ParaConc.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/export/ParaConc.groovy	(revision 258)
@@ -0,0 +1,134 @@
+// 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
+// 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.
+//
+//
+//
+// $LastChangedDate: 2011-09-27 16:44:37 +0200 (mar., 27 sept. 2011) $
+// $LastChangedRevision: 2008 $
+// $LastChangedBy: mdecorde $
+//
+package org.txm.export
+
+import org.txm.Toolbox
+import org.txm.searchengine.cqp.corpus.*
+import org.txm.searchengine.cqp.corpus.query.*
+import org.txm.functions.concordances.*
+import org.txm.functions.concordances.comparators.*
+import org.txm.functions.ReferencePattern
+
+////// PARAMETERS //////
+
+def output = "nomfichier"
+
+def tgtCorpusName = "BLLATLAT"
+def srcCorpusName = "BLLATFRO"
+
+def tgtWords = "sum|ego" // use to highlight lat words
+def srcWords = "je|j'" // use to highlight fro words
+
+def tgtQuery = "<seg> []* \""+tgtWords+"\" []* </seg> :"+srcCorpusName+" \""+srcWords+"\"" // default lat query
+def srcQuery = "<seg> []* \""+srcWords+"\" []* </seg> :"+tgtCorpusName+" \""+tgtWords+"\"" // default fro query
+
+println tgtCorpusName+": "+tgtQuery
+println srcCorpusName+": "+srcQuery
+
+new File(output).withWriter("UTF-8"){writer->
+//// LAT CONCORDANCE ////
+def tgtCorpus = CorpusManager.getCorpusManager().getCorpus(tgtCorpusName)
+def text_id = tgtCorpus.getStructuralUnit("text").getProperty("id")
+def seg_id = tgtCorpus.getStructuralUnit("seg").getProperty("id")
+def word = tgtCorpus.getProperty("word")
+def referencePattern = new ReferencePattern()
+//referencePattern.addProperty(text_id)
+referencePattern.addProperty(seg_id)
+def tgtConcordance = new Concordance(tgtCorpus, new Query(tgtQuery), word, [word], referencePattern, referencePattern, 0, 0)
+
+//// LAT CONCORDANCE ////
+def srcCorpus = CorpusManager.getCorpusManager().getCorpus(srcCorpusName)
+text_id = srcCorpus.getStructuralUnit("text").getProperty("id")
+seg_id = srcCorpus.getStructuralUnit("seg").getProperty("id")
+word = srcCorpus.getProperty("word")
+referencePattern = new ReferencePattern()
+//referencePattern.addProperty(text_id)
+referencePattern.addProperty(seg_id)
+def srcConcordance = new Concordance(srcCorpus, new Query(srcQuery), word, [word], referencePattern, referencePattern, 0, 0)
+
+//// MERGE CONCORDANCE RESULT ////
+HashSet<String> allKeys = new HashSet<String>()
+HashMap<String, Line> srcLines = [:]
+HashMap<String, Line> tgtLines = [:]
+
+println "nb tgt result: "+tgtConcordance.getNLines()
+for(Line line : tgtConcordance.getLines(0, tgtConcordance.getNLines()))
+{
+	allKeys.add(line.getViewRef().toString())
+	tgtLines.put(line.getViewRef().toString(), line)
+}
+
+println "nb src result: "+srcConcordance.getNLines()
+for(Line line : srcConcordance.getLines(0, srcConcordance.getNLines()))
+{
+	allKeys.add(line.getViewRef().toString())
+	srcLines.put(line.getViewRef().toString(), line)
+}
+println "src seg: "+srcLines.keySet()
+println "tgt seg: "+tgtLines.keySet()
+println "nb segments: "+allKeys.size()
+
+writer.println "segment\tsource\ttarget"
+for(Line line : srcConcordance.getLines(0, srcConcordance.getNLines()))
+{
+	String key = line.getViewRef().toString();
+	def tgtLine = tgtLines.get(key)
+	String srcString = line.keywordToString();
+	String tgtString = "";
+	if(tgtLine != null)	{
+		tgtString = tgtLine.keywordToString();
+		tgtLines.remove(key)
+		}else
+	{
+		key = key+"*"
+	}
+	srcString = srcString.replaceAll("("+srcWords+")", "*\$1*");
+	tgtString = tgtString.replaceAll("("+tgtWords+")", "*\$1*");
+	writer.println key+"\t"+srcString+"\t"+tgtString
+}
+
+println "\n"
+for(String key : tgtLines.keySet()) // process remaining tgt lines
+{
+	def srcline = srcLines.get(key)
+	def tgtline = tgtLines.get(key)
+	String srcString = "";
+	String tgtString = tgtLines.keywordToString();
+	if(srcline == null){
+		srcString = srcline.keywordToString();
+	}else
+	{
+		key = key+"*"
+	}
+	srcString = srcString.replaceAll("("+srcWords+")", "*\$1*");
+	tgtString = tgtString.replaceAll("("+tgtWords+")", "*\$1*");
+	writer.println key+"\t"+srcString+"\t"+tgtString
+}
+}
+
+println "Done : written in "+new File(output).getAbsolutePath();
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/export/package.html
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/export/package.html	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/export/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>export scripts from TXM's format to xxxx's format</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/org/txm/export/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/export/ExportCAH.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/export/ExportCAH.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/export/ExportCAH.groovy	(revision 258)
@@ -0,0 +1,35 @@
+package org.txm.export
+
+//import org.txm.rcpapplication.views.*
+import org.txm.functions.classification.*
+import org.txm.stat.engine.r.*
+// uncomment this
+//import org.eclipse.jface.viewers.IStructuredSelection
+
+// Select the CAH result in the CorporaView and run this script
+
+// PARAMETER: the output file
+def outfile = new File("/home/mdecorde/Bureau/CAH.txt")
+
+// get selected object from Corpora view
+def obj = null;
+monitor.syncExec(new Runnable() {
+	@Override
+	public void run() {
+		def corporaview = CorporaView.getInstance()
+		def tree = corporaview.getTreeViewer()
+		// uncomment these 2 lines
+//		def sel = (IStructuredSelection) tree.getSelection()
+//		obj = sel.getFirstElement()
+		}
+	});
+println("Selected object: "+obj)
+
+//TODO temporary commented
+//if (obj != null && obj instanceof CAH) {
+	def rw = RWorkspace.getRWorkspaceInstance()
+	rw.eval("sink(file=\"" + outfile.getAbsolutePath().replace("\\", "\\\\")+"\")")
+	rw.eval("print("+obj.getSymbol()+")")
+	rw.eval("sink()")
+	println("CAH saved in file: "+outfile)
+//}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/export/MultipleConcordances.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/export/MultipleConcordances.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/export/MultipleConcordances.groovy	(revision 258)
@@ -0,0 +1,105 @@
+/**
+ * Main.
+ *
+ * @param args the args
+ */
+// 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
+// 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.
+
+//
+// This file is part of the TXM platform.
+//
+// The TXM platform is free software: you can redistribute it and/or modif y
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 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/>.
+// 
+// 
+// 
+// $LastChangedDate: 2011-05-09 14:58:28 +0200 (lun., 09 mai 2011) $
+// $LastChangedRevision: 1839 $
+// $LastChangedBy: mdecorde $ 
+//
+
+package org.txm.export
+
+// import the packages containing the functions we are going to use
+import org.txm.Toolbox
+import org.txm.searchengine.cqp.corpus.*
+import org.txm.searchengine.cqp.corpus.query.*
+import org.txm.functions.concordances.*
+import org.txm.functions.concordances.comparators.*
+import org.txm.functions.ReferencePattern
+
+//PARAMETRES
+def corpusname = "DISCOURS"
+def requetes = ["je", "tu", "vous"]
+// get the DISCOURS corpus
+// TODO: Auto-generated Javadoc
+
+/* (non-Javadoc)
+ * @see groovy.lang.Script#run()
+ */
+def discours = CorpusManager.getCorpusManager().getCorpus(corpusname)
+
+// get some properties
+def pos = discours.getProperty("pos")
+def word = discours.getProperty("word")
+def text = discours.getStructuralUnit("text")
+
+//get structure text
+def text_id = text.getProperty("id")
+// and define the references pattern for each concordance line
+def referencePattern = new ReferencePattern().addProperty(text_id)
+
+// get a builtin sort function
+def comparator = new LexicographicLeftContextComparator()
+comparator.initialize(discours)
+
+def noconc = 0
+for(String querystring : requetes)
+{
+	println "Computing concordance of $querystring ..."
+	// create a query. Here the concordance keyword will be the French word "Je" (the "I" pronoun in English)
+	def query = new Query(Query.fixQuery(querystring))
+	
+	// compute the concordance with contexts of 15 words on each side of the keyword
+	def concordance = new Concordance(discours, query, word, [word, pos], referencePattern, 15, 15)
+		
+	// sort the concordance
+	//concordance.sort(comparator)
+	
+	// define which occurrence properties will be displayed
+	concordance.setViewProperties([word])
+	
+	// write all the concordance in a text file
+	def file = new File("conc"+(noconc++)+".txt")
+	concordance.toTxt(file, "UTF-8")
+	println("Concordance $querystring written in file: "+file.getAbsolutePath())
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/export/ConcordancesExport_discours.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/export/ConcordancesExport_discours.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/export/ConcordancesExport_discours.groovy	(revision 258)
@@ -0,0 +1,183 @@
+/**
+ * Main.
+ *
+ * @param args the args
+ */
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2012-10-15 17:35:36 +0200 (lun., 15 oct. 2012) $
+// $LastChangedRevision: 2279 $
+// $LastChangedBy: mdecorde $ 
+//
+
+// WARNING when this script is executed for the second time,
+// the window asking for the query parameter is displayed behind all the other windows,
+// so that one can have the feeling that TXM is frozen :
+// just move the other windows to get and answer the query-window hidden behind,
+// and this solves the problem.
+
+package org.txm.export
+
+// import the packages containing the functions we are going to use
+import org.txm.Toolbox
+import org.txm.searchengine.cqp.corpus.*
+import org.txm.searchengine.cqp.corpus.query.*
+import org.txm.functions.concordances.*
+import org.txm.functions.concordances.comparators.*
+import org.txm.functions.ReferencePattern
+
+// TODO: Auto-generated Javadoc
+/* (non-Javadoc)
+ * @see groovy.lang.Script#run()
+ */
+//"ExportConcordanceBFM.csv"
+def outfile = new File("ExportConcordanceVOEUX.csv")
+
+// get the corpus
+// **PARAMETER** : name of the corpus (here DISCOURS)
+// def discours = CorpusManager.getCorpusManager().getCorpus("QUETE")
+def discours = CorpusManager.getCorpusManager().getCorpus("DISCOURS")
+
+// **PARAMETER** : selection and name of the properties - "word", "id", "text" and "text_id" are always available
+// get some properties
+// def pos = discours.getProperty("ttpos")
+// def pos = discours.getProperty("frpos")
+def pos = discours.getProperty("pos")
+println "pos: "+pos
+// def pb = discours.getProperty("pb")
+// println "pb: "+pb
+def id = discours.getProperty("id")
+println "id: "+id
+def word = discours.getProperty("word")
+println "word: "+word
+def text = discours.getStructuralUnit("text")
+println "text: "+text
+def text_id = text.getProperty("id")
+println "text_id: "+text_id
+def text_date = text.getProperty("date")
+println "text_date: "+text_date
+def text_loc = text.getProperty("loc")
+println "text_loc: "+text_loc
+
+// create a query. Edit the query here
+def querys = javax.swing.JOptionPane.showInputDialog(null, "query ")
+if (querys == null)
+	return
+def query = new Query(Query.fixQuery(querys))
+
+println "Compute concordance "
+def start = System.currentTimeMillis()
+
+// define the references pattern for each concordance line
+def referencePattern = new ReferencePattern()
+// **PARAMETER** take properties among the ones selected and defined above,
+// to compose the reference pattern (in the first column)
+//referencePattern.addProperty(text_id)
+referencePattern.addProperty(text_loc)
+referencePattern.addProperty(text_date)
+//referencePattern.addProperty(pb)
+//referencePattern.addProperty(pos)
+//referencePattern.addProperty(id)
+
+def sortReferencePattern = new ReferencePattern()
+// **PARAMETER** take properties among the ones selected and defined above,
+// to set the sorting order of the first column
+sortReferencePattern.addProperty(text_id)
+//sortReferencePattern.addProperty(pb)
+//sortReferencePattern.addProperty(pos)
+sortReferencePattern.addProperty(id)
+
+
+// compute the concordance with contexts of 15 words on each side of the keyword
+// **PARAMETER** choose the properties : here [word, pos] are the properties according to which the pivot is sorted
+// def concordance = new Concordance(discours, query, word, [word, pos], referencePattern, 10, 10)
+def concordance = new Concordance(discours, query, word, [word, pos], referencePattern, sortReferencePattern, 10, 10)
+
+// get a builtin sort function
+def comparator = new LexicographicKeywordComparator()
+comparator.initialize(discours)
+
+// sort the concordance
+//concordance.sort(comparator)
+
+println "done "+(System.currentTimeMillis()-start)
+
+// **PARAMETER** name of the output file
+//def writer = new FileWriter("ExportConcordanceBFM3TT.csv")
+def writer = new FileWriter(outfile)
+
+println "write lines"
+start = System.currentTimeMillis()
+
+// define which occurrence properties will be displayed
+concordance.setViewProperties([word])
+
+for (int i = 0 ; i < concordance.getNLines() ; i += 1000) {
+	List<Line> lines
+	if (i+1000 > concordance.getNLines())
+		lines = concordance.getLines(i, concordance.getNLines()-1)
+	else
+		lines = concordance.getLines(i, i+1000)
+		
+	// println "lines: from "+i
+	for (Line l : lines) {
+		/*
+		 A : référence (nom de texte + page)
+		 B : contexte gauche (10 mots)
+		 C : pivot (cf. la remarque sur "ce que")
+		 D : pos du pivot
+		 E : colonne vide pour les commentaires
+		 F : contexte droit (10 mots)
+		 G : identifiant de l'occurrence (pour injecter les corrections après) 
+		 */
+
+// **PARAMETERS** define the strings which will be used to print the result		
+//		String ntext = l.getViewRef().getValue(text_id)
+		String loc = l.getViewRef().getValue(text_loc)
+		String date = l.getViewRef().getValue(text_date)
+//		String page = l.getViewRef().getValue(pb)
+		String lcontext = l.leftContextToString()
+		String pivot = l.keywordToString()
+//		String rien = ""
+		String rcontext = l.rightContextToString()
+//		String ids = l.getViewRef().getValue(id)
+		
+		String poss = ""
+		for (String s : l.getKeywordsViewProperties().get(pos)) {
+			poss += s+" "
+		}
+		
+		//println l.getKeywordsViewProperties().get(pos)
+// **PARAMETERS** composition of the printed line, cf. strings defined above
+//		writer.write(ntext+"_"+page+"\t"+lcontext+"\t"+pivot+"\t"+poss+"\t"+rien+"\t"+rcontext+"\t"+ids+"\n")
+		writer.write(loc+", "+date+"\t"+lcontext+"\t"+pivot+"\t"+poss+"\t"+rcontext+"\n")
+	}
+	writer.flush()
+}
+writer.close()
+
+println "done "+(System.currentTimeMillis()-start)+" results"
+
+//BP change nom du fichier
+println("Concordance "+query.getQueryString()+" saved in file "+outfile.getAbsolutePath())
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/export/conll2009/ToCoNLL2009.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/export/conll2009/ToCoNLL2009.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/export/conll2009/ToCoNLL2009.groovy	(revision 258)
@@ -0,0 +1,115 @@
+package org.txm.export.conll2009
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.util.Arrays;
+import java.util.List;
+
+import org.txm.searchengine.cqp.CqpDataProxy;
+import org.txm.searchengine.cqp.corpus.Corpus
+import org.txm.searchengine.cqp.corpus.*
+import org.txm.searchengine.cqp.corpus.query.Query
+
+class ToCoNLL2009 {
+
+	boolean debug = true
+	/**
+	 * To CoNLL2009.
+	 *
+	 * @param outfile the outfile, where is result is saved
+	 * @param corpus the corpus or sub-corpus to export
+	 * @param sentenceUnit the StructuralUnitProperty that identify a sentence
+	 * @param word the word property
+	 * @param lemme the lemme property
+	 * @param pos the pos property
+	 * @param encoding the encoding of the outfile
+	 * @return true, if successful
+	 */
+	public boolean process(File outfile, Corpus corpus, StructuralUnitProperty sentenceUnit, Property word, Property lemme, Property pos, String encoding)
+	{
+		def matches = corpus.query(new Query("<s> []+ </s>"), "TMPEXPORTCONNL", false).getMatches()
+		if (debug) println matches.size()
+		int npositions = 0;
+		for (def match : matches) npositions += match.length +1
+		if (debug) println "npositions= $npositions"
+
+		int[] positions = new int[npositions+1]
+		int i = 0;
+		for (def match : matches) {
+			for (int p : match.getRange())
+				positions[i++] = p
+		}
+
+		List<String> words = CorpusManager.getCorpusManager().getCqiClient().cpos2Str(word.getQualifiedName(), positions);
+
+		List<String> lemmes = null;
+		if (lemme != null) {
+			lemmes = CorpusManager.getCorpusManager().getCqiClient().cpos2Str(lemme.getQualifiedName(), positions);
+		}
+
+		List<String> poss = null;
+		if (pos != null) {
+			poss =  CorpusManager.getCorpusManager().getCqiClient().cpos2Str(pos.getQualifiedName(), positions);
+		}
+
+		Writer writer = new OutputStreamWriter(new FileOutputStream(outfile), "UTF-8"); //$NON-NLS-1$;
+
+		String lemmestr;
+		String posstr;
+		int id = 0;
+		int iposition = 0;
+		for (def match : matches) {
+			id = 0 // first position in sentence
+			for (i = match.start ; i < match.end ; i++) { // loop n times, n = mathc length
+
+				if (lemme != null)
+					lemmestr = lemmes.get(iposition);
+				else
+					lemmestr = "_";
+
+				if (pos != null)
+					posstr = poss.get(iposition);
+				else
+					posstr = "_";
+
+				//print(""+id+"\t"+words.get(iposition)+"\t"+lemmestr+"\t_\t"+posstr+"\t_\t_\t_\t_\t_\t_\t_\t_\t_\t_\n");
+				writer.write(""+id+"\t"+words.get(iposition)+"\t"+lemmestr+"\t_\t"+posstr+"\t_\t_\t_\t_\t_\t_\t_\t_\t_\t_\n");
+
+				id++; // next word
+				iposition++ // nextposition
+			}
+		}
+		writer.flush();
+		writer.close();
+
+		return true;
+	}
+
+	public static void main(String[] args) {
+		Corpus corpus = null
+		File outfile = new File("/home/mdecorde/Bureau/conn_export.tsv")
+		String encoding = "UTF-8"
+
+		String sentenceProperty = "s_id"
+		String posProperty = "frpos"
+		String lemmaProperty = "frlemma"
+
+
+		def split = sentenceProperty.split("_", 2)
+		StructuralUnitProperty s = null;//corpus.getStructuralUnit(split[0]).getProperty(split[1])
+		Property word = null;//corpus.getProperty("word")
+		Property lemma = null;//corpus.getProperty(lemmaProperty)
+		Property pos = null;//corpus.getProperty(posProperty)
+
+		//		if (s == null) { println "Error sentence property: $sentenceProperty"; return}
+		//		if (word == null) { println "Error no word property"; return}
+		//		if (pos == null) { println "Error pos property: $posProperty"; return}
+		//		if (lemma == null) { println "Error lemma property: $lemmaProperty"; return}
+
+
+		ToCoNLL2009 processor = new ToCoNLL2009()
+		processor.process(outfile, corpus, s, word, lemma, pos, encoding)
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/export/ExportLT.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/export/ExportLT.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/export/ExportLT.groovy	(revision 258)
@@ -0,0 +1,44 @@
+package org.txm.export
+import org.txm.Toolbox
+import org.txm.searchengine.cqp.corpus.*
+import org.txm.searchengine.cqp.corpus.query.*
+import org.txm.stat.data.*;
+import org.txm.functions.cooccurrences.*
+
+
+def corpus = CorpusManager.getCorpusManager().getCorpus("DISCOURS") // mettre le nom du corpus en Majuscules ici
+def partition = corpus.getPartition("types");
+
+int NTable = 1;
+for (Object o : partition.getResults()) {
+//	if (o instanceof LexicalTable) {
+		File outfile = new File("lt${NTable}.txt")
+		println "export LT of $partition in "+outfile.getAbsolutePath();
+		NTable++;
+		outfile.withWriter{writer->
+		def lt = o;
+		println "found lexical table: "+lt.getName()
+		println "n col: "+lt.getNColumns()
+		println "n line: "+lt.getNRows()
+		def cols = lt.getColNames().asStringsArray();
+		String strline = "unit\t";
+		for (int i = 0 ; i < cols.length ; i++) {
+			strline += cols[i]+"\t"
+			
+		}
+		writer.println(strline.substring(0, strline.length()-1));
+		
+		def rows = lt.getRowNames().asStringsArray();
+		for (int i = 0 ; i < rows.length ; i++) {
+			strline = "";
+			strline += rows[i]+"\t";
+			def line = lt.getRow(i).asIntArray();
+			for (int j = 0 ; j < line.length ; j++)
+				strline += line[j]+"\t";
+			writer.println(strline.substring(0, strline.length()-1));
+		}
+		
+		writer.close();
+		}
+//	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/export/ts/PunctInject.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/export/ts/PunctInject.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/export/ts/PunctInject.groovy	(revision 258)
@@ -0,0 +1,347 @@
+// Script to restore punctuation etc. to results of TS query.
+// Inputs:
+// --- Tiger-XML Document node
+// --- Java array:
+// --- --- String [index][type] where:
+// --- --- --- type == 0 gives the xml:id
+// --- --- --- type == 1 gives the word form
+// Process:
+// --- Injects punctuation.
+// Returns:
+// --- Tiger-XML Document node.
+package org.txm.export.ts;
+
+import javax.xml.parsers.DocumentBuilderFactory
+import org.txm.searchengine.cqp.CqpDataProxy;
+import org.txm.searchengine.cqp.corpus.Corpus
+import org.txm.searchengine.cqp.corpus.CorpusManager;
+import org.txm.searchengine.cqp.corpus.QueryResult;
+import org.txm.searchengine.cqp.corpus.query.Query
+
+public class PunctInject
+{
+	public process (def tigerXml, def txmIdWordTable) {
+
+		def allTs = toList(tigerXml.getElementsByTagName('t'))
+
+		def tAttrs = getTAttrNames(allTs[0])
+
+		def tNodeIdPrefix = allTs[0].getAttribute('id').tokenize('#').first()
+
+		def addedWordIds = []
+
+		int tIx = 0
+
+		while (txmIdWordTable) {
+
+			def word = txmIdWordTable.remove(0)
+
+			if (tIx == allTs.size()) {
+				// End of TS file, but still words left in the BFM file.
+				addTNode(word, allTs.last(), tAttrs, tNodeIdPrefix, 'append')
+			}
+
+			else {
+
+				def tNode = allTs[tIx]
+
+				def tId = getTNodeId(tNode)
+
+				if (tId == word[0] && tNode.getAttribute('word') == word[1]) {
+
+					// alles gut
+
+					tIx += 1
+
+				}
+
+				else if (tId == word[0]) {
+
+					println("Mismatched Ids! ($tId)")
+					tIx += 1
+				}
+
+				else if (['#', '*'].contains(tNode.getAttribute('word')) ) {
+
+					// SRCMF duplicata; try comparing word against the next tNode next time
+					// around.
+
+					txmIdWordTable.add(0, word)
+
+					tIx += 1
+
+				}
+				
+				// Check that the SRCMF corpus doesn't have a bug in it...
+
+				else if ( !(word[1] =~ /[\,\.\?\!\:\;\(\)\[\]\{\}]/)
+				&& (allTs[0..tIx - 1].find{
+					it.getAttribute('id') == "$tNodeIdPrefix#$tId"
+				})) {
+
+					println "Warning: word ${tNode.getAttribute('word')}, id $tId appears twice in corpus!"
+
+					txmIdWordTable.add(0, word)
+
+					tIx += 1
+
+				}
+				
+				// Check that there's not an extra word in the SRCMF corpus (rare, usu. a tokenisation change)
+				
+				else if ( !(word[1] =~ /[\,\.\?\!\:\;\(\)\[\]\{\}]/)
+				&& (allTs[tIx..-1].find{
+					it.getAttribute('id') == "$tNodeIdPrefix#${word[0]}"
+				})) {
+			
+					println "Warning: word ${tNode.getAttribute('word')}, id $tId does not appear in BFM!"
+
+					txmIdWordTable.add(0, word)
+					
+					tIx += 1
+				}
+
+				else if (addedWordIds.contains(tId)) {
+
+					println "Warning: word ${tNode.getAttribute('word')}, id ${tId} out of sequence in SRCMF corpus!"
+
+					txmIdWordTable.add(0, word)
+
+					tIx += 1
+
+				}
+
+				else {
+
+					// Insert word.  In the first instance, it will have the same parent as
+					// the tNode before which it's being inserted.
+
+					addTNode(word, allTs[tIx], tAttrs, tNodeIdPrefix, 'before')
+
+					addedWordIds.add(word[0])
+
+				}
+
+			}
+
+		}
+
+		// Second phase: move punctuation into previous sentence,
+		// dependent on sequence.
+
+		def allTerminalses = toList(tigerXml.getElementsByTagName('terminals'))
+
+		for (def i = 1 ; i < allTerminalses.size() ; i++) {
+
+			def ts = toList(allTerminalses[i].getElementsByTagName('t'))
+
+			def startPunc = true
+
+			def puncStack = []
+
+			while (ts && startPunc) {
+
+				if ((ts[0].getAttribute('word') =~ /[A-zÀ-ÿ0-9]/).size() == 0) {
+
+					puncStack.add(ts.remove(0))
+
+				}
+
+				else {
+
+					startPunc = false
+
+				}
+
+			}
+
+			// Now, treat the punctuation stack at the beginning of the sentence
+
+			if ( puncStack ) {
+
+				int moveLeft = 0
+
+				// First, identify LAST instance of sentence-final punctuation.
+
+				def puncString = puncStack.collect{ it.getAttribute('word')[0] }.join('')
+
+				def matches = puncString =~ /[\.\,\;\:\!\?\)\]\}»”’]/
+
+				if (matches.size() > 0) {
+
+					moveLeft = puncString.lastIndexOf(matches[-1]) + 1
+
+				}
+
+				// Second, split pairs of straight quotes
+
+				matches = puncString =~ /(""|'')/ //"
+
+				if (matches.size() > 0) {
+
+					moveLeft = [moveLeft, puncString.lastIndexOf(matches[-1][0]) + 1].max()
+				}
+
+				// Now, move moveLeft punctuation nodes to the end of the prev. sentence
+
+				ts = toList(allTerminalses[i].getElementsByTagName('t'))
+
+				for (def j = 0 ; j < moveLeft ; j++ ) {
+
+					allTerminalses[i - 1].appendChild(ts[j])
+
+				}
+
+			}
+		}
+		return tigerXml
+
+	}
+
+	private addTNode(word, tNode, tAttrs, tNodeIdPrefix, where) {
+
+		def newTNode = tNode.getOwnerDocument().createElement('t')
+
+		for (def anAttr : tAttrs) {
+
+			if (anAttr == 'id') {
+
+				newTNode.setAttribute('id', "${tNodeIdPrefix}#${word[0]}")
+
+			}
+
+			else if (anAttr == 'word') {
+
+				newTNode.setAttribute('word', word[1])
+
+			}
+
+			else {
+
+				newTNode.setAttribute(anAttr, '--')
+
+			}
+
+		}
+
+		if (where == 'before') {
+
+			tNode.getParentNode().insertBefore(newTNode, tNode)
+
+		}
+
+		else if (where == 'append') {
+
+			tNode.getParentNode().appendChild(newTNode)
+
+		}
+
+		else {
+
+			throw new IllegalArgumentException('Bad before value')
+
+		}
+
+	}
+
+	public getTAttrNames(tNode) {
+
+		def nodeMap = tNode.attributes
+
+		def nameList = []
+
+		for ( def i = 0 ; i < nodeMap.getLength() ; i++ ) {
+			nameList.add( nodeMap.item(i).nodeName )
+		}
+
+		return nameList
+
+	}
+
+	public getTNodeId(tNode) {
+
+		return tNode.getAttribute('id').tokenize('#').last()
+
+	}
+
+	public def toList(def iterable) {
+		return iterable.findAll {true};
+	}
+
+	public static def getWords(String corpusname, String query)
+	{
+		CorpusManager cm = CorpusManager.getCorpusManager();
+		Corpus corpus = cm.getCorpus(corpusname);
+		def word_property = corpus.getProperty("word")
+		def id_property = corpus.getProperty("id")
+
+		def wordCache = cm.getCorpusProxies(corpus).get(word_property);
+		def idCache = cm.getCorpusProxies(corpus).get(id_property);
+
+		def positions = new int[corpus.getSize()];
+		for(int i = 0 ; i< corpus.getSize() ; i++)
+			positions[i] = i;
+		def word_values = wordCache.getData(positions)
+		def id_values = idCache.getData(positions)
+		ArrayList<String[]> words = new ArrayList<String[]>(corpus.getSize());
+		for(int p : positions)
+		{
+			if(id_values[p].startsWith("w"))
+			{
+				words.add(new String[2])
+				words[p][0] = id_values[p]
+				words[p][1] = word_values[p]
+			}
+		}
+
+		return words;
+	}
+
+	public static void main(String[] args)
+	{
+		def words = [
+			["w203_1", "Dominedeu"],
+			["w203_2", "devemps"],
+			["w203_3", "lauder"],
+			["w203_4", "et"],
+			["w203_5", "a"],
+			["w203_6", "sus"],
+			["w203_7", "sancz"],
+			["w203_8", "honor"],
+			["w203_9", "porter"],
+			["w203_10", "»"],
+			["w203_10.2", ")"],
+			["w203_10.3", '.'],
+			["w203_10.5", '"'],
+			["w203_10.7", '"'],
+			["w203_11", "in"],
+			["w203_12", "su'"],
+			["w203_13", "amor"],
+			["w203_14", "cantomps"],
+			["w203_15", "del"],
+			["w203_16", "·sanz"],
+			["w203_17", "quae"],
+			["w203_18", "por"],
+			["w203_19", "lui"],
+			["w203_20", "augrent"],
+			["w203_21", "granz"],
+			["w203_22", "aanz"],
+			["w203_23", "."],
+		];
+		File tigerXml = new File(args[0]);
+		def builder = DocumentBuilderFactory.newInstance().newDocumentBuilder()
+		def THEDOM = builder.parse(tigerXml).documentElement
+
+		println THEDOM.getClass()
+
+		def NEWDOM = new PunctInject().process(THEDOM, words);
+
+		println NEWDOM
+
+		// File outfile = new File("outfile.xml")
+		// println outfile
+		//outfile.withWriter("iso-8859-1"){writer ->
+		//writer.write(NEWDOM.toString())
+		// }
+	}
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/export/ts/MatchInject.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/export/ts/MatchInject.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/export/ts/MatchInject.groovy	(revision 258)
@@ -0,0 +1,86 @@
+#! /usr/bin/groovy
+package org.txm.export.ts;
+
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.XMLReaderFactory;
+import groovy.util.slurpersupport.NodeChild
+
+/*
+ * The script takes the <matches/> elements from file "Tiger_match.xml"
+ * and inserts them at the end of the <s/> element bearing the same ID.
+ * Inputs: three file names 
+ * - TsInputName --- the TS file WITHOUT matches
+ * - MatchInputName --- the TS file containing only matches.
+ * - OutputFileName ---required output file.
+ * To pass these arguments from within an application, call script() directly.
+ */
+
+// Filename variables
+// def TsInputName = '/home/tomr/Documents/Work/lyon12/srcmf/groovy/MatchInject/ts_input.xml'
+// def MatchInputName = '/home/tomr/Documents/Work/lyon12/srcmf/groovy/MatchInject/match_input.xml'
+// def OutputFileName = '/home/tomr/Documents/Work/lyon12/srcmf/groovy/MatchInject/test.xml'
+
+// Main code: checks for correct number of arguments if run from cmd line.
+if (args && args.size() == 3) {
+    script(args[0], args[1], args[2])
+} else {
+    println '''Incorrect number of arguments: three strings required.
+
+USAGE:
+******
+groovy MatchInject.groovy TsInput.xml MatchInput.xml OutputFile.xml'''}
+
+def script(String tsInputName, String matchInputName, String outputFileName) {
+	script(new File(tsInputName), new File(matchInputName, new File(outputFileName)));
+}
+
+// The script.
+def script(File tsInputFile, File matchInputFile, File outputFile) {
+	//println "loading TsInput..."
+    def TsInput = new XmlSlurper().parse(tsInputFile)
+	//println "loading matchInputFile..."
+	System.setProperty("org.xml.sax.driver", "com.sun.org.apache.xerces.internal.parsers.SAXParser");
+	def xmlReader = XMLReaderFactory.createXMLReader();
+	xmlReader.setFeature('http://xml.org/sax/features/namespaces', false)
+    XmlSlurper mslurper = new XmlSlurper(xmlReader);
+	def MatchInput = mslurper.parse(matchInputFile)
+	//println "building OutputFile... size="+matchInputFile.length()
+	
+	def inputSentences = TsInput.'**'.findAll {it.name() == 's'};
+	def matcheSentences = MatchInput.'**'.findAll { it.name() == 's' }
+//	println "MATCHES"
+//	for(NodeChild match : matcheSentences) {
+//		//println match.getClass()
+//		match.namespacePrefix = ""
+//		match.namespaceMap = [:]
+//		//println match
+//	}
+	int count = 0;
+	//println("nb of input sentences: "+inputSentences.size());
+	
+    def markup = {
+		mkp.xmlDeclaration()
+		//mkp.declareNamespace("svg":"xmlns=\"http://www.w3.org/2000/svg\"")
+		
+        corpus(id:'TSOut') {
+            body {
+                inputSentences.each { sPath ->
+					//if (count++%200 == 0) println((100*count/inputSentences.size()))
+                    s(id:"${sPath.'@id'}") { 
+                        mkp.yield(sPath.graph)
+                        def sMatches = matcheSentences.find {
+                            it.'@id'.toString() == sPath.'@id'.toString()
+                        }
+						
+                        if (sMatches) {
+                            mkp.yield(sMatches.matches)
+                        }
+						//matcheSentences.removeAll(sMatches)
+                    }
+                }
+            }
+        }
+    }
+    def processor = new groovy.xml.StreamingMarkupBuilder().bind(markup)
+    outputFile.withWriter { it << groovy.xml.XmlUtil.serialize(processor)}
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/export/ts/package.html
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/export/ts/package.html	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/export/ts/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Contains scripts to build the TIGERSearch concordances</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/org/txm/export/ts/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/export/ts/ConcordanceBlocks.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/export/ts/ConcordanceBlocks.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/export/ts/ConcordanceBlocks.groovy	(revision 258)
@@ -0,0 +1,474 @@
+package org.txm.export.ts;
+
+import javax.xml.parsers.DocumentBuilderFactory
+
+class ConcordanceBlocks {
+	def codec = 'UTF-8'
+
+	int cx = 30;
+	def ntTypes = [];
+	def tTypes = [];
+	File xmlfile, outfile;
+
+	public boolean process(File xmlfile, File outfile, int cx, def ntTypes, def tTypes) {
+		this.cx = cx;
+		this.xmlfile = xmlfile;
+		this.outfile = outfile;
+		this.ntTypes = ntTypes;
+		this.tTypes = tTypes;
+
+		Writer writer = outfile.newPrintWriter(codec)
+
+		println 'Reading XML File'
+		def builder = DocumentBuilderFactory.newInstance().newDocumentBuilder()
+		def records = builder.parse(xmlfile).documentElement
+		println 'done.'
+
+		println 'done.  Pre-treating file to combine results with the same pivot...'
+		records = matchCombine(records)
+		println 'done.'
+
+		println 'Calculating max. number of blocks...'
+		def nBlock = 0
+
+		def allMatches = toList(records.getElementsByTagName('match'))
+
+		for (def match : allMatches) {
+			nBlock = [
+				nBlock,
+				toList(match.getElementsByTagName('variable')).findAll{
+					it.getAttribute('name').startsWith('#block')
+				}.size()
+			].max()
+		}
+
+		println "done ( $nBlock )"
+
+		// Table headers
+		println 'Writing concordance...'
+
+		def header = ['sId', 'LeftCxOutsideSnt', 'LeftCxInsideSnt']
+
+		for (int i = nBlock ; i > 0 ; i--) {
+
+			header.add("${i}BlockBeforePivot")
+
+			for (int j = 0 ; j < [ntTypes.size(), tTypes.size()].max() ; j++) {
+
+				header.add("${i}BlockBeforePivotType${j+1}")
+
+			}
+		}
+
+		header.add('Pivot')
+
+		for (int j = 0 ; j < [ntTypes.size(), tTypes.size()].max() ; j++) {
+
+			header.add("PivotType${j+1}")
+
+		}
+
+		for (int i = 1 ; i <= nBlock ; i++) {
+
+			header.add("${i}BlockAfterPivot")
+
+			for (int j = 0 ; j < [ntTypes.size(), tTypes.size()].max() ; j++) {
+
+				header.add("${i}BlockAfterPivotType${j+1}")
+
+			}
+		}
+
+		header.addAll(['RightCxInsideSnt', 'RightCxOutsideSnt', 'Warnings'])
+
+		writer.write(header.join("\t")+"\n");
+
+		def allTerminals = toList(records.getElementsByTagName('t'))
+		int tenPercentile = 0
+
+		int i = 0;
+		for (def aMatchNode : allMatches) {
+			if ((int)(((float)++i / allMatches.size()) * 10) > tenPercentile)
+				println ""+(++tenPercentile * 10)+ ' percent complete...'
+
+			def (rowDict, inSntCxLengthLeft, inSntCxLengthRight) = match2CSVrow(aMatchNode, header);
+			
+			// Add out-of-sentence context
+			def sNode = aMatchNode.parentNode.parentNode; // sentence
+			def terminals = toList(sNode.getElementsByTagName('t'));
+			def firstTInS = terminals[0] // get first node of the sentence
+			def lastTInS = terminals[-1] // get last node of the sentence
+			def firstTInSIx = allTerminals.indexOf(firstTInS) // get its position in the text
+			def lastTInSIx = allTerminals.indexOf(lastTInS) // get its position in the text
+
+			// Left context
+			def lexs = []
+			int start = Math.max(firstTInSIx - cx + inSntCxLengthLeft, 0);
+			int end = firstTInSIx;
+			if(start < end)
+			for (def tNode : allTerminals.subList(start, end)){
+				lexs.add(tNode.getAttribute('word'))
+				if (toList(tNode.parentNode.getElementsByTagName('t'))[-1] == tNode)
+					lexs.add('/')
+			}
+			rowDict['LeftCxOutsideSnt'] = lexs.join(" ")
+
+			// Right context
+			lexs = []
+
+			start = lastTInSIx + 1;
+			end = Math.min(allTerminals.size(), lastTInSIx + cx - inSntCxLengthRight)
+
+			if(start < end) {
+				for (def tNode : allTerminals.subList(start, end)){
+					lexs.add(tNode.getAttribute('word'))
+					if (toList(tNode.parentNode.getElementsByTagName('t'))[-1] == tNode)
+						lexs.add('/')
+				}}
+			rowDict["RightCxOutsideSnt"] = lexs.join(" ")
+
+			// Right rowDict to CSV
+
+			//			CSVWriter.writerow(dict(zip([k for k in rowDict.iterkeys()], \
+			//        [ v.encode('utf-8') for v in rowDict.itervalues() ] )))
+
+			String line = "";
+			for (int ii = 0 ; ii < header.size() ; ii++){
+				String h = header.get(ii)
+				String val = rowDict.getAt(h);
+				if (val == null)
+					line += "--"
+				else
+					line += val
+				if (ii < header.size() -1)
+					line +="\t"
+			}
+			writer.write(line+"\n")
+			writer.flush()
+
+		}
+		writer.close();
+		return true;
+	}
+
+	private def match2CSVrow(def aMatchNode, def header) {
+		// Step 1: Build a LIST of DICTIONARIES to describe the variables:
+		// dict(name='varname_minus_the_hash'
+		//      parent='nt_nodes'
+		//      terminals='t_nodes in a list')
+		
+		def sNode = aMatchNode.parentNode.parentNode // get the sentence node
+
+		def tNodesInSentence = toList(sNode.getElementsByTagName('t')) // get all terminal nodes of the sentence
+
+		def varDetails = []
+
+		for ( def aVariable : aMatchNode.getElementsByTagName('variable')){
+			if ( aVariable.getAttribute('name') == '#pivot' ||
+			aVariable.getAttribute('name').startsWith('#block')) {
+				def varParent = idKey(sNode, aVariable.getAttribute('idref'))
+
+				varDetails.add([
+							'name' : aVariable.getAttribute('name').substring(1),
+							'parent': varParent,
+							'terminals': toList(getTNodes(varParent)),
+							'lexform': writeLexForm(varParent),
+						])
+
+				// Add types
+
+				for (int j = 0 ; j < [ntTypes.size(), tTypes.size()].max() ; j++) {
+
+					def a = ''
+
+					if (j < ntTypes.size() && varParent.getAttribute(ntTypes[0])
+					) {
+						a = varParent.getAttribute(ntTypes[j])
+					} else if (j < tTypes.size() && varParent.getAttribute(tTypes[0])
+					) {
+						a = varParent.getAttribute(tTypes[j])
+					}
+
+					varDetails[-1]["type${j+1}"] = a
+
+				}
+
+				// write min idx in sentence of terminal nodes used
+				varDetails[-1]['terminalsIx'] = varDetails[-1]['terminals'].collect{tNodesInSentence.indexOf(it)}
+			}
+		}
+
+		// Sort varDetails by the start ID of the word
+
+		varDetails =  varDetails.sort{it['terminalsIx'].min()}
+
+		def pivotBlockPosition = 0;
+		pivotBlockPosition = varDetails.findIndexOf{it['name'] == 'pivot'}
+
+		// Write the table
+		def rowDict = [:]
+		rowDict['sId'] = sNode.getAttribute('id')
+
+		// write the pivot
+		rowDict['Pivot'] = varDetails[pivotBlockPosition]['lexform']
+
+		for (int j = 0 ; j < [ntTypes.size(), tTypes.size()].max() ; j++) {
+
+			rowDict["PivotType${j+1}"] = varDetails[pivotBlockPosition]["type${j+1}"]
+		}
+
+		def startNextId = (varDetails[pivotBlockPosition]['terminalsIx']).min()
+		def endPrevId = (varDetails[pivotBlockPosition]['terminalsIx']).max()
+
+		// Write the Pre-pivot blocks
+
+		def i = 0
+
+		//println "rowDict: $rowDict"
+		if ( pivotBlockPosition > 0)	{
+			for ( int j = pivotBlockPosition -1 ; j >= 0 ; j--) {
+				
+				i++;
+				def block = varDetails.get(j)
+				//println "process block: $block"
+
+				rowDict["${i}BlockBeforePivot"] = block['lexform']
+
+				for ( int k = 0 ; k < [ntTypes.size(), tTypes.size()].max() ; k++ ) {
+					rowDict["${i}BlockBeforePivotType${k+1}"] = block["type${k+1}"]
+				}
+
+				// Add any intervening words to the right edge.
+
+				def rightEdge = (block['terminalsIx'].findAll{ it < startNextId }).max();
+				//println ""+block['terminalsIx']+"   rightEdge: $rightEdge"
+
+				for (int ix = rightEdge + 1 ; ix < startNextId ; ix++) // add word to reach the pivot
+				{
+					rowDict["${i}"+"BlockBeforePivot"] += ' {' + tNodesInSentence[ix].getAttribute('word') + '}';
+				}
+
+				startNextId = (block['terminalsIx']).min()
+			}
+		}
+		
+		// Write the in-sentence left context
+
+		def lexs = tNodesInSentence.subList(0, startNextId).collect {it.getAttribute('word')}
+		rowDict['LeftCxInsideSnt'] = lexs.join(" ")
+
+		def inSntCxLengthLeft = startNextId
+
+		// Write the Post-pivot blocks
+
+		i = 0
+		for (def block in varDetails.subList(pivotBlockPosition + 1, varDetails.size())){
+			i++
+			rowDict["${i}BlockAfterPivot"] = block['lexform']
+
+			for (int j = 0 ; j < [ntTypes.size(), tTypes.size()].max() ; j++) {
+				rowDict["${i}BlockAfterPivotType${j+1}"] = block["type${j+1}"]
+			}
+
+			// Add any intervening words to the left edge.
+			// Note that this isn't always possible, in particular
+			// if the preceding element is discontinuous.
+
+			def leftEdgeList = block['terminalsIx'].findAll{it > endPrevId }
+
+			if ( leftEdgeList.size() > 0) {
+				def leftEdge = leftEdgeList.min()
+				for (int ix = leftEdge - 1 ; ix > endPrevId ; ix--) {
+					rowDict["${i}BlockAfterPivot"] = '{' + tNodesInSentence[ix].getAttribute('word') + '} ' + rowDict["${i}BlockAfterPivot"]
+				}
+			}
+			else {
+				rowDict["${i}BlockAfterPivot"] = '{?} ' + rowDict["${i}BlockAfterPivot"]
+			}
+			endPrevId = block['terminalsIx'].max()
+		}
+
+		// Write the in-sentence right-context
+
+		lexs = tNodesInSentence.subList(endPrevId + 1, tNodesInSentence.size()).collect {it.getAttribute('word')}
+		rowDict['RightCxInsideSnt'] = lexs.join(" ")
+
+		def inSntCxLengthRight = tNodesInSentence.size() - endPrevId
+
+		return [rowDict, inSntCxLengthLeft, inSntCxLengthRight]
+		return null;
+	}
+
+	public def toList(def iterable) {
+		return iterable.findAll {true};
+	}
+
+	/**
+	 * return the children of sNode with the id anId 
+	 */
+	public def idKey(def sNode, String anId) {
+		return sNode.getElementsByTagName("*").find{it.getAttribute("id") == anId}
+	}
+
+	/**
+	 * return a list of all terminal nodes of the node.
+	 * if the node is a non-terminal, iterate over children and so on
+	 */
+	def getTNodes(theNode) {
+		def terminals = []
+		def unprocessed = [theNode]
+
+		while( unprocessed.size() > 0) {
+			def aNode = unprocessed.pop()
+			def edges = toList(aNode.getElementsByTagName('edge'))
+			if (edges.size() == 0)
+				terminals.add(aNode)
+			else
+				for (def anEdge : edges)
+					unprocessed.add(idKey(theNode.parentNode.parentNode, anEdge.getAttribute('idref')))
+		}
+		return terminals;
+	}
+
+	/**
+	 * 
+	 * @param theNode
+	 * @return the join of the terminal nodes value in theNode a varaible node
+	 */
+	def writeLexForm(theNode) {
+		def sNode = theNode.parentNode.parentNode // get the sentence of the variable
+		def allTNodes = sNode.getElementsByTagName('t') // get all sentence children
+		def tNodesInTheNode = getTNodes(theNode) // get the terminal nodes pointed by idref
+		def begunNode = false
+		def lexs = []
+		def lexBuffer = []
+		for (def aTNode : allTNodes){
+			if ( aTNode in tNodesInTheNode) {
+				begunNode = true
+				lexs.addAll(lexBuffer)
+				lexs.add(aTNode.getAttribute('word'))
+				lexBuffer = []
+			}
+			if ( begunNode && !tNodesInTheNode.contains(aTNode))
+				lexBuffer.add('[' + aTNode.getAttribute('word') + ']')
+		}
+		return lexs.join(" ");
+	}
+
+	def matchCombine(theDOM) {
+
+		def matchesNodes = theDOM.getElementsByTagName('matches')
+
+		for (def aMatchesNode : matchesNodes){
+
+			def pivotNodes = toList(
+					aMatchesNode.getElementsByTagName('variable')
+					).findAll{it.getAttribute('name') == '#pivot'}
+
+			def checkedPivots = []
+
+			while (pivotNodes){
+
+				def aPivotNode = pivotNodes.remove(0)
+
+				def matchingPivotList = checkedPivots.findAll{
+					it.getAttribute('idref') == aPivotNode.getAttribute('idref')
+				}
+
+				if (matchingPivotList) {
+
+					// duplicate pivot; copy all variables
+
+
+					for (def node : toList(aPivotNode.getParentNode()
+					.getElementsByTagName('variable')
+					)) {
+
+						matchingPivotList[0].getParentNode().appendChild(node)
+
+					}
+
+					def variables = toList(
+							matchingPivotList[0].getParentNode()
+							.getElementsByTagName('variable')
+							)
+
+					// remove duplicates
+
+					def checkedVariables = []
+
+					while (variables) {
+
+						def aVariableNode = variables.remove(0)
+
+						def matchingVariableList = checkedVariables.findAll{
+							(
+									it.getAttribute('idref') == aVariableNode.getAttribute('idref')
+									&& (
+									it.getAttribute('name') == aVariableNode.getAttribute('name')
+									|| (
+									it.getAttribute('name').startsWith('#block')
+									&& aVariableNode.getAttribute('name').startsWith('#block')
+									)
+									)
+									)
+						}
+
+						if (matchingVariableList) {
+
+							// remove variable node
+
+							aVariableNode.getParentNode().removeChild(aVariableNode)
+
+						}
+
+						else {
+
+							checkedVariables.add(aVariableNode)
+
+						}
+					}
+				}
+				else {
+
+					// not the same pivot
+
+					checkedPivots.add(aPivotNode)
+				}
+			}
+			// Tidying up: remove empty <match /> nodes
+			def matchNodes = toList(aMatchesNode.getElementsByTagName('match'))
+
+			for (def matchNode : matchNodes) {
+
+				if ( !toList(matchNode.getElementsByTagName('variable'))) {
+
+					aMatchesNode.removeChild(matchNode)
+				}
+			}
+		}
+
+		return theDOM
+	}
+
+	public static void usage() {
+		println 'concordance_blocks [OPTIONS] inputfile.xml [outputfile.csv]'
+		println 'OPTIONS'
+		println '-h, --help           Displays this message.'
+		println '-c --context [length] Sets the number of words in context.'
+	}
+
+	static main(args) {
+		if(args.length == 0)
+			usage()
+		int cx = 30;
+		def ntTypes = ['cat'];
+		def tTypes = ['pos'];
+		File xmlfile = new File(args[0])
+		File outfile = new File(args[1])
+		ConcordanceBlocks p = new ConcordanceBlocks();
+		println "START"
+		p.process(xmlfile, outfile, cx, ntTypes, tTypes)
+		println "END"
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/export/ConcordancesExport.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/export/ConcordancesExport.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/export/ConcordancesExport.groovy	(revision 258)
@@ -0,0 +1,161 @@
+/**
+ * Main.
+ *
+ * @param args the args
+ */
+// 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
+// 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.
+//
+//
+//
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $
+//
+package org.txm.export
+
+// import the packages containing the functions we are going to use
+import org.txm.Toolbox
+import org.txm.searchengine.cqp.corpus.*
+import org.txm.searchengine.cqp.corpus.query.*
+import org.txm.functions.concordances.*
+import org.txm.functions.concordances.comparators.*
+import org.txm.functions.ReferencePattern
+
+// TODO: Auto-generated Javadoc
+/* (non-Javadoc)
+ * @see groovy.lang.Script#run()
+ */
+def manualInit = false
+if (!org.txm.Toolbox.isInitialized())
+{
+	manualInit = true
+	org.txm.Toolbox.initialize(new File("~/TXM/install.prefs"))
+}
+
+// get the BFM corpus
+def discours = CorpusManager.getCorpusManager().getCorpus("GRAAL")
+
+// get some properties
+def pos = discours.getProperty("fropos")
+println "pos: "+pos
+def pb = discours.getProperty("pb")
+println "pb: "+pb
+def id = discours.getProperty("id")
+println "id: "+id
+def word = discours.getProperty("word")
+println "word: "+word
+def text = discours.getStructuralUnit("text")
+println "text: "+text
+def text_id = text.getProperty("id")
+println "text_id: "+text_id
+
+// create a query. Edit the query here
+def querys = javax.swing.JOptionPane.showInputDialog(null, "query ")
+if (querys == null)
+	return
+def query = new Query(Query.fixQuery(querys))
+
+println "Compute concordance "
+def start = System.currentTimeMillis()
+
+// define the references pattern for each concordance line
+def referencePattern = new ReferencePattern()
+referencePattern.addProperty(text_id)
+referencePattern.addProperty(pb)
+referencePattern.addProperty(pos)
+referencePattern.addProperty(id)
+
+def sortReferencePattern = new ReferencePattern()
+sortReferencePattern.addProperty(text_id)
+sortReferencePattern.addProperty(pb)
+sortReferencePattern.addProperty(pos)
+sortReferencePattern.addProperty(id)
+
+// compute the concordance with contexts of 15 words on each side of the keyword
+def concordance = new Concordance(discours, query, word, [word, pos], referencePattern, sortReferencePattern, 10, 10)
+
+// get a builtin sort function
+def comparator = new LexicographicKeywordComparator()
+comparator.initialize(discours)
+
+// sort the concordance
+//concordance.sort(comparator)
+
+println "done "+(System.currentTimeMillis()-start)
+
+def writer = new FileWriter("ExportConcordanceBFM3TT.csv")
+
+println "write lines"
+start = System.currentTimeMillis()
+
+// define which occurrence properties will be displayed
+concordance.setViewProperties([word])
+
+for (int i = 0 ; i < concordance.getNLines() ; i += 1000)
+{
+	List<Line> lines
+	if (i+1000 > concordance.getNLines())
+		lines = concordance.getLines(i, concordance.getNLines()-1)
+	else
+		lines = concordance.getLines(i, i+1000)
+		
+	// println "lines: from "+i
+	for (Line l : lines)
+	{
+		/*
+		 A : référence (nom de texte + page)
+		 B : contexte gauche (10 mots)
+		 C : pivot (cf. la remarque sur "ce que")
+		 D : pos du pivot
+		 E : colonne vide pour les commentaires
+		 F : contexte droit (10 mots)
+		 G : identifiant de l'occurrence (pour injecter les corrections après)
+		 */
+		
+		String ntext = l.getViewRef().getValue(text_id)
+		String page = l.getViewRef().getValue(pb)
+		String lcontext = l.leftContextToString()
+		String pivot = l.keywordToString()
+		String rien = ""
+		String rcontext = l.rightContextToString()
+		String ids = l.getViewRef().getValue(id)
+		
+		String poss = ""
+		for(String s : l.getKeywordsViewProperties().get(pos))
+		{
+			poss += s+" "
+		}
+		
+		//println l.getKeywordsViewProperties().get(pos)
+		writer.write(ntext+"_"+page+"\t"+lcontext+"\t"+pivot+"\t"+poss+"\t"+rien+"\t"+rcontext+"\t"+ids+"\n")
+	}
+	writer.flush()
+}
+writer.close()
+
+println "done "+(System.currentTimeMillis()-start)+" results"
+
+println("Concordance "+query.getQueryString()+" saved in file "+new File("ExportConcordanceBFM3TT.csv").getAbsolutePath())
+
+if(manualInit)
+	org.txm.Toolbox.shutdown()
+
Index: tmp/org.txm.core/src/groovy/org/txm/export/CooccurrencesFilter.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/export/CooccurrencesFilter.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/export/CooccurrencesFilter.groovy	(revision 258)
@@ -0,0 +1,57 @@
+package org.txm.export
+
+// we import the packages containing the functions we are going to use
+import org.txm.Toolbox
+import org.txm.searchengine.cqp.corpus.*
+import org.txm.searchengine.cqp.corpus.query.*
+import org.txm.functions.cooccurrences.*
+
+//////////// PARAMETERS ////////////
+def corpus = CorpusManager.getCorpusManager().getCorpus("DISCOURS")
+
+def word = corpus.getProperty("word")
+def pos = corpus.getProperty("pos")
+def viewprops = [word, pos]
+
+def query = new Query(Query.fixQuery("je"))
+def PROPSVALUETOKEEP = "V.+"
+def PROPNUMBER = 1;
+
+def limit = corpus.getStructuralUnit("s") // contexts by <s>
+def includeXpivot = false; // used only if limit != null
+//def limit = null // contexts by word 
+def minleft = 1 // min = 1
+def maxleft = 20 // min = 1
+def minright = 1 // min = 1
+def maxright = 20 // min = 1
+
+def minf = 0
+def mincof = 0
+def minscore = 0
+
+def buildLTWithOnlyCooccurrents = false
+
+//////////// END OF PARAMETERS ////////////
+
+println "computing cooc lines..."
+long time = System.currentTimeMillis()
+//TODO temporary commented
+//def cooccurrence = new Cooccurrence(corpus, query, viewprops, limit, maxleft, minleft, minleft, maxright, minf,mincof, minscore, includeXpivot, buildLTWithOnlyCooccurrents)
+cooccurrence.process();
+println("Compute time : "+(System.currentTimeMillis()-time)+" ms")
+
+println "filtering lines..."
+def lines = cooccurrence.getLines()
+for(int i = 0 ; i < lines.size(); i++)
+{
+	def line = lines.get(i)
+	if( !line.props.get(PROPNUMBER).matches(PROPSVALUETOKEEP))
+	{
+		lines.remove(i--)
+	}	
+}
+
+println "writing result..."
+def file = new File("cooc.txt")
+cooccurrence.toTxt(file, "UTF-8")
+println "printed cooccurrents in "+file.getAbsolutePath()
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/export/exportCA.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/export/exportCA.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/export/exportCA.groovy	(revision 258)
@@ -0,0 +1,28 @@
+package org.txm.export
+import org.txm.Toolbox
+import org.txm.searchengine.cqp.corpus.*
+import org.txm.searchengine.cqp.corpus.query.*
+import org.txm.stat.data.*;
+import org.txm.functions.ca.*
+
+String moncorpus = "DISCOURS"
+String mapartition = "texts"
+
+
+def corpus = CorpusManager.getCorpusManager().getCorpus(moncorpus) // mettre le nom du corpus en Majuscules ici
+def partition = corpus.getPartition(mapartition);
+
+for(Object o : partition.getResults())
+{
+//	if(o instanceof CA)	{		
+		def ca = o;
+		File colinfosfile = new File(ca.getName()+"_colinfosfile.txt");
+		File rowinfosfile = new File(ca.getName()+"_rowinfosfile.txt");
+	
+		
+		ca.exportColInfos(colinfosfile, "UTF-8", "\t", "")
+		ca.exportRowInfos(rowinfosfile, "UTF-8", "\t", "")
+		
+		println ca.getName()+" exported in : "+rowinfosfile.getAbsolutePath()+" and "+colinfosfile.getAbsolutePath()
+//	}
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/importer/hyperbase/hyperbaseLoader.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/hyperbase/hyperbaseLoader.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/hyperbase/hyperbaseLoader.groovy	(revision 258)
@@ -0,0 +1,160 @@
+// 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
+// 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.
+//
+//
+//
+// $LastChangedDate: 2015-06-03 15:04:53 +0200 (Wed, 03 Jun 2015) $
+// $LastChangedRevision: 2984 $
+// $LastChangedBy: mdecorde $
+//
+package org.txm.importer.hyperbase;
+
+
+import org.txm.importer.hyperbase.importer;
+import org.txm.importer.hyperbase.compiler;
+import org.txm.importer.xml.pager;
+import org.txm.objects.*;
+import org.txm.utils.*;
+import org.txm.*;
+import org.txm.scripts.teitxm.*;
+import org.txm.utils.i18n.*;
+import org.w3c.dom.Element
+
+String userDir = System.getProperty("user.home");
+
+def MONITOR;
+boolean debug = org.txm.utils.logger.Log.isPrintingErrors();
+BaseParameters params;
+try {params = paramsBinding;MONITOR=monitor} catch (Exception)
+{	println "DEV MODE";//exception means we debug
+	debug = true
+	params = new BaseParameters(new File(userDir, "xml/TESTS/hyperbase/import.xml"))
+	params.load()
+	if (!org.txm.Toolbox.isInitialized()) {
+
+		Toolbox.setParam(Toolbox.INSTALL_DIR,new File("/usr/lib/TXM"));
+		Toolbox.setParam(Toolbox.TREETAGGER_INSTALL_PATH,new File(userDir,"treetagger"));
+		Toolbox.setParam(Toolbox.TREETAGGER_MODELS_PATH,new File(userDir,"treetagger/models"));
+		Toolbox.setParam(Toolbox.METADATA_ENCODING, "UTF-8");
+		Toolbox.setParam(Toolbox.METADATA_COLSEPARATOR, ",");
+		Toolbox.setParam(Toolbox.METADATA_TXTSEPARATOR, "\"");
+		Toolbox.setParam(Toolbox.USER_TXM_HOME, new File(System.getProperty("user.home"), "TXM"));
+	}
+}
+if (params == null) { println "no parameters. Aborting"; return; }
+
+String corpusname = params.getCorpusName();
+Element corpusElem = params.corpora.get(corpusname);
+String basename = params.name;
+String rootDir = params.rootDir;
+String lang = corpusElem.getAttribute("lang");
+String model = lang
+String encoding = corpusElem.getAttribute("encoding");
+boolean annotate = "true" == corpusElem.getAttribute("annotate");
+String xsl = params.getXsltElement(corpusElem).getAttribute("xsl")
+def xslParams = params.getXsltParams(corpusElem);
+int wordsPerPage = params.getWordsPerPage("default")
+boolean build_edition = params.getDoEdition("default")
+
+File srcDir = new File(rootDir);
+File binDir = new File(Toolbox.getParam(Toolbox.USER_TXM_HOME),"corpora/"+basename);
+binDir.deleteDir();
+binDir.mkdirs();
+if (!binDir.exists()) {
+	println "Could not create binDir "+binDir
+	return;
+}
+
+File txmDir = new File(binDir,"txm/$corpusname");
+txmDir.deleteDir();
+txmDir.mkdirs();
+
+if (MONITOR != null) MONITOR.worked(1, "IMPORTER")
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+println "-- IMPORTER - Reading source files"
+
+if (!(new importer().run(srcDir, binDir, txmDir, encoding, basename, lang))) {
+	println "import process stopped";
+	return;
+}
+
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+if (MONITOR != null) MONITOR.worked(20, "ANNOTATE")
+println "-- ANNOTATE - Running NLP tools"
+boolean annotationSuccess = false;
+if ((new Annotate().run(binDir, txmDir, model+".par"))) {
+	annotationSuccess = true
+}
+
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+if (MONITOR != null) MONITOR.worked(25, "COMPILING")
+println "-- COMPILING - Building Search Engine indexes"
+def c = new compiler();
+c.setAnnotationSuccess(annotationSuccess);
+if (debug) c.setDebug();
+c.setLang(lang);
+if (!c.run(binDir, txmDir, corpusname)) {
+	println "import process stopped";
+	return;
+}
+
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+
+new File(binDir,"HTML/$corpusname").deleteDir();
+new File(binDir,"HTML/$corpusname").mkdirs();
+if (build_edition) {
+
+	println "-- EDITION - Building edition"
+	if (MONITOR != null) MONITOR.worked(20, "EDITION")
+	
+	File outdir = new File(binDir,"/HTML/$corpusname/default/");
+	outdir.mkdirs();
+	List<File> filelist = txmDir.listFiles();
+	Collections.sort(filelist);
+	def second = 0
+
+	println "Paginating texts: "
+
+	for (File srcfile : filelist) {
+		print "."
+		String txtname = srcfile.getName();
+		int i = txtname.lastIndexOf(".");
+		if(i > 0) txtname = txtname.substring(0, i);
+
+		List<String> NoSpaceBefore = LangFormater.getNoSpaceBefore(lang);
+		List<String> NoSpaceAfter = LangFormater.getNoSpaceAfter(lang);
+
+		Element text = params.addText(params.corpora.get(corpusname), txtname, srcfile);
+
+		def ed = new pager(srcfile, outdir, txtname, NoSpaceBefore, NoSpaceAfter, wordsPerPage, basename, "pb");
+		Element edition = params.addEdition(text, "default", outdir.getAbsolutePath(), "html");
+
+		for (i = 0 ; i < ed.getPageFiles().size();) {
+			File f = ed.getPageFiles().get(i);
+			String wordid = ed.getIdx().get(i);
+			params.addPage(edition, ""+(++i), wordid);
+		}
+	}
+}
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+if (MONITOR != null) MONITOR.worked(20, "FINALIZING")
+File paramFile = new File(binDir, "import.xml");
+DomUtils.save(params.root.getOwnerDocument(), paramFile);readyToLoad = true;
Index: tmp/org.txm.core/src/groovy/org/txm/importer/hyperbase/compiler.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/hyperbase/compiler.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/hyperbase/compiler.groovy	(revision 258)
@@ -0,0 +1,316 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2016-05-26 17:42:36 +0200 (Thu, 26 May 2016) $
+// $LastChangedRevision: 3219 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer.hyperbase;
+
+import org.txm.importer.cwb.CwbEncode
+import org.txm.importer.cwb.CwbMakeAll
+import org.txm.importer.*;
+import org.txm.scripts.*;
+import org.txm.scripts.teitxm.BuildTTSrc;
+import org.txm.scripts.teitxm.*;
+import org.txm.utils.treetagger.TreeTagger;
+
+import javax.xml.stream.*;
+import java.net.URL;
+import java.io.File;
+import java.util.HashMap;
+import java.util.List;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class compiler.
+ */
+class compiler 
+{
+	
+	/** The debug. */
+	private boolean debug= false;
+	
+	/** The input data. */
+	private def inputData;
+	
+	/** The factory. */
+	private def factory;
+	
+	/** The parser. */
+	private XMLStreamReader parser;
+	
+	/** The dir. */
+	private def dir;
+	
+	/** The output. */
+	private def output;
+	
+	/** The url. */
+	private def url;
+	
+	/** The anahash. */
+	private HashMap<String,String> anahash = new HashMap<String,String>() ;
+	
+	/** The text. */
+	String text="";
+	
+	/** The base. */
+	String base="";
+	
+	/** The project. */
+	String project="";
+	
+	/** The text attributes. */
+	String[] textAttributes = null;
+	
+	/** The cwb loc. */
+	String cwbLoc;
+	
+	/** The lang. */
+	private String lang ="fr";
+	
+	/**
+	 * initialize.
+	 *
+	 */
+	public compiler(){}
+	
+	/**
+	 * Instantiates a new compiler.
+	 *
+	 * @param url the url
+	 * @param text the text
+	 * @param base the base
+	 * @param project the project
+	 */
+	public compiler(URL url,String text,String base, String project)
+	{
+		this.text = text
+		this.base = base;
+		this.project = project;
+		this.textAttributes = textAttributes;
+		try {
+			this.url = url;
+			inputData = url.openStream();
+			
+			factory = XMLInputFactory.newInstance();
+			parser = factory.createXMLStreamReader(inputData);
+		} catch (XMLStreamException ex) {
+			System.out.println(ex);
+		}catch (IOException ex) {
+			System.err.println("IOException while parsing ");
+		}
+	}
+	
+	/**
+	 * set the language of the corpus.
+	 *
+	 * @param lang the lang
+	 * @return the java.lang. object
+	 */
+	public setLang(String lang)
+	{
+		this.lang = lang;
+	}
+	
+	/** The annotation success. */
+	boolean annotationSuccess = false;
+	
+	/**
+	 * Sets the annotation success.
+	 *
+	 * @param value the value
+	 * @return the java.lang. object
+	 */
+	public setAnnotationSuccess(boolean value)
+	{
+		this.annotationSuccess = value
+	}
+	
+	/**
+	 * Sets the cwb path.
+	 *
+	 * @param path the new cwb path
+	 */
+	public void setCwbPath(String path)
+	{
+		if(!new File(path).exists())
+			System.err.println("CWB Path : "+path+" does not exists")
+		cwbLoc = path;
+	}
+	
+	/**
+	 * Creates the output.
+	 *
+	 * @param f the f
+	 * @return true, if successful
+	 */
+	private boolean createOutput(File f){
+		try {
+			output = new OutputStreamWriter(new FileOutputStream(f,f.exists()) , "UTF-8");
+			return true;
+		} catch (Exception e) {
+			System.err.println(e);
+			
+			return false;
+		}
+	}
+	
+	/**
+	 * Go to text.
+	 */
+	private void GoToText()
+	{
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) 
+		{
+			if(event == XMLStreamConstants.END_ELEMENT)
+				if(parser.getLocalName().equals("teiHeader"))
+					return;
+		}
+	}
+	
+	/**
+	 * Run.
+	 *
+	 * @param rootDirFile the root dir file
+	 * @param basename the basename
+	 * @return true, if successful
+	 */
+	public boolean run(File binDir, File txmDir, String corpusname) 
+	{
+		String rootDir = binDir.getAbsolutePath();
+		
+		if(cwbLoc == null)
+			cwbLoc = org.txm.Toolbox.getParam(org.txm.Toolbox.CQI_SERVER_PATH_TO_CQPLIB)+File.separator;
+		
+		if(!new File(cwbLoc).exists())
+		{
+			println ("CWB path error: "+cwbLoc)
+			return false;
+		}
+		if(!binDir.exists())
+		{
+			println ("binary directory does not exists: "+rootDir)
+			return false;
+		}
+		File wtcFile = new File(binDir,"wtc/"+corpusname+".wtc");
+		new File(binDir,"wtc").deleteDir();
+		new File(binDir,"wtc").mkdir();
+		new File(binDir,"data").deleteDir();
+		new File(binDir,"data").mkdir();
+		new File(binDir,"registry").mkdir();
+		
+		//start corpus
+		if (createOutput(wtcFile)) {
+			output.write("<txmcorpus lang=\""+lang+"\">\n");
+			output.close();
+		}
+		
+		String textid="";
+		int counttext =0;
+		List<File> files = txmDir.listFiles();
+		Collections.sort(files);
+		//1- Transform into WTC file
+		XMLTXM2WTC wtcbuilder = null;
+		println("Compiling "+files.size()+" files")
+		for (File f : files) {
+			print "."
+			counttext++;
+			if (!f.exists()) {
+				println("file "+f+ " does not exists")	
+			}
+			else {	
+				wtcbuilder = new XMLTXM2WTC(f.toURI().toURL());
+				String txtname = f.getName().substring(0,f.getName().length()-4);
+				wtcbuilder.setTextInfo(txtname, corpusname, "project");
+
+				wtcbuilder.setBalisesToKeep(["text","p","s"]);
+				wtcbuilder.setSendToPAttributes(["s":["n"]]);
+				wtcbuilder.setLang(lang);
+				if (!wtcbuilder.transformFile(wtcFile)) {
+					println("Failed to compile "+f)
+				}
+			}
+		}
+		println ""
+		
+		//end corpus
+		if (createOutput(wtcFile)) {
+			output.write("</txmcorpus>\n");
+			output.close();
+		}
+		
+		if (wtcbuilder == null) return false;
+		
+		//2- Import into CWB
+		def outDir =rootDir;
+		
+		CwbEncode cwbEn = new CwbEncode();
+		cwbEn.setDebug(debug);
+		CwbMakeAll cwbMa = new CwbMakeAll();
+		cwbMa.setDebug(debug);
+		
+		List<String> pAttributesList = wtcbuilder.getpAttributs();
+		List<String> sAttributesList = wtcbuilder.getsAttributs();
+		println "word properties : "+pAttributesList
+		println "structures : "+sAttributesList
+		String[] pAttributes = pAttributesList.toArray(new String[pAttributesList.size()])
+		String[] sAttributes = sAttributesList.toArray(new String[sAttributesList.size()])
+		
+		try {
+			String regPath = outDir + "/registry/"+corpusname.toLowerCase();
+			cwbEn.run(new File(cwbLoc,"cwb-encode").getAbsolutePath(), outDir + "/data/$corpusname", outDir + "/wtc/"+corpusname+".wtc", regPath,pAttributes, sAttributes);
+			if (!new File(regPath).exists()) {
+				println "Error: The registry file was not created: $regPath. See https://groupes.renater.fr/wiki/txm-users/public/faq"
+				return false;
+			}
+			cwbMa.run(new File(cwbLoc,"cwb-makeall").getAbsolutePath(), corpusname, outDir + "/registry");
+			
+		} catch (Exception ex) {System.out.println(ex); return false;}
+		
+		return true;
+	}
+	
+	/**
+	 * Sets the debug.
+	 */
+	public void setDebug()
+	{
+		this.debug = true;
+	}
+	
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args)
+	{
+		File dir = new File("~/xml/geo");
+		def c = new compiler();
+		c.setDebug();
+		c.setCwbPath("~/TXM/cwb/bin");
+		c.run(dir,"geo");
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/hyperbase/package.html
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/hyperbase/package.html	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/hyperbase/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Hyperbase import module</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/org/txm/importer/hyperbase/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/importer/hyperbase/importer.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/hyperbase/importer.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/hyperbase/importer.groovy	(revision 258)
@@ -0,0 +1,187 @@
+// 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
+// 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.
+//
+//
+//
+// $LastChangedDate: 2015-06-03 15:04:53 +0200 (Wed, 03 Jun 2015) $
+// $LastChangedRevision: 2984 $
+// $LastChangedBy: mdecorde $
+//
+package org.txm.importer.hyperbase
+
+//import filters.TabulatedToXml.*;
+import org.txm.importer.*;
+import org.txm.importer.filters.*;
+import org.txm.scripts.*;
+import org.txm.importer.cwb.CwbEncode
+import org.txm.importer.cwb.CwbMakeAll
+import org.txm.scripts.teitxm.BuildTTSrc;
+import org.txm.scripts.teitxm.*;
+//import org.txm.utils.treetagger.TreeTagger;
+import javax.xml.stream.*;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.OutputStreamWriter;
+import java.io.PrintStream;
+import java.net.URL;
+
+import filters.CutHeader.*;
+import filters.Tokeniser.*;
+import filters.FusionHeader.*;
+import filters.TagSentences.*;
+
+import org.txm.*;
+import org.txm.utils.*;
+// TODO: Auto-generated Javadoc
+
+/**
+ * The Class importer.
+ */
+class importer {
+
+	/**
+	 * Run.
+	 *
+	 * @param rootDirFile the root dir file
+	 * @param encoding the encoding
+	 * @param basename the basename
+	 * @return true, if successful
+	 */
+	public static boolean run(File srcDir, File binDir, File txmDir, String encoding, String basename, String lang)
+	{
+		String rootDir = srcDir.getAbsolutePath()+"/"
+		//cleaning
+
+		new File(binDir,"ptokenized").deleteDir();
+		new File(binDir,"ptokenized").mkdir();
+		new File(binDir,"tokenized").deleteDir();
+		new File(binDir,"tokenized").mkdir();
+		new File(binDir,"split").deleteDir();
+		new File(binDir,"split").mkdir();
+
+		ArrayList<String> milestones = new ArrayList<String>();//the tags who you want them to stay milestones
+		milestones.add("tagUsage");
+		milestones.add("pb");
+		milestones.add("lb");
+
+		//build xml files
+		if (srcDir.listFiles() == null || srcDir.listFiles().size() == 0 ) {
+			println "No corpus file in: "+srcDir;
+			return false;
+		}
+		File corpusfile = null;
+		for (File f : srcDir.listFiles()) {
+			if (!f.isHidden() && f.canRead() && f.isFile() && f.getName() != "import.xml") {
+				corpusfile = f;
+				break;
+			}
+		}
+
+		System.out.println("Corpus file: "+corpusfile);
+		if (!new Hyperbase2Xml().run(corpusfile, new File(binDir, "split"), encoding)) {
+			println("Failed to split the corpus file into text: "+corpusfile);
+			return false;
+		}
+
+		//TOKENIZE ALL FILES
+		List<File> srcfiles = new File(binDir, "split").listFiles();
+		println("Tokenizing "+srcfiles.size()+" files");
+		for (File pfile : srcfiles) {
+			print "."
+			String filename = pfile.getName().substring(0, pfile.getName().length()-4)
+			File tfile = new File(binDir, "tokenized/"+filename+".xml");
+
+			SimpleTokenizerXml tokenizer = new SimpleTokenizerXml(pfile, tfile, lang);
+			if (!tokenizer.process()) {
+				println("Failed to tokenize file: "+pfile);
+				tfile.delete();
+			}
+		}
+		println ""
+
+		//Tag sentences
+		List<File> stokenfiles = new File(binDir,"tokenized").listFiles()
+		new File(binDir,"stokenized").mkdir();
+		println("Tag sentences of "+stokenfiles.size()+" files")
+		for (File f : stokenfiles) {
+			print "."
+			try {
+				Sequence S = new Sequence();
+				Filter F1 = new CutHeader();
+				Filter F7 = new TagSentences();
+				Filter F11 = new FusionHeader();
+				S.add(F1);
+				S.add(F7);
+				S.add(F11);
+				File infile = new File(binDir, "tokenized/"+f.getName());
+				File xmlfile = new File(binDir, "stokenized/"+f.getName());
+				File headerfile = new File(binDir, "tokenized/"+f.getName()+"header.xml");
+
+				S.SetInFileAndOutFile(infile.getPath(), xmlfile.getPath());
+				S.setEncodages("UTF-8","UTF-8");
+				Object[] arguments1 = [headerfile.getAbsolutePath()];
+				F1.SetUsedParam(arguments1);
+				Object[] arguments2 = [headerfile.getAbsolutePath(),F1];
+				F11.SetUsedParam(arguments2);
+				S.proceed();
+				S.clean();
+				headerfile.delete();//remove the prepared file to clean
+			} catch (Exception e) {println "Failed to sentence file "+f;println e;}
+		}
+		println ""
+
+		//TRANSFORM INTO XML-TEI-TXM
+		List<File> tokenfiles = new File(binDir, "stokenized").listFiles()
+		println("Building xml-txm ("+tokenfiles.size()+" files)")
+		for (File f : tokenfiles) {
+			print "."
+			File file = f;
+			String txmfile = f.getName();
+
+			def correspType = new HashMap<String,String>()
+			def correspRef = new HashMap<String,String>()
+			//il faut lister les id de tous les respStmt
+			def respId = [];
+			//fait la correspondance entre le respId et le rapport d'execution de l'outil
+			def applications = new HashMap<String,HashMap<String,String>>();
+			//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[]>();
+			//associe un id d'item avec sa description et son URI
+			def itemsURI = new HashMap<String,HashMap<String,String>>();
+			//informations de respStmt
+			//resps (respId <voir ci-dessus>, [description, person, date])
+			def resps = new HashMap<String,String[]>();
+			//lance le traitement
+			def builder = new Xml2Ana(file);
+			builder.setCorrespondances(correspRef, correspType);
+			builder.setHeaderInfos(respId,resps, applications, taxonomiesUtilisees, itemsURI)
+			//builder.setAddTEIHeader();
+			if (!builder.process(new File(txmDir,txmfile))) {
+				println("Failed to process "+f);
+				new File(txmDir, txmfile).delete();
+			}
+		}
+		println ""
+		return true;
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/graal/xsl/qgraal_facs.xsl
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/graal/xsl/qgraal_facs.xsl	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/graal/xsl/qgraal_facs.xsl	(revision 258)
@@ -0,0 +1,192 @@
+<?xml version='1.0'?>
+
+<!-- This is a "facsimilary" stylesheet for Old French XML transcriptions:
+	- most abbreviations and medieval letter variants are rendered with the 
+                                                             corresponding Unicode and MUFI characters. "Andron Scriptor Web"
+                                                             font should be installed for correct visualization;
+	- agglutinations and deglutinations are presented "as they are" in
+	  the original;
+	- direct speech is marked with darkblue color;
+	- uncertain readings are marked with grey background color;
+	- text deleted in the original is marked with rose background color;
+	- notes are rendered with [*] sign in the text body; the text of the note
+                                                             appears on "mouse-over" and is reproduced in the end.
+-->
+
+                <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:tei="http://www.tei-c.org/ns/1.0" xmlns:me="http://www.menota.org/ns/1.0" xmlns:bfm="http://bfm.ens-lsh.fr/ns/1.0">
+                                <xsl:import href="mdv_common.xsl"/>
+                                <xsl:param name="form">fac-similaire</xsl:param>
+                                <xsl:variable name="mode">facs</xsl:variable>
+                                
+                                <xsl:output method="html"  encoding="utf-8" version="4.0" indent="yes"/>
+                                
+                                <xsl:strip-space elements="*"/>
+                                
+                                <!--                <xsl:variable name="title-formal" select="//fileDesc/titleStmt/title[@type='formal']"/>
+                                                
+                                                <xsl:variable name="title-normal" select="//fileDesc/titleStmt/title[@type='normal']"/>
+                                                
+                                                <xsl:variable name="title-ref" select="//fileDesc/titleStmt/title[@type='reference']"/>
+                                                
+                                                <xsl:variable name="author" select="//titleStmt/author"/>
+                                -->               
+                                
+                                
+                                
+                                <xsl:template match="//tei:text//tei:p|//tei:text//tei:head">
+                                                <table width="100%" style="border:none">
+                                                                <tr style="border:none">
+                                                                                <td width="10%" valign="top" style="white-space:nowrap;padding-right:10pt;line-height:18px;font-family:Arial;font-size:14px;border:none;text-align:right">
+                                                                                                <xsl:if test="@n"><span style="color:gray;font-size:12px">[§ <xsl:value-of select="@n"/>] </span></xsl:if><xsl:apply-templates select="descendant::tei:lb|descendant::tei:milestone[@unit='column']|descendant::bfm:lettrine" mode="number"/></td>
+                                                                                <td valign="top" style="white-space:nowrap;line-height:18px;font-family:Andron Scriptor Web;font-size:14px;border:none"><xsl:apply-templates mode="facs"/></td>
+                                                                </tr>
+                                                </table>
+                                </xsl:template>
+                                
+                                <xsl:template match="tei:pb" mode="facs">
+                                                <xsl:call-template name="pb_common"/>
+                                </xsl:template>
+                                
+                                <xsl:template match="tei:cb" mode="facs">
+                                                <xsl:call-template name="cb_common"></xsl:call-template>
+                                </xsl:template>
+                                
+                                <xsl:template match="tei:note" mode="facs">
+                                                <xsl:call-template name="note_common"></xsl:call-template>
+                                </xsl:template>
+                                
+                                <xsl:template match="tei:q" mode="facs">
+                                                <span style="background-color:lightcyan"><xsl:apply-templates mode="facs"/></span>
+                                </xsl:template>
+                                
+                                <xsl:template match="tei:gap" mode="facs">
+                                                <xsl:call-template name="gap_common"></xsl:call-template>
+                                </xsl:template>
+                                
+                                <xsl:template match="//tei:lb" mode="facs">
+                                                <xsl:choose>
+                                                                <xsl:when test="@ed='facs'"><br/></xsl:when>
+                                                                <!--<xsl:when test="position()=1 and not(ancestor::tei:seg)"></xsl:when>-->
+                                                                <xsl:when test="@ed='norm' or preceding::tei:lb[1][@ed='facs']"></xsl:when>
+                                                                <xsl:when test="position() = 1 and ancestor::tei:s[not(preceding-sibling::*)]"></xsl:when>
+                                                                <xsl:when test="preceding::tei:w[1][descendant::bfm:headlb]"></xsl:when>
+                                                                <xsl:when test="preceding::tei:w[1][descendant::tei:lb]"></xsl:when>
+                                                                <xsl:otherwise><br/></xsl:otherwise>
+                                                </xsl:choose>
+                                </xsl:template>
+                                
+                                <xsl:template match="tei:lb" mode="number">
+                                                <xsl:choose>
+                                                                <xsl:when test="@ed='facs'"></xsl:when>
+                                                                <xsl:when test="position() = 1 and ancestor::tei:s[not(preceding-sibling::*)]"></xsl:when>
+                                                                <xsl:otherwise><br/>&#xa0;</xsl:otherwise>
+                                                </xsl:choose>
+                                                <xsl:if test="substring(@n, string-length(@n)) = 0 or substring(@n, string-length(@n)) = 5"><xsl:value-of select="@n"/></xsl:if>
+                                </xsl:template>
+                                
+                               
+                               
+                                <xsl:template match="//bfm:headlb" mode="facs">
+                                                <br/>
+                                </xsl:template>
+                                
+                                <xsl:template match="//tei:w" mode="facs">
+                                                <span title="{@type}" class="word" id="{@xml:id}" >
+                                                <xsl:if test="descendant::me:facs"><xsl:apply-templates select="descendant::me:facs" mode="facs"/>
+                                                <xsl:choose>
+                                                                <xsl:when test="@rend='aggl' or @rend='elision'"></xsl:when>
+                                                                <xsl:otherwise><xsl:text> </xsl:text></xsl:otherwise>
+                                                </xsl:choose></xsl:if>
+                                                                </span>
+                                </xsl:template>
+                                
+                                <xsl:template match="text()[ancestor::me:facs]" mode="facs">
+                                                <xsl:value-of select="translate(., 'i', '&#x0131;')"/>
+                                </xsl:template>
+                                
+                                <xsl:template match="bfm:mdvAbbr" mode="facs">
+                                                <xsl:apply-templates mode="facs"/>
+                                </xsl:template>
+                                
+                                <xsl:template match="tei:sic" mode="facs">
+                                                <span style="color:darkred" title="sic!"><xsl:apply-templates mode="facs"/></span>
+                                </xsl:template>
+                                
+                                <xsl:template match="tei:subst" mode="facs">
+                                                [<xsl:choose>
+                                                                <xsl:when test="child::tei:del[@rend='line-through']">
+                                                                                <span style="color:red;text-decoration:line-through"><xsl:value-of select="child::tei:del"/></span> \ <span style="color:blue;text-decoration:underline"><xsl:value-of select="child::tei:add"/></span>
+                                                                </xsl:when>
+                                                                <xsl:when test="child::tei:del[@rend='dotobl']">
+                                                                                <span style="color:red"><xsl:value-of select="child::tei:del"/></span> \ <span style="color:blue;text-decoration:underline"><xsl:value-of select="child::tei:add"/></span>
+                                                                </xsl:when>
+                                                                <xsl:when test="child::tei:del[@rend='transform']">
+                                                                                <span style="color:red;text-decoration:line-through"><xsl:value-of select="child::tei:del"/></span> &gt; <span style="color:blue;text-decoration:underline"><xsl:value-of select="child::tei:add"/></span>
+                                                                </xsl:when>
+                                                                <xsl:when test="child::tei:del[@rend='unmarked'] and child::tei:add[@place='overwrite']">
+                                                                                <span style="color:red;text-decoration:line-through"><xsl:value-of select="child::tei:del"/></span> +  <span style="color:blue;text-decoration:underline"><xsl:value-of select="child::tei:add"/></span>
+                                                                </xsl:when>
+                                                                <xsl:when test="child::tei:del[@rend='unmarked'] and child::tei:add[contains(@place,'linear')]">
+                                                                                <span style="color:red;text-decoration:line-through"><xsl:value-of select="child::tei:del"/></span> +  \ <span style="color:blue;text-decoration:underline"><xsl:value-of select="child::tei:add"/></span>
+                                                                </xsl:when>
+                                                                <xsl:otherwise>
+                                                                                <span style="color:red;text-decoration:line-through"><xsl:value-of select="child::tei:del"/></span> / <span style="color:blue;text-decoration:underline"><xsl:value-of select="child::tei:add"/></span>
+                                                                </xsl:otherwise>                                                
+                                                </xsl:choose>]
+                                </xsl:template>
+                                
+                                <xsl:template match="tei:add" mode="facs">
+                                                <span style="color:blue;text-decoration:underline">
+                                                                <xsl:choose>
+                                                                                <xsl:when test="@place='interlinear' or @place='supralinear'">\<xsl:apply-templates mode="facs"/>/</xsl:when>
+                                                                                <xsl:when test="starts-with(@place,'margin')">\\<xsl:apply-templates mode="facs"/>//</xsl:when>
+                                                                                <xsl:otherwise><xsl:apply-templates mode="facs"/></xsl:otherwise>
+                                                                </xsl:choose>
+                                                </span>
+                                </xsl:template>
+                                
+                                <xsl:template match="tei:del" mode="facs">
+                                                <xsl:choose>
+                                                                <xsl:when test="@rend='dotbl'"><span style="color:red"><xsl:apply-templates mode="facs"/></span></xsl:when>
+                                                                <xsl:otherwise><span style="text-decoration:line-through;color:red"><xsl:apply-templates mode="facs"/></span></xsl:otherwise>
+                                                </xsl:choose>
+                                </xsl:template>
+                                
+                                <xsl:template match="tei:unclear" mode="facs">
+                                                <span style="background-color:lightgrey"><xsl:apply-templates mode="facs"/></span>
+                                </xsl:template>
+                                
+                                <xsl:template match="bfm:lettrine" mode="facs">
+                                                <font color="{@color}" size="{@size}00%" style="font-weight:bold"><xsl:apply-templates mode="facs"/></font>
+                                </xsl:template>
+                                
+                                <xsl:template match="bfm:lettrine" mode="number">
+                                                <font color="black" size="{@size}00%" style="font-weight:bold">&#xa0;</font>
+                                </xsl:template>
+
+                                <xsl:template match="bfm:sb" mode="facs">
+                                                <xsl:text>&#xa0;</xsl:text>
+                                </xsl:template>
+                                
+                                <xsl:template match="//tei:hi[@rend='sup']" mode="facs">
+                                                <sup><xsl:apply-templates mode="facs"/></sup>
+                                </xsl:template>
+                  
+                                  <xsl:template match="tei:supplied" mode="facs">
+                                <span style="color:blue">[<xsl:apply-templates mode="facs"/>]</span>
+                                <xsl:if test="not(ancestor::tei:w)"> </xsl:if>
+                </xsl:template>
+                                
+                                <xsl:template match="tei:surplus">
+                                                <span style="color:darkred" title="sic!"><xsl:apply-templates mode="facs"/></span>
+                                </xsl:template>
+                                
+                                <!-- 
+                                                
+                                                
+                                                <xsl:template match="tei:name">
+                                                <xsl:value-of select="@reg"/>
+                                                </xsl:template>
+                                                
+                                -->
+ </xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/org/txm/importer/graal/xsl/qgraal_facs.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/importer/graal/xsl/mdv_cms.xsl
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/graal/xsl/mdv_cms.xsl	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/graal/xsl/mdv_cms.xsl	(revision 258)
@@ -0,0 +1,193 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
+    xmlns:tei="http://www.tei-c.org/ns/1.0" xmlns:me="http://www.menota.org/ns/1.0"
+    xmlns:bfm="http://bfm.ens-lsh.fr/ns/1.0">
+
+    <!-- Eléments communs à toutes les présentations -->
+
+    <xsl:output method="html" encoding="UTF-8" version="4.0" indent="yes"/>
+
+    <xsl:strip-space elements="*"/>
+
+    <xsl:variable name="text_id">
+        <xsl:value-of select="//tei:teiHeader//tei:title[@type='reference']"/>
+    </xsl:variable>
+
+    <xsl:template match="/">
+        <html>
+            <head> </head>
+            <body>
+                <xsl:apply-templates select="//tei:text"/>
+                <xsl:apply-templates select="//tei:note" mode="final"/>
+            </body>
+        </html>
+    </xsl:template>
+
+
+    <xsl:template match="//tei:body/tei:div">
+        <br/>
+        <span style="font-family:Times;color:indigo">[<i>
+                <xsl:value-of select="@type"/>
+            </i>&#xa0;<xsl:value-of select="@n"/>]</span>
+        <xsl:apply-templates/>
+    </xsl:template>
+
+    <xsl:template match="//tei:body/tei:div/tei:div">
+        <br/>
+        <span style="font-family:Times;color:indigo">[<i>
+                <xsl:value-of select="@type"/>
+            </i>&#xa0;<xsl:value-of select="@n"/>]</span>
+        <br/>
+        <xsl:apply-templates/>
+    </xsl:template>
+
+    <xsl:template match="tei:head">
+        <span style="font-family:Arial; color:darkred">
+            <xsl:apply-templates/>
+        </span>
+        <br/>
+    </xsl:template>
+
+    <xsl:template match="//tei:p">
+        <p>
+            <xsl:if test="@n"> [ § <xsl:value-of select="@n"/>]&#xa0; </xsl:if>
+            <xsl:apply-templates/>
+        </p>
+    </xsl:template>
+
+    <xsl:template match="tei:pb">
+        <br/>
+        <br/>
+        <span style="font-family:Times" id="{$text_id}-{@n}">[folio <xsl:value-of select="@n"/>] <a
+                href="{$text_id}-compare.html#{$text_id}-{@n}">[autres facettes]</a>
+            <xsl:if test="@facs">
+                <xsl:text> </xsl:text>
+                <a href="../{@facs}" target="_blank">[Image]</a>
+            </xsl:if>
+        </span>
+        <xsl:if test="not(following-sibling::*[1][self::cb])">
+            <br/>
+        </xsl:if>
+    </xsl:template>
+
+    <xsl:template match="//tei:cb">
+        <br/>
+        <xsl:if test="not(preceding-sibling::*[1][self::pb])">
+            <br/>
+        </xsl:if>
+        <span style="font-family:Times">[colonne <xsl:value-of select="@n"/>]</span>
+        <br/>
+    </xsl:template>
+
+    <xsl:template match="tei:note">
+        <xsl:variable name="note_num">
+            <xsl:choose>
+                <xsl:when test="@n">
+                    <xsl:value-of select="@n"/>
+                </xsl:when>
+                <xsl:otherwise>
+                    <xsl:value-of select="count(preceding::tei:note) + 1"/>
+                </xsl:otherwise>
+            </xsl:choose>
+        </xsl:variable>
+        <a style="font-size:75%;color:blue;font-family:Times" title="{.}" id="noteref_{$note_num}"
+            href="#note_{$note_num}">
+            <sup>[<xsl:value-of select="count(preceding::tei:note) + 1"/>]</sup>
+        </a>
+        <xsl:if test="following::*[1][self::tei:w]">
+            <xsl:text> </xsl:text>
+        </xsl:if>
+    </xsl:template>
+
+    <xsl:template match="tei:note" mode="final">
+        <xsl:variable name="note_num">
+            <xsl:choose>
+                <xsl:when test="@n">
+                    <xsl:value-of select="@n"/>
+                </xsl:when>
+                <xsl:otherwise>
+                    <xsl:value-of select="position()"/>
+                </xsl:otherwise>
+            </xsl:choose>
+        </xsl:variable>
+        <span id="note_{$note_num}">
+            <a href="#noteref_{$note_num}">[<xsl:value-of select="$note_num"/>]</a>
+            (fol. <xsl:value-of select="preceding::tei:pb[1]/@n"/>, col. 
+            <xsl:value-of select="preceding::tei:cb[1]/@n"/>, l. 
+            <xsl:value-of select="preceding::tei:lb[1]/@n"/>) 
+            <xsl:apply-templates/>
+        </span>
+        <br/>
+    </xsl:template>
+
+    <xsl:template match="tei:q">
+        <span style="color:darkblue">
+            <xsl:apply-templates/>
+        </span>
+    </xsl:template>
+
+
+    <xsl:template match="tei:gap">
+        <xsl:text> [...] </xsl:text>
+    </xsl:template>
+    
+    
+<!--    <xsl:template match="tei:q">
+        <span style="background-color:khaki">
+            <xsl:apply-templates/>
+        </span>
+    </xsl:template>-->
+    
+    <xsl:template match="tei:gap">
+        <xsl:apply-templates/>
+    </xsl:template>
+    
+    <xsl:template match="//tei:lb">
+        <xsl:choose>
+            <xsl:when
+                test="position()=1 and not(ancestor::tei:seg)"/>
+            <xsl:otherwise>
+                <br/>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+    <xsl:template match="//tei:w">
+        <span class="word" id="{@xml:id}" title="{@type}">
+            <xsl:if
+                test="starts-with(.,':') or starts-with(.,'!') or starts-with(.,'?') or starts-with(.,';')"
+                >&#xa0;</xsl:if>
+            <xsl:value-of select="."/>
+            <xsl:choose>
+                <xsl:when
+                    test="following::*[1][starts-with(., ',') or starts-with(., '.') or starts-with(., ']') or starts-with(., ')') or starts-with(.,':') or starts-with(.,'!') or starts-with(.,'?') or starts-with(.,';')]"/>
+                <xsl:when
+                    test=".[string-length(.) = 0]"/>
+                <xsl:when test="@bfm:aggl='elision'">'</xsl:when>
+                <xsl:otherwise>
+                    <xsl:text> </xsl:text>
+                </xsl:otherwise>
+            </xsl:choose>
+        </span>
+    </xsl:template>
+    
+    <xsl:template match="tei:sic" >
+        <span style="text-decoration:line-through;color:red">
+            <xsl:apply-templates mode="norm"/>
+        </span>
+    </xsl:template>
+    
+    <xsl:template match="tei:del"> </xsl:template>
+    
+    
+    <xsl:template match="//tei:hi[@rend='sup']">
+        <sup>
+            <xsl:apply-templates/>
+        </sup>
+    </xsl:template>
+
+    <!-- fin éléments communs -->
+
+
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/src/groovy/org/txm/importer/graal/xsl/mdv_cms.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/importer/graal/xsl/mdv_common.xsl
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/graal/xsl/mdv_common.xsl	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/graal/xsl/mdv_common.xsl	(revision 258)
@@ -0,0 +1,158 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<xsl:stylesheet  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:tei="http://www.tei-c.org/ns/1.0" xmlns:me="http://www.menota.org/ns/1.0" xmlns:bfm="http://bfm.ens-lsh.fr/ns/1.0">
+
+    <!-- Eléments communs à toutes les présentations -->
+
+<xsl:variable name="text_id"><xsl:value-of select="//tei:teiHeader//tei:title[@type='reference']"/></xsl:variable>
+
+<!--    <xsl:template match="/">
+        <html>
+            <head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
+            </head>
+            <body>
+                <div class="head"><xsl:apply-templates select="//tei:teiHeader"/></div>
+                <xsl:apply-templates select="//tei:text">
+                    <xsl:with-param name="form"><xsl:value-of select="$form"/></xsl:with-param>
+                </xsl:apply-templates>
+                <!-\-<xsl:apply-templates select="//tei:note" mode="final"></xsl:apply-templates>-\->
+            </body>
+        </html>
+    </xsl:template>
+-->    
+    <xsl:template match="/">
+                <xsl:apply-templates select="//tei:text">
+                    <xsl:with-param name="form"><xsl:value-of select="$form"/></xsl:with-param>
+                </xsl:apply-templates>
+    </xsl:template>
+
+                                                <!-- TEI-Header Processing -->
+                                
+                                                <xsl:variable name="title-source" select="//tei:fileDesc/tei:titleStmt/tei:title[@type='source']"/>
+                
+                <xsl:variable name="title-normal" select="//tei:fileDesc/tei:titleStmt/tei:title[@type='normal']"/>
+                
+                <xsl:variable name="title-ref" select="//tei:fileDesc/tei:titleStmt/tei:title[@type='reference']"/>
+                
+                
+                <xsl:variable name="author" select="//tei:titleStmt/tei:author"/>
+                
+                <xsl:variable name="apostrophe" select='"&apos;"'/>
+
+                
+                
+                <xsl:template match="//tei:teiHeader">
+                                <p align="center">
+                                                
+                                                <!-- Author (only appears if not anonymous) -->
+                                                <xsl:if test="$author[not(contains(.,'anonym'))]">
+                                                                <span style="font-variant:small-caps;font-weight:bold"><xsl:value-of select="$author"/></span><br/>                
+                                                </xsl:if>
+                                                <!-- Title -->
+                                                <span style="color:darkviolet;font-family:Times;font-weight:bold;font-style:italic;font-size:200%"><xsl:value-of select="$title-normal"/></span><br/>
+                                                <!-- Scientific editor(s) -->
+                                                Edition par <xsl:apply-templates select="//tei:titleStmt/tei:editor[@role='editor']"/><br/>
+                                                Avec la collaboration de <xsl:apply-templates select="//tei:titleStmt/tei:editor[@role='associate_editor']"/><br/>
+                                                
+                                                <!-- Series Statement, Publisher, Year 	
+                                                                <xsl:apply-templates select="fileDesc/seriesStmt/title"/><br/>
+                                                                <xsl:apply-templates select="//sourceDesc//publicationStmt/pubPlace"/>,
+                                                                <xsl:apply-templates select="//sourceDesc//publicationStmt/publisher"/>,
+                                                                <xsl:apply-templates select="//sourceDesc//publicationStmt/date"/>
+                                                                
+                                                -->
+                                </p>
+                                
+                                <!-- Information on the electronic version  -->                
+                                <p align="center">_____________________________________________________<br/><br/>
+                                                <span style="font-size:75%">Edition électronique<br/>
+                                                                Dernière révision : <xsl:value-of select="//tei:revisionDesc/tei:change[1]/@when"/></span><br/>
+                                                                _____________________________________________________</p>
+                                <p align="center">Version <xsl:value-of select="$form"/>
+                                                <br/>_____________________________________________________</p>
+                </xsl:template>
+
+
+    
+    <xsl:template match="//tei:body/tei:div">
+        <br/><span style="font-family:Times;color:indigo">[<i><xsl:value-of select="@type"/></i>&#xa0;<xsl:value-of select="@n"/>]</span>
+        <xsl:apply-templates/>
+    </xsl:template>
+    
+    <xsl:template match="//tei:body/tei:div/tei:div">
+        <br/><span style="font-family:Times;color:indigo">[<i><xsl:value-of select="@type"/></i>&#xa0;<xsl:value-of select="@n"/>]</span><br/>
+        <xsl:apply-templates/>
+    </xsl:template>
+    
+    <xsl:template match="tei:head">
+        <span style="font-family:Arial; color:darkred"><xsl:apply-templates/></span><br/>
+    </xsl:template> 
+    <!-- 
+    <xsl:template match="//tei:p">
+        <p>
+            <xsl:if test="@n">
+                [ § <xsl:value-of select="@n"/>]&#xa0;
+            </xsl:if>
+            <xsl:apply-templates/>
+        </p>
+    </xsl:template>
+    -->
+    <xsl:template name="pb_common" match="tei:pb">
+<!--        <br/><br/>
+        <span style="font-family:Times" id="{$text_id}-{@n}">[folio <xsl:value-of select="@n"/>] <a href="{$text_id}-compare.html#{$text_id}-{@n}">[autres facettes]</a>
+        <xsl:if test="@facs">
+            <xsl:text> </xsl:text><a href="../{@facs}" target="_blank">[Image]</a>
+        </xsl:if>
+        </span>
+        <xsl:if test="not(following-sibling::*[1][self::cb])">
+            <br/>
+        </xsl:if>-->
+    </xsl:template>
+    
+    <xsl:template match="//tei:cb" name="cb_common">
+        <br/>
+        <xsl:if test="not(preceding-sibling::*[1][self::pb])"><br/></xsl:if>
+        <span style="font-family:Times">[colonne <xsl:value-of select="@n"/>]</span>
+        <br/>
+    </xsl:template>
+        
+    <xsl:template match="tei:note" name="note_common">
+<!--        <xsl:variable name="note_num">
+            <xsl:choose>
+                <xsl:when test="@n"><xsl:value-of select="@n"/></xsl:when>
+                <xsl:otherwise><xsl:value-of select="count(preceding::tei:note) + 1"/></xsl:otherwise>
+            </xsl:choose>            
+        </xsl:variable>
+        <a style="font-size:75%;color:blue;font-family:Times" title="{.}" id="noteref_{$note_num}" href="#note_{$note_num}"><sup>[<xsl:value-of select="count(preceding::tei:note) + 1"/>]</sup></a>
+        <xsl:if test="following::*[1][self::tei:w]"><xsl:text> </xsl:text></xsl:if>-->
+    </xsl:template>
+    
+    <xsl:template match="tei:note" mode="final">
+<!--        <xsl:variable name="note_num">
+            <xsl:choose>
+                <xsl:when test="@n"><xsl:value-of select="@n"/></xsl:when>
+                <xsl:otherwise><xsl:value-of select="position()"/></xsl:otherwise>
+            </xsl:choose>            
+        </xsl:variable>
+        <span id="note_{$note_num}"><a href="#noteref_{$note_num}">[<xsl:value-of select="$note_num"/>]</a> (fol. <xsl:value-of select="preceding::tei:pb[1]/@n"/>, col. <xsl:value-of select="preceding::tei:cb[1]/@n"/>,  l. <xsl:value-of select="preceding::tei:lb[1]/@n"/>) <xsl:apply-templates/></span><br/>
+-->    </xsl:template>
+    
+<!--    <xsl:template match="tei:q" name="q_common">
+        <span style="color:darkblue"><xsl:apply-templates/></span>
+    </xsl:template>
+-->    
+    
+    <xsl:template match="tei:gap" name="gap_common">
+        <xsl:text> [...] </xsl:text>
+    </xsl:template>
+
+<xsl:template name="supplied_common">
+    <xsl:text>[</xsl:text>
+    <xsl:apply-templates/>
+    <xsl:text>]</xsl:text>
+</xsl:template>
+
+    <!-- fin éléments communs -->
+    
+    
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/src/groovy/org/txm/importer/graal/xsl/mdv_common.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/importer/graal/xsl/mdv_dipl.xsl
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/graal/xsl/mdv_dipl.xsl	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/graal/xsl/mdv_dipl.xsl	(revision 258)
@@ -0,0 +1,183 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- This is a stylesheet that gives a "diplomatic" presentation of old French manuscript transcriptions
+	- abbreviations are resolved and rendered in italics;
+	- agglutinations and deglutinations are not marked (word limits 
+	  are "normalized");
+                                                          - Strong punctuation is marked with a dot followed by a capital letter;
+                                                             weak punctuation is marked with a comma.
+	- direct speech is marked with darkblue color;
+	- uncertain readings are marked with grey background color;
+	- text deleted in the original is not visualized;
+	- text corrected in the normalized version is marked with darkred
+                                                             color and followed by "(sic!)" note;
+                                                          - notes are rendered with [*] sign in the text body; the text of the note
+                                                            appears on "mouse-over" and is reproduced in the end.
+-->
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" xmlns:tei="http://www.tei-c.org/ns/1.0" xmlns:me="http://www.menota.org/ns/1.0" xmlns:bfm="http://bfm.ens-lsh.fr/ns/1.0">
+                <xsl:include href="mdv_common.xsl"/>
+
+                <xsl:param name="form">diplomatique</xsl:param>
+
+                <xsl:variable name="mode">dipl</xsl:variable>
+
+                <xsl:output method="html" encoding="UTF-8" version="4.0" indent="yes"/>
+
+                <xsl:strip-space elements="*"/>
+
+                <!--                <xsl:variable name="title-formal" select="//fileDesc/titleStmt/title[@type='formal']"/>
+                                
+                                <xsl:variable name="title-normal" select="//fileDesc/titleStmt/title[@type='normal']"/>
+                                
+                                <xsl:variable name="title-ref" select="//fileDesc/titleStmt/title[@type='reference']"/>
+                                
+                                <xsl:variable name="author" select="//titleStmt/author"/>
+                -->
+
+                <xsl:template match="//tei:p|//tei:head">
+                                <p>
+                                                <xsl:if test="@n"> [ § <xsl:value-of select="@n"
+                                                  />]&#xa0; </xsl:if>
+                                                <xsl:apply-templates mode="dipl"/>
+                                </p>
+                </xsl:template>
+
+                <xsl:template match="tei:pb" mode="dipl">
+                                <xsl:call-template name="pb_common"/>
+                </xsl:template>
+
+                <xsl:template match="tei:cb" mode="dipl">
+                                <xsl:call-template name="cb_common"/>
+                </xsl:template>
+
+                <xsl:template match="tei:note" mode="dipl">
+                                <xsl:call-template name="note_common"/>
+                </xsl:template>
+
+                <xsl:template match="tei:q" mode="dipl">
+                                <span style="background-color:khaki">
+                                                <xsl:apply-templates mode="dipl"/>
+                                </span>
+                </xsl:template>
+
+                <xsl:template match="tei:gap" mode="dipl">
+                                <xsl:call-template name="gap_common"/>
+                </xsl:template>
+
+
+                <xsl:template match="//tei:lb[@ed='norm']" mode="dipl"> </xsl:template>
+
+                <xsl:template match="//tei:lb[not(@ed)]" mode="dipl">
+                                <xsl:choose>
+                                                <xsl:when
+                                                  test="position()=1 and not(ancestor::tei:seg)"/>
+                                                <xsl:when
+                                                  test="preceding::tei:w[1][descendant::bfm:headlb]"/>
+                                                <xsl:when
+                                                  test="preceding::tei:w[1][descendant::tei:lb]"/>
+                                                <xsl:otherwise>
+                                                  <br/>
+                                                </xsl:otherwise>
+                                </xsl:choose>
+                </xsl:template>
+
+                <xsl:template match="//tei:lb[@ed='facs']" mode="dipl">
+                                <xsl:text>-</xsl:text>
+                                <br/>
+                </xsl:template>
+
+                <xsl:template match="//tei:w|//bfm:punct" mode="dipl">
+                                <span class="word" id="{@xml:id}" title="{@type}">
+                                                <xsl:apply-templates select="descendant::me:dipl"
+                                                  mode="dipl"/>
+                                                <xsl:if
+                                                  test="descendant::tei:sic and not(following-sibling::tei:w[1][descendant::tei:sic])">
+                                                  <i>
+                                                  <xsl:text> (sic !)</xsl:text>
+                                                  </i>
+                                                </xsl:if>
+                                                <xsl:choose>
+                                                  <xsl:when
+                                                  test="following::*[1][self::bfm:punct][contains(., ',') or contains(., '.') or contains(., ']')or contains(., ')')]"/>
+                                                  <xsl:when test="@bfm:aggl='elision'">'</xsl:when>
+                                                  <xsl:otherwise>
+                                                  <xsl:text> </xsl:text>
+                                                  </xsl:otherwise>
+                                                </xsl:choose>
+                                </span>
+                </xsl:template>
+
+                <xsl:template match="tei:ex" mode="dipl">
+                                <xsl:choose>
+                                                <xsl:when test="@cert='high'">
+                                                  <span style="color:darkgreen;font-style:italic">
+                                                  <xsl:apply-templates mode="dipl"/>
+                                                  </span>
+                                                </xsl:when>
+                                                <xsl:otherwise>
+                                                  <span style="color:darkred;font-style:italic">
+                                                  <xsl:apply-templates mode="dipl"/>
+                                                  </span>
+                                                </xsl:otherwise>
+                                </xsl:choose>
+                </xsl:template>
+
+                <xsl:template match="tei:sic" mode="dipl">
+                                <span style="color:darkred" title="sic!">
+                                                <xsl:apply-templates mode="dipl"/>
+                                </span>
+                </xsl:template>
+
+                <xsl:template match="tei:subst" mode="dipl">[<xsl:apply-templates mode="dipl"
+                                />]</xsl:template>
+
+                <xsl:template match="tei:del" mode="dipl">
+                                <span style="color:red;text-decoration:line-through">
+                                                <xsl:apply-templates mode="dipl"/>
+                                </span>
+                </xsl:template>
+
+                <xsl:template match="tei:add[not(@seq)]" mode="dipl">
+                                <span style="color:blue;text-decoration:underline">
+                                                <xsl:apply-templates mode="dipl"/>
+                                </span>
+                </xsl:template>
+
+                <xsl:template match="tei:add[@seq]" mode="dipl">
+                                <span style="color:blue">
+                                                <sup>&lt;<xsl:value-of select="@seq"/></sup>
+                                                <xsl:apply-templates mode="dipl"/>
+                                                <sup><xsl:value-of select="@seq"/>&gt;</sup>
+                                </span>
+                </xsl:template>
+
+                <xsl:template match="tei:unclear" mode="dipl">
+                                <span style="background-color:lightgrey">
+                                                <xsl:apply-templates mode="dipl"/>
+                                </span>
+                </xsl:template>
+
+                <xsl:template match="tei:hi[@rend='initiale']" mode="dipl">
+                                <span style="font-weight:bold;font-size:xx-large">
+                                                <xsl:apply-templates mode="dipl"/>
+                                </span>
+                </xsl:template>
+
+                <xsl:template match="//tei:hi[@rend='sup']" mode="dipl">
+                                <sup>
+                                                <xsl:apply-templates mode="dipl"/>
+                                </sup>
+                </xsl:template>
+
+
+
+                <!-- 
+
+
+<xsl:template match="tei:name">
+	<xsl:value-of select="@reg"/>
+</xsl:template>
+
+                -->
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/src/groovy/org/txm/importer/graal/xsl/mdv_dipl.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/importer/graal/xsl/qgraal_frmod.xsl
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/graal/xsl/qgraal_frmod.xsl	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/graal/xsl/qgraal_frmod.xsl	(revision 258)
@@ -0,0 +1,175 @@
+<?xml version='1.0'?>
+
+<!--
+                #######################################
+                Qgraal_cm BASIC stylesheet
+                
+                #######################################
+                author: Alexei Lavrentiev
+                version: 1.2
+                date: 2009-02-16
+                
+                version: 1.1
+                date: 2008-09-30
+                
+                version: 1.0
+                date: 2008-02-21
+                
+                #######################################
+                Description
+                This is a basic stylesheet for viewing BFM texts in XML-TEI
+                Modified for QGRAAL modern French translation
+                
+-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tei="http://www.tei-c.org/ns/1.0"
+                version="1.0"> 
+
+                <xsl:output method="html" encoding="utf-8" version="4.0" indent="yes"/>
+                
+                <xsl:strip-space elements="*"/>
+                
+                
+                <xsl:template match="/">
+<!--                                <html>
+                                                <head>
+                                                                <title>Quête du Graal (français moderne)</title>
+                                                </head>
+                                                <body style="margin-left:10%;margin-right:10%">-->
+                                                                <xsl:apply-templates select="//tei:text"/>			
+<!--                                                </body>		
+                                </html>	-->
+                </xsl:template>
+
+                <!-- TEI-Header Processing -->
+                
+                <xsl:template match="//tei:teiHeader">
+                </xsl:template>
+                
+                <!-- End of TEI-header processing -->
+                
+                <!-- Text body processing -->
+
+                <!-- "Original" titles found sometimes immediately before text body -->
+                <xsl:template match="//tei:div[@type='titre']">
+                                <p align="center"><b><xsl:apply-templates/></b></p>
+                </xsl:template>
+                
+                <!-- Text divisions (general) -->
+                <xsl:template match="//tei:div[not(@type='titre')]">
+                                <xsl:if test="child::tei:head">
+                                                <xsl:apply-templates select="head"/><br/>                                                
+                                </xsl:if>
+                                <xsl:apply-templates select="*[not(self::tei:head)]"/>                                
+                </xsl:template>
+                
+                <!-- Paragraphs -->
+                <xsl:template match="//tei:text//tei:p">
+                                <p align="justify"><xsl:apply-templates/></p>
+                </xsl:template>
+                
+
+                
+<!-- Page breaks -->                
+              
+                <xsl:template match="//tei:pb[@ed='Pauphilet1923']">
+                                (p. <xsl:value-of select="@n"/>)
+                </xsl:template>
+
+                <xsl:template match="//tei:milestone[@unit='column']">
+                                <br/><span style="color:darkviolet;font-family:arial;font-size:80%">&lt;<xsl:value-of select="@xml:id"/>&gt;</span>
+                </xsl:template>
+                
+
+                <!-- Line breaks : note special processing for numbered lb used in BFM verse texts -->
+                <xsl:template match="tei:lb">
+                                                                <xsl:if test="not(parent::tei:p and not(preceding-sibling::*))"><br/></xsl:if>
+                </xsl:template>
+                
+              
+                <!-- Processing elements with "rend" attributes  -->
+                
+                <xsl:template match="//*[@rend='ital']">
+                                <i><xsl:apply-templates/></i>
+                </xsl:template>
+
+                <xsl:template match="//*[@rend='gras']">
+                                <b><xsl:apply-templates/></b>
+                </xsl:template>
+                
+                <xsl:template match="//*[@rend='exp']">
+                                <sup><xsl:apply-templates/></sup>
+                </xsl:template>
+
+                <xsl:template match="//*[@rend='ind']">
+                                <sub><xsl:apply-templates/></sub>
+                </xsl:template>
+                
+                <xsl:template match="//*[@rend='maj']">
+                                <span style="text-transform:uppercase"><xsl:apply-templates/></span>
+                </xsl:template>
+                
+                <xsl:template match="//*[@rend='pmaj']">
+<span style="font-variant:small-caps"><xsl:apply-templates/></span>
+                </xsl:template>
+                
+                <xsl:template match="//*[@rend='crochets']">[<xsl:apply-templates/>]</xsl:template>
+
+                <xsl:template match="//*[@rend='chevrons']">
+                                <xsl:text>&lt;</xsl:text><xsl:apply-templates/><xsl:text>&gt; </xsl:text>
+                </xsl:template>
+                                
+                <xsl:template match="//*[@rend='crochets-ital']">
+                                <xsl:text>[</xsl:text><i><xsl:apply-templates/></i><xsl:text>]</xsl:text>
+                </xsl:template>
+                                
+
+                <!-- Numbers -->
+                <xsl:template match="tei:num">
+                                <span style="color:blue"><xsl:apply-templates/></span>
+                </xsl:template>
+                
+                <!-- Notes -->
+                <xsl:template match="tei:note">
+                                <span style="color:violet"> [<b>Note :</b> <xsl:apply-templates/>] </span>	
+                </xsl:template>
+                
+                <!-- Word formatting for morphologically tagged texts -->
+                <xsl:strip-space elements="tei:s"/>
+                <xsl:template match="//text()[starts-with(., ' ')][preceding-sibling::*[1][self::tei:w]]">
+                                <xsl:copy-of select="substring(., 2)"/>
+                </xsl:template>
+                <xsl:template match="//tei:w">
+                                <span title="{@type}" class="word" id="{@xml:id}" >
+                                <xsl:variable name="apostrophe" select='"&apos;"'/>
+                                <xsl:apply-templates/>
+                                <xsl:choose>
+                                                <xsl:when test="following::tei:w[1][starts-with(@type, 'pon')][contains(., ',') or contains(., '.') or contains(., ']')or contains(., ')')]">
+                                                </xsl:when>
+                                                <xsl:when test="following::node()[1][self::text()][starts-with(normalize-space(.), ',') or starts-with(normalize-space(.), '.') or starts-with(normalize-space(.), ']') or starts-with(normalize-space(.), ')')]">
+                                                </xsl:when>
+                                                <xsl:when test="self::tei:w[starts-with(@type, 'pon')][contains(., '[') or contains(., '(')]">
+                                                </xsl:when>
+                                                <xsl:when test="substring(., string-length(.))=$apostrophe">
+                                                </xsl:when>
+                                                <xsl:when test="following::tei:w[1][starts-with(@type, 'pon')][contains(., ':') or contains(., ';') or contains(., '!')or contains(., '?')]">
+                                                                <xsl:text>&#xa0;</xsl:text>
+                                                </xsl:when>
+                                                <xsl:otherwise>
+                                                                <xsl:text> </xsl:text>
+                                                </xsl:otherwise>
+                                </xsl:choose>
+                                                </span>
+                </xsl:template>
+                
+<xsl:template match="tei:ptr"/>
+
+                <!--  Direct speech, not currently tagged -->
+                <xsl:template match="tei:q[ancestor::tei:q]">
+                                <span style="background-color:cyan"> <xsl:apply-templates/></span>
+                </xsl:template>
+                
+                <xsl:template match="tei:q[not(ancestor::tei:q)]">
+                                <span style="background-color:lightcyan"> <xsl:apply-templates/></span>
+                </xsl:template>
+                
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/org/txm/importer/graal/xsl/qgraal_frmod.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/importer/graal/xsl/breakByMilestone.xsl
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/graal/xsl/breakByMilestone.xsl	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/graal/xsl/breakByMilestone.xsl	(revision 258)
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" xmlns:tei="http://www.tei-c.org/ns/1.0" xmlns:me="http://www.menota.org/ns/1.0" xmlns:bfm="http://bfm.ens-lsh.fr/ns/1.0">
+
+    <!-- Based on a stylesheet for creating separate XML-TEI files for
+        each page by Paul Caton (posted on TEI-L 2008-12-11)-->
+
+    <xsl:output method="xml" encoding="UTF-8"/>
+
+    <xsl:param name="pbval1">7</xsl:param>
+    <xsl:param name="pbval2">8</xsl:param>
+
+    <xsl:function name="tei:page-content" as="node()*">
+        <xsl:param name="pb1" as="node()"/>
+        <xsl:param name="pb2" as="node()"/>
+        <xsl:param name="node" as="node()"/>
+        <xsl:choose>
+            <xsl:when test="$node[self::*]">
+                <!-- $node is an element() -->
+                <xsl:choose>
+                    <!--                    <xsl:when test="$node is $pb1">
+                        <xsl:copy-of select="$node"/>
+                    </xsl:when>
+-->
+                    <xsl:when
+                        test="some $n in $node/descendant::* satisfies ($n is $pb1 or $n is $pb2)">
+                        <xsl:element name="{name($node)}" namespace="http://www.tei-c.org/ns/1.0">
+                            <!--<xsl:attribute name="testttt">http://www.menota.org/ns/1.0</xsl:attribute>-->
+                            <xsl:sequence select="for $i in ( $node/node() | $node/@* ) return tei:page-content($pb1, $pb2, $i)"/>
+                        </xsl:element>
+                    </xsl:when>
+                    <xsl:when test="($node >> $pb1) and ($node &lt;&lt; $pb2)">
+                        <xsl:copy-of select="$node"/>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <!-- do nothing -->
+                    </xsl:otherwise>
+                </xsl:choose>
+            </xsl:when>
+            <xsl:when test="$node[count(. | ../@*) = count(../@*)]">
+                <!-- $node is an attribute -->
+                <xsl:attribute name="{name($node)}">
+                    <xsl:sequence select="data($node)"/>
+                </xsl:attribute>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:choose>
+                    <xsl:when test="($node >> $pb1) and ($node &lt;&lt; $pb2)">
+                        <xsl:copy-of select="$node"/>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <!-- do nothing -->
+                    </xsl:otherwise>
+                </xsl:choose>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:function>
+
+    <xsl:template match="*|text()|@*">
+        <xsl:copy>
+            <xsl:apply-templates select="@*"/>
+            <xsl:apply-templates/>
+        </xsl:copy>
+    </xsl:template>
+
+    <xsl:template match="processing-instruction()">
+        <xsl:copy>
+            <xsl:value-of select="."/>
+        </xsl:copy>
+    </xsl:template>
+
+    <xsl:template match="tei:body">
+        <!-- <xsl:variable name="containingNode" select="//tei:text"/> -->
+        <xsl:sequence select="tei:page-content(//tei:milestone[@unit='column'][@n=$pbval1], //tei:milestone[@unit='column'][@n=$pbval2], //tei:body)"/>
+    </xsl:template>
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/src/groovy/org/txm/importer/graal/xsl/breakByMilestone.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/importer/graal/xsl/qgraal_cour.xsl
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/graal/xsl/qgraal_cour.xsl	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/graal/xsl/qgraal_cour.xsl	(revision 258)
@@ -0,0 +1,583 @@
+<?xml version='1.0'?>
+
+<!--
+                #######################################
+                Qgraal_cm BASIC stylesheet
+                
+                #######################################
+                author: Alexei Lavrentiev
+                
+                version: 3.3
+                date: 2011-06-03
+                (handling agglutinations of "en cours de figement" phrases)
+
+                version: 3.2
+                date: 2011-01-19
+                (handling inline and final notes) 
+                
+                version: 3.1
+                date: 2010-06-17
+                (utf-8 encoding; correcting spacing after "sic : " and "comma" sign)
+
+                version: 3.0
+                date: 2010-01-25
+                (adding table with line numbers and text in different columns)
+                
+                version: 2.0
+                date: 2009-08-24
+                (including multi-facet transcription)
+                
+                version: 1.2
+                date: 2009-02-16
+                
+                version: 1.1
+                date: 2008-09-30
+                
+                version: 1.0
+                date: 2008-02-21
+                
+                #######################################
+                Description
+                This is a basic stylesheet for viewing BFM texts in XML-TEI
+                
+-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tei="http://www.tei-c.org/ns/1.0"  xmlns:me="http://www.menota.org/ns/1.0" xmlns:bfm="http://bfm.ens-lsh.fr/ns/1.0"
+                version="1.0"> 
+
+                <xsl:output method = "html" encoding="utf-8" indent="yes"/>
+                
+                <xsl:strip-space elements="*"/>
+                
+                <xsl:variable name="title-source" select="//tei:fileDesc/tei:titleStmt/tei:title[@type='source']"/>
+                
+                <xsl:variable name="title-normal" select="//tei:fileDesc/tei:titleStmt/tei:title[@type='normal']"/>
+                
+                <xsl:variable name="title-ref" select="//tei:fileDesc/tei:titleStmt/tei:title[@type='reference']"/>
+
+                
+                <xsl:variable name="author" select="//tei:titleStmt/tei:author"/>
+                
+                <xsl:variable name="apostrophe" select='"&apos;"'/>
+                
+<!--                <xsl:template match="/">
+                                <html>
+                                                <head>
+                                                                <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
+                                                                <title>
+                                                                                <xsl:if test="$author[not(contains(.,'anonym'))]">
+                                                                                                <xsl:value-of select="$author"/><xsl:text> : </xsl:text>
+                                                                                </xsl:if>
+                                                                                <xsl:value-of select="$title-normal"/>
+                                                                </title>
+                                                                <xsl:apply-templates select="//tei:teiHeader"/>
+                                                </head>
+                                                <body style="margin-left:10%;margin-right:10%">
+                                                                <div class="text">
+                                                                <xsl:apply-templates select="//tei:text"/>
+                                                                </div>
+                                                                <div class="notes">
+                                                                                <p align="center"><b>Notes</b></p>
+                                                                                <xsl:apply-templates select="//tei:note[not(@place='inline')]" mode="notes"/>
+                                                                                </div>
+                                                </body>		
+                                </html>	
+                </xsl:template>
+-->
+                
+                <xsl:template match="/">
+                                <xsl:apply-templates select="//tei:text//tei:p|//tei:note[@place='inline']"/>
+                </xsl:template>
+
+                <!-- TEI-Header Processing -->
+                
+                <xsl:template match="//tei:teiHeader">
+	<p align="center">
+	                
+	                <!-- Author (only appears if not anonymous) -->
+	                <xsl:if test="$author[not(contains(.,'anonym'))]">
+	                                <span style="font-variant:small-caps;font-weight:bold"><xsl:value-of select="$author"/></span><br/>                
+	                </xsl:if>
+	                <!-- Title -->
+	                <span style="color:darkviolet;font-family:Times;font-weight:bold;font-style:italic;font-size:200%"><xsl:value-of select="$title-normal"/></span><br/>
+	                <!-- Scientific editor(s) -->
+	                Edition par <xsl:apply-templates select="//tei:titleStmt/tei:editor[@role='editor']"/><br/>
+	                Avec la collaboration de <xsl:apply-templates select="//tei:titleStmt/tei:editor[@role='associate_editor']"/><br/>
+	                
+	                <!-- Series Statement, Publisher, Year 	
+	                <xsl:apply-templates select="fileDesc/seriesStmt/title"/><br/>
+	                <xsl:apply-templates select="//sourceDesc//publicationStmt/pubPlace"/>,
+	                <xsl:apply-templates select="//sourceDesc//publicationStmt/publisher"/>,
+	                <xsl:apply-templates select="//sourceDesc//publicationStmt/date"/>
+	                
+	                -->
+	</p>
+                                
+                                <!-- Information on the electronic version  -->                
+	<p align="center">_____________________________________________________<br/><br/>
+	<span style="font-size:75%">Edition électronique<br/>
+	                Dernière révision : <xsl:value-of select="//tei:revisionDesc/tei:change[1]/@when"/></span><br/>
+	                _____________________________________________________</p>
+                                <p align="center">Version courante<br/>
+                                _____________________________________________________</p>
+                                
+                </xsl:template>
+
+                <!-- Last change date formatting 
+                <xsl:template match="//revisionDesc/change/date[following-sibling::item[contains(.,'Dernière mise à jour')]]">
+                                <xsl:value-of select="substring-before(., ' 00:')"/>
+                </xsl:template> -->
+                
+                <!-- End of TEI-header processing -->
+                
+                <!-- Text body processing -->
+
+                <!-- "Original" titles found sometimes immediately before text body -->
+                <xsl:template match="//tei:div[@type='titre']">
+                                <p align="center"><b><xsl:apply-templates/></b></p>
+                </xsl:template>
+                
+                <!-- Text divisions (general) -->
+                <xsl:template match="//tei:div[not(@type='titre')]">
+                                <xsl:if test="child::tei:head">
+                                                <xsl:apply-templates select="head"/><br/>                                                
+                                </xsl:if>
+                                <xsl:apply-templates select="*[not(self::tei:head)]"/>                                
+                </xsl:template>
+                
+                <!-- Paragraphs -->
+                <xsl:template match="//tei:text//tei:p">
+                                             <table width="100%" style="border:none">
+                                                             <tr style="border:none">
+                                                                             <td width="10%" valign="top" style="white-space:nowrap;padding-right:10pt;line-height:18px;font-family:Arial;font-size:14px;border-:none;text-align:right">
+                                                                                             <xsl:if test="@n"><span style="color:gray;font-size:12px">[§ <xsl:value-of select="@n"/>] </span></xsl:if><xsl:apply-templates select="descendant::tei:lb|descendant::tei:milestone[@unit='column']" mode="number"/></td>
+                                                                             <td valign="top" style="white-space:nowrap;line-height:18px;font-family:Arial;font-size:14px;border:none">&#xa0;<xsl:apply-templates/></td>
+                                             </tr>
+                                             </table>
+                </xsl:template>
+                
+
+                
+                <!--<xsl:template match="//p[@rend]/lb[1][@n]">
+                                <br/>[<xsl:value-of select="@n"/>]
+                                </xsl:template> -->
+                
+<!-- Page breaks -->                
+              
+                <xsl:template match="//tei:pb[@ed='Pauphilet1923']">
+                                (p. <xsl:value-of select="@n"/>)
+                </xsl:template>
+
+                <xsl:template match="//tei:milestone[@unit='column'][ancestor::tei:p]">
+                                <br/>&#xa0;<br/><span style="color:darkviolet;font-family:arial;font-size:80%">&lt;<xsl:value-of select="substring-after(@xml:id,'col_')"/>&gt;</span><br/>
+                </xsl:template>
+                
+                <xsl:template match="//tei:milestone[@unit='column'][ancestor::tei:p]" mode="number">
+                                <br/>&#xa0;<br/><span style="color:darkviolet;font-family:arial;font-size:80%">&#xa0;</span><br/>
+                </xsl:template>
+                
+                <xsl:template match="//tei:milestone[@unit='column'][not(ancestor::tei:p)]">
+                                <table width="100%">
+                                                <tr>
+                                                                <td width="10%" align="right" valign="top" style="padding-right:10pt"><span style="color:darkviolet;font-family:arial;font-size:80%">&#xa0;</span></td>
+                                                                <td valign="top" style="white-space:nowrap"><span style="color:darkviolet;font-family:arial;font-size:80%">&lt;<xsl:value-of select="substring-after(@xml:id,'col_')"/>&gt;</span></td>
+                                                </tr>
+                                </table>                                
+                </xsl:template>
+                
+
+                <xsl:template match="tei:lb">
+                                <xsl:choose>
+                                                <xsl:when test="@ed='facs'"></xsl:when>
+                                                <xsl:when test="position() = 1 and ancestor::tei:s[not(preceding-sibling::*)]"></xsl:when>
+                                                <xsl:otherwise><br/></xsl:otherwise>
+                                </xsl:choose>
+                </xsl:template>
+                
+                <xsl:template match="tei:lb" mode="number">
+                                <xsl:choose>
+                                                <xsl:when test="@ed='facs'"></xsl:when>
+                                                <xsl:when test="position() = 1 and ancestor::tei:s[not(preceding-sibling::*)]"></xsl:when>
+                                                <xsl:otherwise><br/>&#xa0;</xsl:otherwise>
+                                </xsl:choose>
+                                <xsl:if test="substring(@n, string-length(@n)) = 0 or substring(@n, string-length(@n)) = 5"><xsl:value-of select="@n"/></xsl:if>
+                </xsl:template>
+                
+              
+                <!-- Processing elements with "rend" attributes  -->
+                
+                <xsl:template match="//*[@rend='ital']">
+                                <i>
+                                                <xsl:choose>
+                                                                <xsl:when test="self::tei:hi">
+                                                                                <span style="color:blue"><xsl:apply-templates/></span>
+                                                                </xsl:when>
+                                                                <xsl:when test="self::tei:foreign">
+                                                                                <span style="color:darkblue"><xsl:apply-templates/></span>
+                                                                </xsl:when>
+                                                                <xsl:otherwise>
+                                                                                <span style="color:red"><xsl:apply-templates/></span>
+                                                                </xsl:otherwise>
+                                                </xsl:choose>
+                                </i>
+                </xsl:template>
+
+                <xsl:template match="//*[@rend='gras']">
+                                <b>
+                                                <xsl:choose>
+                                                                <xsl:when test="self::tei:hi">
+                                                                                <span style="color:blue"><xsl:apply-templates/></span>
+                                                                </xsl:when>
+                                                                <xsl:otherwise>
+                                                                                <span style="color:red"><xsl:apply-templates/></span>
+                                                                </xsl:otherwise>
+                                                </xsl:choose>
+                                </b>
+                </xsl:template>
+                
+                <xsl:template match="//*[@rend='exp']">
+                                <sup>
+                                                <xsl:choose>
+                                                                <xsl:when test="self::tei:hi">
+                                                                                <span style="color:blue"><xsl:apply-templates/></span>
+                                                                </xsl:when>
+                                                                <xsl:otherwise>
+                                                                                <span style="color:red"><xsl:apply-templates/></span>
+                                                                </xsl:otherwise>
+                                                </xsl:choose>                                                
+                                </sup>
+                </xsl:template>
+
+                <xsl:template match="//*[@rend='ind']">
+                                <sub>
+                                                <xsl:choose>
+                                                                <xsl:when test="self::tei:hi">
+                                                                                <span style="color:blue"><xsl:apply-templates/></span>
+                                                                </xsl:when>
+                                                                <xsl:otherwise>
+                                                                                <span style="color:red"><xsl:apply-templates/></span>
+                                                                </xsl:otherwise>
+                                                </xsl:choose>                                                
+                                </sub>
+                </xsl:template>
+                
+                <xsl:template match="//*[@rend='maj']">
+                                <xsl:choose>
+                                                <xsl:when test="self::tei:hi">
+                                                                <span style="text-transform:uppercase;color:blue"><xsl:apply-templates/></span>
+                                                </xsl:when>
+                                                <xsl:otherwise>
+                                                                <span style="text-transform:uppercase;color:red"><xsl:apply-templates/></span>
+                                                </xsl:otherwise>
+                                </xsl:choose>                                
+                </xsl:template>
+                
+                <xsl:template match="//*[@rend='pmaj']">
+                                <xsl:choose>
+                                                <xsl:when test="self::tei:hi">
+                                                                <span style="font-variant:small-caps;color:blue"><xsl:apply-templates/></span>
+                                                </xsl:when>
+                                                <xsl:otherwise>
+                                                                <span style="font-variant:small-caps;color:red"><xsl:apply-templates/></span>
+                                                </xsl:otherwise>
+                                </xsl:choose>
+                                
+                </xsl:template>
+                
+                <xsl:template match="//*[@rend='crochets']">
+                                <xsl:choose>
+                                                <xsl:when test="self::tei:corr">
+                                                                <span style="color:brown"> [<xsl:apply-templates/>] </span>
+                                                </xsl:when>
+                                                <xsl:otherwise>
+                                                                <span style="color:red"> [<xsl:apply-templates/>] </span>
+                                                </xsl:otherwise>
+                                </xsl:choose>
+                                
+                </xsl:template>
+
+                <xsl:template match="//*[@rend='chevrons']">
+                                <xsl:choose>
+                                                <xsl:when test="self::tei:corr">
+                                                                <span style="color:brown"><xsl:text>&lt;</xsl:text><xsl:apply-templates/><xsl:text>&gt; </xsl:text></span>
+                                                </xsl:when>
+                                                <xsl:otherwise>
+                                                                <span style="color:red"><xsl:text>&lt;</xsl:text><xsl:apply-templates/><xsl:text>&gt; </xsl:text></span>
+                                                </xsl:otherwise>
+                                </xsl:choose>
+                                
+                </xsl:template>
+                                
+                <xsl:template match="//*[@rend='crochets-ital']">
+                                <xsl:choose>
+                                                <xsl:when test="self::tei:head">
+                                                                <span style="color:indigo">
+                                                                                <xsl:text>[</xsl:text>
+                                                                                <i>
+                                                                                                <xsl:if test="parent::div[@n]">
+                                                                                                                <xsl:value-of select="parent::div/@n"/>
+                                                                                                                <xsl:text>. </xsl:text>
+                                                                                                </xsl:if>
+                                                                                                <xsl:apply-templates/>
+                                                                                </i>
+                                                                                <xsl:text>]</xsl:text>
+                                                                </span>
+                                                </xsl:when>
+                                                <xsl:otherwise>
+                                                                <span style="color:red">
+                                                                                <xsl:text> [</xsl:text>
+                                                                                <i>
+                                                                                                <xsl:if test="parent::div[@n]">
+                                                                                                                <xsl:value-of select="parent::div/@n"/>
+                                                                                                                <xsl:text>. </xsl:text>
+                                                                                                </xsl:if>
+                                                                                                <xsl:apply-templates/>
+                                                                                </i>
+                                                                                <xsl:text>] </xsl:text>
+                                                                </span>                                                               
+                                                </xsl:otherwise>
+                                </xsl:choose>
+                </xsl:template>
+                                
+                <xsl:template match="//*[@rend='crochets-maj']">
+                                <xsl:choose>
+                                                <xsl:when test="self::tei:head">
+                                                                <span style="font-family:Times;text-transform:uppercase;color:indigo">
+                                                                                <xsl:text>[</xsl:text>
+                                                                                <xsl:if test="parent::div[@n]">
+                                                                                                <xsl:value-of select="parent::div/@n"/>
+                                                                                                <xsl:text>. </xsl:text>
+                                                                                </xsl:if>
+                                                                                <xsl:apply-templates/>
+                                                                                <xsl:text>]</xsl:text>
+                                                                </span>
+                                                </xsl:when>
+                                                <xsl:otherwise>
+                                                                <span style="text-transform:uppercase;color:red"> [<xsl:apply-templates/>] </span>
+                                                </xsl:otherwise>
+                                </xsl:choose>
+                </xsl:template>
+                
+                <xsl:template match="//*[@rend='crochets-pmaj']">
+                                <xsl:choose>
+                                                <xsl:when test="self::tei:head">
+                                                                <span style="font-family:Times;font-variant:small-caps;color:indigo">
+                                                                                <xsl:text>[</xsl:text>
+                                                                                <xsl:if test="parent::tei:div[@n]">
+                                                                                                <xsl:value-of select="parent::tei:div/@n"/>
+                                                                                                <xsl:text>. </xsl:text>
+                                                                                </xsl:if>
+                                                                                <xsl:apply-templates/>
+                                                                                <xsl:text>]</xsl:text>
+                                                                </span>
+                                                </xsl:when>
+                                                <xsl:otherwise>
+                                                                <span style="font-variant:small-caps;color:red"> [<xsl:apply-templates/>] </span>
+                                                </xsl:otherwise>
+                                </xsl:choose>
+                </xsl:template>
+                
+                <xsl:template match="//*[@rend='points']">
+                                <xsl:choose>
+                                                <xsl:when test="self::tei:gap">
+                                                                <span style="color:brown"><xsl:text> . . . . . . . . .  </xsl:text></span>
+                                                </xsl:when>
+                                                <xsl:otherwise>
+                                                                <span style="color:red"><xsl:text> . . . . . . . . .  </xsl:text></span>
+                                                </xsl:otherwise>
+                                </xsl:choose>                                
+                </xsl:template>
+                
+                <xsl:template match="//*[@rend='susp']">
+                                <xsl:choose>
+                                                <xsl:when test="self::tei:gap">
+                                                                <span style="color:brown"><xsl:text> ... </xsl:text></span>
+                                                </xsl:when>
+                                                <xsl:otherwise>
+                                                                <span style="color:red"><xsl:text> ... </xsl:text></span>
+                                                </xsl:otherwise>
+                                </xsl:choose>                                
+                </xsl:template>
+
+                <xsl:template match="//*[@rend='crochets-susp']">
+                                <xsl:choose>
+                                                <xsl:when test="self::tei:gap">
+                                                                <span style="color:brown"><xsl:text> [...] </xsl:text></span>
+                                                </xsl:when>
+                                                <xsl:otherwise>
+                                                                <span style="color:red"><xsl:text> [...] </xsl:text></span>
+                                                </xsl:otherwise>
+                                </xsl:choose>                                
+                </xsl:template>                
+                <!-- End of @rend processing -->
+
+                <!-- Gaps without normalized @rend -->
+                <xsl:template match="tei:gap[not(@rend)]">
+                                <span style="color:darkblue"><xsl:text> [...] </xsl:text></span>
+                </xsl:template>
+                
+                <xsl:template match="tei:gap[@rend][not(@rend='susp' or @rend='points' or @rend='crochets-susp')]">
+                                <span style="color:orange"><xsl:text> [...] </xsl:text></span>
+                </xsl:template>
+                
+                <!-- Corrections without normalized @rend -->
+                
+                <xsl:template match="tei:choice">
+                                <span title="{child::tei:corr/@type}"><xsl:apply-templates select="tei:corr"/><xsl:text> </xsl:text><xsl:apply-templates select="tei:sic"/></span>
+                                <xsl:if test="not(ancestor::tei:w)">
+                                                <xsl:call-template name="spacing"/>
+                                </xsl:if>
+                </xsl:template>
+                
+                <xsl:template match="tei:corr[not(@rend)]">
+                                <span style="color:darkblue;background-color:yellow"><xsl:text> </xsl:text><xsl:apply-templates/><xsl:text> </xsl:text></span>
+                </xsl:template>
+                
+<!--                <xsl:template match="tei:corr[@rend][not(@rend='crochets' or @rend='chevrons')]">
+                                <span style="color:orange"> <i><xsl:value-of select="@rend"/></i><xsl:text> </xsl:text></span><xsl:apply-templates/>
+                </xsl:template>
+-->                
+                <xsl:template match="tei:sic">(<i>sic&#xa0;:</i><xsl:text> </xsl:text><span style="background-color:pink"><xsl:apply-templates/></span>)</xsl:template>
+                <!--  Supplied text -->
+                
+                <xsl:template match="tei:supplied">
+                                <span style="color:blue">[<xsl:apply-templates/>]</span>
+                                <xsl:if test="not(ancestor::tei:w)"><xsl:call-template name="spacing"/></xsl:if>
+                </xsl:template>
+                
+                <!-- Deletions -->
+                
+                <xsl:template match="tei:del">
+                                <span style="background-color:lightpink"><xsl:apply-templates/></span>
+                </xsl:template>
+
+                <xsl:template match="tei:add">
+                                <span style="background-color:lightgreen"><xsl:apply-templates/></span>
+                </xsl:template>
+                
+                <!-- Redundant text -->
+                
+                <xsl:template match="tei:surplus">(<span style="background-color:lightpink"><xsl:apply-templates/></span><xsl:text> </xsl:text><i>répété</i>)<xsl:call-template name="spacing"></xsl:call-template></xsl:template>
+                
+                
+                <!-- Numbers -->
+                <xsl:template match="tei:num">
+                                <span style="color:blue"><xsl:apply-templates/></span>
+                </xsl:template>
+                
+                <!-- Notes -->
+                <xsl:template match="tei:note[not(@place='inline')]">
+                                <xsl:variable name="note_count"><xsl:value-of select="count(preceding::tei:note[not(@place='inline')]) + 1"/></xsl:variable>
+                                <!--<a title="{.}" style="color:violet;font-size:75%" href="#note_{$note_count}" name="noteref_{$note_count}">[Note <xsl:value-of select="$note_count"/>]</a>-->
+                                <span title="{.}" style="color:violet">[<xsl:value-of select="$note_count"/>]</span>
+                                <xsl:call-template name="spacing"/>
+                </xsl:template>
+                
+                <xsl:template match="tei:note[not(@place='inline')]" mode="notes">
+                                <xsl:variable name="note_count"><xsl:value-of select="count(preceding::tei:note[not(@place='inline')]) + 1"/></xsl:variable>
+                                <p><xsl:value-of select="$note_count"/>. <a href="#noteref_{$note_count}" name="note_{$note_count}">[<xsl:value-of select="preceding::tei:milestone[@unit='column'][1]/@xml:id"/>, l. <xsl:value-of select="preceding::tei:lb[1]/@n"/>]</a><xsl:text> </xsl:text> <xsl:value-of select="."/></p>
+                </xsl:template>
+                
+                <xsl:template match="tei:note[@place='inline']">
+                                <p style="text-align:justify;text-indent:30px;padding-right:20px;padding-left:20px"><span style="color:blue;font-family:Times New Roman;font-style:italic"><xsl:value-of select="."/></span></p>
+                </xsl:template>
+                
+                <!-- Word formatting for morphologically tagged texts -->
+                <xsl:strip-space elements="tei:s"/>
+                <xsl:template match="//text()[starts-with(., ' ')][preceding-sibling::*[1][self::tei:w]]">
+                                <xsl:copy-of select="substring(., 2)"/>
+                </xsl:template>
+                
+                <xsl:template match="//tei:w"> <!-- modified 2011-06-03 -->                               
+                                <xsl:element name="span">
+                                                <xsl:attribute name="class">word</xsl:attribute>
+                                                <xsl:attribute name="title"><xsl:value-of select="@type"/></xsl:attribute>
+                                                <xsl:attribute name="id"><xsl:value-of select="@xml:id"/></xsl:attribute>
+                                                <xsl:if test="@rend='fgmt'">
+                                                                <xsl:attribute name="style">color:red</xsl:attribute>
+                                                </xsl:if>
+                                                <xsl:choose>
+                                                                <xsl:when test="descendant::me:norm">
+                                                                                <xsl:apply-templates select="descendant::me:norm"/>
+                                                                </xsl:when>
+                                                                <xsl:otherwise>
+                                                                                <xsl:apply-templates/>
+                                                                </xsl:otherwise>
+                                                </xsl:choose>
+                                                
+                                </xsl:element>
+                                <xsl:call-template name="spacing"/>
+                                <!--<xsl:choose>
+                                                <xsl:when test="following::tei:w[1][starts-with(@type, 'PON')][contains(., ',') or contains(., '.') or contains(., ']')or contains(., ')')]">
+                                                </xsl:when>
+                                                <xsl:when test="following::node()[1][self::text()][starts-with(normalize-space(.), ',') or starts-with(normalize-space(.), '.') or starts-with(normalize-space(.), ']') or starts-with(normalize-space(.), ')')]">
+                                                </xsl:when>
+                                                <xsl:when test="self::tei:w[starts-with(@type, 'PON')][contains(., '[') or contains(., '(')]">
+                                                </xsl:when>
+                                                <xsl:when test="substring(., string-length(.))=$apostrophe">
+                                                </xsl:when>
+                                                <xsl:when test="following::tei:w[1][starts-with(@type, 'PON')][contains(., ':') or contains(., ';') or contains(., '!')or contains(., '?')]">
+                                                                <xsl:text>&#xa0;</xsl:text>
+                                                </xsl:when>
+                                                <xsl:when test="@rend='elision'">&apos;</xsl:when>
+                                                <xsl:otherwise>
+                                                                <xsl:text> </xsl:text>
+                                                </xsl:otherwise>
+                                </xsl:choose>-->
+                </xsl:template>
+                
+                <xsl:template match="//tei:w[not(starts-with(@type,'PON'))]/text()">
+                                <xsl:choose>
+                                                <xsl:when test="substring(., string-length(.))=$apostrophe">
+                                                                <xsl:value-of select="translate(.,$apostrophe,'’')"/>
+                                                </xsl:when>
+                                                <xsl:otherwise>
+                                                                <xsl:value-of select="."/>
+                                                </xsl:otherwise>
+                                </xsl:choose>
+                </xsl:template>
+
+<xsl:template name="spacing">
+                <xsl:choose>
+                                <xsl:when test="following::tei:w[1][starts-with(@type, 'PON')][starts-with(normalize-space(descendant::text()[1]), ',') or starts-with(normalize-space(descendant::text()[1]), '.') or starts-with(normalize-space(descendant::text()[1]), ']')or contains(., ')')]">
+                                </xsl:when>
+                                <xsl:when test="following::node()[1][self::text()][starts-with(normalize-space(.), ',') or starts-with(normalize-space(.), '.') or starts-with(normalize-space(.), ']') or starts-with(normalize-space(.), ')')]">
+                                </xsl:when>
+                                <xsl:when test="self::tei:w[starts-with(@type, 'PON')][starts-with(normalize-space(descendant::text()[1]), '[') or starts-with(normalize-space(descendant::text()[1]), '(')]">
+                                </xsl:when>
+                                <xsl:when test="substring(., string-length(.))=$apostrophe and not(@type='PONfbl' or @type='PONpdr' or self::tei:note)">
+                                </xsl:when>
+                                <xsl:when test="position()=last() and (ancestor::tei:choice or ancestor::tei:supplied[not(@rend='multi_s')] or ancestor::tei:surplus)"></xsl:when>
+                                <xsl:when test="following-sibling::*[1][self::tei:note]"></xsl:when>
+                                <xsl:when test="following::tei:w[1][starts-with(@type, 'PON')][contains(., ':') or contains(., ';') or contains(., '!') or contains(., '?')]">
+                                                <xsl:text>&#xa0;</xsl:text>
+                                </xsl:when>
+                                <!--
+                                <xsl:when test="following::tei:w[1][starts-with(@type, 'PON')][contains(descendant::me:norm, ':') or contains(descendant::me:norm, ';') or contains(descendant::me:norm, '!')or contains(descendant::me:norm, '?')]">
+                                                <xsl:text>&#xa0;</xsl:text>
+                                </xsl:when>                                
+                                -->
+                                <xsl:when test="@rend='elision'">’</xsl:when>
+                                <!-- new 201106-03 -->
+                                <xsl:when test="@rend='fgmt'"></xsl:when>
+                                <xsl:otherwise>
+                                                <xsl:text> </xsl:text>
+                                </xsl:otherwise>
+                </xsl:choose>
+                
+</xsl:template>
+
+                <xsl:template match="tei:q[ancestor::tei:q[ancestor::tei:q]]">
+                                <span style="background-color:darkcyan"> <xsl:apply-templates/></span>
+                </xsl:template>
+                
+                <xsl:template match="tei:q[ancestor::tei:q][not(ancestor::tei:q[ancestor::tei:q])]">
+                                <span style="background-color:cyan"> <xsl:apply-templates/></span>
+                </xsl:template>
+                
+                <xsl:template match="tei:q[not(ancestor::tei:q)]">
+                                <span style="background-color:lightcyan"> <xsl:apply-templates/></span>
+                </xsl:template>
+                
+                <xsl:template match="bfm:sb"><span style="color:violet">_</span></xsl:template>
+                                
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/org/txm/importer/graal/xsl/qgraal_cour.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/importer/graal/xsl/qgraal_dipl.xsl
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/graal/xsl/qgraal_dipl.xsl	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/graal/xsl/qgraal_dipl.xsl	(revision 258)
@@ -0,0 +1,407 @@
+<?xml version='1.0'?>
+
+<!-- This is a stylesheet that gives a "diplomatic" presentation of old French manuscript transcriptions
+	- abbreviations are resolved and rendered in italics;
+	- agglutinations are marked with a red +
+	- deglutinations are marked with e red _
+                                                          - Strong punctuation is marked with a dot followed by a capital letter;
+                                                             weak punctuation is marked with a comma.
+	- direct speech is marked with darkblue color;
+	- uncertain readings are marked with grey background color;
+	- text deleted in the original is not visualized;
+	- text corrected in the normalized version is marked with darkred
+                                                             color and followed by "(sic!)" note;
+                                                          - notes are rendered with [*] sign in the text body; the text of the note
+                                                            appears on "mouse-over" and is reproduced in the end.
+-->
+
+
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:tei="http://www.tei-c.org/ns/1.0" xmlns:me="http://www.menota.org/ns/1.0" xmlns:bfm="http://bfm.ens-lsh.fr/ns/1.0">
+                <xsl:import href="mdv_common.xsl"/>
+                <xsl:param name="form">diplomatique</xsl:param>
+                <xsl:variable name="mode">dipl</xsl:variable>
+                
+                <xsl:output method="html"  encoding="utf-8" indent="yes"/>
+                
+                <xsl:strip-space elements="*"/>
+                
+                <!--                <xsl:variable name="title-formal" select="//fileDesc/titleStmt/title[@type='formal']"/>
+                                
+                                <xsl:variable name="title-normal" select="//fileDesc/titleStmt/title[@type='normal']"/>
+                                
+                                <xsl:variable name="title-ref" select="//fileDesc/titleStmt/title[@type='reference']"/>
+                                
+                                <xsl:variable name="author" select="//titleStmt/author"/>
+                -->
+                
+<!--                <xsl:template match="//tei:p|//tei:head">
+                                <p>
+                                                <xsl:if test="@n">
+                                                                [ § <xsl:value-of select="@n"/>]&#xa0;
+                                                </xsl:if>
+                                                <xsl:apply-templates mode="dipl"/>
+                                </p>
+                </xsl:template>
+-->                
+
+                <xsl:variable name="title-source" select="//tei:fileDesc/tei:titleStmt/tei:title[@type='source']"/>
+                
+                <xsl:variable name="title-normal" select="//tei:fileDesc/tei:titleStmt/tei:title[@type='normal']"/>
+                
+                <xsl:variable name="title-ref" select="//tei:fileDesc/tei:titleStmt/tei:title[@type='reference']"/>
+                
+                
+                <xsl:variable name="author" select="//tei:titleStmt/tei:author"/>
+                
+                <xsl:variable name="apostrophe" select='"&apos;"'/>
+                
+                
+<!--                <xsl:template match="/">
+                                <html>
+                                                <head>
+                                                                <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
+                                                                <title>
+                                                                                <xsl:if test="$author[not(contains(.,'anonym'))]">
+                                                                                                <xsl:value-of select="$author"/><xsl:text> : </xsl:text>
+                                                                                </xsl:if>
+                                                                                <xsl:value-of select="$title-normal"/>
+                                                                </title>
+                                                                <xsl:apply-templates select="//tei:teiHeader"/>
+                                                </head>
+                                                <body style="margin-left:10%;margin-right:10%">
+                                                                <div class="text">
+                                                                                <xsl:apply-templates select="//tei:text"/>
+                                                                </div>
+                                                                <div class="notes">
+                                                                                <p align="center"><b>Notes</b></p>
+                                                                                <xsl:apply-templates select="//tei:note[not(@place='inline')]" mode="notes"/>
+                                                                </div>			
+                                                </body>		
+                                </html>	
+                </xsl:template>
+-->                
+                <xsl:template match="/">
+                                <xsl:apply-templates select="//tei:note[@place='inline']" mode="dipl"/>
+                                <xsl:apply-templates select="//tei:text//tei:p|//tei:text//tei:head"/>                                
+                </xsl:template>
+
+
+                
+                <!-- TEI-Header Processing -->
+                
+                <xsl:template match="//tei:teiHeader">
+                                <p align="center">
+                                                
+                                                <!-- Author (only appears if not anonymous) -->
+                                                <xsl:if test="$author[not(contains(.,'anonym'))]">
+                                                                <span style="font-variant:small-caps;font-weight:bold"><xsl:value-of select="$author"/></span><br/>                
+                                                </xsl:if>
+                                                <!-- Title -->
+                                                <span style="color:darkviolet;font-family:Times;font-weight:bold;font-style:italic;font-size:200%"><xsl:value-of select="$title-normal"/></span><br/>
+                                                <!-- Scientific editor(s) -->
+                                                Edition par <xsl:apply-templates select="//tei:titleStmt/tei:editor[@role='editor']"/><br/>
+                                                Avec la collaboration de <xsl:apply-templates select="//tei:titleStmt/tei:editor[@role='associate_editor']"/><br/>
+                                                
+                                                <!-- Series Statement, Publisher, Year 	
+                                                                <xsl:apply-templates select="fileDesc/seriesStmt/title"/><br/>
+                                                                <xsl:apply-templates select="//sourceDesc//publicationStmt/pubPlace"/>,
+                                                                <xsl:apply-templates select="//sourceDesc//publicationStmt/publisher"/>,
+                                                                <xsl:apply-templates select="//sourceDesc//publicationStmt/date"/>
+                                                                
+                                                -->
+                                </p>
+                                
+                                <!-- Information on the electronic version  -->                
+                                <p align="center">_____________________________________________________<br/><br/>
+                                                <span style="font-size:75%">Edition électronique<br/>
+                                                                Dernière révision : <xsl:value-of select="//tei:revisionDesc/tei:change[1]/@when"/></span><br/>
+                                                                _____________________________________________________</p>
+                                <p align="center">Version diplomatique
+                                                <br/>_____________________________________________________</p>
+                </xsl:template>
+                              
+                <!-- Gaps without normalized @rend -->
+                <xsl:template match="tei:gap[not(@rend)]" mode="dipl">
+                                <span style="color:darkblue"><xsl:text> [...] </xsl:text></span>
+                </xsl:template>
+                
+                <xsl:template match="tei:gap[@rend][not(@rend='susp' or @rend='points' or @rend='crochets-susp')]" mode="dipl">
+                                <span style="color:orange"><xsl:text> [...] </xsl:text></span>
+                </xsl:template>
+                
+                <!-- Corrections without normalized @rend -->
+                
+                <xsl:template match="tei:choice" mode="dipl">
+                                <span title="{child::tei:corr/@type}"><xsl:apply-templates select="tei:corr" mode="dipl"/><xsl:text> </xsl:text><xsl:apply-templates select="tei:sic" mode="dipl"/></span>
+                                <xsl:if test="not(ancestor::tei:w)">
+                                                <xsl:call-template name="spacing"/>
+                                </xsl:if>
+                </xsl:template>
+                
+                <xsl:template match="tei:corr[not(@rend)]" mode="dipl">
+                                <span style="color:darkblue;background-color:yellow"><xsl:text> </xsl:text><xsl:apply-templates mode="dipl"/><xsl:text> </xsl:text></span>
+                </xsl:template>
+                
+                <!--                <xsl:template match="tei:corr[@rend][not(@rend='crochets' or @rend='chevrons')]">
+                                <span style="color:orange"> <i><xsl:value-of select="@rend"/></i><xsl:text> </xsl:text></span><xsl:apply-templates/>
+                                </xsl:template>
+                -->                
+                <xsl:template match="tei:sic" mode="dipl">(<i>sic&#xa0;:</i><xsl:text> </xsl:text><span style="background-color:pink"><xsl:apply-templates mode="dipl"/></span>)</xsl:template>
+                
+                              
+                <!--  Supplied text -->
+                
+                <xsl:template match="tei:supplied" mode="dipl">
+                                <span style="color:blue">[<xsl:apply-templates mode="dipl"/>]</span>
+                                <xsl:if test="not(ancestor::tei:w)"><xsl:call-template name="spacing"/></xsl:if>
+                </xsl:template>
+                
+                <!-- Deletions -->
+                
+                <xsl:template match="tei:del" mode="dipl">
+                                <span style="background-color:lightpink"><xsl:apply-templates mode="dipl"/></span>
+                </xsl:template>
+                
+                <xsl:template match="tei:add" mode="dipl">
+                                <span style="background-color:lightgreen"><xsl:apply-templates mode="dipl"/></span>
+                </xsl:template>
+                
+                <!-- Redundant text -->
+                
+                <xsl:template match="tei:surplus" mode="dipl">(<span style="background-color:lightpink"><xsl:apply-templates mode="dipl"/></span><xsl:text> </xsl:text><i>répété</i>)<xsl:call-template name="spacing"></xsl:call-template></xsl:template>
+                
+                <!-- Numbers -->
+                <xsl:template match="tei:num" mode="dipl">
+                                <span style="color:blue"><xsl:apply-templates mode="dipl"/></span>
+                </xsl:template>
+                                              
+                              
+                <!-- NOTES -->
+                
+                <xsl:template match="tei:note[not(@place='inline')]" mode="dipl">
+                                <xsl:variable name="note_count"><xsl:value-of select="count(preceding::tei:note[not(@place='inline')]) + 1"/></xsl:variable>
+                                <!--<a title="{.}" style="color:violet;font-size:75%" href="#note_{$note_count}" name="noteref_{$note_count}">[Note <xsl:value-of select="$note_count"/>]</a>-->
+                                <span title="{.}" style="color:violet">[<xsl:value-of select="$note_count"/>]</span>
+                                <xsl:call-template name="spacing"/>
+                </xsl:template>
+                
+                <xsl:template match="tei:note[not(@place='inline')]" mode="notes">
+                                <xsl:variable name="note_count"><xsl:value-of select="count(preceding::tei:note[not(@place='inline')]) + 1"/></xsl:variable>
+                                <p><xsl:value-of select="$note_count"/>. <a href="#noteref_{$note_count}" name="note_{$note_count}">[<xsl:value-of select="preceding::tei:milestone[@unit='column'][1]/@xml:id"/>, l. <xsl:value-of select="preceding::tei:lb[1]/@n"/>]</a><xsl:text> </xsl:text> <xsl:value-of select="."/></p>
+                </xsl:template>
+                <xsl:template match="tei:note[@place='inline']" mode="dipl">
+                                <p style="text-align:justify;text-indent:30px;padding-right:20px;padding-left:20px"><span style="color:blue;font-family:Times;font-style:italic"><xsl:value-of select="."/></span></p>
+                </xsl:template>
+                
+                
+                
+                <xsl:template match="//tei:text//tei:p|//tei:text//tei:head">
+                                <table width="100%" style="border:none">
+                                                <tr>
+                                                                <td width="10%" valign="top" style="white-space:nowrap;padding-right:10pt;line-height:18px;font-family:Arial;font-size:14px;border:none;text-align:right">
+                                                                                <xsl:if test="@n"><span style="color:gray;font-size:12px">[§ <xsl:value-of select="@n"/>] </span></xsl:if><xsl:apply-templates select="descendant::tei:lb|descendant::tei:milestone[@unit='column']|descendant::tei:hi[@rend='initiale']" mode="number"/></td>
+                                                                <td valign="top" style="white-space:nowrap;line-height:18px;font-family:Arial;font-size:14px;border:none">&#xa0;<xsl:apply-templates mode="dipl"/></td>
+                                                </tr>
+                                </table>
+                </xsl:template>
+                
+                
+<!--                <xsl:template match="tei:pb" mode="dipl">
+                                <xsl:call-template name="pb_common"/>
+                </xsl:template>
+
+                <xsl:template match="tei:cb" mode="dipl">
+                                <xsl:call-template name="cb_common"></xsl:call-template>
+                </xsl:template>
+                
+                <xsl:template match="tei:note" mode="dipl">
+                                <xsl:call-template name="note_common"></xsl:call-template>
+                </xsl:template>
+
+                <xsl:template match="tei:q" mode="dipl">
+                                <span style="background-color:lightcyan"><xsl:apply-templates mode="dipl"/></span>
+                </xsl:template>
+                
+                <xsl:template match="tei:gap" mode="dipl">
+                                <xsl:call-template name="gap_common"></xsl:call-template>
+                </xsl:template>
+-->                                
+      
+                <!-- Page breaks -->                
+                
+                <xsl:template match="//tei:pb[@ed='Pauphilet1923']" mode="dipl">
+                                (p. <xsl:value-of select="@n"/>)
+                </xsl:template>
+                
+                <xsl:template match="//tei:milestone[@unit='column'][ancestor::tei:p]" mode="dipl">
+                                <br/><br/><span style="color:darkviolet;font-family:arial;font-size:80%">&lt;<xsl:value-of select="substring-after(@xml:id,'col_')"/>&gt;</span><br/>
+                </xsl:template>
+                
+                <xsl:template match="//tei:milestone[@unit='column'][ancestor::tei:p]" mode="number">
+                                <br/>&#xa0;<br/><span style="color:darkviolet;font-family:arial;font-size:80%">&#xa0;</span><br/>
+                </xsl:template>
+                
+                <xsl:template match="//tei:milestone[@unit='column'][not(ancestor::tei:p)]">
+                                <table width="100%">
+                                                <tr>
+                                                                <td width="10%" align="right" valign="top" style="padding-right:10pt"><span style="color:darkviolet;font-family:arial;font-size:80%">&#xa0;</span></td>
+                                                                <td valign="top" style="white-space:nowrap"><span style="color:darkviolet;font-family:arial;font-size:80%">&lt;<xsl:value-of select="substring-after(@xml:id,'col_')"/>&gt;</span></td>
+                                                </tr>
+                                </table>                                
+                </xsl:template>
+                
+      
+                <xsl:template match="tei:lb" mode="dipl">
+                                <xsl:choose>
+                                                <xsl:when test="@ed='facs'"><xsl:text>-</xsl:text><br/></xsl:when>
+                                                <xsl:when test="@ed='norm' or preceding::tei:lb[1][@ed='facs']"></xsl:when>
+                                                <xsl:when test="position() = 1 and ancestor::tei:s[not(preceding-sibling::*)]"></xsl:when>
+                                                <xsl:otherwise><br/></xsl:otherwise>
+                                </xsl:choose>
+                </xsl:template>
+                
+                <xsl:template match="tei:lb" mode="number">
+                                <xsl:choose>
+                                                <xsl:when test="@ed='facs'"></xsl:when>
+                                                <xsl:when test="position() = 1 and ancestor::tei:s[not(preceding-sibling::*)]"></xsl:when>
+                                                <xsl:otherwise><br/>&#xa0;</xsl:otherwise>
+                                </xsl:choose>
+                                <xsl:if test="substring(@n, string-length(@n)) = 0 or substring(@n, string-length(@n)) = 5"><xsl:value-of select="@n"/></xsl:if>
+                </xsl:template>
+                                
+                
+                <!--<xsl:template match="//tei:lb[@ed='norm']" mode="dipl">                                
+                </xsl:template>
+                
+                <xsl:template match="//tei:lb[not(@ed)]" mode="dipl">
+                                <xsl:choose>
+                                                <xsl:when test="position()=1 and not(ancestor::tei:seg)"></xsl:when>
+                                                <xsl:when test="preceding::tei:w[1][descendant::bfm:headlb]"></xsl:when>
+                                                <xsl:when test="preceding::tei:w[1][descendant::tei:lb]"></xsl:when>
+                                                <xsl:otherwise><br/></xsl:otherwise>
+                                </xsl:choose>
+                </xsl:template>
+                
+                <xsl:template match="//tei:lb[@ed='facs']" mode="dipl">
+                                <xsl:text>-</xsl:text><br/>
+                </xsl:template>-->
+                
+                
+                
+                               
+                <xsl:template match="//tei:w" mode="dipl">
+                                <span title="{@type}" class="word" id="{@xml:id}" >
+                                                <xsl:if test="@rend='fgmt'"><xsl:attribute name="style">color:red</xsl:attribute></xsl:if>
+                                                <xsl:if test="descendant::me:dipl">
+                                                                <xsl:apply-templates select="descendant::me:dipl" mode="dipl"/>
+                                                                <xsl:if test="descendant::tei:sic and not(following-sibling::tei:w[1][descendant::tei:sic])">
+                                                                                <i><xsl:text> (sic !)</xsl:text></i>
+                                                                </xsl:if>
+                                                </xsl:if>
+                                                <xsl:call-template name="spacing"/>
+                                </span>
+                </xsl:template>
+                
+<xsl:template name="spacing">
+                <xsl:choose>
+                                <xsl:when test="following::tei:w[1][starts-with(@type, 'PON')][starts-with(normalize-space(descendant::text()[1]), ',') or starts-with(normalize-space(descendant::text()[1]), '.') or starts-with(normalize-space(descendant::text()[1]), ']')or contains(., ')')]">
+                                </xsl:when>
+                                <xsl:when test="following::node()[1][self::text()][starts-with(normalize-space(.), ',') or starts-with(normalize-space(.), '.') or starts-with(normalize-space(.), ']') or starts-with(normalize-space(.), ')')]">
+                                </xsl:when>
+                                <xsl:when test="self::tei:w[starts-with(@type, 'PON')][starts-with(normalize-space(descendant::text()[1]), '[') or starts-with(normalize-space(descendant::text()[1]), '(')]">
+                                </xsl:when>
+                                <xsl:when test="substring(., string-length(.))=$apostrophe and not(@type='PONfbl' or @type='PONpdr' or self::tei:note)">
+                                </xsl:when>
+                                <xsl:when test="position()=last() and (ancestor::tei:choice or ancestor::tei:supplied[not(@rend='multi_s')] or ancestor::tei:surplus)"></xsl:when>
+                                <xsl:when test="following-sibling::*[1][self::tei:note]"></xsl:when>
+                                <xsl:when test="following::tei:w[1][starts-with(@type, 'PON')][contains(., ':') or contains(., ';') or contains(., '!') or contains(., '?')]">
+                                                <xsl:text>&#xa0;</xsl:text>
+                                </xsl:when>
+                                <!--
+                                <xsl:when test="following::tei:w[1][starts-with(@type, 'PON')][contains(descendant::me:norm, ':') or contains(descendant::me:norm, ';') or contains(descendant::me:norm, '!')or contains(descendant::me:norm, '?')]">
+                                                <xsl:text>&#xa0;</xsl:text>
+                                </xsl:when>                                
+                                -->
+                                <xsl:when test="@rend='elision'">’</xsl:when>
+                                <!-- new 201106-03 -->
+                                <xsl:when test="@rend='fgmt'"></xsl:when>
+                                <xsl:otherwise>
+                                                <xsl:text> </xsl:text>
+                                </xsl:otherwise>
+                </xsl:choose>
+                
+</xsl:template>
+
+                
+                
+                <xsl:template match="tei:ex" mode="dipl">
+                                <xsl:choose>
+                                                <xsl:when test="@cert='high'"><span style="color:darkgreen;font-style:italic"><xsl:apply-templates mode="dipl"/></span></xsl:when>
+                                                <xsl:otherwise><span style="color:darkred;font-style:italic"><xsl:apply-templates mode="dipl"/></span></xsl:otherwise>
+                                </xsl:choose>
+                </xsl:template>
+                
+                <!-- added degl -->
+                <xsl:template match="bfm:sb" mode="dipl"><span style="color:red">_</span></xsl:template>
+                
+<!--                <xsl:template match="tei:sic" mode="dipl">
+                                <span style="color:darkred" title="sic!"><xsl:apply-templates mode="dipl"/></span>
+                </xsl:template>
+                
+                <xsl:template match="tei:subst" mode="dipl">[<xsl:apply-templates mode="dipl"/>]</xsl:template>
+                
+                <xsl:template match="tei:del" mode="dipl">
+                                <span style="color:red;text-decoration:line-through"><xsl:apply-templates mode="dipl"/></span>
+                </xsl:template>
+                
+                <xsl:template match="tei:add[not(@seq)]" mode="dipl">
+                                <span style="color:blue;text-decoration:underline"><xsl:apply-templates mode="dipl"/></span>
+                </xsl:template>
+-->                
+                <xsl:template match="tei:add[@seq]" mode="dipl">
+                                <span style="color:blue"><sup>&lt;<xsl:value-of select="@seq"/></sup><xsl:apply-templates mode="dipl"/><sup><xsl:value-of select="@seq"/>&gt;</sup></span>
+                </xsl:template>
+                
+                <xsl:template match="tei:unclear" mode="dipl">
+                                <span style="background-color:lightgrey"><xsl:apply-templates mode="dipl"/></span>
+                </xsl:template>
+                <!-- font-size:xx-large enlevé -->
+                <xsl:template match="tei:hi[@rend='initiale']" mode="dipl">
+                                <span style="font-weight:bold;font-size:large"><xsl:apply-templates mode="dipl"/></span>
+                </xsl:template>
+
+                <xsl:template match="tei:hi[@rend='initiale']" mode="number">
+                                <span style="font-weight:bold;font-size:large">&#xa0;</span>
+                </xsl:template>
+                
+                <xsl:template match="//tei:hi[@rend='sup']" mode="dipl">
+                                <sup><xsl:apply-templates mode="dipl"/></sup>
+                </xsl:template>
+                
+                <!-- Discours direct -->
+                                <xsl:template match="tei:q[ancestor::tei:q[ancestor::tei:q]]" mode="dipl">
+                                <span style="background-color:darkcyan"> <xsl:apply-templates mode="dipl"/></span>
+                </xsl:template>
+                
+                <xsl:template match="tei:q[ancestor::tei:q][not(ancestor::tei:q[ancestor::tei:q])]" mode="dipl">
+                                <span style="background-color:cyan"> <xsl:apply-templates mode="dipl"/></span>
+                </xsl:template>
+                
+                <xsl:template match="tei:q[not(ancestor::tei:q)]" mode="dipl">
+                                <span style="background-color:lightcyan"> <xsl:apply-templates mode="dipl"/></span>
+                </xsl:template>
+                
+                <!--<xsl:template match="bfm:sb" mode="dipl"><span style="color:violet">_</span></xsl:template>-->
+
+                
+                
+                <!-- 
+
+
+<xsl:template match="tei:name">
+	<xsl:value-of select="@reg"/>
+</xsl:template>
+
+                -->
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/org/txm/importer/graal/xsl/qgraal_dipl.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/importer/graal/xsl/test.xsl
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/graal/xsl/test.xsl	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/graal/xsl/test.xsl	(revision 258)
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" xmlns:tei="http://www.tei-c.org/ns/1.0"> <xsl:output encoding="UTF-8" indent="yes" method="html"/>
+    <xsl:output method="html" encoding="UTF-8" version="4.0" indent="yes"/>
+    <xsl:strip-space elements="*"/>
+
+    <xsl:template match="/">
+        <xsl:apply-templates select="//tei:text"/>
+    </xsl:template>
+
+
+    <xsl:template match="//tei:body/tei:div">
+        <br/>
+        <span style="font-family:Times;color:indigo">[<i>
+                <xsl:value-of select="@type"/>
+            </i>&#xa0;<xsl:value-of select="@n"/>]</span>
+        <xsl:apply-templates/>
+    </xsl:template>
+
+    <xsl:template match="//tei:body/tei:div/tei:div">
+        <br/>
+        <span style="font-family:Times;color:indigo">[<i>
+                <xsl:value-of select="@type"/>
+            </i>&#xa0;<xsl:value-of select="@n"/>]</span>
+        <br/>
+        <xsl:apply-templates/>
+    </xsl:template>
+
+    <xsl:template match="tei:head">
+        <span style="font-family:Arial; color:darkred">
+            <xsl:apply-templates/>
+        </span>
+        <br/>
+    </xsl:template>
+
+    <xsl:template match="//tei:p">
+        <p>
+            <xsl:if test="@n"> [ § <xsl:value-of select="@n"/>]&#xa0; </xsl:if>
+            <xsl:apply-templates/>
+        </p>
+    </xsl:template>
+
+    <xsl:template match="//tei:lb">
+        <xsl:choose>
+            <xsl:when test="position()=1 and not(ancestor::tei:seg)"/>
+            <xsl:otherwise>
+                <br/>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+
+    <xsl:template match="tei:q" mode="norm">
+        <span style="background-color:khaki">
+            <xsl:apply-templates/>
+        </span>
+    </xsl:template>
+    <xsl:template match="//tei:w">
+        <span class="word" id="{@xml:id}" title="{@type}">
+            <xsl:choose>
+                <xsl:when test="@type[starts-with(., 'PON')]">
+                    <xsl:apply-templates/>
+                </xsl:when>
+                <xsl:otherwise> &#xa0;<xsl:apply-templates/>
+                </xsl:otherwise>
+            </xsl:choose>
+        </span>
+    </xsl:template>
+    <xsl:template match="tei:supplied"> [<xsl:apply-templates/>] </xsl:template>
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/src/groovy/org/txm/importer/graal/xsl/test.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/importer/graal/xsl/mdv_norm.xsl
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/graal/xsl/mdv_norm.xsl	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/graal/xsl/mdv_norm.xsl	(revision 258)
@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- This is a stylesheet that gives a "normalized" presentation of old French manuscript transcriptions
+	- abbreviations are resolved;
+	- agglutinations and deglutinations are not marked (word limits 
+	  are "normalized");
+                                                           - punctuation is normalized as it is in the edition; 
+	- direct speech is marked with quotation marks and darkblue color;
+	- uncertain readings are not marked;
+	- text deleted in the original is not visualized;
+	- corrections are marked with darkred color;
+                                                           - notes are rendered with [*] sign in the text body; the text of the note
+                                                             appears on "mouse-over" and is reproduced in the end.
+-->
+
+
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" xmlns:tei="http://www.tei-c.org/ns/1.0" xmlns:me="http://www.menota.org/ns/1.0" xmlns:bfm="http://bfm.ens-lsh.fr/ns/1.0">
+                <xsl:param name="form">normalisée</xsl:param>
+
+                <xsl:variable name="mode">facs</xsl:variable>
+
+                <xsl:output method="html" encoding="UTF-8" version="4.0" indent="yes"/>
+
+                <xsl:strip-space elements="*"/>
+
+                <!--            <xsl:variable name="title-formal" select="//fileDesc/titleStmt/title[@type='formal']"/>
+                
+                <xsl:variable name="title-normal" select="//fileDesc/titleStmt/title[@type='normal']"/>
+                
+                <xsl:variable name="title-ref" select="//fileDesc/titleStmt/title[@type='reference']"/>
+                
+                <xsl:variable name="author" select="//titleStmt/author"/>
+ -->
+
+                <xsl:include href="mdv_common.xsl"/>
+
+                <xsl:template match="//tei:p|//tei:head">
+                                <p>
+                                                <xsl:if test="@n"> [ § <xsl:value-of select="@n"
+                                                  />]&#xa0; </xsl:if>
+                                                <xsl:apply-templates mode="norm"/>
+                                </p>
+                </xsl:template>
+
+                <xsl:template match="tei:pb" mode="norm">
+                                <xsl:call-template name="pb_common"/>
+                </xsl:template>
+
+                <xsl:template match="tei:cb" mode="norm">
+                                <xsl:call-template name="cb_common"/>
+                </xsl:template>
+
+                <xsl:template match="tei:note" mode="norm">
+                                <xsl:call-template name="note_common"/>
+                </xsl:template>
+
+                <xsl:template match="tei:q" mode="norm">
+                                <span style="background-color:khaki">
+                                                <xsl:apply-templates mode="norm"/>
+                                </span>
+                </xsl:template>
+
+                <xsl:template match="tei:gap" mode="norm">
+                                <xsl:call-template name="gap_common"/>
+                </xsl:template>
+
+                <xsl:template match="//tei:lb" mode="norm">
+                                <xsl:choose>
+                                                <xsl:when
+                                                  test="position()=1 and not(ancestor::tei:seg)"/>
+                                                <xsl:otherwise>
+                                                  <br/>
+                                                </xsl:otherwise>
+                                </xsl:choose>
+                </xsl:template>
+
+                <xsl:template match="//tei:w" mode="norm">
+                                <span class="word" id="{@xml:id}" title="{@type}">
+                                                <xsl:if
+                                                  test="starts-with(.,':') or starts-with(.,'!') or starts-with(.,'?') or starts-with(.,';')"
+                                                  >&#xa0;</xsl:if>
+                                                <xsl:apply-templates select="descendant::me:norm"
+                                                  mode="norm"/>
+                                                <xsl:choose>
+                                                  <xsl:when
+                                                  test="following::*[1][self::bfm:punct][starts-with(., ',') or starts-with(., '.') or starts-with(., ']') or starts-with(., ')') or starts-with(.,':') or starts-with(.,'!') or starts-with(.,'?') or starts-with(.,';')]"/>
+                                                  <xsl:when
+                                                  test="child::me:norm[string-length(.) = 0]"/>
+                                                  <xsl:when test="@bfm:aggl='elision'">'</xsl:when>
+                                                  <xsl:otherwise>
+                                                  <xsl:text> </xsl:text>
+                                                  </xsl:otherwise>
+                                                </xsl:choose>
+                                </span>
+                </xsl:template>
+
+                <xsl:template match="tei:sic" mode="norm">
+                                <span style="text-decoration:line-through;color:red">
+                                                <xsl:apply-templates mode="norm"/>
+                                </span>
+                </xsl:template>
+
+                <xsl:template match="tei:del" mode="norm"> </xsl:template>
+
+
+                <xsl:template match="//tei:hi[@rend='sup']" mode="norm">
+                                <sup>
+                                                <xsl:apply-templates mode="norm"/>
+                                </sup>
+                </xsl:template>
+
+
+
+                <!-- 
+
+
+<xsl:template match="del">
+
+</xsl:template>
+
+
+
+<xsl:template match="name">
+	<xsl:value-of select="@reg"/>
+</xsl:template>
+
+                -->
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/src/groovy/org/txm/importer/graal/xsl/mdv_norm.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/importer/graal/xsl/mdv_facs.xsl
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/graal/xsl/mdv_facs.xsl	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/graal/xsl/mdv_facs.xsl	(revision 258)
@@ -0,0 +1,235 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- This is a "facsimilary" stylesheet for Old French XML transcriptions:
+	- most abbreviations and medieval letter variants are rendered with the 
+                                                             corresponding Unicode and MUFI characters. "Andron Scriptor Web"
+                                                             font should be installed for correct visualization;
+	- agglutinations and deglutinations are presented "as they are" in
+	  the original;
+	- direct speech is marked with darkblue color;
+	- uncertain readings are marked with grey background color;
+	- text deleted in the original is marked with rose background color;
+	- notes are rendered with [*] sign in the text body; the text of the note
+                                                             appears on "mouse-over" and is reproduced in the end.
+-->
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" xmlns:tei="http://www.tei-c.org/ns/1.0" xmlns:me="http://www.menota.org/ns/1.0" xmlns:bfm="http://bfm.ens-lsh.fr/ns/1.0">
+                <xsl:param name="form">facsimilaire</xsl:param>
+                <xsl:variable name="mode">facs</xsl:variable>
+
+                <xsl:output method="html" encoding="UTF-8" version="4.0" indent="yes"/>
+
+                <xsl:strip-space elements="*"/>
+
+                <!--                <xsl:variable name="title-formal" select="//fileDesc/titleStmt/title[@type='formal']"/>
+                                                
+                                                <xsl:variable name="title-normal" select="//fileDesc/titleStmt/title[@type='normal']"/>
+                                                
+                                                <xsl:variable name="title-ref" select="//fileDesc/titleStmt/title[@type='reference']"/>
+                                                
+                                                <xsl:variable name="author" select="//titleStmt/author"/>
+                                -->
+
+                <xsl:include href="mdv_common.xsl"/>
+
+                <xsl:template match="//tei:p|//tei:head">
+                                <p>
+                                                <xsl:if test="@n"> [ § <xsl:value-of select="@n"
+                                                  />]&#xa0; </xsl:if>
+                                                <xsl:apply-templates mode="facs"/>
+                                </p>
+                </xsl:template>
+
+                <xsl:template match="tei:pb" mode="facs">
+                                <xsl:call-template name="pb_common"/>
+                </xsl:template>
+
+                <xsl:template match="tei:cb" mode="facs">
+                                <xsl:call-template name="cb_common"/>
+                </xsl:template>
+
+                <xsl:template match="tei:note" mode="facs">
+                                <xsl:call-template name="note_common"/>
+                </xsl:template>
+
+                <xsl:template match="tei:q" mode="facs">
+                                <span style="background-color:khaki">
+                                                <xsl:apply-templates mode="facs"/>
+                                </span>
+                </xsl:template>
+
+                <xsl:template match="tei:gap" mode="facs">
+                                <xsl:call-template name="gap_common"/>
+                </xsl:template>
+
+
+                <xsl:template match="//tei:lb" mode="facs">
+                                <xsl:choose>
+                                                <xsl:when
+                                                  test="position()=1 and not(ancestor::tei:seg)"/>
+                                                <xsl:when test="@ed='norm'"/>
+                                                <xsl:when
+                                                  test="preceding::tei:w[1][descendant::bfm:headlb]"/>
+                                                <xsl:when
+                                                  test="preceding::tei:w[1][descendant::tei:lb]"/>
+                                                <xsl:otherwise>
+                                                  <br/>
+                                                </xsl:otherwise>
+                                </xsl:choose>
+                </xsl:template>
+
+                <xsl:template match="//bfm:headlb" mode="facs">
+                                <br/>
+                </xsl:template>
+
+                <xsl:template match="//tei:w|//bfm:punct" mode="facs">
+                                <span style="font-family:Andron Scriptor Web" class="word"
+                                                title="{@type}" id="{@xml:id}">
+                                                <xsl:apply-templates select="descendant::me:facs"
+                                                  mode="facs"/>
+                                </span>
+                                <xsl:choose>
+                                                <xsl:when test="@bfm:aggl"/>
+                                                <xsl:otherwise>
+                                                  <xsl:text> </xsl:text>
+                                                </xsl:otherwise>
+                                </xsl:choose>
+                </xsl:template>
+
+                <xsl:template match="text()[ancestor::me:facs]" mode="facs">
+                                <xsl:value-of select="translate(., 'i', '&#x0131;')"/>
+                </xsl:template>
+
+                <xsl:template match="bfm:mdvAbbr" mode="facs">
+                                <span style="color:darkgreen">
+                                                <xsl:apply-templates mode="facs"/>
+                                </span>
+                </xsl:template>
+
+                <xsl:template match="tei:sic" mode="facs">
+                                <span style="color:darkred" title="sic!">
+                                                <xsl:apply-templates mode="facs"/>
+                                </span>
+                </xsl:template>
+
+                <xsl:template match="tei:subst" mode="facs"> [<xsl:choose>
+                                                <xsl:when
+                                                  test="child::tei:del[@rend='line-through']">
+                                                  <span
+                                                  style="color:red;text-decoration:line-through">
+                                                  <xsl:value-of select="child::tei:del"/>
+                                                  </span> \ <span
+                                                  style="color:blue;text-decoration:underline">
+                                                  <xsl:value-of select="child::tei:add"/>
+                                                  </span>
+                                                </xsl:when>
+                                                <xsl:when test="child::tei:del[@rend='dotobl']">
+                                                  <span style="color:red">
+                                                  <xsl:value-of select="child::tei:del"/>
+                                                  </span> \ <span
+                                                  style="color:blue;text-decoration:underline">
+                                                  <xsl:value-of select="child::tei:add"/>
+                                                  </span>
+                                                </xsl:when>
+                                                <xsl:when test="child::tei:del[@rend='transform']">
+                                                  <span
+                                                  style="color:red;text-decoration:line-through">
+                                                  <xsl:value-of select="child::tei:del"/>
+                                                  </span> &gt; <span
+                                                  style="color:blue;text-decoration:underline">
+                                                  <xsl:value-of select="child::tei:add"/>
+                                                  </span>
+                                                </xsl:when>
+                                                <xsl:when
+                                                  test="child::tei:del[@rend='unmarked'] and child::tei:add[@place='overwrite']">
+                                                  <span
+                                                  style="color:red;text-decoration:line-through">
+                                                  <xsl:value-of select="child::tei:del"/>
+                                                  </span> + <span
+                                                  style="color:blue;text-decoration:underline">
+                                                  <xsl:value-of select="child::tei:add"/>
+                                                  </span>
+                                                </xsl:when>
+                                                <xsl:when
+                                                  test="child::tei:del[@rend='unmarked'] and child::tei:add[contains(@place,'linear')]">
+                                                  <span
+                                                  style="color:red;text-decoration:line-through">
+                                                  <xsl:value-of select="child::tei:del"/>
+                                                  </span> + \ <span
+                                                  style="color:blue;text-decoration:underline">
+                                                  <xsl:value-of select="child::tei:add"/>
+                                                  </span>
+                                                </xsl:when>
+                                                <xsl:otherwise>
+                                                  <span
+                                                  style="color:red;text-decoration:line-through">
+                                                  <xsl:value-of select="child::tei:del"/>
+                                                  </span> / <span
+                                                  style="color:blue;text-decoration:underline">
+                                                  <xsl:value-of select="child::tei:add"/>
+                                                  </span>
+                                                </xsl:otherwise>
+                                </xsl:choose>] </xsl:template>
+
+                <xsl:template match="tei:add" mode="facs">
+                                <span style="color:blue;text-decoration:underline">
+                                                <xsl:choose>
+                                                  <xsl:when
+                                                  test="@place='interlinear' or @place='supralinear'"
+                                                  >\<xsl:apply-templates mode="facs"/>/</xsl:when>
+                                                  <xsl:when test="starts-with(@place,'margin')"
+                                                  >\\<xsl:apply-templates mode="facs"/>//</xsl:when>
+                                                  <xsl:otherwise>
+                                                  <xsl:apply-templates mode="facs"/>
+                                                  </xsl:otherwise>
+                                                </xsl:choose>
+                                </span>
+                </xsl:template>
+
+                <xsl:template match="tei:del" mode="facs">
+                                <xsl:choose>
+                                                <xsl:when test="@rend='dotbl'">
+                                                  <span style="color:red">
+                                                  <xsl:apply-templates mode="facs"/>
+                                                  </span>
+                                                </xsl:when>
+                                                <xsl:otherwise>
+                                                  <span
+                                                  style="text-decoration:line-through;color:red">
+                                                  <xsl:apply-templates mode="facs"/>
+                                                  </span>
+                                                </xsl:otherwise>
+                                </xsl:choose>
+                </xsl:template>
+
+                <xsl:template match="tei:unclear" mode="facs">
+                                <span style="background-color:lightgrey">
+                                                <xsl:apply-templates mode="facs"/>
+                                </span>
+                </xsl:template>
+
+                <xsl:template match="bfm:lettrine" mode="facs">
+                                <font color="{@color}" size="{@size}00%" style="font-weight:bold">
+                                                <xsl:apply-templates mode="facs"/>
+                                </font>
+                </xsl:template>
+
+                <xsl:template match="bfm:sb" mode="facs">
+                                <xsl:text>&#xa0;</xsl:text>
+                </xsl:template>
+
+                <xsl:template match="//tei:hi[@rend='sup']" mode="facs">
+                                <sup>
+                                                <xsl:apply-templates mode="facs"/>
+                                </sup>
+                </xsl:template>
+
+
+                <!-- 
+                                                
+                                                
+                                                <xsl:template match="tei:name">
+                                                <xsl:value-of select="@reg"/>
+                                                </xsl:template>
+                                                
+                                -->
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/src/groovy/org/txm/importer/graal/xsl/mdv_facs.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/importer/graal/GraalApplyXsl.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/graal/GraalApplyXsl.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/graal/GraalApplyXsl.groovy	(revision 258)
@@ -0,0 +1,122 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2014-09-15 10:51:15 +0200 (Mon, 15 Sep 2014) $
+// $LastChangedRevision: 2836 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer.graal
+
+import javax.xml.stream.*;
+import java.net.URL;
+import java.lang.Boolean
+import javax.xml.transform.TransformerFactory
+import javax.xml.transform.stream.StreamResult
+import javax.xml.transform.stream.StreamSource
+import java.util.Map
+
+// TODO: Auto-generated Javadoc
+/** The trans data. @author ayepdieu previous version of the script ApplyXsl */
+public class GraalApplyXsl{
+	private def transData;
+	
+	/** The factory. */
+	private def factory;
+	
+	/** The source. */
+	private def source;
+	
+	/** The transformer. */
+	private def transformer;
+	
+	/**
+	 * Instantiates a new graal apply xsl.
+	 *
+	 * @param urlXsl the url xsl
+	 */
+	public GraalApplyXsl(URL urlXsl){
+		try 
+		{
+			FileInputStream inputStream = new FileInputStream(new File(urlXsl.getFile()));
+			factory = new net.sf.saxon.TransformerFactoryImpl();
+			source = new StreamSource(inputStream)
+			source.setSystemId(urlXsl.getPath());
+			transformer = factory.newTransformer(source)
+		} catch (XMLStreamException ex) {
+			System.out.println(ex);
+		}catch (IOException ex) {
+			System.out.println("IOException while parsing ");
+		}
+	}
+	
+	/**
+	 * Sets the params.
+	 *
+	 * @param name the name
+	 * @param value the value
+	 */
+	public void setParams(String name, int value) {
+	    transformer.setParameter(name, value);
+	}
+	
+	/**
+	 * Sets the params.
+	 *
+	 * @param name the name
+	 * @param value the value
+	 */
+	public void setParams(String name, String value) {
+	    transformer.setParameter(name, value);
+	}
+	
+	/**
+	 * Apply xsl.
+	 *
+	 * @param urlXml the url xml
+	 * @param dirPathName the dir path name
+	 * @param fileName the file name
+	 * @return true, if successful
+	 */
+	public boolean ApplyXsl(URL urlXml, String dirPathName, String fileName) {
+		FileInputStream inputData = new FileInputStream(new File(urlXml.getFile()));
+		def output = new File(dirPathName, fileName)
+
+		transformer.transform( new StreamSource(inputData), new StreamResult(output) )
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args) 
+	{
+		String sortie = "Page-test"
+		for (int index = 0; index < 1; index++) {
+			GraalApplyXsl DecTxt = new GraalApplyXsl(new URL("file:///home/ayepdieu/srcQuete/Sources/breakByMilestone.xsl"));
+			DecTxt.setParams("pbval1", index + 1);
+			DecTxt.setParams("pbval2", index + 2);
+			DecTxt.ApplyXsl(new URL("file:///home/ayepdieu/srcQuete/Sources/qgraal_cm_2009-07-d.xml"), "/home/ayepdieu/srcQuete/Decoupe", sortie + "_" + (index+ 1) + ".xml");
+		}
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/graal/GraalImportCqp.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/graal/GraalImportCqp.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/graal/GraalImportCqp.groovy	(revision 258)
@@ -0,0 +1,397 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2017-01-24 18:11:42 +0100 (Tue, 24 Jan 2017) $
+// $LastChangedRevision: 3400 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer.graal
+
+import javax.xml.stream.*;
+import java.net.URL;
+import java.lang.Boolean
+import java.lang.System
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class GraalImportCqp.
+ *
+ * @author ayepdieu
+ * parse graal xml file to build the wtc the next step is to call importInCWB script
+ */
+public class GraalImportCqp{
+	
+	/** The input data. */
+	private def inputData;
+	
+	/** The factory. */
+	private def factory;
+	
+	/** The parser. */
+	private def parser;
+	
+	/** The dir. */
+	private def dir;
+	
+	/** The output. */
+	private def output;
+	
+	
+	/**
+	 * initialize.
+	 *
+	 * @param url the url to the xmlfile to transform
+	 */
+	public GraalImportCqp(URL url){
+		try {
+			inputData = url.openStream();
+			factory = XMLInputFactory.newInstance();
+			parser = factory.createXMLStreamReader(inputData);
+			//System.out.println "ouverture du document en entree reussi";
+		} catch (XMLStreamException ex) {
+			System.out.println(ex);
+		}catch (IOException ex) {
+			System.out.println("IOException while parsing ");
+		}
+	}
+	
+	/**
+	 * create the output file writer.
+	 *
+	 * @param dirPathName the dir path name
+	 * @param fileName the file name
+	 * @return true, if successful
+	 */
+	private boolean createOutput(String dirPathName, String fileName){
+		try {
+			dir = new File(dirPathName)
+			output = new OutputStreamWriter(new FileOutputStream(new File(dir, fileName)) , "UTF-8")
+			//System.out.println "ouverture du document en sortie reussi";
+			return true;
+		} catch (Exception e) {
+			System.out.println(e.getLocalizedMessage());
+			return false;
+		}
+	}
+	
+	/**
+	 * process !!!.
+	 *
+	 * @param dirPathName the output directory
+	 * @param fileName the outfile name
+	 * @return true, if successful
+	 */
+	public boolean transfomFileWtc(String dirPathName, String fileName){
+		if(findBody() && createOutput(dirPathName, fileName)){
+			String idColumn;
+			int idParagraph = 0;
+			int idSentence = 0;
+			int idLine = 0;
+			int q_id =0;
+			String idLinesuiv;
+			String idWord;
+			boolean flagVersion = false;
+			boolean flagWord = false;
+			boolean flagNorm = false;
+			boolean flagDipl = false;
+			boolean flagFacs = false;
+			//boolean flagSupplied = false;
+			int levelSupplied = 0;
+			int levelq = 0;
+			String typeWord = "";
+			String vWordDipl = "";
+			String vWordFacs = "";
+			String vWordNorm = "";
+			try {
+				for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+					switch (event) {
+						case XMLStreamConstants.START_ELEMENT:
+							switch (parser.getLocalName()) {
+								case "milestone":
+									if (parser.getAttributeValue(0) == "column") {
+										idColumn = parser.getAttributeValue(1);
+										idColumn = idColumn.substring(4);
+									}
+								break;
+								case "p":
+									idParagraph = parser.getAttributeValue(0).toInteger();
+									output.write "<p n=" + idParagraph +">\n";
+									//if(idParagraph < 13 && idParagraph > 4){
+										flagVersion = true;
+									/*}else{
+										flagVersion = false;
+									}*/
+								break;
+								case "s":
+//									String no = parser.getAttributeValue(0);
+//									if(no == null)
+//										idSentence = -1;
+//									else
+//										idSentence = no.toInteger();
+								idSentence++;
+									output.write "<s n=" + idSentence + " id=\"" + parser.getAttributeValue(1) + "\">\n";
+								break;
+								case "q":
+									output.write "<q n=\""+q_id+"\">\n";
+									q_id++;
+									//new
+									levelq = levelq + 1;
+								break;
+								
+								case "supplied":
+								levelSupplied++;
+								break;								
+								
+								case "lb":
+									idLinesuiv = parser.getAttributeValue(0);
+									if(!("facs" == idLinesuiv)){
+										idLine = idLinesuiv.toInteger();
+									}
+								break;
+								case "w":
+									typeWord = parser.getAttributeValue(0);
+									if(flagVersion  && null != parser.getAttributeValue(2)){
+										idWord = parser.getAttributeValue(2);
+									}else{
+										idWord = parser.getAttributeValue(1);
+									}
+									flagWord = true;
+									flagNorm = true;
+								break;
+								case "norm":
+									flagNorm = true;
+								break;
+								case "dipl":
+									flagDipl = true;
+								break;
+								case "facs":
+									flagFacs = true;
+								break;
+							}
+						break;
+						
+						case XMLStreamConstants.END_ELEMENT:
+							switch (parser.getLocalName()) {
+								case "p":
+									output.write "</p>\n";
+								break;
+								case "s":
+									output.write "</s>\n";
+								break;
+								case "q":
+									output.write "</q>\n";
+									levelq = levelq - 1;
+								break;
+								case "supplied":
+									levelSupplied = levelSupplied - 1;
+								break;
+								case "w":
+									output.write vWordNorm + "\t" + typeWord + "\t" + levelq + "\t" + levelSupplied.toString().substring(0,1) + "\t" + idColumn + "\t" + idLine + "\t" + idWord + "\t" + vWordDipl + "\t" + vWordFacs + "\n";
+									vWordNorm = "";
+									vWordDipl = "";
+									vWordFacs = "";
+									flagNorm = false;
+									flagDipl = false;
+									flagFacs = false;
+									flagWord = false; 
+								break;
+								case "norm":
+									flagNorm = false;
+								break;
+								case "dipl":
+									flagDipl = false;
+								break;
+								case "facs":
+									flagFacs = false;
+								break;
+							}
+						break;
+						
+						case XMLStreamConstants.CHARACTERS:
+							if(flagWord){
+								vWordNorm.trim();
+								if(flagNorm){
+									vWordNorm += parser.getText().trim();
+								}else if(flagDipl){
+									vWordDipl += parser.getText().trim();
+								}else if(flagFacs){
+									vWordFacs += parser.getText().trim();
+								}
+							}
+						break;
+					}
+				}
+				output.close();
+				parser.close();
+			}
+			catch (Exception ex) {
+				System.out.println("Xml Location: "+parser.getLocation());
+				System.out.println(ex);
+			}
+			
+		}
+	}
+	
+	/**
+	 * a simplier version of transform file to process a non-facette xml.
+	 *
+	 * @param dirPathName the dir path name
+	 * @param fileName the file name
+	 * @return true, if successful
+	 */
+	public boolean transfomFileWtcBrut(String dirPathName, String fileName){
+		if(findBody() && createOutput(dirPathName, fileName)){
+			String idColumn = "";
+			int idParagraph = 0;
+			int idSentence = 0;
+			String idWord;
+			boolean flagWord = false;
+			boolean flagCont = true;
+			boolean flagStart = true;
+			String typeWord = "";
+			String vWord = "";
+			try {
+				for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT && flagCont; event = parser.next()) {
+					switch (event) {
+						case XMLStreamConstants.START_ELEMENT:
+							//System.out.println parser.getLocalName();
+							switch (parser.getLocalName()) {
+								case "milestone":
+									if (parser.getAttributeValue(0) == "p") {
+										idParagraph = parser.getAttributeValue(1).toInteger();
+										if(flagStart){
+											output.write "<p n=" + idParagraph + ">\n";
+										}else{
+											output.write "</p>\n<p n=" + idParagraph + ">\n";
+										}
+									}else if(parser.getAttributeValue(0) == "column"){
+										idColumn = parser.getAttributeValue(1);
+										idColumn = idColumn.substring(4);
+									}else if (parser.getAttributeValue(0) != "s"){
+										idColumn = "";
+									}
+								break;
+								case "s":
+									idSentence = parser.getAttributeValue(0).toInteger();
+									output.write "<s n=" + idSentence + ">\n";
+								break;
+								case "w":
+									if(null != parser.getAttributeValue(1)){
+										typeWord = parser.getAttributeValue(0);
+										idWord = parser.getAttributeValue(1);
+									}else{
+										idWord = parser.getAttributeValue(0);
+										typeWord = "";
+									}
+									flagWord = true;
+								break;
+								case "div":
+									if (parser.getAttributeValue(0) == "note") {
+										output.write "</s>\n</p>";
+										flagCont = false;
+									}
+								break;
+							}
+						break;
+						
+						case XMLStreamConstants.END_ELEMENT:
+							switch (parser.getLocalName()) {
+								case "w":
+									output.write vWord + "\t" + typeWord + "\t" + idWord + "\t" + idColumn + "\n";
+									flagWord = false; 
+								break;
+							}
+						break;
+						case "s":
+							output.write "</s>\n";
+						break;						
+						case XMLStreamConstants.CHARACTERS:
+							if(flagWord){
+								vWord = parser.getText().trim();
+							}
+						break;
+					}
+				}
+				output.close();
+				parser.close();
+			}
+			catch (XMLStreamException ex) {
+				System.out.println(ex);
+			}
+			catch (IOException ex) {
+				System.out.println("IOException while parsing " + input);
+			}
+		}
+	}
+	
+	/**
+	 * test if the current element if the body.
+	 *
+	 * @param name the name
+	 * @return true, if is body
+	 */
+	private static boolean isBody(String name) {
+		if (name.equals("body")) return true;
+	}
+	
+	/**
+	 * bring the parser to the body element.
+	 *
+	 * @return true, if successful
+	 */
+	private boolean findBody(){
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()){
+			if(event == XMLStreamConstants.START_ELEMENT){
+				if (isBody(parser.getLocalName())){
+					return true;
+				}
+			}
+		}
+		return false;
+	} 
+	
+	/**
+	 * no args needed.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args) {
+	 	def inDir = "/home/txm/src";
+	 	def outDir = "/home/txm/";
+	 	def inFile = "qgraal_cm_2009-07-d.xml";
+		System.out.println "file://"+ inDir + "/" + inFile;
+
+		if (args.length == 0) {
+			GraalImportCqp traitTxt = new GraalImportCqp(new URL("file://"+ inDir + "/" + inFile));
+			traitTxt.transfomFileWtc("/home/ayepdieu/srcQuete/result", "graal.wtc");
+		}else if(args.length == 3){
+			GraalImportCqp traitTxt = new GraalImportCqp(new URL(args[0]));
+			traitTxt.transfomFileWtc(args[1], args[2]);
+		}else{
+			System.err.println("Usage: java XHTMLOutliner url" );
+			return;
+		}
+		return
+	}
+	
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/graal/PersonalNamespaceContext.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/graal/PersonalNamespaceContext.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/graal/PersonalNamespaceContext.groovy	(revision 258)
@@ -0,0 +1,118 @@
+// 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
+// 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.
+//
+//
+//
+// $LastChangedDate: 2016-02-01 09:53:38 +0100 (Mon, 01 Feb 2016) $
+// $LastChangedRevision: 3101 $
+// $LastChangedBy: mdecorde $
+//
+package org.txm.importer.graal
+
+import java.util.Iterator;
+
+import javax.xml.*;
+import javax.xml.namespace.NamespaceContext;
+
+import org.xml.sax.helpers.NamespaceSupport;
+
+/**
+ * Instantiates a new personal namespace context.
+ *
+ * @author ayepdieu, mdecorde
+ * 
+ * do correpondances between namespace and uri
+ */
+public class PersonalNamespaceContext implements NamespaceContext {
+	
+	public static HashMap<String, String> adress2name = new HashMap<String, String>();
+	public static HashMap<String, String> name2adress = new HashMap<String, String>();
+	static {
+		addNamespace("tei", "http://www.tei-c.org/ns/1.0")
+		addNamespace("me", "http://www.menota.org/ns/1.0")
+		addNamespace("bfm", "http://bfm.ens-lsh.fr/ns/1.0")
+		addNamespace("txm", "http://textometrie.org/1.0")
+		addNamespace("xi", "http://www.w3.org/2001/XInclude")
+		addNamespace("fn", "http://www.w3.org/2005/xpath-functions")
+		addNamespace("xhtml", "http://www.w3.org/1999/xhtml")
+		addNamespace("svg", "http://www.w3.org/2000/svg")
+		addNamespace(XMLConstants.XML_NS_PREFIX, XMLConstants.XML_NS_URI)
+	}
+	/*
+	String TEINS = "http://www.tei-c.org/ns/1.0"
+	String MENS = "http://www.menota.org/ns/1.0";
+	String BFMNS = "http://bfm.ens-lsh.fr/ns/1.0";
+	String TXMNS = "http://textometrie.org/1.0";
+	String XINS = "http://www.w3.org/2001/XInclude";
+	String FNNS = "http://www.w3.org/2005/xpath-functions";
+	String XHTMLNS = "http://www.w3.org/1999/xhtml";
+	String SVGNS = "http://www.w3.org/2000/svg"
+	String XMLNS = "http://www.w3.org/XML/1998/namespace"
+
+	String TEINSNAME = "tei"
+	String MENSNAME = "me";
+	String BFMNSNAME = "bfm";
+	String TXMNSNAME = "txm";
+	String XINSNAME = "xi";
+	String FNNSNAME = "fn";
+	String XHTMLNSNAME = "xhtml";
+	String SVGNSNAME = "svg"
+*/
+	public PersonalNamespaceContext() {
+		super();
+	}
+
+	public static void addNamespace(String name, String address) {
+		adress2name.put(address, name);
+		name2adress.put(name, address);
+	}
+	
+	/* (non-Javadoc)
+	 * @see javax.xml.namespace.NamespaceContext#getNamespaceURI(java.lang.String)
+	 */
+	public String getNamespaceURI(String prefix) {
+		if (!name2adress.containsKey(prefix)) return XMLConstants.NULL_NS_URI;
+		return name2adress.get(prefix)
+	}
+
+	private static String NONE = "";
+	/**
+	 * 
+	 * @param uri the uri
+	 * @return the prefix
+	 */
+	public String getPrefix(String uri) {
+		
+		if (uri == null) return NONE;
+		if (!adress2name.containsKey(uri)) return NONE;
+		return adress2name.get(uri)
+	}
+
+	/**
+	 * This method isn't necessary for XPath processing either.
+	 *
+	 * @param uri the uri
+	 * @return the prefixes
+	 */
+	public Iterator getPrefixes(String uri) {
+		throw new UnsupportedOperationException();
+	}
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/importer/graal/package.html
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/graal/package.html	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/graal/package.html	(revision 258)
@@ -0,0 +1,4 @@
+<html>
+<body>Deprecated: Graal import module
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/org/txm/importer/graal/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/importer/graal/GraalXpath.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/graal/GraalXpath.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/graal/GraalXpath.groovy	(revision 258)
@@ -0,0 +1,120 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer.graal
+
+import org.txm.importer.*;
+import java.io.IOException;
+import org.w3c.dom.*;
+import org.xml.sax.SAXException;
+import javax.xml.parsers.*;
+import javax.xml.xpath.*;
+import javax.xml.stream.*;
+import java.net.URL;
+
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class GraalXpath.
+ *
+ * @authors ayepdieu, mdecorde, vchabanis
+ * 
+ * return the id of a bfm tag <milestone/>
+ */
+public class GraalXpath
+{
+	
+	/**
+	 * Gets the xpath response.
+	 *
+	 * @param fileName the xmlfile
+	 * @param N the id of the milestone
+	 * @return the id of a bfm tag <milestone/>
+	 */
+	public static String getXpathResponse(def fileName, String N) throws ParserConfigurationException, SAXException, IOException, XPathExpressionException 
+	{	
+		if (System.getProperty("os.name").contains("Windows"))
+		{
+			
+			XMLInputFactory factory = XMLInputFactory.newInstance();
+			FileInputStream inputStream = new FileInputStream(new File(fileName));
+			XMLStreamReader parser = factory.createXMLStreamReader(inputStream);
+
+			for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) 
+			{
+				if( event== XMLStreamConstants.START_ELEMENT)
+				{
+					if(parser.getLocalName() == "milestone")
+					{
+						if(parser.getAttributeValue(null , "n")== N)
+						{
+							if(parser.getAttributeValue(null , "unit")== "column")
+							{
+								//TODO : changer l'acces par une clef String au lieu d'un index, prob avec le namespace
+								return parser.getAttributeValue(1);
+							}
+						}		
+					}
+				}
+			}
+			println( "FAILED TO FIND MILESTONE WITH N = "+N);
+			return null;
+		}
+		else
+		{
+			def testG = new XPathResult(new File(fileName));
+			String npage =testG.getXpathResponse("//tei:milestone[@unit='column' and @n='"+N+"']","xml:id")
+			return npage;
+			/*String Query = "//tei:milestone[@unit='column' and @n='"+N+"']"
+			DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
+		    domFactory.setNamespaceAware(true); // never forget this!
+		    DocumentBuilder builder = domFactory.newDocumentBuilder();
+		    Document doc = builder.parse(fileName);
+		   
+		    XPathFactory factory = XPathFactory.newInstance();
+		    XPath xpath = factory.newXPath();
+		    xpath.setNamespaceContext(new PersonalNamespaceContext());
+		    XPathExpression expr = xpath.compile(Query);
+
+		    Object result = expr.evaluate(doc, XPathConstants.NODESET); // don't work on windows
+		    NodeList nodes = (NodeList) result;
+		    return nodes.item(0).getAttributes().getNamedItem("xml:id").getNodeValue();
+		    */
+		}
+	}
+	
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args) {
+		def testG = new GraalXpath();
+		String npage =testG.getXpathResponse("C:\\Documents and Settings\\H\\Bureau\\resourcesTXM\\corpora\\data\\qgraal\\qgraal_cm_2009_03.xml","2")
+		println "found npage : "+npage;
+	}
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/importer/graal/ImportInCWB.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/graal/ImportInCWB.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/graal/ImportInCWB.groovy	(revision 258)
@@ -0,0 +1,176 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2016-05-26 17:42:36 +0200 (Thu, 26 May 2016) $
+// $LastChangedRevision: 3219 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer.graal;
+
+import java.net.URL;
+import java.lang.Boolean
+import org.txm.importer.cwb.CwbEncode
+import org.txm.importer.cwb.CwbMakeAll
+
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class ImportInCWB.
+ *
+ * @author sheiden,mdecorde
+ * 
+ * import graal wtc fiel into cwb
+ */
+public class ImportInCWB{
+
+ 	/** The cwb loc. */
+	 def cwbLoc;//chemin vers executable cqp
+	
+	/** The root dir. */
+	def rootDir;//chemin du dossier qui contien src/ et xsl/
+	
+	/** The in dir. */
+	def inDir;
+	 	
+	//dossier qui contiendra les gsp et vues dipl, cour, facs, trad et wtc
+	
+	/** The out dir. */
+	def outDir;
+	//dossiers qui contient le registre cqp et le dossier data (qui contient les corpus)
+	
+	/** The out dir txm. */
+	def outDirTxm;
+	
+ 	/** The in file. */
+	 def inFile;
+	
+	/** The in file2. */
+	def inFile2;
+	
+	/** The out file. */
+	def outFile;
+	
+	/** The out file2. */
+	def outFile2;
+	
+	/**
+	 * same args as GraalInportCqp.
+	 *
+	 * @param rootDir the root dir
+	 * @param cwbLoc the cwb loc
+	 * @param inFile the in file
+	 * @param inFile2 the in file2
+	 * @param outFile the out file
+	 * @param outFile2 the out file2
+	 */
+	public ImportInCWB(	rootDir,
+						cwbLoc,
+						inFile,
+						inFile2,
+						outFile,
+						outFile2)
+	{
+		this.rootDir = rootDir;
+		if(cwbLoc == null)
+			cwbLoc = org.txm.Toolbox.getParam(org.txm.Toolbox.CQI_SERVER_PATH_TO_CQPLIB)+File.separator;
+		else
+			this.cwbLoc = cwbLoc;
+		this.inFile = inFile;
+		this.inFile2 = inFile2;
+		this.outFile = outFile;
+		this.outFile2 = outFile2;
+		this.inDir = this.rootDir+"src" ;
+		this.outDir = this.rootDir ;//outdir of the .gsp
+		this.outDirTxm = this.rootDir ;//outdir for data files & registry
+		this.createDirs();
+	}
+	
+	/**
+	 * create dirs to prevent errors.
+	 */
+	private void createDirs()
+	{
+		new File(outDir).mkdir();
+		new File(outDir+"/wtc").mkdir();
+		new File(outDirTxm).mkdir();
+		new File(outDirTxm+"registry").mkdir();
+		new File(outDirTxm+"data").mkdir();
+	}
+	
+	/**
+	 * call :
+	 * GraalImportCqp
+	 * cwb-encode
+	 * cwb-makeall.
+	 */
+	public void start()
+	{//transfome en wtc et compile les index
+		System.out.println "file:///"+ inDir + "/" + inFile+ ".xml";
+		CwbEncode cwbEn = new CwbEncode();
+		CwbMakeAll cwbMa = new CwbMakeAll();
+		
+		GraalImportCqp traitTxt = new GraalImportCqp(new URL("file:///"+ inDir + "/" + inFile+ ".xml"));
+		traitTxt.transfomFileWtc(outDir+"/wtc/", outFile + ".wtc");
+		
+		traitTxt = new GraalImportCqp(new URL("file:///"+ inDir + "/" + inFile2+ ".xml"));
+		traitTxt.transfomFileWtcBrut(outDir+"/wtc/", outFile2 + ".wtc");
+		
+		System.out.println("--Building index files ...") 
+		String[] pAttributecm = ["pos", "q", "supplied", "col", "line", "id", "dipl", "facs"];
+		String[] sAttributecm = ["p:0+n", "q:1+n", "s:0+n+id"];
+		
+		String[] pAttributes = ["pos", "id", "col"];
+		String[] sAttributes = ["p:0+n", "s:0+n"];
+		try {
+			if (System.getProperty("os.name").contains("Windows"))
+			{
+				cwbEn.run(cwbLoc + "cwb-encode.exe", outDirTxm + "data/"+outFile, outDir +"/wtc/"+outFile+".wtc", outDirTxm + "registry/"+outFile,pAttributecm, sAttributecm);
+				cwbMa.run(cwbLoc + "cwb-makeall.exe", outFile.toUpperCase(), outDirTxm + "registry");
+				
+				cwbEn.run(cwbLoc + "cwb-encode.exe", outDirTxm + "data/"+outFile2, outDir + "/wtc/"+outFile2+".wtc", outDirTxm + "registry/"+outFile2, pAttributes, sAttributes);
+				cwbMa.run(cwbLoc + "cwb-makeall.exe", outFile2.toUpperCase(), outDirTxm + "registry");
+			}
+			else
+			{
+				cwbEn.run(cwbLoc + "cwb-encode", outDirTxm + "data/"+outFile, outDir + "/wtc/"+outFile+".wtc", outDirTxm + "registry/"+outFile,pAttributecm, sAttributecm);
+				cwbMa.run(cwbLoc + "cwb-makeall", outFile.toUpperCase(), outDirTxm + "registry");
+				
+				cwbEn.run(cwbLoc + "cwb-encode", outDirTxm + "data/"+outFile2, outDir +"/wtc/"+ outFile2+".wtc", outDirTxm + "registry/"+outFile2, pAttributes, sAttributes);
+				cwbMa.run(cwbLoc + "cwb-makeall", outFile2.toUpperCase(), outDirTxm + "registry");
+			}
+		} catch (Exception ex) {System.out.println(ex);}
+				System.out.println("Done.") 
+	}
+	
+	/**
+	 * test.
+	 */
+	public void run() 
+	{
+		System.out.println "Starting script : importWTC.groovy ...";
+		System.setProperty("javax.xml.transform.TransformerFactory",  
+				 			"net.sf.saxon.TransformerFactoryImpl");  
+		this.importWTC();
+		System.out.println "GraalImport.groovy done."
+	}
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/importer/graal/qgraalLoader.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/graal/qgraalLoader.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/graal/qgraalLoader.groovy	(revision 258)
@@ -0,0 +1,116 @@
+// TODO: Auto-generated Javadoc
+/* (non-Javadoc)
+ * @see groovy.lang.Script#run()
+ */
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-08-29 14:23:55 +0200 (jeu., 29 août 2013) $
+// $LastChangedRevision: 2519 $
+// $LastChangedBy: nilskredens $ 
+//
+package org.txm.importer.graal
+
+//
+//import org.txm.importer.graal.BuildGraalGSP;
+//import org.txm.importer.graal.ImportInCWB;
+//
+//import org.txm.importer.cwb.CwbEncode
+//import org.txm.importer.cwb.CwbMakeAll
+//import org.txm.importer.cwb.PatchCwbRegistry;
+//import org.txm.objects.*;
+//import org.txm.utils.*;
+//String userDir = System.getProperty("user.home");
+//
+//String rootDir;
+//try{rootDir = rootDirBinding;}//srcDir the selected directoy in TXM RCP via the Binding 
+//catch(Exception)
+//{	println "DEV MODE";//exception means we debug
+//	if(!org.txm.Toolbox.isInitialized())
+//	{
+//		rootDir = userDir+"/xml/qgraal/";
+//		org.txm.Toolbox.workspace = new Workspace(new File(userDir,"TXM/workspaces/default.xml"));
+//		org.txm.Toolbox.setParam(org.txm.Toolbox.INSTALL_DIR,new File(userDir,"TXM"));
+//	}
+//}
+//
+//String pathToCwbBinaries = org.txm.Toolbox.getParam(org.txm.Toolbox.INSTALL_DIR)+"/cwb/bin/";//chemin vers executable cqp de l'installation
+//
+//	//2- create GSP & import to WTC
+//	println "EDITION"
+//	def edition = new BuildGraalGSP(rootDir,//rootdir
+//	pathToCwbBinaries// cwb utils dir
+//	,"qgraal_cm_2009-07-d",	"qgraal_frmod_2009-07-w",//infile1 , infile2
+//	"qgraalcm","qgraalfrmod"); //outfile1 & outfile2
+//	edition.start();
+//	
+//	println "COMPILATION"
+//	def compiler = new ImportInCWB(rootDir,//rootdir
+//	pathToCwbBinaries// cwb utils dir
+//	,"qgraal_cm_2009-07-d",	"qgraal_frmod_2009-07-w",//infile1 , infile2
+//	"qgraalcm","qgraalfrmod"); //outfile1 & outfile2
+//	compiler.start();
+//
+//	//THIS IS AN OLD SCRIPT WE HAVE TO MOVE SOMES FILES
+//	new File(rootDir,"txm").deleteDir()
+//	new File(rootDir,"txm").mkdir()
+//	new File(rootDir,"HTML").deleteDir()
+//	new File(rootDir,"HTML").mkdir()
+//	//txm : copy src
+//	FileCopy.copy(new File(rootDir+"/src","qgraal_cm_2009-07-d.xml"),new File(rootDir+"/txm","qgraal.xml"))
+//	
+//	//HTML : get from/cour
+//	for(File f : new File(rootDir+"/imported/form/cour").listFiles())
+//	{
+//		String name = f.getName();
+//		String pageid= name.substring(15,name.length()-4);
+//		String newfilename = "qgraal_"+pageid+".html";
+//		println newfilename
+//		FileCopy.copy(f,new File(rootDir+"/HTML/multi",newfilename));
+//	}
+//	
+//	//data
+//	new File(rootDir,"data/qgraalcm").renameTo(new File(rootDir,"dataCM"));
+//	new File(rootDir,"data").deleteDir();
+//	new File(rootDir,"dataCM").renameTo(new File(rootDir,"data"));
+//	
+//	//registry
+//	File registryfiletopatch = new File(rootDir+"/registry",qgraalcm);
+//	File cwbindex = new File(rootDir,"data");
+//	try {
+//		PatchCwbRegistry.patch(registryfiletopatch, cwbindex);
+//	} catch (IOException e) {org.txm.utils.logger.Log.printStackTrace(e);}
+//	
+//	// copy reg
+//	try {
+//		FileCopy.copy(registryfiletopatch, new File(registrypath,"qgraalcm"));
+//	} catch (IOException e) {org.txm.utils.logger.Log.printStackTrace(e);}
+//	
+//	
+//	Workspace w = org.txm.Toolbox.workspace;
+//	Project p = w.getProject("default")
+//	p.removeBase("qgraal")
+//	Base b = p.addBase("qgraal");
+//	b.addDirectory(new File(rootDir,"txm"));
+//
+//	
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/importer/graal/BuildGraalGSP.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/graal/BuildGraalGSP.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/graal/BuildGraalGSP.groovy	(revision 258)
@@ -0,0 +1,205 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer.graal;
+
+import org.txm.importer.*
+// TODO: Auto-generated Javadoc
+
+/**
+ * The Class BuildGraalGSP.
+ *
+ * @author sheiden
+ */
+
+public class BuildGraalGSP{
+ 	
+	 /** The cwb loc. */
+	 String cwbLoc;
+	
+	/** The root dir. */
+	String rootDir;
+	
+	/** The in dir. */
+	String inDir;
+	
+	/** The in dir xsl. */
+	String inDirXsl;
+	 	
+	//dossier qui contiendra les gsp et vues dipl, cour, facs, trad et wtc
+	
+	/** The out dir. */
+	String outDir;
+	//dossiers qui contient le registre cqp et le dossier data (qui contient les corpus)
+	
+	/** The out dir txm. */
+	String outDirTxm;
+	//dossier qui contient les xml sources découpés
+	
+	/** The out dir cut. */
+	String outDirCut;
+	
+	/** The in file. */
+	String inFile;
+	
+	/** The in file2. */
+	String inFile2;
+	
+	/** The out file. */
+	String outFile;
+	
+	/** The out file2. */
+	String outFile2;
+	
+	/**
+	 * Instantiates a new builds the graal gsp.
+	 *
+	 * @param rootDir the directory which contains sources and which will contains result files
+	 * @param cwbLoc the location of cwb-encode and cwb-makeall
+	 * @param inFile the path to the graalcm file
+	 * @param inFile2 the path to the graalfrmod file
+	 * @param outFile the prefix of gsp outfiles
+	 * @param outFile2 the prefix of gsp outfiles
+	 */
+	public BuildGraalGSP(String	rootDir, String cwbLoc, String inFile,
+	String inFile2,	String outFile,	String outFile2)
+	{
+		this.rootDir = rootDir;
+		this.cwbLoc = cwbLoc;
+		this.inFile = inFile;
+		this.inFile2 = inFile2;
+		this.outFile = outFile;
+		this.outFile2 = outFile2;
+		this.inDir = this.rootDir;
+		this.inDirXsl = this.rootDir + "/src/xsl";
+		this.outDir = this.rootDir + "/imported/form/";//outdir of the .gsp
+		this.outDirTxm = this.rootDir + "/imported/corpora/";//outdir for data files & registry
+		this.outDirCut = this.rootDir + "/imported/cut/";
+		this.createDirs();
+	}
+	
+	/**
+	 * create outputs dir to prevent from "dir not found" error.
+	 */
+	private void createDirs()
+	{
+		new File(outDir).mkdir();
+		new File(outDir+"/dipl").mkdir();
+		new File(outDir+"/trad").mkdir();
+		new File(outDir+"/facs").mkdir();
+		new File(outDir+"/cour").mkdir();
+		new File(outDirTxm).mkdir();
+		new File(outDirCut).mkdir();
+	}
+
+	/**
+	 * process !!!.
+	 */
+	public boolean start()
+	{
+		if(!ValidateXml.test(new File(inDir + "src/"+inFile+".xml")))
+		{
+			println "Invalid source: "+inDir + "src/"+inFile+".xml";
+			return false;
+		}
+		
+		if(!ValidateXml.test(new File(inDir + "src/"+inFile2+".xml")))
+		{
+			println "Invalid source: "+inDir + "src/"+inFile2+".xml";
+			return false;
+		}
+		
+		def timportWTCestG
+		def nPage;
+		def temp;
+		def BBM;
+		def MAN;
+		def MAF;
+		def MAD;
+		def MTR;
+		//Ouverture des Xsl
+		//Decoupe et mise en forme des page
+		println "start"
+		for (int index = 1; index < 268; index++) 
+		{
+			println "loop" + index
+			
+			//URL url = new URL("file:///" + inDirXsl + "/breakByMilestone.xsl");
+			BBM = new ApplyXsl( inDirXsl + "/breakByMilestone.xsl");
+			//println "xsl applied"
+			MAN = new GraalApplyXsl(new URL("file:///" + inDirXsl + "/qgraal_cour.xsl"));
+			//println "xsl applied 2"
+			MAF = new GraalApplyXsl(new URL("file:///" + inDirXsl + "/qgraal_facs.xsl"));
+			//println "xsl applied 3 "
+			MAD = new GraalApplyXsl(new URL("file:///" + inDirXsl + "/qgraal_dipl.xsl"));
+			//println "xsl applied 4"
+			MTR = new GraalApplyXsl(new URL("file:///" + inDirXsl + "/qgraal_frmod.xsl"));
+			//println "xsl applied 5"
+			def testG = new GraalXpath();
+			//println "xpath done"
+			
+			nPage = testG.getXpathResponse(inDir + "src/"+inFile+ ".xml",  index+"").substring(4);//recuperation du numero de page
+			//nPage=index
+			println "npage = " + nPage
+			
+			URL url = new URL("file:///" + inDir + inFile+ ".xml");
+			//System.out.println("--Converting " + url.getFile() + " to web pages.");
+			
+			//BBM.setParam("pbval1", index);
+			//println "params set 1 : "
+			//BBM.setParams("pbval2", index + 1);
+			String[] params = ["pbval1", index,"pbval2", index+1]
+			//println "params set 2"
+			BBM.process(new URL("file:///" + inDir + "/src/" + inFile+ ".xml").getFile(), outDirCut+"/"+ inFile + "_" + nPage + ".xml",params);//decoupe ancienne version
+			println "BBM Done : "+inFile + "_" + nPage + ".xml"
+			//System.out.println "L'index est : " + index + " npage " + nPage;
+				System.out.println "----Pages gsp";
+				if (index<260) {
+				BBM.process(new URL("file:///" + inDir + "/src/" + inFile2+ ".xml").getFile(), outDirCut+"/"+ inFile2 + "_" + nPage + ".xml",params);//decoupe nouvelle version
+				}
+				System.out.println "----Break By MileStone.";
+				if(index<10)
+				{					
+				MAF.ApplyXsl(new URL("file:///" + outDirCut + "/" + inFile + "_" + nPage+ ".xml"), outDir + "facs", "_" + outFile + "_facs_" + nPage + ".gsp");//mise en page facsimilaire
+				System.out.println "----Building facsimile version.";
+				}
+				MAD.ApplyXsl(new URL("file:///" + outDirCut + "/" + inFile + "_" + nPage+ ".xml"), outDir + "dipl", "_" + outFile + "_dipl_" + nPage + ".gsp");//mise en page diplomatique
+				System.out.println "----Building diplomatic version.";
+				if(index<260)
+				{					
+				MTR.ApplyXsl(new URL("file:///" + outDirCut + "/" + inFile2 + "_" + nPage+ ".xml"), outDir + "trad", "_" + outFile2 + "_trad_" + nPage + ".gsp");//mise en forme traduction
+				System.out.println "----Building traduction version.";
+				}
+
+			MAN.ApplyXsl(new URL("file:///" + outDirCut + "/" + inFile + "_" + nPage + ".xml"), outDir + "cour", "_" + outFile + "_norm_" + nPage + ".gsp");//mise en forme courante
+			System.out.println "----Building current version.";
+			System.out.println "--Page " + nPage + " OK";
+		}
+		println "end"
+		return true;
+	}
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/importer/lasla/compiler.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/lasla/compiler.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/lasla/compiler.groovy	(revision 258)
@@ -0,0 +1,300 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2016-05-26 17:42:36 +0200 (Thu, 26 May 2016) $
+// $LastChangedRevision: 3219 $
+// $LastChangedBy: mdecorde $ 
+//
+
+
+package org.txm.importer.lasla;
+
+import java.util.ArrayList;;
+
+import org.txm.importer.cwb.BuildCwbEncodeArgs;
+import org.txm.importer.cwb.CwbEncode
+import org.txm.importer.cwb.CwbMakeAll
+import org.txm.importer.*;
+import org.txm.scripts.*;
+import org.txm.scripts.teitxm.BuildTTSrc;
+import org.txm.scripts.teitxm.*;
+import org.txm.utils.treetagger.TreeTagger;
+
+import javax.xml.stream.*;
+import java.net.URL;
+import java.io.File;
+import java.util.HashMap;
+import java.util.List;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class compiler.
+ */
+class compiler 
+{
+	
+	/** The debug. */
+	private boolean debug= false;
+	
+	/** The input data. */
+	private def inputData;
+	
+	/** The factory. */
+	private def factory;
+	
+	/** The parser. */
+	private XMLStreamReader parser;
+	
+	/** The dir. */
+	private def dir;
+	
+	/** The output. */
+	private def output;
+	
+	/** The url. */
+	private def url;
+	
+	/** The anahash. */
+	private HashMap<String,String> anahash =new HashMap<String,String>() ;
+	
+	/** The text. */
+	String text="";
+	
+	/** The base. */
+	String base="";
+	
+	/** The project. */
+	String project="";
+	
+	/** The text attributes. */
+	String[] textAttributes = null;
+	
+	/** The cwb loc. */
+	String cwbLoc;
+	
+	/** The lang. */
+	private String lang ="fr";
+	
+	/**
+	 * initialize.
+	 *
+	 */
+	public compiler(){}
+	
+	/**
+	 * Instantiates a new compiler.
+	 *
+	 * @param url the url
+	 * @param text the text
+	 * @param base the base
+	 * @param project the project
+	 */
+	public compiler(URL url,String text,String base, String project)
+	{
+		this.text = text
+		this.base = base;
+		this.project = project;
+		this.textAttributes = textAttributes;
+		try {
+			this.url = url;
+			inputData = url.openStream();
+			
+			factory = XMLInputFactory.newInstance();
+			parser = factory.createXMLStreamReader(inputData);
+		} catch (XMLStreamException ex) {
+			System.out.println(ex);
+		}catch (IOException ex) {
+			System.err.println("IOException while parsing ");
+		}
+	}
+	
+	/**
+	 * set the language of the corpus.
+	 *
+	 * @param lang the lang
+	 * @return the java.lang. object
+	 */
+	public setLang(String lang)
+	{
+		this.lang = lang;
+	}
+	
+	/**
+	 * Sets the cwb path.
+	 *
+	 * @param path the new cwb path
+	 */
+	public void setCwbPath(String path)
+	{
+		if(!new File(path).exists())
+			System.err.println("CWB Path : "+path+" does not exists")
+		cwbLoc = path;
+	}
+	
+	/**
+	 * Creates the output.
+	 *
+	 * @param dirPathName the dir path name
+	 * @param fileName the file name
+	 * @return true, if successful
+	 */
+	private boolean createOutput(String dirPathName, String fileName){
+		try {
+			File f = new File(dirPathName, fileName)
+			output = new OutputStreamWriter(new FileOutputStream(f,f.exists()) , "UTF-8");
+			return true;
+		} catch (Exception e) {
+			System.err.println(e);
+			
+			return false;
+		}
+	}
+	
+	/**
+	 * Go to text.
+	 */
+	private void GoToText()
+	{
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) 
+		{
+			if(event == XMLStreamConstants.END_ELEMENT)
+				if(parser.getLocalName().equals("teiHeader"))
+					return;
+		}
+	}
+	
+	/**
+	 * Run.
+	 *
+	 * @param rootDirFile the root dir file
+	 * @param basename the basename
+	 * @param textAttributes the text attributes
+	 * @return true, if successful
+	 */
+	public boolean run(File rootDirFile,String basename, String[] textAttributes) 
+	{
+		String rootDir =rootDirFile.getAbsolutePath();
+		
+		if(cwbLoc == null)
+			cwbLoc = org.txm.Toolbox.getParam(org.txm.Toolbox.CQI_SERVER_PATH_TO_CQPLIB)+File.separator;
+		
+		if(!new File(cwbLoc).exists())
+		{
+			println ("CWB path error: "+cwbLoc)
+			return false;
+		}
+		if(!new File(rootDir).exists())
+		{
+			println ("binary directory does not exists: "+rootDir)
+			return false;
+		}
+
+		new File(rootDir,"/wtc/").deleteDir();
+		new File(rootDir,"/wtc/").mkdir();
+		new File(rootDir,"/data/").deleteDir();
+		new File(rootDir,"/data/").mkdir();
+		new File(rootDir,"registry/").mkdir();
+		
+		String textid="";
+		int counttext =0;
+		List<File> files = new File(rootDirFile,"txm").listFiles();
+		//1- Transform into WTC file
+		def builder = null;
+		for(File f : files)
+		{
+			counttext++;
+			if(!f.exists())
+			{
+				println("file "+f+ " does not exists")	
+			}
+			else
+			{	
+				wtcbuilder = new XMLTXM2WTC(f.toURL());
+				String txtname = f.getName().substring(0,f.getName().length()-4);
+				wtcbuilder.setTextInfo(txtname, basename, "project");
+
+				wtcbuilder.setBalisesToKeep(["text"]);
+				wtcbuilder.setSendToPAttributes([]);
+				wtcbuilder.setLang(lang);
+				if(!wtcbuilder.transformFile(new File(rootDir,"wtc/"+basename+".wtc")))
+				{
+					println("Failed to compile "+f)
+				}
+			}
+		}
+		
+		//2- Import into CWB
+		def outDir =rootDir;
+		def outDirTxm = rootDir;
+		
+		CwbEncode cwbEn = new CwbEncode();
+		cwbEn.setDebug(debug);
+		CwbMakeAll cwbMa = new CwbMakeAll();
+		cwbMa.setDebug(debug);
+		String[] pAttributes = ["ref","s","sent","lemme","line","pos"];
+		
+		BuildCwbEncodeArgs argsgetter = new BuildCwbEncodeArgs();
+
+		ArrayList<String> wordstag = ["w"];
+		//argsgetter.process(new File(rootDir+"/txm",basename+".wtc"), wordstag);
+		
+		String[] sAttributes = ["txmcorpus:0+lang", "text:0+id+base+project"]
+		
+		try {
+			String regPath = outDirTxm + "/registry/"+basename.toLowerCase();
+			cwbEn.run(new File(cwbLoc,"cwb-encode").getAbsolutePath(), outDirTxm + "/data", outDir + "/wtc/"+basename+".wtc", regPath, pAttributes, sAttributes);
+			if (!new File(regPath).exists()) {
+				println "Error: The registry file was not created: $regPath. See https://groupes.renater.fr/wiki/txm-users/public/faq"
+				return false;
+			}
+			cwbMa.run(new File(cwbLoc,"cwb-makeall").getAbsolutePath(), basename.toUpperCase(), outDirTxm + "/registry");
+			
+		} catch (Exception ex) {System.out.println(ex); return false;}
+		
+		System.out.println("Done.") 
+		
+		return true;
+	}
+	
+	/**
+	 * Sets the debug.
+	 */
+	public void setDebug()
+	{
+		this.debug = true;
+	}
+	
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args)
+	{
+		File dir = new File("~/xml/geo");
+		def c = new compiler();
+		c.setDebug();
+		c.setCwbPath("~/TXM/cwb/bin");
+		c.run(dir,"geo");
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/lasla/package.html
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/lasla/package.html	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/lasla/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Lasla import module - not yet finished</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/org/txm/importer/lasla/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/importer/lasla/pager.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/lasla/pager.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/lasla/pager.groovy	(revision 258)
@@ -0,0 +1,377 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2017-01-24 18:11:42 +0100 (Tue, 24 Jan 2017) $
+// $LastChangedRevision: 3400 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer.lasla
+
+;
+
+import org.txm.importer.*;
+import org.xml.sax.Attributes;
+import org.txm.importer.filters.*;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.stream.*;
+import java.net.URL;
+import org.xml.sax.InputSource;
+import org.xml.sax.helpers.DefaultHandler;
+
+// TODO: Auto-generated Javadoc
+/** Build GEO corpus simple edition from a xml-tei. @author mdecorde */
+class pager {
+	List<String> NoSpaceBefore;
+	
+	/** The No space after. */
+	List<String> NoSpaceAfter;
+
+	/** The wordcount. */
+	int wordcount = 0;
+	
+	/** The pagecount. */
+	int pagecount = 0;
+	
+	/** The wordmax. */
+	int wordmax = 0;
+	
+	/** The basename. */
+	String basename = "";
+
+	/** The wordid. */
+	String wordid;
+	
+	/** The first word. */
+	boolean firstWord = true;
+	
+	/** The wordvalue. */
+	String wordvalue;
+	
+	/** The interpvalue. */
+	String interpvalue;
+	
+	/** The lastword. */
+	String lastword = " ";
+	
+	/** The wordtype. */
+	String wordtype;
+	
+	/** The flagform. */
+	boolean flagform = false;
+	
+	/** The flaginterp. */
+	boolean flaginterp = false;
+	
+	/** The url. */
+	private def url;
+	
+	/** The input data. */
+	private def inputData;
+	
+	/** The factory. */
+	private def factory;
+	
+	/** The parser. */
+	private XMLStreamReader parser;
+	
+	/** The writer. */
+	OutputStreamWriter writer;
+	
+	/** The multiwriter. */
+	OutputStreamWriter multiwriter = null;
+	
+	/** The infile. */
+	File infile;
+	
+	/** The outfile. */
+	File outfile;
+	
+	/** The pages. */
+	ArrayList<File> pages = new ArrayList<File>();
+	
+	/** The idxstart. */
+	ArrayList<String> idxstart = new ArrayList<String>();
+
+	/**
+	 * Instantiates a new pager.
+	 *
+	 * @param infile the infile
+	 * @param outfile the outfile
+	 * @param NoSpaceBefore the no space before
+	 * @param NoSpaceAfter the no space after
+	 * @param max the max
+	 * @param basename the basename
+	 */
+	pager(File infile, File outfile, List<String> NoSpaceBefore,
+			List<String> NoSpaceAfter, int max, String basename) {
+		this.basename = basename;
+		this.wordmax = max;
+		this.NoSpaceBefore = NoSpaceBefore;
+		this.NoSpaceAfter = NoSpaceAfter;
+		this.url = infile.toURI().toURL();
+		this.infile = infile;
+
+		inputData = url.openStream();
+		factory = XMLInputFactory.newInstance();
+		parser = factory.createXMLStreamReader(inputData);
+		createOutput(outfile);
+		process();
+	}
+
+	/**
+	 * Creates the next output.
+	 *
+	 * @return true, if successful
+	 */
+	private boolean createNextOutput()
+	{
+		try {
+			if(multiwriter != null)
+			{
+				multiwriter.write("</body>");
+				multiwriter.write("</html>");
+				multiwriter.close();
+			}
+			pagecount++;
+			File f = new File(outfile.getParent()+"/multi/",outfile.getName().substring(0,outfile.getName().length()-5)+"_"+pagecount+".html");
+			pages.add(f);
+			idxstart.add(wordid)
+			multiwriter = new OutputStreamWriter(new FileOutputStream(f) , "UTF-8");
+			
+			multiwriter.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
+			multiwriter.write("<html>");
+			multiwriter.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/>");
+			multiwriter.write("<head>");
+			multiwriter.write("<title>"+basename.toUpperCase()+" Edition - Page "+pagecount+"</title>");
+			multiwriter.write("</head>");
+			multiwriter.write("<body>");
+			
+			return true;
+		} catch (Exception e) {
+			System.out.println(e.getLocalizedMessage());
+			return false;
+		}
+	}
+
+	/**
+	 * Creates the output.
+	 *
+	 * @param outfile the outfile
+	 * @return true, if successful
+	 */
+	private boolean createOutput(File outfile) {
+		try {
+			this.outfile = outfile;
+
+			writer = new OutputStreamWriter(new FileOutputStream(outfile),
+					"UTF-8");
+			createNextOutput();
+			return true;
+		} catch (Exception e) {
+			System.out.println(e.getLocalizedMessage());
+			return false;
+		}
+	}
+
+	/**
+	 * Gets the page files.
+	 *
+	 * @return the page files
+	 */
+	public ArrayList<File> getPageFiles() {
+		return pages;
+	}
+
+	/**
+	 * Gets the idx.
+	 *
+	 * @return the idx
+	 */
+	public ArrayList<String> getIdx() {
+		return idxstart;
+	}
+
+	/**
+	 * Process.
+	 */
+	void process()
+	{
+		String localname = "";
+		
+		writer.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
+		writer.write("<html>");
+		writer.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/>");
+		writer.write("<head>");
+		writer.write("<title>"+basename.toUpperCase()+" edition</title>");
+		writer.write("</head>");
+		writer.write("<body>");
+		
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+			
+			
+			switch (event) {
+				case XMLStreamConstants.START_ELEMENT:
+					localname = parser.getLocalName();
+					switch(localname)
+					{
+						case "head":
+							writer.write("<h2>\n")
+							multiwriter.write("<h2>\n")
+							break;
+						
+						case "lg":
+							writer.write("<p>\n")
+							multiwriter.write("<p>\n")
+							break;
+						
+						case "p":
+						case "q":
+							writer.write("<p>\n")
+							multiwriter.write("<p>\n")
+							break;
+							
+						case "lb":
+						case "br":
+						writer.write("<br/>\n")
+						multiwriter.write("<br/>\n")
+						break;
+						
+						case "w":
+							wordid=parser.getAttributeValue(null,"id");
+							if(firstWord)
+							{
+								firstWord=false;
+								this.idxstart.set(0,wordid);
+							}
+							wordcount++;
+							if(wordcount >= wordmax)
+							{
+								createNextOutput();
+								wordcount=0;
+							}
+							break;
+						
+						case "ana":
+							flaginterp=true;
+							interpvalue+=" "+parser.getAttributeValue(null,"type").substring(1)+":"
+							break;
+						
+						case "form":
+							wordvalue="";
+							interpvalue ="";
+							flagform=true;
+					}
+					break;
+				case XMLStreamConstants.END_ELEMENT:
+					localname = parser.getLocalName();
+					switch(localname)
+					{
+						case "head":
+							writer.write("</h2>\n")
+							multiwriter.write("</h2>\n")
+							break;
+						
+						case "lg":
+							writer.write("</p>\n")
+							multiwriter.write("</p>\n")
+							break;
+						
+						case "lb":
+							writer.write("<br/>\n")
+							multiwriter.write("<br/>\n")
+							break;
+							
+						case "pb":
+							writer.write("<br/><br/>\n")
+							multiwriter.write("<br/><br/>\n")
+							break;
+						
+						case "p":
+						case "q":
+							writer.write("</p>\n")
+							multiwriter.write("</p>\n")
+							break;
+						
+						
+						case "form":
+							flagform = false
+						
+							break;
+						
+						case "ana":
+							flaginterp = false
+							break;
+						
+						case "w":
+							int l = lastword.length();
+							String endOfLastWord = "";
+							if(l > 0)
+								endOfLastWord = lastword.subSequence(l-1, l);
+							
+							if(interpvalue != null)
+								interpvalue = interpvalue.replace("&", "&amp;").replace("\"","&quot;").replace("<", "&lt;");
+							
+							if(NoSpaceBefore.contains(wordvalue) || 
+									NoSpaceAfter.contains(lastword) || 
+									wordvalue.startsWith("-") || 
+									NoSpaceAfter.contains(endOfLastWord))
+							{
+								writer.write("<span title=\""+interpvalue+"\" id=\""+wordid+"\">");
+								multiwriter.write("<span title=\""+interpvalue+"\" id=\""+wordid+"\">");
+							}
+							else
+							{
+								writer.write(" <span title=\""+interpvalue+"\" id=\""+wordid+"\">");
+								multiwriter.write(" <span title=\""+interpvalue+"\" id=\""+wordid+"\">");
+							}
+							writer.write(wordvalue.replace("<", "&lt;")+"</span>");
+							multiwriter.write(wordvalue.replace("<", "&lt;")+"</span>");
+							lastword=wordvalue;
+							break;
+					}
+					break;
+				
+				case XMLStreamConstants.CHARACTERS:
+					if(flagform)
+						if(parser.getText().length() > 0)
+							wordvalue+=(parser.getText().replace("&","&amp;").replace("<", "&lt;"));
+					if(flaginterp)
+						if(parser.getText().length() > 0)
+							interpvalue+=(parser.getText().replace("&","&amp;").replace("<", "&lt;"));
+					break;
+			}
+		}	
+		writer.write("</body>");
+		writer.write("</html>");
+		writer.close();
+		multiwriter.write("</body>");
+		multiwriter.write("</html>");
+		multiwriter.close();
+		inputData.close();
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/lasla/importer.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/lasla/importer.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/lasla/importer.groovy	(revision 258)
@@ -0,0 +1,168 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer.lasla
+
+import javax.xml.stream.*
+
+import org.txm.*
+import org.txm.importer.*
+import org.txm.importer.filters.*
+import org.txm.objects.*
+import org.txm.scripts.*
+import org.txm.scripts.teitxm.*
+
+import filters.CutHeader.*
+import filters.FusionHeader.*
+import filters.TagSentences.*
+import filters.Tokeniser.*
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class importer.
+ */
+class importer {
+	
+	/**
+	 * Run.
+	 *
+	 * @param rootDirFile the root dir file
+	 * @param encoding the encoding
+	 * @param basename the basename
+	 * @return true, if successful
+	 */
+	public boolean run(File rootDirFile, String encoding, String basename)
+	{
+		String filename = rootDirFile.getName();
+		String rootDir = rootDirFile.getAbsolutePath()+"/"
+		
+		//cleaning
+		File binDir = new File(Toolbox.getParam(Toolbox.USER_TXM_HOME),"corpora/"+basename);
+		
+		binDir.deleteDir();
+		binDir.mkdir();
+		new File(binDir,"src").deleteDir();
+		new File(binDir,"src").mkdir();
+		new File(binDir,"txm").deleteDir();
+		new File(binDir,"txm").mkdir();
+		
+		ArrayList<String> milestones = new ArrayList<String>();//the tags who you want them to stay milestones
+		
+		//separates values and build simple xml
+		List<File> srcfiles = new File(rootDir).listFiles();
+		if(srcfiles == null)
+		{
+			println "No file to process"
+			return false;
+		}
+		//println "BYEBYE FORTRAN";
+		println("Converting to xml "+srcfiles.size()+ " files")
+		for(File f : srcfiles)
+		{
+			print "."
+			File outfile = new File(binDir,"src/"+f.getName()+".xml")
+			FortranColumns2XML builder = new FortranColumns2XML(f, outfile, encoding);
+			builder.setColumnIndexes([0, 3, 4, 8, 29, 55, 67],	[3, 4, 8, 28, 54, 66, 78]);
+			builder.setColumnsLinesNames(["ref","s","sent","lemme","word","line","pos"], "w", 4);
+			builder.setAddIds(true);
+			//builder.setLineCheck(3, "l");
+			if(!builder.process())
+			{
+				println "Failed to convert file: "+f
+			}
+		}
+		println ""
+		
+		rootDir = binDir.getAbsolutePath();
+		srcfiles = new File(rootDir, "src").listFiles();
+		//TRANSFORM INTO XML-TEI-TXM
+		println("Building xml-tei-txm "+srcfiles.size()+ " files")
+		for(File f : srcfiles)
+		{
+			print "."
+			//ArrayList<String> milestones = new ArrayList<String>();
+			
+			File file = f; 
+			String txmfile = f.getName();
+			def correspType = new HashMap<String,String>()
+			//["ref","s","sent","word","lemme","line","pos"]
+			correspType.put("ref","ref");
+			correspType.put("s","s");
+			correspType.put("sent","sent");
+			correspType.put("lemme","lemme")
+			correspType.put("line","line")
+			correspType.put("pos","pos");
+			correspType.put("form","form");
+			
+			def correspRef = new HashMap<String,String>()
+			correspRef.put("ref","lasla");
+			correspRef.put("s","lasla");
+			correspRef.put("sent","lasla");
+			correspRef.put("lemme","lasla")
+			correspRef.put("line","lasla")
+			correspRef.put("pos","lasla");
+			correspRef.put("form","lasla");
+			
+			//il faut lister les id de tous les respStmt
+			def respId = ["lasla"];
+			//fait la correspondance entre le respId et le rapport d'execution de l'outil
+			def applications = new HashMap<String, ArrayList<String>>();
+			applications.put("lasla", new ArrayList<String>());
+			applications.get("lasla").add("txm");//app ident
+			applications.get("lasla").add("0.6");//app version
+			applications.get("lasla").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("lasla",["LASLA"]);//,"lemma","lasla","grace"]);
+			
+			//associe un id d'item avec sa description et son URI
+			def itemsURI = new HashMap<String,HashMap<String,String>>();
+			itemsURI.put("LASLA",new HashMap<String,String>());
+			itemsURI.get("LASLA").put("tagset","http://bfm.ens-lsh.fr/IMG/xml/cattex2009.xml");
+			itemsURI.get("LASLA").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("lasla", ["initial tagging","lasla","2010-03-02",""])
+			//lance le traitement
+			String wordprefix = "w_";
+			def builder = new Xml2Ana(file);
+			builder.setCorrespondances(correspRef, correspType);
+			builder.setHeaderInfos(respId,resps, applications, taxonomiesUtilisees, itemsURI)
+			//builder.setAddTEIHeader();
+			if(!builder.process(new File(new File(rootDir,"txm"),txmfile)))
+			{
+				println "Failed to build xml-txm of file: "+f;
+			}
+		}
+		println ""
+		return true;
+	}
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/importer/lasla/laslaLoader.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/lasla/laslaLoader.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/lasla/laslaLoader.groovy	(revision 258)
@@ -0,0 +1,167 @@
+/**
+ * Main.
+ *
+ * @param args the args
+ */
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer.lasla;
+
+import java.io.File;
+
+import org.txm.importer.lasla.importer;
+import org.txm.importer.xml.compiler;
+import org.txm.importer.xml.pager_old;
+import org.txm.objects.*;
+import org.txm.utils.*;
+import org.txm.*;
+import org.txm.utils.i18n.*;
+import org.txm.utils.io.FileCopy;
+
+// TODO: Auto-generated Javadoc
+/* (non-Javadoc)
+ * @see groovy.lang.Script#run()
+ */
+String userDir = System.getProperty("user.home");
+String rootDir;
+String lang;
+String encoding;
+String model;
+String basename;
+try{rootDir = rootDirBinding;lang=langBinding;encoding=encodingBinding;model=modelBinding;basename=basenameBinding;}
+catch(Exception)
+{	println "DEV MODE";//exception means we debug
+	if(!org.txm.Toolbox.isInitialized())
+	{
+		rootDir = userDir+"/xml/lasla/";
+		basename = "latin";
+		lang="fr";
+		encoding= "ISO-8859-1";
+		model="rgaqcj";//not used
+		Toolbox.workspace = new Workspace(new File(userDir,"TXM/workspaces/default.xml"));
+		Toolbox.setParam(Toolbox.INSTALL_DIR,"/usr/lib/TXM");
+		Toolbox.setParam(Toolbox.TREETAGGER_INSTALL_PATH,new File(userDir,"treetagger"));
+		Toolbox.setParam(Toolbox.TREETAGGER_MODELS_PATH,new File(userDir,"treetagger/models"));
+		Toolbox.setParam(Toolbox.METADATA_ENCODING, "UTF-8");
+		Toolbox.setParam(Toolbox.METADATA_COLSEPARATOR, ",");
+		Toolbox.setParam(Toolbox.METADATA_TXTSEPARATOR, "\"");
+		Toolbox.setParam(Toolbox.USER_TXM_HOME, new File(System.getProperty("user.home"),"TXM"));
+	}
+}
+
+//String basename = new File(rootDir).getName().toLowerCase()
+println "-- IMPORTER - Reading source files"
+def imp = new importer();
+if(!imp.run( new File(rootDir), encoding, basename))
+{
+	println "import process stopped";
+	return;
+}
+
+File binDir = new File(Toolbox.getParam(Toolbox.USER_TXM_HOME),"corpora/"+basename);
+File txmfiles = new File(binDir,"txm");
+files = txmfiles.listFiles()
+
+println "-- COMPILING - Building Search Engine indexes"
+
+def files = new File(binDir, "src").listFiles()
+File onesrcfile = null;
+if(files.size() > 0)
+	onesrcfile = files[0];
+if(onesrcfile == null)
+{
+	println "No XML file (extension '.xml') has been found in directory "+binDir
+	return;
+}
+
+def c = new compiler();
+c.setDebug();
+//c.setCwbPath("~/TXM/cwb/bin");
+c.setAnnotationSuccess(false)
+c.setLang(lang);
+if(!c.run(binDir, basename, null, files, null))
+{
+	println "import process stopped";
+	return;
+}
+
+//move registry file to cwb registry dir
+File registryfile = new File(binDir,"registry/"+basename);
+if(registryfile.exists())
+	FileCopy.copy(registryfile,new File(Toolbox.getParam(Toolbox.USER_TXM_HOME), "registry/"+basename))
+
+Workspace w = org.txm.Toolbox.workspace;
+Project p = w.getProject("default")
+p.removeBase(basename)
+Base b = p.addBase(basename);
+b.addDirectory(new File(binDir, "txm"));
+b.setAttribute("lang", lang)
+b.propagateAttribute("lang")
+
+println "-- EDITION - Building edition"
+new File(binDir,"HTML").deleteDir();
+new File(binDir,"HTML").mkdir();
+new File(binDir,"HTML/default").mkdir();
+List<File> filelist = new File(binDir,"txm").listFiles();
+def second = 0
+
+println "Paginating text: "
+for(String textname : b.getTextsID())
+{
+	Text text = b .getText(textname);
+	File srcfile = text.getSource();
+	File resultfile = new File(binDir, "HTML/"+srcfile.getName().substring(0,srcfile.getName().length()-4)+".html");
+	List<String> NoSpaceBefore = LangFormater.getNoSpaceBefore(lang);
+		List<String> NoSpaceAfter = LangFormater.getNoSpaceAfter(lang);
+		
+		if (second) { print(", ") }
+		if (second > 0 && (second % 5) == 0) println ""
+		print(srcfile.getName());
+		second++
+	
+	def ed = new pager_old(srcfile,resultfile, NoSpaceBefore, NoSpaceAfter,500,basename, "br");
+	
+	Edition editionweb = text.addEdition("default","html",resultfile);
+//	println("pages "+ed.getPageFiles())
+//	println("idx "+ed.getIdx())
+	for(int i = 0 ; i < ed.getPageFiles().size();i++)
+	{
+		File f = ed.getPageFiles().get(i);
+		String idx = ed.getIdx().get(i);
+		editionweb.addPage(f,idx);
+	}
+	
+//	Edition editionbp = text.addEdition("onepage","html",resultfile);
+//	editionbp.addPage(resultfile,ed.getIdx().get(0));
+}
+
+
+w.save()
+println "done"
+
+
Index: tmp/org.txm.core/src/groovy/org/txm/importer/DocBookCleaner.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/DocBookCleaner.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/DocBookCleaner.groovy	(revision 258)
@@ -0,0 +1,15 @@
+package org.txm.importer
+
+import org.txm.sw.ChangeEncoding;
+
+File origDir = new File("/home/mdecorde/xml/temoignages2/")
+File outDir = new File("/home/mdecorde/xml/temoignages3/")
+
+File f = new File(origDir, ".xml")
+println f.getText("Windows-1252")
+//for (File f : origDir.listFiles()) {
+//	if (f.isHidden() || f.isDirectory()) continue;
+//	
+//	ChangeEncoding.processFile(f, "Windows-1252", "UTF-8")
+//	println f.getText("UTF-8")
+//}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/importer/WordCounter.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/WordCounter.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/WordCounter.groovy	(revision 258)
@@ -0,0 +1,189 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2015-12-17 12:11:39 +0100 (Thu, 17 Dec 2015) $
+// $LastChangedRevision: 3087 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer;
+
+import java.io.BufferedReader;
+import java.util.ArrayList;
+import javax.xml.parsers.SAXParserFactory
+import org.xml.sax.helpers.DefaultHandler
+import org.xml.sax.*
+import javax.xml.stream.*;
+import java.net.URL;
+
+// TODO: Auto-generated Javadoc
+/** Count the focused tag and add id to it you must specify  : which tag are milestones the tag to count. */
+class WordCounter extends DefaultHandler {
+    String txt ;
+	
+	/** The focus. */
+	String focus;
+    
+    /** The counter. */
+    int counter = 0;
+    
+    /** The solotags. */
+    ArrayList<String> solotags;
+    
+    /** The writer. */
+    XMLStreamWriter writer;
+	
+	/**
+	 * The initializer do the work
+	 * The file infile is replaced by the result.
+	 *
+	 * @param infile the infile
+	 * @param focus the focus
+	 * @param txt the txt
+	 */
+    WordCounter(File infile, String focus, String txt)
+    {
+    	File outfile = new File(infile.getName()+"counter");
+		this.focus=focus;
+		this.txt = txt;
+		
+		FileInputStream input = new FileInputStream(infile);
+		
+        def handler = this;
+        def reader = SAXParserFactory.newInstance().newSAXParser();
+		
+        def output = new FileOutputStream(outfile);
+        XMLOutputFactory factory = XMLOutputFactory.newInstance();
+		writer = factory.createXMLStreamWriter(output, "UTF-8");
+		writer.writeStartDocument("UTF-8", "1.0");
+		output.write("\n")
+		
+		//Reader inputStream = new InputStreamReader(new FileInputStream(infile) , "UTF-8");
+		//BufferedReader r= new BufferedReader(inputStream);
+		
+        reader.parse(input, handler);// process !!
+		
+        input.close();
+        writer.close();
+		output.close();
+        //r.close();
+        if (!(infile.delete() && outfile.renameTo(infile))) println "Warning can't rename file "+outfile+" to "+infile
+    }
+	
+	/**
+	 * process start tag.
+	 *
+	 * @param ns the ns
+	 * @param localName the localname of the current tag
+	 * @param qName the q name
+	 * @param atts the attributes of the current tag
+	 */
+    void startElement(String ns, String localName, String qName, Attributes atts) {
+    	
+    	writer.writeStartElement(qName)
+    	
+    	//writeAttrs
+        if(qName.matches(focus))
+        {
+        	counter++;
+        	writer.writeAttribute("n",""+counter)
+            writer.writeAttribute("xml:id",focus+txt+"_"+counter)
+            for(int i=0; i < atts.getLength();i++)
+            	if(atts.getQName(i) != "n" && atts.getQName(i) != "xml:id" && atts.getQName(i) != "id")
+                writer.writeAttribute(atts.getQName(i), atts.getValue(i));
+        }
+        else
+        {
+        	for(int i=0; i < atts.getLength();i++)
+                writer.writeAttribute(atts.getQName(i), atts.getValue(i));
+        }
+    }
+	
+	/**
+	 * write the CDATA, not finished.
+	 *
+	 * @param chars all the chars
+	 * @param offset where the text begin
+	 * @param length the length
+	 */
+    void characters(char[] chars, int offset, int length)
+    {
+    	writer.writeCharacters(chars, offset, length)
+    }
+	
+	/* (non-Javadoc)
+	 * @see org.xml.sax.helpers.DefaultHandler#endElement(java.lang.String, java.lang.String, java.lang.String)
+	 */
+    void endElement(String ns, String localName, String qName)
+    {
+       writer.writeEndElement();
+    }
+    
+    /**
+     * Find text id.
+     *
+     * @param infile the infile
+     * @param focus the focus
+     * @return the string
+     */
+    public static String findTextId(File infile, String focus)
+    {
+    	def inputData = infile.toURI().toURL().openStream();
+		def inputfactory = XMLInputFactory.newInstance();
+		XMLStreamReader parser = inputfactory.createXMLStreamReader(inputData);
+				
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) 
+		{
+			switch (event) 
+			{
+				case XMLStreamConstants.START_ELEMENT:
+					if(parser.getLocalName() == focus)
+					{
+						String sid = ""
+						for(int i = 0 ; i < parser.getAttributeCount() ; i++)
+							if(parser.getAttributeLocalName(i) == "id")
+							{
+								sid = parser.getAttributeValue(i); //xxx_000
+								sid = sid.substring(focus.length()); // on retire le nom du focus
+								sid = sid.split("_")[0];
+								break;
+							}
+						inputData.close();
+						parser.close();
+						return sid;
+					}
+			}
+		}
+    }
+    
+    /**
+     * The main method.
+     *
+     * @param args the arguments
+     */
+    static void main(String[] args)
+    {
+    	File infile = new File("~/xml/quote/processme-q.xml")
+        new WordCounter(infile, "s","01");
+    	new WordCounter(infile, "q","01");
+    }
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/importer/corptef/pager.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/corptef/pager.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/corptef/pager.groovy	(revision 258)
@@ -0,0 +1,558 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2017-01-24 18:11:42 +0100 (Tue, 24 Jan 2017) $
+// $LastChangedRevision: 3400 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer.corptef;
+
+import org.txm.importer.*;
+import org.xml.sax.Attributes;
+import org.txm.importer.filters.*;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.stream.*;
+import java.net.URL;
+import org.xml.sax.InputSource;
+import org.xml.sax.helpers.DefaultHandler;
+
+// TODO: Auto-generated Javadoc
+/** Build BFM corpus simple edition from a xml-tei. @author mdecorde */
+class pager {
+	List<String> NoSpaceBefore;
+	
+	/** The No space after. */
+	List<String> NoSpaceAfter;
+
+	/** The wordcount. */
+	int wordcount = 0;
+	
+	/** The pagecount. */
+	int pagecount = 0;
+	
+	/** The wordmax. */
+	int wordmax = 0;
+
+	/** The wordid. */
+	String wordid;
+	
+	/** The first word. */
+	boolean firstWord = true;
+	
+	/** The wordvalue. */
+	String wordvalue;
+	
+	/** The interpvalue. */
+	String interpvalue;
+	
+	/** The lastword. */
+	String lastword = " ";
+	
+	/** The wordtype. */
+	String wordtype;
+	
+	/** The flagform. */
+	boolean flagform = false;
+	
+	/** The flaginterp. */
+	boolean flaginterp = false;
+	
+	/** The url. */
+	private def url;
+	
+	/** The input data. */
+	private def inputData;
+	
+	/** The factory. */
+	private def factory;
+	
+	/** The parser. */
+	private XMLStreamReader parser;
+	
+	/** The writer. */
+	OutputStreamWriter writer;
+	
+	/** The multiwriter. */
+	OutputStreamWriter multiwriter = null;
+	
+	/** The infile. */
+	File infile;
+	
+	/** The outfile. */
+	File outfile;
+	
+	/** The pages. */
+	ArrayList<File> pages = new ArrayList<File>();
+	
+	/** The idxstart. */
+	ArrayList<String> idxstart = new ArrayList<String>();
+	
+	/** The titre id. */
+	String titreId;
+
+	/**
+	 * Instantiates a new pager.
+	 *
+	 * @param infile the infile
+	 * @param outfile the outfile
+	 * @param NoSpaceBefore the no space before
+	 * @param NoSpaceAfter the no space after
+	 * @param max the max
+	 */
+	pager(File infile, File outfile, List<String> NoSpaceBefore,
+			List<String> NoSpaceAfter, int max) {
+		this.wordmax = max;
+		this.NoSpaceBefore = NoSpaceBefore;
+		this.NoSpaceAfter = NoSpaceAfter;
+		this.url = infile.toURI().toURL();
+		this.infile = infile;
+
+		inputData = url.openStream();
+		factory = XMLInputFactory.newInstance();
+		parser = factory.createXMLStreamReader(inputData);
+		createOutput(outfile);
+		process();
+	}
+
+	/**
+	 * Creates the next output.
+	 *
+	 * @return true, if successful
+	 */
+	private boolean createNextOutput()
+	{
+		try {
+			if(multiwriter != null)
+			{
+				multiwriter.write("</body>");
+				multiwriter.write("</html>");
+				multiwriter.close();
+			}
+			pagecount++;
+			File f = new File(outfile.getParent()+"/multi/",outfile.getName().substring(0,outfile.getName().length()-5)+"_"+pagecount+".html");
+			pages.add(f);
+			idxstart.add(wordid)
+			multiwriter = new OutputStreamWriter(new FileOutputStream(f) , "UTF-8");
+			
+			multiwriter.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
+			multiwriter.write("<html>");
+			multiwriter.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/>");
+			multiwriter.write("<head>");
+			multiwriter.write("<title>BFM - "+titreId+" - "+pagecount+"</title>");
+			multiwriter.write("</head>");
+			multiwriter.write("<body>");
+			if(wordid != null)
+			{
+				String[] splited = wordid.split("_");
+				int no = Integer.parseInt(splited[1]);
+				multiwriter.write("<span id=\""+splited[0]+"_"+(no++)+"\"/>");
+			}
+						
+			return true;
+		} catch (Exception e) {
+			System.out.println(e.getLocalizedMessage());
+			return false;
+		}
+	}
+
+	/**
+	 * Creates the output.
+	 *
+	 * @param outfile the outfile
+	 * @return true, if successful
+	 */
+	private boolean createOutput(File outfile) {
+		try {
+			this.outfile = outfile;
+
+			writer = new OutputStreamWriter(new FileOutputStream(outfile),
+					"UTF-8");
+
+			return true;
+		} catch (Exception e) {
+			System.out.println(e.getLocalizedMessage());
+			return false;
+		}
+	}
+
+	/**
+	 * Gets the page files.
+	 *
+	 * @return the page files
+	 */
+	public ArrayList<File> getPageFiles() {
+		return pages;
+	}
+
+	/**
+	 * Gets the idx.
+	 *
+	 * @return the idx
+	 */
+	public ArrayList<String> getIdx() {
+		return idxstart;
+	}
+
+	/**
+	 * Process.
+	 */
+	void process()
+	{
+		String localname = "";
+		
+		boolean closeTitre = false;
+		boolean closeAmen = false;
+		
+		boolean flagchoice = false;
+		boolean flagcorr = false;
+		boolean flagsic = false;
+		boolean flagreg = false;
+		boolean flagexpan = false;
+		boolean flagorig = false;
+		boolean flagabbr = false;
+		boolean flagforeign = false;
+				
+		File xpathfile = infile;
+		titreId = XPathResult.getXpathResponse(xpathfile,"tei:TEI/tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:title[@type='normal']/text()");
+		String auteur = XPathResult.getXpathResponse(xpathfile,"tei:TEI/tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:author");
+		String datecompo = XPathResult.getXpathResponse(xpathfile,"tei:TEI/tei:teiHeader/tei:profileDesc/tei:creation/tei:date[@type='compo']/@when");
+		String ssiecle = XPathResult.getXpathResponse(xpathfile,"tei:TEI/tei:teiHeader/tei:profileDesc/tei:creation/tei:date[@type='compo_sous_siecle']/@n");
+		String domaine = XPathResult.getXpathResponse(xpathfile,"tei:TEI/tei:teiHeader/tei:profileDesc/tei:textDesc/tei:domain/@type");
+		String genre = XPathResult.getXpathResponse(xpathfile,"tei:TEI/tei:teiHeader/tei:profileDesc/tei:textDesc/@n");
+		String forme = XPathResult.getXpathResponse(xpathfile,"tei:TEI/tei:teiHeader/tei:profileDesc/tei:textClass/tei:catRef/@target[contains(.,'forme')]");
+		String dialecte = XPathResult.getXpathResponse(xpathfile,"tei:TEI/tei:teiHeader/tei:profileDesc/tei:creation/tei:region[@type='dialecte_auteur']");
+		if(titreId == null)
+			System.err.println("titreId regexp error");
+		if(auteur == null)
+			System.err.println("auteur regexp error");
+		if(datecompo == null)
+			System.err.println("datecompo regexp error");
+		if(ssiecle == null)
+			System.err.println("ssiecle regexp error");
+		if(domaine == null)
+			System.err.println("domaine regexp error");
+		if(genre == null)
+			System.err.println("genre regexp error");
+		if(forme == null)
+			System.err.println("forme regexp error");
+		
+		if(dialecte == null)
+			System.err.println("dialecte regexp error");
+		if(titreId == null || auteur == null || datecompo == null || ssiecle == null || domaine == null || genre == null || forme == null || dialecte == null)
+			return;
+		forme = forme.substring(1);
+		createNextOutput();
+		
+		writer.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
+		writer.write("<html>");
+		writer.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/>");
+		writer.write("<head>");
+		writer.write("<title>BFM - "+titreId+"</title>");
+		writer.write("</head>");
+		writer.write("<body>");
+		
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+			
+			
+			switch (event) {
+				case XMLStreamConstants.START_ELEMENT:
+					localname = parser.getLocalName();
+					switch(localname)
+					{
+					case "text":
+						
+						writer.write("<h1 align=\"center\" style=\"color:darkviolet;font-family:Times;font-weight:bold;font-style:italic;font-size=200%\" class=\"text\">"+titreId+"</h1>")
+						writer.write("<p align=\"center\">")
+						writer.write("_____________________________________________________<br/>\n")
+						writer.write("auteur : "+auteur+"<br/>");
+						writer.write("date de composition : "+datecompo+"<br/>");
+						writer.write("sous-siècle : "+ssiecle+"<br/>");
+						writer.write("domaine : "+domaine+"<br/>");
+						writer.write("genre : "+genre+"<br/>");
+						writer.write("forme : "+forme+"<br/>");
+						writer.write("dialecte : "+dialecte+"<br/>");
+						writer.write("_____________________________________________________<br/>\n")
+						writer.write("</p>")
+						
+						
+						multiwriter.write("<h1 align=\"center\" style=\"color:darkviolet;font-family:Times;font-weight:bold;font-style:italic;font-size=200%\" class=\"text\">"+titreId+"</h1>")
+						multiwriter.write("<p align=\"center\">")
+						multiwriter.write("_____________________________________________________<br/>\n")
+						multiwriter.write("auteur : "+auteur+"<br/>");
+						multiwriter.write("date de composition : "+datecompo+"<br/>");
+						multiwriter.write("sous-siècle : "+ssiecle+"<br/>");
+						multiwriter.write("domaine : "+domaine+"<br/>");
+						multiwriter.write("genre : "+genre+"<br/>");
+						multiwriter.write("forme : "+forme+"<br/>");
+						multiwriter.write("dialecte : "+dialecte+"<br/>");
+						multiwriter.write("_____________________________________________________<br/>\n")
+						multiwriter.write("</p>")
+						
+						break;
+						break;
+						case "head":
+							writer.write("<h2>\n")
+							multiwriter.write("<h2>\n")
+							break;
+						
+						case "lg":
+							writer.write("<p>\n")
+							multiwriter.write("<p>\n")
+							break;
+						
+						case "pb":
+							if(wordcount > 0)
+								createNextOutput();
+							if(parser.getAttributeValue(null,"n") != null)
+							{
+								writer.write("<p style=\"color:red\" align=\"center\">- "+parser.getAttributeValue(null,"n")+" -</p>\n")
+								multiwriter.write("<p style=\"color:red\" align=\"center\">- "+parser.getAttributeValue(null,"n")+" -</p>\n")
+							}
+							break;
+						
+						case "ab":
+							if(parser.getAttributeValue(null,"n") != null)
+							{
+								writer.write("<p align=\"center\">"+parser.getAttributeValue(null,"n")+"</p>\n")
+								multiwriter.write("<p align=\"center\">"+parser.getAttributeValue(null,"n")+"</p>\n")
+							}
+							break;
+						case "l":
+							writer.write("<br/>\n")
+							multiwriter.write("<br/>\n")
+							break;
+						
+						case "p":
+						case "q":
+							writer.write("<p>\n")
+							multiwriter.write("<p>\n")
+							break;
+						
+						case "div":
+							if(parser.getAttributeValue(null,"type") == "titre")
+							{
+								writer.write("<h3>\n")
+								multiwriter.write("<h3>\n")
+								closeTitre = true;
+							}
+							else if(parser.getAttributeValue(null,"type") == "amen")
+							{
+								writer.write("<h3>\n")
+								multiwriter.write("<h3>\n")
+								closeAmen = true;
+							}
+							break;
+													
+						case "w":
+							wordid = parser.getAttributeValue(null,"id");
+							if(firstWord)
+							{
+								firstWord=false;
+								this.idxstart.set(0,wordid);
+							}
+							wordcount++;
+							if(wordcount >= wordmax)
+							{
+								
+								wordcount=0;
+							}
+							break;
+						
+						case "choice":
+							flagchoice = true;
+							break;
+						case "corr":
+							flagcorr = true;
+							break;
+						case "sic":
+							flagsic = true;
+							break;
+						case "reg":
+							flagreg = true;
+							break;
+						case "orig":
+							flagorig = true;
+							break;
+						case "foreign":
+							flagforeign = true;
+							break;
+						
+						case "ana":
+							flaginterp=true;
+							interpvalue+=" "+parser.getAttributeValue(null,"type").substring(1)+":"
+							break;
+						
+						case "form":
+							wordvalue="";
+							interpvalue ="";
+							flagform=true;
+					}
+					break;
+				case XMLStreamConstants.END_ELEMENT:
+					localname = parser.getLocalName();
+					switch(localname)
+					{
+						case "head":
+							writer.write("</h2>\n")
+							multiwriter.write("</h2>\n")
+							break;
+						
+						case "div":
+							if(closeTitre)
+							{
+								writer.write("</h3>\n")
+								multiwriter.write("</h3>\n")
+								closeTitre = false;
+							}
+							else if(closeAmen)
+							{
+								writer.write("</h3>\n")
+								multiwriter.write("</h3>\n")
+								closeTitre = false;
+							}
+							break;
+						
+						case "lg":
+							writer.write("</p>\n")
+							multiwriter.write("</p>\n")
+							break;
+						
+						case "lb":
+							writer.write("<br/>\n")
+							multiwriter.write("<br/>\n")
+							break;
+						
+						case "p":
+						case "q":
+							writer.write("</p>\n")
+							multiwriter.write("</p>\n")
+							break;
+						
+						case "choice":
+							flagchoice = false;
+							break;
+						case "corr":
+							flagcorr = false;
+							break;
+						case "sic":
+							flagsic = false;
+							break;
+						case "reg":
+							flagreg = false;
+							break;
+						case "orig":
+							flagorig = false;
+							break;
+						case "foreign":
+							flagforeign = false;
+							break;
+						
+						case "form":
+							flagform = false
+							break;
+						
+						case "ana":
+							flaginterp = false
+							break;
+						
+						case "w":
+							int l = lastword.length();
+							String color = "";
+							if(flagcorr)
+								color = "style=\"color: green;\"";
+							else if(flagreg)
+								color = "style=\"color: blue;\"";
+							else if(flagforeign)
+								color = "style=\"color: blue;\"";
+							if(!flagchoice || flagcorr || flagreg)
+							{
+								String endOfLastWord = "";
+								if(l > 0)
+									endOfLastWord = lastword.subSequence(l-1, l);
+								
+								if(interpvalue != null)
+									interpvalue = interpvalue.replace("\"","&quot;");
+								
+								if(NoSpaceBefore.contains(wordvalue) || 
+										NoSpaceAfter.contains(lastword) || 
+										wordvalue.startsWith("-") || 
+										NoSpaceAfter.contains(endOfLastWord))
+								{
+									writer.write("<span title=\""+interpvalue+"\" id=\""+wordid+"\" "+color+">");
+									multiwriter.write("<span title=\""+interpvalue+"\" id=\""+wordid+"\" "+color+">");
+								}
+								else
+								{
+									writer.write(" <span title=\""+interpvalue+"\" id=\""+wordid+"\" "+color+">");
+									multiwriter.write(" <span title=\""+interpvalue+"\" id=\""+wordid+"\" "+color+">");
+								}
+								writer.write(wordvalue.replace("<", "&lt;")+"</span>");
+								multiwriter.write(wordvalue.replace("<", "&lt;")+"</span>");
+								lastword=wordvalue;
+							}
+						
+						
+							break;
+					}
+					break;
+				
+				case XMLStreamConstants.CHARACTERS:
+					if(flagform)
+						if(parser.getText().length() > 0)
+							wordvalue+=(parser.getText());
+					if(flaginterp)
+						if(parser.getText().length() > 0)
+							interpvalue+=(parser.getText());
+					break;
+			}
+		}	
+		writer.write("</body>");
+		writer.write("</html>");
+		writer.close();
+		multiwriter.write("</body>");
+		multiwriter.write("</html>");
+		multiwriter.close();
+		inputData.close();
+	}
+
+	/**
+	 * Writecorrespondances file.
+	 *
+	 * @param file the file
+	 * @return the java.lang. object
+	 */
+	public writecorrespondancesFile(File file)
+	{
+		Writer w = new OutputStreamWriter(new FileOutputStream(file,file.exists()) , "UTF-8");
+		for(int i = 0 ; i < pages.size(); i ++)
+		{
+			w.write(pages.get(i).getName()+"\t"+idxstart.get(i)+"\n")
+		}
+		w.close();
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/corptef/importer.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/corptef/importer.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/corptef/importer.groovy	(revision 258)
@@ -0,0 +1,166 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer.corptef;
+
+import org.txm.importer.*;
+import org.txm.importer.filters.*;
+import org.txm.scripts.*;
+import org.txm.scripts.teitxm.*;
+import org.txm.utils.treetagger.TreeTagger;
+import javax.xml.stream.*;
+import java.net.URL;
+
+import org.txm.Toolbox;
+
+import filters.CutHeader.*;
+import filters.ReunitBrokenWords.*;
+import filters.Tokeniser.*;
+import filters.TagSentences.*;
+import filters.FusionHeader.*;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class importer.
+ */
+class importer {
+	
+	/**
+	 * Run.
+	 *
+	 * @param dir the dir
+	 */
+	public void run(File dir)
+	{
+		//prepare
+		String rootDir = dir.getAbsolutePath()+"/";
+
+		//clean directories
+		File binDir = new File(Toolbox.getParam(Toolbox.USER_TXM_HOME),"corpora/corptef");
+		binDir.deleteDir();
+		binDir.mkdir();
+		new File(binDir,"ptokenized").deleteDir();
+		new File(binDir,"ptokenized").mkdir();
+		new File(binDir,"tokenized").deleteDir();
+		new File(binDir,"tokenized").mkdir();
+		new File(binDir,"headers").deleteDir();
+		new File(binDir,"headers").mkdir();
+		new File(binDir,"txm").deleteDir();
+		new File(binDir,"txm").mkdir();
+
+		ArrayList<String> milestones = new ArrayList<String>();
+
+		List<File> files = new File(rootDir,"").listFiles();//scan directory split
+
+		//PREPARE EACH FILE TO BE TOKENIZED
+		for(File f : files)
+		{
+			File srcfile = f;
+			File resultfile = new File(binDir,"ptokenized/"+f.getName());
+			println("prepare tokenizer file : "+srcfile+" to : "+resultfile );
+
+			def builder2 = new OneTagPerLine(srcfile.toURL(), milestones);
+			builder2.process(resultfile);
+		}
+
+		rootDir = binDir.getAbsolutePath();
+
+		//TOKENIZE FILES
+		//Manager<Filter> filterManager = new FilterManager(ActionHome);	
+		files = new File(rootDir,"ptokenized").listFiles();//scan directory split
+		for(File infile : files)
+		{
+			Sequence S = new Sequence();
+			Filter F1 = new CutHeader();
+			Filter F2 = new ReunitBrokenWords();
+			Filter F6 = new Tokeniser(infile);
+			Filter F7 = new TagSentences();
+			Filter F11 = new FusionHeader();
+			S.add(F1);
+			S.add(F2);
+			S.add(F6);
+			//S.add(F7);
+			S.add(F11);
+
+			File xmlfile = new File(rootDir,"tokenized/"+infile.getName());
+			println("Tokenizing "+xmlfile)
+			S.SetInFileAndOutFile(infile.getAbsolutePath(), xmlfile.getAbsolutePath());
+			S.setEncodages("UTF-8","UTF-8");
+
+			Object[] arguments1 = [rootDir+"/headers/"+infile.getName()+"header.xml"];
+			F1.SetUsedParam(arguments1);
+			Object[] arguments2 = [rootDir+"/headers/"+infile.getName()+"header.xml",F1];
+			F11.SetUsedParam(arguments2);
+
+			S.proceed();
+			S.clean();
+		}
+
+		files = new File(rootDir,"tokenized").listFiles()
+		//TRANSFORM INTO XML-TEI-TXM
+		for(File f : files)
+		{
+			//ArrayList<String> milestones = new ArrayList<String>();
+			println("Building xml-tei-txm "+f+ " >> "+f.getName())
+			File file = f; 
+			String txmfile = f.getName();
+
+			def correspType = new HashMap<String,String>()
+			def correspRef = new HashMap<String,String>()
+
+			//il faut lister les id de tous les respStmt
+			def respId = [];
+			//fait la correspondance entre le respId et le rapport d'execution de l'outil
+			def applications = new HashMap<String,HashMap<String,String>>();	
+			//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[]>();
+			//associe un id d'item avec sa description et son URI
+			def itemsURI = new HashMap<String,HashMap<String,String>>();
+			//informations de respStmt
+			//resps (respId <voir ci-dessus>, [description, person, date])
+			def resps = new HashMap<String,String[]>();
+
+			//lance le traitement
+			def builder3 = new Xml2Ana(file);
+			builder3.setCorrespondances(correspRef, correspType);
+			builder3.setHeaderInfos(respId,resps, applications, taxonomiesUtilisees, itemsURI)
+			builder3.transformFile(rootDir,"txm/"+txmfile);
+		}
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args)
+	{
+		File dir = new File("C:/TXM/corpora/corptef/")
+		new importer().run(dir);
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/corptef/annotate.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/corptef/annotate.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/corptef/annotate.groovy	(revision 258)
@@ -0,0 +1,146 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-11-08 13:38:06 +0100 (ven., 08 nov. 2013) $
+// $LastChangedRevision: 2569 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer.corptef;
+
+import org.txm.importer.cwb.*
+import org.txm.scripts.teitxm.*;
+import org.txm.importer.*;
+import org.txm.utils.treetagger.TreeTagger;
+import org.txm.Toolbox;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class annotate.
+ */
+class annotate {
+	
+	/**
+	 * Run.
+	 *
+	 * @param dir the dir
+	 */
+	public void run(File dir)
+	{
+		String rootDir = dir.getAbsolutePath()+"/";//"~/xml/discours/src";
+		String txmDir = dir.getAbsolutePath()+"/txm/"
+
+		//cleaning
+		new File(rootDir,"annotations").deleteDir();
+		new File(rootDir,"annotations").mkdir();
+		new File(rootDir,"treetagger").deleteDir();
+		new File(rootDir,"treetagger").mkdir();
+		println txmDir
+		List<File> listfiles = new File(txmDir).listFiles();
+		for(File teifile : listfiles)
+		{
+			println("annotate "+teifile)
+			File modelfile = new File(Toolbox.getParam(Toolbox.TREETAGGER_MODELS_PATH),"/rgaqcj.par");
+			if(!modelfile.exists())
+			{
+				println "Skipping ANNOTATE: Incorrect modelfile path: "+modelfile;
+				return;
+			}
+			File annotfile = new File(rootDir+"annotations",teifile.getName()+"-STDOFF.xml");
+			File ttsrcfile = new File(rootDir+"treetagger",teifile.getName()+"-src.tt");
+			File ttrezfile = new File(rootDir+"treetagger",teifile.getName()+"-out.tt");
+			
+			//prepare file to be tagged
+			def builder = new BuildTTSrc(teifile.toURL());
+			builder.process(ttsrcfile);
+			
+			//Apply TT
+			if(!new File(Toolbox.getParam(Toolbox.TREETAGGER_INSTALL_PATH)+"/bin/").exists() || Toolbox.getParam(Toolbox.TREETAGGER_INSTALL_PATH).length() == 0 )
+			{
+				println("Path to TreeTagger is wrong: "+Toolbox.getParam(Toolbox.TREETAGGER_INSTALL_PATH)+"/bin/")
+				return;
+			}
+			TreeTagger tt = new TreeTagger(Toolbox.getParam(Toolbox.TREETAGGER_INSTALL_PATH)+"/bin/");
+			tt.settoken();
+			tt.setlemma();
+			tt.setquiet();
+			tt.setnounknown();
+			tt.setsgml();
+			tt.seteostag("<s>");
+			tt.treetagger( modelfile.getAbsolutePath(), ttsrcfile.getAbsolutePath(), ttrezfile.getAbsolutePath())
+			
+			//create stand-off annotation file
+			//targeted file for annotations
+			String target = teifile.getName()
+			
+			
+			//contains txm:application/txm:commandLine
+			File reportFile = new File(rootDir,"NLPToolsParameters.xml");
+			
+			String respPerson = System.getProperty("user.name");
+			String respId = "txm";
+			String respDesc = "NLP annotation tool";
+			String respDate = "Tue Mar  11 1:02:55 Paris, Madrid 2010";
+			String respWhen = ""
+			
+			String appIdent = "TreeTagger";
+			String appVersion = "3.2";
+			
+			String distributor = "";
+			String publiStmt = """""";
+			String sourceStmt = """""";
+			
+			def types = ["ttpos","ttlemma"];
+			def typesTITLE = ["ttpos","ttlemma"];
+			def typesDesc = ["fr pos","fr lemma"]
+			def typesTAGSET = ["",""]
+			def typesWEB = ["",""]
+			String idform ="w_";
+			String encoding ="UTF-8";
+			
+			def transfo = new CSV2W_ANA();
+			transfo.setAnnotationTypes( types, typesDesc, typesTAGSET, typesWEB, idform);
+			transfo.setResp(respId, respDesc,respDate, respPerson, respWhen);
+			transfo.setApp(appIdent, appVersion);
+			transfo.setTarget(target, reportFile);
+			transfo.setInfos(distributor,  publiStmt, sourceStmt);
+			transfo.process( ttrezfile, annotfile, encoding );
+			
+			//merge into the tei file
+			builder = new AnnotationInjection(teifile.toURL(), annotfile.toURL(), new ArrayList<String>());
+			builder.transfomFile(rootDir,"temp");
+			
+			if (!(teifile.delete() && new File(rootDir,"temp").renameTo(teifile))) println "Warning can't rename file "+new File(rootDir,"temp")+" to "+teifile
+		}
+	}
+	
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args)
+	{
+		File dir = new File("C:/Documents and Settings/alavrent/TXM/corpora/corptef/")
+		new annotate().run(dir);
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/corptef/corptefLoader.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/corptef/corptefLoader.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/corptef/corptefLoader.groovy	(revision 258)
@@ -0,0 +1,134 @@
+/**
+ * Main.
+ *
+ * @param args the args
+ */
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer.corptef;
+
+import org.txm.importer.corptef.importer;
+import org.txm.importer.corptef.compiler;
+import org.txm.importer.corptef.annotate;
+import org.txm.importer.corptef.pager;
+import org.txm.objects.*;
+import org.txm.*;
+import org.txm.scripts.teitxm.*;
+import org.txm.utils.i18n.*;
+
+// TODO: Auto-generated Javadoc
+/* (non-Javadoc)
+ * @see groovy.lang.Script#run()
+ */
+String userDir = System.getProperty("user.home");
+String rootDir;
+String lang;
+String encoding;
+String model;
+try{rootDir = rootDirBinding;lang=langBinding;encoding=encodingBinding;model=modelBinding;}
+catch(Exception)
+{	println "DEV MODE";//exception means we debug
+	if(!org.txm.Toolbox.isInitialized())
+	{
+		//rootDir = "C:\\Documents and Settings\\alavrent\\TXM\\sources\\corptef\\src";
+		rootDir = userDir+"/xml/corptef"
+		lang="fr";
+		encoding= "UTF-8";
+		model="rgaqcj";
+		Toolbox.workspace = new Workspace(new File(userDir,"TXM/workspaces/default.xml"));
+		Toolbox.setParam(Toolbox.INSTALL_DIR,new File(userDir,"txminstall"));
+		Toolbox.setParam(Toolbox.TREETAGGER_INSTALL_PATH,new File(userDir,"txminstall/treetagger"));
+		Toolbox.setParam(Toolbox.TREETAGGER_MODELS_PATH,new File(userDir,"txminstall/treetagger/models"));
+		Toolbox.setParam(Toolbox.USER_TXM_HOME, new File(System.getProperty("user.home"),"TXM"));
+	}
+}
+
+File dir = new File(rootDir);
+
+println "-- IMPORTER - Reading source files"
+new importer().run(dir);
+
+File binDir = new File(Toolbox.getParam(Toolbox.USER_TXM_HOME),"corpora/corptef");
+rootDir = binDir.getAbsolutePath();
+dir = new File(rootDir);
+
+println "-- ANNOTATE - Running NLP tools"
+new Annotate().run(dir,model+".par");
+
+println "-- COMPILING - Building Search Engine indexes"
+def c = new compiler();
+c.setDebug();
+//c.setCwbPath("C:/Program Files/TXM/cwb/bin");
+c.setLang(lang);
+c.run(dir);
+
+
+//move registry file to cwb registry dir
+File registryfile = new File(rootDir+"/registry","corptef");
+if(registryfile.exists())
+	org.txm.utils.io.FileCopy.copy(registryfile,new File(Toolbox.getParam(Toolbox.USER_TXM_HOME),"registry/corptef"))
+
+Workspace w = org.txm.Toolbox.workspace;
+Project p = w.getProject("default")
+p.removeBase("corptef")
+Base b = p.addBase("corptef");
+b.addDirectory(new File(rootDir,"txm"));
+b.setAttribute("lang", lang)
+b.propagateAttribute("lang")
+
+println "-- EDITION"
+new File(rootDir+"/HTML/").deleteDir()
+new File(rootDir+"/HTML/").mkdir();
+new File(rootDir+"/HTML/default/").mkdir();
+files = new File(rootDir,"txm").listFiles();
+
+for(String textname : b.getTextsID())
+{
+	Text text = b .getText(textname);
+	File srcfile = text.getSource();
+	File resultfile = new File(rootDir+"/HTML",srcfile.getName().substring(0,srcfile.getName().length()-4)+".html");
+	List<String> NoSpaceBefore = LangFormater.getNoSpaceBefore(lang);
+	List<String> NoSpaceAfter = LangFormater.getNoSpaceAfter(lang);
+	println("Building edition  : "+srcfile+" to : "+resultfile );
+	
+	def ed = new pager(srcfile,resultfile, NoSpaceBefore, NoSpaceAfter,600);
+	ed.writecorrespondancesFile(new File(rootDir,"edition_correspondances.txt"))
+	Edition editionweb = text.addEdition("default","html",resultfile);
+
+	for(int i = 0 ; i < ed.getPageFiles().size();i++)
+	{
+		File f = ed.getPageFiles().get(i);
+		String idx = ed.getIdx().get(i);
+		editionweb.addPage(f,idx);
+	}
+	
+//	Edition editionbp = text.addEdition("onepage","html",resultfile);
+//	editionbp.addPage(resultfile,ed.getIdx().get(0));
+}
+
+w.save();
Index: tmp/org.txm.core/src/groovy/org/txm/importer/corptef/compiler.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/corptef/compiler.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/corptef/compiler.groovy	(revision 258)
@@ -0,0 +1,617 @@
+// 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
+// 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.
+//
+//
+//
+// $LastChangedDate: 2017-01-24 18:11:42 +0100 (Tue, 24 Jan 2017) $
+// $LastChangedRevision: 3400 $
+// $LastChangedBy: mdecorde $
+//
+package org.txm.importer.corptef
+
+
+import org.txm.importer.cwb.CwbEncode
+import org.txm.importer.cwb.CwbMakeAll
+import org.txm.importer.*;
+import org.txm.scripts.*;
+import org.txm.scripts.teitxm.BuildTTSrc;
+import org.txm.scripts.teitxm.*;
+import org.txm.utils.treetagger.TreeTagger;
+
+import javax.xml.stream.*;
+import java.net.URL;
+import java.io.File;
+import java.util.HashMap;
+import java.util.List;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class compiler.
+ */
+class compiler
+{
+
+	/** The debug. */
+	private boolean debug= false;
+
+	/** The input data. */
+	private def inputData;
+
+	/** The factory. */
+	private def factory;
+
+	/** The parser. */
+	private XMLStreamReader parser;
+
+	/** The dir. */
+	private def dir;
+
+	/** The output. */
+	private def output;
+
+	/** The url. */
+	private def url;
+
+	/** The anahash. */
+	private HashMap<String,String> anahash =new HashMap<String,String>() ;
+
+	/** The text. */
+	String text="";
+
+	/** The base. */
+	String base="";
+
+	/** The project. */
+	String project="";
+
+	/** The cwb loc. */
+	String cwbLoc;
+
+	/** The lang. */
+	private String lang ="fr";
+
+	/**
+	 * initialize.
+	 *
+	 */
+	public compiler(){}
+
+	/**
+	 * Instantiates a new compiler.
+	 *
+	 * @param url the url
+	 * @param text the text
+	 * @param base the base
+	 * @param project the project
+	 */
+	public compiler(URL url,String text,String base, String project)
+	{
+		this.text = text
+		this.base = base;
+		this.project = project;
+		try {
+			this.url = url;
+			inputData = url.openStream();
+
+			factory = XMLInputFactory.newInstance();
+			parser = factory.createXMLStreamReader(inputData);
+		} catch (XMLStreamException ex) {
+			System.out.println(ex);
+		}catch (IOException ex) {
+			System.out.println("IOException while parsing ");
+		}
+	}
+
+	/**
+	 * set the language of the corpus.
+	 *
+	 * @param lang the lang
+	 * @return the java.lang. object
+	 */
+	public setLang(String lang)
+	{
+		this.lang = lang;
+	}
+
+	/**
+	 * Sets the cwb path.
+	 *
+	 * @param path the new cwb path
+	 */
+	public void setCwbPath(String path)
+	{
+		if(!new File(path).exists())
+			System.err.println("CWB Path : "+path+" does not exists")
+		cwbLoc = path;
+	}
+
+	/**
+	 * Creates the output.
+	 *
+	 * @param dirPathName the dir path name
+	 * @param fileName the file name
+	 * @return true, if successful
+	 */
+	private boolean createOutput(String dirPathName, String fileName){
+		try {
+			File f = new File(dirPathName, fileName)
+			output = new OutputStreamWriter(new FileOutputStream(f,f.exists()) , "UTF-8");
+			return true;
+		} catch (Exception e) {
+			System.out.println(e.getLocalizedMessage());
+			return false;
+		}
+	}
+
+	/**
+	 * Go to text.
+	 */
+	private void GoToText()
+	{
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next())
+		{
+			if(event == XMLStreamConstants.END_ELEMENT)
+				if(parser.getLocalName().equals("teiHeader"))
+					return;
+		}
+	}
+
+	/**
+	 * Transfom file wtc.
+	 *
+	 * @param dirPathName the dir path name
+	 * @param fileName the file name
+	 * @return true, if successful
+	 */
+	public boolean transfomFileWtc(String dirPathName, String fileName)
+	{
+		createOutput(dirPathName, fileName);
+
+		String headvalue=""
+		String vAna = "";
+		String vForm = "";
+		String wordid= "";
+		String vHead = "";
+
+		int p_id = 0;
+		int q_id = 0;
+		int body_id = 0;
+		int front_id = 0;
+		int back_id = 0;
+		String lb_id = 0;
+		int lb_count = 0;
+		String pb_id = 0;
+		int pb_count = 0;
+		String ab_id = 0;
+
+		boolean captureword = false;
+
+		String vExpan = "";
+		String vCorr = "";
+		String vReg = "";
+		String vOrig = "";
+		String vSic = "";
+		String vAbbr = "";
+
+		boolean flaglg = false;
+		boolean flaghead = false;
+		boolean flagAuthor = false;
+		boolean flagDate = false;
+		boolean flagWord = false;
+		boolean flagForm = false;
+		boolean flagAna = false;
+
+		boolean flagchoice = false;
+		boolean flagcorr = false;
+		boolean flagsic = false;
+		boolean flagreg = false;
+		boolean flagexpan = false;
+		boolean flagorig = false;
+		boolean flagabbr = false;
+		boolean flagfw = false;
+
+		File xpathfile = new File(url.getFile());
+		String titreId = XPathResult.getXpathResponse(xpathfile,"tei:TEI/tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:title[@type='reference']/text()");
+		String auteur = XPathResult.getXpathResponse(xpathfile,"tei:TEI/tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:author/text()");
+		String datecompo = XPathResult.getXpathResponse(xpathfile,"tei:TEI/tei:teiHeader/tei:profileDesc/tei:creation/tei:date[@type='compo']/@when");
+		String ssiecle = XPathResult.getXpathResponse(xpathfile,"tei:TEI/tei:teiHeader/tei:profileDesc/tei:creation/tei:date[@type='compo_sous_siecle']/@n");
+		String domaine = XPathResult.getXpathResponse(xpathfile,"tei:TEI/tei:teiHeader/tei:profileDesc/tei:textDesc/tei:domain/@type");
+		String genre = XPathResult.getXpathResponse(xpathfile,"tei:TEI/tei:teiHeader/tei:profileDesc/tei:textDesc/@n");
+		String forme = XPathResult.getXpathResponse(xpathfile,"tei:TEI/tei:teiHeader/tei:profileDesc/tei:textClass/tei:catRef/@target[contains(.,'forme')]").substring(1);
+		String dialecte = XPathResult.getXpathResponse(xpathfile,"tei:TEI/tei:teiHeader/tei:profileDesc/tei:creation/tei:region[@type='dialecte_auteur']/text()");
+
+		this.GoToText()
+		output.write("<txmcorpus lang=\""+lang+"\">\n");
+		try
+		{
+			for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next())
+			{
+				switch (event)
+				{
+					case XMLStreamConstants.START_ELEMENT:
+						switch (parser.getLocalName())
+						{
+							case "text":
+							output.write("<text id=\""+text+"\"" +
+							" titre=\""+titreId+"\"" +
+							" auteur=\""+auteur+"\"" +
+							" datecompo=\""+datecompo+"\"" +
+							" ssiecle=\""+ssiecle+"\"" +
+							" domaine=\""+domaine+"\"" +
+							" genre=\""+genre+"\"" +
+							" forme=\""+forme+"\"" +
+							" dialecte=\""+dialecte+"\"" +
+							" base=\""+base+"\"" +
+							" project=\""+project+"\">\n");
+							captureword=true;
+							break;
+
+							case "div":
+							//output.write("<div type=\""+parser.getAttributeValue(null,"type")+"\">\n");
+							break;
+
+							case "p":
+							output.write("<p n=\""+(p_id++)+"\">\n");
+							break;
+							case "ab":
+							output.write("<ab n=\""+ab_id+++"\" rend=\""+parser.getAttributeValue(null,"rend")+"\">\n");
+							break;
+							case "q":
+							output.write("<q n=\""+(q_id++)+"\">\n");
+							break;
+							case "front":
+							output.write("<front n=\""+(front_id++)+"\">\n");
+							break;
+							case "body":
+							output.write("<body n=\""+(body_id++)+"\">\n");
+							break;
+							case "back":
+							output.write("<back n=\""+(back_id++)+"\">\n");
+							break;
+							case "lb":
+							String n = parser.getAttributeValue(null,"n")
+							if(n != null)
+								lb_id = n;
+							else
+								lb_id =""+lb_count++;
+							break;
+							case "pb":
+							String n = parser.getAttributeValue(null,"n");
+							if(n != null)
+								pb_id = n;
+							else
+								pb_id = ""+(pb_count++);
+
+							break;
+
+							case "choice":
+							flagchoice = true;
+							break;
+							case "corr":
+							flagcorr = true;
+							vCorr= "";
+							break;
+							case "reg":
+							flagreg = true;
+							vReg= "";
+							break;
+							case "expan":
+							flagexpan = true;
+							vExpan= "";
+							break;
+							case "orig":
+							flagreg = true;
+							vOrig= "";
+							break;
+							case "sic":
+							flagsic = true;
+							vSic= "";
+							break;
+							case "abbr":
+							flagreg = true;
+							vAbbr= "";
+							break;
+
+							case "w":
+							for(int i = 0 ; i < parser.getAttributeCount(); i++)
+								if(parser.getAttributeLocalName(i).equals("id"))
+							{
+								wordid = parser.getAttributeValue(i);
+							}
+							vAna = "";
+							vForm = "";
+							flagWord = true;
+							break;
+							case "form":
+							flagForm = true;
+							vForm = "";
+							vAna ="";
+							break;
+
+							case "ana":
+							flagAna = true;
+							break;
+						}
+						break;
+
+					case XMLStreamConstants.END_ELEMENT:
+						switch (parser.getLocalName())
+						{
+							case "div":
+							break;
+
+							case "text":
+							output.write("</text>\n");
+							captureword=false;
+							break;
+							case "p":
+							output.write("</p>\n");
+							break;
+							case "ab":
+							output.write("</ab>\n");
+							break;
+							case "q":
+							output.write("</q>\n");
+							break;
+							case "front":
+							output.write("</front>\n");
+							break;
+							case "body":
+							output.write("</body>\n");
+							break;
+							case "back":
+							output.write("</back>\n");
+							break;
+
+							case "fw":
+							flagfw = false;
+							break;
+							case "choice":
+
+							if(vCorr != "")
+							{
+								//System.out.println(vCorr+" >> write corr "+vForm +"\t"+vAna+wordid+"\t"+pb_id+"\t"+lb_id+"\t"+vOrig+"\t"+vSic+"\t"+vAbbr)
+								output.write( vCorr +"\t"+vAna+wordid+"\t"+pb_id+"\t"+lb_id+"\t"+vOrig+"\t"+vSic+"\t"+vAbbr+"\n");
+							}
+							else if(vReg != "")
+							{
+								//System.out.println("write reg "+vForm)
+								output.write( vReg +"\t"+vAna+wordid+"\t"+pb_id+"\t"+lb_id+"\t"+vOrig+"\t"+vSic+"\t"+vAbbr+"\n");
+							}
+							else if(vExpan != "")
+							{
+								//System.out.println("write expan "+vForm)
+								output.write( vExpan +"\t"+vAna+wordid+"\t"+pb_id+"\t"+lb_id+"\t"+vOrig+"\t"+vSic+"\t"+vAbbr+"\n");
+							}
+							flagchoice = false;
+							vCorr= "";
+							vSic= "";
+							break;
+							case "corr":
+							flagcorr = false;
+
+							break;
+							case "reg":
+							flagreg = false;
+							vReg = "";
+							break;
+							case "expan":
+							flagexpan = false;
+							vExpan= "";
+							break;
+							case "orig":
+							flagreg = false;
+							vOrig= "";
+							break;
+							case "sic":
+							flagsic = false;
+
+							break;
+							case "abbr":
+							flagreg = false;
+							vAbbr= "";
+							break;
+
+							case "w":
+							if(vAna != null)
+								if(captureword)
+							{
+								if(flagchoice)
+								{
+
+								}
+								else if(flagfw)
+								{
+
+								}
+								else
+								{
+									output.write( vForm +"\t"+vAna+wordid+"\t"+pb_id+"\t"+lb_id+"\t"+vOrig+"\t"+vSic+"\t"+vAbbr+"\n");
+								}
+
+							}
+
+							flagWord = false;
+							break;
+
+							case "form":
+							flagForm = false;
+							break;
+
+							case "ana":
+							vAna += "\t";
+							flagAna = false;
+							break;
+						}
+						break;
+
+					case XMLStreamConstants.CHARACTERS:
+						if(flagAna)
+						{
+							vAna += parser.getText().trim();
+						}
+
+						if(flagForm)
+						{
+							vForm += parser.getText().trim();
+							if(flagchoice)
+							{
+								if(flagsic)
+								{
+									vSic += parser.getText().trim();
+								}
+								if(flagorig)
+								{
+									vOrig += parser.getText().trim();
+								}
+								if(flagabbr)
+								{
+									vAbbr += parser.getText().trim();
+								}
+								if(flagcorr)
+								{
+									vCorr += parser.getText().trim();
+								}
+							}
+						}
+				}
+			}
+			output.write("</txmcorpus>");
+			output.close();
+			parser.close();
+			inputData.close();
+		}
+		catch (XMLStreamException ex) {
+			System.out.println(ex);
+		}
+		catch (IOException ex) {
+			System.out.println("IOException while parsing " + inputData);
+		}
+
+		return true;
+	}
+
+
+
+	/**
+	 * Run.
+	 *
+	 * @param rootDirFile the root dir file
+	 * @return true, if successful
+	 */
+	public boolean run(File rootDirFile)
+	{
+		String rootDir =rootDirFile.getAbsolutePath();
+
+		if(cwbLoc == null)
+			cwbLoc = org.txm.Toolbox.getParam(org.txm.Toolbox.CQI_SERVER_PATH_TO_CQPLIB)+File.separator;
+
+		if(!new File(cwbLoc).exists())
+		{
+			println ("CWB path error: "+cwbLoc)
+			return false;
+		}
+		if(!new File(rootDir).exists())
+		{
+			println ("binary directory does not exists: "+rootDir)
+			return false;
+		}
+		new File(rootDir+"/wtc/","corptef.wtc").delete();//cleaning&preparing
+		new File(rootDir,"/wtc/").deleteDir();
+		new File(rootDir,"/wtc/").mkdir();
+		new File(rootDir,"/data/").deleteDir();
+		new File(rootDir,"/data/").mkdir();
+		new File(rootDir,"registry/").mkdir();
+
+		String textid="";
+		int counttext =0;
+		List<File> files = new File(rootDirFile,"txm").listFiles();
+		Collections.sort(files);
+		//1- Transform into WTC file
+		for(File f : files)
+		{
+			counttext++;
+			if(!f.exists())
+			{
+				println("file "+f+ " does not exists")
+			}
+			else
+			{
+				println("process file "+f)
+				String txtname = f.getName().substring(0,f.getName().length()-4);
+				def builder = new compiler(f.toURL(),txtname, "corptef", "default");
+				builder.setLang lang
+				builder.transfomFileWtc(rootDir+"/wtc","corptef.wtc");
+			}
+		}
+
+		//2- Import into CWB
+		def outDir = rootDir;
+		CwbEncode cwbEn = new CwbEncode();
+		cwbEn.setDebug(debug);
+		CwbMakeAll cwbMa = new CwbMakeAll();
+		cwbMa.setDebug(debug);
+		String[] pAttributes = ["ttpos","ttlemme","id","pb","lb","orig","sic","abbr"];
+		String[] sAttributes = ["txmcorpus:0+lang", "text:0+id+titre+auteur+datecompo+ssiecle+domaine+genre+forme+dialecte+base+project","front:0+n","body:0+n","ab:0+n+rend","div:0+id+type","p:0+n","back:0+n"];
+		try {
+
+			String regPath = new File(outDir , "registry/corptef").getAbsolutePath();
+			cwbEn.run(new File(cwbLoc,"cwb-encode").getAbsolutePath(),
+					new File(outDir, "/data").getAbsolutePath(),
+					new File(outDir, "wtc/"+"corptef.wtc").getAbsolutePath(),
+					regPath,
+					pAttributes, sAttributes);
+			if (!new File(regPath).exists()) {
+				println "Error: The registry file was not created: $regPath. See https://groupes.renater.fr/wiki/txm-users/public/faq"
+				return false;
+			}
+			cwbMa.run(new File(cwbLoc,"cwb-makeall").getAbsolutePath(),
+					"CORPTEF",
+					new File(outDir, "registry").getAbsolutePath());
+		} catch (Exception ex) {System.out.println(ex); return false;}
+		// "C:\Documents and Settings\alavrent\TXM\cwb\bin\cwb-encode" -d "C:\Documents and Settings\alavrent\TXM\corpora\corptef\data" -f "C:\Documents and Settings\alavrent\TXM\corpora\corptef\wtc\corpte.wtc" -R "C:\Documents and Settings\alavrent\TXM\corpora\corptef\registry\corptef" -c utf8 -xsB -xsB -P ttpos -P ttlemme -P id -P pb -P lb -P orig -P sic -P abbr -S text:0+id+titre+auteur+datecompo+ssiecle+domaine+genre+forme+dialecte+base+project -S front:0+n -S body:0+n -S ab:0+n+rend -S div:0+id+type -S p:0+n -S back:0+n
+		System.out.println("Done.")
+
+		return true;
+	}
+
+	/**
+	 * Sets the debug.
+	 */
+	public void setDebug()
+	{
+		this.debug = true;
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args)
+	{
+		File dir = new File("C:/TXM/corpora/corptef/");
+		def c = new compiler();
+		c.setDebug();
+		c.setCwbPath("C:/Program Files/TXM/cwb/bin");
+		c.run(dir);
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/corptef/package.html
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/corptef/package.html	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/corptef/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Corptef import module</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/org/txm/importer/corptef/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/importer/RGAQCJ/compiler.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/RGAQCJ/compiler.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/RGAQCJ/compiler.groovy	(revision 258)
@@ -0,0 +1,606 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2017-01-24 18:11:42 +0100 (Tue, 24 Jan 2017) $
+// $LastChangedRevision: 3400 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer.RGAQCJ
+
+
+
+import org.txm.importer.cwb.CwbEncode
+import org.txm.importer.cwb.CwbMakeAll
+import org.txm.importer.*;
+import org.txm.scripts.*;
+import org.txm.scripts.teitxm.BuildTTSrc;
+import org.txm.scripts.teitxm.*;
+import org.txm.utils.treetagger.TreeTagger;
+
+import javax.xml.stream.*;
+import java.net.URL;
+import java.io.File;
+import java.util.HashMap;
+import java.util.List;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class compiler.
+ */
+class compiler 
+{
+	
+	/** The debug. */
+	private boolean debug= false;
+	
+	/** The input data. */
+	private def inputData;
+	
+	/** The factory. */
+	private def factory;
+	
+	/** The parser. */
+	private XMLStreamReader parser;
+	
+	/** The dir. */
+	private def dir;
+	
+	/** The output. */
+	private def output;
+	
+	/** The url. */
+	private def url;
+	
+	/** The anahash. */
+	private HashMap<String,String> anahash =new HashMap<String,String>() ;
+	
+	/** The text. */
+	String text="";
+	
+	/** The base. */
+	String base="";
+	
+	/** The project. */
+	String project="";
+	
+	/** The cwb loc. */
+	String cwbLoc;
+	
+	/** The lang. */
+	private String lang ="fr";
+	
+	/**
+	 * initialize.
+	 *
+	 */
+	public compiler(){}
+	
+	/**
+	 * Instantiates a new compiler.
+	 *
+	 * @param url the url
+	 * @param text the text
+	 * @param base the base
+	 * @param project the project
+	 */
+	public compiler(URL url,String text,String base, String project)
+	{
+		this.text = text
+		this.base = base;
+		this.project = project;
+		try {
+			this.url = url;
+			inputData = url.openStream();
+			
+			factory = XMLInputFactory.newInstance();
+			parser = factory.createXMLStreamReader(inputData);
+		} catch (XMLStreamException ex) {
+			System.out.println(ex);
+		}catch (IOException ex) {
+			System.out.println("IOException while parsing ");
+		}
+	}
+	
+	/**
+	 * set the language of the corpus.
+	 *
+	 * @param lang the lang
+	 * @return the java.lang. object
+	 */
+	public setLang(String lang)
+	{
+		this.lang = lang;
+	}
+	
+	/**
+	 * Sets the cwb path.
+	 *
+	 * @param path the new cwb path
+	 */
+	public void setCwbPath(String path)
+	{
+		if(!new File(path).exists())
+			System.err.println("CWB Path : "+path+" does not exists")
+		cwbLoc = path;
+	}
+	
+	/**
+	 * Creates the output.
+	 *
+	 * @param dirPathName the dir path name
+	 * @param fileName the file name
+	 * @return true, if successful
+	 */
+	private boolean createOutput(String dirPathName, String fileName){
+		try {
+			File f = new File(dirPathName, fileName)
+			output = new OutputStreamWriter(new FileOutputStream(f,f.exists()) , "UTF-8");
+			return true;
+		} catch (Exception e) {
+			System.out.println(e.getLocalizedMessage());
+			return false;
+		}
+	}
+	
+	/**
+	 * Go to text.
+	 */
+	private void GoToText()
+	{
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) 
+		{
+			if(event == XMLStreamConstants.END_ELEMENT)
+				if(parser.getLocalName().equals("teiHeader"))
+					return;
+		}
+	}
+	
+	/**
+	 * Transfom file wtc.
+	 *
+	 * @param dirPathName the dir path name
+	 * @param fileName the file name
+	 * @return true, if successful
+	 */
+	public boolean transfomFileWtc(String dirPathName, String fileName)
+	{
+		createOutput(dirPathName, fileName);
+		
+		String headvalue=""
+		String vAna = "";
+		String vForm = "";
+		String wordid= "";
+		String vHead = "";
+		
+		int p_id = 0;
+		int q_id = 0;
+		int body_id = 0;
+		int front_id = 0;
+		int back_id = 0;
+		String lb_id = 0;
+		int lb_count = 0;
+		String pb_id = 0;
+		int pb_count = 0;
+		String ab_id = 0;
+		
+		boolean captureword = false;
+		
+		String vExpan = "";
+		String vCorr = "";
+		String vReg = "";
+		String vOrig = "";
+		String vSic = "";
+		String vAbbr = "";
+		
+		boolean flaglg = false;
+		boolean flaghead = false;
+		boolean flagAuthor = false;
+		boolean flagDate = false;
+		boolean flagWord = false;
+		boolean flagForm = false;
+		boolean flagAna = false;
+		
+		boolean flagchoice = false;
+		boolean flagcorr = false;
+		boolean flagsic = false;
+		boolean flagreg = false;
+		boolean flagexpan = false;
+		boolean flagorig = false;
+		boolean flagabbr = false;
+		boolean flagfw = false;
+		
+		File xpathfile = new File(url.getFile());
+		String titreId = XPathResult.getXpathResponse(xpathfile,"tei:TEI/tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:title[@type='reference']/text()");
+		String auteur = XPathResult.getXpathResponse(xpathfile,"tei:TEI/tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:author/text()");
+		String datecompo = XPathResult.getXpathResponse(xpathfile,"tei:TEI/tei:teiHeader/tei:profileDesc/tei:creation/tei:date[@type='compo']/@when");
+		String ssiecle = XPathResult.getXpathResponse(xpathfile,"tei:TEI/tei:teiHeader/tei:profileDesc/tei:creation/tei:date[@type='compo_sous_siecle']/@n");
+		String domaine = XPathResult.getXpathResponse(xpathfile,"tei:TEI/tei:teiHeader/tei:profileDesc/tei:textDesc/tei:domain/@type");
+		String genre = XPathResult.getXpathResponse(xpathfile,"tei:TEI/tei:teiHeader/tei:profileDesc/tei:textDesc/@n");
+		String forme = XPathResult.getXpathResponse(xpathfile,"tei:TEI/tei:teiHeader/tei:profileDesc/tei:textClass/tei:catRef/@target[contains(.,'forme')]").substring(1);
+		String dialecte = XPathResult.getXpathResponse(xpathfile,"tei:TEI/tei:teiHeader/tei:profileDesc/tei:creation/tei:region[@type='dialecte_auteur']/text()");
+		
+		this.GoToText()
+		output.write("<txmcorpus lang=\""+lang+"\">\n"); 
+		try 
+		{
+			for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) 
+			{
+				switch (event) 
+				{
+					case XMLStreamConstants.START_ELEMENT:
+						switch (parser.getLocalName()) 
+						{						
+							case "text":
+							output.write("<text id=\""+text+"\"" +
+							" titre=\""+titreId+"\"" +
+							" auteur=\""+auteur+"\"" +
+							" datecompo=\""+datecompo+"\"" +
+							" ssiecle=\""+ssiecle+"\"" +
+							" domaine=\""+domaine+"\"" +
+							" genre=\""+genre+"\"" +
+							" forme=\""+forme+"\"" +
+							" dialecte=\""+dialecte+"\"" +
+							" base=\""+base+"\"" +
+							" project=\""+project+"\">\n");
+							captureword=true;
+							break;
+							
+							case "div":
+							//output.write("<div type=\""+parser.getAttributeValue(null,"type")+"\">\n");
+							break;
+							
+							case "p":
+							output.write("<p n=\""+(p_id++)+"\">\n");
+							break;
+							case "ab":
+							output.write("<ab n=\""+ab_id+++"\" rend=\""+parser.getAttributeValue(null,"rend")+"\">\n");
+							break;
+							case "q":
+							output.write("<q n=\""+(q_id++)+"\">\n");
+							break;
+							case "front":
+							output.write("<front n=\""+(front_id++)+"\">\n");
+							break;
+							case "body":
+							output.write("<body n=\""+(body_id++)+"\">\n");
+							break;
+							case "back":
+							output.write("<back n=\""+(back_id++)+"\">\n");
+							break;
+							case "lb":
+							String n = parser.getAttributeValue(null,"n")
+							if(n != null)
+								lb_id = n;
+							else
+								lb_id =""+lb_count++;
+							break;
+							case "pb":
+							String n = parser.getAttributeValue(null,"n");
+							if(n != null)
+								pb_id = n;
+							else
+								pb_id = ""+(pb_count++);
+							
+							break;
+							
+							case "choice":
+							flagchoice = true;
+							break;
+							case "corr":
+							flagcorr = true;
+							vCorr= "";
+							break;
+							case "reg":
+							flagreg = true;
+							vReg= "";
+							break;
+							case "expan":
+							flagexpan = true;
+							vExpan= "";
+							break;
+							case "orig":
+							flagreg = true;
+							vOrig= "";
+							break;
+							case "sic":
+							flagsic = true;
+							vSic= "";
+							break;
+							case "abbr":
+							flagreg = true;
+							vAbbr= "";
+							break;
+							
+							case "w":
+							for(int i = 0 ; i < parser.getAttributeCount(); i++)
+								if(parser.getAttributeLocalName(i).equals("id"))
+								{	
+									wordid = parser.getAttributeValue(i);
+									break;
+								}
+							vAna = "";
+							vForm = "";
+							flagWord = true;
+							break;
+							case "form":
+							flagForm = true;
+							vForm = "";
+							vAna ="";
+							break;
+							
+							case "ana":
+							flagAna = true;
+							break;
+						}
+						break;
+					
+					case XMLStreamConstants.END_ELEMENT:
+						switch (parser.getLocalName()) 
+						{	
+							case "div":
+							break;
+							
+							case "text":
+							output.write("</text>\n");
+							captureword=false;
+							break;
+							case "p":
+							output.write("</p>\n");
+							break;
+							case "ab":
+							output.write("</ab>\n");
+							break;
+							case "q":
+							output.write("</q>\n");
+							break;
+							case "front":
+							output.write("</front>\n");
+							break;
+							case "body":
+							output.write("</body>\n");
+							break;
+							case "back":
+							output.write("</back>\n");
+							break;
+							
+							case "fw":
+							flagfw = false;
+							break;
+							case "choice":
+								
+								if(vCorr != "")
+								{
+									//System.out.println(vCorr+" >> write corr "+vForm +"\t"+vAna+wordid+"\t"+pb_id+"\t"+lb_id+"\t"+vOrig+"\t"+vSic+"\t"+vAbbr)
+									output.write( vCorr +"\t"+vAna+wordid+"\t"+pb_id+"\t"+lb_id+"\t"+vOrig+"\t"+vSic+"\t"+vAbbr+"\n");
+								}
+								else if(vReg != "")
+								{
+									//System.out.println("write reg "+vForm)
+									output.write( vReg +"\t"+vAna+wordid+"\t"+pb_id+"\t"+lb_id+"\t"+vOrig+"\t"+vSic+"\t"+vAbbr+"\n");
+								}
+								else if(vExpan != "")
+								{
+									//System.out.println("write expan "+vForm)
+									output.write( vExpan +"\t"+vAna+wordid+"\t"+pb_id+"\t"+lb_id+"\t"+vOrig+"\t"+vSic+"\t"+vAbbr+"\n");
+								}	
+							flagchoice = false;
+							vCorr= "";
+							vSic= "";
+							break;
+							case "corr":
+							flagcorr = false;
+							
+							break;
+							case "reg":
+							flagreg = false;
+							vReg = "";
+							break;
+							case "expan":
+							flagexpan = false;
+							vExpan= "";
+							break;
+							case "orig":
+							flagreg = false;
+							vOrig= "";
+							break;
+							case "sic":
+							flagsic = false;
+							
+							break;
+							case "abbr":
+							flagreg = false;
+							vAbbr= "";
+							break;
+							
+							case "w":
+							if(vAna != null)
+								if(captureword)
+								{
+									if(flagchoice)
+									{
+										
+									}
+									else if(flagfw)
+									{
+										
+									}
+									else
+									{
+										output.write( vForm +"\t"+vAna+wordid+"\t"+pb_id+"\t"+lb_id+"\n");
+									}
+									
+								}
+
+							flagWord = false;
+							break;
+							
+							case "form":
+							flagForm = false;
+							break;
+							
+							case "ana":
+							vAna += "\t";
+							flagAna = false;
+							break;
+						}
+						break;
+					
+					case XMLStreamConstants.CHARACTERS:
+						if(flagAna)
+						{
+							vAna += parser.getText().trim();
+						}
+					
+						if(flagForm)
+						{
+							vForm += parser.getText().trim();
+							if(flagchoice)
+							{
+								if(flagsic)
+								{
+									vSic += parser.getText().trim();
+								}
+								if(flagorig)
+								{
+									vOrig += parser.getText().trim();
+								}
+								if(flagabbr)
+								{
+									vAbbr += parser.getText().trim();
+								}
+								if(flagcorr)
+								{
+									vCorr += parser.getText().trim();
+								}
+							}
+						}
+				}
+			}
+			output.write("</txmcorpus>"); 
+			output.close();
+			parser.close();
+		}
+		catch (XMLStreamException ex) {
+			System.out.println(ex);
+		}
+		catch (IOException ex) {
+			System.out.println("IOException while parsing " + inputData);
+		}
+		
+		return true;
+	}
+	
+	
+	
+	/**
+	 * Run.
+	 *
+	 * @param rootDirFile the root dir file
+	 * @return true, if successful
+	 */
+	public boolean run(File rootDirFile) 
+	{
+		String rootDir =rootDirFile.getAbsolutePath();
+		
+		if(cwbLoc == null)
+			cwbLoc = org.txm.Toolbox.getParam(org.txm.Toolbox.CQI_SERVER_PATH_TO_CQPLIB)+File.separator;
+		
+		if(!new File(cwbLoc).exists())
+		{
+			println ("CWB path error: "+cwbLoc)
+			return false;
+		}
+		if(!new File(rootDir).exists())
+		{
+			println ("binary directory does not exists: "+rootDir)
+			return false;
+		}
+		new File(rootDir+"/wtc/","bfm3tt.wtc").delete();//cleaning&preparing
+		new File(rootDir,"/wtc/").deleteDir();
+		new File(rootDir,"/wtc/").mkdir();
+		new File(rootDir,"/data/").deleteDir();
+		new File(rootDir,"/data/").mkdir();
+		new File(rootDir,"registry/").mkdir();
+		
+		String textid="";
+		int counttext =0;
+		List<File> files = new File(rootDirFile,"txm").listFiles();
+		//1- Transform into WTC file
+		for(File f : files)
+		{
+			counttext++;
+			if(!f.exists())
+			{
+				println("file "+f+ " does not exists")	
+			}
+			else
+			{	
+				println("process file "+f)
+				def builder = new compiler(f.toURL(),f.getName(),"bfm3tt","default");
+				builder.setLang(lang);
+				builder.transfomFileWtc(rootDir+"/wtc","bfm3tt.wtc");
+			}
+		}
+		
+		 //2- Import into CWB
+		 def outDir =rootDir;
+		 def outDirTxm = rootDir;
+		 CwbEncode cwbEn = new CwbEncode();
+		 cwbEn.setDebug(debug);
+		 CwbMakeAll cwbMa = new CwbMakeAll();
+		 cwbMa.setDebug(debug);
+		 String[] pAttributes = ["pos","id","pb","lb"];
+		 String[] sAttributes = ["txmcorpus:0+lang","text:0+id+titre+auteur+datecompo+ssiecle+domaine+genre+forme+dialecte+base+project","front:0+n","body:0+n","ab:0+n+rend","div:0+id+type","q:1+n","p:0+n","back:0+n"];
+		 try
+		 {
+		 cwbEn.run(new File(cwbLoc,"cwb-encode").getAbsolutePath(), outDirTxm + "/data", outDir + "/wtc/"+"bfm3tt.wtc", outDirTxm + "/registry/"+"bfm3tt",pAttributes, sAttributes);
+		 cwbMa.run(new File(cwbLoc,"cwb-makeall").getAbsolutePath(), "BFM3TT", outDirTxm + "/registry");
+		 } catch (Exception ex) {System.out.println(ex); return false;}
+		 
+		System.out.println("Done.") 
+		
+		return true;
+	}
+	
+	/**
+	 * Sets the debug.
+	 */
+	public void setDebug()
+	{
+		this.debug = true;
+	}
+	
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args)
+	{
+		File dir = new File("~/xml/bfm3tt");
+		def c = new compiler();
+		c.setDebug();
+		c.setCwbPath("~/TXM/cwb/bin");
+		c.run(dir);
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/RGAQCJ/package.html
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/RGAQCJ/package.html	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/RGAQCJ/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>RGAQCJ import module - old</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/org/txm/importer/RGAQCJ/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/importer/RGAQCJ/rgaqcjLoader.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/RGAQCJ/rgaqcjLoader.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/RGAQCJ/rgaqcjLoader.groovy	(revision 258)
@@ -0,0 +1,139 @@
+/**
+ * Main.
+ *
+ * @param args the args
+ */
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer.RGAQCJ
+;
+
+import org.txm.importer.RGAQCJ.importer;
+import org.txm.importer.RGAQCJ.compiler;
+import org.txm.importer.bfm.pager;
+import org.txm.objects.*;
+import org.txm.utils.i18n.*;
+import org.txm.*;
+
+// TODO: Auto-generated Javadoc
+/* (non-Javadoc)
+ * @see groovy.lang.Script#run()
+ */
+String userDir = System.getProperty("user.home");
+String rootDir;
+String lang;
+String encoding;
+String model;
+try{rootDir = rootDirBinding;lang=langBinding;encoding=encodingBinding;model=modelBinding;}
+catch(Exception)
+{	println "DEV MODE";//exception means we debug
+	if(!org.txm.Toolbox.isInitialized())
+	{
+		rootDir = userDir+"/xml/weblex/";
+		lang="fr";
+		encoding= "UTF-8";
+		model="rgaqcj";// not used
+		Toolbox.workspace = new Workspace(new File(userDir,"TXM/workspaces/default.xml"));
+		Toolbox.setParam(Toolbox.INSTALL_DIR,new File(userDir,"txminstall"));
+		Toolbox.setParam(Toolbox.TREETAGGER_INSTALL_PATH,new File(userDir,"txminstall/treetagger"));
+		Toolbox.setParam(Toolbox.TREETAGGER_MODELS_PATH,new File(userDir,"txminstall/treetagger/models"));
+		Toolbox.setParam(Toolbox.USER_TXM_HOME, new File(System.getProperty("user.home"),"TXM"));
+	}
+}
+
+File dir = new File(rootDir);
+String basename = dir.getName();
+
+println "-- IMPORTER - Reading source files"
+File paramfile = new File(userDir, "TXM/weblexloader.prefs")
+def imp = new importer()
+if(!imp.run(dir, paramfile, basename))
+{
+	println("Stop import process")
+	return;
+}
+
+File binDir = new File(Toolbox.getParam(Toolbox.USER_TXM_HOME),"corpora/"+basename);
+rootDir = binDir.getAbsolutePath();
+dir = new File(rootDir);
+
+println "No annotation to do"
+
+
+println "-- COMPILER - Building Search Engine indexes"
+def c = new compiler();
+c.setDebug();
+//c.setCwbPath("~/TXM/cwb/bin");
+c.setLang(lang);
+c.run(dir);
+
+
+//move registry file to cwb registry dir
+File registryfile = new File(rootDir+"/registry", basename);
+if(registryfile.exists())
+	FileCopy.copy(registryfile,new File(Toolbox.getParam(Toolbox.USER_TXM_HOME), "registry/"+basename))
+
+Workspace w = org.txm.Toolbox.workspace;
+Project p = w.getProject("default")
+p.removeBase(basename)
+Base b = p.addBase(basename);
+b.addDirectory(new File(rootDir, "txm"));
+b.setAttribute("lang", lang)
+b.propagateAttribute("lang")
+
+println "-- EDITION"
+new File(rootDir+"/HTML/").deleteDir()
+new File(rootDir+"/HTML/").mkdir();
+new File(rootDir+"/HTML/default/").mkdir();
+files = new File(rootDir,"txm").listFiles();
+println files
+for(String textname : b.getTextsID())
+{
+	Text text = b .getText(textname);
+	File srcfile = text.getSource();
+	File resultfile = new File(rootDir+"/HTML", srcfile.getName().substring(0, srcfile.getName().length()-4)+".html");
+	List<String> NoSpaceBefore = LangFormater.getNoSpaceBefore(lang);
+	List<String> NoSpaceAfter = LangFormater.getNoSpaceAfter(lang);
+	println("Building edition  : "+srcfile+" to : "+resultfile );
+	
+	def ed = new pager(srcfile, resultfile, NoSpaceBefore, NoSpaceAfter, 600);
+	//ed.writecorrespondancesFile(new File(rootDir,"edition_correspondances.txt"))
+	Edition editionweb = text.addEdition("default", "html", resultfile);
+
+	for(int i = 0 ; i < ed.getPageFiles().size();i++)
+	{
+		File f = ed.getPageFiles().get(i);
+		String idx = ed.getIdx().get(i);
+		editionweb.addPage(f, idx);
+	}
+	
+//	Edition editionbp = text.addEdition("onepage", "html", resultfile);
+//	editionbp.addPage(resultfile, ed.getIdx().get(0));
+}
+
+w.save();
Index: tmp/org.txm.core/src/groovy/org/txm/importer/RGAQCJ/importer.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/RGAQCJ/importer.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/RGAQCJ/importer.groovy	(revision 258)
@@ -0,0 +1,266 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer.RGAQCJ
+
+import org.txm.importer.*;
+import org.txm.importer.filters.*;
+import org.txm.scripts.*;
+import org.txm.scripts.teitxm.*;
+import org.txm.utils.treetagger.TreeTagger;
+import javax.xml.stream.*;
+import java.net.URL;
+import java.util.Properties;
+
+import filters.CutHeader.*;
+import filters.Tokeniser.*;
+import filters.FusionHeader.*;
+
+import java.io.BufferedReader;
+import java.io.FileInputStream;
+import java.io.InputStreamReader;
+
+import org.apache.commons.lang.StringUtils;
+import org.txm.*;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class importer.
+ */
+class importer {
+	
+	/** The tokenize. */
+	boolean tokenize = true;
+	
+	/**
+	 * Run.
+	 *
+	 * @param dir the dir
+	 * @param paramfile the paramfile
+	 * @param basename the basename
+	 * @return true, if successful
+	 */
+	public boolean run(File dir, File paramfile, String basename)
+	{
+		if(!paramfile.exists())
+		{
+			System.err.println("Parameter file does not exists: "+paramfile.getAbsolutePath());
+			return false;
+		}
+		Properties properties = new Properties();
+		BufferedReader input = new BufferedReader(new InputStreamReader(new FileInputStream(paramfile) , "UTF-8"));
+		String line = input.readLine();
+		while(line != null)
+		{
+			String[] split = line.split("="); //$NON-NLS-1$
+			if(split.length == 2)
+			{
+				properties.put(split[0], split[1]);
+			}
+			else if(split.length > 2)
+			{
+				String[] subsplit = new String[split.length -1 ]; 
+				System.arraycopy(split, 1, subsplit, 0, split.length-1);
+				properties.put(split[0], StringUtils.join(subsplit, "=")); //$NON-NLS-1$
+			}
+			line = input.readLine();
+		}
+		
+		if(!(properties.containsKey("nbP") && properties.containsKey("nbTaxo") && properties.containsKey("nbResp")))
+		{
+			System.err.println("Missing property: nbP or nbTaxo or nbResp");
+			return false;
+		}
+		int nbP = Integer.parseInt(properties.getProperty("nbP"));
+		int nbTaxo = Integer.parseInt(properties.getProperty("nbTaxo"));
+		int nbResp = Integer.parseInt(properties.getProperty("nbResp"));
+		
+		if(nbResp == 0)
+		{
+			System.err.println("No resp ");
+			return false;
+		}
+		String rootDir = dir.getAbsolutePath()+"/";
+		ArrayList<String> milestones = new ArrayList<String>();
+		
+		//where the binaries will be created
+		File binDir = new File(Toolbox.getParam(Toolbox.USER_TXM_HOME),"corpora/"+basename);
+		binDir.deleteDir();
+		binDir.mkdir();
+		
+		new File(binDir,"txm").deleteDir();
+		new File(binDir,"txm").mkdir();
+		
+		List<File> files = new File(rootDir,"").listFiles();
+		
+		//set working directory
+		rootDir = binDir.getAbsolutePath()+"/";
+		
+		//Set import parameters
+		def correspType = new HashMap<String,String>();
+		// correspType(attribut word wlx, attribut type de la propriété ana du w txm)
+		for(int p = 1 ; p <= nbP ; p++)
+		{
+			correspType.put("p"+p, properties.get(properties.get("P"+p+"_taxo")));
+		}
+		
+		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)
+		for(int p = 1 ; p <= nbP ; p++)
+		{
+			String taxo=properties.get("P"+p+"_taxo")
+			String resp=properties.get(taxo+"_resp")
+			correspRef.put("p"+p,properties.get(resp));
+		}
+		
+		//il faut lister les id de tous les respStmt
+		def respId = [];
+		for(int r = 1 ; r <= nbResp ; r++)
+			respId << properties.get("R"+r);
+		
+		//fait la correspondance entre le respId et le rapport d'execution de l'outil
+		
+		def applications = new HashMap<String,HashMap<String,String>>();	
+		//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
+		for(int r = 1 ; r <= nbResp ; r++)
+		{
+			applications.put(properties.get("R"+r), new ArrayList<String>());
+			applications.get(properties.get("R"+r)).add(properties.get("R"+r+"_app_id"));//app ident
+			applications.get(properties.get("R"+r)).add(properties.get("R"+r+"_app_version"));//app version
+			applications.get(properties.get("R"+r)).add(properties.get("R"+r+"_app_reportfile"));//app report file path
+		}
+
+		
+		def taxonomiesUtilisees = new HashMap<String,String[]>();
+		//associe un id d'item avec sa description et son URI
+		for(int t = 1 ; t <= nbTaxo ; t++)
+		{
+			String resp_id = properties.get(properties.get("T"+t+"_resp"))
+			if(!taxonomiesUtilisees.containsKey(resp_id))
+				taxonomiesUtilisees.put(resp_id,[]);//,"lemma","lasla","grace"]);
+			taxonomiesUtilisees.get(resp_id) << properties.get("T"+t)
+		}
+		
+		def itemsURI = new HashMap<String,HashMap<String,String>>();
+		//informations de respStmt
+		//resps (respId <voir ci-dessus>, [description, person, date])
+		for(int t = 1 ; t <= nbTaxo ; t++)
+		{
+			String taxo = properties.get("T"+t);
+			itemsURI.put(taxo,new HashMap<String,String>());
+			itemsURI.get(taxo).put("tagset",properties.get("T"+t+"_tagset"));
+			itemsURI.get(taxo).put("website",properties.get("T"+t+"_web"));
+		}
+		def resps = new HashMap<String,String[]>();
+		for(int r = 1 ; r <= nbResp ; r++)
+		{
+			resps.put(properties.get("R"+r), [properties.get("R"+r+"_desc"),properties.get("R"+r+"_who"),properties.get("R"+r+"_when"),properties.get("R"+r+"_day")])
+		}
+		
+		println("Weblex import parameters : ")
+		println("resps id "+respId);
+		println("resps infos"+resps);
+		println("applications "+applications);
+		
+		println("correspType "+correspType)
+		println("correspRef "+correspRef)
+		
+		println("taxonomiesUtilisees "+taxonomiesUtilisees)
+		println("itemsURI "+itemsURI)
+				
+		//TRANSFORM INTO XML-TEI-TXM
+		for(File f : files)
+		{
+			//ArrayList<String> milestones = new ArrayList<String>();
+			File file = f; 
+			String txmfile = f.getName();
+			println("Building xml-tei-txm "+f+ " >> "+rootDir+"txm/"+txmfile)
+			
+			//lance le traitement
+			def builder3 = new Xml2Ana(file);
+			builder3.setCorrespondances(correspRef, correspType);
+			builder3.setHeaderInfos(respId,resps, applications, taxonomiesUtilisees, itemsURI)
+			builder3.transformFile(rootDir+"txm/",txmfile);
+		}
+		return true;
+	}
+	
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args)
+	{
+		File dir = new File("~/xml/bfm/")
+		new importer().run(dir);
+	}
+}
+
+/* PARAM FILE EXAMPLE
+nbP=3
+nbTaxo=2
+nbResp=2
+
+R1=init
+R1_desc=initial taggin
+R1_who=al
+R1_when=2010
+R1_day=Tue Mar  2 21:02:55 Paris, Madrid 2010
+R1_app_id=appR1
+R1_app_version=app1V
+R1_app_reportfile=
+
+R2=apinit
+R2_desc=second taggin
+R2_who=slh
+R2_when=2010
+R2_day=Tue Mar  2 21:02:55 Paris, Madrid 2010
+R2_app_id=appR2
+R2_app_version=app2V
+R2_app_reportfile=
+
+P1=truc1
+P1_taxo=T1
+
+P2=bidul2
+P2_taxo=T1
+
+P3=machin3
+P3_taxo=T2
+
+T1=CATTEX
+T1_web=www.google.fr
+T1_tagset=www.google.fr
+T1_resp=R1
+
+T2=TTFR
+T2_web=www.bing.fr
+T2_tagset=www.bing.fr
+T2_resp=R2 
+*/
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/importer/RGAQCJ/importRGAQCJ.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/RGAQCJ/importRGAQCJ.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/RGAQCJ/importRGAQCJ.groovy	(revision 258)
@@ -0,0 +1,424 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2017-01-24 18:11:42 +0100 (Tue, 24 Jan 2017) $
+// $LastChangedRevision: 3400 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer.RGAQCJ
+
+import org.txm.importer.cwb.CwbEncode
+import org.txm.importer.cwb.CwbMakeAll
+
+import javax.xml.stream.*;
+import java.net.URL;
+
+import org.txm.importer.filters.*;
+// TODO: Auto-generated Javadoc
+
+/**
+ * The Class BuildXmlRGAQCJ.
+ *
+ * @author mdecorde
+ * simple import in cwb of RGAQCJ
+ * structunits : initial, s, lb ...
+ * wordproperties : form, pos and n
+ */
+
+public class BuildXmlRGAQCJ
+{
+	
+	/** The input data. */
+	private def inputData;
+	
+	/** The factory. */
+	private def factory;
+	
+	/** The parser. */
+	private def parser;
+	
+	/** The dir. */
+	private def dir;
+	
+	/** The output. */
+	private def output;
+	
+	/** The url. */
+	private def url;
+	
+	/** The anahash. */
+	private HashMap<String,String> anahash =new HashMap<String,String>() ;
+	
+	/** The types. */
+	private ArrayList<String> types;
+	
+	/** The current type. */
+	private String currentType;
+	
+	/** The cat ref. */
+	private String catRef="";
+	
+	/** The initial. */
+	private String initial;
+	
+	/**
+	 * initialize.
+	 *
+	 * @param url the url
+	 * @param initial the initial
+	 * @param types the types
+	 */
+	public BuildXmlRGAQCJ(URL url,String initial,ArrayList<String> types){
+		try {
+			this.url = url;
+			this.types = types;
+			this.initial = initial;
+			inputData = url.openStream();
+			factory = XMLInputFactory.newInstance();
+			parser = factory.createXMLStreamReader(inputData);
+		} catch (XMLStreamException ex) {
+			System.out.println(ex);
+		}catch (IOException ex) {
+			System.out.println("IOException while parsing ");
+		}
+	}
+	
+	/**
+	 * clear anaHash variable, it is used to store ana tags values then print it when the end element </ana> is found.
+	 */
+	private void fillanaHash()
+	{
+		anahash.clear();
+		for(String s : types)
+			anahash.put( s,"-" );
+	}
+	
+	/**
+	 * Creates the output.
+	 *
+	 * @param dirPathName output directory
+	 * @param fileName output file name
+	 * @return true, if successful
+	 */
+	private boolean createOutput(String dirPathName, String fileName){
+		try {
+			dir = new File(dirPathName)
+			File f = new File(dir, fileName);
+			output = new OutputStreamWriter(new FileOutputStream(f,f.exists()) , "UTF-8");
+
+			return true;
+		} catch (Exception e) {
+			System.out.println(e.getLocalizedMessage());
+			return false;
+		}
+	}
+	
+	/**
+	 * Checks if is body.
+	 *
+	 * @param name the name
+	 * @return true, if is body
+	 */
+	private static boolean isBody(String name) {
+		if (name.equals("body")) return true;
+	}
+	
+	/**
+	 * Find body.
+	 *
+	 * @return true, if successful
+	 */
+	private boolean findBody(){
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()){
+			if(event == XMLStreamConstants.START_ELEMENT){
+				if (parser.getLocalName() == "catRef"){
+					if(parser.getAttributeValue(null,"target") == "#forme_prose")
+						catRef = "prose";
+					else if(parser.getAttributeValue(null,"target") == "#forme_vers")
+						catRef = "vers";
+					else
+						catRef = "mixte";
+					//println("catRef : "+catRef);
+				}
+				if (isBody(parser.getLocalName())){
+					return true;
+				}
+			}
+		}
+		return false;
+	} 
+	
+	/**
+	 * Transfom file wtc.
+	 *
+	 * @param dirPathName the dir path name
+	 * @param fileName the file name
+	 * @return true, if successful
+	 */
+	public boolean transfomFileWtc(String dirPathName, String fileName)
+	{
+		if(findBody() && createOutput(dirPathName, fileName))
+		{
+			def idPb = "";
+			def idLb = "";
+			String idLinesuiv;
+			
+			boolean flagForm = false;
+			boolean flagAna = false;
+			String vAna = "";
+			String vWord = "";
+			String vForm = "";
+			
+			try 
+			{
+				File inputfile = new File(this.url.getFile());
+				output.write( "<text initiale=\""+initial+"\" forme=\""+catRef+"\">\n");
+				for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) 
+				{
+					switch (event) 
+					{
+						case XMLStreamConstants.START_ELEMENT:
+						switch (parser.getLocalName()) 
+						{
+							case "p":
+								output.write "<p n=" + parser.getAttributeValue(null,"n") +">\n";
+								break;
+							
+							case "s":
+								output.write "<s n=" + parser.getAttributeValue(null,"n")+ "\">\n";
+								break;
+							
+							case "pb":
+								idLinesuiv = parser.getAttributeValue(null,"n");
+								idPb = idLinesuiv;
+								break;
+								
+							case "lb":
+								idLb = parser.getAttributeValue(null,"n");
+								break;
+							
+							case "w":
+								fillanaHash();
+								vWord ="";
+							break;
+							
+							case "form":
+								flagForm =true;
+								vForm ="";
+							break;
+							case "ana":
+								flagAna = true;
+								vAna ="";
+								
+								currentType = (parser.getAttributeValue(null,"ref"));
+								if(currentType != null)
+									currentType= currentType.substring(1)
+								else
+									flagAna = false;
+							break;
+						}
+						break;
+						
+						case XMLStreamConstants.END_ELEMENT:
+						switch (parser.getLocalName()) 
+						{
+							case "p":
+								output.write( "</p>\n");
+								break;
+							
+							case "s":
+								output.write( "</s>\n");
+								break;
+
+							case "w":
+								for(String type : types)
+									vWord+="\t"+anahash.get(type)
+								if(catRef.equals("vers"))
+									output.write( vWord+ "\t" +idLb+ "\n");
+								else
+									output.write( vWord+ "\t" +idPb+ "\n");
+								vWord= "";
+								break;
+							
+							case "form":
+								flagForm = false;
+								vWord +=vForm; 
+								break;
+								
+							case "ana":
+								if(flagAna)
+									anahash.put (currentType,vAna);
+								flagAna = false;
+								break;
+						}
+						break;
+						
+						case XMLStreamConstants.CHARACTERS:
+							if(flagForm){
+								vForm += parser.getText().trim();
+							}
+							if(flagAna){
+								vAna += parser.getText().trim();
+							}
+						break;
+					}
+				}
+				output.write( "</text>\n");
+				output.close();
+				parser.close();
+			}
+			catch (XMLStreamException ex) {
+				System.out.println(ex);
+			}
+			catch (IOException ex) {
+				System.out.println("IOException while parsing " + inputData);
+			}
+		}
+		return true;
+	}
+	
+	/**
+	 * Gets the anatypes.
+	 *
+	 * @param rootDir the root dir
+	 * @param xmltxmfiles the xmltxmfiles
+	 * @return the anatypes
+	 */
+	public static def getAnatypes(String rootDir, List<String> xmltxmfiles)
+	{
+		ArrayList<String> types = new ArrayList<String>()
+		for(int i=0; i < xmltxmfiles.size();i++)
+		{
+			//println("look in "+xmltxmfiles[i]);
+			URL url = new File(rootDir+"/anainline/", xmltxmfiles[i]).toURL();
+			def inputData = url.openStream();
+			def factory = XMLInputFactory.newInstance();
+			XMLStreamReader parser = factory.createXMLStreamReader(inputData);
+			
+			for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) 
+				if(event == XMLStreamConstants.START_ELEMENT)
+					if(parser.getLocalName().equals("ana"))
+					{
+						String s = parser.getAttributeValue(null, "ref");
+						if(s != null)
+						{
+							s = s.substring(1, s.length());
+							if(!types.contains(s))
+							{
+								types.add(s);
+							}
+						}
+					}
+			
+			inputData=null;
+			factory=null
+			parser=null;
+		}
+		return types;		
+	}
+		
+	/**
+	 * Process.
+	 *
+	 * @param files the files
+	 * @param rootDir the root dir
+	 * @param cwbLoc the cwb loc
+	 */
+	public static void process(List<String> files, String rootDir,String cwbLoc) 
+	{
+		new File(rootDir+"wtc/").mkdir();
+		new File(rootDir+"registry/").mkdir();
+		//String[] files = ["roland-ana.xml","qgraal_cm-ana.xml","artu-ana.xml","qjm-ana.xml","commyn1-ana.xml","jehpar-ana.xml"];
+		//String rootDir = "~/xml/rgaqcj/";
+		ArrayList<String> types = BuildXmlRGAQCJ.getAnatypes(rootDir, files);
+		println(types);
+		
+		//1- Transform into WTC file
+		File f = new File(rootDir+"wtc/","RGAQCJ.wtc");
+		f.delete();
+		
+		def output = new OutputStreamWriter(new FileOutputStream(f) , "UTF-8");
+		output.write("<corpus name=\"RGAQCJ\">\n");
+		output.close();
+		
+		
+		def initiales = "RAQCJ";
+		for(int i=0; i < files.size();i++)
+		{
+			println("process file "+files[i])
+			String file = files[i]; 
+			def builder = new BuildXmlRGAQCJ(new File(rootDir+"/anainline/",file).toURL(),""+initiales.charAt(i),types);
+			builder.transfomFileWtc(rootDir+"wtc","RGAQCJ.wtc");
+		}
+		
+		output = new OutputStreamWriter(new FileOutputStream(f,true) , "UTF-8");
+		output.write("</corpus>\n");
+		output.close();
+
+		//2- Import into CWB
+		
+		//def cwbLoc ="~/Bureau/textometrie/CWB/cwb-3.0/utils/";//chemin vers executable cqp
+
+		def inDir = rootDir+"src/";
+		def outDir =rootDir;
+		def outDirTxm = rootDir;
+		
+		CwbEncode cwbEn = new CwbEncode();
+		CwbMakeAll cwbMa = new CwbMakeAll();
+		
+		types.add("line");
+		String[] pAttributes = types;
+		String[] sAttributes = ["corpus:0+name","text:0+initiale+forme", "s:0+n","p:0+n"];
+		
+		try
+		{
+			if (System.getProperty("os.name").contains("Windows"))
+			{
+				cwbEn.run(cwbLoc + "cwb-encode.exe", outDirTxm + "data/"+"RGAQCJ", outDir +"wtc/"+"RGAQCJ"+".wtc", outDirTxm + "registry/"+"rgaqcj",pAttributes, sAttributes);
+				cwbMa.run(cwbLoc + "cwb-makeall.exe", "RGAQCJ", outDirTxm + "registry");
+			}
+			else
+			{
+				cwbEn.run(cwbLoc + "cwb-encode", outDirTxm + "data/"+"RGAQCJ", outDir + "/wtc/"+"RGAQCJ.wtc", outDirTxm + "registry/"+"rgaqcj",pAttributes, sAttributes);
+				cwbMa.run(cwbLoc + "cwb-makeall", "RGAQCJ", outDirTxm + "registry");
+
+			}
+		} catch (Exception ex) {System.out.println(ex);}
+		System.out.println("Done.") 
+		
+		return
+	}
+	
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args)
+	{
+		List<String> files = ["roland-ana.xml","qgraal_cm-ana.xml","artu-ana.xml","qjm-ana.xml","commyn1-ana.xml","jehpar-ana.xml"];
+		String rootDir = "~/xml/rgaqcj/";
+		def cwbLoc ="~/Bureau/textometrie/CWB/cwb-3.0/utils/";//chemin vers executable cqp
+		BuildXmlRGAQCJ.process( files,  rootDir, cwbLoc);
+	}
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/importer/AddAttributeInXml.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/AddAttributeInXml.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/AddAttributeInXml.groovy	(revision 258)
@@ -0,0 +1,120 @@
+package org.txm.importer
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.txm.metadatas.Entry
+import org.txm.utils.Pair;
+
+/**
+ * Add a attribute value map in a XML file
+ * Warning: if an attribute already exists its value won't be changed
+ */
+class AddAttributeInXml extends StaxIdentityParser {
+	File xmlfile;
+	String tag;
+	List<Pair<String, String>> attributes;
+	HashMap<String, String> attributesMap;
+	boolean result;
+
+	public AddAttributeInXml(File xmlfile, String tag, List<Pair<String, String>> attributes)
+	{
+		super(xmlfile.toURI().toURL());
+		this.xmlfile = xmlfile;
+		this.tag = tag;
+		this.attributes = attributes;
+	}
+
+	public AddAttributeInXml(File xmlfile, String tag, HashMap<String, String> attributesMap) {
+		super(xmlfile.toURI().toURL());
+		this.xmlfile = xmlfile;
+		this.tag = tag;
+		this.attributesMap = attributesMap;
+	}
+
+	public AddAttributeInXml(File xmlfile, String tag,	ArrayList<org.txm.metadatas.Entry> attributes) {
+		super(xmlfile.toURI().toURL());
+		this.xmlfile = xmlfile;
+		this.tag = tag;
+		this.attributes = attributes;
+	}
+
+	public boolean process(File outfile) {
+		this.result = false;
+		boolean ret = super.process(outfile)
+		return this.result & ret;
+	}
+
+	
+	/**
+	 * Rewrite the processStartElement() to update/add attributes
+	 */
+	public void processStartElement()
+	{
+		String prefix = parser.getPrefix();
+//TODO: uncomment for TXM 0.7.6 and later
+//			if (INCLUDE == localname && XI == prefix) {
+//				processingXInclude();
+//				return;
+//			}
+		
+		if (prefix.length() > 0)
+			writer.writeStartElement(Nscontext.getNamespaceURI(prefix), localname)
+		else
+			writer.writeStartElement(localname);
+
+		for (int i = 0 ; i < parser.getNamespaceCount() ; i++) {
+			writer.writeNamespace(parser.getNamespacePrefix(i), parser.getNamespaceURI(i));
+		}
+
+		HashSet<String> exists = new HashSet<String>();
+		for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
+			exists.add(parser.getAttributeLocalName(i));
+			writer.writeAttribute(parser.getAttributeLocalName(i), parser.getAttributeValue(i));
+		}
+		if (localname == tag && !stopInsertion) { // insert here
+			result = true
+			if (attributes != null) {
+				for (Pair<String, String> meta : attributes) {
+					if(stopAtFirst)
+						stopInsertion = true;
+					if(!exists.contains(meta.getFirst())) // I can add the new attribute
+						writer.writeAttribute(meta.getFirst(), meta.getSecond());
+				}
+			} else if (attributesMap != null) {
+				for (String name : attributesMap.keySet()) {
+					if (stopAtFirst)
+						stopInsertion = true;
+					if (!exists.contains(name)) // I can add the new attribute
+						writer.writeAttribute(name, attributesMap.get(name));
+				}
+			}
+		}
+	}
+	
+	boolean stopAtFirst = false;
+	boolean stopInsertion = false;
+	public void onlyOneElement() {
+		stopAtFirst = true;
+	}
+
+	public static void main(String[] args)
+	{
+		File xmlfile = new File("/home/mdecorde/xml/xmlçàé/essai.xml")
+		File temp = File.createTempFile("temp", ".xml", xmlfile.getParentFile());
+		String tag = "titre";
+		ArrayList<Pair<String, String>> metadatas = new ArrayList<Pair<String, String>>();
+		metadatas.add(new Pair<String, String>("name1", "newvalue1"));
+		metadatas.add(new Pair<String, String>("name2", "value2"));
+		metadatas.add(new Pair<String, String>("name3", "value3"));
+
+		AddAttributeInXml builder = new AddAttributeInXml(xmlfile, tag, metadatas);
+		builder.onlyOneElement();
+		if(builder.process(temp)) {
+			if (!(xmlfile.delete() && temp.renameTo(xmlfile))) println "Warning can't rename file "+temp+" to "+xmlfile
+		} else {
+			println "Error during process"
+		}
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/HasElement.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/HasElement.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/HasElement.groovy	(revision 258)
@@ -0,0 +1,67 @@
+package org.txm.importer
+
+import javax.xml.stream.*;
+import java.net.URL;
+
+/**
+ * Check if a file contains a tag
+ * @author mdecorde
+ *
+ */
+class HasElement {
+
+	HashSet<String> localnames = new HashSet<String>();
+	File xmlfile;
+	XMLStreamReader parser;
+	HashMap<String, Boolean> elements = [:];
+
+	public HasElement(File xmlfile, String localname) {
+		localnames << localname;
+		this.xmlfile = xmlfile;
+		elements[localname] = false;
+
+		init();
+	}
+
+	private void init() {
+		try {
+			
+//			println "xmlfile: "+xmlfile
+//			println "xmlfile exists: "+xmlfile.exists()
+//			println "uri: "+ xmlfile.toURI()
+//			println "url: "+ xmlfile.toURI().toURL()
+//			
+			def inputData = xmlfile.toURI().toURL().openStream();
+			def inputFactory = XMLInputFactory.newInstance();
+			parser = inputFactory.createXMLStreamReader(inputData);
+		} catch (Exception ex) {
+			System.out.println("IOException while parsing: "+ex);
+			ex.printStackTrace();
+		}
+	}
+
+	public boolean process() {
+		if (parser == null) return false;
+		
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+			if (event == XMLStreamConstants.START_ELEMENT) {
+				String localname = parser.getLocalName();
+				if (localnames.contains(localname)) {
+					parser.close();
+					return true;
+				}
+			}
+		}
+		parser.close();
+	}
+	
+	public static void main(String[] args) {
+		File dir = new File("/home/mdecorde/xml/lamoplat")
+		println dir.listFiles()
+		for (File xmlfile : dir.listFiles()) {
+			if (!xmlfile.getName().endsWith(".xml")) continue
+			//println xmlfile
+			println "$xmlfile: "+ new HasElement(xmlfile, "text").process();
+		}
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/transcriber/ValidateTRS.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/transcriber/ValidateTRS.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/transcriber/ValidateTRS.groovy	(revision 258)
@@ -0,0 +1,509 @@
+package org.txm.importer.transcriber
+
+import java.text.DecimalFormat
+
+import org.txm.utils.ExecTimer
+import org.w3c.dom.*
+
+/**
+ * TRS file time validation for the STDDAD master corpus
+ * @author mdecorde
+ *
+ */
+class ValidateTRS {
+	def doc;
+	def root;
+	def episodeElem;
+	def topicsElem;
+	def speakersElem;
+
+	def declaredTopics = [];
+	def topics = [];
+
+	def mandatoryTopics = ["parcours", "ressources", "débouchés", "acteurs", "métier", "images", "autres"]
+	def declaredSpeakers = [];
+	def speakers = [];
+	def spkDict = [:];
+	def topicDict = [:];
+
+	def sections = [];
+	def turns = new LinkedHashMap();
+	def syncs = new LinkedHashMap();
+	def entities = [];
+
+	def messages = [];
+
+	float sectionsTime = 0;
+	int numberOfSection = 0;
+	HashMap<String, Float> sectionsTimesByTopic = new HashMap<String, Float>();
+	HashMap<String, Integer> numberOfSectionByTopic = new HashMap<String, Integer>();
+
+	float turnsTime = 0;
+	int numberOfTurn = 0;
+	HashMap<String, Float> turnsTimesBySpk = new HashMap<String, Float>();
+	HashMap<String, Integer> numberOfTurnsBySpk = new HashMap<String, Integer>();
+
+	int totalWords = 0;
+	HashMap<String, Integer> totalWordsByTopic = new HashMap<String, Integer>();
+	HashMap<String, Integer> totalWordsBySpk = new HashMap<String, Integer>();
+
+	def static okTopics = ["débouchés", "parcours","ressources",
+		"métier", "acteurs", "autres", "images"];
+
+	def static spkPattern = "((int|enq)[0-9][0-9])|(ext[0-9][0-9][0-9])"
+
+	public static boolean checkSpk(String spk)
+	{
+		return spk.matches("((int|enq)[0-9][0-9])|(ext[0-9][0-9][0-9])");
+	}
+
+	public ValidateTRS(File trsFile)
+	{
+		def slurper = new XmlParser();
+		root = slurper.parse(trsFile.toURI().toString())
+		episodeElem = root.Episode;
+		speakersElem = root.Speakers;
+		topicsElem = root.Topics
+		init();
+	}
+
+	public boolean test(){
+		//ckeckTimes();
+	}
+
+	public void init() {
+		initSpeakersDecl();
+		initTopicsDecl();
+
+		initSections();
+		initTurns();
+		initSyncs();
+
+		initSpeakers();
+		initTopics();
+		initEntities();
+	}
+
+	public void initEntities() {
+		for(def section : sections)
+			for(def turn : turns.get(section))
+				for(def entity : turn.Event)
+					if (entity.@type == "entities")
+						entities.add(entity.@desc)
+	}
+
+	public void initTopicsDecl(){
+		declaredTopics = topicsElem.Topic;
+		for (def topic:declaredTopics) {
+			topicDict[topic.@id]=topic.@desc
+		}
+	}
+
+	public void initSpeakersDecl(){
+		declaredSpeakers = speakersElem.Speaker;
+		for (def spk:declaredSpeakers) {
+			spkDict[spk.@id]=spk.@name
+		}
+	}
+
+	public void initSections() {
+		sections = episodeElem.Section;
+		numberOfSection = sections.size()
+	}
+
+	public void initTurns() {
+		for(def section : sections) {
+			turns[section] = section.Turn
+			numberOfTurn += turns[section].size()
+			//numberOfTurn
+		}
+	}
+
+	public void initSyncs() {
+		for(def section : sections)
+			for(def turn : turns.get(section))
+				syncs[turn] = turn.Sync
+	}
+
+	public void initTopics(){
+		for(def section : sections) {
+			String topic = section.@topic;
+			if (section.@type != "report")
+				topic = section.@type
+			if (topic == null) topic = "notopic"	
+			topics.add(topic);
+		}
+
+		topics.sort()
+	}
+
+	public void initSpeakers(){
+		for(def section : sections)
+			for(def turn : turns.get(section)) {
+				String spk = turn.@speaker;
+				if (spk == null) spk = "nospk"
+				speakers.add(spk);
+			}
+		speakers.sort();
+	}
+
+	public boolean topicsCheck() {
+		messages = []
+		boolean ret = false;
+		def topicsIds = declaredTopics.collect { topic -> topic.@id }
+		for(def topic : topics)
+			if( topic != null && !topicsIds.contains(topic) && topic != "nontrans" && topic != "notopic") {
+				messages << "missing topic declaration: "+topic
+				ret = true;
+			}
+		return ret;
+	}
+
+	public def speakersCheck() {
+		messages = []
+		boolean ret = false;
+		def spksIds = declaredSpeakers.collect { spk -> spk.@id }
+		for(def spk : speakers)  {
+			if (spk == null) continue; // ignore null spk
+			def split = spk.split(" ")
+			for(def sspk : split) {
+				if(!spksIds.contains(sspk) && sspk != "nospk") {
+					println "missing spk declaration: "+sspk
+					ret = true;
+				}
+			}
+		}
+		return ret;
+	}
+
+	String NULL = "null"
+	public void printSortedList(def list, def dict) {
+		def all = [:]
+		for(def value : list) {
+			if (value == null) {
+				if(!all.containsKey(NULL))
+					all[NULL] = 0
+				all[NULL] = all[NULL] + 1
+			} else {
+				def split = value.split(" ")
+				if (dict != null) {
+					for(def sspk : split) {
+						if (!(all.containsKey(sspk)))
+							all[sspk] = 0;
+						all[sspk] = all[sspk] + 1
+					}
+				} else {
+					if (!(all.containsKey(value)))
+						all[value] = 0;
+					all[value] = all[value] + 1
+				}
+			}
+		}
+
+		def toprint = [];
+		for(def speaker : all.keySet())
+			toprint.add([speaker, all[speaker]]);
+
+		toprint = toprint.sort{it -> it.get(1)}
+
+		for(def line : toprint)
+			if (dict != null) {
+				if (dict[line.get(0)] != null)
+					println line.get(0)+"\t"+dict[line.get(0)]+"\t"+line.get(1)
+				else
+				println line.get(0)+"\t"+line.get(0)+"\t"+line.get(1)
+			} else {
+				println line.get(0)+"\t"+line.get(1)
+			}
+	}
+
+	public def timeCheck() {
+		messages = [];
+		boolean warning = false;
+		boolean error = false
+		def previousSectionStart = -1.0f;
+		def previousSectionEnd = -1.0f;
+
+		def previousTurnStart = -1.0f;
+		def previousTurnEnd = -1.0f;
+
+		for(def section : sections) {
+			def sectionStart = Float.parseFloat(section.'@startTime')
+			def sectionEnd =  Float.parseFloat(section.'@endTime')
+			def topic = section.@topic;
+			if (section.@type != "report")
+				topic = section.@type;
+			if (topic == null) topic = "notopic"
+			
+			def time = sectionEnd - sectionStart;
+			if (!sectionsTimesByTopic.containsKey(topic)) {
+				sectionsTimesByTopic.put(topic, 0);
+				numberOfSectionByTopic.put(topic, 0);
+				totalWordsByTopic.put(topic, 0);
+			}
+			if (topic != null && topic != "null" && topic.length() > 0) {
+				sectionsTime += time;
+			}
+			sectionsTimesByTopic.put(topic, sectionsTimesByTopic.get(topic) + time);
+			numberOfSectionByTopic.put(topic, numberOfSectionByTopic.get(topic) + 1);
+
+			boolean sectionBug = false;
+
+			if ( sectionEnd <= sectionStart) { sectionBug = true;
+				messages << "sectionEnd <= sectionStart : $sectionEnd <= $sectionStart"
+			}
+
+			if ( sectionStart < previousSectionStart) { sectionBug = true;
+				messages << "sectionStart < previousSectionStart : $sectionStart < $previousSectionStart"
+			}
+			if ( sectionStart < previousSectionEnd) { sectionBug = true;
+				messages << "sectionStart < previousSectionEnd : $sectionStart < $previousSectionEnd"
+			}
+			if ( sectionEnd < previousSectionStart) { sectionBug = true;
+				messages << "sectionEnd < previousSectionStart : $sectionEnd < $previousSectionStart"
+			}
+			if ( sectionEnd < previousSectionEnd) { sectionBug = true;
+				messages << "sectionEnd < previousSectionEnd : $sectionEnd < $previousSectionEnd"
+			}
+
+			for(def turn : turns.get(section)) {
+				def turnStart = Float.parseFloat(turn.'@startTime')
+				def turnEnd =  Float.parseFloat(turn.'@endTime')
+				def spk = ""+turn.@speaker;
+				if (turn.@speaker == "null") spk = "nospk"
+				time = turnEnd - turnStart;
+				int nbwords = turn.text().split().length
+
+				for(String subspk : spk.split(" ")) {
+					String spkname = spkDict[subspk];
+					if (spkname == null) spkname = "nospk"
+					if (!totalWordsBySpk.containsKey(spkname)) {
+						totalWordsBySpk.put(spkname, 0);
+						turnsTimesBySpk.put(spkname, 0);
+						numberOfTurnsBySpk.put(spkname, 0);
+					}
+				}
+
+				if (spk != "null") turnsTime += time;
+				totalWords += nbwords
+				for(String subspk : spk.split(" ")) {
+					String spkname = spkDict[subspk];
+					if (spkname == null) spkname = "nospk"
+					totalWordsBySpk.put(spkname, totalWordsBySpk.get(spkname) + nbwords)
+					numberOfTurnsBySpk.put(spkname, numberOfTurnsBySpk.get(spkname) + 1);
+					turnsTimesBySpk.put(spkname, turnsTimesBySpk.get(spkname) + time);
+				}
+				totalWordsByTopic.put(topic,totalWordsByTopic.get(topic) +nbwords);
+
+				boolean bug = false;
+
+				if ( turnEnd <= turnStart) { bug = true;
+					messages << " turnEnd <= turnStart : $turnEnd <= $turnStart"
+				}
+
+				//				if ( turnStart < previousSectionStart) { bug = true;
+				//					println " turnStart < previousSectionStart : $turnStart < $previousSectionStart"
+				//				}
+				//				if ( turnStart < previousSectionEnd) { bug = true;
+				//					println " turnStart < previousSectionEnd : $turnStart < $previousSectionEnd"
+				//				}
+				//				if ( turnEnd < previousSectionStart) { bug = true;
+				//					println " turnEnd < previousSectionStart : $turnEnd < $previousSectionStart"
+				//				}
+				//				if ( turnEnd < previousSectionEnd) { bug = true;
+				//					println " turnEnd < previousSectionEnd : $turnEnd < $previousSectionEnd"
+				//				}
+
+				if ( turnStart < previousTurnStart) { bug = true;
+					messages << " turnStart < previousTurnStart : $turnStart < $previousTurnStart"
+				}
+				if ( turnStart < previousTurnEnd) { bug = true;
+					messages << " turnStart < previousTurnEnd : $turnStart < $previousTurnEnd"
+				}
+				if ( turnEnd < previousSectionStart) { bug = true;
+					messages << " turnEnd < previousTurnStart : $turnEnd < $previousTurnStart"
+				}
+				if ( turnEnd < previousTurnEnd) { bug = true;
+					messages << " turnEnd < previousTurnEnd : $turnEnd < $previousTurnEnd"
+				}
+				if (turnStart < sectionStart) { bug = true;
+					messages << " turnStart < sectionStart : $turnStart < $sectionStart"
+				}
+				if (turnStart > sectionEnd) { bug = true;
+					messages << " turnStart > sectionEnd : $turnStart > $sectionEnd"
+				}
+				if ( turnEnd < sectionStart) { bug = true;
+					messages << " turnEnd < sectionStart : $turnEnd < $sectionStart"
+				}
+				if (turnEnd > sectionEnd) { bug = true;
+					messages << " turnEnd > sectionEnd : $turnEnd > $sectionEnd"
+				}
+
+				for(def sync : syncs.get(turn)) {
+					boolean syncBug = false;
+					def syncTime = Float.parseFloat(sync.'@time')
+					if ( syncTime < turnStart) { syncBug = true;
+						messages << "  syncTime < turnStart : $syncTime < $turnStart"
+					}
+					if ( syncTime > turnEnd) { syncBug = true;
+						messages << "  syncTime > turnEnd : $syncTime > $turnEnd"
+					}
+
+					if (syncBug) {
+						warning = true;
+					}
+				}
+
+				previousTurnStart = turnStart;
+				previousTurnEnd = turnEnd;
+				if (bug) {
+					error = true;
+				}
+			}
+
+			previousSectionStart = sectionStart;
+			previousSectionEnd = sectionEnd;
+			if ( sectionBug) {
+				error = true;
+			}
+		}
+
+		return [error, warning];
+	}
+
+	public void printErrors()
+	{
+		for(String mess : messages)
+			println mess;
+	}
+
+	public void printAll()
+	{
+		println "Declared topics: $declaredTopics"
+		println "Topics: $topics"
+
+		println "Declared speakers: $declaredSpeakers"
+		println "Speakers: $speakers"
+
+		println "Sections: "+sections.size()
+		println "Turns: "+syncs.size()
+		println "Entities: $entities"
+	}
+
+	public static HashSet<String> allTopicDesc = new HashSet<String>();
+	public static HashSet<String> allSpkName = new HashSet<String>();
+	public static void checkDirectory(File dir) {
+		allTopicDesc = new HashSet<String>();
+		allSpkName = new HashSet<String>();
+		//println "trs dir: $dir"
+		for (File trsFile : dir.listFiles().sort()) {
+			if (!trsFile.getName().endsWith(".trs")) continue; // ignore
+			checkTRS(trsFile)
+
+		}
+
+		//println allTopicDesc;
+		//println allSpkName;
+
+	}
+
+	public static boolean checkTRS(File trsFile) {
+		boolean ret = true;
+		println "\n***** $trsFile.name *****"
+		def tester = new ValidateTRS(trsFile);
+		//tester.printAll();
+
+		def (error, warning) = tester.timeCheck();
+		if( error ) {
+			print "\nTIMES: "
+			//if( error || warning) {
+			println "errors: "+error+" warnings: "+warning;
+			tester.printErrors();
+			ret = false;
+		} //else println "all declared"
+
+		println "\nSPEAKERS: id, name, frequency"
+		if (tester.speakersCheck()) {
+			println "errors:"
+			tester.printErrors();
+			ret = false;
+		} //else println "all declared"
+		tester.printSortedList(tester.speakers, tester.spkDict);
+
+		println "\nSECTIONS: id, title, frequency"//+ tester.declaredTopics
+		if (tester.topicsCheck()) {
+			println "errors:"
+			tester.printErrors();
+			ret = false;
+		} //else println "all declared"
+		tester.printSortedList(tester.topics, tester.topicDict);
+
+		println "\nENTITIES: value, frequency"
+		tester.printSortedList(tester.entities, null);
+
+		println ""
+		for(def topic : tester.declaredTopics) {
+			allTopicDesc.add(topic.@desc)
+			if (!okTopics.contains(topic.@desc)) {
+				if(tester.topics.contains(topic.@id))
+					println "topic error: "+topic.@desc
+
+			}
+		}
+		//println ""
+		for(def spk : tester.declaredSpeakers) {
+			allSpkName.add(spk.@name)
+			if(!checkSpk(spk.@name)) {
+				if(tester.speakers.contains(spk.@id))
+					println "spk error: "+spk.@name
+			}
+		}
+		DecimalFormat formater = new DecimalFormat("0.00");
+
+		println "Statistics:"
+		println " Approx nb words: "+tester.totalWords;
+		println " Total time: "+ExecTimer.formatSecs(tester.turnsTime)
+		println " Approx word rate (word/sec): "+formater.format(tester.totalWords/tester.turnsTime)
+		println " Approx word rate (word/min): "+formater.format(60*(tester.totalWords/tester.turnsTime))
+		println ""
+
+		def meanSections = [:];
+		for(String key : tester.sectionsTimesByTopic.keySet())
+			meanSections.put(key, ExecTimer.formatSecs(tester.sectionsTimesByTopic.get(key) / tester.numberOfSectionByTopic.get(key)))
+		def meanTurns = [:];
+		for(String key : tester.turnsTimesBySpk.keySet())
+			meanTurns.put(key, ExecTimer.formatSecs(tester.turnsTimesBySpk.get(key) / tester.numberOfTurnsBySpk.get(key)))
+
+		for(String key : tester.sectionsTimesByTopic.keySet())
+			tester.sectionsTimesByTopic.put(key, ExecTimer.formatSecs(tester.sectionsTimesByTopic.get(key)))
+		for(String key : tester.turnsTimesBySpk.keySet())
+			tester.turnsTimesBySpk.put(key, ExecTimer.formatSecs(tester.turnsTimesBySpk.get(key)))
+
+		println " Number of sections: "+tester.numberOfSection
+		println " Sections time: "+ExecTimer.formatSecs(tester.sectionsTime);
+		println " Mean time of sections: "+ExecTimer.formatSecs(tester.sectionsTime/tester.numberOfSection)
+
+		println " Sections time by topic: "+tester.sectionsTimesByTopic
+		println " Number of sections by topic: "+tester.numberOfSectionByTopic
+		println " Mean time of sections by topic: "+meanSections
+		println ""
+
+		println " Number of turns: "+tester.numberOfTurn
+		println " Turns time: "+ExecTimer.formatSecs(tester.turnsTime);
+		println " Mean time of turns: "+ExecTimer.formatSecs(tester.turnsTime/tester.numberOfTurn)
+
+		println " Turns time by spk: "+tester.turnsTimesBySpk
+		println " Number of turns by spk: "+tester.numberOfTurnsBySpk
+		println " Mean time of turns by spk: "+meanTurns
+		println ""
+
+		return ret;
+	}
+
+	public static void main(String[] args) {
+		//File dir = new File("/home/sheiden/enslyon_projets/Textométrie/SpUV/EVS/master 1 STDDAD 2011/enquête 2011/Reçues")
+		File dir = new File("/home/mdecorde/xml/concattrs/ready")
+		ValidateTRS.checkDirectory(dir);
+		//ValidateTRS.checkTRS(new File("/home/mdecorde/xml/concattrs/int40-21.trs"))
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/transcriber/TRS2SRT.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/transcriber/TRS2SRT.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/transcriber/TRS2SRT.groovy	(revision 258)
@@ -0,0 +1,225 @@
+package org.txm.importer.transcriber
+/**
+ * Converts a file from Transcriber XML to STR subtitle file
+ * 
+ * @author mdecorde
+ *
+ */
+
+
+import java.util.ArrayList
+
+import javax.xml.parsers.*
+import javax.xml.stream.*
+
+import java.net.URL
+
+class TRS2SRT {
+
+	private def url
+	private def inputData
+	private def factory
+	private XMLStreamReader parser
+	def writer
+
+	def colors = ["white", "red", "blue", "green", "yellow", "grey", "violet", "pink", "orange", "brown"];
+	def icolor = 0;
+
+	File trsFile;
+	boolean debug = false
+
+	public TRS2SRT(File trsFile) {
+		inputData = trsFile.toURI().toURL().openStream()
+		factory = XMLInputFactory.newInstance()
+		parser = factory.createXMLStreamReader(inputData)
+
+		this.trsFile = trsFile
+	}
+
+	/**
+	 * Transform the trsFile to STR format
+	 * 
+	 * @param srtFile: result file
+	 */
+	public void process(File srtFile) {
+		writer = srtFile.newWriter("UTF-8")
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+			switch (event) {
+				case XMLStreamConstants.START_ELEMENT:
+					processStartElement()
+					break;
+				case XMLStreamConstants.END_ELEMENT:
+					processEndElement()
+					break;
+				case XMLStreamConstants.CHARACTERS:
+					processText()
+					break;
+			}
+		}
+		writer.close()
+	}
+
+	def speakers = [:]
+	def currentSpeakers = []
+	def currentSpeaker = "";
+	def currentSpeach = ""
+	def currentStartTime = ""
+	def currentEndTime = ""
+	def inTurn = false
+	def nTurn = 1
+	def syncCounter = 0;
+	def whoCounter = 0;
+
+	protected void processStartElement() {
+		String localname = parser.getLocalName()
+		switch (localname) {
+			case "Speaker":
+				def info = [:]
+				speakers[parser.getAttributeValue(null, "id")] = info
+				info["name"] = parser.getAttributeValue(null, "name")
+				info["color"] = colors[icolor]
+				info["count"] = 0;
+				icolor++;
+				break;
+			case "Episode":
+				if (debug) println "speakers $speakers"
+				break;
+			case "Turn":
+				if (debug) println "Turn!"
+				currentSpeakers = parser.getAttributeValue(null, "speaker").split(" ")
+				currentSpeaker = currentSpeakers[0]
+				currentSpeach = ""
+				String s = parser.getAttributeValue(null, "startTime")
+				String e = parser.getAttributeValue(null, "endTime")
+				currentStartTime = Float.parseFloat(s)
+				if (e != null) currentEndTime = Float.parseFloat(e)
+				else currentEndTime = currentStartTime+3.0; // temporary fix
+				inTurn = true
+				syncCounter = 0;
+				whoCounter = 0;
+				break;
+			case "Event":
+			if (debug) println "Event!"
+				currentSpeach += " ["+parser.getAttributeValue(null, "desc")+"] "
+				break;
+			case "Sync": // cut a Turn, the Turn@endTime must be replace with Sync@time
+				if (debug) println "Sync!"
+				syncCounter++; 
+				if (syncCounter > 1) { // ignore first 'Sync', there is no speech to write
+					def end = currentEndTime
+					currentEndTime = Float.parseFloat(parser.getAttributeValue(null, "time"))
+					writeSRTTurn() // write previous Turn, so currentEndTime is the Sync@time
+					currentEndTime = end; // restore Turn@endTime
+				}
+				break;
+			case "Who":
+				if (debug) println "Who!"
+				whoCounter++;
+				if (whoCounter > 1) { // ignore first 'Who', there is no speach to write
+					int n = Integer.parseInt(parser.getAttributeValue(null, "nb")) - 1
+					if (currentSpeakers.size() <= n) {
+						println "'Who@nb' Error at "+parser.getLocation()
+						break;
+					}
+					
+					writeSRTTurn() // write previous speach		
+					// switch current speaker
+					currentSpeaker = currentSpeakers[Integer.parseInt(parser.getAttributeValue(null, "nb")) - 1]
+				}
+				break;
+		}
+	}
+
+	protected void processEndElement() {
+		String localname = parser.getLocalName()
+		switch (localname) {
+			case "Speaker":
+				break;
+			case "Turn":
+				inTurn = false
+				writeSRTTurn()
+				break;
+			case "Sync":
+				break;
+			case "Who":
+				break;
+		}
+	}
+
+	protected writeSRTTurn() {
+		currentSpeach = currentSpeach.trim()
+
+		if (currentSpeach.length() == 0) return; // nothing to write
+
+		//println "Writing Turn of '$currentSpeaker': "+speakers[currentSpeaker]
+		def color = speakers[currentSpeaker]["color"]
+
+		if (speakers[currentSpeaker]["count"] < 2) {
+			speakers[currentSpeaker]["count"] = speakers[currentSpeaker]["count"] + 1;
+			currentSpeach = speakers[currentSpeaker]["name"]+"\t"+currentSpeach
+		}
+
+		currentSpeach = "<font color=\"$color\">$currentSpeach</font>".replaceAll("\n", " ")
+
+		def s = formatTime(currentStartTime)
+		def e = formatTime(currentEndTime)
+		currentStartTime = currentEndTime
+		writer.println """
+$nTurn
+$s --> $e
+$currentSpeach"""
+		nTurn++
+		currentSpeach = "" // reset speach
+	}
+
+	protected void processText() {
+		String txt = parser.getText();
+		if (inTurn) {
+			currentSpeach += txt
+		}
+	}
+
+	private String formatTime(float time) {
+		String rez = " ";
+
+		int ms = (time - (int)time) * 1000
+
+		float h = time / 3600;
+		time = time%3600;
+
+		float min = (time%3600) / 60;
+		int sec = (int)time%60
+
+		if (min < 10)
+			rez = ""+(int)h+":0"+(int)min;//+":"+time%60;
+		else
+			rez = ""+(int)h+":"+(int)min;//+":"+time%60;
+
+		if (sec >= 10)
+			rez += ":"+sec;
+		else
+			rez += ":0"+sec;
+
+		rez += "."+ms
+		return rez;
+	}
+
+	public static void main(String[] args) {
+		if (args.length == 0) {
+			println "Usage:"
+			println "java -jar TRS2SRT.jar file1 file2 file3"
+			println "\nResult files are saved in the save directory as fileN files."
+		}
+	//	args = ["/home/mdecorde/CCC/RECETTE/TRS2SRT/victor/pazinterior_ok.trs"]
+		for (String path : args) {
+			println "Processing path=$path ..."
+			
+			File trsFile = new File(path)
+			String name = trsFile.getName()
+			name = name.substring(0, name.indexOf("."))
+			File srtFile = new File(trsFile.getParentFile(), name+".srt")
+			TRS2SRT t = new TRS2SRT(trsFile)
+			t.process(srtFile)
+		}
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/transcriber/CommentIncluder.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/transcriber/CommentIncluder.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/transcriber/CommentIncluder.groovy	(revision 258)
@@ -0,0 +1,46 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+package org.txm.importer.transcriber
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class CommentIncluder.
+ */
+class CommentIncluder {
+	
+	/**
+	 * Instantiates a new comment includer.
+	 *
+	 * @param infile the infile
+	 * @param outfile the outfile
+	 */
+	public CommentIncluder(File infile, File outfile)
+	{
+		
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/transcriber/TokenizeEntities.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/transcriber/TokenizeEntities.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/transcriber/TokenizeEntities.groovy	(revision 258)
@@ -0,0 +1,56 @@
+package org.txm.importer.transcriber
+
+import org.txm.importer.StaxIdentityParser
+
+
+/**
+ * Wrap  "entities" span event in "w" tags 
+ * 
+ * @author mdecorde
+ *
+ */
+class TokenizeEntities extends StaxIdentityParser{
+	int wordcount = 1;
+	boolean writeStartWord = false;
+	boolean writeEndWord = false;
+	public TokenizeEntities(URL url) {
+		super(url);
+	}
+	
+	public void processStartElement() {
+		// close previous word
+		if (localname == "Event" && parser.getAttributeValue(null, "type") == "entities") {
+			if (parser.getAttributeValue(null, "extent") == "end") { // end of word
+				writer.writeEndElement();
+				writeEndWord = false;
+			}
+		}
+		
+		super.processStartElement();
+		
+		// start new word if necessary
+		if (localname == "Event" && parser.getAttributeValue(null, "type") == "entities") {
+			if (parser.getAttributeValue(null, "extent") == "begin") { // start of word
+				writeStartWord = true;
+			}
+		}
+	}
+	
+	public void processEndElement() {
+
+		super.processEndElement();
+		
+		if (writeStartWord) {
+			writer.writeStartElement("w");
+			//writer.writeAttribute("id", "w_entity_"+(wordcount++));
+			writeStartWord = false;
+		} 
+	}
+	
+	public static void main(String[] args) {
+		File dir = new File ("C:\\Documents and Settings\\mdecorde\\xml\\minileman2011")
+		File infile = new File(dir, "int05.trs")
+		TokenizeEntities tokenizer = new TokenizeEntities(infile.toURI().toURL());
+		println tokenizer.process(new File(dir, "out.trs")) 
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/transcriber/pager.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/transcriber/pager.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/transcriber/pager.groovy	(revision 258)
@@ -0,0 +1,783 @@
+// 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
+// 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.
+//
+//
+//
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$
+//
+package org.txm.importer.transcriber
+
+import java.io.File;
+import java.util.ArrayList;
+
+import javax.xml.stream.*
+
+import org.txm.importer.ApplyXsl2
+import org.txm.metadatas.Metadatas
+import org.txm.utils.io.FileCopy;
+
+
+// TODO: Auto-generated Javadoc
+/** Build Discours corpus simple edition from a xml-tei.
+ * 
+ *  @author mdecorde
+ *  
+ */
+class pager {
+	
+	boolean SIMPLE_TOOLTIP = false; // show less properties in word tooltips
+	String ENQ_HIGHLIGHT_ELEMENT = "b"
+	
+	List<String> NoSpaceBefore;
+
+	/** The No space after. */
+	List<String> NoSpaceAfter;
+
+	/** The pages. */
+	def pages = [];
+	def indexes = [];
+
+	/** The wordcount. */
+	int wordcount = 0;
+
+	/** The pagecount. */
+	int pagecount = 0;
+
+	/** The wordmax. */
+	int wordmax = 10;
+
+	/** The wordid. */
+	String wordid;
+
+	/** The first word. */
+	boolean firstWord = true;
+
+	/** The wordvalue. */
+	String wordvalue;
+
+	/** The interpvalue. */
+	String interpvalue;
+
+	/** The lastword. */
+	String lastword = " ";
+
+	/** The wordtype. */
+	String wordtype;
+
+	/** The flagform. */
+	boolean flagform = false;
+
+	/** The flaginterp. */
+	boolean flaginterp = false;
+
+	boolean flagcomment = false;
+
+	/** The url. */
+	private def url;
+
+	/** The input data. */
+	private def inputData;
+
+	/** The factory. */
+	private def factory;
+
+	/** The parser. */
+	private XMLStreamReader parser;
+
+	/** The writer. */
+	XMLStreamWriter writer;
+	BufferedOutputStream output;
+
+	File txmfile;
+
+	File outfile;
+
+	String corpusname ="";
+	String cuttingTag = "pb"
+	String txtname;
+	File htmlDir;
+	File defaultDir;
+	Metadatas metadatas;
+
+	def interviewers = [];
+	def eventTranslations = ["^^":"mot inconnu", "?":"orthographe incertaine",
+		"()":"rupture de syntaxe", "b":"bruit indéterminé",
+		"*":"mot corrigé",
+		"bb":"bruit de bouche", "bg":"bruit de gorge",
+		"ch":"voix chuchotée", "conv":"conversations de fond",
+		"e":"expiration", "i":"inspiration",
+		"mic":"bruits micro", "n":"reniflement",
+		"nontrant":"non transcrit", "pap":"froissement de papiers",
+		"pf":"souffle", "pi":"inintelligible",
+		"pif":"inaudible", "r":"respiration",
+		"rire":"rire du locuteur", "shh":"soufle électrique",
+		"sif":"sifflement du locuteur", "tx":"toux"];
+	String currentTime = "";
+	boolean bold = false;
+	int writenLength = 0;
+	boolean spokenTurn = false;
+	boolean firstSync = false;
+	boolean firstWho = false;
+	/**
+	 * Instantiates a new pager.
+	 *
+	 * @param infile the infile
+	 * @param outfile the outfile
+	 * @param NoSpaceBefore the no space before
+	 * @param NoSpaceAfter the no space after
+	 * @param max the max
+	 * @param metadatas the metadatas
+	 */
+	pager(File txmfile, File htmlDir, String txtname, List<String> NoSpaceBefore,
+	List<String> NoSpaceAfter, int max, String corpusname, String cuttingTag, Metadatas metadatas) {
+		this.metadatas = metadatas
+		this.wordmax = max;
+		this.cuttingTag = cuttingTag;
+		this.corpusname = corpusname;
+		this.NoSpaceBefore = NoSpaceBefore;
+		this.NoSpaceAfter = NoSpaceAfter;
+		this.url = txmfile.toURI().toURL();
+		this.txmfile = txmfile;
+		this.htmlDir = htmlDir;
+		this.txtname = txtname;
+
+		inputData = url.openStream();
+		factory = XMLInputFactory.newInstance();
+		parser = factory.createXMLStreamReader(inputData);
+
+		defaultDir = new File(htmlDir, "default")
+		defaultDir.mkdir()
+		new File(htmlDir, "onepage").mkdir()
+		outfile = new File(htmlDir, "onepage/${txtname}.html");
+		createOutput(outfile)
+
+		try {
+			process();
+		} catch(Exception e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+			if (writer != null) {
+				writer.close();
+				output.close();
+			}
+		}
+	}
+
+	/**
+	 * Creates the output.
+	 *
+	 * @param outfile the outfile
+	 * @return true, if successful
+	 */
+	private boolean createOutput(File outfile) {
+		try {
+			//println "write html in : "+outfile
+			XMLOutputFactory outfactory = XMLOutputFactory.newInstance();
+			output = new BufferedOutputStream(new FileOutputStream(outfile))
+			writer = outfactory.createXMLStreamWriter(output, "UTF-8");//create a new file
+
+			return true;
+		} catch (Exception e) {
+			System.out.println(e.getLocalizedMessage());
+			return false;
+		}
+	}
+	
+	/** The events. */
+	List<String> events = [];
+	String previousEvent = "", nextEvent = "";
+	/**
+	 * Process.
+	 */
+	void process() {
+
+		String previousElem = "";
+		boolean parolesRaportees = false;
+		boolean firstWord = true;
+		boolean shouldBreak = false;
+		boolean overlapping = false;
+		int nbBreak = 0;
+		String previousSPK;
+		String localname = "";
+		ArrayList<String> whos = [];
+		HashMap<String, String> speakers = new HashMap<String, String>();
+		HashMap<String, String> topics = new HashMap<String, String>();
+
+		writer.writeStartDocument("UTF-8","1.0");
+		writer.writeStartElement("html");
+		//<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
+		writer.writeStartElement("meta");
+		writer.writeAttribute("http-equiv", "Content-Type");
+		writer.writeAttribute("content", "text/html");
+		writer.writeAttribute("charset", "UTF-8");
+		writer.writeEndElement();
+		writer.writeStartElement("head");
+
+		//<link rel="stylesheet" type="text/css" href="class.css" />
+		writer.writeStartElement("link");
+		writer.writeAttribute("rel", "stylesheet");
+		writer.writeAttribute("type", "text/css");
+		writer.writeAttribute("href", "transcriber.css");
+		writer.writeEndElement();
+		writer.writeEndElement();
+
+		nbBreak++
+		writer.writeStartElement("body");
+		writer.writeEmptyElement("pb");
+		writer.writeAttribute("id", ""+nbBreak);
+		pages << new File(defaultDir, "${txtname}_${nbBreak}.html")
+
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+			switch (event) {
+				case XMLStreamConstants.START_ELEMENT:
+					localname = parser.getLocalName();
+					switch (localname) {
+						case "text":
+							writer.writeStartElement("h2");
+							writer.writeAttribute("class","titre");
+							String title = parser.getAttributeValue(null, "title");
+							if (title != null) {
+								writer.writeCharacters(title);
+							} else {
+								writer.writeCharacters("Transcription "+txmfile.getName().substring(0, txmfile.getName().length() - 4));
+							}
+							writer.writeEndElement();
+							if(metadatas != null) {
+								writer.writeStartElement("table");
+								boolean grey = false;
+								for (String name : metadatas.getPropertyNames()) {
+									if ("title" == name) continue; // ignore "title" metadata
+									grey = !grey;
+									writer.writeStartElement("tr");
+									if (grey)
+										writer.writeAttribute("style","background-color:lightgrey;")
+									String value = parser.getAttributeValue(null, name);
+									if (value != null) {
+										writer.writeStartElement("td");
+										writer.writeCharacters(name);
+										writer.writeEndElement();
+										writer.writeStartElement("td");
+										writer.writeCharacters(value);
+										writer.writeEndElement();
+									}
+									//get enqueteur to style their names
+									if (name.startsWith("enq")) {
+										interviewers.add(value)
+									}
+									writer.writeEndElement();
+								}
+								writer.writeEndElement();
+							}
+							break;
+						case "Topics":
+						/*writer.writeStartElement("h2");
+					 writer.writeCharacters("Topics");
+					 writer.writeEndElement();
+					 writer.writeStartElement("ul");
+					 */
+							break;
+						case "Topic":
+							topics.put(parser.getAttributeValue(null,"id"), parser.getAttributeValue(null,"desc"))
+						/*writer.writeStartElement("li");
+					 writer.writeCharacters(parser.getAttributeValue(null,"desc"));
+					 writer.writeStartElement("ul");
+					 for(int i = 0 ; i < parser.getAttributeCount() ; i++)
+					 {
+					 if(parser.getAttributeLocalName(i) != "desc")
+					 {
+					 writer.writeStartElement("li");
+					 writer.writeCharacters(parser.getAttributeLocalName(i)+": "+parser.getAttributeValue(i));
+					 writer.writeEndElement();
+					 }
+					 }
+					 writer.writeEndElement();
+					 writer.writeEndElement();
+					 */
+							break;
+						case "Speakers":
+						/*writer.writeStartElement("h2");
+					 writer.writeCharacters("Speakers");
+					 writer.writeEndElement();
+					 writer.writeStartElement("ul");*/
+							break;
+						case "Speaker":
+							whos.add(parser.getAttributeValue(null,"name"));
+							speakers.put(parser.getAttributeValue(null,"id"), parser.getAttributeValue(null,"name"))
+						/*writer.writeStartElement("li");
+					 writer.writeStartElement("ul");
+					 writer.writeCharacters(parser.getAttributeValue(null,"name"));
+					 for(int i = 0 ; i < parser.getAttributeCount() ; i++)
+					 {
+					 if(parser.getAttributeLocalName(i) != "name")
+					 {
+					 writer.writeStartElement("li");
+					 writer.writeCharacters(parser.getAttributeLocalName(i)+": "+parser.getAttributeValue(i));
+					 writer.writeEndElement();
+					 }
+					 }
+					 writer.writeEndElement();
+					 writer.writeEndElement();*/
+							break;
+						case "Comment":
+							spokenTurn = true;
+							writenLength++;
+							writer.writeStartElement("span");
+							writer.writeAttribute("class", "comment");
+							writer.writeCharacters(" ["+parser.getAttributeValue(0)+"] ");
+							writer.writeEndElement();
+							flagcomment = true;
+							break;
+						case "div":
+							writer.writeStartElement("div");
+							writer.writeAttribute("class", "section");
+							String type = parser.getAttributeValue(null,"type");
+							String desc = parser.getAttributeValue(null,"topic");
+							if (type != null && desc != null) {
+								writer.writeStartElement("h3");
+								writer.writeCharacters(type+": "+desc);
+								for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
+									String name = parser.getAttributeLocalName(i);
+									if (!"type".equals(name)
+									&& !"topic".equals(name)
+									&& !"startTime".equals(name)
+									&& !"endTime".equals(name)) {
+										writer.writeCharacters(", "+name+": "+parser.getAttributeValue(i));
+									}
+								}
+								writer.writeEndElement(); // h3
+							}
+							break;
+						case "sp":
+							endBoldIfNeeded()
+							firstSync = true;
+							firstWho = true;
+							spokenTurn = false;
+							overlapping = false
+
+							writer.writeStartElement("p");
+							writer.writeAttribute("class", "turn");
+
+							overlapping = ("true" == parser.getAttributeValue(null,"overlap"))
+							String spid = parser.getAttributeValue(null,"speaker");
+							whos = []
+							if (overlapping) {
+								writer.writeEmptyElement("br");
+								writeSpeaker(parser.getAttributeValue(null,"speaker"), false)
+								
+								writer.writeEmptyElement("br");
+								whos = spid.split(" ")
+							}
+
+							break;
+						case "u":
+							writer.writeCharacters("\n");
+							this.currentTime = parser.getAttributeValue(null,"time");
+						
+							if (previousElem == "u" && writenLength == 0) { // if previous u had no words, it was a silence
+								writer.writeStartElement("span");
+								writer.writeAttribute("class", "event");
+								writer.writeCharacters("[silence]");
+								writer.writeEndElement(); // span
+								writer.writeEmptyElement("br");
+							}
+							
+							String spk = parser.getAttributeValue(null, "spk")
+							if (spk != null && spk != previousSPK) {
+								endBoldIfNeeded()
+								writer.writeEmptyElement("br");
+								writeSpeaker(parser.getAttributeValue(null, "spk"), overlapping)
+								startBoldIfNeeded()
+							}
+
+							writeCurrentTime()
+							previousSPK = spk
+
+						//							writenLength = 0;
+						/*writer.writeStartElement("span");
+					 writer.writeAttribute("class", "sync");
+					 writer.writeCharacters("["+parser.getAttributeValue(null,"time")+"]");
+					 writer.writeEndElement();*/
+
+							break;
+						case "event":
+							spokenTurn = true;
+							writenLength++;
+							String desc = parser.getAttributeValue(null,"desc");
+							desc = translateEvent(desc);
+							String type = parser.getAttributeValue(null,"type");
+							if (desc.equals("paroles rapportées")) {
+								if (parser.getAttributeValue(null, "extent") == "end")
+									writer.writeCharacters("» ");
+								else if (parser.getAttributeValue(null, "extent") == "begin")
+									writer.writeCharacters(" «");
+							} else {
+								writer.writeStartElement("span");
+								writer.writeAttribute("class", "event");
+								if (parser.getAttributeValue(null, "extent") == "end") {
+									writer.writeCharacters(" <"+desc+"] ");
+									if(events.size() > 0)
+										events.remove(events.size()-1)
+								}
+								else if (parser.getAttributeValue(null, "extent") == "begin") 	{
+
+									writer.writeCharacters(" ["+desc+"> ");
+									events.add(desc)
+								}
+								else if (parser.getAttributeValue(null, "extent") == "previous") {
+									if(parser.getAttributeValue(null, "type") == "pronounce")
+										writer.writeCharacters("_["+desc+"] ");
+									else
+										writer.writeCharacters("_["+desc+"] ");
+									previousEvent = desc;
+								}
+								else if (parser.getAttributeValue(null, "extent") == "next") {
+									writer.writeCharacters(" ["+desc+"]_");
+									nextEvent = desc
+								}
+								else
+									writer.writeCharacters(" ["+desc+"] ");
+								writer.writeEndElement(); // span@class=event
+							}
+							break;
+						case "w":
+							for(int i = 0 ; i < parser.getAttributeCount() ; i++)
+								if(parser.getAttributeLocalName(i) == "id") {
+									wordid = (parser.getAttributeValue(i));
+									break;
+								}
+							if (firstWord) {
+								indexes << wordid
+								firstWord = false;
+							}
+							wordcount++;
+							if (wordcount >= wordmax) {
+								shouldBreak = true;
+							}
+							break;
+
+						case "ana":
+							
+							String type = parser.getAttributeValue(null,"type").substring(1);
+							if (SIMPLE_TOOLTIP) {
+								if (type.contains("lemma") || type.contains("pos")) {
+									flaginterp=true;
+									interpvalue+=", ";
+								}
+							} else {
+								flaginterp=true;
+								interpvalue+=", "+type+"="
+							}
+							break;
+
+						case "form":
+							wordvalue="";
+							interpvalue ="";
+							flagform=true;
+							break;
+					}
+					previousElem = localname;
+					break;
+				case XMLStreamConstants.END_ELEMENT:
+					localname = parser.getLocalName();
+					switch(localname)
+					{
+						case "text":
+							break;
+						case "Topics":
+						//writer.writeEndElement();
+							break;
+						case "Topic":
+							break;
+						case "Speakers":
+						//println "Speakers: "+speakers
+						//writer.writeEndElement();
+							break;
+						case "Speaker":
+							break;
+
+						case "div":
+						//writer.writeCharacters("}");
+							
+							writer.writeEndElement(); // div
+							writer.writeCharacters("\n");
+							break;
+						case "sp":
+							//println "CLOSING: "+parser.getLocalName()
+							endBoldIfNeeded()
+							if (!spokenTurn) {
+								writer.writeStartElement("span");
+								writer.writeAttribute("class", "event");
+								writer.writeCharacters("[silence]");
+								writer.writeEndElement();
+								writer.writeEmptyElement("br");
+							}
+
+							writer.writeEndElement(); // p
+
+							if (shouldBreak) {
+								nbBreak++
+								writer.writeEmptyElement("pb");
+								writer.writeAttribute("id", ""+nbBreak);
+								writer.writeCharacters("\n");
+								
+								pages << new File(defaultDir, "${txtname}_${nbBreak}.html")
+								indexes << wordid
+
+								wordcount = 0;
+								shouldBreak = false;
+							}
+							writer.writeCharacters("\n");
+							break;
+						case "u":
+							//writer.writeEndElement() // span@class=u
+							//writer.writeEmptyElement("br");
+						//if (overlapping) writer.writeEndElement(); // b
+							break;
+						case "event":
+							break;
+						case "form":
+							flagform = false
+							break;
+						case "ana":
+							flaginterp = false
+							break;
+						case "w":
+							writenLength++;
+							spokenTurn = true;
+							int l = lastword.length();
+							String endOfLastWord = "";
+							if(l > 0)
+								endOfLastWord = lastword.subSequence(l-1, l);
+
+							if(interpvalue != null)
+								interpvalue = interpvalue.replace("\"","&quot;");
+							if(events.size() > 0)
+								interpvalue = interpvalue.replace("event=", "event="+events.toString().replace("\"","&quot;")); // remove ", "
+
+							if(nextEvent.length() > 0)
+							{
+								interpvalue = interpvalue.replace("event=", "event="+nextEvent+", ")
+								nextEvent = ""
+							}
+							interpvalue = interpvalue.replace("=, ","='', "); // add '' to empty interp value
+							if (interpvalue.startsWith(", ")) interpvalue = interpvalue.substring(2)
+//							println "** SPACE TEST"
+//							println "NoSpaceBefore: "+NoSpaceBefore+" contains ? "+wordvalue
+//							println "NoSpaceAfter: "+NoSpaceAfter+" contains ? "+lastword
+//							println "wordvalue starts with '-' ? "+wordvalue
+//							println "NoSpaceAfter: "+NoSpaceAfter+" contains endOfLastWord ? "+endOfLastWord
+							if(NoSpaceBefore.contains(wordvalue) ||
+							NoSpaceAfter.contains(lastword) ||
+							wordvalue.startsWith("-") ||
+							NoSpaceAfter.contains(endOfLastWord)) {
+//								println " NO SPACE"
+							} else {
+//								println " SPACE"
+								writer.writeCharacters(" ");
+							}
+
+							if (interpvalue.contains("rapp1")) {
+								writer.writeCharacters(" «");
+							} else if (wordvalue == "\"") {
+								// don't write this char
+							} else {
+								writer.writeStartElement("span");
+								writer.writeAttribute("class", "word");
+								writer.writeAttribute("title", interpvalue);
+								writer.writeAttribute("id", wordid);
+								writer.writeCharacters(wordvalue);
+								writer.writeEndElement();
+							}
+							if (interpvalue.contains("orth")) {
+								writer.writeStartElement("span");
+								writer.writeAttribute("class", "event");
+								writer.writeCharacters("_[?]");
+								writer.writeEndElement();
+							}
+							if (interpvalue.contains("corr")) {
+								writer.writeStartElement("span");
+								writer.writeAttribute("class", "event");
+								writer.writeCharacters("_[!]");
+								writer.writeEndElement();
+							}
+
+							if (interpvalue.contains("rapp2")) {
+								writer.writeCharacters(" » ");
+							}
+							
+							lastword=wordvalue;
+							break;
+					}
+					
+					break;
+
+				case XMLStreamConstants.CHARACTERS:
+					if(flagform)
+						if(parser.getText().length() > 0)
+							wordvalue+=(parser.getText().trim());
+					if(flaginterp)
+						if(parser.getText().length() > 0)
+							interpvalue+=(parser.getText().trim());
+					break;
+			}
+		}
+		writer.writeEndElement();
+
+		writer.writeEmptyElement("pb");
+		nbBreak++
+		writer.writeAttribute("id", ""+nbBreak);
+
+		writer.writeEndElement();
+		writer.close();
+		output.close();
+
+		File txmhome = new File(org.txm.Toolbox.getParam(org.txm.Toolbox.USER_TXM_HOME));
+		File xlsDir  = new File(txmhome, "xsl");
+		File xslfile = new File(xlsDir,"breakByMilestone.xsl");
+		if (!xslfile.exists()) {
+			println ""
+		}
+		//		println "xsl: "+xslfile
+		//		println "html: "+outfile
+		//		println "pages: "+pages
+		//		println "words: "+indexes
+
+
+				if (pages.size() > 1) {
+					for (int i = 1 ; i < nbBreak ; i++) {
+						ApplyXsl2 a = new ApplyXsl2(xslfile.getAbsolutePath());
+						String[] params = ["pbval1", i,"pbval2", i+1];
+		
+						File resultfile = pages[i-1]
+						//println "BBmilestones: "+i+" "+(i+1)+" in file "+resultfile
+						//println "process $outfile -> $resultfile"
+						a.process(outfile.getAbsolutePath(), resultfile.getAbsolutePath(), params);
+					}
+				} else {
+					File page = pages[0]
+					FileCopy.copy(outfile, page)
+				}
+	}
+
+	private void writeCurrentTime()
+	{
+		writer.writeStartElement("span");
+		writer.writeAttribute("class", "sync");
+		writer.writeCharacters(currentTime);
+		writer.writeEndElement();
+	}
+
+	private void writeSpeaker(String spk, boolean overlapping) {
+		
+		writer.writeStartElement("span");
+		writer.writeAttribute("class", "spk");
+		if(interviewers.contains(spk))
+			bold = true;
+		else
+			bold = false;
+		spk = spk.replaceAll('^([^0-9]*)([0-9]+)$', '$1 $2');
+		if (overlapping) writer.writeCharacters("// ")
+		writer.writeCharacters(spk+": ")
+		writer.writeEndElement(); // span@class=spk
+	}
+
+	private String translateEvent(String desc) {
+		if(eventTranslations.containsKey(desc))
+			return eventTranslations.get(desc);
+		else
+			return desc;
+	}
+	
+	boolean boldOpenned = false;
+	private void startBoldIfNeeded() {
+		if (bold) {
+			writer.writeStartElement(ENQ_HIGHLIGHT_ELEMENT);
+			boldOpenned = true;
+		}
+	}
+	
+	private endBoldIfNeeded() {
+		if (boldOpenned) {
+//			println "CLOSE BOLD"
+			writer.writeEndElement(); // b
+			boldOpenned = false;
+		}
+	}
+
+	//	private String formatTime(float time, boolean doshort)
+	//	{
+	//		String rez = " ";
+	//		//		if(time >= 3600) // >= 1h
+	//		//		{
+	//		float h = time / 3600;
+	//		time = time%3600;
+	//		float min = (time%3600) / 60;
+	//		int sec = (int)time%60;
+	//
+	//		if(min < 10)
+	//			rez = ""+(int)h+":0"+(int)min;//+":"+time%60;
+	//		else
+	//			rez = ""+(int)h+":"+(int)min;//+":"+time%60;
+	//		//if (!doshort)
+	//		if (sec > 9)
+	//			rez += ":"+(int)time%60;
+	//		else
+	//			rez += ":0"+(int)time%60;
+	//		//		}
+	//		//		else if(time >= 60) // >= 1min
+	//		//		{
+	//		//			int min = time/60;
+	//		//			if(min < 10)
+	//		//				rez = "00:0"+min;//+":"+time%60;
+	//		//			else
+	//		//				rez = "00:"+min;//+":"+time%60;
+	//		//			if(!doshort)
+	//		//				rez += ":"+(int)time%60;
+	//		//		}
+	//		//		else // < 60
+	//		//		{
+	//		//			if(time < 10)
+	//		//				return " 0:0"+time;
+	//		//			else
+	//		//				return " 0:"+time;
+	//		//		}
+	//		return rez;
+	//	}
+
+	/**
+	 * Gets the page files.
+	 *
+	 * @return the page files
+	 */
+	public ArrayList<File> getPageFiles() {
+		return pages;
+	}
+
+	/**
+	 * Gets the idx.
+	 *
+	 * @return the idx
+	 */
+	public ArrayList<String> getIdx() {
+		return indexes;
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/transcriber/FixTiming.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/transcriber/FixTiming.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/transcriber/FixTiming.groovy	(revision 258)
@@ -0,0 +1,227 @@
+// Copyright © - ENS de Lyon - http://textometrie.ens-lyon.fr
+//
+// This file is part of the TXM platform.
+//
+// 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 3 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/>.
+//
+// $LastChangedDate: 2011-11-01 16:12:36 +0100 (mar., 01 nov. 2011) $
+// $LastChangedRevision: 2049 $
+// $LastChangedBy: sheiden $
+//
+
+package org.txm.importer.transcriber
+import java.text.DecimalFormat;
+// parameters
+
+String userdir = System.getProperty("user.home")
+File infile = new File(userdir, "xml/concattrs/Reçues/int23.trs")
+File outfile = new File(userdir, "xml/concattrs/Reçues/int23-corr.trs")
+
+public boolean checkSpk(String spk) {
+	return spk.matches(ValidateTRS.spkPattern);
+}
+
+public fixTopics(def trs) {
+	
+	def okTopics = ValidateTRS.okTopics;
+	
+	// get Topic ids
+	def ids2desc = [:];
+	def declaredTopics = trs.Topics.Topic;
+	for (def topic : declaredTopics) {
+		ids2desc[topic.@id]=topic.@desc
+	}
+	
+	// fix Sections
+	for(def section : trs.Episode.Section) {
+
+		if (section.@topic != null)
+		if (okTopics.contains(ids2desc[section.@topic])) {
+			section.@topic = ids2desc[section.@topic]
+		}
+	}
+	
+	// fix Section decl
+	for(def topic : trs.Topics.Topic) {
+		if (okTopics.contains(ids2desc[topic.@id])) {
+			topic.@id = topic.@desc
+		}
+	}
+}
+
+def fixTurn(prevTurn, turn) // end < start
+{
+	def start =  Float.parseFloat(turn.'@startTime')
+	def startS = turn.'@startTime'
+	def end =  Float.parseFloat(turn.'@endTime')
+	def endS = turn.'@endTime'
+
+	// patch previous turn
+	if (prevTurn != null) {
+		def prevstart = Float.parseFloat(prevTurn.'@startTime')
+		if (prevstart > end) {
+			println "** FixTiming: Warning: previous turn not updated ($prevstart > $end): $prevTurn"
+		} else {
+			prevTurn.'@endTime' = endS;
+		}
+	} else {
+		turn.parent().'@startTime' = endS
+	}
+
+	// patch current turn
+	turn.'@startTime' = endS;
+	turn.'@endTime' = startS;
+
+	// patch next turn
+	def i = turn.parent().children().indexOf(turn)
+	if (turn.parent().children().size() > i+1) {
+		def nextTurn = turn.parent().children().get(i+1)
+		if (nextTurn != null) {
+			def nextend = Float.parseFloat(nextTurn.'@endTime')
+			nextTurn.'@startTime' = startS; // patch next Turn even if nextTurn.end < start, loop will continue to patch next turns
+		}
+	} else {
+		turn.parent().'@endTime' = startS
+	}
+	println "** FixTiming: fixed Turn: old time[$startS, $endS] to ["+turn.@startTime+", "+turn.@endTime+"]"
+}
+
+def fixTurn2(turn, timeResolution) // start == end
+{
+	DecimalFormat formater = DecimalFormat.getInstance(Locale.ENGLISH)
+	formater.setMaximumFractionDigits(3)
+	//DecimalFormat formater = new DecimalFormat("#.000");
+	def start =  Float.parseFloat(turn.'@startTime')
+	def startS = turn.'@startTime'
+	def end =  Float.parseFloat(turn.'@endTime')+timeResolution*10
+	def endS = formater.format(end)
+	println "ENDS: "+endS
+
+	// patch current turn
+	turn.'@endTime' = endS;
+
+	// patch next turn
+	def i = turn.parent().children().indexOf(turn)
+	if (turn.parent().children().size() > i+1) {
+		def nextTurn = turn.parent().children().get(i+1)
+		if (nextTurn != null) {
+			def nextstart = Float.parseFloat(nextTurn.'@startTime')
+			nextTurn.'@startTime' = endS; // patch next Turn even if nextTurn.end < start, loop will continue to patch next turns
+		}
+	} else {
+		turn.parent().'@endTime' = endS
+	}
+
+	println "** FixTiming: fixed Turn: equal old time[$startS, $endS] to ["+turn.@startTime+", "+turn.@endTime+"]"
+}
+
+def fixSync(turn)
+{
+	def start =  Float.parseFloat(turn.'@startTime')
+	def end =  Float.parseFloat(turn.'@endTime')
+	def syncs = turn.Sync
+	def badSyncList = []
+
+	def lastValidSyncTime = start
+	def firstSync = true
+
+	for (def sync : syncs) {
+		if (firstSync) {
+			if (sync.@time != turn.'@startTime') {
+				println "** FixTiming: fixed first Sync: old time "+sync.@time+" to "+turn.'@startTime'
+			}
+			sync.@time = turn.'@startTime'
+			lastValidSyncTime = start
+			firstSync = false
+		} else {
+			def time = Float.parseFloat(sync.@time)
+			if (time > lastValidSyncTime && time < end) {
+				fixBadSyncList(badSyncList, lastValidSyncTime, time)
+				lastValidSyncTime = time
+				badSyncList = []
+			} else {
+				badSyncList << sync
+			}
+		}
+	}
+	fixBadSyncList(badSyncList, lastValidSyncTime, end)
+}
+
+def fixBadSyncList(list, start, end) {
+	def timeResolution = 0.001
+	if (start >= end) {
+		println("** FixTiming: fixBadSyncList: start($start) >= end($end)")
+		return
+	}
+	if (list.size() > 0) {
+		def dt = (end - start)/(list.size()+1)
+		if (dt < timeResolution) {
+			println("** FixTiming: fixBadSyncList: dt($dt) < $timeResolution seconds")
+			return
+		}
+		def st = start
+		list.each { sync ->
+			st += dt
+			def oldtime = sync.@time
+			sync.@time = ""+st
+			println "** FixTiming: fixed Sync: old time $oldtime to $st"
+		}
+	}
+}
+
+public def fixTRS(File infile, File outfile) {
+	def timeResolution = 0.001
+	URL u = infile.toURI().toURL()
+	InputStream ins = u.openStream()
+
+	// Open input file
+	def slurper = new XmlParser();
+	def trs = slurper.parse(infile.toURI().toString())
+
+	// First fix all <Turn>
+	def prevTurn = null
+	for (def section : trs.Episode.Section) {
+		section.Turn.each{ turn ->
+			def start = Float.parseFloat(turn.'@startTime')
+			def end =  Float.parseFloat(turn.'@endTime')
+			if (end < start) {
+				fixTurn(prevTurn, turn)
+			} else if (start == end) {
+				fixTurn2(turn, timeResolution)
+			}
+			prevTurn = turn
+			//} catch (Exception e){ org.txm.utils.logger.Log.printStackTrace(e); println "start: "+turn.'@startTime' println "end: "+turn.'@endTime'}
+		}
+	}
+
+	// Then fix all <Sync>s of Turns
+	for (def section : trs.Episode.Section) {
+		section.Turn.each{ turn ->
+			fixSync(turn)
+		}
+	}
+	
+	// Finally fix topics declarations
+	fixTopics(trs);
+
+	String xml = "";
+
+	println ""+xml
+	outfile.withWriter("UTF-8"){ writer ->
+		writer.write('<?xml version="1.0" encoding="UTF-8"?>\n<!DOCTYPE Trans SYSTEM "trans-14.dtd">\n')
+		new groovy.util.XmlNodePrinter(new PrintWriter(writer)).print(trs) }
+}
+
+/// MAIN ///
+fixTRS(infile, outfile);
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/importer/transcriber/ChangeSpeaker.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/transcriber/ChangeSpeaker.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/transcriber/ChangeSpeaker.groovy	(revision 258)
@@ -0,0 +1,147 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+package org.txm.importer.transcriber;
+
+import org.txm.importer.*;
+import org.txm.utils.*;
+import org.txm.metadatas.*;
+
+import java.io.File;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import javax.xml.parsers.*;
+import javax.xml.xpath.*;
+import javax.xml.transform.*;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+// TODO: Auto-generated Javadoc
+/** remove part of xml given an id. */
+public class ChangeSpeaker {
+	File outfile;
+	
+	/** The doc. */
+	Document doc;
+	
+	/**
+	 * Instantiates a new change speaker.
+	 *
+	 * @param transcriptionfile the transcriptionfile
+	 * @param outfile the outfile
+	 * @param id the id
+	 * @param newid the newid
+	 */
+	public ChangeSpeaker(File transcriptionfile, File outfile, String id, String newid)
+	{
+		this.outfile = outfile;
+		
+		String xpath = "//Turn";
+		DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
+		domFactory.setNamespaceAware(true); // never forget this!
+		DocumentBuilder builder = domFactory.newDocumentBuilder();
+		doc = builder.parse(transcriptionfile);
+		
+		def expr = XPathFactory.newInstance().newXPath().compile(xpath);
+		def nodes = expr.evaluate(doc, XPathConstants.NODESET);
+		
+		
+		
+		for(def node : nodes)
+		{
+			if (node == null) continue;
+			
+			Element elem = (Element)node;
+			if(elem.getAttribute("speaker").contains(id))
+			{
+				String value = elem.getAttribute("speaker");
+				value = value.replace(id, newid);
+				elem.setAttribute("speaker", value);
+			}
+		}
+		
+		def expr2 = XPathFactory.newInstance().newXPath().compile("//Speaker[@id='"+id+"']");
+		def nodes2 = expr2.evaluate(doc, XPathConstants.NODESET);
+		
+		for(def node : nodes2)
+		{
+			if (node == null) continue;
+			
+			Element elem = (Element)node;
+			elem.setAttribute("id", newid);
+		}
+		save()
+	}
+	
+	/**
+	 * Save.
+	 *
+	 * @return true, if successful
+	 */
+	private boolean save()
+	{
+		try {
+			// Création de la source DOM
+			Source source = new DOMSource(doc);
+			
+			// Création du fichier de sortie
+			Writer writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outfile), "UTF-8")); 
+			Result resultat = new StreamResult(writer);
+			
+			// Configuration du transformer
+			TransformerFactory fabrique = new net.sf.saxon.TransformerFactoryImpl();
+			Transformer transformer = fabrique.newTransformer();
+			transformer.setOutputProperty(OutputKeys.METHOD, "xml");
+			transformer.setOutputProperty(OutputKeys.INDENT, "yes"); 
+			transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); 
+			
+			// Transformation
+			transformer.transform(source, resultat);
+			writer.close();
+			return true;
+		} catch (Exception e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+			return false;
+		}
+	}
+	
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args)
+	{
+		String homedir = System.getProperty("user.home")
+		File trs1 = new File(homedir, "xml/concattrs/int18_1.trs")
+		new ChangeSpeaker(trs1, trs1, "spk2", "spk4");
+		new ChangeSpeaker(trs1, trs1, "spk3", "spk2");
+		new ChangeSpeaker(trs1, trs1, "spk4", "spk3");
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/transcriber/ConcatTrs.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/transcriber/ConcatTrs.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/transcriber/ConcatTrs.groovy	(revision 258)
@@ -0,0 +1,436 @@
+// 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
+// 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.
+//
+//
+//
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$
+//
+package org.txm.importer.transcriber
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.*;
+
+import javax.xml.stream.*;
+import java.io.File;
+import java.net.URL;
+import java.text.DecimalFormat;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class ConcatTrs.
+ */
+class ConcatTrs {
+
+	/** The localname. */
+	String localname;
+
+	/** The prefix. */
+	String prefix;
+
+	/** The input data1. */
+	InputStream inputData1,/** The input data2. */
+	inputData2;
+
+	/** The parser1. */
+	XMLStreamReader parser1,
+	/** The parser2. */
+	parser2;
+
+	/** The output. */
+	BufferedOutputStream output;
+
+	/** The writer. */
+	XMLStreamWriter writer;
+
+	/** The inputfactory. */
+	XMLInputFactory inputfactory = XMLInputFactory.newInstance();
+
+	/** The factory. */
+	XMLOutputFactory factory = XMLOutputFactory.newInstance();
+
+	/** The speakers. */
+	HashMap<File, String> speakers = new HashMap<File, String>();
+
+	/**
+	 * Instantiates a new concat trs.
+	 *
+	 * @param trs1 the trs1
+	 * @param trs2 the trs2
+	 * @param result the result
+	 */
+	public ConcatTrs(File trs1, File trs2, File result)
+	{
+		// t1<-open("t1.trs")
+		// t2<-open("t2.trs")
+		// out<-open("t3.trs", "w")
+		inputData1 = trs1.toURI().toURL().openStream();
+		parser1 = inputfactory.createXMLStreamReader(inputData1);
+
+		inputData2 = trs2.toURI().toURL().openStream();
+		parser2 = inputfactory.createXMLStreamReader(inputData2);
+
+		output = new BufferedOutputStream(new FileOutputStream(result))
+		writer = factory.createXMLStreamWriter(output, "UTF-8");
+
+		// check-heads(t1, t2) // same speakers
+		if(!testSpeakers())
+		{
+			println "stop"
+			return;
+		}
+
+		//get shift time trs1
+		inputData1.close();
+		inputData1 = trs1.toURI().toURL().openStream();
+		parser1 = inputfactory.createXMLStreamReader(inputData1);
+		float shift = getLastTime(parser1);
+
+		//get last time trs2
+		inputData2.close();
+		inputData2 = trs2.toURI().toURL().openStream();
+		parser2 = inputfactory.createXMLStreamReader(inputData2);
+		float end = getLastTime(parser2);
+
+		end += shift;
+		println "shift: $shift ; end: $end"
+
+		// copy-head-body-no-tail(t1, out) // shift<-last("sp", t1).time
+		inputData1.close();
+		inputData1 = trs1.toURI().toURL().openStream();
+		parser1 = inputfactory.createXMLStreamReader(inputData1);
+		writeFirstPartAndGetLastTime(parser1, end);
+
+		// copy-body+tail-time-shifted(t2, out, shift)
+		inputData2.close();
+		inputData2 = trs2.toURI().toURL().openStream();
+		parser2 = inputfactory.createXMLStreamReader(inputData2);
+		writeSecondPartAndShiftTime(parser2, shift);
+
+		writer.flush();
+		writer.close();
+		output.close();
+
+		inputData1.close();
+		inputData2.close();
+	}
+
+	/**
+	 * Test speakers.
+	 *
+	 * @return true, if successful
+	 */
+	protected boolean testSpeakers()
+	{
+		String speakers1 = getSpeaker(parser1);
+		String speakers2 = getSpeaker(parser2);
+
+		boolean ret = speakers1 == speakers2;
+
+		if(!ret)
+		{
+			println "Speakers are differents : "
+			println "  speakers1= $speakers1"
+			println "  speakers2= $speakers2"
+		}
+		else
+			println "speakers OK $speakers1 and $speakers2"
+		return ret;
+	}
+
+	/**
+	 * Gets the speaker.
+	 *
+	 * @param parser the parser
+	 * @return the speaker
+	 */
+	protected String getSpeaker(XMLStreamReader parser)
+	{
+		//println "get speakers of $parser"
+
+		ArrayList<String> spksvalues = [];
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next())
+		{
+			switch (event)
+			{
+				case XMLStreamConstants.START_ELEMENT:
+					localname = parser.getLocalName();
+				//println localname
+					if(localname == "Speaker")
+					{
+						spksvalues << "("+parser.getAttributeValue(null,"id")+"-"+parser.getAttributeValue(null,"name")+")";
+					}
+					break;
+				case XMLStreamConstants.END_ELEMENT:
+					localname = parser.getLocalName();
+					if(localname == "Speakers")
+					{
+						Collections.sort(spksvalues);
+						return spksvalues.toString();
+					}
+					break;
+			}
+		}
+	}
+
+	/**
+	 * Gets the last time.
+	 *
+	 * @param parser the parser
+	 * @return the last time
+	 */
+	protected float getLastTime(XMLStreamReader parser)
+	{
+		float timef = 0.0f
+
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next())
+		{
+			switch (event)
+			{
+				case XMLStreamConstants.START_ELEMENT:
+
+					localname = parser.getLocalName();
+					prefix = parser.getPrefix();
+
+					if(localname == "Turn")
+					{
+						String time = parser.getAttributeValue(null, "endTime")
+						if(time != null)
+							timef = Float.parseFloat(time)
+					}
+			}
+		}
+		return timef;
+	}
+
+	/**
+	 * Write first part and get last time.
+	 *
+	 * @param parser the parser
+	 * @param end the end
+	 */
+	protected void writeFirstPartAndGetLastTime(XMLStreamReader parser, float end)
+	{
+		println "First part"
+
+		DecimalFormat f = new DecimalFormat("#.000"); //$NON-NLS-1$
+		writer.writeStartDocument("UTF-8", "1.0");
+		writer.writeCharacters("\n")
+		writer.writeDTD("<!DOCTYPE Trans SYSTEM \"trans-14.dtd\">")
+		writer.writeCharacters("\n")
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next())
+		{
+			switch (event)
+			{
+				case XMLStreamConstants.START_ELEMENT:
+
+					localname = parser.getLocalName();
+					prefix = parser.getPrefix();
+
+					if(prefix != null && prefix.length() > 0)
+						writer.writeStartElement(prefix+":"+localname);
+					else
+						writer.writeStartElement(localname);
+
+					for(int i= 0 ; i < parser.getAttributeCount() ;i++ )
+					{
+						String name = parser.getAttributeLocalName(i)
+						String value = parser.getAttributeValue(i);
+
+						if(parser.getAttributePrefix(i)!= "")
+							writer.writeAttribute(parser.getAttributePrefix(i)+":"+name, value);
+						else
+							writer.writeAttribute(name, value);
+					}
+
+
+					break;
+
+				case XMLStreamConstants.END_ELEMENT:
+
+					localname = parser.getLocalName()
+				// dont close the transcription here
+					if(localname != "Trans" && localname != "Episode")
+						writer.writeEndElement();
+					break;
+
+				case XMLStreamConstants.CHARACTERS:
+					writer.writeCharacters(parser.getText());
+					break;
+			}
+		}
+	}
+
+	/**
+	 * Write second part and shift time.
+	 *
+	 * @param parser the parser
+	 * @param shift the shift
+	 */
+	protected void writeSecondPartAndShiftTime(XMLStreamReader parser, float shift)
+	{
+		println "Second part"
+		DecimalFormat f = new DecimalFormat("#.000"); //$NON-NLS-1$
+
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next())
+		{
+			switch (event)
+			{
+				case XMLStreamConstants.START_ELEMENT:
+					localname = parser.getLocalName();
+					prefix = parser.getPrefix();
+
+				// skip header
+					if(localname == "Trans" || localname == "Episode" || localname == "Topics" || localname == "Topic"
+					|| localname == "Speakers" || localname == "Speaker")
+						break;
+
+					if(prefix != null && prefix.length() > 0)
+						writer.writeStartElement(prefix+":"+localname);
+					else
+						writer.writeStartElement(localname);
+
+					for(int i= 0 ; i < parser.getAttributeCount() ;i++ )
+					{
+						String name = parser.getAttributeLocalName(i);
+						String value = parser.getAttributeValue(i);
+
+						if(name == "time" || name == "endTime" || name == "startTime")
+						{
+							float newf = Float.parseFloat(value)+shift;
+							value = f.format(newf)
+							value = value.replace(",",".")
+						}
+
+						if(parser.getAttributePrefix(i)!= "")
+							writer.writeAttribute(parser.getAttributePrefix(i)+":"+name, value);
+						else
+							writer.writeAttribute(name, value);
+					}
+
+
+					break;
+
+				case XMLStreamConstants.END_ELEMENT:
+					localname = parser.getLocalName()
+					if(localname == "Topics" || localname == "Topic"
+					|| localname == "Speakers" || localname == "Speaker" )
+						break;
+					writer.writeEndElement();
+					break;
+
+				case XMLStreamConstants.CHARACTERS:
+					if (parser.getText().trim().length() > 0)
+						writer.writeCharacters(parser.getText());
+					break;
+			}
+		}
+	}
+
+	/**
+	 * Process.
+	 */
+	protected void process()
+	{
+		writer.writeStartDocument("UTF-8", "1.0");
+
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next())
+		{
+			switch (event)
+			{
+				case XMLStreamConstants.START_ELEMENT:
+					localname = parser.getLocalName();
+					prefix = parser.getPrefix();
+
+					if(prefix != null && prefix.length() > 0)
+						writer.writeStartElement(prefix+":"+localname);
+					else
+						writer.writeStartElement(localname);
+
+
+					for(int i= 0 ; i < parser.getAttributeCount() ;i++ )
+					{
+						String prefix = parser.getAttributePrefix(i)
+						String attname = parser.getAttributeLocalName(i)
+						String attvalue = parser.getAttributeValue(i);
+
+						if(prefix != "")
+							writer.writeAttribute(prefix+":"+attname, attvalue);
+						else
+							writer.writeAttribute(attname, attvalue);
+					}
+
+
+					break;
+
+				case XMLStreamConstants.END_ELEMENT:
+					localname = parser.getLocalName()
+					writer.writeEndElement();
+					break;
+
+				case XMLStreamConstants.CHARACTERS:
+					writer.writeCharacters(parser.getText());
+					break;
+			}
+		}
+	}
+
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args)
+	{
+		File homedir = new File(System.getProperty("user.home"),"xml/concattrs/new");
+		//		File trs1 = new File(homedir, "int17A.trs")
+		//		File trs2 = new File(homedir, "int17B.trs")
+		//		File trs3 = new File(homedir, "int17C.trs")
+		//		File trs4 = new File(homedir, "int17D.trs")
+		//		File tmp1 = new File(homedir, "int17tmp1.trs")
+		//		File tmp2 = new File(homedir, "int17tmp2.trs")
+		//		File trs =  new File(homedir, "int17.trs")
+
+		//		File trs1 = new File(homedir, "int24.trs")
+		//		File trs2 = new File(homedir, "int24-2.trs")
+		//		File trs3 = new File(homedir, "int24-3.trs")
+		//		File trs4 = new File(homedir, "int24-4.trs")
+		//		File trs5 = new File(homedir, "int24-5.trs")
+		//		File trs6 = new File(homedir, "int24-6.trs")
+		//		File tmp1 = new File(homedir, "int24tmp1.trs")
+		//		File tmp2 = new File(homedir, "int24tmp2.trs")
+		//		File tmp3 = new File(homedir, "int24tmp3.trs")
+		//		File tmp4 = new File(homedir, "int24tmp4.trs")
+		//		File trs =  new File(homedir, "int24-corr.trs")
+
+		File trs1 = new File(homedir, "int14.trs")
+		File trs2 = new File(homedir, "int14bis.trs")
+		File trs =  new File(homedir, "int14-corr.trs")
+
+		new ConcatTrs(trs1, trs2, trs)
+
+		ValidateTRS.checkTRS(trs)
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/transcriber/importer.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/transcriber/importer.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/transcriber/importer.groovy	(revision 258)
@@ -0,0 +1,312 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+
+package org.txm.importer.transcriber
+
+import java.util.ArrayList;
+import org.txm.utils.Pair;
+
+import javax.xml.transform.*;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.txm.utils.logger.Log;
+import org.txm.scripts.teitxm.*;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import org.w3c.dom.*;
+import org.xml.sax.SAXException;
+import javax.xml.parsers.*;
+import javax.xml.xpath.*;
+
+import java.util.HashMap;
+import org.txm.importer.*;
+import org.txm.utils.*;
+import org.txm.metadatas.*;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class importer.
+ */
+class importer {
+
+	/** The trans. */
+	HashMap<String, String> trans = ["trans":"//Trans"];
+
+	/** The doc. */
+	def doc;
+
+	/** The infile. */
+	File infile;
+
+	/** The outfile. */
+	File outfile;
+
+	/** The outdir. */
+	File txmDir;
+	File binDir;
+
+	/** The trsfiles. */
+	ArrayList<String> trsfiles;
+
+	/** The metadatas. */
+	Metadatas metadatas;
+	
+	String lang; // language used by the tokenizer
+
+	/**
+	 * Instantiates a new importer.
+	 *
+	 * @param trsfiles the trsfiles
+	 * @param outdir the outdir
+	 * @param metadatas the metadatas
+	 */
+	public importer(ArrayList<File> trsfiles, File binDir, File txmDir, Metadatas metadatas, lang) {
+		this.trsfiles = trsfiles;
+		this.txmDir = txmDir; 
+		this.binDir = binDir;
+		this.metadatas = metadatas;
+		this.lang = lang;
+	}
+
+	/**
+	 * Run.
+	 *
+	 * @return true, if successful
+	 */
+	public boolean run() {
+		if (trsfiles == null) {
+			println "no files to process"
+			return false;
+		}
+		txmDir.mkdir();
+		if (!txmDir.exists()) {
+			println "can't create txmDir: "+txmDir.getAbsolutePath()
+		}
+		
+		// TRS -> TEI
+		println "Converting TRS to TEI "+trsfiles.size()+" files"
+		for (File infile : trsfiles) {
+			print "."
+			String textid = infile.getName()
+			int idx = textid.indexOf(".trs")
+			if (idx > 0) textid = textid.substring(0, idx)
+			File outfile = new File(txmDir, textid+".xml")
+			TRSToTEI p = new TRSToTEI(infile);
+			if (!p.process(outfile)) {
+				println "Error while converting TRS to TEI: "+infile
+				return false;
+			}
+		}
+		println ""
+
+		if (metadatas != null) {
+			if (metadatas.getHeadersList().size() == 0) {
+				println "Malformed metadata file. Check column and text separator. Columns: "+metadatas.getHeadersList()
+				return false;
+			}
+			println "Injecting metadatas "+metadatas.getHeadersList()+" in "+trsfiles.size()+" files"
+		}
+		trsfiles = txmDir.listFiles();
+		trsfiles.sort()
+		for (File infile : trsfiles) {
+			File outfile = new File(txmDir, "tmp.xml")
+			if (metadatas != null && metadatas.isInitialized()) {
+				print "."
+				if (!metadatas.injectMetadatasInXml(infile, outfile, "text")) {
+					println("Failed to inject metadatas in "+infile)
+					outfile.delete()
+				}
+				if (!infile.delete()) {
+					println "ERROR: could not delete $infile"
+					return false
+				}
+				outfile.renameTo(infile)
+			}
+		}
+		
+		println ""
+		
+		// TOKENIZER ENTITIES
+		println "Tokenizing entities "+txmDir.listFiles().length+" files"
+		for (File pfile : txmDir.listFiles()) {
+			print "."
+			TokenizeEntities tokenizer = new TokenizeEntities(pfile.toURI().toURL());
+			File outfile = File.createTempFile("tok", ".xml", pfile.getParentFile());
+			if (tokenizer.process(outfile)) {
+				if (!(pfile.delete() && outfile.renameTo(pfile))) println "Warning can't rename file "+outfile+" to "+pfile
+			} 
+			outfile.delete();
+		}
+		println ""
+		
+		//TOKENIZE
+		println "Tokenizing "+txmDir.listFiles().length+" files from $txmDir"
+		File tokenizedDir = new File(binDir, "tokenized")
+		tokenizedDir.mkdir()
+		for (File pfile : txmDir.listFiles()) {
+			print "."
+			String filename = pfile.getName().substring(0, pfile.getName().length()-4)
+			File tfile = new File(tokenizedDir, pfile.getName())
+			try {
+				TranscriberTokenizer tokenizer = new TranscriberTokenizer(pfile, tfile, lang)
+				if (!tokenizer.process()) {
+					println("Failed to tokenize "+pfile)
+				}
+			} catch (Exception e) {
+				println "Error tokenizer: "+pfile
+				org.txm.utils.logger.Log.printStackTrace(e);
+				return false;
+			}
+		}
+		println ""
+		
+		//TRANSFORM INTO XML-TEI-TXM
+		println("Building XML-TXM ("+txmDir.listFiles().length+" files)")
+		for (File tfile : tokenizedDir.listFiles()) {
+			print "."
+			String filename = tfile.getName().substring(0, tfile.getName().length()-4)
+			File xmlfile = new File(txmDir, tfile.getName())
+			
+			def correspType = new HashMap<String,String>()
+			correspType.put("event","event");
+			correspType.put("audio","audio");
+			correspType.put("notation","notation");
+			def correspRef = new HashMap<String,String>();
+			correspRef.put("event","trs");
+			correspRef.put("audio","trs");
+			correspRef.put("notation","trs");
+			def respId = ["trs"];
+			def applications = new HashMap<String,HashMap<String,String>>();
+			applications.put("trs",new ArrayList<String>());
+			applications.get("trs").add("Transcriber");//app ident
+			applications.get("trs").add("");//app version
+			applications.get("trs").add(null);//app report file path
+			def taxonomiesUtilisees = new HashMap<String,String[]>();
+			taxonomiesUtilisees.put("ctx1",["event", "audio", "notation"]);//,"lemma","lasla","grace"]);
+			def itemsURI = new HashMap<String,HashMap<String,String>>();
+			itemsURI.put("event",new HashMap<String,String>());
+			itemsURI.get("event").put("tagset","orth|corr");
+			itemsURI.get("event").put("website","");
+			itemsURI.put("audio",new HashMap<String,String>());
+			itemsURI.get("audio").put("tagset","present|absent|partiel");
+			itemsURI.get("audio").put("website","");
+			itemsURI.put("notation",new HashMap<String,String>());
+			itemsURI.get("notation").put("tagset","");
+			itemsURI.get("notation").put("website","");
+			def resps = new HashMap<String,String[]>();
+			resps.put("trs", ["Transcriber annotations","TXM","",""])
+			String wordprefix = "w_";
+			
+			Xml2Ana builder = new Xml2Ana(tfile);
+			builder.setConvertAllAtrtibutes true;
+			builder.setCorrespondances(correspRef, correspType);
+			builder.setHeaderInfos(respId,resps, applications, taxonomiesUtilisees, itemsURI)
+			if (!builder.process(xmlfile)) {
+				println("Failed to process "+tfile)
+				xmlfile.delete();
+			}
+		}
+		
+		println ""
+		return txmDir.listFiles() != null;
+	}
+
+	/**
+	 * Process.
+	 *
+	 * @param infile the infile
+	 * @param outfile the outfile
+	 * @param metas the metas
+	 * @return true, if successful
+	 */
+	public boolean process(File infile, File outfile, ArrayList<Pair<String, String>> metas) {
+		//inject metadatas into 	
+		this.infile = infile;
+		this.outfile = outfile;
+		def builder = DocumentBuilderFactory.newInstance().newDocumentBuilder()
+		doc = builder.parse(infile)
+		insert(trans.get("trans"), metas);
+		return save();
+	}
+
+	/**
+	 * Insert.
+	 *
+	 * @param xpath the xpath
+	 * @param pairs the pairs
+	 */
+	public void insert(String xpath, List<Pair<String, String>> pairs) {
+		println ("insert $pairs into $xpath")
+		def expr = XPathFactory.newInstance().newXPath().compile(xpath)
+		def nodes = expr.evaluate(doc, XPathConstants.NODESET)
+		
+		for (Node node : nodes) {
+			Element elem = (Element)node;
+			for (Pair<String, String> p : pairs) {
+				elem.setAttribute(p.getFirst(), p.getSecond());
+			}
+		}
+	}
+
+	/**
+	 * Save.
+	 *
+	 * @return true, if successful
+	 */
+	private boolean save() {
+		try {
+			// Création de la source DOM
+			Source source = new DOMSource(doc);
+			
+			// Création du fichier de sortie
+			Writer writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outfile), "UTF-8")); 
+			Result resultat = new StreamResult(writer);
+			
+			// Configuration du transformer
+			TransformerFactory fabrique = new net.sf.saxon.TransformerFactoryImpl();
+			Transformer transformer = fabrique.newTransformer();
+			transformer.setOutputProperty(OutputKeys.METHOD, "xml");
+			transformer.setOutputProperty(OutputKeys.INDENT, "yes"); 
+			transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); 
+			
+			// Transformation
+			transformer.transform(source, resultat);
+			writer.close();
+			return true;
+		} catch (Exception e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+			return false;
+		}
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/transcriber/TRSTestWorkflow.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/transcriber/TRSTestWorkflow.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/transcriber/TRSTestWorkflow.groovy	(revision 258)
@@ -0,0 +1,57 @@
+package org.txm.importer.transcriber
+
+import org.txm.utils.io.FileCopy;
+
+/**
+ * Test and Fix workflow for the STDDAD master corpus
+ * @author mdecorde
+ *
+ */
+
+File rootDir = new File("/home/mdecorde/xml/leman/")
+if (!rootDir.exists()) println "Error rootDir: "+rootDir;
+
+File dtdFile = new File(rootDir, "trans-14.dtd")
+File renamedTRSDir = new File(rootDir, "final 2012-03-26")
+File corrTRSDir = new File(rootDir, "corr")
+File okTRSDir = new File(rootDir, "ready")
+
+corrTRSDir.delete();
+corrTRSDir.mkdir();
+FileCopy.copy(dtdFile, new File(corrTRSDir, dtdFile.getName()));
+//okTRSDir.delete();
+okTRSDir.mkdir();
+FileCopy.copy(dtdFile, new File(okTRSDir, dtdFile.getName()));
+
+println "1- FixTimming"
+def files = renamedTRSDir.listFiles();
+files.sort()
+for (File trsFile : files) {
+	if (!trsFile.getName().endsWith(".trs")) continue;
+	println "FIX: "+trsFile
+	File newTRSFile = new File(corrTRSDir, trsFile.getName())
+	new FixTiming().fixTRS(trsFile, newTRSFile);
+}
+
+println "2- Validate"
+files = corrTRSDir.listFiles();
+files.sort()
+for(File trsFile : files) {
+	if(!trsFile.getName().endsWith(".trs")) continue;
+	File newTRSFile = new File(okTRSDir, trsFile.getName())
+	println "VALIDATE: "+trsFile
+	if(ValidateTRS.checkTRS(trsFile))
+		FileCopy.copy(trsFile, newTRSFile);
+}
+/*
+println "3- FINALLY"
+if (renamedTRSDir.listFiles().size() != corrTRSDir.listFiles().size) {
+	println "Missing corr transcriptions"
+	return;
+}
+
+if (corrTRSDir.listFiles().size() != okTRSDir.listFiles().size) {
+	println "Missing ok transcriptions"
+	return;
+}
+*/
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/importer/transcriber/transcriberLoader.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/transcriber/transcriberLoader.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/transcriber/transcriberLoader.groovy	(revision 258)
@@ -0,0 +1,309 @@
+// 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
+// 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.
+
+//
+// This file is part of the TXM platform.
+//
+// The TXM platform is free software: you can redistribute it and/or modif y
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 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/>.
+//
+//
+//
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$
+//
+package org.txm.importer.transcriber;
+
+import java.io.File;
+
+import org.txm.scripts.teitxm.*;
+import org.txm.*;
+import org.txm.objects.*;
+import org.txm.utils.i18n.*;
+import org.txm.utils.io.FileCopy;
+import org.txm.utils.*;
+import org.txm.importer.*;
+import org.txm.metadatas.*;
+import org.w3c.dom.Element
+
+//PARAMETERS
+boolean removeInterviewer = false;//if true the transcription of speakers (en1 and enq2) defined in metadatas file will be ignored
+boolean includeComments = false;
+boolean ignoreTranscriberMetadata = false;
+int csvHeaderNumber = 1;
+int maxlines = 200;
+
+String userDir = System.getProperty("user.home");
+
+def MONITOR;
+boolean debug = org.txm.utils.logger.Log.isPrintingErrors();
+BaseParameters params;
+try {params = paramsBinding;MONITOR=monitor} catch (Exception)
+{	println "DEV MODE";//exception means we debug
+	debug = true
+	params = new BaseParameters(new File(userDir, "xml/anapovoas/import.xml"))
+	params.load()
+	if (!org.txm.Toolbox.isInitialized()) {
+
+		Toolbox.setParam(Toolbox.INSTALL_DIR,new File("/usr/lib/TXM"));
+		Toolbox.setParam(Toolbox.TREETAGGER_INSTALL_PATH,new File(userDir,"treetagger"));
+		Toolbox.setParam(Toolbox.TREETAGGER_MODELS_PATH,new File(userDir,"treetagger/models"));
+		Toolbox.setParam(Toolbox.METADATA_ENCODING, "UTF-8");
+		Toolbox.setParam(Toolbox.METADATA_COLSEPARATOR, "\t");
+		Toolbox.setParam(Toolbox.METADATA_TXTSEPARATOR, "");
+		Toolbox.setParam(Toolbox.USER_TXM_HOME, new File(System.getProperty("user.home"), "TXM"));
+	}
+}
+if (params == null) { println "no parameters. Aborting"; return; }
+
+String corpusname = params.getCorpusName();
+Element corpusElem = params.corpora.get(corpusname);
+String basename = params.name;
+String rootDir = params.rootDir;
+String lang = corpusElem.getAttribute("lang");
+String model = lang
+String encoding = corpusElem.getAttribute("encoding");
+boolean annotate = "true" == corpusElem.getAttribute("annotate");
+String xsl = params.getXsltElement(corpusElem).getAttribute("xsl")
+def xslParams = params.getXsltParams(corpusElem);
+int wordsPerPage = params.getWordsPerPage("default")
+String page_element = params.getPageElement("default")
+boolean build_edition = params.getDoEdition("default")
+
+File srcDir = new File(rootDir);
+File binDir = new File(Toolbox.getParam(Toolbox.USER_TXM_HOME),"corpora/"+basename);
+binDir.deleteDir();
+binDir.mkdirs();
+if (!binDir.exists()) {
+	println "Could not create binDir "+binDir
+	return;
+}
+
+File txmDir = new File(binDir,"txm/$corpusname");
+txmDir.deleteDir();
+txmDir.mkdirs();
+
+//get metadata values from CSV
+Metadatas metadatas; // text metadata
+File allmetadatasfile = new File(srcDir, "metadata.csv");
+println "Trying to read metadatas values from: "+allmetadatasfile
+if (allmetadatasfile.exists()) {
+	File copy = new File(binDir, "metadata.csv")
+	if (!FileCopy.copy(allmetadatasfile, copy)) {
+		println "Error: could not create a copy of metadata file "+allmetadatasfile.getAbsoluteFile();
+		return;
+	}
+	metadatas = new Metadatas(copy, Toolbox.getParam(Toolbox.METADATA_ENCODING), Toolbox.getParam(Toolbox.METADATA_COLSEPARATOR), Toolbox.getParam(Toolbox.METADATA_TXTSEPARATOR), 1)
+}
+else
+	println "no metadata file: "+allmetadatasfile
+
+File propertyFile = new File(srcDir, "import.properties")//default
+Properties props = new Properties();
+String[] metadatasToKeep;
+if (propertyFile.exists() && propertyFile.canRead()) {
+	FileInputStream input = new FileInputStream(propertyFile);
+	props.load(input);
+	input.close();
+
+	if (props.getProperty("removeInterviewer") != null)
+		removeInterviewer = Boolean.parseBoolean(props.get("removeInterviewer").toString());
+	if (props.getProperty("ignoreTranscriberMetadata") != null)
+		ignoreTranscriberMetadata = Boolean.parseBoolean(props.get("ignoreTranscriberMetadata").toString());
+	if (props.getProperty("metadataList") != null)
+		metadatasToKeep = props.get("metadataList").toString().split("|");
+	if (props.getProperty("csvHeaderNumber") != null)
+		csvHeaderNumber = props.get("csvHeaderNumber").toString().split("|");
+	//if (props.getProperty("includeComments") != null)
+	//	includeComments = props.get("includeComments").toString();
+
+	println "import properties: "
+	println " removeInterviewer: "+removeInterviewer
+	println " ignoreTranscriberMetadata: "+ignoreTranscriberMetadata
+	println " metadataToKeep: "+metadatasToKeep
+	println " ignored csvHeaderSize: "+csvHeaderNumber
+	//println " includeComments: "+includeComments
+}
+
+// Apply XSL
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+if (MONITOR != null) MONITOR.worked(1, "XSL")
+if (xsl != null && xsl.trim().length() > 0) {
+	if (ApplyXsl2.processImportSources(new File(xsl), srcDir, new File(binDir, "src")))
+		srcDir = new File(binDir, "src");
+	println ""
+}
+
+try {
+	// select only trs files
+	String ext = "trs";
+	ArrayList<File> trsfiles = srcDir.listFiles(); //find all trs files
+	if (trsfiles  == null) {
+		println ("No files in "+srcDir.getAbsolutePath())
+		return false;
+	}
+	for (int i = 0 ; i < trsfiles.size() ; i++) {
+		File f = trsfiles.get(i);
+		if (!f.getName().endsWith(ext) || !f.canRead() || f.isHidden()) {
+			trsfiles.remove(i)
+			i--;
+		}
+	}
+
+	if (trsfiles.size() == 0) {
+		println ("No transcription file (*.trs) found in "+srcDir.getAbsolutePath()+". Aborting.")
+		return false;
+	}
+
+	if (MONITOR != null) MONITOR.worked(1, "IMPORTER")
+	if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+	println "-- IMPORTER"
+	def imp = new importer(trsfiles, binDir, txmDir, metadatas, lang) //put result in the txm folder of binDir
+	if (!imp.run()) {
+		println "Failed to prepare files - Aborting";
+		return;
+	}
+	if (MONITOR != null) MONITOR.worked(20)
+
+	println "-- Xml Validation"
+	if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+	for (File infile : txmDir.listFiles()) {
+		if (!ValidateXml.test(infile)) {
+			println "$infile : Validation failed";
+			infile.delete();
+		}
+	}
+
+	if (MONITOR != null) MONITOR.worked(5)
+	if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+	println "-- Remove interviewer: "+removeInterviewer
+	if (removeInterviewer) 	{
+		if (metadatas == null) {
+			println "Can't remove interviewer without a metadata.csv file defining who are the interviewers."
+		} else {
+			println "Removing some speakers in "+txmDir.listFiles().length+" file(s)"
+			for (File infile : txmDir.listFiles()) {
+				String filename = infile.getName();
+				int idx = filename.indexOf(".xml");
+				if (idx > 0)
+					filename = filename.substring(0, idx);
+
+				ArrayList<Pair<String, String>> metas = metadatas.get(filename)
+				//println "filename=$filename metas= $metas"
+				for (Pair p : metas) {
+					if (p.getFirst().startsWith("enq")) {
+						new RemoveSpeaker(infile, infile, p.getFirst())
+					}
+				}
+			}
+		}
+	}
+
+	if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+	if (MONITOR != null) MONITOR.worked(20, "ANNOTATE")
+	println "-- ANNOTATE - Running NLP tools"
+	boolean annotationSuccess = false;
+	if (annotate && new Annotate().run(binDir, txmDir, model+".par")) {
+		annotationSuccess = true;
+	}
+
+	if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+	if (MONITOR != null) MONITOR.worked(25, "COMPILING")
+	println "--COMPILING - Building Search Engine indexes"
+	trsfiles = txmDir.listFiles();
+
+	def comp = new compiler()
+	if(debug) comp.setDebug();
+	comp.removeInterviewers(removeInterviewer);
+	comp.setIgnoreTranscriberMetadata(ignoreTranscriberMetadata);
+	comp.setAnnotationSucces(annotationSuccess)
+	if (!comp.run(trsfiles, corpusname, "default", binDir)) {
+		println "Failed to compile files";
+		return;
+	}
+	
+	if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+	
+	File htmlDir = new File(binDir,"HTML/$corpusname");
+	htmlDir.deleteDir()
+	htmlDir.mkdirs();
+	if (build_edition) {
+		
+		if (MONITOR != null) MONITOR.worked(20, "EDITION")
+		println "-- EDITION - Building editions"
+		
+		List<File> filelist = txmDir.listFiles();
+		Collections.sort(filelist);
+		def second = 0
+
+		println "Paginating texts: "
+		for (File txmFile : filelist) {
+			print "."
+			String txtname = txmFile.getName();
+			int i = txtname.lastIndexOf(".");
+			if(i > 0) txtname = txtname.substring(0, i);
+
+			List<String> NoSpaceBefore = LangFormater.getNoSpaceBefore(lang);
+			List<String> NoSpaceAfter = LangFormater.getNoSpaceAfter(lang);
+
+			Element text = params.addText(corpusElem, txtname, txmFile);
+
+			def ed = new pager(txmFile, htmlDir, txtname, NoSpaceBefore, NoSpaceAfter, wordsPerPage, basename, page_element, metadatas);
+			Element edition = params.addEdition(text, "default", htmlDir.getAbsolutePath(), "html");
+
+			for (i = 0 ; i < ed.getPageFiles().size();) {
+				File f = ed.getPageFiles().get(i);
+				String wordid = ed.getIdx().get(i);
+				params.addPage(edition, ""+(++i), wordid);
+			}
+
+			if (ed.getPageFiles().size() > 0) {
+				Element editionBD = params.addEdition(text, "onepage", htmlDir.getAbsolutePath(), "html");
+				params.addPage(editionBD, "1", ed.getIndexes().get(0));
+			}
+		}
+
+		//copy transcriber.css
+		File cssfile = new File(Toolbox.getParam(Toolbox.USER_TXM_HOME), "css/transcriber.css")
+		if (cssfile.exists() && htmlDir.exists()) {
+			FileCopy.copy(cssfile, new File(htmlDir, "transcriber.css"));
+			FileCopy.copy(cssfile, new File(htmlDir, "onepage/transcriber.css"));
+			FileCopy.copy(cssfile, new File(htmlDir, "default/transcriber.css"));
+		}
+	}
+}
+catch (Exception e){org.txm.utils.logger.Log.printStackTrace(e);}
+
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+if (MONITOR != null) MONITOR.worked(20, "FINALIZING")
+File paramFile = new File(binDir, "import.xml");
+DomUtils.save(params.root.getOwnerDocument(), paramFile);readyToLoad = true;
Index: tmp/org.txm.core/src/groovy/org/txm/importer/transcriber/RemoveSpeaker.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/transcriber/RemoveSpeaker.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/transcriber/RemoveSpeaker.groovy	(revision 258)
@@ -0,0 +1,130 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+package org.txm.importer.transcriber;
+
+
+import org.txm.importer.*;
+import org.txm.importer.graal.PersonalNamespaceContext
+import org.txm.utils.*;
+import org.txm.metadatas.*;
+
+import java.io.File;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import javax.xml.parsers.*;
+import javax.xml.xpath.*;
+import javax.xml.transform.*;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+
+
+// TODO: Auto-generated Javadoc
+/**
+ * Removes "u" tags of TRS file given an "u@name" value. 
+ * @author mdecorde
+ *
+ */
+public class RemoveSpeaker {
+	File outfile;
+	
+	/** The doc. */
+	Document doc;
+	
+	/**
+	 * Instantiates a new removes the speaker.
+	 *
+	 * @param transcriptionfile the transcriptionfile
+	 * @param outfile the outfile
+	 * @param id the id
+	 */
+	public RemoveSpeaker(File transcriptionfile, File outfile, String id)
+	{
+		System.setProperty("javax.xml.transform.TransformerFactory", "net.sf.saxon.TransformerFactoryImpl");
+				
+		this.outfile = outfile;
+		String xpathString = "//tei:u[@spk='"+id+"']";
+		//println "removing $xpathString in $transcriptionfile"
+		DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
+		//println "domFactory: $domFactory"
+		domFactory.setNamespaceAware(true); // never forget this!
+		DocumentBuilder builder = domFactory.newDocumentBuilder();
+		//println "builder $builder"
+		doc = builder.parse(transcriptionfile);
+		//println "doc $doc"
+		
+		def xpath = XPathFactory.newInstance().newXPath()
+		xpath.setNamespaceContext(new PersonalNamespaceContext());
+		def expr = xpath.compile(xpathString);
+		def nodes = expr.evaluate(doc, XPathConstants.NODESET);
+		
+		for (def node : nodes) {
+			//println "remove node "+node
+			Element elem = (Element)node;
+			elem.getParentNode().removeChild(node);
+		}
+		save()
+	}
+	
+	/**
+	 * Save.
+	 *
+	 * @return true, if successful
+	 */
+	private boolean save()
+	{
+		try {
+			// Création de la source DOM
+			Source source = new DOMSource(doc);
+			
+			// Création du fichier de sortie
+			Writer writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outfile), "UTF-8")); 
+			Result resultat = new StreamResult(writer);
+			
+			// Configuration du transformer
+			//TransformerFactory fabrique = new net.sf.saxon.TransformerFactoryImpl();
+			TransformerFactory fabrique = new net.sf.saxon.TransformerFactoryImpl();
+			//println "fabrique $fabrique"
+			Transformer transformer = fabrique.newTransformer();
+			//println "transformer $transformer"
+			transformer.setOutputProperty(OutputKeys.METHOD, "xml");
+			transformer.setOutputProperty(OutputKeys.INDENT, "yes"); 
+			transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); 
+			
+			// Transformation
+			transformer.transform(source, resultat);
+			writer.close();
+			return true;
+		} catch (Exception e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+			return false;
+		}
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/transcriber/TranscriberTokenizer.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/transcriber/TranscriberTokenizer.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/transcriber/TranscriberTokenizer.groovy	(revision 258)
@@ -0,0 +1,192 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+package org.txm.importer.transcriber
+
+import filters.Tokeniser.SimpleTokenizerXml;
+
+/**
+ * The Class TranscriberTokenizer : manages Transcriber notations
+ */
+class TranscriberTokenizer extends SimpleTokenizerXml{
+	
+	/** The troncature. */
+	boolean troncature = false;
+	
+	/** The audio. */
+	String audio ="F";
+	
+	/** The notation. */
+	String notation = "";
+	
+	/** paroles rapportees */
+	boolean rapp = false;
+	
+	/** The event. */
+	String event="";
+	String txtname;
+	
+	/**
+	 * Instantiates a new transcriber tokenizer.
+	 *
+	 * @param infile the infile
+	 * @param outfile the outfile
+	 */
+	public TranscriberTokenizer(File infile, File outfile)
+	{
+		super(infile, outfile, null)
+		txtname = infile.getName();
+		int idx = txtname.indexOf(".")
+		if (idx > 0) txtname = txtname.substring(0, idx);
+	}
+	
+	/**
+	 * Instantiates a new transcriber tokenizer.
+	 *
+	 * @param infile the infile
+	 * @param outfile the outfile
+	 */
+	public TranscriberTokenizer(File infile, File outfile, String lang)
+	{
+		super(infile, outfile, lang)
+		txtname = infile.getName();
+		int idx = txtname.indexOf(".")
+		if (idx > 0) txtname = txtname.substring(0, idx);
+	}
+	
+	/* (non-Javadoc)
+	 * @see filters.Tokeniser.SimpleTokenizerXml#processWord()
+	 */
+	protected void processWord()
+	{
+		//println " chars: "+parser.getText().trim();
+		String text = buffer.toString().trim().replace("\t", " ");
+		text = text.replaceAll("\\p{C}", "");
+		String previousChar = "";
+		for (String s : text.split("[\\p{Z}\\p{C}]+") )	
+		{
+			//init transcriber attributes
+			if (troncature)
+				audio = "absent";
+			else
+				audio = "present"
+			notation = s;
+			event = "";
+			
+			if (s.startsWith("\"")) {
+				rapp = true;
+				event += "#rapp1";
+			} else if(s.endsWith("\"")) {
+				rapp = false;
+				event += "#rapp2";
+			}
+
+			//test events
+			if (s.startsWith("^^")) {
+				event += "#orth";			
+				s = s.substring(2);
+			}
+			if (s.startsWith("*")) {
+				event += "#corr";
+				s = s.substring(1);
+			}
+			
+			if (event.length() > 0)
+				event = event.substring(1);//remove '|'
+			
+			// test audio
+			if (s.contains("(") || s.contains(")")) // contains ( or )
+			{
+				if (s.contains("(") ^ s.contains(")")) // ert(ert XOR ert)ert
+				{
+					audio = "partiel"
+					
+					if (s.contains("(")) // ert(ert
+					{
+						troncature = true;
+						if (s.startsWith("(")) // (ertert
+						{
+							audio = "absent";
+						}
+					} else // ert)ert
+					{
+						troncature = false;
+						if (s.endsWith(")")) // ertert)
+						{
+							audio = "absent";
+						}
+					}
+				}
+				else if (s.contains("(") && s.contains(")")) // ert(ert)ert OR ert)ert(ert
+				{
+					audio = "partiel";
+					if (s.startsWith("(") && s.endsWith(")")) // (ertert)
+					{
+						audio = "absent";
+						troncature = false;
+					} else if (s.indexOf("(") < s.indexOf(")")) // ert(ert)ert
+					{
+						troncature = false;
+					} else // ert)ert(ert
+					{
+						troncature = true;
+					}
+				}
+				s = s.replace("(","");
+				s = s.replace(")","");
+			}
+						
+			iterate(s);
+		}
+	}
+	
+	/**
+	 * Iterate.
+	 *
+	 * @param s the s
+	 * @return the java.lang. object
+	 */
+	protected iterate(String s)
+	{
+		while (s != null && s.length() > 0) {
+			if (DEBUG) {println "  > $s"}
+			s = standardChecks(s);
+			event = "";
+		}
+	}
+	
+	/* (non-Javadoc)
+	 * @see filters.Tokeniser.SimpleTokenizerXml#writeWordAttributes()
+	 */
+	protected writeWordAttributes()
+	{
+		writer.writeAttribute("id","w_"+txtname+"_"+wordcount);
+		writer.writeAttribute("audio", audio);
+		writer.writeAttribute("event", event);
+		writer.writeAttribute("notation", notation);
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/transcriber/compiler.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/transcriber/compiler.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/transcriber/compiler.groovy	(revision 258)
@@ -0,0 +1,678 @@
+// 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
+// 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.
+//
+//
+//
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$
+//
+package org.txm.importer.transcriber
+
+import java.io.File;
+
+import javax.xml.stream.*;
+
+import java.io.OutputStreamWriter;
+import java.util.LinkedHashMap;
+
+import org.txm.importer.cwb.CwbEncode
+import org.txm.importer.cwb.CwbMakeAll
+import org.txm.importer.cwb.CwbProcess;
+import org.txm.importer.cwb.PatchCwbRegistry;
+import org.txm.utils.Pair;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class compiler.
+ */
+class compiler {
+
+	boolean ADD_TEXTID_TO_REF = true
+	
+	/** The input data. */
+	private def inputData;
+
+	/** The factory. */
+	private def factory;
+
+	/** The parser. */
+	private XMLStreamReader parser;
+
+	/** The output. */
+	OutputStreamWriter output;
+
+	/** The basename. */
+	String corpusname;
+
+	/** The projectname. */
+	String projectname
+
+	/** The outdir. */
+	String outdir;
+
+	/** The debug. */
+	boolean debug = false;
+
+	/** The annotation succes. */
+	boolean annotationSucces = false;
+
+	/** The removeinterviewers. */
+	boolean removeinterviewers = false;
+
+	/** The trans. */
+	HashMap<String, ArrayList<Pair<String, String>>> trans;
+
+	/** The speakers. */
+	HashMap<String, ArrayList<Pair<String, String>>> speakers;
+
+	/** The speakersname. */
+	HashMap<String, String> speakersname = new HashMap<String, String>();
+
+	/** The topics. */
+	HashMap<String, ArrayList<Pair<String, String>>> topics;
+
+
+	/** The interviewers. */
+	ArrayList<String> interviewers = [];
+	static HashSet<String> sectionAttrs;
+
+	/** The anatypes. */
+	private static anatypes = []
+	private static anavalues = [:]
+
+	/**
+	 * Removes the interviewers.
+	 *
+	 * @param value the value
+	 * @return the java.lang. object
+	 */
+	public removeInterviewers(boolean value) {
+		this.removeinterviewers = value;
+	}
+
+	/**
+	 * Run.
+	 *
+	 * @param xmlfiles the xmlfiles
+	 * @param basename the basename
+	 * @param projectname the projectname
+	 * @param outdir the outdir
+	 * @return true, if successful
+	 */
+	public boolean run(List<File> xmlfiles, String corpusname, String projectname, File binDir)
+	{
+		Collections.sort(xmlfiles);
+		//println "run compiler with $xmlfiles, $basename and $outdir"
+		this.outdir = binDir;
+		this.corpusname = corpusname;
+		this.projectname = projectname;
+
+		anatypes = ["event"] // reset
+		anavalues = [:] // reset
+
+		sectionAttrs = new HashSet<String>() // reset section attributs set
+
+		File wtcDir = new File(binDir, "wtc")
+		new File(binDir, "wtc").delete();
+		wtcDir.mkdir();
+		if (!new File(binDir, "wtc").exists()) {
+			println "Can't create wtc directory"
+			return false;
+		}
+
+		File wtcFile = new File(wtcDir, corpusname.toLowerCase()+".wtc")
+
+		// get all anatypes
+		for (File f : xmlfiles) {
+			getAnaTypes(f)
+		}
+		//println "ANATYPES: "+anatypes
+		if (!createOutput(wtcFile)) return false;
+		output.write("<txmcorpus lang=\"fr\">\n")
+		output.close();
+
+		println("Compiling "+xmlfiles.size()+" files")
+		for (File f :xmlfiles) {
+			if (f.exists())
+				if (!process(f)) {
+					println("Failed to compile "+f)
+				}
+		}
+
+		if (!createOutput(wtcFile)) return false;
+		output.write("</txmcorpus>\n")
+		output.close();
+
+		//2- Import into CWB
+		File registryFile = new File(binDir, "registry/"+corpusname.toLowerCase())
+		File dataDir = new File(binDir, "data/$corpusname")
+
+		new File(binDir, "registry").mkdir();
+		if (!new File(binDir, "registry").exists()) {
+			println "Can't create registry directory"
+			return false;
+		}
+
+		String cwbLoc = CwbProcess.getCWBLocation();
+		if (cwbLoc == null) return false;
+
+		CwbEncode cwbEn = new CwbEncode();
+		CwbMakeAll cwbMa = new CwbMakeAll();
+		cwbEn.setDebug(debug);
+		cwbMa.setDebug(debug);
+
+		String uAttr = "u:0+spkid+spk+scope+accent+s+time+check+dialect+type";
+		String textAttr ="text:0+base+project"
+		if (trans != null) {
+			for (String key : trans.keySet()) {
+				for (Pair p : trans.get(key)) {
+					if (ignoreTranscriberMetadata) {
+						String meta =p.getFirst();
+						if (	meta != "scribe" && meta != "audio_filename" &&
+						meta != "version" && meta != "version_date")
+							textAttr+="+"+meta
+					} else {
+						textAttr+="+"+p.getFirst()
+					}
+				}
+				break;
+			}
+		}
+
+		String sectionAttr = "div:0" // "div:0+id+topic+endtime+starttime+type"
+		for (String attr : sectionAttrs) {
+			sectionAttr += "+"+attr
+		}
+
+		List<String> pargs = ["spk", "ref", "id", "entitytype", "entityid"]
+		for (String ana : anatypes) pargs.add(ana)
+
+		String[] pAttributes = pargs
+
+		String[] sAttributes = ["txmcorpus:0+lang", uAttr , textAttr, "event:0+id+desc+type+extent", sectionAttr, "sp:0+id+speaker+endtime+starttime+overlap+time"];
+
+		println "pAttributes: $pAttributes"
+		println "sAttributes: $sAttributes"
+		//return;
+		try {
+			cwbEn.run(cwbLoc + "cwb-encode", dataDir.getAbsolutePath(),
+					wtcFile.getAbsolutePath(),
+					registryFile.getAbsolutePath(), pAttributes, sAttributes);
+			if (!registryFile.exists()) {
+				println "Error: The registry file was not created: $regPath. See https://groupes.renater.fr/wiki/txm-users/public/faq"
+				return false;
+			}
+			cwbMa.run(cwbLoc + "cwb-makeall", corpusname, registryFile.getParent());
+			
+
+		} catch (Exception ex) {System.out.println(ex); return false;}
+
+
+		return true;
+	}
+
+	/**
+	 * Creates the output.
+	 *
+	 * @param dirPathName the dir path name
+	 * @param fileName the file name
+	 * @return true, if successful
+	 */
+	private boolean createOutput(File f){
+		try {
+			//File f = new File(dirPathName, fileName)
+			output = new OutputStreamWriter(new BufferedOutputStream(new FileOutputStream(f,f.exists())) , "UTF-8");
+			return true;
+		} catch (Exception e) {
+			System.out.println(e.getLocalizedMessage());
+			return false;
+		}
+	}
+
+	/** The text_id. */
+	String text_id
+
+	/** The u opened. */
+	boolean uOpened = false;
+
+	/** The idturn. */
+	int idturn = 1;
+
+	/** The idsection. */
+	int idsection = 1;
+
+	/** The idu. */
+	int idu = 1;
+
+	/** The idevent. */
+	int idevent = 1;
+
+	/** The events. */
+	List<String> events = [];
+	static int vEntityId = 0;
+	static int vEntityIdCount = 1;
+
+	/**
+	 * Process.
+	 *
+	 * @param xmlfile the xmlfile
+	 * @return true, if successful
+	 */
+	private boolean process(File xmlfile) {
+		text_id = xmlfile.getName();
+		text_id = text_id.substring(0, text_id.length() -4);
+
+		idturn = 1;
+		idsection = 1;
+		idu = 1;
+
+		boolean flagAna;
+		boolean flagForm;
+		boolean flagWord;
+		String vWord="";
+		String vForm="";
+		String vAna="";
+		String vEvents = "N/A";
+		String vEntityType = "N/A"
+		String wordid= "";
+		//def wordattributes = [:];
+		String anatype = "";
+		String anavalue = "";
+
+		String formatedTime;
+
+		LinkedHashMap<String, String> anahash = new LinkedHashMap<String, String>();
+		String currentType;
+
+		URL url = xmlfile.toURI().toURL();
+		inputData = url.openStream();
+		factory = XMLInputFactory.newInstance();
+		parser = factory.createXMLStreamReader(inputData);
+		String filename = xmlfile.getName()
+		String textid = filename.substring(0, filename.length() - 4);
+
+		createOutput(new File(outdir, "wtc/"+corpusname.toLowerCase()+".wtc"));
+		String localname;
+
+		//get all metadatas declared before Episode tag
+		speakers = new HashMap<String, ArrayList<Pair<String, String>>>();
+		trans = new HashMap<String, ArrayList<Pair<String, String>>>();
+		topics = new HashMap<String, ArrayList<Pair<String, String>>>();
+		//println "parse infos"
+		parseInfos();
+
+		//		println "Trans: $trans"
+		//		println "Topics: $topics"
+		//		println "Speakers: $speakers"
+		//		def transproperties = ""
+		//		for (String key : trans.keySet()) {
+		//			for (Pair p : trans.get(key))
+		//				transproperties+="\t"+p.getSecond();
+		//			break;
+		//		}
+		//		println "Trans properties: "+transproperties
+		List<String> localspeakers;
+
+
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+			//print "event: "+event +" "
+			switch (event) {
+				case XMLStreamConstants.START_ELEMENT:
+					localname = parser.getLocalName();
+				//println localname
+					switch(localname) {
+						case "div":
+							output.write("<div");
+							for (int i = 0 ; i < parser.getAttributeCount() ; i ++) {
+								String name = parser.getAttributeLocalName(i).replace("_","").toLowerCase()
+								output.write(" "+name+"=\""+parser.getAttributeValue(i)+"\"");
+								sectionAttrs << name
+							}
+							output.write ">\n"
+							break;
+						case "sp":
+							output.write("<sp");
+							writeAttributes();
+							output.write ">\n"
+							break;
+						case "u":
+							output.write("<u");
+							for (int i = 0 ; i < parser.getAttributeCount() ; i ++) {
+								String name = parser.getAttributeLocalName(i).replace("_","").toLowerCase()
+								output.write(" "+name+"=\""+parser.getAttributeValue(i)+"\"");
+								if (name == "time") formatedTime = parser.getAttributeValue(i)
+								else if (name == "spk") u_name = parser.getAttributeValue(i)
+							}
+							output.write ">\n"
+							break;
+						case "event":
+							output.write("<event");
+							writeAttributes();
+							output.write ">\n"
+
+							if (parser.getAttributeValue(null, "type") == "entities") {
+								if (parser.getAttributeValue(null, "extent") == "begin") {
+									vEntityType = parser.getAttributeValue(null, "desc");
+									vEntityId = vEntityIdCount++;
+								} else {
+									vEntityType = "N/A";
+									vEntityId = 0;
+								}
+							} else if (parser.getAttributeValue(null, "type") == "pronounce") {
+								if (parser.getAttributeValue(null, "extent") == "begin")
+									events.add(parser.getAttributeValue(null, "desc"))
+								else if (parser.getAttributeValue(null, "extent") == "end")
+									events.remove(parser.getAttributeValue(null, "desc"))
+								vEvents = "";
+								for (String s : events)
+									vEvents += s+"#";
+								if (vEvents.length() > 0)
+									vEvents = vEvents.substring(0, vEvents.length()-1);
+								else
+									vEvents = ""
+							}
+							break;
+						case "w":
+							for (int i = 0 ; i < parser.getAttributeCount(); i++) {
+								if (parser.getAttributeLocalName(i).equals("id")) {
+									wordid = parser.getAttributeValue(i);
+									break;
+								}
+							}
+							anavalues = [:];
+							break;
+						case "form":
+							flagForm = true;
+							vForm = "";
+							vAna ="";
+							break;
+						case "ana":
+							flagAna = true;
+							anavalue = "";
+							for (int i = 0 ; i < parser.getAttributeCount(); i++)
+								if (parser.getAttributeLocalName(i).equals("type")) {
+									anatype = parser.getAttributeValue(i).substring(1);//remove the #
+									break;
+								}
+							break;
+					}
+					break;
+				case XMLStreamConstants.END_ELEMENT:
+					localname = parser.getLocalName();
+
+					switch (localname) {
+						case "text":
+							output.write("</text>\n")
+							break;
+						case "Topics":
+							break;
+						case "Topic":
+							break;
+						case "Speakers":
+							break;
+						case "Speaker":
+							break;
+						case "Episode":
+							break;
+						case "div":
+							output.write("</div>\n")
+							break;
+						case "sp":
+							output.write("</sp>\n")
+							break;
+						case "u":
+							output.write("</u>\n")
+							break;
+						case "event":
+							output.write("</event>\n")
+							break;
+						case "form":
+							flagForm = false;
+							break;
+						case "ana":
+							anavalues.put(anatype, anavalue)
+							flagAna = false;
+							break;
+						case "w":
+						// concat spk id and ref
+							String isEnq = (interviewers.contains(u_name))?"*":"";
+							String ref = (u_name+", "+formatedTime+""+isEnq)
+							if (ADD_TEXTID_TO_REF) ref = textid+", "+ref
+							vForm +="\t"+u_name+"\t"+ref
+
+						// concat entity and entity ID
+							vAna+= "\t"+vEntityType+"\t"+vEntityId;
+
+						//concat ana values
+							for (String type : anatypes) {
+								def v = anavalues.get(type);
+								if (v == null) v = "";
+
+								if ("event" == type) {
+									if (v.length() > 0)
+										vAna+="\t#"+v;
+									else
+										vAna+="\t";
+
+									//concat <Event> values
+									if (vEvents != null && vEvents.length() > 0 && vEvents != "N/A")
+										vAna += "#"+vEvents;
+								} else {
+									vAna+="\t"+v;
+								}
+							}
+
+
+							vForm = vForm.replaceAll("\n", "").replaceAll("&", "&amp;").replaceAll("<", "&lt;");
+
+							if (removeinterviewers) {
+								if (!interviewers.contains(u_name))
+									output.write(vForm+"\t"+wordid+vAna+"\n");
+							} else {
+								output.write(vForm+"\t"+wordid+vAna+"\n");
+							}
+
+							vAna = "";
+							vForm = "";
+							break;
+					}
+					break
+				case XMLStreamConstants.CHARACTERS:
+					if (flagForm)
+						vForm += parser.getText().trim();
+					if (flagAna) {
+						anavalue += parser.getText().trim();
+					}
+					break;
+			}
+		}
+
+		parser.close();
+		inputData.close();
+		output.close();
+		return true;
+	}
+
+	/** The u_name. */
+	String u_name;
+
+	/**
+	 * Write start tag.
+	 */
+	private void writeStartTag() {
+		output.write("<"+parser.getLocalName());
+		writeAttributes();
+		output.write ">\n"
+	}
+
+	/**
+	 * Write attributes.
+	 */
+	private void writeAttributes() {
+		for (int i = 0 ; i < parser.getAttributeCount() ; i ++) {
+			output.write(" "+parser.getAttributeLocalName(i).replace("_","").toLowerCase()+"=\""+parser.getAttributeValue(i)+"\"");
+		}
+	}
+
+	private void getAnaTypes(File xmlFile) {
+		inputData = xmlFile.toURI().toURL().openStream();
+		factory = XMLInputFactory.newInstance();
+		parser = factory.createXMLStreamReader(inputData);
+		String ana = "ana"
+		HashSet<String> types = new HashSet<String>();
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+			if (event == XMLStreamConstants.START_ELEMENT) { // start elem
+				if (ana.equals(parser.getLocalName())) { // ana elem
+					for (int i = 0 ; i < parser.getAttributeCount(); i++) { // find @type
+						if ("type".equals(parser.getAttributeLocalName(i))) { // @type
+							types.add(parser.getAttributeValue(i).substring(1)); //remove the #
+							break;
+						}
+					}
+				}
+			}
+		}
+		parser.close()
+
+		for (String type : types)
+			if (!anatypes.contains(type))
+				anatypes << type
+	}
+
+	/**
+	 * Write start tag.
+	 *
+	 * @param id the id
+	 */
+	private void writeStartTag(int id) {
+		output.write("<"+parser.getLocalName().toLowerCase());
+		output.write(" id=\""+id+"\"");
+		writeAttributes();
+		output.write ">\n"
+	}
+
+	/**
+	 * Write end tag.
+	 */
+	private void writeEndTag() {
+		output.write("</"+parser.getLocalName().toLowerCase()+">\n");
+	}
+
+	/** The ignore transcriber metadata. */
+	boolean ignoreTranscriberMetadata = false;
+
+	/**
+	 * Sets the ignore transcriber metadata.
+	 *
+	 * @param state the new ignore transcriber metadata
+	 */
+	public void setIgnoreTranscriberMetadata(boolean state) {
+		this.ignoreTranscriberMetadata = state;
+	}
+
+	/**
+	 * Parses the infos.
+	 */
+	private void parseInfos() { //until tag Episode
+		String localname;
+		//assert(parser != null);
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+			if (event == XMLStreamConstants.START_ELEMENT) {
+				localname = parser.getLocalName();
+				switch (localname) {
+					case "text":
+						output.write("<text project=\""+projectname+"\" base=\""+corpusname+"\"")
+						for (int i = 0 ; i < parser.getAttributeCount() ; i ++) {
+							if (ignoreTranscriberMetadata) {
+								if (parser.getAttributeLocalName(i) != "scribe" &&
+								parser.getAttributeLocalName(i) != "audio_filename" &&
+								parser.getAttributeLocalName(i) != "version" &&
+								parser.getAttributeLocalName(i) != "version_date")
+									output.write(" "+parser.getAttributeLocalName(i).replace("_","").toLowerCase()+"=\""+parser.getAttributeValue(i)+"\"");
+							} else {
+								output.write(" "+parser.getAttributeLocalName(i).replace("_","").toLowerCase()+"=\""+parser.getAttributeValue(i)+"\"");
+							}
+						}
+
+						output.write ">\n"
+
+						ArrayList list = new ArrayList<Pair<String, String>>()
+						trans.put("trans", list);
+
+						for (int i = 0 ; i < parser.getAttributeCount() ; i ++) {
+							list.add(new Pair(parser.getAttributeLocalName(i).replace("_","").toLowerCase(), parser.getAttributeValue(i)));
+							if(parser.getAttributeLocalName(i).startsWith("enq"))
+								interviewers.add(parser.getAttributeValue(i));
+						}
+						return
+					case "Topic":
+						String id = parser.getAttributeValue(null, "id");
+						if (id != null) {
+							ArrayList list = new ArrayList<Pair<String, String>>()
+							topics.put(id, list);
+						} else {
+							println "found tag $localname with no id"
+						}
+						break;
+					case "Speaker":
+					//case "Trans":
+						String id = parser.getAttributeValue(null, "id");
+						String name = parser.getAttributeValue(null, "name");
+						if (id != null && name != null) {
+							speakersname.put(id, name);
+						} else {
+							println "found tag $localname with no id ($id)or name ($name)"
+							return;
+						}
+						if (id != null) {
+							ArrayList list = new ArrayList<Pair<String, String>>()
+							speakers.put(id, list);
+
+							for (int i = 0 ; i < parser.getAttributeCount() ; i ++) {
+								list.add(new Pair(parser.getAttributeLocalName(i), parser.getAttributeValue(i)));
+							}
+						} else {
+							println "found tag $localname with no id"
+							return;
+						}
+						break;
+				}
+			}
+		}
+	}
+
+	/**
+	 * Sets the debug.
+	 */
+	public void setDebug() {
+		debug = true;
+	}
+
+	/**
+	 * Sets the annotation success.
+	 *
+	 * @param val the new annotation success
+	 */
+	public void setAnnotationSuccess(boolean val) {
+		annotationSucces = val
+	}
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/importer/transcriber/package.html
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/transcriber/package.html	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/transcriber/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Transcriber import module.</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/org/txm/importer/transcriber/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/importer/transcriber/TRSToTEI.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/transcriber/TRSToTEI.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/transcriber/TRSToTEI.groovy	(revision 258)
@@ -0,0 +1,341 @@
+package org.txm.importer.transcriber
+
+import java.io.File;
+
+import javax.xml.stream.*;
+
+import java.io.OutputStreamWriter;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+
+import org.txm.importer.StaxIdentityParser;
+import org.txm.importer.cwb.CwbEncode
+import org.txm.importer.cwb.CwbMakeAll
+import org.txm.importer.cwb.CwbProcess;
+import org.txm.importer.cwb.PatchCwbRegistry;
+import org.txm.utils.Pair;
+
+class TRSToTEI extends StaxIdentityParser {
+	
+	// Transcription informations
+	def informations = [:]
+	def speakers = [:];
+	HashMap<String, String> speakersname = new HashMap<String, String>();
+	def topics = [:];
+
+	List<String> localspeakers; // speakers of the current Turn
+
+	// IDs
+	int idturn = 1;
+	int idsection = 1;
+	int idu = 1;
+	int idevent = 1;
+
+	boolean uOpened = false;
+
+	// values stored
+	List<String> events = [];
+	static int vEntityId = 0;
+	static int vEntityIdCount = 1;
+	String vSpeaker="";
+	String u_name;
+	boolean flagAna;
+	boolean flagForm;
+	boolean flagWord;
+	String vWord="";
+	String vForm="";
+	String vAna="";
+	String vEvents = "N/A";
+	String vEntityType = "N/A"
+	String wordid= "";
+	String anatype = "";
+	String anavalue = "";
+
+	String formatedTime;
+	String currentType;
+	String lastTime = ""
+	String textid;
+	public TRSToTEI(File infile) {
+		super(infile.toURI().toURL());
+		textid = infile.getName()
+		int idx = textid.indexOf(".trs")
+		if (idx > 0) textid = textid.substring(0, idx)
+	}
+
+	boolean beforeBody = true;
+	protected void processStartElement() {
+		if (beforeBody) {
+			parseInfos()
+		} else {
+			processEpisodeStartElement()
+		}
+	}
+
+	protected void processEndElement() {
+		if (beforeBody) {
+			parseInfosEndElements()
+		} else {
+			processEpisodeEndElement()
+		}
+	}
+
+	/**
+	 * Parses the infos.
+	 */
+	private void parseInfos() { //until tag Episode
+		//println "parse infos: $localname"
+		switch (localname) {
+			case "Trans":
+				for (int i = 0 ; i < parser.getAttributeCount() ; i ++) {
+					informations.put(parser.getAttributeLocalName(i), parser.getAttributeValue(i));
+				}
+				writer.writeStartElement("TEI");
+				writer.writeStartElement("teiHeader");
+				writer.writeStartElement("fileDesc");
+				writer.writeEndElement();
+				writer.writeStartElement("encodingDesc");
+				writer.writeEndElement();
+				writer.writeStartElement("profileDesc");
+				writer.writeEndElement();
+				writer.writeStartElement("application");
+				break;
+			case "Topics":
+				super.processStartElement();
+				break;
+			case "Topic":
+				super.processStartElement();
+				for (int i = 0 ; i < parser.getAttributeCount() ; i ++) {
+					topics.put(parser.getAttributeLocalName(i), parser.getAttributeValue(i));
+				}
+				break;
+			case "Speakers":
+				super.processStartElement();
+				break;
+			case "Speaker":
+				super.processStartElement();
+				String id = parser.getAttributeValue(null, "id");
+				String name = parser.getAttributeValue(null, "name");
+				if (id != null && name != null) {
+					speakersname.put(id, name);
+				} else {
+					println "found tag $localname with no id ($id) nor name ($name)"
+					return;
+				}
+
+				if (id != null) {
+					ArrayList list = new ArrayList<Pair<String, String>>()
+					speakers.put(id, list);
+
+					for (int i = 0 ; i < parser.getAttributeCount() ; i ++) {
+						list.add(new Pair(parser.getAttributeLocalName(i), parser.getAttributeValue(i)));
+					}
+				} else {
+					println "found tag $localname with no id"
+					return;
+				}
+				break;
+			case "Episode":
+				writer.writeEndElement() // application
+				writer.writeEndElement() // teiHeader
+				writer.writeStartElement("text")
+				writer.writeAttribute("id", textid)
+				for(def k : informations.keySet()) writer.writeAttribute(k, informations[k])
+				beforeBody = false; // end of info parsing
+				break;
+		}
+	}
+
+	private void parseInfosEndElements() { //until tag Episode
+		//println "parse infos: $localname"
+		switch (localname) {
+			case "Topics":
+				super.processEndElement();
+				break;
+			case "Topic":
+				super.processEndElement();
+				break;
+			case "Speakers":
+				super.processEndElement();
+				break;
+			case "Speaker":
+				super.processEndElement();
+				break;
+		}
+	}
+
+	
+	boolean ignoreFirstSync = false // need to skip fist Sync when multiple locutors in Turn
+	/**
+	 * Process.
+	 *
+	 * @param xmlfile the xmlfile
+	 * @return true, if successful
+	 */
+	private boolean processEpisodeStartElement() {
+		//println "parse start: $localname"
+		switch(localname) {
+			case "Section": // >> div
+				testCloseU();
+				writer.writeStartElement("div")
+				writer.writeAttribute("id", Integer.toString(idsection++))
+				writeAttributes();
+				break;
+			case "Turn": // >> sp
+				testCloseU();
+				vSpeaker = parser.getAttributeValue(null, "speaker");
+				if (vSpeaker == null) { vSpeaker="N/A"	// no spk
+				} else {
+					localspeakers = vSpeaker.split(" ")
+					if (localspeakers.size() == 0) { // only one speaker
+						//println "FOUND ONE SPEAKER"
+						if (speakersname.containsKey(vSpeaker)) {
+							vSpeaker = speakersname.get(vSpeaker);
+						}
+					}
+				}
+
+				writer.writeStartElement("sp")
+				writer.writeAttribute("id", Integer.toString(idturn++))
+				ignoreFirstSync = vSpeaker.contains(" ") // need to skip fist Sync when multiple locutors in Turn
+				writer.writeAttribute("overlap", ""+ignoreFirstSync)
+				
+				String time = parser.getAttributeValue(null, "startTime");
+				formatedTime = formatTime(time)
+				writer.writeAttribute("time", formatedTime)
+				writeAttributes();
+				break;
+			case "Sync": // >> u
+				lastTime = parser.getAttributeValue(null, "time")
+				testCloseU();
+				if (ignoreFirstSync) { // need to skip fist Sync when multiple locutors in Turn
+					ignoreFirstSync = false;
+				} else {
+					writeU()
+				}
+				break;
+			case "Who": // >> u
+				testCloseU();
+				int n = Integer.parseInt(parser.getAttributeValue(null, "nb")) -1;
+				if (localspeakers.size() <= n || n < 0) {
+					println "\nWarning: Mismatch speaker number declaration between <Who> and <Turn> tags at line "+parser.getLocation().getLineNumber()+" of the '"+inputurl.getFile()+"' transcription file.";
+					vSpeaker = "#"+(n+1)+"?";
+				} else {
+					vSpeaker = localspeakers.get(n);
+				}
+				writeU()
+				break;
+			case "Event": // >> event
+				writer.writeStartElement("event")
+				writer.writeAttribute("id", Integer.toString(idevent++))
+				writeAttributes();
+				break;
+			default:
+				super.processStartElement();
+		}
+	}
+
+	void processEpisodeEndElement() {
+		switch (localname) {
+			case "Section":
+				if (uOpened) {
+					super.processEndElement(); // u
+					uOpened = false;
+				}
+				super.processEndElement(); //div
+				break;
+			case "Turn":
+				if (uOpened) {
+					super.processEndElement(); // u
+					uOpened = false;
+				}
+				super.processEndElement(); // sp
+				break;
+			case "Sync":
+			case "Who":
+			case "Episode":
+				break
+			case "Trans":
+				writer.writeEndElement(); // text
+				writer.writeEndElement(); //TEI
+				break
+			default:
+				super.processEndElement();
+		}
+	}
+
+	/**
+	 * If a 'u' tag is opened, close it.
+	 */
+	private testCloseU() {
+		if (uOpened) {
+			super.processEndElement(); // u
+			uOpened = false;
+		}
+	}
+
+	/**
+	 * Write u.
+	 */
+	private void writeU() {
+		writer.writeStartElement("u")
+		writer.writeAttribute("s", lastTime);
+		writer.writeAttribute("time", formatTime(lastTime));
+//		println "write u for vSpeaker=$vSpeaker"
+//		println "getting spk name? ="+speakers.get(vSpeaker)
+//		println "speakers: $speakers"
+		def attributes = speakers.get(vSpeaker)
+		if (attributes == null) { // in case of Who@n wrong number
+			if (vSpeaker.startsWith("#") && vSpeaker.endsWith("?")) { // don't show "N/A" vSpeaker
+				writer.writeAttribute("spk", vSpeaker)
+				writer.writeAttribute("spkid", vSpeaker)
+			}
+		} else {
+			for (Pair p : attributes) {
+//				println " write attribute "+p.getFirst()+" "+p.getSecond()
+				String attrn = p.getFirst().toString();
+				if (attrn == "name") { // rename @name to @spk
+					attrn = "spk"
+					u_name = p.getSecond();
+				} else if (attrn == "id") { // rename @id to @spkid
+					attrn = "spkid"
+				}
+
+				writer.writeAttribute(attrn,p.getSecond())
+			}
+		}
+		uOpened = true;
+	}
+	private String formatTime(String time) {
+		try {
+			return formatTime(Float.parseFloat(time))
+		} catch(Exception e) {return formatTime(0.0f)}
+	}
+
+	private String formatTime(float time) {
+		String rez = " ";
+		float h = time / 3600;
+		time = time%3600;
+		float min = (time%3600) / 60;
+		int sec = (int)time%60
+		if (min < 10)
+			rez = ""+(int)h+":0"+(int)min;//+":"+time%60;
+		else
+			rez = ""+(int)h+":"+(int)min;//+":"+time%60;
+
+		if (sec >= 10)
+			rez += ":"+sec;
+		else
+			rez += ":0"+sec;
+
+		return rez;
+	}
+
+	public static void main(String[] args) {
+		File infile = new File("/home/mdecorde/xml/trs/int01.trs")
+		File outfile = new File("/home/mdecorde/xml/trs/test-tei.xml")
+
+		TRSToTEI p = new TRSToTEI(infile);
+		p.process(outfile)
+	}
+
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/transcriber/CheckWhos.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/transcriber/CheckWhos.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/transcriber/CheckWhos.groovy	(revision 258)
@@ -0,0 +1,115 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+package org.txm.importer.transcriber
+
+import java.io.File;
+import javax.xml.stream.*;
+import java.io.OutputStreamWriter;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class CheckWhos.
+ */
+class CheckWhos {
+	
+	/**
+	 * Test.
+	 *
+	 * @param xmlfile the xmlfile
+	 * @return true, if successful
+	 */
+	public static boolean test(File xmlfile)
+	{
+		boolean ret = true;
+		URL url = xmlfile.toURI().toURL();
+		def inputData = url.openStream();
+		XMLInputFactory factory = XMLInputFactory.newInstance();
+		def parser = factory.createXMLStreamReader(inputData);
+		
+		String localname;
+		String vSpeaker;
+		
+		List<String> localspeakers;
+		
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) 
+		{
+			switch (event) 
+			{
+				case XMLStreamConstants.START_ELEMENT:
+					localname = parser.getLocalName();
+					switch(localname)
+					{
+						case "Turn":
+						
+							vSpeaker = parser.getAttributeValue(null, "speaker");			
+							if(vSpeaker == null)
+							{
+								localspeakers = [];
+								vSpeaker = "N/A"
+							}
+							else
+								localspeakers = vSpeaker.split(" ")
+							break;
+						
+						case "Who":
+						
+							int n = Integer.parseInt(parser.getAttributeValue(null, "nb")) -1;
+							if(localspeakers.size() <= n)
+							{
+								println "$xmlfile: Who error : line "+parser.getLocation().lineNumber+" col "+parser.getLocation().columnNumber+" in file "+xmlfile;
+								vSpeaker = "N/A";
+								ret = false;
+							}
+						
+							break;
+							
+					}
+			}
+		}
+		return ret;
+	}
+	
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args)
+	{
+		String userdir = System.getProperty("user.home")
+		for(File trsfile : new File(userdir, "xml/cedre").listFiles())
+		{
+			if(trsfile.getName().endsWith(".trs"))
+			{
+				if(!CheckWhos.test(trsfile))
+					println trsfile.getName()+" not ok"
+			}
+		}
+	}
+	
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/transcriber/BuildTemplates.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/transcriber/BuildTemplates.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/transcriber/BuildTemplates.groovy	(revision 258)
@@ -0,0 +1,89 @@
+package org.txm.importer.transcriber
+import java.nio.charset.Charset
+import org.txm.utils.CsvReader
+
+/// START PARAMETERS ///
+File dir = new File("C:/") // output and input directory
+File csvfile = new File(dir, "test.csv") // 3 cols: int enq ext
+String spkSeparator = "\\|" // regular expression
+char colSeparator = '\t' // csv column separator
+String csvencoding = "ISO-8859-1" // csv encoding
+
+//transcriptions header
+String date = "111128" // date of transcription edition
+String scribes= "studentN" // scribe name
+String encoding = "ISO-8859-1" // transcription encoding
+
+/// END PARAMETERS ///
+String canvas="""<?xml version="1.0" encoding="@ENCODING"?>
+<!DOCTYPE Trans SYSTEM "trans-14.dtd">
+<Trans scribe="@SCRIBE" audio_filename="@AUDIOFILE" version="1" version_date="@DATE">
+<Speakers>
+@SPEAKERS</Speakers>
+<Episode>
+<Section type="report" startTime="0" endTime="2.0">
+<Turn startTime="0" endTime="1.0" speaker="@FIRSTSPK">
+<Sync time="0"/>
+
+</Turn>
+</Section></Episode></Trans>
+""";
+String spkCanvas="<Speaker id=\"@ID\" name=\"@ID\" check=\"no\" dialect=\"native\" accent=\"\" scope=\"local\"/>"
+
+//load csv
+CsvReader csvreader = new CsvReader(csvfile.getAbsolutePath(), colSeparator, Charset.forName(csvencoding))
+
+//check header
+csvreader.readHeaders();
+def titles = [];
+for(String title : csvreader.getHeaders())
+	titles << title
+assert(titles.contains("int"))
+assert(titles.contains("enq"))
+assert(titles.contains("ext"))
+
+// one transcription per csv line
+while (csvreader.readRecord()){
+
+	String ints = csvreader.get("int")
+	String enqs = csvreader.get("enq")
+	String exts = csvreader.get("ext")
+	
+	def intsS = ints.split(spkSeparator)
+	def enqsS = enqs.split(spkSeparator)
+	def extsS = exts.split(spkSeparator)
+	assert(intsS.size() > 0)
+	assert(enqsS.size() > 0)
+	
+	// build speaker declarations
+	String speakers = ""
+	for(String s : intsS)
+		if(s.length() > 0)
+			speakers += spkCanvas.replace("@ID", s)+"\n"
+	for(String s : enqsS)
+		if(s.length() > 0)
+			speakers += spkCanvas.replace("@ID", s)+"\n"
+	for(String s : extsS)
+		if(s.length() > 0)
+			speakers += spkCanvas.replace("@ID", s)+"\n"
+
+	// some infos
+	String transfile = intsS[0]
+	String firstSpeaker = enqsS[0]
+			
+	// fill infos
+	String content = canvas
+	content = content.replace("@ENCODING", encoding)
+	content = content.replace("@SCRIBE", scribes)
+	content = content.replace("@AUDIOFILE", dir.getAbsolutePath()+transfile+".mp3")
+	content = content.replace("@DATE", date)
+	content = content.replace("@SPEAKERS", speakers)
+	content = content.replace("@FIRSTSPK", firstSpeaker)
+	
+	//write transcription
+	File outfile = new File(dir, transfile+".trs")
+	println "create: "+outfile
+	outfile.withWriter(encoding) { out ->
+      out.println content
+    }
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/importer/alceste/alcesteLoader.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/alceste/alcesteLoader.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/alceste/alcesteLoader.groovy	(revision 258)
@@ -0,0 +1,160 @@
+// 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
+// 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.
+//
+//
+//
+// $LastChangedDate: 2015-06-03 15:04:53 +0200 (Wed, 03 Jun 2015) $
+// $LastChangedRevision: 2984 $
+// $LastChangedBy: mdecorde $
+//
+package org.txm.importer.alceste;
+
+import org.txm.importer.alceste.importer;
+import org.txm.importer.alceste.compiler;
+import org.txm.importer.xml.pager_old;
+import org.txm.objects.*;
+import org.txm.utils.*;
+import org.txm.*;
+import org.txm.scripts.teitxm.*;
+import org.txm.utils.i18n.*;
+import org.w3c.dom.Element
+
+String userDir = System.getProperty("user.home");
+
+def MONITOR;
+boolean debug = org.txm.utils.logger.Log.isPrintingErrors();
+BaseParameters params;
+try {params = paramsBinding;MONITOR=monitor} catch (Exception)
+{	println "DEV MODE";//exception means we debug
+	debug = true
+	params = new BaseParameters(new File(userDir, "xml/TESTS/alceste2/import.xml"))
+	params.load()
+	if (!org.txm.Toolbox.isInitialized()) {
+		Toolbox.setParam(Toolbox.INSTALL_DIR,new File("/usr/lib/TXM"));
+		Toolbox.setParam(Toolbox.TREETAGGER_INSTALL_PATH,new File(userDir,"treetagger"));
+		Toolbox.setParam(Toolbox.TREETAGGER_MODELS_PATH,new File(userDir,"treetagger/models"));
+		Toolbox.setParam(Toolbox.METADATA_ENCODING, "UTF-8");
+		Toolbox.setParam(Toolbox.METADATA_COLSEPARATOR, ",");
+		Toolbox.setParam(Toolbox.METADATA_TXTSEPARATOR, "\"");
+		Toolbox.setParam(Toolbox.USER_TXM_HOME, new File(System.getProperty("user.home"), "TXM"));
+	}
+}
+if (params == null) { println "no parameters. Aborting"; return; }
+
+String corpusname = params.getCorpusName();
+
+Element corpusElem = params.corpora.get(corpusname);
+String basename = params.name;
+String rootDir = params.rootDir;
+String lang = corpusElem.getAttribute("lang");
+String model = lang
+String encoding = corpusElem.getAttribute("encoding");
+boolean annotate = "true" == corpusElem.getAttribute("annotate");
+String xsl = params.getXsltElement(corpusElem).getAttribute("xsl")
+def xslParams = params.getXsltParams(corpusElem);
+int wordsPerPage = params.getWordsPerPage("default")
+boolean build_edition = params.getDoEdition("default")
+
+File srcDir = new File(rootDir);
+File binDir = new File(Toolbox.getParam(Toolbox.USER_TXM_HOME),"corpora/"+basename);
+binDir.deleteDir();
+binDir.mkdirs();
+if (!binDir.exists()) {
+	println "Could not create binDir "+binDir
+	return;
+}
+
+File txmDir = new File(binDir,"txm/$corpusname");
+txmDir.deleteDir();
+txmDir.mkdirs();
+
+if (MONITOR != null) MONITOR.worked(1, "IMPORTER")
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+println "-- IMPORTER - Reading source files"
+
+if (!(new importer().run(srcDir, binDir, txmDir, encoding, basename, lang))) {
+	println "import process stopped";
+	return;
+}
+
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+if (MONITOR != null) MONITOR.worked(20, "ANNOTATE")
+println "-- ANNOTATE - Running NLP tools"
+boolean annotationSuccess = false;
+if (annotate && new Annotate().run(binDir, txmDir, model+".par")) {
+	annotationSuccess = true;
+}
+
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+if (MONITOR != null) MONITOR.worked(25, "COMPILING")
+println "-- COMPILING - Building Search Engine indexes"
+def c = new compiler();
+c.setAnnotationSuccess(annotationSuccess)
+if (debug) c.setDebug();
+c.setLang(lang);
+if (!c.run(binDir, txmDir, corpusname)) {
+	println "import process stopped";
+	return;
+}
+
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+
+new File(binDir,"HTML/$corpusname").deleteDir();
+new File(binDir,"HTML/$corpusname").mkdirs();
+if (build_edition) {
+	
+	if (MONITOR != null) MONITOR.worked(20, "EDITION")
+
+	println "-- EDITION - Building edition"
+	File outdir = new File(binDir,"/HTML/$corpusname/default/");
+	outdir.mkdirs();
+	List<File> filelist = txmDir.listFiles();
+	Collections.sort(filelist);
+	def second = 0
+
+	println "Paginating texts: "
+
+	for (File srcfile : filelist) {
+		print "."
+		String txtname = srcfile.getName();
+		int i = txtname.lastIndexOf(".");
+		if(i > 0) txtname = txtname.substring(0, i);
+
+		List<String> NoSpaceBefore = LangFormater.getNoSpaceBefore(lang);
+		List<String> NoSpaceAfter = LangFormater.getNoSpaceAfter(lang);
+
+		Element text = params.addText(params.corpora.get(corpusname), txtname, srcfile);
+
+		def ed = new pager_old(srcfile, outdir, txtname, NoSpaceBefore, NoSpaceAfter, wordsPerPage, basename, "pb");
+		Element edition = params.addEdition(text, "default", outdir.getAbsolutePath(), "html");
+
+		for (i = 0 ; i < ed.getPageFiles().size();) {
+			File f = ed.getPageFiles().get(i);
+			String wordid = ed.getIdx().get(i);
+			params.addPage(edition, ""+(++i), wordid);
+		}
+	}
+}
+
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+if (MONITOR != null) MONITOR.worked(20, "FINALIZING")
+File paramFile = new File(binDir, "import.xml");
+DomUtils.save(params.root.getOwnerDocument(), paramFile);readyToLoad = true;
Index: tmp/org.txm.core/src/groovy/org/txm/importer/alceste/compiler.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/alceste/compiler.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/alceste/compiler.groovy	(revision 258)
@@ -0,0 +1,306 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2016-05-26 17:42:36 +0200 (Thu, 26 May 2016) $
+// $LastChangedRevision: 3219 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer.alceste;
+
+import org.txm.importer.cwb.CwbEncode
+import org.txm.importer.cwb.CwbMakeAll
+import org.txm.importer.*;
+import org.txm.scripts.*;
+import org.txm.scripts.teitxm.BuildTTSrc;
+import org.txm.scripts.teitxm.*;
+import org.txm.utils.treetagger.TreeTagger;
+
+import javax.xml.stream.*;
+import java.net.URL;
+import java.io.File;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+
+// TODO: Auto-generated Javadoc
+/**
+ * build wtc
+ * build CWB indexes
+ * create registry file.
+ *
+ * @author mdecorde
+ */
+class compiler 
+{
+	/** The debug. */
+	private boolean debug = false;
+	
+	/** The input data. */
+	private def inputData;
+	
+	/** The factory. */
+	private def factory;
+	
+	/** The parser. */
+	private XMLStreamReader parser;
+	
+	/** The dir. */
+	private def dir;
+	
+	/** The output. */
+	private def output;
+	
+	/** The url. */
+	private def url;
+	
+	/** The anahash. */
+	private HashMap<String, String> anahash = new HashMap<String, String>() ;
+	
+	/** The text. */
+	String text = "";
+	
+	/** The base. */
+	String base = "";
+	
+	/** The project. */
+	String project = "";
+	
+	/** The text attributes. */
+	String[] textAttributes = null;
+	
+	/** The cwb loc. */
+	String cwbLoc;
+	
+	/** The lang. */
+	String lang = "fr";
+	
+	/**
+	 * initialize.
+	 *
+	 */
+	public compiler(){}
+	
+	
+	/**
+	 * Instantiates a new compiler.
+	 *
+	 * @param url the url
+	 * @param text the text
+	 * @param base the base
+	 * @param project the project
+	 */
+	public compiler(URL url, String text, String base, String project)
+	{
+		this.text = text
+		this.base = base;
+		this.project = project;
+		this.textAttributes = textAttributes;
+		try {
+			this.url = url;
+			inputData = url.openStream();
+			
+			factory = XMLInputFactory.newInstance();
+			parser = factory.createXMLStreamReader(inputData);
+		} catch (Exception ex) {
+			System.err.println("IOException while parsing: "+ex);
+		}
+	}
+	
+	/** The annotation success. */
+	boolean annotationSuccess = false;
+	
+	/**
+	 * Sets the annotation success.
+	 *
+	 * @param val the new annotation success
+	 */
+	public void setAnnotationSuccess(boolean val)
+	{
+		this.annotationSuccess = val;
+	}
+	
+	/**
+	 * Sets the cwb path.
+	 *
+	 * @param path the new cwb path
+	 */
+	public void setCwbPath(String path)
+	{
+		if (!new File(path).exists())
+			System.err.println("CWB Path : "+path+" does not exists")
+		cwbLoc = path;
+	}
+	
+	/**
+	 * Creates the output.
+	 *
+	 * @param f the f
+	 * @return true, if successful
+	 */
+	private boolean createOutput(File f){
+		try {
+			output = new OutputStreamWriter(new FileOutputStream(f,f.exists()) , "UTF-8");
+			return true;
+		} catch (Exception e) {
+			System.err.println(e);
+			return false;
+		}
+	}
+	
+	/**
+	 * Sets the lang.
+	 *
+	 * @param lang the lang
+	 * @return the java.lang. object
+	 */
+	public setLang(String lang)
+	{
+		this.lang = lang;
+	}
+	
+	/**
+	 * Run.
+	 *
+	 * @param rootDirFile the root dir file
+	 * @param basename the basename
+	 * @param textAttributes the text attributes
+	 * @return true, if successful
+	 */
+	public boolean run(File binDir, File txmDir, String corpusname, String[] textAttributes) 
+	{
+		if(cwbLoc == null)
+			cwbLoc = org.txm.Toolbox.getParam(org.txm.Toolbox.CQI_SERVER_PATH_TO_CQPLIB)+File.separator;
+		
+		if (!new File(cwbLoc).exists()) {
+			println ("CWB path error: "+cwbLoc)
+			return false;
+		}
+		if (!binDir.exists()) {
+			println ("binary directory does not exists: "+binDir)
+			return false;
+		}
+		File wtcFile = new File(binDir,"wtc/"+corpusname+".wtc");
+		new File(binDir, "wtc").deleteDir();
+		new File(binDir, "wtc").mkdir();
+		new File(binDir, "data/$corpusname").deleteDir();
+		new File(binDir, "data/$corpusname").mkdir();
+		new File(binDir, "registry").mkdir();
+		
+		String textid = "";
+		int counttext = 0;
+		List<File> files = txmDir.listFiles();
+		if (files == null || files.size() == 0) {
+			println "no file to compile"
+			return false;
+		}
+		
+		//start corpus
+		if (createOutput(wtcFile)) {
+			output.write("<txmcorpus lang=\""+lang+"\">\n");
+			output.close();
+		}
+		
+		Collections.sort(files);
+		//1- Transform into WTC file
+		XMLTXM2WTC wtcbuilder = null;
+		println("process "+files.size()+" files")
+		for (File f : files) {
+			print "."
+			counttext++;
+			if (!f.exists()) {
+				println("file "+f+ " does not exists")	
+			} else {			
+				wtcbuilder = new XMLTXM2WTC(f.toURI().toURL());
+				String txtname = f.getName().substring(0, f.getName().length()-4);
+				wtcbuilder.setTextInfo(txtname, corpusname, "default");
+
+				wtcbuilder.setBalisesToKeep(["text", "s", "p", "lb"]);
+				wtcbuilder.setSendToPAttributes(["lb":["n"], "p":["n"], "s":["n"]])
+				wtcbuilder.setLang(lang);
+				if (!wtcbuilder.transformFile(wtcFile)) {
+					println("Failed to compile "+f)
+				}
+			}
+		}
+		println ""
+		
+		//end corpus
+		if (createOutput(wtcFile)) {
+			output.write("</txmcorpus>\n");
+			output.close();
+		}
+		
+		if (wtcbuilder == null) {
+			println "there was no files in bin dir : "+txmDir
+			return false;
+		}
+		
+		//2- Import into CWB
+		String rootDir = binDir.getAbsolutePath();
+		CwbEncode cwbEn = new CwbEncode();
+		cwbEn.setDebug(debug);
+		CwbMakeAll cwbMa = new CwbMakeAll();
+		cwbMa.setDebug(debug);
+		
+		List<String> pAttributesList = wtcbuilder.getpAttributs();
+		List<String> sAttributesList = wtcbuilder.getsAttributs();
+		println "pAttrs : "+pAttributesList
+		println "sAttrs : "+sAttributesList
+		String[] pAttributes = pAttributesList.toArray(new String[pAttributesList.size()])
+		String[] sAttributes = sAttributesList.toArray(new String[sAttributesList.size()])
+		
+		try {
+			String regPath = rootDir + "/registry/"+corpusname.toLowerCase(); // CQP wants lowercase registry name
+			cwbEn.run(new File(cwbLoc,"cwb-encode").getAbsolutePath(), rootDir + "/data/${corpusname}", rootDir + "/wtc/"+corpusname+".wtc", regPath,pAttributes, sAttributes);
+			if (!new File(regPath).exists()) {
+				println "The registry file was not created: $regPath. See https://groupes.renater.fr/wiki/txm-users/public/faq"
+				return false;
+			}
+			cwbMa.run(new File(cwbLoc,"cwb-makeall").getAbsolutePath(), corpusname.toUpperCase(), rootDir + "/registry");
+		} catch (Exception ex) {System.out.println(ex); return false;}
+
+		return true;
+	}
+	
+	/**
+	 * Sets the debug.
+	 */
+	public void setDebug()
+	{
+		this.debug = true;
+	}
+	
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args)
+	{
+		File dir = new File("~/xml/geo");
+		def c = new compiler();
+		c.setDebug();
+		c.setCwbPath("~/TXM/cwb/bin");
+		c.run(dir,"geo");
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/alceste/package.html
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/alceste/package.html	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/alceste/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Alceste import module</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/org/txm/importer/alceste/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/importer/alceste/importer.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/alceste/importer.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/alceste/importer.groovy	(revision 258)
@@ -0,0 +1,185 @@
+// 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
+// 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.
+//
+//
+//
+// $LastChangedDate: 2016-12-16 17:28:35 +0100 (Fri, 16 Dec 2016) $
+// $LastChangedRevision: 3377 $
+// $LastChangedBy: mdecorde $
+//
+package org.txm.importer.alceste
+
+
+//import filters.TabulatedToXml.*;
+import org.txm.importer.*;
+import org.txm.importer.filters.*;
+import org.txm.scripts.*;
+import org.txm.importer.cwb.CwbEncode
+import org.txm.importer.cwb.CwbMakeAll
+import org.txm.scripts.teitxm.BuildTTSrc;
+import org.txm.utils.io.FileCopy;
+import org.txm.scripts.teitxm.*;
+
+import javax.xml.stream.*;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.OutputStreamWriter;
+import java.io.PrintStream;
+import java.net.URL;
+
+import filters.CutHeader.*;
+import filters.Tokeniser.*;
+import filters.FusionHeader.*;
+import filters.TagSentences.*;
+
+import org.txm.Toolbox;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class importer.
+ */
+class importer {
+
+	/**
+	 * Run.
+	 *
+	 * @param rootDirFile the root dir file
+	 * @param encoding the encoding
+	 * @param basename the basename
+	 * @return true, if successful
+	 */
+	public static boolean run(File rootDirFile, File binDir, File txmDir, String encoding, String basename, String lang)
+	{
+		if (rootDirFile.listFiles() == null || rootDirFile.listFiles().size() == 0) {
+			println "Error: no file to process in "+rootDirFile;
+			return false;
+		}
+		File srcfile;
+		for (File f : rootDirFile.listFiles()) {
+			if (!f.isHidden() && f.canRead() && f.isFile() && f.getName() != "import.xml" && !f.getName().endsWith("~")) {
+				srcfile = f
+				break;
+			}
+		}
+
+		File splitDir = new File(binDir, "split");
+		File tokenizeDir = new File(binDir, "tokenized");
+		File stokenizeDir = new File(binDir,"stokenized")
+		stokenizeDir.deleteDir();
+		stokenizeDir.mkdir();
+		tokenizeDir.deleteDir();
+		tokenizeDir.mkdir();
+		splitDir.deleteDir();
+		splitDir.mkdir();
+
+		// Build xml files from the alceste file
+		Alceste2Xml transformer = new Alceste2Xml()
+		if (!transformer.run(srcfile, splitDir, encoding)) {
+			return false;
+		}
+
+		// Tokenize xml files
+		List<File> srcfiles = splitDir.listFiles();
+		println (srcfiles.size()+ " texts found in "+srcfile)
+
+		println("Tokenizing files ("+srcfiles.size()+")")
+		for (File f : srcfiles) {
+			print "."
+			File resultfile = new File(tokenizeDir, f.getName());
+			try {
+				def builder = new SimpleTokenizerXml(f, resultfile, lang);
+				builder.setStartTag("text")
+				if (!builder.process()) {
+					println "Failed to tokenize: "+f;
+					resultfile.delete();
+				}
+			}
+			catch(Exception e){org.txm.utils.logger.Log.printStackTrace(e); println "Failed to tokenize: "+f; return false;}
+		}
+		println ""
+		
+		List<File> stokenfiles = tokenizeDir.listFiles();	
+		println("Tagging sentences of "+stokenfiles.size()+" files")
+		for (File f : stokenfiles) {
+			print "."
+			Sequence S = new Sequence();
+			Filter F1 = new CutHeader();
+			Filter F7 = new TagSentences();
+			Filter F11 = new FusionHeader();
+			S.add(F1);
+			S.add(F7);
+			S.add(F11);
+			File infile = f;
+			File xmlfile = new File(stokenizeDir, f.getName());
+			File headerfile = new File(f.getParentFile(), f.getName()+"header.xml");
+
+			S.SetInFileAndOutFile(infile.getPath(), xmlfile.getPath());
+			S.setEncodages("UTF-8","UTF-8");
+			Object[] arguments1 = [headerfile.getAbsolutePath()];
+			F1.SetUsedParam(arguments1);
+			Object[] arguments2 = [headerfile.getAbsolutePath(),F1];
+			F11.SetUsedParam(arguments2);
+			if (!S.proceed()) {
+				println "Failed to tag file: "+f
+			}
+			S.clean();
+			headerfile.delete();//remove the prepared file to clean
+		}
+		println ""
+
+		//TRANSFORM INTO XML-TEI-TXM
+		List<File> tokenfiles = stokenizeDir.listFiles()
+		println("Building xml-tei-txm ("+tokenfiles.size()+" files)")
+		for (File f : tokenfiles) {
+			print "."
+			File file = f;
+			File txmfile = new File(txmDir, f.getName());
+
+			def correspType = new HashMap<String, String>()
+			def correspRef = new HashMap<String, String>()
+			//il faut lister les id de tous les respStmt
+			def respId = [];
+			//fait la correspondance entre le respId et le rapport d'execution de l'outil
+			def applications = new HashMap<String,HashMap<String,String>>();
+			//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[]>();
+			//associe un id d'item avec sa description et son URI
+			def itemsURI = new HashMap<String,HashMap<String,String>>();
+			//informations de respStmt
+			//resps (respId <voir ci-dessus>, [description, person, date])
+			def resps = new HashMap<String,String[]>();
+			//lance le traitement
+			def builder = new Xml2Ana(file);
+			builder.setCorrespondances(correspRef, correspType);
+			builder.setHeaderInfos(respId,resps, applications, taxonomiesUtilisees, itemsURI)
+			if(!builder.process(txmfile))
+			{
+				println "Failed to build xml-txm of file: "+file;
+				txmfile.delete();
+			}
+		}
+		println ""
+		return true;
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/XMLText2TXTCSV.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/XMLText2TXTCSV.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/XMLText2TXTCSV.groovy	(revision 258)
@@ -0,0 +1,32 @@
+package org.txm.importer
+
+File dir = new File("/home/mdecorde/xml/voeux/split_xml")
+File outdir = new File("/home/mdecorde/xml/voeux/split_txtcsv")
+println "1) xml -> txt + write metadata.csv"
+outdir.deleteDir()
+outdir.mkdir()
+File metadatafile = new File(outdir, "metadata.csv")
+String csvString = ""
+
+def files = dir.listFiles()
+files.sort()
+for(File f : files)
+{
+	File outfile = new File(outdir, f.getName()+".txt");
+	String text = f.getText("UTF-8");
+	String texttag = text.find("<text id.*>")
+//	println texttag
+//	texttag = texttag.replaceAll('<text id="([^"]+)"', '<text id="$1.txt"')
+//	println "> "+texttag
+	text = text.replaceAll("<text.*>", "").replace("</text>", "");
+	outfile.withWriter("UTF-8"){writer -> writer.write(text) }
+	csvString += texttag.replace("<text id=","").replace(" loc=", ",").replace(" annee=", ",").replace("\">", "\"")+"\n"
+}
+
+println "2) write metadata.csv"
+metadatafile.withWriter("UTF-8"){csvwriter -> 
+	csvwriter.write("\"id\",\"loc\",\"annee\"\n");
+	csvwriter.write(csvString)}
+
+println "3) rename Voeux_*"
+outdir.eachFileMatch(~/Voeux_.*/) {file-> file.renameTo(new File(outdir, file.getName().substring(6, 10)+".txt")) }
Index: tmp/org.txm.core/src/groovy/org/txm/importer/AddAttributeValuesInXML.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/AddAttributeValuesInXML.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/AddAttributeValuesInXML.groovy	(revision 258)
@@ -0,0 +1,99 @@
+package org.txm.importer
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.txm.metadatas.Entry
+import org.txm.utils.Pair;
+
+/**
+ * Add a attribute value map in a XML file
+ * Warning: if an attribute already exists its value won't be changed
+ */
+class AddAttributeValuesInXML extends StaxIdentityParser {
+	File xmlFile;
+	String tag, attribute;
+	List<String> values;
+	HashMap<String, String> attributesMap;
+	boolean result;
+
+	public AddAttributeValuesInXML(File xmlFile, String tag, String attribute, List<String> values)
+	{
+		super(xmlFile.toURI().toURL());
+		this.xmlFile = xmlFile;
+		this.tag = tag;
+		this.attribute = attribute;
+		this.values = values;
+	}
+
+	public boolean process(File outfile) {
+		this.result = false;
+		boolean ret = super.process(outfile)
+		return this.result & ret;
+	}
+
+	/**
+	 * Rewrite the processStartElement() to update/add attributes
+	 */
+	int n = 0;
+	public void processStartElement()
+	{
+		if (localname != tag) {
+			super.processStartElement()
+		} else {
+			String prefix = parser.getPrefix();
+			if (INCLUDE == localname && XI == prefix) {
+				processingXInclude();
+				return;
+			}
+
+			if (prefix.length() > 0)
+				writer.writeStartElement(Nscontext.getNamespaceURI(prefix), localname)
+			else
+				writer.writeStartElement(localname);
+
+			for (int i = 0 ; i < parser.getNamespaceCount() ; i++) {
+				writer.writeNamespace(parser.getNamespacePrefix(i), parser.getNamespaceURI(i));
+			}
+
+			// get attributes
+			HashMap<String, String> attributes = new HashMap<String, String>();
+			for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
+				attributes[parser.getAttributeLocalName(i)] = parser.getAttributeValue(i);
+			}
+			// add/update the value
+			if (n < values.size()) {
+				attributes[attribute] = values[n]; 
+			} else {
+				println "ERROR: not enough values to insert for file $xmlFile, at XML parser location: l="+parser.getLocation().getLineNumber()+",c="+parser.getLocation().getColumnNumber()+")."
+			}
+			n++
+			
+			// write attributes
+			for (def k : attributes.keySet()) {
+				writer.writeAttribute(k, attributes[k])
+			}
+		}
+	}
+	
+	@Override
+	public void after() {
+		super.after();
+		
+		if (n != values.size()) {
+			println "ERROR: number of $tag ("+n+") missmatch the number of values to insert: "+values.size()
+		}
+	}
+
+	public static void main(String[] args)
+	{
+		File xmlfile = new File("/home/mdecorde/xml/macroaddfacsattribute/src/test1.xml")
+		File temp = File.createTempFile("temp", ".xml", xmlfile.getParentFile());
+
+		AddAttributeValuesInXML builder = new AddAttributeValuesInXML(xmlfile, "pb", "facs", ["V1","V1.2", "V2", "V3"]);
+		builder.process(temp);
+		
+		println "Done"
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/frantext/frantextLoader.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/frantext/frantextLoader.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/frantext/frantextLoader.groovy	(revision 258)
@@ -0,0 +1,213 @@
+// 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
+// Sophia Antipolis, University of Paris 3.
+//
+//
+// This file is part of the TXM platform.
+//
+// The TXM platform is free software: you can redistribute it and/or modif y
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 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/>.
+//
+//
+//
+//
+//
+// $LastChangedDate: 2012-02-13 11:42:24 +0100 (lun., 13 févr. 2012) $
+// $LastChangedRevision: 2126 $
+// $LastChangedBy: mdecorde $
+//
+package org.txm.importer.frantext;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.txm.importer.ApplyXsl2;
+import org.txm.importer.bfm.importer;
+import org.txm.importer.bfm.compiler;
+import org.txm.importer.bfm.pager;
+import org.txm.objects.*;
+import org.txm.*;
+import org.txm.utils.i18n.*;
+import org.txm.utils.io.FileCopy;
+import org.txm.scripts.teitxm.*;
+import org.txm.importer.*;
+import org.w3c.dom.Element
+import org.txm.utils.*;
+
+String userDir = System.getProperty("user.home");
+boolean debug = org.txm.utils.logger.Log.isPrintingErrors();
+def MONITOR;
+BaseParameters params;
+try {params = paramsBinding;MONITOR=monitor} catch (Exception)
+{	println "DEV MODE";//exception means we debug
+	debug = true
+	params = new BaseParameters(new File(userDir, "xml/TESTS/frantext/import.xml"))
+	params.load()
+	if (!org.txm.Toolbox.isInitialized()) {
+		//rootDir = userDir+"/xml/TESTS/alceste";  // directory which contains the source file
+
+		Toolbox.setParam(Toolbox.INSTALL_DIR,new File("/usr/lib/TXM"));
+		Toolbox.setParam(Toolbox.TREETAGGER_INSTALL_PATH,new File(userDir,"treetagger"));
+		Toolbox.setParam(Toolbox.TREETAGGER_MODELS_PATH,new File(userDir,"treetagger/models"));
+		Toolbox.setParam(Toolbox.METADATA_ENCODING, "UTF-8");
+		Toolbox.setParam(Toolbox.METADATA_COLSEPARATOR, ",");
+		Toolbox.setParam(Toolbox.METADATA_TXTSEPARATOR, "\"");
+		Toolbox.setParam(Toolbox.USER_TXM_HOME, new File(System.getProperty("user.home"), "TXM"));
+	}
+}
+if (params == null) { println "no parameters. Aborting"; return; }
+
+String corpusname = params.getCorpusName();
+Element corpusElem = params.corpora.get(corpusname);
+String basename = params.name;
+String rootDir = params.rootDir;
+String lang = corpusElem.getAttribute("lang");
+String model = lang
+String encoding = corpusElem.getAttribute("encoding");
+boolean annotate = "true" == corpusElem.getAttribute("annotate");
+String xsl = params.getXsltElement(corpusElem).getAttribute("xsl")
+def xslParams = params.getXsltParams(corpusElem);
+int wordsPerPage = params.getWordsPerPage("default")
+boolean build_edition = params.getDoEdition("default")
+
+File srcDir = new File(rootDir);
+File binDir = new File(Toolbox.getParam(Toolbox.USER_TXM_HOME),"corpora/"+basename);
+binDir.deleteDir();
+binDir.mkdirs();
+if (!binDir.exists()) {
+	println "Could not create binDir "+binDir
+	return;
+}
+
+File txmDir = new File(binDir,"txm/$corpusname");
+txmDir.deleteDir();
+txmDir.mkdirs();
+
+// BFM XPATH PARAMETERS
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+if (MONITOR != null) MONITOR.worked(1, "READ XPATH PARAMETERS")
+File paramDeclarationFile = new File(srcDir, "import.properties");
+Properties metadataXPath = new Properties();
+if (paramDeclarationFile.exists() && paramDeclarationFile.canRead()) {
+	InputStreamReader input = new InputStreamReader(new FileInputStream(paramDeclarationFile) , "UTF-8");
+	metadataXPath.load(input);
+	input.close();
+
+	if (!metadataXPath.containsKey("titre"))
+		println "Warning: parameters property file does not contain the 'titre' metadata"
+	if (!metadataXPath.containsKey("forme"))
+		println "Warning: parameters property file does not contain the 'forme' metadata in param values. The default value is 'prose'"
+}
+else
+	println "No '$paramDeclarationFile' file found"
+
+// Apply XSL
+if (MONITOR != null) MONITOR.worked(5, "APPLYING XSL")
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+File xslFile = new File(Toolbox.getParam(Toolbox.USER_TXM_HOME), "xsl/txm-filter-teifrantext-teibfm.xsl") // force xsl
+
+if (!ApplyXsl2.processImportSources(xslFile, srcDir, new File(binDir, "xsl"))) {
+	println "Error: failed to apply xsl $xsl. Aborting import."
+	return; // error durring process
+}
+srcDir = new File(binDir, "xsl");
+
+// copy txm files
+println "-- VALIDATION - checking XML source files well-formedness"
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+List<File> srcfiles = srcDir.listFiles();
+for (File f : srcfiles) { // check XML format, and copy file into binDir
+	if (f.isHidden() || f.getName().equals("import.xml") || f.getName().equals("metadata.csv") || f.getName().endsWith(".properties"))
+		continue;
+	if (ValidateXml.test(f)) {
+		FileCopy.copy(f, new File(txmDir, f.getName()));
+	} else {
+		println "Won't process file "+f;
+	}
+}
+if (MONITOR != null) MONITOR.worked(5)
+
+if (txmDir.listFiles() == null) {
+	println "No txm file to process"
+	return;
+}
+
+if (MONITOR != null) MONITOR.worked(1, "IMPORTER")
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+println "-- IMPORTER - Reading source files"
+def imp = new importer()
+if (!imp.run(srcDir, binDir, txmDir, basename, metadataXPath)) {
+	println "import process stopped";
+	return;
+}
+
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+if (MONITOR != null) MONITOR.worked(20, "ANNOTATE")
+println "-- ANNOTATE - Running NLP tools - $model model"
+boolean annotate_status = true;
+if (annotate && !(new Annotate().run(binDir, txmDir, model+".par"))) {
+	println "Skipping Annotate process";
+	annotate_status = false;
+}
+
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+if (MONITOR != null) MONITOR.worked(25, "COMPILING")
+println "-- COMPILING - Building Search Engine indexes"
+def c = new compiler();
+if (debug) c.setDebug();
+//c.setCwbPath("~/TXM/cwb/bin");
+c.setLang(lang);
+c.setAnnotationDone(annotate_status)
+if (!c.run(binDir, txmDir, corpusname, metadataXPath)) {
+	println "import process stopped";
+	return;
+}
+
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+
+new File(binDir,"HTML/$corpusname").deleteDir();
+new File(binDir,"HTML/$corpusname").mkdirs();
+if (build_edition) {
+
+	println "-- EDITION"
+	if (MONITOR != null) MONITOR.worked(25, "EDITION")
+	
+	File outdir = new File(binDir,"/HTML/$corpusname/default/");
+	outdir.mkdirs();
+	files = c.getOrderedTxmFiles();
+	println("Building editions: "+files.size()+" files" );
+
+	for (File txmFile : files) {
+		print "."
+		String txtname = txmFile.getName();
+		int idx = txtname.lastIndexOf(".");
+		if(idx > 0) txtname = txtname.substring(0, idx);
+		List<String> NoSpaceBefore = LangFormater.getNoSpaceBefore(lang);
+		List<String> NoSpaceAfter = LangFormater.getNoSpaceAfter(lang);//["'","(","[","{","«"];
+
+		Element text = params.addText(corpusElem, txtname, txmFile);
+
+		def ed = new pager(txmFile, outdir, txtname, NoSpaceBefore, NoSpaceAfter, wordsPerPage, corpusname, metadataXPath);
+		Element edition = params.addEdition(text, "default", outdir.getAbsolutePath(), "html");
+
+		for (i = 0 ; i < ed.getPageFiles().size();) {
+			File f = ed.getPageFiles().get(i);
+			String wordid = ed.getIdx().get(i);
+			params.addPage(edition, ""+(++i), wordid);
+		}
+	}
+}
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+if (MONITOR != null) MONITOR.worked(20, "FINALIZING")
+File paramFile = new File(binDir, "import.xml");
+DomUtils.save(params.root.getOwnerDocument(), paramFile);readyToLoad = true;
Index: tmp/org.txm.core/src/groovy/org/txm/importer/frantext/package.html
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/frantext/package.html	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/frantext/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Frantext import module (uses the BFM import module)</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/org/txm/importer/frantext/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/importer/Factiva2XmlTxm.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/Factiva2XmlTxm.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/Factiva2XmlTxm.groovy	(revision 258)
@@ -0,0 +1,261 @@
+/**
+ * Main.
+ *
+ * @param args the args
+ */
+// script de recherche de contenus entre balises dans un fichier xml
+
+/**
+ *  @author Daniel Marin, Florent Bédécarrats
+ *  @author Matthieu Decorde
+ *  @copyright 2011 Daniel Marin &  Florent Bédécarrats, for original Perl version
+ *  @copyright 2011 ENS de Lyon, for translation in Groovy
+ *  This software is licensed under the GNU GPL version 3.0 or later. 
+ */
+package org.txm.importer;
+
+public run(File rootDir, String rep_final ) {
+
+	// A RENSEIGNER #########################################
+	
+	def fich_xml = rootDir.listFiles().grep(~/.*\.xml/)
+	println "$rootDir : $fich_xml"
+
+	def ext = ".xml"
+	//def rep_final = rootDir.getAbsolutePath()+"/out" // le nom du répertoire dans lequel on va créer les fichiers txm
+
+	List<String> Balises = ["<baseLanguage>","<date>","<sourceName>","<name>","<name>"] // balises XML à détecter
+	List<String> FinBalises = ["</baseLanguage>","</date>","</sourceName>","</name>","</name>"]
+
+	List<String> Sections = ["<ppsarticle>","<industry ","<region ","<headline>","<tailParagraphs>"] // Balises indiquant qu'à 'intérieur de la section se trouvent les infos (sur plusieurs lignes contrairement à @Balises)
+	List<String> FinSections = ["</ppsarticle>","</industry>","</region>","</headline>","</tailParagraphs>"]
+
+	def Headline = [] // le tableau dans lequel on va stocker le contenu de <headline>
+	def TailPara = [] // le tableau dans lequel on va stocker le contenu de <tailParagraphs>
+
+	def NomsMeta = ["language=","date=","source=","subject=","country="] // les noms qui interviennent dans les méta-données du fichier final
+	// FIN A RENSEIGNER #####################################
+
+	def TestMeta = [0,0,0,0,0] // Tableau qui indique si les métadonnées sont disponibles dans le fichier
+	def MetaData = [] //le tableau des metadonnées
+	def metaData = "" // la chaine dans laquelle on va stocker les métadonnées
+	String temp = ""
+	def fich_out = ">"
+	def nom_in = ""
+
+	def new_fich=0 // variable booleenne qui indique si on doit créer un nouveau txm
+	def industry=0 // variable booleenne qui indique qu'on est dans la section <industry> pour renseigner "subject"
+	def premIndustry=0 // variable booleenne qui indique qu'on a passé le 1er <industry> pour renseigner "subject"
+	def region=0 // variable booleenne qui indique qu'on est dans la section <region> pour renseigner "country"
+	def premRegion=0 // variable booleenne qui indique qu'on a passé le 1er <region> pour renseigner "country"
+	def copie=0 // variable booleenne qui indique si l'on doit copier le contenu de la ligne dans le fichier txm
+	def copieSec3=0 // variable qui indique si on est à l'intérieur de la section 3
+	def copieSec4=0 // variable qui indique si on est à l'intérieur de la section 4
+
+	def num_fich=0 // le numéro du fichier traité
+	def char_num_fich="" // pour numéroter les fichiers fich_001 pour garder l'ordre alphabétique
+
+	def i = 1
+
+	println "Création du répertoire dans lequel on va mettre les fichiers finaux txm"
+	if (new File(rep_final).exists()) {
+		println "Le répertoire $rep_final existe"
+	}
+	else {
+		if (!new File(rep_final).mkdir()) {
+			println "Echec de la création du répertoire: $rep_final"
+			return
+		}
+		if (!new File(rep_final).canWrite()) {
+			println "Le répertoire '$rep_final' final est read-only"
+			return
+		}
+	}
+
+	FileWriter ECRITURE
+	for (File fich_in : fich_xml) {
+		if (fich_in.getName() == "import.xml") continue;
+		println "Validate $fich_in...";
+		if (!ValidateXml.test(fich_in)) {
+			println "skip $fich_in"
+			continue;
+		}
+		// open(LECTURE, fich_in) || die("erreur d'ouverture de $fich_in")
+		println "on parcourt l'ensemble de $fich_in"
+		def reader = new FileReader(fich_in)
+		String line = reader.readLine()
+		while (line != null)
+		{
+			// on stocke le contenu de la ligne (et on efface le retour chariot à la fin)
+			temp = line
+			temp = temp.trim()
+			temp = (temp =~ /^\s+/).replaceAll("")
+			temp = (temp =~ /^\t/).replaceAll("")
+			temp = temp.replaceAll("</paragraph>", "</paragraph><br/>")
+
+			// On indique si on est dans la 1ère section de industry ou region pour prélever <name>
+			if ((temp =~ Sections[1]) && (premIndustry==0)){
+				industry=1
+				premIndustry=1
+			}
+			else if (temp =~ FinSections[1]){
+				industry=0
+			}
+
+			if ((temp =~ Sections[2]) && (premRegion==0)){
+				region = 1
+				premRegion = 1
+			}
+			else if (temp =~ FinSections[2]){
+				region = 0
+			}
+
+			// on regarde si la balise de création de nouveau fichier est présente
+			if (temp =~ Sections[0]){
+				new_fich=1
+				num_fich = num_fich+1
+				nom_in = fich_in.getName()
+				nom_in = (nom_in =~ /$ext/).replaceAll("")
+				// Petit test pour numéroter les fichiers en 001, 002 plutôt que 1, 2 (ordre alphabétique)
+				if (num_fich < 10){
+					char_num_fich = "00"+num_fich
+				} else if (num_fich<100) {
+					char_num_fich = "0"+num_fich
+				} else {
+					char_num_fich = num_fich
+				}
+				fich_out = new File(rep_final, nom_in + "_" + char_num_fich + ext)
+				//open(ECRITURE,"> $fich_out") || die("erreur d'ouverture de $fich_out ! $! \n")
+				println("new file : "+fich_out)
+				if (ECRITURE != null) ECRITURE.close()
+				ECRITURE = new FileWriter(fich_out)
+			}
+
+			// Remplissage des métadonnées : ####################################################
+			// Language
+			if (temp =~ Balises[0]){
+				temp = (temp =~ Balises[0]).replaceAll("")
+				temp = (temp =~ FinBalises[0]).replaceAll("")
+
+				MetaData[0]=temp
+				print " language trouve : "+MetaData[0]+" \n"
+				TestMeta[0]=1
+
+			}
+			// date
+			if (temp =~ Balises[1]) {
+				temp = (temp =~ Balises[1]).replaceAll("")
+				temp = (temp =~ FinBalises[1]).replaceAll("")
+				MetaData[1]=temp
+				print " date trouvee : "+MetaData[1]+" \n"
+				TestMeta[1]=1
+			}
+			// source
+			if (temp =~ Balises[2]){
+				temp = (temp =~ Balises[2]).replaceAll("")
+				temp = (temp =~ FinBalises[2]).replaceAll("")
+				MetaData[2]=temp
+				print " source trouvee : "+MetaData[2]+" \n"
+				TestMeta[2]=1
+			}
+			// subject (on doit être dans la 1ère section <industry>)
+			if ((temp =~ Balises[3]) && (industry==1)){
+				temp = (temp =~ Balises[3]).replaceAll("")
+				temp = (temp =~ FinBalises[3]).replaceAll("")
+				MetaData[3]=temp
+				industry=0
+				print " Sujet trouve : "+MetaData[3]+" \n"
+				TestMeta[3]=1
+			}
+			// country
+			if ((temp =~ Balises[4]) && (region==1)){
+				temp = (temp =~ Balises[4]).replaceAll("")
+				temp = (temp =~ FinBalises[4]).replaceAll("")
+				MetaData[4]=temp
+				region=0
+				print " Pays trouve : "+MetaData[4]+" \n"
+				TestMeta[4]=1
+
+				// Toutes les méta-données ont été trouvées, on assemble la chaîne
+				metaData = "<article "
+				for (i=0;i<(NomsMeta.size()+1);i++){
+					if (TestMeta[i]==1){
+						metaData = metaData+NomsMeta[i]+"\""+MetaData[i]+"\" "
+					}
+					else if (TestMeta[i]==0){
+						metaData = metaData +NomsMeta[i]+"\"\" "
+					}
+				}
+				metaData = "$metaData>\n"
+				print " metaData : $metaData \n"
+			}
+			// FIN Remplissage des métadonnées : #################################################
+
+			// On copie ou pas si on est ou pas dans <headline> ou <tailParagraphs>
+			if (temp =~ Sections[3]){
+				copieSec3=1
+			}
+			if (temp =~ FinSections[3]){
+				Headline.add(temp)
+				copieSec3=0
+			}
+			if (temp =~ Sections[4]){
+				copieSec4=1
+			}
+			if (temp =~ FinSections[4]){
+				TailPara.add(temp)
+				copieSec4=0
+			}
+
+			if (copieSec3 == 1){
+				Headline.add(temp)
+			}
+			if (copieSec4 == 1){
+				TailPara.add(temp)
+			}
+
+			if (temp =~ FinSections[0]){
+				ECRITURE.write("$metaData\n")
+				for (i=0;i<(Headline.size());i++){
+					if (i==0 || i==Headline){
+						ECRITURE.write(Headline[i].toString()+"\n")
+					}
+					else{
+						ECRITURE.write("\t"+Headline[i]+"\n")
+					}
+				}
+				for (i=0;i<(TailPara.size());i++){
+					if (i==0 || i==TailPara){
+						ECRITURE.write(TailPara[i].toString()+"\n")
+					}
+					else{
+						ECRITURE.write("\t"+TailPara[i]+"\n")
+					}
+				}
+				ECRITURE.write("</article>")
+
+				new_fich=0
+				industry=0
+				region=0
+				premIndustry=0
+				premRegion=0
+				MetaData=[]
+				TestMeta=[0,0,0,0,0]
+				Headline=[]
+				TailPara=[]
+
+				ECRITURE.close()
+				print "fichier $char_num_fich traite.\n"
+			}
+			line = reader.readLine()
+		}
+		ECRITURE.close()
+		reader.close()
+		num_fich = 0
+	}
+}
+
+String userDir = System.getProperty("user.home");
+File rootDir = new File(userDir, "xml/factiva")
+File outdir = new File(rootDir, "out2")
+run(rootDir, outdir.getAbsolutePath());
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/importer/perrault/pager.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/perrault/pager.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/perrault/pager.groovy	(revision 258)
@@ -0,0 +1,366 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2017-01-24 18:11:42 +0100 (Tue, 24 Jan 2017) $
+// $LastChangedRevision: 3400 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer.perrault;
+
+import org.txm.importer.*;
+import org.xml.sax.Attributes;
+import org.txm.importer.filters.*;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.stream.*;
+import java.net.URL;
+import org.xml.sax.InputSource;
+import org.xml.sax.helpers.DefaultHandler;
+
+// TODO: Auto-generated Javadoc
+/** Build Discours corpus simple edition from a xml-tei. @author mdecorde */
+class pager {
+	List<String> NoSpaceBefore;
+	
+	/** The No space after. */
+	List<String> NoSpaceAfter;
+
+	/** The wordcount. */
+	int wordcount = 0;
+	
+	/** The pagecount. */
+	int pagecount = 0;
+	
+	/** The wordmax. */
+	int wordmax = 0;
+
+	/** The wordid. */
+	String wordid;
+	
+	/** The first word. */
+	boolean firstWord = true;
+	
+	/** The wordvalue. */
+	String wordvalue;
+	
+	/** The interpvalue. */
+	String interpvalue;
+	
+	/** The lastword. */
+	String lastword = " ";
+	
+	/** The wordtype. */
+	String wordtype;
+	
+	/** The flagform. */
+	boolean flagform = false;
+	
+	/** The flaginterp. */
+	boolean flaginterp = false;
+	
+	/** The url. */
+	private def url;
+	
+	/** The input data. */
+	private def inputData;
+	
+	/** The factory. */
+	private def factory;
+	
+	/** The parser. */
+	private XMLStreamReader parser;
+	
+	/** The writer. */
+	def writer;
+	
+	/** The multiwriter. */
+	def multiwriter = null;
+	
+	/** The infile. */
+	File infile;
+	
+	/** The outfile. */
+	File outfile;
+	
+	/** The pages. */
+	ArrayList<File> pages = new ArrayList<File>();
+	
+	/** The idxstart. */
+	ArrayList<String> idxstart = new ArrayList<String>();
+
+	/**
+	 * Instantiates a new pager.
+	 *
+	 * @param infile the infile
+	 * @param outfile the outfile
+	 * @param NoSpaceBefore the no space before
+	 * @param NoSpaceAfter the no space after
+	 * @param max the max
+	 */
+	pager(File infile, File outfile, List<String> NoSpaceBefore,
+			List<String> NoSpaceAfter, int max) {
+		this.wordmax = max;
+		this.NoSpaceBefore = NoSpaceBefore;
+		this.NoSpaceAfter = NoSpaceAfter;
+		this.url = infile.toURI().toURL();
+		this.infile = infile;
+
+		inputData = url.openStream();
+		factory = XMLInputFactory.newInstance();
+		parser = factory.createXMLStreamReader(inputData);
+		createOutput(outfile);
+		process();
+	}
+
+	/**
+	 * Creates the next output.
+	 *
+	 * @return true, if successful
+	 */
+	private boolean createNextOutput()
+	{
+		try {
+			if(multiwriter != null)
+			{
+				multiwriter.write("</body>");
+				multiwriter.write("</html>");
+				multiwriter.close();
+			}
+			pagecount++;
+			File f = new File(outfile.getParent()+"/multi/",outfile.getName().substring(0,outfile.getName().length()-6)+"_"+pagecount+".html");
+			pages.add(f);
+			idxstart.add(wordid)
+			multiwriter = new OutputStreamWriter(new FileOutputStream(f) , "UTF-8");
+			
+			multiwriter.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
+			multiwriter.write("<html>");
+			multiwriter.write("<head>");
+			multiwriter.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/>");
+			multiwriter.write("<title>Perrault Edition - Page "+pagecount+"</title>");
+			multiwriter.write("</head>");
+			multiwriter.write("<body>");
+			
+			return true;
+		} catch (Exception e) {
+			System.out.println(e.getLocalizedMessage());
+			return false;
+		}
+	}
+
+	/**
+	 * Creates the output.
+	 *
+	 * @param outfile the outfile
+	 * @return true, if successful
+	 */
+	private boolean createOutput(File outfile) {
+		try {
+			this.outfile = outfile;
+
+			writer = new OutputStreamWriter(new FileOutputStream(outfile),
+					"UTF-8");
+			createNextOutput();
+			return true;
+		} catch (Exception e) {
+			System.out.println(e.getLocalizedMessage());
+			return false;
+		}
+	}
+
+	/**
+	 * Gets the page files.
+	 *
+	 * @return the page files
+	 */
+	public ArrayList<File> getPageFiles() {
+		return pages;
+	}
+
+	/**
+	 * Gets the idx.
+	 *
+	 * @return the idx
+	 */
+	public ArrayList<String> getIdx() {
+		return idxstart;
+	}
+
+	/**
+	 * Process.
+	 */
+	void process()
+	{
+		String localname = "";
+		
+		writer.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
+		writer.write("<html>");
+		writer.write("<head>");
+		writer.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/>");
+		writer.write("<title>Perrault Edition</title>");
+		writer.write("</head>");
+		writer.write("<body>");
+		
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+			
+			
+			switch (event) {
+				case XMLStreamConstants.START_ELEMENT:
+					localname = parser.getLocalName();
+					switch(localname)
+					{				
+						case "text":
+						XPathResult testG = new XPathResult(infile);
+						String title =testG.getXpathResponse("//tei:TEI/tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:title[type='sub']","")
+						writer.write("<h1>"+title+"</h1>\n")
+						multiwriter.write("<h1>"+title+"</h1>\n")
+						break;
+						
+						case "head":
+						writer.write("<h2>\n")
+						multiwriter.write("<h2>\n")
+						break;
+						
+						case "lg":
+						writer.write("<p>\n")
+						multiwriter.write("<p>\n")
+						break;
+						
+						case "p":
+						case "q":
+						writer.write("<p>\n")
+						multiwriter.write("<p>\n")
+						break;
+						
+						case "w":
+						wordid=parser.getAttributeValue(null,"id");
+						if(firstWord)
+						{
+							firstWord=false;
+							this.idxstart.set(0,wordid);
+						}
+						wordcount++;
+						if(wordcount >= wordmax)
+						{
+							createNextOutput();
+							wordcount=0;
+						}
+						break;
+						
+						case "ana":
+						flaginterp=true;
+						interpvalue+=" "+parser.getAttributeValue(null,"type")+":"
+						break;
+						
+						case "form":
+						wordvalue="";
+						interpvalue ="";
+						flagform=true;
+						break;
+					}
+					break;
+				case XMLStreamConstants.END_ELEMENT:
+					localname = parser.getLocalName();
+					switch(localname)
+					{				
+						case "head":
+						writer.write("</h2>\n")
+						multiwriter.write("</h2>\n")
+						break;
+						
+						case "lg":
+						writer.write("</p>\n")
+						multiwriter.write("</p>\n")
+						break;
+						
+						case "l":
+							writer.write("<br/>\n")
+							multiwriter.write("<br/>\n")
+							break;
+						
+						case "p":
+						case "q":
+						writer.write("</p>\n")
+						multiwriter.write("</p>\n")
+						break;
+						
+						case "form":
+						flagform = false
+						
+						break;
+						
+						case "ana":
+						flaginterp = false
+						break;
+						
+						case "w":
+							int l = lastword.length();
+							String endOfLastWord = "";
+							if(l > 0)
+								endOfLastWord = lastword.subSequence(l-1, l);
+							
+							if(interpvalue != null)
+								interpvalue = interpvalue.replace("\"","&quot;");
+							
+							if(NoSpaceBefore.contains(wordvalue) || 
+									NoSpaceAfter.contains(lastword) || 
+									wordvalue.startsWith("-") || 
+									NoSpaceAfter.contains(endOfLastWord))
+							{
+								writer.write("<span title=\""+interpvalue+"\" id=\""+wordid+"\">");
+								multiwriter.write("<span title=\""+interpvalue+"\" id=\""+wordid+"\">");
+							}
+							else
+							{
+								writer.write(" <span title=\""+interpvalue+"\" id=\""+wordid+"\">");
+								multiwriter.write(" <span title=\""+interpvalue+"\" id=\""+wordid+"\">");
+							}
+							writer.write(wordvalue.replace("<", "&lt;")+"</span>");
+							multiwriter.write(wordvalue.replace("<", "&lt;")+"</span>");
+							lastword=wordvalue;
+						break;
+						
+					}
+					break;
+				
+				case XMLStreamConstants.CHARACTERS:
+					if(flagform)
+						if(parser.getText().length() > 0)
+							wordvalue+=(parser.getText());
+					if(flaginterp)
+						if(parser.getText().length() > 0)
+							interpvalue+=(parser.getText());
+					break;
+			}
+		}	
+		writer.write("</body>");
+		writer.write("</html>");
+		writer.close();
+		multiwriter.write("</body>");
+		multiwriter.write("</html>");
+		multiwriter.close();
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/perrault/importer.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/perrault/importer.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/perrault/importer.groovy	(revision 258)
@@ -0,0 +1,243 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+
+package org.txm.importer.perrault
+
+import org.txm.importer.*;
+import org.txm.importer.filters.*;
+import org.txm.scripts.*;
+import org.txm.importer.cwb.CwbEncode
+import org.txm.importer.cwb.CwbMakeAll
+import org.txm.scripts.teitxm.*;
+import org.txm.utils.treetagger.TreeTagger;
+import javax.xml.stream.*;
+import java.net.URL;
+
+import filters.CutHeader.*;
+import filters.Tokeniser.*;
+import filters.FusionHeader.*;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class importer.
+ */
+class importer {
+	
+	/**
+	 * Split.
+	 *
+	 * @param file the file
+	 * @return the list
+	 */
+	public static List<File> split(File file)
+	{
+		File f  = file;
+		
+		println "split file "+f;
+		String rootDir = f.getParent()+"/";
+		String xslfile = rootDir+"/xsl/splitcorpus.xsl";
+		String outfile = rootDir+"split_temp.xml";
+		
+		//get the splited file name
+		//String outfilename = new XPathResult(f).getXpathResponse("//TEI/text/body/div/head","");
+		
+		ApplyXsl a = new ApplyXsl(xslfile);
+		//a.SetParam("xpathtag", "//TEI");//coupe //text
+		//a.SetParam("xpathfilename", "/body/div/head");//cherche a partir de //xpathtag
+		a.process(f.getPath(),outfile);
+		
+		new File(outfile).delete();
+		
+		List<File> files = new File(f.getParent(),"split").listFiles();
+	}
+	
+	/**
+	 * Run.
+	 *
+	 * @param srcfiles the srcfiles
+	 */
+	public static void run(File[] srcfiles)
+	{
+		List<File> files = null;
+		File fullfile;
+		String rootDir ="";
+		ArrayList<String> milestones = new ArrayList<String>();//the tags who you want them to stay milestones
+		milestones.add("tagUsage");
+		milestones.add("pb");
+		milestones.add("lb");
+		
+		for(File f : srcfiles)
+		{
+			files = importer.split(f);
+			rootDir = f.getParent()+"/"
+			fullfile = f;
+			new File(rootDir+"ptokenized").deleteDir();
+			new File(rootDir+"ptokenized").mkdir();
+			new File(rootDir+"tokenized").deleteDir();
+			new File(rootDir+"tokenized").mkdir();
+			new File(rootDir+"split").deleteDir();
+			new File(rootDir+"split").mkdir();
+			new File(rootDir+"txm").deleteDir();
+			new File(rootDir+"txm").mkdir();
+			
+			String xslfile = rootDir+"xsl/splitcorpus.xsl";
+			String infile = f.getPath();
+			String outfile = rootDir+"split_temp.xml";
+			
+			ApplyXsl a = new ApplyXsl(xslfile);
+			a.process(infile,outfile);
+			
+			new File(outfile).delete();
+		}
+		
+		//get header
+		String header =""
+		Reader reader = new FileReader(fullfile);
+		String cline = reader.readLine();
+		while(!cline.trim().contains("<text>"))
+		{
+			header += cline+"\n";
+			cline = reader.readLine();
+		}
+		
+		//put splited into tei file
+		for(File f : files)
+		{
+			File temp = new File(f.getParent(),"temp");
+			Writer writer = new OutputStreamWriter(new FileOutputStream(temp) , "UTF-8");
+			writer.write(header);
+			writer.write("""<text>\n<body>\n""")
+			f.eachLine{String line->
+				if(!line.startsWith("<?xml"))
+				writer.write(line+"\n");
+			}
+			
+			writer.write("""</body>\n</text>\n</TEI>""")
+			writer.close();
+			
+			if (!(f.delete() && temp.renameTo(f))) println "Warning can't rename file "+temp+" to "+f
+		}
+		
+		//PREPARE EACH SPLITED FILE TO BE TOKENIZED
+		println files
+		for(File f : files)
+		{
+			File srcfile = f;
+			File resultfile = new File(rootDir+"ptokenized",f.getName()+"-src.xml");
+			println("prepare tokenizer file : "+srcfile+" to : "+resultfile );
+			def builder = new OneTagPerLine(srcfile.toURL(), milestones);
+			builder.process(resultfile);
+		}
+		
+		//TOKENIZE FILES
+		files = new File(rootDir,"ptokenized").listFiles()	
+		for(File f : files)
+		{
+			Sequence S = new Sequence();
+			Filter F1 = new CutHeader();
+			Filter F6 = new Tokeniser(f);
+			Filter F11 = new FusionHeader();
+			S.add(F1);
+			S.add(F6);
+			S.add(F11);
+			File infile = new File(rootDir+"ptokenized",f.getName());
+			File xmlfile = new File(rootDir+"tokenized",f.getName()+"-out.xml");
+			File headerfile = new File(rootDir+"/ptokenized/",f.getName()+"header.xml");
+			println("Tokenizing "+xmlfile)
+			S.SetInFileAndOutFile(infile.getPath(), xmlfile.getPath());
+			S.setEncodages("UTF-8","UTF-8");
+			Object[] arguments1 = [headerfile.getAbsolutePath()];
+			F1.SetUsedParam(arguments1);
+			Object[] arguments2 = [headerfile.getAbsolutePath(),F1];
+			F11.SetUsedParam(arguments2);
+			S.proceed();
+
+			System.out.println("exits src tokenized : "+infile.exists());
+			S= null;
+			F1=null;
+			F6=null;
+			F11=null;
+			System.out.println("delete src tokenized : "+infile.delete());//remove the prepared file to clean
+			headerfile.delete();//remove the prepared file to clean
+		}
+
+		//TRANSFORM INTO XML-TEI-TXM
+		files = new File(rootDir,"tokenized").listFiles()	
+		for(File f : files)
+		{
+			//ArrayList<String> milestones = new ArrayList<String>();
+			println("Building xml-tei-txm "+f+ " >> "+f.getName()+"-TXM.xml")
+			File file = f; 
+			String txmfile = f.getName()+"-TXM.xml";
+			
+			def correspType = new HashMap<String,String>()
+			def correspRef = new HashMap<String,String>()
+			//il faut lister les id de tous les respStmt
+			def respId = [];
+			//fait la correspondance entre le respId et le rapport d'execution de l'outil
+			def applications = new HashMap<String,HashMap<String,String>>();	
+			//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[]>();
+			//associe un id d'item avec sa description et son URI
+			def itemsURI = new HashMap<String,HashMap<String,String>>();
+			//informations de respStmt
+			//resps (respId <voir ci-dessus>, [description, person, date])
+			def resps = new HashMap<String,String[]>();
+			//lance le traitement
+			String wordprefix = "w_c_";
+			def builder = new Xml2Ana(file);
+			builder.setCorrespondances(correspRef, correspType);
+			builder.setHeaderInfos(respId,resps, applications, taxonomiesUtilisees, itemsURI)
+			builder.transformFile(rootDir+"txm/",txmfile);
+		}
+		
+		//rename files correctly
+		files = new File(rootDir,"txm").listFiles();
+		for(File file : files)
+		{
+			String txmfile = file.getName();
+			txmfile = txmfile.tokenize(".").get(0);
+			txmfile = txmfile.substring(0, txmfile.length()-1);
+			txmfile += ".xml"
+			file.renameTo(new File(file.getParent(),txmfile));
+		}
+		
+	}
+	
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args)
+	{
+		File[] files = [new File("~/xml/perrault/perrault.xml")];
+		new importer().run(files);
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/perrault/allimport.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/perrault/allimport.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/perrault/allimport.groovy	(revision 258)
@@ -0,0 +1,659 @@
+/**
+ * Main.
+ *
+ * @param args the args
+ */
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2017-01-24 18:11:42 +0100 (Tue, 24 Jan 2017) $
+// $LastChangedRevision: 3400 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer.perrault;
+
+import javax.xml.stream.*
+
+import org.txm.importer.*
+import org.txm.importer.cwb.CwbEncode
+import org.txm.importer.cwb.CwbMakeAll
+import org.txm.importer.filters.*
+import org.txm.scripts.*
+import org.txm.scripts.teitxm.*
+import org.txm.utils.treetagger.TreeTagger
+
+import filters.CutHeader.*
+import filters.FusionHeader.*
+import filters.Tokeniser.*
+
+// TODO: Auto-generated Javadoc
+/**
+ * Split.
+ *
+ * @param file the file
+ * @return the list
+ */
+public static List<File> split(File file)
+{
+	File f  = file;
+	
+	println "split file "+f;
+	String rootDir = f.getParent()+"/";
+	String xslfile = rootDir+"splitcorpus.xsl";
+	String outfile = rootDir+"split_temp.xml";
+	
+	//get the splited file name
+	//String outfilename = new XPathResult(f).getXpathResponse("//TEI/text/body/div/head","");
+	
+	ApplyXsl a = new ApplyXsl(xslfile);
+	//a.SetParam("xpathtag", "//TEI");//coupe //text
+	//a.SetParam("xpathfilename", "/body/div/head");//cherche a partir de //xpathtag
+	a.process(f.getPath(),outfile);
+	
+	new File(outfile).delete();
+	
+	List<File> files = new File(f.getParent(),"split").listFiles();
+}
+
+/**
+ * Run1.
+ *
+ * @param srcfiles the srcfiles
+ */
+public void run1(File[] srcfiles)
+{
+	List<File> files = null;
+	File fullfile;
+	String rootDir ="";
+	ArrayList<String> milestones = new ArrayList<String>();//the tags who you want them to stay milestones
+	milestones.add("tagUsage");
+	milestones.add("pb");
+	milestones.add("lb");
+	
+	for(File f : srcfiles)
+	{
+		files = split(f);
+		rootDir = f.getParent()+"/"
+		fullfile = f;
+		new File(rootDir+"tokenized").deleteDir();
+		new File(rootDir+"tokenized").mkdir();
+		new File(rootDir+"split").deleteDir();
+		new File(rootDir+"split").mkdir();
+		new File(rootDir+"txm").deleteDir();
+		new File(rootDir+"txm").mkdir();
+		
+		String xslfile = rootDir+"splitcorpus.xsl";
+		String infile = f.getPath();
+		String outfile = rootDir+"split_temp.xml";
+		
+		ApplyXsl a = new ApplyXsl(xslfile);
+		a.process(infile,outfile);
+		
+		new File(outfile).delete();
+	}
+	
+	//get header
+	String header =""
+	Reader reader = new FileReader(fullfile);
+	String cline = reader.readLine();
+	while(!cline.trim().contains("<text>"))
+	{
+		header += cline+"\n";
+		cline = reader.readLine();
+	}
+	
+	//put splited into tei file
+	for(File f : files)
+	{
+		File temp = new File(f.getParent(),"temp");
+		Writer writer = new FileWriter(temp)
+		writer.write(header);
+		writer.write("""<text>\n<body>\n""")
+		f.eachLine{String line->
+			if(!line.startsWith("<?xml"))
+				writer.write(line+"\n");
+		}
+		
+		writer.write("""</body>\n</text>\n</TEI>""")
+		writer.close();
+		
+		if (!(f.delete() && temp.renameTo(f))) println "Warning can't rename file "+temp+" to "+f
+	}
+	
+	//PREPARE EACH SPLITED FILE TO BE TOKENIZED
+	println files
+	for(File f : files)
+	{
+		File srcfile = f;
+		File resultfile = new File(rootDir+"tokenized",f.getName()+"-src.xml");
+		println("prepare tokenizer file : "+srcfile+" to : "+resultfile );
+		def builder = new OneTagPerLine(srcfile.toURL(), milestones);
+		builder.process(resultfile);
+	}
+	
+	//TOKENIZE FILES
+	//Manager<Filter> filterManager = new FilterManager(ActionHome);		
+	for(File f : files)
+	{
+		Sequence S = new Sequence();
+		Filter F1 = new CutHeader();
+		Filter F6 = new Tokeniser(f);
+		Filter F11 = new FusionHeader();
+		S.add(F1);
+		S.add(F6);
+		S.add(F11);
+		File infile = new File(rootDir+"tokenized",f.getName()+"-src.xml");
+		File xmlfile = new File(rootDir+"tokenized",f.getName()+"-out.xml");
+		File headerfile = new File(rootDir+"/tokenized/",f.getName()+"header.xml");
+		println("Tokenize "+xmlfile)
+		S.SetInFileAndOutFile(infile.getPath(), xmlfile.getPath());
+		S.setEncodages("UTF-8","UTF-8");
+		Object[] arguments1 = [headerfile.getAbsolutePath()];
+		F1.SetUsedParam(arguments1);
+		Object[] arguments2 = [headerfile.getAbsolutePath(),F1];
+		F11.SetUsedParam(arguments2);
+		S.proceed();
+		S.clean();
+		infile.delete();//remove the prepared file to clean
+		headerfile.delete();//remove the prepared file to clean
+	}
+	files = new File(rootDir,"tokenized").listFiles()	
+	
+	
+	//TRANSFORM INTO XML-TEI-TXM
+	for(File f : files)
+	{
+		//ArrayList<String> milestones = new ArrayList<String>();
+		println("build xml-tei-txm "+f+ " >> "+f.getName()+"-TXM.xml")
+		File file = f; 
+		String txmfile = f.getName()+"-TXM.xml";
+		
+		def correspType = new HashMap<String,String>()
+		def correspRef = new HashMap<String,String>()
+		//il faut lister les id de tous les respStmt
+		def respId = [];
+		//fait la correspondance entre le respId et le rapport d'execution de l'outil
+		def applications = new HashMap<String,HashMap<String,String>>();	
+		//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[]>();
+		//associe un id d'item avec sa description et son URI
+		def itemsURI = new HashMap<String,HashMap<String,String>>();
+		//informations de respStmt
+		//resps (respId <voir ci-dessus>, [description, person, date])
+		def resps = new HashMap<String,String[]>();
+		//lance le traitement
+		String wordprefix = "w_c_";
+		def builder = new Xml2Ana(file);
+		builder.setCorrespondances(correspRef, correspType);
+		builder.setHeaderInfos(respId,resps, applications, taxonomiesUtilisees, itemsURI)
+		builder.transformFile(rootDir+"txm/",txmfile);
+	}
+	
+	//rename files correctly
+	files = new File(rootDir,"txm").listFiles();
+	for(File file : files)
+	{
+		String txmfile = file.getName();
+		txmfile = txmfile.tokenize(".").get(0)+".xml"
+		file.renameTo(new File(file.getParent(),txmfile));
+	}
+	
+}
+
+/**
+ * Run2.
+ *
+ * @param rootDirFile the root dir file
+ */
+public void run2(File rootDirFile)
+{
+	String rootDir = rootDirFile.getAbsolutePath()+"/";
+	if(!new File(rootDir,"models").exists() || !new File(rootDir,"txm").exists())
+	{
+		println "no models dir or no txm dir, check rootDir "+rootDirFile;
+		return;
+	}
+	//cleaning
+	new File(rootDir,"annotations").deleteDir();
+	new File(rootDir,"annotations").mkdir();
+	new File(rootDir,"treetagger").deleteDir();
+	new File(rootDir,"treetagger").mkdir();
+	
+	ArrayList<String> milestones = new ArrayList<String>();//the tags who you want them to stay milestones
+	milestones.add("tagUsage");
+	milestones.add("pb");
+	milestones.add("lb");
+	
+	List<File> files = new File(rootDir,"txm").listFiles()	
+	//BUILD TT FILE READY TO BE TAGGED
+	for(File f : files)
+	{
+		File srcfile = f;
+		File resultfile = new File(rootDir+"treetagger/",f.getName()+".tt");
+		new BuildTTSrc(srcfile.toURL()).process(resultfile)
+	}
+	
+	//APPLY TREETAGGER
+	files = new File(rootDir,"treetagger").listFiles()	
+	for(File f : files)
+	{
+		File modelfile = new File(rootDir+"models/","fr.par");
+		File infile = f
+		File outfile = new File(f.getParent(),f.getName()+"-out.tt");
+		println("3- APPLY TT on : "+infile+" with : "+modelfile +" >>  "+outfile);
+		
+		TreeTagger tt = new TreeTagger(System.getProperty("user.home")+"/TXM/treetagger/bin/");
+		tt.settoken();
+		tt.setlemma();
+		tt.setquiet();
+		tt.setsgml();
+		tt.setnounknown();
+		tt.seteostag("<s>");
+		tt.treetagger( modelfile.getAbsolutePath(), infile.getAbsolutePath(), outfile.getAbsolutePath())
+		infile.delete();
+	}
+	
+	//BUILD STAND-OFF FILES
+	//contains txm:application/txm:commandLine
+	File reportFile = new File(rootDir,"NLPToolsParameters.xml");
+	
+	String respPerson = System.getProperty("user.name");
+	String respId = "txm";
+	String respDesc = "NLP annotation tool";
+	String respDate = "";
+	String respWhen = ""
+	
+	String appIdent = "TreeTagger";
+	String appVersion = "3.2";
+	
+	String distributor = "";
+	String publiStmt = """""";
+	String sourceStmt = """""";
+	
+	def types = ["pos","lemme"];
+	def typesTITLE = ["",""];
+	def typesDesc = ["",""];
+	def typesTAGSET = ["",""];
+	def typesWEB = ["",""];
+	String idform ="w_c_";
+	
+	files = new File(rootDir,"treetagger").listFiles()	
+	for(File f : files)
+	{
+		String target = f.getAbsolutePath();
+		File ttfile = f
+		File posfile = new File(rootDir+"annotations/",f.getName()+"-STOFF.xml");
+		
+		def encoding ="UTF-8";
+		def transfo = new CSV2W_ANA();
+		println("build w-interp "+ttfile.getName()+ ">>"+posfile.getName())
+		transfo.setAnnotationTypes( types, typesDesc, typesTAGSET, typesWEB, idform);
+		transfo.setResp(respId, respDesc,respDate, respPerson, respWhen);
+		transfo.setApp(appIdent, appVersion);
+		transfo.setTarget(target, reportFile);
+		transfo.setInfos(distributor,  publiStmt, sourceStmt);
+		transfo.process( ttfile, posfile, encoding );
+	}
+	
+	files = new File(rootDir,"annotations").listFiles();
+	List<File> txmfiles = new File(rootDir,"txm").listFiles();
+	for(int i = 0 ; i< files.size();i++)
+	{
+		File srcfile = txmfiles.get(i);
+		File pos1file = files.get(i);
+		File temp = new File(rootDir,"temp"); 
+		
+		println("5- inject annotation in file : "+srcfile+" with : "+pos1file );
+		
+		def builder = new org.txm.scripts.teitxm.AnnotationInjection(srcfile.toURL(), pos1file.toURL(), milestones);
+		builder.transfomFile(temp.getParent(),temp.getName());
+		
+		if (!(srcfile.delete() && temp.renameTo(srcfile))) println "Warning can't rename file "+temp+" to "+srcfile
+	}
+	
+}
+
+def inputData;
+def factory;
+XMLStreamReader parser;
+def dir;
+def output;
+def url;
+HashMap<String,String> anahash =new HashMap<String,String>() ;
+String text="";
+String base="";
+String project="";
+
+/**
+ * initialize.
+ *
+ * @param url the url
+ * @param text the text
+ * @param base the base
+ * @param project the project
+ */
+public void compil(URL url,String text,String base, String project)
+{
+	this.text = text
+	this.base = base;
+	this.project = project;
+	try {
+		this.url = url;
+		inputData = url.openStream();
+		
+		factory = XMLInputFactory.newInstance();
+		parser = factory.createXMLStreamReader(inputData);
+	} catch (XMLStreamException ex) {
+		System.out.println(ex);
+	}catch (IOException ex) {
+		System.out.println("IOException while parsing ");
+	}
+}
+
+/**
+ * Creates the output.
+ *
+ * @param dirPathName the dir path name
+ * @param fileName the file name
+ * @return true, if successful
+ */
+private boolean createOutput(String dirPathName, String fileName){
+	try {
+		File f = new File(dirPathName, fileName)
+		output = new java.io.FileWriter(f,f.exists())
+		return true;
+	} catch (Exception e) {
+		System.out.println(e.getLocalizedMessage());
+		return false;
+	}
+}
+
+/**
+ * clear anaHash variable, it is used to store ana tags values then print it when the end element </ana> is found.
+ */
+private void fillanaHash()
+{
+	anahash.clear();
+	for(String s : types)
+		anahash.put( s,"-" );
+}
+
+
+/**
+ * Go to text.
+ */
+private void GoToText()
+{
+	for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) 
+	{
+		if(event == XMLStreamConstants.END_ELEMENT)
+			if(parser.getLocalName().equals("teiHeader"))
+				return;
+	}
+}
+
+/**
+ * Transfom file wtc.
+ *
+ * @param dirPathName the dir path name
+ * @param fileName the file name
+ * @return true, if successful
+ */
+public boolean transfomFileWtc(String dirPathName, String fileName)
+{
+	createOutput(dirPathName, fileName);
+	
+	String headvalue=""
+	String vAna = "";
+	String vForm = "";
+	String wordid= "";
+	String vHead = "";
+	
+	int p_id = 0;
+	int q_id = 0;
+	int lg_id = 0;
+	int l_id = 0;
+	
+	boolean flaglg = false;
+	boolean flaghead = false;
+	boolean flagAuthor = false;
+	boolean flagDate = false;
+	boolean flagForm = false;
+	boolean flagAna = false;
+	
+	this.GoToText()
+	
+	try 
+	{
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) 
+		{
+			switch (event) 
+			{
+				case XMLStreamConstants.START_ELEMENT:
+					switch (parser.getLocalName()) 
+					{
+						
+						case "head"://get attr lang
+						flaghead =true;
+						vHead="";
+						break;
+						
+						case "text":
+						output.write("<text id=\""+text+"\" base=\""+base+"\" project=\""+project+"\">\n");
+						break;
+						
+						case "p":
+						output.write("<"+parser.getLocalName()+" id=\""+text+"_p_"+(p_id++)+"\">\n");
+						break;
+						case "q":
+						output.write("<"+parser.getLocalName()+" id=\""+text+"_q_"+(q_id++)+"\">\n");
+						break;
+						case "l":
+						output.write("<"+parser.getLocalName()+" id=\""+text+"_l_"+(l_id++)+"\">\n");
+						break;
+						
+						case "lg":
+						flaglg = true;
+						break;
+						
+						case "s":
+						output.write( "<s>\n");
+						break;
+						
+						case "w":
+						for(int i = 0 ; i < parser.getAttributeCount(); i++)
+							if(parser.getAttributeLocalName(i).equals("id"))
+							{	
+								wordid = parser.getAttributeValue(i);
+							}
+						break;
+						case "form":
+						flagForm = true;
+						vForm = "";
+						vAna ="";
+						break;
+						
+						case "ana":
+						flagAna = true;
+						break;
+					}
+					break;
+				
+				case XMLStreamConstants.END_ELEMENT:
+					switch (parser.getLocalName()) 
+					{
+						case "head"://get attr lang
+						flaghead =false;
+						if(flaglg)
+							output.write("<moral id=\""+text+"_moral_"+(lg_id++)+"\" head=\""+vHead+"\">\n");
+						break;
+						
+						case "text":
+						output.write("</text>\n");
+						break;
+						
+						case "p":
+						case "q":
+						case "l":
+						output.write("</"+parser.getLocalName()+">\n");
+						break;
+						
+						case "lg":
+						output.write("</moral>\n");
+						flaglg = false;
+						break;
+						
+						case "s":
+						output.write( "</s>\n");
+						break;
+						
+						case "w":
+						if(!(flaghead && flaglg))
+							if(vAna != null)
+								output.write( vForm +vAna+"\t"+wordid+"\n");
+						vAna = "";
+						vForm = "";
+						break;
+						
+						case "form":
+						flagForm = false;
+						break;
+						
+						case "ana":
+						flagAna = false;
+						break;
+					}
+					break;
+				
+				case XMLStreamConstants.CHARACTERS:
+					if(flagForm)
+						vForm += parser.getText().trim();
+					if(flagAna)
+						vAna += "\t" +parser.getText().trim();
+					if(flaghead && flaglg)
+						vHead += parser.getText().trim();
+					break;
+			}
+		}
+		output.close();
+		parser.close();
+	}
+	catch (XMLStreamException ex) {
+		System.out.println(ex);
+	}
+	catch (IOException ex) {
+		System.out.println("IOException while parsing " + inputData);
+	}
+	
+	return true;
+}
+
+/**
+ * Run3.
+ *
+ * @param files the files
+ * @return true, if successful
+ */
+public boolean run3(List<File> files) 
+{
+	String rootDir ="";
+	if(files.size() > 0)
+		rootDir = files.get(0).getParentFile().getParentFile().getAbsolutePath()+"/";//"~/xml/perrault/";
+	def cwbLoc = org.txm.Toolbox.getParam(org.txm.Toolbox.CQI_SERVER_PATH_TO_CQPLIB)+File.separator;
+	
+	if(!new File(cwbLoc).exists())
+	{
+		println ("CWB path error: "+cwbLoc)
+		return false;
+	}
+	if(!new File(rootDir).exists())
+	{
+		println ("binary directory does not exists: "+rootDir)
+		return false;
+	}
+	new File(rootDir+"wtc/","perrault.wtc").delete();//cleaning&preparing
+	new File(rootDir+"wtc/").deleteDir();
+	new File(rootDir+"wtc/").mkdir();
+	new File(rootDir+"registry/").mkdir();
+	
+	String textid="";
+	int counttext =0;
+	//1- Transform into WTC file
+	for(File f : files)
+	{
+		counttext++;
+		if(!f.exists())
+		{
+			println("file "+f+ " does not exists")	
+		}
+		else
+		{	
+			println("process file "+f)
+			compil(f.toURL(),"text"+counttext,"perrault","default");
+			transfomFileWtc(rootDir+"wtc","perrault.wtc");
+		}
+	}
+	
+	//2- Import into CWB
+	def outDir =rootDir;
+	def outDirTxm = rootDir;
+	
+	CwbEncode cwbEn = new CwbEncode();
+	CwbMakeAll cwbMa = new CwbMakeAll();
+	
+	String[] pAttributes = ["id","pos","lemme"];
+	//String[] pAttributes = ["id"];
+	String[] sAttributes = ["text:0+id+base+project","p:0+id","q:0+id","moral:0+head+id","l:0+id"];
+	
+	try
+	{
+		cwbEn.run(cwbLoc + "cwb-encode", outDirTxm + "data/"+"PERRAULT", outDir + "/wtc/"+"perrault.wtc", outDirTxm + "registry/"+"perrault",pAttributes, sAttributes);
+		cwbMa.run(cwbLoc + "cwb-makeall", "PERRAULT", outDirTxm + "registry");
+		
+	} catch (Exception ex) {System.out.println(ex); return false;}
+	
+	System.out.println("Done.") 
+	
+	return true;
+}
+
+////FIN
+println "IMPORTER"
+File[] files = [new File("~/xml/perrault/perrault.xml")];
+run1(files);
+
+println "ANNOTATE"
+File rootDir = new File("~/xml/perrault/");
+run2(rootDir);
+
+println "COMPIL"
+File directory = new File("~/xml/perrault/txm/");
+files = directory.listFiles();
+ArrayList<File> Lfiles = new ArrayList<File>();
+for(File f : files)
+	Lfiles.add f
+run3(Lfiles);
+
+//move registry file to cwb registry dir
+File registryfile = new File("~/xml/perrault/txm/registry/perrault");
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/importer/perrault/perraultLoader.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/perrault/perraultLoader.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/perrault/perraultLoader.groovy	(revision 258)
@@ -0,0 +1,133 @@
+/**
+ * Main.
+ *
+ * @param args the args
+ */
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer.perrault;
+
+import java.io.File;
+import org.txm.importer.perrault.importer;
+import org.txm.importer.perrault.compiler;
+import org.txm.importer.perrault.annotate;
+import org.txm.importer.perrault.pager;
+import org.txm.objects.*;
+import org.txm.*;
+import org.txm.scripts.teitxm.*;
+import org.txm.utils.i18n.*;
+
+// TODO: Auto-generated Javadoc
+/* (non-Javadoc)
+ * @see groovy.lang.Script#run()
+ */
+String userDir = System.getProperty("user.home");
+String rootDir;
+String lang;
+String encoding;
+String model;
+try{rootDir = rootDirBinding;lang=langBinding;encoding=encodingBinding;model=modelBinding;}
+catch(Exception)
+{	println "DEV MODE";//exception means we debug
+	if(!org.txm.Toolbox.isInitialized())
+	{
+		rootDir = userDir+"/xml/perrault/";
+		lang="fr";
+		encoding= "UTF-8"; // not used
+		model="fr";
+		Toolbox.workspace = new Workspace(new File(userDir,"TXM/workspaces/default.xml"));
+		Toolbox.setParam(Toolbox.INSTALL_DIR,new File(userDir,"txminstall"));
+		Toolbox.setParam(Toolbox.TREETAGGER_INSTALL_PATH,new File(userDir,"txminstall/treetagger"));
+		Toolbox.setParam(Toolbox.TREETAGGER_MODELS_PATH,new File(userDir,"txminstall/treetagger/models"));
+		Toolbox.setParam(Toolbox.USER_TXM_HOME, new File(System.getProperty("user.home"),"TXM"));
+	}
+}
+
+String corpusSrc = "perrault.xml";
+
+println "-- IMPORTER - Reading source files"
+File[] files = [new File(rootDir,corpusSrc)];
+new importer().run(files);
+
+println "-- ANNOTATE - Running NLP tools"
+new Annotate().run(new File(rootDir), model+".par");//the files in ./txm
+
+println "-- COMPILING - Building Search Engine indexes"
+files = new File(rootDir,"txm/").listFiles();
+ArrayList<File> Lfiles = new ArrayList<File>();
+for(File f : files)
+	Lfiles.add f
+def c = new compiler()
+//c.setCwbPath("")// for developers
+c.setLang(lang);
+c.run(Lfiles);
+
+//move registry file to cwb registry dir
+File registryfile = new File(rootDir+"/registry","perrault");
+if(registryfile.exists())
+	org.txm.utils.io.FileCopy.copy(registryfile,new File(Toolbox.getParam(Toolbox.USER_TXM_HOME),"registry/perrault"))
+	
+
+Workspace w = org.txm.Toolbox.workspace;
+Project p = w.getProject("default")
+p.removeBase("perrault")
+Base b = p.addBase("perrault");
+b.addDirectory(new File(rootDir,"txm"));
+b.setAttribute("lang", lang)
+b.propagateAttribute("lang")
+
+println "-- EDITION"
+new File(rootDir+"/HTML/").deleteDir()
+new File(rootDir+"/HTML/").mkdir();
+new File(rootDir+"/HTML/default/").mkdir();
+files = new File(rootDir,"txm").listFiles();
+
+for(String textname : b.getTextsID())
+{
+	Text text = b .getText(textname);
+	File srcfile = text.getSource();
+	File resultfile = new File(rootDir+"/HTML",srcfile.getName().substring(0,srcfile.getName().length()-4)+".html");
+	List<String> NoSpaceBefore = LangFormater.getNoSpaceBefore(lang);
+	List<String> NoSpaceAfter = LangFormater.getNoSpaceAfter(lang);
+	println("Building edition  : "+srcfile+" to : "+resultfile );
+	
+	def ed = new pager(srcfile,resultfile, NoSpaceBefore, NoSpaceAfter,600);
+	Edition editionweb = text.addEdition("default","web",resultfile);
+	//println("pages "+ed.getPageFiles())
+	//println("idx "+ed.getIdx())
+	for(int i = 0 ; i < ed.getPageFiles().size();i++)
+	{
+		File f = ed.getPageFiles().get(i);
+		String idx = ed.getIdx().get(i);
+		editionweb.addPage(f,idx);
+	}
+	
+//	Edition editionbp = text.addEdition("bp","integral",resultfile);
+//	editionbp.addPage(resultfile,ed.getIdx().get(0));
+}
+
Index: tmp/org.txm.core/src/groovy/org/txm/importer/perrault/annotate.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/perrault/annotate.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/perrault/annotate.groovy	(revision 258)
@@ -0,0 +1,176 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-11-08 13:38:06 +0100 (ven., 08 nov. 2013) $
+// $LastChangedRevision: 2569 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer.perrault
+
+import org.txm.importer.*;
+import org.txm.scripts.*;
+import org.txm.importer.cwb.CwbEncode
+import org.txm.importer.cwb.CwbMakeAll
+import org.txm.scripts.teitxm.BuildTTSrc;
+import org.txm.scripts.teitxm.*;
+import org.txm.utils.treetagger.TreeTagger;
+import org.txm.Toolbox;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class annotate.
+ */
+class annotate {
+	
+	/**
+	 * Run.
+	 *
+	 * @param rootDirFile the root dir file
+	 */
+	public static void run(File rootDirFile)
+	{
+		String rootDir = rootDirFile.getAbsolutePath()+"/";
+
+		//cleaning
+		new File(rootDir,"annotations").deleteDir();
+		new File(rootDir,"annotations").mkdir();
+		new File(rootDir,"treetagger").deleteDir();
+		new File(rootDir,"treetagger").mkdir();
+		
+		ArrayList<String> milestones = new ArrayList<String>();//the tags who you want them to stay milestones
+		milestones.add("tagUsage");
+		milestones.add("pb");
+		milestones.add("lb");
+		
+		List<File> files = new File(rootDir,"txm").listFiles()	
+		//BUILD TT FILE READY TO BE TAGGED
+		for(File f : files)
+		{
+			File srcfile = f;
+			File resultfile = new File(rootDir+"treetagger/",f.getName()+".tt");
+			new BuildTTSrc(srcfile.toURL()).process(resultfile)
+		}
+		
+		//APPLY TREETAGGER
+		files = new File(rootDir,"treetagger").listFiles()	
+		for(File f : files)
+		{
+			File modelfile = new File(Toolbox.getParam(Toolbox.TREETAGGER_MODELS_PATH),"/fr.par");
+			if(!modelfile.exists())
+			{
+				println "Skipping ANNOTATE: Incorrect modelfile path: "+modelfile;
+				return;
+			}
+			File infile = f
+			File outfile = new File(f.getParent(),f.getName()+"-out.tt");
+			println("3- APPLY TT on : "+infile+" with : "+modelfile +" >>  "+outfile);
+			
+			if(!new File(Toolbox.getParam(Toolbox.TREETAGGER_INSTALL_PATH)+"/bin/").exists())
+			{
+				println("Path to TreeTagger is wrong "+Toolbox.getParam(Toolbox.TREETAGGER_INSTALL_PATH)+"/bin/")
+				return;
+			}
+			TreeTagger tt = new TreeTagger(Toolbox.getParam(Toolbox.TREETAGGER_INSTALL_PATH)+"/bin/");
+			tt.settoken();
+			tt.setlemma();
+			tt.setquiet();
+			tt.setsgml();
+			tt.setnounknown();
+			tt.seteostag("<s>");
+			tt.treetagger( modelfile.getAbsolutePath(), infile.getAbsolutePath(), outfile.getAbsolutePath())
+			infile.delete();
+		}
+		
+		//BUILD STAND-OFF FILES
+		//contains txm:application/txm:commandLine
+		File reportFile = new File(rootDir,"NLPToolsParameters.xml");
+		
+		String respPerson = System.getProperty("user.name");
+		String respId = "txm";
+		String respDesc = "NLP annotation tool";
+		String respDate = "";
+		String respWhen = ""
+		
+		String appIdent = "TreeTagger";
+		String appVersion = "3.2";
+		
+		String distributor = "";
+		String publiStmt = """""";
+		String sourceStmt = """""";
+		
+		def types = ["pos","lemme"];
+		def typesTITLE = ["",""];
+		def typesDesc = ["",""];
+		def typesTAGSET = ["",""];
+		def typesWEB = ["",""];
+		String idform ="w_c_";
+		
+		files = new File(rootDir,"treetagger").listFiles()	
+		for(File f : files)
+		{
+			String target = f.getAbsolutePath();
+			File ttfile = f
+			File posfile = new File(rootDir+"annotations/",f.getName()+"-STOFF.xml");
+			
+			def encoding ="UTF-8";
+			def transfo = new CSV2W_ANA();
+			println("build w-interp "+ttfile.getName()+ ">>"+posfile.getName())
+			transfo.setAnnotationTypes( types, typesDesc, typesTAGSET, typesWEB, idform);
+			transfo.setResp(respId, respDesc,respDate, respPerson, respWhen);
+			transfo.setApp(appIdent, appVersion);
+			transfo.setTarget(target, reportFile);
+			transfo.setInfos(distributor,  publiStmt, sourceStmt);
+			transfo.process( ttfile, posfile, encoding );
+		}
+		
+		files = new File(rootDir,"annotations").listFiles();
+		List<File> txmfiles = new File(rootDir,"txm").listFiles();
+		files.sort();
+		txmfiles.sort();
+		for(int i = 0 ; i< files.size();i++)
+		{
+			File srcfile = txmfiles.get(i);
+			
+			File pos1file = files.get(i);
+			File temp = new File(rootDir,"temp"); 
+
+			println("5- inject annotation in file : "+srcfile+" with : "+pos1file );
+			
+			def builder = new org.txm.scripts.teitxm.AnnotationInjection(srcfile.toURL(), pos1file.toURL(), milestones);
+			builder.transfomFile(temp.getParent(),temp.getName());
+			
+			if (!(srcfile.delete() && temp.renameTo(srcfile))) println "Warning can't rename file "+temp+" to "+srcfile
+		}
+	}
+	
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args)
+	{
+		File rootDir = new File("~/xml/perrault/");
+		new annotate().run(rootDir);
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/perrault/compiler.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/perrault/compiler.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/perrault/compiler.groovy	(revision 258)
@@ -0,0 +1,413 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2017-01-24 18:11:42 +0100 (Tue, 24 Jan 2017) $
+// $LastChangedRevision: 3400 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer.perrault
+
+import org.txm.importer.cwb.CwbEncode
+import org.txm.importer.cwb.CwbMakeAll
+import org.txm.importer.*;
+import org.txm.scripts.*;
+import org.txm.scripts.teitxm.BuildTTSrc;
+import org.txm.scripts.teitxm.*;
+import org.txm.utils.treetagger.TreeTagger;
+
+import javax.xml.stream.*;
+import java.net.URL;
+import java.io.File;
+import java.util.HashMap;
+import java.util.List;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class compiler.
+ */
+class compiler 
+{
+	
+	/** The input data. */
+	private def inputData;
+	
+	/** The factory. */
+	private def factory;
+	
+	/** The parser. */
+	private XMLStreamReader parser;
+	
+	/** The dir. */
+	private def dir;
+	
+	/** The output. */
+	private def output;
+	
+	/** The url. */
+	private def url;
+	
+	/** The anahash. */
+	private HashMap<String,String> anahash =new HashMap<String,String>() ;
+	
+	/** The text. */
+	String text="";
+	
+	/** The base. */
+	String base="";
+	
+	/** The project. */
+	String project="";
+	
+	/** The cwb loc. */
+	String cwbLoc;
+	
+	/** The lang. */
+	private String lang ="fr";
+	
+	/**
+	 * initialize.
+	 *
+	 */
+	public compiler(){}
+	
+	/**
+	 * Instantiates a new compiler.
+	 *
+	 * @param url the url
+	 * @param text the text
+	 * @param base the base
+	 * @param project the project
+	 */
+	public compiler(URL url,String text,String base, String project)
+	{
+		this.text = text
+		this.base = base;
+		this.project = project;
+		try {
+			this.url = url;
+			inputData = url.openStream();
+			
+			factory = XMLInputFactory.newInstance();
+			parser = factory.createXMLStreamReader(inputData);
+		} catch (XMLStreamException ex) {
+			System.out.println(ex);
+		}catch (IOException ex) {
+			System.out.println("IOException while parsing ");
+		}
+	}
+	
+	/**
+	 * set the language of the corpus.
+	 *
+	 * @param lang the lang
+	 * @return the java.lang. object
+	 */
+	public setLang(String lang)
+	{
+		this.lang = lang;
+	}
+	
+	/**
+	 * Sets the cwb path.
+	 *
+	 * @param path the new cwb path
+	 */
+	public void setCwbPath(String path)
+	{
+		if(!new File(path).exists())
+			System.err.println("CWB Path : "+path+" does not exists")
+		cwbLoc = path;
+	}
+	
+	/**
+	 * Creates the output.
+	 *
+	 * @param dirPathName the dir path name
+	 * @param fileName the file name
+	 * @return true, if successful
+	 */
+	private boolean createOutput(String dirPathName, String fileName){
+		try {
+			File f = new File(dirPathName, fileName)
+			output = new OutputStreamWriter(new FileOutputStream(f,f.exists()) , "UTF-8");
+			return true;
+		} catch (Exception e) {
+			System.out.println(e.getLocalizedMessage());
+			return false;
+		}
+	}
+	
+	/**
+	 * Go to text.
+	 */
+	private void GoToText()
+	{
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) 
+		{
+			if(event == XMLStreamConstants.END_ELEMENT)
+				if(parser.getLocalName().equals("teiHeader"))
+					return;
+		}
+	}
+	
+	/**
+	 * Transfom file wtc.
+	 *
+	 * @param dirPathName the dir path name
+	 * @param fileName the file name
+	 * @return true, if successful
+	 */
+	public boolean transfomFileWtc(String dirPathName, String fileName)
+	{
+		createOutput(dirPathName, fileName);
+		
+		String headvalue=""
+		String vAna = "";
+		String vForm = "";
+		String wordid= "";
+		String vHead = "";
+		
+		int p_id = 0;
+		int q_id = 0;
+		int lg_id = 0;
+		int l_id = 0;
+		
+		boolean flaglg = false;
+		boolean flaghead = false;
+		boolean flagAuthor = false;
+		boolean flagDate = false;
+		boolean flagForm = false;
+		boolean flagAna = false;
+		
+		this.GoToText()
+		output.write("<txmcorpus lang=\""+lang+"\">\n"); 
+		try 
+		{
+			for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) 
+			{
+				switch (event) 
+				{
+					case XMLStreamConstants.START_ELEMENT:
+					switch (parser.getLocalName()) 
+					{
+						
+						case "head"://get attr lang
+							flaghead =true;
+							vHead="";
+						break;
+												
+						case "text":
+						output.write("<text id=\""+text+"\" base=\""+base+"\" project=\""+project+"\">\n");
+						break;
+						
+						case "p":
+						output.write("<"+parser.getLocalName()+" id=\""+text+"_p_"+(p_id++)+"\">\n");
+						break;
+						case "q":
+						output.write("<"+parser.getLocalName()+" id=\""+text+"_q_"+(q_id++)+"\">\n");
+						break;
+						case "l":
+							output.write("<"+parser.getLocalName()+" id=\""+text+"_l_"+(l_id++)+"\">\n");
+						break;
+						
+						case "lg":
+							flaglg = true;
+						break;
+						
+						case "s":
+						output.write( "<s>\n");
+						break;
+						
+						case "w":
+							for(int i = 0 ; i < parser.getAttributeCount(); i++)
+								if(parser.getAttributeLocalName(i).equals("id"))
+								{	
+									wordid = parser.getAttributeValue(i);
+								}
+						break;
+						case "form":
+						flagForm = true;
+						vForm = "";
+						vAna ="";
+						break;
+						
+						case "ana":
+						flagAna = true;
+						break;
+					}
+					break;
+					
+					case XMLStreamConstants.END_ELEMENT:
+					switch (parser.getLocalName()) 
+					{
+						case "head"://get attr lang
+						flaghead =false;
+						if(flaglg)
+							output.write("<moral id=\""+text+"_moral_"+(lg_id++)+"\" head=\""+vHead+"\">\n");
+						break;
+						
+						case "text":
+						output.write("</text>\n");
+						break;
+						
+						case "p":
+						case "q":
+						case "l":
+						output.write("</"+parser.getLocalName()+">\n");
+						break;
+						
+						case "lg":
+						output.write("</moral>\n");
+						flaglg = false;
+						break;
+						
+						case "s":
+						output.write( "</s>\n");
+						break;
+						
+						case "w":
+						if(!(flaghead && flaglg))
+							if(vAna != null)
+								output.write( vForm +vAna+"\t"+wordid+"\n");
+						vAna = "";
+						vForm = "";
+						break;
+						
+						case "form":
+						flagForm = false;
+						break;
+						
+						case "ana":
+						flagAna = false;
+						break;
+					}
+					break;
+					
+					case XMLStreamConstants.CHARACTERS:
+					if(flagForm)
+					vForm += parser.getText().trim();
+					if(flagAna)
+					vAna += "\t" +parser.getText().trim();
+					if(flaghead && flaglg)
+						vHead += parser.getText().trim();
+					break;
+				}
+			}
+			output.write("</txmcorpus>"); 
+			output.close();
+			parser.close();
+		}
+		catch (XMLStreamException ex) {
+			System.out.println(ex);
+		}
+		catch (IOException ex) {
+			System.out.println("IOException while parsing " + inputData);
+		}
+		
+		return true;
+	}
+	
+	/**
+	 * Run.
+	 *
+	 * @param files the files
+	 * @return true, if successful
+	 */
+	public boolean run(List<File> files) 
+	{
+		String rootDir ="";
+		if(files.size() > 0)
+			rootDir = files.get(0).getParentFile().getParentFile().getAbsolutePath()+"/";//"~/xml/perrault/";
+		if(cwbLoc == null)
+			cwbLoc = org.txm.Toolbox.getParam(org.txm.Toolbox.CQI_SERVER_PATH_TO_CQPLIB)+File.separator;
+		
+		if(!new File(cwbLoc).exists())
+		{
+			println ("CWB path error: "+cwbLoc)
+			return false;
+		}
+		if(!new File(rootDir).exists())
+		{
+			println ("binary directory does not exists: "+rootDir)
+			return false;
+		}
+		new File(rootDir+"wtc/","perrault.wtc").delete();//cleaning&preparing
+		new File(rootDir+"wtc/").deleteDir();
+		new File(rootDir+"wtc/").mkdir();
+		new File(rootDir+"registry/").mkdir();
+		
+		String textid="";
+		int counttext =0;
+		//1- Transform into WTC file
+		for(File f : files)
+		{
+			counttext++;
+			if(!f.exists())
+			{
+				println("file "+f+ " does not exists")	
+			}
+			else
+			{	
+				println("process file "+f)
+				String txtname = f.getName().substring(0,f.getName().length()-4);
+				def builder = new compiler(f.toURL(), txtname, "perrault", "default");
+				builder.setLang(lang);
+				builder.transfomFileWtc(rootDir+"wtc","perrault.wtc");
+			}
+		}
+		
+		//2- Import into CWB
+		def outDir =rootDir;
+		def outDirTxm = rootDir;
+		
+		CwbEncode cwbEn = new CwbEncode();
+		CwbMakeAll cwbMa = new CwbMakeAll();
+		
+		String[] pAttributes = ["pos","lemme","id"];
+		//String[] pAttributes = ["id"];
+		String[] sAttributes = ["txmcorpus:0+lang","text:0+id+base+project","p:0+id","q:0+id","moral:0+head+id","l:0+id"];
+		
+		try
+		{
+			cwbEn.run(cwbLoc + "cwb-encode", outDirTxm + "data", outDir + "/wtc/"+"perrault.wtc", outDirTxm + "registry/"+"perrault",pAttributes, sAttributes);
+			cwbMa.run(cwbLoc + "cwb-makeall", "PERRAULT", outDirTxm + "registry");
+			
+		} catch (Exception ex) {System.out.println(ex); return false;}
+		
+		System.out.println("Done.") 
+		
+		return true;
+	}
+	
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args)
+	{
+		File dir = new File("~/xml/perrault/txm/");
+		List<File> files = dir.listFiles();
+		new compiler().run(files);
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/perrault/package.html
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/perrault/package.html	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/perrault/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Perault import module : teiCorpus</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/org/txm/importer/perrault/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/importer/CsvToXml.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/CsvToXml.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/CsvToXml.groovy	(revision 258)
@@ -0,0 +1,185 @@
+// 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
+// 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.
+//
+//
+//
+// $LastChangedDate: 2015-12-17 12:11:39 +0100 (Thu, 17 Dec 2015) $
+// $LastChangedRevision: 3087 $
+// $LastChangedBy: mdecorde $
+//
+package org.txm.importer
+
+import java.io.FileInputStream
+import java.io.InputStreamReader
+import java.nio.charset.Charset
+import org.txm.utils.*
+
+import javax.xml.stream.*
+import java.net.URL
+
+/**
+ * The Class CsvToXml: allow to convert CSV files to XML files
+ *
+ * @author mdecorde
+ */
+class CsvToXml {
+
+	/** The titles. */
+	File xmlfile
+	List<String> titles = []
+
+	private CsvReader getCSVReader(File csvfile, String fieldSeparator, String encoding) {
+		CsvReader csvreader = new CsvReader(csvfile.getAbsolutePath(), fieldSeparator.charAt(0), Charset.forName(encoding))
+
+		//get titles
+		csvreader.readHeaders()
+		titles = []
+		for (String title : csvreader.getHeaders()) {
+			titles << title
+		}
+
+		if (titles.size() == 0) {
+			println "the CSV file as no column"
+			return null
+		}
+
+		if (titles.contains("text") == 0) {
+			println "the CSV file as no 'text' column"
+			return null
+		}
+
+		if (titles.contains("id") == 0) {
+			println "the CSV file as no 'id' column"
+			return null
+		}
+		
+		return csvreader
+	}
+	
+	/**
+	 * Convert a CSV file to ONE XML file using the first line to declare metadata
+	 *
+	 * @param csvfile the csvfile
+	 * @param outfile the outfile
+	 * @param fieldSeparator the field separator
+	 * @param textSeparator the text separator
+	 * @param encoding the encoding
+	 * @return true, if successful
+	 */
+	public boolean toOneXMLFile(File csvfile, File xmlfile, String fieldSeparator, String textSeparator, String encoding) {
+		CsvReader csvreader = getCSVReader(csvfile, fieldSeparator, encoding)
+		if (csvreader == null) return false
+		
+		println "Metadata properties declared: "+titles
+
+		XMLOutputFactory factory = XMLOutputFactory.newInstance()
+		FileOutputStream output = new FileOutputStream(xmlfile)
+		XMLStreamWriter writer = factory.createXMLStreamWriter(output, "UTF-8")
+
+		writer.writeStartDocument("UTF-8","1.0")
+		writer.writeStartElement("text")
+		while (csvreader.readRecord()) {
+			
+			writer.writeStartElement("div")
+
+			for (int i = 0 ; i < titles.size() ; i++) {
+				if (titles[i] == "text") continue
+				writer.writeAttribute(AsciiUtils.buildId(titles.get(i)), csvreader.get(i))
+			}
+
+			writer.writeCharacters(csvreader.get("text")) // get text content
+			writer.writeEndElement() // div
+		}
+
+		writer.writeEndElement() // text
+		writer.close()
+		output.close()
+		csvreader.close()
+
+		return true;
+	}
+	
+	/**
+	* Convert a CSV file to SEVERAL XML file using the first line to declare metadata
+	*
+	* @param csvfile the csvfile
+	* @param outfile the outfile
+	* @param fieldSeparator the field separator
+	* @param textSeparator the text separator
+	* @param encoding the encoding
+	* @return true, if successful
+	*/
+	public boolean toMultipleXMLFiles(File csvfile, File outDir, String fieldSeparator, String textSeparator, String encoding) {
+		CsvReader csvreader = getCSVReader(csvfile, fieldSeparator, encoding)
+		if (csvreader == null) return false
+		
+		if (!outDir.exists()) outDir.mkdirs()
+		if (!outDir.exists()) {
+			println "Out directory does not exist and could not create it"
+			return false;
+		}
+		
+		while (csvreader.readRecord()) {
+			
+			File xmlfile = new File(outDir, csvreader.get("id")+".xml")
+			
+			XMLOutputFactory factory = XMLOutputFactory.newInstance()
+			FileOutputStream output = new FileOutputStream(xmlfile)
+			XMLStreamWriter writer = factory.createXMLStreamWriter(output, "UTF-8")
+	
+			writer.writeStartDocument("UTF-8","1.0")
+			writer.writeStartElement("text")
+			
+			for (int i = 0 ; i < titles.size() ; i++) {
+				if (titles[i] == "text") continue
+				writer.writeAttribute(AsciiUtils.buildId(titles.get(i)), csvreader.get(i))
+			}
+
+			writer.writeCharacters(csvreader.get("text")) // get text content
+			
+			writer.writeEndElement() //text
+			writer.close()
+			output.close()
+		}
+		return true
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	static public void main(String[] args)
+	{
+		String home = System.getProperty("user.home")
+		File csvfile = new File(home, "xml/csv/test.csv")
+		File outfile = new File(home, "xml/csv/test.xml")
+		File outdir = new File(home, "xml/csv/out")
+
+		String fieldSeparator = "\t"
+		String textSeparator = "" //or "'"
+		CsvToXml builder = new CsvToXml()
+		
+		builder.toMultipleXMLFiles(csvfile, outdir, fieldSeparator, textSeparator, "UTF-8")
+		
+		builder.toOneXMLFile(csvfile, outfile, fieldSeparator, textSeparator, "UTF-8")
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/PartialDomIdentityParser.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/PartialDomIdentityParser.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/PartialDomIdentityParser.groovy	(revision 258)
@@ -0,0 +1,179 @@
+package org.txm.importer
+
+import java.util.ArrayList;
+
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamWriter;
+
+import java.io.File;
+import java.io.Writer;
+import java.net.URL;
+
+import javax.xml.stream.*;
+
+class PartialDomIdentityParser extends StaxIdentityParser {
+	
+	boolean domMode = false;
+	def partialDom = [];
+	def currentNode;
+	
+	public PartialDomIdentityParser(File infile) {
+		super(infile)
+	}
+	
+	protected void processNamespace() {
+		super.processNamespace()
+	}
+	
+	protected void processStartElement()
+	{
+		if (parser.getLocalName() == "test") {
+			println "Build dom..."
+			Tag testTag = new Tag(parser);
+			println testTag.toString()
+			testTag.writeDom(writer)
+		} else {
+			super.processStartElement()
+		}
+	}
+	
+	protected void writeAttributes() {
+		super.writeAttributes();
+	}
+	
+	protected void processCharacters()
+	{
+		super.processCharacters()
+	}
+	
+	protected void processProcessingInstruction()
+	{
+		super.processProcessingInstruction()
+	}
+	
+	protected void processDTD()
+	{
+		super.processDTD()
+	}
+	
+	protected void processCDATA()
+	{
+		super.processCDATA();
+	}
+	
+	protected void processComment()
+	{
+		super.processComment()
+	}
+	
+	protected void processEndElement()
+	{
+		super.processEndElement();
+	}
+	
+	protected void processEndDocument() {
+		super.processEndDocument()
+	}
+	
+	protected void processEntityReference() {
+		super.processEntityReference()
+	}
+	
+	public class Tag {
+		public String[] attnames, attvalues, attprefix;
+		public String localname, prefix
+		int count;
+		public def children = [];
+
+		public Tag(def parser) {
+			prefix = parser.getPrefix()
+			localname = parser.getLocalName();
+			count = parser.getAttributeCount()
+			attnames =  new String[count]
+			attvalues = new String[count]
+			attprefix = new String[count]
+			for (int i = 0 ; i < count ; i++) {
+				attnames[i] = parser.getAttributeLocalName(i)
+				attprefix[i] = parser.getAttributePrefix(i).toString()
+				attvalues[i] = parser.getAttributeValue(i).toString()
+			}
+			buildNodeContent(parser)
+		}
+		
+		private void buildNodeContent(def parser) {
+			try {
+				for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+					//println "event "+event
+					switch (event) {
+						case XMLStreamConstants.START_ELEMENT:
+							children << new Tag(parser);
+							break;
+						case XMLStreamConstants.CHARACTERS:
+							children << parser.getText()
+							break;
+						case XMLStreamConstants.END_ELEMENT:
+							if (localname == parser.getLocalName()) {
+								return; // end of stax parsing, the Tag is built
+							}
+							break;
+						case XMLStreamConstants.END_DOCUMENT:
+							println "ERROR: END OF DOCUMENT REACHED"
+							break;
+					}
+				}
+			} catch(Exception e) {
+				println("Error while parsing partial content of file "+inputurl);
+				println("Location "+parser.getLocation());
+				org.txm.utils.logger.Log.printStackTrace(e);
+				return;
+			}
+		}
+
+		public String toString() {
+			def out = new StringWriter()
+			XMLStreamWriter strwriter = outfactory.createXMLStreamWriter(out);//create a new file
+			println ""+(strwriter != null)
+			writeDom(strwriter);
+			return out.toString()
+		}
+		
+		public writeDom(def writer) {
+			// Open the Tag
+			if (prefix != null && prefix.length() > 0)
+				writer.writeStartElement(prefix+":"+localname)
+			else
+				writer.writeStartElement(localname)
+
+			// write Attributes
+			for (int i = 0 ; i < count ; i++) {
+				if (attprefix[i] != null && attprefix[i].length() > 0) {
+					writer.writeAttribute(attprefix[i]+":"+attnames[i], attvalues[i])
+				} else {
+					writer.writeAttribute(attnames[i], attvalues[i])
+				}
+			}
+			
+			// write children recursivelly
+			for (def child : children) {
+				if (child instanceof String) {
+					writer.writeCharacters(child)
+				} else if (child instanceof Tag) {
+					child.writeDom(writer)
+				} else {
+					println "Error: can't write $child"
+				}
+			}
+			
+			// close the Tag
+			writer.writeEndElement() 
+		}
+	}
+	
+	public static void main(String[] args) {
+		File infile = new File("/home/mdecorde/xml/partialdom/test.xml")
+		File outfile = new File("/home/mdecorde/xml/partialdom/test-o.xml")
+		PartialDomIdentityParser p = new PartialDomIdentityParser(infile);
+		println p.process(outfile)
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/WriteIdAndNAttributesUltraGeneric.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/WriteIdAndNAttributesUltraGeneric.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/WriteIdAndNAttributesUltraGeneric.groovy	(revision 258)
@@ -0,0 +1,141 @@
+package org.txm.importer
+
+class WriteIdAndNAttributesUltraGeneric extends StaxIdentityParser {
+
+	String baseID = ""
+	def rules = [];
+
+	def idCounters = [:]
+	def nCounters = [:]
+	def parentIds = [:]
+	
+	def elements;
+	def elementShortNames
+	def elementParents
+	def elementResets
+	def elementSelection
+	public WriteIdAndNAttributesUltraGeneric(File xmlFile, def elements, def elementSelection, def elementShortNames, def elementParents, def elementResets) {
+		super(xmlFile)
+		
+		this.elements = elements;
+		this.elementSelection = elementSelection
+		this.elementShortNames = elementShortNames;
+		this.elementParents = elementParents
+		this.elementResets = elementResets
+		
+		this.baseID = xmlFile.getName();
+		if (baseID.indexOf(".") > 0) baseID = baseID.substring(0, baseID.indexOf("."))
+		
+		for (String element : elements) {
+			idCounters[element] = 1;
+			nCounters[element] = 1;
+			parentIds[element] = null;
+		}
+	}
+
+	/**
+	 * Special rule to add @corresp=#ref to its reference element to element which @attribute=@value
+	 */
+	public setReferenceRule(String element, String attribute, String value) {
+		this.rules << [element, attribute, value]
+	}
+	
+	protected void writeAttributes() {
+		if (!idCounters.containsKey(localname) ) {
+			super.writeAttributes();
+			return;
+		} 
+		println "write attributes $localname"
+		boolean idFound = false
+		boolean nFound = false
+		
+		
+		for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
+			String name = parser.getAttributeLocalName(i);
+			String value = parser.getAttributeValue(i);
+			
+			println " at $name=$value"
+			
+			//String element_sign = [localname, name, value]
+			
+			if ("id" == name) {
+				if (value == null) {
+					value = getNextID()
+				} 
+				
+				parentIds[localname] = value
+			} else if ("n" == name) {
+				if (value == null) {
+					value = getNextN()
+				} else {
+					nCounters[localname] = Integer.parseInt(value)
+				}
+			}
+			
+			String attrPrefix = parser.getAttributePrefix(i);
+			if (attrPrefix != null && attrPrefix.length() > 0)
+				writer.writeAttribute(attrPrefix+":"+name, value);
+			else
+				writer.writeAttribute(name, value);
+		}
+		
+		if (!idFound) {
+			String value = getNextID()
+			writer.writeAttribute("id", value);
+			parentIds[localname] = value
+		}
+		if (!nFound) {
+			String value = getNextN()
+			writer.writeAttribute("n", value);
+		}
+		
+		
+		idCounters[localname]++
+	}
+	
+	protected void processStartElement() {
+		
+		if (idCounters.containsKey(localname)) {
+			println "Element: "+localname
+			for (String resetElement : elementResets[localname]) {
+				println "reset N: "+resetElement
+				nCounters[resetElement] = 1
+			}
+		}
+		
+		super.processStartElement();
+	}
+	
+	protected String getNextID() {
+		String value = elementShortNames[localname]
+		
+		String parent = elementParents[localname]
+		if (parent != null)
+			value += "_"+parentIds[parent]
+		else
+			value += "_"+baseID
+			
+		value += "-"+idCounters[localname]
+		
+		return value
+	}
+	
+	protected String getNextN() {
+		String value = Integer.toString(nCounters[localname])
+		nCounters[localname]++
+		return value
+	}
+	
+	public static void main(String[] args) {
+		File xmlFile = new File("/home/mdecorde/TEMP/idnmissing.xml")
+		File outFile = new File("/home/mdecorde/TEMP/idnmissing-fix.xml")
+		
+		WriteIdAndNAttributesUltraGeneric wiana = new WriteIdAndNAttributesUltraGeneric(xmlFile, 
+			["milestone", "pb", "cb", "lb"],
+			["milestone":"unit=surface", "pb":null, "cb":null, "lb":null],
+			["milestone":"surf", "pb":"page", "cb":"col", "lb":"line"], 
+			["milestone":null, "pb":null, "cb":"pb", "lb":"cb"],
+			["milestone":[], "pb":["cb", "lb"], "cb":[ "lb"], "lb":[]])
+		println wiana.process(outFile)
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/SplitBy.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/SplitBy.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/SplitBy.groovy	(revision 258)
@@ -0,0 +1,204 @@
+package org.txm.importer
+
+import java.io.Writer;
+import java.io.File;
+import javax.xml.stream.*;
+import java.net.URL;
+import org.txm.importer.filters.*;
+
+class SplitBy 
+{
+	
+	XMLOutputFactory factory = XMLOutputFactory.newInstance();
+	FileOutputStream output;
+	XMLStreamWriter writer;
+	def parser;
+	ArrayList<String> newfiles = [];
+	
+	public SplitBy(File xmlfile)
+	{
+		try {
+			def inputData = xmlfile.toURI().toURL().openStream();
+			def inputFactory = XMLInputFactory.newInstance();
+			parser = inputFactory.createXMLStreamReader(inputData);
+			
+		} catch (XMLStreamException ex) {
+			System.out.println(ex);
+		}catch (IOException ex) {
+			System.out.println("IOException while parsing ");
+		}
+	}
+	boolean inby = false;
+	public boolean process(File outdir, String by, String idAttribute)
+	{
+		outdir.mkdirs();
+		try
+		{
+			for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+				
+				switch(event)
+				{
+					case XMLStreamConstants.START_ELEMENT:
+						if(parser.getLocalName() == by)
+						{
+							
+							inby = true;
+							if(writer != null)
+							{
+								writer.close();
+								output.close();
+							}
+							
+							String filename = "";
+							for(int i = 0 ; i < parser.getAttributeCount(); i++)
+								if(parser.getAttributeLocalName(i) == idAttribute)
+								{
+									filename = parser.getAttributeValue(i);
+									break;
+								}
+							File newfile = new File(outdir,filename+".xml")
+							if(files.contains(newfile))
+							{
+								println "Item declared twice "+filename+" at location "+parser.getLocation();
+								return false;
+							}
+							files.add(newfile);
+							output = new FileOutputStream(newfile)
+							writer = factory.createXMLStreamWriter(output, "UTF-8");//create a new file
+							
+						}
+						if(writer != null)
+						{
+							writeEvent(event);
+							if(parser.getLocalName() == "TEI")
+							{ // write namespaces
+								writer.writeNamespace("tei", "http://www.tei-c.org/ns/1.0")
+								writer.writeNamespace("txm", "http://textometrie.org/1.0")
+							}
+						}
+						break;
+					case XMLStreamConstants.END_ELEMENT:
+						if(inby)
+						{
+							if(writer != null)
+							{
+								writer.writeEndElement();
+							}
+						}
+						if(parser.getLocalName() == by)
+						{
+							inby = false; // write the end element $by before
+						}
+						break;
+					case XMLStreamConstants.CHARACTERS:
+						if(writer != null)
+						{
+							writer.writeCharacters(parser.getText());
+						}
+						break;
+				}
+				
+			}
+			if(writer != null)
+				writer.close();
+			if(output != null)
+				output.close();
+			return true;
+		}
+		catch(Exception e){
+			println "XML Error at location: "+parser.getLocation()
+			e.printStackTrace()
+			if(writer != null)
+				writer.close()
+				output.close()
+				return false
+			}
+	}
+	
+	/**
+	 * write the current event.
+	 *
+	 * @param event the stax event
+	 */
+	private void writeEvent(int event)
+	{
+		def prefix = parser.getPrefix();
+		if (event == XMLStreamConstants.START_ELEMENT ) 
+		{
+			def localname = parser.getLocalName(); // write element
+			if (prefix != null && prefix.length() > 0)
+				writer.writeStartElement(prefix+":"+localname);
+			else
+				writer.writeStartElement(localname);
+			
+			for(int i = 0 ; i < parser.getNamespaceCount() ; i++) //write namespaces
+			{
+				writer.writeNamespace(parser.getNamespacePrefix(i), parser.getNamespaceURI(i));
+			}
+			
+			String attrprefix; // write attributes
+			for (int i = 0 ; i < parser.getAttributeCount() ; i++)
+			{
+				attrprefix = parser.getAttributePrefix(i);
+				if (attrprefix != null & attrprefix.length() > 0)
+					writer.writeAttribute(attrprefix+":"+parser.getAttributeLocalName(i), parser.getAttributeValue(i))
+				else
+					writer.writeAttribute(parser.getAttributeLocalName(i), parser.getAttributeValue(i))
+			}
+			//writer.writeCharacters("\n");
+		}
+		else if (event == XMLStreamConstants.END_ELEMENT)
+		{
+			writer.writeEndElement();
+			//writer.writeCharacters("\n");
+		}
+		else if (event == XMLStreamConstants.CHARACTERS)
+		{
+			writer.writeCharacters(parser.getText());
+		}
+		else if (event == XMLStreamConstants.COMMENT)
+		{
+			writer.writeComment(parser.getText());
+		}
+	}
+	
+	public ArrayList<File> getFiles()
+	{
+		return newfiles;
+	}
+	
+	public static void main(String[] args)
+	{
+		File xmlfile = new File("C:\\Documents and Settings\\mdecorde\\Bureau\\MISAT2011\\corpus\\tiempo\\ELTIEMPO.2002-2010.MIN.xml");
+		File okfile = new File("C:\\Documents and Settings\\mdecorde\\Bureau\\MISAT2011\\corpus\\tiempo\\");
+		File outdir = new File("C:\\Documents and Settings\\mdecorde\\Bureau\\MISAT2011\\corpus\\tiempo\\tiempo");
+		outdir.deleteDir();
+		outdir.mkdir();
+		
+		//		Reader reader = new InputStreamReader(new FileInputStream(xmlfile) , "ISO-8859-1");
+		//		Writer writer = new OutputStreamWriter(new FileOutputStream(okfile) , "UTF-8");
+		//		String line = reader.readLine();
+		//		while(line != null)
+		//		{
+		//			line = line.replaceAll(' ([a-zA-Z0-9]+)="(.*)""', ' $1="$2"')
+		//			writer.write(line+"\n");
+		//			line = reader.readLine();
+		//		}
+		//		reader.close();
+		//		writer.close();
+		//		
+		//		
+		////		if(!ValidateXml.test(okfile))
+		////		{
+		////			println "XML not valid";
+		////			return;
+		////		}
+		
+		def splitter = new SplitBy(xmlfile);
+		if(splitter.process(outdir, "texte", "id"))
+			println "success";
+		else
+			println "failed !"
+		
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/RemoveTag.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/RemoveTag.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/RemoveTag.groovy	(revision 258)
@@ -0,0 +1,119 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+package org.txm.importer;
+
+import javax.xml.parsers.*
+import javax.xml.transform.*
+import javax.xml.transform.dom.DOMSource
+import javax.xml.transform.stream.StreamResult
+import javax.xml.xpath.*
+
+import org.txm.metadatas.*
+import org.txm.utils.*
+import org.w3c.dom.Document
+import org.w3c.dom.Element
+
+/**
+ * Removes tags of XML file given a XPath. 
+ * @author mdecorde
+ *
+ */
+public class RemoveTag {
+	File outfile;
+	
+	/** The doc. */
+	Document doc;
+	
+	/**
+	 *
+	 * @param xmlfile the xmlfile
+	 * @param outfile the outfile
+	 * @param xpath the XPath
+	 */
+	public RemoveTag(File xmlfile, File outfile, String xpath)
+	{
+		this.outfile = outfile;
+		DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
+		domFactory.setNamespaceAware(true); // never forget this!
+		DocumentBuilder builder = domFactory.newDocumentBuilder();
+		doc = builder.parse(xmlfile);
+		
+		def expr = XPathFactory.newInstance().newXPath().compile(xpath);
+		def nodes = expr.evaluate(doc, XPathConstants.NODESET);
+		
+		if (nodes != null)
+		for(def node : nodes)
+		{
+			//println "Remove node "+node
+			Element elem = (Element)node;
+			elem.getParentNode().removeChild(node);
+		}
+		save()
+		doc = null
+	}
+	
+	/**
+	 * Save.
+	 *
+	 * @return true, if successful
+	 */
+	private boolean save()
+	{
+		try {
+			// Création de la source DOM
+			Source source = new DOMSource(doc);
+			
+			// Création du fichier de sortie
+				Writer writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outfile), "UTF-8")); 
+			Result resultat = new StreamResult(writer);
+			
+			// Configuration du transformer
+			TransformerFactory fabrique = new net.sf.saxon.TransformerFactoryImpl();
+			Transformer transformer = fabrique.newTransformer();
+			transformer.setOutputProperty(OutputKeys.METHOD, "xml");
+			transformer.setOutputProperty(OutputKeys.INDENT, "yes"); 
+			transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); 
+			
+			// Transformation
+			transformer.transform(source, resultat);
+			writer.close();
+			return true;
+		} catch (Exception e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+			return false;
+		}
+	}
+	
+	public static void main(String[] args) {
+		RemoveTag rt = new RemoveTag(
+			new File("/home/mdecorde/TXM/corpora/graal/import.xml"),
+			new File("/home/mdecorde/TXM/corpora/graal/import-o.xml"),
+			"//edition[@name='courante']"
+			)
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/ApplyXsl2.java
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/ApplyXsl2.java	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/ApplyXsl2.java	(revision 258)
@@ -0,0 +1,560 @@
+// 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
+// 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.
+
+//
+// This file is part of the TXM platform.
+//
+// The TXM platform is free software: you can redistribute it and/or modif y
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 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/>.
+// 
+// 
+// 
+// $LastChangedDate: 2011-11-03 17:59:23 +0100 (jeu., 03 nov. 2011) $
+// $LastChangedRevision: 2051 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer;
+
+/**
+ * @author mdecorde
+ */
+
+import java.io.BufferedOutputStream;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.logging.Level;
+
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.URIResolver;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import net.sf.saxon.TransformerFactoryImpl;
+
+import org.txm.stat.utils.ConsoleProgressBar;
+import org.txm.utils.Diff;
+import org.txm.utils.io.FileCopy;
+import org.txm.utils.io.IOUtils;
+import org.txm.utils.logger.Log;
+import org.txm.utils.saxon.SaxonNodeSet;
+
+// TODO: Auto-generated Javadoc
+/**
+ * apply a xsl file to a file : use process(File infile, File outfile, String[]
+ * args) to apply the xslt file loaded by the constructor args =
+ * ["name1","value1","name2",value2, ...]
+ * 
+ * @author mdecorde
+ */
+
+public class ApplyXsl2 {
+
+	//	/** The proc. */
+	//	private Processor proc;
+	//	
+	//	/** The comp. */
+	//	private XsltCompiler comp;
+	//	
+	//	/** The exp. */
+	//	private XsltExecutable exp;
+	//
+	//	/** The source. */
+	//	private XdmNode source;
+	//	
+	//	/** The out. */
+	//	private Serializer out;
+	//	
+	//	/** The trans. */
+	//	private XsltTransformer trans;
+
+	net.sf.saxon.TransformerFactoryImpl tFactory;
+	Transformer transformer;
+	private HashMap<String, Object> params = new HashMap<String, Object>();
+	private File xsltfile;
+	boolean debug = false;
+
+	/**
+	 * initialize with the xslt file.
+	 *
+	 * @param xsltfile the xsltfile
+	 * @throws TransformerConfigurationException 
+	 */
+	public ApplyXsl2(String xsltfile) throws TransformerConfigurationException {
+
+		System.setProperty("javax.xml.transform.TransformerFactory", "net.sf.saxon.TransformerFactoryImpl");
+
+		this.xsltfile = new File(xsltfile);
+		tFactory = new TransformerFactoryImpl();
+		transformer = tFactory.newTransformer(new StreamSource(this.xsltfile));
+		
+
+		//Log.info("new tFactory: "+tFactory);
+		//Log.info("new transformer: "+transformer);
+	}
+
+	/**
+	 * initialize with the xslt file.
+	 *
+	 * @param xsltfile the xsltfile
+	 * @throws TransformerConfigurationException 
+	 */
+	public ApplyXsl2(File xsltfile) throws TransformerConfigurationException {
+		this.xsltfile = xsltfile;
+
+		System.setProperty("javax.xml.transform.TransformerFactory", "net.sf.saxon.TransformerFactoryImpl");
+
+		tFactory = new net.sf.saxon.TransformerFactoryImpl();
+		Log.info("new tFactory: "+tFactory);
+		tFactory.getConfiguration().registerExtensionFunction(new SaxonNodeSet());
+		Log.info("ApplyXsl2 from file: "+xsltfile);
+		reload();
+		Log.info("new transformer: "+transformer);
+	}
+
+	/**
+	 * Set a xslt param.
+	 *
+	 * @param name the name
+	 * @param value the value
+	 * @return true, if successful
+	 */
+	public boolean setParams(HashMap<String, String> params) {
+		boolean b = true;
+		for (String k : params.keySet()) b = b & setParam(k, params.get(k));
+		return b;
+	}
+	
+	public void setDebug(boolean d) {
+		this.debug = d;
+	}
+	
+	/**
+	 * Set a xslt param.
+	 *
+	 * @param name the name
+	 * @param value the value
+	 * @return true, if successful
+	 */
+	public boolean setParam(String name, Object value) {
+		if (transformer != null) {
+			transformer.setParameter(name, value);
+			params.put(name, value);
+			return true;
+		} else
+			return false;
+	}
+
+	/**
+	 * Set a xslt param.
+	 *
+	 * @param name the name
+	 * @param value the value
+	 * @return true, if successful
+	 */
+	@Deprecated
+	public boolean SetParam(String name, Object value) {
+		if (transformer != null) {
+			transformer.setParameter(name, value);
+			params.put(name, value);
+			return true;
+		} else
+			return false;
+	}
+	public boolean resetParams() {
+		if (transformer != null) {
+			transformer.reset();
+			params.clear();
+		} else
+			return false;
+		return true;
+	}
+
+	/**
+	 * Force java to clean memory after processing a xslt. If not we might catch
+	 * a JavaHeapspace Exception
+	 * @throws TransformerConfigurationException 
+	 * 
+	 */
+	private void cleanMemory() throws TransformerConfigurationException {
+		reload();
+		for (String name : params.keySet()) { // reload parameters
+			transformer.setParameter(name, params.get(name));
+		}
+	}
+
+	private boolean reload() throws TransformerConfigurationException {
+		//try {
+			transformer = null;
+			transformer = tFactory.newTransformer(new StreamSource(xsltfile));
+//		} catch (TransformerConfigurationException e) {
+//			org.txm.utils.logger.Log.printStackTrace(e);
+//			Log.severe("Error while reloading transformer: "+e);
+//			System.out.println("Error while reloading transformer: "+e);
+//			return false;
+//		}
+		return true;
+	}
+
+	/**
+	 * Process files with xslt args.
+	 *
+	 * @param xmlinfile file to be processed
+	 * @param xmloutfile output file
+	 * @param args xslt args ["arg1","arg1value","arg2","arg2value"...]
+	 * @return true, if successful
+	 * @throws TransformerException 
+	 * @throws FileNotFoundException 
+	 */
+
+	public boolean process(String xmlinfile, String xmloutfile, String[] args) throws Exception {
+		File infile = new File(xmlinfile);
+		File outfile = new File(xmloutfile);
+		
+		//System.out.println(xmlinfile+" Params: "+Arrays.toString(args));
+		for (int i = 0; i < args.length; i = i + 2) {
+			if (!this.setParam(args[i], args[i + 1]))
+				return false;
+		}
+
+		transformer.transform(new StreamSource(xmlinfile), new StreamResult(new BufferedOutputStream(new FileOutputStream(xmloutfile))));
+		cleanMemory(); // save memory
+		// System.out.println("Done");
+		return true;
+	}
+
+	/**
+	 * Process files without xslt args.
+	 *
+	 * @param xmlinfile the xmlinfile
+	 * @param xmloutfile the xmloutfile
+	 * @return true, if successful
+	 * @throws TransformerException 
+	 * @throws IOException 
+	 */
+	public boolean process(File xmlinfile, File xmloutfile) throws TransformerException, IOException {
+		
+		// bufferize result in a String
+		StringWriter strWriter = new StringWriter();
+		StreamResult out = new StreamResult(strWriter);
+		
+		if (debug) {
+			File inputfile_copy = new File("/tmp", xmlinfile.getName());
+			System.out.println("copying inputfile in: "+inputfile_copy.getAbsolutePath());
+			inputfile_copy.delete();
+			FileCopy.copy(xmlinfile, inputfile_copy);
+		}
+
+		transformer.transform(new StreamSource(xmlinfile), out);
+
+		// then write the result in the result file
+		if (xmloutfile != null) {
+			BufferedWriter w = new BufferedWriter(new FileWriter(xmloutfile));
+			w.write(strWriter.toString());
+			w.close();
+			
+			if (debug) {
+				File inputfile_copy = new File("/tmp", xmlinfile.getName());
+				String s = Diff.diffFile(inputfile_copy, xmloutfile);
+				if (s.length() > 0) { // for ultra debug ?
+					System.out.println("Result "+xmlinfile.getName()+" VS "+ xmloutfile.getName()+" diff="+s);
+				} else {
+					System.out.println("Warning: no diff between "+inputfile_copy+" and "+ xmloutfile);
+				}
+			}
+		}
+
+		cleanMemory();
+		return true;
+	}
+
+	/**
+	 * Transform files and select files : nor hidden and nor technical (DTD, XSL, etc.)
+	 * 
+	 * @param xslFile
+	 * @param srcdir
+	 * @param outdir
+	 * @return
+	 * @throws TransformerException
+	 * @throws IOException 
+	 */
+	public static boolean processImportSources(File xslFile, File srcdir, File outdir) throws TransformerException, IOException
+	{
+		HashMap<String, Object> params = new HashMap<String, Object>();
+		return processImportSources(xslFile, srcdir, outdir, params);
+	}
+
+	/**
+	 * Transform files and select files : nor hidden and nor technical (DTD, XSL, etc.)
+	 * 
+	 * @param xslFile
+	 * @param srcdir
+	 * @param outdir
+	 * @param params XSL parameters
+	 * @return
+	 * @throws TransformerException
+	 * @throws IOException 
+	 */
+	public static boolean processImportSources(File xslFile, File srcdir, File outdir, HashMap<String, Object> params) throws TransformerException, IOException
+	{
+		return processImportSources(xslFile, srcdir, outdir, params, false);
+	}
+
+	public static File[] listFiles(File srcdir) {
+		File[] files = srcdir.listFiles(new FileFilter() {
+			@Override
+			public boolean accept(File f) {
+				String name = f.getName();
+				if (f.isHidden() || f.isDirectory()) return false;
+				if (name.endsWith(".properties")) return false;
+				if (name.equals("import.xml")) return false;
+				if (name.endsWith(".csv")) return false;
+				if (name.endsWith(".dtd")) return false;
+				if (name.endsWith(".xsl")) return false;
+				if (name.endsWith("~")) return false;
+				if (name.endsWith(".bak")) return false;
+				if (name.startsWith(".")) return false;
+				return true;
+			}
+		});
+		return files;
+	}
+	
+	/**
+	 * Transform files and select files : nor hidden and nor technical (DTD, XSL, etc.)
+	 * 
+	 * @param xslFile
+	 * @param srcdir
+	 * @param outdir
+	 * @param params XSL parameters
+	 * @return
+	 * @throws TransformerException
+	 * @throws IOException 
+	 */
+	public static boolean processImportSources(File xslFile, File srcdir, File outdir, HashMap<String, Object> params, boolean deleteOutput) throws TransformerException, IOException
+	{
+		outdir.mkdir();
+		if (xslFile.exists()) {
+			ApplyXsl2 builder = new ApplyXsl2(xslFile);
+			boolean debug = Log.getLevel().intValue() < Level.WARNING.intValue();
+			if (debug) {
+				builder.setDebug(true);
+				System.out.println("Debug mode enabled.");
+			}
+			if (!params.containsKey("output-directory"))
+				params.put("output-directory", outdir.getAbsoluteFile().toURI().toString());
+			
+			for (String name : params.keySet())
+				builder.setParam(name, params.get(name));
+			
+			File[] files = listFiles(srcdir); // get files XSL compatible
+			if (files == null) return false;
+			
+			System.out.println("-- Applying "+xslFile+" XSL to "+files.length+" files with parameters: "+params+" on directory "+srcdir+" result written in "+outdir);
+
+			ConsoleProgressBar cpb = new ConsoleProgressBar(files.length);
+			for (File f : files) {
+				String name = f.getName();
+
+				cpb.tick();
+				File outfile = new File(outdir, name);
+				
+				if (!f.getAbsolutePath().equals(outfile.getAbsolutePath()) && f.lastModified() <= outfile.lastModified()) {
+					if (debug) System.out.println("skipped: "+f);
+					continue; // input file is older than output file
+				}
+				
+				if (deleteOutput) outfile = null;
+
+				if (!builder.process(f, outfile)) {
+					System.out.println("Failed to process file "+ f);
+					if (outfile != null) outfile.delete();
+				}
+			}
+			System.out.println("");
+			return true;
+		} else {
+			System.out.println("XSL file does not exists: "+ xslFile);
+		}
+		return false;
+	}
+
+	/**
+	 * Transform files and select files : nor hidden and nor technical (DTD, XSL, etc.)
+	 * 
+	 * Apply one XSL, XML files are replaced 
+	 * 
+	 * @param xslFile
+	 * @param srcdir
+	 * @param outdir
+	 * @param params XSL parameters
+	 * @return
+	 * @throws TransformerException
+	 * @throws IOException 
+	 */
+	public static boolean processImportSources(File xslFile, File[] files, HashMap<String, Object> params) throws TransformerException, IOException
+	{
+		if (xslFile.exists()) {
+			ApplyXsl2 builder = new ApplyXsl2(xslFile);
+			for(String name : params.keySet())
+				builder.setParam(name, params.get(name));
+
+			if (files == null) return false;
+			
+			System.out.println("-- Applying "+xslFile+" XSL to "+files.length+" files with parameters: "+params);
+			
+			ConsoleProgressBar cpb = new ConsoleProgressBar(files.length);
+
+			for (File f : files) {
+				String name = f.getName();
+				if (f.isHidden() || f.isDirectory()) continue;
+				if (name.endsWith(".properties")) continue;
+				if (name.equals("import.xml")) continue;
+				if (name.endsWith(".csv")) continue;
+				if (name.endsWith(".dtd")) continue;
+				if (name.endsWith(".xsl")) continue;
+				if (name.endsWith("~"))	continue;
+				if (name.startsWith(".")) continue;
+				
+				if (!ValidateXml.test(f)) {
+					System.out.println("src file "+f+", is not XML valid");
+					return false;
+				}
+				cpb.tick();
+				
+				if (!builder.process(f, f)) {
+					System.out.println("Failed with file "+ f);
+				}
+			}
+			System.out.println("");
+			return true;
+		} else {
+			System.out.println("XSL file does not exists: "+ xslFile);
+		}
+		return false;
+	}
+
+	/** 
+	 * Apply the XSL listed in the xslDirectory. Files are replaced
+	 * 
+	 * @param filesToProcess
+	 * @param xslDirectory
+	 * @param xslParams
+	 * @return
+	 * @throws TransformerException
+	 * @throws IOException
+	 */
+	public static boolean processWithMultipleXSL(File[] filesToProcess, File xslDirectory, HashMap<String, Object> xslParams) throws TransformerException, IOException {
+		if (xslDirectory.exists()) {
+			File[] xslFiles = xslDirectory.listFiles();
+			Arrays.sort(xslFiles);
+			return processWithMultipleXSL(filesToProcess, xslFiles, xslParams);
+		} else {
+			System.out.println("Nothing to do.");
+		}
+		return true;
+	}
+
+	/** 
+	 * Apply the XSL list. Files are replaced
+	 * 
+	 * @param filesToProcess
+	 * @param xslDirectory
+	 * @param xslParams
+	 * @return
+	 * @throws TransformerException
+	 * @throws IOException
+	 */
+	public static boolean processWithMultipleXSL(File[] filesToProcess, File[] xslFiles, HashMap<String, Object> xslParams) throws TransformerException, IOException {
+
+		Arrays.sort(xslFiles);
+		for (File xslFile : xslFiles) {
+			if (xslFile.isDirectory() || xslFile.isHidden() || !xslFile.getName().endsWith(".xsl")) continue;
+			
+			if (processImportSources(xslFile, filesToProcess, xslParams)) {
+				System.out.println("");
+			} else {
+				return false;
+			}
+		}
+
+		return true;
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 * @throws TransformerException 
+	 * @throws FileNotFoundException 
+	 */
+	public static void main(String[] args) throws Exception {
+		//String xslfile = "/home/mdecorde/TXM/xsl/breakByMilestone.xsl";
+		String xslfile = "G:/Feuilles de style/filtre-frantext-query-export4txm.xsl";
+		File xslFile = new File(xslfile);
+		ApplyXsl2 a = new ApplyXsl2(xslFile);
+
+		//File srcdirectory = new File("/home/mdecorde/TXM/corpora/transcribertest/HTML");
+		File srcdirectory = new File("C:/Documents and Settings/alavrent/xml/applyxsl");
+		assert(srcdirectory.exists());
+		assert(srcdirectory.isDirectory());
+		assert(srcdirectory.canRead());
+		assert(srcdirectory.canExecute());
+
+		File[] files = srcdirectory.listFiles();
+		System.out.println("process : "+srcdirectory+"/*");
+		System.out.println("with : "+xslfile);
+		long bigstart = System.currentTimeMillis();
+		for (File infile : files) {
+			if (infile.canRead() && infile.getName().endsWith(".xml")) {
+				File outfile = new File(infile.getAbsolutePath()+".out.xml");
+				long start = System.currentTimeMillis();
+				System.out.println("Process : "+infile.getName()+ " >> ");
+				//String[] params = {"pbval1",""+1,"pbval2",""+2};
+				a.process(infile,outfile); // no parameters
+				//a.process( infile.getAbsolutePath() ,outfile,params);
+				System.out.println("Done : "+(System.currentTimeMillis()-start)+"ms");
+			}
+		}
+		System.out.println("Total time : "+(System.currentTimeMillis()-bigstart)+"ms");
+	}
+}

Property changes on: tmp/org.txm.core/src/groovy/org/txm/importer/ApplyXsl2.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/importer/Pager.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/Pager.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/Pager.groovy	(revision 258)
@@ -0,0 +1,152 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer
+import java.util.regex.Pattern
+// TODO: Auto-generated Javadoc
+
+/**
+ * The Class Pager.
+ */
+class Pager {
+	
+	//Prototype of generic pager
+	
+	//cut infos
+	
+	/** The cuttag. */
+	String cuttag = "w";// tag to cut, default <w>
+	
+	/** The cutattr. */
+	String cutattr;//attr of cuttag to test
+	
+	/** The cutvaluereg. */
+	Pattern cutvaluereg;// regex value
+	
+	/** The cutnumber. */
+	int cutnumber = 500;// number of cuttag before cutting, default 500 words
+	
+	//xpaths
+	
+	/** The xpaths. */
+	HashMap<String, String> xpaths = new HashMap<String, String>();
+	
+	//tag classes
+	
+	/** The ptags. */
+	public List<String> ptags = ["p", "lg", ];
+	
+	/** The linetags. */
+	public List<String> linetags = ["br", "lb", "l"];
+	
+	/** The dbllinetags. */
+	public List<String> dbllinetags = [];
+	
+	/** The commenttags. */
+	public List<String> commenttags = ["note"];
+	
+	/** The corrtags. */
+	public List<String> corrtags = ["corr"];
+	
+	/** The regtags. */
+	public List<String> regtags = ["reg"];
+	
+	/** The foreigntags. */
+	public List<String> foreigntags = ["foreign"];
+	
+	/**
+	 * Sets the cut infos.
+	 *
+	 * @param tag the tag
+	 * @param attr the attr
+	 * @param valuereg the valuereg
+	 * @param number the number
+	 */
+	public void setCutInfos(String tag, String attr, String valuereg, int number)
+	{
+		if(tag != null && tag.length() > 0)
+			cuttag = tag;
+		
+		try
+		{
+			Pattern p = Pattern.compile(valuereg);
+			cutvaluereg = p;
+		}
+		catch(Exception e){System.err.println("Pager: setCutInfos: Wrong regex syntax");}
+		
+		if(cutattr != null && cutattr.length() > 0)
+			cutattr = attr;
+		
+		if(cutnumber > 0)	
+			cutnumber = number;
+	}
+	
+	/**
+	 * Sets the x paths.
+	 *
+	 * @param xpaths the xpaths
+	 */
+	public void setXPaths(HashMap<String, String> xpaths)
+	{
+		if(xpaths != null)
+			this.xpaths = xpaths
+	}
+	
+	/**
+	 * Adds the x path.
+	 *
+	 * @param name the name
+	 * @param xpath the xpath
+	 */
+	public void addXPath(String name, String xpath)
+	{
+		if(xpath != null && name != null)
+			xpaths.put(name, xpath)
+	}
+	
+	/**
+	 * Run.
+	 *
+	 * @param infile the infile
+	 * @return true, if successful
+	 */
+	public boolean run(File infile)
+	{
+		
+	}
+	
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args)
+	{
+		Pager p = new Pager()
+		p.setCutInfos("w","type", "{[|]@^[|`[{`]@^pon.*", 600);
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/EncodeTEIQuotes.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/EncodeTEIQuotes.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/EncodeTEIQuotes.groovy	(revision 258)
@@ -0,0 +1,457 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStreamReader;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class EncodeTEIQuotes.
+ */
+public class EncodeTEIQuotes
+{
+	
+	/** The name. */
+	def name;
+	
+	/** The initsize. */
+	def initsize;
+	
+	/** The quote. */
+	String quote ="\"";
+	
+	/** The quote_type. */
+	String quote_type= "pon"
+	
+		/**
+		 * Gets the name.
+		 *
+		 * @param node the xml node
+		 * @return the name of the node
+		 */
+	String getName(def node)
+	{
+		def name = node.name();
+		try{name = name.getLocalPart()}catch(Exception e){return name;} // might throw an exception depending on the node class
+		return name;
+	}
+	
+	/**
+	 * method to know if the Node is an element.
+	 *
+	 * @param n the n
+	 * @return true, if is elem
+	 */
+	boolean isElem(def n)
+	{
+		try{ n.name(); return true; }
+		catch(MissingMethodException e){ return false;}
+	}
+	
+	/**
+	 * Contains open quote.
+	 *
+	 * @param selem the node to process
+	 * @return true if the node contains a tag <q> at the beginning
+	 */
+	boolean containsOpenQuote(Node selem)
+	{
+		def children = selem.children()
+		//println "OTS: "+selem.attributes()
+		for(int i = 0 ; i < children.size()-1 ; i++)//on part de la fin jusqu'au 2e w
+		{
+			def child = children.get(i)
+			if(isElem(child))
+			{
+				name = getName(child)
+				if(name == "w" && child.@type != quote_type)
+				{
+					//println "not opening Q"
+					return false;
+				}
+				else if(name == "w" && child.@type == quote_type && child.text().equals(quote))
+				{
+					//println "opening Q"
+					return true;
+				}
+			}
+		}
+		//println "not opening Q"
+		return false;
+	}
+	
+	/**
+	 * Contains close quote.
+	 *
+	 * @param selem the node to process
+	 * @return true if the node contains a tag <q> at the end
+	 */
+	boolean containsCloseQuote(Node selem)
+	{
+		if(selem.w.size() == 0)
+			return false
+		//println "CTS: "+selem.attributes()
+		def children = selem.children()
+		for(int i = children.size()-1 ; i > 0 ; i--)//on part de la fin jusqu'au 2e w
+		{
+			def child = children.get(i)
+			if(isElem(child))
+			{
+				name = getName(child)
+				if(name == "w" && child.@type != quote_type)
+				{
+					//println "not closing Q"
+					return false;
+				}
+				else if(name == "w" && child.@type == quote_type && child.text().equals(quote))
+				{
+					//println "closing Q"
+					return true;
+				}
+			}
+		}
+		return false;
+	}
+	
+	/**
+	 * Next children are words.
+	 *
+	 * @param children the children
+	 * @param index the index
+	 * @return true, if successful
+	 */
+	def boolean nextChildrenAreWords(def children, def index)
+	{
+		//println "at "+children.get(index).attributes()+" test("+children.size()+") "+children
+		for(int i = index ; i < children.size() ; i++)
+		{
+			def nextC = children.get(i)
+			if(isElem(nextC) && getName(nextC) == "w" && nextC.@type != quote_type)
+				return true;
+		}
+		//println "no more words"
+		return false;
+	}
+	
+	/**
+	 * Process containers.
+	 *
+	 * @param root the root
+	 * @param containers the containers
+	 * @return the java.lang. object
+	 */
+	def processContainers(Node root, containers)
+	{
+		int countcontainer = 0;
+		int countinits = 0;
+		int countnews = 0;
+		int countinitquote = 0
+		int quotecount = 0;
+		boolean openq = false;
+		// cut sentences whit a wpon not first nor last
+		int initsizecontainer = root.children().size()
+		//println "process "+initsizecontainer+" elements"
+		for(int k = 0 ; k < initsizecontainer ; k++)
+		{
+			def node = root.children().get(0);
+			root.children().remove(0);
+			//println getName(node)
+			if(isElem(node) && containers.contains(getName(node)))
+			{
+				countcontainer++;
+				Node pelem = node;
+				openq = false;
+				//println "PAB================="
+				int initsize = pelem.children().size()
+				for(int j = 0 ; j < initsize ; j++) // pour chq fils de p
+				{
+					def subnode = pelem.children().get(0);
+					pelem.children().remove(0)
+					//println getName(subnode)
+					if(isElem(subnode) && getName(subnode) == "s") // si c un S
+					{
+						//println "\nS: "+subnode.attributes()
+						def selem = subnode;
+						def newS = pelem.appendNode(selem.name(), selem.attributes())
+						boolean isOpenningQuote = false;
+						if(containsOpenQuote(selem))
+						{
+							isOpenningQuote = true
+							if(openq)
+							{
+								//println "ERROR: unclosed quote before "+selem.@id
+							}
+							openq = false;
+							//println "force openq false"
+						}
+						int tempwponcount = 0
+						for(int i = 0 ; i < selem.children().size() ; i++) // append chacun de ses fils au S courant
+						{
+							def child = selem.children().get(i) // test si == wpon"
+							if(isElem(child) && getName(child) == "w" && child.@type == quote_type && child.text().equals(quote))
+							{
+								countinitquote++
+								//println "Q: "+child.attributes()
+								//println "openq "+openq
+								if(openq)
+								{
+									newS.children().add(child)
+									if(nextChildrenAreWords(selem.children(), i))
+									{                                                                             
+										//println "NEW S"
+										newS = pelem.appendNode(selem.name(), selem.attributes())
+									}
+									//println "set openq false"
+									openq = false;
+								}
+								else
+								{
+									if(tempwponcount != 0)// premier wpon"
+									{
+										//println "pas premier wpon''"
+										if(nextChildrenAreWords(selem.children(), i))// si y'a aut' chose deriere, new S
+										{
+											newS = pelem.appendNode(selem.name(), selem.attributes())
+											//println "NEW S"
+											//println "set openq true"
+											openq = true
+										}
+									}
+									else // tempwponcount == 0
+									{
+										if(!isOpenningQuote)
+										{
+											if(nextChildrenAreWords(selem.children(), i))// si y'a aut' chose deriere, new S
+											{
+												newS = pelem.appendNode(selem.name(), selem.attributes())
+											}
+										}
+										//println "set openq true"
+										openq = true
+									}
+									newS.children().add(child)
+								}
+								tempwponcount++;
+							}
+							else
+							{
+								newS.children().add(child)
+							}
+						}
+					}
+					else
+						pelem.children().add(subnode)
+				}
+			}
+			root.children().add(node)
+		}
+		// A partir d'ici on a que des phrases de la forme :
+		// s q wwww s
+		// s q wwww q s
+		// s wwww q s
+		//println "****"
+		//wrap sentences in q tags
+		initsize = root.children().size()
+		for(int j = 0 ; j < initsize ; j++)
+		{
+			def node = root.children().get(0);
+			root.children().remove(0)
+			if(isElem(node) && containers.contains(getName(node)))
+			{
+				Node pelem = node
+				//println "PPPPPPPP"
+				def newp = root.appendNode(getName(pelem), pelem.attributes());
+				//newp.attribute("test")
+				openq = false;
+				def children = pelem.children()
+				//println children
+				Node qelem;
+				for(Node subnode : children)
+				{
+					if(isElem(subnode) && (getName(subnode) == "s"))
+					{
+						countnews++;
+						//println "ELEM s"
+						Node selem = subnode;
+						if(containsOpenQuote(selem))
+						{
+							// println "openning wpon"
+							if(openq)
+							{
+								// println "ERROR: unclosed quote (found swpon)"
+								//on ferme, et ouvre un new
+								qelem.appendNode("note",[type:"auto"]).setValue("unclosed quote")
+								Map attrs = [:];
+								attrs.put("xml:id",""+(quotecount+1))
+								qelem = newp.appendNode("q", attrs)
+								quotecount++;
+								qelem.appendNode(getName(pelem), selem.attributes(), selem.value());
+								if(containsCloseQuote(selem)) // la phrase étaient bien balisée
+									openq = false;
+							}
+							else
+							{
+								// println "open q + append current s"
+								openq = true;
+								Map attrs = [:];
+								attrs.put("xml:id",""+(quotecount+1))
+								qelem = newp.appendNode("q", attrs)
+								quotecount++;
+								qelem.appendNode(getName(selem), selem.attributes(), selem.value());
+								if(containsCloseQuote(selem)) // la phrase étaient bien balisée
+									openq = false;
+							}
+						}
+						else if(containsCloseQuote(selem))
+						{
+							//println "closing wpon"
+							if(openq)
+							{
+								// println "close q + add dernier s du quote"
+								qelem.appendNode(getName(selem), selem.attributes(), selem.value());
+								openq = false;
+							}
+							else
+							{
+								//println "ERROR: unopened quote"
+								Map attrs = [:];
+								attrs.put("xml:id",""+(quotecount+1))
+								qelem = newp.appendNode("q", attrs)
+								qelem.appendNode(getName(selem), selem.attributes(), selem.value());
+								quotecount++;
+								qelem.appendNode("note",[type:"auto"]).setValue("unopened quote")
+							}
+						}
+						else // no wpon
+						{
+							// println "normal s"
+							if(openq)
+							{
+								// println "append to q"
+								qelem.appendNode(getName(selem), selem.attributes(), selem.value());
+							}
+							else
+							{
+								// println "append to p"
+								newp.appendNode(getName(selem), selem.attributes(), selem.value());
+							}
+						}
+					}
+					else
+					{
+						if(openq)
+						{
+							qelem.children().add(subnode)
+						}
+						else
+						{
+							newp.children().add(subnode)
+						}
+					}
+				}
+				if(openq)// un quote fermé a la fin du P !!
+				{
+					// println "ERROR: unmatched quote"
+					qelem.appendNode("note",[type:"auto"]).setValue("unmatched quote")
+				}
+				//root.children().add(newp)
+			}
+			else
+				root.children().add(node)
+		}
+		//count sentences
+		println "processed "+countcontainer+" "+containers
+		println "initial number of &quot; "+countinitquote;
+		println "created "+(countnews )+" init "+ countinits+" s"
+		println "create "+(quotecount)+" quotes elements"
+	}
+	
+	/**
+	 * Instantiates a new encode tei quotes.
+	 *
+	 * @param nodesToInspect the nodes to inspect
+	 * @param containers the containers
+	 * @param quote_value the quote_value
+	 * @param quote_type the quote_type
+	 */
+	public EncodeTEIQuotes(List<Node> nodesToInspect, containers, String quote_value, String quote_type)
+	{
+		this.quote= quote_value;
+		this.quote_type= quote_type;
+		println "process "+nodesToInspect.size()+" elements with containers "+containers
+		for(groovy.util.slurpersupport.Node root : nodesToInspect)//.body)
+		{
+			println(" root : "+root.children().size())
+			processContainers(root, containers)
+		}
+	}
+	
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args)
+	{
+		List<String> containers = ["p","ab"]; // elements qui contiennent des <s>
+		
+		File infile = new File(System.getProperty("user.home"), "xml/quote/gormont.xml")
+		File outfile = new File(System.getProperty("user.home"), "xml/quote/gormont-q.xml")
+		
+		def doc = new XmlParser().parse (infile)
+		List<Node> nodesToInspect = doc.text.body
+		// nodesToInspect << doc.text.body.div // on en rajoute
+		
+		/*************************/
+		new org.txm.importer.EncodeTEIQuotes(nodesToInspect, containers, "\"", "pon");
+		
+		//copy the doc in "outfile" File  
+		String encoding = "UTF-8"
+		OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(outfile) , encoding);
+		writer.write("<?xml version=\"1.0\" encoding=\""+encoding+"\"?>\n")
+		def pwriter = new PrintWriter(writer, true)
+		XmlNodePrinter xmlwriter = new XmlNodePrinter(pwriter)
+		xmlwriter.setPreserveWhitespace(false)
+		xmlwriter.print(doc)
+		pwriter.close()
+		writer.close()
+		xmlwriter = null
+		//println "write output file "+outfile
+		
+		//update counts
+		if(outfile.exists())
+		{
+			String txtid = org.txm.importer.WordCounter.findTextId(infile, "s"); // retrouve l'id du text qui a été concaténé aux id des S originels (ex : s19_12 >> 19)
+			new org.txm.importer.WordCounter(outfile, "s", txtid);
+			new org.txm.importer.WordCounter(outfile, "q", txtid);
+		}
+	}
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/importer/GetAttributeValue.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/GetAttributeValue.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/GetAttributeValue.groovy	(revision 258)
@@ -0,0 +1,47 @@
+package org.txm.importer
+
+import java.util.HashMap;
+import java.util.ArrayList;
+import java.io.File;
+import javax.xml.stream.*;
+import java.net.URL;
+
+class GetAttributeValue {
+	public static String process(File xmlFile, String path, String attribute) {
+		String value = "N/A";
+		String currentpath = "";
+		boolean done = false;
+		
+		try {
+			URL url = xmlFile.toURI().toURL();
+			def inputData = url.openStream();
+			def factory = XMLInputFactory.newInstance();
+			XMLStreamReader parser = factory.createXMLStreamReader(inputData);
+			for (int event = parser.next(); !done && event != XMLStreamConstants.END_DOCUMENT; event = parser.next())
+			{
+				switch (event) {
+					case XMLStreamConstants.START_ELEMENT:
+						currentpath += "/"+parser.getLocalName();// append the current tag to the current path
+						if (path == currentpath) {
+							for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
+								if (parser.getAttributeName(i) == attribute) {
+									value = parser.getAttributeValue(i)
+									done = true;
+									break;
+								}
+							}
+						}
+						
+						break;
+					case XMLStreamConstants.END_ELEMENT:
+						currentpath = currentpath.substring(0,currentpath.length() -1 - parser.getLocalName().length()) // remove tag from the path
+						break;
+					
+				}
+			}
+			
+		}
+		catch(Exception e){println("File "+xmlFile+"\n"+e); return "N/A";}
+		return value;
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/xtz/Importer.java
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/xtz/Importer.java	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/xtz/Importer.java	(revision 258)
@@ -0,0 +1,24 @@
+package org.txm.importer.xtz;
+
+import java.io.File;
+
+/**
+ * Takes any form of source files
+ * 
+ * After this step, the XML-TXM files are created.
+ * 
+ * they are validated before continuing 
+ * @author mdecorde
+ *
+ */
+public abstract class Importer extends ImportStep {
+
+	public Importer(ImportModule module) {
+		super(module);
+		inputDirectory = module.getSourceDirectory();
+		outputDirectory = new File(module.getBinaryDirectory(), "txm/"+module.getCorpusName());
+		outputDirectory.mkdirs();
+	}
+
+	public abstract void checkFiles();
+}

Property changes on: tmp/org.txm.core/src/groovy/org/txm/importer/xtz/Importer.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/importer/xtz/XTZFacsPagerStep.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/xtz/XTZFacsPagerStep.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/xtz/XTZFacsPagerStep.groovy	(revision 258)
@@ -0,0 +1,351 @@
+package org.txm.importer.xtz
+
+import org.txm.importer.*
+import org.xml.sax.Attributes
+import org.txm.importer.filters.*
+import java.util.ArrayList
+import javax.xml.parsers.*
+import javax.xml.stream.*
+import java.net.URL
+import org.xml.sax.InputSource
+import org.xml.sax.helpers.DefaultHandler
+import java.io.FileFilter
+
+class XTZFacsPagerStep extends Step {
+
+	private def url
+	private def inputData
+	private def factory
+	private XMLStreamReader parser
+	OutputStreamWriter writer
+	StaxStackWriter pagedWriter = null
+
+	File editionDir
+	File imageDirectory // contains all the images sub-diretories
+	int iImages
+	File textImagesDirectory // contains the images for the txtname
+	File xmlFile
+	File htmlFile
+
+	def pages = []
+	def imageAttributes = [:];
+	
+	def tag, attribute, txtname, corpusname
+	boolean firstWord
+	boolean cutBefore = true;
+	String wtag;
+	boolean debug = false;
+
+	public XTZFacsPagerStep(File xmlFile, File editionDir, File imageDirectory, String txtname, String corpusname, String tag, String attribute, String wtag, boolean debug) {
+		inputData = xmlFile.toURI().toURL().openStream()
+		factory = XMLInputFactory.newInstance()
+		parser = factory.createXMLStreamReader(inputData)
+
+		this.xmlFile = xmlFile
+		this.editionDir = editionDir
+		editionDir.mkdirs()
+		this.imageDirectory = imageDirectory
+		this.tag = tag
+		this.attribute = attribute
+		this.txtname = txtname
+		this.corpusname= corpusname
+		this.wtag= wtag;
+		this.debug = debug
+
+		imageAttributes = ["src":"", 
+			"id":"txm_image", 
+			"alt":"Le fac-similé de cette page n'est pas accessible", 
+			//"style":"display:block;width:100%;", 
+			"onLoad":"viewer.toolbarImages='images/icons';viewer.onload=viewer.toolbar;new viewer({image: this, frame: ['100%','100%']});"
+			]
+		
+		if (imageDirectory != null)
+			textImagesDirectory = new File(imageDirectory, txtname)
+		iImages = 0;
+	}
+
+	int n = 1;
+	private boolean createNextOutput() {
+		try {
+			def tags = closeMultiWriter();
+			for (int i = 0 ; i < tags.size() ; i++) {
+				String tag = tags[i]
+				if ("body" != tag) {
+					tags.remove(i--)
+				} else {
+					tags.remove(i--) // remove "body"
+					break; // remove elements until "body tag
+				}
+			}
+
+			if (wordid != null) {//wordid = "w_0";
+				//println " add page $n $wordid, page=$pages"
+				pages << [htmlFile, wordid] // store the previous page
+				n++
+			}
+
+			// Page suivante
+			htmlFile = new File(editionDir, "${txtname}_${n}.html")
+
+			firstWord = true
+			//println "SET FIRST WORD=true"
+			pagedWriter = new StaxStackWriter(htmlFile, "UTF-8");
+			if (debug) println "Create file $htmlFile"
+			pagedWriter.writeStartDocument("UTF-8", "1.0")
+			pagedWriter.writeStartElement("html");
+			pagedWriter.writeStartElement("head");
+			pagedWriter.writeStartElement("title")
+			pagedWriter.writeCharacters(corpusname+" Edition - Page "+n)
+			pagedWriter.writeEndElement(); // </title>
+			pagedWriter.writeStartElement("meta", ["http-equiv":"Content-Type", "content":"text/html","charset":"UTF-8"]);
+			pagedWriter.writeEndElement()
+			pagedWriter.writeStartElement("link", ["rel":"stylesheet", "media":"all", "type":"text/css","href":"txm.css"]);
+			pagedWriter.writeEndElement()
+			pagedWriter.writeStartElement("link", ["rel":"stylesheet", "media":"all", "type":"text/css","href":"${corpusname}.css"]);
+			pagedWriter.writeEndElement()
+			pagedWriter.writeStartElement("script", ["type":"text/javascript", "src":"js/viewer/Simple_Viewer_beta_1.1-min.js"]);
+			pagedWriter.writeEndElement()
+			pagedWriter.writeStartElement("script", ["type":"text/javascript", "src":"js/viewer/toolbar-ext.js"]);
+			pagedWriter.writeEndElement()
+			pagedWriter.writeStartElement("link", ["rel":"stylesheet", "media":"all", "type":"text/css","href":"js/viewer/toolbar-ext.css"]);
+			pagedWriter.writeEndElement()
+			pagedWriter.writeEndElement() // </head>
+			pagedWriter.writeStartElement("body") //<body>
+			pagedWriter.writeStartElement("div", ["id":"txmeditionpage"]);
+			pagedWriter.writeStartElements(tags);
+
+			wordid = "${wtag}_0"; // default value if no word is found
+			return true;
+		} catch (Exception e) {
+			System.out.println("Error while creating HTML file: "+e);
+			return false;
+		}
+	}
+
+	private def closeMultiWriter()
+	{
+		if (pagedWriter != null) {
+			def tags = pagedWriter.getTagStack().clone();
+
+			if (firstWord) { // there was no words
+				pagedWriter.writeCharacters("");
+				pagedWriter.write("<span id=\"${wtag}_0\"/>");
+			}
+			pagedWriter.writeEndElements();
+			pagedWriter.close();
+			return tags;
+		} else {
+			return [];
+		}
+	}
+
+	private writeImg(String src) {
+		
+		
+		if (src == null || src.length() == 0) {
+			pagedWriter.writeStartElement("p", ["class":"no-img"]);
+			pagedWriter.writeCharacters("Cette page n'est pas disponible en mode fac-similé.");
+			pagedWriter.writeEndElement(); // </div>
+		} else {
+			imageAttributes["src"] = src
+			pagedWriter.writeEmptyElement("img", imageAttributes);
+		}
+		
+	}
+
+	/**
+	 * Process the XML-TXM file. if imageDirectory is not null, then it will be use to fetch the images, if not then the pb@facs attribute contains the image path
+	 */
+	public boolean process() {
+		if (textImagesDirectory != null) {
+			return processWithImages();
+		} else {
+			return processWithoutImages();
+		}
+	}
+	
+	String wordid = null;
+	def imagesFiles;
+	public boolean processWithImages() {
+
+		if (!textImagesDirectory.exists()) {
+			println ("No images directory found: "+textImagesDirectory)
+			return false;
+		}
+
+		// Scan textImagesDirectory for images
+		imagesFiles = textImagesDirectory.listFiles(new FileFilter() {
+					public boolean accept(File f) {
+						return !f.isHidden() && !f.isDirectory()
+					}
+				});
+		if (imagesFiles == null || imagesFiles.size() == 0) {
+			println ("No facs images found in "+textImagesDirectory)
+			return false;
+		}
+		imagesFiles.sort(); // sort by name
+		iImages = 0;
+		//println "For text "+xmlFile.getName()
+		//println " using images : $imagesFiles"
+
+		// parse XML-TXM files
+		boolean start = false
+		String localname
+
+		createNextOutput(); // empty page
+
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+			switch (event) {
+				case XMLStreamConstants.START_ELEMENT:
+					localname = parser.getLocalName();
+					switch (localname) {
+						case "text":
+							start = true
+							printStartPage();
+							break;
+							break;
+						case wtag:
+							if (firstWord) {
+								wordid = parser.getAttributeValue(null, "id");
+								//println "found word: $wordid"
+								firstWord = false;
+							}
+							break;
+						case tag:
+							if (debug) println "** TAG $tag $attribute : "+parser.getAttributeValue(null, attribute);
+
+							if (iImages >= imagesFiles.size() ) {
+								println " ERROR Cound not find the $iImages th image for file $xmlFile at location "+parser.getLocation().getLineNumber()
+							} else {
+								String imgPath = "res/images/$corpusname/${editionDir.getName()}/$txtname/"+imagesFiles[iImages].getName()
+								if (imgPath == null) {
+									println " ERROR in $xmlFile no value found for tag=$tag attribute=@$attribute iImages=@iImages at location "+parser.getLocation().getLineNumber()
+								} else {
+									if (cutBefore) {
+										if (debug) println " cut before"
+										createNextOutput()
+										if (debug) println " write img $imgPath"
+										writeImg(imgPath)
+									} else {
+										if (debug) println " write img $imgPath"
+										writeImg(imgPath)
+										if (debug) println " cut after"
+										createNextOutput()
+									}
+								}
+							}
+							iImages++ // next image file
+							break;
+					}
+					break;
+			}
+		}
+		closeMultiWriter()
+		pages << [htmlFile, wordid] // add the last page (no pb encountered
+
+		return pages.size() > 1
+	}
+
+	public boolean processWithoutImages() {
+
+		// parse XML-TXM files
+		boolean start = false
+		String localname
+
+		createNextOutput(); // empty page
+
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+			switch (event) {
+				case XMLStreamConstants.START_ELEMENT:
+					localname = parser.getLocalName();
+					switch (localname) {
+						case "text":
+							start = true
+							printStartPage()
+							break;
+							
+						case wtag:
+							if (firstWord) {
+								wordid = parser.getAttributeValue(null, "id");
+								//println "found word: $wordid"
+								firstWord = false;
+							}
+							break;
+							
+						case tag:
+							String url = "" // get image URL 
+							for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
+								if (parser.getAttributeLocalName(i).equals(attribute)) {
+									url = parser.getAttributeValue(i);
+									continue;
+								}
+							}
+							if (debug) println "** TAG $tag $attribute : $url"
+
+							if (cutBefore) {
+								if (debug) println " cut before"
+								createNextOutput()
+								if (debug) println " write img $url"
+								writeImg(url)
+							} else {
+								if (debug) println " write img $url"
+								writeImg(url)
+								if (debug) println " cut after"
+								url()
+							}
+
+							break;
+					}
+					break;
+			}
+		}
+		closeMultiWriter()
+		pages << [htmlFile, wordid] // add the last page (no pb encountered
+
+		return pages.size() > 1
+	}
+
+	public void printStartPage() {
+		LinkedHashMap attributes = new LinkedHashMap();
+		for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
+			attributes[parser.getAttributeLocalName(i)] = parser.getAttributeValue(i).toString()
+		}
+		pagedWriter.write("\n");
+		pagedWriter.writeStartElement("p")
+		if (attributes.containsKey("id")) {
+			pagedWriter.writeElement("h3", attributes["id"])
+		}
+		
+		pagedWriter.writeStartElement("table");
+		for (String k : attributes.keySet()) {
+			if (k == "id") continue;
+			pagedWriter.writeStartElement("tr");
+			pagedWriter.writeElement("td", k);
+			pagedWriter.writeElement("td", attributes[k]);
+			pagedWriter.writeEndElement();
+		}
+		pagedWriter.writeEndElement() // table
+		pagedWriter.writeEndElement() // p
+		
+		pagedWriter.writeCharacters("");
+	}
+	
+	public def getPageFiles() {
+		return pages
+	}
+	
+	public static void main(String[] args) {
+		File txmFile = new File("/home/mdecorde/TXM/corpora/BVHEPISTEMON2016/txm/BVHEPISTEMON2016/1546_RabelaisTL.xml")
+		String txtname = "1532_RabelaisPrnstctn"
+		String corpusname = "BVH"
+		File newEditionDirectory = new File("/tmp/xtzpagertest/")
+		newEditionDirectory.deleteDir()
+		newEditionDirectory.mkdir()
+		File imageDirectory = null;
+		
+		def ed = new XTZFacsPagerStep(txmFile, newEditionDirectory, imageDirectory, txtname, corpusname, "pb", "facs", "w", true);
+		if (!ed.process()) {
+			println "Fail to build edition for text: $txmFile"
+		}
+	}
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/importer/xtz/ImportKeys.java
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/xtz/ImportKeys.java	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/xtz/ImportKeys.java	(revision 258)
@@ -0,0 +1,16 @@
+package org.txm.importer.xtz;
+
+public class ImportKeys {
+
+	public static final String CLEAN = "clean.directories";
+	public static final String TTMODEL = "annotate.model";
+	public static final String TTANNOTATE = "annotate.run";
+	public static final String LANG = "lang";
+	
+	public static final String MULTITHREAD = "multithread";
+	public static final String DEBUG = "debug";
+	public static final String UPDATECORPUS = "corpus.update";
+	
+	public static final String NORMALISEANAVALUES = "normalize.ana.values";
+	public static final String NORMALISEATTRIBUTEVALUES = "normalize.attribute.values";
+}
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/org/txm/importer/xtz/ImportKeys.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/importer/xtz/ImportStep.java
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/xtz/ImportStep.java	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/xtz/ImportStep.java	(revision 258)
@@ -0,0 +1,54 @@
+package org.txm.importer.xtz;
+
+import java.io.File;
+import java.util.HashMap;
+
+/**
+ * One of the step of an import module
+ * 
+ * @author mdecorde
+ *
+ */
+public abstract class ImportStep {
+
+	protected File inputDirectory, outputDirectory;
+	protected ImportModule module;
+	
+	protected HashMap<String, Object> stepProperties = new HashMap<String, Object>();
+	protected boolean isSuccessFul = false;
+	protected String reason = "not set.";
+	protected boolean stopAtFirstError = true;
+	protected boolean debug = true;
+	
+	public ImportStep(ImportModule module) {
+		this.module = module;
+		debug = module.debug;
+	}
+	
+	public File getInputDirectory() {
+		return inputDirectory;
+	}
+	
+	public File getOutputDirectory() {
+		return outputDirectory;
+	}
+	
+	public ImportModule getImportModule() {
+		return module;
+	}
+	
+	public boolean isSuccessFul() {
+		return isSuccessFul;
+	}
+	
+	public String getReason() {
+		return reason;
+	}
+	
+	/**
+	 * Called when a step is interrupted to clean streams and stuff
+	 */
+	public abstract void cancel();
+	
+	public abstract void process();
+}

Property changes on: tmp/org.txm.core/src/groovy/org/txm/importer/xtz/ImportStep.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/importer/xtz/TTAnnotater.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/xtz/TTAnnotater.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/xtz/TTAnnotater.groovy	(revision 258)
@@ -0,0 +1,56 @@
+package org.txm.importer.xtz
+
+import java.io.File;
+
+import org.txm.scripts.teitxm.Annotate
+
+
+/**
+ * Wraps current Annotate class into the import workflow
+ * 
+ * @author mdecorde
+ *
+ */
+class TTAnnotater extends Annotater {
+
+	Annotate a;
+	
+	public TTAnnotater(ImportModule module) {
+		super(module);
+	}
+
+	@Override
+	public void process() {
+
+		//String model = module.getParameters().get(ImportKeys.TTMODEL);
+		String cleanDirectories = module.getParameters().getKeyValueParameters().get(ImportKeys.CLEAN);
+		
+		String corpusname = module.getParameters().getCorpusName();
+		def corpusElem = module.getParameters().getCorpora().get(corpusname);
+		String lang = corpusElem.getAttribute("lang");
+
+		def hash = [:]
+		for (File txmFile : inputDirectory.listFiles()) {
+			hash[txmFile.getName()] = lang;
+		}
+		
+		a = new Annotate()
+		if (module.isMultiThread()) {
+			isSuccessFul = a.run(module.getBinaryDirectory(), inputDirectory, hash);
+		} else {
+			isSuccessFul = a.run(module.getBinaryDirectory(), inputDirectory, lang+".par");
+		}
+		
+		if ("true".equals(cleanDirectories)) {
+			new File(module.getBinaryDirectory(), "treetagger").deleteDir()
+			new File(module.getBinaryDirectory(), "annotations").deleteDir()
+		}
+		
+		if (!isSuccessFul) reason = "TreeTagger annotation failed."
+	}
+
+	@Override
+	public void cancel() {
+		a.setCancelNow();
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/xtz/XTZPager.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/xtz/XTZPager.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/xtz/XTZPager.groovy	(revision 258)
@@ -0,0 +1,461 @@
+package org.txm.importer.xtz
+
+import java.io.File;
+import java.util.ArrayList;
+
+import org.txm.objects.BaseParameters
+import org.w3c.dom.Element
+import org.txm.importer.*
+import org.txm.stat.utils.ConsoleProgressBar
+import org.txm.utils.BundleUtils;
+import org.txm.utils.i18n.*
+import org.txm.utils.io.FileCopy;
+
+import javax.xml.stream.*
+
+class XTZPager extends Pager {
+
+	BaseParameters params;
+
+	Element corpusElem;
+	String lang;
+	String page_element;
+	String wordTag;
+	int wordsPerPage;
+
+	File cssDirectory, jsDirectory, imagesDirectory;
+
+	public XTZPager(ImportModule module) {
+		super(module, "default");
+
+		params = module.getParameters()
+
+		corpusElem = params.corpora.get(corpusname);
+		lang = corpusElem.getAttribute("lang");
+		wordsPerPage = params.getWordsPerPage("default")
+		page_element = params.getPageElement("default")
+		wordTag = module.getParameters().getWordElement().getTextContent()
+
+		cssDirectory = new File(module.getSourceDirectory(), "css")
+		jsDirectory = new File(module.getSourceDirectory(), "js")
+		imagesDirectory = new File(module.getSourceDirectory(), "images")
+	}
+
+	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;
+
+		isSuccessFul = true;
+		println ""
+	}
+
+	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..."
+
+		def css = ["css/txm.css", "css/${corpusname}.css"] // default CSS inclusion
+
+		// scan existing css files that must be declared in each HTML page
+		if (cssDirectory.exists()) {
+			def cssFiles = cssDirectory.listFiles();
+			if (cssFiles != null)
+				for (File cssFile : cssFiles) {
+					if (cssFile.isFile() && !cssFile.isHidden() && cssFile.getName().endsWith(".css"))
+						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);
+
+			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);
+
+			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))
+				}
+			}
+
+			for (i = 0 ; i < ed.getPageFiles().size();) {
+				File f = ed.getPageFiles().get(i);
+				String wordid = ed.getIdx().get(i);
+				params.addPage(edition, ""+(++i), wordid);
+			}
+		}
+		
+		// copy default TXM css file in the "facs" edition directory
+		File csshtmlDirectory = new File(outputDirectory, "css")
+		csshtmlDirectory.mkdirs()
+		BundleUtils.copyFiles("org.txm.toolbox", "res", "org/txm/css", "txm.css", csshtmlDirectory);
+		
+		// copy CSS files in the "default" edition directory
+		if (cssDirectory.exists()) {
+			FileCopy.copyFiles(cssDirectory, csshtmlDirectory)
+		}
+		if (jsDirectory.exists()) {
+			File jshtmlDirectory = new File(outputDirectory, "js")
+			FileCopy.copyFiles(jsDirectory, jshtmlDirectory)
+		}
+		if (imagesDirectory.exists()) {
+			File imageshtmlDirectory = new File(outputDirectory, "images")
+			FileCopy.copyFiles(imagesDirectory, imageshtmlDirectory)
+		}
+
+		// save changes
+		println ""
+		return true;
+	}
+
+	public boolean doFacsEditionStep() {
+
+		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()) {
+			imageDirectory = null;
+		}
+
+		def second = 0
+
+		println "-- Building 'facs' edition of ${files.size()} texts..."
+		File newEditionDirectory = new File(htmlDirectory, "facs");
+		newEditionDirectory.mkdir();
+
+		// declare the "facs" edition
+		Element editionDefinitionElement = params.getEditionDefinitionElement(corpusElem, "facs");
+		if (editionDefinitionElement == null) {
+			editionDefinitionElement = params.addEditionDefinition(corpusElem, "facs", "groovy", "XTZPager.groovy")
+		}
+		Element textsElement = params.getTextsElement(corpusElem)
+
+		ConsoleProgressBar cpb = new ConsoleProgressBar(files.size())
+		for (File txmFile : files) {
+			cpb.tick()
+			String txtname = txmFile.getName();
+			int i = txtname.lastIndexOf(".");
+			if (i > 0) txtname = txtname.substring(0, i);
+
+			File firstHTMLPageFile = new File(newEditionDirectory, txtname+"_1.html");
+			if (firstHTMLPageFile.exists() && firstHTMLPageFile.lastModified() >= txmFile.lastModified()) continue;
+
+			List<String> NoSpaceBefore = LangFormater.getNoSpaceBefore(lang);
+			List<String> NoSpaceAfter = LangFormater.getNoSpaceAfter(lang);
+
+			// the text should already exists
+			Element text = params.getTextElement(textsElement, txtname)
+			if (text == null) { // just in case
+				text = params.addText(corpusElem, txtname, txmFile)
+			}
+			Element edition = params.getEditionElement(text, "facs");
+			if (edition == null) {
+				edition = params.addEdition(text, "facs", newEditionDirectory.getAbsolutePath(), "html");
+			} else {
+				def children = edition.getChildNodes();
+				while (children.getLength() > 0 ) {
+					edition.removeChild(children.item(0))
+				}
+			}
+
+			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"
+					continue;
+				}
+
+				def pages = ed.getPageFiles()
+				for (i = 0 ; i < pages.size();) {
+					File f = pages[i][0];
+					String wordid = pages[i][1]
+					params.addPage(edition, ""+(++i), wordid);
+					//println "add facs page: $f $wordid"
+				}
+			} catch (Exception e) {
+				println "Error while processing $txmFile text: "+e
+				e.printStackTrace();
+				return false;
+			}
+		}
+
+		if (!imageDirectoryPath.startsWith("http") && imageDirectory != null) { // copy files only if local
+			File editionImagesDirectory = new File(newEditionDirectory, "res/images/"+corpusname+"/facs");
+			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.toolbox", "res", "org/txm/js", "viewer", jshtmlDirectory);
+		BundleUtils.copyFiles("org.txm.toolbox", "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.toolbox", "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)
+		}
+		if (jsDirectory.exists()) {
+			FileCopy.copyFiles(jsDirectory, jshtmlDirectory)
+		}
+		if (imagesDirectory.exists()) {
+			File imageshtmlDirectory = new File(newEditionDirectory, "images")
+			FileCopy.copyFiles(imagesDirectory, imageshtmlDirectory)
+		}
+		
+		Element editionsElement = params.getEditionsElement(corpusElem);
+		editionsElement.setAttribute("default","default,facs");
+
+		println ""
+		return true;
+	}
+
+	/**
+	 * read from $bindir/txm and write the result in $bindir/txm
+	 *
+	 */
+	public boolean doPostEditionXSLStep() {
+
+		File xslDirectory = new File(module.getSourceDirectory(), "xsl/4-edition")
+		if (xslDirectory.exists()) {
+
+			// prepare XSL parameters
+			def xslParams = module.getParameters().getXsltParams(corpusElem);
+			String s = module.getParameters().getWordsPerPage("default");
+			if (s != null && s.length() > 0)
+
+			// 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
+
+			def xslFiles = xslDirectory.listFiles()
+			xslFiles.sort()
+			def editionsCreated = [:]
+			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)
+				else {
+					println "$xslFile is not a '.xsl' file"
+					continue;
+				}
+				int idx3 = xslName.indexOf("-")
+				if (idx3 < 0) {
+					println "$xslFile file does not follow the '{Number}-{editionName}-{step}.xsl' name pattern"
+					continue;
+				}
+				String pagerStep = xslName.substring(idx3 + 1);
+				String editionName = xslName.substring(0, idx3);
+
+				int idx = editionName.indexOf(".")
+				if (idx > 0) editionName = editionName.substring(0, idx);
+				println "-- Building '$editionName' XSL edition with step '$pagerStep'..."
+
+				File newEditionDirectory = new File(htmlDirectory, editionName);
+				xslParams["output-directory"] = newEditionDirectory.toURI().toString()
+
+				if (editionsCreated[editionName] == null) { // first XSL, replace an edition
+					editionsCreated[editionName] = xslFile
+					//if (!importModule.isUpdatingCorpus()) {
+					//TODO: optimisation if update is enable,
+					newEditionDirectory.deleteDir(); // delete previous edition if any
+					//}
+					newEditionDirectory.mkdir()
+
+					boolean deleteOutputFiles = "pager" == pagerStep;
+					if (ApplyXsl2.processImportSources(xslFile, inputDirectory, newEditionDirectory, xslParams, deleteOutputFiles)) {
+						println ""
+					} else {
+						reason = "Fail to apply edition XSL: $xslFile"
+						return false;
+					}
+
+					// copy CSS files in the newEditionDirector edition directory
+					if (cssDirectory.exists()) {
+						File csshtmlDirectory = new File(newEditionDirectory, "css")
+						FileCopy.copyFiles(cssDirectory, csshtmlDirectory)
+					}
+					if (jsDirectory.exists()) {
+						File jshtmlDirectory = new File(newEditionDirectory, "js")
+						FileCopy.copyFiles(jsDirectory, jshtmlDirectory)
+					}
+					if (imagesDirectory.exists()) {
+						File imageshtmlDirectory = new File(newEditionDirectory, "images")
+						FileCopy.copyFiles(imagesDirectory, imageshtmlDirectory)
+					}
+				} else { // N+1 XSL working with HTML files
+					def htmlFiles = newEditionDirectory.listFiles()
+					htmlFiles.sort()
+
+					if (ApplyXsl2.processImportSources(xslFile, htmlFiles, xslParams)) {
+						if ("pager".equals(pagerStep)) {
+							// delete the one page HTML files only if the XSL step is "pager"
+							for (File f : htmlFiles) f.delete();
+						}
+						//	println ""
+					} else {
+						reason = "Fail to apply edition XSL: $xslFile"
+						return false;
+					}
+				}
+			}
+
+			// UPDATE import.xml: for each XML-TXM file, we must retrieve the first word ID from the XSL output files
+			//println "retrieve word ids from $inputDirectory"
+			println "-- Fetching page word IDs..."
+			ConsoleProgressBar cpb = new ConsoleProgressBar(editionsCreated.keySet().size())
+			for (String editionName : editionsCreated.keySet()) {
+				cpb.tick()
+				//ensure edition definition is declared
+				def editionsElement = params.getEditionsElement(corpusElem)
+				def e = params.getEditionDefinitionElement(editionsElement, editionName);
+				if (e == null) {
+					params.addEditionDefinition(corpusElem, editionName, "xsl", editionsCreated[editionName].toString());
+				}
+
+				File newEditionDirectory = new File(htmlDirectory, editionName);
+				File xslFile = editionsCreated[editionName]
+				for (File txmFile : inputDirectory.listFiles()) {
+					if (txmFile.isDirectory()) continue;
+					String textName = txmFile.getName()
+					int idx4 = textName.indexOf(".")
+					if (idx4 > 0) textName = textName.substring(0, idx4);
+
+					getFirstWordIDs(textName, editionName, newEditionDirectory, xslFile);
+				}
+			}
+			println ""
+		}
+		return true;
+	}
+
+	private void getFirstWordIDs(String textName, String editionName, File newEditionDirectory, File xslFile) {
+		//		println "call getFirstWordIDs textName=$textName editionName=$editionName dir=$newEditionDirectory xsl=$xslFile"
+		Element textsElement = params.getTextsElement(corpusElem)
+		Element textElement = params.getTextElement(textsElement, textName)
+		if (textElement == null) { // just in case
+			textElement = params.addText(corpusElem, textName, new File(inputDirectory, textName+".xml"))
+		}
+
+		Element editionElement = params.getEditionElement(textElement, editionName);
+		if (editionElement == null) { // the edition does not exist, declare it
+			editionElement = params.addEdition(textElement, editionName, newEditionDirectory.getAbsolutePath(), "html");
+		} else { // the edition already exists, remove pages from the existing edition
+			def children = editionElement.getChildNodes();
+			while (children.getLength() > 0 ) {
+				editionElement.removeChild(children.item(0))
+			}
+		}
+		editionElement.setAttribute("mode", "xsl");
+		editionElement.setAttribute("script", xslFile.getName());
+
+		LinkedHashMap<File, String> words = new LinkedHashMap<File, String>()
+		def files = []
+		newEditionDirectory.eachFile() {it -> if (it.isFile()) files << it}
+
+		files.sort() { f1, f2 ->
+			String s1 = f1.getName()
+			String s2 = f2.getName()
+			int n1 = Integer.parseInt(s1.substring(s1.lastIndexOf("_")+1, s1.lastIndexOf(".")))
+			int n2 = Integer.parseInt(s2.substring(s2.lastIndexOf("_")+1, s2.lastIndexOf(".")))
+			return n1 - n2;
+		}
+
+		for (File f : files) {
+			String pagename = f.getName();
+			if (pagename.startsWith(textName+"_")) { // this is a page
+				String firstWordID = getMetaContent(f);
+				pagename = pagename.substring((textName+"_").length(), pagename.indexOf(".html")) // !!!!
+				params.addPage(editionElement, pagename, firstWordID)
+			}
+		}
+	}
+
+	public static String getMetaContent(File f) {
+		def inputData = f.toURI().toURL().openStream();
+		def factory = XMLInputFactory.newInstance();
+		factory.setProperty("javax.xml.stream.supportDTD", false); // ignore the DTD declared in doctype
+
+		def parser = factory.createXMLStreamReader(inputData);
+		String META = "meta"
+		String BODY = "body"
+		String NAME = "name"
+		String DESCRIPTION = "txm:first-word-id"
+		String CONTENT = "content"
+
+		String content = "";
+		String desc = "";
+
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+			if (event == XMLStreamConstants.START_ELEMENT) { // start elem
+
+				if (META.equals(parser.getLocalName())) { // ana elem
+					desc = "";
+					// fetch attribute values
+					for (int i = 0 ; i < parser.getAttributeCount(); i++) { // scan attributes
+						if (NAME.equals(parser.getAttributeLocalName(i))) { // found @name
+							desc = parser.getAttributeValue(i)
+						} else if (CONTENT.equals(parser.getAttributeLocalName(i))) { // found @content
+							content = parser.getAttributeValue(i)
+						}
+					}
+					if (DESCRIPTION.equals(desc)) { // stop now
+						break;
+					}
+				} else if (BODY.equals(parser.getLocalName())) { // no need to go further, meta@name="description" not found :(
+					content = "";
+					break;
+				}
+			}
+		}
+		parser.close()
+
+		return content;
+	}
+
+	public static void main(def args) {
+		println "RESULT: "+getMetaContent(new File("/home/mdecorde/TXM/corpora/QGRAALXTZ/HTML/QGRAALXTZ/default", "qgraal_cm_test201510_page_160_2.html"))
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/xtz/XTZDefaultPagerStep.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/xtz/XTZDefaultPagerStep.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/xtz/XTZDefaultPagerStep.groovy	(revision 258)
@@ -0,0 +1,519 @@
+package org.txm.importer.xtz;
+
+import java.io.File;
+import java.io.OutputStreamWriter;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.stream.*;
+
+import org.txm.importer.StaxStackWriter;
+
+public class XTZDefaultPagerStep {
+
+	List<String> NoSpaceBefore;
+
+	/** The No space after. */
+	List<String> NoSpaceAfter;
+
+	/** The wordcount. */
+	int wordcount = 0;
+
+	/** The pagecount. */
+	int pagecount = 0;
+
+	/** The wordmax. */
+	int wordmax = 0;
+
+	/** The basename. */
+	String basename = "";
+	String txtname = "";
+	File outdir;
+
+	/** The wordid. */
+	String wordid;
+
+	/** The first word. */
+	boolean firstWord = true;
+
+	/** The wordvalue. */
+	String wordvalue = "";
+
+	/** The interpvalue. */
+	String interpvalue = "";
+
+	/** The lastword. */
+	String lastword = " ";
+
+	/** The wordtype. */
+	String wordtype;
+
+	/** The flagform. */
+	boolean flagform = false;
+
+	/** The flaginterp. */
+	boolean flaginterp = false;
+
+	/** The url. */
+	private def url;
+
+	/** The input data. */
+	private def inputData;
+
+	/** The factory. */
+	private def factory;
+
+	/** The parser. */
+	private XMLStreamReader parser;
+
+	/** The writer. */
+	OutputStreamWriter writer;
+
+	/** The pagedWriter. */
+	StaxStackWriter pagedWriter = null;
+
+	/** The infile. */
+	File infile;
+
+	/** The outfile. */
+	File outfile;
+
+	/** The pages. */
+	ArrayList<File> pages = new ArrayList<File>();
+
+	/** The idxstart. */
+	ArrayList<String> idxstart = new ArrayList<String>();
+	String paginationElement;
+	def cssList;
+	def wordTag = "w";
+	def noteElements = new HashSet<String>();
+	def outOfTextElements = new HashSet<String>();
+	XTZPager pager;
+
+	/**
+	 * Instantiates a new pager.
+	 *
+	 * @param infile the infile
+	 * @param outfile the outfile
+	 * @param NoSpaceBefore the no space before
+	 * @param NoSpaceAfter the no space after
+	 * @param max the max
+	 * @param basename the basename
+	 */
+	public XTZDefaultPagerStep(XTZPager pager, File infile, String txtname, List<String> NoSpaceBefore,
+	List<String> NoSpaceAfter, def cssList) {
+		this.pager = pager;
+		this.paginationElement = pager.page_element;
+		this.cssList = cssList;
+		this.basename = pager.corpusname;
+		this.txtname = txtname;
+		this.outdir = pager.outputDirectory;
+		this.wordmax = pager.wordsPerPage;
+		this.NoSpaceBefore = NoSpaceBefore;
+		this.NoSpaceAfter = NoSpaceAfter;
+		this.url = infile.toURI().toURL();
+		this.infile = infile;
+		this.wordTag= pager.wordTag;
+		outdir.mkdirs()
+
+		inputData = new BufferedInputStream(url.openStream());
+		factory = XMLInputFactory.newInstance();
+		parser = factory.createXMLStreamReader(inputData);
+		
+		String notesListString = pager.getImportModule().getParameters().getNoteElement().getTextContent()
+		if (notesListString != null) for (def s : notesListString.split(",")) noteElements << s;
+		
+		String elems = pager.getImportModule().getParameters().getOutSideTextTagsAndKeepContentElement().getTextContent()
+		if (elems != null) for (def s : elems.split(",")) outOfTextElements << s;
+		
+		process();
+	}
+
+	private def closeMultiWriter() {
+		if (pagedWriter != null) {
+			def tags = pagedWriter.getTagStack().clone();
+
+			if (firstWord) { // there was no words
+				pagedWriter.writeCharacters("");
+				this.idxstart.add("${wordTag}_0")
+				pagedWriter.write("<span id=\"${wordTag}_0\"/>");
+				//				}
+			}
+			pagedWriter.writeEndElements();
+
+			if (notes.size() > 0) {
+				pagedWriter.writeEmptyElement("hr", ["id":"notes", "width":"20%", "align":"left"]);
+				//pagedWriter.writeStartElement("ol");
+				int i = 1;
+				for (String note : notes) {
+					//pagedWriter.writeStartElement("li");
+					pagedWriter.writeStartElement("a", ["href":"#noteref_"+i, "name":"note_"+i]);
+					pagedWriter.writeStartElement("sup")
+					pagedWriter.writeCharacters(""+i)
+					pagedWriter.writeEndElement() // </sub>
+					pagedWriter.writeEndElement() // </a>
+					pagedWriter.writeCharacters(note)
+					pagedWriter.writeEmptyElement("br")
+					//pagedWriter.writeEndElement() // </li>
+					i++;
+				}
+				//pagedWriter.writeEndElement() // </ol>
+				notes.clear()
+			}
+
+			pagedWriter.close();
+			return tags;
+		} else {
+			return [];
+		}
+	}
+
+	/**
+	 * Creates the next output.
+	 *
+	 * @return true, if successful
+	 */
+	private boolean createNextOutput() {
+		wordcount = 0;
+		try {
+
+			def tags = closeMultiWriter();
+			for (int i = 0 ; i < tags.size() ; i++) {
+				String tag = tags[i]
+				if ("body" != tag) {
+					tags.remove(i--)
+				} else {
+					tags.remove(i--) // remove "body"
+					break; // remove elements until "body tag
+				}
+			}
+			File outfile = new File(outdir, txtname+"_"+(++pagecount)+".html")
+			pages.add(outfile);
+			firstWord = true; // waiting for next word
+
+			pagedWriter = new StaxStackWriter(outfile, "UTF-8");
+
+			pagedWriter.writeStartDocument("UTF-8", "1.0")
+			pagedWriter.writeStartElement("html");
+			pagedWriter.writeEmptyElement("meta", ["http-equiv":"Content-Type", "content":"text/html","charset":"UTF-8"]);
+			for (String css : cssList) {
+				pagedWriter.writeEmptyElement("link", ["rel":"stylesheet", "type":"text/css","href":"$css"]);
+			}
+			pagedWriter.writeStartElement("head");
+			pagedWriter.writeStartElement("title")
+			pagedWriter.writeCharacters(basename.toUpperCase()+" Edition - Page "+pagecount)
+			pagedWriter.writeEndElement(); // </title>
+			pagedWriter.writeEndElement() // </head>
+			pagedWriter.writeStartElement("body") //<body>
+			pagedWriter.writeStartElement("div", ["class": "txmeditionpage"]) //<div>
+			pagedWriter.writeStartElements(tags);
+			return true;
+		} catch (Exception e) {
+			System.out.println(e.getLocalizedMessage());
+			return false;
+		}
+	}
+
+	/**
+	 * Creates the output.
+	 *
+	 * @param outfile the outfile
+	 * @return true, if successful
+	 */
+	private boolean createOutput() {
+		try {
+			return createNextOutput();
+		} catch (Exception e) {
+			System.out.println(e.getLocalizedMessage());
+			return false;
+		}
+	}
+
+	/**
+	 * Gets the page files.
+	 *
+	 * @return the page files
+	 */
+	public ArrayList<File> getPageFiles() {
+		return pages;
+	}
+
+	/**
+	 * Gets the idx.
+	 *
+	 * @return the idx
+	 */
+	public ArrayList<String> getIdx() {
+		return idxstart;
+	}
+
+	/**
+	 * Go to text.
+	 */
+	private void goToText() {
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+			if (event == XMLStreamConstants.END_ELEMENT)
+				if (parser.getLocalName().matches("teiHeader"))
+					return;
+		}
+	}
+
+	def notes = []
+	def currentOutOfTextElements = [] // stack of element with out of text to edit opened element
+	def writeOutOfTextToEditText = false
+	/**
+	 * Process.
+	 */
+	public boolean process() {
+		boolean flagNote = false;
+		String noteContent = "";
+		String rend = ""
+		goToText();
+
+		String localname = "";
+		createNextOutput();
+
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+			rend = "";
+			switch (event) {
+				case XMLStreamConstants.START_ELEMENT:
+					localname = parser.getLocalName();
+					if (outOfTextElements.contains(localname)) {
+						currentOutOfTextElements << localname
+						writeOutOfTextToEditText = true;
+					} else if (currentOutOfTextElements.size() > 0) {
+						currentOutOfTextElements << localname
+					}			
+					
+					rend = parser.getAttributeValue(null, "rend")
+					if (rend == null) rend = "";
+					switch (localname) {
+						case "text":
+							LinkedHashMap attributes = new LinkedHashMap();
+							for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
+								attributes[parser.getAttributeLocalName(i)] = parser.getAttributeValue(i).toString()
+							}
+							pagedWriter.write("\n");
+							pagedWriter.writeStartElement("p")
+							pagedWriter.writeAttribute("class", rend);
+							if (attributes.containsKey("id")) {
+								pagedWriter.writeElement("h3", attributes["id"])
+							}
+
+							pagedWriter.writeStartElement("table");
+							for (String k : attributes.keySet()) {
+								if (k == "id") continue;
+								if (k == "rend") continue;
+
+								pagedWriter.writeStartElement("tr");
+								pagedWriter.writeElement("td", k);
+								pagedWriter.writeElement("td", attributes[k]);
+								pagedWriter.writeEndElement();
+							}
+							pagedWriter.writeEndElement() // table
+							pagedWriter.writeEndElement() // p
+
+							pagedWriter.writeCharacters("");
+							break;
+						case "ref":
+							pagedWriter.writeStartElement("a")
+							pagedWriter.writeAttribute("href", parser.getAttributeValue(null, "target"));
+
+							pagedWriter.writeAttribute("target", "_blank");
+							pagedWriter.writeAttribute("class", rend);
+							break;
+						case "head":
+							pagedWriter.write("\n");
+							pagedWriter.writeStartElement("h2", ["class":rend])
+							break;
+						case "graphic":
+							pagedWriter.write("\n");
+							String url = parser.getAttributeValue(null, "url")
+							if (url != null) {
+								pagedWriter.writeStartElement("center", ["class":rend])
+								pagedWriter.writeEmptyElement("img", ["src":url, "align":"middle"])
+								pagedWriter.writeEndElement() // div
+							}
+							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 = parser.getAttributeValue(null,"type");
+							if ("unordered" == type) {
+								pagedWriter.writeStartElement("ul", ["class":rend])
+							} else {
+								pagedWriter.writeStartElement("ol", ["class":rend])
+							}
+							break
+						case "item":
+							pagedWriter.writeStartElement("li", ["class":rend])
+							break;
+						case "hi":
+						case "emph":
+							if ("i".equals(rend) || "italic".equals(rend)) {
+								pagedWriter.writeStartElement("i", ["class":rend])
+							} else if ("b".equals(rend) || "bold".equals(rend)) {
+								pagedWriter.writeStartElement("b", ["class":rend])
+							} else {
+								if ("emph".equals(localname)) {
+									pagedWriter.writeStartElement("i", ["class":rend])
+								} else { // hi
+									pagedWriter.writeStartElement("b", ["class":rend])
+								}
+							}
+
+							break;
+						case "p":
+							pagedWriter.write("\n");
+							pagedWriter.writeStartElement("p", ["class":rend])
+							break;
+						case paginationElement:
+							createNextOutput();
+							wordcount=0;
+							pagedWriter.write("\n");
+							if (parser.getAttributeValue(null,"n") != null) {
+								pagedWriter.writeElement("p", ["class":"txmeditionpb", "align":"center"], parser.getAttributeValue(null,"n"))
+							}
+							break;
+						case "lb":
+							pagedWriter.writeEmptyElement("br")
+							break;
+						case wordTag:
+							wordid = parser.getAttributeValue(null,"id");
+							if (firstWord) {
+								firstWord = false;
+								this.idxstart.add(wordid);
+							}
+							wordcount++;
+							if (wordcount >= wordmax) {
+								createNextOutput();
+							}
+							break;
+						case "ana":
+							flaginterp=true;
+							interpvalue+=" "+parser.getAttributeValue(null,"type").substring(1)+":"
+							break;
+						case "form":
+							wordvalue="";
+							interpvalue ="";
+							flagform=true;
+							break;
+						default:
+							if (noteElements.contains(localname)) {
+								flagNote = true;
+								noteContent = ""
+							}
+							break;
+					}
+					break;
+				case XMLStreamConstants.END_ELEMENT:
+					localname = parser.getLocalName();
+					if (currentOutOfTextElements.size() > 0) currentOutOfTextElements.pop()
+					writeOutOfTextToEditText = currentOutOfTextElements.size() > 0
+					
+					switch (localname) {
+						case "p":
+							pagedWriter.writeEndElement() // </p>
+							pagedWriter.write("\n");
+							break;
+						case "head":
+							pagedWriter.writeEndElement() // </h2>
+							pagedWriter.write("\n");
+							break;
+						case "list":
+							pagedWriter.writeEndElement(); // ul or ol
+							pagedWriter.write("\n");
+							break
+						case "item":
+							pagedWriter.writeEndElement(); // li
+							pagedWriter.write("\n");
+							break;
+						case "hi":
+							pagedWriter.writeEndElement(); // b
+							break;
+						case "emph":
+							pagedWriter.writeEndElement(); // i
+							break;
+						case "table":
+							pagedWriter.writeEndElement(); // table
+							pagedWriter.write("\n");
+							break;
+						case "row":
+							pagedWriter.writeEndElement(); // tr
+							break;
+						case "cell":
+							pagedWriter.writeEndElement(); // td
+							break;
+						case "ref":
+							pagedWriter.writeEndElement() // </a>
+							break;
+						case "form":
+							flagform = false
+							break;
+						case "ana":
+							flaginterp = false
+							break;
+						case wordTag:
+							int l = lastword.length();
+							String endOfLastWord = "";
+							if (l > 0)
+								endOfLastWord = lastword.subSequence(l-1, l);
+
+							if (interpvalue != null)
+								interpvalue = interpvalue;
+
+							if (NoSpaceBefore.contains(wordvalue) ||
+							NoSpaceAfter.contains(lastword) ||
+							wordvalue.startsWith("-") ||
+							NoSpaceAfter.contains(endOfLastWord)) {
+								pagedWriter.writeStartElement("span", ["title":interpvalue, "id":wordid]);
+							} else {
+								pagedWriter.writeCharacters(" ");
+								pagedWriter.writeStartElement("span", ["title":interpvalue, "id":wordid]);
+							}
+
+							pagedWriter.writeCharacters(wordvalue);
+							pagedWriter.writeEndElement();
+							lastword=wordvalue;
+							break;
+						default:
+							if (noteElements.contains(localname)) {
+								flagNote = false;
+								if (noteContent.length() > 0) {
+									notes << noteContent;
+									pagedWriter.writeStartElement("a", ["href":"#note_"+notes.size(), "name":"noteref_"+notes.size(), "title":noteContent]);
+									pagedWriter.writeStartElement("sup")
+									pagedWriter.writeCharacters(""+notes.size())
+									pagedWriter.writeEndElement() // </sub>
+									pagedWriter.writeEndElement() // </span>
+								}
+							}
+							break;
+					}
+					break;
+				case XMLStreamConstants.CHARACTERS:
+					if (flagform && parser.getText().length() > 0) {
+						wordvalue+=(parser.getText());
+						if (flagNote == parser.getText().length() > 0)
+							noteContent += parser.getText().replace("\n", " ");
+					} else	if (flaginterp && parser.getText().length() > 0) {
+						interpvalue+=(parser.getText());
+					} else if (flagNote == parser.getText().length() > 0) {
+						noteContent += parser.getText().replace("\n", " ");
+					} else if (writeOutOfTextToEditText) {
+						pagedWriter.writeCharacters(parser.getText())
+					}
+					break;
+			}
+		}
+		closeMultiWriter();
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/xtz/Compiler.java
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/xtz/Compiler.java	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/xtz/Compiler.java	(revision 258)
@@ -0,0 +1,61 @@
+package org.txm.importer.xtz;
+
+import java.io.File;
+import java.util.ArrayList;
+
+import org.txm.utils.DeleteDir;
+
+/**
+ * Takes XML-TXM files, build the WTC files and call cwb utils
+ * 
+ * @author mdecorde
+ *
+ */
+public class Compiler extends ImportStep {
+
+	protected File wtcDirectory, registryDirectory, dataDirectory;
+	protected ArrayList<File> files;
+	
+	/**
+	 * Creates the output directories
+	 * 
+	 * @param module
+	 */
+	public Compiler(ImportModule module) {
+		super(module);
+
+		inputDirectory = new File(module.getBinaryDirectory(), "txm/"+module.getCorpusName());
+		wtcDirectory = new File(module.getBinaryDirectory(), "wtc");		
+		outputDirectory = new File(module.getBinaryDirectory(), "data");
+		registryDirectory = new File(module.getBinaryDirectory(), "registry");
+		dataDirectory = new File(outputDirectory, module.getCorpusName());
+
+		DeleteDir.deleteDirectory(outputDirectory);
+		outputDirectory.mkdirs();
+		
+		DeleteDir.deleteDirectory(dataDirectory);
+		dataDirectory.mkdirs();
+		
+		DeleteDir.deleteDirectory(registryDirectory);
+		registryDirectory.mkdirs();
+		
+		if (!module.isUpdatingCorpus()) {
+			DeleteDir.deleteDirectory(wtcDirectory);
+			wtcDirectory.mkdir();
+		}
+	}
+
+	@Override
+	public void cancel() {
+		// TODO Auto-generated method stub
+	}
+
+	@Override
+	public void process() {
+		process(null); // no default files order set
+	}
+	
+	public void process(ArrayList<File> files) {
+		this.files = files;
+	}
+}

Property changes on: tmp/org.txm.core/src/groovy/org/txm/importer/xtz/Compiler.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/importer/xtz/Step.java
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/xtz/Step.java	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/xtz/Step.java	(revision 258)
@@ -0,0 +1,12 @@
+package org.txm.importer.xtz;
+
+public class Step {
+
+	public Step() {
+		// TODO Auto-generated constructor stub
+	}
+
+	public boolean process() {
+		return true;
+	}
+}

Property changes on: tmp/org.txm.core/src/groovy/org/txm/importer/xtz/Step.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/importer/xtz/XTZImporter.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/xtz/XTZImporter.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/xtz/XTZImporter.groovy	(revision 258)
@@ -0,0 +1,444 @@
+package org.txm.importer.xtz
+
+import filters.Tokeniser.SimpleTokenizerXml
+
+import java.io.File;
+
+import net.sf.saxon.style.XSLParam;
+
+import org.txm.importer.ApplyXsl2;
+import org.txm.importer.MileStoneProjection;
+import org.txm.importer.ValidateXml;
+import org.txm.*;
+
+import javax.xml.stream.*;
+
+import org.w3c.dom.Element
+import org.txm.metadatas.Metadatas
+import org.txm.objects.BaseParameters
+import org.txm.scripts.teitxm.Xml2Ana
+import org.txm.stat.utils.ConsoleProgressBar
+import org.txm.utils.*;
+import org.txm.utils.io.FileCopy;
+
+class XTZImporter extends Importer {
+
+	boolean cancelNow = false;
+	def filesToProcess = []
+
+	File frontXSLResultDirectory;
+	File tokenizedDirectory;
+	File sentencedDirectory;
+
+	String xslPath;
+	def xslParams;
+	String lang;
+	String wordTag;
+	boolean skipDoTokenizeStep = false;
+	
+	Metadatas metadata = null; // text metadata
+
+	public XTZImporter(ImportModule module) {
+		super(module);
+	}
+	
+	public Metadatas getMetadata() {
+		return metadata;
+	}
+
+	public void process() {
+
+		BaseParameters params = module.getParameters();
+		File binDir = module.getBinaryDirectory();
+
+		String corpusname = params.getCorpusName();
+		Element corpusElem = params.corpora.get(corpusname);
+
+		def srcFiles = [];
+		def files = inputDirectory.listFiles();
+		if (files == null) {
+			reason = "No file to process in "+inputDirectory
+			return; // no file to process in the directory
+		}
+
+		for (File f : files) {
+			if (f.isHidden() || f.isDirectory())
+				continue;
+			else if (f.getName().endsWith(".properties"))
+				continue;
+			else if (f.getName().equals("import.xml"))
+				continue;
+			else if (f.getName().endsWith(".csv"))
+				continue;
+			else if (f.getName().endsWith(".dtd"))
+				continue;
+			else if (f.getName().endsWith(".xsl"))
+				continue;
+			else if (f.getName().endsWith("~"))
+				continue;
+			else if (f.getName().startsWith("."))
+				continue;
+
+			srcFiles << f
+		}
+
+		if (srcFiles.size() == 0) {
+			reason = "No suitable file to process in "+inputDirectory
+			return; // no file to process in the directory
+		}
+
+		// prepare front XSL if any
+		xslPath = params.getXsltElement(corpusElem).getAttribute("xsl")
+		xslParams = params.getXsltParams(corpusElem);
+
+		lang = corpusElem.getAttribute("lang");
+		
+		wordTag = module.getParameters().getWordElement().getTextContent()
+		this.skipDoTokenizeStep = module.getParameters().getSkipTokenization()
+
+		//prepare metadata if any
+		File allmetadatafile = new File(inputDirectory, "metadata.csv");
+		if (allmetadatafile.exists()) {
+			File copy = new File(binDir, "metadata.csv")
+			if (!FileCopy.copy(allmetadatafile, copy)) {
+				println "Error: could not create a copy of the metadata file "+allmetadatafile.getAbsoluteFile();
+				return;
+			}
+			metadata = new Metadatas(copy,
+					Toolbox.getParam(Toolbox.METADATA_ENCODING),
+					Toolbox.getParam(Toolbox.METADATA_COLSEPARATOR),
+					Toolbox.getParam(Toolbox.METADATA_TXTSEPARATOR), 1)
+		}
+
+		String cleanDirectories = module.getParameters().getKeyValueParameters().get(ImportKeys.CLEAN);
+
+		if (!doSplitMergeXSLStep()) return;
+		if (!doFrontXSLStep()) return;
+		if (!doCheckXMLFileStep()) return;
+		if (!doTokenizeStep()) return;
+		if (!doPostTokenizeXSLStep()) return;
+		if (!doEncodeMileStonesStep()) return;
+		if (!doToXMLTXMStep()) return;
+		if (!doInjectMetadataStep()) return;
+
+		isSuccessFul = filesToProcess.size() > 0
+
+		if ("true".equals(cleanDirectories)) {
+			new File(module.getBinaryDirectory(), "tokenized").deleteDir()
+			new File(module.getBinaryDirectory(), "src").deleteDir()
+		}
+	}
+
+	/**
+	 * read from source directory and write the result in $bindir/txm
+	 * 
+	 * only one XSL is applied
+	 *
+	 */
+	public boolean doSplitMergeXSLStep() {
+		File srcDirectory = new File(module.getBinaryDirectory(), "src")
+		srcDirectory.mkdir()
+		xslParams["output-directory"] = srcDirectory.getAbsoluteFile().toURI().toString();
+
+		File xslDirectory = new File(module.getSourceDirectory(), "xsl/1-split-merge")
+		println "-- Split-Merge XSL Step with $xslDirectory"
+		def xslFiles = xslDirectory.listFiles()
+		if (xslDirectory.exists() && xslFiles != null && xslFiles.size() > 0) {
+			
+			xslFiles.sort()
+			for (File xslFile : xslFiles) {
+				if (xslFile.isDirectory() || xslFile.isHidden() || !xslFile.getName().endsWith(".xsl")) continue;
+				//if (!xslFile.getName().matches("[1-9]-.+")) continue;
+				
+				if (ApplyXsl2.processImportSources(xslFile, inputDirectory, srcDirectory, xslParams, true)) {
+					println ""
+				} else {
+					reason = "Fail to apply split-merge XSL: $xslPath"
+				}
+				break; // THERE IS ONLY ONE XSL FILE TO APPLY
+			}
+			inputDirectory = srcDirectory; // the files to process are now in the "src" directory
+		} else {
+			//println "Nothing to do."
+		}
+		return true;
+	}
+	
+	public boolean doEncodeMileStonesStep() {
+		filesToProcess = new File(module.getBinaryDirectory(), "tokenized").listFiles()
+		def milestonesString = module.getParameters().getMilestonesElement().getTextContent().trim()
+		if (milestonesString.length() == 0) return true;
+		
+		def milestones = milestonesString.split(",")
+		//def milestones = ["lb", "pb", "cb"]
+		//println "milestones=$milestones type="+milestones.getClass()+" size="+milestones.size()
+		if (milestones.size() == 0) return true;
+		
+		println "-- Encoding milestone $milestones into XML files..."
+		ConsoleProgressBar cpb = new ConsoleProgressBar(milestones.size())
+		for (def milestone : milestones) {
+			milestone = milestone.trim()// just in case
+			cpb.tick()
+			
+			for (File inputFile : filesToProcess) {
+				File outputFile = File.createTempFile("tmp", inputFile.getName(),inputFile.getParentFile());
+				MileStoneProjection msp = new MileStoneProjection(inputFile, "body", wordTag, milestone)
+				if (!msp.process(outputFile)) {
+					println "Fail to encode $milestone in $inputFile"
+					return false
+				} else {
+					if (inputFile.delete()) {
+						outputFile.renameTo(inputFile)
+					} else {
+						println "Fail to encode $milestone in ${inputFile}: could not replace the file."
+						return false
+					}
+				}
+			}
+		}
+		println ""
+		return true;
+	}
+
+	/**
+	 * read from $inputDirectory and write the result in $bindir/txm 
+	 *
+	 */
+	public boolean doFrontXSLStep() {
+
+		//filesToProcess = inputDirectory.listFiles();
+
+		File frontXSLdirectory = new File(module.getSourceDirectory(), "xsl/2-front")
+		println "-- Front XSL Step with $frontXSLdirectory"
+		def xslFiles = frontXSLdirectory.listFiles()
+		if (frontXSLdirectory.exists() && xslFiles != null && xslFiles.size() > 0) {
+			
+			xslFiles.sort()
+			for (File xslFile : xslFiles) {
+				if (xslFile.isDirectory() || xslFile.isHidden() || !xslFile.getName().endsWith(".xsl")) continue;
+				//if (!xslFile.getName().matches("[1-9]-.+")) continue;
+
+				if (ApplyXsl2.processImportSources(xslFile, inputDirectory, outputDirectory, xslParams)) {
+					inputDirectory = outputDirectory; // the files to process are now in the "txm" directory
+					println ""
+				} else {
+					reason = "Fail to apply front XSL: $xslPath"
+					return false;
+				}
+			}
+		} else {
+			//println "Nothing to do."
+		}
+		return true;
+	}
+
+	public boolean doCheckXMLFileStep() {
+		filesToProcess = []
+		println "-- Check XML files for well-formedness."
+		def files = inputDirectory.listFiles()
+
+		if (files == null || files.size() == 0) {
+			println "No XML file (*.xml) to process. Aborting"
+			return false;
+		}
+		files = files.sort()
+
+		ConsoleProgressBar cpb = new ConsoleProgressBar(files.size())
+		for (File f : files) {
+			cpb.tick()
+			if (f.getName().toLowerCase().endsWith(".xml"))
+				if (!f.isHidden() && f.canRead() && !f.getName().endsWith(".properties")
+				&& !f.getName().startsWith("metadata") && !f.isDirectory())
+			{
+				
+				if (!ValidateXml.test(f)) {
+					continue;
+				} else {
+					if (!f.getName().equals("import.xml"))
+						filesToProcess << f
+				}
+			}
+		}
+		println ""
+		if (filesToProcess.size() == 0) {
+			reason = "No file suitable to process in "+inputDirectory
+			return false;
+		} else {
+			return true;
+		}
+	}
+
+
+	public boolean doTokenizeStep() {
+
+		println "-- Tokenizing "+filesToProcess.size()+" files"
+		new File(module.getBinaryDirectory(),"tokenized").mkdir()
+
+		String outSideTextTagsRegex = "";
+		String outSideTextTagsAndKeepContentRegex = "";
+		String noteRegex = "";
+		// get the element names to ignore
+		Element textualPlanEelement = module.getParameters().getTextualPlans();
+
+		if (textualPlanEelement != null) {
+			Element e1 = module.getParameters().getOutSideTextTagsElement()
+			def split  = e1.getTextContent().split(",")
+			for (String s : split) {
+				outSideTextTagsRegex += "|"+s.trim()
+			}
+			if (outSideTextTagsRegex.trim().length() > 0) {
+				outSideTextTagsRegex = outSideTextTagsRegex.substring(1) // remove the first "|"
+			}
+			
+			Element e2 = module.getParameters().getOutSideTextTagsAndKeepContentElement()
+			def split2  = e2.getTextContent().split(",")
+			for (String s : split2) {
+				outSideTextTagsAndKeepContentRegex += "|"+s.trim()
+			}
+			if (outSideTextTagsAndKeepContentRegex.trim().length() > 0) {
+				outSideTextTagsAndKeepContentRegex = outSideTextTagsAndKeepContentRegex.substring(1) // remove the first "|"
+			}
+			
+			Element e3 = module.getParameters().getNoteElement()
+			def split3  = e3.getTextContent().split(",")
+			for (String s : split3) {
+				noteRegex += "|"+s.trim()
+			}
+			if (noteRegex.trim().length() > 0) {
+				noteRegex = noteRegex.substring(1) // remove the first "|"
+			}
+		}
+
+		//if (wordTag != "w") {
+		if (skipDoTokenizeStep ) {
+			println "No tokenization do to."
+			// ConsoleProgressBar cpb = new ConsoleProgressBar(filesToProcess.size())
+			for (File f : filesToProcess) {
+				File outfile = new File(module.getBinaryDirectory(),"tokenized/"+f.getName());
+				FileCopy.copy(f, outfile);
+			}
+			return true;
+		} else {
+			ConsoleProgressBar cpb = new ConsoleProgressBar(filesToProcess.size())
+			for (File f : filesToProcess) {
+				cpb.tick()
+				File infile = f;
+				File outfile = new File(module.getBinaryDirectory(),"tokenized/"+f.getName());
+				SimpleTokenizerXml tokenizer = new SimpleTokenizerXml(infile, outfile, lang)
+				if (wordTag.length() > 0)
+					tokenizer.setWord_tags(wordTag);
+
+				if (outSideTextTagsRegex != null && outSideTextTagsRegex.trim().length() > 0) {
+					tokenizer.setOutSideTextTags(outSideTextTagsRegex)
+				}
+				
+				if (outSideTextTagsAndKeepContentRegex != null && outSideTextTagsAndKeepContentRegex.trim().length() > 0) {
+					tokenizer.setOutSideTextTagsAndKeepContent(outSideTextTagsAndKeepContentRegex)
+				}
+				
+				if (noteRegex != null && noteRegex.trim().length() > 0) {
+					tokenizer.setNote(noteRegex)
+				}
+
+				// tokenize ! \o/
+				if (!tokenizer.process()) {
+					println("Failed to process "+f)
+					outfile.delete()
+				}
+			}
+		}
+		
+		filesToProcess = new File(module.getBinaryDirectory(),"tokenized").listFiles()
+		println ""
+
+		return true;
+	}
+
+	/**
+	 * read from $bindir/tokenized and write the result in $bindir/tokenized
+	 *
+	 */
+	public boolean doPostTokenizeXSLStep() {
+
+		filesToProcess = new File(module.getBinaryDirectory(),"tokenized").listFiles()
+		File xslDirectory = new File(module.getSourceDirectory(), "xsl/3-posttok")
+		def xslFiles = xslDirectory.listFiles()
+		if (!xslDirectory.exists() || xslFiles == null || xslFiles.size() == 0) return true;
+
+		println "-- Posttokenize XSL Step with $xslDirectory"
+		return ApplyXsl2.processWithMultipleXSL(filesToProcess, xslDirectory, xslParams)
+	}
+
+	public boolean doInjectMetadataStep() {
+		if (metadata != null) {
+			println("-- INJECTING METADATA - "+metadata.getHeadersList()+" in texts of directory "+outputDirectory)
+			ConsoleProgressBar cpb = new ConsoleProgressBar(filesToProcess.size())
+			for (File infile : filesToProcess) {
+				cpb.tick()
+				File outfile = File.createTempFile("temp", ".xml", infile.getParentFile());
+				if (metadata.injectMetadatasInXml(infile, outfile, "text", null)) {
+					if (!(infile.delete() && outfile.renameTo(infile))) println "Warning can't rename file "+outfile+" to "+infile
+					if (!infile.exists()) {
+						println "Error: could not replace $infile by $outfile"
+						return false;
+					}
+				} else {
+					outfile.delete(); // fail
+				}
+			}
+			println ""
+		}
+		return true;
+	}
+
+	public boolean doToXMLTXMStep() {
+		filesToProcess = new File(module.getBinaryDirectory(),"tokenized").listFiles()
+		ConsoleProgressBar cpb = new ConsoleProgressBar(filesToProcess.size())
+		println("-- Building XML-TXM ("+filesToProcess.size()+" files)")
+		for (File f : filesToProcess) {
+			//ArrayList<String> milestones = new ArrayList<String>();
+			cpb.tick()
+			File file = f;
+			String txmfile = f.getName();
+
+			def correspType = new HashMap<String,String>()
+			def correspRef = new HashMap<String,String>()
+			//il faut lister les id de tous les respStmt
+			def respId = [];
+			//fait la correspondance entre le respId et le rapport d'execution de l'outil
+			def applications = new HashMap<String,HashMap<String,String>>();
+			//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[]>();
+			//associe un id d'item avec sa description et son URI
+			def itemsURI = new HashMap<String,HashMap<String,String>>();
+			//informations de respStmt
+			//resps (respId <voir ci-dessus>, [description, person, date])
+			def resps = new HashMap<String,String[]>();
+			//lance le traitement
+			def builder = new Xml2Ana(file);
+			builder.setWordTag(module.getParameters().getWordElement().getTextContent())
+			builder.setConvertAllAtrtibutes true;
+			builder.setCorrespondances(correspRef, correspType);
+			builder.setHeaderInfos(respId,resps, applications, taxonomiesUtilisees, itemsURI)
+			//builder.setAddTEIHeader();
+			if (!builder.process(new File(outputDirectory, txmfile))) {
+				println("Failed to process "+f);
+				new File(outputDirectory,txmfile).delete();
+			}
+		}
+		filesToProcess = outputDirectory.listFiles();
+		println ""
+		return true;
+	}
+
+	@Override
+	public void checkFiles() {
+		//isSuccessFul = isSuccessFul && outputDirectory.listFiles() != null;
+	}
+
+	@Override
+	public void cancel() {
+		cancelNow = true;
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/xtz/xtzLoader.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/xtz/xtzLoader.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/xtz/xtzLoader.groovy	(revision 258)
@@ -0,0 +1,75 @@
+// 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
+// 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.
+//
+//
+//
+// $LastChangedDate: 2015-06-03 15:04:53 +0200 (mer., 03 juin 2015) $
+// $LastChangedRevision: 2984 $
+// $LastChangedBy: mdecorde $
+//
+package org.txm.importer.xtz;
+
+import javax.xml.stream.*
+
+import org.txm.*
+import org.txm.metadatas.*
+import org.txm.objects.*
+import org.txm.scripts.teitxm.*
+import org.txm.tokenizer.TokenizerClasses
+import org.txm.utils.*
+import org.txm.utils.i18n.*
+
+String userDir = System.getProperty("user.home");
+
+def MONITOR;
+boolean debug = org.txm.utils.logger.Log.isPrintingErrors();
+BaseParameters params;
+try {params = paramsBinding;MONITOR=monitor} catch (Exception)
+{	println "DEV MODE";//exception means we debug
+	debug = true
+	params = new BaseParameters(new File(userDir, "xml/srcmfmadridxmltxm/import.xml"))
+	params.load()
+	if (!org.txm.Toolbox.isInitialized()) {
+
+		TokenizerClasses.loadFromNode(params.getTokenizerElement(params.getCorpusElement()));
+		Toolbox.setParam(Toolbox.INSTALL_DIR,new File("/usr/lib/TXM"));
+		//Toolbox.setParam(Toolbox.INSTALL_DIR,new File("C:\\Program Files\\TXM"));//For Windows
+		Toolbox.setParam(Toolbox.TREETAGGER_INSTALL_PATH,new File(userDir,"treetagger"));
+		//Toolbox.setParam(Toolbox.TREETAGGER_INSTALL_PATH,new File("C:\\Program Files\\treetagger"));//for Windows
+		Toolbox.setParam(Toolbox.TREETAGGER_MODELS_PATH,new File(userDir,"treetagger/models"));
+		Toolbox.setParam(Toolbox.METADATA_ENCODING, "UTF-8");
+		Toolbox.setParam(Toolbox.METADATA_COLSEPARATOR, ",");
+		Toolbox.setParam(Toolbox.METADATA_TXTSEPARATOR, "\"");
+		//Toolbox.setParam(Toolbox.TREETAGGER_MODELS_PATH,new File("C:\\Program Files\\treetagger\\models"));//for Windows
+		Toolbox.setParam(Toolbox.USER_TXM_HOME, new File(System.getProperty("user.home"), "TXM"));
+	}
+}
+
+if (params == null) { println "no parameters. Aborting"; return; }
+
+//params.getKeyValueParameters().put(ImportKeys.CLEAN, "false")
+//params.getKeyValueParameters().put(ImportKeys.MULTITHREAD, "false")
+//params.getKeyValueParameters().put(ImportKeys.DEBUG, "false")
+//params.getKeyValueParameters().put(ImportKeys.UPDATECORPUS, "false")
+
+XTZImport i = new XTZImport(params);
+i.process();
+readyToLoad = i.isSuccessful
Index: tmp/org.txm.core/src/groovy/org/txm/importer/xtz/ImportModule.java
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/xtz/ImportModule.java	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/xtz/ImportModule.java	(revision 258)
@@ -0,0 +1,255 @@
+package org.txm.importer.xtz;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.logging.Level;
+
+import org.txm.Toolbox;
+import org.txm.functions.ProgressWatcher;
+import org.txm.objects.BaseParameters;
+import org.txm.utils.DeleteDir;
+import org.txm.utils.xml.DomUtils;
+import org.txm.utils.logger.Log;
+
+public class ImportModule {
+
+	protected BaseParameters importParameters;
+	
+	protected String corpusVersionProduced;
+
+	protected File sourceDirectory;
+	protected File binaryDirectory;
+
+	protected Importer importer;
+	protected Annotater annotater;
+	protected Compiler compiler;
+	protected Pager pager;
+
+	protected boolean isSuccessful = true;
+	protected String reason = "none";
+	protected boolean debug = false;
+	protected boolean multithread = false;
+	protected boolean updateCorpus = false;
+	protected String corpusName;
+
+	ProgressWatcher monitor;
+	
+	public void setMonitor(ProgressWatcher monitor) {
+		this.monitor = monitor;
+	}
+
+	
+	public boolean isMultiThread() {
+		return multithread;
+	}
+
+	public boolean isDebugging() {
+		return debug;
+	}
+
+	public ImportModule(File importParametersFile) {
+		try {
+			BaseParameters b = new BaseParameters(importParametersFile);
+			init(b);
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+
+	public ImportModule(BaseParameters p) {
+		init(p);
+	}
+	
+	public boolean isUpdatingCorpus() {
+		return updateCorpus;
+	}
+
+	protected void init(BaseParameters p) {
+		this.importParameters = p;
+		this.importParameters.load();
+		corpusName = importParameters.name;
+		//this.debug = "true".equals(importParameters.getKeyValueParameters().get(ImportKeys.DEBUG));
+		
+		if (Log.getLevel().intValue() < Level.WARNING.intValue()) {
+			debug = true;
+		}
+		this.multithread = "true".equals(importParameters.getKeyValueParameters().get(ImportKeys.MULTITHREAD));
+		this.updateCorpus = "true".equals(importParameters.getKeyValueParameters().get(ImportKeys.UPDATECORPUS));
+
+		
+		this.sourceDirectory = importParameters.paramFile.getParentFile();
+		this.binaryDirectory = new File(Toolbox.getParam(Toolbox.USER_TXM_HOME), "corpora/"+corpusName.toUpperCase());
+
+		if (!updateCorpus) { // clean directories only if it's a new import
+			DeleteDir.deleteDirectory(binaryDirectory);
+			binaryDirectory.mkdir();
+			
+			File txmDir = new File(binaryDirectory, "txm");
+			txmDir.mkdir();
+		}
+	}
+
+	public void start() throws InterruptedException {
+
+		binaryDirectory.mkdirs(); // ensure output exists
+		//System.out.println("ImportModule.start");
+		if (!updateCorpus) { // create XML-TXM files and annotate
+			//System.out.println("ImportModule.start: not updating");
+			if (importer != null) {
+				//System.out.println("ImportModule.start: importer: "+importer);
+				if (monitor != null) System.out.println("-- IMPORTER - Reading source files");
+				importer.process();
+				//importer.checkFiles();
+				isSuccessful = isSuccessful & importer.isSuccessFul();
+				if (!isSuccessful) {
+					System.out.println("Error while importing corpus during 'importer' step, reason="+importer.getReason());
+					return;
+				}
+			} else {
+				System.out.println("XML-TXM files already produced in "+new File(binaryDirectory, "txm/"+corpusName));
+			}
+
+			boolean annotate = "true".equals(importParameters.getCorpusElement().getAttribute("annotate"));
+			if (annotate && annotater != null) {
+				if (monitor != null) System.out.println("-- ANNOTATE - Running NLP tools");
+				annotater.process();
+				isSuccessful = isSuccessful & annotater.isSuccessFul();
+				if (!isSuccessful) {
+					System.out.println("Error while importing corpus during 'annotate' step, reason="+annotater.getReason());
+					return;
+				}
+			} else {
+				//System.out.println("XML-TXM files already annotated.");
+			}
+		} else {
+			System.out.println("Updating corpus...");
+		}
+		
+		//System.out.println("GET FILES ORDER");
+		final ArrayList<File> files = getTXMFilesOrder();
+		
+		Thread Tcompiler = new Thread() {
+			public void run() {
+				if (compiler != null) {
+					if (monitor != null) System.out.println("-- COMPILING - Building Search Engine indexes");
+					compiler.process(files);
+					isSuccessful = isSuccessful & compiler.isSuccessFul();
+					if (!isSuccessful) {
+						System.out.println("Error while importing corpus during 'compiler' step, reason="+compiler.getReason());
+						return;
+					}
+				} else {
+					System.out.println("No CQP index created.");
+				}
+			}
+		};
+
+		Thread Tpager = new Thread() {
+			public void run() {
+
+				if (pager != null) {
+					if (monitor != null) System.out.println("-- EDITION - Building edition");
+					pager.process(files);
+					isSuccessful = isSuccessful & pager.isSuccessFul();
+					if (!isSuccessful) {
+						System.out.println("Error while importing corpus during 'pager' step, reason="+pager.getReason());
+						return;
+					}
+				} else {
+					System.out.println("No edition produced.");
+				}
+			}
+		};
+
+		Tcompiler.start();
+		if (!multithread) {
+			Tcompiler.join(); // wait for the end if not multithreaded
+			if (!isSuccessful) { // don't call pager is compiler step failed
+				return;
+			}
+		}
+		
+		Tpager.start();
+		if (multithread) Tcompiler.join(); // wait for both thread to end
+		Tpager.join();		
+	}
+	
+	protected ArrayList<File> getTXMFilesOrder() {
+		//System.out.println("DEFAULT FILES ORDER");
+		File txmDirectory = new File(binaryDirectory, "txm/"+corpusName);
+		ArrayList<File> files = new ArrayList<File>(Arrays.asList(txmDirectory.listFiles(new FileFilter() {
+			@Override
+			public boolean accept(File file) {
+				return file.isFile() && file.getName().endsWith(".xml");
+			}
+		})));
+		
+		Collections.sort(files);
+		
+		return files;
+	}
+
+
+	public void end() {
+		File paramFile = new File(binaryDirectory, "import.xml");
+		try {
+			DomUtils.save(importParameters.root.getOwnerDocument(), paramFile);
+			isSuccessful = true;
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+			isSuccessful = false;
+		}
+	}
+	
+	public String getCorpusName() {
+		return corpusName;
+	}
+
+	public String getReason() {
+		return reason;
+	}
+
+	public boolean isSuccessFul() {
+		return isSuccessful;
+	}
+
+	public BaseParameters getParameters() {
+		return importParameters;
+	}
+
+	public File getSourceDirectory() {
+		return sourceDirectory;
+	}
+
+	public File getBinaryDirectory() {
+		return binaryDirectory;
+	}
+	
+	public void process() throws InterruptedException {
+		start();
+		if (isSuccessful)
+			end();
+	}
+
+	public static void main(String[] args) {
+		File importParametersFile = new File("/home/mdecorde/xml/brown/import.xml");
+
+		ImportModule module = new ImportModule(importParametersFile);
+		System.out.println("Parameters: "+module.getParameters());
+		try {
+			module.start();
+
+			if (module.isSuccessful) {
+				System.out.println("Import sucessful. reloading corpora...");
+			} else {
+				System.out.println("Import failed, reason = "+module.getReason());
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+}

Property changes on: tmp/org.txm.core/src/groovy/org/txm/importer/xtz/ImportModule.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/importer/xtz/XTZCompilerStep.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/xtz/XTZCompilerStep.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/xtz/XTZCompilerStep.groovy	(revision 258)
@@ -0,0 +1,267 @@
+package org.txm.importer.xtz;
+
+import java.io.File;
+import javax.xml.stream.*
+import java.net.URL
+import java.util.HashMap;
+import org.txm.utils.*
+
+public class XTZCompilerStep {
+
+	static String FORM = "form";
+	static String ANA = "ana";
+	static String ID = "id";
+	static String TYPE = "type";
+	static String TAB = "\t";
+	static String QUOTE = "\"";
+
+	File xmlFile
+	File wtcFile
+	String textname, corpusname, projectname;
+	boolean normalizeAttributeValues = false;
+	boolean normalizeAnaValues = true;
+	boolean normalizeFormValues = true;
+
+	def inputData;
+	XMLInputFactory factory;
+	XMLStreamReader parser;
+	OutputStreamWriter output;
+
+	def anavalues = [:];
+	def anatypes;
+
+	String WTAG = "w"
+
+	public void setNormalizeAttributeValues(boolean n) {
+		this.normalizeAttributeValues = n;
+	}
+
+	public void setNormalizeAnaValues(boolean n) {
+		this.normalizeAnaValues = n;
+	}
+
+	public void setNormalizeFormValues(boolean n) {
+		this.normalizeFormValues = n;
+	}
+
+	public XTZCompilerStep(File xmlFile, File wtcFile, String textname, String corpusname, String projectname, def anatypes, def wtag) {
+		this.xmlFile = xmlFile;
+		this.wtcFile = wtcFile;
+		this.textname = textname
+		this.corpusname = corpusname;
+		this.projectname = projectname;
+		this.anatypes = anatypes;
+		this.WTAG = wtag
+
+		try {
+			inputData = xmlFile.toURI().toURL().openStream();
+			factory = XMLInputFactory.newInstance();
+			parser = factory.createXMLStreamReader(inputData);
+
+		} catch (Exception ex) {
+			System.err.println("Exception while parsing $xmlFile : "+ex);
+		}
+	}
+
+	/**
+	 * Creates the output.
+	 *
+	 * @param dirPathName the dir path name
+	 * @param fileName the file name
+	 * @return true, if successful
+	 */
+	private boolean createOutput(File f) {
+		try {
+			output = new OutputStreamWriter(new BufferedOutputStream(new FileOutputStream(f)) , "UTF-8");
+			return true;
+		} catch (Exception e) {
+			System.err.println(e);
+			return false;
+		}
+	}
+
+	/**
+	 * Transfom file wtc.
+	 *
+	 * @param dirPathName the dir path name
+	 * @param fileName the file name
+	 * @return true, if successful
+	 */
+	public boolean process()
+	{
+		if (!createOutput(wtcFile))
+			return false;
+
+		String headvalue=""
+		String vAna = "";
+		String vForm = "";
+		String wordid= "";
+		String vHead = "";
+
+
+		int p_id = 0;
+		int s_id = 0;
+
+		def divs = []
+		def ncounts = [:] // contains the n values per tags with no attribute
+
+		boolean captureword = false;
+		boolean flagWord = false;
+		boolean flagForm = false;
+		boolean flagAna = false;
+
+		String anatype = "";
+		String anavalue = "";
+		boolean stopAtFirstSort = true;
+		boolean foundtei = false;
+		boolean foundtext = false;
+
+		try {
+			String localname;
+			for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next())
+			{
+				switch (event) {
+					case XMLStreamConstants.START_ELEMENT:
+						localname = parser.getLocalName().toLowerCase();
+						if ("tei".equals(localname)) foundtei = true;
+						switch (localname) {
+							case "text":
+								foundtext = true;
+								output.write("<text id=\""+textname+"\" base=\""+corpusname+QUOTE + " project=\""+projectname+QUOTE);
+								for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
+									String attrname = parser.getAttributeLocalName(i);
+									String attrvalue = parser.getAttributeValue(i)
+
+									if (normalizeAttributeValues)
+										attrvalue = attrvalue.trim();
+
+									if (attrname != ID)
+										output.write(" "+attrname.toLowerCase()+"=\""+attrvalue+QUOTE)
+								}
+								output.write(">\n");
+
+								break;
+
+							case WTAG:
+								for (int i = 0 ; i < parser.getAttributeCount(); i++) {
+									if (parser.getAttributeLocalName(i).equals(ID)) {
+										wordid = parser.getAttributeValue(i);
+									}
+								}
+								anavalues = [:];
+								flagWord = true
+								break;
+							case FORM:
+								flagForm = true;
+								vForm = "";
+								vAna = "";
+								break;
+
+							case ANA:
+								flagAna = true;
+								anavalue = "";
+								for (int i = 0 ; i < parser.getAttributeCount(); i++) {
+									//println parser.getAttributeLocalName(i)+"="+parser.getAttributeValue(i)
+									if (TYPE.equals(parser.getAttributeLocalName(i))) {
+										anatype = parser.getAttributeValue(i).substring(1);//remove the #
+										break;
+									}
+								}
+								break;
+
+							default:
+								if (foundtei && !foundtext) break;
+
+								output.write("<"+localname);
+
+								for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
+									String attrname = parser.getAttributeLocalName(i);
+
+									String attrvalue = parser.getAttributeValue(i)
+									if (normalizeAttributeValues)
+										attrvalue = attrvalue.trim();
+
+									output.write(" "+attrname.toLowerCase()+"=\""+attrvalue+QUOTE)
+								}
+								if (parser.getAttributeCount() == 0) { // add the n attribute
+									if (!ncounts.containsKey(localname)) ncounts.put(localname, 0);
+									int ncount = ncounts.get(localname);
+									ncounts.put(localname, ncount+1);
+									output.write(" n=\""+ncount+QUOTE)
+								}
+								output.write(">\n");
+						}
+						break;
+
+					case XMLStreamConstants.END_ELEMENT:
+						localname = parser.getLocalName().toLowerCase();
+						switch (localname) {
+							case WTAG:
+								for (String type : anatypes) {
+									def v = anavalues.get(type);
+									if (v != null) vAna +=TAB+v;
+									else vAna +=TAB;
+								}
+								vForm = vForm.replaceAll("\n", "").replaceAll("&", "&amp;").replaceAll("<", "&lt;");
+								if (vAna != null) {
+									output.write(vForm+TAB+wordid+vAna+"\n");
+								}
+								vAna = "";
+								vForm = "";
+								flagWord = false;
+								break;
+
+							case "tei":
+								break;
+							case FORM:
+								flagForm = false;
+								break;
+							case ANA:
+								anavalues.put(anatype, anavalue)
+								flagAna = false;
+								break;
+							default:
+								if (foundtei && !foundtext) break;
+
+								output.write("</"+localname+">\n");
+						}
+						break;
+
+					case XMLStreamConstants.CHARACTERS:
+						if (flagWord) {
+							if (flagForm) {
+								if (normalizeFormValues) {
+									vForm += parser.getText().trim();
+								} else {
+									vForm += parser.getText();
+								}
+							}
+							if (flagAna) {
+								if (normalizeAnaValues)
+									anavalue += parser.getText().trim();
+								else
+									anavalue += parser.getText();
+							}
+						}
+						break;
+				}
+			}
+
+			output.close();
+			parser.close();
+		} catch (Exception ex) {
+			System.out.println("Exception while parsing " + inputData+" of Text "+textname+" : "+ex);
+			File errorDir = null
+			try {
+				errorDir = new File(wtcFile.getParentFile(), "compiler-error")
+				println "Warning: Moving $xmlFile to $errorDir"
+				errorDir.mkdir();
+				FileCopy.copy(xmlFile, new File(errorDir, xmlFile.getName()))
+			} catch(Exception eCopy) {
+				println "Error while moving "+xmlFile+" to "+errorDir+" : "+eCopy
+			}
+			return false;
+		}
+		return true;
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/xtz/XTZCompiler.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/xtz/XTZCompiler.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/xtz/XTZCompiler.groovy	(revision 258)
@@ -0,0 +1,249 @@
+package org.txm.importer.xtz
+
+import java.io.File;
+
+import org.txm.*
+import org.txm.importer.SAttributesListener
+import org.txm.importer.cwb.*
+import org.txm.stat.utils.ConsoleProgressBar
+
+import javax.xml.stream.*
+
+
+class XTZCompiler extends Compiler {
+
+	SAttributesListener sattrsListener; // store scanned structures
+	private def anatypes = new HashSet<String>() // store scanned word attributes
+	
+	String regPath;
+	String cwbLoc;
+	String corpusname;
+	String wtag;
+	
+	boolean doNormalizeAttributeValues = false;
+	boolean doNormalizeAnaValues = true;
+	
+	public XTZCompiler(ImportModule module) {
+		super(module);
+
+		corpusname = module.getParameters().getCorpusName();
+		regPath = module.getBinaryDirectory().getAbsolutePath() + "/registry/"+corpusname.toLowerCase()
+		cwbLoc = Toolbox.getParam(Toolbox.CQI_SERVER_PATH_TO_CQPLIB)+File.separator;
+		
+		wtag = module.getParameters().getWordElement().getTextContent();
+		
+		doNormalizeAttributeValues = "true".equals(module.getParameters().getKeyValueParameters().get(ImportKeys.NORMALISEATTRIBUTEVALUES))
+		doNormalizeAnaValues = "true".equals(module.getParameters().getKeyValueParameters().get(ImportKeys.NORMALISEANAVALUES))
+	}
+
+	public void process(ArrayList<File> files) {
+		super.process(files); // set member
+		
+		if (files == null) files = inputDirectory.listFiles();
+		
+		if (!doScanStep()) return;
+		if (!doWTCStep()) return;
+		if (!doCWBEncodeStep()) return;
+		if (!doCWBMakeAllStep()) return;
+		
+		String cleanDirectories = module.getParameters().getKeyValueParameters().get(ImportKeys.CLEAN);
+		if ("true".equals(cleanDirectories)) {
+			new File(module.getBinaryDirectory(), "wtc").deleteDir()
+		}
+		
+		isSuccessFul = true;
+	}
+
+	/**
+	 * Scan all XML-TXM files to find out structures and word properties
+	 */
+	public boolean doScanStep() {
+		// get all anatypes		
+		sattrsListener = SAttributesListener.scanFiles(inputDirectory, wtag)
+		println "-- Listing structures&properties to create for "+files.size()+" XML-TXM files..."
+		ConsoleProgressBar cpb = new ConsoleProgressBar(files.size())
+		for (File f : files) {
+			try {
+				cpb.tick();
+				getAnaTypes(f)
+			} catch (Exception e) {
+				println "Error while processing $f text: "+e
+				e.printStackTrace();
+				return false;
+			}
+		}
+		println ""
+		return true;
+	}
+	
+	private void getAnaTypes(File xmlFile) {
+		def inputData = xmlFile.toURI().toURL().openStream();
+		def factory = XMLInputFactory.newInstance();
+		def parser = factory.createXMLStreamReader(inputData);
+		boolean start = false;
+		String ANA = "ana"
+		String TYPE = "type"
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+			if (event == XMLStreamConstants.START_ELEMENT) { // start elem
+				if (wtag.equals(parser.getLocalName())) {
+					start = true;
+				} else if (start && ANA.equals(parser.getLocalName())) { // ana elem
+					for (int i = 0 ; i < parser.getAttributeCount(); i++) { // find @type
+						if (TYPE.equals(parser.getAttributeLocalName(i))) { // @type
+							anatypes.add(parser.getAttributeValue(i).substring(1)); //remove the #
+							break;
+						}
+					}
+				}
+			} else if (event == XMLStreamConstants.END_ELEMENT) { // start elem
+				if (wtag.equals(parser.getLocalName())) {
+					start = false;
+				}	
+			}
+		}
+		parser.close()
+
+//		for (String type : types)
+//			if (!anatypes.contains(type))
+//				anatypes << type
+	}
+
+	def wtcFiles = []
+	public boolean doWTCStep() {
+		println "-- Building WTC files $inputDirectory..."
+		wtcDirectory.mkdir(); // if not created
+		
+		ConsoleProgressBar cpb = new ConsoleProgressBar(files.size())
+		for (File xmlFile : files) {
+			cpb.tick();
+			String textname = xmlFile.getName();
+			int idx = textname.indexOf(".")
+			if (idx > 0) textname = textname.substring(0, idx)
+			
+			File wtcFile = new File(wtcDirectory, textname + ".wtc")
+			wtcFiles << wtcFile
+			// skip step if wtcFile is more recent than xmlFile
+			if (wtcFile.exists() && wtcFile.lastModified() >= xmlFile.lastModified()) continue;
+			
+			XTZCompilerStep step = new XTZCompilerStep(xmlFile, wtcFile, textname, corpusname, "default", anatypes, wtag)
+			step.setNormalizeAnaValues(doNormalizeAnaValues)
+			step.setNormalizeAttributeValues(doNormalizeAttributeValues)
+			if (!step.process()) {
+				reason = "Fail to process $xmlFile."
+				return false;
+			}
+		}
+		println ""
+		return true;
+	}
+
+	public boolean doCWBEncodeStep() {
+		println "-- Running cwb-encode..."
+		CwbEncode cwbEn = new CwbEncode()
+		cwbEn.setDebug(debug)
+		
+		List<String> pargs = []
+		pargs.add("id")
+		for (String ana : anatypes)
+			pargs.add(ana)
+
+		String[] pAttrs = pargs
+
+		def structs = sattrsListener.getStructs()
+		def structsProf = sattrsListener.getProfs()
+
+		if (debug) {
+			println structs
+			println structsProf
+		}
+		
+		List<String> sargs = new ArrayList<String>()
+		def tmpTextAttrs = []
+		for (String name : structs.keySet()) {
+			if (name == "text") {
+				for (String value : structs.get(name)) // append the attributes
+					tmpTextAttrs << value // added after
+				continue;
+			}
+
+			String concat = name+":"+structsProf.get(name); // append the depth
+			for (String attributeName : structs.get(name)) // append the attributes
+				concat += "+"+attributeName.toLowerCase();
+				
+			if (structs.get(name).size() == 0) {
+				concat += "+n";
+			} else {
+				if (!structs.get(name).contains("n"))
+					concat += "+n"
+			}
+				
+			if ((name == "p" || name == "body" || name == "back" || name == "front")
+				 && !concat.contains("+n+") && !concat.endsWith("+n"))
+				concat += "+n"
+				
+			sargs.add(concat)
+		}
+
+		String textSAttributes = "text:0+id+base+project";
+		for (String name : tmpTextAttrs) {
+			if (!("id".equals(name) || "base".equals(name) || "project".equals(name)))
+				textSAttributes += "+"+name.toLowerCase()
+		}
+
+		sargs.add(textSAttributes)
+		sargs.add("txmcorpus:0+lang")
+
+		sargs.sort()
+
+		String[] sAttributes = sargs
+		String[] pAttributes = pAttrs
+		println " Word properties: "+pAttributes
+		println " Structures: "+sargs
+		File allwtcFile = new File(wtcDirectory, "all.wtc");
+		try {		
+			if (!CwbEncode.concat(wtcFiles, allwtcFile)) {
+				println "Fail to write the master wtc file: "+allwtcFile
+				return false;
+			}
+						
+			cwbEn.run(cwbLoc + "cwb-encode", outputDirectory.getAbsolutePath() + "/$corpusname",
+					allwtcFile.getAbsolutePath(),
+					regPath, pAttributes, sAttributes, false);
+				
+			allwtcFile.delete(); // clean
+		} catch (Exception e) {
+			println "Error while running cwb-encode: "+e
+			e.printStackTrace()
+			allwtcFile.delete(); // clean 
+			return false;
+		}
+		println ""
+		return true;
+	}
+
+	public boolean doCWBMakeAllStep() {
+		println "-- Running cwb-makeall..."
+		try {
+			CwbMakeAll cwbMa = new CwbMakeAll();
+			cwbMa.setDebug(debug);
+
+			if (!new File(regPath).exists()) {
+				println "Error: The registry file was not created: $regPath. See https://groupes.renater.fr/wiki/txm-users/public/faq"
+				return false;
+			}
+			cwbMa.run(new File(cwbLoc,"cwb-makeall").getAbsolutePath(), corpusname, module.getBinaryDirectory().getAbsolutePath() + "/registry");
+			
+			// remove milestones from CWB registry and data files
+			FixMilestoneDeclarations fm = new FixMilestoneDeclarations(
+				new File(regPath), new File(outputDirectory.getAbsolutePath(), corpusname));			
+			if (!fm.process()) {
+				println "Fail to verify&fix milestone declarations"
+				return false
+			}
+		} catch (Exception e) {
+			println "Error while running cwb-makeall: "+e
+			return false;
+		}
+		return true;
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/xtz/XTZImport.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/xtz/XTZImport.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/xtz/XTZImport.groovy	(revision 258)
@@ -0,0 +1,146 @@
+package org.txm.importer.xtz;
+
+import org.txm.*
+import org.txm.metadatas.Metadatas
+import org.txm.objects.BaseParameters
+import org.txm.utils.io.FileCopy;
+
+public class XTZImport extends ImportModule {
+
+	public XTZImport(File importParametersFile) {
+		super(importParametersFile);
+	}
+
+	public XTZImport(BaseParameters importParameters) {
+		super(importParameters);
+	}
+
+	@Override
+	public void init(BaseParameters p) {
+		super.init(p);
+		
+		importer = new XTZImporter(this)
+		compiler = new XTZCompiler(this)
+		annotater = new TTAnnotater(this);
+		pager = new XTZPager(this)
+	}
+	
+	@Override
+	protected ArrayList<File> getTXMFilesOrder() {
+		//System.out.println("XTZ FILES ORDER");
+		if (importer == null) {
+			println "no importer step, using default text order"
+			return super.getTXMFilesOrder();
+		}
+		Metadatas metadata = importer.getMetadata();
+		if (metadata == null) {
+			println "no metadata, using default text order"
+			return super.getTXMFilesOrder();
+		}
+		File txmDirectory = new File(binaryDirectory, "txm/"+corpusName);
+		ArrayList<File> files = new ArrayList<File>(Arrays.asList(txmDirectory.listFiles(new FileFilter() {
+			@Override
+			public boolean accept(File file) {
+				return file.isFile() && file.getName().endsWith(".xml");
+			}
+		})));
+	
+		final HashMap<File, String> textorder = new HashMap<File, String>();
+		for (File f : files) {
+			HashMap<String, String> m = metadata.getTextMetadata(f);
+			if (m != null && m.containsKey("textorder")) textorder[f] = m["textorder"];
+		}
+		println "Sorting texts using 'textorder' metadata values: "+textorder
+		Collections.sort(files, new Comparator<File>() {
+			public int compare(File f1, File f2) {
+				String o1 = textorder[f1];
+				String o2 = textorder[f2];
+				if (o1 == null && o2 == null) {
+					return f1.getName().compareTo(f2.getName());
+				} else if (o1 == null) {
+					return 1
+				} else if (o2 == null) {
+					return -1
+				} else {
+					int c = o1.compareTo(o2);
+					if (c == 0) return f1.getName().compareTo(f2.getName());
+					else return c;
+				}
+			}
+		});
+		//println files
+		return files;
+	}
+	
+	public void start() throws InterruptedException {
+		super.start();
+
+		if (isSuccessful) {
+			
+			//declare a local KR
+			List<String> krnames = importParameters.getKnowledgeRepositoryNames();
+			if (krnames.size() == 0) {
+				importParameters.createKnowledgeRepositoryElement("DEFAULT"); // set a default KR shared by all XTZ corpus
+			} else if (krnames.size() == 1 && krnames.get(0).equals("DEFAULT")) {
+				// nothing to do
+			} else {
+				println("Corpus is using custom Knowledge repositories: "+importParameters.getKnowledgeRepositoryNames());
+			}
+			
+			//copy sub directories
+			if (isUpdatingCorpus()) {
+
+			} else {
+				def dirToCopy = ["xsl", "css", "dtd"]
+				println "--- Copying subdirectories $dirToCopy"
+				for (String dir : dirToCopy) {
+					File origDirectory = new File(this.sourceDirectory, dir)
+					if (origDirectory.exists()) {
+						print "."
+						File copyDirectory = new File(this.binaryDirectory, dir)
+						FileCopy.copyFiles(origDirectory, copyDirectory)
+					}
+				}
+				println ""
+			}
+		}
+	}
+
+	public static void main(String[] args) {
+
+		long start = System.currentTimeMillis()
+
+		String userDir = System.getProperty("user.home")
+		Toolbox.setParam(Toolbox.INSTALL_DIR,new File("/usr/lib/TXM"));
+		//Toolbox.setParam(Toolbox.INSTALL_DIR,new File("C:\\Program Files\\TXM"));//For Windows
+		Toolbox.setParam(Toolbox.TREETAGGER_INSTALL_PATH,new File(userDir,"treetagger"));
+		//Toolbox.setParam(Toolbox.TREETAGGER_INSTALL_PATH,new File("C:\\Program Files\\treetagger"));//for Windows
+		Toolbox.setParam(Toolbox.TREETAGGER_MODELS_PATH,new File(userDir,"treetagger/models"));
+		Toolbox.setParam(Toolbox.METADATA_ENCODING, "UTF-8");
+		Toolbox.setParam(Toolbox.METADATA_COLSEPARATOR, ",");
+		Toolbox.setParam(Toolbox.METADATA_TXTSEPARATOR, "\"");
+		//Toolbox.setParam(Toolbox.TREETAGGER_MODELS_PATH,new File("C:\\Program Files\\treetagger\\models"));//for Windows
+		Toolbox.setParam(Toolbox.USER_TXM_HOME, new File(userDir, "TXM"));
+
+		//File importParametersFile = new File("/home/mdecorde/xml/brown-for-xtz/import.xml");
+		//		File importParametersFile = new File("/home/mdecorde/xml/qgraalc/qgraal_cw/import.xml"); // new import
+		//File importParametersFile = new File("/home/mdecorde/TXM/corpora/QGRAALXTZ/import.xml"); // corpus update
+		//		File importParametersFile = new File("/home/mdecorde/xml/annotation/import.xml"); // new import
+		//File importParametersFile = new File("/home/mdecorde/xml/baiptest/import.xml"); // new import
+		//File importParametersFile = new File("/home/mdecorde/TXM/corpora/BAIP/import.xml"); // corpus update
+		File importParametersFile = new File("/home/mdecorde/xml/xtzsmall/import.xml");
+		BaseParameters b = new BaseParameters(importParametersFile);
+		b.getKeyValueParameters().put(ImportKeys.CLEAN, "false")
+		b.getKeyValueParameters().put(ImportKeys.MULTITHREAD, "false")
+		b.getKeyValueParameters().put(ImportKeys.DEBUG, "true")
+		b.getKeyValueParameters().put(ImportKeys.UPDATECORPUS, "false")
+
+		XTZImport i = new XTZImport(b);
+		i.start();
+		
+		println "Done: "+i.isSuccessful
+
+		long end = System.currentTimeMillis()
+		println "TIME: "+(end-start)
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/xtz/Annotater.java
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/xtz/Annotater.java	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/xtz/Annotater.java	(revision 258)
@@ -0,0 +1,21 @@
+package org.txm.importer.xtz;
+
+import java.io.File;
+
+
+/**
+ * 
+ * Takes the XML-TXM files and wrap a TAL Tool to update the XML-TXM files
+ * 
+ * @author mdecorde
+ *
+ */
+public abstract class Annotater extends ImportStep {
+
+	public Annotater(ImportModule module) {
+		super(module);
+		
+		inputDirectory = new File(module.getBinaryDirectory(), "txm/"+module.corpusName);
+		outputDirectory = new File(module.getBinaryDirectory(), "txm");
+	}
+}

Property changes on: tmp/org.txm.core/src/groovy/org/txm/importer/xtz/Annotater.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/importer/xtz/Pager.java
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/xtz/Pager.java	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/xtz/Pager.java	(revision 258)
@@ -0,0 +1,49 @@
+package org.txm.importer.xtz;
+
+import java.io.File;
+import java.util.ArrayList;
+
+import org.txm.utils.DeleteDir;
+
+/**
+ * Takes the XML-TXM files and build an edition
+ * 
+ * @author mdecorde
+ *
+ */
+public class Pager extends ImportStep {
+
+	protected File htmlDirectory;
+	protected String corpusname;
+	protected ArrayList<File> files;
+
+	public Pager(ImportModule module, String editionName) {
+		super(module);
+
+		corpusname = module.getCorpusName();
+
+		inputDirectory = new File(module.getBinaryDirectory(), "txm/"+module.getCorpusName());
+		htmlDirectory = new File(module.getBinaryDirectory(), "HTML/"+corpusname);
+		outputDirectory  = new File(htmlDirectory, editionName);
+
+		if (!module.isUpdatingCorpus()) {
+			DeleteDir.deleteDirectory(outputDirectory);
+			outputDirectory.mkdirs();
+		}
+	}
+
+	@Override
+	public void cancel() {
+		// TODO Auto-generated method stub
+
+	}
+
+	@Override
+	public void process() {
+		process(null); // no default files order set
+	}
+	
+	public void process(ArrayList<File> files) {
+		this.files = files;
+	}
+}

Property changes on: tmp/org.txm.core/src/groovy/org/txm/importer/xtz/Pager.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/importer/NiceToXML.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/NiceToXML.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/NiceToXML.groovy	(revision 258)
@@ -0,0 +1,202 @@
+package org.txm.importer
+
+import javax.xml.stream.XMLStreamException
+import org.apache.tools.ant.types.resources.selectors.InstanceOf;
+import groovy.xml.*
+
+def root = new File("/home/mdecorde/xml/temoignagesnice/corpus Matrice - fichiers xmlisés/")
+File srcdir = new File(root, "orig");
+File outdir = new File(root, "tmp");
+File okdir = new File(root, "ok");
+File ok2dir = new File(root, "ok2");
+File temoignagedir = new File(root, "temoignages");
+ok2dir.deleteDir()
+ok2dir.mkdir()
+
+//rename title -> head
+for (def file : outdir.listFiles()) {
+	if (!file.getName().endsWith(".xml")) continue;
+	def doc = new XmlParser().parse(file);
+	
+	for (def note : doc.body.chapter.title) {
+		println note
+		note.name = "head"
+	}
+	
+	new File(ok2dir, file.getName()).withWriter("UTF-8") { writer ->
+		new XmlNodePrinter(new PrintWriter(writer)).print(doc)
+	}
+}
+
+/*
+// ADD chapter@title
+for (def file : outdir.listFiles()) {
+	if (!file.getName().endsWith(".xml")) continue;
+	def doc = new XmlParser().parse(file);
+	
+	for (def chapter : doc.body.chapter) {
+		for (def title : chapter.title) {
+			chapter.@title = title.text()
+			break;
+		}
+	}
+	
+	new File(ok2dir, file.getName()).withWriter("UTF-8") { writer ->
+		new XmlNodePrinter(new PrintWriter(writer)).print(doc)
+	}
+}
+*/
+//FIX figure and caption inclusions
+/*
+for (def file : outdir.listFiles()) {
+	if (!file.getName().endsWith(".xml")) continue;
+	def doc = new XmlParser().parse(file);
+	for (def note : doc.body."**".figure) {
+		note.name = "note"
+		//println "fig : $note"
+		//if ("Image :" == note.text()) {
+			def children = note.parent().children()
+			int i = children.indexOf(note)
+			//println i + " < "+children.size()
+			def nextChild = children[i+1]
+			if (nextChild != null && nextChild.name().toString() == "caption") {
+				println nextChild
+
+				note.value = "Images : "+note.text()// + " "+nextChild.text()
+				//println note
+
+				children.remove(i+1)
+				note.append(nextChild)
+			}
+		//}
+	}
+
+	new File(ok2dir, file.getName()).withWriter("UTF-8") { writer ->
+		new XmlNodePrinter(new PrintWriter(writer)).print(doc)
+	}
+}
+*/
+/*
+// DOCBOOK -> DOCBOOK TEXT ONLY
+for (def file : outdir.listFiles()) {
+	def doc = new XmlParser().parse(file);
+
+	def body = null
+	def bookinfo = null
+	def preface = null
+	for (def e : doc.body) body = e
+
+	for (def e : doc.bookinfo) {
+		doc.remove(e)
+	}
+	for (def e : doc.preface) {
+		doc.remove(e)
+	}
+	for (def e : doc.appendix) {
+		doc.remove(e)
+	}
+	for (def e : doc.chapter) {
+		doc.remove(e)
+	}
+
+	if (body == null) {
+		println "error text: "+file
+		continue
+	}
+
+	new File(ok2dir, file.getName()).withWriter("UTF-8") { writer ->
+		new XmlNodePrinter(new PrintWriter(writer)).print(doc)
+	}
+	//		writer.print XmlUtil.serialize(new StreamingMarkupBuilder().bind {
+	//			mkp.yield body
+	//		  })
+}
+*/
+//DOCBOOK to TEI
+/*
+ for (def file : outdir.listFiles()) {
+ def doc = new XmlParser().parse(file);
+ def body = null
+ //def bookinfo = null
+ for (def e : doc.body) body = e
+ //for (def e : doc.bookinfo) bookinfo = e
+ //println body.getClass()
+ if (body == null) {
+ println "error text: "+file
+ continue
+ }
+ //	bookinfo.name = "teiHeader"
+ body.name = "text"
+ def teins = new groovy.xml.Namespace("http://www.tei-c.org/ns/1.0",'tei')
+ //	for (def node : body."**") {
+ //		if (node instanceof String) continue
+ //		def name = node.name()
+ //		if (name instanceof String)
+ //			node.name = teins.get(name)
+ //		else 
+ //			node.name = teins.get(name.getLocalPart())
+ //	}
+ for (def figure : body."**".figure) {
+ figure.name = "note"
+ figure.value = "Image : " + figure.caption.text()
+ }
+ for (def chapter : body."**".chapter) {
+ chapter.name = "div"
+ chapter.@type = "chapter"
+ }
+ for (def caption : body."**".title) {
+ caption.name = "head"
+ }
+ for (def para : body."**".para) {
+ para.name = "p"
+ }
+ def newdoc = new Node(null, "TEI");
+ newdoc.@xmlns="http://www.tei-c.org/ns/1.0";
+ newdoc.append(new Node(null, "teiHeader"))
+ newdoc.append(body)
+ new File(okdir, file.getName()).withWriter("UTF-8") { writer ->
+ new XmlNodePrinter(new PrintWriter(writer)).print(newdoc)
+ }
+ //		writer.print XmlUtil.serialize(new StreamingMarkupBuilder().bind {
+ //			mkp.yield body
+ //		  })
+ }
+ */
+
+// remove TEI
+/*outdir.deleteDir()
+ outdir.mkdir()
+ def errors = []
+ for (def file : srcdir.listFiles()) {
+ if (file.isDirectory()) continue;
+ //new EncodingConverter(file, "Windows-1252", "UTF-8")
+ File outfile = new File(outdir, file.getName());
+ outfile.withWriter("UTF-8") { writer ->
+ file.eachLine("UTF-8") { line ->
+ if (line.trim() == "<TEI>") {
+ } else if (line.trim() == "</TEI>") {
+ writer.println("</book>")
+ } else if (line.trim() == "<book lang=\"fr\"/>") {
+ writer.println("<book lang=\"fr\">")
+ } else {
+ writer.println(line)
+ }
+ }		
+ }
+ try {
+ ValidateXml.testAndThrow(outfile);
+ } catch (XMLStreamException e) {
+ println file.getName() + " : "+ e.getMessage()
+ errors << file
+ if (e.getMessage().contains('Message: The element type "TEI" must be terminated by the matching end-tag "</TEI>"')) {
+ println "Delete line : "+e.location.lineNumber
+ }
+ println ""
+ }
+ }
+ */
+println "done"
+//if (errors.size() > 0)
+//	println ""+errors.size()+" errors : $errors"
+//String content = file.getText("Windows-1252")
+//println content
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/importer/hyperprince/pager.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/hyperprince/pager.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/hyperprince/pager.groovy	(revision 258)
@@ -0,0 +1,459 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2017-01-24 18:11:42 +0100 (Tue, 24 Jan 2017) $
+// $LastChangedRevision: 3400 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer.hyperprince;
+
+import org.txm.objects.*;
+import org.txm.importer.XPathResult;
+import org.xml.sax.Attributes;
+import org.txm.importer.filters.*;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.stream.*;
+import java.net.URL;
+import org.xml.sax.InputSource;
+import org.xml.sax.helpers.DefaultHandler;
+import org.txm.utils.i18n.*;
+
+// TODO: Auto-generated Javadoc
+/** Build Discours corpus simple edition from a xml-tei. @author mdecorde */
+class pager {
+	List<String> NoSpaceBefore;
+	
+	/** The No space after. */
+	List<String> NoSpaceAfter;
+
+	/** The wordcount. */
+	int wordcount = 0;
+	
+	/** The pagecount. */
+	int pagecount = 0;
+	
+	/** The wordmax. */
+	int wordmax = 0;
+
+	/** The wordid. */
+	String wordid;
+	
+	/** The first word. */
+	boolean firstWord = true;
+	
+	/** The wordvalue. */
+	String wordvalue;
+	
+	/** The interpvalue. */
+	String interpvalue;
+	
+	/** The lastword. */
+	String lastword = " ";
+	
+	/** The wordtype. */
+	String wordtype;
+	
+	/** The flagform. */
+	boolean flagform = false;
+	
+	/** The flaginterp. */
+	boolean flaginterp = false;
+	
+	/** The url. */
+	private def url;
+	
+	/** The input data. */
+	private def inputData;
+	
+	/** The factory. */
+	private def factory;
+	
+	/** The parser. */
+	private XMLStreamReader parser;
+	
+	/** The writer. */
+	def writer;
+	
+	/** The multiwriter. */
+	def multiwriter = null;
+	
+	/** The infile. */
+	File infile;
+	
+	/** The outfile. */
+	File outfile;
+	
+	/** The pages. */
+	ArrayList<File> pages = new ArrayList<File>();
+	
+	/** The idxstart. */
+	ArrayList<String> idxstart = new ArrayList<String>();
+	
+	/** The segid. */
+	String segid;
+	
+	/** The title. */
+	String title;
+
+	/**
+	 * Instantiates a new pager.
+	 *
+	 * @param infile the infile
+	 * @param outfile the outfile
+	 * @param NoSpaceBefore the no space before
+	 * @param NoSpaceAfter the no space after
+	 * @param max the max
+	 */
+	pager(File infile, File outfile, List<String> NoSpaceBefore,
+			List<String> NoSpaceAfter, int max) {
+		this.wordmax = max;
+		this.NoSpaceBefore = NoSpaceBefore;
+		this.NoSpaceAfter = NoSpaceAfter;
+		this.url = infile.toURI().toURL();
+		this.infile = infile;
+
+		inputData = url.openStream();
+		factory = XMLInputFactory.newInstance();
+		parser = factory.createXMLStreamReader(inputData);
+		createOutput(outfile);
+		process();
+	}
+
+	/**
+	 * Creates the next output.
+	 *
+	 * @return true, if successful
+	 */
+	private boolean createNextOutput()
+	{
+		try {
+			
+			if(multiwriter != null)
+			{
+				multiwriter.write("</body>");
+				multiwriter.write("</html>");
+				multiwriter.close();
+			}
+			pagecount++;
+			File f = new File(outfile.getParent()+"/multi/",outfile.getName().substring(0,2)+"_"+"page_"+pagecount+".html");
+			pages.add(f);
+			idxstart.add(wordid)
+			multiwriter = new OutputStreamWriter(new FileOutputStream(f) , "UTF-8");
+			
+			multiwriter.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
+			multiwriter.write("<html>");
+			multiwriter.write("<head>");
+			multiwriter.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/>");
+			
+			if(segid != null)
+			{
+				multiwriter.write("<title>Hyperprince "+segid+"</title>");
+			}else {
+				multiwriter.write("<title>Hyperprince "+title+"</title>");
+			}
+			multiwriter.write("</head>");
+			multiwriter.write("<body>");
+			
+			return true;
+		} catch (Exception e) {
+			System.out.println(e.getLocalizedMessage());
+			return false;
+		}
+	}
+
+	/**
+	 * Creates the output.
+	 *
+	 * @param outfile the outfile
+	 * @return true, if successful
+	 */
+	private boolean createOutput(File outfile) {
+		try {
+			this.outfile = outfile;
+
+			writer = new OutputStreamWriter(new FileOutputStream(outfile),
+					"UTF-8");
+			createNextOutput();
+			return true;
+		} catch (Exception e) {
+			System.out.println(e.getLocalizedMessage());
+			return false;
+		}
+	}
+
+	/**
+	 * Gets the page files.
+	 *
+	 * @return the page files
+	 */
+	public ArrayList<File> getPageFiles() {
+		return pages;
+	}
+
+	/**
+	 * Gets the idx.
+	 *
+	 * @return the idx
+	 */
+	public ArrayList<String> getIdx() {
+		return idxstart;
+	}
+
+	/**
+	 * Process.
+	 */
+	void process()
+	{
+		String localname = "";
+		String query = "//tei:TEI/tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:author/text()";
+		title = XPathResult.getXpathResponse(infile, query);
+		
+		writer.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
+		writer.write("<html>");
+		writer.write("<head>");
+		writer.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/>");
+		writer.write("<title>Hyperprince "+title+"</title>");
+		writer.write("</head>");
+		writer.write("<body>");
+		
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+			
+			
+			switch (event) {
+				case XMLStreamConstants.START_ELEMENT:
+					localname = parser.getLocalName();
+					switch(localname)
+					{	
+						case "text":
+							//XPathResult testG = new XPathResult(infile);
+							
+							//String title = testG.getXpathResponse("//tei:TEI/tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:title","")
+							//testG = null;
+							writer.write("<h1>"+title+"</h1>\n")
+							multiwriter.write("<h1>"+title+"</h1>\n")
+							break;
+						
+						case "front":
+							writer.write("<h2>"+parser.getAttributeValue(null, "type")+"</h2>\n")
+							multiwriter.write("<h2>"+parser.getAttributeValue(null, "type")+"</h2>\n")
+							break;
+						
+						case "div0":
+							writer.write("<h2>Book</h2>\n")
+							multiwriter.write("<h2>Book</h2>\n")
+							break;
+						
+						case "back":
+							writer.write("<h2>"+parser.getAttributeValue(null, "type")+"</h2>\n")
+							multiwriter.write("<h2>"+parser.getAttributeValue(null, "type")+"</h2>\n")
+							break;
+						
+						case "seg":
+							segid=parser.getAttributeValue(null,"id");
+							createNextOutput();
+							
+							writer.write("<p>\n");
+							multiwriter.write("<p>\n");
+							break;
+						
+						case "w":
+							wordid=parser.getAttributeValue(null,"id");
+							if(firstWord)
+							{
+								firstWord=false;
+								this.idxstart.set(0,wordid);
+							}
+							/*wordcount++;
+							if(wordcount >= wordmax)
+							{
+								createNextOutput();
+								wordcount=0;
+							}*/
+							break;
+						
+						case "ana":
+							flaginterp=true;
+							interpvalue+=" "+parser.getAttributeValue(null,"type")+":"
+							break;
+						
+						case "form":
+							wordvalue="";
+							interpvalue ="";
+							flagform=true;
+							break;
+					}
+					break;
+				case XMLStreamConstants.END_ELEMENT:
+					localname = parser.getLocalName();
+					switch(localname)
+					{
+						case "teiHeader":
+						
+							break;
+						
+						case "seg":
+							writer.write("</p>\n");
+							break;
+						
+						case "form":
+							flagform = false
+						
+							break;
+						
+						case "ana":
+							flaginterp = false
+							break;
+						
+						case "w":
+							int l = lastword.length();
+							String endOfLastWord = "";
+							if(l > 0)
+								endOfLastWord = lastword.subSequence(l-1, l);
+							
+							if(interpvalue != null)
+								interpvalue = interpvalue.replace("\"","&quot;");
+							
+							if(NoSpaceBefore.contains(wordvalue) || 
+									NoSpaceAfter.contains(lastword) || 
+									wordvalue.startsWith("-") || 
+									NoSpaceAfter.contains(endOfLastWord))
+							{
+								writer.write("<span title=\""+interpvalue+"\" id=\""+wordid+"\">");
+								multiwriter.write("<span title=\""+interpvalue+"\" id=\""+wordid+"\">");
+							}
+							else
+							{
+								writer.write(" <span title=\""+interpvalue+"\" id=\""+wordid+"\">");
+								multiwriter.write(" <span title=\""+interpvalue+"\" id=\""+wordid+"\">");
+							}
+							writer.write(wordvalue.replace("<", "&lt;")+"</span>");
+							multiwriter.write(wordvalue.replace("<", "&lt;")+"</span>");
+							lastword=wordvalue;
+							break;
+						
+					}
+					break;
+				
+				case XMLStreamConstants.CHARACTERS:
+					if(flagform)
+						if(parser.getText().length() > 0)
+							wordvalue+=(parser.getText());
+					if(flaginterp)
+						if(parser.getText().length() > 0)
+							interpvalue+=(parser.getText());
+					break;
+			}
+		}	
+		writer.write("</body>");
+		writer.write("</html>");
+		writer.close();
+		multiwriter.write("</body>");
+		multiwriter.write("</html>");
+		multiwriter.close();
+		
+		parser.close();
+		inputData.close();
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args)
+	{
+		/*String rootDir = System.getProperty("user.home")+"/xml/hyperprince/";
+		new File(rootDir,"HTML/").deleteDir();
+		new File(rootDir+"HTML/").mkdir();
+		new File(rootDir+"HTML/multi/").mkdir();
+		List<File> filelist = new File(rootDir,"txm").listFiles();
+		
+		for(File srcfile : filelist)
+		{
+			File resultfile = new File(rootDir+"HTML",srcfile.getName().substring(0,2)+".html");
+			List<String> NoSpaceBefore = LangFormater.getNoSpaceBefore(lang);
+			List<String> NoSpaceAfter = LangFormater.getNoSpaceAfter(lang);
+			println("build discours xml-tei file : "+srcfile+" to : "+resultfile );
+			
+			def builder = new pager(srcfile,resultfile, NoSpaceBefore, NoSpaceAfter,1500);
+		}
+		
+		return;*/
+		
+		
+		String userDir = System.getProperty("user.home");
+		String lang= "fr"
+		String rootDir;
+		println "DEV MODE";//exception means we debug
+		if(!org.txm.Toolbox.isInitialized()){
+			rootDir = "D:\\Travail_Sev\\Projets\\Corpus\\TXM\\hyperprince"; //userDir+"/xml/hyperprince/";//"D:\\Travail_Sev\\Projets\\Corpus\\TXM\\hyperprince";
+			org.txm.Toolbox.workspace = new Workspace(new File(userDir,"TXM/workspaces/default.xml"));
+			org.txm.Toolbox.setParam(org.txm.Toolbox.INSTALL_DIR,new File(userDir,"TXM"));
+		}
+		
+		Workspace w = org.txm.Toolbox.workspace;
+		Project p = w.getProject("default")
+		p.removeBase("hyperprince")
+		Base b = p.addBase("hyperprince");
+		b.addDirectory(new File(rootDir,"txm"));
+		
+		
+		println "-- EDITION"
+		new File(rootDir+"/HTML/").deleteDir();
+		new File(rootDir+"/HTML/").mkdir();
+		new File(rootDir,"/HTML/multi").mkdir();
+		List<File> filelist = new File(rootDir,"txm").listFiles();
+
+		for(String textname : b.getTextsID())
+		{
+			Text text = b .getText(textname);
+			File srcfile = text.getSource();
+			File resultfile = new File(rootDir+"/HTML",srcfile.getName().substring(0,srcfile.getName().length()-4)+".html");
+			List<String> NoSpaceBefore = LangFormater.getNoSpaceBefore(lang);
+			List<String> NoSpaceAfter = LangFormater.getNoSpaceAfter(lang);
+			println("build hyperprince xml-tei file : "+srcfile+" to : "+resultfile );
+			
+			def ed = new pager(srcfile,resultfile, NoSpaceBefore, NoSpaceAfter,500);
+			
+			Edition editionweb = text.addEdition("default","html",resultfile);
+			//println("pages "+ed.getPageFiles())
+			//println("idx "+ed.getIdx())
+			for(int i = 0 ; i < ed.getPageFiles().size();i++)
+			{
+				File f = ed.getPageFiles().get(i);
+				String idx = ed.getIdx().get(i);
+				editionweb.addPage(f,idx);
+			}
+			
+			//Edition (version Pincemin)
+//			Edition editionbp = text.addEdition("onepage","html",resultfile);
+//			editionbp.addPage(resultfile,ed.getIdx().get(0));
+		}
+		w.save();
+	}
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/importer/hyperprince/hyperprinceLoader.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/hyperprince/hyperprinceLoader.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/hyperprince/hyperprinceLoader.groovy	(revision 258)
@@ -0,0 +1,137 @@
+/**
+ * Main.
+ *
+ * @param args the args
+ */
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer.hyperprince;
+
+import org.txm.importer.hyperprince.importer;
+import org.txm.importer.hyperprince.compiler;
+import org.txm.objects.*;
+import org.txm.Toolbox;
+import org.txm.scripts.teitxm.*;
+import org.txm.utils.i18n.*;
+
+// TODO: Auto-generated Javadoc
+/* (non-Javadoc)
+ * @see groovy.lang.Script#run()
+ */
+String userDir = System.getProperty("user.home");
+String rootDir;
+String lang;
+String encoding;
+String model;
+try{rootDir = rootDirBinding;lang=langBinding;encoding=encodingBinding;model=modelBinding;}
+catch(Exception)
+{	println "DEV MODE";//exception means we debug
+	if(!org.txm.Toolbox.isInitialized())
+	{
+		rootDir = userDir+"/xml/hyperprince/";
+		lang="fr";
+		encoding= "UTF-8";
+		model="rgaqcj";
+		Toolbox.workspace = new Workspace(new File(userDir,"TXM/workspaces/default.xml"));
+		Toolbox.setParam(Toolbox.INSTALL_DIR,new File(userDir,"TXM"));
+		Toolbox.setParam(Toolbox.TREETAGGER_INSTALL_PATH,new File(userDir,"TXM/treetagger"));
+		Toolbox.setParam(Toolbox.TREETAGGER_MODELS_PATH,new File(userDir,"TXM/treetagger/models"));
+		Toolbox.setParam(Toolbox.USER_TXM_HOME, new File(System.getProperty("user.home"),"TXM"));
+	}
+}
+
+File homedir = new File(rootDir);
+String corpusSrc = "Corpus-Hyperprince_2009-06-10.xml";//"Corpus-Hyperprince_2010-04-06.xml";
+
+//IMPORT TXT
+if(!new File(rootDir,corpusSrc).exists())
+{
+	println("source file : "+new File(rootDir,corpusSrc)+" does not exists")
+	return false;
+}
+
+println "-- IMPORTER - Reading source files"
+List<File> srcfiles = [new File(rootDir,corpusSrc)];
+new importer().run(rootDir, corpusSrc);
+
+//ANNOTATE
+println "-- ANNOTATE - Running NLP tools"
+new Annotate().run(homedir,model+".par");
+
+//COMPILATION
+println "COMPILING"
+def c = new compiler()
+//c.setCwbPath("D:\\Travail_Sev\\Logiciels\\TXM\\cwb\\bin"); // for developers
+c.setLang(lang);
+c.run(rootDir);
+
+//move registry file to cwb registry dir
+File registryfile = new File(rootDir+"/registry","hyperprince");
+if(registryfile.exists())
+	org.txm.utils.io.FileCopy.copy(registryfile,new File(Toolbox.getParam(Toolbox.USER_TXM_HOME),"registry/hyperprince"))
+
+Workspace w = org.txm.Toolbox.workspace;
+Project p = w.getProject("default")
+p.removeBase("hyperprince")
+Base b = p.addBase("hyperprince");
+b.addDirectory(new File(rootDir,"txm"));
+b.setAttribute("lang", lang)
+b.propagateAttribute("lang")
+
+println "-- EDITION"
+new File(rootDir+"/HTML/").deleteDir();
+new File(rootDir+"/HTML/").mkdir();
+new File(rootDir,"/HTML/default").mkdir();
+List<File> filelist = new File(rootDir,"txm").listFiles();
+
+for(String textname : b.getTextsID())
+{
+	Text text = b .getText(textname);
+	File srcfile = text.getSource();
+	File resultfile = new File(rootDir+"/HTML",srcfile.getName().substring(0,srcfile.getName().length()-4)+".html");
+	List<String> NoSpaceBefore = LangFormater.getNoSpaceBefore(lang);
+	List<String> NoSpaceAfter = LangFormater.getNoSpaceAfter(lang);
+	println("build hyperprince xml-tei file : "+srcfile+" to : "+resultfile );
+	
+	def ed = new pager(srcfile,resultfile, NoSpaceBefore, NoSpaceAfter,500);
+	
+	Edition editionweb = text.addEdition("default","html",resultfile);
+	//println("pages "+ed.getPageFiles())
+	//println("idx "+ed.getIdx())
+	for(int i = 0 ; i < ed.getPageFiles().size();i++)
+	{
+		File f = ed.getPageFiles().get(i);
+		String idx = ed.getIdx().get(i);
+		editionweb.addPage(f,idx);
+	}
+	
+//	Edition editionbp = text.addEdition("onepage","html",resultfile);
+//	editionbp.addPage(resultfile,ed.getIdx().get(0));
+}
+
+w.save()
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/importer/hyperprince/importer.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/hyperprince/importer.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/hyperprince/importer.groovy	(revision 258)
@@ -0,0 +1,186 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2015-06-03 15:04:53 +0200 (Wed, 03 Jun 2015) $
+// $LastChangedRevision: 2984 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer.hyperprince
+
+import org.txm.importer.*;
+import org.txm.importer.filters.*;
+import org.txm.scripts.*;
+import org.txm.importer.cwb.CwbEncode
+import org.txm.importer.cwb.CwbMakeAll
+import org.txm.scripts.teitxm.*;
+import org.txm.utils.treetagger.TreeTagger;
+import javax.xml.stream.*;
+import java.net.URL;
+
+import filters.CutHeader.*;
+import filters.Tokeniser.*;
+import filters.TagSentences.*;
+import filters.FusionHeader.*;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class importer.
+ *
+ * @author mdecorde
+ * simple import in cwb of RGAQCJ
+ * structunits : initial, s, lb ...
+ * wordproperties : form, pos and n
+ */
+
+class importer
+{		
+	
+	/** The align list. */
+	HashSet<String>  alignList;
+	
+	/** The aa. */
+	AnalyzeAlignement aa ;
+
+	/**
+	 * Run.
+	 *
+	 * @param rootDir the root dir
+	 * @param corpusSrc the corpus src
+	 */
+	public void run(String rootDir, String corpusSrc)//List<File> srcfiles = [new File(rootDir,"Corpus-Hyperprince_2009-06-10.xml")];
+	{
+		//String ActionHome = "~/Bureau/trunkToolbox/0.4.6/org.txm.toolbox/GroovyImportScripts/filters";
+		
+		//-0 split, parceque c'est un corpus et ca a pls header partout partout
+		ArrayList<String> milestones = new ArrayList<String>();//the tags which stay milestones
+		milestones.add("tagUsage");
+		milestones.add("pb");
+		milestones.add("lb");
+		
+		File corpussrc = new File(rootDir,corpusSrc);
+		rootDir = corpussrc.getParent()+"/";
+		
+		new File(rootDir+"ptokenized").deleteDir();
+		new File(rootDir+"ptokenized").mkdir();
+		new File(rootDir+"tokenized").deleteDir();
+		new File(rootDir+"tokenized").mkdir();
+		new File(rootDir+"split").deleteDir();
+		new File(rootDir+"split").mkdir();
+		new File(rootDir+"txm").deleteDir();
+		new File(rootDir+"txm").mkdir();
+		
+		String xslfile = rootDir+"/xsl/splitcorpus.xsl";
+		String outfile = rootDir+"split_temp.xml";
+		
+		aa = new AnalyzeAlignement(corpussrc);
+		alignList = aa.process()
+		ApplyXsl a = new ApplyXsl(xslfile);
+		a.process(corpussrc.getAbsolutePath(),outfile);
+		new File(outfile).delete()
+
+		
+		List<File> files = new File(rootDir,"split").listFiles();//scan directory split
+		//PREPARE EACH FILE TO BE TOKENIZED
+		for(File f : files)
+		{
+			File srcfile = f;
+			//new EncodingConverter(srcfile, "iso-8859-1");
+			File resultfile = new File(rootDir+"ptokenized",f.getName());
+			println("prepare tokenizer file : "+srcfile+" to : "+resultfile );
+			
+			def builder = new OneTagPerLine(srcfile.toURL(), milestones);
+			builder.process(resultfile);
+		}
+		
+		//TOKENIZE FILES
+		//Manager<Filter> filterManager = new FilterManager(ActionHome);
+		files = new File(rootDir,"ptokenized").listFiles();//scan directory split
+		for(File infile : files)
+		{
+			Sequence S = new Sequence();
+			Filter F1 = new CutHeader();
+			Filter F6 = new Tokeniser(infile);
+			Filter F7 = new TagSentences();
+			Filter F11 = new FusionHeader();
+			S.add(F1);
+			S.add(F6);
+			//S.add(F7);
+			S.add(F11);
+			
+			//File infile = new File(rootDir+"tokenized",f.getName()+"-src.xml");
+			File xmlfile = new File(rootDir+"tokenized",infile.getName());
+			println("Tokenizing "+xmlfile)
+			S.setEncodages("UTF-8","UTF-8");
+			S.SetInFileAndOutFile(infile.getAbsolutePath(), xmlfile.getAbsolutePath());
+			
+			Object[] arguments1 = [infile.getParent()+"/"+infile.getName()+"header.xml"];
+			F1.SetUsedParam(arguments1);
+			Object[] arguments2 = [infile.getParent()+"/"+infile.getName()+"header.xml",F1];
+			F11.SetUsedParam(arguments2);
+			
+			S.proceed();
+		}
+		
+		files = new File(rootDir,"tokenized").listFiles()			
+		//TRANSFORM INTO XML-TEI-TXM
+		for(File f : files)
+		{
+			//ArrayList<String> milestones = new ArrayList<String>();
+			println("Building xml-tei-txm "+f+ " >> "+f.getName()+".xml")
+			File file = f; 
+			String txmfile = f.getName().subSequence(0, 2)+".xml";
+			
+			def correspType = new HashMap<String,String>()
+			def correspRef = new HashMap<String,String>()
+			
+			//il faut lister les id de tous les respStmt
+			def respId = [];
+			//fait la correspondance entre le respId et le rapport d'execution de l'outil
+			def applications = new HashMap<String,HashMap<String,String>>();	
+			//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[]>();
+			//associe un id d'item avec sa description et son URI
+			def itemsURI = new HashMap<String,HashMap<String,String>>();
+			//informations de respStmt
+			//resps (respId <voir ci-dessus>, [description, person, date])
+			def resps = new HashMap<String,String[]>();
+			
+			//lance le traitement
+			def builder = new Xml2Ana(file);
+			builder.setCorrespondances(correspRef, correspType);
+			builder.setHeaderInfos(respId,resps, applications, taxonomiesUtilisees, itemsURI)
+			builder.transformFile(rootDir+"txm/",txmfile);
+		}
+		
+		//rename files correctly
+		files = new File(rootDir,"txm").listFiles();
+		for(File file : files)
+		{
+			String txmfile = file.getName();
+			file = aa.addAlignement(file, alignList);
+			txmfile = txmfile.tokenize(".").get(0)+".xml"
+			file.renameTo(new File(file.getParent(),txmfile));
+		}
+	}
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/importer/hyperprince/AnalyzeAlignement.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/hyperprince/AnalyzeAlignement.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/hyperprince/AnalyzeAlignement.groovy	(revision 258)
@@ -0,0 +1,281 @@
+// 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
+// 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.
+
+//
+// This file is part of the TXM platform.
+//
+// The TXM platform is free software: you can redistribute it and/or modif y
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 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/>.
+// 
+// 
+// 
+// $LastChangedDate: 2015-12-17 12:11:39 +0100 (Thu, 17 Dec 2015) $
+// $LastChangedRevision: 3087 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer.hyperprince
+
+import java.io.File;
+import java.net.URL;
+import java.util.ArrayList;
+import javax.xml.stream.*;
+
+import org.txm.functions.concordances.comparators.NullComparator;
+
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class AnalyzeAlignement.
+ */
+class AnalyzeAlignement {
+	
+	/** The url. */
+	private def url;
+	
+	/** The input data. */
+	private def inputData;
+	
+	/** The factory. */
+	private def factory;
+	
+	/** The parser. */
+	private XMLStreamReader parser;
+	
+	/**
+	 * Instantiates a new analyze alignement.
+	 *
+	 * @param file the file
+	 */
+	public AnalyzeAlignement(File file){
+		try {
+			this.url = file.toURI().toURL();
+			inputData = url.openStream();
+			factory = XMLInputFactory.newInstance();
+			factory.setProperty(XMLInputFactory.IS_VALIDATING,false)
+			parser = factory.createXMLStreamReader(inputData);
+			
+		} catch (XMLStreamException ex) {
+			System.out.println(ex);
+		}catch (IOException ex) {
+			System.out.println("IOException while parsing ");
+		}
+	}
+	
+	/**
+	 * Process.
+	 *
+	 * @return the list
+	 */
+	public List <Set <String>> process(){
+		List <Set <String>> list = new ArrayList <Set <String>>();
+		
+		String localname = "";
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+			
+			String prefix = parser.getPrefix();
+			if(prefix == null || prefix == "")
+				prefix = "";
+			else
+				prefix +=":";
+			
+			switch (event) {
+				case XMLStreamConstants.START_ELEMENT:
+					localname = parser.getLocalName();
+				
+				// <link targets="#i1_Pr-Seg0 #f1_Pr-Seg0 #f3_Pr-Seg0 #f5_Pr-Seg0 #f4_Pr-Seg0 "/>
+					if(localname == "link"){
+						for(int i= 0 ; i < parser.getAttributeCount() ;i++ )
+						{
+							String att = parser.getAttributeLocalName(i)
+							if(att == "targets"){
+								List<String> vals = parser.getAttributeValue(i).split(" ");
+								HashSet<String> newVals = new HashSet<String>();
+								//vals*.trim(); dans le cas du #
+								vals.each{ it->
+									newVals << it.substring(1);
+								}
+								list.add(newVals);
+							}
+						}
+					}
+			}
+		}
+		parser.close()
+		return list;
+	}
+	
+	/**
+	 * Adds the alignement.
+	 *
+	 * @param file the file
+	 * @param alignIds the align ids
+	 * @return the file
+	 */
+	public File addAlignement(File file, HashSet<String> alignIds){
+		try {
+			this.url = file.toURI().toURL();
+			inputData = url.openStream();
+			factory = XMLInputFactory.newInstance();
+			factory.setProperty(XMLInputFactory.IS_VALIDATING,false)
+			parser = factory.createXMLStreamReader(inputData);
+			
+		} catch (XMLStreamException ex) {
+			System.out.println(ex);
+		}catch (IOException ex) {
+			System.out.println("IOException while parsing ");
+		}
+		
+		/*
+		 File outfile = new File(outdir,textname+language+".xml");
+		 Writer output = new OutputStreamWriter(new FileOutputStream(outfile) , "UTF-8");
+		 def writer = factory.createXMLStreamWriter(output, "UTF-8")*/
+		String textname = file.getName().substring(0,file.getName().length()-4)+"_";
+		
+		// create XML writer
+		File tempFile = new File(file.getParent(),textname+"temp.xml");
+		XMLOutputFactory factory = XMLOutputFactory.newInstance();
+		FileOutputStream output = new FileOutputStream(tempFile)
+		def writer = factory.createXMLStreamWriter(output, "UTF-8")
+		
+		
+		String localname = "";
+		writer.writeStartDocument("UTF-8","1.0");
+		writer.writeStartElement ("TEI");
+		
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+			
+			String prefix = parser.getPrefix();
+			if(prefix == null || prefix == "")
+				prefix = "";
+			else
+				prefix +=":";
+			
+			switch (event) {
+				case XMLStreamConstants.START_ELEMENT:
+					localname = parser.getLocalName();
+					if(prefix == null){
+						writer.writeStartElement(prefix, localname);
+					}else {
+						writer.writeStartElement(localname);
+					}
+					for(int i= 0 ; i < parser.getAttributeCount() ;i++ )
+					{
+						writer.writeAttribute(parser.getAttributeLocalName(i), parser.getAttributeValue(i))
+						if("id" == parser.getAttributeLocalName(i)){
+							if((parser.getAttributeValue(i)).startsWith("w")){
+							}else {
+								String idAlign = searchForAlignId(parser.getAttributeValue(i), alignIds);
+								writer.writeAttribute("pid", idAlign);
+								if(idAlign == "-1"){
+									System.out.println(parser.getAttributeValue(i)+" - ALIGN ID is ? "+idAlign);
+								}
+							}
+						}
+					}
+				
+					break;
+				case XMLStreamConstants.END_ELEMENT:
+					writer.writeEndElement();
+				
+					break;
+				case XMLStreamConstants.CHARACTERS:
+					writer.writeCharacters(parser.getText());
+					break;
+			}
+		}
+		writer.writeEndElement(); // close TEI
+		parser.close();
+		writer.close();
+		output.close()
+		inputData.close();
+		return copyfile(tempFile.getAbsolutePath(), file.getAbsolutePath());
+
+	}
+	
+	/**
+	 * Copyfile.
+	 *
+	 * @param srFile the sr file
+	 * @param dtFile the dt file
+	 * @return the file
+	 */
+	private static File copyfile(String srFile, String dtFile){
+		File f2 ;
+		try{
+			File f1 = new File(srFile);
+			f2 = new File(dtFile);
+			InputStream inStr = new FileInputStream(f1);
+			
+			//For Append the file.
+			//OutputStream out = new FileOutputStream(f2,true);
+			
+			//For Overwrite the file.
+			OutputStream out = new FileOutputStream(f2);
+			
+			byte[] buf = new byte[1024];
+			int len;
+			while ((len = inStr.read(buf)) > 0){
+				out.write(buf, 0, len);
+			}
+			inStr.close();
+			out.close();
+			System.out.println("File copied.");
+		}
+		catch(FileNotFoundException ex){
+			System.out.println(ex.getMessage() + " in the specified directory.");
+			return null;
+		}
+		catch(IOException e){
+			System.out.println(e.getMessage());      
+		}
+		return f2;
+	}
+	
+	/**
+	 * Search for align id.
+	 *
+	 * @param id the id
+	 * @param alignIds the align ids
+	 * @return the string
+	 */
+	public String searchForAlignId(String id, HashSet<String> alignIds){
+		int i = 0;
+		for(Set<String> set: alignIds){
+			i++;
+			if(set.contains(id)){
+				return ""+i;
+			}
+		}
+		return "-1";
+	}
+	
+	
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/importer/hyperprince/compiler.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/hyperprince/compiler.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/hyperprince/compiler.groovy	(revision 258)
@@ -0,0 +1,387 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2017-01-24 18:11:42 +0100 (Tue, 24 Jan 2017) $
+// $LastChangedRevision: 3400 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer.hyperprince
+;
+
+import org.txm.importer.cwb.CwbEncode
+import org.txm.importer.cwb.CwbMakeAll
+import org.txm.importer.*;
+import org.txm.scripts.*;
+import org.txm.scripts.teitxm.BuildTTSrc;
+import org.txm.scripts.teitxm.*;
+import org.txm.utils.treetagger.TreeTagger;
+
+import javax.xml.stream.*;
+import java.net.URL;
+import java.io.File;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.List;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class compiler.
+ */
+class compiler 
+{
+	
+	/** The input data. */
+	private def inputData;
+	
+	/** The factory. */
+	private def factory;
+	
+	/** The parser. */
+	private def parser;
+	
+	/** The dir. */
+	private def dir;
+	
+	/** The output. */
+	private def output;
+	
+	/** The url. */
+	private def url;
+	
+	/** The anahash. */
+	private HashMap<String,String> anahash =new HashMap<String,String>() ;
+	
+	/** The text. */
+	String text="";
+	
+	/** The base. */
+	String base="";
+	
+	/** The project. */
+	String project="";
+	
+	/** The cwb loc. */
+	String cwbLoc;
+	
+	/** The lang. */
+	private String lang ="fr";
+	
+	/**
+	 * Instantiates a new compiler.
+	 */
+	public compiler(){}
+	
+	/**
+	 * initialize.
+	 *
+	 * @param url the url
+	 * @param text the text
+	 * @param base the base
+	 * @param project the project
+	 */
+	public compiler(URL url,String text,String base, String project)
+	{
+		this.text = text
+		this.base = base;
+		this.project = project;
+		
+		try {
+			this.url = url;
+			inputData = url.openStream();
+			
+			factory = XMLInputFactory.newInstance();
+			parser = factory.createXMLStreamReader(inputData);
+		} catch (XMLStreamException ex) {
+			System.out.println(ex);
+		}catch (IOException ex) {
+			System.out.println("IOException while parsing ");
+		}
+	}
+	
+	/**
+	 * Sets the cwb path.
+	 *
+	 * @param path the new cwb path
+	 */
+	public void setCwbPath(String path)
+	{
+		if(!new File(path).exists())
+			System.err.println("CWB Path : "+path+" does not exists")
+		cwbLoc = path;
+	}
+	
+	/**
+	 * set the language of the corpus.
+	 *
+	 * @param lang the lang
+	 * @return the java.lang. object
+	 */
+	public setLang(String lang)
+	{
+		this.lang = lang;
+	}
+	
+	/**
+	 * Creates the output.
+	 *
+	 * @param dirPathName the dir path name
+	 * @param fileName the file name
+	 * @return true, if successful
+	 */
+	private boolean createOutput(String dirPathName, String fileName){
+		try {
+			File f = new File(dirPathName, fileName)
+			output = new OutputStreamWriter(new FileOutputStream(f,f.exists()) , "UTF-8")
+			return true;
+		} catch (Exception e) {
+			System.out.println(e.getLocalizedMessage());
+			return false;
+		}
+	}
+	
+	/**
+	 * clear anaHash variable, it is used to store ana tags values then print it when the end element </ana> is found.
+	 */
+	private void fillanaHash()
+	{
+		anahash.clear();
+		for(String s : types)
+		anahash.put( s,"-" );
+	}
+	
+	/**
+	 * Transfom file wtc.
+	 *
+	 * @param dirPathName the dir path name
+	 * @param fileName the file name
+	 * @param idtext the idtext
+	 * @return true, if successful
+	 */
+	public boolean transfomFileWtc(String dirPathName, String fileName,idtext)
+	{
+		createOutput(dirPathName, fileName);
+		
+		String author = "";
+		String date = "";
+		String lang = "";
+		String vAna = "";
+		String vForm = "";
+		String wordid= "";
+		
+		boolean flagAuthor = false;
+		boolean flagDate = false;
+		boolean flagForm = false;
+		boolean flagAna = false;
+		output.write("<txmcorpus lang=\""+lang+"\">\n"); 
+		try 
+		{
+			for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) 
+			{
+				switch (event) 
+				{
+					case XMLStreamConstants.START_ELEMENT:
+					switch (parser.getLocalName()) 
+					{
+						
+						case "monogr"://get attr lang
+						lang = parser.getAttributeValue(null,"lang");
+						//idtext = parser.getAttributeValue(null,"id");
+						break;
+						
+						case "author"://get text
+						flagAuthor = true;
+						author ="";
+						break;
+						
+						case "date"://get text
+						flagDate = true;
+						date = "";
+						break;
+						
+						case "text"://write tag+ lang + date + author
+						output.write("<text lang=\""+lang+"\" auteur=\""+author+"\" date=\""+date+"\" id=\""+idtext+"\" base=\""+base+"\" project=\""+project+"\">\n");
+						break;
+						
+						case "front"://get type,id, write tag
+						case "back"://get type,id, write tag
+						case "head"://get type,id, write tag
+						case "seg"://get type,id,n write tag
+						output.write("<"+parser.getLocalName()+" id=\""+parser.getAttributeValue(null,"id")+"\" type=\""+parser.getAttributeValue(null,"type")+"\">\n");
+						break;
+						
+						case "body"://get type,id, write tag BODY
+						//	for(int i = 0 ; i < parser.getAttributeCount(); i++)
+								
+						output.write("<body id=\""+parser.getAttributeValue(null,"id")+"\" type=\""+parser.getAttributeValue(null,"type")+"\">\n");
+						break;
+						
+						case "s":
+						output.write( "<s>\n");
+						break;
+						
+						case "w":
+						wordid = parser.getAttributeValue(null,"id")
+						break;
+						case "form":
+						flagForm = true;
+						vForm = "";
+						vAna ="";
+						break;
+						
+						case "ana":
+						flagAna = true;
+						break;
+					}
+					break;
+					
+					case XMLStreamConstants.END_ELEMENT:
+					switch (parser.getLocalName()) 
+					{
+						case "author"://get text
+						flagAuthor = false;
+						break;
+						
+						case "date"://get text
+						flagDate = false;
+						break;
+						
+						case "text"://write tag+ lang + date + author
+						output.write("</text>\n");
+						break;
+						
+						case "front"://get type,id, write tag
+						case "back"://get type,id, write tag
+						case "head"://get type,id, write tag
+						case "seg"://get type,id,n write tag
+						output.write("</"+parser.getLocalName()+">\n");
+						break;
+						
+						case "div0"://get type,id, write tag BODY
+						output.write("</body>\n");
+						break;
+						
+						case "s":
+						output.write( "</s>\n");
+						break;
+						
+						case "w":
+						output.write( vForm +vAna+"\t"+wordid+"\n");
+						vAna = "";
+						vForm = "";
+						break;
+						
+						case "form":
+						flagForm = false;
+						break;
+						
+						case "ana":
+						flagAna = false;
+						break;
+					}
+					break;
+					
+					case XMLStreamConstants.CHARACTERS:
+					if(flagForm)
+					vForm += parser.getText().trim();
+					if(flagAna)
+					vAna += "\t" +parser.getText().trim();
+					if(flagDate)
+					date += parser.getText().trim();
+					if(flagAuthor)
+					author += parser.getText().trim();
+					break;
+				}
+			}
+			output.write("</txmcorpus>"); 
+			output.close();
+			parser.close();
+			inputData.close();
+		}
+		catch (XMLStreamException ex) {
+			System.out.println(ex);
+		}
+		catch (IOException ex) {
+			System.out.println("IOException while parsing " + inputData);
+		}
+		
+		return true;
+	}
+	
+	/**
+	 * Run.
+	 *
+	 * @param rootDir the root dir
+	 */
+	public boolean run(String rootDir) 
+	{
+		//String rootDir = "~/xml/Hyperprince/";
+		if(cwbLoc == null)
+			cwbLoc = org.txm.Toolbox.getParam(org.txm.Toolbox.CQI_SERVER_PATH_TO_CQPLIB)+File.separator;
+		
+		new File(rootDir,"wtc/hyperprince.wtc").delete();//cleaning&preparing
+		new File(rootDir,"wtc/").deleteDir();
+		new File(rootDir,"wtc/").mkdir();
+		new File(rootDir,"registry/").mkdir();
+		
+		//1- Transform into WTC file
+		List<File> files = new File(rootDir,"txm").listFiles();
+		for(File f : files) {
+			if(!f.exists()) {
+				println("file "+f+ " does not exists")	
+			}
+			else
+			{	
+				println("process file "+f)
+				String txtname = f.getName().substring(0,f.getName().length()-4);
+				def builder = new compiler(f.toURL(),txtname, "hyperprince", "default");
+				builder.setLang lang
+				builder.transfomFileWtc(rootDir,"wtc/hyperprince.wtc",f.getName());
+			}
+		}
+		
+		//2- Import into CWB
+		def outDir =rootDir;
+		def outDirTxm = rootDir;
+		
+		CwbEncode cwbEn = new CwbEncode();
+		cwbEn.setDebug true;
+		CwbMakeAll cwbMa = new CwbMakeAll();
+		cwbMa.setDebug true;
+		
+		String[] pAttributes = ["pos","lemme","id"];
+		String[] sAttributes = ["txmcorpus:0+lang", "text:0+auteur+date+id+lang+base+project","front:0+type+id","body:0+type+id","back:0+type+id","head:0+type+id", "seg:0+type+n+id"];
+		
+		try {
+			String regPath =outDirTxm + "/registry/"+"hyperprince"
+			cwbEn.run(cwbLoc + "/cwb-encode", outDirTxm + "data", outDir + "/wtc/"+"hyperprince.wtc", regPath,pAttributes, sAttributes);
+			if (!new File(regPath).exists()) {
+				println "Error: The registry file was not created: $regPath. See https://groupes.renater.fr/wiki/txm-users/public/faq"
+				return false;
+			}
+			cwbMa.run(cwbLoc + "/cwb-makeall", "HYPERPRINCE", outDirTxm + "/registry");
+		} catch (Exception ex) {System.out.println(ex); return false;}
+		
+		System.out.println("Done.") 
+		return true;
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/hyperprince/package.html
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/hyperprince/package.html	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/hyperprince/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Hyperprince import module : multi-ling corpus</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/org/txm/importer/hyperprince/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/importer/xmltxm/compiler.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/xmltxm/compiler.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/xmltxm/compiler.groovy	(revision 258)
@@ -0,0 +1,533 @@
+// 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
+// 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.
+//
+//
+//
+// $LastChangedDate: 2016-05-26 17:42:36 +0200 (Thu, 26 May 2016) $
+// $LastChangedRevision: 3219 $
+// $LastChangedBy: mdecorde $
+//
+
+
+package org.txm.importer.xmltxm;
+
+import java.util.ArrayList;;
+
+import org.txm.*;
+import org.txm.importer.cwb.BuildCwbEncodeArgs;
+import org.txm.importer.cwb.CwbEncode
+import org.txm.importer.cwb.CwbMakeAll
+import org.txm.importer.*;
+import org.txm.scripts.*;
+import org.txm.scripts.teitxm.BuildTTSrc;
+import org.txm.scripts.teitxm.*;
+import org.txm.utils.treetagger.TreeTagger;
+
+import javax.xml.stream.*;
+import java.net.URL;
+import java.io.File;
+import java.util.HashMap;
+import java.util.List;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class compiler.
+ */
+class compiler
+{
+	String sortMetadata;
+	/** The debug. */
+	private boolean debug= false;
+
+	/** The input data. */
+	private def inputData;
+
+	/** The factory. */
+	private def factory;
+
+	/** The parser. */
+	private XMLStreamReader parser;
+
+	/** The dir. */
+	private def dir;
+
+	/** The output. */
+	private Writer output;
+
+	/** The url. */
+	private def url;
+
+	/** The text. */
+	String text="";
+
+	/** The base. */
+	String base="";
+
+	/** The project. */
+	String project="";
+
+	/** The cwb loc. */
+	String cwbLoc;
+
+	/** The lang. */
+	private String lang ="fr";
+
+	/** The s attribs. */
+	private static HashMap<String, List<String>> sAttribs;
+
+	/** The anatypes. */
+	private static anatypes = []
+	private static anavalues = [:]
+	
+	/**
+	 * initialize.
+	 *
+	 */
+	public compiler(){}
+
+	/**
+	 * Instantiates a new compiler.
+	 *
+	 * @param url the url
+	 * @param text the text
+	 * @param base the base
+	 * @param project the project
+	 */
+	public compiler(URL url,String text,String base, String project)
+	{
+		this.text = text
+		this.base = base;
+		this.project = project;
+		try {
+			this.url = url;
+			inputData = url.openStream();
+
+			factory = XMLInputFactory.newInstance();
+			parser = factory.createXMLStreamReader(inputData);
+		} catch (Exception ex) {
+			System.out.println("Error while creating indexes: $ex");
+			ex.printStackTrace();
+		}
+	}
+
+	public void setSortMetadata(String sortMetadata)
+	{
+		this.sortMetadata = sortMetadata;
+	}
+
+	/**
+	 * set the language of the corpus.
+	 *
+	 * @param lang the lang
+	 * @return the java.lang. object
+	 */
+	public setLang(String lang)
+	{
+		this.lang = lang;
+	}
+
+	/**
+	 * Sets the cwb path.
+	 *
+	 * @param path the new cwb path
+	 */
+	public void setCwbPath(String path)
+	{
+		if(!new File(path).exists())
+			System.err.println("CWB Path : "+path+" does not exists")
+		cwbLoc = path;
+	}
+
+	/**
+	 * Creates the output.
+	 *
+	 * @param dirPathName the dir path name
+	 * @param fileName the file name
+	 * @return true, if successful
+	 */
+	private boolean createOutput(File f) {
+		try {
+			//File f = new File(dirPathName, fileName)
+			output = new OutputStreamWriter(new BufferedOutputStream(new FileOutputStream(f,f.exists())) , "UTF-8");
+			return true;
+		} catch (Exception e) {
+		println "Error while create WTC otput file: "+e
+			e.printStackTrace();
+
+			return false;
+		}
+	}
+
+	/**
+	 * Go to text.
+	 */
+	private boolean GoToText()
+	{
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+			if (event == XMLStreamConstants.END_ELEMENT)
+				if (parser.getLocalName().equals("teiHeader") || parser.getLocalName().equals("teiheader")) {
+					return true;
+				}
+		}
+		return false;
+	}
+
+	/**
+	 * Transfom file wtc.
+	 *
+	 * @param dirPathName the dir path name
+	 * @param fileName the file name
+	 * @return true, if successful
+	 */
+	public boolean transfomFileWtc(File wtcFile)
+	{
+		createOutput(wtcFile);
+		String headvalue=""
+		String vAna = "";
+		String vForm = "";
+		String wordid= "";
+		String vHead = "";
+		String anatype = null;
+		String anavalue = null;
+		int p_id = 0;
+		int s_id = 0;
+
+		boolean captureword = false;
+		boolean flagForm = false;
+		boolean flagAna = false;
+		boolean inW = false;
+		int wcounter = 1;
+		if (!GoToText()) {
+			println "Error: no teiHeader tag found in text '"+this.text+"' (please check file format or content)"
+			return false;
+		}
+		int wc = 0; // TEMP FOR TEST ONLY
+		try {
+			for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next())
+			{
+				switch (event) {
+					case XMLStreamConstants.START_ELEMENT:
+						//println "start: "+parser.getLocalName()
+						switch (parser.getLocalName()) {
+							case "w":
+							
+							inW = true;
+							anavalues = [:]
+							wordid = parser.getAttributeValue(null, "id")
+							if (wordid == null)
+								wordid = "w_"+text+"_"+(wcounter++)
+
+							vAna ="";
+							break;
+
+							case "form":
+							String type2 = parser.getAttributeValue(null, "type");
+							if(type2 == null || type2.equals("default")) {
+								flagForm = true;
+								vForm = "";
+							} else {
+								flagAna = true;
+								vAna += "\t";
+								if(!anatypes.contains(type2))
+									anatypes << type2;
+							}
+							
+							break;
+
+							case "ana":
+							flagAna = true;
+							anavalue = "";
+							anatype = parser.getAttributeValue(null, "type");
+							if (anatype != null) {
+								if(anatype.startsWith("#"))
+									anatype = anatype.substring(1)
+								break;
+							}
+							break;
+
+							default:
+							if (!inW) {
+								output.write("<"+parser.getLocalName().toLowerCase());
+								if (!sAttribs.containsKey(parser.getLocalName()))
+									sAttribs.put(parser.getLocalName().toLowerCase(), []);
+
+								for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
+									String attrname = parser.getAttributeLocalName(i).toLowerCase();
+									String attrvalue = parser.getAttributeValue(i);
+									if (!(parser.getLocalName() == "text" && attrname == "id"))
+										output.write(" "+attrname+"=\""+attrvalue.replace("\"", "'")+"\"");
+
+									if (!sAttribs.get(parser.getLocalName().toLowerCase()).contains(attrname))
+										sAttribs.get(parser.getLocalName().toLowerCase()).add(attrname)
+								}
+
+								if (parser.getLocalName() == "text") {
+									output.write(" id=\""+text+"\" base=\""+base+"\" project=\""+project+"\"");
+								}
+								output.write(">\n");
+							}
+						}
+						break;
+
+					case XMLStreamConstants.END_ELEMENT:
+						switch (parser.getLocalName()) {
+							case "TEI":
+								break;
+							case "w":
+							for (String t : anatypes) {
+								def v = anavalues.get(t);
+								if (v != null) vAna +="\t"+v;
+								else vAna +="\t";
+							}
+							
+							output.write( vForm.replaceAll("&", "&amp;").replaceAll("<", "&lt;") +"\t"+wordid+vAna+"\n");
+							vAna = "";
+							vForm = "";
+							inW = false;
+							break;
+
+							case "form":
+							flagForm = false;
+							flagAna = false;
+							break;
+
+							case "ana":
+							anavalues.put(anatype, anavalue)
+							flagAna = false;
+							break;
+
+							default:
+							if(!inW)
+								output.write("</"+parser.getLocalName().toLowerCase()+">\n");
+
+						}
+						break;
+
+					case XMLStreamConstants.CHARACTERS:
+						if(inW)
+						{	
+							if(flagForm) {	
+								vForm += parser.getText().trim();
+							}
+							else if (flagAna) {
+								anavalue += parser.getText().trim();
+							}
+						}
+						break;
+				}
+			}
+
+			output.close();
+			parser.close();
+		}
+		catch (Exception ex) {
+			System.out.println("Error while writing WTC file $ex");
+			ex.printStackTrace();
+			return false;
+		}
+		return true;
+	}
+
+
+
+	/**
+	 * Run.
+	 *
+	 * @param rootDirFile the root dir file
+	 * @param basename the basename
+	 * @return true, if successful
+	 */
+	public boolean run(File binDir, File txmDir, String basename, String corpusname, List<File> files)
+	{
+		anatypes = new ArrayList<String>();// init only 1 time
+		anavalues = [:]
+		sAttribs = new HashMap<String, List<String>>();// init only 1 time
+		String rootDir = binDir.getAbsolutePath();
+
+		if(cwbLoc == null)
+			cwbLoc = org.txm.Toolbox.getParam(org.txm.Toolbox.CQI_SERVER_PATH_TO_CQPLIB)+File.separator;
+
+		if(!new File(cwbLoc).exists()) {
+			println ("CWB path error: "+cwbLoc)
+			return false;
+		}
+		if(!new File(rootDir).exists()) {
+			println ("binary directory does not exists: "+rootDir)
+			return false;
+		}
+
+		File wtcFile = new File(binDir,"wtc/"+corpusname.toLowerCase()+".wtc");
+		new File(rootDir,"/wtc/").deleteDir();
+		new File(rootDir,"/wtc/").mkdir();
+		new File(rootDir,"data/"+corpusname).deleteDir();
+		new File(rootDir,"data/"+corpusname).mkdir();
+		new File(rootDir,"registry/").mkdir();
+
+		String textid = "";
+		int counttext = 0;
+		//List<File> files = txmDir.listFiles();
+		
+		// get all anatypes
+		for (File f : files) {
+			getAnaTypes(f)
+		}
+
+		//0 set Lang
+		if (createOutput(wtcFile)) {
+			output.write("<txmcorpus lang=\""+lang+"\">\n");
+			output.close();
+		}
+		//1- Transform into WTC file
+		def builder = null;
+		for (File f : files) {
+			counttext++;
+			if (!f.exists()) {
+				println("file "+f+ " does not exists")
+			} else {
+				//println("process file "+f)
+				String txtname = f.getName().substring(0,f.getName().length()-4);
+				builder = new compiler(f.toURI().toURL(), txtname, corpusname.toLowerCase(), "default");
+				builder.setLang(lang);
+				if(!builder.transfomFileWtc(wtcFile))
+					return false;
+			}
+		}
+
+		//end corpus
+		if (createOutput(wtcFile)) {
+			output.write("</txmcorpus>\n");
+			output.close();
+		}
+
+		//2- Import into CWB
+
+		CwbEncode cwbEn = new CwbEncode();
+		cwbEn.setDebug(debug);
+		CwbMakeAll cwbMa = new CwbMakeAll();
+		cwbMa.setDebug(debug);
+		List<String> pargs = ["id"];
+		for(String ana : anatypes)
+			pargs.add(ana);
+
+		List<String> sargs = [];
+		//println "Found Sattributes "+this.sAttribs;
+		if(sAttribs.containsKey("text")) {
+			if(!sAttribs.get("text").contains("id"))
+				sAttribs.get("text").add("id");
+			if(!sAttribs.get("text").contains("base"))
+				sAttribs.get("text").add("base");
+			if(!sAttribs.get("text").contains("project"))
+				sAttribs.get("text").add("project");
+		} else {
+			sargs.add("text:0+id+base+project")
+		}
+
+		if (sAttribs.containsKey("txmcorpus")) {
+			if(!sAttribs.get("txmcorpus").contains("lang"))
+				sAttribs.get("txmcorpus").add("lang");
+		} else {
+			sargs.add("txmcorpus:0+lang")
+		}
+
+		for (String tag : this.sAttribs.keySet()) {
+			String sAttr = tag;
+			if(sAttribs.get(tag).size() > 0)
+				sAttr += ":";
+			for(String attr : sAttribs.get(tag))
+				sAttr +="+"+attr;
+			sargs.add(sAttr)
+		}
+
+
+
+		String[] sAttributes = sargs;
+		String[] pAttributes = pargs;
+		println "sAttributes : "+sAttributes;
+		println "pAttributes : "+pAttributes;
+		try {
+			println cwbLoc
+			String regPath = rootDir + "/registry/"+corpusname.toLowerCase() 
+			cwbEn.run(new File(cwbLoc,"cwb-encode").getAbsolutePath(), 
+				rootDir + "/data/$corpusname", 
+				wtcFile.getAbsolutePath(), 
+				regPath, pAttributes, sAttributes);
+			if (!new File(regPath).exists()) {
+				println "Error: The registry file was not created: $regPath. See https://groupes.renater.fr/wiki/txm-users/public/faq"
+				return false;
+			}
+			cwbMa.run(new File(cwbLoc,"cwb-makeall").getAbsolutePath(), corpusname, rootDir + "/registry");
+
+		} catch (Exception ex) {
+			System.out.println("Error while creating indexes with CQP tools: $ex");
+			ex.printStackTrace();
+			return false;
+		}
+
+		return true;
+	}
+
+	/**
+	 * Sets the debug.
+	 */
+	public void setDebug()
+	{
+		this.debug = true;
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args)
+	{
+		File dir = new File("~/xml/geo");
+		def c = new compiler();
+		c.setDebug();
+		c.setCwbPath("~/TXM/cwb/bin");
+		c.run(dir,"geo");
+	}
+	
+	private void getAnaTypes(File xmlFile) {
+		inputData = xmlFile.toURI().toURL().openStream();
+		factory = XMLInputFactory.newInstance();
+		parser = factory.createXMLStreamReader(inputData);
+		String ana = "ana"
+		HashSet<String> types = new HashSet<String>();
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+			if (event == XMLStreamConstants.START_ELEMENT) { // start elem
+				if (ana.equals(parser.getLocalName())) { // ana elem
+					for (int i = 0 ; i < parser.getAttributeCount(); i++) { // find @type
+						if ("type".equals(parser.getAttributeLocalName(i))) { // @type
+							types.add(parser.getAttributeValue(i).substring(1)); //remove the #
+							break;
+						}
+					}
+				}
+			}
+		}
+		parser.close()
+
+		for (String type : types)
+			if (!anatypes.contains(type))
+				anatypes << type
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/xmltxm/package.html
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/xmltxm/package.html	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/xmltxm/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>XML-TXM import module</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/org/txm/importer/xmltxm/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/importer/xmltxm/xmltxmLoader.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/xmltxm/xmltxmLoader.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/xmltxm/xmltxmLoader.groovy	(revision 258)
@@ -0,0 +1,241 @@
+// 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
+// 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.
+//
+// $LastChangedDate: 2016-05-11 08:38:47 +0200 (Wed, 11 May 2016) $
+// $LastChangedRevision: 3211 $
+// $LastChangedBy: mdecorde $
+//
+package org.txm.importer.xmltxm
+
+import javax.xml.stream.*;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.OutputStreamWriter;
+import java.io.PrintStream;
+import java.net.URL;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.io.File;
+
+import org.txm.importer.*;
+import org.txm.importer.xmltxm.compiler;
+import org.txm.importer.xml.pager;
+import org.txm.objects.*;
+import org.txm.utils.*;
+import org.txm.*;
+import org.txm.scripts.teitxm.*;
+import org.txm.metadatas.*;
+import org.txm.utils.i18n.*;
+import org.txm.utils.io.FileCopy;
+import org.w3c.dom.Element;
+
+String userDir = System.getProperty("user.home");
+boolean debug = false
+def MONITOR;
+BaseParameters params;
+try {params = paramsBinding;MONITOR=monitor} catch (Exception)
+{	println "DEV MODE";//exception means we debug
+	debug = true
+	params = new BaseParameters(new File(userDir, "xml/anapovoas/FOLLOWING TEST OF MATTHIEU/OUTPUT 2/import.xml"))
+	params.load()
+	if (!org.txm.Toolbox.isInitialized()) {
+		Toolbox.setParam(Toolbox.INSTALL_DIR,new File("/usr/lib/TXM"));
+		Toolbox.setParam(Toolbox.TREETAGGER_INSTALL_PATH,new File(userDir,"treetagger"));
+		Toolbox.setParam(Toolbox.TREETAGGER_MODELS_PATH,new File(userDir,"treetagger/models"));
+		Toolbox.setParam(Toolbox.METADATA_ENCODING, "UTF-8");
+		Toolbox.setParam(Toolbox.METADATA_COLSEPARATOR, ",");
+		Toolbox.setParam(Toolbox.METADATA_TXTSEPARATOR, "\"");
+		Toolbox.setParam(Toolbox.USER_TXM_HOME, new File(System.getProperty("user.home"), "TXM"));
+	}
+}
+if (params == null) { println "no parameters. Aborting"; return; }
+
+String corpusname = params.getCorpusName();
+Element corpusElem = params.corpora.get(corpusname);
+String basename = params.name;
+String rootDir = params.rootDir;
+String lang = corpusElem.getAttribute("lang");
+String model = lang
+String encoding = corpusElem.getAttribute("encoding");
+boolean annotate = "true" == corpusElem.getAttribute("annotate");
+String xsl = params.getXsltElement(corpusElem).getAttribute("xsl")
+def xslParams = params.getXsltParams(corpusElem);
+int wordsPerPage = params.getWordsPerPage("default")
+String page_element = params.getPageElement("default")
+boolean build_edition = params.getDoEdition("default")
+
+File srcDir = new File(rootDir);
+File binDir = new File(Toolbox.getParam(Toolbox.USER_TXM_HOME),"corpora/"+basename);
+binDir.deleteDir();
+binDir.mkdirs();
+if (!binDir.exists()) {
+	println "Could not create binDir "+binDir
+	return;
+}
+
+File txmDir = new File(binDir,"txm/$corpusname");
+txmDir.deleteDir();
+txmDir.mkdirs();
+
+File allmetadatasfile = new File(srcDir, "metadata.csv");
+
+// Apply XSL
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+if (MONITOR != null) MONITOR.worked(1, "APPLYING XSL")
+if (xsl != null && xslParams != null && xsl.trim().length() > 0) {
+	if (ApplyXsl2.processImportSources(new File(xsl), srcDir, new File(binDir, "src"), xslParams))
+	// return; // error during process
+	srcDir = new File(binDir, "src");
+	println ""
+}
+
+// copy txm files
+println "Copying XML-TXM files..."
+List<File> srcfiles = srcDir.listFiles();
+for (File f : srcfiles) {// check XML format, and copy file into binDir
+	if (f.isHidden() || f.getName().equals("import.xml") || f.getName().equals("metadata.csv") || f.getName().endsWith(".properties"))
+		continue;
+	if (ValidateXml.test(f)) {
+		FileCopy.copy(f, new File(txmDir, f.getName()));
+	} else {
+		println "Won't process file "+f;
+	}
+}
+
+def files = txmDir.listFiles();
+if (files == null || files.size() == 0) {
+	println "No txm file to process"
+	return;
+}
+
+////get metadata values from CSV
+//Metadatas metadatas; // text metadata
+//if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+//if (allmetadatasfile.exists()) {
+//	println "Trying to read metadata from: "+allmetadatasfile
+//	File copy = new File(binDir, "metadata.csv")
+//	if (!FileCopy.copy(allmetadatasfile, copy)) {
+//		println "Error: could not create a copy of metadata file "+allmetadatasfile.getAbsoluteFile();
+//		return;
+//	}
+//	metadatas = new Metadatas(copy, Toolbox.getParam(Toolbox.METADATA_ENCODING), Toolbox.getParam(Toolbox.METADATA_COLSEPARATOR), Toolbox.getParam(Toolbox.METADATA_TXTSEPARATOR), 1)
+//} else {
+//	println "no metadata file: "+allmetadatasfile
+//}
+//
+//if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+//if (MONITOR != null) MONITOR.worked(20, "INJECTING METADATA - from csv file: "+allmetadatasfile)
+//if (metadatas != null) {
+//	println("Injecting metadata: "+metadatas.getHeadersList()+" in texts of directory "+txmDir)
+//	for (File infile : files) {
+//		print "."
+//		File outfile = File.createTempFile("temp", ".xml", infile.getParentFile());
+//
+//		if (!metadatas.injectMetadatasInXml(infile, outfile, "text", null)) {
+//			outfile.delete();
+//		} else {
+//			if (!(infile.delete() && outfile.renameTo(infile))) println "Warning can't rename file "+outfile+" to "+infile
+//			if (!infile.exists()) {
+//				println "Error: could not replace $infile by $outfile"
+//				return false;
+//			}
+//		}
+//	}
+//	println ""
+//}
+
+//sorting files per metadata "date" with format
+def dates = [:]
+def useDates = false
+SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd.MM.yyyy");
+for (File infile : files) { // get dates
+	String str = GetAttributeValue.process(infile, "/TEI/text", "date")
+
+	if (str != "N/A") {
+		dates[infile] = simpleDateFormat.parse(str)
+		useDates = true
+	}
+}
+
+//sort
+if (useDates) {
+	files.sort() { f-> dates[f] }
+} else {
+	files.sort()
+}
+
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+if (MONITOR != null) MONITOR.worked(25, "COMPILING")
+println "-- COMPILING - Building Search Engine indexes"
+def c = new compiler();
+if (debug) c.setDebug();
+c.setLang(lang);
+if (!c.run(binDir, txmDir, basename, corpusname, Arrays.asList(files))) {
+	println "import process stopped";
+	return;
+}
+
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+
+new File(binDir,"HTML/$corpusname").deleteDir();
+new File(binDir,"HTML/$corpusname").mkdirs();
+if (build_edition) {
+
+	if (MONITOR != null) MONITOR.worked(20, "EDITION")
+	println "-- EDITION - Building edition"
+	
+	File outdir = new File(binDir,"/HTML/$corpusname/default/");
+	outdir.mkdirs();
+
+	def second = 0
+
+	println "Paginating text: "
+	for (File srcfile : files) {
+
+		String txtname = srcfile.getName();
+		int i = txtname.lastIndexOf(".");
+		if(i > 0) txtname = txtname.substring(0, i);
+
+		List<String> NoSpaceBefore = LangFormater.getNoSpaceBefore(lang);
+		List<String> NoSpaceAfter = LangFormater.getNoSpaceAfter(lang);
+
+		Element text = params.addText(params.corpora.get(corpusname), txtname, srcfile);
+
+		if (second) { print(", ") }
+		if (second > 0 && (second++ % 5) == 0) println ""
+		print(".");
+
+		def ed = new pager(srcfile, outdir, txtname, NoSpaceBefore, NoSpaceAfter, wordsPerPage, basename, page_element);
+		Element edition = params.addEdition(text, "default", outdir.getAbsolutePath(), "html");
+
+		for (i = 0 ; i < ed.getPageFiles().size();) {
+			File f = ed.getPageFiles().get(i);
+			String wordid = ed.getIdx().get(i);
+			params.addPage(edition, ""+(++i), wordid);
+		}
+	}
+}
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+if (MONITOR != null) MONITOR.worked(20, "FINALIZING")
+File paramFile = new File(binDir, "import.xml");
+DomUtils.save(params.root.getOwnerDocument(), paramFile);readyToLoad = true;
Index: tmp/org.txm.core/src/groovy/org/txm/importer/DisplayXmlTags.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/DisplayXmlTags.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/DisplayXmlTags.groovy	(revision 258)
@@ -0,0 +1,183 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer;
+
+import java.util.HashMap;
+import java.util.ArrayList;
+import java.io.File;
+import javax.xml.stream.*;
+import java.net.URL;
+
+// TODO: Auto-generated Javadoc
+/** count and display the tags of an xml file. @author mdecorde */
+class DisplayXmlTags {
+	ArrayList<String> paths = new ArrayList<String>(); // contains the xpath of
+	// the tags
+	
+	/** The counts. */
+	HashMap<String, Integer> counts = new HashMap<String, Integer>(); // contains the counts per tag
+	
+	/** The chars. */
+	HashMap<String, Integer> chars = new HashMap<String, Integer>(); // contains the char counts per tag
+
+	/** The currentpath. */
+	String currentpath = "";
+	
+	/** The sum. */
+	public int sum = 0;
+
+	/**
+	 * Instantiates a new display xml tags.
+	 *
+	 * @param infile : the file to parse
+	 */
+	public DisplayXmlTags(File infile) {
+		if (infile.isDirectory()) {
+			for (File f : infile.listFiles()) {
+				processxmlFile(f);
+			}
+		} else
+			processxmlFile(infile);
+	}
+
+	/**
+	 * run the script.
+	 *
+	 * @param xmlfile the xmlfile
+	 * @return true, if successful
+	 */
+	private boolean processxmlFile(File xmlfile)
+	{
+		try
+		{
+			URL url = xmlfile.toURI().toURL();
+			def inputData = url.openStream();
+			def factory = XMLInputFactory.newInstance();
+			XMLStreamReader parser = factory.createXMLStreamReader(inputData);
+			for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) 
+			{
+				switch (event) 
+				{
+					case XMLStreamConstants.START_ELEMENT:
+					
+						currentpath += "/"+parser.getLocalName();// append the current tag to the current path
+						if(!paths.contains(currentpath))
+						{
+							paths.add(currentpath);
+							counts.put(currentpath, 0);
+							chars.put(currentpath, 0);
+						}
+						counts.put(currentpath, counts.get(currentpath)+1); // increment path count
+					
+						break;
+					case XMLStreamConstants.END_ELEMENT:
+						currentpath = currentpath.substring(0,currentpath.length() -1 - parser.getLocalName().length()) // remove tag from the path
+						break;
+					case XMLStreamConstants.CHARACTERS:
+						
+						chars.put(currentpath, chars.get(currentpath)+parser.getText().trim().length());
+						sum += parser.getText().trim().length();
+				}
+			}
+			
+		}
+		catch(Exception e){println("File "+xmlfile+"\n"+e); return false;}
+		return true;
+	}
+
+	/**
+	 * Gets the tag hierarchy.
+	 *
+	 * @return the hierarchy of the tags
+	 */
+	public ArrayList<String> getTagHierarchy() {
+		return paths;
+	}
+
+	/**
+	 * return the counts of a tag.
+	 *
+	 * @param path : the tag path (ex : /TEI/text/p")
+	 * @return the count
+	 */
+	public int getCount(String path) {
+		return counts.get(path);
+	}
+
+	/**
+	 * Gets the counts.
+	 *
+	 * @return all the tags counts
+	 */
+	public int getCounts() {
+		return counts;
+	}
+	
+	/**
+	 * return the counts of chars of  a tag.
+	 *
+	 * @param path : the tag path (ex : /TEI/text/p")
+	 * @return the char
+	 */
+	public int getChar(String path) {
+		return chars.get(path);
+	}
+
+	/**
+	 * Gets the chars.
+	 *
+	 * @return all the tags counts
+	 */
+	public int getChars() {
+		return chars;
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args)
+	{
+		String userhome = System.getProperty("user.home"); 
+		DisplayXmlTags diag = new DisplayXmlTags(new File(userhome, "xml/manuelTXM/Manuel_TEI_FR_0_5.xml"));
+		ArrayList<String> paths = diag.getPaths();
+		Collections.sort(paths);
+		if(paths != null)
+			for(String s : paths)
+			{
+				print s+" : "+diag.getCount(s);
+				if(diag.getChar(s) > 0)
+					print " (chars "+diag.getChar(s)+")";
+					
+				println ""
+			}
+		
+		println "total chars : "+diag.sum;
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/StaxIdentityParser.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/StaxIdentityParser.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/StaxIdentityParser.groovy	(revision 258)
@@ -0,0 +1,379 @@
+package org.txm.importer
+
+import groovy.transform.CompileStatic
+import java.io.File;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamWriter;
+import java.io.File;
+import java.net.URL;
+import javax.xml.stream.*;
+import org.txm.importer.filters.*;
+import org.txm.importer.graal.PersonalNamespaceContext;
+
+@CompileStatic
+class StaxIdentityParser {
+	/** The input */
+	protected URL inputurl;
+	protected InputStream inputData;
+	protected XMLInputFactory factory;
+	protected XMLStreamReader parser;
+	
+	/** The output. */
+	protected XMLOutputFactory outfactory = XMLOutputFactory.newInstance();
+	protected BufferedOutputStream output;
+	protected XMLStreamWriter writer;
+	
+	public static String TXMNS = "http://textometrie.org/1.0";
+	public static String TXM = "txm"
+	public static String TEINS = "http://www.tei-c.org/ns/1.0";
+	public static String TEI = "tei"
+	protected static PersonalNamespaceContext Nscontext = new PersonalNamespaceContext();
+	
+	//protected StringBuilder currentXPath = new StringBuilder("/")
+	protected String localname;
+	int processingXInclude = 0;
+	
+	public StaxIdentityParser(File infile) {
+		this(infile.toURI().toURL());
+	}
+	
+	public StaxIdentityParser(URL inputurl) {
+		this.inputurl = inputurl;
+		this.inputData = inputurl.openStream();
+		this.factory = XMLInputFactory.newInstance();
+		this.parser = factory.createXMLStreamReader(inputData);
+	}
+	
+	protected void before() {
+		
+	}
+	
+	protected void after() {
+		factory = null;
+		if (parser !=null) parser.close();
+		writer.flush();
+		if (writer != null) writer.close();
+		if (inputData != null) inputData.close();
+		writer = null;
+		parser = null;
+	}
+	
+	protected void closeForError() {
+		parser.close();
+	}
+	
+	/**
+	 * Creates the output.
+	 *
+	 * @param outfile the outfile
+	 * @return true, if successful
+	 */
+	private boolean createOutput(File f) {
+		try {
+			if (writer != null) // process from a file
+				writer.close();
+			if (output != null) // process from a file
+				output.close();
+
+			output = new BufferedOutputStream(new FileOutputStream(f), 16*1024)
+			
+			writer = outfactory.createXMLStreamWriter(output, "UTF-8");//create a new file
+			writer.setNamespaceContext(Nscontext);
+			return true;
+		} catch (Exception e) {
+			System.out.println("Error: create output of "+f+": "+e);
+			return false;
+		}
+	}
+	
+	public boolean process(File outfile)
+	{
+		if (!createOutput(outfile))
+			return false;
+			
+		writer.writeStartDocument("UTF-8", "1.0");
+		writer.writeCharacters("\n");
+		boolean ret = process(writer);
+		if (writer != null) { // process from a file
+			writer.close();
+		}
+		if (output != null) { // process from a file
+		//	output.flush()
+			output.close();
+		}
+		
+		if (parser != null) {
+			try {parser.close()} catch(Exception e){println "parser exep: "+e; return false;}
+		}
+		return ret;
+	}
+	
+	public final static String SLASH = "/"
+	public boolean process(XMLStreamWriter awriter)
+	{
+		this.writer = awriter;
+		//if (processingXInclude == 0) {
+			before(); // if you need to do something before reading the xml
+		//}
+		try {
+			for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+				switch (event) {
+					case XMLStreamConstants.NAMESPACE:
+						processNamespace();
+						break;
+					case XMLStreamConstants.START_ELEMENT:
+						localname = parser.getLocalName();
+						//currentXPath.append(SLASH)
+						processStartElement();
+						break;		
+					case XMLStreamConstants.CHARACTERS:
+						processCharacters();
+						break;
+					case XMLStreamConstants.END_ELEMENT:
+						localname = parser.getLocalName();
+						processEndElement();
+						//currentXPath.substring(0, currentXPath.length() - localname.length() -1)
+						break;
+					case XMLStreamConstants.PROCESSING_INSTRUCTION:
+						processProcessingInstruction();
+						break;
+					case XMLStreamConstants.DTD:
+						processDTD();
+						break;
+					case XMLStreamConstants.CDATA:
+						processCDATA();
+						break;
+					case XMLStreamConstants.COMMENT:
+						processComment();
+						break;
+					case XMLStreamConstants.END_DOCUMENT:
+						processEndDocument();
+						break;
+					case XMLStreamConstants.ENTITY_REFERENCE:
+						processEntityReference();
+						break;
+				}
+			}
+		} catch(Exception e) {
+			println("Unexpected error while parsing file "+inputurl+" : "+e);
+			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();
+			parser.close();
+			return false;
+		}
+		//if (processingXInclude == 0) {
+		after(); // if you need to do something before closing the parser();
+		//}
+		return true;
+	}
+	
+	/**
+	 * The start element has already been written
+	 * @param tagname
+	 */
+	public void goToEnd(String tagname) {
+		//println "start gotoend $tagname"
+		def elements = 1;
+		try {
+			for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+				//println "event "+event
+				switch (event) {
+					case XMLStreamConstants.NAMESPACE:
+						processNamespace();
+						break;
+					case XMLStreamConstants.START_ELEMENT:
+						elements++;
+						localname = parser.getLocalName();
+						//currentXPath.append(SLASH)
+						_processStartElement();
+						break;
+					case XMLStreamConstants.CHARACTERS:
+						processCharacters();
+						break;
+					case XMLStreamConstants.PROCESSING_INSTRUCTION:
+						processProcessingInstruction();
+						break;
+					case XMLStreamConstants.DTD:
+						processDTD();
+						break;
+					case XMLStreamConstants.CDATA:
+						processCDATA();
+						break;
+					case XMLStreamConstants.COMMENT:
+						processComment();
+						break;
+					case XMLStreamConstants.END_ELEMENT:
+						elements--;
+						localname = parser.getLocalName();
+						//currentXPath.substring(0, currentXPath.length() - localname.length() -1)
+						writer.writeEndElement();
+						if (elements == 0 && localname == tagname)
+							return;
+						break;
+					case XMLStreamConstants.END_DOCUMENT:
+						processEndDocument();
+						break;
+					case XMLStreamConstants.ENTITY_REFERENCE:
+						processEntityReference();
+						break;
+				}
+			}
+		} catch(Exception e) {
+			println("Error while parsing file "+inputurl);
+			println("Location "+parser.getLocation());
+			org.txm.utils.logger.Log.printStackTrace(e);
+			output.close();
+			parser.close();
+			return;
+		}
+	}
+	
+	public def getLocation() {
+		if (parser != null)
+			return "Line: "+parser.getLocation().getLineNumber()+" Col: "+parser.getLocation().	getColumnNumber()
+		return null;
+	}
+	
+	protected void processNamespace() {
+		writer.writeNamespace(parser.getPrefix(), parser.getNamespaceURI());
+	}
+	
+	public static final String INCLUDE = "include"
+	public static final String XI = "xi"
+	
+	protected void processStartElement()
+	{
+		String prefix = parser.getPrefix();
+		if (INCLUDE == localname && XI == prefix) {
+			processXInclude();
+		} else {
+			if (prefix != null && prefix.length() > 0)
+				writer.writeStartElement(Nscontext.getNamespaceURI(prefix), localname)
+			else
+				writer.writeStartElement(localname);
+			
+			for (int i = 0 ; i < parser.getNamespaceCount() ; i++) {
+				writer.writeNamespace(parser.getNamespacePrefix(i), parser.getNamespaceURI(i));
+			}
+			
+			writeAttributes();
+		}
+	}
+	
+	private void _processStartElement()
+	{
+		String prefix = parser.getPrefix();
+		if (INCLUDE == localname && XI == prefix) {
+			processXInclude();
+		} else {
+			if (prefix != null && prefix.length() > 0)
+				writer.writeStartElement(Nscontext.getNamespaceURI(prefix), localname)
+			else
+				writer.writeStartElement(localname);
+			
+			for (int i = 0 ; i < parser.getNamespaceCount() ; i++) {
+				writer.writeNamespace(parser.getNamespacePrefix(i), parser.getNamespaceURI(i));
+			}
+			
+			writeAttributes();
+		}
+	}
+	
+	protected void writeAttributes() {
+		for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
+			writeAttribute(parser.getAttributePrefix(i), parser.getAttributeLocalName(i), parser.getAttributeValue(i))
+		}
+	}
+	
+	protected void writeAttribute(String prefix, String name, String value) {
+		if (prefix != null && prefix.length() > 0)
+			writer.writeAttribute(prefix+":"+name, value);
+		else
+			writer.writeAttribute(name, value);
+	}
+	
+	protected void processCharacters()
+	{
+		writer.writeCharacters(parser.getText());
+	}
+	
+	protected void processProcessingInstruction()
+	{
+		writer.writeProcessingInstruction(parser.getPITarget(), parser.getPIData());
+	}
+	
+	protected void processDTD()
+	{
+		writer.writeDTD(parser.getText());
+	}
+	
+	protected void processCDATA()
+	{
+		writer.writeCData(parser.getText())	
+	}
+	
+	protected void processComment()
+	{
+		writer.writeComment(parser.getText());
+	}
+	
+	protected void processEndElement()
+	{
+		if (localname == INCLUDE && parser.getPrefix() == XI) {
+			// nothing !!
+		} else {
+			writer.writeEndElement();
+		}
+	}
+	
+	protected void processEndDocument() {
+		writer.writeEndDocument();
+	}
+	
+	protected void processEntityReference() {
+		writer.writeEntityRef(parser.getLocalName());
+	}
+	/**
+	 * Process the XInclude elements
+	 */
+	protected void processXInclude() {
+		String url = parser.getAttributeValue(null, "href"); // relative only
+		File driver = new File(inputurl.getFile());
+		File ref = new File(driver.getParent(), url);
+		if (ref.exists()) {
+			URL includeurl = ref.toURI().toURL();
+			// save variables before killing them
+			println "process xi include: "+ref
+			def parserSave = this.parser // back up current parser
+			def xiIncludeInputData = includeurl.openStream();
+			def xiIncludeParser = factory.createXMLStreamReader(xiIncludeInputData);
+			parser = xiIncludeParser;
+			processingXInclude++ // to avoid recalling before & after methods
+			this.process(writer);
+			processingXInclude-- // end of XInclude processing
+			this.parser = parserSave // restore parser
+		} else {
+			println "Warning referenced file: $ref does not exists"
+		}
+	}
+	
+	public static void main(String[] args)
+	{
+		File input = new File("/home/mdecorde/xml/xiinclude/master.xml")
+		File output = new File("/home/mdecorde/xml/xiinclude/merged.xml")
+		if (!(input.exists() && input.canRead())) {
+			println "cannot found $input";
+			return;
+		}
+		def builder = new StaxIdentityParser(input.toURI().toURL());
+		if (builder.process(output)) {
+			println "success ? "+ValidateXml.test(output);
+		} else {
+			println "failure !"
+		}
+	}
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/importer/discours/compiler.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/discours/compiler.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/discours/compiler.groovy	(revision 258)
@@ -0,0 +1,302 @@
+// 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
+// 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.
+//
+//
+//
+// $LastChangedDate: 2016-05-26 17:42:36 +0200 (Thu, 26 May 2016) $
+// $LastChangedRevision: 3219 $
+// $LastChangedBy: mdecorde $
+//
+package org.txm.importer.discours
+
+import org.txm.importer.cwb.BuildCwbEncodeArgsFromTEITXM;
+import org.txm.importer.cwb.CwbEncode
+import org.txm.importer.cwb.CwbMakeAll
+import org.txm.importer.*;
+import org.txm.scripts.*;
+import org.txm.scripts.teitxm.BuildTTSrc;
+import org.txm.scripts.teitxm.*;
+import org.txm.utils.treetagger.TreeTagger;
+
+import javax.xml.stream.*;
+import java.net.URL;
+import java.io.File;
+import java.util.HashMap;
+import java.util.List;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class compiler.
+ */
+class compiler {
+
+	/** The input data. */
+	private def inputData;
+
+	/** The factory. */
+	private def factory;
+
+	/** The parser. */
+	private XMLStreamReader parser;
+
+	/** The dir. */
+	private def dir;
+
+	/** The output. */
+	private def output;
+
+	/** The url. */
+	private def url;
+
+	/** The anahash. */
+	private HashMap<String,String> anahash = new HashMap<String,String>() ;
+
+	/** The text. */
+	String text="";
+
+	/** The base. */
+	String base="";
+
+	/** The project. */
+	String project="";
+
+	/** The cwb loc. */
+	String cwbLoc;
+
+	/** The lang. */
+	private String lang ="fr";
+
+	/** The text attributes. */
+	static String textAttributes = "";
+
+	/**
+	 * initialize.
+	 *
+	 */
+
+	public compiler(){
+	}
+
+	/**
+	 * Instantiates a new compiler.
+	 *
+	 * @param url the url
+	 * @param text the text
+	 * @param base the base
+	 * @param project the project
+	 */
+	public compiler(URL url,String text,String base, String project) {
+		this.text = text
+		this.base = base;
+		this.project = project;
+		try {
+			this.url = url;
+			inputData = url.openStream();
+
+			factory = XMLInputFactory.newInstance();
+			parser = factory.createXMLStreamReader(inputData);
+		} catch (XMLStreamException ex) {
+			System.out.println(ex);
+		}catch (IOException ex) {
+			System.err.println("IOException while parsing ");
+		}
+	}
+
+	/**
+	 * set the language of the corpus.
+	 *
+	 * @param lang the lang
+	 * @return the java.lang. object
+	 */
+	public setLang(String lang)
+	{
+		this.lang = lang;
+	}
+
+	/**
+	 * Sets the cwb path.
+	 *
+	 * @param path the new cwb path
+	 */
+	public void setCwbPath(String path) {
+		if(!new File(path).exists())
+			System.err.println("Wrong CWB directory path: "+path)
+		cwbLoc = path;
+	}
+
+	/**
+	 * Creates the output.
+	 *
+	 * @param f the f
+	 * @return true, if successful
+	 */
+	private boolean createOutput(File f){
+		try {
+			output = new OutputStreamWriter(new FileOutputStream(f,f.exists()) , "UTF-8");
+			return true;
+		} catch (Exception e) {
+			System.err.println(e);
+			return false;
+		}
+	}
+
+	/**
+	 * Go to text.
+	 */
+	private void GoToText() {
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+			if(event == XMLStreamConstants.END_ELEMENT)
+				if(parser.getLocalName().equals("teiHeader"))
+					return;
+		}
+	}
+
+	/** The debug. */
+	boolean debug = false;
+
+	/**
+	 * Sets the debug.
+	 */
+	public void setDebug()
+	{
+		debug = true;
+	}
+
+	/**
+	 * Run.
+	 *
+	 * @param files the files
+	 * @param basename the basename
+	 * @return true, if successful
+	 */
+	public boolean run(List<File> files, File binDir, File txmDir, String corpusname) {
+		String binDirPath = binDir.getAbsolutePath()+"/";
+
+		if(cwbLoc == null)
+			cwbLoc = org.txm.Toolbox.getParam(org.txm.Toolbox.CQI_SERVER_PATH_TO_CQPLIB)+File.separator;
+
+		if(!new File(cwbLoc).exists() || !binDir.exists())
+		{
+			println ("Wrong CWB directory path: "+cwbLoc+" , or Wrong corpus source path:"+binDirPath)
+			return false;
+		}
+		File wtcFile = new File(binDir,"wtc/${corpusname}.wtc");
+		new File(binDir, "wtc.").deleteDir();
+		new File(binDir, "wtc").mkdirs();
+		new File(binDir, "data/$corpusname").deleteDir();
+		new File(binDir, "data/$corpusname").mkdir();
+		new File(binDir, "registry").deleteDir();
+		new File(binDir, "registry").mkdir();
+
+		//start corpus
+		if (createOutput(wtcFile)) {
+			output.write("<txmcorpus lang=\""+lang+"\">\n");
+			output.close();
+		}
+
+		def second = 0
+		//1- Transform into WTC file
+
+		Collections.sort(files);
+		XMLTXM2WTC wtcbuilder = null;
+		for (File f : files) {
+			if (second) { print(", ") }
+			if (second > 0 && (second % 5) == 0) println ""
+			print(f.getName().replaceFirst("\\.xml", ""));
+			second++
+
+			wtcbuilder = new XMLTXM2WTC(f.toURI().toURL());
+			String txtname = f.getName().substring(0,f.getName().length()-4);
+			wtcbuilder.setTextInfo(txtname, corpusname, "project");
+
+			wtcbuilder.setBalisesToKeep(["text","p","s"]);
+			wtcbuilder.setSendToPAttributes(["s":["id"], "p":["id"]]);
+			wtcbuilder.setLang(lang);
+			if (!wtcbuilder.transformFile(wtcFile)) {
+				println("Failed to compile "+f)
+			}
+
+		}
+
+		//end corpus
+		if (createOutput(wtcFile)) {
+			output.write("</txmcorpus>\n");
+			output.close();
+		}
+
+		if (wtcbuilder == null) {
+			println "there was no files to process: "+files
+			return false;
+		}
+
+		//2- Import into CWB
+		def outDir = binDirPath;
+
+		CwbEncode cwbEn = new CwbEncode();
+		CwbMakeAll cwbMa = new CwbMakeAll();
+
+		List<String> pAttributesList = wtcbuilder.getpAttributs();
+		List<String> sAttributesList = wtcbuilder.getsAttributs();
+		println "pAttrs : "+pAttributesList
+		println "sAttrs : "+sAttributesList
+		String[] pAttributes = pAttributesList.toArray(new String[pAttributesList.size()])
+		String[] sAttributes = sAttributesList.toArray(new String[sAttributesList.size()])
+
+		try {
+			//println "Indexing "+compiler.textAttributes
+			cwbEn.setDebug(debug);
+			String regPath = outDir + "registry/"+corpusname.toLowerCase()
+			cwbEn.run(
+					cwbLoc + "cwb-encode",
+					outDir + "data/$corpusname",
+					outDir + "/wtc/"+corpusname+".wtc",
+					regPath,
+					pAttributes,
+					sAttributes);
+			if (!new File(regPath).exists()) {
+				println "Error: The registry file was not created: $regPath. See https://groupes.renater.fr/wiki/txm-users/public/faq"
+				return false;
+			}
+			//println "Binding all indexes"
+			cwbMa.setDebug(debug);
+			cwbMa.run(cwbLoc + "cwb-makeall", corpusname, outDir + "registry");
+
+		} catch (Exception ex) { System.err.println(ex); return false;}
+
+		return true;
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args) {
+		File dir = new File(System.getProperty("user.home"),"xml/discours/txm/");
+		List<File> files = dir.listFiles();
+		def c = new compiler()
+		c.setCwbLoc(System.getProperty("user.home")+"/TXM/cwb/bin/")
+		if (!c.run(files,"discours")) {
+			println "Compiler failed"
+			return;
+		}
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/discours/package.html
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/discours/package.html	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/discours/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Discours import module : CNR + CSV</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/org/txm/importer/discours/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/importer/discours/importer.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/discours/importer.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/discours/importer.groovy	(revision 258)
@@ -0,0 +1,282 @@
+// 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
+// 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.
+//
+//
+//
+// $LastChangedDate: 2016-12-16 17:28:35 +0100 (Fri, 16 Dec 2016) $
+// $LastChangedRevision: 3377 $
+// $LastChangedBy: mdecorde $
+//
+package org.txm.importer.discours
+
+//import filters.TabulatedToXml.*;
+import org.txm.importer.*;
+import org.txm.importer.filters.*;
+import org.txm.scripts.*;
+import org.txm.importer.cwb.CwbEncode
+import org.txm.importer.cwb.CwbMakeAll
+import org.txm.metadatas.Metadatas
+import org.txm.scripts.teitxm.*;
+
+import javax.xml.stream.*;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.OutputStreamWriter;
+import java.io.PrintStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.txm.*;
+import org.txm.utils.*;
+import org.txm.utils.i18n.DetectBOM;
+import org.txm.utils.io.FileCopy;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class importer.
+ */
+class importer {
+
+	/**
+	 * Run.
+	 *
+	 * @param dir the dir
+	 * @param encoding the encoding
+	 * @param basename the basename
+	 * @return true, if successful
+	 */
+	public boolean run(File srcDir, File binDir, File txmDir, String encoding, String basename)
+	{
+		String rootDir = srcDir.getAbsolutePath()+"/"
+		// scanning directory brut/*.cnr
+		String extension = "cnr";
+		File[] list = srcDir.listFiles();
+		
+		if (list == null || list.length == 0) return false;
+
+		LinkedList filelist = new LinkedList();
+		for (File cnr : list) {
+			if (cnr.getName().endsWith("."+extension)) {
+				filelist.add(cnr.getName());
+			}
+		}
+		Collections.sort(filelist);
+
+		// get the headers
+		def csvfile = new File(srcDir, "metadata.csv");
+		Metadatas metadatas; // text metadata
+		
+		println "Trying to read metadata from: "+csvfile
+		if (csvfile.exists()) {
+			File copy = new File(binDir, "metadata.csv")
+			if (!FileCopy.copy(csvfile, copy)) {
+				println "Error: could not create a copy of metadata file "+csvfile.getAbsoluteFile();
+				return;
+			}
+			metadatas = new Metadatas(copy, Toolbox.getParam(Toolbox.METADATA_ENCODING), Toolbox.getParam(Toolbox.METADATA_COLSEPARATOR), Toolbox.getParam(Toolbox.METADATA_TXTSEPARATOR), 1)
+		} else {
+			println "No metadata file: "+csvfile
+			println "Aborting"
+			return false;
+		}
+		
+		// build each xml file from cnr
+		def attrs = ["para", "sent", "form", "lem", "pos", "func"];
+		int formid = 2;
+		String separator = "\t";
+
+		String encodingAll = null;
+		if (encoding == "??") {
+			encodingAll = new CharsetDetector(srcDir).getEncoding();
+			println "Guessed encoding: $encodingAll"
+		}
+
+		print "Converting CNR to XML:"
+		def second = 0
+		for (String id : metadatas.keySet()) // loop on text nodes
+		{
+			int sentence=-1, paragraph=-1, idword=0;
+			String lastopenlocalname= "", localname = "";
+			int para = -1, sent = -1;
+			
+			// = textnode.attribute("id")
+			ArrayList<org.txm.metadatas.Entry> metas = metadatas.get(id);
+			
+			String filename = id +".cnr";
+			File srcfile = new File(srcDir, filename);
+			if (!srcfile.exists()) {
+				println "Can't find CNR file : "+filename
+				continue
+			}
+			File teifile = new File(txmDir, id+".xml");
+			//println("||"+srcfile+">>"+teifile.getAbsolutePath());
+			OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(teifile), "UTF-8");
+
+//			if (second) { print(", ") }
+//			if ((second % 5) == 0) println ""
+//			print(filename.replaceFirst("\\.cnr", ""));
+//			second++
+
+			// HEADER
+			writer.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
+			writer.write("<TEI xmlns=\"http://www.tei-c.org/ns/1.0\" xmlns:txm=\"http://textometrie.org/1.0\">\n");
+			writer.write("<teiHeader type=\"text\">\n");
+			writer.write("<fileDesc>\n");
+			writer.write("<titleStmt>\n");
+			writer.write("<title>"+id+"</title>\n");
+			writer.write("<respStmt>\n");
+			writer.write("<resp id=\"cordial\">initial tagging</resp>")
+			writer.write("</respStmt>\n");
+			writer.write("</titleStmt>\n");
+			writer.write("</fileDesc>\n");
+			writer.write("<encodingDesc>\n");
+			writer.write("<classDecl>\n");
+			writer.write("<taxonomy id=\"pos\"><bibl type=\"tagset\"/></taxonomy>\n")
+			writer.write("<taxonomy id=\"func\"><bibl type=\"tagset\"/></taxonomy>\n")
+			writer.write("<taxonomy id=\"lemma\"><bibl type=\"tagset\"/></taxonomy>\n")
+			writer.write("</classDecl>\n");
+			writer.write("</encodingDesc>\n");
+			writer.write("</teiHeader>\n");
+			writer.write("<text ")
+			for (org.txm.metadatas.Entry metadata : metas) {
+				String name = metadata.getId()
+				String value = metadata.getValue()
+				if (name != "id")
+					writer.write(" "+name+"=\""+value.replace("&", "&amp;").replace("<", "&lt;").replace("\"", "&quot;")+"\"");	
+			}
+			writer.write(" id=\""+id.replace("&", "&amp;").replace("<", "&lt;").replace("\"", "&quot;")+"\"");
+			writer.write(">\n");
+
+			//def content = srcfile.getText(encoding)
+			String tmpEncoding = encoding;
+			if (encodingAll != null) {
+				tmpEncoding = encodingAll
+				if (srcfile.length() > CharsetDetector.MINIMALSIZE) {
+					tmpEncoding = new CharsetDetector(srcfile).getEncoding();
+					//println "file encoding: $tmpEncoding"	
+				}
+			}
+			def input = new FileInputStream(srcfile)
+			def reader = new BufferedReader(new InputStreamReader(input , tmpEncoding));
+			DetectBOM bomdetector = new DetectBOM(srcfile);
+			for (int ibom = 0 ; ibom < bomdetector.getBOMSize() ; ibom++) input.read()
+
+			// BODY
+			String line = reader.readLine();
+			int nline = 0;
+			def errors = [];
+			while (line != null) {
+				nline++;
+				String[] fields = line.split(separator);
+				if (fields.size() == attrs.size()) {
+					idword++;
+					
+					String paraV = fields[0].replaceAll("\\p{C}", "")
+					String sentV = fields[1].replaceAll("\\p{C}", "")
+					String formV = fields[2].replaceAll("\\p{C}", "").replace("&","&amp;").replace("<","&lt;");
+					String lemV = fields[3].replaceAll("\\p{C}", "").replace("&","&amp;").replace("<","&lt;");
+					String posV = fields[4].replaceAll("\\p{C}", "").replace("&","&amp;").replace("<","&lt;");
+					String funcV = fields[5].replaceAll("\\p{C}", "").replace("&","&amp;").replace("<","&lt;");
+					
+					try {
+						para = Integer.parseInt(paraV);
+					} catch(Exception e){}
+					if (para != paragraph) {
+						if (paragraph != -1) {
+							if (sentence != -1) {
+								writer.write("</s>\n")
+								sentence = -1;
+							}
+							writer.write("</p>\n")
+						}
+						writer.write("<p id=\"p_${para}\">\n");
+						paragraph = para;
+					}
+					
+					try {
+						sent = Integer.parseInt(sentV);
+					} catch(Exception e){}
+					if (sent != sentence) {
+						if (sentence != -1)
+							writer.write("</s>\n")
+						writer.write("<s id=\"s_${sent}\">\n");
+						sentence = sent;
+					}
+					
+					writer.write("<w id=\"w_${id}_${idword}\">\n");
+					writer.write(" <txm:form>$formV</txm:form>\n");
+					writer.write(" <txm:ana resp=\"#cordial\" type=\"#pos\">$posV</txm:ana>\n");
+					writer.write(" <txm:ana resp=\"#cordial\" type=\"#func\">$funcV</txm:ana>\n");
+					writer.write(" <txm:ana resp=\"#cordial\" type=\"#lemma\">$lemV</txm:ana>\n");
+					writer.write(" <txm:ana resp=\"#cordial\" type=\"#sent\">$sentV</txm:ana>\n");
+					writer.write(" <txm:ana resp=\"#cordial\" type=\"#para\">$paraV</txm:ana>\n");
+					writer.write(" <txm:ana resp=\"#txm\" type=\"#ref\">${id}, §${paraV}</txm:ana>\n");
+					writer.write("</w>\n");
+				} else {
+					//println "error : $nline : '$line'"
+					errors << nline
+				}
+				line = reader.readLine();
+			}
+
+			// CLOSE
+			if(sentence != -1) { writer.write("</s>\n") }
+			if(paragraph != -1) { writer.write("</p>\n") }
+			paragraph=-1;
+			sentence=-1;
+			writer.write("</text>\n");
+			writer.write("</TEI>\n");
+			writer.close();
+			
+			if (errors.size() > 0) {
+				println "Errors in file $filename. Wrong number of columns at lines: "+errors
+			} else print "."
+		}
+		println ""
+		return true;
+	}
+
+	/**
+	 * Gets the metadata.
+	 *
+	 * @return the metadata
+	 */
+	public List<String> getMetadatas()
+	{
+		return metaDatas;
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args)
+	{
+		File dir = new File(System.getProperty("user.home"), "xml/discours/");
+		new importer().run(dir);
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/discours/discoursLoader.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/discours/discoursLoader.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/discours/discoursLoader.groovy	(revision 258)
@@ -0,0 +1,152 @@
+// 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
+// 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.
+//
+//
+//
+// $LastChangedDate: 2014-11-20 11:30:43 +0100 (Thu, 20 Nov 2014) $
+// $LastChangedRevision: 2904 $
+// $LastChangedBy: mdecorde $
+//
+package org.txm.importer.discours;
+
+import org.txm.importer.discours.compiler;
+import org.txm.importer.xml.pager;
+import org.txm.objects.*;
+import org.txm.utils.*;
+import org.txm.*;
+import org.txm.utils.i18n.*;
+import org.w3c.dom.Element
+
+String userDir = System.getProperty("user.home");
+
+def MONITOR;
+boolean debug = org.txm.utils.logger.Log.isPrintingErrors();
+BaseParameters params;
+try {params = paramsBinding;MONITOR=monitor} catch (Exception)
+{	println "DEV MODE";//exception means we debug
+	debug = true;
+	params = new BaseParameters(new File(userDir, "xml/discours/import.xml"))
+	params.load()
+	if (!org.txm.Toolbox.isInitialized()) {
+
+		Toolbox.setParam(Toolbox.INSTALL_DIR,new File("/usr/lib/TXM"));
+		Toolbox.setParam(Toolbox.TREETAGGER_INSTALL_PATH,new File(userDir,"treetagger"));
+		Toolbox.setParam(Toolbox.TREETAGGER_MODELS_PATH,new File(userDir,"treetagger/models"));
+		Toolbox.setParam(Toolbox.METADATA_ENCODING, "UTF-8");
+		Toolbox.setParam(Toolbox.METADATA_COLSEPARATOR, ",");
+		Toolbox.setParam(Toolbox.METADATA_TXTSEPARATOR, "\"");
+		Toolbox.setParam(Toolbox.USER_TXM_HOME, new File(System.getProperty("user.home"), "TXM"));
+	}
+}
+if (params == null) { println "no parameters. Aborting"; return; }
+
+String corpusname = params.getCorpusName();
+Element corpusElem = params.corpora.get(corpusname);
+String basename = params.name;
+String rootDir = params.rootDir;
+String lang = corpusElem.getAttribute("lang");
+String model = lang
+String encoding = corpusElem.getAttribute("encoding");
+boolean annotate = "true" == corpusElem.getAttribute("annotate");
+String xsl = params.getXsltElement(corpusElem).getAttribute("xsl")
+def xslParams = params.getXsltParams(corpusElem);
+int wordsPerPage = params.getWordsPerPage("default")
+boolean build_edition = params.getDoEdition("default")
+
+File srcDir = new File(rootDir);
+File binDir = new File(Toolbox.getParam(Toolbox.USER_TXM_HOME),"corpora/"+basename);
+binDir.deleteDir();
+binDir.mkdirs();
+if (!binDir.exists()) {
+	println "Could not create binDir "+binDir
+	return;
+}
+
+File txmDir = new File(binDir,"txm/$corpusname");
+txmDir.deleteDir();
+txmDir.mkdirs();
+
+if (MONITOR != null) MONITOR.worked(1, "IMPORTER")
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+println "-- IMPORTER - Reading source files"
+def imp = new importer();
+if (!imp.run(srcDir, binDir, txmDir, encoding, basename)) {
+	println "import process stopped";
+	return;
+}
+
+println "-- ANNOTATE - Running NLP tools"
+println "No annotation to do"
+
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+if (MONITOR != null) MONITOR.worked(25, "COMPILING")
+println("-- COMPILING - Building Search Engine indexes")
+List<File> files = txmDir.listFiles();
+def c = new compiler()
+if (debug) c.setDebug();
+// no annotation
+c.setLang(lang);
+if (!c.run(files, binDir, txmDir, corpusname)) {
+	println "import process stopped";
+	return;
+}
+
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+
+new File(binDir,"HTML/$corpusname").deleteDir();
+new File(binDir,"HTML/$corpusname").mkdirs();
+if (build_edition) {
+
+	println "-- EDITION - Building edition"
+	if (MONITOR != null) MONITOR.worked(20, "EDITION")
+	
+	File outdir = new File(binDir,"/HTML/$corpusname/default/");
+	outdir.mkdirs();
+	List<File> filelist = txmDir.listFiles();
+	Collections.sort(filelist);
+
+	println "Paginating texts: "
+
+	for (File srcfile : filelist) {
+		print "."
+		String txtname = srcfile.getName();
+		int i = txtname.lastIndexOf(".");
+		if(i > 0) txtname = txtname.substring(0, i);
+
+		List<String> NoSpaceBefore = LangFormater.getNoSpaceBefore(lang);
+		List<String> NoSpaceAfter = LangFormater.getNoSpaceAfter(lang);
+
+		Element text = params.addText(params.corpora.get(corpusname), txtname, srcfile);
+
+		def ed = new pager(srcfile, outdir, txtname, NoSpaceBefore, NoSpaceAfter, wordsPerPage, basename, "pb");
+		Element edition = params.addEdition(text, "default", outdir.getAbsolutePath(), "html");
+
+		for (i = 0 ; i < ed.getPageFiles().size();) {
+			File f = ed.getPageFiles().get(i);
+			String wordid = ed.getIdx().get(i);
+			params.addPage(edition, ""+(++i), wordid);
+		}
+	}
+}
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+if (MONITOR != null) MONITOR.worked(20, "FINALIZING")
+File paramFile = new File(binDir, "import.xml");
+DomUtils.save(params.root.getOwnerDocument(), paramFile);readyToLoad = true;
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/importer/EncodingConverter.java
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/EncodingConverter.java	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/EncodingConverter.java	(revision 258)
@@ -0,0 +1,215 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2014-09-15 10:51:15 +0200 (Mon, 15 Sep 2014) $
+// $LastChangedRevision: 2836 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer;
+
+import java.io.*;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.w3c.dom.Node;
+
+// TODO: Auto-generated Javadoc
+/**
+ * change the encoding of a file.
+ *
+ * @author mdecorde
+ */
+public class EncodingConverter {
+
+	/**
+	 * Instantiates a new encoding converter.
+	 *
+	 * @param in the in
+	 * @param out the out
+	 * @param in_encoding the in_encoding
+	 * @param out_encoding the out_encoding
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 */
+	public EncodingConverter(File in, File out, String in_encoding,
+			String out_encoding) throws IOException {
+		int c;
+		InputStreamReader ist = new InputStreamReader(new FileInputStream(in),
+				in_encoding);
+		OutputStreamWriter ost = new OutputStreamWriter(new FileOutputStream(
+				out), out_encoding);
+
+		while ((c = ist.read()) != -1)
+			ost.write(c);
+
+		ist.close();
+		ost.close();
+	}
+
+	/**
+	 * out encoding is UTF-8.
+	 *
+	 * @param in the in
+	 * @param in_encoding the in_encoding
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 */
+	public EncodingConverter(File in, String in_encoding) throws IOException {
+		String out_encoding = "UTF-8";
+
+		File out = new File("tempencodingconverter");
+		int c;
+		InputStreamReader ist = new InputStreamReader(new FileInputStream(in),
+				in_encoding);
+		OutputStreamWriter ost = new OutputStreamWriter(new FileOutputStream(
+				out), out_encoding);
+		while ((c = ist.read()) != -1)
+			ost.write(c);
+
+		ist.close();
+		ost.close();
+
+		in.delete();
+		out.renameTo(in);
+	}
+
+	/**
+	 * Instantiates a new encoding converter.
+	 *
+	 * @param in : will be replaced
+	 * @param in_encoding the in_encoding
+	 * @param out_encoding the out_encoding
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 */
+	public EncodingConverter(File in, String in_encoding, String out_encoding)
+			throws IOException {
+		File out = new File("tempencodingconverter");
+		int c;
+		InputStreamReader ist = new InputStreamReader(new FileInputStream(in),
+				in_encoding);
+		OutputStreamWriter ost = new OutputStreamWriter(new FileOutputStream(
+				out), out_encoding);
+		while ((c = ist.read()) != -1)
+			ost.write(c);
+
+		ist.close();
+		ost.close();
+
+		in.delete();
+		out.renameTo(in);
+	}
+	
+	/**
+	 * Convert xml.
+	 *
+	 * @param infile the infile
+	 * @param outfile the outfile
+	 * @param encoding the encoding
+	 * @return true, if successful
+	 */
+	public static boolean convertXML(File infile, File outfile, String encoding)
+	{
+		try {
+			DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+			Node doc = builder.parse(infile);
+			// Création de la source DOM
+			Source source = new DOMSource(doc);
+			
+			// Création du fichier de sortie
+			Writer writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outfile), "UTF-8")); 
+			Result resultat = new StreamResult(writer);
+			
+			// Configuration du transformer
+			TransformerFactory fabrique = new net.sf.saxon.TransformerFactoryImpl();
+			
+			Transformer transformer = fabrique.newTransformer();
+			transformer.setOutputProperty(OutputKeys.INDENT, "yes"); 
+			transformer.setOutputProperty(OutputKeys.METHOD, "xml");
+			transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); 
+			
+			// Transformation
+			transformer.transform(source, resultat);
+			writer.close();
+			doc = null;
+			return true;
+		} catch (Exception e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+			return false;
+		}
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args) {
+		File infile = new File("C:\\Documents and Settings\\mdecorde\\xml\\minicedre\\int1.trs");
+		File outfile = new File("C:\\Documents and Settings\\mdecorde\\xml\\minicedre\\int1utf8.trs");
+		EncodingConverter.convertXML(infile, outfile, "UTF-8");
+		/*List<File> files = new ArrayList<File>();
+		LinkedList<File> filefiles = new LinkedList<File>();
+
+		File racine = new File(
+				"~/workspace/org.txm.rcpapplication");
+		String extension = ".properties";
+		String prefix = "messages";
+
+		while (racine != null) {
+			if (racine.exists())
+				for (File f : racine.listFiles()) {
+					// System.out.println("scan file "+f);
+					if (f.isDirectory()) {
+						if (!f.getName().equals(".svn"))
+							filefiles.add(f);
+					} else if (f.isFile()) {
+						if (f.getName().endsWith(extension)
+								&& f.getName().startsWith(prefix))
+							files.add(f);
+					}
+				}
+
+			if (filefiles.size() > 0)
+				racine = filefiles.pop();
+			else
+				racine = null;
+		}
+
+		System.out.println(files);
+
+		for (File f : files) {
+			System.out.println("convert " + f);
+			try {
+				new EncodingConverter(f, "iso-8859-1", "utf-8");
+			} catch (IOException e) {
+				org.txm.utils.logger.Log.printStackTrace(e);
+			}
+		}*/
+	}
+
+}

Property changes on: tmp/org.txm.core/src/groovy/org/txm/importer/EncodingConverter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/importer/package.html
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/package.html	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Shared tools for import modules</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/org/txm/importer/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/importer/fleurs/fleursLoader.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/fleurs/fleursLoader.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/fleurs/fleursLoader.groovy	(revision 258)
@@ -0,0 +1,147 @@
+/**
+ * Main.
+ *
+ * @param args the args
+ */
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer.fleurs
+;
+
+import java.io.File;
+
+import org.txm.importer.fleurs.compiler;
+import org.txm.importer.fleurs.pager;
+import org.txm.importer.fleurs.importer;
+import org.txm.objects.*;
+import org.txm.utils.*;
+import org.txm.*;
+import org.txm.scripts.teitxm.*;
+import org.txm.utils.i18n.*;
+import org.txm.utils.io.FileCopy;
+
+// TODO: Auto-generated Javadoc
+/* (non-Javadoc)
+ * @see groovy.lang.Script#run()
+ */
+String userDir = System.getProperty("user.home");
+String rootDir;
+String lang;
+String encoding;
+String model;
+try{rootDir = rootDirBinding;lang=langBinding;encoding=encodingBinding;model=modelBinding;}
+catch(Exception)
+{	println "DEV MODE";//exception means we debug
+	if(!org.txm.Toolbox.isInitialized())
+	{
+		rootDir = userDir+"/xml/fleurs/";
+		lang="fr";
+		encoding= "UTF-8";// not used
+		model="rgaqcj"; // not used
+		Toolbox.setParam(Toolbox.INSTALL_DIR,new File(userDir,"TXMinstall"));
+		Toolbox.setParam(Toolbox.TREETAGGER_INSTALL_PATH,new File(userDir,"treetagger"));
+		Toolbox.setParam(Toolbox.TREETAGGER_MODELS_PATH,new File(userDir,"treetagger/models"));
+		Toolbox.setParam(Toolbox.METADATA_ENCODING, "UTF-8");
+		Toolbox.setParam(Toolbox.METADATA_COLSEPARATOR, ",");
+		Toolbox.setParam(Toolbox.METADATA_TXTSEPARATOR, "\"");
+		Toolbox.setParam(Toolbox.USER_TXM_HOME, new File(System.getProperty("user.home"),"TXM"));
+	}
+}
+
+String basename = "fleurs";
+System.out.println("basename : "+basename);
+println "-- IMPORTER - Reading source files"
+File homedir = new File(rootDir);
+def imp = new importer();
+imp.run(homedir, basename);
+
+File binDir = new File(Toolbox.getParam(Toolbox.USER_TXM_HOME),"corpora/"+basename);
+rootDir = binDir.getAbsolutePath()+"/";
+
+println "-- ANNOTATE - Running NLP tools"
+println "No annotation to do"
+//new Annotate().run(new File(rootDir),model+".par");
+
+println "-- COMPILING - Building Search Engine indexes"
+List<File> files = new File(rootDir,"txm").listFiles();
+def c = new compiler()
+//c.setCwbPath("")// for developers
+c.setLang(lang);
+c.run(rootDir);
+
+//move registry file to cwb registry dir
+File registryfile = new File(rootDir,"registry/"+basename);
+if(registryfile.exists())
+	FileCopy.copy(registryfile,new File(Toolbox.getParam(Toolbox.USER_TXM_HOME),"registry/"+basename.toLowerCase()))
+
+Workspace w = org.txm.Toolbox.workspace;
+
+Project p = w.getProject("default")
+p.removeBase(basename)
+Base b = p.addBase(basename);
+b.addDirectory(new File(rootDir,"txm"));
+b.setAttribute("lang", lang)
+b.propagateAttribute("lang")
+
+println "-- EDITION - Building edition"
+new File(rootDir,"HTML").deleteDir();
+new File(rootDir,"HTML").mkdir();
+new File(rootDir,"HTML/default").mkdir();
+List<File> filelist = new File(rootDir,"txm").listFiles();
+def second = 0
+
+println "Paginating text: "
+for(Text text : b.getTexts())
+{
+	File srcfile = text.getSource();
+	File resultfile = new File(rootDir,"HTML/"+srcfile.getName().substring(0,srcfile.getName().length()-4)+".html");
+	List<String> NoSpaceBefore = LangFormater.getNoSpaceBefore(lang);
+		List<String> NoSpaceAfter = LangFormater.getNoSpaceAfter(lang);
+		
+		if (second) { print(", ") }
+		if (second > 0 && (second % 5) == 0) println ""
+		print(srcfile.getName());
+		second++
+	
+	def ed = new pager(srcfile,resultfile, NoSpaceBefore, NoSpaceAfter,500,basename);
+	
+	Edition editionweb = text.addEdition("default","html",resultfile);
+	for(int i = 0 ; i < ed.getPageFiles().size();i++)
+	{
+		File f = ed.getPageFiles().get(i);
+		String idx = ed.getIdx().get(i);
+		editionweb.addPage(f,idx);
+	}
+	
+//	Edition editionbp = text.addEdition("onepage","html",resultfile);
+//	editionbp.addPage(resultfile,ed.getIdx().get(0));
+}
+
+w.save();
+println ""
+
Index: tmp/org.txm.core/src/groovy/org/txm/importer/fleurs/compiler.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/fleurs/compiler.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/fleurs/compiler.groovy	(revision 258)
@@ -0,0 +1,305 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2017-01-24 18:11:42 +0100 (Tue, 24 Jan 2017) $
+// $LastChangedRevision: 3400 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer.fleurs;
+
+import org.txm.importer.cwb.CwbEncode
+import org.txm.importer.cwb.CwbMakeAll
+import org.txm.importer.*;
+import org.txm.scripts.*;
+import org.txm.scripts.teitxm.BuildTTSrc;
+import org.txm.scripts.teitxm.*;
+import org.txm.utils.treetagger.TreeTagger;
+
+import javax.xml.stream.*;
+import java.net.URL;
+import java.io.File;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.List;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class compiler.
+ */
+class compiler{
+	
+	/** The input data. */
+	private def inputData;
+	
+	/** The factory. */
+	private def factory;
+	
+	/** The parser. */
+	private def parser;
+	
+	/** The dir. */
+	private def dir;
+	
+	/** The output. */
+	private def output;
+	
+	/** The url. */
+	private def url;
+	
+	/** The text. */
+	String text="";
+	
+	/** The base. */
+	String base="";
+	
+	/** The project. */
+	String project="";
+	
+	/** The cwb loc. */
+	String cwbLoc;
+	
+	/** The lang. */
+	private String lang ="fr";
+	
+	/**
+	 * Instantiates a new compiler.
+	 */
+	public compiler(){}
+	
+	/**
+	 * initialize.
+	 *
+	 * @param url the url
+	 * @param text the text
+	 * @param base the base
+	 * @param project the project
+	 */
+	public compiler(URL url,String text,String base, String project)
+	{
+		this.text = text
+		this.base = base;
+		this.project = project;
+		
+		try {
+			this.url = url;
+			inputData = url.openStream();
+			
+			factory = XMLInputFactory.newInstance();
+			parser = factory.createXMLStreamReader(inputData);
+		} catch (XMLStreamException ex) {
+			System.out.println(ex);
+		}catch (IOException ex) {
+			System.out.println("IOException while parsing ");
+		}
+	}
+	
+	/**
+	 * set the language of the corpus.
+	 *
+	 * @param lang the lang
+	 * @return the java.lang. object
+	 */
+	public setLang(String lang)
+	{
+		this.lang = lang;
+	}
+	
+	/**
+	 * Sets the cwb path.
+	 *
+	 * @param path the new cwb path
+	 */
+	public void setCwbPath(String path)
+	{
+		if(!new File(path).exists())
+			System.err.println("CWB Path : "+path+" does not exists")
+		cwbLoc = path;
+	}
+	
+	/**
+	 * Creates the output.
+	 *
+	 * @param dirPathName the dir path name
+	 * @param fileName the file name
+	 * @return true, if successful
+	 */
+	private boolean createOutput(String dirPathName, String fileName){
+		try {
+			File f = new File(dirPathName, fileName)
+			output = new OutputStreamWriter(new FileOutputStream(f,f.exists()) , "UTF-8")
+			return true;
+		} catch (Exception e) {
+			System.out.println(e.getLocalizedMessage());
+			return false;
+		}
+	}
+		
+	/**
+	 * Transfom file wtc.
+	 *
+	 * @param dirPathName the dir path name
+	 * @param fileName the file name
+	 * @return true, if successful
+	 */
+	public boolean transfomFileWtc(String dirPathName, String fileName)
+	{
+		createOutput(dirPathName, fileName);
+		
+		String vForm = "";
+		String wordid= "";
+		String w_l= "";
+		String w_lemme= "";
+		String w_pos= "";
+		String w_x= "";
+		String w_z= "";
+		
+		boolean flagForm = false;
+		output.write("<txmcorpus lang=\""+lang+"\">\n"); 
+		try 
+		{
+			for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) 
+			{
+				switch (event) 
+				{
+					case XMLStreamConstants.START_ELEMENT:
+					switch (parser.getLocalName()) 
+					{
+					case "recueil":
+						output.write("<text id=\""+text+"\" base=\"fleurs\" project=\"default\">\n");
+						break;
+					case "w":
+						flagForm= true;
+						w_l = parser.getAttributeValue(null,"l");
+						w_lemme = parser.getAttributeValue(null,"lemme");
+						w_pos = parser.getAttributeValue(null,"pos");
+						w_x= parser.getAttributeValue(null,"x");
+						w_z= parser.getAttributeValue(null,"z");
+						wordid= parser.getAttributeValue(null,"id");
+						vForm ="";
+						break;
+					default:
+						output.write("<"+parser.getLocalName())
+						for(int i =0; i < parser.getAttributeCount() ; i++)
+								output.write(" "+parser.getAttributeLocalName(i)+"=\""+parser.getAttributeValue(i)+"\"")
+							output.write(">\n");
+						break;
+					}
+					break;
+					
+					case XMLStreamConstants.END_ELEMENT:
+					switch (parser.getLocalName()) 
+					{
+					case "recueil":
+						output.write("</text>\n");
+						break;
+					case "w":
+						flagForm= false;
+						output.write(vForm+"\t"+wordid+"\t"+w_l+"\t"+w_lemme+"\t"+w_pos+"\t"+w_x+"\t"+w_z+"\n")
+						break;
+					default:
+						output.write("</"+parser.getLocalName()+">\n");
+						break;
+					}
+					break;
+					
+					case XMLStreamConstants.CHARACTERS:
+						if(flagForm)
+							vForm += parser.getText().trim();
+					
+					break;
+				}
+			}
+			output.write("</txmcorpus>"); 
+			output.close();
+			parser.close();
+			inputData.close();
+		}
+		catch (XMLStreamException ex) {
+			System.out.println(ex);
+		}
+		catch (IOException ex) {
+			System.out.println("IOException while parsing " + inputData);
+		}
+		
+		return true;
+	}
+	
+	/**
+	 * Run.
+	 *
+	 * @param rootDir the root dir
+	 */
+	public boolean run(String rootDir) 
+	{
+		//String rootDir = "~/xml/Hyperprince/";
+		if(cwbLoc == null)
+			cwbLoc = org.txm.Toolbox.getParam(org.txm.Toolbox.CQI_SERVER_PATH_TO_CQPLIB)+File.separator;
+		
+		new File(rootDir,"wtc/fleurs.wtc").delete();//cleaning&preparing
+		new File(rootDir,"wtc/").deleteDir();
+		new File(rootDir,"wtc/").mkdir();
+		new File(rootDir,"registry/").mkdir();
+		
+		//1- Transform into WTC file
+		List<File> files = new File(rootDir,"txm").listFiles();
+		for (File f : files) {
+			if (!f.exists()) {
+				println("file "+f+ " does not exists")	
+			}
+			else
+			{	
+				println("process file "+f)
+				String txtname = f.getName().substring(0,f.getName().length()-4);
+				def builder = new compiler(f.toURL(), txtname, "fleurs", "default");
+				builder.setLang lang
+				builder.transfomFileWtc(rootDir,"wtc/fleurs.wtc");
+			}
+		}
+		
+		//2- Import into CWB
+		def outDir =rootDir;
+		def outDirTxm = rootDir;
+		
+		CwbEncode cwbEn = new CwbEncode();
+		cwbEn.setDebug true;
+		CwbMakeAll cwbMa = new CwbMakeAll();
+		cwbMa.setDebug true;
+		
+		String[] pAttributes = ["id","l","lemme","pos","x","z"];
+		String[] sAttributes = ["txmcorpus:0+lang", "text:0+id+base+project","poeme:0+titre+genre+type+section+tranche_chrono+date+annee+titre_abr+preorig+schema1+schema2+n","strophe:0+ordre+nb_vers+structure","div:0+type+structure","vers:0+numvers+tphon+stru+n_syl+n_pied+cesure+rime"];
+		
+		try {
+			String regPath = outDirTxm + "/registry/"+"fleurs"
+			cwbEn.run(cwbLoc + "/cwb-encode", outDirTxm + "data", outDir + "/wtc/"+"fleurs.wtc", regPath,pAttributes, sAttributes);
+			if (!new File(regPath).exists()) {
+				println "Error: The registry file was not created: $regPath. See https://groupes.renater.fr/wiki/txm-users/public/faq"
+				return false;
+			}
+			cwbMa.run(cwbLoc + "/cwb-makeall", "FLEURS", outDirTxm + "/registry");
+			
+		} catch (Exception ex) {System.out.println(ex); return false;}
+		
+		System.out.println("Done.") 
+		return true;
+	}
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/importer/fleurs/package.html
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/fleurs/package.html	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/fleurs/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Fleur import module : Astartex</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/org/txm/importer/fleurs/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/importer/fleurs/BuildEdition.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/fleurs/BuildEdition.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/fleurs/BuildEdition.groovy	(revision 258)
@@ -0,0 +1,264 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2017-01-24 18:11:42 +0100 (Tue, 24 Jan 2017) $
+// $LastChangedRevision: 3400 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer.fleurs;
+
+import org.txm.importer.*;
+import org.xml.sax.Attributes;
+import org.txm.importer.filters.*;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.util.ArrayList;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.stream.*;
+import java.net.URL;
+import org.xml.sax.InputSource;
+import org.xml.sax.helpers.DefaultHandler;
+
+// TODO: Auto-generated Javadoc
+/** Build Discours corpus simple edition from a xml-tei. @author mdecorde */
+class BuildEdition {
+	int wordcount;
+	
+	/** The No space before. */
+	List<String> NoSpaceBefore;
+	
+	/** The No space after. */
+	List<String> NoSpaceAfter;
+	
+	/** The wordid. */
+	String wordid;
+	
+	/** The wordvalue. */
+	String wordvalue;
+	
+	/** The interpvalue. */
+	String interpvalue;
+	
+	/** The flaginterp. */
+	boolean flaginterp = false;
+	
+	/** The lastword. */
+	String lastword = " ";
+	
+	/** The wordtype. */
+	String wordtype;
+	
+	/** The flagform. */
+	boolean flagform = false;
+	
+	/** The url. */
+	private def url;
+	
+	/** The input data. */
+	private def inputData;
+	
+	/** The factory. */
+	private def factory;
+	
+	/** The parser. */
+	private XMLStreamReader parser;
+	
+	/** The writer. */
+	def writer;
+
+	/**
+	 * Instantiates a new builds the edition.
+	 *
+	 * @param infile the infile
+	 * @param outfile the outfile
+	 * @param NoSpaceBefore the no space before
+	 * @param NoSpaceAfter the no space after
+	 */
+	BuildEdition(File infile, File outfile, List<String> NoSpaceBefore,
+			List<String> NoSpaceAfter) {
+		this.NoSpaceBefore = NoSpaceBefore;
+		this.NoSpaceAfter = NoSpaceAfter;
+		this.url = infile.toURI().toURL();
+
+		inputData = url.openStream();
+		factory = XMLInputFactory.newInstance();
+		parser = factory.createXMLStreamReader(inputData);
+		createOutput(outfile);
+		process();
+	}
+
+	/**
+	 * Creates the output.
+	 *
+	 * @param outfile the outfile
+	 * @return true, if successful
+	 */
+	private boolean createOutput(File outfile) {
+		try {
+			writer = new OutputStreamWriter(new FileOutputStream(outfile),
+					"UTF-8");
+
+			return true;
+		} catch (Exception e) {
+			System.out.println(e.getLocalizedMessage());
+			return false;
+		}
+	}
+
+	/**
+	 * Process.
+	 */
+	void process()
+	{
+		String localname = "";
+		
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+			
+			
+			switch (event) {
+				case XMLStreamConstants.START_ELEMENT:
+					localname = parser.getLocalName();
+					switch(localname)
+					{
+						case "teiHeader":
+						if(parser.getAttributeValue(null,"type").equals("text"))
+						{
+							writer.write("<h1 class=\"text\">Discours</h1>")
+						}
+						else if(parser.getAttributeValue(null,"type").equals("corpus"))
+						{
+							writer.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
+							writer.write("<html>");
+							writer.write("<head>");
+							writer.write("<title>Discours edition</title>");
+							writer.write("</head>");
+							writer.write("<body>");
+						}
+						break;
+						
+						case "text":
+							writer.write("<ul>")
+							writer.write("<li>type : "+parser.getAttributeValue(null,"type")+"</li>")
+							writer.write("<li>locuteur : "+parser.getAttributeValue(null,"loc")+"</li>")
+							writer.write("<li>date : "+parser.getAttributeValue(null,"date")+"</li>")
+							writer.write("</ul>")
+						
+						break;
+						case "p":
+							writer.write("<p>");
+						break;
+						
+						case "w":
+						wordid=parser.getAttributeValue(null,"id");
+						wordcount++;
+						break;
+						
+						case "ana":
+						flaginterp=true;
+						interpvalue+=" "+parser.getAttributeValue(null,"type")+":"
+						break;
+						
+						case "form":
+						wordvalue="";
+						interpvalue ="";
+						flagform=true;
+					}
+				break;
+				case XMLStreamConstants.END_ELEMENT:
+					localname = parser.getLocalName();
+					switch(localname)
+					{
+						case "teiHeader":
+
+						break;
+						
+						case "p":
+							writer.write("</p>");
+						break;
+						
+						case "form":
+						flagform = false
+						
+						break;
+						
+						case "ana":
+						flaginterp = false
+						break;
+						
+						case "w":
+						int l = lastword.length();
+						interpvalue = interpvalue.replace("\"","&quot;");
+						if(NoSpaceBefore.contains(wordvalue))
+						writer.write("<span title=\""+interpvalue+"\" id=\""+wordid+"\">");
+						else if(NoSpaceAfter.contains(lastword.substring(l-1, l)))
+						writer.write("<span title=\""+interpvalue+"\" id=\""+wordid+"\">");
+						else if(wordvalue.startsWith("-") && wordvalue.length() > 0)
+						writer.write("<span title=\""+interpvalue+"\" id=\""+wordid+"\">");
+						else
+						writer.write(" <span title=\""+interpvalue+"\" id=\""+wordid+"\">");
+						writer.write(wordvalue);
+						writer.write("</span>");
+						lastword=wordvalue;
+						break;
+					}
+				break;
+				
+				case XMLStreamConstants.CHARACTERS:
+					if(flagform)
+						if(parser.getText().length() > 0)
+							wordvalue+=(parser.getText());
+					if(flaginterp)
+						if(parser.getText().length() > 0)
+							interpvalue+=(parser.getText());
+				break;
+			}
+		}	
+		writer.write("</body>");
+		writer.write("</html>");
+		inputData.close();
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args)
+	{
+		String rootDir = "~/.txm/cwb/data/discours/src/";
+		new File(rootDir+"/identity/").mkdir();
+		
+		File srcfile = new File(rootDir,"discours-p5.xml");
+		File resultfile = new File(rootDir,"discours-p5.html");
+		List<String> NoSpaceBefore = [",",".",")","]","}"];
+		List<String> NoSpaceAfter = ["'","(","[","{"];
+		println("build discours xml-tei file : "+srcfile+" to : "+resultfile );
+		
+		def builder = new BuildEdition(srcfile,resultfile, NoSpaceBefore, NoSpaceAfter);
+		
+		return;
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/fleurs/pager.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/fleurs/pager.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/fleurs/pager.groovy	(revision 258)
@@ -0,0 +1,335 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2017-01-24 18:11:42 +0100 (Tue, 24 Jan 2017) $
+// $LastChangedRevision: 3400 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer.fleurs;
+
+import org.txm.importer.*;
+import org.xml.sax.Attributes;
+import org.txm.importer.filters.*;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.stream.*;
+import java.net.URL;
+import org.xml.sax.InputSource;
+import org.xml.sax.helpers.DefaultHandler;
+
+// TODO: Auto-generated Javadoc
+/** Build Discours corpus simple edition from a xml-tei. @author mdecorde */
+class pager {
+	List<String> NoSpaceBefore;
+	
+	/** The No space after. */
+	List<String> NoSpaceAfter;
+
+	/** The wordcount. */
+	int wordcount = 0;
+	
+	/** The pagecount. */
+	int pagecount = 0;
+	
+	/** The wordmax. */
+	int wordmax = 0;
+
+	/** The basename. */
+	String basename;
+	
+	/** The wordid. */
+	String wordid;
+	
+	/** The first word. */
+	boolean firstWord = true;
+	
+	/** The wordvalue. */
+	String wordvalue;
+	
+	/** The interpvalue. */
+	String interpvalue;
+	
+	/** The lastword. */
+	String lastword = " ";
+	
+	/** The wordtype. */
+	String wordtype;
+	
+	/** The flagform. */
+	boolean flagform = false;
+	
+	/** The flaginterp. */
+	boolean flaginterp = false;
+	
+	/** The url. */
+	private def url;
+	
+	/** The input data. */
+	private def inputData;
+	
+	/** The factory. */
+	private def factory;
+	
+	/** The parser. */
+	private XMLStreamReader parser;
+	
+	/** The writer. */
+	OutputStreamWriter writer;
+	
+	/** The multiwriter. */
+	OutputStreamWriter multiwriter = null;
+	
+	/** The infile. */
+	File infile;
+	
+	/** The outfile. */
+	File outfile;
+	
+	/** The pages. */
+	ArrayList<File> pages = new ArrayList<File>();
+	
+	/** The idxstart. */
+	ArrayList<String> idxstart = new ArrayList<String>();
+
+	/**
+	 * Instantiates a new pager.
+	 *
+	 * @param infile the infile
+	 * @param outfile the outfile
+	 * @param NoSpaceBefore the no space before
+	 * @param NoSpaceAfter the no space after
+	 * @param max the max
+	 * @param basename the basename
+	 */
+	pager(File infile, File outfile, List<String> NoSpaceBefore,
+			List<String> NoSpaceAfter, int max, String basename) {
+		this.basename = basename;
+		this.wordmax = max;
+		this.NoSpaceBefore = NoSpaceBefore;
+		this.NoSpaceAfter = NoSpaceAfter;
+		this.url = infile.toURI().toURL();
+		this.infile = infile;
+
+		inputData = url.openStream();
+		factory = XMLInputFactory.newInstance();
+		parser = factory.createXMLStreamReader(inputData);
+		createOutput(outfile);
+		process();
+	}
+
+	/**
+	 * Creates the next output.
+	 *
+	 * @return true, if successful
+	 */
+	private boolean createNextOutput()
+	{
+		try {
+			if(multiwriter != null)
+			{
+				multiwriter.write("</body>");
+				multiwriter.write("</html>");
+				multiwriter.close();
+			}
+			pagecount++;
+			File f = new File(outfile.getParent()+"/multi/",outfile.getName().substring(0,outfile.getName().length()-5)+"_"+pagecount+".html");
+			pages.add(f);
+			idxstart.add(wordid)
+			multiwriter = new OutputStreamWriter(new FileOutputStream(f) , "UTF-8");
+			
+			multiwriter.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
+			multiwriter.write("<html>");
+			multiwriter.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/>");
+			multiwriter.write("<head>");
+			multiwriter.write("<title>"+basename.toUpperCase()+" Edition - Page "+pagecount+"</title>");
+			multiwriter.write("</head>");
+			multiwriter.write("<body>");
+			
+			return true;
+		} catch (Exception e) {
+			System.out.println(e.getLocalizedMessage());
+			return false;
+		}
+	}
+
+	/**
+	 * Creates the output.
+	 *
+	 * @param outfile the outfile
+	 * @return true, if successful
+	 */
+	private boolean createOutput(File outfile) {
+		try {
+			this.outfile = outfile;
+
+			writer = new OutputStreamWriter(new FileOutputStream(outfile),
+					"UTF-8");
+			// createNextOutput();
+			return true;
+		} catch (Exception e) {
+			System.out.println(e.getLocalizedMessage());
+			return false;
+		}
+	}
+
+	/**
+	 * Gets the page files.
+	 *
+	 * @return the page files
+	 */
+	public ArrayList<File> getPageFiles() {
+		return pages;
+	}
+
+	/**
+	 * Gets the idx.
+	 *
+	 * @return the idx
+	 */
+	public ArrayList<String> getIdx() {
+		return idxstart;
+	}
+
+	/**
+	 * Process.
+	 */
+	void process()
+	{
+		String localname = "";
+		
+		writer.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
+		writer.write("<html>");
+		writer.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/>");
+		writer.write("<head>");
+		writer.write("<title>"+basename.toUpperCase()+" edition</title>");
+		writer.write("</head>");
+		writer.write("<body>");
+		
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+			
+			
+			switch (event) {
+				case XMLStreamConstants.START_ELEMENT:
+					localname = parser.getLocalName();
+					switch(localname)
+					{
+						case "poeme":
+							createNextOutput();
+						writer.write("<h1 class=\"text\">"+parser.getAttributeValue(null,"titre")+"</h1>")
+						writer.write("<ul>")
+						for(int i =0 ; i < parser.getAttributeCount() ; i++)
+							writer.write("<li>"+parser.getAttributeLocalName(i)+" : "+parser.getAttributeValue(i)+"</li>");
+						writer.write("</ul><br/>")
+						
+						multiwriter.write("<h1 class=\"text\">"+parser.getAttributeValue(null,"titre")+"</h1>")
+						multiwriter.write("<ul>")
+						for(int i =0 ; i < parser.getAttributeCount() ; i++)
+							multiwriter.write("<li>"+parser.getAttributeLocalName(i)+" : "+parser.getAttributeValue(i)+"</li>");
+						multiwriter.write("</ul><br/>")
+						break;
+						
+						case "vers":
+							multiwriter.write("<br/>")
+							writer.write("<br/>")
+							break;
+							
+						case "strophe":
+							multiwriter.write("<br/>")
+							writer.write("<br/>")
+							break;
+							
+						case "w":
+						wordid=parser.getAttributeValue(null,"id");
+						if(firstWord)
+						{
+							firstWord=false;
+							this.idxstart.set(0,wordid);
+						}
+						interpvalue = "";
+						for(int i = 0 ; i < parser.getAttributeCount() ; i++)
+						{
+							if(parser.getAttributeLocalName(i) != "id")
+								interpvalue += " "+parser.getAttributeLocalName(i)+":"+parser.getAttributeValue(i);
+						}
+
+						flagform = true;
+						wordvalue = "";
+						break;
+
+					}
+					break;
+				case XMLStreamConstants.END_ELEMENT:
+					localname = parser.getLocalName();
+					switch(localname)
+					{
+						
+						case "w":
+							int l = lastword.length();
+							String endOfLastWord = "";
+							if(l > 0)
+								endOfLastWord = lastword.subSequence(l-1, l);
+							
+							if(interpvalue != null)
+								interpvalue = interpvalue.replace("\"","&quot;");
+							
+							if(NoSpaceBefore.contains(wordvalue) || 
+									NoSpaceAfter.contains(lastword) || 
+									wordvalue.startsWith("-") || 
+									NoSpaceAfter.contains(endOfLastWord))
+							{
+								writer.write("<span title=\""+interpvalue+"\" id=\""+wordid+"\">");
+								multiwriter.write("<span title=\""+interpvalue+"\" id=\""+wordid+"\">");
+							}
+							else
+							{
+								writer.write(" <span title=\""+interpvalue+"\" id=\""+wordid+"\">");
+								multiwriter.write(" <span title=\""+interpvalue+"\" id=\""+wordid+"\">");
+							}
+							writer.write(wordvalue.replace("<", "&lt;")+"</span>");
+							multiwriter.write(wordvalue.replace("<", "&lt;")+"</span>");
+							lastword=wordvalue;
+						flagform = false;
+						break;
+					}
+					break;
+				
+				case XMLStreamConstants.CHARACTERS:
+					if(flagform)
+						if(parser.getText().length() > 0)
+							wordvalue+=(parser.getText());
+					break;
+			}
+		}	
+		writer.write("</body>");
+		writer.write("</html>");
+		writer.close();
+		multiwriter.write("</body>");
+		multiwriter.write("</html>");
+		multiwriter.close();
+		inputData.close();
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/fleurs/BuildTEI.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/fleurs/BuildTEI.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/fleurs/BuildTEI.groovy	(revision 258)
@@ -0,0 +1,245 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2017-01-24 18:11:42 +0100 (Tue, 24 Jan 2017) $
+// $LastChangedRevision: 3400 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer.fleurs;
+
+import javax.xml.stream.*;
+import java.io.FileOutputStream;
+import java.io.OutputStreamWriter;
+import java.net.URL;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class BuildTEI.
+ */
+class BuildTEI {
+	
+	/** The url. */
+	private def url;
+	
+	/** The input data. */
+	private def inputData;
+	
+	/** The factory. */
+	private def factory;
+	
+	/** The parser. */
+	private XMLStreamReader parser;
+	
+	/** The output. */
+	private OutputStreamWriter output;
+
+	/**
+	 * Instantiates a new builds the tei.
+	 *
+	 * @param discoursxml the discoursxml
+	 */
+	public BuildTEI(File discoursxml) {
+		this.url = discoursxml.toURI().toURL();
+
+		inputData = url.openStream();
+		factory = XMLInputFactory.newInstance();
+		parser = factory.createXMLStreamReader(inputData);
+	}
+
+	/**
+	 * Creates the output.
+	 *
+	 * @param outfile the outfile
+	 * @return true, if successful
+	 */
+	private boolean createOutput(File outfile) {
+		try {
+			output = new OutputStreamWriter(new FileOutputStream(outfile),
+					"UTF-8");
+			return true;
+		} catch (Exception e) {
+			System.out.println(e.getLocalizedMessage());
+			return false;
+		}
+	}
+
+	/**
+	 * Write header.
+	 */
+	public void writeHeader() {
+		output.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
+		output
+				.write("<teiCorpus xmlns=\"http://www.tei-c.org/ns/1.0\" xmlns:txm=\"http://textometrie.org/1.0\">\n");
+		output.write("<teiHeader type=\"corpus\">\n");
+		output.write("</teiHeader>\n");
+	}
+
+	/**
+	 * Write footer.
+	 */
+	public void writeFooter() {
+		output.write("</teiCorpus>\n");
+	}
+
+	/**
+	 * Process.
+	 *
+	 * @param outfile the outfile
+	 */
+	public void process(File outfile)
+	{
+		createOutput(outfile);
+		int sentence=0;
+		int paragraph=0;
+		int idword=0;
+		
+		String lastopenlocalname= "";
+		String localname = "";
+				
+		try {
+			for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+				
+				switch (event) {
+					case XMLStreamConstants.START_ELEMENT:
+						localname = parser.getLocalName();
+					lastopenlocalname = localname;
+					switch (localname) {
+						case "corpus":
+							this.writeHeader();
+						break;
+						case "w":
+							idword++;	
+							
+							int para = Integer.parseInt(parser.getAttributeValue(null,"para"));
+							int sent = Integer.parseInt(parser.getAttributeValue(null,"sent"));
+							if(sent != sentence)
+							{
+								output.write("</s>\n")
+								
+								if(para != paragraph)
+								{
+									output.write("</p>\n")
+									output.write("<p id=\"p_"+para+"\">\n");
+									paragraph = para;
+								}
+								
+								output.write("<s id=\"s_"+sent+"\">\n");
+								sentence = sent;
+							}
+
+							output.write("<w id=\"w_"+idword+"\">\n");
+							output.write(" <txm:form>"+parser.getAttributeValue(null,"form")+"</txm:form>\n");
+							output.write(" <txm:ana resp=\"#cordial\" type=\"#pos\">"+parser.getAttributeValue(null,"pos")+"</interp>\n");
+							output.write(" <txm:ana resp=\"#cordial\" type=\"#func\">"+parser.getAttributeValue(null,"func")+"</interp>\n");
+							output.write(" <txm:ana resp=\"#cordial\" type=\"#lemma\">"+parser.getAttributeValue(null,"lem")+"</interp>\n");
+							output.write("</w>\n");
+							
+						break;
+						case "text":
+							output.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
+							output.write("<TEI xmlns=\"http://www.tei-c.org/ns/1.0\" xmlns:txm=\"http://textometrie.org/1.0\">\n");
+							output.write("<teiHeader type=\"text\">\n");
+							output.write("<fileDesc>\n");
+							output.write("<titleStmt>\n");
+							output.write("<title>"+parser.getAttributeValue(null,"file")+"</title>\n");
+							output.write("<respStmt>\n");
+							output.write("<resp id=\"cordial\">initial tagging</resp>")
+							output.write("</respStmt>\n");
+							output.write("</titleStmt>\n");
+							output.write("</fileDesc>\n");
+							output.write("<encodingDesc>\n");
+							output.write("<classDecl>\n");
+							output.write("<taxonomy id=\"pos\"><bibl type=\"tagset\"/></taxonomy>\n")
+							output.write("<taxonomy id=\"func\"><bibl type=\"tagset\"/></taxonomy>\n")
+							output.write("<taxonomy id=\"lemma\"><bibl type=\"tagset\"/></taxonomy>\n")
+							output.write("</classDecl>\n");
+							output.write("</encodingDesc>\n");
+							output.write("</teiHeader>\n");
+							output.write("<text id=\""+parser.getAttributeValue(null,"id")+"\" type=\""+parser.getAttributeValue(null,"type")+"\" loc=\""+parser.getAttributeValue(null,"loc")+"\" date=\""+parser.getAttributeValue(null,"date")+"\" file=\""+parser.getAttributeValue(null,"file")+"\">\n");
+							output.write("<p id=\"p_1\">\n");
+							output.write("<s id=\"s_1\">\n");
+							paragraph=1;
+							sentence=1;
+						break;
+					}
+					break;	
+					
+					case XMLStreamConstants.END_ELEMENT:
+						localname = parser.getLocalName();
+					switch (localname) {				
+						
+						case "w":
+						break;
+						
+						case "text":
+							output.write("</s>\n");
+							output.write("</p>\n");
+							paragraph=1;
+							sentence=1;
+							output.write("</text>\n");
+							output.write("</TEI>\n");
+						break;
+						
+						case "corpus":
+							this.writeFooter();
+						break;
+					}
+					break;
+					
+					case XMLStreamConstants.CHARACTERS:
+						//output.write(parser.getText().trim());				
+					break;
+				}
+			}
+			output.close();
+			parser.close();
+			inputData.close();
+		}
+		catch (XMLStreamException ex) {
+			System.out.println(ex);
+		}
+		catch (IOException ex) {
+			System.out.println("IOException while parsing " + inputData);
+		}
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args) {
+
+		String rootDir = "~/xml/discours/src";
+
+		File srcfile = new File(rootDir, "discours.xml");
+		File resultfile = new File(rootDir, "discours-tei.xml");
+		println("build discours xml-tei file : " + srcfile + " to : "
+				+ resultfile);
+
+		def builder = new BuildTEI(srcfile);
+		builder.process(resultfile);
+
+		return;
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/fleurs/importer.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/fleurs/importer.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/fleurs/importer.groovy	(revision 258)
@@ -0,0 +1,239 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer.fleurs
+
+import org.txm.importer.*;
+import org.txm.importer.filters.*;
+import org.txm.scripts.*;
+import org.txm.scripts.teitxm.BuildTTSrc;
+import org.txm.scripts.teitxm.*;
+import javax.xml.stream.*;
+import java.io.BufferedWriter;
+import java.io.FileOutputStream;
+import java.io.OutputStreamWriter;
+import java.io.PrintStream;
+import java.net.URL;
+import java.util.List;
+
+import org.txm.*;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class importer.
+ */
+class importer 
+{
+	
+	/**
+	 * Run.
+	 *
+	 * @param dir the dir
+	 * @param basename the basename
+	 */
+	public void run(File dir, String basename)
+	{
+		String rootDir = dir.getAbsolutePath()+"/"
+		//cleaning
+		File binDir = new File(Toolbox.getParam(Toolbox.USER_TXM_HOME),"corpora/"+basename);
+		binDir.deleteDir();
+		binDir.mkdir();
+		new File(binDir,"txm").deleteDir();
+		new File(binDir,"txm").mkdir();
+		
+		File srcfile = new File(rootDir).listFiles()[0];
+		File resultfile = new File(binDir,"txm/"+srcfile.getName());
+		
+		this.process(srcfile, resultfile);		
+	}
+	
+	/**
+	 * Process.
+	 *
+	 * @param srcfile the srcfile
+	 * @param resultfile the resultfile
+	 */
+	public void process(File srcfile, File resultfile)
+	{
+		
+		String localname= "";
+		URL url = srcfile.toURI().toURL();
+		def inputData = url.openStream();
+		def factory = XMLInputFactory.newInstance();
+		XMLStreamReader parser = factory.createXMLStreamReader(inputData);
+		OutputStreamWriter output = new OutputStreamWriter(new FileOutputStream(resultfile) , "UTF-8");
+		
+		println resultfile.getAbsolutePath()
+		
+		String poeme_titre ="";
+		String poeme_type ="";
+		String poeme_genre ="";
+		String poeme_section ="";
+		String poeme_tranchechrono ="";
+		String poeme_date ="";
+		String poeme_annee ="";
+		String poeme_titreabr ="";
+		String poeme_preorig ="";
+		String poeme_schema1 ="";
+		String poeme_schema2 ="";
+		
+		int wordid = 1;
+		
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) 
+		{
+			switch (event) {
+				case XMLStreamConstants.START_ELEMENT:
+					localname = parser.getLocalName();
+					switch (localname) {
+						case "M"://f, l, x test si null
+						case "MC":
+						case "PC":
+							String x = parser.getAttributeValue(null,"x");
+							String z = parser.getAttributeValue(null,"z");
+							String l = parser.getAttributeValue(null,"l");
+							String f = parser.getAttributeValue(null,"f");
+							String pos = "none";
+							String lemme = "none";
+							if(l != null)
+							{
+								String[] split = l.split("_");
+								if(split.length == 2)
+								{
+									pos = split[1];
+									lemme = split[0];
+								}
+							}
+						
+							if(x == null)
+								x = "n/a";
+							if(z == null)
+								z = "1";
+							output.write("<w id=\"w_"+(wordid++)+"\" l=\""+l+"\" lemme=\""+lemme+"\" pos=\""+pos+"\" x=\""+x+"\" z=\""+z+"\">"+f+"</w>\n")
+							break;
+						
+						case "RECUEIL":
+							output.write("<recueil>\n");
+						
+							break;
+						case "POEME":
+							poeme_titre = parser.getAttributeValue(null,"TITRE");
+							poeme_type = parser.getAttributeValue(null,"TYPE");
+							poeme_genre = parser.getAttributeValue(null,"GENRE");
+							poeme_section = parser.getAttributeValue(null,"SECTION");
+							poeme_tranchechrono = parser.getAttributeValue(null,"TRANCHE_CHRONO");
+							poeme_date = parser.getAttributeValue(null,"DATE");
+							poeme_annee = parser.getAttributeValue(null,"ANNEE");
+							poeme_titreabr = parser.getAttributeValue(null,"TITRE_ABR");
+							poeme_preorig = parser.getAttributeValue(null,"PREORIG");
+							poeme_schema1 = parser.getAttributeValue(null,"SCHEMA1");
+							poeme_schema2 = parser.getAttributeValue(null,"SCHEMA2");
+							break;	
+						case "ASTX_ATTR":
+							output.write("<poeme");
+							output.write(" titre=\""+poeme_titre+"\"");
+							if(poeme_type == "")
+								output.write(" type=\"v\"");
+							else
+								output.write(" type=\""+poeme_type+"\"");
+							if(poeme_genre == "")
+								output.write(" genre=\"v\"");
+							else
+								output.write(" genre=\""+poeme_genre+"\"");
+							output.write(" section=\""+poeme_section+"\"");
+							output.write(" tranche_chrono=\""+poeme_tranchechrono+"\"");
+							output.write(" date=\""+poeme_date+"\"");
+							output.write(" annee=\""+poeme_annee+"\"");
+							output.write(" titre_abr=\""+poeme_titreabr+"\"");
+							output.write(" preorig=\""+poeme_preorig+"\"");
+							output.write(" schema1=\""+poeme_schema1+"\"");
+							output.write(" schema2=\""+poeme_schema2+"\"");
+							output.write(" n=\""+poeme_schema2+"\"");
+							output.write(">\n");
+							break;
+						
+						case "HUITAIN":
+						case "SIZAIN":
+							output.write("<div type=\""+localname.toLowerCase()+"\"");
+							for(int i =0; i < parser.getAttributeCount() ; i++)
+								output.write(" "+parser.getAttributeLocalName(i).toLowerCase()+"=\""+parser.getAttributeValue(i)+"\"")
+							output.write(">\n");
+							break;
+						case "STROPHE":
+						case "VERS":
+							output.write("<"+localname.toLowerCase());
+							for(int i =0; i < parser.getAttributeCount() ; i++)
+								output.write(" "+parser.getAttributeLocalName(i).toLowerCase()+"=\""+parser.getAttributeValue(i)+"\"")
+							output.write(">\n");
+							break;
+					}
+					break;
+				case XMLStreamConstants.END_ELEMENT:
+					localname = parser.getLocalName();
+					switch (localname) {
+						
+						case "RECUEIL":
+							output.write("</recueil>\n");
+							break;
+						
+						case "ASTX_ATTR":
+							output.write("</poeme>\n");
+							break;
+						
+						case "HUITAIN":
+						case "SIZAIN":
+							output.write("</div>\n");
+							break;
+						case "STROPHE":
+						case "VERS":
+							output.write("</"+localname.toLowerCase()+">\n");
+							break;
+					}
+					break;
+				case XMLStreamConstants.CHARACTERS:
+				//output.write(parser.getText().trim());				
+					break;
+			}
+		}
+		output.close();
+		parser.close();
+		inputData.close();
+	}
+	
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args)
+	{
+		File dir = new File(System.getProperty("user.home"),"xml/fleurs/");
+		String rootDir = dir.getAbsolutePath();
+		File homedir = new File(rootDir);
+		def imp = new importer();
+		imp.run(homedir);
+	}
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/importer/xml/xmlLoader.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/xml/xmlLoader.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/xml/xmlLoader.groovy	(revision 258)
@@ -0,0 +1,301 @@
+// 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
+// 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.
+//
+//
+//
+// $LastChangedDate: 2016-11-29 16:47:07 +0100 (Tue, 29 Nov 2016) $
+// $LastChangedRevision: 3349 $
+// $LastChangedBy: mdecorde $
+//
+package org.txm.importer.xml;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.txm.sw.RemoveTag;
+import org.txm.importer.ApplyXsl2;
+import org.txm.importer.ValidateXml;
+import org.txm.importer.xml.importer;
+import org.txm.importer.xml.compiler;
+import org.txm.importer.xml.pager_old;
+import org.txm.objects.*;
+import org.txm.tokenizer.TokenizerClasses;
+import org.txm.utils.*;
+import org.txm.*;
+import org.txm.scripts.teitxm.*;
+import org.txm.utils.i18n.*;
+import org.txm.metadatas.*;
+
+import javax.xml.stream.*;
+
+import org.w3c.dom.Element
+
+String userDir = System.getProperty("user.home");
+
+def MONITOR;
+boolean debug = org.txm.utils.logger.Log.isPrintingErrors();
+BaseParameters params;
+try {params = paramsBinding;MONITOR=monitor} catch (Exception)
+{	println "DEV MODE";//exception means we debug
+	debug = true
+	params = new BaseParameters(new File(userDir, "xml/bvh/bugnames/import.xml"))
+	params.load()
+	if (!org.txm.Toolbox.isInitialized()) {
+
+		TokenizerClasses.loadFromNode(params.getTokenizerElement(params.getCorpusElement()));
+		Toolbox.setParam(Toolbox.INSTALL_DIR,new File("/usr/lib/TXM"));
+		//Toolbox.setParam(Toolbox.INSTALL_DIR,new File("C:\\Program Files\\TXM"));//For Windows
+		Toolbox.setParam(Toolbox.TREETAGGER_INSTALL_PATH,new File(userDir,"treetagger"));
+		//Toolbox.setParam(Toolbox.TREETAGGER_INSTALL_PATH,new File("C:\\Program Files\\treetagger"));//for Windows
+		Toolbox.setParam(Toolbox.TREETAGGER_MODELS_PATH,new File(userDir,"treetagger/models"));
+		Toolbox.setParam(Toolbox.METADATA_ENCODING, "UTF-8");
+		Toolbox.setParam(Toolbox.METADATA_COLSEPARATOR, ",");
+		Toolbox.setParam(Toolbox.METADATA_TXTSEPARATOR, "\"");
+		//Toolbox.setParam(Toolbox.TREETAGGER_MODELS_PATH,new File("C:\\Program Files\\treetagger\\models"));//for Windows
+		Toolbox.setParam(Toolbox.USER_TXM_HOME, new File(System.getProperty("user.home"), "TXM"));
+	}
+}
+if (params == null) { println "no parameters. Aborting"; return; }
+
+String corpusname = params.getCorpusName();
+Element corpusElem = params.corpora.get(corpusname);
+String basename = params.name;
+String rootDir = params.rootDir;
+String lang = corpusElem.getAttribute("lang");
+String model = lang
+String encoding = corpusElem.getAttribute("encoding");
+boolean annotate = "true" == corpusElem.getAttribute("annotate");
+String xsl = params.getXsltElement(corpusElem).getAttribute("xsl")
+def xslParams = params.getXsltParams(corpusElem);
+int wordsPerPage = params.getWordsPerPage("default")
+String page_element = params.getPageElement("default")
+boolean build_edition = params.getDoEdition("default")
+
+File srcDir = new File(rootDir);
+File binDir = new File(Toolbox.getParam(Toolbox.USER_TXM_HOME), "corpora/"+basename);
+binDir.deleteDir();
+binDir.mkdirs();
+if (!binDir.exists()) {
+	println "Could not create binDir "+binDir
+	return;
+}
+
+File txmDir = new File(binDir, "txm/$corpusname");
+txmDir.deleteDir();
+txmDir.mkdirs();
+
+File propertyFile = new File(rootDir, "import.properties")//default
+Properties props = new Properties();
+String[] metadatasToKeep;
+
+String textSortAttribute = null;
+boolean normalizeMetadata = false;
+String ignoredElements = null;
+boolean stopIfMalformed = false;
+
+println "Trying to read import properties file: "+propertyFile
+if (propertyFile.exists() && propertyFile.canRead()) {
+	InputStreamReader input = new InputStreamReader(new FileInputStream(propertyFile) , "UTF-8");
+	props.load(input);
+	input.close();
+	if(props.getProperty("sortmetadata") != null)
+		textSortAttribute = props.get("sortmetadata").toString();
+	if (props.getProperty("normalizemetadata") != null)
+		normalizeMetadata = Boolean.parseBoolean(props.get("normalizemetadata").toString());
+	if (props.getProperty("ignoredelements") != null)
+		ignoredElements = props.get("ignoredelements").toString();
+	if (props.getProperty("stopifmalformed") != null)
+		stopIfMalformed = Boolean.parseBoolean(props.get("stopifmalformed").toString());
+
+	println "import properties: "
+	println " sort metadata: "+textSortAttribute
+	println " normalize attributes: "+normalizeMetadata
+	println " ignored elements: "+ignoredElements
+	println " stop if a XML source is malformed: "+stopIfMalformed
+}
+
+File allmetadatasfile = new File(srcDir, "metadata.csv");
+
+// Apply XSL
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+if (MONITOR != null) MONITOR.worked(1, "APPLYING XSL")
+if (xsl != null && xslParams != null && xsl.trim().length() > 0) {
+	if (ApplyXsl2.processImportSources(new File(xsl), srcDir, new File(binDir, "src"), xslParams))
+	// return; // error during process
+	srcDir = new File(binDir, "src");
+	println ""
+}
+
+// copy xml+dtd files
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+List<File> srcfiles = srcDir.listFiles();
+if (srcfiles != null)
+	for (int i = 0 ; i < srcfiles.size() ; i++) {// check XML format, and copy file into binDir
+		File f = srcfiles.get(i)
+		if (f.getName().equals("import.xml") || f.getName().equals("metadata.csv") || f.getName().endsWith(".properties")) {
+			srcfiles.remove(i);
+			i--;
+			continue;
+		}
+		if (ValidateXml.test(f)) {
+			FileCopy.copy(f, new File(txmDir, f.getName()));
+		} else {
+			println "Won't process file "+f;
+		}
+	}
+
+if (txmDir.listFiles() == null) {
+	println "No txm file to process"
+	return;
+}
+
+// filtering
+/*def xpaths = params.getExcludeXpaths()
+ if (xpaths != null) {
+ println "Filtering XML files with xpaths: $xpaths"
+ for (File infile : txmDir.listFiles()) {
+ print "."
+ if (!RemoveTag.xpath(infile, xpaths)) {
+ println "Failed to filter $infile"
+ return
+ }
+ }
+ println ""
+ }*/
+
+//get metadata values from CSV
+Metadatas metadatas; // text metadata
+
+println "Trying to read metadata from: "+allmetadatasfile
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+if (allmetadatasfile.exists()) {
+	println " Metadata file found: "+allmetadatasfile
+	File copy = new File(binDir, "metadata.csv")
+	if (!FileCopy.copy(allmetadatasfile, copy)) {
+		println "Error: could not create a copy of metadata file "+allmetadatasfile.getAbsoluteFile();
+		return;
+	}
+	metadatas = new Metadatas(copy, Toolbox.getParam(Toolbox.METADATA_ENCODING), Toolbox.getParam(Toolbox.METADATA_COLSEPARATOR), Toolbox.getParam(Toolbox.METADATA_TXTSEPARATOR), 1)
+} else {
+	println " No metadata file: "+allmetadatasfile
+}
+
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+if (MONITOR != null) MONITOR.worked(5, "IMPORTER")
+println "-- IMPORTER - Reading source files"
+def imp = new importer();
+imp.doValidation(true) // change this to not validate xml
+boolean skipDoTokenizeStep = params.getSkipTokenization()
+imp.doTokenize(!skipDoTokenizeStep) // change this, to not tokenize xml
+imp.setStopIfMalformed(stopIfMalformed);
+if (!imp.run( srcDir, binDir, txmDir, basename, ignoredElements, lang)) {
+	println "import process stopped";
+	return;
+}
+
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+if (MONITOR != null) MONITOR.worked(20, "INJECTING METADATA")
+if (metadatas != null) {
+	println("-- INJECTING METADATA - "+metadatas.getHeadersList()+" in texts of directory "+new File(binDir,"txm"))
+	for (File infile : txmDir.listFiles()) {
+		print "."
+		File outfile = File.createTempFile("temp", ".xml", infile.getParentFile());
+		if (!metadatas.injectMetadatasInXml(infile, outfile, "text", null)) {
+			outfile.delete();
+		} else {
+			if (!(infile.delete() && outfile.renameTo(infile))) println "Warning can't rename file "+outfile+" to "+infile
+			if (!infile.exists()) {
+				println "Error: could not replace $infile by $outfile"
+				return false;
+			}
+		}
+	}
+	println ""
+}
+List<File> files = txmDir.listFiles()
+if (files == null || files.size() == 0) {
+	return;
+}
+
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+if (MONITOR != null) MONITOR.worked(20, "ANNOTATE")
+println "-- ANNOTATE - Running NLP tools"
+boolean annotationSuccess = false;
+if (annotate && new Annotate().run(binDir, txmDir, model+".par")) {
+	annotationSuccess = true;
+}
+
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+if (MONITOR != null) MONITOR.worked(25, "COMPILING")
+println "-- COMPILING - Building Search Engine indexes"
+def c = new compiler();
+if(debug) c.setDebug();
+//c.setCwbPath("~/TXM/cwb/bin");
+c.setOptions(textSortAttribute, normalizeMetadata);
+c.setAnnotationSuccess(annotationSuccess)
+c.setLang(lang);
+if (!c.run(binDir, txmDir, corpusname, null, srcfiles, metadatas)) {
+	println "import process stopped";
+	return;
+}
+
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+
+new File(binDir,"HTML/$corpusname").deleteDir();
+new File(binDir,"HTML/$corpusname").mkdirs();
+if (build_edition) {
+
+	println "-- EDITION - Building edition"
+	if (MONITOR != null) MONITOR.worked(25, "EDITION")
+	
+	File outdir = new File(binDir,"/HTML/$corpusname/default/");
+	outdir.mkdirs();
+	List<File> filelist = txmDir.listFiles();
+	Collections.sort(filelist);
+	def second = 0
+
+	println "Paginating texts: "+filelist
+
+	for (File txmFile : filelist) {
+		print "."
+		String txtname = txmFile.getName();
+		int i = txtname.lastIndexOf(".");
+		if (i > 0) txtname = txtname.substring(0, i);
+
+		List<String> NoSpaceBefore = LangFormater.getNoSpaceBefore(lang);
+		List<String> NoSpaceAfter = LangFormater.getNoSpaceAfter(lang);
+
+		Element text = params.addText(corpusElem, txtname, txmFile);
+
+		def ed = new pager(txmFile, outdir, txtname, NoSpaceBefore, NoSpaceAfter, wordsPerPage, basename, page_element);
+		Element edition = params.addEdition(text, "default", outdir.getAbsolutePath(), "html");
+
+		for (i = 0 ; i < ed.getPageFiles().size();) {
+			File f = ed.getPageFiles().get(i);
+			String wordid = ed.getIdx().get(i);
+			params.addPage(edition, ""+(++i), wordid);
+		}
+	}
+}
+
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+if (MONITOR != null) MONITOR.worked(20, "FINALIZING")
+File paramFile = new File(binDir, "import.xml");
+DomUtils.save(params.root.getOwnerDocument(), paramFile);readyToLoad = true;
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/importer/xml/compiler.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/xml/compiler.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/xml/compiler.groovy	(revision 258)
@@ -0,0 +1,735 @@
+
+
+// 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
+// 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.
+//
+//
+//
+// $LastChangedDate: 2016-05-26 17:42:36 +0200 (Thu, 26 May 2016) $
+// $LastChangedRevision: 3219 $
+// $LastChangedBy: mdecorde $
+//
+
+
+package org.txm.importer.xml;
+
+import java.util.ArrayList
+import java.util.Collections
+
+import org.txm.importer.cwb.BuildCwbEncodeArgs
+import org.txm.importer.cwb.CwbEncode
+import org.txm.importer.cwb.CwbMakeAll
+import org.txm.importer.*
+import org.txm.scripts.*
+import org.txm.scripts.teitxm.*
+import org.txm.utils.io.FileCopy;
+import org.txm.utils.treetagger.TreeTagger
+
+import javax.xml.stream.*
+
+import java.net.URL
+import java.io.File
+import java.util.HashMap
+import java.util.List
+import java.util.HashMap
+import java.util.HashSet
+
+import org.txm.metadatas.*
+
+/**
+ * The "compiler" Class of the XML/w import module.
+ */
+class compiler {
+	
+	/** The debug. */
+	private boolean debug= false;
+
+	/** The input data. */
+	private def inputData;
+
+	/** The factory. */
+	private def factory;
+
+	/** The parser. */
+	private XMLStreamReader parser;
+
+	/** The dir. */
+	private def dir;
+
+	/** The output. */
+	private def output;
+
+	/** The url. */
+	private def url;
+
+	/** The anatypes. */
+	private static anatypes = []
+	private static anavalues = [:]
+
+	/** The anahash. */
+	private HashMap<String, String> anahash = new HashMap<String, String>() ;
+
+	private static SAttributesListener sattrsListener;
+	private static HashMap<String, ArrayList<String>> structs;
+	private static HashMap<String, Integer> structsProf;
+
+	/** The text. */
+	String text="";
+
+	/** The base. */
+	String base="";
+
+	/** The project. */
+	String project="";
+
+	/** The text attributes. */
+	String[] textAttributes = null;
+
+	/** The cwb loc. */
+	String cwbLoc;
+
+	/** The lang. */
+	private String lang ="fr";
+
+	public static sortMetadata = null;
+	public static normalizeMetadata = false;
+
+	/**
+	 * initialize.
+	 *
+	 */
+	public compiler(){}
+
+	public void setOptions(String sortmetadata, boolean normalizemetadata)
+	{
+		sortMetadata = sortmetadata;
+		normalizeMetadata = normalizemetadata;
+	}
+
+	/**
+	 * Instantiates a new compiler.
+	 *
+	 * @param url the url
+	 * @param text the text
+	 * @param base the base
+	 * @param project the project
+	 */
+	public compiler(URL url, String text, String base, String project)
+	{
+		this.text = text
+		this.base = base;
+		this.project = project;
+		this.textAttributes = textAttributes;
+		try {
+			this.url = url;
+			inputData = url.openStream();
+
+			factory = XMLInputFactory.newInstance();
+			parser = factory.createXMLStreamReader(inputData);
+
+			if (sattrsListener == null)
+				sattrsListener = new SAttributesListener(parser);
+			else
+				sattrsListener.start(parser)
+
+		} catch (XMLStreamException ex) {
+			System.out.println(ex);
+		}catch (IOException ex) {
+			System.err.println("IOException while parsing ");
+		}
+	}
+
+	/**
+	 * set the language of the corpus.
+	 *
+	 * @param lang the lang
+	 * @return the java.lang. object
+	 */
+	public setLang(String lang)
+	{
+		this.lang = lang;
+	}
+
+	/** The annotation success. */
+	boolean annotationSuccess = false;
+
+	/**
+	 * Sets the annotation success.
+	 *
+	 * @param val the new annotation success
+	 */
+	public void setAnnotationSuccess(boolean val)
+	{
+		this.annotationSuccess = val;
+	}
+
+	/**
+	 * Sets the cwb path.
+	 *
+	 * @param path the new cwb path
+	 */
+	public void setCwbPath(String path)
+	{
+		if (!new File(path).exists())
+			System.err.println("CWB Path : "+path+" does not exists")
+		cwbLoc = path;
+	}
+
+	/**
+	 * Creates the output.
+	 *
+	 * @param dirPathName the dir path name
+	 * @param fileName the file name
+	 * @return true, if successful
+	 */
+	private boolean createOutput(File f){
+		try {
+			output = new OutputStreamWriter(new BufferedOutputStream(new FileOutputStream(f,f.exists())) , "UTF-8");
+			return true;
+		} catch (Exception e) {
+			System.err.println(e);
+			return false;
+		}
+	}
+
+	/**
+	 * Go to text.
+	 */
+	private void GoToText()
+	{
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+			if (event == XMLStreamConstants.END_ELEMENT)
+				if (parser.getLocalName().equals("teiHeader"))
+					return;
+		}
+	}
+
+	/**
+	 * Transfom file wtc.
+	 *
+	 * @param dirPathName the dir path name
+	 * @param fileName the file name
+	 * @return true, if successful
+	 */
+	public boolean transfomFileWtc(File wtcFile, HashMap<String, String> textmetadata)
+	{
+		if (!createOutput(wtcFile))
+			return false;
+
+		String headvalue=""
+		String vAna = "";
+		String vForm = "";
+		String wordid= "";
+		String vHead = "";
+
+		int p_id = 0;
+		int s_id = 0;
+
+		def divs = []
+		def ncounts = [:] // contains the n values per tags with no attribute
+
+		boolean captureword = false;
+		boolean flagForm = false;
+		boolean flagAna = false;
+
+		String anatype = "";
+		String anavalue = "";
+		boolean stopAtFirstSort = true;
+		boolean foundtei = false;
+		boolean foundtext = false;
+		//output.write("<txmcorpus lang=\""+lang+"\">\n");
+		try {
+			String localname;
+			for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next())
+			{
+				switch (event) {
+					case XMLStreamConstants.START_ELEMENT:
+						localname = parser.getLocalName().toLowerCase();
+						if ("tei".equals(localname)) foundtei = true;
+						switch (localname) {
+							case "text":
+								sattrsListener.startElement(localname);
+								foundtext = true;
+								output.write("<text id=\""+text+"\" base=\""+base+"\"" + " project=\""+project+"\"");
+							//							for (String name : textmetadata.keySet())
+							//								output.write(" "+name+"=\""+textmetadata.get(name)+"\"")
+								for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
+									String attrname = parser.getAttributeLocalName(i);
+									String attrvalue = parser.getAttributeValue(i)
+									if (normalizeMetadata)
+										attrvalue = attrvalue.toLowerCase();
+									if (attrname != "id")
+										output.write(" "+attrname.toLowerCase()+"=\""+attrvalue+"\"")
+								}
+								output.write(">\n");
+
+							//								if (textAttributes == null) {
+							//									textAttributes = new String[parser.getAttributeCount()];
+							//
+							//									for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
+							//										textAttributes[i]=parser.getAttributeLocalName(i).toLowerCase();
+							//									}
+							//								}
+
+								break;
+
+
+							case "w":
+								for (int i = 0 ; i < parser.getAttributeCount(); i++) {
+									if (parser.getAttributeLocalName(i).equals("id")) {
+										wordid = parser.getAttributeValue(i);
+									}
+								}
+								anavalues = [:];
+								break;
+							case "form":
+								flagForm = true;
+								vForm = "";
+								vAna ="";
+								break;
+
+							case "ana":
+								flagAna = true;
+								anavalue = "";
+								for (int i = 0 ; i < parser.getAttributeCount(); i++)
+									if ("type".equals(parser.getAttributeLocalName(i))) {
+										anatype = parser.getAttributeValue(i).substring(1);//remove the #
+										break;
+									}
+								break;
+
+							default:
+//								if ("div" == localname ) {
+//									def type = localname;
+//									for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
+//										String attrname = parser.getAttributeLocalName(i);
+//										if ("type".equals(attrname)) {
+//											type= parser.getAttributeValue(i)
+//										}
+//									}
+//									divs << type;
+//									localname = type
+//								}
+
+								if (foundtei && !foundtext) break;
+
+								sattrsListener.startElement(localname);
+								output.write("<"+localname);
+
+								for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
+									String attrname = parser.getAttributeLocalName(i);
+									String attrvalue = parser.getAttributeValue(i)
+									if (normalizeMetadata)
+										attrvalue = attrvalue.toLowerCase();
+									output.write(" "+attrname.toLowerCase()+"=\""+attrvalue+"\"")
+								}
+								if (parser.getAttributeCount() == 0) { // add the n attribute
+									if (!ncounts.containsKey(localname)) ncounts.put(localname, 0);
+									int ncount = ncounts.get(localname);
+									ncounts.put(localname, ncount+1);
+									output.write(" n=\""+ncount+"\"")
+								}
+								output.write(">\n");
+						}
+						break;
+
+					case XMLStreamConstants.END_ELEMENT:
+						localname = parser.getLocalName().toLowerCase();
+						switch (localname) {
+							case "w":
+								for (String type : anatypes) {
+									def v = anavalues.get(type);
+									if (v != null) vAna +="\t"+v;
+									else vAna +="\t";
+								}
+								vForm = vForm.replaceAll("\n", "").replaceAll("&", "&amp;").replaceAll("<", "&lt;");
+								if (vAna != null) {
+									output.write(vForm+"\t"+wordid+vAna+"\n");
+								}
+								vAna = "";
+								vForm = "";
+								break;
+
+							case "tei":
+								break;
+							case "form":
+								flagForm = false;
+								break;
+							case "ana":
+								anavalues.put(anatype, anavalue)
+								flagAna = false;
+								break;
+							default:
+								if (foundtei && !foundtext) break;
+
+//								if ("div" == localname && divs.size() > 0) {
+//									localname = divs.pop()
+//								}
+
+								sattrsListener.endElement(localname);
+								output.write("</"+localname+">\n");
+						}
+						break;
+
+					case XMLStreamConstants.CHARACTERS:
+						if (flagForm)
+							vForm += parser.getText().trim();
+						if (flagAna) {
+							if (normalizeMetadata)
+								anavalue += parser.getText().trim().toLowerCase();
+							else
+								anavalue += parser.getText().trim();
+						}
+						break;
+				}
+			}
+			//output.write("</txmcorpus>");
+			output.close();
+			parser.close();
+		} catch (Exception ex) {
+			System.out.println("Exception while parsing " + inputData+" of Text "+text);
+			File xmlFile = null
+			File errorDir = null		
+			try {
+				xmlFile = new File(url.getFile())
+				errorDir = new File(wtcFile.getParentFile(), "compiler-error")
+				println "Warning: Moving $xmlFile to $errorDir"
+				errorDir.mkdir();
+				FileCopy.copy(xmlFile, new File(errorDir, xmlFile.getName()))
+			} catch(Exception eCopy) {
+				println "Error while moving "+url+" to "+errorDir
+			}
+			return false;
+		}
+		return true;
+	}
+
+	private void getAnaTypes(File xmlFile) {
+		inputData = xmlFile.toURI().toURL().openStream();
+		factory = XMLInputFactory.newInstance();
+		parser = factory.createXMLStreamReader(inputData);
+		String ana = "ana"
+		HashSet<String> types = new HashSet<String>();
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+			if (event == XMLStreamConstants.START_ELEMENT) { // start elem
+				if (ana.equals(parser.getLocalName())) { // ana elem
+					for (int i = 0 ; i < parser.getAttributeCount(); i++) { // find @type
+						if ("type".equals(parser.getAttributeLocalName(i))) { // @type
+							types.add(parser.getAttributeValue(i).substring(1)); //remove the #
+							break;
+						}
+					}
+				}
+			}
+		}
+		parser.close()
+
+		for (String type : types)
+			if (!anatypes.contains(type))
+				anatypes << type
+	}
+
+	/**
+	 * Run.
+	 *
+	 * @param rootDirFile the root dir file
+	 * @param basename the basename
+	 * @param textAttributes the text attributes
+	 * @param srcfiles the srcfiles
+	 * @return true, if successful
+	 */
+	public boolean run(File binDir, File txmDir, String corpusname, String[] textAttributes, def srcfiles, Metadatas metadatas)
+	{
+		sattrsListener = null; // reset SAttribute Listener for each new import
+		String rootDir = binDir.getAbsolutePath();
+		anatypes = [] // reset
+		anavalues = [:] // reset
+		if (cwbLoc == null)
+			cwbLoc = org.txm.Toolbox.getParam(org.txm.Toolbox.CQI_SERVER_PATH_TO_CQPLIB)+File.separator;
+
+		if (!new File(cwbLoc).exists()) {
+			println ("CWB path error: "+cwbLoc)
+			return false;
+		}
+		if (!binDir.exists()) {
+			println ("binary directory does not exists: "+binDir)
+			return false;
+		}
+
+		File wtcFile = new File(binDir, "wtc/"+corpusname+".wtc")
+		new File(binDir, "wtc").deleteDir()
+		new File(binDir, "wtc").mkdir()
+		new File(binDir, "data").deleteDir()
+		new File(binDir, "data").mkdir()
+		new File(binDir, "registry").mkdir()
+
+		String textid = ""
+		int counttext = 0
+		List<File> files = txmDir.listFiles()
+		//1- Transform into WTC file
+		def builder = null
+
+		//start corpus
+		if (createOutput(wtcFile)) {
+			output.write("<txmcorpus lang=\""+lang+"\">\n")
+			output.close()
+		}
+
+		// sort files
+		if (sortMetadata == null) {
+			Collections.sort(files)
+		} else {
+			HashMap<File, String> sortmetadatavalues = new HashMap<File, String>()
+			for (File f : files) {
+				String value = MetadataGetter.get(f,"text", sortMetadata)
+				sortmetadatavalues.put(f, value)
+			}
+			println "sort properties value: "+sortmetadatavalues
+			Collections.sort(files, new Comparator<File>() {
+				/**
+				 * Compare.
+				 *
+				 * @param o1 the o1
+				 * @param o2 the o2
+				 * @return the int
+				 */
+						public int compare(Object o1, Object o2) {
+							String v1 = sortmetadatavalues.get((File)o1)
+							String v2 = sortmetadatavalues.get((File)o2)
+							if (v1 == null || v2 == null) return 0;
+							return v1.compareTo(v2)
+						}
+					});
+		}
+
+		// get all anatypes
+		for (File f : files) {
+			getAnaTypes(f)
+		}
+
+		println("Compiling "+files.size()+" $files ")
+		for (File f : files) {
+			print "."
+			HashMap<String, String> textmetadata;
+			if (metadatas != null)
+				textmetadata = metadatas.getTextMetadata(f)
+			else
+				textmetadata = [:]
+
+			counttext++;
+			if (!f.exists()) {
+				println("file "+f+ " does not exists")
+			} else {
+				String txtname = f.getName().substring(0,f.getName().length()-4)
+				builder = new compiler(f.toURI().toURL(), txtname, corpusname, "default")
+				builder.setLang(lang);
+				if (!builder.transfomFileWtc(wtcFile, textmetadata)) {
+					println("Failed to compile "+f)
+				}
+			}
+		}
+
+		//end corpus
+		if (createOutput(wtcFile)) {
+			output.write("</txmcorpus>\n")
+			output.close()
+		}
+		println ""
+		//2- Import into CWB
+		def outDir = rootDir
+
+		CwbEncode cwbEn = new CwbEncode()
+		cwbEn.setDebug(debug)
+		CwbMakeAll cwbMa = new CwbMakeAll()
+		cwbMa.setDebug(debug)
+
+		List<String> pargs = []
+		pargs.add("id")
+		for (String ana : anatypes)
+			pargs.add(ana)
+
+		String[] pAttrs = pargs
+
+		structs = sattrsListener.getStructs()
+		structsProf = sattrsListener.getProfs()
+
+		if (debug) {
+			println structs
+			println structsProf
+		}
+		
+		List<String> sargs = new ArrayList<String>()
+		def tmpTextAttrs = []
+		for (String name : structs.keySet()) {
+			if (name == "text") {
+				for (String value : structs.get(name)) // append the attributes
+					tmpTextAttrs << value // added after
+				continue;
+			}
+			//if ( name == "q") continue; // added after
+			//if ( name == "foreign") continue; // added after
+			String concat = name+":"+structsProf.get(name); // append the depth
+			for (String attributeName : structs.get(name)) // append the attributes
+				concat += "+"+attributeName.toLowerCase();
+				
+			if (structs.get(name).size() == 0) {
+				concat += "+n";
+			} else {
+				if (!structs.get(name).contains("n"))
+					concat += "+n"
+			}
+				
+			if ((name == "p" || name == "body" || name == "back" || name == "front")
+				 && !concat.contains("+n+") && !concat.endsWith("+n"))
+				concat += "+n"
+				
+			sargs.add(concat)
+		}
+
+		String textSAttributes = "text:0+id+base+project";
+		for (String name : tmpTextAttrs) {
+			if (!("id".equals(name) || "base".equals(name) || "project".equals(name)))
+				textSAttributes += "+"+name.toLowerCase()
+		}
+		//		if (metadataXPath != null) {
+		//			for (String meta : metadataXPath.keySet()) // text property declarations from metadata.csv
+		//				textSAttributes+="+"+meta;
+		//		}
+		sargs.add(textSAttributes)
+		sargs.add("txmcorpus:0+lang")
+
+		sargs.sort()
+
+		String[] sAttributes = sargs
+		String[] pAttributes = pAttrs
+		println "P-attributes: "+pAttributes
+		println "S-attributes: "+sargs
+
+		//if(!annotationSuccess)
+		//pAttributes = ["id"];
+
+		//println "PATTRIBUTES : "+pargs;
+		/*
+		 ArrayList<String> wordstag = ["w"];
+		 println "Getting structural attributes..."
+		 BuildCwbEncodeArgs argsgetter = new BuildCwbEncodeArgs();
+		 HashMap<String, HashSet<String>> allStructures = new HashMap<String, HashSet<String>>();
+		 HashMap<String, Integer> allStructuresInclusion = new HashMap<String, Integer>();
+		 for (File srcfile: txmDir.listFiles()) {
+		 if (!(!srcfile.getName().endsWith(".csv") && srcfile.canRead() && !srcfile.isHidden() && !srcfile.isDirectory() && ValidateXml.test(srcfile)))
+		 continue;
+		 print "."
+		 argsgetter.process(srcfile, wordstag);
+		 for (String sattr : argsgetter.getSAttributes()) {
+		 int idx = sattr.indexOf(":");
+		 if(idx < 0 )
+		 continue;
+		 String name = sattr.substring(0, idx);
+		 if (!allStructures.containsKey(name)) {
+		 allStructures.put(name, new HashSet<String>());
+		 allStructuresInclusion.put(name, 0);
+		 }
+		 //println "sattr: "+name
+		 String attrs = sattr.substring(idx+1);
+		 String[] split = attrs.split("\\+");
+		 if (split.length > 0) {
+		 int start = 1;
+		 try {// test if first attr is a number
+		 int n = Integer.parseInt(split[0]);
+		 if (n > allStructuresInclusion.get(name))
+		 allStructuresInclusion.put(name, n);
+		 } catch(Exception e) {start = 0;}
+		 for (int i = start ; i < split.length ; i++)
+		 allStructures.get(name).add(split[i]);
+		 }
+		 }
+		 }
+		 // add structures+properties found in sources
+		 List<String> sargs = new ArrayList<String>();
+		 for (String name : allStructuresInclusion.keySet()) {
+		 String concat = name+":"+allStructuresInclusion.get(name);
+		 for (String value : allStructures.get(name))
+		 concat += "+"+value;
+		 if (name.equals("text")) {
+		 concat += "+base+project"
+		 if (!concat.contains("id"))
+		 concat += "+id";
+		 }
+		 sargs.add(concat);
+		 }*/
+
+		//		for (int i = 0 ; i < sargs.size() ; i++) {
+		//			if (sargs.get(i).startsWith("text:")) {
+		//				String str = sargs.get(i);
+		//				sargs.set(i, "text:"+str.substring(6));
+		//			}
+		//		}
+
+		//		String textSAttributes = "text:0+id+base+project";
+		//		if (metadatas != null) {
+		//			for (String meta : metadatas.getHeadersList()) // text property declarations from metadata.csv
+		//				textSAttributes+="+"+meta;
+		//		}
+		//sargs.add(textSAttributes)
+		//sargs.add("txmcorpus:0+lang")
+
+		//		String[] sAttributes = sargs;
+		//		System.out.println("\nCorpus structures: "+sAttributes);
+		//		System.out.println("corpus word properties: "+pAttributes);
+
+		try {
+			String regPath = outDir + "/registry/"+corpusname.toLowerCase();
+			cwbEn.run(new File(cwbLoc,"cwb-encode").getAbsolutePath(), 
+				outDir + "/data/$corpusname", 
+				outDir + "/wtc/"+corpusname+".wtc", 
+				regPath, pAttributes, sAttributes);
+			if (!new File(regPath).exists()) {
+				println "Error: The registry file was not created: $regPath. See https://groupes.renater.fr/wiki/txm-users/public/faq"
+				return false;
+			}
+			cwbMa.run(new File(cwbLoc,"cwb-makeall").getAbsolutePath(), corpusname, outDir + "/registry");
+		} catch (Exception ex) {System.out.println(ex); return false;}
+
+		return true;
+	}
+
+	/**
+	 * Sets the debug.
+	 */
+	public void setDebug()
+	{
+		this.debug = true;
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args)
+	{
+		File dir = new File("~/xml/geo");
+		def c = new compiler();
+		c.setDebug();
+		c.setCwbPath("~/TXM/cwb/bin");
+		c.run(dir,"geo");
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/xml/package.html
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/xml/package.html	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/xml/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>XML import module</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/org/txm/importer/xml/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/importer/xml/pager_old.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/xml/pager_old.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/xml/pager_old.groovy	(revision 258)
@@ -0,0 +1,370 @@
+// 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
+// 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.
+//
+//
+//
+// $LastChangedDate: 2017-01-24 18:11:42 +0100 (Tue, 24 Jan 2017) $
+// $LastChangedRevision: 3400 $
+// $LastChangedBy: mdecorde $
+//
+package org.txm.importer.xml;
+
+import org.txm.importer.*;
+import org.xml.sax.Attributes;
+import org.txm.importer.filters.*;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.stream.*;
+import java.net.URL;
+import org.xml.sax.InputSource;
+import org.xml.sax.helpers.DefaultHandler;
+
+// TODO: Auto-generated Javadoc
+/** Build a simple edition from a xml-tei. 
+ * @author mdecorde */
+class pager_old {
+	List<String> NoSpaceBefore;
+	//StaxStack staxStack;
+
+	/** The No space after. */
+	List<String> NoSpaceAfter;
+
+	/** The wordcount. */
+	int wordcount = 0;
+
+	/** The pagecount. */
+	int pagecount = 0;
+
+	/** The wordmax. */
+	int wordmax = 0;
+
+	/** The basename. */
+	String basename = "";
+	String txtname = "";
+	File outdir;
+
+	/** The wordid. */
+	String wordid;
+
+	/** The first word. */
+	boolean firstWord = true;
+
+	/** The wordvalue. */
+	String wordvalue;
+
+	/** The interpvalue. */
+	String interpvalue;
+
+	/** The lastword. */
+	String lastword = " ";
+
+	/** The wordtype. */
+	String wordtype;
+
+	/** The flagform. */
+	boolean flagform = false;
+
+	/** The flaginterp. */
+	boolean flaginterp = false;
+
+	/** The url. */
+	private def url;
+
+	/** The input data. */
+	private def inputData;
+
+	/** The factory. */
+	private def factory;
+
+	/** The parser. */
+	private XMLStreamReader parser;
+
+	/** The writer. */
+	OutputStreamWriter writer;
+
+	/** The multiwriter. */
+	OutputStreamWriter multiwriter = null;
+
+	/** The infile. */
+	File infile;
+
+	/** The outfile. */
+	File outfile;
+
+	/** The pages. */
+	ArrayList<File> pages = new ArrayList<File>();
+
+	/** The idxstart. */
+	ArrayList<String> idxstart = new ArrayList<String>();
+	String editionPage;
+
+	/**
+	 * Instantiates a new pager.
+	 *
+	 * @param infile the infile
+	 * @param outfile the outfile
+	 * @param NoSpaceBefore the no space before
+	 * @param NoSpaceAfter the no space after
+	 * @param max the max
+	 * @param basename the basename
+	 */
+	pager_old(File infile, File outdir, String txtname, List<String> NoSpaceBefore,
+	List<String> NoSpaceAfter, int max, String basename, String editionPage) {
+		this.editionPage = editionPage;
+		this.basename = basename;
+		this.txtname = txtname;
+		this.outdir = outdir;
+		this.wordmax = max;
+		this.NoSpaceBefore = NoSpaceBefore;
+		this.NoSpaceAfter = NoSpaceAfter;
+		this.url = infile.toURI().toURL();
+		this.infile = infile;
+
+		inputData = url.openStream();
+		factory = XMLInputFactory.newInstance();
+		parser = factory.createXMLStreamReader(inputData);
+		//staxStack = new StaxStack(parser)
+		process();
+	}
+
+	private void closeMultiWriter()
+	{
+		if (multiwriter != null) {
+			//staxStack.closeStack(multiwriter);
+			if (firstWord) { // there was no words
+				this.idxstart.add("w_0")
+				multiwriter.write("<span id=\"w_0\"/>");
+			}
+			multiwriter.write("</body>");
+			multiwriter.write("</html>"); 
+			multiwriter.close();
+		}
+	}
+
+	/**
+	 * Creates the next output.
+	 *
+	 * @return true, if successful
+	 */
+	private boolean createNextOutput()
+	{
+		wordcount = 0;
+		try {
+			closeMultiWriter();
+			File outfile = new File(outdir, txtname+"_"+(++pagecount)+".html")
+			pages.add(outfile);
+			firstWord = true; // waiting for next word
+
+			multiwriter = new OutputStreamWriter(new FileOutputStream(outfile) , "UTF-8");
+
+			multiwriter.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
+			multiwriter.write("<html>");
+			multiwriter.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/>");
+			multiwriter.write("<head>");
+			multiwriter.write("<title>"+basename.toUpperCase()+" Edition - Page "+pagecount+"</title>");
+			multiwriter.write("</head>");
+			multiwriter.write("<body>");
+
+			//staxStack.openStack(multiwriter);
+			return true;
+		} catch (Exception e) {
+			System.out.println(e.getLocalizedMessage());
+			return false;
+		}
+	}
+
+	/**
+	 * Creates the output.
+	 *
+	 * @param outfile the outfile
+	 * @return true, if successful
+	 */
+	private boolean createOutput() {
+		try {
+			return createNextOutput();
+		} catch (Exception e) {
+			System.out.println(e.getLocalizedMessage());
+			return false;
+		}
+	}
+
+	/**
+	 * Gets the page files.
+	 *
+	 * @return the page files
+	 */
+	public ArrayList<File> getPageFiles() {
+		return pages;
+	}
+
+	/**
+	 * Gets the idx.
+	 *
+	 * @return the idx
+	 */
+	public ArrayList<String> getIdx() {
+		return idxstart;
+	}
+
+	/**
+	 * Process.
+	 */
+	void process() {
+		String localname = "";
+		createNextOutput();
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+			switch (event) {
+				case XMLStreamConstants.START_ELEMENT:
+					localname = parser.getLocalName();
+					switch (localname) {
+						case "text":
+							if (parser.getAttributeValue(null,"id") != null)
+								multiwriter.write("<h3>"+parser.getAttributeValue(null,"id")+"</h3>\n")
+							multiwriter.write("<table>\n");
+							for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
+								multiwriter.write("<tr>");
+								multiwriter.write("<td>"+parser.getAttributeLocalName(i)+": </td>");
+								multiwriter.write("<td>"+parser.getAttributeValue(i)+"</td>");
+								multiwriter.write("</tr>\n");
+							}
+							multiwriter.write("</table><br/>\n");
+							break;
+						case "head":
+							multiwriter.write("<h2>\n")
+							//staxStack.onStartElement("h2", null);
+							break;
+						case "graphic":
+							String url = parser.getAttributeValue(null, "url")
+						//println "URL: "+url
+							if (url != null) multiwriter.write("<div><img src=\"$url\"/></div>");
+							break;
+						case "lg":
+						case "p":
+						case "q":
+							String rend = parser.getAttributeValue(null, "rend")
+							if (rend == null) rend = "normal"
+							multiwriter.write("<p class=\"$rend\">\n")
+							//staxStack.onStartElement("p", null);
+							break;
+						//case "pb":
+						case editionPage:
+							createNextOutput();
+							wordcount=0;
+							if (parser.getAttributeValue(null,"n") != null) {
+								multiwriter.write("<p style=\"color:red\" align=\"center\">- "+parser.getAttributeValue(null,"n")+" -</p>\n")
+							}
+							break;
+						case "lb":
+						case "br":
+							multiwriter.write("<br/>\n")
+							break;
+						case "w":
+							wordid = parser.getAttributeValue(null,"id");
+
+							if (firstWord) {
+								firstWord = false;
+								this.idxstart.add(wordid);
+							}
+							wordcount++;
+							if (wordcount >= wordmax) {
+								createNextOutput();
+							}
+							break;
+
+						case "ana":
+							flaginterp=true;
+							interpvalue+=" "+parser.getAttributeValue(null,"type").substring(1)+":"
+							break;
+
+						case "form":
+							wordvalue="";
+							interpvalue ="";
+							flagform=true;
+					}
+					break;
+				case XMLStreamConstants.END_ELEMENT:
+					localname = parser.getLocalName();
+					switch (localname) {
+						case "head":
+							multiwriter.write("</h2>\n")
+							
+							break;
+						case "lg":
+						case "p":
+						case "q":
+							multiwriter.write("</p>\n")
+							
+							break;
+
+
+						case "form":
+							flagform = false
+							break;
+
+						case "ana":
+							flaginterp = false
+							break;
+
+						case "w":
+
+							int l = lastword.length();
+							String endOfLastWord = "";
+							if (l > 0)
+								endOfLastWord = lastword.subSequence(l-1, l);
+
+							if (interpvalue != null)
+								interpvalue = interpvalue.replace("&", "&amp;").replace("<", "&lt;").replace("\"","&quot;");
+
+							if (NoSpaceBefore.contains(wordvalue) ||
+							NoSpaceAfter.contains(lastword) ||
+							wordvalue.startsWith("-") ||
+							NoSpaceAfter.contains(endOfLastWord)) {
+								multiwriter.write("<span title=\""+interpvalue+"\" id=\""+wordid+"\">");
+							} else {
+								multiwriter.write(" <span title=\""+interpvalue+"\" id=\""+wordid+"\">");
+							}
+						//writer.write(wordvalue.replace("&", "&amp;").replace("\"","&quot;").replace("<", "&lt;")+"</span>");
+							multiwriter.write(wordvalue.replace("&", "&amp;").replace("\"","&quot;").replace("<", "&lt;")+"</span>");
+							lastword=wordvalue;
+							break;
+					}
+					break;
+
+				case XMLStreamConstants.CHARACTERS:
+					if (flagform)
+						if (parser.getText().length() > 0)
+							wordvalue+=(parser.getText());
+					if (flaginterp)
+						if (parser.getText().length() > 0)
+							interpvalue+=(parser.getText());
+					break;
+			}
+		}
+		//writer.write("</body>");
+		//writer.write("</html>");
+		//writer.close();
+		closeMultiWriter();
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/xml/pager.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/xml/pager.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/xml/pager.groovy	(revision 258)
@@ -0,0 +1,417 @@
+// 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
+// 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.
+//
+//
+//
+// $LastChangedDate: 2017-01-24 18:11:42 +0100 (Tue, 24 Jan 2017) $
+// $LastChangedRevision: 3400 $
+// $LastChangedBy: mdecorde $
+//
+package org.txm.importer.xml;
+
+import org.txm.importer.*;
+import org.xml.sax.Attributes;
+import org.txm.importer.filters.*;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import javax.xml.parsers.*
+import javax.xml.stream.*;
+import java.net.URL;
+import org.xml.sax.InputSource;
+import org.xml.sax.helpers.DefaultHandler;
+
+/** Build a simple edition from a xml-tei. 
+ * @author mdecorde */
+class pager {
+
+	List<String> NoSpaceBefore;
+
+	/** The No space after. */
+	List<String> NoSpaceAfter;
+
+	/** The wordcount. */
+	int wordcount = 0;
+
+	/** The pagecount. */
+	int pagecount = 0;
+
+	/** The wordmax. */
+	int wordmax = 0;
+
+	/** The basename. */
+	String basename = "";
+	String txtname = "";
+	File outdir;
+
+	/** The wordid. */
+	String wordid;
+
+	/** The first word. */
+	boolean firstWord = true;
+
+	/** The wordvalue. */
+	String wordvalue = "";
+
+	/** The interpvalue. */
+	String interpvalue = "";
+
+	/** The lastword. */
+	String lastword = " ";
+
+	/** The wordtype. */
+	String wordtype;
+
+	/** The flagform. */
+	boolean flagform = false;
+
+	/** The flaginterp. */
+	boolean flaginterp = false;
+
+	/** The url. */
+	private def url;
+
+	/** The input data. */
+	private def inputData;
+
+	/** The factory. */
+	private def factory;
+
+	/** The parser. */
+	private XMLStreamReader parser;
+
+	/** The writer. */
+	OutputStreamWriter writer;
+
+	/** The pagedWriter. */
+	StaxStackWriter pagedWriter = null;
+
+	/** The infile. */
+	File infile;
+
+	/** The outfile. */
+	File outfile;
+
+	/** The pages. */
+	ArrayList<File> pages = new ArrayList<File>();
+
+	/** The idxstart. */
+	ArrayList<String> idxstart = new ArrayList<String>();
+	String paginationElement;
+
+	/**
+	 * Instantiates a new pager.
+	 *
+	 * @param infile the infile
+	 * @param outfile the outfile
+	 * @param NoSpaceBefore the no space before
+	 * @param NoSpaceAfter the no space after
+	 * @param max the max
+	 * @param basename the basename
+	 */
+	pager(File infile, File outdir, String txtname, List<String> NoSpaceBefore,
+	List<String> NoSpaceAfter, int max, String basename, String paginationElement) {
+		this.paginationElement = paginationElement;
+		this.basename = basename;
+		this.txtname = txtname;
+		this.outdir = outdir;
+		this.wordmax = max;
+		this.NoSpaceBefore = NoSpaceBefore;
+		this.NoSpaceAfter = NoSpaceAfter;
+		this.url = infile.toURI().toURL();
+		this.infile = infile;
+
+		inputData = url.openStream();
+		factory = XMLInputFactory.newInstance();
+		parser = factory.createXMLStreamReader(inputData);
+
+		process();
+	}
+
+	private def closeMultiWriter()
+	{
+		if (pagedWriter != null) {
+			def tags = pagedWriter.getTagStack().clone();
+
+			if (firstWord) { // there was no words
+				pagedWriter.writeCharacters("");
+				//				if (this.idxstart.size() == 0) {
+				//					this.idxstart.add("w_0")
+				//					pagedWriter.write("<span id=\"w_0\"/>");
+				//				} else {
+				this.idxstart.add("w_0")
+				pagedWriter.write("<span id=\"w_0\"/>");
+				//				}
+			}
+			pagedWriter.writeEndElements();
+			pagedWriter.close();
+			return tags;
+		} else {
+			return [];
+		}
+	}
+
+	/**
+	 * Creates the next output.
+	 *
+	 * @return true, if successful
+	 */
+	private boolean createNextOutput() {
+		wordcount = 0;
+		try {
+			def tags = closeMultiWriter();
+			for (int i = 0 ; i < tags.size() ; i++) {
+				String tag = tags[i]
+				if ("body" != tag) {
+					tags.remove(i--)
+				} else {
+					tags.remove(i--) // remove "body"
+					break; // remove elements until "body tag
+				}
+			}
+			File outfile = new File(outdir, txtname+"_"+(++pagecount)+".html")
+			pages.add(outfile);
+			firstWord = true; // waiting for next word
+
+			pagedWriter = new StaxStackWriter(outfile, "UTF-8");
+
+			pagedWriter.writeStartDocument("UTF-8", "1.0")
+			pagedWriter.writeStartElement("html");
+			pagedWriter.writeEmptyElement("meta", ["http-equiv":"Content-Type", "content":"text/html","charset":"UTF-8"]);
+			pagedWriter.writeEmptyElement("link", ["rel":"stylesheet", "type":"text/css","href":"txm.css"]);
+			pagedWriter.writeEmptyElement("link", ["rel":"stylesheet", "type":"text/css","href":"${basename}.css"]);
+			pagedWriter.writeStartElement("head");
+			pagedWriter.writeStartElement("title")
+			pagedWriter.writeCharacters(basename.toUpperCase()+" Edition - Page "+pagecount)
+			pagedWriter.writeEndElement(); // </title>
+			pagedWriter.writeEndElement() // </head>
+			pagedWriter.writeStartElement("body") //<body>
+
+			pagedWriter.writeStartElements(tags);
+			return true;
+		} catch (Exception e) {
+			System.out.println(e.getLocalizedMessage());
+			return false;
+		}
+	}
+
+	/**
+	 * Creates the output.
+	 *
+	 * @param outfile the outfile
+	 * @return true, if successful
+	 */
+	private boolean createOutput() {
+		try {
+			return createNextOutput();
+		} catch (Exception e) {
+			System.out.println(e.getLocalizedMessage());
+			return false;
+		}
+	}
+
+	/**
+	 * Gets the page files.
+	 *
+	 * @return the page files
+	 */
+	public ArrayList<File> getPageFiles() {
+		return pages;
+	}
+
+	/**
+	 * Gets the idx.
+	 *
+	 * @return the idx
+	 */
+	public ArrayList<String> getIdx() {
+		return idxstart;
+	}
+
+	/**
+	 * Process.
+	 */
+	void process() {
+		boolean flagNote = false;
+		String noteContent = "";
+
+		String localname = "";
+		createNextOutput();
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+			switch (event) {
+				case XMLStreamConstants.START_ELEMENT:
+					localname = parser.getLocalName();
+					switch (localname) {
+						case "text":
+							pagedWriter.write("\n");
+							if (parser.getAttributeValue(null,"id") != null)
+								pagedWriter.writeElement("h3", parser.getAttributeValue(null,"id"))
+							pagedWriter.writeStartElement("table");
+							for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
+								pagedWriter.writeStartElement("tr");
+								pagedWriter.writeElement("td", parser.getAttributeLocalName(i));
+								pagedWriter.writeElement("td", parser.getAttributeValue(i).toString());
+								pagedWriter.writeEndElement();
+							}
+							pagedWriter.writeEndElement() // table
+							pagedWriter.writeEmptyElement("br")
+							pagedWriter.writeCharacters("");
+							break;
+						case "note":
+							flagNote = true;
+							noteContent = ""
+							break;
+						case "a":
+							pagedWriter.writeStartElement("a")
+							pagedWriter.writeAttribute("href", parser.getAttributeValue(null,"href"));
+							String target = parser.getAttributeValue(null,"target");
+							if (target == null) target = "_blank";
+							pagedWriter.writeAttribute("target", target);
+							break;
+						case "head":
+							pagedWriter.write("\n");
+							pagedWriter.writeStartElement("h2")
+							break;
+						case "graphic":
+							pagedWriter.write("\n");
+							String url = parser.getAttributeValue(null, "url")
+							if (url != null) {
+								pagedWriter.writeStartElement("div")
+								pagedWriter.writeEmptyElement("img", ["src":url])
+								pagedWriter.writeEndElement() // div
+							}
+							break;
+						case "lg":
+						case "p":
+						case "q":
+							pagedWriter.write("\n");
+							String rend = parser.getAttributeValue(null, "rend")
+							if (rend == null) rend = "normal"
+							pagedWriter.writeStartElement("p",["class":rend])
+							break;
+						//case "pb":
+						case paginationElement:
+							createNextOutput();
+							wordcount=0;
+							pagedWriter.write("\n");
+							if (parser.getAttributeValue(null,"n") != null) {
+								pagedWriter.writeElement("p", ["style":"color:red", "align":"center"], "- "+parser.getAttributeValue(null,"n")+" -")
+							}
+							break;
+						case "lb":
+						case "br":
+							pagedWriter.writeEmptyElement("br")
+							break;
+						case "w":
+							wordid = parser.getAttributeValue(null,"id");
+							if (firstWord) {
+								firstWord = false;
+								this.idxstart.add(wordid);
+							}
+							wordcount++;
+							if (wordcount >= wordmax) {
+								createNextOutput();
+							}
+							break;
+						case "ana":
+							flaginterp=true;
+							interpvalue+=" "+parser.getAttributeValue(null,"type").substring(1)+":"
+							break;
+						case "form":
+							wordvalue="";
+							interpvalue ="";
+							flagform=true;
+							break;
+						//						default:
+						//							pagedWriter.writeStartElement(localname)
+					}
+					break;
+				case XMLStreamConstants.END_ELEMENT:
+					localname = parser.getLocalName();
+					switch (localname) {
+						case "head":
+							pagedWriter.writeEndElement() // </h2>
+							break;
+						case "note":
+							flagNote = false;
+							if (noteContent.length() > 0) {
+								pagedWriter.writeStartElement("span", ["style":"color:red;", "title":noteContent]);
+								pagedWriter.writeCharacters("[*]");
+								pagedWriter.writeEndElement() // </span>
+							}
+							break;
+						case "lg":
+						case "p":
+						case "q":
+							pagedWriter.writeEndElement() // </p>
+							break;
+						case "a":
+							pagedWriter.writeEndElement() // </a>
+							break;
+						case "form":
+							flagform = false
+							break;
+						case "ana":
+							flaginterp = false
+							break;
+						case "w":
+							int l = lastword.length();
+							String endOfLastWord = "";
+							if (l > 0)
+								endOfLastWord = lastword.subSequence(l-1, l);
+
+							if (interpvalue != null)
+								interpvalue = interpvalue;
+
+							if (NoSpaceBefore.contains(wordvalue) ||
+							NoSpaceAfter.contains(lastword) ||
+							wordvalue.startsWith("-") ||
+							NoSpaceAfter.contains(endOfLastWord)) {
+								pagedWriter.writeStartElement("span", ["title":interpvalue, "id":wordid]);
+							} else {
+								pagedWriter.writeCharacters(" ");
+								pagedWriter.writeStartElement("span", ["title":interpvalue, "id":wordid]);
+							}
+
+							pagedWriter.writeCharacters(wordvalue);
+							pagedWriter.writeEndElement();
+							lastword=wordvalue;
+							break;
+						//						default:
+						//							pagedWriter.writeEndElement()
+					}
+					break;
+				case XMLStreamConstants.CHARACTERS:
+					if (flagform && parser.getText().length() > 0) {
+						wordvalue+=(parser.getText());
+						if (flagNote == parser.getText().length() > 0)
+							noteContent += parser.getText().replace("\n", " ");
+					} else	if (flaginterp && parser.getText().length() > 0) {
+						interpvalue+=(parser.getText());
+					} else if (flagNote == parser.getText().length() > 0) {
+						noteContent += parser.getText().replace("\n", " ");
+					}
+					break;
+			}
+		}
+		closeMultiWriter();
+	}
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/importer/xml/importer.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/xml/importer.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/xml/importer.groovy	(revision 258)
@@ -0,0 +1,209 @@
+// 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
+// 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.
+//
+//
+//
+// $LastChangedDate: 2016-12-01 17:48:31 +0100 (Thu, 01 Dec 2016) $
+// $LastChangedRevision: 3351 $
+// $LastChangedBy: mdecorde $
+//
+package org.txm.importer.xml
+
+//import filters.TabulatedToXml.*;
+import java.io.File
+
+import javax.xml.stream.*
+
+import org.txm.*
+import org.txm.importer.*
+import org.txm.importer.filters.*
+import org.txm.objects.*
+import org.txm.scripts.*
+import org.txm.scripts.teitxm.*
+
+import filters.CutHeader.*
+import filters.FusionHeader.*
+import filters.TagSentences.*
+import filters.Tokeniser.*
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class importer.
+ */
+class importer {
+
+	/** The validation. */
+	boolean validation;
+
+	/** The tokenize. */
+	boolean tokenize;
+
+	/** The sentence. */
+	boolean sentence = false;
+
+	/**
+	 * Do tokenize.
+	 *
+	 * @param b the b
+	 */
+	public void doTokenize(boolean b) { tokenize = b; }
+
+	/**
+	 * Do validation.
+	 *
+	 * @param b the b
+	 */
+	public void doValidation(boolean b) { validation = b; }
+
+	/**
+	 * Run.
+	 *
+	 * @param rootDirFile the root dir file
+	 * @param basename the basename
+	 * @return true, if successful
+	 */
+	public boolean run(File srcDir, File binDir, File txmDir, String basename, String ignoredElements, String lang)
+	{
+		new File(binDir,"tokenized").deleteDir();
+		new File(binDir,"tokenized").mkdir();
+
+		ArrayList<String> milestones = new ArrayList<String>();//the tags who you want them to stay milestones
+
+		//TEST EACH XML FILE IF VALID
+		List<File> srcfiles = txmDir.listFiles();
+		List<File> okfiles = []
+
+		println "Sources cleaning & validation";
+				def files = txmDir.listFiles()
+		for (File f : txmDir.listFiles()) { // clean directory
+			String name = f.getName()
+			if (f.isHidden() || !name.toLowerCase().endsWith(".xml")) {
+				if (!f.delete()) {
+					println "WARNING: could not clean $txmDir directory: TXM could not delete $f"
+					return false;
+				}
+			}
+		}
+		
+		files = txmDir.listFiles()
+		if (files == null || files.size() == 0) {
+			println "No XML file (*.xml) to process. Aborting"
+			return false;
+		}
+		files = files.sort()
+		for (File f : txmDir.listFiles()) {
+			if (!f.getName().toLowerCase().endsWith(".xml")) continue;
+			
+			if (!f.isHidden() && f.canRead() && !f.getName().endsWith(".properties") && !f.getName().startsWith("metadata") && !f.isDirectory()) {
+				print "."
+				if (!ValidateXml.test(f)) {
+					if (stopIfMalformed)
+						return;
+					else
+						continue;
+				} else {
+					if (!f.getName().equals("import.xml"))
+						okfiles.add(f);
+				}
+			}
+		}
+		println ""
+
+		okfiles.sort()
+		println "Files processed: "+okfiles
+		if (okfiles.size() == 0) {
+			println "No file. Check if the file extensions are '.xml'"
+			return false;
+		}
+		
+		//println "ptokenfiles "+ptokenfiles
+		//TOKENIZE FILES
+		List<File> tokenfiles;
+		if (tokenize || sentence) {
+			println "Tokenizing "+okfiles.size()+" files"
+			for (File f : okfiles) {
+				print "."
+				File infile = f;
+				File outfile = new File(binDir,"tokenized/"+f.getName());
+				SimpleTokenizerXml tokenizer = new SimpleTokenizerXml(infile, outfile, lang)
+				if (ignoredElements != null && ignoredElements.trim().length() > 0)
+					tokenizer.setOutSideTextTagsAndKeepContent(ignoredElements)
+				if (!tokenizer.process()) {
+					println("Failed to process "+f)
+					outfile.delete()
+				}
+			}
+			tokenfiles = new File(binDir,"tokenized").listFiles()
+			println ""
+		} else {
+			tokenfiles = okfiles;
+		}
+
+//		Change XML tag "text" to "textunit"
+//		for (File f : tokenfiles) {
+//			if (!RenameTag.rename(f, "text", "textunit")) {
+//				println "Failed to rename <text> tag to <textunit> in file "+f
+//				return false;
+//			}
+//		}
+
+		//TRANSFORM INTO XML-TEI-TXM
+		println("Building XML-TXM ("+tokenfiles.size()+" files)")
+		for (File f : tokenfiles) {
+			//ArrayList<String> milestones = new ArrayList<String>();
+			print "."
+			File file = f;
+			String txmfile = f.getName();
+
+			def correspType = new HashMap<String,String>()
+			def correspRef = new HashMap<String,String>()
+			//il faut lister les id de tous les respStmt
+			def respId = [];
+			//fait la correspondance entre le respId et le rapport d'execution de l'outil
+			def applications = new HashMap<String,HashMap<String,String>>();
+			//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[]>();
+			//associe un id d'item avec sa description et son URI
+			def itemsURI = new HashMap<String,HashMap<String,String>>();
+			//informations de respStmt
+			//resps (respId <voir ci-dessus>, [description, person, date])
+			def resps = new HashMap<String,String[]>();
+			//lance le traitement
+			def builder = new Xml2Ana(file);
+			builder.setConvertAllAtrtibutes true;
+			builder.setCorrespondances(correspRef, correspType);
+			builder.setHeaderInfos(respId,resps, applications, taxonomiesUtilisees, itemsURI)
+			//builder.setAddTEIHeader();
+			if (!builder.process(new File(txmDir,txmfile))) {
+				println("Failed to process "+f);
+				new File(txmDir,txmfile).delete();
+			}
+		}
+		println ""
+		return true;
+	}
+
+	boolean stopIfMalformed = false;
+	public void setStopIfMalformed(boolean b) {
+		stopIfMalformed = b;
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/SAttributesListener.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/SAttributesListener.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/SAttributesListener.groovy	(revision 258)
@@ -0,0 +1,217 @@
+package org.txm.importer
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import javax.xml.stream.*;
+
+/**
+ * Read an XML file and find out : XML elements, their attributes and recursivity level
+ * names are lowercases
+ * 
+ * @author mdecorde
+ *
+ */
+class SAttributesListener {
+
+	private static HashMap<String,ArrayList<String>> structs = new HashMap<String, ArrayList<String>>();
+	private static HashMap<String, Integer> structsCountProf = new HashMap<String, Integer>();
+	private static HashMap<String, Integer> structsMaxProf = new HashMap<String, Integer>();
+	private static String structPath = "/";
+	private XMLStreamReader parser;
+
+	SAttributesListener() {
+		structs = new HashMap<String, ArrayList<String>>();
+		structsCountProf = new HashMap<String, Integer>();
+		structsMaxProf = new HashMap<String, Integer>();
+		structPath = "/";
+	}
+	
+	SAttributesListener(XMLStreamReader parser) {
+		this();
+		this.parser = parser;
+	}
+	
+	public void appendResultsTo(SAttributesListener another) {
+		structs = another.structs;
+		structsCountProf = another.structsCountProf;
+		structsMaxProf = another.structsMaxProf;
+	}
+
+	public void start(def parser) {
+		this.parser = parser;
+	}
+
+	def W = "w";
+	def ANA = "ana";
+	def FORM = "form";
+	/**
+	 * Call this method for each START_ELEMENT stax event
+	 * @param localname the element localname
+	 */
+	public void startElement(String localname) {
+		localname = localname.toLowerCase();
+
+		//String localname = parser.getLocalName();
+		if(localname.equals(W)) return;
+		if(localname.equals(ANA)) return;
+		if(localname.equals(FORM)) return;
+
+		structPath += localname+"/"
+		//println "add: "+structPath
+		def attrs = structs.get(localname)
+		if (!structs.containsKey(localname)) {
+			attrs = new HashSet();
+			structs.put(localname, attrs);
+			structsCountProf.put(localname, 0)
+			structsMaxProf.put(localname, 0)
+		} //else {
+		
+		// get structure recursion
+		int prof = structsCountProf.get(localname)+1
+		structsCountProf.put(localname, prof)
+		if (structsMaxProf.get(localname) < prof )
+			structsMaxProf.put(localname, prof)
+		
+		// get the structure attributes
+		for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
+			attrs << parser.getAttributeLocalName(i).toLowerCase();
+		}
+	}
+
+	/**
+	 * Call this method for each END_ELEMENT stax event
+	 * @param localname the element localname
+	 */
+	public void endElement(String localname) {
+		localname = localname.toLowerCase();
+		//String localname = parser.getLocalName();
+		if(localname.equals(W)) return;
+		if(localname.equals(ANA)) return;
+		if(localname.equals(FORM)) return;
+
+		if (structPath.length() > 1) {
+			int idx = structPath.lastIndexOf("/");
+			if (idx > 0) {
+				structPath = structPath.substring(0, idx)
+				//println "end of $localname "+(structsCountProf.get(localname))
+				//if (structsCountProf.get(localname) != null)
+				structsCountProf.put(localname, structsCountProf.get(localname)-1)
+			}
+			//println "pop: "+structPath
+		}
+	}
+
+	boolean firstGetStructs = true;
+	public HashMap<String,ArrayList<String>> getStructs() {
+		if (structsCountProf.get("div") > 0)
+			structs.remove("div1")
+		if (structsCountProf.get("div") > 1)
+			structs.remove("div2")
+		if (structsCountProf.get("div") > 2)
+			structs.remove("div3")
+		if (structsCountProf.get("div") > 3)
+			structs.remove("div4")
+		if (structsCountProf.get("div") > 4)
+			structs.remove("div5")
+		if (structsCountProf.get("div") > 5)
+			structs.remove("div6")
+
+		if (firstGetStructs) {
+			firstGetStructs = false;
+			def keys = []
+			keys.addAll(structs.keySet());
+			for( String key : keys) {
+				def value = structs.get(key);
+				structs.remove(key)
+				structs.put(key.toLowerCase(), value);
+			}
+		}
+
+		return structs;
+	}
+
+	boolean firstGetstructsCountProf = true;
+	public HashMap<String, Integer> getProfs() {
+
+		//		if (firstGetstructsCountProf) {
+		//			firstGetstructsCountProf = false;
+		//			def keys = []
+		//			keys.addAll(structsCountProf.keySet());
+		//			for( String key : keys) {
+		//				def value = structsCountProf.get(key);
+		//				structsCountProf.remove(key)
+		//				structsCountProf.put(key.toLowerCase(), value);
+		//			}
+		//		}
+		HashMap<String, Integer> clone = new HashMap<String, Integer>();
+		for (String key : structsMaxProf.keySet()) {
+			if (structsMaxProf.get(key) > 0)
+				clone.put(key, structsMaxProf.get(key)-1)
+			else
+				clone.put(key, 0)
+		}
+		return clone;
+	}
+	
+	public static SAttributesListener scanFile(File xmlFile) {
+		return scanFile(xmlFile, null)
+	}
+	
+	public void setParser(def parser) {
+		this.parser = parser;
+	}
+	
+	/**
+	 * Merge results in the parentListener
+	 * 
+	 * @param xmlFile
+	 * @param parentListener results are appended to the parentListener if any
+	 * @return
+	 */
+	public static SAttributesListener scanFile(File xmlFile, SAttributesListener parentListener) {
+		
+		def start = false;
+		def inputData = xmlFile.toURI().toURL().openStream();
+		def factory = XMLInputFactory.newInstance();
+		def parser = factory.createXMLStreamReader(inputData);
+		
+		SAttributesListener listener;
+		if (parentListener != null) {
+			listener = parentListener;
+			listener.setParser(parser)
+		} else {
+			listener = new SAttributesListener(parser);
+		}
+		String TEXT = "text";
+		//HashSet<String> types = new HashSet<String>();
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+			if (event == XMLStreamConstants.START_ELEMENT) { // start elem
+				if (TEXT.equals(parser.getLocalName())) start = true;
+				if (start) listener.startElement(parser.getLocalName())
+			} else if (event == XMLStreamConstants.END_ELEMENT) { // end elem
+				if (start) listener.endElement(parser.getLocalName())
+				if (TEXT.equals(parser.getLocalName())) start = false;
+			}
+		}
+		parser.close()
+		
+		return listener
+	}
+	
+	public static SAttributesListener scanFiles(File xmlDirectory, String wordTag) {
+		SAttributesListener listener = new SAttributesListener()
+		listener.W = wordTag
+		for (File xmlFile : xmlDirectory.listFiles()) {
+			if (xmlFile.isFile() && !xmlFile.isHidden() && xmlFile.getName().toLowerCase().endsWith(".xml")) {
+				scanFile(xmlFile, listener); // results saved in 'listener' data
+//				println "LISTENER RESULT with ${xmlFile.getName()}: "+listener
+//				println " prof: "+listener.getStructs()
+//				println " prof: "+listener.getProfs()
+//				println " path: "+listener.structPath
+			}
+		}
+		
+		return listener;
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/teicmc/SplitTEICMRPerLocutor.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/teicmc/SplitTEICMRPerLocutor.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/teicmc/SplitTEICMRPerLocutor.groovy	(revision 258)
@@ -0,0 +1,200 @@
+package org.txm.importer.teicmc
+
+import java.io.File;
+import java.net.URL;
+
+import javax.xml.stream.*;
+
+import org.txm.importer.StaxIdentityParser;
+import org.txm.importer.StaxStackWriter;
+
+public class SplitTEICMRPerLocutor extends StaxIdentityParser {
+
+	File outputDirectory;
+	def writers = [:];
+
+	public SplitTEICMRPerLocutor(File inputFile, File outputDirectory) {
+		super(inputFile);
+		this.outputDirectory = outputDirectory;
+		outputDirectory.mkdir()
+	}
+
+	protected void processStartElement() {
+		if (parser.getLocalName() == "posting") {
+			for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
+				if (parser.getAttributeLocalName(i) == "who") {
+					String loc = parser.getAttributeValue(i)
+					writer = writers.get(loc) // switch writer on locutor
+					break;
+				}
+			}
+		}
+
+		if (writer != null) {
+			processStartElement(writer);
+		} else {
+			for (def swriter : writers.values()) processStartElement(swriter);
+		}
+	}
+
+	protected void processStartElement(def swriter)
+	{
+		String prefix = parser.getPrefix();
+
+		if (prefix != null && prefix.length() > 0)
+			swriter.writeStartElement(Nscontext.getNamespaceURI(prefix), localname)
+		else
+			swriter.writeStartElement(localname);
+
+		for (int i = 0 ; i < parser.getNamespaceCount() ; i++) {
+			swriter.writeNamespace(parser.getNamespacePrefix(i), parser.getNamespaceURI(i));
+		}
+
+		writeAttributes(swriter);
+	}
+
+	private void _processStartElement() {
+		String prefix = parser.getPrefix();
+
+		if (prefix != null && prefix.length() > 0)
+			writer.writeStartElement(Nscontext.getNamespaceURI(prefix), localname)
+		else
+			writer.writeStartElement(localname);
+
+		for (int i = 0 ; i < parser.getNamespaceCount() ; i++) {
+			writer.writeNamespace(parser.getNamespacePrefix(i), parser.getNamespaceURI(i));
+		}
+
+		writeAttributes();
+	}
+
+
+	protected void processNamespace() {
+		if (writer != null) {
+			writer.writeNamespace(parser.getPrefix(), parser.getNamespaceURI());
+		} else {
+			for (def swriter : writers.values()) swriter.writeNamespace(parser.getPrefix(), parser.getNamespaceURI());
+		}
+	}
+
+	protected void writeAttributes() {
+		if (writer != null) {
+			writeAttributes(writer);
+		} else {
+			for (def swriter : writers.values()) writeAttributes(swriter);
+		}
+	}
+
+	protected void writeAttributes(def swriter) {
+		for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
+			String attrPrefix = parser.getAttributePrefix(i);
+			if (attrPrefix != null && attrPrefix.length() > 0)
+				swriter.writeAttribute(attrPrefix+":"+parser.getAttributeLocalName(i), parser.getAttributeValue(i));
+			else
+				swriter.writeAttribute(parser.getAttributeLocalName(i), parser.getAttributeValue(i));
+		}
+	}
+
+	protected void processCharacters()
+	{
+		if (writer != null) {
+			writer.writeCharacters(parser.getText());
+		} else {
+			for (def swriter : writers.values()) swriter.writeCharacters(parser.getText());
+		}
+	}
+
+	protected void processProcessingInstruction()
+	{
+		if (writer != null) {
+			writer.writeProcessingInstruction(parser.getPITarget(), parser.getPIData());
+		} else {
+			for (def swriter : writers.values()) swriter.writeProcessingInstruction(parser.getPITarget(), parser.getPIData());
+		}
+	}
+
+	protected void processDTD()
+	{
+		if (writer != null) {
+			writer.writeDTD(parser.getText());
+		} else {
+			for (def swriter : writers.values()) swriter.writeDTD(parser.getText());
+		}
+	}
+
+	protected void processCDATA()
+	{
+		if (writer != null) {
+			writer.writeCData(parser.getText())
+		} else {
+			for (def swriter : writers.values()) swriter.writeCData(parser.getText())
+		}
+	}
+
+	protected void processComment()
+	{
+		if (writer != null) {
+			writer.writeComment(parser.getText());
+		} else {
+			for (def swriter : writers.values()) swriter.writeComment(parser.getText());
+		}
+	}
+
+	protected void processEndElement()
+	{
+		if (writer != null) {
+			writer.writeEndElement();
+		} else {
+			for (def swriter : writers.values()) swriter.writeEndElement();
+		}
+		if (parser.getLocalName() == "posting") writer = null;
+	}
+
+	protected void processEndDocument() {
+		if (writer != null) {
+			writer.writeEndDocument();
+		} else {
+			for (def swriter : writers.values()) swriter.writeEndDocument();
+		}
+	}
+
+	protected void processEntityReference() {
+		if (writer != null) {
+			writer.writeEntityRef(parser.getLocalName());
+		} else {
+			for (def swriter : writers.values()) swriter.writeEntityRef(parser.getLocalName());
+		}
+	}
+
+	public boolean processLocutors(def locutors) {
+		for (String loc : locutors) {
+			println "Create writer for $loc"
+			writers.put(loc, new StaxStackWriter(new File(outputDirectory, loc+"-teicmr.xml"), "UTF8"))
+		}
+		println "writers: $writers"
+
+		for (def swriter : writers.values()) {
+			swriter.writeStartDocument("UTF-8", "1.0");
+			swriter.writeCharacters("\n");
+		}
+
+		boolean ret = process(writer);
+
+		for (def swriter : writers.values()) {
+			try {swriter.close();} catch(Exception e){println "close writer exep: "+e}
+		}
+
+		if (parser != null)
+			try {parser.close()} catch(Exception e){println "parser exep: "+e}
+
+		return ret;
+	}
+
+	public static void main(String[] args) {
+		File inputFile = new File("/home/mdecorde/xml/comere/ismael-textchat.xml")
+		File outputDirectory = new File("/home/mdecorde/xml/comere/split_out")
+
+		def p = new SplitTEICMRPerLocutor(inputFile, outputDirectory)
+		println p.processLocutors(["s_1", "s_10", "s_11", "s_12", "s_13", "s_14", "s_3", "s_4", "s_5", "s_6", "s_7", "s_8", "s_9", "tt_1", "tt_12", "tt_2", "tt_3", "tt_4", "tt_5", "tt_6", "tt_7", "tt_8"])
+	}
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/importer/bfm/compiler.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/bfm/compiler.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/bfm/compiler.groovy	(revision 258)
@@ -0,0 +1,996 @@
+// 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
+// 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.
+
+//
+// This file is part of the TXM platform.
+//
+// The TXM platform is free software: you can redistribute it and/or modif y
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 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/>.
+//
+//
+//
+// $LastChangedDate: 2017-01-24 18:11:42 +0100 (Tue, 24 Jan 2017) $
+// $LastChangedRevision: 3400 $
+// $LastChangedBy: mdecorde $
+//
+package org.txm.importer.bfm
+
+import org.txm.Toolbox;
+import org.txm.importer.cwb.*
+import org.txm.importer.*;
+import org.txm.scripts.*;
+import org.txm.scripts.teitxm.BuildTTSrc;
+import org.txm.scripts.teitxm.*;
+import org.txm.utils.treetagger.TreeTagger;
+
+import javax.xml.stream.*;
+import java.net.URL;
+import java.io.File;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.List;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Produce WTC files from the TEI-TXM files. <br/>
+ * - Read texts metadata with XPath queries <br/>
+ * - Add the following word properties : sic, abbr, orig, lb and pb <br/>
+ * - Keep &lt;front>, &lt;body> and &lt;back> for each text <br/>
+ * - Text enclosed in &lt;q> is tokenized <br/>
+ * 
+ * @author mdecorde
+ *
+ */
+class compiler {
+	/** The debug. */
+	private boolean debug= false;
+
+	/** The annotate_status. */
+	private boolean annotate_status=true;
+
+	/** The input data. */
+	private def inputData;
+
+	/** The factory. */
+	private def factory;
+
+	/** The parser. */
+	private XMLStreamReader parser;
+
+	/** The dir. */
+	private def dir;
+
+	/** The output. */
+	private def output;
+
+	/** The url. */
+	private def url;
+
+	/** The anahash. */
+	static boolean firstWord = true;
+	static private def anaTypes = [];
+	private HashMap<String,String> anahash = new HashMap<String,String>() ;
+
+	private static SAttributesListener sattrsListener;
+	private static HashMap<String,ArrayList<String>> structs;
+	private static HashMap<String, Integer> structsProf;
+
+	/** The text. */
+	private String text="";
+
+	/** The base. */
+	private String base="";
+
+	/** The project. */
+	private String project="";
+
+	/** The cwb loc. */
+	private String cwbLoc;
+
+	/** The lang. */
+	private String lang ="fr";
+
+	/**
+	 * contains the metadata xpath organize per name
+	 */
+	Properties metadataXPath;
+
+	/**
+	 * initialize.
+	 *
+	 */
+	public compiler(){
+		firstWord = true;
+		anaTypes = [];
+	}
+
+	/**
+	 * initialize the compiler.
+	 *
+	 * @param url the file to process
+	 * @param text the Texte's name
+	 * @param base the base's name
+	 * @param project the Project's name
+	 */
+	public compiler(URL url,String text,String base, String project, Properties metadataXPath)
+	{
+		this.metadataXPath = metadataXPath;
+		this.text = text
+		this.base = base;
+		this.project = project;
+		try {
+			this.url = url;
+			inputData = url.openStream();
+
+			factory = XMLInputFactory.newInstance();
+			parser = factory.createXMLStreamReader(inputData);
+			if (sattrsListener == null)
+				sattrsListener = new SAttributesListener(parser);
+			else
+				sattrsListener.start(parser)
+		} catch (XMLStreamException ex) {
+			System.out.println(ex);
+		}catch (IOException ex) {
+			System.out.println("IOException while parsing ");
+		}
+	}
+
+	/**
+	 * Sets the cwb path.
+	 *
+	 * @param path the path to cwb utils binaries
+	 */
+	public void setCwbPath(String path) {
+		if (!new File(path).exists())
+			System.err.println("CWB Path : "+path+" does not exists")
+		cwbLoc = path;
+	}
+
+	ArrayList<File> orderedFiles;
+	public ArrayList<File> getOrderedTxmFiles() {
+		return orderedFiles;
+	}
+
+	/**
+	 * Sets the lang.
+	 *
+	 * @param lang the new lang
+	 */
+	public void setLang(String lang)
+	{
+		this.lang = lang;
+	}
+
+	/**
+	 * Sets the annotation done.
+	 *
+	 * @param done the new annotation done
+	 */
+	public void setAnnotationDone(boolean done)
+	{
+		this.annotate_status = done;
+	}
+
+	/**
+	 * Creates the output.
+	 *
+	 * @param dirPathName the dir path name
+	 * @param fileName the file name
+	 * @return true, if successful
+	 */
+	private boolean createOutput(File f) {
+		try {
+			output = new OutputStreamWriter(new FileOutputStream(f,f.exists()) , "UTF-8");
+		} catch (Exception e) {
+			System.out.println(e.getLocalizedMessage());
+			return false;
+		}
+		return true;
+	}
+
+	/**
+	 * Go to text.
+	 */
+	private void GoToText()
+	{
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+			if (event == XMLStreamConstants.END_ELEMENT)
+				if (parser.getLocalName().equals("teiHeader"))
+					return;
+		}
+	}
+
+	/**
+	 * Increment.
+	 *
+	 * @param parser the parser
+	 * @param value the value
+	 * @return the java.lang. object
+	 */
+	private def increment(XMLStreamReader parser, int value)
+	{
+		String n=null;
+		for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
+			//System.out.println("attr name "+parser.getAttributeLocalName(i));
+			if (parser.getAttributeLocalName(i) == "n") {
+				n = parser.getAttributeValue(i);
+				break;
+			}
+		}
+		//System.out.println("inc n "+n);
+		if (n != null)
+			try {
+				value = Integer.parseInt(n);
+				return value;
+			}
+			catch (Exception e) {return value+1;}
+
+		value = value+1;
+		return value;
+	}
+
+	/**
+	 * Transfom file wtc.
+	 *
+	 * @param dirPathName the dir path name
+	 * @param fileName the file name
+	 * @return true, if successful
+	 */
+	private boolean transfomFileWtc(File wtcFile)
+	{
+		try {
+			if (!createOutput(wtcFile)) return false;
+
+			String headvalue = ""
+			String vAna = "";
+			String vForm = "";
+			String wordid = "";
+			String vHead = "";
+
+			Integer p_id = 0;
+			Integer s_id = 0;
+			Integer q_id = 0;
+			int sp_id = 0;
+			Integer body_id = 0;
+			Integer front_id = 0;
+			Integer back_id = 0;
+			Integer lb_id = 0;
+			Integer pb_id = 0;
+			Integer ab_id = 0;
+			int foreign_id = 0;
+			int name_id = 0;
+
+			boolean captureword = false;
+
+			String vExpan = "";
+			String vCorr = "";
+			String vReg = "";
+			String vOrig = "";
+			String vSic = "";
+			String vAbbr = "";
+			String givenpos = "";
+			String pb_n = "";
+			String foreign_lang = "";
+			String nameType = "";
+			String anaType;
+			//String abType = "";
+			
+			boolean foundtei=false, foundtext=false;
+
+			boolean flaglg = false;
+			int levelq = 0;
+			//boolean flagq = false;
+			boolean flaghead = false;
+			//Added:
+			boolean flagSp = false;
+			boolean flagAuthor = false;
+			boolean flagDate = false;
+			boolean flagWord = false;
+			boolean flagForm = false;
+			boolean flagAna = false;
+
+			boolean flagchoice = false;
+			boolean flagcorr = false;
+			boolean flagsic = false;
+			boolean flagreg = false;
+			boolean flagexpan = false;
+			boolean flagorig = false;
+			boolean flagabbr = false;
+			boolean flagfw = false;
+			//boolean flagSupplied = false;
+			int levelSupplied = 0;
+			//boolean flagSurplus = false;
+			boolean flagForeign = false;
+			//boolean flagName = false;
+
+			this.GoToText();
+			int missingId= 0
+			boolean USEVERSE = false; // switch default reference to verse references
+			String titreId; // the title to use in the reference
+			
+			for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+				switch (event) {
+					case XMLStreamConstants.START_ELEMENT:
+
+						String localname = parser.getLocalName();
+						if (foundtext) sattrsListener.startElement(localname);
+						
+						switch (localname) {
+							case "TEI":
+								foundtei = true;
+								break;
+							case "text":
+								foundtext = true;
+								sattrsListener.startElement(localname);
+								output.write("<text id=\""+text+"\"")
+
+								for (int i = 0; i < parser.getAttributeCount() ; i++) {
+									String name = parser.getAttributeLocalName(i);
+									if ("id" == name || "base" == name || "project" == name) continue;
+									output.write(" "+name+"=\""+parser.getAttributeValue(i)+"\"");
+									
+									if (name == "forme") {
+										USEVERSE = (parser.getAttributeValue(i).contains("vers"))
+									} else if (name == "sigle") {
+										titreId = parser.getAttributeValue(i)
+									}
+								}
+								
+								output.write(" base=\""+base+"\" project=\""+project+"\">\n");
+								captureword=true;
+								break;
+
+							case "div":
+							//output.write("<div type=\""+parser.getAttributeValue(null,"type")+"\">\n");
+								String divType = "NA";
+								String divSubtype = "NA";
+								String divN = "NA";
+								String divId ="NA";
+								for(int i = 0 ; i < parser.getAttributeCount(); i++) {
+									if(parser.getAttributeLocalName(i) == "type") {
+										divType = parser.getAttributeValue(i);
+									} else if(parser.getAttributeLocalName(i) == "subtype") {
+										divSubtype = parser.getAttributeValue(i);
+									} else if(parser.getAttributeLocalName(i) == "n") {
+										divN = parser.getAttributeValue(i);
+									} else if(parser.getAttributeLocalName(i) == "id") {
+										divId = parser.getAttributeValue(i);
+										break;
+									}
+								}
+								output.write("<div type=\""+divType+"\" subtype=\""+divSubtype+"\" n=\""+divN+"\" id=\""+divId+"\">\n");
+								break;
+							case "p":
+								p_id = increment(parser, p_id);
+								output.write("<p n=\""+p_id+"\">\n");
+								break;
+							case "ab":
+								ab_id = increment(parser, ab_id)
+								output.write("<ab n=\""+(ab_id)+"\" type=\""+parser.getAttributeValue(null,"type")+"\" subtype=\""+parser.getAttributeValue(null,"subtype")+"\" rend=\""+parser.getAttributeValue(null,"rend")+"\">\n");
+								break;
+							case "q":
+								q_id = increment(parser, q_id)
+								output.write("<q n=\""+(q_id)+"\">\n");
+							//flagq=true;
+								levelq = levelq + 1;
+								break;
+							case "sp":
+								sp_id = increment(parser, sp_id)
+								output.write("<sp n=\""+(sp_id)+"\">\n");
+								flagSp = true;
+								break;
+							case "front":
+								front_id = increment(parser, front_id)
+								output.write("<front n=\""+front_id+"\">\n");
+								break;
+							case "body":
+								body_id= increment(parser, body_id)
+								output.write("<body n=\""+body_id+"\">\n");
+								break;
+							case "back":
+								back_id = increment(parser, back_id)
+								output.write("<back n=\""+back_id+"\">\n");
+								break;
+							case "lb":
+								lb_id = increment(parser, lb_id)
+								break;
+							case "pb":
+								pb_id = increment(parser, pb_id)
+								for (int i = 0 ; i < parser.getAttributeCount(); i++) {
+									if (parser.getAttributeLocalName(i) == "n") {
+										pb_n = parser.getAttributeValue(i);
+									}
+								}
+								break;
+							case "s":
+								s_id = increment(parser, s_id)
+								output.write("<s n=\""+s_id+"\">\n");
+								break;
+							case "choice":
+								flagchoice = true;
+								break;
+							case "corr":
+								flagcorr = true;
+								vCorr= "";
+								break;
+							case "reg":
+								flagreg = true;
+								vReg= "";
+								break;
+							case "expan":
+								flagexpan = true;
+								vExpan= "";
+								break;
+							case "orig":
+								flagreg = true;
+								vOrig= "";
+								break;
+							case "sic":
+								flagsic = true;
+								vSic= "";
+								break;
+							case "abbr":
+								flagreg = true;
+								vAbbr= "";
+								break;
+							case "foreign":
+								flagForeign = true;
+								for (int i = 0 ; i < parser.getAttributeCount(); i++) {
+									if (parser.getAttributeLocalName(i) == "lang") {
+										lang = parser.getAttributeValue(i);
+										break;
+									}
+								}
+
+								output.write("<foreign n=\""+(foreign_id++)+"\" lang=\""+lang+"\">\n");
+							//vForeign = "";
+								break;
+
+							case "name":
+							//flagName = true;
+								for(int i = 0 ; i < parser.getAttributeCount(); i++)
+									if(parser.getAttributeLocalName(i) == "type")
+								{
+									nameType = parser.getAttributeValue(i);
+									break;
+								}
+
+								output.write("<name n=\""+(name_id++)+"\" type=\""+nameType+"\">\n");
+								break;
+							case "supplied":
+							//flagSupplied = true;
+								levelSupplied = levelSupplied + 1;
+								break;
+
+							case "surplus":
+								flagfw = true;
+								break;
+
+							case "del":
+								flagfw = true;
+								break;
+
+							case "w":
+								givenpos = "";
+								wordid = "w_"+text+"_m"+missingId++
+								for (int i = 0 ; i < parser.getAttributeCount(); i++) {
+									if (parser.getAttributeLocalName(i) == "id") {
+										wordid = parser.getAttributeValue(i);
+									} else if (parser.getAttributeLocalName(i) == "type") {
+										givenpos = parser.getAttributeValue(i);
+									}
+								}
+								if (wordid.startsWith("w")) {
+									if (!wordid.startsWith("w_"))
+										wordid = "w_"+wordid.substring(1)
+								} else {
+									wordid = "w_"+wordid;
+								}
+
+								if (givenpos == null || givenpos == "")
+									givenpos = "NA";
+								vForm = "";
+								anahash.clear(); // remove previous word ana values
+								flagWord = true;
+								break;
+							case "form":
+								flagForm = true;
+								vForm = "";
+								break;
+
+							case "ana":
+								flagAna = true;
+								anaType = parser.getAttributeValue(null, "type")
+								anahash.put(anaType, "");
+								if (firstWord) {
+									anaTypes << anaType;
+								}
+								break;
+						}
+						break;
+
+					case XMLStreamConstants.END_ELEMENT:
+						String localname = parser.getLocalName();
+						if (foundtext) sattrsListener.endElement(localname);
+
+						switch (localname) {
+							case "div":
+								output.write("</div>\n");
+								break;
+							case "text":
+								output.write("</text>\n");
+								captureword=false;
+								break;
+							case "p":
+								output.write("</p>\n");
+								break;
+							case "s":
+								output.write("</s>\n");
+								break;
+							case "ab":
+								output.write("</ab>\n");
+								break;
+							case "q":
+								output.write("</q>\n");
+							//flagq= false;
+								levelq = levelq - 1;
+								break;
+							case "sp":
+								output.write("</sp>\n");
+								flagSp = false;
+								break;
+							case "front":
+								output.write("</front>\n");
+								break;
+							case "body":
+								output.write("</body>\n");
+								break;
+							case "back":
+								output.write("</back>\n");
+								break;
+
+							//							case "fw":
+							//							flagfw = false;
+							//							break;
+
+							case "choice":
+								if(vOrig == "")
+									vOrig="NA";
+								if(vSic == "")
+									vSic="NA";
+								if(vAbbr == "")
+									vAbbr="NA";
+
+								String ref;
+								if(USEVERSE)
+									ref = titreId+", p."+pb_n+", v."+lb_id;
+								else
+									ref = titreId+", p."+pb_n;
+
+								if (flagfw) {
+									// on est hors texte
+								} else {
+									String vFormToWrite = vForm;
+									if (vCorr != "") {
+										vFormToWrite = vCorr;
+									} else if(vReg != "") {
+										vFormToWrite = vReg;
+									} else if(vExpan != "") {
+										vFormToWrite = vExpan
+									}
+									firstWord = false;
+									output.write( vFormToWrite +"\t"+wordid+"\t"+levelq.toString().substring(0,1)+"\t"+flagSp.toString().substring(0,1)+"\t"+pb_n+"\t"+lb_id+"\t"+vOrig+
+											"\t"+vSic+"\t"+vAbbr+"\t"+ref+"\t"+givenpos+"\t"+levelSupplied.toString().substring(0,1)+"\t"+lang+"\t"+nameType);
+									for(String type : anaTypes) {
+										output.write("\t"+anahash.get(type));
+									}
+									output.write("\n")
+								}
+								flagchoice = false;
+								vCorr= "";
+								vSic= "";
+								break;
+							case "corr":
+								flagcorr = false;
+
+								break;
+							case "reg":
+								flagreg = false;
+								vReg = "";
+								break;
+							case "expan":
+								flagexpan = false;
+								vExpan= "";
+								break;
+							case "orig":
+								flagreg = false;
+								vOrig= "";
+								break;
+							case "sic":
+								flagsic = false;
+
+								break;
+							case "abbr":
+								flagreg = false;
+								vAbbr= "";
+								break;
+
+							case "foreign":
+								flagForeign = false;
+								lang = "";
+								output.write("</foreign>\n");
+								break;
+
+							case "name":
+							//flagName = false;
+								nameType = "";
+								output.write("</name>\n");
+								break;
+
+							case "supplied":
+							//flagSupplied = false;
+								levelSupplied = levelSupplied - 1;
+								break;
+
+							case "surplus":
+								flagfw = false;
+								break;
+
+							case "del":
+								flagfw = false;
+								break;
+
+							case "w":
+								if (captureword) {
+									if (flagchoice) {
+
+									} else if(flagfw) {
+
+									} else {
+										if (vOrig == "")
+											vOrig="NA";
+										if(vSic == "")
+											vSic="NA";
+										if(vAbbr == "")
+											vAbbr="NA";
+										if (nameType == "")
+											nameType = "NA";
+										if(lang == "")
+											lang="fr"
+
+										String ref;
+										if(USEVERSE)
+											ref = titreId+", p."+pb_n+", v."+lb_id;
+										else
+											ref = titreId+", p."+pb_n;
+
+										firstWord = false;
+										output.write(vForm.replaceAll("&", "&amp;").replaceAll("<", "&lt;") +"\t"+wordid+"\t"+levelq.toString().substring(0,1)+"\t"+flagSp.toString().substring(0,1)+"\t"+pb_n+"\t"+lb_id+"\t"+vOrig+"\t"+vSic+"\t"+vAbbr+"\t"+ref+"\t"+givenpos+"\t"+levelSupplied.toString().substring(0,1)+"\t"+lang+"\t"+nameType);
+										for(String type : anaTypes) {
+											output.write("\t"+anahash.get(type));
+										}
+										output.write("\n")
+									}
+
+									flagWord = false;
+								}
+								break;
+
+							case "form":
+								flagForm = false;
+								break;
+
+							case "ana":
+								flagAna = false;
+								anahash.put(anaType, vAna);
+								vAna = "";
+								break;
+						}
+						break; // end elem
+
+					case XMLStreamConstants.CHARACTERS:
+						if (flagAna) {
+							vAna += parser.getText().trim()
+						}
+
+						if (flagForm) {
+							vForm += parser.getText().trim();
+							if (flagchoice) {
+								if (flagsic) {
+									vSic += parser.getText().trim();
+								}
+								if (flagorig) {
+									vOrig += parser.getText().trim();
+								}
+								if (flagabbr) {
+									vAbbr += parser.getText().trim();
+								}
+								if (flagcorr) {
+									vCorr += parser.getText().trim();
+								}
+							}
+						}
+				}
+			}
+			//output.write("</txmcorpus>");
+			output.close();
+			parser.close();
+			inputData.close();
+		} catch (Exception ex) {
+			System.out.println("Exception while parsing " + inputData);
+			ex.printStackTrace();
+			return false;
+		}
+
+		return true;
+	}
+
+
+	/**
+	 * Run.
+	 *
+	 * @param rootDirFile contains the TEI-TXM files
+	 * @param basename the basename
+	 * @return true, if successful
+	 */
+	public boolean run(File binDir, File txmDir, String corpusname, Properties metadataXPath)
+	{
+		sattrsListener = null; // reset SAttribute Listener for each new import
+		this.metadataXPath = metadataXPath;
+		if (cwbLoc == null)
+			cwbLoc = org.txm.Toolbox.getParam(org.txm.Toolbox.CQI_SERVER_PATH_TO_CQPLIB)+File.separator;
+
+		if (!new File(cwbLoc).exists()) {
+			println ("CWB path error: "+cwbLoc)
+			return false;
+		}
+		if (!txmDir.exists()) {
+			println ("binary directory does not exists: "+txmDir)
+			return false;
+		}
+
+		File wtcFile = new File(binDir, "wtc/${corpusname}.wtc");
+		new File(binDir, "/wtc/").deleteDir();
+		new File(binDir, "/wtc/").mkdir();
+		new File(binDir, "/data/${corpusname}").deleteDir();
+		new File(binDir, "/data/${corpusname}").mkdir();
+		new File(binDir, "registry/").mkdir();
+
+		String textid = "";
+		int counttext = 0;
+		List<File> files = txmDir.listFiles();
+		
+		// get text siecles to be able to sort with it
+		HashMap<File,Integer[]> filesiecle = new HashMap<File, Integer[]>()
+		for (File f : files) {
+			Integer[] date = new Integer[3];
+			date[0] = date[1] = date[2] = 0;
+			String xpath = "//tei:TEI/tei:teiHeader/tei:profileDesc/tei:creation/tei:date[@type='compo']/@when"
+			if (metadataXPath.containsKey("datecompo"))
+				xpath = metadataXPath.get("datecompo")
+			String datecompo = XPathResult.getXpathResponse(f, xpath);
+			if (datecompo != null) {
+				//println f.getName()+" > "+datecompo
+				String[] split = datecompo.split("-"); // yyyy-mm-dd
+				if (split.length == 3) {
+					date[0] = Integer.parseInt(split[0]);
+					date[1] = Integer.parseInt(split[1]);
+					date[2] = Integer.parseInt(split[2]);
+				}
+				else if (split.length == 1) { // yyyy
+					date[0] = Integer.parseInt(split[0]);
+					date[1] = 1;
+					date[2] = 1;
+				}				
+			}
+			filesiecle.put(f, date);
+		}
+		//println "date compos: "+filesiecle
+		Collections.sort(files); // Alpha order
+		Collections.sort(files, new Comparator<File>() { // Date order
+					@Override
+					public int compare(File o1, File o2) {
+						Integer[] date1 = filesiecle.get(o1);
+						Integer[] date2 = filesiecle.get(o2);
+						if (date1[0] < date2[0]) {
+							return -1;
+						} else if(date1[0] > date2[0]) {
+							return 1;
+						}
+
+						if (date1[1] < date2[1]) {
+							return -1;
+						} else if(date1[1] > date2[1]) {
+							return 1;
+						}
+
+						if (date1[2] < date2[2]) {
+							return -1;
+						} else if(date1[2] > date2[2]) {
+							return 1;
+						}
+
+						return 0;
+					}
+				});
+			
+		this.orderedFiles = files;
+		println("process "+files.size()+" files ")
+		//println("files: $files")
+		//write txmcorpus
+		if (!createOutput(wtcFile)) {
+			println "Error: could not write wtc file"
+			return false;
+		} else {
+			output.write("<txmcorpus lang=\""+lang+"\">\n");
+			output.close();
+		}
+		
+		//1- Transform into WTC file
+		for (File f : files) {
+			counttext++;
+			if (!f.exists()) {
+				println("file "+f+ " does not exists")
+			} else {
+				print "."
+				String txtname = f.getName().substring(0, f.getName().length()-4);
+				def builder = new compiler(f.toURI().toURL(), txtname, corpusname, "default", metadataXPath);
+				builder.setLang(lang)
+				if (!builder.transfomFileWtc(wtcFile)) {
+					println "Failed to compile "+f
+				}
+				builder.setAnnotationDone(this.annotate_status);
+			}
+		}
+
+		//close txmcorpus
+		if (!createOutput(wtcFile)) {
+			println "Error: could not write wtc file"
+			return false;
+		} else {
+			output.write("</txmcorpus>\n");
+			output.close();
+		}
+		println ""
+		
+		//2- Import into CWB
+		def outDir = binDir.getAbsolutePath();;
+		CwbEncode cwbEn = new CwbEncode();
+		cwbEn.setDebug(debug);
+		CwbMakeAll cwbMa = new CwbMakeAll();
+		cwbMa.setDebug(debug);
+		
+		def pAttrs = ["id","q","sp","pb","lb","orig","sic","abbr","ref","pos","supplied","lang","nametype"];
+		for(String type : anaTypes)
+			pAttrs.add(type.substring(1)); // remove #
+
+		structs = sattrsListener.getStructs();
+		structsProf = sattrsListener.getProfs();
+		if (debug) {
+			println structs
+			println structsProf
+		}
+		// add structures+properties found in sources
+		List<String> sargs = new ArrayList<String>();
+		for (String name : structs.keySet()) {
+			if ( name == "text") continue; // added after
+			//if ( name == "q") continue; // added after
+			//if ( name == "foreign") continue; // added after
+			String concat = name+":"+structsProf.get(name); // append the depth
+			for (String value : structs.get(name)) // append the attributes
+				concat += "+"+value;
+			if ((name == "p" || name == "body" || name == "back" || name == "front") &&
+			!(concat.endsWith("+n") || concat.contains("+n+")))
+				concat += "+n"
+			sargs.add(concat);
+		}
+
+		String textSAttributes = "text:0+id+base+project";
+		if (metadataXPath != null) {
+			for (String meta : metadataXPath.keySet()) // text property declarations from metadata.csv
+				textSAttributes+="+"+meta;
+		}
+		if (!metadataXPath.keySet().contains("sigle"))
+			textSAttributes+="+sigle";
+			
+		sargs.add(textSAttributes)
+		sargs.add("txmcorpus:0+lang")
+		//sargs.add("q:0+n+lang")
+		for (int c = 0 ; c < sargs.size() ; c++) {
+			String sarg = sargs.get(c);
+			if (sarg.startsWith("q:")) {
+				if (! sarg.contains("+n")) sarg +="+n"
+				if (! sarg.contains("+lang")) sarg +="+lang"
+
+				sargs.set(c, sarg);
+			} else if(sarg.startsWith("foreign:")) {
+				if (! sarg.contains("+n")) sarg +="+n"
+				if (! sarg.contains("+lang")) sarg +="+lang"
+				sargs.set(c, sarg);
+			} else if(sarg.startsWith("ab:") || sarg.startsWith("sp:")) {
+				if (! sarg.contains("+n")) sarg +="+n"
+				if (! sarg.contains("+subtype")) sarg +="+subtype"
+				if (! sarg.contains("+rend")) sarg +="+rend"
+				sargs.set(c, sarg);
+			}  else if(sarg.startsWith("div:")) {
+				if (! sarg.contains("+n")) sarg +="+n"
+				if (! sarg.contains("+id")) sarg +="+id"
+				if (! sarg.contains("+type")) sarg +="+type"
+				if (! sarg.contains("+subtype")) sarg +="+subtype"
+				sargs.set(c, sarg);
+			} else if(sarg.startsWith("name:")) {
+				if (! sarg.contains("+n")) sarg +="+n"
+				if (! sarg.contains("+type")) sarg +="+type"
+				sargs.set(c, sarg);
+			}
+		}
+		sargs.sort();
+		
+		String[] sAttributes = sargs;
+		String[] pAttributes = pAttrs;
+		println "P-attributes: "+pAttributes
+		println "S-attributes: "+sargs
+
+		try {
+			String regPath = outDir + "/registry/"+corpusname.toLowerCase(); // CQP wants lower case registry files
+			cwbEn.run(new File(cwbLoc,"cwb-encode").getAbsolutePath(), outDir + "/data/${corpusname}", outDir + "/wtc/"+corpusname+".wtc", regPath,pAttributes, sAttributes);
+			if (!new File(regPath).exists()) {
+				println "Error: The registry file was not created: $regPath. See https://groupes.renater.fr/wiki/txm-users/public/faq"
+				return false;
+			}
+			cwbMa.run(new File(cwbLoc,"cwb-makeall").getAbsolutePath(), corpusname, outDir + "/registry");
+		} catch (Exception ex) {System.out.println(ex);return false;}
+
+		return true;
+	}
+
+	/**
+	 * show cwb utils messages.
+	 */
+	public void setDebug()
+	{
+		this.debug = true;
+	}
+
+	/**
+	 * test purpose.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args)
+	{
+		File dir = new File("~/xml/bfm");
+		def c = new compiler();
+		c.setDebug();
+		c.setCwbPath("~/TXM/cwb/bin");
+		c.run(dir);
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/bfm/package.html
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/bfm/package.html	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/bfm/package.html	(revision 258)
@@ -0,0 +1,12 @@
+<html>
+<body>
+<p>The BFM import module<br/>
+The bfmLoader.groovy script is the main entry point.<br/>
+Process : <br/>
+1- Read a directory containing XML files who follow the BFM encoding guidelines (<a href="http://bfm.ens-lsh.fr/">BFM website</a>) <br/>
+2- Add annotations on words <br/>
+3- Build a TXM corpus with the same name as the directory <br/>
+4- Build a HTML edition <br/>
+</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/org/txm/importer/bfm/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/importer/bfm/bfmLoader.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/bfm/bfmLoader.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/bfm/bfmLoader.groovy	(revision 258)
@@ -0,0 +1,219 @@
+// 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
+// Sophia Antipolis, University of Paris 3.
+//
+//
+// This file is part of the TXM platform.
+//
+// The TXM platform is free software: you can redistribute it and/or modif y
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 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/>.
+//
+//
+//
+// $LastChangedDate: 2016-03-01 10:10:58 +0100 (Tue, 01 Mar 2016) $
+// $LastChangedRevision: 3133 $
+// $LastChangedBy: mdecorde $
+//
+package org.txm.importer.bfm;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.txm.importer.ApplyXsl2;
+import org.txm.importer.bfm.importer;
+import org.txm.importer.bfm.compiler;
+import org.txm.importer.bfm.pager;
+import org.txm.objects.*;
+import org.txm.*;
+import org.txm.utils.i18n.*;
+import org.txm.utils.io.FileCopy;
+import org.txm.scripts.teitxm.*;
+import org.txm.importer.*;
+import org.w3c.dom.Element
+import org.txm.utils.*;
+
+String userDir = System.getProperty("user.home");
+boolean debug = org.txm.utils.logger.Log.isPrintingErrors();
+def MONITOR;
+BaseParameters params;
+try {params = paramsBinding;MONITOR=monitor} catch (Exception)
+{	println "DEV MODE";//exception means we debug
+	debug = true
+	params = new BaseParameters(new File(userDir, "xml/bfm/import.xml"))
+	params.load()
+	if (!org.txm.Toolbox.isInitialized()) {
+		//rootDir = userDir+"/xml/TESTS/alceste";  // directory which contains the source file
+
+		Toolbox.setParam(Toolbox.INSTALL_DIR,new File("/usr/lib/TXM"));
+		//Toolbox.setParam(Toolbox.INSTALL_DIR,new File("C:\\Program Files\\TXM"));//For Windows
+		Toolbox.setParam(Toolbox.TREETAGGER_INSTALL_PATH,new File(userDir,"treetagger"));
+		//Toolbox.setParam(Toolbox.TREETAGGER_INSTALL_PATH,new File("C:\\Program Files\\treetagger"));//for Windows
+		Toolbox.setParam(Toolbox.TREETAGGER_MODELS_PATH,new File(userDir,"treetagger/models"));
+		Toolbox.setParam(Toolbox.METADATA_ENCODING, "UTF-8");
+		Toolbox.setParam(Toolbox.METADATA_COLSEPARATOR, ",");
+		Toolbox.setParam(Toolbox.METADATA_TXTSEPARATOR, "\"");
+		Toolbox.setParam(Toolbox.TREETAGGER_MODELS_PATH,new File("C:\\Program Files\\treetagger\\models"));//for Windows
+		Toolbox.setParam(Toolbox.USER_TXM_HOME, new File(System.getProperty("user.home"), "TXM"));
+	}
+}
+if (params == null) { println "no parameters. Aborting"; return; }
+
+String corpusname = params.getCorpusName();
+Element corpusElem = params.corpora.get(corpusname);
+String basename = params.name;
+String rootDir = params.rootDir;
+String lang = corpusElem.getAttribute("lang");
+String model = lang
+String encoding = corpusElem.getAttribute("encoding");
+boolean annotate = "true" == corpusElem.getAttribute("annotate");
+String xsl = params.getXsltElement(corpusElem).getAttribute("xsl")
+def xslParams = params.getXsltParams(corpusElem);
+int wordsPerPage = params.getWordsPerPage("default")
+boolean build_edition = params.getDoEdition("default")
+
+File srcDir = new File(rootDir);
+File binDir = new File(Toolbox.getParam(Toolbox.USER_TXM_HOME),"corpora/"+basename);
+binDir.deleteDir();
+binDir.mkdirs();
+if (!binDir.exists()) {
+	println "Could not create binDir "+binDir
+	return;
+}
+
+File txmDir = new File(binDir,"txm/$corpusname");
+txmDir.deleteDir();
+txmDir.mkdirs();
+
+// BFM XPATH PARAMETERS
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+if (MONITOR != null) MONITOR.worked(1, "READ XPATH PARAMETERS")
+File paramDeclarationFile = new File(srcDir, "import.properties");
+Properties metadataXPath = new Properties();
+if (paramDeclarationFile.exists() && paramDeclarationFile.canRead()) {
+	InputStreamReader input = new InputStreamReader(new FileInputStream(paramDeclarationFile) , "UTF-8");
+	metadataXPath.load(input);
+	input.close();
+
+	if (!metadataXPath.containsKey("titre"))
+		println "Warning: parameters property file does not contain the 'titre' metadata"
+	if (!metadataXPath.containsKey("forme"))
+		println "Warning: parameters property file does not contain the 'forme' metadata in param values. The default value is 'prose'"
+}
+else
+	println "No '$paramDeclarationFile' file found"
+
+// Apply XSL
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+if (MONITOR != null) MONITOR.worked(1, "APPLYING XSL")
+if (xsl != null && xslParams != null && xsl.trim().length() > 0) {
+	if (ApplyXsl2.processImportSources(new File(xsl), srcDir, new File(binDir, "src"), xslParams))
+	// return; // error during process
+	srcDir = new File(binDir, "src");
+	println ""
+}
+
+// copy txm files
+println "-- VALIDATION - checking XML source files well-formedness"
+List<File> srcfiles = srcDir.listFiles();
+for (File f : srcfiles) { // check XML format, and copy file into binDir
+	if (f.isHidden() || f.getName().equals("import.xml") || f.getName().equals("metadata.csv") || f.getName().endsWith(".properties"))
+		continue;
+	if (ValidateXml.test(f)) {
+		FileCopy.copy(f, new File(txmDir, f.getName()));
+	} else {
+		println "Won't process file "+f;
+	}
+}
+
+if (txmDir.listFiles() == null) {
+	println "No txm file to process"
+	return;
+}
+
+if (MONITOR != null) MONITOR.worked(1, "IMPORTER")
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+println "-- IMPORTER - Reading source files"
+def imp = new importer()
+if (!imp.run(srcDir, binDir, txmDir, basename, metadataXPath)) {
+	println "import process stopped";
+	return;
+}
+
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+if (MONITOR != null) MONITOR.worked(20, "ANNOTATE")
+println "-- ANNOTATE - Running NLP tools - $model model"
+boolean annotate_status = true;
+if (annotate && !(new Annotate().run(binDir, txmDir,model+".par"))) {
+	println "Skipping Annotate process";
+	annotate_status = false;
+}
+
+//if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+//if (MONITOR != null) MONITOR.worked(20, "ANNOTATE")
+//println "-- ANNOTATE - Running NLP tools - fr model"
+//annotate_status = true;
+//if (annotate && !(new Annotate().run(binDir, txmDir,"fr.par"))) {
+//	println "Skipping Annotate process";
+//	annotate_status = false;
+//}
+
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+if (MONITOR != null) MONITOR.worked(25, "COMPILING")
+println "-- COMPILING - Building Search Engine indexes"
+def c = new compiler();
+if (debug) c.setDebug();
+//c.setCwbPath("~/TXM/cwb/bin");
+c.setLang(lang);
+c.setAnnotationDone(annotate_status)
+if (!c.run(binDir, txmDir, corpusname, metadataXPath)) {
+	println "import process stopped";
+	return;
+}
+
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+
+new File(binDir,"HTML/$corpusname").deleteDir();
+new File(binDir,"HTML/$corpusname").mkdirs();
+if (build_edition) {
+
+	println "-- EDITION"
+	if (MONITOR != null) MONITOR.worked(25, "EDITION")
+	File outdir = new File(binDir,"/HTML/$corpusname/default/");
+	outdir.mkdirs();
+	files = c.getOrderedTxmFiles();
+
+	println("Building editions: "+files.size()+" files" );
+	for (File txmFile : files) {
+		print "."
+		String txtname = txmFile.getName();
+		int idx = txtname.lastIndexOf(".");
+		if(idx > 0) txtname = txtname.substring(0, idx);
+		List<String> NoSpaceBefore = LangFormater.getNoSpaceBefore(lang);
+		List<String> NoSpaceAfter = LangFormater.getNoSpaceAfter(lang);//["'","(","[","{","«"];
+
+		Element text = params.addText(corpusElem, txtname, txmFile);
+
+		def ed = new pager(txmFile, outdir, txtname, NoSpaceBefore, NoSpaceAfter, wordsPerPage, corpusname, metadataXPath);
+		Element edition = params.addEdition(text, "default", outdir.getAbsolutePath(), "html");
+
+		for (i = 0 ; i < ed.getPageFiles().size();) {
+			File f = ed.getPageFiles().get(i);
+			String wordid = ed.getIdx().get(i);
+			params.addPage(edition, ""+(++i), wordid);
+		}
+	}
+}
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+if (MONITOR != null) MONITOR.worked(20, "FINALIZING")
+File paramFile = new File(binDir, "import.xml");
+DomUtils.save(params.root.getOwnerDocument(), paramFile);readyToLoad = true;
Index: tmp/org.txm.core/src/groovy/org/txm/importer/bfm/pager.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/bfm/pager.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/bfm/pager.groovy	(revision 258)
@@ -0,0 +1,545 @@
+// 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
+// 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.
+
+//
+// This file is part of the TXM platform.
+//
+// The TXM platform is free software: you can redistribute it and/or modif y
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 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/>.
+//
+//
+//
+// $LastChangedDate: 2017-01-24 18:11:42 +0100 (Tue, 24 Jan 2017) $
+// $LastChangedRevision: 3400 $
+// $LastChangedBy: mdecorde $
+//
+package org.txm.importer.bfm;
+
+import org.txm.importer.*;
+import org.xml.sax.Attributes;
+import org.txm.importer.filters.*;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.stream.*;
+import java.net.URL;
+import org.xml.sax.InputSource;
+import org.xml.sax.helpers.DefaultHandler;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Build BFM texts HTML edition from the TEI-TXM files. <br/>
+ * The result is similar to the one of the XSLT script made by Alexis Lavrentiev
+ * (BFM & ICAR3). <br/>
+ * 
+ * @author mdecorde
+ */
+class pager {
+	private List<String> NoSpaceBefore;
+
+	/** The No space after. */
+	private List<String> NoSpaceAfter;
+
+	/** The wordcount. */
+	private int wordcount = 0;
+
+	/** The pagecount. */
+	private int pagecount = 0;
+
+	/** The wordmax. */
+	private int wordmax = 0;
+
+	/** The wordid. */
+	private String wordid;
+
+	/** The first word. */
+	private boolean firstWord = true;
+
+	/** The wordvalue. */
+	private String wordvalue;
+
+	/** The interpvalue. */
+	private String interpvalue;
+
+	/** The lastword. */
+	private String lastword = " ";
+
+	/** The wordtype. */
+	private String wordtype;
+
+	/** The flagform. */
+	private boolean flagform = false;
+
+	/** The flaginterp. */
+	private boolean flaginterp = false;
+
+	/** The url. */
+	private URL url;
+
+	/** The input data. */
+	private def inputData;
+
+	/** The factory. */
+	private def factory;
+
+	/** The parser. */
+	private XMLStreamReader parser;
+
+	/** The writer. */
+	private OutputStreamWriter writer;
+
+	/** The multiwriter. */
+	private OutputStreamWriter multiwriter = null;
+	StaxStackWriter pagedWriter = null;
+
+	/** The infile. */
+	private File infile;
+
+	/** The outfile. */
+	private File outfile;
+	private File outDir;
+
+	/** The pages. */
+	ArrayList<File> pages = new ArrayList<File>();
+
+	/** The idxstart. */
+	ArrayList<String> idxstart = new ArrayList<String>();
+
+	/** The titre id. */
+	private String titreId;
+
+	private String basename;
+	private String textname;
+
+	private def xpathProperties;
+
+	/**
+	 * Instantiates a new pager.
+	 *
+	 * @param infile the file to convert
+	 * @param outfile the result file
+	 * @param NoSpaceBefore the punctuation marks that don't have a space before
+	 * @param NoSpaceAfter the punctuation marks that don't have a space after
+	 * @param max the max number of word per page
+	 */
+	pager(File infile, File outDir, String textname, List<String> NoSpaceBefore,
+	List<String> NoSpaceAfter, int max, String basename, Properties xpathprops) {
+		this.wordmax = max;
+		this.NoSpaceBefore = NoSpaceBefore;
+		this.NoSpaceAfter = NoSpaceAfter;
+		this.basename = basename;
+		this.textname = textname;
+		this.outDir = outDir;
+		this.xpathProperties = xpathprops;
+		this.url = infile.toURI().toURL();
+		this.infile = infile;
+
+		inputData = url.openStream();
+		factory = XMLInputFactory.newInstance();
+		parser = factory.createXMLStreamReader(inputData);
+		process();
+	}
+
+	private def closeMultiWriter()
+	{
+		if (pagedWriter != null) {
+			def tags = pagedWriter.getTagStack().clone();
+
+			if (firstWord) { // there was no words
+				this.idxstart.add("w_0")
+				pagedWriter.write("<span id=\"w_0\"/>");
+			}
+			pagedWriter.writeEndElements();
+			pagedWriter.close();
+			return tags;
+		} else {
+			return [];
+		}
+	}
+
+	/**
+	 * Creates the next output.
+	 *
+	 * @return true, if successful
+	 */
+	private boolean createNextOutput()
+	{
+		wordcount = 0;
+		try {
+			def tags = closeMultiWriter();
+			for (int i = 0 ; i < tags.size() ; i++) {
+				String tag = tags[i]
+				if ("body" != tag) {
+					tags.remove(i--)
+				} else {
+					tags.remove(i--) // remove "body"
+					break; // remove elements until "body tag
+				}
+			}
+			File outfile = new File(outDir, textname+"_"+(++pagecount)+".html")
+			pages.add(outfile);
+			firstWord = true; // waiting for next word
+
+			pagedWriter = new StaxStackWriter(outfile, "UTF-8");
+
+			pagedWriter.writeStartDocument("UTF-8", "1.0")
+			pagedWriter.writeStartElement("html")
+			pagedWriter.writeEmptyElement("meta", ["http-equiv":"Content-Type", "content":"text/html","charset":"UTF-8"]);
+			pagedWriter.writeStartElement("head")
+			pagedWriter.writeStartElement("title")
+			pagedWriter.writeCharacters(basename.toUpperCase()+" - "+textname+" - Edition - Page "+pagecount)
+			pagedWriter.writeEndElement() // </title>
+			pagedWriter.writeEndElement() // </head>
+			pagedWriter.writeStartElement("body") //<body>
+			pagedWriter.writeStartElements(tags);
+			return true;
+		} catch (Exception e) {
+			System.out.println(e.getLocalizedMessage());
+			return false;
+		}
+	}
+
+	/**
+	 * Creates the output.
+	 *
+	 * @param outfile the outfile
+	 * @return true, if successful
+	 */
+	private boolean createOutput(File outfile) {
+		try {
+			return createNextOutput();
+		} catch (Exception e) {
+			System.out.println(e.getLocalizedMessage());
+			return false;
+		}
+	}
+
+	/**
+	 * Gets the page files.
+	 *
+	 * @return the pages create during the processing
+	 */
+	public ArrayList<File> getPageFiles() {
+		return pages;
+	}
+
+	/**
+	 * Gets the idx.
+	 *
+	 * @return the word's indexes
+	 */
+	public ArrayList<String> getIdx() {
+		return idxstart;
+	}
+
+	/**
+	 * process the infile.
+	 */
+	void process() {
+		String localname = "";
+
+		boolean closeTitre = false;
+		boolean closeAmen = false;
+
+		boolean flagchoice = false;
+		boolean flagcorr = false;
+		boolean flagsic = false;
+		boolean flagreg = false;
+		boolean flagexpan = false;
+		boolean flagorig = false;
+		boolean flagabbr = false;
+		boolean flagforeign = false;
+		int levelSupplied = 0;
+		boolean flagSurplus = false;
+		boolean flagDel = false;
+
+		// option for metadata from BFM TEI header
+		def mValues = [:];
+		def xpathprocessor = new XPathResult(infile)
+		for (String name : xpathProperties.keySet()) {
+			String value = xpathprocessor.getXpathResponse(xpathProperties.get(name), "N/A");
+			mValues.put(name, value.replace("\n", " "));
+		}
+		if (mValues.containsKey("forme") && !mValues.get("forme").equals("N/A")) {
+			if (mValues.get("forme").startsWith("#forme_")) {
+				mValues.put("forme", mValues.get("forme").substring(7));
+			} else if (mValues.get("forme").startsWith("#")) {
+				mValues.put("forme", mValues.get("forme").substring(1));
+			} else {
+				mValues.put("forme", mValues.get("forme"));
+			}
+		}
+		createNextOutput();
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next())
+		{
+			switch (event) {
+				case XMLStreamConstants.START_ELEMENT:
+					localname = parser.getLocalName();
+					switch (localname) {
+						case "text":
+							pagedWriter.writeStartElement("h1",
+							["align":"center", "style":"color:darkviolet;font-family:Times;font-weight:bold;font-style:italic;font-size=200%", "class":"text"])
+							pagedWriter.writeCharacters(mValues.get("titre"))
+							pagedWriter.writeEndElement(); // h1
+							pagedWriter.writeStartElement("p")
+							pagedWriter.writeEmptyElement("hr")
+							pagedWriter.writeCharacters("auteur : "+mValues.get("auteur"))
+							pagedWriter.writeEmptyElement("br");
+							pagedWriter.writeCharacters("date de composition : "+mValues.get("datecompolibre"));
+							pagedWriter.writeEmptyElement("br");
+							pagedWriter.writeCharacters("domaine : "+mValues.get("domaine"))
+							pagedWriter.writeEmptyElement("br");
+							pagedWriter.writeCharacters("genre : "+mValues.get("genre"))
+							pagedWriter.writeEmptyElement("br");
+							pagedWriter.writeCharacters("forme : "+mValues.get("forme"))
+							pagedWriter.writeEmptyElement("br");
+							pagedWriter.writeCharacters("dialecte : "+mValues.get("dialecte"))
+							pagedWriter.writeEmptyElement("br");
+							pagedWriter.writeEmptyElement("hr")
+							pagedWriter.writeEndElement(); // p
+							break;
+						case "head":
+							pagedWriter.writeStartElement("h2")
+							break;
+						case "lg":
+						case "p":
+							pagedWriter.writeStartElement("p")
+							break;
+						case "pb":
+							createNextOutput();
+							if (parser.getAttributeValue(null,"n") != null) {
+								pagedWriter.writeStartElement("p", ["style":"color:red", "align":"center"]);
+								pagedWriter.writeCharacters("- "+parser.getAttributeValue(null,"n")+" -")
+								pagedWriter.writeEndElement() // p
+							}
+							break;
+
+						case "ab":
+							if (parser.getAttributeValue(null,"n") != null) {
+								pagedWriter.writeStartElement("p", ["align":"center"]);
+								pagedWriter.writeCharacters(parser.getAttributeValue(null,"n"))
+								pagedWriter.writeEndElement() // p
+							}
+							break;
+						case "l":
+							pagedWriter.writeEmptyElement("br");
+							break;
+						case "div":
+							if (parser.getAttributeValue(null,"type") == "titre") {
+								pagedWriter.writeStartElement("h3")
+								closeTitre = true;
+							} else if (parser.getAttributeValue(null,"type") == "amen") {
+								pagedWriter.writeStartElement("h3")
+								closeAmen = true;
+							}
+							break;
+						case "w":
+							interpvalue = "";
+							for (int i = 0 ; i < parser.getAttributeCount(); i++) {
+								if (parser.getAttributeLocalName(i).equals("type")) {
+									interpvalue = " pos: "+parser.getAttributeValue(i);
+								}
+							}
+							wordid = parser.getAttributeValue(null, "id");
+
+							if (firstWord) {
+								firstWord = false;
+								this.idxstart.add(wordid);
+							}
+							wordcount++;
+							if (wordcount >= wordmax) {
+								createNextOutput();
+							}
+							break;
+
+						case "choice":
+							flagchoice = true;
+							break;
+						case "corr":
+							flagcorr = true;
+							break;
+						case "sic":
+							flagsic = true;
+							break;
+						case "reg":
+							flagreg = true;
+							break;
+						case "orig":
+							flagorig = true;
+							break;
+						case "foreign":
+							flagforeign = true;
+							break;
+						case "supplied":
+							levelSupplied = levelSupplied +1;
+							if(flagform)
+								wordvalue = wordvalue+"[";
+							break;
+
+						case "surplus":
+							flagSurplus = true;
+							pagedWriter.writeStartElement("span", ["class": "surplus", "style":"color:red;"])
+							break;
+
+						case "del":
+							flagDel = true;
+							pagedWriter.writeStartElement("span", ["class": "del", "style":"color:red;text-decoration:line-through;"])
+							break;
+
+						case "ana":
+							flaginterp=true;
+							interpvalue+=" "+parser.getAttributeValue(null,"type").substring(1)+":"
+							break;
+
+						case "form":
+							wordvalue="";
+							flagform=true;
+					}
+					break;
+				case XMLStreamConstants.END_ELEMENT:
+					localname = parser.getLocalName();
+					switch (localname) {
+						case "head":
+							pagedWriter.writeEndElement() // h2
+							break;
+
+						case "div":
+							if (closeTitre) {
+								pagedWriter.writeEndElement() // h3
+								closeTitre = false;
+							} else if(closeAmen) {
+								pagedWriter.writeEndElement() // h3
+								closeTitre = false;
+							}
+							break;
+
+						case "lb":
+							pagedWriter.writeEmptyElement("br")
+							break;
+						case "lg":
+						case "p":
+							pagedWriter.writeEndElement() // p
+							break;
+
+						case "choice":
+							flagchoice = false;
+							break;
+						case "corr":
+							flagcorr = false;
+							break;
+						case "sic":
+							flagsic = false;
+							break;
+						case "reg":
+							flagreg = false;
+							break;
+						case "orig":
+							flagorig = false;
+							break;
+						case "foreign":
+							flagforeign = false;
+							break;
+						case "supplied":
+							levelSupplied = levelSupplied -1;
+							if (flagform)
+								wordvalue = wordvalue+"]";
+							break;
+						case "surplus":
+							flagSurplus = false;
+							pagedWriter.writeCharacters(")")
+							pagedWriter.writeEndElement() // span
+							break;
+
+						case "del":
+							flagDel = false;
+							pagedWriter.writeEndElement() // span
+							break;
+
+						case "form":
+							flagform = false
+							break;
+
+						case "ana":
+							flaginterp = false
+							break;
+
+						case "w":
+							int l = lastword.length();
+							String color = "";
+							if (flagcorr)
+								color = "color: green;";
+							else if (flagreg)
+								color = "color: darkgreen;";
+							else if (flagforeign)
+								color = "color: darkred;";
+							else if (levelSupplied == 1)
+								color = "color: blue;";
+							else if (levelSupplied == 2)
+								color = "color: darkblue;";
+							if (!flagchoice || flagcorr || flagreg) {
+								String endOfLastWord = "";
+								if (l > 0)
+									endOfLastWord = lastword.subSequence(l-1, l);
+
+								if (NoSpaceBefore.contains(wordvalue) ||
+								NoSpaceAfter.contains(lastword) ||
+								wordvalue.startsWith("-") ||
+								NoSpaceAfter.contains(endOfLastWord))
+								{
+									//multiwriter.write("<span title=\""+interpvalue+"\" id=\""+wordid+"\" "+color+">");
+								} else {
+									//multiwriter.write(" <span title=\""+interpvalue+"\" id=\""+wordid+"\" "+color+">");
+									pagedWriter.writeCharacters(" ")
+								}
+								
+								pagedWriter.writeStartElement("span", ["title":interpvalue, "id":wordid, "style":color]) // span
+								pagedWriter.writeCharacters(wordvalue) 
+								pagedWriter.writeEndElement() // span
+								lastword=wordvalue;
+							}
+							break;
+					}
+					break;
+
+				case XMLStreamConstants.CHARACTERS:
+					if (flagform && parser.getText().length() > 0)
+							wordvalue += (parser.getText());
+					if (flaginterp && parser.getText().length() > 0)
+							interpvalue += (parser.getText());
+					break;
+			}
+		}
+		closeMultiWriter();
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/bfm/BuildBiblio.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/bfm/BuildBiblio.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/bfm/BuildBiblio.groovy	(revision 258)
@@ -0,0 +1,193 @@
+// 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
+// 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.
+
+//
+// This file is part of the TXM platform.
+//
+// The TXM platform is free software: you can redistribute it and/or modif y
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 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/>.
+// 
+// 
+// 
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+package org.txm.importer.bfm;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStreamReader;
+import java.nio.charset.Charset;
+import org.txm.utils.*;
+
+import javax.xml.stream.*;
+import java.net.URL;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class BuildBiblio.
+ */
+class BuildBiblio {
+	
+	/**
+	 * Process.
+	 *
+	 * @param csvfile the csvfile
+	 * @param separator the separator
+	 * @param encoding the encoding
+	 * @param outputfile the outputfile
+	 * @param buildIndex the build index
+	 * @return true, if successful
+	 */
+	public static boolean process(File csvfile, String separator, String encoding, File outputfile, boolean buildIndex) {
+		if(!(csvfile.exists() && csvfile.canRead()))
+		{
+			println "csvfile does not exist"
+			return false;
+		}
+		
+		if(!outputfile.getParentFile().exists())
+		{
+			println "outpurfile's parent does not exist"
+			return false;
+		}
+		
+		CsvReader csvreader = new CsvReader(csvfile.getAbsolutePath(), separator.charAt(0), Charset.forName(encoding))
+		
+		XMLOutputFactory factory = XMLOutputFactory.newInstance();
+		FileOutputStream output = new FileOutputStream(outputfile)
+		XMLStreamWriter writer = factory.createXMLStreamWriter(output, "UTF-8");
+		
+		if(csvreader == null)
+		{
+			println "failed to build csvreader"
+			return false;
+		}
+		
+		writer.writeStartDocument("UTF-8","1.0");
+		writer.writeStartElement("html");
+		//header
+		writer.writeStartElement("head");
+		//writer.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/>");
+		writer.writeStartElement("meta");
+		writer.writeAttribute("http-equiv","Content-Type");
+		writer.writeAttribute("content","text/html");
+		writer.writeAttribute("charset","UTF-8");
+		writer.writeEndElement();//meta
+		writer.writeStartElement("title");
+		writer.writeCharacters("Fiches biblio BFM")
+		writer.writeEndElement();//title
+		writer.writeEndElement();//head
+		
+		//get titles
+		csvreader.readHeaders();
+		def titles = [];
+		for(String title : csvreader.getHeaders())
+		{
+			titles << title
+		}
+		
+		writer.writeStartElement("body");
+		
+		if(buildIndex)
+		{
+		writer.writeStartElement("ul");
+		while (csvreader.readRecord()){
+			
+			writer.writeStartElement("li");
+			writer.writeStartElement("a");
+			writer.writeAttribute("href", "#"+csvreader.get("id"))
+			writer.writeCharacters(csvreader.get("id"))
+			writer.writeEndElement();//a
+			writer.writeEndElement();//li			
+		}
+		writer.writeEndElement();//ul
+		}
+		
+		println "Metadata declared: "+titles
+		csvreader = new CsvReader(csvfile.getAbsolutePath(), separator.charAt(0), Charset.forName(encoding))
+		csvreader.readHeaders();
+		while (csvreader.readRecord()){
+			writer.writeStartElement("div");
+			writer.writeAttribute("class", "fiche");
+			
+			writer.writeStartElement("a")
+			writer.writeAttribute("name", csvreader.get("id"));
+			writer.writeEndElement();//a
+			
+			writer.writeStartElement("h1");
+			String auteur = csvreader.get("Auteur")
+			String titre = csvreader.get("Titre")
+			if(auteur != null && auteur != "anonyme")
+				writer.writeCharacters(auteur+", ")
+			writer.writeCharacters(titre);
+			writer.writeEndElement();//h1
+			
+			writer.writeStartElement("ul");
+			for (int i = 0 ; i < titles.size() ; i++) {
+				writer.writeStartElement("li");
+				writer.writeStartElement("b");
+				writer.writeCharacters(titles.get(i)+" : ")
+				writer.writeEndElement();
+				
+				writer.writeCharacters(csvreader.get(titles.get(i)))
+				writer.writeEndElement();//li
+			}
+			
+			writer.writeEndElement();//ul
+			writer.writeEndElement();//div
+		}
+		
+		writer.writeEndElement();//body
+		writer.close();
+		output.close()
+		return true;
+	}
+	
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args)
+	{
+		File csvfile = new File("C:\\Documents and Settings\\alavrent\\Mes documents\\bfm - local\\Bases bibliographiques (copie)\\Fiches_biblio_TXM.txt")
+		File outputfile = new File("C:\\Documents and Settings\\alavrent\\Mes documents\\bfm - local\\Bases bibliographiques (copie)\\Fiches_biblio_TXM.html")
+		String separator = "\t"
+		String encoding = "cp1252"
+		
+		if(!BuildBiblio.process(csvfile, separator, encoding, outputfile, false))
+			println("Error.")
+		else
+			println "Success";
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/bfm/BuildBiblioFromHeaders.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/bfm/BuildBiblioFromHeaders.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/bfm/BuildBiblioFromHeaders.groovy	(revision 258)
@@ -0,0 +1,125 @@
+package org.txm.importer.bfm;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStreamReader;
+import java.nio.charset.Charset;
+import org.txm.utils.*;
+import org.txm.importer.*;
+
+import javax.xml.stream.*;
+import java.net.URL;
+	
+
+String xslfile = "G:\\Feuilles de style\\teiHeader2ficheBiblio.xsl";
+ApplyXsl a = new ApplyXsl(xslfile);
+
+File srcdirectory = new File("C:\\Documents and Settings\\alavrent\\TXM-SRC\\corptef")
+File outdirectory = new File("C:\\Documents and Settings\\alavrent\\TXM-SRC\\corptef-biblio")
+outdirectory.mkdir();
+assert(srcdirectory.exists())
+assert(outdirectory.exists())
+assert(srcdirectory.isDirectory())
+assert(srcdirectory.canRead())
+assert(srcdirectory.canExecute())
+
+List<File> files = srcdirectory.listFiles();
+
+files = files.findAll{item-> item.getName().endsWith(".xml")}
+
+long bigstart = System.currentTimeMillis()
+for(File infile : files)
+{
+	String outfile = outdirectory.getAbsolutePath()+"/"+infile.getName().substring(0,infile.getName().length()-4)+"-biblio.html";
+	if(infile.canRead())
+	{
+		long start = System.currentTimeMillis()
+		println "Process : "+infile.getName()
+		// String[] params = ["pbval1",1,"pbval2",2];
+		a.process(infile.getAbsolutePath(), outfile); // no parameters
+		// a.process( infile.getAbsolutePath(),outfile,params);
+		println "Done : "+(System.currentTimeMillis()-start)+"ms"
+	}
+}
+println "Total time : "+(System.currentTimeMillis()-bigstart)+"ms"
+/*
+class BuildBiblioFromHeaders {
+	
+	public static boolean process(File dir, File xslfile, File outputfile) {
+		if(!(xslfile.exists() && xslfile.canRead()))
+		{
+			println "xslfile does not exist"
+			return false;
+		}
+		
+		if(!outputfile.getParentFile().exists())
+		{
+			println "outputfile's parent does not exist"
+			return false;
+		}
+		
+		
+		
+		XMLOutputFactory factory = XMLOutputFactory.newInstance();
+		FileOutputStream output = new FileOutputStream(outputfile)
+		XMLStreamWriter writer = factory.createXMLStreamWriter(output, "UTF-8");
+		
+		
+		writer.writeStartDocument("UTF-8","1.0");
+		writer.writeStartElement("html");
+		//header
+		writer.writeStartElement("head");
+		//writer.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/>");
+		writer.writeStartElement("meta");
+		writer.writeAttribute("http-equiv","Content-Type");
+		writer.writeAttribute("content","text/html");
+		writer.writeAttribute("charset","UTF-8");
+		writer.writeEndElement();//meta
+		writer.writeStartElement("title");
+		writer.writeCharacters("Fiches biblio BFM")
+		writer.writeEndElement();//title
+		writer.writeEndElement();//head
+		
+		writer.writeStartElement("body");
+		
+		String rootDir = dir.getAbsolutePath()+"/";
+		
+		List<File> files = new File(rootDir,"").listFiles();//scan directory split
+		
+		for(File f : files) {
+			
+//			ApplyXsl a = new ApplyXsl(xslfile.getAbsolutePath());
+//			String[] args = ["outputDir",xxx];
+//			a.process(f.getAbsolutePath(), "./HTML",args);
+			
+			
+
+		}
+		
+		
+		writer.writeEndElement();//body
+		writer.close();
+		return true;
+	}
+	
+	
+	
+	public static void main(String[] args)
+	{
+	
+		String rootDir;
+		String htmloutdir;
+		File dir = new File(rootDir);
+		
+		rootDir = "C:\\Documents and Settings\\alavrent\\TXM-SRC\\corptef";
+		File xslfile = new File("G:\\Feuilles de style\\teiHeader2ficheBiblio.xsl")
+		File outputfile = new File("C:\\Documents and Settings\\alavrent\\Mes documents\\bfm - local\\Bases bibliographiques (copie)\\Fiches_biblio_TXM_test.html")
+
+		
+		if(!BuildBiblioFromHeaders.process(xslfile, outputfile, false))
+			println("Error.")
+		else
+			println "Success";
+	}
+}
+*/
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/importer/bfm/importer.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/bfm/importer.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/bfm/importer.groovy	(revision 258)
@@ -0,0 +1,303 @@
+// 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
+// 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.
+//
+//
+//
+// $LastChangedDate: 2016-05-11 08:38:47 +0200 (Wed, 11 May 2016) $
+// $LastChangedRevision: 3211 $
+// $LastChangedBy: mdecorde $
+//
+package org.txm.importer.bfm;
+
+import org.txm.importer.*;
+import org.txm.importer.filters.*;
+import org.txm.scripts.*;
+import org.txm.scripts.teitxm.*;
+import org.txm.utils.io.FileCopy;
+import org.txm.utils.treetagger.TreeTagger;
+
+import javax.xml.stream.*;
+
+import java.io.File;
+import java.net.URL;
+import java.util.Properties;
+
+import org.txm.*;
+
+import filters.CutHeader.*;
+import filters.ReunitBrokenWords.*;
+import filters.Tokeniser.*;
+import filters.TagSentences.*;
+import filters.FusionHeader.*;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Convert TEI-BFM to TEI-TXM: <br/>
+ * 1- tokenize : manage BFM's &lt;choice> policy (see <a
+ * href="http://bfm.ens-lsh.fr">BFM website</a>).<br/>
+ * 2- launch XML2TEITXM.groovy with no annotation to import. <br/>
+ *
+ * @param dir contains the sources files
+ * @param basename the basename
+ * @return true, if successful
+ * @author mdecorde
+ */
+class importer {
+	
+	public boolean run(File srcDir, File binDir, File txmDir, String basename, Properties metadataXPath)
+	{
+		new File(binDir, "ptokenized").deleteDir();
+		new File(binDir, "ptokenized").mkdir();
+		new File(binDir, "tokenized").deleteDir();
+		new File(binDir, "tokenized").mkdir();
+		new File(binDir, "headers").deleteDir();
+		new File(binDir, "headers").mkdir();
+
+		ArrayList<String> milestones = new ArrayList<String>();
+		milestones.add("lb");
+		milestones.add("pb");
+		milestones.add("milestone");
+
+		List<File> files = txmDir.listFiles();
+		if (files == null || files.size() == 0) return false;
+
+		for (int i = 0 ; i < files.size() ; i++)
+			if (!(files.get(i).getName().endsWith(".xml"))
+			|| files.get(i).getName().equals("import.xml"))
+				files.remove(i--);
+
+		for (File f : files) {
+			//System.out.println("Get metadata from file $xpathfile");
+			HashMap<String, String> metadataValues = new HashMap<String, String>();
+			if (metadataXPath != null) {
+				def xpathprocessor = new XPathResult(f)
+				for (String name : metadataXPath.keySet()) {
+					String value = xpathprocessor.getXpathResponse(metadataXPath.get(name), "N/A");
+					value = value.trim().replace("\n", " ");
+					//println "xpath: "+metadataXPath.get(name)+" >> "+value.trim()
+					metadataValues.put(name, value);
+				}
+				xpathprocessor.close();
+			}
+			
+			//forme is mandatory !!!
+			String forme = "prose";
+			if (metadataValues.containsKey("forme")) {
+				String tmp = metadataValues.get("forme");
+				if (tmp.startsWith("#forme_"))
+					tmp = tmp.substring(7)
+				metadataValues.put("forme", tmp)
+				forme = metadataValues.get("forme");
+			}
+
+			if (metadataValues.containsKey("morphosynt")) {
+				//println "MORPHOSYNT: "+metadataValues.get("morphosynt");
+				if (metadataValues.get("morphosynt").equals("N/A"))
+					metadataValues.put("morphosynt","non vérifié");
+				else
+					metadataValues.put("morphosynt","vérifié");
+			}
+
+			String txtname = f.getName().substring(0, f.getName().length()-4);
+			String titreId = txtname;
+			if (metadataValues.containsKey("sigle")) {
+				titreId = metadataValues.get("sigle");
+			} else if (metadataValues.containsKey("idbfm")) {
+				titreId = metadataValues.get("idbfm");
+			}
+			metadataValues.put("sigle", titreId);
+			
+			// inject attributes in $f
+			AddAttributeInXml builder = new AddAttributeInXml(f, "text", metadataValues);
+			builder.onlyOneElement();
+			//println "INJECTING $metadataValues"
+			File outfile = new File(txmDir, "copy"+f.getName())
+			
+			if (!builder.process(outfile)) {
+				println "Error while injecting metadata in $f"
+				return false;
+			}
+			builder= null;
+			if (f.delete()) {
+				outfile.renameTo(f)
+			} else {
+				println "ERROR could not delete $f for metadatainjection"
+				return false
+			}
+		}
+
+		files = txmDir.listFiles();
+		if (files == null || files.size() == 0) return false;
+		
+		//return false; // TEMP TEMP TEMP
+		
+		//PREPARE EACH FILE TO BE TOKENIZED
+		println("preparing "+files.size()+" files for the tokenizer");
+
+		for (File f : files) {
+			if (f.isDirectory()) continue;
+			print "."//+f.getAbsolutePath()
+			File srcfile = f;
+			File resultfile = new File(binDir,"ptokenized/"+f.getName());
+
+			def builder2 = new OneTagPerLine(srcfile.toURI().toURL(), milestones);
+			if (!builder2.process(resultfile)) {
+				println "Failed to tokenize file: "+f;
+				resultfile.delete();
+			}
+		}
+		println ""
+
+		//TOKENIZE FILES
+		files = new File(binDir, "ptokenized").listFiles();//scan directory split
+		println("Tokenizing "+files.size()+" files")
+		for (File infile : files) {
+			print "."
+			try {
+				Sequence S = new Sequence();
+				Filter F1 = new CutHeader();
+				Filter F2 = new ReunitBrokenWords();
+				Filter F6 = new Tokeniser(infile);
+				Filter F7 = new TagSentences();
+				Filter F11 = new FusionHeader();
+				S.add(F1);
+				//S.add(F2);
+				S.add(F6);
+				//S.add(F7);
+				S.add(F11);
+
+				File xmlfile = new File(binDir,"tokenized/"+infile.getName());
+
+				S.SetInFileAndOutFile(infile.getAbsolutePath(), xmlfile.getAbsolutePath());
+				S.setEncodages("UTF-8","UTF-8");
+
+				Object[] arguments1 = [new File(binDir,"/headers/"+infile.getName()+"header.xml").getAbsolutePath()];
+				F1.SetUsedParam(arguments1);
+				Object[] arguments2 = [new File(binDir,"/headers/"+infile.getName()+"header.xml").getAbsolutePath(),F1];
+				F11.SetUsedParam(arguments2);
+
+				S.proceed();
+				S.clean();
+			} catch(Exception e) {
+				org.txm.utils.logger.Log.printStackTrace(e);
+				return false;
+			}
+		}
+		println ""
+
+
+		files = new File(binDir,"tokenized").listFiles()
+		println "Validating XML of "+files.size()+" files"
+		for (File f : files) {
+			print "."
+			if (!ValidateXml.test(f)) {
+				System.out.println("XML NOT VALID "+f);
+				new File(binDir, "tokenizerError").mkdir();
+				FileCopy.copy(f,new File(binDir, "tokenizerError/"+f.getName()));
+				f.delete();
+			}
+		}
+		println("");
+
+		//TRANSFORM INTO XML-TEI-TXM
+		files = new File(binDir, "tokenized").listFiles()
+		println("Building xml-tei-txm "+files.size()+ " files")
+		if (files.size() == 0) return false;
+		for (File file : files) {
+			print "."
+			String txmfile = file.getName();
+
+			def correspType = new HashMap<String,String>()
+			def correspRef = new HashMap<String,String>()
+
+			//il faut lister les id de tous les respStmt
+			def respId = [];
+			//fait la correspondance entre le respId et le rapport d'execution de l'outil
+			def applications = new HashMap<String,HashMap<String,String>>();
+			//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[]>();
+			//associe un id d'item avec sa description et son URI
+			def itemsURI = new HashMap<String,HashMap<String,String>>();
+			//informations de respStmt
+			//resps (respId <voir ci-dessus>, [description, person, date])
+			def resps = new HashMap<String,String[]>();
+
+			//lance le traitement
+			def builder3 = new Xml2Ana(file);
+			builder3.setCorrespondances(correspRef, correspType);
+			builder3.setHeaderInfos(respId,resps, applications, taxonomiesUtilisees, itemsURI)
+			if (!builder3.process(new File(txmDir,txmfile))) {
+				println "Failed to build xml-txm file from file: "+file;
+				return false;
+			}
+		}
+		println("")
+		return true;
+	}
+
+	/**
+	 * for test purpose.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args) {
+		long start = System.currentTimeMillis();
+		File dir = new File("/home/mdecorde/xml/qgraal")
+		File srcfile = new File(dir, "qgraal_cm-detoken.xml");
+		File resultfile = new File(dir,"QGRAALFRO-pt1.xml");
+		File xmlfile = new File(dir,"QGRAALFRO-t1.xml");
+
+		def builder2 = new OneTagPerLine(srcfile.toURI().toURL(), []);
+		if (!builder2.process(resultfile)) {
+			println "Failed to tokenize file: "+srcfile;
+			resultfile.delete();
+		}
+
+		try {
+			Sequence S = new Sequence();
+			Filter F1 = new CutHeader();
+			Filter F2 = new ReunitBrokenWords();
+			Filter F6 = new Tokeniser(resultfile);
+			Filter F7 = new TagSentences();
+			Filter F11 = new FusionHeader();
+			S.add(F1);
+			//S.add(F2);
+			S.add(F6);
+			//S.add(F7);
+			//S.add(F11);
+
+			S.SetInFileAndOutFile(resultfile.getAbsolutePath(), xmlfile.getAbsolutePath());
+			S.setEncodages("UTF-8","UTF-8");
+
+			Object[] arguments1 = [new File(dir,"header.xml").getAbsolutePath()];
+			F1.SetUsedParam(arguments1);
+			Object[] arguments2 = [new File(dir,"header.xml").getAbsolutePath(),F1];
+			F11.SetUsedParam(arguments2);
+
+			S.proceed();
+			S.clean();
+		} catch(Exception e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+		println "time: "+(System.currentTimeMillis()-start)/1000
+	}
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/importer/CleanFile.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/CleanFile.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/CleanFile.groovy	(revision 258)
@@ -0,0 +1,96 @@
+// 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
+// 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.
+
+//
+// This file is part of the TXM platform.
+//
+// The TXM platform is free software: you can redistribute it and/or modif y
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 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/>.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer;
+
+import java.io.BufferedWriter;
+import java.io.File;
+
+// TODO: Auto-generated Javadoc
+/**
+ * remove all ctrl char and replace \t by ' '.
+ *
+ * @param infile : the file to process
+ * @param encoding : the encoding of the file
+ */
+class CleanFile {
+	public CleanFile(File infile, String encoding){
+		Reader reader = new BufferedReader(new InputStreamReader(new FileInputStream(infile),encoding));
+		File outfile = File.createTempFile("filecleaner","123456", infile.getParentFile());
+		Writer writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outfile), "UTF-8"));
+		String line = reader.readLine();
+		while(line != null)
+		{
+			writer.write(clean(line) +"\n")
+			line = reader.readLine();
+		}
+		writer.close();
+		reader.close();
+		
+		infile.delete(); // erase old file
+		outfile.renameTo(infile); // rename the copy
+	}
+
+	/**
+	 * Clean.
+	 *
+	 * @param str the str
+	 * @return the string
+	 */
+	public static String clean(String str) {
+		str = str.replace("\t", " ");// replace \t by ' '
+		str = str.replaceAll("\\p{Cntrl}", ""); // remove all ctrl char
+		return str;
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args){
+		File infile = new File("C:\\Documents and Settings\\H\\xml\\cleaner\\test.txt")		
+		String encoding = "CP1252";
+		new CleanFile(infile, encoding);
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/Alceste2Xml.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/Alceste2Xml.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/Alceste2Xml.groovy	(revision 258)
@@ -0,0 +1,294 @@
+// 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
+// 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.
+//
+//
+//
+// $LastChangedDate: 2017-01-24 18:11:42 +0100 (Tue, 24 Jan 2017) $
+// $LastChangedRevision: 3400 $
+// $LastChangedBy: mdecorde $
+//
+package org.txm.importer;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.txm.utils.AsciiUtils;
+import org.txm.utils.CharsetDetector;
+import org.txm.utils.i18n.DetectBOM;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+
+import javax.xml.stream.*;
+import java.net.URL;
+
+
+// TODO: Auto-generated Javadoc
+/**
+ * Create a file per text of an alceste file.
+ */
+class Alceste2Xml {
+
+	/** The textno. */
+	String textno = "0001";
+
+	/** The textcount. */
+	int textcount = 0;
+	int nbOfStarNumbers;
+	static def TEXTNUMBERREGEX = /^[0-9]{4,6} .+/
+	static def TEXTSTARREGEX = /^[*]{4,6} .+/
+	/**
+	 * run the script.
+	 *
+	 * @param infile the infile
+	 * @param outdir the outdir
+	 * @param encoding the encoding
+	 */
+	public boolean run(File infile, File outdir, String encoding) {
+		if (encoding == "??") {
+			encoding = new CharsetDetector(infile).getEncoding();
+			println "Guessing encoding of $infile : $encoding"
+		}
+		int noline = 0;
+		int p_n = 1;
+		int lb_n = 1;
+		def duplicatedAttributes = new HashSet<String>();
+		try {
+			outdir.mkdir();
+			boolean star = guessStar(infile, encoding);
+
+			String textname = infile.getName().substring(0,infile.getName().length()-4);// creates file with prefix the name of the alceste file
+
+			FileInputStream input = new FileInputStream(infile);
+			Reader reader = new InputStreamReader(input , encoding);
+
+			DetectBOM bomdetector = new DetectBOM(infile);
+			for (int ibom = 0 ; ibom < bomdetector.getBOMSize() ; ibom++) input.read()
+			
+			XMLOutputFactory factory = XMLOutputFactory.newInstance();
+			BufferedOutputStream output;
+			XMLStreamWriter writer;
+
+			String line = reader.readLine();
+			while (line != null) {
+				line = CleanFile.clean(line);
+				
+				if (((line ==~ TEXTNUMBERREGEX) || line ==~ TEXTSTARREGEX) && line.contains("*")) { // we found a text declaration with star attributes
+					if (writer != null) { // end previous text if any
+						writer.writeEndElement(); // p
+						writer.writeEndElement(); // text
+						writer.close();
+						output.close()
+					}
+					
+					lb_n = 1; // reset line counter
+					p_n = 1; // reset paragraph counter
+					int idx = line.indexOf(" "); // star metadata starts after the first ' '
+					
+					if (!star) {
+						textno = line.substring(0, idx)
+						textcount++;
+					} else {
+						this.buildNextId(); // update textno
+					}
+
+					String filename = textno;
+					def attributes = new LinkedHashMap<String, String>();
+					filename = filename.trim();
+					output = new BufferedOutputStream(new FileOutputStream(new File(outdir, filename+".xml")))
+					writer = factory.createXMLStreamWriter(output, "UTF-8"); //create a new file
+					writer.writeStartDocument("UTF-8", "1.0")
+					writer.writeStartElement("text");
+					
+					attributes["id"] = filename // writen at the end
+					// get text metadata
+					line = line.substring(idx + 1); // remove the text marker
+					
+					String[] splited = line.split("\\*");
+					for (String s1 : splited) { // for each text star metadata
+						s1 = s1.trim();
+						if (s1.length() == 0) continue;
+
+						String[] splited2 = s1.split("_", 2);
+						if (splited2.length == 1) { // attribute without value
+							
+							if (s1.endsWith("0")) {
+								String attrname = s1.substring(0, s1.length()-1); // remove "0"
+								String attrnamebase = attrname = AsciiUtils.buildId(attrname);
+								int c = 2;
+								while (attributes.containsKey(attrname)) {
+									attrname = attrnamebase+(c++)
+								}
+								if (c > 2) duplicatedAttributes.add(attrname);
+								attributes.put(attrname, "N/A")
+							} else {
+								println "Error: attribute: "+s1+ " with line "+line
+							}
+						} else if (splited2.length == 2) {
+							
+							String attrname = splited2[0].toLowerCase()
+							String attrnamebase = attrname = AsciiUtils.buildId(attrname);
+								int c = 2;
+								while (attributes.containsKey(attrname)) {
+									attrname = attrnamebase+(c++)
+								}
+								if (c > 2) duplicatedAttributes.add(attrname);
+							
+							String attrvalue = splited2[1]
+								
+							attributes.put(attrname, attrvalue)
+						} else {
+						
+							print("wrong size: name_value : "+splited2.length+" : ");
+							for (String s : splited ) print s+""
+							println ""
+						}
+					}
+					
+					for (def attname: attributes.keySet()) { // finally write the XML attributes
+						writer.writeAttribute(attname, attributes[attname]);
+					}
+					writer.writeCharacters("\n");
+					writer.writeStartElement("p"); // we create a tag <p>
+					writer.writeAttribute("n", ""+(p_n++));// then we add attributes to the tag
+
+				} else if (line.startsWith("-*")) {
+					println "ignored locution : "+line;
+				} else {
+					if (writer != null) {
+						if (line.length() > 0) {
+							writer.writeEmptyElement("lb");
+							writer.writeAttribute("n", ""+(lb_n++))
+							writer.writeCharacters("\n");
+						} else if (line.trim().length() == 0) {
+							writer.writeEndElement(); // p
+							writer.writeStartElement("p");
+							writer.writeAttribute("n", ""+(p_n++))
+							writer.writeCharacters("\n");
+						}
+						
+						writer.writeCharacters(line);
+					}
+				}
+				line = reader.readLine();
+				noline++;
+			}
+			// the end
+			if (writer != null) { // end last text
+				writer.writeEndElement(); // p
+				writer.writeEndElement(); // text
+
+				reader.close();
+				writer.close();
+				output.close();
+			}
+		} catch(Exception e) {
+			println "Error line : "+noline;
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+		
+		if (duplicatedAttributes.size() > 0){
+			println "Some attributes were duplicated: "+duplicatedAttributes;
+		}
+		
+		if (textcount == 0) {
+			println "Error: no text found in "+infile;
+			return false;
+		}
+		
+		return true;
+	}
+
+	/**
+	 * Builds the next id.
+	 *
+	 * @return the string
+	 */
+	private String buildNextId() {
+		textcount++;
+		textno = ""+textcount;
+		while (textno.length() < nbOfStarNumbers) {
+			textno="0"+textno;
+		}
+		return textno;
+	}
+
+	/**
+	 * allow to guess if the file use **** or 000x format.
+	 *
+	 * @param infile the infile
+	 * @param encoding the file encoding
+	 * @return true, if the text marker is "****"
+	 */
+	private boolean guessStar(File infile, String encoding)
+	{
+		Reader input = new InputStreamReader(new FileInputStream(infile) , encoding);
+		String line = input.readLine();
+		while (line != null) {
+			if (line ==~ /^[0-9]{4,6} .*/) { // 0000
+				int idx = line.indexOf(" ");
+				nbOfStarNumbers = idx;
+				//println "NB NUMBER:" + nbOfStarNumbers
+				input.close();
+				return false;
+			} else if (line ==~ /^[*]{4,6} .*/) { 
+				input.close();
+				int idx = line.indexOf(" ");
+				nbOfStarNumbers = idx;
+				//println "NB STAR:" + nbOfStarNumbers
+				return true;
+			}
+			line = input.readLine();
+		}
+		input.close();
+	}
+
+	/**
+	 * Main.
+	 *
+	 * @param args the args
+	 */
+	static main(args)
+	{
+		//File infile = new File(System.getProperty("user.home")+"/xml/nature/Nature.txt");
+		File infile = new File(System.getProperty("user.home")+"/xml/TESTS2/alceste/Voeux.txt");
+		//File infile = new File("~/xml/geo/src/rivières.txt");
+		File outdir = new File(infile.getParentFile(), "out");
+		outdir.mkdir()
+		new Alceste2Xml().run(infile, outdir, "cp1252");
+		println "done: $infile -> $outdir"
+	}
+}
+
Index: tmp/org.txm.core/src/groovy/org/txm/importer/tmx/compiler.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/tmx/compiler.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/tmx/compiler.groovy	(revision 258)
@@ -0,0 +1,684 @@
+// 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
+// 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.
+//
+//
+//
+// $LastChangedDate: 2017-01-24 18:11:42 +0100 (Tue, 24 Jan 2017) $
+// $LastChangedRevision: 3400 $
+// $LastChangedBy: mdecorde $
+//
+package org.txm.importer.tmx;
+
+import org.txm.importer.cwb.BuildAlignOut;
+import org.txm.importer.cwb.CwbAlign;
+import org.txm.importer.cwb.CwbEncode
+import org.txm.importer.cwb.CwbMakeAll
+import org.txm.importer.cwb.PatchCwbRegistry;
+import org.txm.importer.*;
+import org.txm.scripts.*;
+import org.txm.scripts.teitxm.*;
+import org.txm.utils.logger.Log;
+import org.txm.utils.treetagger.TreeTagger;
+
+import javax.xml.stream.*;
+
+import java.net.URL;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class compiler.
+ */
+class compiler
+{
+	/** The debug. */
+	private boolean debug= false;
+
+	/** The input data. */
+	private def inputData;
+
+	/** The factory. */
+	private def factory;
+
+	/** The parser. */
+	private XMLStreamReader parser;
+
+	/** The dir. */
+	private def dir;
+
+	/** The output. */
+	private def output;
+
+	/** The url. */
+	private def url;
+
+	/** The text. */
+	String text="";
+
+	/** The base. */
+	String base="";
+
+	/** The project. */
+	String project="";
+
+	/** The anahash. */
+	static boolean firstWord = true;
+	private def anaTypes = [];
+	public def getAnaTypes() { return anaTypes; }
+	private HashMap<String,String> anahash = new HashMap<String,String>() ;
+
+	private static SAttributesListener sattrsListener;
+	private static HashMap<String,ArrayList<String>> structs;
+	private static HashMap<String, Integer> structsProf;
+	def headerAttrs; // only for TMX
+
+	/** The tuprops. */
+	List<String> tuprops;
+
+	/** The cwb loc. */
+	String cwbLoc;
+
+	/** The corporanames. */
+	List<String> corporanames = new ArrayList<String>();
+
+	/** The align structure. */
+	String alignStructure;
+
+	/** The align attribute. */
+	String alignAttribute;
+
+	/** The do align. */
+	boolean doAlign = false;
+	public static HashMap<String, Integer> segs_id = [:]; // static so the id are uniques
+	public static int seg_id = 0;
+
+	/**
+	 * initialize.
+	 *
+	 */
+	public compiler(){}
+
+	/**
+	 * Instantiates a new compiler.
+	 *
+	 * @param url the url
+	 * @param text the text
+	 * @param base the base
+	 * @param project the project
+	 * @param tuprops the tuprops
+	 */
+	public compiler(URL url, String text, String base, String project, List<String> tuprops)
+	{
+		this.text = text
+		this.base = base;
+		this.project = project;
+		this.tuprops = tuprops;
+		try {
+			this.url = url;
+			inputData = url.openStream();
+			factory = XMLInputFactory.newInstance();
+			parser = factory.createXMLStreamReader(inputData);
+
+			if (sattrsListener == null)
+				sattrsListener = new SAttributesListener(parser);
+			else
+				sattrsListener.start(parser)
+		} catch (XMLStreamException ex) {
+			System.out.println(ex);
+		}catch (IOException ex) {
+			System.err.println("IOException while parsing ");
+		}
+	}
+
+	/**
+	 * Sets the cwb path.
+	 *
+	 * @param path the new cwb path
+	 */
+	public void setCwbPath(String path)
+	{
+		if(!new File(path).exists())
+			System.err.println("CWB Path : "+path+" does not exists")
+		cwbLoc = path;
+	}
+
+	/**
+	 * Creates the output.
+	 *
+	 * @param dirPathName the dir path name
+	 * @param fileName the file name
+	 * @return true, if successful
+	 */
+	private boolean createOutput(String dirPathName, String fileName){
+		try {
+			File f = new File(dirPathName, fileName)
+			//We don't want to concatenate the wtc files
+			output = new OutputStreamWriter(new FileOutputStream(f, f.exists()) , "UTF-8");
+			return true;
+		} catch (Exception e) {
+			System.err.println(e);
+
+			return false;
+		}
+	}
+
+	/**
+	 * Go to text.
+	 */
+	private void GoToText()
+	{
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next())
+		{
+			if(event == XMLStreamConstants.END_ELEMENT)
+				if(parser.getLocalName().equals("teiHeader"))
+					return;
+		}
+	}
+
+	/**
+	 * Transfom file wtc.
+	 *
+	 * @param dirPathName the dir path name
+	 * @param fileName the file name
+	 * @return true, if successful
+	 */
+	public boolean transfomFileWtc(String dirPathName, String fileName)
+	{
+		createOutput(dirPathName, fileName);
+
+		GoToText();
+		firstWord = true;
+		String headvalue = ""
+		String vAna = "";
+		String vForm = "";
+		String wordid= "";
+		String vHead = "";
+
+		boolean captureword = false;
+		boolean flagForm = false;
+		boolean flagAna = false;
+
+		String anaType;
+		String tuRef;
+		try {
+			for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next())
+			{
+				switch (event) {
+					case XMLStreamConstants.START_ELEMENT:
+						sattrsListener.startElement(parser.getLocalName());
+						switch (parser.getLocalName()) {
+							case "header": // capture header attributes
+								headerAttrs = [:];
+								for ( int i = 0 ; i < parser.getAttributeCount() ; i++) {
+									headerAttrs[parser.getAttributeLocalName(i)] =  parser.getAttributeValue(i);
+								}
+								break;
+							case "text":
+								output.write("<text id=\""+text+"\" base=\""+base+"\"" +
+								" project=\""+project+"\"");
+								def textAttrs = [];
+								for ( int i = 0 ; i < parser.getAttributeCount() ; i++)
+								{
+									String attrname = parser.getAttributeLocalName(i);
+									String attrvalue = parser.getAttributeValue(i);
+									if(attrname != "id")
+										output.write(" "+attrname+"=\""+attrvalue+"\"")
+									textAttrs << attrname
+								}
+								if (headerAttrs != null)
+									for( String key : headerAttrs.keySet()) {
+										if (!textAttrs.contains(key))
+											output.write(" "+key+"=\""+headerAttrs[key]+"\"")
+									}
+								output.write(">\n");
+
+								break;
+
+							case "tu":
+								output.write("<tu");
+								for( String attrname : tuprops)
+								{
+									String attrvalue = parser.getAttributeValue(null, attrname);
+									attrname = attrname.toLowerCase();
+									if(attrvalue == null)
+										output.write(" "+attrname+"=\"N/A\"")
+									else
+										output.write(" "+attrname+"=\""+attrvalue+"\"")
+								}
+								tuRef = text;
+								for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
+									output.write(" "+parser.getAttributeLocalName(i)+"=\""+parser.getAttributeValue(i)+"\"")
+									if (parser.getAttributeLocalName(i) == "ref")
+										tuRef = parser.getAttributeValue(i);
+								}
+								output.write(">\n");
+								break;
+							case "seg":
+								output.write("<seg")
+								for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
+									output.write(" "+parser.getAttributeLocalName(i)+"=\""+parser.getAttributeValue(i)+"\"")
+								}
+								output.write(">\n")
+								break;
+
+							case "w":
+								for(int i = 0 ; i < parser.getAttributeCount(); i++)
+									if(parser.getAttributeLocalName(i).equals("id"))
+								{
+									wordid = parser.getAttributeValue(i);
+								}
+								break;
+							case "form":
+								flagForm = true;
+								vForm = "";
+								anahash.clear();
+								break;
+
+							case "ana":
+								flagAna = true;
+								anaType = parser.getAttributeValue(null, "type")
+								if (anaType.length() > 0) anaType = anaType.substring(1);
+								//println "anatype $anaType"
+								anahash.put(anaType, "");
+								if (firstWord) {
+									anaTypes << anaType;
+								}
+								break;
+						}
+						break;
+
+					case XMLStreamConstants.END_ELEMENT:
+						sattrsListener.endElement(parser.getLocalName());
+						switch (parser.getLocalName())
+						{
+							case "text":
+								output.write("</text>\n");
+								break;
+
+							case "tu":
+								output.write("</tu>\n")
+								break;
+							case "seg":
+								output.write("</seg>\n")
+								break;
+
+							case "w":
+								firstWord = false;
+								output.write( vForm.replaceAll("&", "&amp;").replaceAll("<", "&lt;")
+									 +"\t"+wordid+"\t"+tuRef);
+								for(String type : anaTypes) {
+									output.write("\t"+anahash.get(type));
+								}
+								output.write("\n")
+
+								vForm = "";
+								break;
+
+							case "form":
+								flagForm = false;
+								break;
+
+							case "ana":
+								anahash.put(anaType, vAna);
+								vAna = "";
+								flagAna = false;
+								break;
+						}
+						break;
+
+					case XMLStreamConstants.CHARACTERS:
+						if(flagForm)
+							vForm += parser.getText().trim();
+						if (flagAna) {
+							vAna += parser.getText().trim()
+						}
+						break;
+				}
+			}
+			output.close();
+			parser.close();
+		}
+		catch (XMLStreamException ex) {
+			System.out.println(ex);
+		}
+		catch (IOException ex) {
+			System.out.println("IOException while parsing " + inputData);
+		}
+
+		return true;
+	}
+
+	/**
+	 * Sets the alignment.
+	 *
+	 * @param structure the structure
+	 * @param attribute the attribute
+	 */
+	public void setAlignment(String structure, String attribute)
+	{
+		doAlign = true;
+		this.alignStructure = structure;
+		this.alignAttribute = attribute;
+	}
+
+	/**
+	 * Gets the tu props.
+	 *
+	 * @param files the files
+	 * @return the tu props
+	 */
+	public List<String> getTuProps(List<File> files)
+	{
+		Set<String> tuprops = new HashSet<String>();
+		for (File f : files) {
+			def inputData = f.toURI().toURL().openStream();
+			def factory = XMLInputFactory.newInstance();
+			def parser = factory.createXMLStreamReader(inputData);
+			for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next())
+			{
+				switch (event) {
+					case XMLStreamConstants.START_ELEMENT:
+						switch (parser.getLocalName()) {
+							case "tu":
+							for ( int i = 0 ; i < parser.getAttributeCount() ; i++) {
+								tuprops.add(parser.getAttributeLocalName(i));
+							}
+							break;
+						}
+				}
+			}
+		}
+		return new ArrayList<String>(tuprops);
+	}
+
+	public static HashMap<String, String> langs;
+	public void setLangs(HashMap<String, String> langs)
+	{
+		this.langs = langs;
+	}
+
+	public static HashMap<Integer, ArrayList<String>> langGroups;
+	public void setLangGroups(HashMap<Integer, ArrayList<String>> groups)
+	{
+		this.langGroups = groups;
+	}
+	
+	public static HashMap<Integer, ArrayList<String>> corpusIDS;
+	public void setCorpusIDS(HashMap<Integer, ArrayList<String>> corpusIDS)
+	{
+		this.corpusIDS = corpusIDS;
+	}
+	
+	/**
+	 * Run.
+	 *
+	 * @param rootDirFile the root dir file
+	 * @param basename the basename
+	 * @param textAttributes the text attributes
+	 * @return true, if successful
+	 */
+	public boolean run(File binDir, File txmDir, String basename)
+	{
+		sattrsListener = null; // reset SAttribute Listener for each new import
+		String rootDir = binDir.getAbsolutePath();
+		seg_id=1;
+		if (cwbLoc == null)
+			cwbLoc = org.txm.Toolbox.getParam(org.txm.Toolbox.CQI_SERVER_PATH_TO_CQPLIB)+File.separator;
+
+		if (!new File(cwbLoc).exists()) {
+			println ("CWB path error: "+cwbLoc)
+			return false;
+		}
+		if (!new File(rootDir).exists()) {
+			println ("binary directory does not exists: "+rootDir)
+			return false;
+		}
+
+		new File(binDir,"/wtc/").deleteDir();
+		new File(binDir,"/wtc/").mkdir();
+		new File(binDir,"/data/").deleteDir();
+		new File(binDir,"/data/").mkdir();
+		new File(binDir,"registry/").mkdir();
+
+		String textid="";
+		int counttext =0;
+		List<File> files = txmDir.listFiles();
+
+		//0- get all tu props
+		//List<String> tuprops = getTuProps(files);
+
+		if (corpusIDS == null || corpusIDS.size() == 0) {
+			corpusIDS = [:];
+			for (int group : langGroups.keySet()) {
+				String lang = langs.get(langGroups.get(group)[0]);
+				if (lang ==null) {
+					println "ERROR: no lang defined for group $group . Aborting."
+				}
+				corpusIDS[group] = (lang+group).toLowerCase();
+			}
+		}
+		println "Using corpus ID: $corpusIDS"
+		
+		String wtcName;
+		for (int group : langGroups.keySet()) {
+			String lang = langs.get(langGroups.get(group)[0]);
+			segs_id.put(group, 0);
+			wtcName = basename+"_"+corpusIDS.get(group);
+			createOutput(rootDir+"/wtc", "${wtcName}.wtc");
+			output.write("<txmcorpus id=\"${wtcName}\" lang=\"$lang\">\n")
+			output.close();
+
+			//create txmDirs
+			new File(rootDir, "txm/"+wtcName.toUpperCase()).mkdir();
+		}
+
+		//1- Transform into WTC file and build a corpus per file
+		Collections.sort(files);
+		def anaTypesPerWtc = [:];
+		def builder = null;
+		for (int group : langGroups.keySet()) {
+			//String lang = langs.get(langGroups.get(group)[0]);
+			wtcName = basename+"_"+corpusIDS.get(group);
+			def filenames = langGroups.get(group);
+			filenames.sort()
+			//println("Process group no $group of files "+filenames)
+			for (String filename : filenames) {
+				File f = new File(txmDir, filename);
+				print "."
+				if (!f.exists()) {
+					println("COMPILER: file "+f+ " does not exists -> stop")
+					return false;
+				}
+
+				filename = filename.substring(0, filename.length()-4);
+				String corpusname = (wtcName).toLowerCase();
+				counttext++;
+
+				String txtname = f.getName();
+				txtname = txtname.substring(0, txtname.lastIndexOf("_"));
+				seg_id = segs_id.get(group);
+				builder = new compiler(f.toURI().toURL(), txtname, basename, "default", tuprops);
+				builder.transfomFileWtc(rootDir+"/wtc",wtcName+".wtc");
+				anaTypesPerWtc[wtcName] = builder.getAnaTypes();
+				segs_id.put(group, seg_id);
+
+				// move xml-txm file
+				File txmCorpusDir = new File(rootDir, "txm/"+wtcName.toUpperCase())
+				f.renameTo(new File(txmCorpusDir, f.getName()));
+			}
+		}
+		println ""
+		
+		for (int group : langGroups.keySet()) {
+			//String lang = langs.get(langGroups.get(group)[0]);
+			createOutput(rootDir+"/wtc", basename+"_"+corpusIDS.get(group)+".wtc");
+			output.write("</txmcorpus>")
+			output.close();
+		}
+
+		if(builder == null) {
+			System.out.println("No TXM files to process Stop import");
+			return false;
+		}
+		//2- Import into CWB
+		def outDir = rootDir;
+		def outDirTxm = rootDir;
+
+		def wtcFiles = [:]
+		for (File wtcfile : new File(rootDir, "wtc").listFiles()) {
+			String corpusname = wtcfile.getName();
+			
+			corpusname = corpusname.substring(0, corpusname.length()-4);
+			def corpusAnaTypes = anaTypesPerWtc[corpusname];
+			
+			CwbEncode cwbEn = new CwbEncode();
+			cwbEn.setDebug(debug);
+			CwbMakeAll cwbMa = new CwbMakeAll();
+			cwbMa.setDebug(debug);
+
+			def pAttrs = ["id", "ref"];
+			for(String type : corpusAnaTypes) {
+				int i = 2;
+				while (pAttrs.contains(type))
+					type = type+(i++);
+				pAttrs.add(type);
+			}
+
+			structs = sattrsListener.getStructs();
+			structsProf = sattrsListener.getProfs();
+			// add structures+properties found in sources
+			List<String> sargs = new ArrayList<String>();
+
+			for (String name : structs.keySet()) {
+				if (name == "header") continue;
+				//if ( name == "text") continue; // added after
+				//if ( name == "q") continue; // added after
+				//if ( name == "foreign") continue; // added after
+				String concat = name+":"+structsProf.get(name); // append the depth
+				for (String value : structs.get(name)) // append the attributes
+					concat += "+"+value;
+				if ((name == "text") &&
+				!(concat.endsWith("+id") || concat.contains("+id+")))
+					concat += "+id"
+				if ((name == "text") &&
+				!(concat.endsWith("+base") || concat.contains("+base+")))
+					concat += "+base"
+				if ((name == "text") &&
+				!(concat.endsWith("+project") || concat.contains("+project+")))
+					concat += "+project"
+				sargs.add(concat);
+			}
+
+			sargs.add("txmcorpus:0+id+lang")
+			sargs.sort();
+
+			String[] sAttributes = sargs;
+			String[] pAttributes = pAttrs;
+			println "P-attributes: "+pAttrs
+			println "S-attributes: "+sargs
+
+			try {
+				wtcFiles[corpusname.toLowerCase()] = outDir + "/wtc/"+wtcfile.getName();
+				String regPath = outDirTxm + "/registry/"+corpusname.toLowerCase()
+				cwbEn.run(new File(cwbLoc,"cwb-encode").getAbsolutePath(), outDirTxm + "/data/"+corpusname.toUpperCase()+"/", outDir + "/wtc/"+wtcfile.getName(), regPath, pAttributes, sAttributes);
+				if (!new File(regPath).exists()) {
+					println "Error: The registry file was not created: $regPath. See https://groupes.renater.fr/wiki/txm-users/public/faq"
+					return false;
+				}
+				cwbMa.run(new File(cwbLoc,"cwb-makeall").getAbsolutePath(), corpusname.toUpperCase(), outDirTxm + "/registry");
+			} catch (Exception ex) {System.out.println(ex); return false;}
+		}
+
+		// 3- do alignement
+		if (doAlign) {
+			File registryDirectory = new File(rootDir,"registry");
+			def registryFiles = registryDirectory.listFiles();
+			for (File corpusName : registryFiles) {
+				for (File targetName : registryFiles) {
+					if (!corpusName.equals(targetName)) {
+						try {
+							PatchCwbRegistry.patchAlignment(new File(registryDirectory, corpusName.getName()), targetName.getName());
+							
+							File wtcFile1 = new File(wtcFiles[corpusName.getName()]);
+							File wtcFile2 = new File(wtcFiles[targetName.getName()]);
+							File alignOutFile = new File(outDir, "align.out");
+							
+							BuildAlignOut bao = new BuildAlignOut(wtcFile1, wtcFile2);
+							if (!bao.process(alignOutFile, "seg", "id")) {
+								println "Error while creating alignement file of $corpusName. Aborting."
+								return false;
+							}
+							
+							CwbAlign tt = new CwbAlign(cwbLoc);
+							// ./cwb-align-encode -D -r ~/TXM/corpora/tmxtest/registry/ -v out.align
+							tt = new CwbAlign(cwbLoc);
+							tt.setD();
+							tt.setv();
+							tt.setr(new File(rootDir,"registry").getAbsolutePath());
+							tt.cwbalignencode(alignOutFile.getAbsolutePath());
+						} catch (IOException e) {
+							Log.severe("Error while calling TreeTagger: "+e.getLocalizedMessage());
+							return false;
+						}
+					}
+				}
+			}
+		}
+
+		return true;
+	}
+
+	/**
+	 * Gets the corpora names.
+	 *
+	 * @return the corpora names
+	 */
+	public List<String> getCorporaNames()
+	{
+		return corporanames;
+	}
+
+	/**
+	 * Sets the debug.
+	 */
+	public void setDebug()
+	{
+		this.debug = true;
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args)
+	{
+		File dir = new File("~/xml/geo");
+		def c = new compiler();
+		c.setDebug();
+		c.setCwbPath("~/TXM/cwb/bin");
+		c.run(dir,"geo");
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/tmx/package.html
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/tmx/package.html	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/tmx/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>TMX import module - not yet finished </p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/org/txm/importer/tmx/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/importer/tmx/Tmx2XmlFiles.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/tmx/Tmx2XmlFiles.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/tmx/Tmx2XmlFiles.groovy	(revision 258)
@@ -0,0 +1,468 @@
+// 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
+// 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.
+//
+//
+//
+// $LastChangedDate: 2015-12-17 12:11:39 +0100 (Thu, 17 Dec 2015) $
+// $LastChangedRevision: 3087 $
+// $LastChangedBy: mdecorde $
+//
+package org.txm.importer.tmx;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.stream.*;
+
+import org.txm.objects.Base;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStreamReader;
+
+
+import java.net.URL;
+
+import org.txm.objects.*;
+// TODO: Auto-generated Javadoc
+
+/**
+ * Split a TMX file into N xml files, N the number of lang declared in the <tuv> tags.
+ *
+ * @author mdecorde
+ */
+class Tmx2XmlFiles {
+
+	/** The lang. */
+	String lang;
+
+	/** The type. */
+	String type;
+
+	/** The infile. */
+	File infile;
+
+	/** The outdir. */
+	File outdir;
+
+	/** The writers. */
+	ArrayList<XMLStreamWriter> writers;
+	def outputs;
+
+	/** The textslangs. */
+	HashMap<String, String> textslangs;
+	HashMap<Integer, ArrayList<String>> langGroups;
+	Set<String> langs;
+	def header = [:];
+
+	/**
+	 * Instantiates a new tmx2 xml files.
+	 *
+	 * @param base the base
+	 */
+	public Tmx2XmlFiles(HashMap<String, String> textslangs, HashMap<Integer, ArrayList<String>> langGroups)
+	{
+		this.textslangs = textslangs;
+		this.langGroups = langGroups;
+	}
+
+	/**
+	 * Gets the text langs.
+	 *
+	 * @return the langs of the TMX files
+	 */
+	public HashMap<String, String> getTextLangs()
+	{
+		return textslangs;
+	}
+
+	/**
+	 * Gets the original texts
+	 *
+	 * @return the langs of the TMX files
+	 */
+	public HashMap<String, String> getLangGroups()
+	{
+		return langGroups;
+	}
+	
+	def corpusIDS = [:];
+	int noCorpusID = 0;
+	public def getCorpusIDS() {
+		return corpusIDS;
+	}
+
+	int TOTALTUV = 0;
+	public def initWriters(File tmxFile) {
+		println "initialize writers for : $tmxFile"
+		def inputData = infile.toURI().toURL().openStream();
+		def inputfactory = XMLInputFactory.newInstance();
+		XMLStreamReader parser = inputfactory.createXMLStreamReader(inputData);
+
+		TOTALTUV = 0;
+		writers = new ArrayList<XMLStreamWriter>(); // one writer per text
+		outputs = []; // one writer per text
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next())
+		{
+			if (event == XMLStreamConstants.START_ELEMENT) {
+				if (parser.getLocalName() == "tuv") {
+
+					String lang = "fr";
+					for(int i = 0 ; i < parser.getAttributeCount() ; i++)
+						if (parser.getAttributeLocalName(i) == "lang")
+					{
+						lang = (parser.getAttributeValue(i)).toLowerCase()
+						break;
+					}
+
+					buildWriter(TOTALTUV, lang);
+					TOTALTUV++
+				}
+			} else if (event == XMLStreamConstants.END_ELEMENT) {
+				if (parser.getLocalName() == "tu") {
+					break; // stop at the end of the first </tu>
+				}
+			}
+		}
+
+		parser.close()
+		inputData.close();
+	}
+
+	String textname;
+	int noTuv = -1;
+	XMLOutputFactory factory = XMLOutputFactory.newInstance();
+	public def buildWriter(int no, String lang) {
+		//println "build Writer : $no $lang"
+		if (writers.size() <= no) {
+			File outfile = new File(outdir, textname+no+".xml");
+			textLangs.put(outfile.getName(), lang);
+			if (!langGroups.containsKey(no)) langGroups[no] = [];
+			langGroups.get(no).add(outfile.getName());
+
+			FileOutputStream output = new FileOutputStream(outfile)
+			def writer = factory.createXMLStreamWriter(output, "UTF-8")
+			writers.add(no, writer);
+			outputs.add(no, output);
+
+			writer.writeStartDocument("UTF-8","1.0");
+			writer.writeStartElement ("TEI");
+			writer.writeStartElement ("teiHeader");
+			writer.writeEndElement();
+		}
+		return writers.get(no);
+	}
+
+	XMLStreamReader parser;
+	int tuCounter = 0;
+	/**
+	 * start the processing.
+	 *
+	 * @param infile the infile
+	 * @param outdir the outdir
+	 */
+	public void run(File indir, File outdir)
+	{
+		boolean isTuv = false;
+		boolean isProp = false;
+		boolean isTu = false;
+		boolean flagHeader = false;
+		String propvalue;
+		String localname;
+
+		def tuvProps = [:];
+		def tuProps = [:];
+		def corpusTITLES = [];
+		def corpusSUBTITLES = [];
+		def corpusAUTHORS = [];
+		def corpusTRANSLATORS = [];
+		
+		def tuTitles = [];
+		boolean endOfTuProp = false;
+
+		for (File infile : indir.listFiles()) {
+			if (!infile.canRead() || infile.getName().startsWith("import") || infile.getName().endsWith(".css"))  {
+				println "skip file : "+infile;
+				continue;
+			}
+			this.infile = infile;
+			this.outdir = outdir;
+			outdir.mkdir(); // ensure the directory exists
+			// get the filename without ".xml"
+			textname = infile.getName().substring(0,infile.getName().length()-4)+"_";
+			initWriters(infile);
+
+			// create XML reader
+			def inputData = infile.toURI().toURL().openStream();
+			def inputfactory = XMLInputFactory.newInstance();
+			parser = inputfactory.createXMLStreamReader(inputData);
+			def headerProps = [:];
+			noTuv = -1;
+			//getWriter(noTuv);
+			for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next())
+			{
+				switch (event) {
+					case XMLStreamConstants.START_ELEMENT:
+						localname = parser.getLocalName();
+
+						if (localname == "tuv") {
+							noTuv++;
+							
+							if (endOfTuProp) {
+								endOfTuProp = false;
+								//println "localname: "+localname+" $tuTitles "//+parser.getLocation()
+								for(int i = 0 ; i < writers.size() && i < tuTitles.size() ; i++) {
+									writers.get(i).writeAttribute("title", tuTitles.get(i));
+								}
+							}
+							
+							this.writeStartElement("seg");
+							for (int i = 0 ; i < parser.getAttributeCount() ; i++) // get the lang attribute of the tuv
+								if (parser.getAttributeLocalName(i) == "lang")
+							{
+								lang = parser.getAttributeValue(i)
+								break;
+							}
+							
+							
+							
+							this.writeAttribute("id", "seg_$tuCounter");
+						} else if (localname == "seg") {
+							// do nothing :)
+						} else if (localname == "prop") {
+							type = null;
+							for (int i = 0 ; i < parser.getAttributeCount() ; i++) { // get the type attribute of the prop
+								if (parser.getAttributeLocalName(i) == "type") {
+									type = parser.getAttributeValue(i)
+									break;
+								}
+							}
+							if (type == null) {
+								println "ERROR NO PROP TYPE : "+parser.getLocation()
+							}
+							propvalue= "";
+							isProp= true;
+						} else if (localname == "header") {
+							flagHeader = true;
+							for (int i = 0 ; i < parser.getAttributeCount() ; i++) { // get the type attribute of the prop
+								headerProps[parser.getAttributeLocalName(i)] = parser.getAttributeValue(i)
+							}
+						} else {
+
+							if (endOfTuProp && localname == "note") {
+								//println "localname: note $tuTitles "
+								for (int i = 0 ; i < writers.size() ; i++) {
+									writers.get(i).writeAttribute("title", tuTitles.get(i));
+								}
+								endOfTuProp = false;
+							}
+							
+							if (localname == "tmx") continue;
+							if (localname == "tu") {
+								tuTitles = [];
+								isTu= true;
+								noTuv = -1;
+								endOfTuProp = true; // wait for the next start element that is not note or prop
+								tuCounter++;
+							}
+							if (localname == "body")
+								localname = "text"
+							this.writeStartElement(localname); // create text tag in each xml file
+
+							for (int i= 0 ; i < parser.getAttributeCount() ;i++) {
+								this.writeAttribute(parser.getAttributeLocalName(i), parser.getAttributeValue(i));
+							}
+							if (localname == "text") {
+								println "add header : $headerProps"
+								//for(String key : headerProps.keySet())	this.writeAttribute(key, headerProps[key]);
+
+								for (int i = 0 ; i < writers.size() ; i++) {
+									if (corpusIDS.size() > i)
+										writers.get(i).writeAttribute("corpusid", corpusIDS[i]);
+									if (corpusTITLES.size() > i)
+										writers.get(i).writeAttribute("title", corpusTITLES.get(i));
+									if (corpusSUBTITLES.size() > i)
+										writers.get(i).writeAttribute("subtitle", corpusSUBTITLES.get(i));
+									if (corpusAUTHORS.size() > i)
+										writers.get(i).writeAttribute("author", corpusAUTHORS.get(i));
+									if (corpusTRANSLATORS.size() > i)
+										writers.get(i).writeAttribute("translator", corpusTRANSLATORS.get(i));
+								}
+							}
+						}
+						break;
+
+					case XMLStreamConstants.END_ELEMENT:
+						localname = parser.getLocalName();
+						switch (localname) {
+							case "tuv":
+								lang = null
+								this.writeEndElement();
+								break
+							case "seg":
+								break;
+							case "prop":
+								//println "flagHeader $flagHeader isTu $isTu type $type"
+								if (flagHeader) {
+									if (type == "corpusId") {
+										corpusIDS[noCorpusID++] = propvalue.toLowerCase();
+									} else if (type == "title") {
+										corpusTITLES << propvalue;
+									} else if (type == "subtitle") {
+										corpusSUBTITLES << propvalue;
+									} else if (type == "author") {
+										corpusAUTHORS << propvalue;
+									} else if (type == "translator") {
+										corpusTRANSLATORS << propvalue;
+									}
+								} else if (isTu && type == "tuTitle") {
+									tuTitles << propvalue
+								} else {
+									writeAttribute(type, propvalue); // transform all properties to attributes
+								}
+								isProp= false;
+								break;
+							case "tmx":
+								break;
+							case "tu":
+								isTu= false;
+								endOfTuProp = false;
+								noTuv = -1;
+								this.writeEndElement();
+							case "header":
+								flagHeader = false;
+								break;
+							default:
+								this.writeEndElement();
+								break;
+						}
+						break;
+
+					case XMLStreamConstants.CHARACTERS:
+						if (isProp) {
+							propvalue += parser.getText(); // get prop tag text
+						} else {
+							this.writeCharacters(parser.getText());
+						}
+						break;
+
+				}
+			}
+
+			this.writeEndElement(); // close TEI
+			parser.close();
+			inputData.close();
+
+			for (XMLStreamWriter writer : writers) { // close all xml file output streamS
+				writer.close();
+			}
+			for (def output : outputs) { // close all xml file output streamS
+				output.close();
+			}
+		}
+	}
+
+	/**
+	 * call writeEndElement in all outputstream
+	 * if lang field is set, write only in the stream of the file with the corresponding lang.
+	 */
+	private void writeEndElement()
+	{
+		if (noTuv == -1) {
+			for (def writer : writers) writer.writeEndElement();
+		} else
+			writers.get(noTuv).writeEndElement();
+	}
+
+	/**
+	 * call writeStartElement in all outputstream
+	 * if lang field is set, write only in the stream of the file with the corresponding lang.
+	 *
+	 * @param localname the localname
+	 */
+	private void writeStartElement(String localname)
+	{
+		if (noTuv == -1) {
+			for (def writer : writers) writer.writeStartElement(localname);
+		} else
+			writers.get(noTuv).writeStartElement(localname);
+	}
+
+	/**
+	 * call writeStartDocument in all outputstream
+	 * if lang field is set, write only in the stream of the file with the corresponding lang.
+	 *
+	 * @param text the text
+	 */
+	private void writeCharacters(String text)
+	{
+		//System.err.println "write chars elem : '"+text+"' >> "+lang
+		text = text.trim();
+		if (text.length() > 0) {
+			if (noTuv == -1) {
+				for (def writer : writers) writer.writeCharacters(text);
+			} else
+				writers.get(noTuv).writeCharacters(text);
+		}
+	}
+
+	/**
+	 * call writeAttribute in all outputstream
+	 * if lang field is set, write only in the stream of the file with the corresponding lang.
+	 *
+	 * @param name the name
+	 * @param value the value
+	 */
+	private void writeAttribute(String name, String value)
+	{
+		try {
+			if (noTuv == -1) {
+				for (def writer : writers) writer.writeAttribute(name, value);
+			} else
+				writers.get(noTuv).writeAttribute(name, value);
+		} catch (Exception e) { org.txm.utils.logger.Log.printStackTrace(e); System.err.println("ERROR: "+parser.getLocation());}
+	}
+
+	/**
+	 * Main.
+	 *
+	 * @param args the args
+	 */
+	static main(args)
+	{
+		File infile = new File(System.getProperty("user.home"),"xml/tmx/sample.tmx");
+		File outfile = new File(System.getProperty("user.home"),"TXM/corpora/tmx/");
+		new Tmx2XmlFiles().run(infile, outfile);
+		println "done"
+	}
+}
+
Index: tmp/org.txm.core/src/groovy/org/txm/importer/tmx/pager.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/tmx/pager.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/tmx/pager.groovy	(revision 258)
@@ -0,0 +1,449 @@
+// 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
+// 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.
+//
+//
+//
+// $LastChangedDate: 2012-06-01 17:47:31 +0200 (ven., 01 juin 2012) $
+// $LastChangedRevision: 2185 $
+// $LastChangedBy: mdecorde $
+//
+package org.txm.importer.tmx;
+
+import org.txm.importer.*;
+import org.xml.sax.Attributes;
+import org.txm.importer.filters.*;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.stream.*;
+import java.net.URL;
+import org.xml.sax.InputSource;
+import org.xml.sax.helpers.DefaultHandler;
+
+// TODO: Auto-generated Javadoc
+/** Build GEO corpus simple edition from a xml-tei. @author mdecorde */
+class pager {
+	List<String> NoSpaceBefore;
+
+	/** The No space after. */
+	List<String> NoSpaceAfter;
+
+	/** The wordcount. */
+	int wordcount = 0;
+
+	/** The pagecount. */
+	int pagecount = 0;
+
+	/** The wordmax. */
+	int wordmax = 0;
+
+	/** The basename. */
+	String basename = "";
+	String txtname = "";
+	File outdir;
+
+	/** The wordid. */
+	String wordid;
+
+	/** The first word. */
+	boolean firstWord = true;
+
+	/** The wordvalue. */
+	String wordvalue;
+
+	/** The interpvalue. */
+	String interpvalue;
+
+	/** The lastword. */
+	String lastword = " ";
+
+	/** The wordtype. */
+	String wordtype;
+
+	/** The flagform. */
+	boolean flagform = false;
+
+	/** The flaginterp. */
+	boolean flaginterp = false;
+
+	/** The url. */
+	private def url;
+
+	/** The input data. */
+	private def inputData;
+
+	/** The factory. */
+	private def factory;
+
+	/** The parser. */
+	private XMLStreamReader parser;
+
+	/** The writer. */
+	OutputStreamWriter writer;
+
+	/** The multiwriter. */
+	OutputStreamWriter multiwriter = null;
+
+	/** The infile. */
+	File infile;
+
+	/** The outfile. */
+	File outfile;
+
+	/** The pages. */
+	ArrayList<File> pages = new ArrayList<File>();
+
+	/** The idxstart. */
+	ArrayList<String> idxstart = new ArrayList<String>();
+	String editionPage;
+	ArrayList<Integer> splitTUs; // contains the tu ids used to split pages
+	boolean shouldSplit = false;
+	boolean useSplitTUs = false;
+	/**
+	 * Instantiates a new pager.
+	 *
+	 * @param infile the infile
+	 * @param outfile the outfile
+	 * @param NoSpaceBefore the no space before
+	 * @param NoSpaceAfter the no space after
+	 * @param max the max
+	 * @param basename the basename
+	 */
+	pager(File infile, File outdir, String txtname, List<String> NoSpaceBefore,
+	List<String> NoSpaceAfter, int max, String basename, String editionPage, ArrayList<Integer> splitTUs) {
+		this.editionPage = editionPage;
+		this.basename = basename;
+		this.txtname = txtname;
+		this.outdir = outdir;
+		this.wordmax = max;
+		this.NoSpaceBefore = NoSpaceBefore;
+		this.NoSpaceAfter = NoSpaceAfter;
+		this.url = infile.toURI().toURL();
+		this.infile = infile;
+		this.splitTUs = splitTUs;
+		//println "spliting pages with : "+splitTUs
+		useSplitTUs = splitTUs.size() > 0;
+		inputData = url.openStream();
+		factory = XMLInputFactory.newInstance();
+		parser = factory.createXMLStreamReader(inputData);
+		process();
+	}
+
+	private void closeMultiWriter()
+	{
+		if (multiwriter != null) {
+			if (firstWord) { // there was no words
+				this.idxstart.add("w_0")
+				multiwriter.write("<span id=\"w_0\"/>");
+			}
+			multiwriter.write("</div>\n")
+			multiwriter.write("</body>");
+			multiwriter.write("</html>");
+			multiwriter.close();
+		}
+	}
+
+	/**
+	 * Creates the next output.
+	 *
+	 * @return true, if successful
+	 */
+	private boolean createNextOutput()
+	{
+		wordcount = 0;
+		shouldSplit = false;
+		try {
+			closeMultiWriter();
+			File outfile = new File(outdir, txtname+"_"+(++pagecount)+".html")
+			pages.add(outfile);
+			firstWord = true; // waiting for next word
+
+			multiwriter = new OutputStreamWriter(new FileOutputStream(outfile) , "UTF-8");
+
+			multiwriter.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
+			multiwriter.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"   \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n")
+			multiwriter.write("<html>");
+			multiwriter.write("<head>");
+			multiwriter.write("<title>"+basename.toUpperCase()+" $txtname Edition - Page "+pagecount+"</title>");
+			multiwriter.write("<link rel=\"stylesheet\" type=\"text/css\" href=\"tmx.css\"/>");
+			multiwriter.write("<link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\"/>");
+			multiwriter.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/>");
+			multiwriter.write("</head>");
+			multiwriter.write("<body>");
+			multiwriter.write("<div class=\"tmx\">\n")
+
+			return true;
+		} catch (Exception e) {
+			System.out.println(e.getLocalizedMessage());
+			return false;
+		}
+	}
+
+	/**
+	 * Creates the output.
+	 *
+	 * @param outfile the outfile
+	 * @return true, if successful
+	 */
+	private boolean createOutput() {
+		try {
+			return createNextOutput();
+		} catch (Exception e) {
+			System.out.println(e.getLocalizedMessage());
+			return false;
+		}
+	}
+
+	/**
+	 * Gets the page files.
+	 *
+	 * @return the page files
+	 */
+	public ArrayList<File> getPageFiles() {
+		return pages;
+	}
+
+	/**
+	 * Gets the idx.
+	 *
+	 * @return the idx
+	 */
+	public ArrayList<String> getIdx() {
+		return idxstart;
+	}
+
+	/**
+	 * Process.
+	 */
+	void process() {
+
+		String vNote = ""
+		String cssNote = "note"
+		boolean flagNote = false;
+		
+		String tuCSS = "tu"
+		
+		int tuCounter = 0;
+		String localname = "";
+		createNextOutput();
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+			switch (event) {
+				case XMLStreamConstants.START_ELEMENT:
+					localname = parser.getLocalName();
+					switch (localname) {
+						case "text":
+							boolean grey = "true"
+							String title = txtname;
+							String subtitle = "";
+							String author = "";
+							String translator = "";
+							String table = "";
+							table += ("<table>\n");
+							for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
+								String name = parser.getAttributeLocalName(i);
+								grey = !grey;
+								if (grey) table += ("<tr  style=\"background-color:lightgrey;\">");
+								else table += ("<tr>");
+								
+								table += ("<td>"+parser.getAttributeLocalName(i)+": </td>");
+								table += ("<td>"+parser.getAttributeValue(i)+"</td>");
+								table += ("</tr>\n");
+								
+								if (name == "title") title = parser.getAttributeValue(i);
+								else if (name == "subtitle") subtitle = parser.getAttributeValue(i);
+								else if (name == "author") author = parser.getAttributeValue(i);
+								else if (name == "translator") translator = parser.getAttributeValue(i);
+							}
+							multiwriter.write("<div class=\"header\">")
+							multiwriter.write("<span class=\"authorStyle\"> "+author+" </span>")
+							multiwriter.write("<span class=\"titleStyle\"> "+title+" </span>")
+							multiwriter.write("<span class=\"subtitleStyle\"> "+subtitle+" </span>")
+							if (translator.size() > 0)
+								multiwriter.write("<span class=\"translatorStyle\"> "+translator+" </span>")
+							multiwriter.write("</div>")
+//							multiwriter.write(table)
+//							multiwriter.write("</table><br/>\n");
+							break;
+						case "head":
+							multiwriter.write("<h2>\n")
+							break;
+						case "graphic":
+							String url = parser.getAttributeValue(null, "url")
+						//println "URL: "+url
+							if (url != null) multiwriter.write("<div><img src=\"$url\"/></div>");
+							break;
+						case "lg":
+						case "p":
+						case "q":
+							String rend = parser.getAttributeValue(null, "rend")
+							if (rend == null) rend = "normal"
+							multiwriter.write("<p class=\"$rend\">\n")
+							break;
+						//case "pb":
+						case editionPage:
+							createNextOutput();
+							wordcount=0;
+							if (parser.getAttributeValue(null,"n") != null) {
+								multiwriter.write("<p style=\"color:red\" align=\"center\">- "+parser.getAttributeValue(null,"n")+" -</p>\n")
+							}
+							break;
+						case "lb":
+						case "br":
+							multiwriter.write("<br/>\n")
+							break;
+						case "tu":
+							tuCounter++;
+							if (useSplitTUs) {
+								if (splitTUs.contains(tuCounter))
+									createNextOutput();
+							} else if (shouldSplit) {
+								createNextOutput();
+								this.splitTUs << tuCounter
+							}
+							String str = "";
+							String title;
+							tuCSS = "tu"
+							for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
+								str += " "+parser.getAttributeLocalName(i)+"="+parser.getAttributeValue(i)
+								if (parser.getAttributeLocalName(i).equals("cssClass")) {
+									tuCSS = parser.getAttributeValue(i)
+								} else if (parser.getAttributeLocalName(i).equals("title")) {
+									title = parser.getAttributeValue(i)
+								}
+							}
+							if (title != null) str = title;
+							multiwriter.write("<h5 class=\"${tuCSS}Title\">$str</h5>\n")
+							break;
+						case "note":
+						cssNote = "note"
+						for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
+							if (parser.getAttributeLocalName(i) == "cssClass") {
+								cssNote = parser.getAttributeValue(i)
+								break
+							}
+						}
+							vNote = "";
+							flagNote = true;
+							break;
+						case "seg":
+						String css = "seg"
+							if (tuCSS != "tu") css = tuCSS;
+							multiwriter.write("<p class=\"${css}\">\n");
+							break;
+						case "w":
+							wordid = parser.getAttributeValue(null,"id");
+
+							if (firstWord) {
+								firstWord = false;
+								this.idxstart.add(wordid);
+							}
+							wordcount++;
+							if (wordcount >= wordmax) {
+								//createNextOutput();
+								shouldSplit = true;
+								//println "should split: "+wordcount
+							}
+							break;
+
+						case "ana":
+							flaginterp=true;
+							interpvalue+=" "+parser.getAttributeValue(null,"type").substring(1)+":"
+							break;
+
+						case "form":
+							wordvalue="";
+							interpvalue ="";
+							flagform=true;
+					}
+					break;
+				case XMLStreamConstants.END_ELEMENT:
+					localname = parser.getLocalName();
+					switch (localname) {
+						case "head":
+							multiwriter.write("</h2>\n")
+							break;
+						case "lg":
+						case "p":
+						case "q":
+							multiwriter.write("</p>\n")
+							break;
+
+						case "seg":
+							multiwriter.write("</p>\n");
+							break;
+						case "note":
+							flagNote = false;
+							multiwriter.write("<div class=\"${cssNote}\">${vNote}</div>")
+							break;
+
+						case "form":
+							flagform = false
+							break;
+						case "ana":
+							flaginterp = false
+							break;
+						case "w":
+
+							int l = lastword.length();
+							String endOfLastWord = "";
+							if (l > 0)
+								endOfLastWord = lastword.subSequence(l-1, l);
+
+							if (interpvalue != null)
+								interpvalue = interpvalue.replace("&", "&amp;").replace("<", "&lt;").replace("\"","&quot;");
+
+							if (NoSpaceBefore.contains(wordvalue) ||
+							NoSpaceAfter.contains(lastword) ||
+							wordvalue.startsWith("-") ||
+							NoSpaceAfter.contains(endOfLastWord)) {
+								multiwriter.write("<span title=\""+interpvalue+"\" id=\""+wordid+"\">");
+							} else {
+								multiwriter.write(" <span title=\""+interpvalue+"\" id=\""+wordid+"\">");
+							}
+						//writer.write(wordvalue.replace("&", "&amp;").replace("\"","&quot;").replace("<", "&lt;")+"</span>");
+							multiwriter.write(wordvalue.replace("&", "&amp;").replace("\"","&quot;").replace("<", "&lt;")+"</span>");
+							lastword=wordvalue;
+							break;
+					}
+					break;
+
+				case XMLStreamConstants.CHARACTERS:
+					if (flagform)
+						if (parser.getText().length() > 0)
+							wordvalue+=(parser.getText());
+					if (flaginterp)
+						if (parser.getText().length() > 0)
+							interpvalue+=(parser.getText());
+					if (flagNote)
+						if (parser.getText().length() > 0)
+							vNote+=(parser.getText());
+					break;
+			}
+		}
+		//writer.write("</body>");
+		//writer.write("</html>");
+		//writer.close();
+		closeMultiWriter();
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/tmx/tmxLoader.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/tmx/tmxLoader.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/tmx/tmxLoader.groovy	(revision 258)
@@ -0,0 +1,194 @@
+// 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
+// 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.
+//
+//
+//
+// $LastChangedDate: 2015-08-31 13:45:22 +0200 (Mon, 31 Aug 2015) $
+// $LastChangedRevision: 3028 $
+// $LastChangedBy: mdecorde $
+//
+package org.txm.importer.tmx;
+import org.txm.searchengine.cqp.corpus.MainCorpus;
+
+import java.io.File;
+
+import org.txm.importer.tmx.importer;
+import org.txm.importer.tmx.compiler;
+import org.txm.importer.tmx.pager;
+import org.txm.objects.*;
+import org.txm.utils.*;
+import org.txm.*;
+import org.txm.scripts.teitxm.*;
+import org.txm.utils.i18n.*;
+import org.w3c.dom.Element
+
+String userDir = System.getProperty("user.home");
+boolean debug = org.txm.utils.logger.Log.isPrintingErrors();
+def MONITOR;
+BaseParameters params;
+try {params = paramsBinding;MONITOR=monitor} catch (Exception)
+{	println "DEV MODE";//exception means we debug
+	debug = true
+	params = new BaseParameters(new File(userDir, "xml/tmx/import.xml"))
+	params.load()
+	if (!org.txm.Toolbox.isInitialized()) {
+
+		Toolbox.setParam(Toolbox.INSTALL_DIR,new File("/usr/lib/TXM"));
+		Toolbox.setParam(Toolbox.TREETAGGER_INSTALL_PATH,new File(userDir,"treetagger"));
+		Toolbox.setParam(Toolbox.TREETAGGER_MODELS_PATH,new File(userDir,"treetagger/models"));
+		Toolbox.setParam(Toolbox.METADATA_ENCODING, "UTF-8");
+		Toolbox.setParam(Toolbox.METADATA_COLSEPARATOR, ",");
+		Toolbox.setParam(Toolbox.METADATA_TXTSEPARATOR, "\"");
+		Toolbox.setParam(Toolbox.USER_TXM_HOME, new File(System.getProperty("user.home"), "TXM"));
+	}
+}
+if (params == null) { println "no parameters. Aborting"; return; }
+
+String corpusname = params.getCorpusName();
+Element corpusElem = params.corpora.get(corpusname);
+String basename = params.name;
+String rootDir = params.rootDir;
+String lang = corpusElem.getAttribute("lang");
+String model = lang;
+String encoding = corpusElem.getAttribute("encoding");
+boolean annotate = "true" == corpusElem.getAttribute("annotate");
+String xsl = params.getXsltElement(corpusElem).getAttribute("xsl")
+def xslParams = params.getXsltParams(corpusElem);;
+int wordsPerPage = params.getWordsPerPage("default")
+String page_element = params.getPageElement("default")
+boolean build_edition = params.getDoEdition("default")
+
+File srcDir = new File(rootDir);
+File binDir = new File(Toolbox.getParam(Toolbox.USER_TXM_HOME),"corpora/"+basename);
+binDir.deleteDir();
+binDir.mkdirs();
+if (!binDir.exists()) {
+	println "Could not create binDir "+binDir
+	return;
+}
+
+File txmDir = new File(binDir, "txm");
+txmDir.deleteDir();
+txmDir.mkdirs();
+HashMap<String, String> textLangs = [:];
+def langGroups = [:];
+
+println "-- IMPORTER - Reading source files"
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+if (MONITOR != null) MONITOR.worked(20, "IMPORTER - Reading source files");
+def imp = new importer()
+imp.run(srcDir, binDir, txmDir, textLangs, langGroups);
+def corpusIDS = imp.getCorpusIDS()
+println "-- ANNOTATE - Running NLP tools"
+if (MONITOR != null) MONITOR.worked(20, "ANNOTATE - Running NLP tools");
+new Annotate().run(binDir, txmDir, textLangs);
+
+println "langs : "+textLangs
+println "texts : "+langGroups
+
+println "-- COMPILING - Building Search Engine indexes"
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+if (MONITOR != null) MONITOR.worked(20, "COMPILING - Building Search Engine indexes")
+def c = new compiler();
+if (debug) c.setDebug();
+c.setAlignment("seg","id");
+c.setLangs(textLangs);
+c.setCorpusIDS(corpusIDS);
+c.setLangGroups(langGroups);
+if (!c.run(binDir, txmDir, basename)) {
+	println "Compiler failed"
+	return;
+}
+
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+new File(binDir,"HTML").deleteDir();
+new File(binDir,"HTML").mkdirs();
+if (build_edition) {
+	
+	println "-- EDITION - Building edition"
+	if (MONITOR != null) MONITOR.worked(20, "EDITION - Building edition")
+	
+	List<File> filelist = new File(binDir,"txm").listFiles();
+	def second = 0
+
+	def splitTUsPerText = [:]
+
+	for (File txmCorpusDir : txmDir.listFiles()) {
+		def txmFiles = txmCorpusDir.listFiles();
+		txmFiles.sort() // same order
+		//println "paging txmFiles : "+txmFiles
+
+		File outdir = new File(binDir,"/HTML/"+txmCorpusDir.getName()+"/default/");
+		outdir.mkdirs();
+		//println "processing pages of corpus "+txmCorpusDir.getName()
+
+		Element paraCorpusElem = corpusElem.cloneNode(true);
+		paraCorpusElem.setAttribute("name", txmCorpusDir.getName());
+
+		for (File srcfile : txmFiles) {
+			print "."
+			String txtname = srcfile.getName();
+			int i = txtname.lastIndexOf("_");
+			if(i > 0) txtname = txtname.substring(0, i);
+
+			//println ""+srcfile.getName()+" -> "+splitTUsPerText[txtname]
+			def splitTUs = splitTUsPerText[txtname];
+			if (splitTUs == null) {
+				splitTUs = [];
+				splitTUsPerText[txtname] = splitTUs;
+			}
+
+			String l = textLangs.get(srcfile.getName())
+			if (l == null) l = "fr";
+			List<String> NoSpaceBefore = LangFormater.getNoSpaceBefore(l);
+			List<String> NoSpaceAfter = LangFormater.getNoSpaceAfter(l);
+
+			Element text = params.addText(paraCorpusElem, txtname, srcfile);
+
+			def ed = new pager(srcfile, outdir, txtname, NoSpaceBefore, NoSpaceAfter, wordsPerPage, basename, page_element,splitTUs);
+			Element edition = params.addEdition(text, "default", outdir.getAbsolutePath(), "html");
+
+			for (i = 0 ; i < ed.getPageFiles().size();) {
+				File f = ed.getPageFiles().get(i);
+				String wordid = ed.getIdx().get(i);
+				params.addPage(edition, ""+(++i), wordid);
+			}
+		}
+
+		params.corporaElement.appendChild(paraCorpusElem);
+
+		File cssfile = new File(Toolbox.getParam(Toolbox.USER_TXM_HOME), "css/tmx.css")
+		if (cssfile.exists()) {
+			FileCopy.copy(cssfile, new File(outdir, "tmx.css"));
+		}
+		File stylefile = new File(binDir, "style.css")
+		if (stylefile.exists()) {
+			FileCopy.copy(stylefile, new File(outdir, "style.css"));
+		}
+		println ""
+	}
+}
+params.corporaElement.removeChild(corpusElem);
+
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+if (MONITOR != null) MONITOR.worked(20, "FINALIZING")
+File paramFile = new File(binDir, "import.xml");
+DomUtils.save(params.root.getOwnerDocument(), paramFile);readyToLoad = true;
Index: tmp/org.txm.core/src/groovy/org/txm/importer/tmx/importer.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/tmx/importer.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/tmx/importer.groovy	(revision 258)
@@ -0,0 +1,151 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2016-12-01 17:48:31 +0100 (Thu, 01 Dec 2016) $
+// $LastChangedRevision: 3351 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer.tmx
+
+
+
+//import filters.TabulatedToXml.*;
+import org.txm.importer.*;
+import org.txm.importer.filters.*;
+import org.txm.scripts.*;
+import org.txm.importer.cwb.CwbEncode
+import org.txm.importer.cwb.CwbMakeAll
+import org.txm.scripts.teitxm.*;
+//import org.txm.utils.treetagger.TreeTagger;
+import org.txm.utils.io.FileCopy;
+
+import javax.xml.stream.*;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.OutputStreamWriter;
+import java.io.PrintStream;
+import java.net.URL;
+
+import filters.CutHeader.*;
+import filters.Tokeniser.*;
+import filters.FusionHeader.*;
+import filters.TagSentences.*;
+
+import org.txm.objects.*;
+import org.txm.*;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class importer.
+ */
+class importer {
+	static Tmx2XmlFiles converter;
+	/**
+	 * Run.
+	 *
+	 * @param rootDirFile the root dir file
+	 * @param base the base
+	 */
+	public static void run(File srcDir, File binDir, File txmDir, HashMap<String, String> langs, HashMap<String, String> originalTexts)
+	{
+		String filename = binDir.getName();
+		
+		new File(binDir, "ptokenized").deleteDir();
+		new File(binDir, "ptokenized").mkdir();
+		new File(binDir, "tokenized").deleteDir();
+		new File(binDir, "tokenized").mkdir();
+		new File(binDir, "split").deleteDir();
+		new File(binDir, "split").mkdir();
+
+		//build xml files
+		if(srcDir.listFiles() == null || srcDir.listFiles().size() == 0)
+			return;
+		//File tmxfile = rootDirFile.listFiles()[0]
+		converter = new Tmx2XmlFiles(langs, originalTexts) // fill langs and originalTexts dictionaries
+		converter.run(srcDir, new File(binDir, "split"));
+			
+		List<File> srcfiles = new File(binDir, "split").listFiles();
+		println("Tokenizing "+srcfiles.size()+" files")
+		for (File f : srcfiles) {
+			
+			String lang = langs.get(f.getName());
+						
+			print "."
+			File outfile = new File(binDir,"tokenized/"+f.getName());
+			SimpleTokenizerXml tokenizer = new SimpleTokenizerXml(f, outfile, lang)
+			tokenizer.setOutSideTextTagsAndKeepContent("note");
+			if (!tokenizer.process()) {
+				println("Failed to tokenize $f")
+				outfile.delete()
+			}
+		}
+		println ""
+		
+		// copy css file if any
+		File cssSrc = new File(srcDir, "style.css");
+		File cssBin = new File(binDir, "style.css");
+		if (cssSrc.exists()) {
+			FileCopy.copy(cssSrc, cssBin)
+		}
+		
+		//TRANSFORM INTO XML-TEI-TXM
+		List<File> tokenfiles = new File(binDir,"tokenized").listFiles()
+		println("Building xml-tei-txm ("+tokenfiles.size()+" files)")
+		for (File f : tokenfiles) {
+			print "."
+			String txmfile = f.getName();
+			
+			def correspType = new HashMap<String, String>()
+			def correspRef = new HashMap<String, String>()
+			//il faut lister les id de tous les respStmt
+			def respId = [];
+			//fait la correspondance entre le respId et le rapport d'execution de l'outil
+			def applications = new HashMap<String, HashMap<String,String>>();	
+			//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[]>();
+			//associe un id d'item avec sa description et son URI
+			def itemsURI = new HashMap<String, HashMap<String, String>>();
+			//informations de respStmt
+			//resps (respId <voir ci-dessus>, [description, person, date])
+			def resps = new HashMap<String, String[]>();
+			//lance le traitement
+			String wordprefix = "w_";
+			def builder = new Xml2Ana(f);
+			builder.setCorrespondances(correspRef, correspType);
+			builder.setHeaderInfos(respId,resps, applications, taxonomiesUtilisees, itemsURI)
+			//builder.setAddTEIHeader();
+			if (!builder.process(new File(txmDir, txmfile))) {
+				println("Failed to process file "+f)
+				new File(srcDir, txmfile).delete()
+			}
+		}
+		println ""
+	}
+	
+	public def getCorpusIDS() {
+		converter.getCorpusIDS()
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/SetNewXmlDocumentRoot.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/SetNewXmlDocumentRoot.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/SetNewXmlDocumentRoot.groovy	(revision 258)
@@ -0,0 +1,43 @@
+package org.txm.importer
+
+import javax.xml.parsers.*
+import javax.xml.transform.*
+import javax.xml.xpath.*
+
+import org.txm.importer.graal.PersonalNamespaceContext
+import org.txm.utils.xml.DomUtils
+import org.w3c.dom.Document
+import org.w3c.dom.Element
+import org.w3c.dom.Node
+
+class SetNewXmlDocumentRoot {
+	public static boolean process(File xmlfile, String xpath) {
+		DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
+		domFactory.setNamespaceAware(true); // never forget this!
+		DocumentBuilder builder = domFactory.newDocumentBuilder();
+		Document doc = builder.parse(xmlfile);
+		Element root = doc.getDocumentElement();
+		
+		XPathFactory xpathfactory = XPathFactory.newInstance();
+		def _xpath = xpathfactory.newXPath();
+		_xpath.setNamespaceContext(new PersonalNamespaceContext());
+		def expr = _xpath.compile(xpath);
+		def nodes = expr.evaluate(doc, XPathConstants.NODESET);
+
+		for(Node node : nodes) {
+
+			Document document = builder.newDocument();
+			document.setXmlVersion("1.0");
+			document.setXmlStandalone(true);
+			Node adopted = document.adoptNode(node)
+			document.appendChild(adopted)
+			return DomUtils.save(document, xmlfile);
+		}
+		return false;
+	}
+	
+	//		File xmlfile = new File("/home/mdecorde/xml/txmrefman/TEI/refman.xml")
+	//		File outfile = new File("/home/mdecorde/xml/txmrefman/TEI/refman-o.xml")
+	//		String xpath = "//body"
+	
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/INARecords.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/INARecords.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/INARecords.groovy	(revision 258)
@@ -0,0 +1,39 @@
+package org.txm.importer
+
+import org.txm.utils.CsvReader;
+import java.nio.charset.Charset;
+
+File csvFile = new File("/home/mdecorde/xml/notices/MARTICE_20130304_TF1_IMAGO_1994-12-31.csv")
+CsvReader reader = new CsvReader(csvFile.getAbsolutePath(), ";".charAt(0), Charset.forName("UTF-8"))
+
+reader.readHeaders()
+def headers = reader.getHeaders()
+int nheader = headers.size()
+int nlines = 0;
+def counts = new int[nheader]
+def values = [:]
+for (String key : headers) values[key] = new HashSet()
+
+while (reader.readRecord()) {
+	nlines++;
+	for (int i = 0 ; i < nheader ; i++) {
+		String key = headers[i]
+		String str = " "+reader.get(key);
+		//print str
+		if (str.trim().length() > 0) {
+			counts[i] = counts[i] + 1
+			values[key] << str.trim()
+		}
+	}
+	//println ""
+}
+
+println "N lines: "+nlines
+println "Empty cols: N <= 20"
+for (int i = 0 ; i < nheader ; i++) {
+	
+	if (counts[i] < 30) {
+		println ( headers[i]+ " : "+counts[i])
+		println values[headers[i]]
+	}
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/importer/factiva/FactivaMail2Alceste.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/factiva/FactivaMail2Alceste.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/factiva/FactivaMail2Alceste.groovy	(revision 258)
@@ -0,0 +1,153 @@
+package org.txm.importer.factiva
+/**
+ * 
+ * This is a Groovy port of the converter made by Pierre Ratinaud
+ * #Author: Pierre Ratinaud
+ * #Copyright (c) 2012 Pierre Ratinaud
+ * #Lisense: GNU/GPL
+ * 
+ * @author mdecorde
+ *
+ */
+class FactivaMail2Alceste {
+
+	def txtdir;
+	def fileout;
+	def encodage_in = 'UTF-8'
+	def encodage_out = 'UTF-8'
+
+	def metadata = ["BY":"Author",
+		"ART":"CaptionsDescriptionGraphics",
+		"CLM":"Column",
+		"CT":"Contact",
+		"CY":"Copyright",
+		"CX":"Correction",
+		"CR":"Credit",
+		"ED":"Edition",
+		"HD":"Headline",
+		"LA":"Language",
+		"PG":"Page",
+		"PD":"PublicationDate",
+		"ET":"PublicationTime",
+		"RBBCM":"ReutersCodes",
+		"SE":"Section",
+		"SC":"SourceCode",
+		"GC":"SourceGroupCode",
+		"NGC":"SourceGroupName",
+		"SN":"SourceName",
+		"TD":"TextFollowingLeadParagraphs",
+		"VOL":"Volume",
+		"WC":"WordCount"]
+
+	def starts = ["LP":"LeadParagraph"]
+
+	def ends = ["RF":"Reference",
+		"AN":"AccessionNumber",
+		"PUB":"PublisherName",
+		"RE":"RegionCodeDescriptor",
+		"IPC":"InformationProviderCodes",
+		"IN":"IndustryCodeDescriptor",
+		"CO":"CompanyCodeName",
+		"IPD":"InformationProviderDescriptors",
+		"NS":"SubjectCodeDescriptor",
+		"DJIC":"DowJonesCodes",
+		"DJID":"DowJonesDescriptors"]
+	
+	def ucis = []
+	def writeTextOK = false
+	def nextLineIsAnEndMetadataValue = false
+	def endsKey
+
+	FactivaMail2Alceste(File txtdir, File fileout, String encodage_in, String encodage_out) {
+		this.txtdir = txtdir;
+		this.fileout = fileout;
+		this.encodage_in = encodage_in;
+		this.encodage_out = encodage_out;
+	}
+
+	def toAttribute(String str) {
+		return str.replaceAll(' ','')
+//		.replaceAll('\'','').replaceAll(":", "").replaceAll("\\|", "").replaceAll("_","")
+//			 .replaceAll('´','').replaceAll('’','').replaceAll('-','').toLowerCase().replaceAll("/", "").replaceAll("\\.", "")
+//			 .replaceAll(" \"", "")
+	}
+	
+	def writeText(String str) {
+		if (writeTextOK) ucis[-1][1] += str+"\n";
+	}
+	
+	/**
+	 * parser de texte pour factiva
+	 * @return liste d'uci (= list header + corp)
+	 */
+	def parsetxt(txt) {
+		def lines = txt.split("\n") // met le texte dans une liste de lignes
+		def keepline = false
+		
+		for (String line : lines)  { //pour chaque ligne du texte...
+			if (line.length() == 0) continue;
+			
+			if (nextLineIsAnEndMetadataValue) {
+				//println "DATA: "+line
+				ucis[-1][0] += " *${endsKey}_"+toAttribute(line)
+				nextLineIsAnEndMetadataValue = false;
+			} else if (line.startsWith('---------------------------------------------------------------')) {// si la ligne commence avec...
+				ucis << ['****',''] // nouveau texte
+			} else {
+				int idxSpace = line.indexOf(" ")
+				if (0 <= idxSpace && idxSpace < 5) { // maybe a key
+					String head = line.substring(0, idxSpace)
+					String tail = line.substring(idxSpace+1)
+					String tail2;
+					int idxTab = tail.indexOf("\t");
+
+					if (metadata.containsKey(head)) {
+						if (idxTab == 0 && tail.length() > 0) {
+							ucis[-1][0] += " *${head}_"+toAttribute(tail.substring(1));
+						} else if (tail.length() > 0){
+							writeText(line)
+						}
+					} else if (ends.containsKey(head)) {
+						if (idxTab == 0) nextLineIsAnEndMetadataValue = true;
+						endsKey = head;
+						writeTextOK = false; // stop writing text
+					} else if (starts.containsKey(head)) {
+						writeTextOK = true; // start writing text
+					} else {
+						writeText(line)
+					}
+				} else {
+					writeText(line)
+				}
+			}
+		}
+		return ucis
+	}
+
+	def doparse() {
+		def files = txtdir.listFiles() // liste des fichiers dans txtdir
+		fileout.withWriter("UTF-8") { writer ->
+			for (File f : files) { // pour chaque fichier en entree...
+				if (f.isHidden() || !f.canRead() || !f.isFile() || f.getName() == "import.xml") {
+					continue;
+				}
+				println "parse file: $f"
+				for (def uci : parsetxt(f.getText("UTF-8"))) { // on récupère les lignes
+					writer.println uci[0] // header
+					writer.println uci[1] // corp
+				}
+			}
+		}
+		return true;
+	}
+
+	public static void main(String[] args) {
+		File  txtdir = new File("/home/mdecorde/xml/factivatxt/") // repertoire des textes
+		File fileout = new File("/home/mdecorde/xml/factivatxt/montagne-out.txt")
+		String encodage_in = "UTF-8"
+		String encodage_out = "UTF-8"
+		def converter = new FactivaMail2Alceste(txtdir, fileout, encodage_in, encodage_out);
+
+		println 'Done: '+converter.doparse()
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/factiva/factivaLoader.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/factiva/factivaLoader.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/factiva/factivaLoader.groovy	(revision 258)
@@ -0,0 +1,290 @@
+// 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
+// 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.
+//
+//
+//
+// $LastChangedDate: 2012-02-13 11:42:24 +0100 (lun., 13 févr. 2012) $
+// $LastChangedRevision: 2126 $
+// $LastChangedBy: mdecorde $
+//
+package org.txm.importer.factiva;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.txm.importer.ApplyXsl2;
+import org.txm.importer.Factiva2XmlTxm;
+import org.txm.importer.ValidateXml;
+import org.txm.importer.xml.importer;
+import org.txm.importer.xml.compiler;
+import org.txm.importer.xml.pager;
+import org.txm.objects.*;
+import org.txm.utils.*;
+import org.txm.*;
+import org.txm.scripts.teitxm.*;
+import org.txm.utils.i18n.*;
+import org.txm.metadatas.*;
+
+import javax.xml.stream.*;
+
+import org.w3c.dom.Element
+
+String userDir = System.getProperty("user.home");
+
+def MONITOR;
+boolean debug = org.txm.utils.logger.Log.isPrintingErrors();
+BaseParameters params;
+try {params = paramsBinding;MONITOR=monitor} catch (Exception)
+{	println "DEV MODE";//exception means we debug
+	debug = true;
+	params = new BaseParameters(new File(userDir, "xml/TESTS/factiva/import.xml"))
+	params.load()
+	if (!org.txm.Toolbox.isInitialized()) {
+
+		Toolbox.setParam(Toolbox.INSTALL_DIR,new File("/usr/lib/TXM"));
+		Toolbox.setParam(Toolbox.TREETAGGER_INSTALL_PATH,new File(userDir,"treetagger"));
+		Toolbox.setParam(Toolbox.TREETAGGER_MODELS_PATH,new File(userDir,"treetagger/models"));
+		Toolbox.setParam(Toolbox.METADATA_ENCODING, "UTF-8");
+		Toolbox.setParam(Toolbox.METADATA_COLSEPARATOR, ",");
+		Toolbox.setParam(Toolbox.METADATA_TXTSEPARATOR, "\"");
+		Toolbox.setParam(Toolbox.USER_TXM_HOME, new File(System.getProperty("user.home"), "TXM"));
+	}
+}
+if (params == null) { println "no parameters. Aborting"; return; }
+
+String corpusname = params.getCorpusName();
+Element corpusElem = params.corpora.get(corpusname);
+String basename = params.name;
+String rootDir = params.rootDir;
+String lang = corpusElem.getAttribute("lang");
+String model = lang
+String encoding = corpusElem.getAttribute("encoding");
+boolean annotate = "true" == corpusElem.getAttribute("annotate");
+String xsl = params.getXsltElement(corpusElem).getAttribute("xsl")
+def xslParams = params.getXsltParams(corpusElem);
+int wordsPerPage = params.getWordsPerPage("default")
+String page_element = params.getPageElement("default")
+boolean build_edition = params.getDoEdition("default")
+
+File srcDir = new File(rootDir);
+File binDir = new File(Toolbox.getParam(Toolbox.USER_TXM_HOME),"corpora/"+basename);
+binDir.deleteDir();
+binDir.mkdirs();
+if (!binDir.exists()) {
+	println "Could not create binDir "+binDir
+	return;
+}
+
+File txmDir = new File(binDir,"txm/$corpusname");
+txmDir.deleteDir();
+txmDir.mkdirs();
+
+File propertyFile = new File(rootDir, "import.properties")//default
+Properties props = new Properties();
+String[] metadatasToKeep;
+
+String textSortAttribute = null;
+String paginationElement = null;
+boolean normalizeMetadata = false;
+String ignoredElements = null;
+boolean stopIfMalformed = false;
+
+println "Trying to read import properties file: "+propertyFile
+if (propertyFile.exists() && propertyFile.canRead()) {
+	InputStreamReader input = new InputStreamReader(new FileInputStream(propertyFile) , "UTF-8");
+	props.load(input);
+	input.close();
+	if(props.getProperty("sortmetadata") != null)
+		textSortAttribute = props.get("sortmetadata").toString();
+	if(props.getProperty("editionpage") != null)
+		paginationElement = props.get("editionpage").toString();
+	if(props.getProperty("normalizemetadata") != null)
+		normalizeMetadata = Boolean.parseBoolean(props.get("normalizemetadata").toString());
+	if(props.getProperty("ignoredelements") != null)
+		ignoredElements = props.get("ignoredelements").toString();
+	if(props.getProperty("stopIfMalformed") != null)
+		stopIfMalformed = Boolean.parseBoolean(props.get("stopIfMalformed").toString());
+
+	println "import properties: "
+	println " sort metadata: "+textSortAttribute
+	println " edition page tag: "+paginationElement
+	println " normalize attributes: "+normalizeMetadata
+	println " ignored elements: "+ignoredElements
+	println " stop if a XML source is malformed: "+stopIfMalformed
+}
+
+File allmetadatasfile = new File(srcDir, "metadata.csv");
+
+// Apply Factiva2XMLTXM
+println "Factiva -> xml/w"
+File factivaOutDir = new File(binDir, "src")
+new Factiva2XmlTxm().run(srcDir, factivaOutDir.getAbsolutePath());
+if (factivaOutDir.listFiles() == null) {
+	println "Error: no file to process"
+	return;
+}
+srcDir = factivaOutDir;
+
+// Apply XSL
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+if (MONITOR != null) MONITOR.worked(1, "APPLYING XSL")
+if (xsl != null && xslParams != null && xsl.trim().length() > 0) {
+	if (ApplyXsl2.processImportSources(new File(xsl), srcDir, new File(binDir, "src"), xslParams))
+	// return; // error during process
+	srcDir = new File(binDir, "src");
+	println ""
+}
+
+// copy txm files
+List<File> srcfiles = srcDir.listFiles();
+for (int i = 0 ; i < srcfiles.size() ; i++) {// check XML format, and copy file into binDir
+	File f = srcfiles.get(i)
+	if (f.getName().equals("import.xml") || f.getName().equals("metadata.csv") || f.getName().endsWith(".properties")) {
+		srcfiles.remove(i);
+		i--;
+		continue;
+	}
+	if (ValidateXml.test(f)) {
+		FileCopy.copy(f, new File(txmDir, f.getName()));
+	} else {
+		println "Won't process file "+f;
+	}
+}
+
+if (txmDir.listFiles() == null) {
+	println "No txm file to process"
+	return;
+}
+
+//get metadata values from CSV
+Metadatas metadatas; // text metadata
+println "Trying to read metadata from: "+allmetadatasfile
+if (allmetadatasfile.exists()) {
+	File copy = new File(binDir, "metadata.csv")
+	if (!FileCopy.copy(allmetadatasfile, copy)) {
+		println "Error: could not create a copy of metadata file "+allmetadatasfile.getAbsoluteFile();
+		return;
+	}
+	metadatas = new Metadatas(copy, Toolbox.getParam(Toolbox.METADATA_ENCODING), Toolbox.getParam(Toolbox.METADATA_COLSEPARATOR), Toolbox.getParam(Toolbox.METADATA_TXTSEPARATOR), 1)
+} else
+	println "no metadata file: "+allmetadatasfile
+
+if (MONITOR != null) MONITOR.worked(1, "IMPORTER")
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+println "-- IMPORTER - Reading source files"
+def imp = new importer();
+imp.doValidation(true) // change this to not validate xml
+imp.doTokenize(true) // change this, to not tokenize xml
+imp.setStopIfMalformed(stopIfMalformed);
+if (!imp.run( srcDir, binDir, txmDir, basename, null, lang)) {
+	println "import process stopped";
+	return;
+}
+
+if (MONITOR != null) MONITOR.worked(20, "INJECTING METADATA")
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+println "-- INJECTING METADATA - from csv file: "+allmetadatasfile
+if (metadatas != null) {
+	println("Injecting metadata: "+metadatas.getHeadersList()+" in texts of directory "+new File(binDir,"txm"))
+	for (File infile : txmDir.listFiles()) {
+		print "."
+		File outfile = File.createTempFile("temp", ".xml", infile.getParentFile());
+		if (!metadatas.injectMetadatasInXml(infile, outfile, "text", null)) {
+			outfile.delete();
+		} else {
+			if (!(infile.delete() && outfile.renameTo(infile))) println "Warning can't rename file "+outfile+" to "+infile
+			if (!infile.exists()) {
+				println "Error: could not replace $infile by $outfile"
+				return false;
+			}
+		}
+	}
+	println ""
+}
+
+List<File> files = txmDir.listFiles()
+if (files == null || files.size() == 0) {
+	return;
+}
+
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+if (MONITOR != null) MONITOR.worked(10, "ANNOTATE")
+println "-- ANNOTATE - Running NLP tools"
+boolean annotationSuccess = false;
+if (annotate && new Annotate().run(binDir, txmDir, model+".par")) {
+	annotationSuccess = true;
+}
+
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+if (MONITOR != null) MONITOR.worked(25, "COMPILING")
+println "-- COMPILING - Building Search Engine indexes"
+def c = new compiler();
+if(debug) c.setDebug();
+//c.setCwbPath("~/TXM/cwb/bin");
+c.setOptions(textSortAttribute, normalizeMetadata);
+c.setAnnotationSuccess(annotationSuccess)
+c.setLang(lang);
+if (!c.run(binDir, txmDir, corpusname, null, srcfiles, metadatas)) {
+	println "import process stopped";
+	return;
+}
+
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+
+new File(binDir,"HTML/$corpusname").deleteDir();
+new File(binDir,"HTML/$corpusname").mkdirs();
+if (build_edition) {
+
+	println "-- EDITION - Building edition"
+	if (MONITOR != null) MONITOR.worked(20, "EDITION")
+	
+	File outdir = new File(binDir,"/HTML/$corpusname/default/");
+	outdir.mkdirs();
+	List<File> filelist = txmDir.listFiles();
+	Collections.sort(filelist);
+	def second = 0
+
+	println "Paginating texts: "
+
+	for (File txmFile : filelist) {
+		print "."
+		String txtname = txmFile.getName();
+		int i = txtname.lastIndexOf(".");
+		if(i > 0) txtname = txtname.substring(0, i);
+
+		List<String> NoSpaceBefore = LangFormater.getNoSpaceBefore(lang);
+		List<String> NoSpaceAfter = LangFormater.getNoSpaceAfter(lang);
+
+		Element text = params.addText(corpusElem, txtname, txmFile);
+
+		def ed = new pager(txmFile, outdir, txtname, NoSpaceBefore, NoSpaceAfter, wordsPerPage, basename, page_element);
+		Element edition = params.addEdition(text, "default", outdir.getAbsolutePath(), "html");
+
+		for (i = 0 ; i < ed.getPageFiles().size();) {
+			File f = ed.getPageFiles().get(i);
+			String wordid = ed.getIdx().get(i);
+			params.addPage(edition, ""+(++i), wordid);
+		}
+	}
+}
+
+if (MONITOR != null) MONITOR.worked(20, "FINALIZING")
+File paramFile = new File(binDir, "import.xml");
+DomUtils.save(params.root.getOwnerDocument(), paramFile);readyToLoad = true;
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/importer/factiva/factivamailLoader.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/factiva/factivamailLoader.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/factiva/factivamailLoader.groovy	(revision 258)
@@ -0,0 +1,158 @@
+// 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
+// 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.
+//
+//
+//
+// $LastChangedDate: 2012-07-20 17:33:42 +0200 (ven., 20 juil. 2012) $
+// $LastChangedRevision: 2221 $
+// $LastChangedBy: mdecorde $
+//
+package org.txm.importer.factiva;
+
+import org.txm.importer.alceste.importer;
+import org.txm.importer.alceste.compiler;
+import org.txm.importer.xml.pager_old;
+import org.txm.objects.*;
+import org.txm.utils.*;
+import org.txm.*;
+import org.txm.scripts.teitxm.*;
+import org.txm.utils.i18n.*;
+import org.w3c.dom.Element
+
+String userDir = System.getProperty("user.home");
+
+def MONITOR;
+boolean debug = org.txm.utils.logger.Log.isPrintingErrors();
+BaseParameters params;
+try {params = paramsBinding;MONITOR=monitor} catch (Exception) {
+	println "DEV MODE";//exception means we debug
+	debug = true
+	params = new BaseParameters(new File(userDir, "xml/factivatxt/import.xml"))
+	params.load()
+	if (!org.txm.Toolbox.isInitialized()) {
+
+		Toolbox.setParam(Toolbox.INSTALL_DIR,new File("/usr/lib/TXM"));
+		Toolbox.setParam(Toolbox.TREETAGGER_INSTALL_PATH,new File(userDir,"treetagger"));
+		Toolbox.setParam(Toolbox.TREETAGGER_MODELS_PATH,new File(userDir,"treetagger/models"));
+		Toolbox.setParam(Toolbox.METADATA_ENCODING, "UTF-8");
+		Toolbox.setParam(Toolbox.METADATA_COLSEPARATOR, ",");
+		Toolbox.setParam(Toolbox.METADATA_TXTSEPARATOR, "\"");
+		Toolbox.setParam(Toolbox.USER_TXM_HOME, new File(System.getProperty("user.home"), "TXM"));
+	}
+}
+if (params == null) { println "no parameters. Aborting"; return; }
+
+String corpusname = params.getCorpusName();
+
+Element corpusElem = params.corpora.get(corpusname);
+String basename = params.name;
+String rootDir = params.rootDir;
+String lang = corpusElem.getAttribute("lang");
+String model = lang
+String encoding = corpusElem.getAttribute("encoding");
+boolean annotate = "true" == corpusElem.getAttribute("annotate");
+String xsl = params.getXsltElement(corpusElem).getAttribute("xsl")
+def xslParams = params.getXsltParams(corpusElem);
+
+File srcDir = new File(rootDir);
+File binDir = new File(Toolbox.getParam(Toolbox.USER_TXM_HOME),"corpora/"+basename);
+binDir.deleteDir();
+binDir.mkdirs();
+if (!binDir.exists()) {
+	println "Could not create binDir "+binDir
+	return;
+}
+
+File txmDir = new File(binDir,"txm/$corpusname");
+txmDir.deleteDir();
+txmDir.mkdirs();
+
+// TRANSFORM FACTIVA TO ALCESTE HERE
+File newSrcDir = new File(binDir, "src")
+newSrcDir.mkdir();
+File alcesteFile = new File(newSrcDir, srcDir.getName()+".txt");
+FactivaMail2Alceste converter = new FactivaMail2Alceste(srcDir, alcesteFile, "UTF-8", "UTF-8")
+if (!converter.doparse()) {
+	println "Failed to convert files in $srcDir to one Alceste file"
+	return false;
+}
+if (MONITOR != null) MONITOR.worked(1, "IMPORTER")
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+println "-- IMPORTER - Reading source files"
+
+if (!(new importer().run(newSrcDir, binDir, txmDir, encoding, basename, lang))) {
+	println "import process stopped";
+	return;
+}
+
+if (MONITOR != null) MONITOR.worked(20, "ANNOTATE")
+println "-- ANNOTATE - Running NLP tools"
+boolean annotationSuccess = false;
+if (annotate && new Annotate().run(binDir, txmDir, model+".par")) {
+	annotationSuccess = true;
+}
+
+if (MONITOR != null) MONITOR.worked(25, "COMPILING")
+println "-- COMPILING - Building Search Engine indexes"
+def c = new compiler();
+c.setAnnotationSuccess(annotationSuccess)
+if (debug) c.setDebug();
+c.setLang(lang);
+if (!c.run(binDir, txmDir, corpusname)) {
+	println "import process stopped";
+	return;
+}
+
+if (MONITOR != null) MONITOR.worked(20, "EDITION")
+println "-- EDITION - Building edition"
+new File(binDir,"HTML/$corpusname").deleteDir();
+new File(binDir,"HTML/$corpusname").mkdirs();
+File outdir = new File(binDir,"/HTML/$corpusname/default/");
+outdir.mkdirs();
+List<File> filelist = txmDir.listFiles();
+Collections.sort(filelist);
+def second = 0
+
+println "Paginating texts: "
+for (File srcfile : filelist) {
+	print "."
+	String txtname = srcfile.getName();
+	int i = txtname.lastIndexOf(".");
+	if(i > 0) txtname = txtname.substring(0, i);
+	
+	List<String> NoSpaceBefore = LangFormater.getNoSpaceBefore(lang);
+	List<String> NoSpaceAfter = LangFormater.getNoSpaceAfter(lang);
+
+	Element text = params.addText(params.corpora.get(corpusname), txtname, srcfile);
+		
+	def ed = new pager_old(srcfile, outdir, txtname, NoSpaceBefore, NoSpaceAfter, 500, basename, "pb");
+	Element edition = params.addEdition(text, "default", outdir.getAbsolutePath(), "html");
+	
+	for (i = 0 ; i < ed.getPageFiles().size();) {
+		File f = ed.getPageFiles().get(i);
+		String wordid = ed.getIdx().get(i);
+		params.addPage(edition, ""+(++i), wordid);
+	}
+}
+
+if (MONITOR != null) MONITOR.worked(20, "FINALIZING")
+File paramFile = new File(binDir, "import.xml");
+DomUtils.save(params.root.getOwnerDocument(), paramFile);readyToLoad = true;
Index: tmp/org.txm.core/src/groovy/org/txm/importer/factiva/package.html
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/factiva/package.html	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/factiva/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Factiva XML and mail import modules</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/org/txm/importer/factiva/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/importer/MetadataGetter.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/MetadataGetter.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/MetadataGetter.groovy	(revision 258)
@@ -0,0 +1,35 @@
+package org.txm.importer
+
+import javax.xml.stream.*;
+
+class MetadataGetter {
+	public static String get(File xmlFile, String struct, String prop) {
+
+		def inputData = xmlFile.toURI().toURL().openStream();
+		def factory = XMLInputFactory.newInstance();
+		XMLStreamReader parser = factory.createXMLStreamReader(inputData);
+
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+			if (event == XMLStreamConstants.START_ELEMENT) {
+				if ("text".equals(parser.getLocalName())) {
+					for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
+						if(prop.equals(parser.getAttributeLocalName(i))) {
+							String tmp = parser.getAttributeValue(i)
+							parser.close()
+							return tmp
+						}
+					}
+				}
+			}
+		}
+		parser.close()
+		return null;
+	}
+
+	public static void main(String[] args) {
+		File xmlFile = new File("/home/mdecorde/TXM/corpora/superphenix/txm/SUPERPHENIX/CreysSuper_04_0175.xml")
+		String struct = "text"
+		String prop = "date"
+		println MetadataGetter.get(xmlFile, struct, prop)
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/bvh/bvhLoader.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/bvh/bvhLoader.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/bvh/bvhLoader.groovy	(revision 258)
@@ -0,0 +1,145 @@
+/**
+ * Main.
+ *
+ * @param args the args
+ */
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-09-16 14:31:48 +0200 (lun., 16 sept. 2013) $
+// $LastChangedRevision: 2535 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer.bvh;
+
+import java.io.File;
+import org.txm.importer.bvh.importer;
+import org.txm.importer.bvh.compiler;
+import org.txm.importer.bvh.annotate;
+import org.txm.importer.bvh.pager;
+import org.txm.objects.*;
+import org.txm.*;
+import org.txm.scripts.teitxm.*;
+import org.txm.utils.i18n.*;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Run.
+ *
+ * @return the java.lang. object
+ * @author mdecorde
+ */
+
+String userDir = System.getProperty("user.home");
+String lang;
+String encoding;
+String rootDir;
+String model;
+String basename;
+try{rootDir = rootDirBinding;lang=langBinding;encoding=encodingBinding;model=modelBinding;basename=basenameBinding}
+catch(Exception)
+{	println "DEV MODE";//exception means we debug
+	if(!org.txm.Toolbox.isInitialized())
+	{
+		rootDir = userDir+"/xml/bvh/";
+		lang="fr";
+		encoding= "UTF-8";// not used by bvh
+		model="rgaqcj"; //not used by bvh
+		basename="bvh"
+		Toolbox.workspace = new Workspace(new File(userDir,"TXM/workspaces/default.xml"));
+		Toolbox.setParam(Toolbox.INSTALL_DIR,new File(userDir,"TXM"));
+		Toolbox.setParam(Toolbox.TREETAGGER_INSTALL_PATH,new File(userDir,"treetagger"));
+		Toolbox.setParam(Toolbox.TREETAGGER_MODELS_PATH,new File(userDir,"treetagger/models"));
+		Toolbox.setParam(Toolbox.METADATA_ENCODING, "UTF-8");
+		Toolbox.setParam(Toolbox.METADATA_COLSEPARATOR, ",");
+		Toolbox.setParam(Toolbox.METADATA_TXTSEPARATOR, "\"");
+		Toolbox.setParam(Toolbox.USER_TXM_HOME, new File(System.getProperty("user.home"),"TXM"));
+	}
+}
+
+println "IMPORTER"
+new importer().run(new File(rootDir), basename);
+
+File binDir = new File(Toolbox.getParam(Toolbox.USER_TXM_HOME),"corpora/"+basename);
+rootDir = binDir.getAbsolutePath();
+
+println "ANNOTATE - fr "
+new Annotate().run(new File(rootDir),"fr.par");//the files in ./txm
+
+println "ANNOTATE - afr"
+def secondannotator = new Annotate()
+secondannotator.run(new File(rootDir),"afr.par");//the files in ./txm
+
+println "--COMPILING"
+File dir = new File(rootDir);
+def c = new compiler();
+c.setDebug();
+//c.setCwbPath("~/TXM/cwb/bin");
+c.setLang(lang);
+if (!c.run(dir)) {
+	println "Compiler failed"
+	return;
+}
+
+//move registry file to cwb registry dir
+File registryfile = new File(rootDir+"/registry",basename);
+if(registryfile.exists())
+	org.txm.utils.io.FileCopy.copy(registryfile,new File(Toolbox.getParam(Toolbox.USER_TXM_HOME),"registry/"+basename))
+
+Workspace w = org.txm.Toolbox.workspace;
+Project p = w.getProject("default")
+p.removeBase(basename)
+Base b = p.addBase(basename);
+b.addDirectory(new File(rootDir,"txm"));
+b.setAttribute("lang", lang)
+b.propagateAttribute("lang")
+
+println "-- EDITION"
+new File(rootDir+"/HTML/").deleteDir()
+new File(rootDir+"/HTML/").mkdir();
+new File(rootDir+"/HTML/default/").mkdir();
+files = new File(rootDir,"txm").listFiles();
+
+for(Text text : b.getTexts())
+{
+	File srcfile = text.getSource();
+	File resultfile = new File(rootDir+"/HTML",srcfile.getName().substring(0,srcfile.getName().length()-4)+".html");
+	List<String> NoSpaceBefore = LangFormater.getNoSpaceBefore(lang);
+	List<String> NoSpaceAfter = LangFormater.getNoSpaceAfter(lang);
+	println("Building edition  : "+srcfile+" to : "+resultfile );
+	
+	def ed = new pager(srcfile,resultfile, NoSpaceBefore, NoSpaceAfter,600);
+	Edition editionweb = text.addEdition("default","html",resultfile);
+
+	for(int i = 0 ; i < ed.getPageFiles().size();i++)
+	{
+		File f = ed.getPageFiles().get(i);
+		String idx = ed.getIdx().get(i);
+		editionweb.addPage(f,idx);
+	}
+	
+//	Edition editionbp = text.addEdition("onepage","html",resultfile);
+//	editionbp.addPage(resultfile,ed.getIdx().get(0));
+}
+
+w.save();
Index: tmp/org.txm.core/src/groovy/org/txm/importer/bvh/annotate.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/bvh/annotate.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/bvh/annotate.groovy	(revision 258)
@@ -0,0 +1,181 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-11-08 13:38:06 +0100 (ven., 08 nov. 2013) $
+// $LastChangedRevision: 2569 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer.bvh
+
+import org.txm.importer.*;
+import org.txm.scripts.*;
+import org.txm.importer.cwb.CwbEncode
+import org.txm.importer.cwb.CwbMakeAll
+import org.txm.scripts.teitxm.BuildTTSrc;
+import org.txm.scripts.teitxm.*;
+import org.txm.utils.treetagger.TreeTagger;
+import org.txm.Toolbox;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Add treetagger annotations with a choosen model file<br/>
+ * If a word is unknowned the lemma will be set to the word's form <br/>
+ * Use the &lt;s> tags to build sentences boundaries <br/>.
+ *
+ * @author mdecorde
+ */
+class annotate {
+	/*
+	 * @param rootDirFile contains the TEI-TXM files
+	 * @param model the name of the model file to use
+	 * @param pos the name of the pos attribute added
+	 * @param lemme the name of the lemme attribute added
+	 */
+	
+	/**
+	 * Run.
+	 *
+	 * @param rootDirFile the root dir file
+	 * @param model the model
+	 * @param pos the pos
+	 * @param lemme the lemme
+	 */
+	public static void run(File rootDirFile,String model,String pos, String lemme)
+	{
+		String rootDir = rootDirFile.getAbsolutePath()+"/";
+		
+		//cleaning
+		new File(rootDir,"annotations").deleteDir();
+		new File(rootDir,"annotations").mkdir();
+		new File(rootDir,"treetagger").deleteDir();
+		new File(rootDir,"treetagger").mkdir();
+		new File(rootDir,"ptreetagger").deleteDir();
+		new File(rootDir,"ptreetagger").mkdir();
+		
+		ArrayList<String> milestones = new ArrayList<String>();//the tags who you want them to stay milestones
+		milestones.add("tagUsage");
+		milestones.add("pb");
+		milestones.add("lb");
+		
+		List<File> files = new File(rootDir,"txm").listFiles()	
+		//BUILD TT FILE READY TO BE TAGGED
+		for(File f : files)
+		{
+			File srcfile = f;
+			File resultfile = new File(rootDir+"ptreetagger/",f.getName()+".tt");
+			new BuildTTSrc(srcfile.toURL()).process(resultfile)
+		}
+		
+		//APPLY TREETAGGER
+		files = new File(rootDir,"ptreetagger").listFiles()	
+		for(File f : files)
+		{
+			File modelfile = new File(Toolbox.getParam(Toolbox.TREETAGGER_MODELS_PATH),"/afr.par");
+			File infile = f
+			File outfile = new File(rootDir+"/treetagger",f.getName());
+			println("3- APPLY TT on : "+infile+" with : "+modelfile +" >>  "+outfile);
+			
+			TreeTagger tt = new TreeTagger(Toolbox.getParam(Toolbox.TREETAGGER_INSTALL_PATH)+"/bin/");
+			tt.settoken();
+			tt.setlemma();
+			tt.setquiet();
+			tt.setsgml();
+			tt.setnounknown();
+			tt.seteostag("<s>");
+			tt.treetagger( modelfile.getAbsolutePath(), infile.getAbsolutePath(), outfile.getAbsolutePath())
+			//infile.delete();
+		}
+		
+		//BUILD STAND-OFF FILES
+		//contains txm:application/txm:commandLine
+		File reportFile = new File(rootDir,"NLPToolsParameters.xml");
+		
+		String respPerson = System.getProperty("user.name");
+		String respId = "txm";
+		String respDesc = "NLP annotation tool";
+		String respDate = "";
+		String respWhen = ""
+		
+		String appIdent = "TreeTagger";
+		String appVersion = "3.2";
+		
+		String distributor = "";
+		String publiStmt = """""";
+		String sourceStmt = """""";
+		
+		def types = [pos,lemme];
+		def typesTITLE = ["",""];
+		def typesDesc = ["",""];
+		def typesTAGSET = ["",""];
+		def typesWEB = ["",""];
+		String idform ="w_";
+		
+		files = new File(rootDir,"treetagger").listFiles()	
+		for(File f : files)
+		{
+			String target = f.getAbsolutePath();
+			File ttfile = f
+			File posfile = new File(rootDir+"annotations/",f.getName()+"STOFF.xml");
+			
+			def encoding ="UTF-8";
+			def transfo = new CSV2W_ANA();
+			println("build w-interp "+ttfile.getName()+ ">>"+posfile.getName())
+			transfo.setAnnotationTypes( types, typesDesc, typesTAGSET, typesWEB, idform);
+			transfo.setResp(respId, respDesc,respDate, respPerson, respWhen);
+			transfo.setApp(appIdent, appVersion);
+			transfo.setTarget(target, reportFile);
+			transfo.setInfos(distributor,  publiStmt, sourceStmt);
+			transfo.process( ttfile, posfile, encoding );
+		}
+		
+		files = new File(rootDir,"annotations").listFiles();
+		List<File> txmfiles = new File(rootDir,"txm").listFiles();
+		files.sort();
+		txmfiles.sort();
+		for(int i = 0 ; i< files.size();i++)
+		{
+			File srcfile = txmfiles.get(i);
+			File pos1file = files.get(i);
+			File temp = new File(rootDir,"temp"); 
+			
+			println("5- inject annotation in file : "+srcfile+" with : "+pos1file );
+			
+			def builder = new org.txm.scripts.teitxm.AnnotationInjection(srcfile.toURL(), pos1file.toURL(), milestones);
+			builder.transfomFile(temp.getParent(),temp.getName());
+			
+			if (!(srcfile.delete() && temp.renameTo(srcfile))) println "Warning can't rename file "+temp+" to "+srcfile
+		}
+		
+	}
+	
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args)
+	{
+		File rootDir = new File("~/xml/bvh/");
+		new annotate().run(rootDir,);
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/bvh/compiler.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/bvh/compiler.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/bvh/compiler.groovy	(revision 258)
@@ -0,0 +1,642 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2017-01-24 18:11:42 +0100 (Tue, 24 Jan 2017) $
+// $LastChangedRevision: 3400 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer.bvh
+
+
+import org.txm.importer.cwb.CwbEncode
+import org.txm.importer.cwb.CwbMakeAll
+import org.txm.importer.*;
+import org.txm.scripts.*;
+import org.txm.scripts.teitxm.BuildTTSrc;
+import org.txm.scripts.teitxm.*;
+import org.txm.utils.treetagger.TreeTagger;
+
+import javax.xml.stream.*;
+import java.net.URL;
+import java.io.File;
+import java.util.HashMap;
+import java.util.List;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Produce WTC files from TEI-TXM files. <br/>
+ * Add the following word properties : "frpos","frlemme","afrpos","afrlemme","id","page","line","orig","sic","abbr". <br/>
+ * 
+ * @author mdecorde
+ */
+class compiler 
+{
+	
+	/** The debug. */
+	private boolean debug= false;
+	
+	/** The input data. */
+	private def inputData;
+	
+	/** The factory. */
+	private def factory;
+	
+	/** The parser. */
+	private XMLStreamReader parser;
+	
+	/** The dir. */
+	private def dir;
+	
+	/** The output. */
+	private def output;
+	
+	/** The url. */
+	private def url;
+	
+	/** The anahash. */
+	private HashMap<String,String> anahash =new HashMap<String,String>() ;
+	
+	/** The text. */
+	String text="";
+	
+	/** The base. */
+	String base="";
+	
+	/** The project. */
+	String project="";
+	
+	/** The cwb loc. */
+	String cwbLoc;
+	
+	/** The lang. */
+	private String lang ="fr";
+	
+	/**
+	 * Instantiates a new compiler.
+	 */
+	public compiler(){}
+	
+	/**
+	 * initialize the compiler.
+	 *
+	 * @param url the fiel to read
+	 * @param text the Texte's name
+	 * @param base the Base's name
+	 * @param project the Project's name
+	 */
+	public compiler(URL url,String text,String base, String project)
+	{
+		this.text = text
+		this.base = base;
+		this.project = project;
+		try {
+			this.url = url;
+			inputData = url.openStream();
+			
+			factory = XMLInputFactory.newInstance();
+			parser = factory.createXMLStreamReader(inputData);
+		} catch (XMLStreamException ex) {
+			System.out.println(ex);
+		}catch (IOException ex) {
+			System.out.println("IOException while parsing ");
+		}
+	}
+	
+	/**
+	 * set the language of the corpus.
+	 *
+	 * @param lang the lang
+	 * @return the java.lang. object
+	 */
+	public setLang(String lang)
+	{
+		this.lang = lang;
+	}
+	
+	/**
+	 * Sets the cwb path.
+	 *
+	 * @param path the path to cwb utils binaries
+	 */
+	public void setCwbPath(String path)
+	{
+		if(!new File(path).exists())
+			System.err.println("CWB Path : "+path+" does not exists")
+		cwbLoc = path;
+	}
+	
+	/**
+	 * Creates the output.
+	 *
+	 * @param dirPathName the dir path name
+	 * @param fileName the file name
+	 * @return true, if successful
+	 */
+	private boolean createOutput(String dirPathName, String fileName){
+		try {
+			File f = new File(dirPathName, fileName)
+			output = new OutputStreamWriter(new FileOutputStream(f,f.exists()) , "UTF-8");
+			return true;
+		} catch (Exception e) {
+			System.out.println(e.getLocalizedMessage());
+			return false;
+		}
+	}
+	
+	/**
+	 * Go to text.
+	 */
+	private void GoToText()
+	{
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) 
+		{
+			if(event == XMLStreamConstants.END_ELEMENT)
+				if(parser.getLocalName().equals("teiHeader"))
+					return;
+		}
+	}
+	
+	/**
+	 * Transfom file wtc.
+	 *
+	 * @param dirPathName the dir path name
+	 * @param fileName the file name
+	 * @return true, if successful
+	 */
+	private boolean transfomFileWtc(String dirPathName, String fileName)
+	{
+		createOutput(dirPathName, fileName);
+		
+		String headvalue=""
+		String vAna = "";
+		String vForm = "";
+		String wordid= "";
+		String vHead = "";
+		
+		String vExpan = "";
+		String vCorr = "";
+		String vReg = "";
+		String vOrig = "";
+		String vSic = "";
+		String vAbbr = "";
+		
+		String divtype = "";
+		
+		int p_id = 0;
+		int q_id = 0;
+		int lg_id = 0;
+		int l_id = 0;
+		int pb_id = 0;
+		int lb_id = 0;
+		int said_id = 0;
+		int foreign_id = 0;
+		int sp_id = 0;
+		int speaker_id = 0;
+		int stage_id = 0;
+		
+		boolean captureword = false;
+		boolean fwcapture = false;
+		boolean choicecapture = false;
+		boolean divcapture = false;
+		
+		boolean flagchoice = false;
+		boolean flagcorr = false;
+		boolean flagsic = false;
+		boolean flagreg = false;
+		boolean flagexpan = false;
+		boolean flagorig = false;
+		boolean flagabbr = false;
+		boolean flagfw = false;
+		
+		boolean flaglg = false;
+		boolean flaghead = false;
+		boolean flagAuthor = false;
+		boolean flagDate = false;
+		boolean flagForm = false;
+		boolean flagAna = false;
+		boolean
+		
+		this.GoToText()
+		output.write("<txmcorpus lang=\""+lang+"\">\n"); 
+		try 
+		{
+			for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) 
+			{
+				switch (event) 
+				{
+					case XMLStreamConstants.START_ELEMENT:
+						switch (parser.getLocalName()) 
+						{				
+							case "text":
+							captureword=true;
+							output.write("<text id=\""+text+"\" type=\""+parser.getAttributeValue(null,"type")+"\" base=\""+base+"\" project=\""+project+"\">\n");
+							break;
+							
+							case "div":
+								divtype = parser.getAttributeValue(null,"type")
+							switch(divtype)
+							{
+								case "toa":
+								case "toc":
+								break;
+								case null:
+								break;
+								default:
+								output.write("<div id=\""+parser.getAttributeValue(null,"n")+"\" type=\""+parser.getAttributeValue(null,"type")+"\">\n");		
+							}
+							
+							break;
+							
+							case "p":
+							output.write("<p id=\""+(p_id++)+"\">\n");
+							break;
+							
+							case "lg":
+							output.write("<lg id=\""+(lg_id++)+"\">\n");
+							break;
+							
+							case "l":
+							output.write("<l id=\""+(l_id++)+"\">\n");
+							break;
+							
+							case "q":
+							output.write("<q id=\""+(q_id++)+"\">\n");
+							break;
+							
+							case "said":
+							output.write("<said id=\""+(said_id++)+"\">\n");
+							break;
+							
+							case "foreign":
+							output.write("<foreign id=\""+(foreign_id++)+"\">\n");
+							break;
+							
+							case "stage":
+							output.write("<stage id=\""+(stage_id++)+"\">\n");
+							break;
+							
+							case "sp":
+							output.write("<sp id=\""+(sp_id++)+"\">\n");
+							break;
+							
+							case "speaker":
+							output.write("<speaker id=\""+(speaker_id++)+"\">\n");
+							break;
+							
+							case "fw":
+							flagfw = true;
+							break;
+							case "choice":
+							flagchoice = true;
+							break;
+							case "corr":
+							flagcorr = true;
+							vCorr= "";
+							break;
+							case "reg":
+							flagreg = true;
+							vReg= "";
+							break;
+							case "expan":
+							flagexpan = true;
+							vExpan= "";
+							break;
+							case "orig":
+							flagreg = true;
+							vOrig= "";
+							break;
+							case "sic":
+							flagsic = true;
+							vSic= "";
+							break;
+							case "abbr":
+							flagreg = true;
+							vAbbr= "";
+							break;
+							
+							case "w":
+							for(int i = 0 ; i < parser.getAttributeCount(); i++)
+								if(parser.getAttributeLocalName(i).equals("id"))
+								{	
+									wordid = parser.getAttributeValue(i);
+								}
+							break;
+							case "form":
+							flagForm = true;
+							vForm = "";
+							vAna ="";
+							break;
+							
+							case "ana":
+							flagAna = true;
+							break;
+						}
+						break;
+					
+					case XMLStreamConstants.END_ELEMENT:
+						switch (parser.getLocalName()) 
+						{	
+							case "body":
+							captureword=false;
+							break;
+							
+							case "text":
+							output.write("</text>\n");
+							break;
+							
+							case "div":
+							switch(divtype)
+							{
+								case "toa":
+								case "toc":
+								break;
+								default:
+									output.write("</div>\n");		
+							}
+							
+							break;
+							
+							case "p":
+							output.write("</p>\n");
+							break;
+							
+							case "q":
+							output.write("</q>\n");
+							break;
+							
+							case "said":
+							output.write("</said>\n");
+							break;
+							
+							case "foreign":
+							output.write("</foreign>\n");
+							break;
+							
+							case "lg":
+							output.write("</lg>\n");
+							break;
+							
+							case "pb":
+							pb_id++;
+							break;
+							
+							case "lb":
+								lb_id++;
+								break;
+							
+							case "l":
+							output.write("</l>\n");
+							break;
+							
+							case "stage":
+							output.write("</stage>\n");
+							break;
+							
+							case "sp":
+							output.write("</sp>\n");
+							break;
+							
+							case "speaker":
+							output.write("</speaker>\n");
+							break;
+							
+							
+							case "fw":
+							flagfw = false;
+							break;
+							case "choice":
+							flagchoice = false;
+							break;
+							case "corr":
+							flagcorr = false;
+							vCorr= "";
+							break;
+							case "reg":
+							flagreg = false;
+							vReg= "";
+							break;
+							case "expan":
+							flagexpan = false;
+							vExpan= "";
+							break;
+							case "orig":
+							flagreg = false;
+							vOrig= "";
+							break;
+							case "sic":
+							flagsic = false;
+							vSic= "";
+							break;
+							case "abbr":
+							flagreg = false;
+							vAbbr= "";
+							break;
+							
+							case "w":
+							if(vAna != null)
+								if(captureword)
+								{
+									if(flagchoice)
+									{
+										if(flagcorr)
+										{
+											output.write( vCorr +"\t"+vAna+wordid+"\t"+pb_id+"\t"+lb_id+"\t"+vOrig+"\t"+vSic+"\t"+vAbbr+"\n");
+										}
+										else if(flagreg)
+										{
+											output.write( vReg +"\t"+vAna+wordid+"\t"+pb_id+"\t"+lb_id+"\t"+vOrig+"\t"+vSic+"\t"+vAbbr+"\n");
+										}
+										else if(flagsic)
+										{
+											
+										}
+										else if(flagexpan)
+										{
+											output.write( vExpan +"\t"+vAna+wordid+"\t"+pb_id+"\t"+lb_id+"\t"+vOrig+"\t"+vSic+"\t"+vAbbr+"\n");
+										}	
+									}
+									else if(flagfw)
+									{
+										
+									}
+									else
+									{
+										output.write( vForm +"\t"+vAna+wordid+"\t"+pb_id+"\t"+lb_id+"\t"+vOrig+"\t"+vSic+"\t"+vAbbr+"\n");
+									}
+									
+								}
+							vAna = "";
+							vForm = "";
+							break;
+							
+							case "form":
+							flagForm = false;
+							break;
+							
+							case "ana":
+							vAna += "\t";
+							flagAna = false;
+							break;
+						}
+						break;
+					
+					case XMLStreamConstants.CHARACTERS:
+						if(flagForm)
+						{	
+							vForm += parser.getText().trim();
+						}
+						if(flagAna)
+						{
+							vAna += parser.getText().trim();
+						}
+						if(flagsic)
+						{
+							vSic += parser.getText().trim();
+						}
+						if(flagorig)
+						{
+							vOrig += parser.getText().trim();
+						}
+						if(flagabbr)
+						{
+							vAbbr += parser.getText().trim();
+						}
+						break;
+				}
+			}
+			output.write("</txmcorpus>"); 
+			output.close();
+			parser.close();
+			inputData.close();
+		}
+		catch (XMLStreamException ex) {
+			System.out.println(ex);
+		}
+		catch (IOException ex) {
+			System.out.println("IOException while parsing " + inputData);
+		}
+		
+		return true;
+	}
+	
+	
+	/**
+	 * start processing.
+	 *
+	 * @param rootDirFile the directory containing the TEI-TXM files
+	 * @return true, if successful
+	 */
+	public boolean run(File rootDirFile) 
+	{
+		String rootDir =rootDirFile.getAbsolutePath();
+		
+		if(cwbLoc == null)
+			cwbLoc = org.txm.Toolbox.getParam(org.txm.Toolbox.CQI_SERVER_PATH_TO_CQPLIB)+File.separator;
+		
+		if(!new File(cwbLoc).exists())
+		{
+			println ("CWB path error: "+cwbLoc)
+			return false;
+		}
+		if(!new File(rootDir).exists())
+		{
+			println ("binary directory does not exists: "+rootDir)
+			return false;
+		}
+		new File(rootDir+"/wtc/","bvh.wtc").delete();//cleaning&preparing
+		new File(rootDir,"/wtc/").deleteDir();
+		new File(rootDir,"/wtc/").mkdir();
+		new File(rootDir,"/data/").deleteDir();
+		new File(rootDir,"/data/").mkdir();
+		new File(rootDir,"registry/").mkdir();
+		
+		String textid="";
+		int counttext =0;
+		List<File> files = new File(rootDirFile,"txm").listFiles();
+		Collections.sort(files);
+		//1- Transform into WTC file
+		for(File f : files)
+		{
+			counttext++;
+			if(!f.exists())
+			{
+				println("file "+f+ " does not exists")	
+			}
+			else
+			{	
+				println("process file "+f)
+				String txtname = f.getName().substring(0,f.getName().length()-4);
+				def builder = new compiler(f.toURL(),txtname, "bvh", "default");
+				builder.setLang lang
+				builder.transfomFileWtc(rootDir+"/wtc","bvh.wtc");
+			}
+		}
+		
+		//2- Import into CWB
+		def outDir =rootDir;
+		def outDirTxm = rootDir;
+		
+		CwbEncode cwbEn = new CwbEncode();
+		cwbEn.setDebug(debug);
+		CwbMakeAll cwbMa = new CwbMakeAll();
+		cwbMa.setDebug(debug);
+		String[] pAttributes = ["frpos","frlemme","afrpos","afrlemme","id","page","line","orig","sic","abbr"];
+		String[] sAttributes = ["txmcorpus:0+lang", "text:2+id+type+base+project","div:2+id+type","p:0+id","q:0+id","said:0+id","foreign:0+id","lg:0+id","l:0+id","sp:0+id","speaker:0+id","stage:0+id"];
+		try {
+			String regPath = outDirTxm + "/registry/"+"bvh"
+			cwbEn.run(new File(cwbLoc,"cwb-encode").getAbsolutePath(), outDirTxm + "/data", outDir + "/wtc/"+"bvh.wtc", regPath, pAttributes, sAttributes);
+			if (!new File(regPath).exists()) {
+				println "Error: The registry file was not created: $regPath. See https://groupes.renater.fr/wiki/txm-users/public/faq"
+				return false;
+			}
+			cwbMa.run(new File(cwbLoc,"cwb-makeall").getAbsolutePath(), "BVH", outDirTxm + "/registry");
+			
+		} catch (Exception ex) {System.out.println(ex); return false}
+		
+		System.out.println("Done.") 
+		
+		return true;
+	}
+	
+	/**
+	 * show cwb-encode and cwb-makeall messages.
+	 */
+	public void setDebug()
+	{
+		this.debug = true;
+	}
+	
+	/**
+	 * test purpose.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args)
+	{
+		File dir = new File("~/xml/bvh");
+		def c = new compiler();
+		c.setDebug();
+		c.setCwbPath("~/TXM/cwb/bin");
+		c.run(dir);
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/bvh/package.html
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/bvh/package.html	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/bvh/package.html	(revision 258)
@@ -0,0 +1,12 @@
+<html>
+<body>
+<p>The BVH import module<br>
+The bvhLoader.groovy script is the main entry point.<br>
+Process : <br>
+1- Reads a directory containing XML files who follow the BVH encoding guidelines, see <a href="http://www.bvh.univ-tours.fr/">BVH website</a>.<br/>
+2- Annotates with <b>rgaqcj.par</b> and <b>afr.par</b> models.<br> 
+3- Builds a TXM corpus with the name of the directory. <br/>
+4- Builds an edition similar to the BVH's one.<br/><big>Hello</big><big><br></big><big>
+</big></p><big>
+</big></body><big>
+</big></html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/org/txm/importer/bvh/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/importer/bvh/pager.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/bvh/pager.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/bvh/pager.groovy	(revision 258)
@@ -0,0 +1,374 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2017-01-24 18:11:42 +0100 (Tue, 24 Jan 2017) $
+// $LastChangedRevision: 3400 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer.bvh;
+
+import org.txm.importer.*;
+import org.xml.sax.Attributes;
+import org.txm.importer.filters.*;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.stream.*;
+import java.net.URL;
+import org.xml.sax.InputSource;
+import org.xml.sax.helpers.DefaultHandler;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Build BVH texts simple edition from the TEI-TXM files. <br/>
+ * The result is similar to the edition of the BVH site. <br/>
+ * Segment edition by page at &lt;pb> tags. <br/>
+ * 
+ * @author mdecorde
+ * 
+ */
+class pager {
+	private List<String> NoSpaceBefore;
+	
+	/** The No space after. */
+	private List<String> NoSpaceAfter;
+
+	/** The wordcount. */
+	private int wordcount = 0;
+	
+	/** The pagecount. */
+	private int pagecount = 0;
+	
+	/** The wordmax. */
+	private int wordmax = 0;
+
+	/** The wordid. */
+	private String wordid;
+	
+	/** The first word. */
+	private boolean firstWord = true;
+	
+	/** The wordvalue. */
+	private String wordvalue;
+	
+	/** The interpvalue. */
+	private String interpvalue;
+	
+	/** The lastword. */
+	private String lastword = " ";
+	
+	/** The wordtype. */
+	private String wordtype;
+	
+	/** The flagform. */
+	private boolean flagform = false;
+	
+	/** The flaginterp. */
+	private boolean flaginterp = false;
+	
+	/** The url. */
+	private def url;
+	
+	/** The input data. */
+	private def inputData;
+	
+	/** The factory. */
+	private def factory;
+	
+	/** The parser. */
+	private XMLStreamReader parser;
+	
+	/** The writer. */
+	private OutputStreamWriter writer;
+	
+	/** The multiwriter. */
+	private OutputStreamWriter multiwriter = null;
+	
+	/** The infile. */
+	private File infile;
+	
+	/** The outfile. */
+	private File outfile;
+	
+	/** The pages. */
+	private ArrayList<File> pages = new ArrayList<File>();
+	
+	/** The idxstart. */
+	private ArrayList<String> idxstart = new ArrayList<String>();
+
+	/**
+	 * Instantiates a new pager.
+	 *
+	 * @param infile the file to convert
+	 * @param outfile the result file
+	 * @param NoSpaceBefore the punctuation marks that don't have a space before
+	 * @param NoSpaceAfter the punctuation marks that don't have a space after
+	 * @param max the max number of word per page
+	 */
+	pager(File infile, File outfile, List<String> NoSpaceBefore,
+			List<String> NoSpaceAfter, int max) {
+		this.wordmax = max;
+		this.NoSpaceBefore = NoSpaceBefore;
+		this.NoSpaceAfter = NoSpaceAfter;
+		this.url = infile.toURI().toURL();
+		this.infile = infile;
+
+		inputData = url.openStream();
+		factory = XMLInputFactory.newInstance();
+		parser = factory.createXMLStreamReader(inputData);
+		createOutput(outfile);
+		process();
+	}
+
+	/**
+	 * Creates the next output.
+	 *
+	 * @return true, if successful
+	 */
+	private boolean createNextOutput()
+	{
+		try {
+			if(multiwriter != null)
+			{
+				multiwriter.write("</body>");
+				multiwriter.write("</html>");
+				multiwriter.close();
+			}
+			pagecount++;
+			File f = new File(outfile.getParent()+"/multi/",outfile.getName().substring(0,outfile.getName().length()-5)+"_"+pagecount+".html");
+			pages.add(f);
+			idxstart.add(wordid)
+			multiwriter = new OutputStreamWriter(new FileOutputStream(f) , "UTF-8");
+			
+			multiwriter.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
+			multiwriter.write("<html>");
+			multiwriter.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/>");
+			multiwriter.write("<head>");
+			multiwriter.write("<title>BVH Edition - Page "+pagecount+"</title>");
+			multiwriter.write("</head>");
+			multiwriter.write("<body>");
+			
+			return true;
+		} catch (Exception e) {
+			System.out.println(e.getLocalizedMessage());
+			return false;
+		}
+	}
+
+	/**
+	 * Creates the output.
+	 *
+	 * @param outfile the outfile
+	 * @return true, if successful
+	 */
+	private boolean createOutput(File outfile) {
+		try {
+			this.outfile = outfile;
+
+			writer = new OutputStreamWriter(new FileOutputStream(outfile),
+					"UTF-8");
+			createNextOutput();
+			return true;
+		} catch (Exception e) {
+			System.out.println(e.getLocalizedMessage());
+			return false;
+		}
+	}
+
+	/**
+	 * Gets the page files.
+	 *
+	 * @return the geenrated edition page path
+	 */
+	public ArrayList<File> getPageFiles() {
+		return pages;
+	}
+
+	/**
+	 * Gets the idx.
+	 *
+	 * @return the id of the edition
+	 */
+	public ArrayList<String> getIdx() {
+		return idxstart;
+	}
+
+	/**
+	 * start processing.
+	 */
+	void process()
+	{
+		String localname = "";
+		
+		writer.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
+		writer.write("<html>");
+		writer.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/>");
+		writer.write("<head>");
+		writer.write("<title>BVH edition</title>");
+		writer.write("</head>");
+		writer.write("<body>");
+		
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+			
+			
+			switch (event) {
+				case XMLStreamConstants.START_ELEMENT:
+					localname = parser.getLocalName();
+					switch(localname)
+					{
+						case "head":
+							writer.write("<h2>\n")
+							multiwriter.write("<h2>\n")
+							break;
+						
+						case "lg":
+							writer.write("<p>\n")
+							multiwriter.write("<p>\n")
+							break;
+							
+						case "pb":
+							createNextOutput();
+						break;
+						
+						case "l":
+							writer.write("<br/>\n")
+							multiwriter.write("<br/>\n")
+							break;
+						
+						case "p":
+						case "q":
+							writer.write("<p>\n")
+							multiwriter.write("<p>\n")
+							break;
+						
+						case "w":
+							wordid=parser.getAttributeValue(null,"id");
+							if(firstWord)
+							{
+								firstWord=false;
+								this.idxstart.set(0,wordid);
+							}
+							wordcount++;
+							if(wordcount >= wordmax)
+							{
+								
+								wordcount=0;
+							}
+							break;
+						
+						case "ana":
+							flaginterp=true;
+							interpvalue+=" "+parser.getAttributeValue(null,"type").substring(1)+":"
+							break;
+						
+						case "form":
+							wordvalue="";
+							interpvalue ="";
+							flagform=true;
+					}
+					break;
+				case XMLStreamConstants.END_ELEMENT:
+					localname = parser.getLocalName();
+					switch(localname)
+					{
+						case "head":
+							writer.write("</h2>\n")
+							multiwriter.write("</h2>\n")
+							break;
+						
+						case "lg":
+							writer.write("</p>\n")
+							multiwriter.write("</p>\n")
+							break;
+						
+						case "lb":
+							writer.write("<br/>\n")
+							multiwriter.write("<br/>\n")
+							break;
+												
+						case "p":
+						case "q":
+							writer.write("</p>\n")
+							multiwriter.write("</p>\n")
+							break;
+							
+						case "form":
+							flagform = false
+						
+							break;
+						
+						case "ana":
+							flaginterp = false
+							break;
+						
+						case "w":
+							int l = lastword.length();
+							String endOfLastWord = "";
+							if(l > 0)
+								endOfLastWord = lastword.subSequence(l-1, l);
+							
+							if(interpvalue != null)
+								interpvalue = interpvalue.replace("\"","&quot;");
+							
+							if(NoSpaceBefore.contains(wordvalue) || 
+									NoSpaceAfter.contains(lastword) || 
+									wordvalue.startsWith("-") || 
+									NoSpaceAfter.contains(endOfLastWord))
+							{
+								writer.write("<span title=\""+interpvalue+"\" id=\""+wordid+"\">");
+								multiwriter.write("<span title=\""+interpvalue+"\" id=\""+wordid+"\">");
+							}
+							else
+							{
+								writer.write(" <span title=\""+interpvalue+"\" id=\""+wordid+"\">");
+								multiwriter.write(" <span title=\""+interpvalue+"\" id=\""+wordid+"\">");
+							}
+							writer.write(wordvalue.replace("<", "&lt;")+"</span>");
+							multiwriter.write(wordvalue.replace("<", "&lt;")+"</span>");
+							lastword=wordvalue;
+							break;
+					}
+					break;
+				
+				case XMLStreamConstants.CHARACTERS:
+					if(flagform)
+						if(parser.getText().length() > 0)
+							wordvalue+=(parser.getText());
+					if(flaginterp)
+						if(parser.getText().length() > 0)
+							interpvalue+=(parser.getText());
+					break;
+			}
+		}	
+		writer.write("</body>");
+		writer.write("</html>");
+		writer.close();
+		multiwriter.write("</body>");
+		multiwriter.write("</html>");
+		multiwriter.close();
+		inputData.close();
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/bvh/importer.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/bvh/importer.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/bvh/importer.groovy	(revision 258)
@@ -0,0 +1,173 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer.bvh
+
+import org.txm.importer.*;
+import org.txm.importer.filters.*;
+import org.txm.scripts.*;
+import org.txm.importer.cwb.CwbEncode
+import org.txm.importer.cwb.CwbMakeAll
+import org.txm.scripts.teitxm.*;
+import org.txm.utils.treetagger.TreeTagger;
+import javax.xml.stream.*;
+import java.io.File;
+import java.net.URL;
+
+import org.txm.*;
+
+import filters.CutHeader.*;
+import filters.Tokeniser.*;
+import filters.FusionHeader.*;
+import filters.TagSentences.TagSentences;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Convert TEI-BVH to TEI-TXM <br/>
+ * 1- tokenize<br/>
+ * 2- launch XML2TEITXM with no annotation import <br/>.
+ *
+ * @author mdecorde
+ */
+class importer {
+	
+	/**
+	 * Run.
+	 *
+	 * @param rootDirFile contains the source files
+	 */
+	public static void run(File rootDirFile, String basename)
+	{
+		
+		File fullfile;
+		String rootDir =rootDirFile.getAbsolutePath();
+		
+		ArrayList<String> milestones = new ArrayList<String>();//the tags who you want them to stay milestones
+		milestones.add("tagUsage");
+		milestones.add("pb");
+		milestones.add("lb");
+		
+		File binDir = new File(Toolbox.getParam(Toolbox.USER_TXM_HOME),"corpora/"+basename);
+		binDir.deleteDir();
+		binDir.mkdir();
+		new File(binDir,"ptokenized").deleteDir();
+		new File(binDir,"ptokenized").mkdir();
+		new File(binDir,"tokenized").deleteDir();
+		new File(binDir,"tokenized").mkdir();
+		new File(binDir,"txm").deleteDir();
+		new File(binDir,"txm").mkdir();
+		
+		//PREPARE EACH SPLITED FILE TO BE TOKENIZED
+		List<File> srcfiles = rootDirFile.listFiles();
+		println("Preparing Tokenizing "+srcfiles.size()+" files")
+		for(File f : srcfiles)
+		{
+			print "."
+			File srcfile = f;
+			File resultfile = new File(binDir,"ptokenized/"+f.getName());
+			//println("prepare tokenizer file : "+srcfile+" to : "+resultfile );
+			def builder = new OneTagPerLine(srcfile.toURL(), milestones);
+			builder.process(resultfile);
+		}
+		println ""
+		rootDir = binDir.getAbsolutePath();
+		
+		//TOKENIZE FILES
+		List<File> ptokenfiles = new File(rootDir,"ptokenized").listFiles()	
+		println("Tokenizing "+ptokenfiles.size()+" files")
+		for(File f : ptokenfiles)
+		{
+			print "."
+			Sequence S = new Sequence();
+			Filter F1 = new CutHeader();
+			Filter F6 = new Tokeniser(f);
+			Filter F7 = new TagSentences();
+			Filter F11 = new FusionHeader();
+			S.add(F1);
+			S.add(F6);
+			S.add(F7);
+			S.add(F11);
+			File infile = new File(rootDir+"/ptokenized",f.getName());
+			File xmlfile = new File(rootDir+"/tokenized",f.getName());
+			File headerfile = new File(rootDir+"/ptokenized/",f.getName()+"header.xml");
+			
+			S.SetInFileAndOutFile(infile.getPath(), xmlfile.getPath());
+			S.setEncodages("UTF-8","UTF-8");
+			Object[] arguments1 = [headerfile.getAbsolutePath()];
+			F1.SetUsedParam(arguments1);
+			Object[] arguments2 = [headerfile.getAbsolutePath(),F1];
+			F11.SetUsedParam(arguments2);
+			S.proceed();
+			
+			S.clean();
+			//headerfile.delete();//remove the prepared file to clean
+		}
+		println ""
+		
+		//TRANSFORM INTO XML-TEI-TXM
+		List<File> tokenfiles = new File(rootDir,"tokenized").listFiles()	
+		println("Building "+tokenfiles.size()+" xml-tei-txm files")
+		for(File f : tokenfiles)
+		{
+			print "."
+			File file = f; 
+			String txmfile = f.getName();
+			
+			def correspType = new HashMap<String,String>()
+			def correspRef = new HashMap<String,String>()
+			//il faut lister les id de tous les respStmt
+			def respId = [];
+			//fait la correspondance entre le respId et le rapport d'execution de l'outil
+			def applications = new HashMap<String,HashMap<String,String>>();	
+			//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[]>();
+			//associe un id d'item avec sa description et son URI
+			def itemsURI = new HashMap<String,HashMap<String,String>>();
+			//informations de respStmt
+			//resps (respId <voir ci-dessus>, [description, person, date])
+			def resps = new HashMap<String,String[]>();
+			//lance le traitement
+			String wordprefix = "w_";
+			def builder = new Xml2Ana(file);
+			builder.setCorrespondances(correspRef, correspType);
+			builder.setHeaderInfos(respId,resps, applications, taxonomiesUtilisees, itemsURI)
+			builder.process(new File(new File(rootDir,"txm"),txmfile));
+		}
+		println ""
+	}
+	
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args)
+	{
+		new importer().run(new File("~/xml/bvh"));
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/MileStoneProjection.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/MileStoneProjection.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/MileStoneProjection.groovy	(revision 258)
@@ -0,0 +1,111 @@
+package org.txm.importer
+
+import java.io.File;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamWriter;
+import java.io.File;
+import java.net.URL;
+import javax.xml.stream.*;
+import org.txm.importer.filters.*;
+import org.txm.importer.graal.PersonalNamespaceContext;
+
+/**
+ * add 2 attributes per element to encode the distance to the previous milestone and next milestone
+ * TODO: only the first attribute is implemented
+ * 
+ * @author mdecorde
+ *
+ */
+class MileStoneProjection extends StaxIdentityParser {
+	String wordTag
+	String mileStoneTag
+	String startTag
+	boolean start = false
+
+	int mileStoneDistance = 0
+
+	String mileStoneID = ""
+	def milestonesLength = []
+	int milestonesCounter = 0
+	boolean secondPass = false
+	
+	String msIdAttributeName
+	String msStartAttributeName
+	String msEndAttributeName
+
+	public MileStoneProjection(File inputFile, String startTag, String wordTag, String mileStoneTag) {
+		super(inputFile)
+
+		this.wordTag = wordTag
+		this.mileStoneTag = mileStoneTag
+		mileStoneID = mileStoneTag+"_0"
+		this.startTag = startTag
+		this.start = false;
+		
+		msIdAttributeName = mileStoneTag+"id";
+		msStartAttributeName = mileStoneTag+"start";
+		msEndAttributeName = mileStoneTag+"end";
+
+		fetchMilestoneLengths();
+		start = false // reset
+	}
+
+	public void fetchMilestoneLengths() {
+		def inputData = inputurl.openStream();
+		def factory = XMLInputFactory.newInstance();
+		def parser = factory.createXMLStreamReader(inputData);
+
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+			switch (event) {
+				case XMLStreamConstants.START_ELEMENT:
+					localname = parser.getLocalName()
+					if (start && localname == mileStoneTag) {
+						milestonesLength << mileStoneDistance;
+						mileStoneDistance = 0
+						milestonesCounter++;
+					} else if (start && localname == wordTag) {
+						mileStoneDistance++
+					} else if (localname == startTag) {
+						start = true
+					}
+					break;
+			}
+		}
+		milestonesLength[milestonesCounter] = mileStoneDistance;
+		parser.close()
+		milestonesCounter = 0;
+	}
+
+
+	
+	public void processStartElement() {
+		super.processStartElement();
+
+		if (start && localname == mileStoneTag) {
+			mileStoneDistance = 0
+			mileStoneID = parser.getAttributeValue(null, "id")
+			if (mileStoneID == null) mileStoneID = parser.getAttributeValue("xml", "id");
+			if (mileStoneID == null) mileStoneID = "0";
+			
+			milestonesCounter++;
+		} else if (start && localname == wordTag) {
+			// println "end of $milestonesCounter len="+milestonesLength[milestonesCounter]+" dist="+mileStoneDistance
+			writer.writeAttribute(msEndAttributeName, Integer.toString((milestonesLength[milestonesCounter] - mileStoneDistance - 1)))
+			writer.writeAttribute(msStartAttributeName, Integer.toString(mileStoneDistance))
+			writer.writeAttribute(msIdAttributeName, mileStoneID)
+
+			mileStoneDistance++
+		} else if (localname == startTag) {
+			start = true
+		}
+	}
+
+	public static void main(String[] args) {
+		File inputFile = new File("/home/mdecorde/TXM/corpora/BVHEPISTEMON2016/tokenized/1538_MarotAdole.xml")
+		File outputFile = new File("/home/mdecorde/TEMP/tmp.xml")
+
+		MileStoneProjection msp = new MileStoneProjection(inputFile, "body", "w", "lb");
+		println "Sucess: "+msp.process(outputFile)
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/WExtract.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/WExtract.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/WExtract.groovy	(revision 258)
@@ -0,0 +1,334 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2015-12-17 12:11:39 +0100 (Thu, 17 Dec 2015) $
+// $LastChangedRevision: 3087 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+import javax.xml.stream.*;
+import java.io.File;
+import java.net.URL;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Extract w tags from a tei file
+ * not finished.
+ *
+ * @author mdecorde
+ */
+class WExtract 
+{
+	
+	/**
+	 * Process.
+	 *
+	 * @param infile the infile
+	 * @param outfile the outfile
+	 * @param max the max
+	 * @return the java.lang. object
+	 */
+	public process(File infile, File outfile, int max)
+	{
+		println "Process "+infile.getName()+", keep $max words"
+		int count = this.countW(infile);
+		if(count < max)
+		{
+			println "can't extract $max words, the file "+infile.getName()+" contains only $count words"
+			return;
+		}
+		String ms = "#ms_K"
+		int tier = max/3;
+		int from1 = 0 
+		int to1 = tier;
+		int from2 = (count/2) - (tier/2);
+		int to2 =(count/2) + (tier/2);
+		int from3 = count -tier;
+		int to3= count-1;
+		boolean isSic = false;
+		boolean isW = false;
+		boolean isText = false;
+		boolean printW = true;
+		int wcount=0;
+		
+		println " count : "+count
+		println "  get from "+from1+" to "+to1
+		println "  get from "+from2+" to "+to2
+		println "  get from "+from3+" to "+to3
+		
+		
+		String localname;
+		String prefix;
+		InputStream inputData = infile.toURI().toURL().openStream();
+		XMLInputFactory inputfactory = XMLInputFactory.newInstance();
+		XMLStreamReader parser = inputfactory.createXMLStreamReader(inputData);
+		XMLOutputFactory factory = XMLOutputFactory.newInstance();
+		
+		FileOutputStream output = new FileOutputStream(outfile);
+		XMLStreamWriter writer = factory.createXMLStreamWriter(output, "UTF-8");
+		
+		writer.writeStartDocument("utf-8", "1.0");
+		
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) 
+		{
+			if(isText)
+			{
+				if((wcount >= from1 && wcount <= to1 )||
+				(wcount >= from2 && wcount <= to2) ||
+				(wcount >= from3 && wcount <= to3))
+					printW = true;
+				else
+					printW = false;
+			}
+			else
+				printW = true;
+			
+			switch (event) 
+			{
+				case XMLStreamConstants.START_ELEMENT:
+					localname = parser.getLocalName();
+					prefix = parser.getPrefix();
+				
+				/*
+				 if(localname == "supplied")
+				 if(parser.getAttributeValue(null,"source") != null)
+				 ms = parser.getAttributeValue(null,"source")
+				 if(localname == "sic")
+				 {
+				 isSic= true;
+				 }
+				 */
+					if(localname == "text")
+						isText = true;
+				
+					if(localname == "w")
+					{
+						isW= true;
+						wcount++;
+						
+						if(isText)
+						{
+							if((wcount >= from1 && wcount <= to1 )||
+							(wcount >= from2 && wcount <= to2) ||
+							(wcount >= from3 && wcount <= to3))
+								printW = true;
+							else
+								printW = false;
+						}
+						else
+							printW = true;
+					}
+				
+				/*if(!isSic)
+				 if(localname != "choice" && localname != "corr" && localname != "sic" && localname != "supplied" && localname != "seg")
+				 {*/
+					if(localname == "w")
+					{
+						if(printW)
+						{
+							if(prefix != null && prefix.length() > 0)
+								writer.writeStartElement(prefix+":"+localname);
+							else
+								writer.writeStartElement(localname);
+							
+							for(int i= 0 ; i < parser.getAttributeCount() ;i++ )
+							{
+								if(parser.getAttributePrefix(i)!= "")
+									writer.writeAttribute(parser.getAttributePrefix(i)+":"+parser.getAttributeLocalName(i), parser.getAttributeValue(i));
+								else
+									writer.writeAttribute(parser.getAttributeLocalName(i), parser.getAttributeValue(i));
+							}
+							//writer.writeAttribute("srcmf:src", ms);
+						}
+					}
+					else
+					{
+						if(prefix != null && prefix.length() > 0)
+							writer.writeStartElement(prefix+":"+localname);
+						else
+							writer.writeStartElement(localname);
+						
+						if(localname == "teiHeader")
+						{
+							writer.writeAttribute("xmlns:me", "http://www.menota.org/ns/1.0");
+							writer.writeAttribute("xmlns:bfm", "http://bfm.ens-lsh.fr/ns/1.0");
+							//writer.writeAttribute("xmlns:srcmf", "https://listes.cru.fr/wiki/srcmf/index");
+						}
+						
+						if(localname == "TEI")
+						{
+							writer.writeAttribute("xmlns","http://www.tei-c.org/ns/1.0");
+						}
+						
+						for(int i= 0 ; i < parser.getAttributeCount() ;i++ )
+						{
+							if(parser.getAttributePrefix(i)!= "")
+								writer.writeAttribute(parser.getAttributePrefix(i)+":"+parser.getAttributeLocalName(i), parser.getAttributeValue(i));
+							else
+								writer.writeAttribute(parser.getAttributeLocalName(i), parser.getAttributeValue(i));
+						}
+					}
+				//}
+					break;
+				
+				case XMLStreamConstants.END_ELEMENT:
+					localname =parser.getLocalName()
+				
+				/*if(localname == "sic")
+				 isSic= false;
+				 if(localname == "w")
+				 isW= false;
+				 if(localname == "supplied" && ms != "#ms_K")
+				 ms = "#ms_K";
+				 if(!isSic)
+				 if(localname != "choice" && localname != "corr" && localname != "sic" && localname != "supplied" && localname != "seg")
+				 {*/
+					if(localname == "w")
+					{
+						if(printW)
+						{
+							writer.writeEndElement();
+							writer.writeCharacters("\n");
+						}
+					}
+					else
+					{	
+						writer.writeEndElement();
+						writer.writeCharacters("\n");
+					}
+				//	}
+				
+					break;
+				
+				case XMLStreamConstants.CHARACTERS:
+				//if(!isSic)
+					if(isW)
+					{
+						if(printW)
+						{
+							writer.writeCharacters(parser.getText().trim());
+						}
+					}
+					else
+						writer.writeCharacters(parser.getText().trim());
+					break;
+			}
+		}
+		writer.flush();
+		writer.close();
+		output.close()
+		inputData.close();
+	}
+	
+	/**
+	 * Count w.
+	 *
+	 * @param infile the infile
+	 * @return the int
+	 */
+	public int countW(File infile)
+	{
+		InputStream inputData = infile.toURI().toURL().openStream();
+		XMLInputFactory inputfactory = XMLInputFactory.newInstance();
+		XMLStreamReader parser = inputfactory.createXMLStreamReader(inputData);
+		
+		int count = 0;
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) 
+		{
+			switch (event) 
+			{
+				case XMLStreamConstants.START_ELEMENT:
+					if(parser.getLocalName() == "w")
+						count++;
+			}
+		}
+		inputData.close()
+		return count;
+	}
+	
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args)
+	{
+		String userDir = System.getProperty("user.home");
+		
+		File directory = new File(userDir+"/xml/extract/");
+		File outdir = new File(userDir+"/xml/extract/","results");
+		outdir.mkdir();
+		
+		File maxfile = new File(userDir+"/xml/extract/maxfile");
+		/*
+		 * maxfile format:
+		 * 
+		 * filename1.xml	45000
+		 * filename2.xml	22500
+		 * filename3.xml	45000
+		 */
+		HashMap<File, Integer> maxperfile = new HashMap<File, Integer>();
+		maxfile.eachLine{it->
+			String[] split = it.split("\t");
+			if(split.length == 2)
+			{
+				try
+				{
+				String filename = it.split("\t")[0];
+				int max = Integer.parseInt(it.split("\t")[1])
+				maxperfile.put(filename, max);
+				}catch(Exception e ){}
+			}
+		}
+		println maxperfile;
+		
+		def files = directory.listFiles();
+		for(File infile : files)
+		{
+			
+			if(maxperfile.containsKey(infile.getName()))
+			{
+				File outfile = new File(outdir, infile.getName());
+				int max= maxperfile.get(infile.getName());
+				new WExtract().process(infile, outfile, max)
+			}
+		}
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/StaxStackWriter.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/StaxStackWriter.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/StaxStackWriter.groovy	(revision 258)
@@ -0,0 +1,259 @@
+package org.txm.importer
+
+import java.nio.charset.Charset;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.stream.*;
+
+import org.eclipse.core.runtime.Platform;
+
+public class StaxStackWriter implements XMLStreamWriter {
+
+	XMLStreamWriter writer;
+	OutputStream output;
+	def events = [];
+	
+	public StaxStackWriter(File file, String encoding) {
+		XMLOutputFactory factory = XMLOutputFactory.newInstance();
+		this.output = new BufferedOutputStream(new FileOutputStream(file));
+		this.writer = factory.createXMLStreamWriter(output, encoding); //create a new file
+	}
+	
+	public StaxStackWriter(OutputStream output, String encoding) {
+		XMLOutputFactory factory = XMLOutputFactory.newInstance();
+		this.output = output
+		this.writer = factory.createXMLStreamWriter(output, encoding);//create a new file
+	}
+	
+	public StaxStackWriter(OutputStream output) {
+		XMLOutputFactory factory = XMLOutputFactory.newInstance();
+		this.output = output
+		this.writer = factory.createXMLStreamWriter(output, "UTF-8");//create a new file
+	}
+
+	Charset UTF8 = Charset.forName("UTF-8");
+	public void write(String txt) {
+		output.write(txt.getBytes(UTF8))
+	}
+	
+	public void writeEndElements() {
+		int size = events.size();
+		for (int i = 0 ; i < size ; i++) {
+			writeEndElement();
+		}
+		events = [];
+	}
+
+	public void writeStartElements(def tagsToWrite) {
+		for (String tag : tagsToWrite)
+			writeStartElement(tag);
+	}
+
+	public def getTagStack() {
+		return events;
+	}
+
+	@Override
+	public void close () throws XMLStreamException {
+		writer.close();
+		output.close();
+	}
+
+	@Override
+	public void flush () throws XMLStreamException {
+		writer.flush();
+
+	}
+
+	@Override
+	public NamespaceContext getNamespaceContext() {
+		return writer.getNamespaceContext();
+	}
+
+	@Override
+	public String getPrefix (String uri) throws XMLStreamException {
+		return writer.getPrefix(uri);
+	}
+
+	@Override
+	public Object getProperty (String name) throws IllegalArgumentException {
+		return writer.getProperty(name);
+	}
+
+	@Override
+	public void setDefaultNamespace (String uri) throws XMLStreamException {
+		writer.setDefaultNamespace(uri);
+	}
+
+	@Override
+	public void setNamespaceContext(NamespaceContext context)
+	throws XMLStreamException {
+		writer.setNamespaceContext(context);
+	}
+
+	@Override
+	public void setPrefix (String prefix, String uri) throws XMLStreamException {
+		writer.setPrefix(prefix, uri);
+	}
+
+	@Override
+	public void writeAttribute (String localName, String value) throws XMLStreamException {
+		writer.writeAttribute(localName, value);
+	}
+
+	@Override
+	public void writeAttribute (String namespaceURI, String localName, String value) throws XMLStreamException {
+		writer.writeAttribute(namespaceURI, localName, value);
+	}
+
+	@Override
+	public void writeAttribute (String prefix, String namespaceURI, String localName, String value) throws XMLStreamException {
+		writer.writeAttribute(prefix, namespaceURI, localName, value);
+	}
+
+	@Override
+	public void writeCData (String data) throws XMLStreamException {
+		writer.writeCData(data);
+	}
+
+	@Override
+	public void writeCharacters (String text) throws XMLStreamException {
+		writer.writeCharacters(text);
+	}
+
+	@Override
+	public void writeCharacters (char[] text, int start, int len) throws XMLStreamException {
+		writer.writeCharacters(text, start, len);
+	}
+
+	@Override
+	public void writeComment (String data) throws XMLStreamException {
+		writer.writeComment(data);
+	}
+
+	@Override
+	public void writeDTD (String dtd) throws XMLStreamException {
+		writer.writeDTD(dtd);
+	}
+
+	@Override
+	public void writeDefaultNamespace(String namespaceURI)
+	throws XMLStreamException {
+		writer.writeDefaultNamespace(namespaceURI);
+	}
+
+	public void writeElement (String localName, String text) throws XMLStreamException {
+		writer.writeStartElement(localName);
+		writer.writeCharacters(text);
+		writer.writeEndElement();
+	}
+	
+	public void writeElement (String localName, def map, String text) throws XMLStreamException {
+		writer.writeStartElement(localName);
+		for (def key : map.keySet()) writeAttribute(key.toString(), map[key].toString());
+		writer.writeCharacters(text);
+		writer.writeEndElement();
+	}
+
+	@Override
+	public void writeEmptyElement (String localName) throws XMLStreamException {
+		writer.writeEmptyElement(localName);
+	}
+
+	public void writeEmptyElement (String localName, def map) throws XMLStreamException {
+		writer.writeEmptyElement(localName);
+		for (def key : map.keySet())
+			writeAttribute(key.toString(), map[key].toString());
+	}
+
+	@Override
+	public void writeEmptyElement(String namespaceURI, String localName)
+	throws XMLStreamException {
+		writer.writeEmptyElement(namespaceURI, localName);
+	}
+
+	@Override
+	public void writeEmptyElement (String prefix, String localName, String namespaceURI) throws XMLStreamException {
+		writer.writeEmptyElement(prefix, localName, namespaceURI);
+	}
+
+	@Override
+	public void writeEndDocument () throws XMLStreamException {
+		writer.writeEndDocument();
+	}
+
+	@Override
+	public void writeEndElement () throws XMLStreamException {
+		writer.writeEndElement();
+		events.pop()
+
+	}
+
+	@Override
+	public void writeEntityRef (String name) throws XMLStreamException {
+		writer.writeEntityRef(name);
+	}
+
+	@Override
+	public void writeNamespace(String prefix, String namespaceURI)
+	throws XMLStreamException {
+		writer.writeNamespace(prefix, namespaceURI);
+	}
+
+	@Override
+	public void writeProcessingInstruction(String target)
+	throws XMLStreamException {
+		writer.writeProcessingInstruction(target);
+	}
+
+	@Override
+	public void writeProcessingInstruction(String target, String data)
+	throws XMLStreamException {
+		writer.writeProcessingInstruction(target, data);
+	}
+
+	@Override
+	public void writeStartDocument () throws XMLStreamException {
+		writer.writeStartDocument();
+
+	}
+
+	@Override
+	public void writeStartDocument (String version) throws XMLStreamException {
+		writer.writeStartDocument(version);
+	}
+
+	@Override
+	public void writeStartDocument(String encoding, String version)
+	throws XMLStreamException {
+		writer.writeStartDocument(encoding, version);
+	}
+
+	@Override
+	public void writeStartElement (String localName) throws XMLStreamException {
+		writer.writeStartElement(localName);
+		events << localName
+
+	}
+	
+	public void writeStartElement (String localName, def map) throws XMLStreamException {
+		writeStartElement(localName);
+		for (def key : map.keySet()) {
+			writeAttribute(key.toString(), map[key].toString());
+		}
+	}
+
+	@Override
+	public void writeStartElement(String namespaceURI, String localName)
+	throws XMLStreamException {
+		writer.writeStartElement(namespaceURI, localName);
+		events << localName
+	}
+
+	@Override
+	public void writeStartElement(String prefix, String localName,
+	String namespaceURI) throws XMLStreamException {
+		writer.writeStartElement(prefix, localName, namespaceURI);
+		events << localName
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/WExtractWithMode.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/WExtractWithMode.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/WExtractWithMode.groovy	(revision 258)
@@ -0,0 +1,376 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2011-10-19 17:50:26 +0200 (mer., 19 oct. 2011) $
+// $LastChangedRevision: 2038 $
+// $LastChangedBy: alavrentev $ 
+//
+package org.txm.importer
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+import javax.xml.stream.*;
+import java.io.File;
+import java.net.URL;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Extract w tags from a tei file
+ * not finished.
+ *
+ * @author mdecorde
+ */
+class WExtractWithMode 
+{
+	
+	/**
+	 * Process.
+	 *
+	 * @param infile the infile
+	 * @param outfile the outfile
+	 * @param max the max
+	 * @return the java.lang. object
+	 */
+	public process(File infile, File outfile, String modemax)
+	{
+		println "Process "+infile.getName()+", keep $modemax words"
+		int count = this.countW(infile);
+		
+		int max = 0
+		String mode = ""
+		
+		try {
+		mode = modemax.split("/")[0]
+		max = Integer.parseInt(modemax.split("/")[1])		
+		}catch(Exception e ){}
+		
+		if(count < max)
+		{
+			println "can't extract $max words, the file "+infile.getName()+" contains only $count words"
+			return;
+		}
+		//String ms = "#ms_K"
+		int part = 0; 
+		if (mode == "3")
+		{
+			part = max/3		
+		}
+		else if (mode == "2")
+		{
+			part = max/2
+		}
+		else if (mode == "1a" || mode == "1m" || mode == "1z")
+		{
+			part = max
+		}
+		else
+		{
+			println "mode must be 1a, 1m, 1z, 2 or 3"
+			return
+		}
+		int from1 = 0 
+		int to1 = 0
+		if (mode != "1m" && mode != "1z")
+		{
+			to1 = part
+		}
+		int from2 = 0
+		int to2 = 0
+		if (mode == "3" || mode == "1m")
+		{
+			from2 = (count/2) - (part/2);
+			to2 =(count/2) + (part/2);			
+		}
+		int from3 = 0
+		int to3 = 0
+		if (mode != "1a" && mode != "1m")
+		{
+			from3 = count -part;
+			to3= count-1;			
+		}
+		boolean isSic = false;
+		boolean isW = false;
+		boolean isText = false;
+		boolean printW = true;
+		int wcount=0;
+		
+		println " count : "+count
+		println "  get from "+from1+" to "+to1
+		println "  get from "+from2+" to "+to2
+		println "  get from "+from3+" to "+to3
+		
+		
+		String localname;
+		String prefix;
+		InputStream inputData = infile.toURI().toURL().openStream();
+		XMLInputFactory inputfactory = XMLInputFactory.newInstance();
+		XMLStreamReader parser = inputfactory.createXMLStreamReader(inputData);
+		XMLOutputFactory factory = XMLOutputFactory.newInstance();
+		
+		FileOutputStream output = new FileOutputStream(outfile)
+		XMLStreamWriter writer = factory.createXMLStreamWriter(output, "UTF-8");
+		
+		writer.writeStartDocument("utf-8", "1.0");
+		
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) 
+		{
+			if(isText)
+			{
+				if((wcount >= from1 && wcount <= to1 )||
+				(wcount >= from2 && wcount <= to2) ||
+				(wcount >= from3 && wcount <= to3))
+					printW = true;
+				else
+					printW = false;
+			}
+			else
+				printW = true;
+			
+			switch (event) 
+			{
+				case XMLStreamConstants.START_ELEMENT:
+					localname = parser.getLocalName();
+					prefix = parser.getPrefix();
+				
+				/*
+				 if(localname == "supplied")
+				 if(parser.getAttributeValue(null,"source") != null)
+				 ms = parser.getAttributeValue(null,"source")
+				 if(localname == "sic")
+				 {
+				 isSic= true;
+				 }
+				 */
+					if(localname == "text")
+						isText = true;
+				
+					if(localname == "w")
+					{
+						isW= true;
+						wcount++;
+						
+						if(isText)
+						{
+							if((wcount >= from1 && wcount <= to1 )||
+							(wcount >= from2 && wcount <= to2) ||
+							(wcount >= from3 && wcount <= to3))
+								printW = true;
+							else
+								printW = false;
+						}
+						else
+							printW = true;
+					}
+				
+				/*if(!isSic)
+				 if(localname != "choice" && localname != "corr" && localname != "sic" && localname != "supplied" && localname != "seg")
+				 {*/
+					if(localname == "w")
+					{
+						if(printW)
+						{
+							if(prefix != null && prefix.length() > 0)
+								writer.writeStartElement(prefix+":"+localname);
+							else
+								writer.writeStartElement(localname);
+							
+							for(int i= 0 ; i < parser.getAttributeCount() ;i++ )
+							{
+								if(parser.getAttributePrefix(i)!= "")
+									writer.writeAttribute(parser.getAttributePrefix(i)+":"+parser.getAttributeLocalName(i), parser.getAttributeValue(i));
+								else
+									writer.writeAttribute(parser.getAttributeLocalName(i), parser.getAttributeValue(i));
+							}
+							//writer.writeAttribute("srcmf:src", ms);
+						}
+					}
+					else
+					{
+						if(prefix != null && prefix.length() > 0)
+							writer.writeStartElement(prefix+":"+localname);
+						else
+							writer.writeStartElement(localname);
+						
+						if(localname == "teiHeader")
+						{
+							writer.writeAttribute("xmlns:me", "http://www.menota.org/ns/1.0");
+							writer.writeAttribute("xmlns:bfm", "http://bfm.ens-lsh.fr/ns/1.0");
+							//writer.writeAttribute("xmlns:srcmf", "https://listes.cru.fr/wiki/srcmf/index");
+						}
+						
+						if(localname == "TEI")
+						{
+							writer.writeAttribute("xmlns","http://www.tei-c.org/ns/1.0");
+						}
+						
+						for(int i= 0 ; i < parser.getAttributeCount() ;i++ )
+						{
+							if(parser.getAttributePrefix(i)!= "")
+								writer.writeAttribute(parser.getAttributePrefix(i)+":"+parser.getAttributeLocalName(i), parser.getAttributeValue(i));
+							else
+								writer.writeAttribute(parser.getAttributeLocalName(i), parser.getAttributeValue(i));
+						}
+					}
+				//}
+					break;
+				
+				case XMLStreamConstants.END_ELEMENT:
+					localname =parser.getLocalName()
+				
+				/*if(localname == "sic")
+				 isSic= false;
+				 if(localname == "w")
+				 isW= false;
+				 if(localname == "supplied" && ms != "#ms_K")
+				 ms = "#ms_K";
+				 if(!isSic)
+				 if(localname != "choice" && localname != "corr" && localname != "sic" && localname != "supplied" && localname != "seg")
+				 {*/
+					if(localname == "w")
+					{
+						if(printW)
+						{
+							writer.writeEndElement();
+							writer.writeCharacters("\n");
+						}
+					}
+					else
+					{	
+						writer.writeEndElement();
+						writer.writeCharacters("\n");
+					}
+				//	}
+				
+					break;
+				
+				case XMLStreamConstants.CHARACTERS:
+				//if(!isSic)
+					if(isW)
+					{
+						if(printW)
+						{
+							writer.writeCharacters(parser.getText().trim());
+						}
+					}
+					else
+						writer.writeCharacters(parser.getText().trim());
+					break;
+			}
+		}
+		writer.flush();
+		writer.close();
+		output.close()
+		inputData.close();
+	}
+	
+	/**
+	 * Count w.
+	 *
+	 * @param infile the infile
+	 * @return the int
+	 */
+	public int countW(File infile)
+	{
+		InputStream inputData = infile.toURI().toURL().openStream();
+		XMLInputFactory inputfactory = XMLInputFactory.newInstance();
+		XMLStreamReader parser = inputfactory.createXMLStreamReader(inputData);
+		
+		int count = 0;
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) 
+		{
+			switch (event) 
+			{
+				case XMLStreamConstants.START_ELEMENT:
+					if(parser.getLocalName() == "w")
+						count++;
+			}
+		}
+		inputData.close()
+		return count;
+	}
+	
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args)
+	{
+		String userDir = System.getProperty("user.home");
+		
+		File directory = new File(userDir+"/xml/extract/");
+		File outdir = new File(userDir+"/xml/extract/","results");
+		outdir.mkdir();
+		
+		File maxfilemode = new File(userDir+"/xml/extract/maxfilemode");
+		/*
+		 * maxfilemode format:
+		 * 
+		 * filename1.xml	3	45000
+		 * filename2.xml	1a	15000
+		 * filename3.xml	1m	15000
+		 * filename4.xml	1z	15000
+		 * filename5.xml	2	22500
+		 */
+		HashMap<File, String> maxperfile = new HashMap<File, String>();
+		maxfilemode.eachLine{it->
+			String[] split = it.split("\t");
+			if(split.length == 3)
+			{
+				try
+				{
+				String filename = it.split("\t")[0];
+				String modemax = it.split("\t")[1]+"/"+it.split("\t")[2]
+				maxperfile.put(filename, modemax);
+				}catch(Exception e ){}
+			}
+		}
+		println maxperfile;
+		
+		def files = directory.listFiles();
+		for(File infile : files)
+		{
+			
+			if(maxperfile.containsKey(infile.getName()))
+			{
+				File outfile = new File(outdir, infile.getName());
+				String modemax = maxperfile.get(infile.getName());
+				new WExtractWithMode().process(infile, outfile, modemax)
+			}
+		}
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/RenameTag.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/RenameTag.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/RenameTag.groovy	(revision 258)
@@ -0,0 +1,146 @@
+// 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
+// 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.
+//
+//
+//
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$
+//
+package org.txm.importer
+
+import javax.xml.parsers.*
+import javax.xml.transform.*
+import javax.xml.xpath.*
+
+import org.txm.importer.graal.PersonalNamespaceContext
+import org.txm.utils.xml.DomUtils
+import org.w3c.dom.Document
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class RenameTag : using Stax or DOM depending on the file size
+ */
+class RenameTag extends StaxIdentityParser{
+
+	public static int DOMMAXSIZE = 1000000;
+	String newname, oldname;
+	File xmlfile;
+
+	public RenameTag(File xmlfile, String oldname, String newname)
+	{
+		super(xmlfile.toURI().toURL());
+		this.oldname = oldname;
+		this.newname = newname;
+		this.xmlfile = xmlfile;
+	}
+	/**
+	 * Rename an element - DOM method
+	 *
+	 * @param xmlfile the xmlfile
+	 * @param oldname the oldname
+	 * @param newname the newname
+	 * @return true, if successful
+	 */
+	public static boolean rename(File xmlfile, String oldname, String newname)
+	{
+		if (!xmlfile.exists()) {
+			println "Error: $xmlfile does not exists"
+		}
+
+		if (!(xmlfile.canRead() && xmlfile.canWrite())) {
+			println "Error: $xmlfile is not readable or writable"
+		}
+
+		if (xmlfile.length() <= DOMMAXSIZE) {
+			String xpath = "//"+oldname;
+			DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
+			domFactory.setNamespaceAware(true); // never forget this!
+			DocumentBuilder builder = domFactory.newDocumentBuilder();
+			Document doc = builder.parse(xmlfile);
+
+			XPathFactory xpathfactory = XPathFactory.newInstance();
+			def _xpath = xpathfactory.newXPath();
+			_xpath.setNamespaceContext(new PersonalNamespaceContext());
+			def expr = _xpath.compile(xpath);
+			def nodes = expr.evaluate(doc, XPathConstants.NODESET);
+
+			for(def node : nodes) {
+				doc.renameNode(node, null, newname)
+			}
+			return DomUtils.save(doc, xmlfile)
+		}
+		else {
+			RenameTag builder = new RenameTag(xmlfile, oldname, newname);
+			File temp = File.createTempFile("temp", ".xml", xmlfile.getParentFile());
+			if(builder.process(temp)) {
+				if (!(xmlfile.delete() && temp.renameTo(xmlfile))) println "Warning can't rename file "+temp+" to "+xmlfile
+				return true;
+			}
+			else
+				return false;
+		}
+	}
+
+	/**
+	 * Rewrite processStartElement to update the localname if localname == oldname
+	 */
+	public void processStartElement()
+	{
+		String prefix = parser.getPrefix();
+		if (INCLUDE == localname && XI == prefix) {
+			processingXInclude();
+			return;
+		}
+
+		if (localname == oldname) {
+			localname = newname;
+
+			if(prefix.length() > 0)
+				writer.writeStartElement(Nscontext.getNamespaceURI(prefix), localname)
+			else
+				writer.writeStartElement(localname);
+
+			for(int i = 0 ; i < parser.getNamespaceCount() ; i++)
+			{
+				writer.writeNamespace(parser.getNamespacePrefix(i), parser.getNamespaceURI(i));
+			}
+
+			for(int i = 0 ; i < parser.getAttributeCount() ; i++)
+				writer.writeAttribute(parser.getAttributeLocalName(i), parser.getAttributeValue(i));
+		} else {
+			super.processStartElement();
+		}
+	}
+
+	public static void main(String[] args)
+	{
+		File xmlfile = new File("/home/mdecorde/xml/xmlçàé/essai.xml");
+		File temp = new File("/home/mdecorde/xml/xmlçàé/renamed.xml");
+		String oldname = "machin"
+		String newname = "titre"
+		long time = System.currentTimeMillis();
+		RenameTag.rename(xmlfile, oldname, newname);
+		//		RenameTag builder = new RenameTag(xmlfile, oldname, newname);
+		//		builder.process(temp);
+		println "elapsed: "+(System.currentTimeMillis()-time);
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/HTML2XHTML.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/HTML2XHTML.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/HTML2XHTML.groovy	(revision 258)
@@ -0,0 +1,42 @@
+package org.txm.importer
+
+import org.txm.utils.CharsetDetector;
+import org.txm.importer.ValidateXml;
+
+File infile = new File("/home/mdecorde/Bureau/matrice/témoignages/CONVERSIONS/jod/odt.html")
+File outfile = new File("/home/mdecorde/Bureau/matrice/témoignages/CONVERSIONS/jod/odt.xml")
+
+String encoding = new CharsetDetector(infile).getEncoding();
+println "Encoding: $encoding"
+String text = infile.getText(encoding);
+
+//lower case tags
+text = text.replaceAll(/(<[^!][^>]*>)/, 
+	{ full, word -> 
+		//fix attributes TRUC=sdf234
+		word = word.replaceAll("([A-Z]+=)([^\" >]+)([ >])",'$1"$2"$3' )
+		word.toLowerCase() // bourrin
+	} )
+
+//lower case <.> tags
+text = text.replaceAll(/(<.>)/,
+	{ full, word ->
+		word.toLowerCase()
+	} )
+
+//resolve entities
+text = text.replaceAll(/&nbsp;/," ")
+
+//close tags
+text = text.replaceAll(/<br>/,"<br/>")
+text = text.replaceAll(/<meta([^>]*)>/,'<meta$1/>')
+text = text.replaceAll(/<img([^>]*)>/,'<img$1/>')
+
+//remove doctype declaration
+text = text.replace('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">', '')
+
+//write&Validate
+outfile.withWriter(encoding) { writer -> writer.write(text) }
+if (!ValidateXml.test(outfile)) {
+	println "FILE: $outfile"
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/importer/GetPagesFromURL.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/GetPagesFromURL.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/GetPagesFromURL.groovy	(revision 258)
@@ -0,0 +1,74 @@
+package org.txm.importer
+
+import org.w3c.tidy.Tidy
+
+def workDir = new File("/home/mdecorde/TEMP")
+def outdir = new File("/home/mdecorde/TEMP/out")
+
+def src = "http://txm.sourceforge.net/doc/manual/manual1.xhtml";
+def base = src.substring(0, src.lastIndexOf("/"));
+
+def url_xpath = """//*/a[@href]/@href""";
+def url_regexp = /.+/;
+def duplicates = false; // 'true' not implemented
+def filename_regexp = /zer/;
+def content_xpath = "//*/div[@id=\"content\"]";
+
+def xhtmlFile = new File(workDir, "src.xhtml")
+URL2XHTMLFILE(src, xhtmlFile, workDir);
+
+println "finding urls of $xhtmlFile"
+XPathResult xpathResult = new XPathResult(xhtmlFile);
+def urls = new LinkedHashSet<String>();
+
+for (String url : xpathResult.getXpathResponses(url_xpath))
+	if (urls ==~ url_regexp ) urls << url
+println urls
+
+int i = 1;
+for (String url : urls) {
+	//url = url.replaceAll()
+	def subxHtmlFile = new File(workDir, url)
+	URL2XHTMLFILE(base+"/"+url, subxHtmlFile, workDir);
+	
+	def txtFile = new File(outdir, url+".xhtml")
+	def writer = txtFile.newWriter("UTF-8");
+	for (def node : xpathResult.getNodes(content_xpath)) {
+		writer.println(node)
+	}
+	writer.close()
+	i++
+}
+
+def URL2XHTMLFILE(String url, File outfile, File workDir) {
+	println "getting src: $url"
+	def htmlFile = new File(workDir, "base.html")
+	def filestream = new FileOutputStream(htmlFile)
+	def out = new BufferedOutputStream(filestream)
+	out << new URL(url).openStream()
+	out.close()
+	
+	println "xHTMLize HTML $htmlFile"
+	Tidy tidy = new Tidy(); // obtain a new Tidy instance
+	tidy.setXHTML(true); // set desired config options using tidy setters
+	tidy.setInputEncoding("UTF-8")
+	tidy.setOutputEncoding("UTF-8")
+	tidy.setShowErrors(0)
+	tidy.setTabsize(10)
+	tidy.setShowWarnings(false)
+	File xhtmlFile = new File(workDir, "base.xhtml")
+	xhtmlFile.withWriter("UTF-8") { out2 ->
+		tidy.parse(htmlFile.toURI().toURL().newInputStream([readTimeout: 10000]), out2); // run tidy, providing an input and output stream
+	}
+	
+	println "remove entities and doctype"
+	String text = xhtmlFile.getText("UTF-8")
+	text = text.replaceAll("&nbsp;", " ")
+	text = text.replaceAll("xmlns=\"http://www.w3.org/1999/xhtml\"", " ")
+	text = text.replaceAll("""<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">""", "")
+	outfile.withWriter("UTF-8") { writer ->
+		writer.write(text);
+	}
+}
+println "done"
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/importer/Doc2Transcription.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/Doc2Transcription.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/Doc2Transcription.groovy	(revision 258)
@@ -0,0 +1,122 @@
+package org.txm.importer
+
+import javax.xml.stream.*
+import java.net.URL
+
+class Doc2Transcription {
+
+	String encoding
+	File txtfile
+	File outfile
+	Reader reader
+	XMLOutputFactory factory
+	FileOutputStream output
+	XMLStreamWriter writer
+
+	int noline = 1
+	boolean question = false
+	int idquestion = 1
+	int idresponse = 1
+	boolean opened = false
+
+	public Doc2Transcription(File txtfile, File outfile, String encoding)
+	{
+		this.txtfile = txtfile
+		this.outfile = outfile
+		this.encoding = encoding
+
+		reader = new InputStreamReader(new FileInputStream(txtfile) , encoding)
+		factory = XMLOutputFactory.newInstance()
+		output = new FileOutputStream(outfile)
+		writer = factory.createXMLStreamWriter(output, "UTF-8")//create a new file
+	}
+
+	public boolean process()
+	{
+		if(reader == null || writer == null)
+		{
+			println "I/O error"
+			return false
+		}
+		
+		// build text id
+		String filename = txtfile.getName()
+		int idx = filename.indexOf(".")
+		if(idx > 0)
+			filename = filename.substring(0, idx)
+
+		//write Start doc
+		writer.writeStartDocument("UTF-8", "1.0")
+		writer.writeStartElement("text") // we create a tag <text>
+		writer.writeAttribute("id",filename)// and set its id
+
+		//write first block
+		writeStartQuestionResponse()
+		
+		String line = reader.readLine()
+		while(line != null)
+		{
+			if(line.length() == 0) // saut de ligne
+			{
+				question = !question
+				writer.writeEmptyElement("br")
+				writeStartQuestionResponse()
+			}
+			else
+			{
+				writer.writeCharacters(line+" \n")
+				writer.writeEmptyElement("br")
+			}
+
+			noline++
+			line = reader.readLine()
+		}
+
+		//close xml doc and question/response if needed
+		if(opened)
+			writer.writeEndElement()// question/response
+		writer.writeEndElement()// text
+
+		reader.close()
+		writer.close()
+		output.close()
+		return true
+	}
+
+	public void writeStartQuestionResponse()
+	{
+		if(opened)
+		{
+			writer.writeEndElement()
+			opened = false
+		}
+		opened = true
+		if(question)
+		{
+			writer.writeStartElement("question") // we create a tag <text>
+			writer.writeAttribute("id","q"+idquestion++)// and set its id
+		}
+		else
+		{
+			writer.writeStartElement("response") // we create a tag <text>
+			writer.writeAttribute("id","r"+idresponse++)// and set its id
+		}
+	}
+
+	public void setInitialeState(boolean state)
+	{
+		question = state
+	}
+
+	static main(args) {
+		File infile = new File("/home/matt/xml/txttranscription/test.txt")
+		File outfile = new File("/home/matt/xml/txttranscription/test.xml")
+		String encoding = "UTF-8"
+
+		def builder = new Doc2Transcription(infile, outfile, encoding)
+		if(builder.process())
+			println "ok"
+		else
+			println "fail"
+	}
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/importer/ResolveXInclude.java
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/ResolveXInclude.java	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/ResolveXInclude.java	(revision 258)
@@ -0,0 +1,106 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+package org.txm.importer;
+
+import java.io.File;
+import java.io.FileOutputStream;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.w3c.dom.Document;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class ResolveXInclude.
+ */
+class ResolveXInclude {
+	
+	/**
+	 * Resolve.
+	 *
+	 * @param xmlfile the xmlfile
+	 * @param outfile the outfile
+	 * @return true, if successful
+	 * @throws Exception the exception
+	 */
+	public static boolean resolve(File xmlfile, File outfile) throws Exception
+	{
+		DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+		//factory.setXIncludeAware(true);
+		factory.setNamespaceAware(true);
+		DocumentBuilder docBuilder = factory.newDocumentBuilder();
+//		if (!docBuilder.isXIncludeAware()) {
+//			throw new IllegalStateException();
+//		}
+		/*docBuilder.setEntityResolver(new EntityResolver() {
+					@Override
+					public InputSource resolveEntity(String publicId, String systemId)
+					throws SAXException, IOException {
+						if (systemId.endsWith("include.txt")) {
+							return new InputSource(includeStream);
+						}
+						return null;
+					}
+				});*/
+		Document doc = docBuilder.parse(xmlfile);
+		// print result
+		Source source = new DOMSource(doc);
+		Result result = new StreamResult(new FileOutputStream(outfile));
+		TransformerFactory transformerFactory = new net.sf.saxon.TransformerFactoryImpl();
+		Transformer transformer;
+
+		transformer = transformerFactory.newTransformer();
+		transformer.transform(source, result);		
+		return true;
+	}
+	
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args)
+	{
+		String userdir= System.getProperty("user.home");
+		File xmlfile = new File(userdir, "xml/queen/queen/Texts/driver.xml");
+		File outfile = new File(userdir, "xml/queen/queen.xml");
+		try {
+			ResolveXInclude.resolve(xmlfile, outfile);
+		} catch (Exception e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+			System.out.println("Fail to resolve xinclude");
+		}
+	}
+}

Property changes on: tmp/org.txm.core/src/groovy/org/txm/importer/ResolveXInclude.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/importer/xmltxmpara/ValidateXmlTXM.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/xmltxmpara/ValidateXmlTXM.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/xmltxmpara/ValidateXmlTXM.groovy	(revision 258)
@@ -0,0 +1,219 @@
+package org.txm.importer.xmltxmpara
+
+import javax.xml.stream.*;
+import java.net.URL;
+
+class ValidateXmlTXM {
+	
+	public static String XMLNS = "http://www.w3.org/XML/1998/namespace";
+	public static String TXMNS = "http://textometrie.org/1.0";
+	public static String TEINS = "http://www.tei-c.org/ns/1.0";
+	
+
+	boolean checkteiCorpus = false;
+	boolean checkTEI = true;
+	boolean checkAlignStruct = false;
+	boolean checkW = true;
+
+	boolean hasTeiCorpus = false;
+	boolean hasTeiCorpusID = false;
+	boolean hasTeiCorpusHeader = false;
+	boolean hasTeiCorpusHeaderAppDesc = false;
+	boolean hasTeiCorpusHeaderVersion = false;
+	int hasTei = 0;
+	int hasTeiID = 0;
+	boolean hasAlignStruct = false
+	String alignStruct = "";
+	boolean hasTXMW = false;
+
+	public boolean validate(File sourceDir)
+	{
+		boolean ret = true;
+		//get infos from import.xml if any
+		File alignxml = sourceDir.listFiles().find{it.getName() == "align.xml"}
+		if(alignxml != null)
+		{
+			infosFromImportXML(alignxml)
+			checkteiCorpus = true;
+			// checkAlignStruct = true;
+			// mainLang = ...
+			// corpusnames = ...
+			// alignStructs = 
+		}
+		
+		sourceDir.eachFileMatch(~/.+.xml/){f->
+
+			if (f.getName() != "import.xml" && f.getName() != "align.xml" && f.isFile())
+				ret = ret & validateXMLTXM(f);
+		}
+
+		return ret;
+	}
+	
+	HashMap<String, ArrayList<String>> links = [:];
+	protected boolean infosFromImportXML(File alignxml)
+	{
+		this.url = xmlfile.toURI().toURL();;
+		inputData = url.openStream();
+
+		factory = XMLInputFactory.newInstance();
+		parser = factory.createXMLStreamReader(inputData);
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next())
+		{
+			if(event == XMLStreamConstants.START_ELEMENT)
+			{
+				if(parser.getLocalName() == "link")
+				{
+					links.put(parser.getAttributeValue(null, "target"), 
+						[parser.getAttributeValue(null, "alignElement"), parser.getAttributeValue(null, "alignLevel")])
+					
+				}
+			}
+		}
+		parser.close();
+		println "get infos from $alignxml"
+		return true;
+	}
+	
+	private void printAttributes(def parser)
+	{
+		for(int i = 0 ; i < parser.getAttributeCount(); i++)
+		println( "$path "+parser.getAttributeLocalName(i)+
+		 " = "+ parser.getAttributeValue(i))
+	}
+	
+	def url;
+	def inputData;
+	def factory;
+	XMLStreamReader parser;
+	String path = ""
+	protected boolean validateXMLTXM(File xmlfile)
+	{
+		println "validate $xmlfile"
+		boolean inTeiCorpus = false;
+		boolean inTeiHeader = false;
+		boolean inMetadata = false;
+		boolean inTEI = false;
+		boolean inW = false;
+		boolean inForm = false;
+
+		try {
+			this.url = xmlfile.toURI().toURL();;
+			inputData = url.openStream();
+
+			factory = XMLInputFactory.newInstance();
+			parser = factory.createXMLStreamReader(inputData);
+		} catch (XMLStreamException ex) {
+			System.out.println(ex);
+			return false;
+		}catch (IOException ex) {
+			System.err.println("IOException while parsing ");
+			return false
+		}
+		String localname = ""
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next())
+		{
+			if(event == XMLStreamConstants.START_ELEMENT)
+			{
+				localname = parser.getLocalName();
+				path += "/"+localname
+				switch (localname)
+				{
+					case "teiCorpus":
+						inTeiCorpus = true;
+						hasTeiCorpus = true;
+						//printAttributes(parser);
+						if(parser.getAttributeValue(XMLNS, "id") != null)
+							hasTeiCorpusID = true;
+						break;
+					case "teiHeader":
+						inTeiHeader = true;
+						if(inTeiCorpus)
+							hasTeiCorpusHeader = true;
+						break;
+					case "metadata":
+						inMetadata = true;
+						//printAttributes(parser);
+						if(parser.getAttributeValue(null, "name") == "version")
+							hasTeiCorpusHeaderVersion = true;
+						break;
+					case "TEI":
+						inTEI = true;
+						hasTei++;
+						if(parser.getAttributeValue(XMLNS, "id") != null)
+							hasTeiID++;
+						break;
+					case "w":
+						inW = true;
+						String id = parser.getAttributeValue(XMLNS, "id");
+						if(!(id != null && id.matches("w_.+_.+")))
+							hasTXMW = false;
+						break;
+					case "form":
+						inForm = true;
+						break;
+					case alignStruct:
+					if(parser.getAttributeValue(null, "align") == null)
+						hasAlignStruct = false;
+						break;
+				}
+			}
+			else if(event == XMLStreamConstants.END_ELEMENT)
+			{
+				localname = parser.getLocalName()
+				if(path.lastIndexOf("/") > 0)
+					path = path.substring(0, path.lastIndexOf("/"))
+				switch (localname)
+				{
+					case "teiCorpus":
+						inTeiCorpus = false;
+						break;
+					case "teiHeader":
+						inTeiHeader = false;
+						break;
+					case "metadata":
+						inMetadata = false;
+						break;
+					case "TEI":
+						inTEI = false;
+						break;
+					case "w":
+						inW = false;
+						break;
+					case "form":
+						inForm = false;
+						break;
+				}
+			}
+		}
+		parser.close();
+		
+		if(checkteiCorpus &
+			!(hasTeiCorpus & hasTeiCorpusID & hasTeiCorpusHeader & hasTeiCorpusHeaderVersion))
+		{	println "wrong <teiCorpus> format: $hasTeiCorpus & $hasTeiCorpusID & $hasTeiCorpusHeader & $hasTeiCorpusHeaderVersion"
+			return false;
+		}
+		
+		if(checkAlignStruct &
+			!hasAlignStruct)
+		{   println "wrong align structure format: $hasAlignStruct"
+			return false;
+		}
+		
+		if(checkTEI & !(hasTei == hasTeiID))
+		{	println "wrong <TEI> format: $hasTei == $hasTeiID"
+			return false;
+		}
+		
+		return true;
+	}
+	
+	public static void main(String[] args)
+	{
+		File srcdir = new File("/home/mdecorde/xml/xmltxmpara");
+		def checker = new ValidateXmlTXM();
+		println checker.validate(srcdir)
+	}
+}
+
+
Index: tmp/org.txm.core/src/groovy/org/txm/importer/xmltxmpara/xmltxmparaLoader.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/xmltxmpara/xmltxmparaLoader.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/xmltxmpara/xmltxmparaLoader.groovy	(revision 258)
@@ -0,0 +1,243 @@
+// 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
+// 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.
+//
+// $LastChangedDate: 2011-06-03 12:37:57 +0200 (Fri, 03 Jun 2011) $
+// $LastChangedRevision: 1867 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer.xmltxmpara;
+
+import org.txm.importer.xmltxmpara.compiler;
+import org.txm.importer.xml.pager_old;
+import org.txm.objects.*;
+import org.txm.utils.*;
+import org.txm.*;
+import org.txm.scripts.teitxm.*;
+import org.txm.utils.i18n.*;
+import org.txm.utils.io.FileCopy;
+import org.txm.importer.*;
+import org.txm.importer.cwb.CwbAlign;
+import org.txm.importer.cwb.PatchCwbRegistry;
+import org.w3c.dom.Element
+
+String userDir = System.getProperty("user.home");
+String rootDir;
+String lang;
+String encoding;
+String model;
+String basename;
+String xsl;
+
+try {rootDir = rootDirBinding;}
+catch (Exception)
+{	println "DEV MODE";//exception means we debug
+	if (!org.txm.Toolbox.isInitialized()) {
+		rootDir = userDir+"/xml/qgraal";
+		Toolbox.setParam(Toolbox.INSTALL_DIR,new File("/usr/lib/TXM"));
+		Toolbox.setParam(Toolbox.TREETAGGER_INSTALL_PATH,new File(userDir,"treetagger"));
+		Toolbox.setParam(Toolbox.TREETAGGER_MODELS_PATH,new File(userDir,"treetagger/models"));
+		Toolbox.setParam(Toolbox.METADATA_ENCODING, "UTF-8");
+		Toolbox.setParam(Toolbox.METADATA_COLSEPARATOR, ",");
+		Toolbox.setParam(Toolbox.METADATA_TXTSEPARATOR, "\"");
+		Toolbox.setParam(Toolbox.USER_TXM_HOME, new File(System.getProperty("user.home"),"TXM"));
+	}
+}
+
+File srcDir = new File(rootDir);
+File binDir = new File(Toolbox.getParam(Toolbox.USER_TXM_HOME),"corpora/"+srcDir.getName());
+binDir.deleteDir();
+binDir.mkdirs();
+if (!binDir.exists()) {
+	println "Could not create binDir "+binDir
+	return;
+}
+
+File srcParamFile = new File(rootDir, "import.xml");
+File paramFile = new File(binDir, "import.xml")
+if (!srcParamFile.exists()) {
+	println "Stop import: can't find params file: "+srcParamFile
+	return;
+}
+FileCopy.copy(srcParamFile, paramFile);
+if (!paramFile.exists()) {
+	println "Stop import: failed to copy param file: "+srcParamFile+" to "+paramFile
+	return;
+}
+BaseParameters params = new BaseParameters(paramFile);
+params.load();
+basename = params.name;
+
+File paraDir = new File(binDir, "paracorpus/");
+paraDir.deleteDir();
+paraDir.mkdir();
+
+// Apply XSL
+if (xsl != null && xsl.trim().length() > 0) {
+	if (!ApplyXsl2.processImportSources(new File(xsl, new File(rootDir), srcDir)))
+	return; // error durring process
+	srcDir = new File(binDir, "src");
+}
+
+//copy txm files
+List<File> srcfiles = srcDir.listFiles();
+for (File f : srcfiles) {// check XML format, and copy file into binDir
+	if (f.getName().equals("import.xml") || f.getName().equals("metadata.csv") || f.getName().endsWith(".properties"))
+	continue;
+	if (ValidateXml.test(f)) {
+		FileCopy.copy(f, new File(paraDir, f.getName()));
+	} else {
+		println "Won't process file "+f;
+	}
+}
+
+if (paraDir.listFiles() == null) {
+	println "No txm file to process"
+	return;
+}
+
+//contains the text files associated to a corpus
+println "Getting lang of each corpus and splitting corpus: "+params.corpora.keySet()
+for (String corpusname : params.corpora.keySet()) {
+	
+	lang = params.corpora.get(corpusname).getAttribute("lang");
+	encoding = params.corpora.get(corpusname).getAttribute("encoding");
+	model = lang
+	
+	print "."
+	println "split in"
+	File txmDir = new File(binDir,"txm/$corpusname");
+	txmDir.deleteDir();
+	txmDir.mkdirs();
+	
+	def corpusElem = params.corpora.get(corpusname)
+	String corpuslang = corpusElem.getAttribute("lang")
+	
+	println "split corpus $corpusname by TEI@id"
+	File f = new File(paraDir, corpusname+".xml")
+	if (!f.exists()) {
+		println "source file is missing: "+f;
+	}
+	def splitter = new SplitBy(f);
+	if (splitter.process(txmDir, "TEI", "id")) {
+		for (File textfile : splitter.getFiles()) {
+			params.addText(corpusElem, basename, textfile)
+		}
+	} else {
+		println "failed to split corpus "+corpusname;
+		return false;
+	}
+}
+
+println "-- COMPILING - Building Search Engine indexes"
+for (String corpusname : base.getCorpora().keySet()) {
+	println "Build corpus "+corpusname
+	def c = new compiler();
+	c.setDebug();
+	//c.setCwbPath("~/TXM/cwb/bin");
+	if (!c.run(corpusfiles.get(corpusname), binDir, corpusname, basename)) {
+		println "Compiler failed"
+		return;
+	}
+}
+
+println "-- ALIGN - aligning CQP corpus with each others"
+for (String alignement : parameters.getAlignements()) {
+	println "aligning..."+alignement
+		String alignStructure = parameters.getStructure(alignement);
+		String alignAttribute = "align";
+		
+		String regpath = new File(binDir,"registry").getAbsolutePath();
+		String cwbLoc;
+		if(cwbLoc == null)
+			cwbLoc = org.txm.Toolbox.getParam(org.txm.Toolbox.CQI_SERVER_PATH_TO_CQPLIB)+File.separator;
+		
+		if (!new File(cwbLoc).exists()) {
+			println ("CWB path error: "+cwbLoc)
+			return false;
+		}
+		
+		println "aligned corpora: "+parameters.getTargets(alignement);
+		for (String corpusName : parameters.getTargets(alignement)) {
+			for (String targetName : parameters.getTargets(alignement)) {
+				if (corpusName != targetName) {
+					try {
+						println "build align index: "+corpusName+" with "+targetName
+						//./cwb-align -V seg_id -r ~/TXM/corpora/tmxtest/registry/ tmxen tmxfr seg
+						CwbAlign tt = new CwbAlign(cwbLoc);
+						tt.setV(alignStructure+"_"+alignAttribute);
+						tt.setr(regpath);
+						tt.cwbalign(corpusName, targetName, alignStructure);
+						
+						//patch registry
+						println " patch reg : "+new File(regpath, corpusName.toLowerCase())
+						if (PatchCwbRegistry.patchAlignment(new File(regpath, corpusName.toLowerCase()), targetName.toLowerCase()))
+						{
+							// ./cwb-align-encode -D -r ~/TXM/corpora/tmxtest/registry/ -v out.align
+							tt = new CwbAlign(cwbLoc);
+							tt.setD();
+							tt.setv();
+							tt.setr(regpath);
+							tt.cwbalignencode("out.align");
+						}
+					} catch (IOException e) {
+						org.txm.utils.logger.Log.printStackTrace(e);
+						return;
+					}
+				}
+			}
+		}
+
+}
+
+println "-- EDITION - Building edition"
+new File(binDir,"HTML").deleteDir();
+new File(binDir,"HTML").mkdir();
+new File(binDir,"HTML/default").mkdir();
+List<File> filelist = new File(binDir,"txm").listFiles();
+def second = 0
+
+println "Paginating text: "
+for(String textname : base.getTextsID())
+{
+	Text text = base.getText(textname);
+	File srcfile = text.getSource();
+	File resultfile = new File(binDir,"HTML/"+srcfile.getName().substring(0,srcfile.getName().length()-4)+".html");
+	lang = text.getAttribute("lang").toString();
+	List<String> NoSpaceBefore = LangFormater.getNoSpaceBefore(lang);
+	List<String> NoSpaceAfter = LangFormater.getNoSpaceAfter(lang);
+		
+	if (second) { print(", ") }
+	if (second > 0 && (second % 5) == 0) println ""
+	print(srcfile.getName());
+	second++
+	
+	def ed = new pager_old(srcfile,resultfile, NoSpaceBefore, NoSpaceAfter, 500, basename, "pb");
+	
+	Edition editionweb = text.addEdition("default", "html", resultfile);
+	for(int i = 0 ; i < ed.getPageFiles().size();i++)
+	{
+		File f = ed.getPageFiles().get(i);
+		String idx = ed.getIdx().get(i);
+		editionweb.addPage(f,idx);
+	}
+}
+
+DomUtils.print(params.root.getOwnerDocument())
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/importer/xmltxmpara/compiler.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/xmltxmpara/compiler.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/xmltxmpara/compiler.groovy	(revision 258)
@@ -0,0 +1,511 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2011-06-03 12:37:57 +0200 (Fri, 03 Jun 2011) $
+// $LastChangedRevision: 1867 $
+// $LastChangedBy: mdecorde $ 
+//
+
+
+package org.txm.importer.xmltxmpara;
+
+import java.util.ArrayList;
+
+import org.txm.importer.cwb.BuildCwbEncodeArgs;
+import org.txm.importer.cwb.CwbEncode
+import org.txm.importer.cwb.CwbMakeAll
+import org.txm.importer.*;
+import org.txm.scripts.*;
+import org.txm.scripts.teitxm.BuildTTSrc;
+import org.txm.scripts.teitxm.*;
+import org.txm.utils.treetagger.TreeTagger;
+
+import javax.xml.stream.*;
+import java.net.URL;
+import java.io.File;
+import java.util.HashMap;
+import java.util.List;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class compiler.
+ */
+class compiler 
+{
+	
+	/** The debug. */
+	private boolean debug= false;
+	
+	/** The input data. */
+	private def inputData;
+	
+	/** The factory. */
+	private def factory;
+	
+	/** The parser. */
+	private XMLStreamReader parser;
+	
+	/** The dir. */
+	private def dir;
+	
+	/** The output. */
+	private Writer output;
+	
+	/** The url. */
+	private def url;
+	
+	/** The text. */
+	String text="";
+	
+	/** The base. */
+	String base="";
+	
+	/** The project. */
+	String project="";
+	
+	/** The text attributes. */
+	String[] textAttributes = null;
+	
+	/** The cwb loc. */
+	String cwbLoc;
+	
+	/** The lang. */
+	private String lang ="fr";
+	
+	/** The anatypes. */
+	private static ArrayList<String> anatypes;
+	
+	/** The s attribs. */
+	private static HashMap<String, List<String>> sAttribs;
+	
+	/**
+	 * initialize.
+	 *
+	 */
+	public compiler(){}
+	
+	/**
+	 * Instantiates a new compiler.
+	 *
+	 * @param url the url
+	 * @param text the text
+	 * @param base the base
+	 * @param project the project
+	 */
+	public compiler(URL url,String text,String base, String project)
+	{
+		this.text = text
+		this.base = base;
+		this.project = project;
+		this.textAttributes = textAttributes;
+		try {
+			this.url = url;
+			inputData = url.openStream();
+			
+			factory = XMLInputFactory.newInstance();
+			parser = factory.createXMLStreamReader(inputData);
+		} catch (XMLStreamException ex) {
+			System.out.println(ex);
+		}catch (IOException ex) {
+			System.err.println("IOException while parsing ");
+		}
+	}
+	
+	/**
+	 * set the language of the corpus.
+	 *
+	 * @param lang the lang
+	 * @return the java.lang. object
+	 */
+	public setLang(String lang)
+	{
+		this.lang = lang;
+	}
+	
+	/**
+	 * Sets the cwb path.
+	 *
+	 * @param path the new cwb path
+	 */
+	public void setCwbPath(String path)
+	{
+		if(!new File(path).exists())
+			System.err.println("CWB Path : "+path+" does not exists")
+		cwbLoc = path;
+	}
+	
+	/**
+	 * Creates the output.
+	 *
+	 * @param dirPathName the dir path name
+	 * @param fileName the file name
+	 * @return true, if successful
+	 */
+	private boolean createOutput(File f){
+		try {
+			output = new OutputStreamWriter(new FileOutputStream(f,f.exists()) , "UTF-8");
+			return true;
+		} catch (Exception e) {
+			System.err.println(e);
+			
+			return false;
+		}
+	}
+	
+	/**
+	 * Go to text.
+	 */
+	private void GoToText()
+	{
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) 
+		{
+			if(event == XMLStreamConstants.END_ELEMENT)
+				if(parser.getLocalName().equals("teiHeader"))
+					return;
+		}
+	}
+	
+	/**
+	 * Transfom file wtc.
+	 *
+	 * @param dirPathName the dir path name
+	 * @param fileName the file name
+	 * @return true, if successful
+	 */
+	public boolean transfomFileWtc(File wtcfile)
+	{
+		createOutput(wtcfile);
+		String headvalue=""
+		String vAna = "";
+		String vForm = "";
+		String wordid= "";
+		String vHead = "";
+		
+		int p_id = 0;
+		int s_id = 0;
+		
+		boolean captureword = false;
+		boolean flagForm = false;
+		boolean flagAna = false;
+		boolean inW = false;
+		int wcounter = 1;
+		GoToText();
+		
+		try 
+		{
+			boolean stop = false;
+			for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT && !stop; event = parser.next()) 
+			{
+				switch (event) 
+				{
+					case XMLStreamConstants.START_ELEMENT:
+					
+						
+						switch (parser.getLocalName()) 
+						{							
+							case "w":
+								inW = true;
+								wordid = parser.getAttributeValue(null, "id")
+								if(wordid == null)
+									wordid = "w_"+text+"_"+(wcounter++)
+							
+							vAna ="";
+							break;
+							
+							case "form":
+								String type = parser.getAttributeValue(null, "type");
+								if(type == null)
+								{
+									flagForm = true;
+								}
+								else if(type.equals("default"))
+								{
+									flagForm = true;
+								}
+								else
+								{
+									flagAna = true;
+									vAna += "\t";
+									if(!anatypes.contains(type))
+										anatypes << type;	
+								}
+							vForm = "";
+							break;
+							
+							case "ana":
+							flagAna = true;
+							vAna += "\t";
+							String type = parser.getAttributeValue(null, "type");
+
+								if(type != null)
+								{	
+									if(type.startsWith("#"))
+										type = type.substring(1)
+									if(!anatypes.contains(type))
+										anatypes << type;
+									break;
+								}
+							break;
+							
+							default:
+								if(!inW)
+								{
+									output.write("<"+parser.getLocalName().toLowerCase());
+									if(!sAttribs.containsKey(parser.getLocalName()))
+										sAttribs.put(parser.getLocalName().toLowerCase(), []);
+									
+									for( int i = 0 ; i < parser.getAttributeCount() ; i++)
+									{
+										String attrname = parser.getAttributeLocalName(i).toLowerCase();
+										String attrvalue = parser.getAttributeValue(i);
+										if(!(parser.getLocalName() == "text" && attrname == "id"))
+											output.write(" "+attrname+"=\""+attrvalue.replace("\"", "'")+"\"");
+										
+										if(!sAttribs.get(parser.getLocalName().toLowerCase()).contains(attrname))
+											sAttribs.get(parser.getLocalName().toLowerCase()).add(attrname)
+									}
+							
+									if(parser.getLocalName() == "text")
+									{ // add some infos
+										output.write(" id=\""+text+"\" base=\""+base+"\" project=\""+project+"\"");
+									}
+									output.write(">\n");
+								}
+							}
+						break;
+					
+					case XMLStreamConstants.END_ELEMENT:
+						
+						switch (parser.getLocalName()) 
+						{	
+							case "w":
+							output.write( vForm.replaceAll("&", "&amp;").replaceAll("<", "&lt;") +"\t"+wordid+vAna+"\n");
+							vAna = "";
+							vForm = "";
+							inW = false;
+							break;
+							
+							case "form":
+							flagForm = false;
+							flagAna = false;
+							break;
+							
+							case "ana":
+							flagAna = false;
+							break;
+							
+							default:
+								if(!inW)
+									output.write("</"+parser.getLocalName().toLowerCase()+">\n");
+								if(parser.getLocalName() == "text")
+									stop = true;
+						}
+						break;
+					
+					case XMLStreamConstants.CHARACTERS:
+						if(inW)
+						{
+						if(flagForm)
+							if(flagAna)
+								vAna += parser.getText().trim();
+							else
+								vForm += parser.getText().trim();
+						if(flagAna)
+							vAna += parser.getText().trim();
+						}
+						break;
+				}
+			}
+			
+			output.close();
+			parser.close();
+		}
+		catch (XMLStreamException ex) {
+			System.out.println(ex);
+			return false;
+		}
+		catch (IOException ex) {
+			System.out.println("IOException while parsing " + inputData);
+			return false;
+		}
+		return true;
+	}
+	
+	
+	
+	/**
+	 * Run.
+	 *
+	 * @param rootDirFile the root dir file
+	 * @param basename the basename
+	 * @param textAttributes the text attributes
+	 * @return true, if successful
+	 */
+	public boolean run(ArrayList<File> files, File binDir, String corpusname, String basename, String[] textAttributes) 
+	{
+		anatypes = new ArrayList<String>();// init only 1 time
+		sAttribs = new HashMap<String, List<String>>();// init only 1 time
+		String rootDir = binDir.getAbsolutePath();
+		
+		if(cwbLoc == null)
+			cwbLoc = org.txm.Toolbox.getParam(org.txm.Toolbox.CQI_SERVER_PATH_TO_CQPLIB)+File.separator;
+		
+		if(!new File(cwbLoc).exists())
+		{
+			println ("CWB path error: "+cwbLoc)
+			return false;
+		}
+		if(!binDir.exists())
+		{
+			println ("binary directory does not exists: "+binDir)
+			return false;
+		}
+		
+		if(files == null || files.size() == 0)
+		{
+			println "Error: no file to process"
+			return false;
+		}
+				
+		String textid = "";
+		int counttext = 0;
+		File wtcdir = new File(binDir,"wtc");
+		File wtcfile = new File(wtcdir, corpusname.toLowerCase()+".wtc");
+		//0 set Lang
+		if(createOutput(wtcfile))
+		{
+			output.write("<txmcorpus lang=\""+lang+"\">\n");
+			output.close();
+		}
+		
+		//1- Transform into WTC file
+		def builder = null;
+		for (File f : files) {
+			counttext++;
+			if (!f.exists()) {
+				println("The file "+f+ " does not exists")	
+			} else {	
+				//println("process file "+f)
+				String txtname = f.getName().substring(0,f.getName().length()-4);
+				builder = new compiler(f.toURL(), txtname, basename, "default");
+				builder.setLang(lang);
+				if (!builder.transfomFileWtc(wtcfile))
+					return false;
+			}
+		}
+		
+		//end corpus
+		if(createOutput(wtcfile))
+		{
+			output.write("</txmcorpus>\n");
+			output.close();
+		}
+		
+		//2- Import into CWB
+		def outDir = rootDir;
+		def outDirTxm = rootDir;
+		
+		CwbEncode cwbEn = new CwbEncode();
+		cwbEn.setDebug(debug);
+		CwbMakeAll cwbMa = new CwbMakeAll();
+		cwbMa.setDebug(debug);
+		List<String> pargs = ["id"];
+		for(String ana : anatypes)
+			pargs.add(ana);
+		
+		List<String> sargs = [];
+		//println "Found Sattributes "+this.sAttribs;
+		if (sAttribs.containsKey("text")) {
+			if (!sAttribs.get("text").contains("id"))
+				sAttribs.get("text").add("id");
+			if (!sAttribs.get("text").contains("base"))
+				sAttribs.get("text").add("base");
+			if (!sAttribs.get("text").contains("project"))
+				sAttribs.get("text").add("project");
+		} else {
+			sargs.add("text:0+id+base+project")
+		}
+		
+		if(sAttribs.containsKey("txmcorpus"))
+		{
+			if(!sAttribs.get("txmcorpus").contains("lang"))
+				sAttribs.get("txmcorpus").add("lang");
+		} else {
+			sargs.add("txmcorpus:0+lang")
+		}
+		
+		for(String tag : this.sAttribs.keySet())
+		{
+			String sAttr = tag;
+			if(sAttribs.get(tag).size() > 0)
+				sAttr += ":";
+			for(String attr : sAttribs.get(tag))
+				sAttr +="+"+attr;
+			sargs.add(sAttr)
+		}
+		
+		String[] sAttributes = sargs;
+		String[] pAttributes = pargs;
+		println "Corpus structural attributes: "+sAttributes;
+		println "Corpus lexical attributes: "+pAttributes;
+		try {
+			String regPath = outDirTxm + "/registry/"+corpusname.toLowerCase();
+			cwbEn.run(new File(cwbLoc,"cwb-encode").getAbsolutePath(),
+				outDirTxm + "/data/"+corpusname+"/", 
+				wtcfile.getAbsolutePath(), 
+				regPath, pAttributes, sAttributes);
+			if (!new File(regPath).exists()) {
+				println "Error: The registry file was not created: $regPath. See https://groupes.renater.fr/wiki/txm-users/public/faq"
+				return false;
+			}
+			cwbMa.run(new File(cwbLoc,"cwb-makeall").getAbsolutePath(), corpusname.toUpperCase(), outDirTxm + "/registry");
+			
+		} catch (Exception ex) {System.out.println(ex); return false;}
+		
+		System.out.println("Done.") 
+		
+		return true;
+	}
+	
+	/**
+	 * Sets the debug.
+	 */
+	public void setDebug()
+	{
+		this.debug = true;
+	}
+	
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args)
+	{
+		File dir = new File("~/xml/geo");
+		def c = new compiler();
+		c.setDebug();
+		c.setCwbPath("~/TXM/cwb/bin");
+		c.run(dir,"geo");
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/xmltxmpara/package.html
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/xmltxmpara/package.html	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/xmltxmpara/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>XML-TXM import module specialized with aligned corpus</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/org/txm/importer/xmltxmpara/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/importer/wtc/pager.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/wtc/pager.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/wtc/pager.groovy	(revision 258)
@@ -0,0 +1,350 @@
+package org.txm.importer.wtc;
+//Copyright © - ANR Textométrie - http://textometrie.ens-lyon.fr
+//
+//This file is part of the TXM platform.
+//
+//The TXM platform is free software: you can redistribute it and/or modif y
+//it under the terms of the GNU General Public License as published by
+//the Free Software Foundation, either version 3 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/>.
+//
+//
+//
+//$LastChangedDate: 2012-06-01 17:47:31 +0200 (ven., 01 juin 2012) $
+//$LastChangedRevision: 2185 $
+//$LastChangedBy: mdecorde $
+//
+
+import org.txm.importer.*;
+import org.xml.sax.Attributes;
+import org.txm.importer.filters.*;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.stream.*;
+import java.net.URL;
+import org.xml.sax.InputSource;
+import org.xml.sax.helpers.DefaultHandler;
+
+/** Build WTC corpus simple edition from a WTC file. 
+ * 
+ * @author mdecorde
+ */
+class pager {
+	List<String> NoSpaceBefore;
+
+	/** The No space after. */
+	List<String> NoSpaceAfter;
+
+	/** The wordcount. */
+	int wordcount = 0;
+
+	/** The pagecount. */
+	int pagecount = 0;
+
+	/** The wordmax. */
+	int wordmax = 0;
+
+	/** The basename. */
+	String basename = "";
+	String txtname = "";
+	File outdir;
+
+	/** The wordid. */
+	String wordid;
+
+	/** The first word. */
+	boolean firstWord = true;
+
+	/** The wordvalue. */
+	String wordvalue;
+
+	/** The interpvalue. */
+	String interpvalue;
+
+	/** The lastword. */
+	String lastword = " ";
+
+	/** The wordtype. */
+	String wordtype;
+
+	/** The flagform. */
+	boolean flagform = false;
+
+	/** The flaginterp. */
+	boolean flaginterp = false;
+
+	/** The url. */
+	private def url;
+
+	/** The input data. */
+	private def inputData;
+
+	/** The factory. */
+	private def factory;
+
+	/** The parser. */
+	private XMLStreamReader parser;
+
+	/** The writer. */
+	OutputStreamWriter writer;
+
+	/** The pagedWriter. */
+	OutputStreamWriter pagedWriter = null;
+
+	/** The wtcFile. */
+	File wtcFile;
+
+	/** The outfile. */
+	File outfile;
+
+	/** The pages. */
+	def pages = [:];
+
+	/** The idxstart. */
+	def idxstart = [:]
+	String editionPage;
+	ArrayList<Integer> splitTUs; // contains the tu ids used to split pages
+	boolean shouldSplit = false;
+	boolean useSplitTUs = false;
+	boolean hasWordId = false;
+	int noWordIdProperty = -1;
+	/**
+	 * Instantiates a new pager.
+	 *
+	 * @param wtcFile the wtcFile
+	 * @param outfile the outfile
+	 * @param NoSpaceBefore the no space before
+	 * @param NoSpaceAfter the no space after
+	 * @param max the max
+	 * @param basename the basename
+	 */
+	pager(File wtcFile, File outdir, List<String> NoSpaceBefore,
+	List<String> NoSpaceAfter, int max, String basename, boolean hasWordId, List pAttrs) {
+		this.editionPage = editionPage;
+		this.basename = basename;
+		this.txtname = "text1";
+		this.outdir = outdir;
+		this.wordmax = max;
+		this.NoSpaceBefore = NoSpaceBefore;
+		this.NoSpaceAfter = NoSpaceAfter;
+		this.wtcFile = wtcFile;
+		this.hasWordId = hasWordId;
+		if (hasWordId) {
+			noWordIdProperty = pAttrs.indexOf("id") + 1;
+			if (noWordIdProperty == 0)
+			hasWordId = false;
+		}
+		
+		process();
+	}
+
+	private void closeMultiWriter()
+	{
+		if (pagedWriter != null) {
+			if (firstWord) { // there was no words
+				this.idxstart[txtname] = ["w_0"]
+				pagedWriter.write("<span id=\"w_0\"/>");
+			}
+			pagedWriter.write("</p>\n")
+			pagedWriter.write("</body>");
+			pagedWriter.write("</html>");
+			pagedWriter.close();
+		}
+	}
+
+	/**
+	 * Creates the next output.
+	 *
+	 * @return true, if successful
+	 */
+	private boolean createNextOutput()
+	{
+		wordcount = 0;
+		shouldSplit = false;
+		try {
+			closeMultiWriter();
+			File outfile = new File(outdir, txtname+"_"+(++pagecount)+".html")
+			//println "outfile: "+outfile
+			if (pages[txtname] == null) pages[txtname] = []
+			pages[txtname] << outfile;
+			firstWord = true; // waiting for next word
+
+			pagedWriter = new OutputStreamWriter(new BufferedOutputStream(new FileOutputStream(outfile)) , "UTF-8");
+			pagedWriter.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
+			pagedWriter.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"   \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n")
+			pagedWriter.write("<html>");
+			pagedWriter.write("<head>");
+			pagedWriter.write("<title>"+basename.toUpperCase()+" $txtname Edition - Page "+pagecount+"</title>");
+			pagedWriter.write("<link rel=\"stylesheet\" type=\"text/css\" href=\"tmx.css\"/>");
+			pagedWriter.write("<link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\"/>");
+			pagedWriter.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/>");
+			pagedWriter.write("</head>");
+			pagedWriter.write("<body>");
+
+			return true;
+		} catch (Exception e) {
+			System.out.println(e.getLocalizedMessage());
+			return false;
+		}
+	}
+
+	/**
+	 * Creates the output.
+	 *
+	 * @param outfile the outfile
+	 * @return true, if successful
+	 */
+	private boolean createOutput() {
+		try {
+			return createNextOutput();
+		} catch (Exception e) {
+			System.out.println(e.getLocalizedMessage());
+			return false;
+		}
+	}
+
+	/**
+	 * Gets the page files.
+	 *
+	 * @return the page files
+	 */
+	public def getPageFiles() {
+		return pages;
+	}
+
+	/**
+	 * Gets the idx.
+	 *
+	 * @return the idx
+	 */
+	public def getIdx() {
+		return idxstart;
+	}
+
+	def texts = []
+
+	/**
+	 * Process.
+	 */
+	void process() {
+
+		String localname = "";
+		String lastword= "";
+		createNextOutput();
+		int wcounter = 1;
+		int txtwcounter = 1;
+
+		BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(wtcFile) , "UTF-8"));
+		String line = reader.readLine();
+		int cline = 0;
+		while (line != null) {
+			pagedWriter.flush();
+			cline++;
+			//println "line: "+line
+			if (line.startsWith("<")) {
+				if (line.startsWith("<lb/") || line.startsWith("<br/") || line.startsWith("</p>") || 
+					line.startsWith("<lb>") || line.startsWith("<br>")) {
+					pagedWriter.write("<br/>");
+				} 
+				if (line.startsWith("<text>") || line.startsWith("<text ")) {
+					String tmp = line;
+					int idx = tmp.indexOf("id=\"");
+					if (idx > 0) {
+						tmp = tmp.substring(idx+4);
+						//println "tmp1: "+tmp
+						int idx2 = tmp.indexOf("\"");
+						//println "tmp2: "+tmp
+						if (idx2 > 0) {
+							tmp = tmp.substring(0, idx2);
+							txtname = tmp
+							texts << txtname;
+							pagecount = 0;
+							createNextOutput();
+						}
+					}
+				} else if (line.startsWith("<s>") || line.startsWith("<s ")) {
+					pagedWriter.write(line.replaceAll("<s", "<sent "));
+				} else if (line.startsWith("</s>")) {
+					pagedWriter.write("</sent>");
+				} else {
+					pagedWriter.write(line);
+				}
+			} else { // word
+				if (txtwcounter > wordmax) {
+					txtwcounter = 1;
+					createNextOutput();
+				}
+				def split = line.split("\t");
+				if (split == null || split.size() == 0) {
+					// empty line
+				} else {
+					String wordid;
+					if (hasWordId) {
+						if (split.size() <= noWordIdProperty) { // +1 since line contains word
+							println "Error: line $cline"
+						} else {
+							wordid = split[noWordIdProperty];
+						}
+					} else {
+						wordid = "w_"+(wcounter++);
+					}
+					txtwcounter++;
+					String wordvalue = split[0];
+
+					if (firstWord) {
+						firstWord = false;
+						if (this.idxstart[txtname] == null) {
+							this.idxstart[txtname] = []
+						}
+						this.idxstart[txtname] << [wordid];
+					}
+
+					int l = lastword.length();
+					String endOfLastWord = "";
+					if (l > 0) {
+						endOfLastWord = lastword.subSequence(l-1, l);
+					}
+
+					String interpvalue = "";
+					if (split.size() > 1) {
+						interpvalue = split[1..split.size()-1].join(" ")
+						interpvalue = interpvalue.replace("&", "&amp;").replace("<", "&lt;").replace("\"","&quot;");
+					}
+
+
+					if (NoSpaceBefore.contains(wordvalue) ||
+					NoSpaceAfter.contains(lastword) ||
+					wordvalue.startsWith("-") ||
+					NoSpaceAfter.contains(endOfLastWord)) {
+						pagedWriter.write("<span title=\""+interpvalue+"\" id=\""+wordid+"\">");
+					} else {
+						pagedWriter.write(" <span title=\""+interpvalue+"\" id=\""+wordid+"\">");
+					}
+
+					pagedWriter.write(wordvalue.replace("&", "&amp;").replace("\"","&quot;").replace("<", "&lt;")+"</span>\n");
+					pagedWriter.flush()
+					lastword = wordvalue;
+				}
+			}
+			line = reader.readLine();
+		}
+
+		closeMultiWriter();
+	}
+
+	def getTextNames() {
+		return texts;
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/wtc/wtcLoader.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/wtc/wtcLoader.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/wtc/wtcLoader.groovy	(revision 258)
@@ -0,0 +1,145 @@
+package org.txm.importer.wtc
+
+import org.txm.*
+import org.txm.metadatas.*
+import org.txm.objects.*
+import org.txm.scripts.teitxm.*
+import org.txm.utils.i18n.*
+import org.w3c.dom.Element
+
+String userDir = System.getProperty("user.home");
+
+def MONITOR;
+boolean debug = org.txm.utils.logger.Log.isPrintingErrors();
+BaseParameters params;
+try {params = paramsBinding;MONITOR=monitor} catch (Exception)
+{	println "DEV MODE";//exception means we debug
+	debug = true
+	params = new BaseParameters(new File(userDir, "xml/wtc/import.xml"))
+	params.load()
+	if (!org.txm.Toolbox.isInitialized()) {
+		Toolbox.setParam(Toolbox.INSTALL_DIR,new File("/usr/lib/TXM"));
+		//Toolbox.setParam(Toolbox.INSTALL_DIR,new File("C:\\Program Files\\TXM"));//For Windows
+		Toolbox.setParam(Toolbox.TREETAGGER_INSTALL_PATH,new File(userDir,"treetagger"));
+		//Toolbox.setParam(Toolbox.TREETAGGER_INSTALL_PATH,new File("C:\\Program Files\\treetagger"));//for Windows
+		Toolbox.setParam(Toolbox.TREETAGGER_MODELS_PATH,new File(userDir,"treetagger/models"));
+		Toolbox.setParam(Toolbox.METADATA_ENCODING, "UTF-8");
+		Toolbox.setParam(Toolbox.METADATA_COLSEPARATOR, ",");
+		Toolbox.setParam(Toolbox.METADATA_TXTSEPARATOR, "\"");
+		//Toolbox.setParam(Toolbox.TREETAGGER_MODELS_PATH,new File("C:\\Program Files\\treetagger\\models"));//for Windows
+		Toolbox.setParam(Toolbox.USER_TXM_HOME, new File(System.getProperty("user.home"), "TXM"));
+	}
+}
+if (params == null) { println "no parameters. Aborting"; return; }
+
+String corpusname = params.getCorpusName();
+Element corpusElem = params.corpora.get(corpusname);
+String basename = params.name;
+String rootDir = params.rootDir;
+String lang = corpusElem.getAttribute("lang");
+String model = lang
+String encoding = corpusElem.getAttribute("encoding");
+boolean annotate = "true" == corpusElem.getAttribute("annotate");
+String xsl = params.getXsltElement(corpusElem).getAttribute("xsl")
+def xslParams = params.getXsltParams(corpusElem);
+int wordsPerPage = params.getWordsPerPage("default")
+boolean build_edition = params.getDoEdition("default")
+
+File srcDir = new File(rootDir);
+File binDir = new File(Toolbox.getParam(Toolbox.USER_TXM_HOME),"corpora/"+basename);
+binDir.deleteDir();
+binDir.mkdirs();
+if (!binDir.exists()) {
+	println "Could not create binDir "+binDir
+	return;
+}
+
+// FAKE: will contains no XML-TXM files
+File txmDir = new File(binDir, "txm/$corpusname");
+txmDir.deleteDir();
+txmDir.mkdirs();
+
+// Will contains the edition files
+File htmlDir = new File(binDir, "HTML/$corpusname");
+htmlDir.deleteDir();
+htmlDir.mkdirs();
+
+// get the wtc file and the registry file
+File wtcFile;
+File registryFile;
+println "Looking for files to process..."
+for(File f : srcDir.listFiles()) {
+	if (f.isHidden()) continue;
+	if (f.isDirectory()) continue;
+	if (f.getName().endsWith(".wtc")) {
+		if (wtcFile == null) {
+			wtcFile = f;
+			println "Using WTC file : $wtcFile"
+		}
+	} else if (f.getName().endsWith(".xml")) {
+
+	} else if (!f.getName().contains(".")){ // its the registry file
+		if (registryFile == null) {
+			registryFile = f;
+			println "Using registry file : $f"
+		}
+	}
+}
+
+if (wtcFile == null) {
+	println "No WTC file in source directory: "+srcDir;
+	return false;
+}
+
+// get pAttributes an run cwb-encode + cwb-makeall
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+if (MONITOR != null) MONITOR.worked(25, "COMPILING")
+println "-- COMPILING - Building Search Engine indexes"
+def c = new compiler(wtcFile, registryFile)
+c.setDebug(debug)
+if (!c.run(binDir, corpusname)) {
+	println "Import stopped"
+	return;
+}
+
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+
+new File(binDir,"HTML/$corpusname").deleteDir();
+new File(binDir,"HTML/$corpusname").mkdirs();
+if (build_edition) {
+	
+	println "-- EDITION - Building edition"
+	if (MONITOR != null) MONITOR.worked(20, "EDITION - Building edition")
+
+	File outdir = new File(binDir,"/HTML/$corpusname/default/");
+	outdir.mkdirs();
+
+	print "."
+
+	List<String> NoSpaceBefore = LangFormater.getNoSpaceBefore(lang);
+	List<String> NoSpaceAfter = LangFormater.getNoSpaceAfter(lang);
+
+	File binWtcFile = new File(binDir,"wtc/"+corpusname+".wtc");
+	def ed = new pager(binWtcFile, outdir, NoSpaceBefore, NoSpaceAfter, wordsPerPage, basename, registryFile !=null, c.pAttributesList);
+	def allIndexes = ed.getIdx();
+	def allPages = ed.getPageFiles();
+	for (String txtname : ed.getTextNames()) {
+		def txtIndexes = allIndexes[txtname];
+		def txtPages = allPages[txtname];
+
+		Element text = params.addText(params.corpora.get(corpusname), txtname, wtcFile);
+		Element edition = params.addEdition(text, "default", outdir.getAbsolutePath(), "html");
+
+		for (i = 0 ; i < txtPages.size();) {
+			File f = txtPages.get(i);
+			String wordid = txtIndexes.get(i);
+			params.addPage(edition, ""+(++i), wordid);
+		}
+	}
+}
+println ""
+
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+if (MONITOR != null) MONITOR.worked(20, "FINALIZING")
+File paramFile = new File(binDir, "import.xml");
+DomUtils.save(params.root.getOwnerDocument(), paramFile);readyToLoad = true;
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/importer/wtc/compiler.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/wtc/compiler.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/wtc/compiler.groovy	(revision 258)
@@ -0,0 +1,221 @@
+
+
+// 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
+// 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.
+//
+//
+//
+// $LastChangedDate: 2012-01-05 14:27:34 +0100 (jeu., 05 janv. 2012) $
+// $LastChangedRevision: 2096 $
+// $LastChangedBy: mdecorde $
+//
+package org.txm.importer.wtc
+
+import org.txm.Toolbox;
+import org.txm.importer.cwb.*
+import org.txm.importer.*;
+import org.txm.scripts.*;
+import org.txm.scripts.teitxm.*;
+import org.txm.utils.io.FileCopy;
+import org.txm.utils.treetagger.TreeTagger;
+
+import java.util.ArrayList;
+
+import javax.xml.stream.*;
+
+import java.net.URL;
+import java.io.File;
+import java.util.HashMap;
+import java.util.List;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class compiler.
+ */
+class compiler
+{
+	/** The debug. */
+	boolean debug = false;
+
+	/** The dir. */
+	private def dir;
+
+	/** The cwb loc. */
+	String cwbLoc;
+	File srcWTCFile, srcRegistryFile;
+
+	public def pAttributesList = [];
+	public def sAttributesList = [];
+
+	public compiler(File wtcFile, File registryFile) {
+		this.srcWTCFile = wtcFile;
+		this.srcRegistryFile = registryFile
+	}
+
+	/**
+	 * Sets the debug.
+	 *
+	 * @return the java.lang. object
+	 */
+	public setDebug()
+	{
+		debug =true;
+	}
+
+	/**
+	 * Sets the cwb path.
+	 *
+	 * @param path the new cwb path
+	 */
+	public void setCwbPath(String path)
+	{
+		if (!new File(path).exists())
+			System.err.println("CWB Path : "+path+" does not exists")
+		cwbLoc = path;
+	}
+
+	/**
+	 * Run.
+	 *
+	 * @param rootDirFile the root dir file
+	 * @param basename the basename
+	 * @return true, if successful
+	 */
+	public boolean run(File binDir, String corpusname)
+	{
+		if (cwbLoc == null)
+			cwbLoc = org.txm.Toolbox.getParam(org.txm.Toolbox.CQI_SERVER_PATH_TO_CQPLIB)+File.separator;
+
+		if (!new File(cwbLoc).exists()) {
+			println ("CWB path error: "+cwbLoc)
+			return false;
+		}
+		if (!binDir.exists()) {
+			println ("binary directory does not exists: "+binDir)
+			return false;
+		}
+
+		if (!srcWTCFile.exists()) {
+			println "Error: cannot find the WTC file $srcWTCFile"
+			return false;
+		}
+
+		File wtcFile = new File(binDir,"wtc/"+corpusname+".wtc");
+		new File(binDir, "wtc").deleteDir();
+		new File(binDir, "wtc").mkdir();
+		new File(binDir, "data").deleteDir();
+		new File(binDir, "data").mkdir();
+		new File(binDir, "registry").mkdir();
+
+		FileCopy.copy(srcWTCFile, wtcFile);
+
+		//2- Import into CWB
+		def outDir = binDir.getAbsolutePath()+"/";
+
+		CwbEncode cwbEn = new CwbEncode();
+		CwbMakeAll cwbMa = new CwbMakeAll();
+		cwbEn.setDebug(debug);
+		cwbMa.setDebug(debug);
+
+		String[] pAttributes;
+		String[] sAttributes;
+
+		if (srcRegistryFile == null) {
+			println "WARNING: No registry file found in source directory"
+			println "We'll search for positional attributes and structural attributes in the WTC file"
+
+			// s attributes
+			BuildCwbEncodeArgsFromWTC argsgetter = new BuildCwbEncodeArgsFromWTC(); // XML stream
+			argsgetter.process(wtcFile); //$NON-NLS-1$
+			sAttributesList = argsgetter.getSAttributes();
+
+			// p attributes
+			int nbAttr = -1;
+			File tmp = File.createTempFile("txm", ".wtc", wtcFile.getParentFile());
+			int wcounter = 1;
+			println "Adding the 'id' property to the WTC file and getting word properties number."
+			tmp.withWriter("UTF-8") { writer ->
+				wtcFile.eachLine("UTF-8") { line ->
+					if (!line.startsWith("<")) {
+						if (nbAttr == -1) nbAttr = line.split("\t").size();
+						writer.println(line+"\tw_"+(wcounter++))
+					} else {
+						writer.println(line)
+					}
+					writer.flush();
+				}
+			}
+			wtcFile.delete()
+			tmp.renameTo(wtcFile)
+
+			System.out.println("Found "+(nbAttr-1)+" word properties, $nbAttr with the 'id'");
+			for (int i = 1; i < nbAttr ; i++) {
+				pAttributesList << "p$i";
+			}
+			pAttributesList << "id"
+		} else {
+			ReadRegistryFile reader = new ReadRegistryFile(srcRegistryFile);
+			pAttributesList = reader.getPAttributes();
+			sAttributesList = reader.getSAttributes();
+			pAttributesList.remove(0) // remove word
+
+			if (!pAttributesList.contains("id")) {
+				System.out.println("Error: The registry file does not declare the 'id' word property");
+				return false;
+			}
+		}
+
+		pAttributes = pAttributesList; // cast to array
+		sAttributes = sAttributesList; // cast to array
+
+		println "pAttrs : "+Arrays.toString(pAttributes)
+		println "sAttrs : "+Arrays.toString(sAttributes)
+
+		try {
+			cwbEn.setDebug(debug);
+			cwbMa.setDebug(debug);
+			String regPath =outDir + "/registry/"+corpusname.toLowerCase()
+			cwbEn.run(cwbLoc + "cwb-encode", outDir + "/data/$corpusname", 
+					wtcFile.getAbsolutePath(),
+					regPath, pAttributes, sAttributes);
+			if (!new File(regPath).exists()) {
+				println "Error: The registry file was not created: $regPath. See https://groupes.renater.fr/wiki/txm-users/public/faq"
+				return false;
+			}
+			cwbMa.run(cwbLoc + "cwb-makeall", corpusname, outDir + "/registry");
+			return true;
+		} catch (Exception ex) {System.out.println(ex); return false;}
+
+		return true;
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args)
+	{
+		File dir = new File("~/xml/perrault/txm/");
+		List<File> files = dir.listFiles();
+		new compiler().run(files);
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/wtc/package.html
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/wtc/package.html	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/wtc/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>CWB import module.</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/org/txm/importer/wtc/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/importer/ApplyXsl.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/ApplyXsl.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/ApplyXsl.groovy	(revision 258)
@@ -0,0 +1,244 @@
+// 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
+// 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.
+
+//
+// This file is part of the TXM platform.
+//
+// The TXM platform is free software: you can redistribute it and/or modif y
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 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/>.
+// 
+// 
+// 
+// $LastChangedDate: 2016-03-01 10:10:58 +0100 (Tue, 01 Mar 2016) $
+// $LastChangedRevision: 3133 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer;
+
+/**
+ * @author mdecorde
+ */
+
+import java.io.File;
+import javax.xml.transform.Transformer
+import javax.xml.transform.TransformerFactory
+import javax.xml.transform.stream.StreamResult
+import javax.xml.transform.stream.StreamSource;
+
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import net.sf.saxon.*;
+import net.sf.saxon.s9api.*;
+
+// TODO: Auto-generated Javadoc
+/**
+ * apply a xsl file to a file : use process(File infile, File outfile, String[]
+ * args) to apply the xslt file loaded by the constructor args =
+ * ["name1","value1","name2",value2, ...]
+ * 
+ * @author mdecorde
+ */
+
+public class ApplyXsl {
+	
+//	/** The proc. */
+//	private Processor proc;
+//	
+//	/** The comp. */
+//	private XsltCompiler comp;
+//	
+//	/** The exp. */
+//	private XsltExecutable exp;
+//
+//	/** The source. */
+//	private XdmNode source;
+//	
+//	/** The out. */
+//	private Serializer out;
+//	
+//	/** The trans. */
+//	private XsltTransformer trans;
+
+	TransformerFactory tFactory;
+	Transformer transformer;
+	
+	/**
+	 * initialize with the xslt file.
+	 *
+	 * @param xsltfile the xsltfile
+	 */
+	public ApplyXsl(String xsltfile) {
+//		proc = new Processor(false);
+//		comp = proc.newXsltCompiler();
+//		exp = comp.compile(new StreamSource(new File(xsltfile)));
+		tFactory = new net.sf.saxon.TransformerFactoryImpl();
+		transformer = tFactory.newTransformer(new StreamSource(xsltfile));
+
+	}
+	
+	/**
+	 * initialize with the xslt file.
+	 *
+	 * @param xsltfile the xsltfile
+	 */
+	public ApplyXsl(File xsltfile) {
+//		proc = new Processor(false);
+//		comp = proc.newXsltCompiler();
+//		exp = comp.compile(new StreamSource(xsltfile));
+		tFactory = new net.sf.saxon.TransformerFactoryImpl();
+		transformer = tFactory.newTransformer(new StreamSource(xsltfile));
+	}
+
+	/**
+	 * Set in and out file.
+	 *
+	 * @param xmlinfile the xmlinfile
+	 * @param xmloutfile the xmloutfile
+	 * @return true, if successful
+	 */
+	private boolean SetInOutSource(String xmlinfile, String xmloutfile) {
+//		if (proc == null || exp == null || comp == null)
+//			return false;
+//
+//		source = proc.newDocumentBuilder().build(
+//				new StreamSource(new File(xmlinfile)));
+//		out = new Serializer();
+//		out.setOutputFile(new File(xmloutfile));
+//
+//		trans = exp.load();
+//		transformer.set.setInitialContextNode(source);
+//		transformer.setDestination(out);
+		return true;
+	}
+
+	/**
+	 * Set a xslt param.
+	 *
+	 * @param name the name
+	 * @param value the value
+	 * @return true, if successful
+	 */
+	public boolean SetParam(String name, Object value) {
+//		if (trans != null)
+//			trans.setParameter(new QName(name), new XdmAtomicValue("" + value));
+//		else
+//			return false;
+		return true;
+	}
+
+	/**
+	 * Force java to clean memory after processing a xslt. If not we might catch
+	 * a JavaHeapspace Exception
+	 * 
+	 */
+	private void cleanMemory() {
+//		source = null;
+//		trans = null;
+//		out = null;
+	}
+
+	/**
+	 * Process files with xslt args.
+	 *
+	 * @param xmlinfile file to be processed
+	 * @param xmloutfile output file
+	 * @param args xslt args ["arg1","arg1value","arg2","arg2value"...]
+	 * @return true, if successful
+	 */
+
+	public boolean process(String xmlinfile, String xmloutfile, String[] args) {
+		if (!this.SetInOutSource(xmlinfile, xmloutfile))
+			return false;
+		for (int i = 0; i < args.length; i = i + 2)// set params
+		{
+			if (!this.SetParam(args[i], args[i + 1]))
+				return false;
+		}
+
+		transformer.transform(new StreamSource(xmlinfile), new StreamResult(new BufferedOutputStream(new FileOutputStream(xmloutfile))));
+		cleanMemory(); // save memory
+		// System.out.println("Done");
+		return true;
+	}
+
+	/**
+	 * Process files without xslt args.
+	 *
+	 * @param xmlinfile the xmlinfile
+	 * @param xmloutfile the xmloutfile
+	 * @return true, if successful
+	 */
+	public boolean process(String xmlinfile, String xmloutfile) {
+		if (!this.SetInOutSource(xmlinfile, xmloutfile))
+			return false;
+
+		transformer.transform(new StreamSource(xmlinfile), new StreamResult(new BufferedOutputStream(new FileOutputStream(xmloutfile))));
+		cleanMemory();
+		// System.out.println("Done");
+		return true;
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args)
+	{
+		String xslfile = "pathtoxslfile";
+		ApplyXsl a = new ApplyXsl(xslfile);
+		
+		File srcdirectory = new File("pathtodirectorytoprocess")
+		assert(srcdirectory.exists())
+		assert(srcdirectory.isDirectory())
+		assert(srcdirectory.canRead())
+		assert(srcdirectory.canExecute())
+		
+		List<File> files = srcdirectory.listFiles();
+		
+		files = files.findAll{item-> item.getName().endsWith(".xml")}
+		
+		long bigstart = System.currentTimeMillis()
+		for(File infile : files)
+		{
+			String outfile = infile.getAbsolutePath()+".out"
+			if(infile.canRead())
+			{
+				long start = System.currentTimeMillis()
+				println "Process : "+infile.getName()
+				// String[] params = ["pbval1",1,"pbval2",2];
+				// a.process(infile.getAbsolutePath(),outfile); // no parameters
+				// a.process( infile.getAbsolutePath(),outfile,params);
+				println "Done : "+(System.currentTimeMillis()-start)+"ms"
+			}
+		}
+		println "Total time : "+(System.currentTimeMillis()-bigstart)+"ms"
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/CopyXMLFiles.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/CopyXMLFiles.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/CopyXMLFiles.groovy	(revision 258)
@@ -0,0 +1,63 @@
+package org.txm.importer;
+
+import java.io.File;
+import java.io.InputStream;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLResolver;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.events.DTD;
+import javax.xml.stream.events.EntityReference;
+
+import org.txm.utils.*
+import org.txm.utils.io.FileCopy;
+
+public class CopyXMLFiles {
+	File xmlFile;
+	File outDir;
+	def dtdFiles = []
+	
+	public CopyXMLFiles(File xmlFile) {
+		this.xmlFile = xmlFile;
+	}
+	
+	public boolean copy(File outDir) {
+		XMLInputFactory factory;
+		XMLStreamReader parser;
+		InputStream inputData = xmlFile.toURI().toURL().openStream();
+		factory = XMLInputFactory.newInstance();
+		factory.setXMLResolver(new XMLResolver() {
+			@Override
+			public Object resolveEntity(String publicID, String systemID,
+					String baseURI, String namespace) throws XMLStreamException {
+				//println "Resolving $publicID $systemID $baseURI $namespace"
+				File srcFile = new File(xmlFile.getParentFile(), systemID);
+				dtdFiles << srcFile
+				return srcFile.toURI().toURL().openStream();
+			}
+		});
+	
+		parser = factory.createXMLStreamReader(inputData);
+		
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+			
+		}
+		
+		dtdFiles << xmlFile
+		for (File dtd : dtdFiles) {
+			File cpy = new File(outDir, dtd.getName());
+			FileCopy.copy(dtd, cpy);
+		}
+		return outDir.listFiles().size() == dtdFiles.size();
+	}
+	
+	public static void main(def args) {
+		File xmlFile = new File("/home/mdecorde/Téléchargements/Inscriptions1.xml")
+		File outDir = new File("/home/mdecorde/Téléchargements/test")
+		outDir.mkdir()
+		CopyXMLFiles cdf = new CopyXMLFiles(xmlFile)
+		println cdf.copy(outDir)
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/WriteIdAndNAttributes.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/WriteIdAndNAttributes.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/WriteIdAndNAttributes.groovy	(revision 258)
@@ -0,0 +1,231 @@
+package org.txm.importer
+
+class WriteIdAndNAttributes extends StaxIdentityParser {
+
+	String textname
+
+	int nMileStone = 1, nPb = 1, nCb = 1, nLb = 1, nW = 1, nSeg = 1, nRejet = 1;
+	String previousMileStone, previousPb, previousCb, previousW;
+
+
+	String PB = "pb", CB = "cb", LB = "lb", ID = "id", TYPE = "type",
+	N = "n", CORRESP = "corresp", FACS="facs", W="w", PC="pc", SEG="seg",
+	UNIT="unit", XML="xml", WP="wp", SURFACE="surface", POINT = ".", REJET ="rejet";
+
+	public WriteIdAndNAttributes(File xmlFile, String textname) {
+		super(xmlFile);
+
+		this.textname = textname
+	}
+
+	protected void writeAttributes() {
+		// do nothing
+	}
+
+	protected void processStartElement() {
+		String id = null
+		String n = null
+		String type = null
+		String corresp = null
+		String facs = null
+
+		for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
+			if (parser.getAttributeLocalName(i) == ID) {
+				id = parser.getAttributeValue(i)
+			} else if (parser.getAttributeLocalName(i) == N) {
+				n = parser.getAttributeValue(i)
+			} else if (parser.getAttributeLocalName(i) == TYPE) {
+				type = parser.getAttributeValue(i)
+			} else if (parser.getAttributeLocalName(i) == CORRESP) {
+				corresp = parser.getAttributeValue(i)
+			} else if (parser.getAttributeLocalName(i) == FACS) {
+				facs = parser.getAttributeValue(i)
+			}
+		}
+
+		super.processStartElement(); // attributes are not written because super.writeAttributes() is not called
+
+		if (localname == "milestone" && parser.getAttributeValue(null, UNIT) == SURFACE) {
+			if (n == null) {
+				n = nMileStone
+			} else {
+				int tmp = Integer.parseInt(n)
+				if (nMileStone < tmp) {
+					nMileStone = tmp
+					n = tmp
+				} else {
+					n = nMileStone;
+				}
+			}
+
+			if (id == null) { // don't rewrite "id"
+				if (facs == null) {
+					println "Error: found milestone@type=\"surface\" with no @facs at "+parser.getLocation()
+					throw new Exception("no facs attribute")
+				}
+				if (facs.lastIndexOf(POINT) > 0) facs = facs.substring(0, facs.lastIndexOf(POINT))
+				previousMileStone = "surf_$textname"+"_"+facs
+				id = previousMileStone
+			} else {
+				previousMileStone = id
+			}
+
+			nMileStone++
+		} else if (localname == PB) {
+			if (n == null) {
+				n = nPb
+			} else {
+				try {
+					int tmp = Integer.parseInt(n)
+					if (nPb < tmp) {
+						nPb = tmp
+					} else {
+						n = nPb;
+					}
+				} catch(Exception e) { }
+			}
+
+			if (id == null) { // don't rewrite "id"
+				id = "page_${textname}_"+nPb
+				previousPb = "${textname}_"+nPb
+			} else {
+				previousPb = id
+			}
+
+			nRejet = nLb = nCb = 1
+			nPb++
+		} else if (localname == CB) {
+			if (n == null) {
+				n = nCb
+			} else {
+				try {
+					int tmp = Integer.parseInt(n)
+					if (nCb < tmp) {
+						nCb = tmp
+					} else {
+						n = nCb;
+					}
+				} catch(Exception e) { }
+			}
+
+			if (id == null) { // don't rewrite "id"
+				previousCb = "${previousPb}_"+nCb
+				id = "col_${previousPb}_"+nCb
+			} else {
+				previousCb = id
+			}
+
+			nLb = nRejet = 1
+			nCb++
+		} else if (localname == LB) {
+			if (n == null) {
+				if (REJET == type) {
+					println "Warning: no 'n' attribute provided for 'rejet' line break at "+parser.getLocation()
+				}
+				
+				n = nLb
+			} else {
+				if (REJET != type) {
+					try { // if n is numeric update nLgRelative
+						int tmp = Integer.parseInt(n)
+						nLb = tmp;
+					} catch(Exception e) {
+						// n is not numeric use it
+					}
+				}
+			}
+
+			if (id == null) { // don't rewrite "id"
+				if (REJET == type) {
+					id = "line_${previousCb}_"+n+"_r"+nRejet
+				} else {
+					id = "line_${previousCb}_"+n
+				}
+			}
+
+			if (corresp == null && REJET == type) {
+				//println "Warning: no 'corresp' attribute provided for 'rejet' line break at "+parser.getLocation()
+				corresp = "#line_${previousCb}_"+n; // next word id in the same column
+			}
+
+			if (REJET != type) {
+				nLb++;
+			} else {
+				nRejet++;
+			}
+
+		} else if (localname == W || localname == PC) {
+			if (n == null) {
+				n = nW
+			} else {
+				try {
+					int tmp = Integer.parseInt(n)
+					if (nW < tmp) {
+						nW = tmp
+					} else {
+						n = nW;
+					}
+				} catch(Exception e) { }
+			}
+
+			if (id == null) { // don't rewrite "id"
+				//previousW = "${previousPb}_"+nW
+				id = localname+"_${textname}_"+nW
+			} 
+			previousW = id
+			nSeg = 1
+			nW++
+		} else if (localname == SEG && WP == type) {
+			if (n == null) {
+				n = nSeg
+			} else {
+				try {
+					int tmp = Integer.parseInt(n)
+					if (nSeg < tmp) {
+						nSeg = tmp
+					} else {
+						n = nSeg;
+					}
+				} catch(Exception e) { }
+			}
+
+			if (id == null) { // don't rewrite "id"
+				id = "w_p_"+previousW+"_"+nSeg
+			}
+			nSeg++
+		}
+
+		// write attributes except ID, N and CORRESP
+		for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
+			if (parser.getAttributeLocalName(i) == ID) {
+
+			} else if (parser.getAttributeLocalName(i) == N) {
+
+			}  else if (parser.getAttributeLocalName(i) == CORRESP) {
+
+			} else {
+				writeAttribute(parser.getAttributePrefix(i), parser.getAttributeLocalName(i), parser.getAttributeValue(i))
+			}
+		}
+		//if (localname == "lb") println "write id: "+["xml", "id", id]
+		if (id != null)
+			writeAttribute(XML, ID, id)
+		if (n != null)
+			writeAttribute(null, N, n)
+		if (corresp != null)
+			writeAttribute(null, CORRESP, corresp)
+	}
+
+	public static void main(String[] args) {
+		File xmlFile = new File("/home/mdecorde/xml/bugrejet/Psautier5-or28.xml")
+		File outFile = new File("/home/mdecorde/xml/bugrejet/Psautier5-or28-o.xml")
+
+		WriteIdAndNAttributes wiana = new WriteIdAndNAttributes(xmlFile, "qgraal_cm")
+		println wiana.process(outFile)
+
+		String text = xmlFile.getText().replaceAll(">", ">\n");
+		new File("/home/mdecorde/xml/bugrejet/Psautier5-or28-p.xml").write(text);
+		text = outFile.getText().replaceAll(">", ">\n");
+		new File("/home/mdecorde/xml/bugrejet/Psautier5-or28-o-p.xml").write(text);
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/FortranColumns2XML.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/FortranColumns2XML.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/FortranColumns2XML.groovy	(revision 258)
@@ -0,0 +1,325 @@
+// 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
+// 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.
+
+//
+// This file is part of the TXM platform.
+//
+// The TXM platform is free software: you can redistribute it and/or modif y
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 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/>.
+// 
+// 
+// 
+// $LastChangedDate: 2016-12-16 17:28:35 +0100 (Fri, 16 Dec 2016) $
+// $LastChangedRevision: 3377 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer;
+
+import org.txm.utils.i18n.DetectBOM;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStreamReader;
+
+import javax.xml.stream.*;
+import java.net.URL;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class FortranColumns2XML.
+ */
+class FortranColumns2XML {
+	
+	/** The infile. */
+	
+	File infile;
+	
+	/** The outfile. */
+	File outfile;
+	
+	/** The encoding. */
+	String encoding;
+	
+	/** The column names. */
+	List<String> columnNames
+	
+	/** The word tag. */
+	String wordTag;
+	
+	/** The wordcolumn. */
+	int wordcolumn;
+	
+	/** The linecounter. */
+	int linecounter = 0;
+	
+	/** The check line number. */
+	int checkLineNumber;
+	
+	/** The check line number tag. */
+	String checkLineNumberTag;
+	
+	/** The columnindex. */
+	private List<Integer> columnindex;
+	
+	/** The endcolumnindex. */
+	private List<Integer> endcolumnindex;
+	
+	/** The line. */
+	private String line;
+	
+	/** The writer. */
+	private XMLStreamWriter writer;
+	
+	/** The reader. */
+	private Reader reader;
+	
+	/** The output. */
+	private FileOutputStream output;
+	
+	String textname;
+	
+	/**
+	 * Instantiates a new fortran columns2 xml.
+	 *
+	 * @param infile the infile
+	 * @param outfile the outfile
+	 * @param encoding the encoding
+	 */
+	FortranColumns2XML(File infile, File outfile, String encoding)
+	{
+		this.infile = infile;
+		this.outfile = outfile;
+		
+		textname = infile.getName();
+		int idx = -1;
+		idx = textname.indexOf(".");
+		if (idx > 0)
+			textname = textname.substring(0, idx);
+
+		def input = new FileInputStream(infile) 		
+		reader = new InputStreamReader(input , encoding);
+		DetectBOM bomdetector = new DetectBOM(infile);
+		for (int ibom = 0 ; ibom < bomdetector.getBOMSize() ; ibom++) input.read()
+		
+		XMLOutputFactory factory = XMLOutputFactory.newInstance();
+		output = new FileOutputStream(outfile)
+		writer = factory.createXMLStreamWriter(output, "UTF-8");
+	}
+	
+	/**
+	 * Process.
+	 *
+	 * @return true, if successful
+	 */
+	public boolean process()
+	{
+		line = reader.readLine(); // use the first line to find columns 
+		
+		if(columnindex == null || endcolumnindex == null)
+		{
+			searchNumberOfColumns();
+		}
+		
+		if(columnindex.size() != columnNames.size())
+		{
+			System.err.println("Number of column("+columnindex.size()+") different of number of column name("+columnNames.size()+")");
+			return false;
+		}
+		
+		//write start document
+		writer.writeStartDocument("UTF-8", "1.0");
+		writer.writeStartElement("text")
+		writer.writeAttribute("id",infile.getName())
+		
+		boolean gogogo = true;
+		while(gogogo)
+		{	
+			//println "line : "+line
+			processLine();//split line accordinly to columnindexes
+			linecounter++;
+			
+			//continue to read the document
+			line = reader.readLine();
+			if(line == null)
+				gogogo= false;
+		}
+		
+		writer.writeEndElement();
+		writer.writeEndDocument();
+		writer.close();
+		output.close();
+		
+		return true;
+	}
+	
+	/**
+	 * Process line.
+	 */
+	int wordcount = 1;
+	private void processLine()
+	{
+		String pcdata;
+		if(line.length() > 0)
+		{
+			writer.writeStartElement(wordTag)
+			if(setIds)
+				writer.writeAttribute("id", "w_"+textname+"_"+(wordcount++));
+			for(int i = 0 ; i < columnindex.size(); i++)
+			{
+				if(line.length() > endcolumnindex.get(i))
+				{
+					String substring = line.substring(columnindex.get(i), endcolumnindex.get(i))
+					if(i != wordcolumn)
+					{
+						writer.writeAttribute(columnNames.get(i), substring.trim())
+					}
+					else
+					{
+						pcdata = substring.trim()
+					}
+				}
+				else
+				{
+					println "Error: line $linecounter: len="+line.length()+" maxidx="+endcolumnindex.get(i)
+					println line;
+				}
+			}
+			writer.writeCharacters(pcdata);
+			writer.writeEndElement();
+		}
+	}
+	
+	/**
+	 * Sets the column indexes.
+	 *
+	 * @param starts the starts
+	 * @param ends the ends
+	 */
+	private void setColumnIndexes(List<Integer> starts, List<Integer> ends)
+	{
+		columnindex = starts;
+		endcolumnindex = ends;
+	}
+	
+	boolean setIds = false;
+	public void setAddIds(boolean setIds)
+	{
+		this.setIds = setIds;
+	}
+	
+	/**
+	 * Search number of columns.
+	 */
+	private void searchNumberOfColumns()
+	{
+		columnindex = new ArrayList<Integer>();
+		endcolumnindex = new ArrayList<Integer>();
+		columnindex.add(0);
+		int ic = 0
+		char c;
+		char[] cline = line.toCharArray();
+		int state = 0; // 0 lettre, 1 espace
+		
+		for(ic = 0 ; ic < cline.length ; ic++)
+		{
+			c = cline[ic];
+			if(state == 0)// zone lettre
+			{
+				if(c == " ")
+				{
+					state = 1;
+					
+				}
+			}
+			else // zone espace
+			{
+				if(c != " ")
+				{
+					columnindex.add(ic);
+					endcolumnindex.add(ic-1);
+					state = 0;
+				}
+			}
+		}
+		endcolumnindex.add(cline.length);
+		println columnindex;
+		println endcolumnindex;
+	}
+	
+	/**
+	 * Sets the columns lines names.
+	 *
+	 * @param columnNames the column names
+	 * @param unitTag the unit tag
+	 * @param wordcolumn the wordcolumn
+	 */
+	public void setColumnsLinesNames(List<String> columnNames, String unitTag, int wordcolumn)
+	{
+		this.columnNames = columnNames;
+		this.wordTag = unitTag;
+		this.wordcolumn = wordcolumn;
+	}
+	
+	/**
+	 * Sets the line check.
+	 *
+	 * @param colindex the colindex
+	 * @param tagname the tagname
+	 */
+	public void setLineCheck(int colindex, String tagname)
+	{
+		this.checkLineNumber = colindex;
+		this.checkLineNumberTag = tagname;
+	}
+	
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args)
+	{
+		File fortranfile = new File(System.getProperty("user.home"),"\\xml\\lasla\\lasla\\L01PlaAmphi.APN");
+		File outfile = new File(System.getProperty("user.home"),"\\xml\\lasla\\out.xml");
+		FortranColumns2XML builder = new FortranColumns2XML(fortranfile, outfile, "iso-8859-1");
+		builder.setColumnIndexes([0, 3, 4, 8, 29, 55, 67],	[3, 4, 8, 28, 54, 66, 79]);
+		builder.setColumnsLinesNames(["ref","s","sent","word","lemme","line","pos"], "w", 3);
+		builder.setLineCheck(3, "l");
+		
+		builder.process();
+	}
+}
+
+
Index: tmp/org.txm.core/src/groovy/org/txm/importer/doc/package.html
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/doc/package.html	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/doc/package.html	(revision 258)
@@ -0,0 +1,90 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<title>IMPORT WORD-ODT</title>
+</head>
+<body>
+<h3>IMPORT WORD-ODT </h3>
+
+<h4>Processus :</h4> 
+Pour l'instant, l'import WORD-ODT repose grandement sur l'import XML/w
+<ul>
+ <li>transformation en ODT de tous les documents : doc et docx</li>
+ <li>transformation en TEI avec XSL de Ratz</li>
+ <li>retire &lt;term> et &lt;teiHeader> (de toute façon vide)</li>
+ <li>import XML/w</li>
+</ul>
+
+<h4>Sauts de pages</h4>
+ Les pages sont paginées en fonction des soft-page-break d'ODT<br/>
+ repérage des &lt;xsl:template match="text:soft-page-break"><br/>
+
+<h4>Images</h4>
+ Le chemin des images de la source sont conservés jusqu'en l'édition dans l'attribut "url" des balises "graphic".<br/>
+ Il faut placer le dossier "Pictures" à coté des pages d'édition.<br/>
+ Il n'y a aucune différence dans le codage d'image linkée ou pas.<br/>
+ On peut différentier si une image est linké par son url : <br/>
+<ul>
+  <li>incorporée : "Pictures/xxx", Pictures est un dossier de l'archive ODT</li>
+  <li>linkée : "../xxx"</li>
+  <li>web : "http://" "ftp://" ...</li>
+</ul>
+
+<h4>Tokenisation</h4>
+ Pour cet import, j'ai branché le Tokenizer paramétrable en variables et en tests.<br/>
+ Les mots sont typés à l'import grâce aux paramétrages : protocole, tag, path, number<br/>
+ corrections de bugs de tokenisation du "SimpleXmlTokenizer"<br/>
+
+<h3>MODIFS XSL RATZ</h3>
+<h4>Paragraphes</h4>
+ styles automatiques PN -> prend style parent<br/>
+ erreur xsl avec certains odt<br/>
+ récupération du style parent des styles automatiques<br/>
+
+<h4>Sauts de page</h4>
+ text:soft-page-break -> pb<br/>
+
+<h4>gestion par défaut de certains [[[UNTRANSLATED...]]]</h4>
+Affichage du content des éléments :<br/>
+<ul>
+ <li>text:editing-cycles</li>
+ <li>text:page-count</li>
+ <li>text:word-count</li>
+ <li>text:image-count</li>
+ <li>text:table-count</li>
+ <li>text:modification-date</li>
+ <li>text:modification-time</li>
+ <li>text:sequence-ref</li>
+</ul>
+<h3>A FAIRE</h3>
+
+<h4>Images</h4>
+ Automatiser la déplacement des images lors de l'import pour que les url pointent bien les fichiers.<br/>
+ xxxx-files -> $TXMHOME/corpora/$CORPUS/HTML/default<br/>
+
+<h4>Tokenisation</h4>
+ PB: les mots sont dabord découpés par blanc (ex: pas bon pour <tag attr="" atrt2="">)<br/>
+
+<h4>UNTRANSLATED</h4>
+Faut-il marquer ces infos : <br/>
+<ul>
+ <li>text:editing-cycles</li>
+ <li>text:page-count</li>
+ <li>text:word-count</li>
+ <li>text:image-count</li>
+ <li>text:table-count</li>
+ <li>text:modification-date</li>
+ <li>text:modification-time</li>
+ <li>text:sequence-ref</li>
+</ul>
+<h4>Sauts de page durs</h4>
+ Ils sont codés dans les styles de paragraphe **automatiques**<br/>
+ &lt;style:paragraph-properties fo:break-before="page"/><br/>
+
+<h4>Typage des paragraphes</h4>
+ but atteindre un typage comme celui fait par l'export xHTML d'oo<br/>
+ lire styles.xml et créer une css<br/>
+ Unifier les styles identiques ?<br/>
+ Reclasser les @rend ?<br/>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/org/txm/importer/doc/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/importer/doc/FixBreaksAndAutomaticStyles.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/doc/FixBreaksAndAutomaticStyles.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/doc/FixBreaksAndAutomaticStyles.groovy	(revision 258)
@@ -0,0 +1,120 @@
+package org.txm.importer.doc
+
+import org.txm.utils.NameSpaceXmlNodePrinter
+import org.txm.utils.NameSpaceXmlNodePrinter.NamespaceContext
+import org.txm.utils.io.IOUtils;
+
+import groovy.xml.QName
+import groovy.xml.StreamingMarkupBuilder
+
+class FixBreaksAndAutomaticStyles {
+
+	def nsText = new groovy.xml.Namespace("urn:oasis:names:tc:opendocument:xmlns:text:1.0", 'tei')
+	def sytleAt;
+	def pbAt;
+
+	FixBreaksAndAutomaticStyles() {
+
+	}
+	def befores
+	def afters
+	def parents
+
+	public boolean run(File xmlFile, def befores, def afters, def parents) {
+
+		sytleAt = nsText.get("rend")
+		pbAt = nsText.get("soft-page-break")
+
+
+		def parser = new XmlParser(false, true)
+		def root = parser.parse(xmlFile)
+
+		this.befores = befores
+		this.afters = afters
+		this.parents = parents
+		process(root, null)
+
+
+		//println root.children()
+		File tmp = new File(xmlFile.getParentFile(), "test.txt")
+		def writer = IOUtils.getWriter(tmp, "UTF-8")
+		writer.write('<?xml version="1.0" encoding="UTF-8"?>\n')
+		def printer = new NameSpaceXmlNodePrinter(new PrintWriter(writer))
+		//create namespace context
+		NamespaceContext namespaceContext = new NamespaceContext(printer);
+		namespaceContext.registerNamespacePrefix("office", "urn:oasis:names:tc:opendocument:xmlns:office:1.0");
+		namespaceContext.registerNamespacePrefix("style", "urn:oasis:names:tc:opendocument:xmlns:style:1.0");
+		namespaceContext.registerNamespacePrefix("text", "urn:oasis:names:tc:opendocument:xmlns:text:1.0");
+		namespaceContext.registerNamespacePrefix("table", "urn:oasis:names:tc:opendocument:xmlns:table:1.0");
+		namespaceContext.registerNamespacePrefix("draw", "urn:oasis:names:tc:opendocument:xmlns:drawing:1.0");
+		namespaceContext.registerNamespacePrefix("fo", "urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0");
+		namespaceContext.registerNamespacePrefix("xlink", "http://www.w3.org/1999/xlink");
+		namespaceContext.registerNamespacePrefix("dc", "http://purl.org/dc/elements/1.1/");
+		namespaceContext.registerNamespacePrefix("meta", "urn:oasis:names:tc:opendocument:xmlns:meta:1.0");
+		namespaceContext.registerNamespacePrefix("number", "urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0");
+		namespaceContext.registerNamespacePrefix("svg", "urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0");
+		namespaceContext.registerNamespacePrefix("chart", "urn:oasis:names:tc:opendocument:xmlns:chart:1.0");
+		namespaceContext.registerNamespacePrefix("dr3d", "urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0");
+		namespaceContext.registerNamespacePrefix("math", "http://www.w3.org/1998/Math/MathML");
+		namespaceContext.registerNamespacePrefix("form", "urn:oasis:names:tc:opendocument:xmlns:form:1.0");
+		namespaceContext.registerNamespacePrefix("script", "urn:oasis:names:tc:opendocument:xmlns:script:1.0");
+		namespaceContext.registerNamespacePrefix("ooo", "http://openoffice.org/2004/office");
+		namespaceContext.registerNamespacePrefix("ooow", "http://openoffice.org/2004/writer");
+		namespaceContext.registerNamespacePrefix("oooc", "http://openoffice.org/2004/calc");
+		namespaceContext.registerNamespacePrefix("dom", "http://www.w3.org/2001/xml-events");
+		namespaceContext.registerNamespacePrefix("xforms", "http://www.w3.org/2002/xforms");
+		namespaceContext.registerNamespacePrefix("xsd", "http://www.w3.org/2001/XMLSchema");
+		namespaceContext.registerNamespacePrefix("xsi", "http://www.w3.org/2001/XMLSchema-instance");
+		namespaceContext.registerNamespacePrefix("rpt", "http://openoffice.org/2005/report");
+		namespaceContext.registerNamespacePrefix("of", "urn:oasis:names:tc:opendocument:xmlns:of:1.2");
+		namespaceContext.registerNamespacePrefix("xhtml", "http://www.w3.org/1999/xhtml");
+		namespaceContext.registerNamespacePrefix("grddl", "http://www.w3.org/2003/g/data-view#");
+		namespaceContext.registerNamespacePrefix("tableooo", "http://openoffice.org/2009/table");
+		namespaceContext.registerNamespacePrefix("field", "urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0");
+		namespaceContext.registerNamespacePrefix("formx", "urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0");
+		namespaceContext.registerNamespacePrefix("css3t", "http://www.w3.org/TR/css3-text/");
+
+		printer.setNamespaceAware(true);
+		printer.print(root, namespaceContext)
+		writer.close();
+
+		if (xmlFile.delete()) tmp.renameTo(xmlFile);
+		else println "FixBreaksAndAutomaticStyles: Error: could not replace "+xmlFile
+	}
+
+	public void process(def node, def parent) {
+		if (!(node instanceof groovy.util.Node)) return;
+
+		def list = new ArrayList(node.children())
+		for( def child : list) {
+			process(child, node)
+		}
+		String name = node.name().getLocalPart()
+		if ("p" == name || "div" == name) {
+			//println "P: "+node.attribute("rend")
+			String style = node.attribute("rend")
+			if (befores.contains(style)) {
+				def newChild = new Node(null, "pb")
+				newChild.parent = parent
+				def idx = parent.children().indexOf(node)
+				//println "b idx: $idx"
+				parent.children().add(idx, newChild)
+			} else if (afters.contains(style)) {
+				def newChild = new Node(null, "pb")
+				newChild.parent = parent
+				def idx = parent.children().indexOf(node)
+				//println "a idx: $idx"
+				parent.children().add(idx+1, newChild)
+			}
+			if (parents.containsKey(style)) {
+				//println "parent of "+style+ " = "+parents[style]
+				node.attributes()["rend"] = parents[style]
+			}
+		}
+	}
+
+	public static void main(String[] args) {
+		File xmlFile = new File("/home/mdecorde/xml/temoignages/content.xml")
+		new FixBreaksAndAutomaticStyles().run(xmlFile, ["P1", "P2"], ["P3"], ["P1": "Standard", "P2":"Standard", "P3":"Standard"])
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/doc/docLoader.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/doc/docLoader.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/doc/docLoader.groovy	(revision 258)
@@ -0,0 +1,362 @@
+// 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
+// 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.
+//
+//
+//
+// $LastChangedDate: 2012-04-24 14:30:47 +0200 (mar., 24 avr. 2012) $
+// $LastChangedRevision: 2174 $
+// $LastChangedBy: mdecorde $
+//
+package org.txm.importer.doc;
+
+import org.txm.importer.*;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.txm.importer.ApplyXsl2;
+import org.txm.importer.ValidateXml;
+import org.txm.importer.xml.importer;
+import org.txm.importer.xml.compiler;
+import org.txm.objects.*;
+import org.txm.tokenizer.TokenizerClasses;
+import org.txm.utils.*;
+import org.txm.*;
+import org.txm.scripts.teitxm.*;
+import org.txm.utils.i18n.*;
+import org.txm.metadatas.*;
+
+import javax.xml.stream.*;
+
+import org.w3c.dom.Element;
+import org.txm.sw.RemoveTag;
+import org.txm.doc.*;
+
+String userDir = System.getProperty("user.home");
+
+def MONITOR;
+boolean debug = org.txm.utils.logger.Log.isPrintingErrors();
+BaseParameters params;
+try {params = paramsBinding;MONITOR=monitor} catch (Exception)
+{	println "DEV MODE";//exception means we debug
+	debug = true
+	params = new BaseParameters(new File(userDir, "xml/doc/import.xml"))
+	params.load()
+	if (!org.txm.Toolbox.isInitialized()) {
+		TokenizerClasses.loadFromNode(params.getTokenizerElement(params.getCorpusElement()));
+		Toolbox.setParam(Toolbox.INSTALL_DIR,new File("/usr/lib/TXM"));
+		//Toolbox.setParam(Toolbox.INSTALL_DIR,new File("C:\\Program Files\\TXM"));//For Windows
+		Toolbox.setParam(Toolbox.TREETAGGER_INSTALL_PATH,new File(userDir,"treetagger"));
+		//Toolbox.setParam(Toolbox.TREETAGGER_INSTALL_PATH,new File("C:\\Program Files\\treetagger"));//for Windows
+		Toolbox.setParam(Toolbox.TREETAGGER_MODELS_PATH,new File(userDir,"treetagger/models"));
+		Toolbox.setParam(Toolbox.METADATA_ENCODING, "UTF-8");
+		Toolbox.setParam(Toolbox.METADATA_COLSEPARATOR, ",");
+		Toolbox.setParam(Toolbox.METADATA_TXTSEPARATOR, "\"");
+		//Toolbox.setParam(Toolbox.TREETAGGER_MODELS_PATH,new File("C:\\Program Files\\treetagger\\models"));//for Windows
+		Toolbox.setParam(Toolbox.USER_TXM_HOME, new File(System.getProperty("user.home"), "TXM"));
+	}
+}
+if (params == null) { println "no parameters. Aborting"; return; }
+
+String corpusname = params.getCorpusName();
+Element corpusElem = params.corpora.get(corpusname);
+String basename = params.name;
+String rootDir = params.rootDir;
+String lang = corpusElem.getAttribute("lang");
+String model = lang
+boolean annotate = "true" == corpusElem.getAttribute("annotate");
+int wordsPerPage = params.getWordsPerPage("default")
+boolean build_edition = params.getDoEdition("default")
+
+File srcDir = new File(rootDir);
+File binDir = new File(Toolbox.getParam(Toolbox.USER_TXM_HOME), "corpora/"+basename);
+binDir.deleteDir();
+binDir.mkdirs();
+if (!binDir.exists()) {
+	println "Could not create binDir "+binDir
+	return;
+}
+
+File txmDir = new File(binDir, "txm/$corpusname");
+txmDir.deleteDir();
+txmDir.mkdirs();
+
+String textSortAttribute = null; // a property in metadata.csv file
+String paginationElement = "pb";
+boolean normalizeMetadata = true;
+
+File allmetadatasfile = new File(srcDir, "metadata.csv");
+
+if (txmDir.listFiles() == null) {
+	println "No file to process"
+	return;
+}
+
+def srcfiles = [];
+for (File f : srcDir.listFiles()) {
+	String name = f.getName().toLowerCase();
+	if (name.endsWith(".properties")) continue;
+	if (name.equals("import.xml")) continue;
+	if (name.endsWith(".csv")) continue;
+	if (f.isDirectory()) continue;
+	if (f.isHidden()) continue;
+	if (name.endsWith(".doc") || name.endsWith(".docx") || name.endsWith(".odt") || name.endsWith(".rtf")) {
+		srcfiles.add(f)
+	}
+}
+
+if (srcfiles.size() == null) {
+	println "No file to process"
+	return;
+}
+
+// convert to TEI
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+if (MONITOR != null) MONITOR.worked(20, "CREATING TEI FILES")
+println "-- CONVERTER - Converting source files"
+File xsldir = new File(Toolbox.getParam(Toolbox.USER_TXM_HOME), "xsl")
+if (!DocumentToTei.processFiles(srcfiles, txmDir, xsldir)) {
+	println "Abord import"
+	return;
+}
+println ""
+
+// move data folders and build css file
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+if (MONITOR != null) MONITOR.worked(20, "RETRIEVE STYLES")
+println "Retrieving data folders and style files"
+println txmDir.listFiles()
+File docfiles = new File(binDir, "docfiles");
+docfiles.mkdir()
+for (File infile : txmDir.listFiles()) {
+	if (infile.isDirectory()) {
+		File unzipDir = new File(docfiles, infile.getName())
+		infile.renameTo(unzipDir)
+
+		//println "zipdir "+unzipDir
+		StylesToCSS converter = new StylesToCSS(unzipDir);
+		if (!converter.process(new File(unzipDir, "style.css"))) {
+			println "WARNING: Failed to build css file of $unzipDir"
+		}
+		// and get the soft page breaks and styles parents
+		def parentStyles = converter.parentStyles;
+		def beforebreaks = converter.beforebreaks
+		def afterbreaks = converter.afterbreaks
+
+		//println "BEFORES: "+beforebreaks
+		//println "AFTERS: "+afterbreaks
+		//println "PARENTS: "+parentStyles
+
+		// se servir de ça pour insérer <pb/> et remplacer styles automatiques
+		File xmlFile = new File(txmDir, unzipDir.getName().substring(6))
+		//println "PATCH : $xmlFile"
+		new FixBreaksAndAutomaticStyles().run(xmlFile, beforebreaks, afterbreaks, parentStyles)
+	}
+}
+
+// set new Root
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+if (MONITOR != null) MONITOR.worked(20, "FIXING TEI")
+println "Setting new XML root element"
+for (File infile : txmDir.listFiles()) {
+	if (infile.isHidden() || infile.isDirectory() || infile.getName().startsWith(".")) continue;
+	print "."
+	if (!SetNewXmlDocumentRoot.process(infile, "//tei:text")) {
+		println "Failed to reset XML root $infile"
+		return
+	}
+}
+println ""
+
+// filtering
+println "Filtering XML files with xpaths: [//tei:term]"
+def xpaths = params.getExcludeXpaths()
+if (xpaths == null) xpaths = ["//tei:term"]
+else xpaths << "//tei:term"
+
+if (xpaths != null) {
+	println "Filtering XML files with xpaths: $xpaths"
+	for (File infile : txmDir.listFiles()) {
+		if (infile.isHidden() || infile.isDirectory() || infile.getName().startsWith(".")) continue;
+		print "."
+		if (!RemoveTag.xpath(infile, xpaths)) {
+			println "Failed to filter $infile"
+			return
+		}
+	}
+	println ""
+}
+
+//get metadata values from CSV
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+if (MONITOR != null) MONITOR.worked(20, "READ METADATA")
+Metadatas metadatas; // text metadata
+//println "Trying to read metadata from: "+allmetadatasfile
+if (allmetadatasfile.exists()) {
+	File copy = new File(binDir, "metadata.csv")
+	if (!FileCopy.copy(allmetadatasfile, copy)) {
+		println "Error: could not create a copy of the metadata.csv file "+allmetadatasfile.getAbsoluteFile();
+		return;
+	}
+	metadatas = new Metadatas(copy, Toolbox.getParam(Toolbox.METADATA_ENCODING), Toolbox.getParam(Toolbox.METADATA_COLSEPARATOR), Toolbox.getParam(Toolbox.METADATA_TXTSEPARATOR), 1)
+} else {
+	println "no $allmetadatasfile metadata file found."
+}
+
+for (File infile : txmDir.listFiles()) {
+	if (infile.isHidden()) infile.delete();
+	if (infile.getName().startsWith(".")) infile.delete();
+}
+
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+if (MONITOR != null) MONITOR.worked(5, "IMPORTER")
+println "-- IMPORTER - Reading source files"
+def imp = new importer();
+imp.doValidation(true) // change this to not validate xml
+imp.doTokenize(true) // change this, to not tokenize xml
+if (!imp.run(srcDir, binDir, txmDir, basename, "", lang)) {
+	println "import process stopped";
+	return;
+}
+
+if (metadatas != null) {
+	if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+	if (MONITOR != null) MONITOR.worked(20, "INJECTING METADATA")
+	println "-- INJECTING METADATA - from csv file: "+allmetadatasfile
+	
+	println("Injecting metadata: "+metadatas.getHeadersList()+" in texts of directory "+new File(binDir,"txm"))
+	for (File infile : txmDir.listFiles()) {
+		if (infile.isHidden() || infile.isDirectory() || infile.getName().startsWith(".")) continue;
+		print "."
+
+		File outfile = File.createTempFile("temp", ".xml", infile.getParentFile());
+		if (!metadatas.injectMetadatasInXml(infile, outfile, "text", null)) {
+			outfile.delete();
+		} else {
+			if (!(infile.delete() && outfile.renameTo(infile))) println "Warning can't rename file "+outfile+" to "+infile
+			if (!infile.exists()) {
+				println "Error: could not replace $infile by $outfile"
+				return false;
+			}
+		}
+	}
+	println ""
+}
+
+List<File> files = txmDir.listFiles()
+if (files == null || files.size() == 0) {
+	return;
+}
+
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+if (MONITOR != null) MONITOR.worked(20, "ANNOTATE")
+println "-- ANNOTATE - Running NLP tools"
+boolean annotationSuccess = false;
+if (annotate && new Annotate().run(binDir, txmDir, model+".par")) {
+	annotationSuccess = true;
+}
+
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+if (MONITOR != null) MONITOR.worked(25, "COMPILING")
+println "-- COMPILING - Building Search Engine indexes"
+def c = new compiler();
+if(debug) c.setDebug();
+//c.setCwbPath("~/TXM/cwb/bin");
+c.setOptions(textSortAttribute, normalizeMetadata);
+c.setAnnotationSuccess(annotationSuccess)
+c.setLang(lang);
+if (!c.run(binDir, txmDir, corpusname, null, srcfiles, metadatas)) {
+	println "import process stopped";
+	return;
+}
+
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+
+new File(binDir,"HTML/$corpusname").deleteDir();
+new File(binDir,"HTML/$corpusname").mkdirs();
+if (build_edition) {
+
+	println "-- EDITION - Building edition"
+	if (MONITOR != null) MONITOR.worked(25, "EDITION")
+
+	File outdir = new File(binDir,"/HTML/$corpusname/default/");
+	outdir.mkdirs();
+	List<File> filelist = txmDir.listFiles();
+	Collections.sort(filelist);
+	def second = 0
+
+	println "Paginating texts: "
+
+	for (File txmFile : filelist) {
+		if (txmFile.isHidden() || txmFile.isDirectory() || txmFile.getName().startsWith(".")) continue;
+		print "."
+
+		String txtname = txmFile.getName();
+		int i = txtname.lastIndexOf(".");
+		if(i > 0) txtname = txtname.substring(0, i);
+
+		List<String> NoSpaceBefore = LangFormater.getNoSpaceBefore(lang);
+		List<String> NoSpaceAfter = LangFormater.getNoSpaceAfter(lang);
+
+		Element text = params.addText(corpusElem, txtname, txmFile);
+
+		def ed = new pager(txmFile, outdir, txtname, NoSpaceBefore, NoSpaceAfter, wordsPerPage, basename, "pb");
+		Element edition = params.addEdition(text, "default", outdir.getAbsolutePath(), "html");
+
+		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 (File unzipDir : docfiles.listFiles()) {
+		File css = new File(unzipDir, "style.css")
+		String textname = unzipDir.getName();
+		textname = textname.substring(6, textname.lastIndexOf(".")) // remove "files-" and ".xml"
+		File newcss = new File(outdir, textname+".css")
+		css.renameTo(newcss)
+	}
+	File doc = new File(Toolbox.getParam(Toolbox.USER_TXM_HOME), "css/doc.css")
+	doc_copy = new File(outdir, "doc.css")
+	FileCopy.copy(doc, doc_copy);
+
+
+	// copy images : images externaly linked must be added manually in the html/CORPUS/default directory
+	println "Copying internal images..."
+	for (File txmFile : filelist) {
+		if (txmFile.isHidden() || txmFile.isDirectory() || txmFile.getName().startsWith(".")) continue;
+		print "."
+		File picturesDirectory = new File(binDir, "docfiles/files-"+txmFile.getName()+"/Pictures")
+		println picturesDirectory
+		if (picturesDirectory.exists()) {
+			File picturesDirectory_copy = new File(outdir, "Pictures")
+			if (!FileCopy.copyFiles(picturesDirectory, picturesDirectory_copy)) {
+				println "Failed to copy $picturesDirectory to $picturesDirectory_copy"
+			}
+		}
+	}
+	println ""
+}
+
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+if (MONITOR != null) MONITOR.worked(20, "FINALIZING")
+File paramFile = new File(binDir, "import.xml");
+DomUtils.save(params.root.getOwnerDocument(), paramFile);readyToLoad = true;
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/importer/doc/pager.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/doc/pager.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/doc/pager.groovy	(revision 258)
@@ -0,0 +1,472 @@
+// 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
+// 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.
+//
+//
+//
+// $LastChangedDate: 2012-04-24 14:30:47 +0200 (mar., 24 avr. 2012) $
+// $LastChangedRevision: 2174 $
+// $LastChangedBy: mdecorde $
+//
+package org.txm.importer.doc;
+
+import org.txm.importer.*;
+import org.xml.sax.Attributes;
+import org.txm.importer.filters.*;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.stream.*;
+import java.net.URL;
+import org.xml.sax.InputSource;
+import org.xml.sax.helpers.DefaultHandler;
+
+// TODO: Auto-generated Javadoc
+/** 
+ * Build edition from xml-tei-odt
+ * @author mdecorde
+ * 
+ */
+class pager {
+	List<String> NoSpaceBefore;
+
+	/** The No space after. */
+	List<String> NoSpaceAfter;
+
+	/** The wordcount. */
+	int wordcount = 0;
+
+	/** The pagecount. */
+	int pagecount = 0;
+
+	/** The wordmax. */
+	int wordmax = 0;
+
+	/** The basename. */
+	String basename = "";
+	String txtname = "";
+	File outdir;
+
+	/** The wordid. */
+	String wordid;
+
+	/** The first word. */
+	boolean firstWord = true;
+
+	/** The wordvalue. */
+	String wordvalue;
+
+	/** The interpvalue. */
+	String interpvalue;
+
+	/** The lastword. */
+	String lastword = " ";
+
+	/** The wordtype. */
+	String wordtype;
+
+	/** The flagform. */
+	boolean flagform = false;
+
+	/** The flaginterp. */
+	boolean flaginterp = false;
+
+	/** The url. */
+	private def url;
+
+	/** The input data. */
+	private def inputData;
+
+	/** The factory. */
+	private def factory;
+
+	/** The parser. */
+	private XMLStreamReader parser;
+
+	/** The writer. */
+	OutputStreamWriter writer;
+
+	/** The multiwriter. */
+	OutputStreamWriter multiwriter = null;
+	
+	/** The pagedWriter. */
+	StaxStackWriter pagedWriter = null;
+
+	/** The infile. */
+	File infile;
+
+	/** The outfile. */
+	File outfile;
+
+	/** The pages. */
+	ArrayList<File> pages = new ArrayList<File>();
+
+	/** The idxstart. */
+	ArrayList<String> idxstart = new ArrayList<String>();
+	String editionPage;
+
+	/**
+	 * Instantiates a new pager.
+	 *
+	 * @param infile the infile
+	 * @param outfile the outfile
+	 * @param NoSpaceBefore the no space before
+	 * @param NoSpaceAfter the no space after
+	 * @param max the max
+	 * @param basename the basename
+	 */
+	pager(File infile, File outdir, String txtname, List<String> NoSpaceBefore,
+	List<String> NoSpaceAfter, int max, String basename, String editionPage) {
+		this.editionPage = editionPage;
+		this.basename = basename;
+		this.txtname = txtname;
+		this.outdir = outdir;
+		this.wordmax = max;
+		this.NoSpaceBefore = NoSpaceBefore;
+		this.NoSpaceAfter = NoSpaceAfter;
+		this.url = infile.toURI().toURL();
+		this.infile = infile;
+
+		inputData = url.openStream();
+		factory = XMLInputFactory.newInstance();
+		parser = factory.createXMLStreamReader(inputData);
+		process();
+	}
+
+	private def closeMultiWriter()
+	{
+		if (pagedWriter != null) {
+			def tags = pagedWriter.getTagStack().clone();
+			if (firstWord) { // there was no words
+				this.idxstart.add("w_0")
+				pagedWriter.write("<span id=\"w_0\"/>");
+			}
+
+			pagedWriter.writeEndElements();
+			pagedWriter.close();
+			return tags;
+
+			//			pagedWriter.write("</body>");
+			//			pagedWriter.write("</html>");
+			//			pagedWriter.close();
+		} else {
+			return [];
+		}
+	}
+
+	/**
+	 * Creates the next output.
+	 *
+	 * @return true, if successful
+	 */
+	private boolean createNextOutput()
+	{
+		wordcount = 0;
+		try {
+			def tags = closeMultiWriter()
+			for (int i = 0 ; i < tags.size() ; i++) {
+				String tag = tags[i]
+				if ("body" != tag) {
+					tags.remove(i--)
+				} else {
+					tags.remove(i--) // remove "body"
+					break; // remove elements until "body tag
+				}
+			}
+			File outfile = new File(outdir, txtname+"_"+(++pagecount)+".html")
+			pages.add(outfile)
+			firstWord = true // waiting for next word
+
+			pagedWriter = new StaxStackWriter(outfile , "UTF-8");
+			pagedWriter.writeStartDocument("UTF-8", "1.0")
+			pagedWriter.writeStartElement("html")
+			pagedWriter.writeEmptyElement("meta", ["http-equiv":"Content-Type", "content":"text/html","charset":"UTF-8"])
+			pagedWriter.writeStartElement("head")
+			pagedWriter.writeEmptyElement("link", ["rel":"stylesheet", "href":txtname+".css"])
+			pagedWriter.writeEmptyElement("link", ["rel":"stylesheet", "href":"doc.css"])
+			pagedWriter.writeStartElement("title")
+			pagedWriter.writeCharacters(basename.toUpperCase()+" Edition - Page "+pagecount)
+			pagedWriter.writeEndElement() // </title>
+			pagedWriter.writeEndElement() // </head>
+			pagedWriter.writeStartElement("body") //<body>
+			pagedWriter.writeStartElements(tags)
+			return true;
+		} catch (Exception e) {
+			System.out.println(e.getLocalizedMessage());
+			return false;
+		}
+	}
+
+	/**
+	 * Creates the output.
+	 *
+	 * @param outfile the outfile
+	 * @return true, if successful
+	 */
+	private boolean createOutput() {
+		try {
+			return createNextOutput();
+		} catch (Exception e) {
+			System.out.println(e.getLocalizedMessage());
+			return false;
+		}
+	}
+
+	/**
+	 * Gets the page files.
+	 *
+	 * @return the page files
+	 */
+	public ArrayList<File> getPageFiles() {
+		return pages;
+	}
+
+	/**
+	 * Gets the idx.
+	 *
+	 * @return the idx
+	 */
+	public ArrayList<String> getIdx() {
+		return idxstart;
+	}
+
+	void gotoText() {
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+			switch (event) {
+				case XMLStreamConstants.END_ELEMENT:
+					if(parser.getLocalName() == "teiHeader")
+						return;
+			}
+		}
+	}
+	/**
+	 * Process.
+	 */
+	void process() {
+		try {
+		String localname = "";
+		String figurerend = ""
+		boolean unordered = false;
+		createNextOutput();
+		
+		gotoText();
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+			switch (event) {
+				case XMLStreamConstants.START_ELEMENT:
+					localname = parser.getLocalName();
+					switch (localname) {
+						case "textunit":
+							if (parser.getAttributeValue(null,"id") != null) {
+								pagedWriter.writeStartElement("h3")
+								pagedWriter.writeCharacters(parser.getAttributeValue(null,"id"))
+								pagedWriter.writeEndElement() // h3
+							}
+							pagedWriter.writeStartElement("table")
+							for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
+								pagedWriter.writeStartElement("tr")
+								pagedWriter.writeStartElement("td")
+								pagedWriter.writeCharacters(parser.getAttributeLocalName(i))
+								pagedWriter.writeEndElement() // td
+								pagedWriter.writeStartElement("td")
+								pagedWriter.writeCharacters(parser.getAttributeValue(i))
+								pagedWriter.writeEndElement() // td
+								pagedWriter.writeEndElement() // tr
+							}
+							pagedWriter.writeEndElement() // table
+							pagedWriter.writeEmptyElement("br")
+							break;
+						case "head":
+							String rend = parser.getAttributeValue(null, "rend")
+							if (rend == null) rend = "normal"
+							pagedWriter.writeStartElement("h2", ["class":rend])
+							break;
+						case "figure":
+							figurerend = parser.getAttributeValue(null, "rend")
+							break;
+						case "graphic":
+							String url = parser.getAttributeValue(null, "url")
+							if (url.startsWith("..//")) url = url.substring(4);
+							else if (url.startsWith("../")) url = url.substring(3);
+
+							if (url != null) { 
+								pagedWriter.writeStartElement("div")
+								pagedWriter.writeEmptyElement("img", ["class":figurerend, "src":url])
+								pagedWriter.writeEndElement() // div
+							}
+							figurerend = "";
+							break;
+						case "lg":
+						case "p":
+						case "q":
+							String rend = parser.getAttributeValue(null, "rend")
+							if (rend == null) rend = "normal"
+							pagedWriter.writeStartElement("p", ["class":rend])
+							break;
+						//case "pb":
+						case editionPage:
+							createNextOutput();
+							wordcount=0;
+							if (parser.getAttributeValue(null,"n") != null) {
+								pagedWriter.writeStartElement("p", ["style":"color:red", "align":"center"])
+								pagedWriter.writeCharacters("- "+parser.getAttributeValue(null,"n")+" -")
+								pagedWriter.writeEndElement() // p
+							}
+							break;
+						case "table":
+							pagedWriter.writeStartElement("table", ["class":parser.getAttributeValue(null, "rend")])
+							break;
+						case "row":
+							pagedWriter.writeStartElement("tr")
+							break;
+						case "cell":
+							pagedWriter.writeStartElement("td")
+							break;
+						case "lb":
+						case "br":
+							pagedWriter.writeEmptyElement("br")
+							break;
+						case "w":
+							wordid = parser.getAttributeValue(null,"id");
+
+							if (firstWord) {
+								firstWord = false;
+								this.idxstart.add(wordid);
+							}
+							wordcount++;
+
+							break;
+						case "list":
+							String type = parser.getAttributeValue(null,"type");
+							if ("unordered" == type) {
+								unordered = true;
+								pagedWriter.writeStartElement("ul")
+							} else {
+								unordered = false
+								pagedWriter.writeStartElement("ol")
+							}
+							break
+						case "item":
+							pagedWriter.writeStartElement("li")
+							break;
+						case "hi":
+							pagedWriter.writeStartElement("b")
+							break;
+						case "emph":
+							pagedWriter.writeStartElement("i")
+							break;
+						case "ana":
+							flaginterp=true;
+							interpvalue+=" "+parser.getAttributeValue(null,"type").substring(1)+":"
+							break;
+
+						case "form":
+							wordvalue="";
+							interpvalue ="";
+							flagform=true;
+					}
+					break;
+				case XMLStreamConstants.END_ELEMENT:
+					localname = parser.getLocalName();
+					switch(localname)
+					{
+						case "head":
+							pagedWriter.writeEndElement(); // h2
+							break;
+						case "lg":
+						case "p":
+						case "q":
+							pagedWriter.writeEndElement(); // p
+							if (wordcount >= wordmax) {
+								createNextOutput();
+							}
+							break;
+						case "list":
+							pagedWriter.writeEndElement(); // ul or ol
+							break
+						case "item":
+							pagedWriter.writeEndElement(); // li
+							break;
+						case "hi":
+							pagedWriter.writeEndElement(); // b
+							break;
+						case "emph":
+							pagedWriter.writeEndElement(); // i
+							break;
+						case "table":
+							pagedWriter.writeEndElement(); // table
+							break;
+						case "row":
+							pagedWriter.writeEndElement(); // tr
+							break;
+						case "cell":
+							pagedWriter.writeEndElement(); // td
+							break;
+						case "form":
+							flagform = false
+							break;
+						case "ana":
+							flaginterp = false
+							break;
+						case "w":
+							int l = lastword.length();
+							String endOfLastWord = "";
+							if (l > 0)
+								endOfLastWord = lastword.subSequence(l-1, l);
+
+							if (interpvalue != null)
+								interpvalue = interpvalue;
+
+							if (NoSpaceBefore.contains(wordvalue) ||
+								NoSpaceAfter.contains(lastword) ||
+								wordvalue.startsWith("-") ||
+								NoSpaceAfter.contains(endOfLastWord))
+							{
+								// multiwriter.write("<span title=\""+interpvalue+"\" id=\""+wordid+"\">");
+							} else {
+								// multiwriter.write(" <span title=\""+interpvalue+"\" id=\""+wordid+"\">");
+								pagedWriter.writeCharacters(" ");
+							}
+							pagedWriter.writeStartElement("span", ["title":interpvalue, "id":wordid]);
+							pagedWriter.writeCharacters(wordvalue);
+							pagedWriter.writeEndElement() // span
+							lastword=wordvalue;
+							break;
+					}
+					break;
+				case XMLStreamConstants.CHARACTERS:
+					if (flagform)
+						if (parser.getText().length() > 0)
+							wordvalue+=(parser.getText());
+					if (flaginterp)
+						if (parser.getText().length() > 0)
+							interpvalue+=(parser.getText());
+					break;
+			}
+		}
+		//writer.write("</body>");
+		//writer.write("</html>");
+		//writer.close();
+		closeMultiWriter();
+	} catch(Exception e) { org.txm.utils.logger.Log.printStackTrace(e); pagedWriter.close(); }
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/doc/ODTMovePicturesFiles.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/doc/ODTMovePicturesFiles.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/doc/ODTMovePicturesFiles.groovy	(revision 258)
@@ -0,0 +1,15 @@
+package org.txm.importer.doc
+
+File dir = new File("/home/mdecorde/TXM/corpora/temoignages/docfiles/")
+File outdir = new File("/home/mdecorde/TXM/corpora/temoignages/HTML/TEMOIGNAGES/default/Pictures")
+outdir.deleteDir()
+outdir.mkdir()
+
+for(def subdir : dir.listFiles()) {
+	if (subdir.isDirectory()) {
+		File picturesDir = new File(subdir, "Pictures")	
+		for (def img : picturesDir.listFiles()) {
+			img.renameTo(new File(outdir, img.getName()))
+		}
+	}
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/importer/doc/StylesToCSS.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/doc/StylesToCSS.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/doc/StylesToCSS.groovy	(revision 258)
@@ -0,0 +1,194 @@
+package org.txm.importer.doc
+
+class StylesToCSS {
+
+	File cssFile, styleFile, contentFile;
+	def rootStyles, rootContent;
+
+	def styles = [:]
+	def translatedStyles = [:]
+	
+	def beforebreaks = []
+	def afterbreaks = []
+	def parentStyles = [:]
+
+	public StylesToCSS(File unzipDir) {
+		this.styleFile= new File(unzipDir, "styles.xml");
+		this.contentFile= new File(unzipDir, "content.xml");
+		rootStyles = new XmlSlurper().parse(styleFile);
+		rootContent = new XmlSlurper().parse(contentFile);
+	}
+
+	public boolean process(File css) {
+		//println "StylesToCSS: "+css
+		this.cssFile = cssFile;
+		
+		//INDEXING STYLES BY ".NAME_FAMILY"
+		// for each style of styles.xml
+		for( def style : rootStyles.styles.style) {
+			String family = ""+style.@family;
+			String name = ""+style.@name
+			if ("paragraph".equals(family)) {
+				styles[name+"_"+family] = style
+			} else if ("text".equals(family)) {
+				if (!name.startsWith("WW8Num"))
+					styles[name+"_"+family] = style
+			} else if ("graphic".equals(family)) {
+				styles[name+"_"+family] = style
+			}
+		}
+		
+		// for each automatic style of content.xml
+		for( def style : rootContent['automatic-styles'].style) {
+			//println "style: "+style.@name
+			String family = ""+style.@family;
+			String name = ""+style.@name
+			String parent = ""+style['@parent-style-name'] // get parent style name
+			String breakpage = ""; // get soft page break
+			for (def pproperty : style['paragraph-properties']) {
+				//println " paragraph-properties: "+pproperty['@break-before']
+				//println " paragraph-properties: "+pproperty['@break-after']
+				if ("page" == pproperty['@break-before'].toString())
+					beforebreaks << name
+				else if ("page" == pproperty['@break-after'].toString())
+					afterbreaks << name
+			}
+			
+			parentStyles[name] = parent
+			
+			//println "auto $name $family"
+			if ("paragraph".equals(family)) {
+				styles[name+"_"+family] = style
+			} else if ("text".equals(family)) {
+				if (!name.startsWith("WW8Num"))
+					styles[name+"_"+family] = style
+			} else if ("graphic".equals(family)) {
+				styles[name+"_"+family] = style
+			}
+		}
+		
+		// for each default style of styles.xml
+		for( def style : rootStyles.styles['default-style']) {
+			String family = ""+style.@family;
+			String name = ""+style.@name
+			if ("paragraph".equals(family)) {
+				styles[name+"_"+family] = style
+			}
+		}
+		//println styles.keySet()
+		
+		//BUILDING CSS
+		// build styles.xml css
+		for( def style : rootStyles.styles.style) {
+			String name = ""+style.@name
+			if (!name.startsWith("WW8Num")) buildStyle(style);
+		}
+		
+		// for each default style of styles.xml
+		for( def style : rootStyles.styles['default-style']) {
+			String family = ""+style.@family;
+			String name = ""+style.@name
+			if ("paragraph".equals(family)) {
+				buildStyle(style)
+			}
+		}
+		
+		// build content.xml css
+		for( def style : rootContent['automatic-styles'].style) {
+			String name = ""+style.@name
+			if (!name.startsWith("WW8Num")) buildStyle(style);
+		}
+		
+		def writer = css.newPrintWriter("UTF-8")
+		def keys = new ArrayList<String>(translatedStyles.keySet());
+		keys.sort()
+		//println keys
+		for (String name : keys) {
+			if (name.equals("")) {
+				writer.println("body{\n")
+			} else {
+				writer.println(".$name{")
+			}
+			def props = translatedStyles[name]
+			for (def key : props.keySet())
+				writer.println(""+key+":"+props[key]+";")
+			writer.println("}\n")
+		}
+		writer.close()
+
+		return true;
+	}
+	
+	private void buildDefaultStyle(def style) {
+		
+	}
+
+	private void buildStyle (def style) {
+		
+		StringBuffer str = new StringBuffer();
+		String name = style.@name
+		//if (name.length() == 1) name = ".body"
+		if (translatedStyles.containsKey(name)) return
+		def props = [:];
+		
+		String family = ""+style.@family
+		String parentname = style['@parent-style-name']
+		if ( parentname != null && parentname.length() > 0) {
+			String fullparentname = parentname+"_"+family
+			//println "build parent: "+parentname+" for $name"
+			buildStyle(styles[fullparentname]); // build its parent if any
+			def parentprops = translatedStyles[parentname]
+			for (def key : parentprops.keySet())
+				props[key] = parentprops[key]
+		}
+
+		//writer.println(".$name {")
+		for (def property : style['paragraph-properties']) {
+			for (def attr : property.attributes()) {
+				//println attr.getClass()
+				switch (attr.getKey()) {
+					case "text-align": props[attr.getKey()] = attr.getValue(); break;
+					case "margin": props[attr.getKey()] = attr.getValue(); break;
+					case "margin-left": props[attr.getKey()] = attr.getValue(); break;
+					case "margin-right": props[attr.getKey()] = attr.getValue(); break;
+					case "margin-top": props[attr.getKey()] = attr.getValue(); break;
+					case "margin-bottom": props[attr.getKey()] = attr.getValue(); break;
+					case "padding": props[attr.getKey()] = attr.getValue(); break;
+					case "padding-left": props[attr.getKey()] = attr.getValue(); break;
+					case "padding-right": props[attr.getKey()] = attr.getValue(); break;
+					case "padding-top": props[attr.getKey()] = attr.getValue(); break;
+					case "padding-bottom": props[attr.getKey()] = attr.getValue(); break;
+					//case "writing-mode": println(attr); break;
+				}
+			}
+			break;
+		}
+
+		for (def property : style['text-properties']) {
+			//println property.attributes()
+			for (def attr : property.attributes()) {
+				switch (attr.getKey()) {
+					//case "fo:language": println(attr); break;
+					case "font-size": props[attr.getKey()] = attr.getValue(); break;
+					case "font-name": props["font-family"] = "\""+attr.getValue()+"\""; break;
+					case "font-style": props[attr.getKey()] = attr.getValue(); break;
+					case "font-weight": props[attr.getKey()] = attr.getValue(); break;
+					//case "text-position": str.append(""+attr+"\n"); break;
+					case "color": props[attr.getKey()] = attr.getValue(); break;
+				}
+			}
+			break;
+		}
+				
+		translatedStyles[name] = props;
+		//println "builded $name"
+	}
+
+	static main(args) {
+		File unzipDir = new File("/home/mdecorde/xml/txmrefman/TEI/files-Manuel de Référence TXM 0.6_FR.odt.xml")
+		File cssFile = new File("/home/mdecorde/xml/txmrefman/TEI/files-Manuel de Référence TXM 0.6_FR.odt.xml", "style.css")
+
+		StylesToCSS converter = new StylesToCSS(unzipDir);
+		println converter.process(cssFile);
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/ReunitShortLines.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/ReunitShortLines.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/ReunitShortLines.groovy	(revision 258)
@@ -0,0 +1,93 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+package org.txm.importer
+
+import java.io.File;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class ReunitShortLines.
+ */
+class ReunitShortLines {
+	
+	/**
+	 * Instantiates a new reunit short lines.
+	 *
+	 * @param file the file
+	 * @param maxsize the maxsize
+	 * @param encoding the encoding
+	 */
+	ReunitShortLines(File file, int maxsize, String encoding)
+	{
+		File temp = new File( file.getParentFile(), "reu.txt");
+		Reader input = new InputStreamReader(new FileInputStream(file) , encoding);
+		OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(temp) , encoding);
+		
+		String line = input.readLine();
+		boolean oklength = true;
+		boolean previousok = false;
+		while(line != null)
+		{
+			if(line.length() == 0)
+			{
+				writer.write("\n");
+				oklength = true;
+			}
+			else if(line.startsWith("**** "))
+			{
+				writer.write("\n"+line);
+				oklength = true;
+			}
+			else
+			{
+			previousok = oklength;
+			oklength = line.length() > maxsize;
+			
+			if(previousok && oklength)
+				writer.write("\n");
+			
+			writer.write(line);
+			
+			if(previousok && ! oklength)
+				writer.write("\n");
+			
+			}
+			line = input.readLine();
+		}
+	}
+	
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args)
+	{
+		new ReunitShortLines(new File("/home/mdecorde/xml/voeux/Voeux.txt"), 30, "cp1252")
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/XPathResult.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/XPathResult.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/XPathResult.groovy	(revision 258)
@@ -0,0 +1,235 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2016-03-29 09:51:35 +0200 (Tue, 29 Mar 2016) $
+// $LastChangedRevision: 3185 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer;
+
+import org.txm.importer.graal.PersonalNamespaceContext;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Iterator;
+import org.w3c.dom.*;
+import org.xml.sax.SAXException;
+
+import javax.xml.bind.helpers.DefaultValidationEventHandler;
+import javax.xml.parsers.*;
+import javax.xml.xpath.*;
+import javax.xml.stream.*;
+import java.net.URL;
+import java.util.Iterator;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class XPathResult.
+ *
+ * @authors ayepdieu, mdecorde, vchabanis
+ * 
+ * return the id of a bfm tag <milestone/>
+ */
+public class XPathResult {
+	
+	/** The doc. */
+	Document doc;
+	XPath xpath;
+
+	/**
+	 * Instantiates a new x path result.
+	 *
+	 * @param file the file
+	 */
+	public XPathResult(File xmlfile) {
+		this(xmlfile, true)
+	}
+	
+	/**
+	 * Instantiates a new x path result.
+	 *
+	 * @param file the file
+	 */
+	public XPathResult(File xmlfile, boolean namespaceAware) {
+		DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+		factory.setNamespaceAware(namespaceAware); // never forget this!
+		
+		DocumentBuilder builder = factory.newDocumentBuilder();
+		doc = builder.parse(xmlfile);
+		
+		XPathFactory xfactory = XPathFactory.newInstance();
+		xpath = xfactory.newXPath();
+		xpath.setNamespaceContext(new PersonalNamespaceContext());
+	}
+	
+	public def getNodes(String query) {
+		def rnodes = [];
+		
+		XPathExpression expr = xpath.compile(query);
+		Object result = expr.evaluate(doc.getDocumentElement(), XPathConstants.NODESET);
+		
+		NodeList nodes = (NodeList) result;
+		for (int i = 0; i < nodes.getLength(); i++) {
+			rnodes.add(nodes.item(i));
+		}
+		return rnodes;
+	}
+	
+	public String getXpathResponse(String query) {
+		XPathExpression expr = xpath.compile(query);
+		Object result = expr.evaluate(doc.getDocumentElement(), XPathConstants.NODESET);
+		
+		NodeList nodes = (NodeList) result;
+		for (int i = 0; i < nodes.getLength(); i++) {
+			//println nodes.item(i)
+			return (nodes.item(i).getNodeValue());
+		}
+	}
+	
+	public ArrayList<String> getXpathResponses(String query) {
+		ArrayList<String> xresult = new ArrayList<String>();
+		XPathExpression expr = xpath.compile(query);
+		Object result = expr.evaluate(doc.getDocumentElement(), XPathConstants.NODESET);
+		
+		NodeList nodes = (NodeList) result;
+		for (int i = 0; i < nodes.getLength(); i++) {
+			//println nodes.item(i)
+			xresult.add((nodes.item(i).getNodeValue()));
+		}
+		return xresult
+	}
+	
+	public String getXpathResponse(String query, String devaultValue) {
+		String rez = getXpathResponse(query);
+		if (rez == null)
+			return devaultValue;
+		return rez;
+	}
+	
+	public void close() {
+		xpath = null;
+		doc = null;
+	}
+
+	/**
+
+	 * OBSOLETE VERSION FOR TXM return the node text content given a XPath
+
+	 * "//path.../.../@attr"
+	 * 
+	 * @param path
+	 * @param attr
+	 *            null or "" return the text of the tag targeted
+	 * @return
+	 */
+	/*
+	 * public String getXpathResponse(String path, String attr) throws
+	 * ParserConfigurationException, SAXException, IOException,
+	 * XPathExpressionException { String Query = path;
+	 * 
+	 * //println "XPath : "+Query; XPathFactory factory =
+	 * XPathFactory.newInstance(); XPath xpath = factory.newXPath();
+	 * xpath.setNamespaceContext(new PersonalNamespaceContext());
+	 * XPathExpression expr = xpath.compile(Query);
+	 * 
+	 * Object result = expr.evaluate(doc, XPathConstants.NODESET); // don't work
+	 * on windows NodeList nodes = (NodeList) result; //println
+	 * "result xpath : "+nodes.getLength(); for(int i = 0 ; i <
+	 * nodes.getLength() ; i++) { //println
+	 * "item : "+nodes.item(i).getLocalName(); if(attr != null &&
+	 * !attr.equals("")) return
+	 * nodes.item(i).getAttributes().getNamedItem(attr).getNodeValue(); else
+	 * return nodes.item(i).getTextContent();
+	 * 
+	 * } return ""; }
+	 */
+	
+	static public String getXpathResponse(File xmlfile, String query, String devaultValue) {
+		String rez = getXpathResponse(xmlfile, query);
+		if (rez == null)
+			return devaultValue;
+		return rez;
+	}
+	
+	static public String getXpathResponse(File xmlfile, String query, String devaultValue, boolean namespaceAware) {
+		String rez = getXpathResponse(xmlfile, query, namespaceAware);
+		if (rez == null)
+			return devaultValue;
+		return rez;
+	}
+
+	/**
+	 * Gets the xpath response.
+	 *
+	 * @param xmlfile the xmlfile
+	 * @param query the query
+	 * @return the xpath response
+	 */
+	static public String getXpathResponse(File xmlfile, String query) {
+		return getXpathResponse(xmlfile, query, true);
+	}
+	
+	/**
+	 * Gets the xpath response.
+	 *
+	 * @param xmlfile the xmlfile
+	 * @param query the query
+	 * @return the xpath response
+	 */
+	static public String getXpathResponse(File xmlfile, String query, boolean namespaceAware) {
+		XPathResult result = new XPathResult(xmlfile);
+		return result.getXpathResponse(query);
+//		DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+//		factory.setNamespaceAware(namespaceAware); // never forget this!
+//		
+//		DocumentBuilder builder = factory.newDocumentBuilder();
+//		Document doc = builder.parse(xmlfile);
+//		
+//		XPathFactory xfactory = XPathFactory.newInstance();
+//		XPath xpath = xfactory.newXPath();
+//		xpath.setNamespaceContext(new PersonalNamespaceContext());
+//		
+//		XPathExpression expr = xpath.compile(query);
+//		Object result = expr.evaluate(doc, XPathConstants.NODESET);
+//		
+//		NodeList nodes = (NodeList) result;
+//		println "size: "+result.getLength()
+//		for (int i = 0; i < nodes.getLength(); i++) {
+//			return (nodes.item(i).getNodeValue());
+//		}
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args) {
+		println("main of XPathResult")
+		File xmlFile = new File("/home/mdecorde/TXM/corpora/superphenix/txm/SUPERPHENIX/CreysSuper_04_0175.xml")
+		String value = XPathResult.getXpathResponse(xmlFile, "TEI/text/@date");
+		println "value: $value"
+		//value = XPathResult.getXpathResponse(new File("/home/mdecorde/xml/bfm/strasb.xml"), "tei:TEI/tei:teiHeader/tei:revisionDesc/tei:change[contains(.,'étiquetage morpho')]");
+		//println "value: $value"
+	}
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/importer/HTMLIndexer.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/HTMLIndexer.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/HTMLIndexer.groovy	(revision 258)
@@ -0,0 +1,170 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+package org.txm.importer
+
+import java.util.Collections;
+import java.io.File;
+
+import org.txm.utils.*;
+import org.txm.utils.io.FileCopy;
+
+import java.util.HashMap;
+import java.util.ArrayList;
+import java.io.File;
+
+import javax.xml.stream.*;
+
+import java.net.URL;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class HTMLIndexer.
+ */
+class HTMLIndexer {
+	
+	/** The idxprefix. */
+	static String idxprefix = "IDX-";
+	
+	/** The index. */
+	HashMap<String, ArrayList<String>> index = new HashMap<String, ArrayList<String>>();
+	
+	/**
+	 * Process html dir.
+	 *
+	 * @param htmlDirectory the html directory
+	 * @return true, if successful
+	 */
+	private boolean processHTMLDir(File htmlDirectory)
+	{
+		ArrayList<File> htmlfiles = DeleteDir.scanDirectory(htmlDirectory, true)
+		Collections.sort(htmlfiles);
+		
+		for(File htmlFile : htmlfiles)//get all indexes
+		{
+			if(htmlFile.getName().endsWith(".html"))
+				processHTMLFile(htmlFile);
+		}
+		
+		ArrayList<String> tokens = new ArrayList<String>(index.keySet());
+		Collections.sort(tokens);
+		
+		//fix doubles like étiquette&étiquettes
+		for(int i = 0 ; i < tokens.size() ; i++)
+		{
+			String t1 = tokens.get(i);
+			String t2 = tokens.get(i+1);
+			if(t1.equals(t2.substring(0, t2.length() -1)))
+			{
+				tokens.remove(i+1);
+				index.get(t1).addAll(index.get(t2));
+				//i--;
+			}
+		}
+		
+		tokens = new ArrayList<String>(index.keySet());
+		for(String token : tokens)
+		{
+			println("Token: "+token);
+			println(index.get(token));
+		}
+	}
+	
+	/**
+	 * Process html file.
+	 *
+	 * @param htmlFile the html file
+	 * @return true, if successful
+	 */
+	private boolean processHTMLFile(File htmlFile)
+	{
+		
+		
+		String lasttoken;
+		String page;
+		
+		try
+		{
+			URL url = htmlFile.toURI().toURL();
+			println "process html file "+url;
+			def inputData = url.openStream();
+			def factory = XMLInputFactory.newInstance();
+			//factory.setXMLResolver resolver
+			//factory.setProperty(factory.IS_VALIDATING, false)
+			factory.setProperty("javax.xml.stream.supportDTD", false);
+			factory.setProperty("javax.xml.stream.isReplacingEntityReferences", false);
+			
+			XMLStreamReader parser = factory.createXMLStreamReader(inputData);
+			for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) 
+			{
+				//println "parse"
+				switch (event) 
+				{
+					case XMLStreamConstants.START_ELEMENT:
+						//println "elem "+parser.getLocalName()
+						if(parser.getLocalName() == "div")
+							if(parser.getAttributeValue(null, "id") != null && parser.getAttributeValue(null, "id").startsWith("index-body"))
+								page = parser.getAttributeValue(null, "id")
+								
+						String id = parser.getAttributeValue(null, "id");
+						if(id != null && id.startsWith(idxprefix))
+						{
+							if(!index.containsKey(lasttoken))
+								index.put(lasttoken, new ArrayList<String>());
+							index.get(lasttoken).add(htmlFile.getName()+"#"+id)
+						}
+					
+						break;
+					
+					case XMLStreamConstants.CHARACTERS:
+						String text = parser.getText().trim();
+						if(text.length() > 0)
+						{
+							def texts = text.split(" ");
+							lasttoken = texts[texts.size()-1];
+							if(lasttoken.endsWith("."))
+								lasttoken = lasttoken.substring(0, lasttoken.length() -1)
+						}
+				}
+			}
+			
+		}
+		catch(Exception e){println("File "+htmlFile+"\n"+e); return false;}
+		return true;
+	}
+	
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args)
+	{
+		File htmlDirectory = new File("/home/mdecorde/xml/html")
+		new HTMLIndexer().processHTMLDir(htmlDirectory);
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/Hyperbase2Xml.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/Hyperbase2Xml.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/Hyperbase2Xml.groovy	(revision 258)
@@ -0,0 +1,185 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2016-12-16 17:28:35 +0100 (Fri, 16 Dec 2016) $
+// $LastChangedRevision: 3377 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer
+
+import org.txm.utils.CharsetDetector
+import org.txm.utils.i18n.DetectBOM;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStreamReader;
+
+import javax.xml.stream.*;
+import java.net.URL;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Create a xml file per text declared in a Hyperbase file (old format).
+ *
+ * @author mdecorde
+ */
+class Hyperbase2Xml {
+	
+	/**
+	 * Run.
+	 *
+	 * @param infile the hyperbase file (old format)
+	 * @param outdir where the xml files are created
+	 * @param encoding the encoding of the hyperbase file
+	 * @return true, if successful
+	 */
+	public boolean run(File infile, File outdir, String encoding)
+	{
+		if (encoding == "??") {
+			encoding = new CharsetDetector(infile).getEncoding();
+			println "Guessing encoding of $infile : $encoding"
+		}
+		outdir.mkdir();
+		
+		String textname = null
+		String partname = null;
+		int textcount = 1;
+		def input = new FileInputStream(infile)
+		Reader reader = new InputStreamReader(input , encoding);
+		DetectBOM bomdetector = new DetectBOM(infile);
+		for (int ibom = 0 ; ibom < bomdetector.getBOMSize() ; ibom++) input.read()
+		
+		XMLOutputFactory factory = X	MLOutputFactory.newInstance();
+		BufferedOutputStream output = null;
+		XMLStreamWriter writer = null;
+		
+		boolean firsttext=true;
+		
+		String line = reader.readLine();
+		while(line != null)
+		{
+			line = CleanFile.clean(line);
+			if((line.startsWith("&&&"))) // text declaration &&& longtitle, title, shorttitle &&&
+			{
+				if(partname != null) // close previous part
+				{
+					//println("close last part")
+					writer.writeEndElement();
+					partname= null;
+				}
+				if(textname != null) // close previous text
+				{
+					//println("close text "+textname)
+					writer.writeEndElement();
+					writer.close();
+					output.close();
+				}
+				textname = line.substring(3, line.length()-3);
+				if(textname.contains(","))
+				{
+					String[] textnames = textname.split(",");
+					if(textnames.length > 1)
+						textname = textnames[1].trim();
+					
+				}
+				// create a new text
+				output = new BufferedOutputStream(new FileOutputStream(new File(outdir,textname+".xml")))
+				writer = factory.createXMLStreamWriter(output, "UTF-8");
+				writer.writeStartElement("text");
+				writer.writeAttribute("id",textname);
+				println "text : "+new File(outdir,textname+".xml");
+			}
+			else if((line.startsWith("%%%%"))) // an other type of text declaration
+			{
+				if(partname != null)
+				{
+					//println("close last part")
+					writer.writeEndElement();
+					partname= null;
+				}
+				if(textname != null)
+				{
+					//println("close text "+textname)
+					writer.writeEndElement();
+					writer.close();
+					output.close();
+				}
+				textname = infile.getName().substring(0, infile.getName().length()-4)+(textcount++);
+				output =  new BufferedOutputStream(new FileOutputStream(new File(outdir,textname+".xml")))
+				writer = factory.createXMLStreamWriter(output, "UTF-8");
+				writer.writeStartElement("text");
+				writer.writeAttribute("id",textname);
+				println "text : "+new File(outdir,textname+".xml");
+			}
+			else if((line.startsWith("\$"))) // paragraph declaration
+			{
+				if(partname != null)
+				{
+					//println("close part "+partname)
+					writer.writeEndElement();
+				}
+				partname = line.substring(1);
+				
+				writer.writeStartElement("p");
+				writer.writeAttribute("id",partname);
+			}
+			else // brut text > write chars
+			{
+				if(writer != null)
+					writer.writeCharacters(line+"\n");
+			}
+			line = reader.readLine();
+		}
+		
+		if(partname != null)
+		{
+			//println("close last part")
+			writer.writeEndElement();
+		}
+		if(writer != null)
+			writer.writeEndElement();
+		
+		reader.close();
+		if(output != null)
+			output.close();
+		
+		return true;
+	}
+	
+	/**
+	 * Main.
+	 *
+	 * @param args the args
+	 */
+	static main(args) 
+	{
+		File infile = new File(System.getProperty("user.home")+"/xml/presdiscfra/src/PresDiscFranc");
+		File outfile = new File(System.getProperty("user.home")+"/xml/presdiscfra/split/");
+		new Hyperbase2Xml().run(infile, outfile,"ISO-8859-1");
+		println "done"
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/ImportXmlTag.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/ImportXmlTag.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/ImportXmlTag.groovy	(revision 258)
@@ -0,0 +1,216 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2017-01-24 18:11:42 +0100 (Tue, 24 Jan 2017) $
+// $LastChangedRevision: 3400 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer;
+
+import java.text.DateFormat;
+import java.util.Date;
+import java.util.ArrayList;
+import java.util.LinkedList;
+import javax.xml.stream.*;
+import java.net.URL;
+import org.txm.importer.filters.*;
+import org.txm.importer.cwb.CwbEncode
+import org.txm.importer.cwb.CwbMakeAll
+// TODO: Auto-generated Javadoc
+
+/**
+ * The Class ImportXmlTag.
+ *
+ * @author mdecorde
+ */
+public class ImportXmlTag {
+	
+	/** The url. */
+	private def url;
+	
+	/** The input data. */
+	private def inputData;
+	
+	/** The factory. */
+	private def factory;
+	
+	/** The parser. */
+	private XMLStreamReader parser;
+	
+	/** The output. */
+	private def output;
+	
+	/**
+	 * Instantiates a new import xml tag.
+	 *
+	 * @param url the url
+	 */
+	public ImportXmlTag(URL url){
+		try {
+			this.url = url;
+			inputData = url.openStream();
+			factory = XMLInputFactory.newInstance();
+			parser = factory.createXMLStreamReader(inputData);
+			
+		} catch (XMLStreamException ex) {
+			System.out.println(ex);
+		}catch (IOException ex) {
+			System.out.println("IOException while parsing ");
+		}
+	}
+	
+	/**
+	 * Creates the output.
+	 *
+	 * @param outfile the outfile
+	 * @return true, if successful
+	 */
+	private boolean createOutput(File outfile){
+		try {
+			File f = outfile;
+			output = new OutputStreamWriter(new FileOutputStream(f) , "UTF-8");
+			
+			return true;
+		} catch (Exception e) {
+			System.out.println(e.getLocalizedMessage());
+			return false;
+		}
+	}
+	
+	/** The maxprof. */
+	int maxprof = 0;
+	
+	/**
+	 * Process.
+	 *
+	 * @param outfile the outfile
+	 * @return true, if successful
+	 */
+	public boolean process(File outfile){
+		LinkedList<Integer> writechilds = new LinkedList<Integer>();
+		writechilds.add(0);
+		String prof = "";
+		int wordid =0
+		
+		def children = 0;
+		if(createOutput(outfile)){
+			
+			String localname = "";
+			try {
+				for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+					
+					String prefix = parser.getPrefix();
+					if(prefix == null || prefix == "")
+						prefix = "none";
+					
+					switch (event) {
+					
+						case XMLStreamConstants.START_ELEMENT:
+							localname = parser.getLocalName();
+							if (writechilds.getLast() == 0) {
+								children++;
+								output.write(prof+"<children n="+children+">\n");
+							}
+							
+							int cpt = writechilds.pop();
+							cpt++;
+							writechilds.add(cpt);
+
+							prof+=" ";
+							maxprof = Math.max(maxprof,prof.length());
+							output.write(prof+localname+"\t"+(wordid++)+"\t"+prefix+"\t"+prof.length()+"\t"+parser.getAttributeCount()+"\n");
+
+							writechilds.add(0);
+							break;	
+						
+						case XMLStreamConstants.END_ELEMENT:
+							localname = parser.getLocalName();
+							if (writechilds.getLast() > 0) {
+								output.write(prof+"</children>\n");
+							}
+							writechilds.removeLast();
+							prof = prof.subSequence(0, prof.length() -1);
+
+							break;
+						
+						case XMLStreamConstants.CHARACTERS:		
+							break;
+					}
+				}
+				output.write(prof+"</children>\n");
+				output.close();
+				parser.close();
+			}
+			catch (XMLStreamException ex) {
+				System.out.println(ex);
+			}
+			catch (IOException ex) {
+				System.out.println("IOException while parsing " + inputData);
+			}
+		}
+	}
+	
+	
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args) {
+		
+		String rootDir = "~/xml/rgaqcj/";
+		new File(rootDir+"/wtc/").mkdir();
+		new File(rootDir,"/registry/").mkdir();
+		
+		File srcfile = new File(rootDir+"/src/","roland.xml");
+		File resultfile = new File(rootDir+"/wtc/","roland-xmltag.wtc");
+		println("importXmlTag : "+srcfile+" to : "+resultfile );
+		
+		def builder = new ImportXmlTag(srcfile.toURL());
+		builder.process(resultfile);
+		
+		def cwbLoc ="~/Bureau/textometrie/CWB/cwb-3.0/utils/";//chemin vers executable cqp
+		
+		def inDir = rootDir;
+		def outDir =rootDir+"wtc/";
+		def outDirTxm = rootDir;
+		CwbEncode cwbEn = new CwbEncode();
+		CwbMakeAll cwbMa = new CwbMakeAll();
+		
+		String[] pAttributes = ["id","prefix","prof","nbattr"];
+		String[] sAttributes = ["children:"+builder.maxprof+"+n"];
+		
+		try {
+			if (System.getProperty("os.name").contains("Windows")) {
+				cwbEn.run(cwbLoc + "cwb-encode.exe", outDirTxm + "data/"+"ROLANDXML", outDir +"roland-xmltag.wtc", outDirTxm + "registry/"+"rolandxml",pAttributes, sAttributes);
+				cwbMa.run(cwbLoc + "cwb-makeall.exe", "ROLANDXML", outDirTxm + "registry");
+			} else {
+				cwbEn.run(cwbLoc + "cwb-encode", outDirTxm + "data/"+"ROLANDXML", outDir +"roland-xmltag.wtc", outDirTxm + "registry/"+"rolandxml",pAttributes, sAttributes);
+				cwbMa.run(cwbLoc + "cwb-makeall", "ROLANDXML", outDirTxm + "registry");
+			}
+		} catch (Exception ex) {System.out.println(ex);}
+		
+		return;
+	}
+}
+
Index: tmp/org.txm.core/src/groovy/org/txm/importer/quick/importer.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/quick/importer.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/quick/importer.groovy	(revision 258)
@@ -0,0 +1,291 @@
+// 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
+// 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.
+//
+//
+//
+// $LastChangedDate: 2016-12-16 17:28:35 +0100 (Fri, 16 Dec 2016) $
+// $LastChangedRevision: 3377 $
+// $LastChangedBy: mdecorde $
+//
+package org.txm.importer.quick
+
+import javax.xml.stream.*
+
+import org.txm.*
+import org.txm.importer.*
+import org.txm.importer.filters.*
+import org.txm.scripts.*
+import org.txm.scripts.teitxm.*
+import org.txm.utils.*
+import org.txm.utils.i18n.DetectBOM
+
+import filters.CutHeader.*
+import filters.FusionHeader.*
+import filters.TagSentences.*
+import filters.Tokeniser.*
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class importer.
+ */
+class importer {
+
+	/**
+	 * Run.
+	 *
+	 * @param rootfile the rootfile
+	 * @param encoding the encoding
+	 * @param suffixes the suffixes
+	 * @param basename the basename
+	 * @return true, if successful
+	 */
+	public static boolean run(File srcDir, File binDir, File txmDir, String encoding, List<String> suffixes, String basename, String lang)
+	{
+		//String rootDir = srcDir.getAbsolutePath();// ./xml/quick
+
+		File ptokenizedDir = new File(binDir,"ptokenized");
+		ptokenizedDir.deleteDir();
+		ptokenizedDir.mkdir();
+		File tokenizedDir = new File(binDir,"tokenized");
+		tokenizedDir.deleteDir();
+		tokenizedDir.mkdir();
+
+		List<File> files = null;
+
+		ArrayList<String> milestones = new ArrayList<String>();//the tags who stay milestones
+		milestones.add("tagUsage");
+		milestones.add("pb");
+		milestones.add("lb");
+
+		// Build the list of src files
+		List<File> srcfiles = DeleteDir.scanDirectory(srcDir, true)
+		for (int i = 0; i < srcfiles.size(); i++) {
+			File srcfile = srcfiles.get(i);
+			int point = srcfile.getName().indexOf(".");
+			String filename, fileext;
+			if (point >= 1 && point < srcfile.getName().length()) {
+				filename = srcfile.getName().substring(0, point)
+				fileext = srcfile.getName().substring(point+1, srcfile.getName().length());
+			} else {
+				filename = srcfile.getName()
+				fileext = "";
+			}
+
+			if (!suffixes.contains(fileext)) {
+				srcfiles.remove(i);
+				i--;
+			}
+		}
+		
+		if (srcfiles != null && srcfiles.size() == 0) {
+			println "No 'txt' file to process in directory $srcDir"
+			return false;
+		}
+
+		//CREATE SIMPLE XML FILE
+		HashSet<String> existingfiles = new HashSet<String>();
+		String currentpath = srcDir.getAbsolutePath()
+
+		String encodingAll = null;
+		if (encoding == "??") {
+			encodingAll = new CharsetDetector(srcDir).getEncoding();
+			println "Guessed encoding: $encodingAll"
+		}
+
+		println("Create simple XML files ("+srcfiles.size()+" files)")
+		for (File srcfile : srcfiles) {
+			print "."
+			File xmlfile;
+			try {
+				int point = srcfile.getName().indexOf(".");
+				String filename;
+				String fileext;
+				if (point >= 1 && point < srcfile.getName().length() ) {
+					filename = srcfile.getName().substring(0, point)
+					fileext = srcfile.getName().substring(point+1, srcfile.getName().length());
+				} else {
+					filename = srcfile.getName()
+					fileext = "";
+				}
+
+				String filepath = srcfile.getParentFile().getAbsolutePath();
+				filepath = filepath.substring(currentpath.length());
+				xmlfile = new File(txmDir, filename+".xml");
+
+				while (existingfiles.contains(xmlfile.getName()))//to not erase a file with the same name
+				{
+					xmlfile = new File(txmDir, "_"+xmlfile.getName());
+				}
+				existingfiles.add(xmlfile.getName());
+
+				//println "ENCODING "+encoding
+				String tmpEncoding = encoding;
+				if (encodingAll != null) {
+					tmpEncoding = encodingAll
+					if (srcfile.length() > CharsetDetector.MINIMALSIZE) {
+						tmpEncoding = new CharsetDetector(srcfile).getEncoding();
+						//println "file encoding: $tmpEncoding"
+					}
+				}
+				def input = new FileInputStream(srcfile)
+				Reader reader = new InputStreamReader(input , tmpEncoding);
+				DetectBOM bomdetector = new DetectBOM(srcfile);
+				for (int ibom = 0 ; ibom < bomdetector.getBOMSize() ; ibom++) input.read()
+
+				int lb = 1;
+				int np = 1;
+				int countlb = 0;
+
+				BufferedOutputStream output = new BufferedOutputStream(new FileOutputStream(xmlfile))
+				XMLOutputFactory factory = XMLOutputFactory.newInstance();
+				XMLStreamWriter writer = factory.createXMLStreamWriter(output, "UTF-8");
+
+				writer.writeStartDocument("UTF-8","1.0");
+				writer.writeStartElement ("TEI");
+				writer.writeDefaultNamespace("http://www.tei-c.org/ns/1.0");
+				writer.writeNamespace("txm", "http://textometrie.org/1.0");
+				writer.writeStartElement ("teiHeader");
+				writer.writeStartElement("fileDesc");
+				writer.writeStartElement("titleStmt");
+				writer.writeStartElement("title")
+				writer.writeCharacters(xmlfile.getName())
+				writer.writeEndElement(); // title
+				writer.writeEndElement(); //titleStmt
+				writer.writeStartElement("publicationStmt");
+				writer.writeEndElement(); // publicationStmt
+				writer.writeStartElement("sourceDesc");
+				writer.writeStartElement("p");
+				writer.writeCharacters("Generated by TXM TXT+CSV import module - TXM project - http://textometrie.org");
+				writer.writeEndElement(); // p
+				writer.writeEndElement(); // sourceDesc
+				writer.writeEndElement(); // fileDesc
+				writer.writeStartElement("encodingDesc")
+				writer.writeStartElement("http://textometrie.org/1.0", "applicationDesc")
+				writer.writeEndElement();
+				writer.writeEndElement();
+				writer.writeEndElement (); // teiHeader
+				writer.writeStartElement ("text");
+				writer.writeAttribute("id",filename)
+
+				reader.eachLine{String line ->
+					line = CleanFile.clean(line);
+					
+					//writer.writeStartElement("p");
+					//writer.writeAttribute("id",""+np++)
+					line = FixString.normalize(line);
+					writer.writeStartElement("lb")
+					writer.writeAttribute("n",""+lb++)
+					writer.writeEndElement(); // close lb
+					writer.writeCharacters(line.replace("\t"," "))
+					//writer.writeEndElement(); // p
+					writer.writeCharacters("\n"); // XML readability
+					//}
+				}
+
+				writer.writeEndElement();//text
+				writer.writeEndElement();// TEI
+				
+				writer.close();
+				output.close();
+			}
+			catch(Exception e) {
+				println("Failed to process file "+srcfile);
+				xmlfile.delete()
+			}
+		}
+		println ""
+
+		println("Tokenizing "+txmDir.listFiles().length+" files")
+		for (File pfile : txmDir.listFiles()) {
+			print "."
+			File tfile = new File(tokenizedDir, pfile.getName());
+
+			SimpleTokenizerXml tokenizer = new SimpleTokenizerXml(pfile, tfile, lang);
+			tokenizer.setStartTag("text")
+			if (!tokenizer.process()) {
+				println("Failed to tokenize file "+pfile)
+				tfile.delete()
+			}
+		}
+		println ""
+		
+		// Tag sentences
+		List<File> stokenfiles = tokenizedDir.listFiles()
+		File stokenizeDir = new File(tokenizedDir.getParentFile(), "stokenized")
+		stokenizeDir.mkdir();
+		println("Tagging sentences of "+stokenfiles.size()+" files")
+		for (File f : stokenfiles) {
+			print "."
+			Sequence S = new Sequence();
+			Filter F1 = new CutHeader();
+			Filter F7 = new TagSentences();
+			Filter F11 = new FusionHeader();
+			S.add(F1);
+			S.add(F7);
+			S.add(F11);
+			File infile = new File(tokenizedDir, f.getName());
+			File xmlfile = new File(stokenizeDir, f.getName());
+			File headerfile = new File(tokenizedDir, f.getName()+"header.xml");
+
+			S.SetInFileAndOutFile(infile.getPath(), xmlfile.getPath());
+			S.setEncodages("UTF-8","UTF-8");
+			Object[] arguments1 = [headerfile.getAbsolutePath()];
+			F1.SetUsedParam(arguments1);
+			Object[] arguments2 = [headerfile.getAbsolutePath(), F1];
+			F11.SetUsedParam(arguments2);
+			if (!S.proceed()) {
+				println "Failed to tag file: "+f
+			}
+			
+			S.clean();
+			S = F1 = F7 = F11 = null;
+			headerfile.delete();//remove the prepared file to clean
+		}
+		println ""
+
+		//TRANSFORM INTO XML-TEI-TXM
+		println("Building xml-tei-txm ("+stokenizeDir.listFiles().length+" files)")
+		for (File tfile : stokenizeDir.listFiles()) {
+			print  "."
+			File xmlfile = new File(txmDir, tfile.getName());
+
+			def correspType = new HashMap<String,String>()
+			def correspRef = new HashMap<String,String>()
+			def respId = [];
+			def applications = new HashMap<String,HashMap<String,String>>();
+			def taxonomiesUtilisees = new HashMap<String,String[]>();
+			def itemsURI = new HashMap<String,HashMap<String,String>>();
+			def resps = new HashMap<String,String[]>();
+
+			//println "file : $tfile"
+			Xml2Ana builder = new Xml2Ana(tfile);
+			builder.setCorrespondances(correspRef, correspType);
+			builder.setHeaderInfos(respId,resps, applications, taxonomiesUtilisees, itemsURI)
+			if (!builder.process(xmlfile)) {
+				println("Failed to process file "+tfile)
+				new File(xmlfile.getParent(),xmlfile.getName()).delete()
+			}
+		}
+		println ""
+
+		return true;
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/quick/quickLoader.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/quick/quickLoader.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/quick/quickLoader.groovy	(revision 258)
@@ -0,0 +1,195 @@
+// 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
+// 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.
+//
+//
+//
+// $LastChangedDate: 2016-05-11 08:38:47 +0200 (Wed, 11 May 2016) $
+// $LastChangedRevision: 3211 $
+// $LastChangedBy: mdecorde $
+//
+package org.txm.importer.quick;
+
+import org.txm.*
+import org.txm.importer.xml.pager
+import org.txm.metadatas.*
+import org.txm.objects.*
+import org.txm.scripts.teitxm.*
+import org.txm.utils.i18n.*
+import org.txm.utils.io.FileCopy;
+import org.w3c.dom.Element
+
+String userDir = System.getProperty("user.home");
+boolean debug = org.txm.utils.logger.Log.isPrintingErrors();
+def MONITOR;
+BaseParameters params;
+try {params = paramsBinding;MONITOR=monitor} catch (Exception)
+{	println "DEV MODE";//exception means we debug
+	debug = true
+	params = new BaseParameters(new File(userDir, "TXM/clipboard/clipboard2/import.xml"))
+	params.load()
+	if (!org.txm.Toolbox.isInitialized()) {
+		Toolbox.setParam(Toolbox.INSTALL_DIR,new File("C:/Program Files/TXM"));
+		Toolbox.setParam(Toolbox.TREETAGGER_INSTALL_PATH, new File("C:/Program Files/TreeTagger"));
+		Toolbox.setParam(Toolbox.TREETAGGER_MODELS_PATH, new File("C:/Users/mdecorde/TXM/treetagger"));
+		Toolbox.setParam(Toolbox.METADATA_ENCODING, "UTF-8");
+		Toolbox.setParam(Toolbox.METADATA_COLSEPARATOR, ",");
+		Toolbox.setParam(Toolbox.METADATA_TXTSEPARATOR, "\"");
+		Toolbox.setParam(Toolbox.USER_TXM_HOME, new File(userDir, "TXM"));
+	}
+}
+if (params == null) { println "No parameters file. Aborting"; return;}
+
+String corpusname = params.getCorpusName();
+Element corpusElem = params.corpora.get(corpusname);
+String basename = params.name;
+String rootDir = params.rootDir;
+String lang = corpusElem.getAttribute("lang");
+String model = lang
+String encoding = corpusElem.getAttribute("encoding");
+boolean annotate = "true" == corpusElem.getAttribute("annotate");
+String xsl = params.getXsltElement(corpusElem).getAttribute("xsl")
+def xslParams = params.getXsltParams(corpusElem);
+int wordsPerPage = params.getWordsPerPage("default")
+boolean build_edition = params.getDoEdition("default")
+
+File srcDir = new File(rootDir);
+File binDir = new File(Toolbox.getParam(Toolbox.USER_TXM_HOME), "corpora/"+basename);
+binDir.deleteDir();
+binDir.mkdirs();
+if (!binDir.exists()) {
+	println "Could not create binDir "+binDir
+	return;
+}
+
+File txmDir = new File(binDir, "txm/$corpusname");
+txmDir.deleteDir();
+txmDir.mkdirs();
+
+//get metadata values from CSV
+Metadatas metadatas; // text metadata
+File allmetadatasfile = new File(srcDir, "metadata.csv");
+
+if (allmetadatasfile.exists()) {
+	println "Trying to read metadata from: "+allmetadatasfile
+	File copy = new File(binDir, "metadata.csv")
+	if (!FileCopy.copy(allmetadatasfile, copy)) {
+		println "Error: could not create a copy of metadata file "+allmetadatasfile.getAbsoluteFile();
+		return;
+	}
+	metadatas = new Metadatas(copy, Toolbox.getParam(Toolbox.METADATA_ENCODING), Toolbox.getParam(Toolbox.METADATA_COLSEPARATOR), Toolbox.getParam(Toolbox.METADATA_TXTSEPARATOR), 1)
+} else {
+	println "No metadata file: "+allmetadatasfile
+}
+
+def suffixes = ["txt", "TXT"]
+println "-- IMPORTER - Reading source files with extension "+suffixes
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+if (MONITOR != null) MONITOR.worked(20, "IMPORTER - Reading source files with extension "+suffixes)
+if (!new importer().run(srcDir, binDir, txmDir,encoding, suffixes, basename, lang)) {
+	println "Import process stopped";
+	return;
+}
+
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+if (MONITOR != null) MONITOR.worked(20, "INJECTING METADATA - from csv file: "+allmetadatasfile)
+if (metadatas != null) {
+	println "-- INJECTING METADATA - from csv file: "+allmetadatasfile
+	println("Injecting metadata: "+metadatas.getHeadersList()+" in texts of directory "+txmDir)
+	for (File infile : txmDir.listFiles()) {
+		print "."
+		File outfile = File.createTempFile("temp", ".xml", infile.getParentFile());
+
+		if (!metadatas.injectMetadatasInXml(infile, outfile, "text", null)) {
+			outfile.delete();
+		} else {
+			if (!(infile.delete() && outfile.renameTo(infile))) println "Warning can't rename file "+outfile+" to "+infile
+			if (!infile.exists()) {
+				println "Error: could not replace $infile by $outfile"
+				return false;
+			}
+		}
+	}
+	println ""
+}
+
+println "-- ANNOTATE - Running NLP tools"
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+if (MONITOR != null) MONITOR.worked(20, "ANNOTATE - Running NLP tools")
+boolean annotationSuccess = true;
+if (annotate && !new Annotate().run(binDir, txmDir, model+".par")) {
+	annotationSuccess = false;
+}
+
+println "-- COMPILING - Building Search Engine indexes"
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+if (MONITOR != null) MONITOR.worked(20, "COMPILING - Building Search Engine indexes")
+def c = new compiler(null, "", corpusname, "default");
+//c.setCwbPath(userDir+"/TXM/cwb/bin/")// for developers
+if (metadatas != null)
+	c.setMetadataAttributes(metadatas.getSattributes())
+c.setLang(lang);
+c.setAnnotationSuccess(annotationSuccess)
+if (debug) c.setDebug();
+if (!c.run(binDir, txmDir, corpusname)) {
+	println "Import process stopped";
+	return;
+}
+//println "basename :"+basename;
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+new File(binDir,"HTML/$corpusname").deleteDir();
+new File(binDir,"HTML/$corpusname").mkdirs();
+if (build_edition) {
+
+	println "-- EDITION - Building edition"
+	if (MONITOR != null) MONITOR.worked(20, "EDITION - Building edition")
+	
+	File outdir = new File(binDir, "HTML/$corpusname/default/");
+	outdir.mkdirs();
+	List<File> filelist = txmDir.listFiles();
+	Collections.sort(filelist);
+	def second = 0
+
+
+	for (File srcfile : filelist) {
+		print "."
+		String txtname = srcfile.getName();
+		int i = txtname.lastIndexOf(".");
+		if (i > 0) txtname = txtname.substring(0, i);
+
+		List<String> NoSpaceBefore = LangFormater.getNoSpaceBefore(lang);
+		List<String> NoSpaceAfter = LangFormater.getNoSpaceAfter(lang);
+
+		Element text = params.addText(params.corpora.get(corpusname), txtname, srcfile);
+
+		def ed = new pager(srcfile, outdir, txtname, NoSpaceBefore, NoSpaceAfter, wordsPerPage, basename, null);
+		Element edition = params.addEdition(text, "default", outdir.getAbsolutePath(), "html");
+
+		for (i = 0 ; i < ed.getPageFiles().size();) {
+			File f = ed.getPageFiles().get(i);
+			String wordid = ed.getIdx().get(i);
+			params.addPage(edition, ""+(++i), wordid);
+		}
+	}
+}
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+if (MONITOR != null) MONITOR.worked(20, "FINALIZING")
+File paramFile = new File(binDir, "import.xml");
+DomUtils.save(params.root.getOwnerDocument(), paramFile);readyToLoad = true;
Index: tmp/org.txm.core/src/groovy/org/txm/importer/quick/compiler.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/quick/compiler.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/quick/compiler.groovy	(revision 258)
@@ -0,0 +1,288 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2017-01-24 18:11:42 +0100 (Tue, 24 Jan 2017) $
+// $LastChangedRevision: 3400 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer.quick
+
+import org.txm.Toolbox;
+import org.txm.importer.cwb.CwbEncode
+import org.txm.importer.cwb.CwbMakeAll
+import org.txm.importer.cwb.PatchCwbRegistry;
+import org.txm.importer.*;
+import org.txm.scripts.*;
+import org.txm.scripts.teitxm.BuildTTSrc;
+import org.txm.scripts.teitxm.*;
+import org.txm.utils.treetagger.TreeTagger;
+
+import javax.xml.stream.*;
+import java.net.URL;
+import java.io.File;
+import java.util.HashMap;
+import java.util.List;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class compiler.
+ */
+class compiler {
+	
+	/** The debug. */
+	boolean debug = false;
+	
+	/** The input data. */
+	private def inputData;
+	
+	/** The factory. */
+	private def factory;
+	
+	/** The parser. */
+	private XMLStreamReader parser;
+	
+	/** The dir. */
+	private def dir;
+	
+	/** The output. */
+	private def output;
+	
+	/** The url. */
+	private def url;
+	
+	/** The anahash. */
+	private HashMap<String,String> anahash = new HashMap<String,String>() ;
+	
+	/** The text. */
+	String text="";
+	
+	/** The base. */
+	String base="";
+	
+	/** The project. */
+	String project="";
+	
+	/** The cwb loc. */
+	String cwbLoc;
+	
+	/** The lang. */
+	private String lang ="fr";
+	
+	/**
+	 * initialize.
+	 *
+	 * @param url the url
+	 * @param text the text
+	 * @param base the base
+	 * @param project the project
+	 */
+	
+	public compiler(URL url,String text,String base, String project)
+	{
+		this.text = text
+		this.base = base;
+		this.project = project;
+		this.url = url;
+	}
+	
+	/**
+	 * Sets the debug.
+	 *
+	 * @return the java.lang. object
+	 */
+	public setDebug()
+	{
+		debug =true;
+	}
+	
+	/** The annotation success. */
+	boolean annotationSuccess = false;
+	
+	/**
+	 * Sets the annotation success.
+	 *
+	 * @param val the new annotation success
+	 */
+	public void setAnnotationSuccess(boolean val)
+	{
+		this.annotationSuccess = val;
+	}
+	
+	/** The metadata s attributes. */
+	String metadataSAttributes = "";
+	
+	/**
+	 * Sets the metadata attributes.
+	 *
+	 * @param attrsdecl the new metadata attributes
+	 */
+	public void setMetadataAttributes(String attrsdecl)
+	{
+		metadataSAttributes = attrsdecl;
+	}
+	
+	/**
+	 * set the language of the corpus.
+	 *
+	 * @param lang the lang
+	 * @return the java.lang. object
+	 */
+	public setLang(String lang)
+	{
+		this.lang = lang;
+	}
+	
+	/**
+	 * Sets the cwb path.
+	 *
+	 * @param path the new cwb path
+	 */
+	public void setCwbPath(String path)
+	{
+		if (!new File(path).exists())
+			System.err.println("CWB Path : "+path+" does not exists")
+		cwbLoc = path;
+	}
+	
+	/**
+	 * Creates the output.
+	 *
+	 * @param f the f
+	 * @return true, if successful
+	 */
+	private boolean createOutput(File f) {
+		try {
+			output = new OutputStreamWriter(new BufferedOutputStream(new FileOutputStream(f,f.exists())) , "UTF-8");
+			return true;
+		} catch (Exception e) { 
+			System.out.println(e.getLocalizedMessage());
+			return false;
+		}
+	}
+	
+	/**
+	 * Run.
+	 *
+	 * @param rootDirFile the root dir file
+	 * @param basename the basename
+	 * @return true, if successful
+	 */
+	public boolean run(File binDir, File txmDir, String corpusname) 
+	{
+		if (cwbLoc == null)
+			cwbLoc = org.txm.Toolbox.getParam(org.txm.Toolbox.CQI_SERVER_PATH_TO_CQPLIB)+File.separator;
+		
+		if (!new File(cwbLoc).exists()) {
+			println ("CWB path error: "+cwbLoc)
+			return false;
+		}
+		if (!binDir.exists()) {
+			println ("Binary directory does not exists: "+binDir)
+			return false;
+		}
+		
+		File wtcFile = new File(binDir,"wtc/"+corpusname+".wtc");
+		new File(binDir, "wtc").deleteDir();
+		new File(binDir, "wtc").mkdir();
+		new File(binDir, "data").deleteDir();
+		new File(binDir, "data").mkdir();
+		new File(binDir, "registry").mkdir();
+		
+		String textid="";
+		int counttext =0;
+		
+		//start corpus
+		if (createOutput(wtcFile)) {
+			output.write("<txmcorpus lang=\""+lang+"\">\n");
+			output.close();
+		}
+		
+		//1- Transform into WTC file
+		println("Compiling "+txmDir.listFiles().length+" files")
+		XMLTXM2WTC wtcbuilder = null;
+		ArrayList<File> files = txmDir.listFiles();
+		Collections.sort(files);
+		for (File txmfile : files) {
+			print "."
+			wtcbuilder = new XMLTXM2WTC(txmfile.toURI().toURL());
+			String txtname = txmfile.getName().substring(0,txmfile.getName().length()-4);
+			wtcbuilder.setTextInfo(txtname, this.base, this.project);
+
+			wtcbuilder.setBalisesToKeep(["text","s"]);
+			wtcbuilder.setSendToPAttributes(["lb":["n"]]);
+			wtcbuilder.setLang(lang);
+			if (!wtcbuilder.transformFile(wtcFile)) {
+				println("Failed to compile "+txmfile)
+			}
+		}
+		println ""
+		
+		//end corpus
+		if (createOutput(wtcFile)) {
+			output.write("</txmcorpus>\n");
+			output.close();
+		}
+		
+		//2- Import into CWB
+		def outDir = binDir.getAbsolutePath()+"/";
+		
+		CwbEncode cwbEn = new CwbEncode();
+		CwbMakeAll cwbMa = new CwbMakeAll();
+		cwbEn.setDebug(debug);
+		cwbMa.setDebug(debug);
+		
+		if(wtcbuilder == null)
+			return false;
+		
+		List<String> pAttributesList = wtcbuilder.getpAttributs();
+		List<String> sAttributesList = wtcbuilder.getsAttributs();
+		println "pAttrs : "+pAttributesList
+		println "sAttrs : "+sAttributesList
+		String[] pAttributes = pAttributesList.toArray(new String[pAttributesList.size()])
+		String[] sAttributes = sAttributesList.toArray(new String[sAttributesList.size()])
+		
+		try {
+			String regPath = outDir + "/registry/"+corpusname.toLowerCase();
+			cwbEn.run(cwbLoc + "cwb-encode", outDir + "/data/$corpusname", outDir + "/wtc/"+corpusname+".wtc", regPath, pAttributes, sAttributes);
+			if (!new File(regPath).exists()) {
+				println "Error: The registry file was not created: $regPath. See https://groupes.renater.fr/wiki/txm-users/public/faq"
+				return false;
+			}
+			cwbMa.run(cwbLoc + "cwb-makeall", corpusname, outDir + "/registry");
+		} catch (Exception ex) {System.out.println("CWB error: "+ex); return false;}
+		
+		return true;
+	}
+	
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args)
+	{
+		File dir = new File("~/xml/perrault/txm/");
+		List<File> files = dir.listFiles();
+		new compiler().run(files);
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/quick/package.html
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/quick/package.html	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/quick/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Quick import module : text files</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/org/txm/importer/quick/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/importer/limsi/compiler.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/limsi/compiler.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/limsi/compiler.groovy	(revision 258)
@@ -0,0 +1,203 @@
+
+
+// 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
+// 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.
+//
+//
+//
+// $LastChangedDate: 2012-01-05 14:27:34 +0100 (jeu., 05 janv. 2012) $
+// $LastChangedRevision: 2096 $
+// $LastChangedBy: mdecorde $
+//
+package org.txm.importer.limsi
+
+import org.txm.Toolbox;
+import org.txm.importer.cwb.*
+import org.txm.importer.*;
+import org.txm.scripts.*;
+import org.txm.scripts.teitxm.*;
+import org.txm.stat.utils.ConsoleProgressBar
+import org.txm.utils.io.FileCopy;
+import org.txm.utils.treetagger.TreeTagger;
+
+import java.util.ArrayList;
+
+import javax.xml.stream.*;
+
+import java.net.URL;
+import java.io.File;
+import java.util.HashMap;
+import java.util.List;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class compiler.
+ */
+class compiler
+{
+	/** The debug. */
+	boolean debug = false
+
+	/** The dir. */
+	private def dir
+
+	/** The cwb loc. */
+	String cwbLoc
+	boolean annotationSuccess = false
+
+	public def pAttributesList = []
+	public def sAttributesList = []
+
+	/**
+	 * Sets the debug.
+	 *
+	 * @return the java.lang. object
+	 */
+	public setDebug()
+	{
+		debug = true
+	}
+
+	/**
+	 * Sets the cwb path.
+	 *
+	 * @param path the new cwb path
+	 */
+	public void setCwbPath(String path)
+	{
+		if (!new File(path).exists())
+			System.err.println("CWB Path : "+path+" does not exists")
+		cwbLoc = path
+	}
+
+	/**
+	 * Sets the annotation success.
+	 *
+	 * @param val the new annotation success
+	 */
+	public void setAnnotationSuccess(boolean val)
+	{
+		this.annotationSuccess = val
+	}
+
+	/**
+	 * Run.
+	 *
+	 * @param rootDirFile the root dir file
+	 * @param basename the basename
+	 * @return true, if successful
+	 */
+	public boolean run(File binDir, File txmDir, String corpusname)
+	{
+		if (cwbLoc == null)
+			cwbLoc = org.txm.Toolbox.getParam(org.txm.Toolbox.CQI_SERVER_PATH_TO_CQPLIB)+File.separator;
+
+		if (!new File(cwbLoc).exists()) {
+			println ("CWB path error: "+cwbLoc)
+			return false
+		}
+		if (!binDir.exists()) {
+			println ("binary directory does not exists: "+binDir)
+			return false
+		}
+
+		//File wtcFile = new File(binDir,"wtc/"+corpusname+".wtc")
+		new File(binDir, "wtc").deleteDir()
+		new File(binDir, "wtc").mkdir()
+		new File(binDir, "data").deleteDir()
+		new File(binDir, "data").mkdir()
+		new File(binDir, "registry").mkdir()
+
+		//1- Merge WTC files
+		if (annotationSuccess) {
+			File annotationDir = new File(binDir, "annotations")
+			if (annotationDir.exists()) txmDir = annotationDir;
+		}
+		def files = txmDir.listFiles()
+		files.sort(); // sort files by name
+
+		//2- Import into CWB
+		def outDir = binDir.getAbsolutePath()+"/";
+
+		CwbEncode cwbEn = new CwbEncode()
+		CwbMakeAll cwbMa = new CwbMakeAll()
+		cwbEn.setDebug(debug)
+		cwbMa.setDebug(debug)
+
+		def pAttrs = []; // cast to array
+		if (annotationSuccess) {
+			pAttrs << "frpos"
+			pAttrs << "frlemma"
+		}
+		def sAttrs = ["text:0+id", "txmcorpus:0+lang"]; // cast to array
+
+
+		String[] pAttributes = pAttrs // cwb-encode needs String[]
+		String[] sAttributes = sAttrs // cwb-encode needs String[]
+		println "pAttrs : "+pAttrs
+		println "sAttrs : "+sAttrs
+
+		try {
+			cwbEn.setDebug(debug)
+			cwbMa.setDebug(debug)
+			String regPath =outDir + "/registry/"+corpusname.toLowerCase()
+			cwbEn.run(cwbLoc + "cwb-encode", outDir + "/data/$corpusname",
+					null,
+					regPath, pAttributes, sAttributes);
+
+			def output = new OutputStreamWriter(cwbEn.getOutputStream());
+			if (output == null) {println "CWB-ENCODE OUTPUT NULL"; return false;}
+			ConsoleProgressBar cpb = new ConsoleProgressBar(files.size())
+			println "processing "+files.size()+" files."
+			output.write("<txmcorpus lang=\"fr\">\n")
+			for (File f : files) {
+				cpb.tick()
+				output.write(f.getText("UTF-8"))
+				output.flush();
+				output.write("\n")
+			}
+			output.write("</txmcorpus>\n")
+			output.close()
+			cwbEn.endProcess();
+			
+			if (!new File(regPath).exists()) {
+				println "Error: The registry file was not created: $regPath. See https://groupes.renater.fr/wiki/txm-users/public/faq"
+				return false;
+			}
+			cwbMa.run(cwbLoc + "cwb-makeall", corpusname, outDir + "/registry")
+			return true
+		} catch (Exception ex) {System.out.println("Error while compiling indexes: $ex"); ex.printStackTrace(); return false;}
+
+		return true;
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args)
+	{
+		File dir = new File("~/xml/perrault/txm/")
+		List<File> files = dir.listFiles()
+		new compiler().run(files)
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/limsi/package.html
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/limsi/package.html	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/limsi/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Limsi format transformation scripts</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/org/txm/importer/limsi/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/importer/limsi/importer.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/limsi/importer.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/limsi/importer.groovy	(revision 258)
@@ -0,0 +1,229 @@
+// 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
+// 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.
+//
+//
+//
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$
+//
+
+package org.txm.importer.limsi
+
+import java.util.ArrayList;
+import org.txm.utils.Pair;
+
+import javax.xml.transform.*;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.txm.utils.logger.Log;
+import org.txm.scripts.teitxm.*;
+import org.txm.stat.utils.ConsoleProgressBar
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import org.w3c.dom.*;
+import org.xml.sax.SAXException;
+import javax.xml.parsers.*;
+import javax.xml.xpath.*;
+
+import java.util.HashMap;
+import org.txm.importer.*;
+import org.txm.utils.*;
+import org.txm.metadatas.*;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class importer.
+ */
+class importer {
+
+	/** The speakers. */
+	HashMap<String, String> speakers = ["spk1":"//Speaker[@id='spk1']", "spk2":"//Speaker[@id='spk2']"];
+
+	/** The topics. */
+	HashMap<String, String> topics = ["to1":"//Topic[@id='to1']", "to2":"//Topic[@id='to2']"];
+
+	/** The trans. */
+	HashMap<String, String> trans = ["trans":"//Trans"];
+
+	/** The doc. */
+	def doc;
+
+	/** The infile. */
+	File infile;
+
+	/** The outfile. */
+	File outfile;
+
+	/** The outdir. */
+	File txmDir;
+	File binDir;
+
+	/** The trsfiles. */
+	ArrayList<String> trsfiles;
+
+	/** The metadata. */
+	Metadatas metadatas;
+
+	/**
+	 * Instantiates a new importer.
+	 *
+	 * @param trsfiles the trsfiles
+	 * @param outdir the outdir
+	 * @param metadata the metadata
+	 */
+	public importer(ArrayList<File> trsfiles, File binDir, File txmDir)
+	{
+		this.trsfiles = trsfiles;
+		this.txmDir = txmDir;
+		this.binDir = binDir;
+	}
+
+	/**
+	 * Run.
+	 *
+	 * @return true, if successful
+	 */
+	public boolean run()
+	{
+		if (trsfiles == null) {
+			println "no files to process"
+			return false;
+		}
+		txmDir.mkdir();
+		if (!txmDir.exists()) {
+			println "can't create txmDir: "+txmDir.getAbsolutePath()
+		}
+
+		println "Convert from LIMSI files to CQP files ("+trsfiles.size()+")."
+		ConsoleProgressBar cpb = new ConsoleProgressBar(trsfiles.size());
+		for (File infile : trsfiles) {
+			cpb.tick();
+
+			String filename = infile.getName();
+			int idx = filename.indexOf(".");
+			if (idx > 0) filename = filename.substring(0, idx)
+
+			File outfile = new File(txmDir, filename+".wtc")
+			
+			if (outfile.exists() && outfile.lastModified() >= infile.lastModified()) {
+				// skip
+			} else {
+				def processor = new LimsiToCQP(infile);
+				processor.process(outfile);
+			}
+		}
+
+		println ""
+		return txmDir.listFiles() != null;
+	}
+
+	/**
+	 * Process.
+	 *
+	 * @param infile the infile
+	 * @param outfile the outfile
+	 * @param metas the metas
+	 * @return true, if successful
+	 */
+	public boolean process(File infile, File outfile, ArrayList<Pair<String, String>> metas)
+	{
+		//inject metadata into
+		this.infile = infile;
+		this.outfile = outfile;
+		def builder = DocumentBuilderFactory.newInstance().newDocumentBuilder()
+		doc = builder.parse(infile)
+		insert(trans.get("trans"), metas);
+		return save();
+	}
+
+	/**
+	 * Insert.
+	 *
+	 * @param xpath the xpath
+	 * @param pairs the pairs
+	 */
+	public void insert(String xpath, List<Pair<String, String>> pairs)
+	{
+		println ("insert $pairs into $xpath")
+		def expr = XPathFactory.newInstance().newXPath().compile(xpath)
+		def nodes = expr.evaluate(doc, XPathConstants.NODESET)
+
+		for (Node node : nodes) {
+			Element elem = (Element)node;
+			for (Pair<String, String> p : pairs) {
+				elem.setAttribute(p.getFirst(), p.getSecond());
+			}
+		}
+	}
+
+	/**
+	 * Save.
+	 *
+	 * @return true, if successful
+	 */
+	private boolean save()
+	{
+		try {
+			// Création de la source DOM
+			Source source = new DOMSource(doc);
+
+			// Création du fichier de sortie
+			Writer writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outfile), "UTF-8"));
+			Result resultat = new StreamResult(writer);
+
+			// Configuration du transformer
+			TransformerFactory fabrique = new net.sf.saxon.TransformerFactoryImpl();
+			Transformer transformer = fabrique.newTransformer();
+			transformer.setOutputProperty(OutputKeys.METHOD, "xml");
+			transformer.setOutputProperty(OutputKeys.INDENT, "yes");
+			transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
+
+			// Transformation
+			transformer.transform(source, resultat);
+			writer.close();
+			return true;
+		} catch (Exception e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+			return false;
+		}
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args)
+	{
+		String userhome = System.getProperty("user.home");
+		File metadatasfile = new File(userhome,"/xml/transcriber/metadatas.xml");
+		File infile = new File(userhome,"/xml/transcriber/dialogue.trs");
+		File outfile = new File(userhome,"/xml/transcriber/dialogue-out.trs");
+		new importer().run(infile, outfile, metadatasfile);
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/limsi/LimsiToCQP.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/limsi/LimsiToCQP.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/limsi/LimsiToCQP.groovy	(revision 258)
@@ -0,0 +1,78 @@
+package org.txm.importer.limsi
+
+import javax.xml.stream.*
+import java.net.URL
+
+class LimsiToCQP {
+
+	File xmlfile;
+
+	public LimsiToCQP(File xmlfile) {
+		this.xmlfile = xmlfile;
+	}
+
+	public boolean process(File outfile) {
+		if (!xmlfile.exists()) return false;
+		
+		URL url = xmlfile.toURI().toURL();
+		String filename = outfile.getName()
+		filename = filename.substring(0, filename.length()-4); // remove ".wtc"
+		def inputData = url.openStream();
+		XMLInputFactory factory = XMLInputFactory.newInstance();
+		XMLStreamReader parser = factory.createXMLStreamReader(inputData);
+
+		def output = new OutputStreamWriter(new FileOutputStream(outfile) , "UTF-8");
+		
+		boolean flagWord = false
+		String word = ""
+		
+
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+			switch (event)
+			{
+				case XMLStreamConstants.START_ELEMENT:
+					String localname = parser.getLocalName()
+					//println "start $localname"
+					switch(localname) {
+						case "AudioDoc":
+							output.println "<text id=\"$filename\">"
+							break
+						case "Word":
+							flagWord = true
+							word = ""
+						break;
+					}
+					break;
+				case XMLStreamConstants.END_ELEMENT:
+					String localname = parser.getLocalName()
+					switch(localname) {
+						case "AudioDoc":
+						output.println "</text>"
+						break
+						case "Word":
+							flagWord = false
+							output.println word.trim()
+						//	println "WORD: $word"
+						break;
+					}
+					break
+				case XMLStreamConstants.CHARACTERS:
+					if (flagWord) {
+						word += parser.getText();
+					}
+					break
+			}
+		}
+		output.flush()
+		output.close()
+		//println "$xmlfile -> $outfile"
+		return true;
+	}
+
+	public static void main(String[] args) {
+		File infile = new File("/home/mdecorde/xml/limsi","20071220_1900_1920_inter.xml")
+		File outfile = new File("/home/mdecorde/xml/limsi","out.wtc")
+		def processor = new LimsiToCQP(infile);
+		println processor.process(outfile);
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/importer/limsi/limsiLoader.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/limsi/limsiLoader.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/limsi/limsiLoader.groovy	(revision 258)
@@ -0,0 +1,222 @@
+// 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
+// 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.
+
+//
+// This file is part of the TXM platform.
+//
+// The TXM platform is free software: you can redistribute it and/or modif y
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 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/>.
+//
+//
+//
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$
+//
+package org.txm.importer.limsi;
+
+import org.eclipse.swt.widgets.*;
+import org.txm.importer.transcriber.compiler.*;
+import org.txm.importer.transcriber.pager.*;
+import org.txm.importer.transcriber.*;
+
+import java.io.File;
+
+import org.txm.scripts.teitxm.*;
+import org.txm.stat.utils.ConsoleProgressBar
+import org.txm.*;
+import org.txm.objects.*;
+import org.txm.utils.i18n.*;
+import org.txm.utils.io.FileCopy;
+import org.txm.utils.*;
+import org.txm.importer.*;
+import org.w3c.dom.Element
+import org.txm.rcpapplication.commands.*
+
+
+//PARAMETERS
+boolean removeInterviewer = false;//if true the transcription of speakers (en1 and enq2) defined in metadatas file will be ignored
+boolean includeComments = false;
+boolean ignoreTranscriberMetadata = false;
+int csvHeaderNumber = 1;
+int maxlines = 200;
+
+String userDir = System.getProperty("user.home");
+
+def MONITOR;
+boolean debug = org.txm.utils.logger.Log.isPrintingErrors();
+BaseParameters params;
+try {params = paramsBinding;MONITOR=monitor} catch (Exception)
+{	println "DEV MODE";//exception means we debug
+	debug = true
+	//
+		params = new BaseParameters(new File(userDir, "xml/limsi/files/import.xml"))
+		println "loading "+params.paramFile
+		params.load()
+	if (!org.txm.Toolbox.isInitialized()) {
+		Toolbox.setParam(Toolbox.INSTALL_DIR,new File("/usr/lib/TXM"));
+		Toolbox.setParam(Toolbox.TREETAGGER_INSTALL_PATH,new File(userDir,"treetagger"));
+		Toolbox.setParam(Toolbox.TREETAGGER_MODELS_PATH,new File(userDir,"treetagger/models"));
+		Toolbox.setParam(Toolbox.METADATA_ENCODING, "UTF-8");
+		Toolbox.setParam(Toolbox.METADATA_COLSEPARATOR, ",");
+		Toolbox.setParam(Toolbox.METADATA_TXTSEPARATOR, "\"");
+		Toolbox.setParam(Toolbox.USER_TXM_HOME, new File(System.getProperty("user.home"), "TXM"));
+	}
+}
+if (params == null) { println "no parameters. Aborting"; return; }
+
+String corpusname = params.getCorpusName();
+Element corpusElem = params.corpora.get(corpusname);
+String basename = params.name;
+String rootDir = params.rootDir;
+String lang = corpusElem.getAttribute("lang");
+String model = lang
+String encoding = corpusElem.getAttribute("encoding");
+boolean annotate = "true" == corpusElem.getAttribute("annotate");
+String xsl = params.getXsltElement(corpusElem).getAttribute("xsl")
+def xslParams = params.getXsltParams(corpusElem);
+
+File srcDir = new File(rootDir);
+File binDir = new File(Toolbox.getParam(Toolbox.USER_TXM_HOME),"corpora/"+basename);
+//binDir.deleteDir();
+binDir.mkdirs();
+if (!binDir.exists()) {
+	println "Could not create binDir "+binDir
+	return;
+}
+
+File txmDir = new File(binDir,"txm/$corpusname");
+//txmDir.deleteDir();
+txmDir.mkdirs();
+
+try {
+	// select only xml files
+	String ext = ".xml";
+	ArrayList<File> limsiFiles = srcDir.listFiles(); //find all trs files
+	if (limsiFiles  == null) {
+		println ("No files in "+srcDir.getAbsolutePath())
+		return false;
+	}
+	
+	// remove non XML files
+	for (int i = 0 ; i < limsiFiles.size() ; i++) {
+		File f = limsiFiles.get(i);
+		if (f.getName().equals("import.xml") || !f.getName().endsWith(ext) || !f.canRead() || f.isHidden()) {
+			limsiFiles.remove(i)
+			i--;
+		}
+	}
+
+	if (limsiFiles.size() == 0) {
+		println ("No transcriptions in "+srcDir.getAbsolutePath())
+		return false;
+	} else {
+		println "Number of transcriptions: "+limsiFiles.size();
+	}
+
+	if (MONITOR != null) MONITOR.worked(1, "IMPORTER")
+	if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+	println "-- IMPORTER"
+	def imp = new importer(limsiFiles, binDir, txmDir) //put result in the txm folder of binDir
+	if (!imp.run()) {
+		println "Failed to prepare files - Aborting";
+		return;
+	}
+	if (MONITOR != null) MONITOR.worked(20)
+
+	if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+	if (MONITOR != null) MONITOR.worked(20, "ANNOTATE")
+	println "-- ANNOTATE CQP- Running NLP tools"
+	boolean annotationSuccess = false;
+	if (annotate && new AnnotateWTC().run(binDir, txmDir, model+".par")) {
+		annotationSuccess = true;
+	}
+
+	if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+	if (MONITOR != null) MONITOR.worked(25, "COMPILING")
+	println "--COMPILING - Building Search Engine indexes"
+	limsiFiles = txmDir.listFiles();
+
+	def comp = new compiler()
+	if(debug) comp.setDebug();
+	comp.setAnnotationSuccess(annotationSuccess)
+	if (!comp.run(binDir, txmDir, corpusname)) {
+		println "Failed to compile files";
+		return;
+	}
+	
+	// create HTML directory but don't build an edition
+	File htmlDir = new File(binDir,"HTML/$corpusname");
+	htmlDir.mkdirs();
+	
+	def filelist;
+	if (annotationSuccess)
+		filelist = new File(binDir, "annotations").listFiles();
+	else 
+		filelist = txmDir.listFiles();
+	filelist.sort();
+	def second = 0
+	
+	println "Registering texts: "+filelist.size()
+	ConsoleProgressBar cpb = new ConsoleProgressBar(filelist.size());
+	for (File txmFile : filelist) {
+		cpb.tick()
+		
+		String txtname = txmFile.getName();
+		int i = txtname.lastIndexOf(".");
+		if(i > 0) txtname = txtname.substring(0, i);
+		
+		Element text = params.addText(corpusElem, txtname, txmFile);
+	}
+}
+catch (Exception e){org.txm.utils.logger.Log.printStackTrace(e);}
+
+if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
+if (MONITOR != null) MONITOR.worked(20, "FINALIZING")
+File paramFile = new File(binDir, "import.xml");
+DomUtils.save(params.root.getOwnerDocument(), paramFile);readyToLoad = true;
+
+
+// load corpus
+println "Loading corpus..."
+try {LoadBinaryCorpus.loadBase(binDir)} catch(Exception e777){try {AddBases.loadBase(binDir, MONITOR)} catch(Exception e){}} // LoadBinaryCorpus does not exist if TXM version is < 0.7.7
+
+Toolbox.restartWorkspace();
+Toolbox.restartSearchEngine();
+
+Display.getDefault().syncExec(new Runnable() {
+	@Override
+	public void run() {
+		println "Reloading corpora view..."
+		RestartTXM.reloadViews();
+		println "import done."
+	}
+});
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/importer/XMLTXM2WTC.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/XMLTXM2WTC.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/XMLTXM2WTC.groovy	(revision 258)
@@ -0,0 +1,509 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2016-03-29 09:51:35 +0200 (Tue, 29 Mar 2016) $
+// $LastChangedRevision: 3185 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer
+
+import java.text.DateFormat;
+import java.util.Date;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import javax.xml.stream.*;
+import java.net.URL;
+import org.txm.importer.filters.*;
+// TODO: Auto-generated Javadoc
+
+/**
+ * The Class XMLTXM2WTC.
+ *
+ * @author mdecorde
+ * simple transofmration of a xml-tei-txm file into wtc file
+ */
+
+class XMLTXM2WTC
+{
+	
+	/** The url. */
+	private def url;
+	
+	/** The input data. */
+	private def inputData;
+	
+	/** The factory. */
+	private def factory;
+	
+	/** The parser. */
+	private XMLStreamReader parser;
+	
+	/** The output. */
+	private def output;
+	
+	/** The hashmap of txm:form and txm:ana values and the attributes hash*/
+	LinkedHashMap<String, String> anahash = new LinkedHashMap<String, String>();
+	LinkedHashMap<String, String> formhash = new LinkedHashMap<String, String>();
+	LinkedHashMap<String, String> wordattributes = new LinkedHashMap<String, String>();
+	
+	/** The balisesfound. */
+	HashMap<String, List<String>> balisesfound;// = new HashMap<String, List<String>>();
+
+	/** The balises to keep. */
+	List<String> balisesToKeep;
+	
+	/** The send to p attributes. */
+	HashMap <String, List<String>> sendToPAttributes;// = new HashMap<String, List<String>>();
+	
+	/** The injected p attributes. */
+	List<String> injectedPAttributes = new ArrayList<String>();
+	
+	/** The default reference : a pattern + the properties to use */
+	List<String> defaultReferences = new ArrayList<String>();
+	String defaultReferencePattern;
+	
+	/** The injected p attributes values. */
+	HashMap <String, String> injectedPAttributesValues;// = new ArrayList<String>();
+	
+	/** The addinfos. */
+	boolean addinfos = false;
+	
+	/** The txtname. */
+	String txtname;
+	
+	/** The base. */
+	String base;
+	
+	/** The project. */
+	String project;
+	
+	/** The lang. */
+	public String lang= "fr";
+	public String currentForm;
+	public String currentAna;
+	
+	/**
+	 * Sets the lang.
+	 *
+	 * @param lang the lang
+	 * @return the java.lang. object
+	 */
+	public setLang(String lang)
+	{
+		this.lang = lang;
+	}
+	
+	/**
+	 * Instantiates a new xMLTX m2 wtc.
+	 *
+	 * @param url the url
+	 */
+	public XMLTXM2WTC(URL url){
+		try {
+			this.url = url;
+			inputData = url.openStream();
+			factory = XMLInputFactory.newInstance();
+			
+			parser = factory.createXMLStreamReader(inputData);
+			
+			
+		} catch (XMLStreamException ex) {
+			System.out.println(ex);
+		}catch (IOException ex) {
+			System.out.println("IOException while parsing ");
+		}
+	}
+	
+	/**
+	 * Sets the text info.
+	 *
+	 * @param name the name
+	 * @param base the base
+	 * @param project the project
+	 */
+	public void setTextInfo(String name, String base, String project)
+	{
+		this.addinfos = true;
+		this.txtname= name;
+		this.base = base;
+		this.project = project;
+	}
+	
+	/**
+	 * Creates the output.
+	 *
+	 * @param outfile the outfile
+	 * @return true, if successful
+	 */
+	private boolean createOutput(File outfile)
+	{
+		try {
+			output = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outfile, outfile.exists()) , "UTF-8"));
+			return true;
+		} catch (Exception e) {
+			System.err.println(e);
+			return false;
+		}
+	}
+	
+	/** The haspb. */
+	boolean haspb = false;
+	
+	/** The haslb. */
+	boolean haslb = false;
+	
+	/**
+	 * Transform file.
+	 *
+	 * @param outfile the outfile
+	 * @return true, if successful
+	 */
+	public boolean transformFile(File outfile)
+	{
+		if(balisesToKeep == null)
+		{
+			println "no element has been defined to be keeped"
+			return false;
+		}
+		
+		haspb = false;
+		haslb = false;	
+		
+		boolean flagAna;
+		boolean flagForm;
+		boolean flagWord;
+		String vWord = "";
+		String vForm = "";
+		String vAna = "";
+		
+		String lb_id = "";
+		String pb_id = "";
+		
+		wordattributes = [:];
+		balisesfound = new HashMap<String, List<String>>();
+		
+		
+		if(!createOutput(outfile))
+			return false;
+		
+		if(sendToPAttributes != null)
+		{
+			for(String tag: sendToPAttributes.keySet())
+				for(String attr : sendToPAttributes.get(tag))
+					injectedPAttributes.add(tag+attr);
+			injectedPAttributesValues = [:];
+		}
+		
+		//output.write("<txmcorpus lang=\""+lang+"\">\n");
+		balisesfound.put("txmcorpus",["lang"]);
+		
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+			switch (event) 
+			{
+				case XMLStreamConstants.START_ELEMENT:
+					String localname = parser.getLocalName().toLowerCase();
+				
+				// we will only declare found tags in cwb registry
+					if(balisesToKeep.contains(localname))
+					{
+						if(!balisesfound.containsKey(localname))
+						{
+							balisesfound.put(localname,[]);
+						}
+						
+						List<String> attrlist = balisesfound.get(localname);
+						for(int i= 0 ; i < parser.getAttributeCount() ;i++ )
+							if(!attrlist.contains(parser.getAttributeLocalName(i)))
+								attrlist.add(parser.getAttributeLocalName(i));
+						
+					}
+					switch (localname) 
+					{						
+						case "w": // get word id !!
+							wordattributes.put("id", parser.getAttributeValue(null, "id"));
+							break;
+						
+						case "form":
+							flagForm = true;
+							currentForm = parser.getAttributeValue(null, "type");
+							if(currentForm == null)
+								currentForm = "default";
+							vForm = "";
+							break;
+						
+						case "ana":
+							flagAna = true;
+							vAna ="";
+						
+							currentAna = (parser.getAttributeValue(null,"type"));
+							if(currentAna != null)
+								currentAna = currentAna.substring(1)// remove the #
+							else
+								flagAna = false;
+							break;
+						
+						default:
+							
+							if (sendToPAttributes != null) {
+								//println "should store $localname ? with "+sendToPAttributes.keySet()
+								if (sendToPAttributes.keySet().contains(localname)) {
+									//println "store attr of "+localname
+									List<String> attrs = sendToPAttributes.get(localname);
+									for (int i= 0 ; i < parser.getAttributeCount() ;i++ ) {
+										if (attrs.contains(parser.getAttributeLocalName(i))) {
+											injectedPAttributesValues.put(localname+parser.getAttributeLocalName(i).toLowerCase(),parser.getAttributeValue(i)) 
+										}
+									}
+								}
+							}
+							
+							if (balisesToKeep.contains(localname)) {
+								output.write("<"+localname);
+								//println "write <"+localname+"..."
+								//write attributes
+								boolean idwritten = false;
+								boolean basewritten = false;
+								boolean projectwritten = false;
+								for (int i= 0 ; i < parser.getAttributeCount() ;i++ ) {
+									String attrname = parser.getAttributeLocalName(i).toLowerCase();
+									if (attrname == "id")
+										idwritten = true;
+									if (attrname == "base")
+										basewritten = true;
+									if (attrname == "project")
+										projectwritten = true;
+									output.write(" "+attrname+"=\""+parser.getAttributeValue(i).replace("\"", "'")+"\"" );
+								}
+								
+								if (localname.equals("text"))
+									if (addinfos) {
+										List<String> attrlist = balisesfound.get(localname);
+	
+										if (!idwritten) {
+											output.write(" id=\""+txtname+"\"")
+											attrlist.add("id");
+										}
+										if (!basewritten) {
+											output.write(" base=\""+base+"\"");
+											attrlist.add("base");
+										}
+										if (!projectwritten) {
+											output.write(" project=\""+project+"\"");
+											attrlist.add("project");
+										}											
+									}	
+											
+								// finalize tag
+								output.write(">\n");
+							}
+					}
+					break;
+				
+				case XMLStreamConstants.END_ELEMENT:
+					String localname = parser.getLocalName().toLowerCase();
+					switch (localname) {
+						case "form":
+							if(flagForm)
+								formhash.put(currentForm, vForm);
+							flagForm = false; 
+							break;
+						
+						case "ana":
+							if(flagAna)
+								anahash.put(currentAna, vAna);
+							flagAna = false;
+							break;
+						
+						case "w":
+							vWord = "";
+							vWord = formhash.get("default").replaceAll("&", "&amp;").replaceAll("<", "&lt;"); // get default form
+							for (String form : formhash.keySet()) // and the others
+								if (form != "default")
+									vWord += "\t"+formhash.get(form);
+							
+							for (String type : wordattributes.keySet()) // only word id ?
+								vWord+="\t"+wordattributes.get(type)
+						
+							if (sendToPAttributes != null) // word attributes from structure properties
+							{
+								//println "injectedPAttributesValues: "+injectedPAttributesValues
+								for(String pattr : injectedPAttributes)
+									vWord+="\t"+injectedPAttributesValues.get(pattr) ;//les attributs injecter
+							}
+							
+							for (String type : anahash.keySet()) // word annotations in txm:ana
+								vWord+="\t"+anahash.get(type)
+							
+							output.write(vWord+"\n");
+							vWord= "";
+							break;
+						
+						default:
+							if (sendToPAttributes != null) // reset structure properties
+							{
+								if (sendToPAttributes.keySet().contains(localname)) {
+									for (String attr : sendToPAttributes.get(localname)) {
+										injectedPAttributesValues.put(attr, "N/A") 
+									}
+								}
+							}
+							
+							if (balisesToKeep.contains(localname)) {
+								output.write("</"+localname+">\n");
+							}
+					}
+					break;
+				
+				case XMLStreamConstants.CHARACTERS:
+					if (flagForm) {
+						vForm += parser.getText().trim();
+					}
+					if (flagAna) {
+						vAna += parser.getText().trim();
+					}
+					break;
+			}
+		}
+		//output.write("</txmcorpus>\n"); 
+		output.close();
+		parser.close();
+		
+		return true;
+	}
+	
+	/**
+	 * Gets the p attributs.
+	 *
+	 * @return the p attributs
+	 */
+	public List<String> getpAttributs()
+	{
+		def pAttributs = [];
+		
+		for (String wordattr : wordattributes.keySet()) {
+			pAttributs.add(wordattr);
+		}
+		
+		if (sendToPAttributes != null)
+			for (String pAttr : this.injectedPAttributes)
+				pAttributs.add(pAttr);
+		
+		for (String anakey : anahash.keySet()) {
+			pAttributs.add(anakey);
+		}
+		
+		return pAttributs;
+	}
+	
+	/**
+	 * Gets the s attributs.
+	 *
+	 * @return the s attributs
+	 */
+	public List<String> getsAttributs()
+	{
+		def sAttributs = [];
+		for (String balise : this.balisesfound.keySet()) {
+			List<String> sAtt = this.balisesfound.get(balise);
+			String attributes = "";
+			for (String attr : sAtt) {
+				attributes+="+"+attr;
+			}
+			
+			if (sAtt.size() > 0)
+				sAttributs.add(balise +":"+attributes);
+			else
+				sAttributs.add(balise);
+		}
+		return sAttributs;
+	}
+	
+	/**
+	 * Sets the balises to keep.
+	 *
+	 * @param balisesToKeep the new balises to keep
+	 */
+	public void setBalisesToKeep(List<String> balisesToKeep)
+	{
+		if (balisesToKeep != null)
+			this.balisesToKeep = balisesToKeep;
+		else
+			println("Warning: the list of elements to keep is null")
+	}
+	
+	/**
+	 * Sets the defautl reference pattern
+	 * TODO: not implemented
+	 *
+	 * @param balisesToKeep the new balises to keep
+	 */
+	public void setDefaultReference(String pattern, List<String> strucProperties)
+	{
+		if (defaultReferencePattern != null) {
+			this.defaultReferences = defaultReferences;
+			defaultReferencePattern = pattern;
+		}
+	}
+	
+	
+	/**
+	 * Sets the send to p attributes.
+	 *
+	 * @param sendus the sendus
+	 */
+	public void setSendToPAttributes(HashMap<String, List<String>> sendus)
+	{
+		if (sendus != null)
+			this.sendToPAttributes = sendus;
+		else
+			println("Warning: the pAttributes to inject is null")
+	}
+	
+	
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args) {
+		
+		String rootDir = "C:/Documents and Settings/H/xml/quick/txm";
+		
+		File srcfile = new File(rootDir,"quick.xml");
+		File wtcfile = new File(rootDir+"/wtc","quick.wtc");
+		new File(rootDir,"wtc").deleteDir()
+		new File(rootDir,"wtc").mkdir()
+		
+		System.out.println("XMLTXM2WTC : "+srcfile+" >> "+wtcfile);
+		def builder = new XMLTXM2WTC(srcfile.toURL());
+		def balises = ["text","lb","pb"];
+		builder.setBalisesToKeep(balises);
+		builder.transformFile wtcfile;
+		
+		println(builder.getsAttributs());
+		println(builder.getpAttributs());
+		return;
+	}
+}
+
Index: tmp/org.txm.core/src/groovy/org/txm/importer/TabulatedToXml.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/TabulatedToXml.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/TabulatedToXml.groovy	(revision 258)
@@ -0,0 +1,244 @@
+package org.txm.importer 
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.util.ArrayList;
+
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamWriter;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Tool to convert Tabulated file to xml file. Such as CWB files or TreeTagger ouput
+ */
+public class TabulatedToXml {
+	String[] colnames;
+	
+	/** The texttag. */
+	String texttag;
+	
+	/** The tag. */
+	boolean tag;
+	
+	/** The no col form. */
+	int noColForm;
+	
+	/**
+	 * Instantiates a new tabulated to xml.
+	 *
+	 * @param colnames the word properties name
+	 * @param texttag the element that represents a text unit
+	 * @param tag if true, split the file by the texttag, if false wrap the file with an element texttag
+	 */
+	public TabulatedToXml(String[] colnames, String texttag, boolean tag) throws Exception
+	{
+		this.colnames = colnames;
+		this.texttag = texttag;
+		this.tag = tag;
+		this.noColForm = 0;
+	}
+	
+	/**
+	 * Instantiates a new tabulated to xml.
+	 *
+	 * @param colnames the colnames
+	 * @param texttag the texttag
+	 * @param tag the tag
+	 * @param noColForm the no col form
+	 */
+	public TabulatedToXml(String[] colnames, String texttag, boolean tag, int noColForm) throws Exception
+	{
+		this.colnames = colnames;
+		this.texttag = texttag;
+		this.tag = tag;
+		this.noColForm = noColForm;
+	}
+	
+	/**
+	 * Process.
+	 *
+	 * @param tabulatedfile the tabulatedfile
+	 * @param xmlfile the xmlfile
+	 * @param encoding the encoding
+	 * @return true, if successful
+	 */
+	public boolean process(File tabulatedfile, File xmlfile, String encoding)
+	{
+		BufferedReader reader = new BufferedReader(new FileReader(tabulatedfile));
+		FileOutputStream output = new FileOutputStream(xmlfile)
+		
+		XMLOutputFactory factory = XMLOutputFactory.newInstance();
+		XMLStreamWriter writer = factory.createXMLStreamWriter(output, "UTF-8"); 
+		
+		writer.writeStartDocument("UTF-8", "1.0")
+		
+		if(!tag) // there is no tag, we must wrap the content in an element
+		{
+			if(texttag.length() == 0)
+			{
+				println "no text element given"
+				return false;
+			}
+			writer.writeStartElement(texttag);
+			String filename = tabulatedfile.getName()
+			filename = filename.substring(0, filename.lastIndexOf("."));
+			writer.writeAttribute("id", filename);
+		}
+		
+		String line = reader.readLine();
+		int noline = 0;
+		while(line != null)
+		{
+			if(tag && line.startsWith("</")) // closing xml tag
+			{
+				writer.writeEndElement();
+			}
+			else if(tag && line.startsWith("<")) // opening xml tag
+			{
+				int firstblank = line.indexOf(" ");
+				String tagname;
+				String[] attrnamevalues = null;
+				if(firstblank > 0) // contains attributes
+				{
+					tagname = line.substring(1, firstblank);
+					line = line.substring(firstblank+1, line.length() -1);
+					attrnamevalues = line.split(" ");
+				}
+				else // no attr
+				{
+					tagname = line.substring(1, line.length() -1);
+				}
+				
+				writer.writeStartElement(tagname);
+				if(attrnamevalues != null)
+				{
+					for(String namevalue : attrnamevalues)
+					{
+						int egalidx = namevalue.indexOf("=");
+						String name = namevalue.substring(0, egalidx);
+						String value = namevalue.substring(egalidx+1, namevalue.length());
+						
+						writer.writeAttribute(name, value.replace("\"",""));
+					}
+				}
+			}
+			else // it's a word
+			{
+				String[] split = line.split("\t");
+				if(split.length != colnames.length)
+				{
+					System.out.println("Error line "+noline+" : missing columns :"+split.length+" instead of "+ colnames.length);
+					println "line: "+line
+				}
+				String form = "";
+				writer.writeStartElement("w");
+				for(int i = 0 ; i < colnames.length ; i++)
+				{
+					if(i == noColForm)
+					{
+						form = split[0];
+					}
+					else
+					{
+						if(split.length <= i)
+						writer.writeAttribute(colnames[i], "N/A");
+						else
+						writer.writeAttribute(colnames[i], split[i]);
+					}
+				}
+				writer.writeCharacters(form);
+				writer.writeEndElement();
+				
+			}
+			noline++;
+			line = reader.readLine();
+		}
+		
+		if(!tag) // there is no tag, we close the wrapping element
+		{
+			writer.writeEndElement();
+		}
+		
+		writer.close();
+		output.close();
+		reader.close();
+	}
+	
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args)
+	{
+		String home = System.getProperty("user.home");
+		// sample_TXM_LA.vrt
+		/*
+		 File tabulatedfile = new File(home, "xml/tabulated/sample_TXM_LA.vrt");
+		 File xmlfile = new File(home, "xml/tabulated/sample_TXM_LA.xml");
+		 String[] colnames = ["form", "pos", "lem", "func"]; // TreeTagger
+		 boolean tag = true;
+		 String encoding = "UTF-8";
+		 try {
+		 TabulatedToXml ttx = new TabulatedToXml(colnames, "", tag);
+		 ttx.process(tabulatedfile, xmlfile, encoding)
+		 } catch (Exception e) {
+		 // TODO Auto-generated catch block
+		 org.txm.utils.logger.Log.printStackTrace(e);
+		 }*/
+		File srcdir = new File(home, "xml/Bendinelli");
+		File outdir = new File(home, "xml/Bendinelli/xml");
+		println "srcdir: "+srcdir
+		outdir.deleteDir();
+		outdir.mkdir();
+		
+		String[] colnames = ["form", "pos", "lem"]; // TreeTagger
+		boolean tag = false;
+		String encoding = "UTF-8";
+		
+		TabulatedToXml ttx = new TabulatedToXml(colnames, "debat", tag);
+		for(File tabulatedfile : srcdir.listFiles())
+		{
+			if(tabulatedfile.getName().endsWith(".txt"))
+			{
+				String filename = tabulatedfile.getName()
+				filename = filename.substring(0, filename.lastIndexOf("."));
+				File xmlfile = new File(outdir, filename+".xml")
+				println "process: "+tabulatedfile
+				ttx.process(tabulatedfile, xmlfile, encoding)
+			}
+		}
+		
+		println "Done"
+	}
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/importer/ReadImportParameters.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/ReadImportParameters.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/ReadImportParameters.groovy	(revision 258)
@@ -0,0 +1,277 @@
+package org.txm.importer
+
+import javax.xml.stream.*;
+import java.net.URL;
+/**
+ * Read the import.xml file
+ * @author mdecorde
+ */
+class ReadImportParameters {
+	HashMap<String, ArrayList<String>> links = new HashMap<String, ArrayList<String>>();;
+	HashMap<String, String> structs = new HashMap<String, String>();
+	HashMap<String, Integer> levels = new HashMap<String, Integer>();
+	
+	HashMap<String, HashMap<String, String>> metadatas = [:];
+	HashMap<String, HashMap<String, String>> pattributes = [:];
+	HashMap<String, HashMap<String, String>> sattributes = [:];
+	
+	HashMap<String, String> biblios = [:];
+	
+	HashMap<String, String> uis = [:];
+	
+	HashMap<String, ArrayList<HashMap<String, String>>> editions = [:];
+	
+	String basename;
+	String encoding;
+	String language;
+	String rootDir;
+	String script;
+	String xslt;
+	String author;
+	String description;
+	
+	boolean debug;
+
+	public ReadImportParameters()
+	{
+
+	}
+
+	public boolean read(File infile)
+	{
+		try {
+			def url = infile.toURI().toURL();
+			def inputData = url.openStream();
+			def factory = XMLInputFactory.newInstance();
+			def parser = factory.createXMLStreamReader(inputData);
+			return read(parser);
+		} catch (XMLStreamException ex) {
+			System.out.println(ex);
+		}catch (IOException ex) {
+			System.out.println("IOException while parsing ");
+		}
+	}
+
+	public boolean read(def parser)
+	{
+		boolean startAlignInfos = false;
+		boolean startEditions = false;
+		boolean startMetadatas = false;
+		boolean startPAttributes = false;
+		boolean startSAttributes = false;
+		boolean startTokenizer = false;
+		
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next())
+		{
+			switch (event) {
+
+				case XMLStreamConstants.END_ELEMENT:
+					String localname = parser.getLocalName();
+					if(localname == "linkGrp")
+					{
+						startAlignInfos = false;
+					}
+					else if(localname == "metadatas")
+					{
+						startMetadatas = false;
+					}
+					else if(localname == "editions")
+					{
+						startEditions = false;
+					}
+					else if(localname == "pattributes")
+					{
+						startPAttributes = false;
+					}
+					else if(localname == "sattributes")
+					{
+						startSAttributes = false;
+					}
+					else if(localname == "tokenizer")
+					{
+						startSAttributes = false;
+					}
+					break;
+
+				case XMLStreamConstants.START_ELEMENT:
+					String localname = parser.getLocalName();
+					if (localname == "import")
+					{
+						basename = parser.getAttributeValue(null, "name");
+						encoding = parser.getAttributeValue(null, "encoding");
+						language = parser.getAttributeValue(null, "lang");
+						rootDir = parser.getAttributeValue(null, "rootDir");
+						script = parser.getAttributeValue(null, "script");
+						xslt = parser.getAttributeValue(null, "xslt");
+						author = parser.getAttributeValue(null, "author")
+						description = parser.getAttributeValue(null, "desc");
+						
+						boolean debug;
+					}
+					else if(localname == "editions")
+					{
+						startEditions = true;
+					}
+					else if(localname == "edition")
+					{
+						String corpus = parser.getAttributeValue(null, "corpus")
+						if(!editions.containsKey(corpus))
+							editions.put(corpus, []);
+						def list = editions.get(corpus);
+						def map = [:]
+						list.add(map)
+						
+						map.put("name", parser.getAttributeValue(null, "name"))
+						map.put("mode", parser.getAttributeValue(null, "mode"))
+						map.put("script", parser.getAttributeValue(null, "script"))
+					}
+					else if (localname == "metadatas") {
+						startMetadatas = true;
+					}
+					else if (localname == "metadata" && startMetadatas) {
+						metadatas.put(parser.getAttributeValue(null, "id"), 
+							["id":parser.getAttributeValue(null, "id"),
+							"shortname":parser.getAttributeValue(null, "shortname"),
+							"longname":parser.getAttributeValue(null, "longname"),
+							"type":parser.getAttributeValue(null, "type"),
+							"selection":parser.getAttributeValue(null, "selection"),
+							"partition":parser.getAttributeValue(null, "partition"),
+							"display":parser.getAttributeValue(null, "display"),])
+					}
+					else if (localname == "pattributes") {
+						startPAttributes = true;
+					} else if(localname == "pattribute" && startPAttributes) {
+						pattributes.put(parser.getAttributeValue(null, "id"), 
+							["id":parser.getAttributeValue(null, "id"),
+							"shortname":parser.getAttributeValue(null, "shortname"),
+							"longname":parser.getAttributeValue(null, "longname"),
+							"type":parser.getAttributeValue(null, "type"),
+							"renderer":parser.getAttributeValue(null, "renderer"),
+							"tooltip":parser.getAttributeValue(null, "tooltip"),
+							"display":parser.getAttributeValue(null, "display"),
+							"min":parser.getAttributeValue(null, "min"),
+							"max":parser.getAttributeValue(null, "max"),
+							"inputFormat":parser.getAttributeValue(null, "inputFormat"),
+							"outputFormat":parser.getAttributeValue(null, "outputFormat"),
+							"position":parser.getAttributeValue(null, "position"),
+							"sortBy":parser.getAttributeValue(null, "sortBy")])
+					}
+					else if (localname == "sattributes") {
+						startSAttributes = true;
+					}
+					else if (localname == "sattribute" && startSAttributes) {
+						sattributes.put(parser.getAttributeValue(null, "id"), 
+							["id":parser.getAttributeValue(null, "id"),
+							"shortname":parser.getAttributeValue(null, "shortname"),
+							"longname":parser.getAttributeValue(null, "longname"),
+							"type":parser.getAttributeValue(null, "type"),
+							"renderer":parser.getAttributeValue(null, "renderer"),
+							"tooltip":parser.getAttributeValue(null, "tooltip"),
+							"pattern":parser.getAttributeValue(null, "renderer"),
+							"import":parser.getAttributeValue(null, "import"),
+							"min":parser.getAttributeValue(null, "min"),
+							"max":parser.getAttributeValue(null, "max"),
+							"mandatory":parser.getAttributeValue(null, "mandatory"),
+							"order":parser.getAttributeValue(null, "order"),
+							"inputFormat":parser.getAttributeValue(null, "inputFormat"),
+							"outputFormat":parser.getAttributeValue(null, "outputFormat"),])
+					} else if (localname == "link" && startAlignInfos) {
+						String target = parser.getAttributeValue(null, "target");
+						String struct = parser.getAttributeValue(null, "alignElement");
+						String level = parser.getAttributeValue(null, "alignLevel")
+						ArrayList<String> corpora = target.split("#");
+						for (int i = 0 ; i < corpora.size() ; i++) {
+							corpora[i] = corpora[i].trim()
+							if (corpora[i].length() == 0) {
+								corpora.remove(i)
+								i--
+							}
+						}
+
+						if (level == null)
+							level = "1";
+
+						if (corpora.size() == 0) {
+							println "no corpus aligned: "+parser.getLocation()
+							return false;
+						}
+						if (struct == null) {
+							println "a sturcture is missing: "+parser.getLocation()
+							return false;
+						}
+						links.put(target, corpora)
+						structs.put(target, struct)
+						levels.put(target, level.toInteger())
+					} else if(localname == "linkGrp" && parser.getAttributeValue(null, "type") == "align") {
+						startAlignInfos = true;
+					} else if(localname == "tokenizer") {
+						startSAttributes = true;
+					}
+			}
+		}
+	}
+
+	public Set<String> getAlignements()
+	{
+		return links.keySet();
+	}
+
+	public ArrayList<String> getTargets(String alignement)
+	{
+		return links.get(alignement);
+	}
+
+	public String getStructure(String alignement)
+	{
+		return structs.get(alignement);
+	}
+
+	public int getLevel(String alignement)
+	{
+		return levels.get(alignement);
+	}
+
+	public void dump()
+	{
+		println "LINKS"
+		for(String link : links.keySet())
+		{
+			println link
+			println " corpus: "+links.get(link)
+			println " struct: "+structs.get(link)
+			println " level: "+levels.get(link)
+		}
+		
+		println "PROPERTIES"
+		println "metadatas $metadatas"
+		println " pattributes $pattributes"
+		println " sattributes $sattributes"
+		
+		println " biblios $biblios"
+		
+		println "uis $uis"
+		
+		println " editions $editions"
+		
+		println "HEADER"
+		println " basename $basename"
+		println " encoding $encoding"
+		println " language $language"
+		println " rootDir $rootDir"
+		println " script $script"
+		println " xslt $xslt"
+		println " author $author"
+		println " description $description"
+		println "DEBUG: $debug"
+	}
+
+	public static void main(String[] args)
+	{
+		String userhome = System.getProperty("user.home");
+		File alignfile = new File(userhome, "xml/xmltxmpara/align.xml")
+		ReadImportParameters parameters = new ReadImportParameters();
+		parameters.read(alignfile);
+		parameters.dump();
+	}
+}
+
Index: tmp/org.txm.core/src/groovy/org/txm/importer/StaxParser.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/importer/StaxParser.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/importer/StaxParser.groovy	(revision 258)
@@ -0,0 +1,166 @@
+package org.txm.importer
+
+import groovy.transform.CompileStatic
+import java.io.File;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamWriter;
+import java.io.File;
+import java.net.URL;
+import javax.xml.stream.*;
+import org.txm.importer.filters.*;
+import org.txm.importer.graal.PersonalNamespaceContext;
+
+@CompileStatic
+class StaxParser {
+
+	protected URL inputurl;
+	protected InputStream inputData;
+	protected XMLInputFactory factory;
+	protected XMLStreamReader parser;
+	
+	
+	protected static PersonalNamespaceContext Nscontext = new PersonalNamespaceContext();
+	
+	protected String localname;
+	
+	public StaxParser(File infile)
+	{
+		this(infile.toURI().toURL());
+	}
+	
+	public StaxParser(URL inputurl)
+	{
+		this.inputurl = inputurl;
+		inputData = inputurl.openStream();
+		factory = XMLInputFactory.newInstance();
+		
+		parser = factory.createXMLStreamReader(inputData);
+	}
+	
+	protected void before()
+	{
+		
+	}
+	
+	protected void after()
+	{
+		factory = null;
+		if (parser !=null) parser.close();
+		parser = null;
+	}
+	
+	protected void closeForError() {
+		parser.close();
+	}
+
+	public boolean process()
+	{
+		try {
+			for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+				switch (event) {
+					case XMLStreamConstants.NAMESPACE:
+						processNamespace();
+						break;
+					case XMLStreamConstants.START_ELEMENT:
+						localname = parser.getLocalName();
+						processStartElement();
+						break;		
+					case XMLStreamConstants.CHARACTERS:
+						processCharacters();
+						break;
+					case XMLStreamConstants.PROCESSING_INSTRUCTION:
+						processProcessingInstruction();
+						break;
+					case XMLStreamConstants.DTD:
+						processDTD();
+						break;
+					case XMLStreamConstants.CDATA:
+						processCDATA();
+						break;
+					case XMLStreamConstants.COMMENT:
+						processComment();
+						break;
+					case XMLStreamConstants.END_ELEMENT:
+						localname = parser.getLocalName();
+						processEndElement();	
+						break;
+					case XMLStreamConstants.END_DOCUMENT:
+						processEndDocument();
+						break;
+					case XMLStreamConstants.ENTITY_REFERENCE:
+						processEntityReference();
+						break;
+				}
+			}
+		} catch(Exception e) {
+			println("Unexpected error while parsing file "+inputurl+" : "+e);
+			println("Location line: "+parser.getLocation().getLineNumber()+" character: "+parser.getLocation().getColumnNumber());
+			org.txm.utils.logger.Log.printStackTrace(e);
+			parser.close();
+			return false;
+		}
+		
+		after(); // if you need to do something before closing the parser();
+		return true;
+	}
+
+	public def getLocation() {
+		if (parser != null)
+			return "Line: "+parser.getLocation().getLineNumber()+" Col: "+parser.getLocation().	getColumnNumber()
+		return null;
+	}
+	
+	protected void processNamespace() {
+	}
+	
+	protected void processStartElement()
+	{
+	}
+
+	protected void processCharacters()
+	{
+	}
+	
+	protected void processProcessingInstruction()
+	{
+	}
+	
+	protected void processDTD()
+	{
+	}
+	
+	protected void processCDATA()
+	{
+	}
+	
+	protected void processComment()
+	{
+	}
+	
+	protected void processEndElement()
+	{
+	}
+	
+	protected void processEndDocument() {
+	}
+	
+	protected void processEntityReference() {
+	}
+	
+	public static void main(String[] args)
+	{
+		File input = new File("/home/mdecorde/xml/xiinclude/master.xml")
+		File output = new File("/home/mdecorde/xml/xiinclude/merged.xml")
+		if (!(input.exists() && input.canRead())) {
+			println "cannot found $input";
+			return;
+		}
+		def builder = new StaxParser(input.toURI().toURL());
+		if (builder.process()) {
+			println "success ? "+ValidateXml.test(output);
+		} else {
+			println "failure !"
+		}
+	}
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/macro/annotation/AnnotationInjectionFilter.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/macro/annotation/AnnotationInjectionFilter.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/macro/annotation/AnnotationInjectionFilter.groovy	(revision 258)
@@ -0,0 +1,176 @@
+package org.txm.macro.annotation
+
+import javax.xml.stream.*
+
+import org.txm.importer.StaxIdentityParser
+import org.txm.importer.filters.*
+import org.txm.importer.graal.PersonalNamespaceContext
+
+/**
+ * The Class AnnotationInjection.
+ *
+ * @author mdecorde
+ *
+ * inject annotation from a stand-off file into a xml-tei-txm
+ * file
+ */
+
+public class AnnotationInjectionFilter extends StaxIdentityParser {
+
+	public static String TXMNS = "http://textometrie.org/1.0"
+
+	/** The xml reader factory. */
+	private def factory;
+
+	def xmlFile;
+	def records;
+	def properties;
+	int n = 0;
+	boolean debug = false
+
+	public AnnotationInjectionFilter() {
+		super(null, null, null);
+	}
+	
+	/**
+	 * Instantiates a new annotation injection.
+	 *
+	 * @param url the xml-tei-txm file
+	 * @param anaurl the stand-off file
+	 */
+	public AnnotationInjectionFilter(File xmlFile, def records, def properties, def debug) {
+		super(xmlFile.toURI().toURL()); // init reader and writer
+		
+		this.debug = debug
+		this.xmlFile = xmlFile
+		this.records = records
+		this.properties = properties
+		this.n = 0;
+		//println ""+records.size()+" lines to process..."
+
+		try {
+			factory = XMLInputFactory.newInstance();
+		} catch (XMLStreamException ex) {
+			System.out.println(ex);
+		} catch (IOException ex) {
+			System.out.println("IOException while parsing ");
+		}
+	}
+
+	def data; // the word id properties to add/replace
+	String newform = null
+	String wordId;
+	String anaType;
+	boolean start = false;
+	boolean replaceAnnotation = false;
+	protected void processStartElement() {
+		// this block don't write but only do tests
+		switch (localname) {
+			case "form":
+				if (start) {
+					def f = data.get("word")
+					if (f != null && f.length() > 0)
+						newform = f
+				}
+			case "w":
+				for (int i= 0 ; i < parser.getAttributeCount() ; i++ ) {
+					if (parser.getAttributeLocalName(i) == "id") {
+						wordId = parser.getAttributeValue(i);
+						data = records.get(wordId)
+						if (records.containsKey(wordId)) {
+							n++;
+							start = true; // found a word to update !
+							//println "found word $wordId"
+						}
+						break;
+					}
+				}
+				break;
+			case "ana":
+				if (start) { // found a word to update
+					for (int i= 0 ; i < parser.getAttributeCount() ; i++) { // look for the "type" attribute
+						if (parser.getAttributeLocalName(i) == "type") { 
+							anaType = parser.getAttributeValue(i);
+							anaType = anaType.substring(1)
+							//if (debug) println "type: $anaType"
+							replaceAnnotation = properties.contains(anaType) // there is a new value for this property
+							//if (replaceAnnotation) println " replace annotation $anaType"
+							break;
+						}
+					}
+				}
+				break;
+		}
+
+		super.processStartElement();
+	}
+
+	@Override
+	protected void processCharacters() {
+		if (start && replaceAnnotation) return; // don't write annotation chars if we are currently replacing
+		if (newform != null) { // don't rewrite form content
+			// we are currently in a <w> tags
+		} else {
+			super.processCharacters();
+		}
+	}
+
+	protected void processEndElement() {
+		if (start) { // write the new content of the <w> tags
+			switch (localname) {
+				case "w":
+					start = false
+					if (data.keySet().size() > 0) writer.writeCharacters("\n");
+					// write remaining properties
+					if (debug) if (data.size() > 0) println "new ana: " +data
+					for (def prop : data.keySet()) { // (1)
+						// write prop
+						writer.writeStartElement(TXMNS, "ana")
+						writer.writeAttribute("resp", "txm")
+						writer.writeAttribute("type", "#$prop")
+						writer.writeCharacters(data.get(prop))
+						writer.writeEndElement()
+						writer.writeCharacters("\n")
+						println " create annotation $prop with "+data.get(prop)
+					}
+					break;
+				case "form":
+					if (start) newform = null
+				case "ana":
+					if (replaceAnnotation) {
+						writer.writeCharacters(data.get(anaType))
+						if (debug) println " replace annotation $anaType content with "+data.get(anaType)
+						data.remove(anaType) // the anaType is removed because it is now written. I don't need to write it here (1)
+					}
+					anaType = ""
+					replaceAnnotation = false;
+					break;
+			}
+		}
+		super.processEndElement();
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args) {
+
+		File xmlFile = new File("/home/mdecorde/TEMP/annotation/01_DeGaulle.xml")
+		def properties = ["p1", "lemma"]
+		def records = [
+			"w_1":["p1":"a", "lemma":"b"],
+			"w_224":["p1":"c", "lemma":"d"],
+			"w_400":["p1":"e", "lemma":"f"],
+			"w_750":["p1":"g", "lemma":"h"],
+			"w_753":["p1":"i", "lemma":"j"],
+			"w_756":["p1":"k", "lemma":"l"]
+		]
+
+		def builder = new AnnotationInjectionFilter(xmlFile, records, properties);
+		builder.process(new File("/home/mdecorde/TEMP", "rez.xml"));
+
+		return;
+	}
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/macro/annotation/InjectWordPropTableMacro.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/macro/annotation/InjectWordPropTableMacro.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/macro/annotation/InjectWordPropTableMacro.groovy	(revision 258)
@@ -0,0 +1,102 @@
+package org.txm.macro.annotation;
+
+import org.txm.utils.*
+import org.txm.utils.io.FileCopy;
+
+import java.nio.charset.Charset
+
+import org.kohsuke.args4j.*
+
+import groovy.transform.Field
+
+import org.txm.rcpapplication.swt.widget.parameters.*
+
+@Field @Option(name="inputDirectory", usage="The XML-TXM folder", widget="Folder", required=true, def="")
+def inputDirectory = new File(System.getProperty("user.home"), "xml/anapovoas/HELPTXM-02-131124/ite02")
+
+@Field @Option(name="outputDirectory", usage="The result folder", widget="Folder", required=true, def="")
+def outputDirectory = new File(System.getProperty("user.home"), "xml/anapovoas/HELPTXM-02-131124/ite03")
+
+@Field @Option(name="tsvFile", usage="The annotation TSV file", widget="File", required=true, def="")
+def tsvFile = new File(System.getProperty("user.home"), "xml/anapovoas/HELPTXM-02-131124/TSV-ITE02.csv")
+
+@Field @Option(name="properties", usage="columns to inject separated by commas", widget="String", required=true, def="p1, p2, ... , pn")
+def properties = "verificado"
+
+@Field @Option(name="debug", usage="Debug de the macro", widget="Boolean", required=true, def="false")
+def debug = true
+
+if (!ParametersDialog.open(this)) return;
+
+def split = properties.split(",")
+if (split.length == 0) {
+	println "ERROR: no property given"
+	return false
+}
+properties = []
+for (def p : split) properties << p.trim()
+
+println "Injecting annotations with the following parameters:"
+println "- inputDirectory: $inputDirectory"
+println "- outputDirectory: $outputDirectory"
+println "- tsvFile: $tsvFile"
+println "- properties: $properties"
+
+outputDirectory.mkdir()
+if (!outputDirectory.exists()) {
+	println "ERROR: could not create or read $outputDirectory directory"
+	return false
+}
+
+CsvReader records = new CsvReader(tsvFile.getAbsolutePath(), "\t".charAt(0), Charset.forName("UTF-8"))
+records.setTextQualifier((char)0)
+records.readHeaders();
+
+def header = Arrays.asList(records.getHeaders())
+if (debug) println "CSV header: $header"
+for (def s : properties) if (!header.contains(s)) {
+	println "Missing annotation property : $s"
+	return;
+}
+for (def s : ["text_id", "id"]) if (!header.contains(s)) {
+	println "Missing annotation property : $s"
+	return;
+}
+
+def injections = [:]
+int no = 1;
+while (records.readRecord()) {
+	String textid = records.get("text_id")
+	if (!injections.containsKey(textid)) injections[textid] = [:]
+	
+	def props = [:]
+	for (def s : properties) props[s] = records.get(s)
+	if (records.get("id") == "") {
+		 print "ERROR in record "+no
+	} else {
+		injections[textid][records.get("id")] = props
+	}
+	no++;
+}
+
+println "Injecting..."
+//for (String textid : injections.keySet()) {
+for (File currentXMLFile : inputDirectory.listFiles()) {
+	String textid = currentXMLFile.getName();
+	int idx = textid.indexOf(".")
+	if (idx > 0) textid = textid.substring(0, idx);
+	
+	if (injections.containsKey(textid)) {	
+		if (debug) println "Injections of "+injections[textid].size()+" lines."
+		
+		def builder = new AnnotationInjectionFilter(currentXMLFile, injections[textid], properties, debug)
+		println "injecting in $currentXMLFile $properties"
+		builder.process(new File(outputDirectory, currentXMLFile.getName()));
+		println ""+builder.n+" lines injected."
+	} else {
+		println "copying file $currentXMLFile"
+		FileCopy.copy(currentXMLFile, new File(outputDirectory, currentXMLFile.getName()))
+	}
+}
+
+println "New XML-TXM files are saved in ${outputDirectory}."
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/macro/annotation/BuildWordPropTableMacro.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/macro/annotation/BuildWordPropTableMacro.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/macro/annotation/BuildWordPropTableMacro.groovy	(revision 258)
@@ -0,0 +1,179 @@
+// 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
+// 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.
+//
+//
+// $LastChangedDate: 2012-10-15 17:35:36 +0200 (lun., 15 oct. 2012) $
+// $LastChangedRevision: 2279 $
+// $LastChangedBy: mdecorde $
+//
+package org.txm.macro.annotation
+
+import org.txm.Toolbox
+import org.txm.searchengine.cqp.corpus.*
+import org.txm.searchengine.cqp.corpus.query.*
+import org.txm.functions.concordances.*
+import org.txm.functions.concordances.comparators.*
+import org.txm.functions.ReferencePattern
+import org.kohsuke.args4j.*
+import groovy.transform.Field
+import org.txm.rcpapplication.swt.widget.parameters.*
+
+def corpus = corpusViewSelection
+if (!(corpus instanceof Corpus)) {
+	println "Error: you must select a corpus or a subcorpus to export properties"
+	return false;
+}
+
+@Field @Option(name="properties", usage="columns to inject separated by commas", widget="String", required=true, def="p1, p2, ... , pn")
+		def properties = "pos"
+
+@Field @Option(name="query", usage="The query to select words to annotate", widget="Query", required=true, def="[]")
+		def query
+
+@Field @Option(name="leftcontextsize", usage="The context sizes", widget="Integer", required=true, def="10")
+		def leftcontextsize = 10
+
+@Field @Option(name="rightcontextsize", usage="The context sizes", widget="Integer", required=true, def="10")
+		def rightcontextsize = 10
+
+@Field @Option(name="references", usage="references to show", widget="String", required=true, def="text_id")
+		def references = "text_id, p_id, s_id"
+
+@Field @Option(name="tsvFile", usage="The result TSV file", widget="File", required=true, def="export.tsv")
+		def tsvFile
+
+if (!ParametersDialog.open(this)) return;
+
+def split = properties.split(",")
+if (split.length == 0) {
+	println "ERROR: no property given"
+	return false
+}
+properties = []
+for (def p : split) properties << p.trim()
+
+println "Building Annotation Table with the following parameters: "
+println "- corpus: $corpus"
+println "- query: $query"
+println "- annotation properties: $properties"
+println "- TSV file: $tsvFile"
+
+
+if (!tsvFile.getParentFile().canWrite()) {
+	println "Error: "+tsvFile.getParentFile()+" is not writable."
+	return;
+}
+
+def annots = []
+for (def p : properties) {
+	def prop = corpus.getProperty(p)
+	if (prop == null) {
+		println "No such property $p in the $corpus corpus"
+		return false;
+	}
+	annots << prop
+}
+def id = corpus.getProperty("id")
+def word = corpus.getProperty("word")
+def text = corpus.getStructuralUnit("text")
+def text_id = text.getProperty("id")
+def refs = references.split(",")
+
+if (annots == null || annots.size() == 0) {
+	println "No such property given"//$annots in the $corpus corpus"
+	return false;
+}
+
+println "Exporting ..."
+def start = System.currentTimeMillis()
+
+// define the references pattern for each concordance line
+def referencePattern = new ReferencePattern()
+referencePattern.addProperty(text_id)
+referencePattern.addProperty(id)
+for (def annot : annots) referencePattern.addProperty(annot)
+
+def refProperties = []
+for (def ref : refs) {
+	ref = ref.trim()
+	try {
+		if (ref.contains("_")) {
+			def split2 = ref.split("_",2)
+			def refp = corpus.getStructuralUnit(split2[0].trim()).getProperty(split2[1].trim())
+			if (ref != "text_id")
+				referencePattern.addProperty(refp)
+			refProperties << refp
+		} else {
+			def p = corpus.getProperty(ref)
+			if (p != null) referencePattern.addProperty(p)
+		}
+	} catch(Exception e) { println "Error while parsing references: "+ref+" "+e}
+}
+
+// compute the concordance with contexts of 15 words on each side of the keyword
+//query = new Query(Query.fixQuery(query))
+def viewprops = [word]
+viewprops.addAll(annots)
+def concordance = new Concordance(corpus, query, word, viewprops, referencePattern, referencePattern, leftcontextsize, rightcontextsize)
+
+//println "Conc done "+(System.currentTimeMillis()-start)
+
+def writer = tsvFile.newWriter("UTF-8");
+
+//println "Writing lines..."
+start = System.currentTimeMillis()
+String annotHeader = ""
+for (def annot : annots) annotHeader += "\t$annot"
+writer.write("N"+"\t"+"Références"+"\t"+"ContexteGauche"+"\t"+"Pivot"+annotHeader+"\t"+"ContexteDroit"+"\t"+"id"+"\t"+"text_id\n")
+
+// define which occurrence properties will be displayed
+concordance.setViewProperties([word])
+int NLines = concordance.getNLines();
+int chunk = 1000;
+for (int i = 0 ; i < concordance.getNLines() ; i += chunk) {
+	List<Line> lines
+	if (i+chunk > NLines)
+		lines = concordance.getLines(i, concordance.getNLines()-1)
+	else
+		lines = concordance.getLines(i, i+chunk-1) // e.g. from 0 to 999
+
+	int n = 1
+	for (Line l : lines) {
+		String ntext = l.getViewRef().getValue(text_id)
+		String lcontext = l.leftContextToString()
+		String pivot = l.keywordToString()
+		String rcontext = l.rightContextToString()
+		String ids = l.getViewRef().getValue(id)
+		String refValue = "";
+		for (def refp : refProperties) refValue += " "+l.getViewRef().getValue(refp)
+
+		String poss = "";
+		for (def annot : annots) {
+			poss += "\t"+l.getViewRef().getValue(annot)
+		}
+
+		//println l.getKeywordsViewProperties().get(pos)
+		writer.write(""+(l.getKeywordPosition())+"\t"+refValue+"\t"+lcontext+"\t"+pivot+poss+"\t"+rcontext+"\t"+ids+"\t"+ntext+"\n")
+	}
+	writer.flush()
+}
+println "Saved in "+tsvFile.getAbsolutePath()
+writer.close()
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/macro/csv/CSV2XMLMacro.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/macro/csv/CSV2XMLMacro.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/macro/csv/CSV2XMLMacro.groovy	(revision 258)
@@ -0,0 +1,113 @@
+package org.txm.macro.csv
+
+import org.kohsuke.args4j.*
+import groovy.transform.Field
+import java.nio.charset.Charset
+import org.txm.rcpapplication.swt.widget.parameters.*
+import org.txm.utils.*
+import javax.xml.stream.*
+import java.net.URL
+
+@Field @Option(name="inputFile", usage="CSV File", widget="File", required=false, def="file.csv")
+File inputFile;
+
+@Field @Option(name="columnSeparator", usage="column columnSeparator", widget="String", required=false, def="\t")
+def columnSeparator;
+
+@Field @Option(name="characterEncoding", usage="File characterEncoding", widget="String", required=false, def="UTF-8")
+def characterEncoding;
+
+@Field @Option(name="rootTag", usage="Root tag name", widget="String", required=false, def="root")
+def rootTag;
+
+@Field @Option(name="textTag", usage="Text tag name", widget="String", required=false, def="unit")
+def textTag;
+
+@Field @Option(name="metadataColumnList", usage="metadataColumnList column list separated with comma", widget="String", required=false, def="meta1,meta2")
+def metadataColumnList;
+
+@Field @Option(name="textColumnList", usage="textColumnList column list separated with comma", widget="String", required=false, def="textColumnList1,textColumnList2")
+def textColumnList;
+
+if (!ParametersDialog.open(this)) return;
+
+metadataColumnList = metadataColumnList.split(",")
+textColumnList = textColumnList.split(",")
+textTag = textTag.trim()
+rootTag = rootTag.trim()
+
+
+
+CsvReader reader = new CsvReader(inputFile.getAbsolutePath(), columnSeparator.charAt(0), Charset.forName(characterEncoding));
+if (!reader.readHeaders()) {
+	println "Error: no header"
+	return
+}
+def headers = Arrays.asList(reader.getHeaders()) 
+
+println "root tag: $rootTag"
+println "textColumnList tag: $textTag"
+println "columns: $headers"
+println "metadataColumnList columns: $metadataColumnList"
+println "textColumnList columns: $textColumnList"
+
+def ok = true
+for (String m : metadataColumnList) {
+	m = m.trim()
+	if (!headers.contains(m)) {
+		println "Error: missing metadataColumnList column: $m"
+		ok = false
+	}
+}
+for (String t : textColumnList) {
+	t = t.trim()
+	if (!headers.contains(t)) {
+		println "Error: missing textColumnList column: $t"
+	}
+}
+
+if (!ok) { return; }
+
+String name = inputFile.getName()
+int idx = name.indexOf(".")
+if (idx > 0) name = name.substring(0, idx)
+File outputfile = new File(inputFile.getParentFile(), name+".xml")
+XMLOutputFactory factory = XMLOutputFactory.newInstance()
+FileOutputStream output = new FileOutputStream(outputfile)
+XMLStreamWriter writer = factory.createXMLStreamWriter(output, "UTF-8")
+
+writer.writeStartDocument("UTF-8","1.0")
+writer.writeCharacters("\n") // simple XML formating
+writer.writeStartElement(rootTag)
+
+int pb_n = 1;
+while (reader.readRecord()) {
+	
+	writer.writeCharacters("\n") // simple XML formating
+	
+	writer.writeEmptyElement("pb") // <pb/>
+	writer.writeAttribute("n", ""+pb_n++)
+	
+	writer.writeCharacters("\n") // simple XML formating
+	
+	writer.writeStartElement(textTag)
+	
+	for (String m : metadataColumnList) {
+		m = m.trim()
+		writer.writeAttribute(m, reader.get(m))
+	}
+	
+	for (String t : textColumnList) {
+		t = t.trim()
+		writer.writeStartElement(t)
+		writer.writeCharacters(reader.get(t)) // get textColumnList content
+		writer.writeEndElement() // t
+	}
+	
+	writer.writeEndElement() // textTag
+}
+
+writer.writeEndElement() // rootTag
+writer.close()
+output.close()
+reader.close()
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/macro/edition/RemoveTag.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/macro/edition/RemoveTag.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/macro/edition/RemoveTag.groovy	(revision 258)
@@ -0,0 +1,135 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+package org.txm.macro.edition;
+
+import javax.xml.parsers.*
+import javax.xml.transform.*
+import javax.xml.transform.dom.DOMSource
+import javax.xml.transform.stream.StreamResult
+import javax.xml.xpath.*
+
+import org.txm.metadatas.*
+import org.txm.utils.*
+import org.w3c.dom.Document
+import org.w3c.dom.Element
+
+/**
+ * Removes tags of XML file given a XPath. 
+ * @author mdecorde
+ *
+ */
+public class RemoveTag {
+	File outfile
+	String xpath
+	Document doc
+	
+	public RemoveTag(def root, def outfile, def xpath)
+	{
+		this.doc = root
+		this.outfile = outfile
+		this.xpath = xpath
+		
+		process()
+	}
+	
+	/**
+	 *
+	 * @param xmlfile the xmlfile
+	 * @param outfile the outfile
+	 * @param xpath the XPath
+	 */
+	public RemoveTag(File xmlfile, File outfile, String xpath)
+	{
+		this.outfile = outfile
+		this.xpath = xpath
+		
+		DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
+		domFactory.setNamespaceAware(true); // never forget this!
+		DocumentBuilder builder = domFactory.newDocumentBuilder();
+		this.doc = builder.parse(xmlfile);
+		
+		process()
+	}
+	
+	private void process() {
+		def expr = XPathFactory.newInstance().newXPath().compile(xpath);
+		def nodes = expr.evaluate(doc, XPathConstants.NODESET);
+		
+		if (nodes != null)
+		for(def node : nodes)
+		{
+			//println "Remove node "+node
+			Element elem = (Element)node;
+			elem.getParentNode().removeChild(node);
+		}
+		save()
+		doc = null
+	}
+	
+	/**
+	 * Save.
+	 *
+	 * @return true, if successful
+	 */
+	private boolean save()
+	{
+		if (outfile == null) return true;
+	
+		try {
+			// Création de la source DOM
+			Source source = new DOMSource(doc);
+			
+			// Création du fichier de sortie
+				Writer writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outfile), "UTF-8")); 
+			Result resultat = new StreamResult(writer);
+			
+			// Configuration du transformer
+			TransformerFactory fabrique = new net.sf.saxon.TransformerFactoryImpl();
+			Transformer transformer = fabrique.newTransformer();
+			transformer.setOutputProperty(OutputKeys.METHOD, "xml");
+			transformer.setOutputProperty(OutputKeys.INDENT, "yes"); 
+			transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); 
+			
+			// Transformation
+			transformer.transform(source, resultat);
+			writer.close();
+			return true;
+		} catch (Exception e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+			return false;
+		}
+	}
+	
+	public static void main(String[] args) {
+		RemoveTag rt = new RemoveTag(
+			new File("/home/mdecorde/TXM/corpora/graal/import.xml"),
+			new File("/home/mdecorde/TXM/corpora/graal/import-o.xml"),
+			"//edition[@name='courante']"
+			)
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/macro/edition/AddFacsAttributeMacro.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/macro/edition/AddFacsAttributeMacro.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/macro/edition/AddFacsAttributeMacro.groovy	(revision 258)
@@ -0,0 +1,90 @@
+package org.txm.macro.edition
+
+import org.kohsuke.args4j.*
+import groovy.transform.Field
+import org.txm.rcpapplication.swt.widget.parameters.*
+
+try { println "ARGS=$args";} catch(Exception e) {args = [:]}
+
+// BEGINNING OF PARAMETERS
+@Field @Option(name="sourceDirectory", usage="Directory containig XML-TXM or XML SRC files", widget="Folder", required=true, def="src")
+def sourceDirectory
+
+@Field @Option(name="imageDirectory", usage="directory containing the ordered images files in subdirectories", widget="Folder", required=true, def="img")
+def imageDirectory
+
+@Field @Option(name="outputDirectory", usage="Output directory", widget="Folder", required=true, def="out")
+def outputDirectory
+
+@Field @Option(name="element", usage="The element to upgrade", widget="String", required=true, def="pb")
+def element
+
+@Field @Option(name="attribute", usage="The attribute to add", widget="String", required=true, def="facs")
+def attribute
+
+@Field @Option(name="prefix", usage="The image path prefix, if empty then the absolute file path is used", widget="String", required=true, def="../img/")
+def prefix
+
+// Open the parameters input dialog box
+if (args.size() == 0) {
+	if (!ParametersDialog.open(this)) return;
+} else {
+	monitor = args["monitor"];
+	sourceDirectory = args["sourceDirectory"]
+	imageDirectory = args["imageDirectory"]
+	outputDirectory = args["outputDirectory"]
+	element = args["element"]
+	attribute = args["attribute"]
+	prefix = args["prefix"]
+}
+// END OF PARAMETERS
+
+println "Parameters: "
+println " sourceDirectory: $sourceDirectory"
+println " imageDirectory: $imageDirectory"
+println " outputDirectory: $outputDirectory"
+println " element: $element"
+println " attribute: $attribute"
+
+assert(sourceDirectory.exists())
+assert(imageDirectory.exists())
+
+outputDirectory.deleteDir()
+outputDirectory.mkdir()
+
+if (!outputDirectory.exists()) {
+	println "Error: failed to create $outputDirectory"
+	return;
+}
+
+def srcFiles = []
+sourceDirectory.eachFile() { file ->
+	if (!file.isDirectory() && !file.isHidden() && file.getName().endsWith(".xml") && file.getName() != "import.xml") srcFiles << file
+}
+println "srcFiles=$srcFiles"
+
+for (def subdir : imageDirectory.listFiles()) {
+	if (!subdir.isDirectory()) continue;
+	
+	String name = subdir.getName();
+	File srcFile = new File(sourceDirectory, name+".xml")
+	if (!srcFile.exists()) { println "Warning: missing source file: $srcFile"; continue }
+	
+	def imgFiles = subdir.listFiles().sort()
+	if (imgFiles.size() == 0) { println "Warning: no image in $subdir"; continue }
+	
+	def imgPaths = []
+	for (def img : imgFiles) {
+		if (img.isFile() && !img.isHidden()) {
+			if (prefix != null && prefix.length() > 0)
+				imgPaths << prefix+name+"/"+img.getName()
+			else
+				imgPaths << img.getAbsolutePath()
+		}
+	}
+	
+	println "Processing '$name' directory with "+imgPaths.size()+" images."
+	
+	AddAttributeValuesInXML builder = new AddAttributeValuesInXML(srcFile, element, attribute, imgPaths);
+	builder.process(new File(outputDirectory, srcFile.getName()));
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/macro/edition/BuildFacsEditions.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/macro/edition/BuildFacsEditions.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/macro/edition/BuildFacsEditions.groovy	(revision 258)
@@ -0,0 +1,166 @@
+package org.txm.macro.edition
+
+import org.txm.importer.*
+import org.xml.sax.Attributes
+import org.txm.importer.filters.*
+import java.util.ArrayList
+import javax.xml.parsers.*
+import javax.xml.stream.*
+import java.net.URL
+import org.xml.sax.InputSource
+import org.xml.sax.helpers.DefaultHandler
+
+class BuildFacsEditions {
+
+	private def url
+	private def inputData
+	private def factory
+	private XMLStreamReader parser
+	OutputStreamWriter writer
+	StaxStackWriter pagedWriter = null
+
+	File editionDir
+	File xmlFile
+	File htmlFile
+	def pages = []
+	def tag, attribute, txtname, corpusname
+	boolean firstWord
+	boolean cutBefore = true;
+	boolean debug = false;
+	
+	public BuildFacsEditions(File xmlFile, File editionDir, String corpusname, String txtname, String tag, String attribute, boolean debug) {
+		inputData = xmlFile.toURI().toURL().openStream()
+		factory = XMLInputFactory.newInstance()
+		parser = factory.createXMLStreamReader(inputData)
+		
+		this.xmlFile = xmlFile
+		this.editionDir = editionDir
+		this.tag = tag
+		this.attribute = attribute
+		this.txtname = txtname
+		this.debug = debug
+	}
+	
+	int n = 1;
+	private boolean createNextOutput()
+	{
+		try {
+			def tags = closeMultiWriter();
+			for (int i = 0 ; i < tags.size() ; i++) {
+				String tag = tags[i]
+				if ("body" != tag) {
+					tags.remove(i--)
+				} else {
+					tags.remove(i--) // remove "body"
+					break; // remove elements until "body tag
+				}
+			}
+			if (wordid != null) {//wordid = "w_0";
+				//println " add page $n $wordid, page=$pages"
+				pages << ["$n", wordid]
+				n++
+			}
+			// Page suivante
+			
+			htmlFile = new File(editionDir, "${txtname}_${n}.html")
+			firstWord = true
+	//println "SET FIRST WORD=true"
+			pagedWriter = new StaxStackWriter(htmlFile, "UTF-8");
+			if (debug) println "Create file $htmlFile"
+			pagedWriter.writeStartDocument("UTF-8", "1.0")
+			pagedWriter.writeStartElement("html");
+			pagedWriter.writeEmptyElement("meta", ["http-equiv":"Content-Type", "content":"text/html","charset":"UTF-8"]);
+			pagedWriter.writeEmptyElement("link", ["rel":"stylesheet", "type":"text/css","href":"txm.css"]);
+			pagedWriter.writeEmptyElement("link", ["rel":"stylesheet", "type":"text/css","href":"${corpusname}.css"]);
+			pagedWriter.writeStartElement("head");
+			pagedWriter.writeStartElement("title")
+			pagedWriter.writeCharacters(corpusname+" Edition - Page "+n)
+			pagedWriter.writeEndElement(); // </title>
+			pagedWriter.writeEndElement() // </head>
+			pagedWriter.writeStartElement("body") //<body>
+
+			pagedWriter.writeStartElements(tags);
+			
+			wordid = "w_0"; // default value if no word is found
+			return true;
+		} catch (Exception e) {
+			System.out.println(e.getLocalizedMessage());
+			return false;
+		}
+	}
+	
+	private def closeMultiWriter()
+	{
+		if (pagedWriter != null) {
+			def tags = pagedWriter.getTagStack().clone();
+
+			if (firstWord) { // there was no words
+				pagedWriter.writeCharacters("");
+				pagedWriter.write("<span id=\"w_0\"/>");
+			}
+			pagedWriter.writeEndElements();
+			pagedWriter.close();
+			return tags;
+		} else {
+			return [];
+		}
+	}
+	
+	private writeImg(String src) {
+		pagedWriter.writeStartElement("div");
+		pagedWriter.writeEmptyElement("img", ["src":src, "width":"100%"]);
+		pagedWriter.writeEndElement(); // </div>
+	}
+	
+	String wordid = null;
+	public def process() {
+		
+		boolean start = false
+		String localname
+		
+		createNextOutput();
+		
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+			switch (event) {
+				case XMLStreamConstants.START_ELEMENT:
+					localname = parser.getLocalName();
+					switch (localname) {
+						case "text":
+							start = true
+						break;
+						case "w":
+							if (firstWord) {
+								wordid = parser.getAttributeValue(null, "id");
+								//println "found word: $wordid"
+								firstWord = false;
+							}
+						break;
+						case tag:
+							if (debug) println "** TAG $tag $attribute : "+parser.getAttributeValue(null, "id");
+							String imgPath = parser.getAttributeValue(null, attribute);
+							if (imgPath == null) {
+								println "ERROR in $xmlFile no value found for $tag@$attribute at location "+parser.getLocation().getLineNumber()
+							} else {
+								if (cutBefore) {
+									if (debug) println " cut before"
+									createNextOutput()
+									if (debug) println " write img $imgPath"
+									writeImg(imgPath)
+								} else {
+									if (debug) println " write img $imgPath"
+									writeImg(imgPath)
+									if (debug) println " cut after"
+									createNextOutput()
+								}
+							}
+							//firstWord = true;
+						break;
+					}
+				break;
+			}
+		}
+		closeMultiWriter()
+		pages << ["$n", wordid] // add the last page (no pb encountered
+		return pages
+	}
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/macro/edition/FacsEditionBuilderMacro.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/macro/edition/FacsEditionBuilderMacro.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/macro/edition/FacsEditionBuilderMacro.groovy	(revision 258)
@@ -0,0 +1,206 @@
+package org.txm.macro.edition
+
+// STANDARD DECLARATIONS
+
+import groovy.transform.Field
+
+import javax.xml.parsers.*
+import javax.xml.transform.*
+import javax.xml.transform.dom.DOMSource
+import javax.xml.transform.stream.StreamResult
+
+import org.kohsuke.args4j.*
+import org.txm.Toolbox
+import org.txm.objects.*
+import org.txm.rcpapplication.commands.*
+import org.txm.rcpapplication.swt.widget.parameters.*
+import org.txm.searchengine.cqp.corpus.*
+import org.txm.utils.xml.DomUtils
+import org.w3c.dom.*
+
+
+try { println "ARGS=$args";} catch(Exception e) {args = [:]}
+
+def corpus = null
+if (args.size() == 0) {
+	if (!(corpusViewSelection instanceof MainCorpus)) {
+		println "This marcro works with a MainCorpus selection. Aborting"
+		return;
+	}
+	println "Working on $corpusViewSelection corpus"
+	corpus = corpusViewSelection
+} else {
+	monitor = args["monitor"];
+}
+
+// BEGINNING OF PARAMETERS
+@Field @Option(name="editionName", usage="the edition name to create", widget="String", required=true, def="facs")
+def editionName
+
+@Field @Option(name="tag", usage="The tag to upgrade", widget="String", required=true, def="pb")
+def tag
+
+@Field @Option(name="attribute", usage="The attribute to add", widget="String", required=true, def="facs")
+def attribute
+
+@Field @Option(name="debug", usage="Debug mode", widget="Boolean", required=false, def="true")
+def debug = false
+
+// END OF params
+if (args.size() == 0) {
+	if (!ParametersDialog.open(this)) return;
+} else {
+	monitor = args["monitor"];
+	attribute = args["attribute"]
+	tag = args["tag"]
+	editionName = args["editionName"]
+}
+
+if (args.size() == 0) { // the "corpus" variable exists
+	binDirectory = corpus.getBase().getBaseDirectory()
+	txmDirectory = new File(binDirectory, "txm/"+corpus.getName().toUpperCase())
+	tokenizedDirectory = new File(binDirectory, "tokenized")
+	HTMLDirectory = new File(binDirectory, "HTML")
+	newEditionDirectory = new File(HTMLDirectory, corpus.getName().toUpperCase()+"/"+editionName)
+	params = corpus.getBase().params
+} else { // the "corpus" variable does not exist, get informations from the "args" map
+	binDirectory = args["binDirectory"]
+	txmDirectory = args["txmDirectory"]
+	params = args["params"]
+	tokenizedDirectory = new File(binDirectory, "tokenized")
+	HTMLDirectory = new File(binDirectory, "HTML")
+	corpusName = params.getCorpusName()
+	newEditionDirectory = new File(HTMLDirectory, corpusName.toUpperCase()+"/"+editionName)
+}
+
+println "Parameters:"
+println "	attribute = $attribute"
+println "	tag =  $tag"
+println "	editionName =  $editionName"
+
+if (!HTMLDirectory.exists()) {
+	println "ERROR: can't find this corpus 'HTML' directory: $HTMLDirectory. Aborting"
+	return false;
+}
+
+File workDirectory = txmDirectory
+if (!workDirectory.exists()) {
+	println "XML-TXM directory ($txmDirectory) not found. Using XML tokenized directory instead: "+tokenizedDirectory
+	workDirectory = tokenizedDirectory
+}
+if (!workDirectory.exists()) {
+	println "XML tokenized directory not found: "+tokenizedDirectory
+	println "Aborting."
+	return false
+}
+
+println "Working directory=$workDirectory"
+
+//0- clean previous edition if any : html files, import.xml
+if (newEditionDirectory.exists()) {
+	println "** Old version of $editionName edition found."
+	println " removing the 'edition' reference from the corpus configuration."
+	File tempParam = new File(binDirectory, "import.xml.cpy")
+	RemoveTag rt = new RemoveTag(
+			params.root.getOwnerDocument(), // will be updated
+			null, // don't create a new import.xml
+			"//edition[@name='$editionName']"
+			)
+	println " delete $newEditionDirectory"
+	newEditionDirectory.deleteDir()
+	
+	//printDOM(params.root.getOwnerDocument())
+}
+
+//2- fix import.xml
+println "** Updating corpus configuration..."
+// for edition list
+def corpusElem = params.getCorpusElement()
+params.addEditionDefinition(corpusElem, editionName, "groovy", "FacsEditionBuilderMacro");
+
+//1- create HTML files
+println "** Building new edition HTML files..."
+
+println " Creating edition '$editionName' directory: '$newEditionDirectory'"
+newEditionDirectory.mkdir()
+for (def xmlFile : workDirectory.listFiles()) {
+	if (xmlFile.isHidden() || xmlFile.isDirectory()) continue // ignore
+	String txtname = xmlFile.getName()
+	int idx = txtname.indexOf(".")
+	if (idx > 0) txtname = txtname.substring(0,idx)
+
+	// create a page per "pb" element found in the xml-txm file
+	println " Building HTML pages of text=$txtname"
+	BuildFacsEditions builder = new BuildFacsEditions(xmlFile, newEditionDirectory, params.name, txtname, tag, attribute, debug);
+	def newPages = builder.process()
+	if (newPages == null || newPages.size() == 0) {
+		println "WARNING: no edition files created with $xmlFile"
+	}
+		
+	println " Building edition references in corpus configuration"
+	
+	Element corpusElement = params.getCorpusElement();
+	//println "corpusElement $corpusElement"
+	Element textsElem = params.getTextsElement(corpusElement);
+	//println "textsElem $textsElem"
+	Element textElem = params.getTextElement(textsElem, txtname);
+	if (textElem == null) { // just in case
+		textElem = params.addText(textsElem, txtname, xmlFile)
+	}
+	//println "textElem $textElem with txtname=$txtname"
+	Element editionElem = params.addEdition(textElem, editionName, newEditionDirectory.getAbsolutePath(), "html"); // add a new edition to the "text" node
+	for (def pagedef : newPages) {
+		params.addPage(editionElem, pagedef[0], pagedef[1]);
+	}
+}
+
+//printDOM(params.root.getOwnerDocument())
+
+//3- Save and reload the corpus
+println " Saving corpus configuration..."
+File paramFile = new File(binDirectory, "import.xml");
+DomUtils.save(params.root.getOwnerDocument(), paramFile);
+
+
+//4- Reload Corpora
+if (args.size() == 0) {
+	Toolbox.restart();
+	monitor.syncExec(new Runnable() {
+				public void run() {
+					RestartTXM.reloadViews();
+				}
+			});
+}
+
+//5- Done
+println "New edition created."
+
+//printDOM(params.root.getOwnerDocument())
+
+
+
+def printDOM(def doc) {
+	if (!debug) return;
+	try {
+		// Création de la source DOM
+		Source source = new DOMSource(doc);
+		
+		// Création du fichier de sortie
+		StreamResult resultat = new StreamResult(new PrintWriter(System.out));
+		
+		// Configuration du transformer
+		TransformerFactory fabrique = new net.sf.saxon.TransformerFactoryImpl();
+		Transformer transformer = fabrique.newTransformer();
+		transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$
+		transformer.setOutputProperty(OutputKeys.INDENT, "yes");  //$NON-NLS-1$
+		transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");  //$NON-NLS-1$
+		
+		// Transformation
+		transformer.transform(source, resultat);
+		// writer.close();
+		return true;
+	} catch (Exception e) {
+		e.printStackTrace();
+		return false;
+	}
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/macro/edition/EditionUpdaterMacro.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/macro/edition/EditionUpdaterMacro.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/macro/edition/EditionUpdaterMacro.groovy	(revision 258)
@@ -0,0 +1,259 @@
+package org.txm.macro.edition
+// STANDARD DECLARATIONS
+
+import groovy.transform.Field
+
+import javax.xml.parsers.*
+import javax.xml.transform.*
+
+import org.kohsuke.args4j.*
+import org.txm.Toolbox
+import org.txm.importer.*
+import org.txm.objects.*
+import org.txm.rcpapplication.commands.*
+import org.txm.rcpapplication.swt.widget.parameters.*
+import org.txm.searchengine.cqp.corpus.*
+import org.txm.utils.io.FileCopy;
+import org.w3c.dom.*
+
+try { println "ARGS=$args";} catch(Exception e) {args = [:]}
+
+def corpus = null
+if (args.size() == 0) {
+	if (!(corpusViewSelection instanceof MainCorpus)) {
+		println "This marcro works with a MainCorpus selection. Aborting"
+		return;
+	}
+	println "Working on $corpusViewSelection corpus"
+	corpus = corpusViewSelection
+} else {
+	monitor = args["monitor"];
+}
+
+// BEGINNING OF params
+
+@Field @Option(name="xslEdition", usage="XSL to build the HTML edition - if empty uses 'txm-edition-xtz.xsl'", widget="File", required=false, def="txm-edition-xtz.xsl")
+def xslEdition
+
+@Field @Option(name="xslPages", usage="XSL to build the edition pages - if empty uses 'txm-edition-page-split.xsl'", widget="File", required=false, def="txm-edition-page-split.xsl")
+def xslPages
+
+@Field @Option(name="editionName", usage="The edition name to produce", widget="String", required=false, def="default")
+String editionName
+
+@Field @Option(name="useTokenizedDirectory", usage="Use the 'XML/w' of the 'tokenized' directory instead of the 'XML-TXM' files", widget="Boolean", required=false, def="false")
+def useTokenizedDirectory = false
+
+@Field @Option(name="debug", usage="Enable debug mode: temporary files are not deleted", widget="Boolean", required=false, def="false")
+def debug = false
+
+// END OF params
+if (args.size() == 0) {
+	if (!ParametersDialog.open(this)) return;
+} else {
+	monitor = args["monitor"];
+	xslEdition = new File(args["xslEdition"])
+	xslPages = new File(args["xslPages"])
+	editionName = args["editionName"]
+	useTokenizedDirectory = args["useTokenizedDirectory"]
+}
+
+if (args.size() == 0) { // corpus informations
+	defaultEditionName = corpus.getDefaultEdition()
+	corpusName = corpus.getName()
+	binDirectory = corpus.getBase().getBaseDirectory()
+	txmDirectory = new File(binDirectory, "txm/"+corpusName.toUpperCase())
+	params = corpus.getBase().params
+} else { // the "corpus" variable does not exists
+	defaultEditionName = "default"
+	binDirectory = args["binDirectory"]
+	txmDirectory = args["txmDirectory"]
+	params = args["params"]
+	corpusName = params.getCorpusName()
+}
+
+if (editionName == null || editionName.length() == 0) {
+	editionName = defaultEditionName
+}
+println "Parameters:"
+println "	xslEdition = $xslEdition"
+println "	xslPages = $xslPages"
+println "	editionName = $editionName"
+println "	useTokenizedDirectory = $useTokenizedDirectory"
+
+File TXMHOME = new File(Toolbox.getParam(Toolbox.USER_TXM_HOME))
+File xslDirectory = new File(TXMHOME, "xsl")
+if (xslEdition == null || xslEdition.getName() == "txm-edition-xtz.xsl")
+	xslEdition = new File(xslDirectory, "txm-edition-xtz.xsl")
+if (xslPages == null || xslPages.getName() == "txm-edition-page-split.xsl")
+	xslPages = new File(xslDirectory, "txm-edition-page-split.xsl")
+
+println "XSLs: "+xslEdition.getName()+" & "+ xslPages.getName()
+println ""
+
+
+if (useTokenizedDirectory) {
+	println "Using the 'tokenized' directory instead of the 'txm' directory to get XML files"
+	txmDirectory = new File(binDirectory, "tokenized")
+}
+File HTMLDirectory = new File(binDirectory, "HTML")
+File HTMLCorpusDirectory = new File(HTMLDirectory, corpusName.toUpperCase())
+File defaultEditionDirectory = new File(HTMLCorpusDirectory, editionName)
+
+File cssDirectory = new File(TXMHOME, "css")
+File cssDefaultEditionDirectory = new File(defaultEditionDirectory, "css")
+File cssTXM = new File(cssDirectory, "txm.css")
+File cssTEI = new File(cssDirectory, "tei.css")
+boolean newEdition = false;
+
+if (!txmDirectory.exists()) {
+	println "ERROR: can't find this corpus 'txm' directory: $txmDirectory. Aborting"
+	return false;
+}
+if (!defaultEditionDirectory.exists()) {
+	println "This is a new edition"
+	newEdition = true;
+	defaultEditionDirectory.mkdir()
+	if (!defaultEditionDirectory.exists()) {
+		println "HTML directory could be created: $defaultEditionDirectory. Aborting"
+		return false
+	}
+}
+if (!cssTXM.exists()) {
+	println "WARNING: can't find the $cssTXM CSS file. Aborting"
+	return false;
+}
+if (!cssTEI.exists()) {
+	println "WARNING: can't find the $cssTEI CSS file. Aborting"
+	return false;
+}
+if (!xslEdition.exists()) {
+	println "Error: can't find $xslEdition XSL file"
+	return false;
+}
+if (!xslPages.exists()) {
+	println "Error: can't find $xslPages XSL file"
+	return false;
+}
+
+defaultEditionDirectory.mkdir()
+cssDefaultEditionDirectory.mkdir()
+FileCopy.copy(cssTXM, new File(cssDefaultEditionDirectory, cssTXM.getName()))
+FileCopy.copy(cssTEI, new File(cssDefaultEditionDirectory, cssTEI.getName()))
+
+//1- Back up current "HTML" directory
+if (!newEdition) {
+	File backupDirectory = new File(binDirectory, "HTML-"+defaultEditionDirectory.getName()+"-back")
+	backupDirectory.mkdir()
+	println "Backup of $defaultEditionDirectory directory to $backupDirectory..."
+	for (File f : defaultEditionDirectory.listFiles()) {
+		String name = f.getName()
+		if (f.isDirectory() || f.isHidden()) continue
+		
+		File rez = new File(backupDirectory, f.getName())
+		
+		if (debug) println " file $f >> $rez"
+		else print "."
+		
+		if (!FileCopy.copy(f, rez)) {
+			println "Error: failed to backup $f"
+			return false;
+		}
+	}
+	println ""
+}
+
+//2- Apply edition XSL
+println "Applying XSL 1: $xslEdition..."
+ApplyXsl2 applier = new ApplyXsl2(xslEdition);
+def htmlFiles = []
+for (File f : txmDirectory.listFiles()) {
+	String name = f.getName()
+	String txtname = name.substring(0, name.indexOf("."));
+	File rez = new File(HTMLCorpusDirectory, txtname+".html")
+
+	if (!f.isDirectory() && !f.isHidden() && name.endsWith(".xml") && !name.equals("import.xml")) {
+	
+		if (debug) println " file $f >> $rez"
+		else print "."
+	
+		if (!applier.process(f, rez)) {
+			println "Error: failed to process $f"
+			return false
+		} else {
+			htmlFiles << rez
+		}
+	}
+}
+println ""
+
+//3- Apply pages XSL
+println "Applying XSL 2: $xslPages..."
+ApplyXsl2 applier2 = new ApplyXsl2(xslPages);
+applier2.setParam("editionname", editionName)
+applier2.setParam("cssname", corpusName)
+for (File f : htmlFiles) {
+	String name = f.getName()
+	String txtname = name.substring(0, name.indexOf("."));
+	File rez = new File(defaultEditionDirectory, txtname+"-pages.html")
+	
+	if (debug) println " file $f >> $rez"
+	else print "."
+	
+	if (!applier2.process(f, rez)) {
+		println "Error: failed to process $f"
+		return false
+	} else {
+		if (!debug) rez.delete()
+	}
+}
+println ""
+
+// clean temp files
+if (!debug) {
+	for (File f : htmlFiles) {
+		f.delete()
+	}
+}
+
+//4- register new edition if any (copy edition)
+
+if (editionName != defaultEditionName) {
+	println "Update corpus configuration"
+	
+	// remove edition declaration if any
+	RemoveTag rt = new RemoveTag(
+			params.root.getOwnerDocument(), // will be updated
+			null, // don't create a new import.xml
+			"//edition[@name='$editionName']"
+			)
+
+	def corpusElem = params.getCorpusElement()
+	params.addEditionDefinition(corpusElem, editionName, "xsl", "XSLEditionBuilder"); // declare the new edition
+	
+	for (def text : corpus.getTexts()) {
+		Element textElem = text.getSelfElement()
+		def defaultEdition = text.getEdition(defaultEditionName)
+		if (defaultEdition == null) { println "Error: no default edition with name="+defaultEditionName; return false} 
+		Element editionElem = params.addEdition(textElem, editionName, defaultEditionDirectory.getAbsolutePath(), "html");
+		def pages = defaultEdition.getPages()
+		for (int i = 1 ; i <= pages.size() ; i++) {
+			def page = pages[i-1]
+			params.addPage(editionElem, "$i", page.getWordId());
+		}
+	}
+	
+	File paramFile = new File(binDirectory, "import.xml");
+	DomUtils.save(params.root.getOwnerDocument(), paramFile);
+}
+
+//5- Reload Corpora
+if (args.size() == 0) { // the user run the macro
+	Toolbox.restart();
+	monitor.syncExec(new Runnable() {
+			public void run() {
+				RestartTXM.reloadViews();
+			}
+		});
+}
+println "New edition created."
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/macro/edition/AddAttributeValuesInXML.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/macro/edition/AddAttributeValuesInXML.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/macro/edition/AddAttributeValuesInXML.groovy	(revision 258)
@@ -0,0 +1,88 @@
+package org.txm.macro.edition
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import org.txm.importer.*
+
+/**
+ * Add a attribute value map in a XML file
+ * Warning: if an attribute already exists its value won't be changed
+ */
+class AddAttributeValuesInXML extends StaxIdentityParser {
+	File xmlFile;
+	String tag, attribute;
+	List<String> values;
+	HashMap<String, String> attributesMap;
+	boolean result;
+
+	public AddAttributeValuesInXML(File xmlFile, String tag, String attribute, List<String> values)
+	{
+		super(xmlFile.toURI().toURL());
+		this.xmlFile = xmlFile;
+		this.tag = tag;
+		this.attribute = attribute;
+		this.values = values;
+	}
+
+	public boolean process(File outfile) {
+		this.result = false;
+		boolean ret = super.process(outfile)
+		return this.result & ret;
+	}
+
+	
+	/**
+	 * Rewrite the processStartElement() to update/add attributes
+	 */
+	int n = 0;
+	public void processStartElement()
+	{
+		if (localname != tag) {
+			super.processStartElement()
+		} else {
+			String prefix = parser.getPrefix();
+//TODO: uncomment for TXM 0.7.6
+//			if (INCLUDE == localname && XI == prefix) {
+//				processingXInclude();
+//				return;
+//			}
+
+			if (prefix.length() > 0)
+				writer.writeStartElement(Nscontext.getNamespaceURI(prefix), localname)
+			else
+				writer.writeStartElement(localname);
+
+			for (int i = 0 ; i < parser.getNamespaceCount() ; i++) {
+				writer.writeNamespace(parser.getNamespacePrefix(i), parser.getNamespaceURI(i));
+			}
+
+			// get attributes
+			HashMap<String, String> attributes = new HashMap<String, String>();
+			for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
+				attributes[parser.getAttributeLocalName(i)] = parser.getAttributeValue(i);
+			}
+			// add/update the value
+			if (n < values.size()) {
+				attributes[attribute] = values[n]; 
+			} else {
+				println "ERROR: not enough values to insert for file $xmlFile, at XML parser location: l="+parser.getLocation().getLineNumber()+",c="+parser.getLocation().getColumnNumber()+")."
+			}
+			n++
+			
+			// write attributes
+			for (def k : attributes.keySet()) {
+				writer.writeAttribute(k, attributes[k])
+			}
+		}
+	}
+	
+	@Override
+	public void after() {
+		super.after();
+		
+		if (n != values.size()) {
+			println "ERROR: number of $tag ("+n+") missmatch the number of values to insert: "+values.size()
+		}
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/macro/edition/BuildXTZEditions.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/macro/edition/BuildXTZEditions.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/macro/edition/BuildXTZEditions.groovy	(revision 258)
@@ -0,0 +1,144 @@
+package org.txm.macro.edition
+
+import org.txm.importer.*
+import org.xml.sax.Attributes
+import org.txm.importer.filters.*
+import java.util.ArrayList
+import javax.xml.parsers.*
+import javax.xml.stream.*
+import java.net.URL
+import org.xml.sax.InputSource
+import org.xml.sax.helpers.DefaultHandler
+
+class BuildXTZEditions {
+
+	private def url
+	private def inputData
+	private def factory
+	private XMLStreamReader parser
+	OutputStreamWriter writer
+	StaxStackWriter pagedWriter = null
+
+	File editionDir
+	File xmlFile
+	File htmlFile
+	def pages = []
+	def txtname, corpusname
+	int wordsPerPage = 500
+	boolean firstWord
+	boolean cutBefore = true;
+	
+	public BuildFacsEditions(File xmlFile, File editionDir, String corpusname, String txtname, int wordsPerPage) {
+		inputData = xmlFile.toURI().toURL().openStream()
+		factory = XMLInputFactory.newInstance()
+		parser = factory.createXMLStreamReader(inputData)
+		
+		this.xmlFile = xmlFile
+		this.editionDir = editionDir
+		this.txtname = txtname
+		this.wordsPerPage = wordsPerPage
+	}
+	
+	int n = 0;
+	private boolean createNextOutput()
+	{
+		try {
+			def tags = closeMultiWriter();
+			for (int i = 0 ; i < tags.size() ; i++) {
+				String tag = tags[i]
+				if ("body" != tag) {
+					tags.remove(i--)
+				} else {
+					tags.remove(i--) // remove "body"
+					break; // remove elements until "body tag
+				}
+			}
+			n++
+			htmlFile = new File(editionDir, "${txtname}_${n}.html")
+			firstWord = true
+
+			pagedWriter = new StaxStackWriter(htmlFile, "UTF-8");
+
+			pagedWriter.writeStartDocument("UTF-8", "1.0")
+			pagedWriter.writeStartElement("html");
+			pagedWriter.writeEmptyElement("meta", ["http-equiv":"Content-Type", "content":"text/html","charset":"UTF-8"]);
+			pagedWriter.writeEmptyElement("link", ["rel":"stylesheet", "type":"text/css","href":"txm.css"]);
+			pagedWriter.writeEmptyElement("link", ["rel":"stylesheet", "type":"text/css","href":"${corpusname}.css"]);
+			pagedWriter.writeStartElement("head");
+			pagedWriter.writeStartElement("title")
+			pagedWriter.writeCharacters(corpusname+" Edition - Page "+n)
+			pagedWriter.writeEndElement(); // </title>
+			pagedWriter.writeEndElement() // </head>
+			pagedWriter.writeStartElement("body") //<body>
+
+			pagedWriter.writeStartElements(tags);
+			return true;
+		} catch (Exception ee) {
+			System.out.println(ee);
+			return false;
+		}
+	}
+	
+	private def closeMultiWriter()
+	{
+		if (pagedWriter != null) {
+			def tags = pagedWriter.getTagStack().clone();
+
+			if (firstWord) { // there was no words
+				pagedWriter.writeCharacters("");
+				pagedWriter.write("<span id=\"w_0\"/>");
+				pages << ["$n", "w_0"]
+			}
+			pagedWriter.writeEndElements();
+			pagedWriter.close();
+			return tags;
+		} else {
+			return [];
+		}
+	}
+	
+	private writeImg(String src) {
+		pagedWriter.writeStartElement("div");
+		pagedWriter.writeEmptyElement("img", ["src":src]);
+		pagedWriter.writeEndElement(); // </div>
+	}
+	
+	public def process() {
+		String wordid = "w_0"
+		boolean start = false
+		String localname
+		
+		createNextOutput();
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+			switch (event) {
+				case XMLStreamConstants.START_ELEMENT:
+					localname = parser.getLocalName();
+					switch (localname) {
+						case "text":
+							start = true
+						break;
+						case "w":
+							if (firstWord) {
+								wordid = parser.getAttributeValue(null, "id");
+								firstWord = false;
+							}
+						break;
+						case "pb":
+							if (cutBefore) {
+								pages << ["$n", wordid]
+								// WRITE PB
+								createNextOutput()
+							} else {
+								createNextOutput()
+								pages << ["$n", wordid]
+								// WRITE PB
+							}
+						break;
+					}
+				break;
+			}
+		}
+		closeMultiWriter()
+		return pages
+	}
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/macro/misc/Specif2CoinMacro.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/macro/misc/Specif2CoinMacro.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/macro/misc/Specif2CoinMacro.groovy	(revision 258)
@@ -0,0 +1,171 @@
+// Copyright © 2016 ENS de Lyon
+//
+// Authors:
+// - Serge Heiden
+//
+// Licence:
+// This file is part of the TXM platform.
+// 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.
+//
+// Version:
+// $LastChangedDate: 2014-11-01 16:00:01 +0100 (sam., 1 nov. 2014) $
+// $LastChangedRevision: XXXX $
+// $LastChangedBy: sheiden $
+//
+
+/* --------------   Specif2Coin    --------------
+
+FR:
+
+Macro affichant la probabilité a priori (avant de faire les lancés) d'obtenir N faces 'pile' consécutives en lançant une pièce au pile ou face.
+
+On considère qu'une pièce a 50% de chances (1 chance sur 2) de tomber sur la face 'pile' à chaque lancé (les lancés sont indépendants).
+
+La probabilité est mise en regard avec la spécificité équivalente.
+
+La macro prend un seul paramètre :
+
+* nthrows : le nombre de lancés 'pile' consécutifs
+
+La macro affiche - selon les options :
+
+* displayProba : toutes les probabilités de 1 à nthrows lancés en détaillant :
+-  n : le nombre de 'pile' consécutifs
+-  p : la probabilité correspondante
+-  % : le pourcentage correspondant
+- pe : la probabilité exprimée en notation avec exposant en base 10
+-  s : la spécificité équivalente (l'exposant de la probabilité, soit son logarithme en base 10)
+
+* onlyMainRanks : s'utilise avec l'option displayProba pour n'afficher que les probabilités des rangs décimaux principaux (1, 2..., 10, 20..., 100, 200...)
+
+* displayCoins : plutôt que le détail de la probabilité, liste pour une spécificité S- donnée, le nombre équivalent de lancés 'pile' consécutifs correspondants exprimé sous la forme d'un intervalle : nombre de lancés minimum - nombre de lancés maximum
+Par exemple '-10 = 30-33' signifie : une spécificité S- de '-10' équivaut à entre 30 et 33 lancés 'pile' consécutifs
+
+Les limites du calcul sont celles de la machine. Une machine 64-bit peut typiquement calculer la probabilité de 1023 lancés consécutifs.
+
+*/
+
+// STANDARD DECLARATIONS
+package org.txm.macro.misc
+
+import org.kohsuke.args4j.*
+import groovy.transform.Field
+import org.txm.rcpapplication.swt.widget.parameters.*
+import org.eclipse.ui.console.*
+
+// BEGINNING OF PARAMETERS
+
+@Field @Option(name="nthrows", usage="maximum number of throws", widget="Integer", required=true, def="99")
+def nthrows
+
+@Field @Option(name="displayProba", usage="display probabilities", widget="Boolean", required=false, def="true")
+def displayProba
+
+@Field @Option(name="onlyMainRanks", usage="only display main rank lines", widget="Boolean", required=false, def="false")
+def onlyMainRanks
+
+@Field @Option(name="displayCoins", usage="display equivalent of coin flipping", widget="Boolean", required=false, def="true")
+def displayCoins
+
+// Open the parameters input dialog box
+if (!ParametersDialog.open(this)) return
+
+// END OF PARAMETERS
+
+def clearConsole = { ->
+	// clear the console
+	(ConsolePlugin.getDefault().getConsoleManager().getConsoles())[0].clearConsole()
+}
+
+clearConsole()
+
+min = [:]
+max = [:]
+
+pow = 2**(nthrows)
+powd = pow.doubleValue()
+
+if (powd == Double.POSITIVE_INFINITY || powd == Double.NEGATIVE_INFINITY) {
+	println sprintf("** Impossible to calculate probabilities for this value, try a lower value (impossible to represent 2 to the power of %d with this machine). Aborting.", nthrows)
+	return
+}
+
+d = 1/powd
+
+significandSize = ((-java.lang.Math.log10(d) as double)-1 as int)+4
+
+format = sprintf("%%4d = %%%d.%df = %%0%d.%df%%%% = %%9.2e = %%4d", significandSize, significandSize-2, significandSize-1, significandSize-4)
+
+unit = 1
+dec = 1
+
+if (displayProba) {
+	println """Légende :
+-  n : le nombre de 'pile' consécutifs
+-  p : la probabilité correspondante
+-  % : le pourcentage correspondant
+- pe : la probabilité exprimée en notation avec exposant en base 10
+-  s : la spécificité équivalente (l'exposant de la probabilité, soit son logarithme en base 10)
+"""
+	spc = ' ' * (significandSize+2)
+	println "   n    p"+spc+" %"+spc+"  pe         s"
+}
+
+nthrows.times {
+    n = it+1
+	p = 1/2**(n) as double
+	s = java.lang.Math.log10(p)-1 as int
+	if (min[s]) { if (min[s] > n) min[s] = n } else min[s] = n
+	if (max[s]) { if (max[s] < n) max[s] = n } else max[s] = n
+	if (displayProba) {
+		s = sprintf(format, n, p, p*100, p, s).replaceAll(/ = 0([^,])/, ' =  $1')
+		m0 = s =~ /(....)0+ = ([^-])/
+		if (m0.count > 0) {
+			spc0 = m0[0][1] + (' ' * (m0[0][0].size()-8)) + ' = ' + m0[0][2]
+			s = m0.replaceFirst(spc0)
+		}
+		m0p = s =~ /(....)0+% = /
+		if (m0p.count > 0) {
+			spc0p = m0p[0][1] + '%' + (' ' * (m0p[0][0].size()-8)) + ' = '
+			s = m0p.replaceFirst(spc0p)
+		}
+
+		if (!onlyMainRanks || ((n % dec) == 0) || (n == nthrows)) {
+			println s
+		}
+		
+		unit = unit+1
+		if (unit >= dec * 10) {
+			dec = dec * 10
+			unit = 1
+		}
+	}
+}
+
+if (displayCoins) {
+
+	if (displayProba) {
+		println ""
+	}
+
+	println """Légende :
+- -S      : spécificité équivalente
+-  lancés : intervalle des lancés 'pile' consécutifs correspondant
+"""
+	println " -S   lancés"
+	min.each { key, value -> if (min[key] != max[key]) println sprintf("%3d = %d-%d", key, min[key], max[key]) else println sprintf("%3d = %d", key, min[key])}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/macro/misc/EuroPress2XMLMacro.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/macro/misc/EuroPress2XMLMacro.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/macro/misc/EuroPress2XMLMacro.groovy	(revision 258)
@@ -0,0 +1,299 @@
+package org.txm.macro.misc
+// STANDARD DECLARATIONS
+
+import groovy.transform.Field
+import groovy.xml.QName
+
+import java.text.DecimalFormat
+
+import org.kohsuke.args4j.*
+import org.txm.importer.ValidateXml
+import org.txm.rcpapplication.swt.widget.parameters.*
+import org.w3c.tidy.Tidy
+
+// BEGINNING OF PARAMETERS
+@Field @Option(name="rootDir", usage="The directory contains the 'orig' directory which contains the html files", widget="Folder", required=false, def="/path")
+File rootDir = new File("");
+
+@Field @Option(name="encoding", usage="HTML encoding", widget="String", required=false, def="iso-8859-1")
+String encoding = "iso-8859-1" // HTML files encoding
+
+@Field @Option(name="debug", usage="show debug messages. Values = true, false", widget="String", required=false, def="false")
+def debug = "true" // set true to debug the script
+
+// Open the parameters input dialog box
+if (!ParametersDialog.open(this)) return;
+
+debug = ("true" == debug)
+// END OF PARAMETERS
+
+String corpusName = rootDir.getName()
+File srcDir = new File(rootDir, "orig");
+File outDir = new File(rootDir, "xhtml");
+File outDir2 = new File(rootDir, corpusName);
+File rejected = new File(rootDir, "duplicates");
+File tmpDir = new File(rootDir, "tmp");
+
+
+if (!srcDir.exists()) {
+	println "STOP, srcDir does not exists $srcDir"
+	return;
+}
+
+outDir.deleteDir()
+outDir.mkdir()
+outDir2.deleteDir()
+outDir2.mkdir()
+rejected.deleteDir()
+rejected.mkdir()
+tmpDir.deleteDir()
+tmpDir.mkdir()
+
+def allTags = new HashSet<String>();
+def allStyles = new HashSet<String>();
+def allClasses = new HashSet<String>();
+def newPrefix = "Numéro de document : "
+int itext = 1;
+def formater = new DecimalFormat("0000");
+int LIMITDIFF = 10
+def metadatas = ["DocPublicationName", "DocHeader"]
+def files = []
+srcDir.eachFileMatch(~/.*\.html/){ htmlFile -> files << htmlFile}
+files = files.sort()
+
+def done = new HashSet<String>();
+def ignored = []
+def allTitles = [:]
+def dones = [:]
+def ignoreds = []
+
+def getText(def node) {
+	//if (debug) println "node: "+node
+	String s = " ";
+	if (node instanceof String) {
+		s += " "+node
+	} else {
+		for(def c : node.children())
+			s += " "+getText(c)
+	}
+	//println " "+s.replace("\n", " ").trim();
+	return " "+s.replace("\n", " ").trim();
+}
+
+println "Nb of HTML files: "+files.size()
+for (File htmlFile : files) {
+	println "Processing file $htmlFile"
+	File tmpHTML = new File(tmpDir, htmlFile.getName())
+	tmpHTML.withWriter("UTF-8") { writer -> 
+		String txt = htmlFile.getText(encoding)
+		txt = txt.replaceAll("<p></p>", " ");
+		txt = txt.replaceAll("<p> </p>", " ");
+		txt = txt.replaceAll("<br>", "<br> ");
+		writer.write(txt)
+	}
+	
+	String name = htmlFile.getName()
+	name = name.substring(0, name.indexOf("."));
+
+	File xhtmlFile = new File(outDir, name+".xhtml")
+
+	Tidy tidy = new Tidy(); // obtain a new Tidy instance
+	tidy.setXHTML(true); // set desired config options using tidy setters
+	tidy.setInputEncoding("UTF-8")
+	tidy.setOutputEncoding("UTF-8")
+	tidy.setShowErrors(0)
+	tidy.setShowWarnings(false)
+	xhtmlFile.withWriter("UTF-8") { out ->
+		tidy.parse(tmpHTML.toURI().toURL().newInputStream(), out); // run tidy, providing an input and output stream
+	}
+
+	if (ValidateXml.test(xhtmlFile)) {
+		def root = new XmlParser().parse(xhtmlFile)
+		def tables = root.body.table.tbody.tr.td
+		if (tables.size() == 0) tables = root.body.table.tr.td
+		//println "Nb of txt : "+tables.size()
+
+		for (def text : tables) {
+			String sign = ""
+		
+			if (! text instanceof groovy.util.Node) { println "NOT NODE: "+text; continue; }
+			//println "TEXT "
+			//text.setName("text")
+			boolean endOfText = false;
+			def textMetadatas = [:]
+			for (String metadata : metadatas) {
+				textMetadatas[metadata] = ""
+			}
+			for (def subtable : text.table) text.remove(subtable)	
+			
+			for (def p : text.table.p) p.addChild(" ")		
+			
+			for (def child : text.span) {
+				if ("color:red; font-weight:bold".equals(child.@style)) {
+					//text.remove(child)
+					if (debug) "Found bold: "+child
+					child.replaceNode { node -> w(expFound: "y", child.text())}
+				}
+			}
+			
+			def startIgnoringText = false
+			def tmp =""
+			def ichar = 0
+			String title = "";
+			def ignoredText = ""
+			def children = text.children()
+			for (int idx = 0 ; idx < children.size() ; idx++) {
+				
+				def child  = children[idx]
+				if (debug) println "child: $child"
+			
+				if (startIgnoringText) {
+					if (debug) println "Ignoring text : "+ignoredText
+					if (child instanceof String) ignoredText += child
+					else ignoredText += child.text()
+					
+					def t = text.children().remove(idx);
+					//if (tmp.length() > 0) println "removing : "+t
+					idx--
+					continue; // next child
+				}
+			
+				if (child instanceof String) {
+					//println " "+child
+					ichar += child.length()
+				} else {
+					ichar += child.text().length()
+					//		allTags.add(child.name().getLocalPart())
+					//		allClasses.add(child.@class)
+					//		allStyles.add(child.@style)
+					def nn = child.name()
+					
+					try {nn = nn.getLocalPart()} catch(Exception e) {}
+					switch (nn) {
+						case "br": break;
+						case "span":
+						if (debug) println "Found span $child"
+							String classV = child.@class
+							String style = child.@style
+							if (classV != null) {
+								if (metadatas.contains(classV)) {
+									textMetadatas[classV] = (textMetadatas[classV] + " " + child.text()).trim()
+									text.remove(child);
+									idx--
+									//println "METADATA: "+classV + " = "+child.text().trim().length();
+								} else if ("TitreArticleVisu" == classV) {
+									title += getText(child)//.text().trim().replaceAll("\n", " ")+ " "
+									child.name = new QName(child.name().getNamespaceURI(), "head", child.name().getPrefix())
+								} else {
+									println "UNKNOWED CLASS: "+classV + " = "+child.text().trim().length();
+								}
+							} else if (style != null) {
+								if ("color:red; font-weight:bold".equals(style)) {
+									//child.replaceNode { node -> w(expFound: "test")	}
+									//println "KEYWORD: "+child.text().trim();
+								} else {
+									println "UNKNOWED STYLE: '"+style+"' = "+child.text().trim();
+								}
+							} else {
+								println "UNKNOWED SPAN: "+child.text().trim();
+							}
+							break;
+
+						case "a": break
+						case "w": break;
+						case "b":
+							startIgnoringText = true;
+							tmp = child.text()
+							//if (tmp.length() > 0) println "START REMOVING FROM : "+tmp
+							text.remove(child);
+							idx--
+							break;
+						case "i": break;
+						case "font":
+							if (debug) println "Found font $child"
+							String style = child.@style
+							if ("font-style:italic;" == style) {
+								if (debug) println "ITALIC: "+getText(child).trim();
+								child.replaceNode { node -> i(getText(child))}
+							} else if ("font-weight:bold;") {
+								if (debug) println "BOLD: "+getText(child).trim();
+								child.replaceNode { node -> b(getText(child))}
+							} else {
+								println "FSTYLE: '"+style+"' = "+getText(child).trim();
+							}
+							break;
+						default: println child.name()
+					}
+				}
+			}
+			
+			//rename td to text
+			text.name = new QName(text.name().getNamespaceURI(), "text", text.name().getPrefix())
+			
+			//Write metadatas
+			for( String metadata : metadatas) {
+				text.attributes().put(metadata, textMetadatas[metadata])
+				//sign+= " "+textMetadatas[metadata].trim()
+			}
+			
+			// get document number
+			ignoredText = ignoredText.replaceAll("\n", " ")
+			int iNo= ignoredText.indexOf(newPrefix);
+			//println ignoredText
+			if (iNo >= 0) {
+				String no =ignoredText.substring(iNo+newPrefix.length()).trim()
+				text.attributes().put("idnews", no)
+				//sign += " "+no
+				text.attributes().put("date", no.substring(5,9)+"-"+no.substring(9,11)+"-"+no.substring(11,13))
+				text.attributes().put("yyyymmdd", no.substring(5,13))
+				text.attributes().put("yyyymm", no.substring(5,11))
+				text.attributes().put("yyyy", no.substring(5,9))
+				text.attributes().put("mm", no.substring(9,11))
+				text.attributes().put("dd", no.substring(11,13))
+			}
+			
+			//sign += " "+ichar
+			sign += " "+title
+			
+			if (allTitles[title] == null) allTitles[title] = ichar
+			if (Math.abs(allTitles[title] - ichar) > LIMITDIFF) {
+				sign += " "+ichar
+			}
+			File xmlFile;
+			if (done.contains(sign)) {
+				ignored << sign
+				xmlFile = new File(rejected, name+"_"+formater.format((itext++))+".xml")
+				ignoreds << xmlFile.getName()
+			} else {
+				done << sign;
+				xmlFile = new File(outDir2, name+"_"+formater.format((itext++))+".xml")
+				dones[sign] = xmlFile
+			}
+			def writer = new PrintWriter(new OutputStreamWriter(new FileOutputStream(xmlFile) , "UTF-8")); //$NON-NLS-1$
+				writer.println "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+				new XmlNodePrinter(writer).print(text)
+		}
+	}
+}
+
+if (ignored.size() > 0) {
+	File ignoredFile = new File (rejected, "ignored.txt");
+	ignoredFile.withWriter("UTF-8") { writer ->
+		writer.println "TOTAL: "+ignored.size()
+		for (int i = 0 ; i < ignored.size() ; i++) {
+			def sign = ignored[i]
+			writer.println "\n**DUPLICATE\n "
+			writer.println "keeped="+dones[sign];
+			writer.println "rejected="+ignoreds[i];
+			writer.println "SIGN="+sign
+			writer.println "\n"
+		}
+	}
+	println "TOTAL IGNORED: "+ignored.size()
+}
+
+println "TOTAL TEXT: $itext"
+if (!debug) {
+	outDir.deleteDir()
+	tmpDir.deleteDir()
+}
Index: tmp/org.txm.core/src/groovy/org/txm/macro/misc/TXM2CoNLL2009Macro.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/macro/misc/TXM2CoNLL2009Macro.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/macro/misc/TXM2CoNLL2009Macro.groovy	(revision 258)
@@ -0,0 +1,43 @@
+package org.txm.macro.misc
+import org.txm.export.conll2009.ToCoNLL2009
+
+import java.io.File;
+import org.txm.searchengine.cqp.corpus.*
+import org.kohsuke.args4j.*
+import groovy.transform.Field
+import org.txm.rcpapplication.swt.widget.parameters.*
+
+if (!(corpusViewSelection instanceof Corpus)) {
+	println "Select a corpus or a sub-corpus"
+	return;
+}
+def corpus = corpusViewSelection
+
+@Field @Option(name="outputFile", usage="an example file", widget="File", required=true, def="conn_export.tsv")
+File outputFile = new File("conn_export.tsv")
+@Field @Option(name="encoding", usage="sentenceProperty", widget="String", required=true, def="UTF-8")
+String encoding = "UTF-8"
+
+@Field @Option(name="sentenceProperty", usage="sentenceProperty", widget="String", required=true, def="s_id")
+String sentenceProperty = "s_id"
+@Field @Option(name="posProperty", usage="sentenceProperty", widget="String", required=true, def="pos")
+String posProperty = "frpos"
+@Field @Option(name="lemmaProperty", usage="sentenceProperty", widget="String", required=true, def="lemma")
+String lemmaProperty = "frlemma"
+
+if (!ParametersDialog.open(this)) return;
+
+def split = sentenceProperty.split("_", 2)
+StructuralUnitProperty s = corpus.getStructuralUnit(split[0]).getProperty(split[1])
+Property word = corpus.getProperty("word")
+Property lemma = corpus.getProperty(lemmaProperty)
+Property pos = corpus.getProperty(posProperty)
+
+if (s == null) { println "Error sentence property: $sentenceProperty"; return}
+if (word == null) { println "Error no word property"; return}
+if (pos == null) { println "Error pos property: $posProperty"; return}
+if (lemma == null) { println "Error lemma property: $lemmaProperty"; return}
+
+
+ToCoNLL2009 processor = new ToCoNLL2009()
+processor.process(outputFile, corpus, s, word, lemma, pos, encoding)
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/macro/package.html
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/macro/package.html	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/macro/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Contains various macro samples</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/org/txm/macro/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/macro/stats/Specif2ThrowMacro.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/macro/stats/Specif2ThrowMacro.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/macro/stats/Specif2ThrowMacro.groovy	(revision 258)
@@ -0,0 +1,187 @@
+// Copyright © 2016 ENS de Lyon, CNRS, University of Franche-Comté
+// Licensed under the terms of the GNU General Public License (http://www.gnu.org/licenses)
+// @author sheiden
+
+/* --------------   Specif2Throw    --------------
+
+FR:
+
+Macro affichant la probabilité a priori (avant de faire les lancés ou les tirages) d'obtenir N succès consécutifs
+dans des jeux de lancés ou de tirages simples en regard avec des valeurs de spécificités.
+Il s'agit de jeux de lancés ou tirages connus de tous : le lancé de pièce pour obtenir pile ou face, le lancé de dé
+à 6 faces, tirer une carte dans un jeu de 32 ou 52 cartes, etc.
+On considère qu'une pièce a 50% de chances (1 chance sur 2) de tomber sur la face 'pile' à chaque lancé.
+On considère qu'un dé a 16,6% de chances (1 chance sur 6) de tomber sur '6' à chaque lancé.
+On considère qu'on a 3,1% de chances (1 chance sur 32) de tirer un as de trèfle à chaque tirage dans un jeu de 32 cartes.
+On considère qu'on a 1,9% de chances (1 chance sur 52) de tirer un as de trèfle à chaque tirage dans un jeu de 52 cartes.
+etc.
+On considère que les lancés ou les tirages sont indépendants et que les objets ne sont pas biaisés (eg le dé n'est pas pipé).
+
+La probabilité est mise en regard avec la spécificité équivalente pour mettre en lien
+des valeurs de spécificités calculées par TXM et l'intuition que l'on a de chances de succès
+dans un jeu de lancé ou de tirage.
+Il s'agit bien sûr uniquement d'illustrer l'ordre de grandeur de la surprise à avoir en
+interprétant directement le modèle des spécificités. Il ne s'agit en aucun cas d'illustrer
+une quelconque assimilation de l'apparition de mots dans des textes à un jeu de hasard.
+
+La macro prend deux paramètres :
+
+* cardOmega : le nombre d'issues possibles pour le jeu de lancé ou de tirage considéré
+              (Omega est l'univers de l'expérience aléatoire, cardOmega son cardinal)
+ - pour un lancé de pièce : choisir 2 pour cardOmega
+   (Omega = {pile, face})
+ - pour un lancé de dé : choisir 6 pour cardOmega
+   (Omega = {1, 2, 3, 4, 5, 6})
+ - pour un tirage de carte dans un jeu de 32 cartes : choisir 32 pour cardOmega
+   (Omega = {1 de trèfle, 2 de trèfle, 3 de trèfle, 4 de trèfle, 5 de trèfle, 6 de trèfle, 7 de trèfle,
+   8 de trèfle, 9 de trèfle, 10 de trèfle, valet de trèfle, dame de trèfle, roi de trèfle, 1 de carreau,
+   2 de carreau, etc.})
+ - pour un tirage de carte dans un jeu de 52 cartes : choisir 52 pour cardOmega
+ - etc.
+* nthrows : le nombre maximum de lancés ou de tirages avec succès consécutifs
+
+La macro affiche - selon les options :
+
+* displayProba : toutes les probabilités de 1 à nthrows lancés ou tirages en détaillant :
+-  n : le nombre de succès consécutifs
+-  p : la probabilité correspondante
+-  % : le pourcentage correspondant
+- pe : la probabilité exprimée en notation avec exposant en base 10
+-  s : la spécificité équivalente (l'exposant de la probabilité, soit son logarithme en base 10)
+
+* onlyMainRanks : s'utilise avec l'option displayProba pour n'afficher que les probabilités des rangs décimaux principaux (1, 2..., 10, 20..., 100, 200...)
+
+* displayThrows : plutôt que le détail de la probabilité, liste pour une spécificité S- donnée, le nombre équivalent de lancés ou de tirages avec succès consécutifs correspondants exprimé sous la forme d'un intervalle : nombre de lancés ou tirages minimum - nombre de lancés ou tirages maximum
+Par exemple '-10 = 30-33' signifie : une spécificité S- de '-10' équivaut à entre 30 et 33 lancés ou tirages avec succès consécutifs (cas du lancé de pièce, cardOmega = 2)
+
+Les limites du calcul sont liées au modèle de la mémoire de la machine. Une machine 64-bit peut typiquement calculer la probabilité de 1023 lancés de pièce avec succès consécutifs.
+
+*/
+
+// STANDARD DECLARATIONS
+package org.txm.macro.stats
+
+import org.kohsuke.args4j.*
+import groovy.transform.Field
+import org.txm.rcpapplication.swt.widget.parameters.*
+import org.eclipse.ui.console.*
+
+// BEGINNING OF PARAMETERS
+
+@Field @Option(name="cardOmega", usage="card(Ω): 2=coin, 6=dice, 32=32-card deck, 52=52-card deck, etc.", widget="Integer", required=true, def="2")
+def cardOmega
+
+@Field @Option(name="nthrows", usage="maximum number of successful throws or draws", widget="Integer", required=true, def="99")
+def nthrows
+
+@Field @Option(name="displayProba", usage="display probabilities", widget="Boolean", required=false, def="true")
+def displayProba
+
+@Field @Option(name="onlyMainRanks", usage="only display main rank lines", widget="Boolean", required=false, def="false")
+def onlyMainRanks
+
+@Field @Option(name="displayThrows", usage="display equivalent specificity value for each number or interval number of throws or draws", widget="Boolean", required=false, def="true")
+def displayThrows
+
+// Open the parameters input dialog box
+if (!ParametersDialog.open(this)) return
+
+// END OF PARAMETERS
+
+def clearConsole = { ->
+	// clear the console
+	(ConsolePlugin.getDefault().getConsoleManager().getConsoles())[0].clearConsole()
+}
+
+clearConsole()
+
+min = [:]
+max = [:]
+
+pow = cardOmega**(nthrows)
+powd = pow.doubleValue()
+
+if (powd == Double.POSITIVE_INFINITY || powd == Double.NEGATIVE_INFINITY) {
+	println sprintf("** Impossible to calculate probabilities for this value, try a lower value (impossible to represent cardOmega to the power of %d with this machine). Aborting.", nthrows)
+	return
+}
+
+d = 1/powd
+
+significandSize = ((-java.lang.Math.log10(d) as double)-1 as int)+4
+
+format = sprintf("%%4d = %%%d.%df = %%0%d.%df%%%% = %%9.2e = %%4d", significandSize, significandSize-2, significandSize-1, significandSize-4)
+
+unit = 1
+dec = 1
+
+println "cardOmega = "+cardOmega
+
+if (displayProba) {
+	println """Légende :
+-  n : le nombre de lancés ou tirages avec succès consécutifs
+-  p : la probabilité correspondante
+-  % : le pourcentage correspondant
+- pe : la probabilité exprimée en notation avec exposant en base 10
+-  s : la spécificité équivalente (l'exposant de la probabilité, soit son logarithme en base 10)
+"""
+	spc = ' ' * (significandSize+2)
+	println "   n    p"+spc+" %"+spc+"  pe         s"
+}
+
+nthrows.times {
+    n = it+1
+	p = (1/cardOmega)**(n) as double
+	s = java.lang.Math.log10(p)-1 as int
+	if (min[s]) { if (min[s] > n) min[s] = n } else min[s] = n
+	if (max[s]) { if (max[s] < n) max[s] = n } else max[s] = n
+	if (displayProba) {
+		s = sprintf(format, n, p, p*100, p, s).replaceAll(/ = 0([^,])/, ' =  $1')
+		m0 = s =~ /(....)0+ = ([^-])/
+		if (m0.count > 0) {
+			spc0 = m0[0][1] + (' ' * (m0[0][0].size()-8)) + ' = ' + m0[0][2]
+			s = m0.replaceFirst(spc0)
+		}
+		m0p = s =~ /(....)0+% = /
+		if (m0p.count > 0) {
+			spc0p = m0p[0][1] + '%' + (' ' * (m0p[0][0].size()-8)) + ' = '
+			s = m0p.replaceFirst(spc0p)
+		}
+
+		if (!onlyMainRanks || ((n % dec) == 0) || (n == nthrows)) {
+			println s
+		}
+		
+		unit = unit+1
+		if (unit >= dec * 10) {
+			dec = dec * 10
+			unit = 1
+		}
+	}
+}
+
+if (displayThrows) {
+
+	if (displayProba) {
+		println ""
+	}
+
+	def x = []
+	def y = []
+	
+	println """Légende :
+- -S      : spécificité équivalente
+-  lancés : intervalle des nombres de lancés ou tirages avec succès consécutifs correspondant
+"""
+	println " -S   lancés"
+	min.each { key, value ->
+	 if (min[key] != max[key]) println sprintf("%3d = %d-%d", key, min[key], max[key])
+	 else println sprintf("%3d = %d", key, min[key])
+	 x.push(key)
+	 y.push(min[key])
+	}
+	
+//	println "x = "+x
+//	println "y = "+y
+
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/macro/stats/BasicVocabularyMacro.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/macro/stats/BasicVocabularyMacro.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/macro/stats/BasicVocabularyMacro.groovy	(revision 258)
@@ -0,0 +1,133 @@
+package org.txm.macro.stats
+// Copyright © 2010-2016 ENS de Lyon.
+// 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.
+// @author mdecorde
+// @author sheiden
+//
+// 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.
+
+// This macro computes the basic vocabulary of a partition
+// given a specificities table. The result is saved in a
+// TSV file.
+
+import org.txm.Toolbox
+import org.txm.functions.ca.*
+import org.txm.searchengine.cqp.clientExceptions.*
+import org.txm.searchengine.cqp.corpus.*
+import org.txm.searchengine.cqp.corpus.query.*
+import org.txm.stat.*
+import org.txm.stat.data.*
+import org.txm.stat.engine.r.*
+import org.txm.functions.specificities.*
+import org.kohsuke.args4j.*
+import groovy.transform.Field
+import org.txm.rcpapplication.swt.widget.parameters.*
+
+//TODO temporary uncommented
+//if (!(corpusViewSelection instanceof SpecificitesResult)) {
+//	println "** You need to select a Specificities result icon in the Corpus view before calling this macro. Aborting."
+//	return
+//}
+
+// PARAMETERS
+
+@Field @Option(name="outputDirectory", usage="output directory", widget="Folder", required=true, def=".")
+def outputDirectory
+
+@Field @Option(name="outputFile", usage="TSV result file", widget="String", required=true, def="banal.tsv")
+def outputFile
+
+@Field @Option(name="scoreMax", usage="score maximum threshold", widget="Float", required=false, def="1.5")
+def scoreMax
+
+//@Field @Option(name="suseSum", usage="Use the row sums : y/n", widget="String", required=false, def="n")
+def suseSum // not used
+
+// END OF PARAMETERS
+if (!ParametersDialog.open(this)) return
+
+if (suseSum == null || suseSum.length() == 0) suseSum = "n"
+boolean useSum = suseSum.toLowerCase().charAt(0) == "y"
+
+if (useSum) {
+	println "Using line sums..."
+}
+
+def output = new File(outputDirectory.toString()+"/"+outputFile)
+def writer = output.newWriter("UTF-8")
+def specif = corpusViewSelection
+def indices = specif.getSpecificitesIndex()
+def freqs = specif.getFrequency()
+def rownames = specif.getTypeNames()
+def colnames = specif.getPartShortNames()
+
+def selected = []
+
+writer.print "unit"
+writer.print "\tF"
+writer.print "\tscore_max"
+
+for (int j = 0; j < colnames.size() ; j++) {
+	writer.print "\t"+colnames[j]
+	writer.print "\tscore"
+}
+
+writer.println ""
+
+for (int i = 0; i < rownames.length ; i++) {
+	boolean add = true
+	def totF = 0
+	def totscore = 0.0
+	def maxS = 0
+
+	for (int j = 0; j < colnames.size() ; j++) {
+
+		def sp = Math.abs(indices[i][j])
+		if (sp >= scoreMax) {
+			add = false
+		} else {
+			if (sp >= maxS) maxS = sp
+		}
+		totF += freqs[i][j]
+		totscore += sp
+	}
+	
+	if (useSum) {
+		if (totscore >= scoreMax) add = false
+		else add = true
+	}
+	
+	if (add) {
+		selected << rownames[i]
+		writer.print rownames[i]
+		writer.print "\t$totF"
+		writer.print "\t$maxS"
+		for (int j = 0; j < colnames.size() ; j++) {
+			writer.print "\t"+freqs[i][j]
+			writer.print "\t"+indices[i][j]
+		}
+		writer.println ""
+	}
+}
+
+println "Selected: "+selected
+println "Saved in $output."
+
+writer.close()
+
Index: tmp/org.txm.core/src/groovy/org/txm/macro/transcription/FixTransanaTimings.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/macro/transcription/FixTransanaTimings.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/macro/transcription/FixTransanaTimings.groovy	(revision 258)
@@ -0,0 +1,220 @@
+// 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
+// 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.
+
+package org.txm.macro.transcription
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+class FixTransanaTimings {
+
+	File trsInFile = new File("/home/mdecorde/xml/transana/out.xml")
+	File trsOutFile = new File("/home/mdecorde/xml/transana/TrP1S8_08102010.trs")
+
+	public FixTransanaTimings(File trsInFile, File trsOutFile) {
+		this.trsInFile = trsInFile;
+		this.trsOutFile = trsOutFile;
+	}
+
+	public boolean process() {
+		def slurper = new XmlParser();
+		def trs = slurper.parse(trsInFile)
+
+		def speakers = new HashSet<String>();
+		for (def turn : trs.Episode.Section.Turn) {
+			String tmp = turn.@speaker.toUpperCase();
+			speakers << tmp
+			turn.@speaker = tmp
+		}
+		for (def speakersNode : trs.Speakers) {
+			for (String spk : speakers) {
+				def speakerNode = new Node(speakersNode, 'Speaker',
+				[id:spk, name:spk, type:'unknown', check:'yes', dialect:'native', accent:'no', scope:'local'])
+			}
+			def speakerNode = new Node(speakersNode, 'Speaker',
+				[id:"none", name:"none", type:'unknown', check:'yes', dialect:'native', accent:'no', scope:'local'])
+		}
+		
+		String currentEnd = null;
+		for (def turn : trs.Episode.Section.Turn) {
+			def children = turn.children()
+	
+			if (children.size() > 0) {
+				//println "fixing turn start="+turn.@startTime+" end="+turn.@endTime+" previous end="+currentEnd
+				if (currentEnd != null && currentEnd.length() > 0 && turn.@startTime.length() == 0) { // using last Sync
+					//println "fixing with previous Turn $currentEnd"
+					turn.@startTime = currentEnd
+					setStartTime(children[0], currentEnd)
+				} else if (!(children[0] instanceof String)) { // no previous Sync, using next Sync
+					def start = getStartTime(children[0])
+					if (start != null && start.length() > 0)	turn.@startTime = start
+				}
+				currentEnd = null
+	
+				if (!(children[children.size() - 1] instanceof String)) { // this is the last Sync
+					def end = getStartTime(children[children.size() - 1])
+					if (end != null && end.length() > 0)  {
+						turn.@endTime = end
+						currentEnd = end;
+					}
+				}
+			}
+		}
+	
+		def nodes = []
+		// get Sync nodes to fix
+		for (def section : trs.Episode.Section) { // all Section
+			for (def child : section.children()) { // all Section children
+				if (!(child instanceof String)) { // is a Tag
+					switch(child.name()) {
+						case "Turn": // get Sync in Turn
+							//nodes << child;
+							for (def sync : child.Sync)
+								nodes << sync
+							break;
+						case "Sync":
+							nodes << child;
+							break;
+						default: break;
+					}
+				}
+			}
+		}
+		
+		//Fixing Sync@time
+		for (int i = 0 ; i < nodes.size() ; i++) {
+			def node = nodes[i]
+			String time = getStartTime(node)	
+			
+			if (time.length() == 0) {				
+				def list = [];
+				String previous;
+				if (i > 0) { previous = getStartTime(nodes[i-1]);
+				} else { previous = "0.0" }
+				
+				String next = null;
+				while ((next == null || next.length() == 0) && i <= nodes.size()) {
+					list << node
+					node = nodes[++i]
+					next = getStartTime(node)
+				}
+				if (next != null) {
+					if (node != null) list << node
+					fixSyncTimes(list, previous, next)
+				} else {
+					println "ERROR: no end time in the transcription"
+				}
+			}
+		}
+	
+		// fixing startTime of Turn using next Sync.@time
+		def turns = trs.Episode.Section.Turn
+		for (int i = 0 ; i < turns.size() ; i++) {
+			def turn = turns[i]
+			def syncs = turn.Sync
+			if (syncs.size() > 0) {
+				turn.@startTime = syncs[0].@time
+			} else {
+				println "Error: Turn with no Sync milestone"
+			}
+		}
+	
+		// fixing endTimes of Turn using next Turn.@startTime
+		for (int i = 0 ; i < turns.size() ; i++) {
+			def turn = turns[i]
+			//println "turn start="+turn.@startTime+" end="+turn.@endTime
+			if (i < turns.size() - 1) {
+				if (turn.@endTime.length() == 0 && turns[i+1].@startTime.length() > 0) {
+					//println "fixing turn.@endTime "+turn.@endTime+" with turns[i+1].@startTime "+(turns[i+1]);
+					turn.@endTime = turns[i+1].@startTime
+				}
+			}  else if (turn.@endTime.length() == 0) { // last turn has no timing, aproximate it 
+				Float e = Float.parseFloat(turn.@startTime)
+				e += turn.text().length()*1.0f 
+				turn.@endTime = e.toString()
+			}
+		}
+		
+		// fixing endTimes of Section using last Turn.@endTime
+		// fixing startTimes of Section using first Turn.@startTime
+		def sections = trs.Episode.Section
+		for (int i = 0 ; i < sections.size() ; i++) {
+			def t = sections[i].Turn
+			if (t.size() == 0) continue;
+			sections[i].@startTime = t[0].@startTime
+			sections[i].@endTime = t[-1].@endTime
+		}
+		
+		trsOutFile.withWriter("UTF-8") { writer ->
+			writer.write('<?xml version="1.0" encoding="UTF-8"?>\n<!DOCTYPE Trans SYSTEM "trans-14.dtd">\n')
+			new groovy.util.XmlNodePrinter(new PrintWriter(writer)).print(trs) }
+		
+		return true;
+	}
+	
+	def getStartTime(def node) {
+		def ret = null;
+		if (node == null) return "0.0"
+		if (node.name() == null) return "0.0"
+		switch(node.name()) {
+			case "Turn":
+			case "Section":
+			//			println "Turn"
+				ret = node.@startTime
+				break
+			case "Sync":
+			//		println "Sync"
+				ret = node.@time
+				break
+			default: break;
+		}
+		//println "getStartTime "+node.name()+" $ret"
+		return ret
+	}
+
+	def setStartTime(def node, def value) {
+		switch(node.name()) {
+			case "Turn":
+			case "Section":
+				node.@startTime = ""+value
+				break;
+			
+			case "Sync":
+				return node.@time = ""+value
+			default: break;
+		}
+	}
+
+	def fixSyncTimes(def list, def start, def end) {
+		//println "Nfix: "+list.size()+" "+list
+		//println "$start $end"
+		
+		def startf = Double.parseDouble(start)
+		def endf = Double.parseDouble(end)
+		def delta = (endf-startf)/list.size()
+		//println delta
+		float c = startf;
+		for (int i = 0 ; i < list.size() ; i++) {
+			c += delta;
+			list[i].@time = ""+c
+		}
+	}
+}
Index: tmp/org.txm.core/src/groovy/org/txm/macro/transcription/SetTRSTurnTimingsAndSpeakers.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/macro/transcription/SetTRSTurnTimingsAndSpeakers.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/macro/transcription/SetTRSTurnTimingsAndSpeakers.groovy	(revision 258)
@@ -0,0 +1,220 @@
+// 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
+// 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.
+
+package org.txm.macro.transcription
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+class SetTRSTurnTimingsAndSpeakers {
+
+	File trsInFile = new File("/home/mdecorde/xml/transana/out.xml")
+	File trsOutFile = new File("/home/mdecorde/xml/transana/TrP1S8_08102010.trs")
+
+	public SetTRSTurnTimingsAndSpeakers(File trsInFile, File trsOutFile) {
+		this.trsInFile = trsInFile;
+		this.trsOutFile = trsOutFile;
+	}
+
+	public boolean process() {
+		def slurper = new XmlParser();
+		def trs = slurper.parse(trsInFile)
+
+		// collect speakers from Turn@speaker values
+		def speakers = new HashSet<String>();
+		for (def turn : trs.Episode.Section.Turn) {
+			String tmp = turn.@speaker.toUpperCase();
+			speakers << tmp
+			turn.@speaker = tmp
+		}
+		for (def speakersNode : trs.Speakers) {
+			for (String spk : speakers) {
+				def speakerNode = new Node(speakersNode, 'Speaker',
+				[id:spk.replace(" ", "_"), name:spk, type:'unknown', check:'yes', dialect:'native', accent:'no', scope:'local'])
+			}
+			def speakerNode = new Node(speakersNode, 'Speaker',	[id:"none", name:"none", type:'unknown', check:'yes', dialect:'native', accent:'no', scope:'local'])
+		}
+				
+		String currentEnd = null;
+		for (def turn : trs.Episode.Section.Turn) {
+			def children = turn.children()
+	
+			if (children.size() > 0) {
+				//println "fixing turn start="+turn.@startTime+" end="+turn.@endTime+" previous end="+currentEnd
+				if (currentEnd != null && currentEnd.length() > 0 && turn.@startTime.length() == 0) { // using last Sync
+					//println "fixing with previous Turn $currentEnd"
+					turn.@startTime = currentEnd
+					setStartTime(children[0], currentEnd)
+				} else if (!(children[0] instanceof String)) { // no previous Sync, using next Sync
+					def start = getStartTime(children[0])
+					if (start != null && start.length() > 0)	turn.@startTime = start
+				}
+				currentEnd = null
+	
+				if (!(children[children.size() - 1] instanceof String)) { // this is the last Sync
+					def end = getStartTime(children[children.size() - 1])
+					if (end != null && end.length() > 0)  {
+						turn.@endTime = end
+						currentEnd = end;
+					}
+				}
+			}
+		}
+	
+		def nodes = []
+		// get Sync nodes to fix
+		for (def section : trs.Episode.Section) { // all Section
+			for (def child : section.children()) { // all Section children
+				if (!(child instanceof String)) { // is a Tag
+					switch(child.name()) {
+						case "Turn": // get Sync in Turn
+							//nodes << child;
+							for (def sync : child.Sync) {
+								nodes << sync
+							}
+							break;
+						case "Sync":
+							nodes << child;
+							break;
+						default: break;
+					}
+				}
+			}
+		}
+
+		//Fixing Sync@time
+		String previousValue = "0.0"
+		for (int i = 0 ; i < nodes.size() ; i++) {
+			def node = nodes[i]
+			String time = getStartTime(node)	
+			
+			if (time.length() == 0 || time == previousValue) {				
+				def list = [];
+				String previous;
+				if (i > 0) { previous = getStartTime(nodes[i-1]);
+				} else { previous = "0.0" }
+				
+				String next = null;
+				while ((next == null || next.length() == 0 || next == previousValue) && i <= nodes.size()) {
+					list << node
+					node = nodes[i]
+					next = getStartTime(node)
+					i++
+				}
+				if (next != null) {
+					if (node != null) list << node
+					fixSyncTimes(list, previous, next)
+					previousValue = next;
+				} else {
+					println "ERROR: no end time in the transcription"
+				}
+			}
+		}
+	
+		// fixing startTime of Turn using next Sync.@time
+		def turns = trs.Episode.Section.Turn
+		for (int i = 0 ; i < turns.size() ; i++) {
+			def turn = turns[i]
+			def syncs = turn.Sync
+			if (syncs.size() > 0) {
+				turn.@startTime = syncs[0].@time
+			} else {
+				println "Error: Turn with no Sync milestone"
+			}
+		}
+	
+		// fixing endTimes of Turn using next Turn.@startTime
+		for (int i = 0 ; i < turns.size() ; i++) {
+			def turn = turns[i]
+			//println "turn start="+turn.@startTime+" end="+turn.@endTime
+			if (i < turns.size() - 1) {
+				if (turn.@endTime.length() == 0 && turns[i+1].@startTime.length() > 0) {
+					//println "fixing turn.@endTime "+turn.@endTime+" with turns[i+1].@startTime "+(turns[i+1]);
+					turn.@endTime = turns[i+1].@startTime
+				}
+			}
+		}
+		
+		// fixing endTimes of Section using last Turn.@endTime
+		// fixing startTimes of Section using first Turn.@startTime
+		def sections = trs.Episode.Section
+		for (int i = 0 ; i < sections.size() ; i++) {
+			def t = sections[i].Turn
+			if (t.size() == 0) continue;
+			sections[i].@startTime = t[0].@startTime
+			sections[i].@endTime = t[-1].@endTime
+		}
+		
+		trsOutFile.withWriter("UTF-8") { writer ->
+			writer.write('<?xml version="1.0" encoding="UTF-8"?>\n<!DOCTYPE Trans SYSTEM "trans-14.dtd">\n')
+			new groovy.util.XmlNodePrinter(new PrintWriter(writer)).print(trs) }
+		
+		return true;
+	}
+	
+	def getStartTime(def node) {
+		def ret = null;
+		if (node == null) return "0.0"
+		if (node.name() == null) return "0.0"
+		switch(node.name()) {
+			case "Turn":
+			case "Section":
+			//			println "Turn"
+				ret = node.@startTime
+				break
+			case "Sync":
+			//		println "Sync"
+				ret = node.@time
+				break
+			default: break;
+		}
+		//println "getStartTime "+node.name()+" $ret"
+		return ret
+	}
+
+	def setStartTime(def node, def value) {
+		switch(node.name()) {
+			case "Turn":
+			case "Section":
+				node.@startTime = ""+value
+				break;
+			
+			case "Sync":
+				return node.@time = ""+value
+			default: break;
+		}
+	}
+
+	def fixSyncTimes(def list, def start, def end) {
+		println "Nfix: "+list.size()+" "+list
+		
+		def startf = Double.parseDouble(start)
+		def endf = Double.parseDouble(end)
+		def delta = (endf-startf)/list.size()
+		println "start=$start end=$end delta=$delta"
+
+		float c = startf;
+		for (int i = 0 ; i < list.size() ; i++) {
+			c += delta;
+			list[i].@time = ""+c
+		}
+	}
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/macro/transcription/TXT2TRS.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/macro/transcription/TXT2TRS.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/macro/transcription/TXT2TRS.groovy	(revision 258)
@@ -0,0 +1,345 @@
+// 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
+// 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.
+
+package org.txm.macro.transcription
+
+import java.text.DecimalFormat
+import java.text.SimpleDateFormat
+
+import javax.xml.stream.*
+
+import org.txm.doc.*
+import org.txm.importer.*
+import org.txm.importer.filters.*
+
+class TXT2TRS {
+
+	boolean inTurn = false
+	def locs = new HashSet<String>()
+	def lastTiming = "none"
+	String localname = null
+	String allTxt
+	String header = ""
+	String type = ""
+	boolean startOfP = false
+	boolean firstTurn = true
+	boolean firstSync = true
+	def loc = null
+	int time = 0;
+	boolean start= false;
+	boolean startTranscription=false
+	boolean isThemeOpened = false
+
+	def formater
+	def formater2
+	StaxStackWriter pagedWriter
+	
+	
+	//                 /\([0-9]+:[0-9][0-9]?:[0-9][0-9]?(\.[0-9])?\)|(¤<[0-9]+>)/
+	def bullet_regex = /\([0-9]+:[0-9][0-9]?:[0-9][0-9]?(\.[0-9])?\)|(¤<[0-9]+>)/
+	def turn_with_bullet = /.+(\([0-9]+:[0-9][0-9]?:[0-9][0-9]?(\.[0-9])?\)|(¤<[0-9]+>))/
+	//                  /([a-zA-Z]+)="([^"]+)"/
+	def section_regex = /([a-zA-Z]+)="([^"]+)"/
+	
+	public TXT2TRS() { }
+
+	public boolean process(File txtFile, File trsFile) {
+
+		def lines = txtFile.readLines("UTF-8")
+
+		formater = new SimpleDateFormat("h:mm:ss.S");
+		formater.setTimeZone(TimeZone.getTimeZone("GMT"));
+		formater2 = new DecimalFormat("#######.0")
+		formater2.setMaximumFractionDigits(2)
+
+		//println "Start writing TRS file..."
+		pagedWriter = new StaxStackWriter(trsFile, "UTF-8");
+		pagedWriter.writeStartDocument("UTF-8", "1.0")
+		//pagedWriter.writeDTD("<!DOCTYPE Trans SYSTEM \"trans-14.dtd\">") // removed because parser has the "no DTD" option set
+		pagedWriter.writeStartElement("Trans");
+		pagedWriter.writeAttribute("scribe", "SCRIBE");
+		pagedWriter.writeAttribute("audio_filename", "");
+		pagedWriter.writeAttribute("version", "1.0");
+		pagedWriter.writeAttribute("version_date", "110110");
+		pagedWriter.writeStartElement("Speakers");
+		pagedWriter.writeEndElement(); // Speakers
+		
+		pagedWriter.writeStartElement("Episode");
+		pagedWriter.writeAttribute("program", "NA");
+		pagedWriter.writeAttribute("air_date", "NA");
+		isThemeOpened = false
+		def firstTurn = true
+
+		// test if the transcription structure is : comment, start line, end line
+		def trslines = []
+		boolean started = false
+		for (String line : lines) {
+			line = line.trim()
+			if (line.matches("\\(.+:..:..\\..+\\)")) {
+				started = true;
+			}
+
+			if (started) { // get ttranscription lines
+				if (line.length() > 0) trslines << line
+			}
+		}
+
+		if (!started) {
+			println "The $txtFile file does not contain the first time bullet"
+			return false;
+		}
+		String lastLine = trslines[-1]
+		if (!lastLine.matches("\\(.+:..:..\\..+\\)")) {
+			// check if last turn has a bullet at the end
+			boolean bulletIsMissing = true;
+			for (int i = trslines.size() - 1 ; i > 0 ; i--) {
+				String line = trslines[i].trim()
+				def split = line.split("\t", 2)
+				//println "$line "+split.length+ " VS "+turn_with_bullet
+				if (split.length == 2) {
+				 	if (line.matches(turn_with_bullet)) {
+						bulletIsMissing = false;
+					} 
+					println "END $bulletIsMissing"
+					i=-1
+				}
+			}
+			if (bulletIsMissing) {
+				println "Error: The $txtFile file last line or last turn does not contain the end time bullet: $bullet_regex"
+				return false;
+			}
+		}
+
+		lines = trslines
+
+		def currentTime = lines[0] // get starting time
+
+		// group lines per Turn, Event, Comment...
+		def groups = [["sync", lines[0]]]
+		lines.remove(0)
+		def currentGroup = []
+
+		for (String line : lines) {
+			if (line.indexOf("\t") > 0) { // start of Turn
+				def split = line.split("\t", 2)
+				def loc = split[0]
+				def content = split[1]
+
+				if (currentGroup.size() > 0) {groups << currentGroup} // store previous group
+				currentGroup = ["turn", loc, content];
+
+			} else if (line.matches("(\\([^)]+\\) *)+")) {//("(") && line.endsWith(")")) { // comment or timing
+				if (line.matches(bullet_regex)) { // Sync in a Turn
+					if (currentGroup.size() > 0) {
+						currentGroup << line
+					} else {
+						if (currentGroup.size() > 0) {groups << currentGroup} // store previous group
+						groups << ["sync", line]
+					}
+				} else { // comment -> ignored
+					if (currentGroup.size() > 0) {groups << currentGroup} // store previous group
+					currentGroup = ["comment", line];
+				}
+			} else if (line.startsWith("[") && line.endsWith("]")) { // section, end of Turn
+				if (currentGroup.size() > 0) groups << currentGroup
+				groups << ["section", line]
+			} else { // something that happens during a Turn
+				currentGroup << line
+				
+			}
+		}
+
+		for (def g : groups) {
+			//println g
+			if (g[0] == "turn") {
+				String loc = g[1]
+				//println "process turn: "+g
+				def tokens = []
+				for (int i = 2 ; i < g.size() ; i++) {// speach starts for position 2
+					//println " process speach: "+g[i]
+					// 	tokenize time bullets, comment and speach
+
+
+					def turntokens = []
+					def toProcess = [g[i]]
+					def lastMatch = 0
+					// find Sync
+					while (toProcess.size() > 0) {
+						String txt = toProcess.pop()
+						boolean nomatch = true
+						def m = (txt =~ bullet_regex) // time
+						//if (m.size() > 0) {
+						while (m.find()) {
+							nomatch = false
+							//println "found: "+m.group()
+							// grab the string in between the end of the last match
+							// and the start of the current one (empty string if none)
+							String before = txt.substring(lastMatch, m.start())
+							if (before.length() > 0) turntokens << before
+							// grab the delimiter
+							turntokens << m.group()
+							// keep looking from the end of the current match
+							lastMatch = m.end()
+						}
+						if (nomatch) turntokens << txt
+						if (lastMatch > 0 && lastMatch < txt.length()) turntokens << txt.substring(lastMatch)
+					}
+					//println "  speach+syncs="+turntokens
+
+					// find Comments (....)
+					toProcess = turntokens
+					turntokens = []
+					
+					while (toProcess.size() > 0) {
+						String txt = toProcess.remove(0)
+						
+						boolean nomatch = true
+						def m = (txt =~ /(\([^)]+\))/) // time
+						//if (m.size() > 0) {
+						lastMatch = 0
+						while (m.find()) {
+							nomatch = false
+							//println "found: "+m.group()
+							// grab the string in between the end of the last match
+							// and the start of the current one (empty string if none)
+							String before = txt.substring(lastMatch, m.start())
+							if (before.length() > 0) turntokens << before
+							// grab the delimiter
+							turntokens << m.group()
+							// keep looking from the end of the current match
+							lastMatch = m.end()
+						}
+						if (nomatch) turntokens << txt
+						if (lastMatch > 0 && lastMatch < txt.length()) turntokens << txt.substring(lastMatch)
+					}
+					//println "  speach+syncs+comments="+turntokens
+					//					if (!processCommentAndSync(g[i])) {
+					//						println "ERROR $lastTiming 'contains ([]) but malformed' error line "+parser.getLocation().getLineNumber()+" : $allTxt"
+					//					}
+					tokens.addAll(turntokens)
+				}
+
+				if (firstTurn && !isThemeOpened) {
+					isThemeOpened = true;
+					
+					pagedWriter.writeStartElement("Section");
+					pagedWriter.writeAttribute("type", "report");
+					pagedWriter.writeAttribute("topic", "");
+					pagedWriter.writeAttribute("startTime", "0.0");
+					pagedWriter.writeAttribute("endTime", "");
+				}
+				firstTurn = false
+				pagedWriter.writeCharacters("\n")
+				pagedWriter.writeStartElement("Turn");
+				pagedWriter.writeAttribute("speaker", loc);
+				pagedWriter.writeAttribute("startTime", "");
+				pagedWriter.writeAttribute("endTime", "");
+				pagedWriter.writeCharacters("\n")
+				writeSync(currentTime)
+
+				String previousToken = ""
+				for (def t : tokens) {
+					if (t.matches(bullet_regex)) {
+						writeSync(t)
+						currentTime = t
+					}  else if (t.startsWith("(") && t.endsWith(")") ){
+						pagedWriter.writeCharacters("\n")
+						pagedWriter.writeEmptyElement("Comment")
+						pagedWriter.writeAttribute("desc", t.substring(1, t.length() -1))
+					}else {
+						pagedWriter.writeCharacters(" "+t)
+					}
+				}
+
+				pagedWriter.writeCharacters("\n")
+				pagedWriter.writeEndElement(); // Turn
+			} else if (g[0] == "sync") {
+				currentTime = g[1]
+				writeSync(currentTime)
+			} else if (g[0] == "comment") {
+//				println "process comment: "+g[1]
+				pagedWriter.writeCharacters("\n")
+				pagedWriter.writeEmptyElement("Comment")
+				pagedWriter.writeAttribute("desc", g[1].substring(1, g[1].length() -1))
+			} else if (g[0] == "section") {
+//				println "process section: "+g[1]
+				
+				def m = (g[1] =~ section_regex) // time
+				if (m.size() > 0) {
+					if (isThemeOpened) {
+						pagedWriter.writeCharacters("\n")
+						pagedWriter.writeEndElement(); // previous Section
+					}
+					isThemeOpened = true;
+					pagedWriter.writeCharacters("\n")
+					pagedWriter.writeStartElement("Section");
+					def attr = ["type":"report", "topic":"", "startTime":"", "endTime":""]
+					
+					for (def match : m) {
+						if (match.size() == 3) {
+							attr[match[1]]=match[2];
+						} else {
+							println "ERROR $lastTiming malformed section attribute "+g[1]+ "near $currentTime"
+						}
+					}
+					
+					// write attributes
+					for (def k : attr.keySet())	pagedWriter.writeAttribute(k, attr[k]);
+				} else {
+					println "ERROR $lastTiming malformed section "+g[1]
+				}
+			} else {
+				println "Error: found malformed line: "+g
+			}
+		}
+
+		boolean ret = true
+		if (isThemeOpened) { // close previous theme
+			pagedWriter.writeCharacters("\n")
+			pagedWriter.writeEndElement(); // Section
+		}
+
+		//pagedWriter.writeEndElement(); // Section
+		pagedWriter.writeCharacters("\n")
+		pagedWriter.writeEndElement(); // Episode
+		pagedWriter.writeCharacters("\n")
+		pagedWriter.writeEndElement(); // Trans
+
+		ret = true
+
+		pagedWriter.close()
+		return ret
+	}
+
+	def writeSync(String txt) {
+		//println "write time code $txt"
+		pagedWriter.writeEmptyElement("Sync");
+		if (txt.startsWith("¤")) { // ¤<5648>
+			String time = txt.substring(2, txt.length()-1)
+			pagedWriter.writeAttribute("time", time.substring(0,time.length()-3)+"."+time.substring(time.length()-3));
+		} else {
+			String str = txt.substring(1, txt.length()-1)
+			Date date = formater.parse(str);
+			pagedWriter.writeAttribute("time", ""+(date.getTime()/1000.0f));
+		}
+		pagedWriter.writeCharacters("\n")
+	}
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/macro/transcription/package.html
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/macro/transcription/package.html	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/macro/transcription/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Macros which transform transcriptions written in ODT, WORD or RTF (like Transana) files to the Transcriber format</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/org/txm/macro/transcription/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/macro/transcription/HTML2TRS.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/macro/transcription/HTML2TRS.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/macro/transcription/HTML2TRS.groovy	(revision 258)
@@ -0,0 +1,331 @@
+// 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
+// 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.
+
+package org.txm.macro.transcription
+
+import java.text.DecimalFormat
+import java.text.SimpleDateFormat
+
+import javax.xml.stream.*
+
+import org.txm.doc.*
+import org.txm.importer.*
+import org.txm.importer.filters.*
+
+class HTML2TRS {
+
+	boolean inTurn = false
+	def locs = new HashSet<String>()
+	def lastTiming = "none"
+	String localname = null
+	String allTxt
+	String header = ""
+	String type = ""
+	boolean startOfP = false
+	boolean firstTurn = true
+	boolean firstSync = true
+	def loc = null
+	int time = 0;
+	boolean start= false;
+	boolean startTranscription=false
+	boolean isThemeOpened = false
+
+	def inputData
+	def factory
+	def parser
+	def formater
+	def formater2
+	StaxStackWriter pagedWriter
+	public HTML2TRS() { }
+	
+	public process(File xhtmlFile, File trsFile) {
+	
+		println "remove entities and doctype"
+		String text = xhtmlFile.getText("UTF-8")
+		text = text.replaceAll("&nbsp;", " ")
+		text = text.replaceAll("""<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">""", "")
+		xhtmlFile.withWriter("UTF-8") { writer ->
+			writer.write(text);
+		}
+		
+		inputData = xhtmlFile.toURI().toURL().openStream();
+		factory = XMLInputFactory.newInstance();
+		factory.setProperty(XMLInputFactory.SUPPORT_DTD, Boolean.FALSE);
+		parser = factory.createXMLStreamReader(inputData);
+		
+		formater = new SimpleDateFormat("h:mm:ss.S");
+		formater.setTimeZone(TimeZone.getTimeZone("GMT"));
+		formater2 = new DecimalFormat("#######.0")
+		formater2.setMaximumFractionDigits(2)
+	
+		println "start writing TRS file"
+		pagedWriter = new StaxStackWriter(trsFile, "UTF-8");
+		pagedWriter.writeStartDocument("UTF-8", "1.0")
+		//pagedWriter.writeDTD("<!DOCTYPE Trans SYSTEM \"trans-14.dtd\">") // removed because parser has the "no DTD" option set
+		pagedWriter.writeStartElement("Trans");
+		pagedWriter.writeAttribute("scribe", "SCRIBE");
+		pagedWriter.writeAttribute("audio_filename", "");
+		pagedWriter.writeAttribute("version", "1.0");
+		pagedWriter.writeAttribute("version_date", "110110");
+		pagedWriter.writeStartElement("Speakers");
+		pagedWriter.writeEndElement(); // Speakers
+
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+			switch (event) {
+				case XMLStreamConstants.START_ELEMENT:
+					localname = parser.getLocalName()
+					//println "start elem: "+localname
+					switch (localname) {
+						case "body": println "START OF BODY";start = true;
+							break;
+						case "p":
+							loc = null
+							allTxt = ""
+							type = "";
+							startOfP = true;
+							break
+					}
+					break;
+				case XMLStreamConstants.END_ELEMENT:
+					localname = parser.getLocalName()
+					switch (localname) {
+						case "body": start = false;
+							break
+						case "p":
+							//if (allTxt.length() > 0) allTxt = allTxt.substring(1)
+							//println "PTEXT '$allTxt'"
+							if (allTxt.indexOf("####") > 0) {
+								//println "SAY $txt"
+								if (allTxt.startsWith("\"")) allTxt = allTxt.substring(1)
+								loc = allTxt.substring(0, allTxt.indexOf("####")).trim()
+								locs.add(loc)
+								allTxt = allTxt.substring(allTxt.indexOf("####")+4) // remove " [A-Z]"
+								//println "LOC: '$loc'"
+								//println "LOC: '$allTxt'"
+							}
+							String trimedTxt = allTxt.trim()
+							if (startTranscription)
+							if (loc) {
+								inTurn = true;
+								pagedWriter.writeStartElement("Turn");
+								pagedWriter.writeAttribute("speaker", loc);
+								pagedWriter.writeAttribute("startTime", "");
+								pagedWriter.writeAttribute("endTime", "");
+								
+								// write Sync
+								if (firstTurn) {
+									writeTimeCode("(0:00:00.0)")
+									firstTurn = false;
+								} else {
+									pagedWriter.writeEmptyElement("Sync")
+									pagedWriter.writeAttribute("time", "");
+								}
+								
+								if (!processCommentAndSync(allTxt)) {
+									if (allTxt.trim().length() > 0)
+										println "ERROR $lastTiming 'contains ([]) but malformed' error line "+parser.getLocation().getLineNumber()+" : $allTxt"
+								}
+								//pagedWriter.writeCharacters(allTxt.replaceAll("\\(.+:..:..\\..+\\)", ""))
+								pagedWriter.writeEndElement(); // endTurn
+								
+								inTurn = false
+								time++;
+							} else { // Sync or Comment or Section : out of Turn 
+								if (allTxt.length() > 0)
+								if (trimedTxt.startsWith("(") && trimedTxt.endsWith(")")) {
+									if (!processCommentAndSync(allTxt)) {
+										if (allTxt.trim().length() > 0)
+											println "ERROR $lastTiming 'contains ([]) but malformed' line "+parser.getLocation().getLineNumber()+" : $allTxt"
+									}
+								} else if (trimedTxt.startsWith("[") && trimedTxt.endsWith("]")) {
+									println "SECTION: "+trimedTxt
+									def section_regex = /([a-zA-Z]+)="([^"]+)"/
+									def m = (trimedTxt =~ section_regex) // time
+									if (m.size() > 0) {
+										if (isThemeOpened)
+											pagedWriter.writeEndElement(); // previous Section
+										isThemeOpened = true;
+										pagedWriter.writeStartElement("Section");
+										pagedWriter.writeAttribute("type", "report");
+										pagedWriter.writeAttribute("topic", "");
+										pagedWriter.writeAttribute("startTime", "");
+										pagedWriter.writeAttribute("endTime", "");
+										for (def match : m) {
+											if (match.size() == 3) {
+												pagedWriter.writeAttribute(match[1], match[2]);
+											} else {
+												println "ERROR $lastTiming malformed section attribute "+trimedTxt
+											}
+										}
+									} else {
+										println "ERROR $lastTiming malformed section "+trimedTxt
+									}
+								} else if (allTxt.trim().length() > 0) {
+									println "ERROR $lastTiming 'not in Turn and not a comment' line "+parser.getLocation().getLineNumber()+" : $allTxt"
+								}
+							}
+		
+							allTxt = ""
+							break
+					}
+					break;
+					
+				case XMLStreamConstants.CHARACTERS:
+					String txt = parser.getText().replaceAll("\n", " ")
+					allTxt += txt.replaceAll("    ", "####")
+					//println allTxt+"\n\n"
+					if (!startTranscription && start && txt.matches("\\(.+:..:..\\..+\\)")) {
+						println "START with $txt"
+						startTranscription = true
+						
+						pagedWriter.writeStartElement("Episode");
+						pagedWriter.writeAttribute("program", "NA");
+						pagedWriter.writeAttribute("air_date", "NA");
+						isThemeOpened = true
+						pagedWriter.writeStartElement("Section");
+						pagedWriter.writeAttribute("type", "report");
+						pagedWriter.writeAttribute("topic", "");
+						pagedWriter.writeAttribute("startTime", "0.0");
+						pagedWriter.writeAttribute("endTime", "");
+					}
+					//println "$start $startTranscription "+txt.length()+" $startOfP"
+					if (start && startTranscription && txt.length() > 0 && startOfP) {
+						//println "first P: $txt $loc"
+						startOfP = false
+					}
+					break;
+				default: break;
+			}
+		}
+		boolean ret = true
+		if (startTranscription) {
+			if (isThemeOpened) { // close previous theme
+				pagedWriter.writeEndElement(); // Section
+			}
+			
+			//pagedWriter.writeEndElement(); // Section
+			pagedWriter.writeEndElement(); // Episode
+			pagedWriter.writeEndElement(); // Trans
+
+			ret = true
+		} else {
+			println "ERROR6: header not found"
+			ret = false;
+		}
+		pagedWriter.close()
+		return ret
+	}
+
+	def writeTimeCode(String txt) {
+		//println "write time code $txt"
+		String str = txt.substring(1, txt.length()-1)
+		Date date = formater.parse(str);
+		lastTiming = str;
+		if (inTurn || firstSync) {
+			pagedWriter.writeEmptyElement("Sync");
+			pagedWriter.writeAttribute("time", ""+(date.getTime()/1000.0f));
+		} else {
+			pagedWriter.writeStartElement("Turn");
+			pagedWriter.writeAttribute("speaker", "none");
+			pagedWriter.writeAttribute("startTime", "");
+			pagedWriter.writeAttribute("endTime", "");
+			inTurn = true
+			writeTimeCode(txt);
+			inTurn = false	
+			pagedWriter.writeEndElement(); // endTurn
+			//println "ERROR: can't write Sync out of Turn $txt at "+parser.getLocation().getLineNumber()
+		}
+		firstSync = false
+	}
+	
+	//                 /\([0-9]+:[0-9][0-9]?:[0-9][0-9]?(\.[0-9])?\)/
+	def bullet_regex = /\([0-9]+:[0-9][0-9]?:[0-9][0-9]?(\.[0-9])?\)/
+	def processCommentAndSync(String txt) {
+		if (txt.length() == 0) return true;
+		//println "process sync text: "+txt
+		boolean ret = true;
+		//find timing
+		//find comments
+		def allBySync = []
+		def all = []
+		def splits = []
+		def lastMatch = 0
+		
+		// split bullet from txt
+		def m = (txt =~ bullet_regex) // time
+		while (m.find()) {
+			//println "found: "+m.group()
+	   		// grab the string in between the end of the last match
+	   		// and the start of the current one (empty string if none)
+	   		allBySync << txt.substring(lastMatch, m.start())
+	   		// grab the delimiter
+	   		allBySync << m.group()
+	   		// keep looking from the end of the current match
+	   		lastMatch = m.end()
+		}
+		all = allBySync
+		// grab everything after the end of the last match
+		all << txt.substring(lastMatch)
+		//println "** $txt >> $all"
+		for (String str : all) {
+			if (str.trim().length() == 0) continue
+			if (str.matches(bullet_regex)) {
+				//println "TIMING: $str"
+				writeTimeCode(str)
+			} else {
+				int idxOpen = str.indexOf("(");
+				int idxClose = str.indexOf(")")
+				
+				while (idxOpen >=0 && idxClose > idxOpen) {
+					if (str.substring(0, idxOpen).length() > 0) {
+						if (loc != null) {
+							pagedWriter.writeCharacters(str.substring(0, idxOpen))
+							//println "SAY: "+str.substring(0, idxOpen)
+						} else {
+							if (str.trim().length() > 0)
+								println "WARNING $lastTiming no locutor at line "+parser.getLocation().getLineNumber()+" : $str"
+						}
+					}
+					pagedWriter.writeEmptyElement("Comment")
+					pagedWriter.writeAttribute("desc", str.substring(idxOpen+1, idxClose))
+					//println "COMMENT: "+str.substring(idxOpen+1, idxClose)
+					str = str.substring(idxClose+1)
+					idxOpen = str.indexOf("(");
+					idxClose = str.indexOf(")")
+				}
+				if (str.length() > 0) {
+					if (loc != null) {
+						pagedWriter.writeCharacters(str)
+					//	println "SAY: "+str
+					} else {
+						if (str.trim().length() > 0)
+							println "ERROR $lastTiming 'not in turn and not a comment' line "+parser.getLocation().getLineNumber()+" : $str"
+					}
+				}
+				if (str.contains("(") || str.contains("[") || str.contains(")") || str.contains("]")) {
+					ret = false;
+				}
+		  }
+		}
+		return ret;
+	}
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/macro/transcription/TextTranscription2TRS.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/macro/transcription/TextTranscription2TRS.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/macro/transcription/TextTranscription2TRS.groovy	(revision 258)
@@ -0,0 +1,257 @@
+// 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
+// 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.
+
+package org.txm.macro.transcription
+
+import javax.xml.stream.*
+
+import org.kohsuke.args4j.*
+import org.txm.doc.*
+import org.txm.importer.*
+import org.txm.importer.filters.*
+import org.txm.rcpapplication.swt.widget.parameters.*
+
+class TextTranscription2TRS {
+	boolean debug = false;
+	boolean isDirectory = false;
+	File outDir;
+	ConvertDocument converter;
+	def monitor
+
+	TextTranscription2TRS(File outDir, boolean debug, def monitor) {
+		this.outDir = outDir
+		this.monitor = monitor
+		this.debug = debug
+	}
+
+	boolean process(File file) {
+		try {
+			isDirectory = file.isDirectory();
+			if (isDirectory) {
+				return processDir(file)
+			} else {
+				return processFile(file, 100)
+			}
+		} catch(Exception e) {
+			println "Error while processing: "+e
+			if (debug) e.printStackTrace()
+		}
+	}
+
+	boolean processDir(File dir) {
+		boolean ret = true
+		try {
+			println "* Processing $dir directory"
+			converter = new ConvertDocument();
+			def files = dir.listFiles()
+			def okfiles = [];
+			if (files != null)
+				for (File file : files) {
+					String fname = file.getName().toLowerCase()
+					if ( file.isFile() &&
+					(fname.endsWith(".odt") || fname.endsWith(".doc") || fname.endsWith(".rtf") || fname.endsWith(".txt"))) {
+						okfiles << file
+					}
+
+				}
+
+			if (okfiles.size() == 0) {
+				println "No ODT/DOC/RTF file found in $dir"
+				return false
+			}
+
+			int delta = 100 / okfiles.size()
+			for (File file : okfiles) {
+				if (monitor != null) monitor.worked(0, "Processing file: $file")
+				if (!processFile(file, delta)) {
+					ret = false;
+					println "ERROR: Failed to process $file"
+				}
+
+				if (monitor != null && monitor.isCanceled()) {
+					break; // stop looping
+				}
+			}
+		} catch(Exception e) {
+			println "Error while processing directory: "+e;
+			if (debug) e.printStackTrace();
+		}
+		if (converter != null) converter.stop();
+		return ret;
+	}
+
+	boolean processFile(File docFile, int work) {
+		if (docFile == null) return false;
+		int delta = work / 5
+		println "** Processing $docFile file"
+		String filename = docFile.getName()
+		int idx = filename.indexOf(".")
+		if (idx < 0) return false;
+		String ext = filename.substring(idx)
+		filename = filename.substring(0, idx)
+
+		//File docFile = new File(srcDir, "${filename}$ext")
+		//		File htmlFile = new File(outDir, "${filename}.html")
+		//		File htmlFile2 = new File(outDir, "${filename}_temp.html")
+		//		File xhtmlFile = new File(outDir, "${filename}.xhtml")
+		//		File xmlFile = new File(outDir, "${filename}.xml")
+		File txtFile = new File(outDir, "${filename}.txt")
+		File trsFile = new File(outDir, "${filename}-tmp.trs")
+		File finalTrsFile = new File(outDir, "${filename}.trs")
+		boolean ret = false;
+		
+		if (!docFile.getName().toLowerCase().endsWith("txt")) {
+			if (monitor != null) monitor.worked(0, "DOCtoTXT: "+docFile.getName())
+
+			ret = DOCtoTXT(docFile, txtFile)
+			if (monitor != null) monitor.worked(delta, "DOCtoTXT: "+docFile.getName())
+			if (monitor != null && monitor.isCanceled()) {
+				println "Process interrupted by user"
+				return false;
+			}
+			if (!ret) return ret;
+		} else { // the document is already a TXT file
+			org.txm.utils.io.FileCopy.copy(docFile, txtFile)
+			ret = true
+		}
+
+		ret = ret && TXTtoTRS(txtFile, trsFile)
+		if (monitor != null) monitor.worked(delta, "TXTtoTRS: "+docFile.getName())
+		if (monitor != null && monitor.isCanceled()) {
+			println "Process interrupted by user"
+			return false;
+		}
+		if (!ret) return ret;
+
+		ret = ret && TRStoFixedTRS(trsFile, finalTrsFile);
+		if (monitor != null) monitor.worked(delta, "Done: "+docFile.getName())
+		if (monitor != null && monitor.isCanceled()) {
+			println "Process interrupted by user"
+			return false;
+		}
+		if (!ret) return ret;
+
+		// cleaning
+		System.gc()
+		if (!debug) {
+			//htmlFile.delete();htmlFile2.delete();xhtmlFile.delete();xmlFile.delete();
+			txtFile.delete()
+			trsFile.delete()
+		}
+
+		return ret
+	}
+
+	boolean DOCtoTXT(File docFile, File txtFile) {
+		println "*** ODT -> TXT"
+		try {
+			if (!isDirectory) converter = new ConvertDocument();
+			converter.setDebug(debug)
+			converter.autoFile(docFile, txtFile, "txt")
+		} catch(Exception e) {
+			println "Error while converting $docFile : $e"
+			if (debug) e.printStackTrace()
+		} finally {
+			if (!isDirectory && converter != null) converter.stop()
+		}
+		return txtFile.exists() && txtFile.length() > 0
+	}
+
+//	boolean HTMLtoHTMLforTidy(File htmlFile, File htmlFile2) {
+//		println "*** HTML -> HTML for tidy"
+//		try {
+//			println "replace TABS with 4 spaces"
+//			String text2 = htmlFile.getText("UTF-8")
+//			text2 = text2.replaceAll("&nbsp;", " ")
+//			text2 = text2.replaceAll("’", "'")
+//			text2 = text2.replaceAll("&rsquo;", "'")
+//			text2 = text2.replaceAll("\t", "&nbsp;&nbsp;&nbsp;&nbsp;")
+//			text2 = text2.replaceAll("\n", '&nbsp;')
+//			text2 = text2.replaceAll("\r\n", '&nbsp;')
+//			htmlFile2.withWriter("UTF-8") { writer ->
+//				writer.write(text2);
+//			}
+//		} catch(Exception e) {
+//			println "Error while preparing HTML of $htmlFile : $e"
+//			if (debug) e.printStackTrace()
+//		}
+//		return htmlFile2.exists() && htmlFile2.length() > 0
+//	}
+//
+//	boolean HTMLtoXHTML(File htmlFile2, File xhtmlFile) {
+//		println "*** HTML for tidy -> XHTML"
+//		try {
+//			Tidy tidy = new Tidy(); // obtain a new Tidy instance
+//			tidy.setXHTML(true); // set desired config options using tidy setters
+//			tidy.setInputEncoding("UTF-8")
+//			tidy.setOutputEncoding("UTF-8")
+//			tidy.setShowErrors(100)
+//			tidy.setShowWarnings(debug)
+//			tidy.setTabsize(10)
+//			tidy.setWraplen(9999)
+//			tidy.setForceOutput(true) // Tidy won't stop if error are found
+//			xhtmlFile.withWriter("UTF-8") { out ->
+//				def input = new InputStreamReader(htmlFile2.toURI().toURL().newInputStream(), "UTF-8")
+//				tidy.parse(input, out); // run tidy, providing an input and output stream
+//			}
+//			if (xhtmlFile.exists()) {
+//				// JTidy produced a "0x0" char. removing them
+//				// fix separated < and / ???
+//				def c = Character.toChars(0)[0]
+//				String txttmp = xhtmlFile.getText("UTF-8");
+//				xhtmlFile.withWriter("UTF-8") { out ->
+//					out.write(txttmp.replace("<\n/", "</").replace("<\r\n/", "</"))
+//				}
+//			}
+//		} catch(Exception e) {
+//			println "Error while applying JTidy: "+e
+//			if (debug) e.printStackTrace()
+//		}
+//		return xhtmlFile.exists() && xhtmlFile.length() > 0
+//	}
+
+	boolean TXTtoTRS(File txtFile, File trsFile) {
+		println "*** TXT -> TRS"
+		try {
+			TXT2TRS ht = new TXT2TRS();
+			ht.process(txtFile, trsFile);
+		} catch(Exception e) {
+			println "Error while creating TRS file: "+e
+			if (debug) e.printStackTrace()
+		}
+		return trsFile.exists() && trsFile.length() > 0
+	}
+
+	boolean TRStoFixedTRS(File trsFile, File finalTrsFile) {
+		println "*** TRS -> FIXED TRS"
+		try {
+			def timingfixer = new SetTRSTurnTimingsAndSpeakers(trsFile, finalTrsFile);
+			if (!timingfixer.process()) {
+				println "Error while fixing timing"
+			}
+		} catch(Exception e) {
+			println "Error while fixing TRS file: "+e
+			if (debug) e.printStackTrace()
+		}
+		return finalTrsFile.exists() && finalTrsFile.length() > 0
+	}
+}
+
Index: tmp/org.txm.core/src/groovy/org/txm/macro/transcription/TextTranscription2TRSMacro.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/macro/transcription/TextTranscription2TRSMacro.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/macro/transcription/TextTranscription2TRSMacro.groovy	(revision 258)
@@ -0,0 +1,54 @@
+// 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
+// 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.
+
+package org.txm.macro.transcription
+
+import org.kohsuke.args4j.*
+
+import groovy.transform.Field
+
+import org.txm.rcpapplication.swt.widget.parameters.*
+
+
+@Field @Option(name="odtDir", usage="Dossier qui contient les fichiers ODT", widget="Folder", required=true, def="")
+File odtDir;
+
+@Field @Option(name="debug", usage="Don't clean files, 'y' to enable debug", widget="String", required=false, def="n")
+def debug = "n";
+
+if (!ParametersDialog.open(this)) return;
+
+File outDir = new File(odtDir, "out") // write result in "out" folder
+
+outDir.deleteDir()
+outDir.mkdir()
+
+println "out: $outDir"
+println "odtDir: $odtDir"
+
+println "DEBUG: "+("y" == debug || "yes" == debug)
+
+if (!odtDir.exists()) {
+	println "$odtDir does not exists. Aborting"
+}
+def monitor = null
+TextTranscription2TRS trs = new TextTranscription2TRS(outDir, "y" == debug, monitor)
+trs.process(odtDir)
Index: tmp/org.txm.core/src/groovy/org/txm/macro/transcription/Transana2TRS.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/macro/transcription/Transana2TRS.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/macro/transcription/Transana2TRS.groovy	(revision 258)
@@ -0,0 +1,267 @@
+// 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
+// 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.
+
+package org.txm.macro.transcription
+
+import javax.xml.stream.*
+
+import org.kohsuke.args4j.*
+import org.txm.doc.*
+import org.txm.importer.*
+import org.txm.importer.filters.*
+import org.txm.rcpapplication.swt.widget.parameters.*
+import org.w3c.tidy.Tidy
+
+class Transana2TRS {
+	boolean debug = false;
+	boolean isDirectory = false;
+	File outDir;
+	File dtd;
+	ConvertDocument converter;
+	def monitor
+
+	Transana2TRS(File outDir, File dtd, boolean debug, def monitor) {
+		this.dtd = dtd;
+		this.outDir = outDir
+		this.monitor = monitor
+		this.debug = debug
+	}
+
+	boolean process(File file) {
+		try {
+			isDirectory = file.isDirectory();
+			if (isDirectory) {
+				return processDir(file)
+			} else {
+				return processFile(file, 100)
+			}
+		} catch(Exception e) {
+			println "Error while processing: "+e
+			if (debug) e.printStackTrace()
+		}
+	}
+
+	boolean processDir(File dir) {
+		boolean ret = true
+		try {
+			println "* Processing $dir directory"
+			converter = new ConvertDocument();
+			def files = dir.listFiles()
+			def okfiles = [];
+			if (files != null)
+				for (File file : files) {
+					String fname = file.getName().toLowerCase()
+					if ( file.isFile() &&
+					(fname.endsWith(".odt") || fname.endsWith(".doc") || fname.endsWith(".rtf"))) {
+						okfiles << file
+					}
+
+				}
+
+			if (okfiles.size() == 0) {
+				println "No ODT/DOC/RTF file found in $dir"
+				return false
+			}
+
+			int delta = 100 / okfiles.size()
+			for (File file : okfiles) {
+				monitor.worked(0, "Processing file: $file")
+				if (!processFile(file, delta)) {
+					ret = false;
+					println "ERROR: Failed to process $file"
+				}
+
+				if (monitor.isCanceled()) {
+					break; // stop looping
+				}
+			}
+		} catch(Exception e) {
+			println "Error while processing directory: "+e;
+			if (debug) e.printStackTrace();
+		}
+		if (converter != null) converter.stop();
+		return ret;
+	}
+
+	boolean processFile(File docFile, int work) {
+		if (docFile == null) return false;
+		int delta = work / 5
+		println "** Processing $docFile file"
+		String filename = docFile.getName()
+		int idx = filename.indexOf(".")
+		if (idx < 0) return false;
+		String ext = filename.substring(idx)
+		filename = filename.substring(0, idx)
+
+		//File docFile = new File(srcDir, "${filename}$ext")
+		File htmlFile = new File(outDir, "${filename}.html")
+		File htmlFile2 = new File(outDir, "${filename}_temp.html")
+		File xhtmlFile = new File(outDir, "${filename}.xhtml")
+		File xmlFile = new File(outDir, "${filename}.xml")
+		File trsFile = new File(outDir, "${filename}-tmp.trs")
+		File finalTrsFile = new File(outDir, "${filename}.trs")
+
+		monitor.worked(0, "DOCtoHTML: "+docFile.getName())
+
+		boolean ret = DOCtoHTML(docFile, htmlFile)
+		monitor.worked(delta, "HTMLtoHTMLforTidy: "+docFile.getName())
+		if (monitor.isCanceled()) {
+			println "Process interrupted by user"
+			return false;
+		}
+		if (!ret) return ret;
+
+		ret = ret && HTMLtoHTMLforTidy(htmlFile, htmlFile2)
+		monitor.worked(delta, "HTMLtoXHTML: "+docFile.getName())
+		if (monitor.isCanceled()) {
+			println "Process interrupted by user"
+			return false;
+		}
+		if (!ret) return ret;
+
+		ret = ret && HTMLtoXHTML(htmlFile2, xhtmlFile)
+		monitor.worked(delta, "XHTMLtoTRS: "+docFile.getName())
+		if (monitor.isCanceled()) {
+			println "Process interrupted by user"
+			return false;
+		}
+		if (!ret) return ret;
+
+		ret = ret && XHTMLtoTRS(xhtmlFile, trsFile)
+		monitor.worked(delta, "TRStoFixedTRS: "+docFile.getName())
+		if (monitor.isCanceled()) {
+			println "Process interrupted by user"
+			return false;
+		}
+		if (!ret) return ret;
+
+		ret = ret && TRStoFixedTRS(trsFile, finalTrsFile);
+		monitor.worked(delta, "Done: "+docFile.getName())
+		if (monitor.isCanceled()) {
+			println "Process interrupted by user"
+			return false;
+		}
+		if (!ret) return ret;
+
+		// cleaning
+		System.gc()
+		if (!debug) {
+			htmlFile.delete();htmlFile2.delete();xhtmlFile.delete();xmlFile.delete();trsFile.delete()
+		}
+
+		return ret
+	}
+
+	boolean DOCtoHTML(File docFile, File htmlFile) {
+		println "*** ODT -> HTML"
+		try {
+			if (!isDirectory) converter = new ConvertDocument();
+			converter.setDebug(debug)
+			converter.autoFile(docFile, htmlFile, "html")
+		} catch(Exception e) {
+			println "Error while converting $docFile : $e"
+			if (debug) e.printStackTrace()
+		} finally {
+			if (!isDirectory && converter != null) converter.stop()
+		}
+		return htmlFile.exists() && htmlFile.length() > 0
+	}
+
+	boolean HTMLtoHTMLforTidy(File htmlFile, File htmlFile2) {
+		println "*** HTML -> HTML for tidy"
+		try {
+			println "replace TABS with 4 spaces"
+			String text2 = htmlFile.getText("UTF-8")
+			text2 = text2.replaceAll("&nbsp;", " ")
+			text2 = text2.replaceAll("’", "'")
+			text2 = text2.replaceAll("&rsquo;", "'")
+			text2 = text2.replaceAll("\t", "&nbsp;&nbsp;&nbsp;&nbsp;")
+			text2 = text2.replaceAll("\n", '&nbsp;')
+			text2 = text2.replaceAll("\r\n", '&nbsp;')
+			htmlFile2.withWriter("UTF-8") { writer ->
+				writer.write(text2);
+			}
+		} catch(Exception e) {
+			println "Error while preparing HTML of $htmlFile : $e"
+			if (debug) e.printStackTrace()
+		}
+		return htmlFile2.exists() && htmlFile2.length() > 0
+	}
+
+	boolean HTMLtoXHTML(File htmlFile2, File xhtmlFile) {
+		println "*** HTML for tidy -> XHTML"
+		try {
+			Tidy tidy = new Tidy(); // obtain a new Tidy instance
+			tidy.setXHTML(true); // set desired config options using tidy setters
+			tidy.setInputEncoding("UTF-8")
+			tidy.setOutputEncoding("UTF-8")
+			tidy.setShowErrors(100)
+			tidy.setShowWarnings(debug)
+			tidy.setTabsize(10)
+			tidy.setWraplen(9999)
+			tidy.setForceOutput(true) // Tidy won't stop if error are found
+			xhtmlFile.withWriter("UTF-8") { out ->
+				def input = new InputStreamReader(htmlFile2.toURI().toURL().newInputStream(), "UTF-8")
+				tidy.parse(input, out); // run tidy, providing an input and output stream
+			}
+			if (xhtmlFile.exists()) {
+				// JTidy produced a "0x0" char. removing them
+				// fix separated < and / ???
+				def c = Character.toChars(0)[0]
+				String txttmp = xhtmlFile.getText("UTF-8");
+				xhtmlFile.withWriter("UTF-8") { out ->
+					out.write(txttmp.replace("<\n/", "</").replace("<\r\n/", "</"))
+				}
+			}
+		} catch(Exception e) {
+			println "Error while applying JTidy: "+e
+			if (debug) e.printStackTrace()
+		}
+		return xhtmlFile.exists() && xhtmlFile.length() > 0
+	}
+
+	boolean XHTMLtoTRS(File xhtmlFile, File trsFile) {
+		println "*** XHTML -> TRS"
+		try {
+			HTML2TRS ht = new HTML2TRS();
+			ht.process(xhtmlFile, trsFile);
+		} catch(Exception e) {
+			println "Error while creating TRS file: "+e
+			if (debug) e.printStackTrace()
+		}
+		return trsFile.exists() && trsFile.length() > 0
+	}
+
+	boolean TRStoFixedTRS(File trsFile, File finalTrsFile) {
+		println "*** TRS -> FIXED TRS"
+		try {
+			def timingfixer = new FixTransanaTimings(trsFile, finalTrsFile);
+			if (!timingfixer.process()) {
+				println "Error while fixing timing"
+			}
+		} catch(Exception e) {
+			println "Error while fixing TRS file: "+e
+			if (debug) e.printStackTrace()
+		}
+		return finalTrsFile.exists() && finalTrsFile.length() > 0
+	}
+}
+
Index: tmp/org.txm.core/src/groovy/org/txm/macro/txt/SearchInDirectoryMacro.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/macro/txt/SearchInDirectoryMacro.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/macro/txt/SearchInDirectoryMacro.groovy	(revision 258)
@@ -0,0 +1,45 @@
+package org.txm.macro.txt
+
+import org.kohsuke.args4j.*
+
+import groovy.transform.Field
+
+import java.nio.charset.Charset
+
+import org.txm.rcpapplication.swt.widget.parameters.*
+import org.txm.utils.*
+
+import javax.xml.stream.*
+
+import java.net.URL
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+@Field @Option(name="inputDirectory", usage="TXT directory", widget="Folder", required=false, def="txt")
+File inputDirectory;
+@Field @Option(name="regexp", usage="Regular expression to match", widget="String", required=false, def="p")
+String regexp;
+@Field @Option(name="encoding", usage="File encoding", widget="String", required=false, def="UTF-8")
+String encoding;
+
+if (!ParametersDialog.open(this)) return;
+
+def p = /$regexp/
+
+println "processing: "+inputDirectory.listFiles()
+for (File inputfile : inputDirectory.listFiles()) {
+	if (inputfile.isDirectory()) continue // ignore
+	
+	def lines = []
+	inputfile.eachLine("UTF-8") { line, n ->
+		def m = line =~ p
+		if ( m.size() > 0) {
+			lines << "  line $n: $line"
+		}
+	}
+	
+	println inputfile.getName() + " "+lines.size() + " match" +((lines.size() > 1)?"s":"")
+	if (lines.size() > 0) {
+		for (String s : lines ) println s
+	}
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/macro/txt/TXT2XMLMacro.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/macro/txt/TXT2XMLMacro.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/macro/txt/TXT2XMLMacro.groovy	(revision 258)
@@ -0,0 +1,47 @@
+package org.txm.macro.txt
+
+import org.kohsuke.args4j.*
+import groovy.transform.Field
+import java.nio.charset.Charset
+import org.txm.rcpapplication.swt.widget.parameters.*
+import org.txm.utils.*
+import javax.xml.stream.*
+import java.net.URL
+
+@Field @Option(name="inputDirectory", usage="TXT directory", widget="Folder", required=false, def="txt")
+File inputDirectory;
+
+@Field @Option(name="encoding", usage="File encoding", widget="String", required=false, def="UTF-8")
+String encoding;
+
+@Field @Option(name="rootTag", usage="rootTag", widget="String", required=false, def="doc")
+String rootTag;
+
+if (!ParametersDialog.open(this)) return;
+rootTag = rootTag.trim()
+encoding = encoding.trim()
+
+File outputDirectory = new File(inputDirectory, "out")
+outputDirectory.mkdir()
+println "processing: "+inputDirectory
+for (File inputfile : inputDirectory.listFiles()) {
+	if (inputfile.isDirectory() || inputfile.isHidden() || !inputfile.getName().endsWith(".txt")) continue // ignore
+	println " file: "+inputfile
+	
+	String name = inputfile.getName()
+	int idx = name.indexOf(".")
+	if (idx > 0) name = name.substring(0, idx)
+	File outputfile = new File(outputDirectory, name+".xml")
+	
+	XMLOutputFactory factory = XMLOutputFactory.newInstance()
+	FileOutputStream output = new FileOutputStream(outputfile)
+	XMLStreamWriter writer = factory.createXMLStreamWriter(output)
+
+	writer.writeStartDocument("UTF-8","1.0")
+	writer.writeCharacters("\n") // manage XML reserved characters
+	writer.writeStartElement(rootTag)
+	writer.writeCharacters(inputfile.getText(encoding)) // manage XML reserved characters
+	writer.writeEndElement() // rootTag
+	writer.close()
+	output.close()
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/macro/txt/CharListMacro.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/macro/txt/CharListMacro.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/macro/txt/CharListMacro.groovy	(revision 258)
@@ -0,0 +1,30 @@
+package org.txm.macro.txt;
+// STANDARD DECLARATIONS
+
+import org.kohsuke.args4j.*
+import groovy.transform.Field
+import org.txm.rcpapplication.swt.widget.parameters.*
+
+// BEGINNING OF PARAMETERS
+
+// Declare each parameter here
+// (available widget types: Query, File, Folder, String, Text, Boolean, Integer, Float and Date)
+
+@Field @Option(name="inputFile", usage="The file to read", widget="File", required=true, def="C:/Temp/foo.txt")
+def inputFile
+
+// Open the parameters input dialog box
+if (!ParametersDialog.open(this)) return;
+
+// END OF PARAMETERS
+
+String s = inputFile.getText()
+
+def dic = [:]
+
+for (char c : s) {
+	if (!dic.containsKey(c)) { dic[c] = 0 }
+	dic[c]++
+}
+
+for (def e : dic) { println(sprintf("%c\t%d", [e.getKey(), e.getValue()])) }
Index: tmp/org.txm.core/src/groovy/org/txm/macro/txt/ChangeEncodingMacro.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/macro/txt/ChangeEncodingMacro.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/macro/txt/ChangeEncodingMacro.groovy	(revision 258)
@@ -0,0 +1,76 @@
+// 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
+// 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.
+
+package org.txm.macro.txt
+
+import org.kohsuke.args4j.*
+import groovy.transform.Field
+import org.txm.rcpapplication.swt.widget.parameters.*
+import org.txm.utils.CharsetDetector
+
+@Field @Option(name="inputDirectory", usage="Dossier qui contient les fichiers à traiter", widget="Folder", required=true, def="")
+File inputDirectory
+
+@Field @Option(name="inputEncoding", usage="Input encoding", widget="String", required=false, def="")
+String inputEncoding
+
+@Field @Option(name="outputEncoding", usage="Output encoding", widget="String", required=true, def="UTF-8")
+String outputEncoding
+
+if (!ParametersDialog.open(this)) return;
+
+File outDir = new File(inputDirectory, "out") // write result in "out" folder
+if (outDir.exists()) {
+	if (!outDir.deleteDir()) {
+		println "Could not delete directory: $outDir"
+		return;
+	}
+}
+if (!outDir.mkdir()) {
+	println "Could not create directory: $outDir"
+	return;
+}
+println "Writing result in : $outDir"
+
+def processFile(File file, File outfile, String fromEncoding, String toutputEncoding) {
+	String text = file.getText(fromEncoding)
+	outfile.withWriter(toutputEncoding) {writer -> // read with the "fromEncoding"
+		writer.write(text) // write with the "toutputEncoding"
+	}
+}
+
+try {
+inputDirectory.eachFile { file ->
+	if (!file.isHidden() && !file.isDirectory()) {
+		String e = inputEncoding
+		if (inputEncoding == null || inputEncoding.length() == 0) {
+			CharsetDetector detector = new CharsetDetector(file)
+			e = detector.getEncoding()
+		}
+		
+		File outfile = new File(outDir, file.getName())
+		println "$e -> $outputEncoding : "+outfile.getName()
+		processFile(file, outfile, e, outputEncoding)
+	}
+}
+} catch (UnsupportedEncodingException e) {
+	println "ERROR: Unsupported encoding: "+e
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/macro/txt/SearchReplaceInDirectoryMacro.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/macro/txt/SearchReplaceInDirectoryMacro.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/macro/txt/SearchReplaceInDirectoryMacro.groovy	(revision 258)
@@ -0,0 +1,104 @@
+package org.txm.macro.txt
+// Copyright © - ENS de Lyon - http://textometrie.ens-lyon.fr
+// @author sheiden
+//
+// This file is part of the TXM platform.
+//
+// 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 3 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/>.
+//
+// $LastChangedDate: 2013-05-02 11:28:42 +0200 (jeu., 02 mai 2013) $
+// $LastChangedRevision: 2378 $
+// $LastChangedBy: sheiden $
+//
+
+// imports
+import org.kohsuke.args4j.*
+import groovy.transform.Field
+import org.txm.rcpapplication.swt.widget.parameters.*
+
+// parameters
+
+// **change this parameter**
+@Field @Option(name="inputDirectory", usage="Dossier qui contient les fichiers à modifier", widget="Folder", required=true, def='voeux')
+		inputDirectory = new File(System.getProperty("user.home"), "Bureau/voeux")
+
+// **change this parameter**
+@Field @Option(name="extension", usage="Regexp de l'extension des fichiers à modifier", widget="String", required=true, def='\\.txt')
+		extension = "\\.txt"
+
+// **change this parameter**
+@Field @Option(name="find", usage="Expression régulière", widget="String", required=true, def='’')
+		find = "’"
+
+// **change this parameter**
+@Field @Option(name="replaceWith", usage="Chaîne de remplacement", widget="String", required=false, def='\'')
+		replaceWith = "'"
+
+// **change this parameter**
+@Field @Option(name="encoding", usage="Encodage des fichiers", widget="String", required=true, def='UTF-8')
+		encoding = "utf-8"
+
+// **change this parameter**
+// 'true' = only display matching lines, 'false' = replace in matching files
+//@Field @Option(name="showMatchingFilesOnly", usage="Montrer seulement les matchs", widget="Boolean", required=false, def='false')
+		showMatchingFilesOnly = false;
+
+if (!ParametersDialog.open(this)) return;
+
+println "Working with $inputDirectory files with extension="+/.*$extension/
+if (showMatchingFilesOnly) {
+	println "Search '$find'"
+} else {
+	println "Replace '$find' with '$replaceWith'"
+}
+
+//find = /date="([0-9]+)-([0-9]+-[0-9]+)"/
+// **change this parameter**
+//replaceWith = 'date="$1-$2" year="$1"'
+// **change this parameter** (warning: '$1', '$2'... can be interpreted by Groovy in "..." strings)
+process(inputDirectory, extension, encoding, find, replaceWith, showMatchingFilesOnly)
+
+// main body
+def process(File inputDirectory, extension, encoding, find, replaceWith, showMatchingFilesOnly) {
+	
+	inputDirectory.eachFileMatch(~/.*$extension/) { file ->               // for each file matching extension
+		println "Processing: "+file.getName()
+//		if (showMatchingFilesOnly) {
+//			printMatches(file, encoding, find)
+//		} else {
+			replaceInFile(file, encoding, find,replaceWith)
+//		}
+	}
+}
+
+//def printMatches(File file, encoding, find) {
+//	file.eachLine(encoding) { line ->                  // for each line
+//		if (line.matches("$find")) { println " *match* : "+line }
+//	}
+//}
+
+def replaceInFile(File file, encoding,  find, replaceWith) {
+	def tmp = File.createTempFile("SearchReplaceInDirectoryTemp", ".tmp", file.getParentFile()) // create temporary file
+	tmp.write('')                                // create empty file
+	tmp.withWriter(encoding) { writer ->
+		String txt = file.getText(encoding);
+		writer.println txt.replaceAll(find, replaceWith)
+//		file.eachLine(encoding) { line ->                  // for each line
+//			writer.println line.replaceAll(find, replaceWith) // find&replace and print
+//		}
+		writer.close()
+	}
+	file.delete()
+	tmp.renameTo(file)                           // save results
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/macro/xml/XMLStatisticsMacro.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/macro/xml/XMLStatisticsMacro.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/macro/xml/XMLStatisticsMacro.groovy	(revision 258)
@@ -0,0 +1,28 @@
+package org.txm.macro.xml
+
+import org.txm.scripts.*
+import org.kohsuke.args4j.*
+import groovy.transform.Field
+import org.txm.rcpapplication.swt.widget.parameters.*
+
+@Field @Option(name="inputDirectory", usage="Dossier qui contient les fichiers à parser", widget="Folder", required=true, def="src")
+File inputDirectory;
+
+@Field @Option(name="tsvFile", usage="FichierTSV résultat", widget="File", required=true, def="file.tsv")
+File tsvFile;
+
+@Field @Option(name="usePaths", usage="FichierTSV résultat", widget="Boolean", required=true, def="false")
+def usePaths = true
+@Field @Option(name="useAttributes", usage="FichierTSV résultat", widget="Boolean", required=true, def="false")
+def useAttributes = true
+@Field @Option(name="useAttributeValues", usage="FichierTSV résultat", widget="Boolean", required=true, def="false")
+def useAttributeValues = true
+
+if (!ParametersDialog.open(this)) return;
+println "Input directory: "+inputDirectory
+println "TSV file: "+tsvFile
+println "use paths $usePaths"
+println "use attributes $useAttributes"
+println "use attributes values $useAttributeValues"
+
+XMLStatistics.processDirectory(inputDirectory, tsvFile, ".xml", usePaths, useAttributes, useAttributeValues);
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/macro/commands/CrossedPartitionBuilderMacro.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/macro/commands/CrossedPartitionBuilderMacro.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/macro/commands/CrossedPartitionBuilderMacro.groovy	(revision 258)
@@ -0,0 +1,337 @@
+package org.txm.macro.commands
+
+import groovy.transform.Field
+
+import org.kohsuke.args4j.*
+import org.txm.rcpapplication.swt.widget.parameters.*
+import org.txm.rcpapplication.views.*
+import org.txm.searchengine.cqp.corpus.*
+import org.txm.utils.logger.Log
+
+//BEGINNING OF PARAMETERS
+def corpus = corpusViewSelection
+if (!(corpus instanceof Corpus)) {
+	println "Error: this macro should be run with a Corpus selected"
+	return
+}
+
+@Field @Option(name="structuralUnit", usage="the structural Unit to use", widget="String", required=true, def="text")
+String structuralUnit = "text"
+
+@Field @Option(name="structuralUnitPropertiesList", usage="the structural Unit properties list separated with commas", widget="String", required=true, def="p1,p2")
+def structuralUnitPropertiesList = "loc, type";
+		
+//@Field @Option(name="expandTarget", usage="Expand structure", widget="String", required=false, def="")
+def expandTarget = "";
+
+//@Field @Option(name="structuralUnitToIgnore", usage="the structural Unit properties list to ignore separated with commas", widget="String", required=false, def="")
+def structuralUnitToIgnore = "";
+
+//@Field @Option(name="partitionName", usage="The partition name to use", widget="String", required=false, def="")
+def partitionName = ""
+
+//@Field @Option(name="partNamePrefix", usage="the part prefix to use", widget="String", required=true, def="")
+def partNamePrefix = ""
+
+@Field @Option(name="debug", usage="If debug, then show only queries", widget="Boolean", required=false, def="false")
+def debug = true;
+
+//Open the parameters input dialog box
+if (!ParametersDialog.open(this)) return;
+
+//END OF PARAMETERS
+
+/**
+ * Create partition with advanced CQL queries and autoname the parts.
+ * Can create partitions by defining a multi-level structural units hierarchy or by defining several properties values for one structural unit.
+ * Can define some structural units to remove from the resulting parts subcorpus.
+ * 
+ */
+
+// TODO: add this variables to the macro parameters
+
+def structuralUnits = []
+def structuralUnitProperties = []
+structuralUnit = structuralUnit.trim()
+structuralUnitPropertiesList = structuralUnitPropertiesList.trim()
+
+// Build lists
+def split = structuralUnit.split(",")
+def split2 = structuralUnitPropertiesList.split(",")
+if (split.size() == 1) {
+	for (String p : split2) {
+		p = p.trim();
+		structuralUnits << structuralUnit
+		structuralUnitProperties << p
+	}
+} else {
+	if (split.size() == split2.size()) {
+		for (int i = 0 ; i < split.size() ; i++) {
+			def su = split[i]
+			def p = split2[i];
+			structuralUnits << su
+			structuralUnitProperties << p
+		}
+	} else {
+		println "Error: structuralUnitList size is different from structuralUnitPropertiesList"
+		println "structuralUnitList=structuralUnitList=$structuralUnit structuralUnitPropertiesList=$structuralUnitPropertiesList"
+		return false
+	}
+}
+
+// check properties existance
+try {
+	boolean ok = true;
+	for (int i = 0 ; i < structuralUnits.size() ; i++) {
+		def suName = structuralUnits[i]
+		def pName = structuralUnitProperties[i]
+		
+		if (corpus.getStructuralUnit(suName) == null) {
+			println "Error: no '$suName' structure in the '$corpus' corpus"
+			ok = false;
+		} else {
+			def su = corpus.getStructuralUnit(suName)
+			for (String p : structuralUnitProperties) {
+				if (su.getProperty(pName) == null) {
+					println "Error: no '$pName' structure property in the '$corpus' corpus"
+					ok = false;
+				}
+			}
+		}
+	}
+	if (!ok) return;
+} catch(Exception e) {
+	println "Error: $e"
+	Log.printStackTrace(e)
+	return
+}
+
+
+
+//Running
+PartitionQueriesGenerator pqg = new PartitionQueriesGenerator();
+try {
+	def partition = pqg.createPartition(corpus, debug,
+			partitionName, partNamePrefix,
+			structuralUnits, structuralUnitProperties,
+			structuralUnitToIgnore, expandTarget);
+
+	if (partition != null)	{
+		monitor.syncExec(new Runnable() {
+					public void run() {
+						CorporaView.refresh();
+						CorporaView.expand(partition.getParent());
+					}
+				});
+	}
+} catch(Exception e) {
+	println "Exception $e"
+	Log.printStackTrace(e);
+	return;
+}
+
+/**
+ * Create a list of queries and part names regarding the structural units, structural units properties, structural units to ignore user defined lists and expand target value specified.
+ * @author s
+ *
+ */
+public class PartitionQueriesGenerator	{
+
+	public boolean DEBUG = false;					// si DEBUG, alors les requêtes sont affichées mais la partition n'est pas créée
+
+	public String PARTITION_NAME = "";				// Nom de la partition (optionnel)
+	public def STRUCTURAL_UNITS = [];				// Liste des unités structurelles sur lesquelles effectuer la partition, ex: ['text', 'div1']
+	public def STRUCTURAL_UNITS_PROPERTIES = [];	// Propriétés des unités structurelles sur lesquelles effectuer la partition, ex : ['id', 'name']
+	public def STRUCTURAL_UNITS_TO_IGNORE = [];	// Structure à ignorer, ex. CQL : !speaker (optionnel)
+	public String PART_NAMES_PREFIX = '';			// Prefix pour les noms de partie (optionnel)
+	public String EXPAND_TARGET = null;			// Expand to target, englobe les empans jusqu'à la balise parente spécifiée.
+	// NOTE : Le expand entre en conflit avec les sections à ignorer.
+	// Si la target est à un niveau supérieur aux balises à ignorer, il les remet dans liste de résultats CWB et elles ne sont donc pas ignorées
+
+	public def queries = [];
+	public def partNames = [];
+
+	/**
+	 * Init the generator and process.
+	 * @param corpusName
+	 */
+	public Partition createPartition(Corpus corpus, boolean debug,
+			String partitionName, String partNamePrefix,
+			def structuralUnits, def structuralUnitProperties,
+			def structuralUnitToIgnore, String expandTarget) 	{
+
+		PARTITION_NAME = partitionName
+		STRUCTURAL_UNITS = structuralUnits
+		STRUCTURAL_UNITS_PROPERTIES = structuralUnitProperties
+		STRUCTURAL_UNITS_TO_IGNORE = structuralUnitToIgnore
+		PART_NAMES_PREFIX = partNamePrefix
+		EXPAND_TARGET = expandTarget
+		DEBUG = debug;
+
+		if (DEBUG) {
+			println "Arguments: "
+			println "PARTITION_NAME = $PARTITION_NAME"
+			println "STRUCTURAL_UNITS = $STRUCTURAL_UNITS"
+			println "STRUCTURAL_UNITS_PROPERTIES = $STRUCTURAL_UNITS_PROPERTIES"
+			println "STRUCTURAL_UNITS_TO_IGNORE = $STRUCTURAL_UNITS_TO_IGNORE"
+			println "PART_NAMES_PREFIX = $PART_NAMES_PREFIX"
+			println "EXPAND_TARGET = $EXPAND_TARGET"
+			println "DEBUG = $DEBUG"
+		}
+
+		if (STRUCTURAL_UNITS.size() > 0 && STRUCTURAL_UNITS.size() == STRUCTURAL_UNITS_PROPERTIES.size())	{
+
+			if (DEBUG) println 'Creating the queries on corpus "' + corpus + "'" ;
+			if (DEBUG) println 'PARTITION_NAME: ' + PARTITION_NAME;
+
+			//Corpus corpus = CorpusManager.getCorpusManager().getCorpus(corpusName);
+
+			// Recursing through the corpus and subcorpus
+			process(corpus, 0, '', '');
+
+			// Displaying the queries
+			if (DEBUG) {
+				println "Queries processed: "
+				for (int i = 0 ; i < queries.size() ; i++) {
+					println partNames[i] + " = " + queries[i]
+				}
+			}
+
+			// Finalizing the queries
+			finalizeQueries();
+
+			// Displaying the queries
+			if (DEBUG) {
+				println "Queries finalized: "
+				for (int i = 0 ; i < queries.size() ; i++) {
+					println partNames[i] + " = " + queries[i]
+				}
+			}
+
+			if (DEBUG) println 'Queries created.';
+
+			// Creating the partition
+			if (!DEBUG  && queries.size() == partNames.size()) {
+				return corpus.createPartition(PARTITION_NAME, queries, partNames);
+			}
+		} else {
+			println "Error: Structural units count or structural units properties count error.";
+			return null
+		}
+	}
+
+	/**
+	 * Recurse through structural units and structural units properties of corpus and create the queries and the part names. 
+	 * @param corpus the corpus or subcorpus
+	 * @param index the index for recursion
+	 * @param tmpQuery the temporary query for creating subcorpus part
+	 * @param tmpPartName the temporary part name of the subcorpus part
+	 */
+	protected void process(Corpus corpus, int index, String tmpQuery, String tmpPartName)	{
+		// End of array
+		if (index >= STRUCTURAL_UNITS.size()) {
+
+			queries.add(tmpQuery);
+			partNames.add(PART_NAMES_PREFIX + tmpPartName);
+
+			return;
+		}
+
+		StructuralUnit su = corpus.getStructuralUnit(STRUCTURAL_UNITS[index]);
+		StructuralUnitProperty sup = su.getProperty(STRUCTURAL_UNITS_PROPERTIES[index]);
+
+		if (DEBUG) {
+			if (index == 0)	{
+				println 'Pocessing Structural Unit Property "' + sup.getFullName() + '" on mother corpus "' + corpus.getName() + '"';
+			} else {
+				println 'Pocessing Structural Unit Property "' + sup.getFullName() + '" on subcorpus part "' + tmpPartName + '"';
+			}
+		}
+
+
+		// Creating the queries parts for each structural units properties values
+		// for (supValue in sup.getOrderedValues()) { // TODO : signaler bug Matthieu, on ne devrait pas être obligé de repasser le sous-corpus à la méthode car sup a déjà été créée depuis le sous-corpus ? getValues() bugge aussi
+		for (supValue in sup.getOrderedValues(corpus)) {
+
+			// TODO : Log
+			if (DEBUG) println 'Value "' + supValue + '"';
+
+			// Getting the subcorpus linked to the structural unit property value
+			Subcorpus tmpSubcorpus = corpus.createSubcorpusWithQueryString(su, sup, supValue, "tmp" + UUID.randomUUID());
+
+			// Partition conditions and part name separators
+			String and = '';
+			String underscore = '';
+			if (tmpQuery != '')	{
+				underscore = ' ∩ ';
+				and = ' & ';
+			}
+
+			process(tmpSubcorpus, index + 1, (tmpQuery + and + '_.' + sup.getFullName() + '="' + supValue + '"'), tmpPartName + underscore + supValue);
+
+			// Deleting the temporary subcorpus
+			// TODO : bug : cette méthode ne supprime pas le corpus sans doute car il faut que le sous-corpus ne contienne pas d'autres sous-corpus ? le delete() en revanche fonctionne.
+			//			corpus.dropSubcorpus(tmpSubcorpus);
+			tmpSubcorpus.delete();
+		}
+	}
+
+
+	/**
+	 * 	Autoname the partition.
+	 * @param partitionName
+	 */
+	protected void autoNamePartition(String partitionName) {
+
+		// Structural units names and properties
+		for (int i = 0; i < STRUCTURAL_UNITS.size(); i++) {
+			partitionName +=  STRUCTURAL_UNITS[i] + '_' + STRUCTURAL_UNITS_PROPERTIES[i] + ' x ';
+		}
+
+		// Structural units to ignore
+		for (int i = 0; i < STRUCTURAL_UNITS_TO_IGNORE.size(); i++) {
+			partitionName +=  'NOT_' + STRUCTURAL_UNITS_TO_IGNORE[i] + '.';
+		}
+
+		// Removing last 'x' in partition name
+		PARTITION_NAME = partitionName.substring(0, partitionName.length() - 3);
+	}
+
+	/**
+	 * Finalize the queries.
+	 */
+	protected void finalizeQueries() {
+
+		String expandTo = '';
+		// Expanding to user defined target
+		if (EXPAND_TARGET != null && EXPAND_TARGET.length() > 0) {
+			expandTo = ' expand to ' + EXPAND_TARGET;
+		}
+		// Expanding to last child structural unit in user defined hierarchy
+		else if(STRUCTURAL_UNITS_TO_IGNORE.size() == 0)	 {
+			expandTo = ' expand to ' + STRUCTURAL_UNITS[STRUCTURAL_UNITS.size() - 1];
+		}
+
+		// Autonaming the partition
+		if (PARTITION_NAME != null && PARTITION_NAME.length() == 0) {
+			autoNamePartition(PARTITION_NAME);
+			// Finalizing partition name
+			if (EXPAND_TARGET != null && EXPAND_TARGET.length() > 0)
+				PARTITION_NAME += expandTo.replace(' expand to', '.EXPAND TO').replace(' ', '_');
+		}
+
+		// Finalizing queries
+		for (int j = 0; j < queries.size(); j++) {
+
+			String queryEnd = '';
+
+			// Removing some sections
+			for (sectionToIgnore in STRUCTURAL_UNITS_TO_IGNORE) {
+				queryEnd += ' & !' + sectionToIgnore;
+			}
+
+			queryEnd += ']' + expandTo;
+			queries.set(j, '[' +  queries.get(j) + queryEnd);
+		}
+	}
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/macro/r/PlotSpecifMacro.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/macro/r/PlotSpecifMacro.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/macro/r/PlotSpecifMacro.groovy	(revision 258)
@@ -0,0 +1,99 @@
+package org.txm.macro.r;
+// Copyright © 2013-2016 ENS de Lyon, University of Franche-Comté.
+// 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
+// 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.
+// 
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+
+import org.kohsuke.args4j.*
+import groovy.transform.Field
+import org.txm.rcpapplication.swt.widget.parameters.*
+import org.txm.rcpapplication.commands.*
+import org.txm.Toolbox
+import org.txm.stat.engine.r.RWorkspace
+
+/**
+ * 
+ * @authors Matthieu Decorde, Serge Heiden, Achille Falaise.
+ * 
+ * Sample default values from:
+ *  Lafon, P. “Sur la variabilité de la fréquence des formes dans un corpus.” Mots, no. 1 (1980):
+ *  Robespierre 'peuple' word in D9 part example (see Figure 1), pp 140-141.
+ *  <http://www.persee.fr/web/revues/home/prescript/article/mots_0243-6450_1980_num_1_1_1008>.
+ *  
+**/
+
+@Field @Option(name="f", usage="La fréquence de la forme dans la partie", widget="Integer", required=true, def="11")
+def f;
+
+@Field @Option(name="F", usage="La fréquence totale de la forme dans le corpus", widget="Integer", required=true, def="296")
+def F;
+
+@Field @Option(name="t", usage="Le nombre d'occurrences de la partie", widget="Integer", required=true, def="1084")
+def t;
+
+@Field @Option(name="T", usage="Le nombre total d'occurrences du corpus", widget="Integer", required=true, def="61449")
+def T;
+
+// Open the parameters input dialog box
+if (!ParametersDialog.open(this)) return;
+
+// END OF PARAMETERS
+
+def r = RWorkspace.getRWorkspaceInstance()
+def file = File.createTempFile("txm", ".svg", new File(Toolbox.getParam(Toolbox.USER_TXM_HOME), "results"))
+
+/// BEGIN SCRIPTS
+def script ="""
+library(textometry)
+res <- specificities.distribution.plot($f, $F, $t, $T)
+"""
+/// END SCRIPTS
+r.plot(file, script)
+
+def px = r.eval('res$px').asDouble()
+def mode = r.eval('res$mode').asInteger()
+def pfsum = r.eval('res$pfsum'+"[$f+1]").asDouble()
+def isPositiveSpecificity = (f > mode.abs())  // True if S+
+def proba = pfsum.abs()  // Compute actual probability (should be a positive number, even for negative specificities, where pfsum = -probability)
+def specifSign = (isPositiveSpecificity ? "+" : "-")
+def specif = Math.log10(proba).abs()  // Compute actual specificity
+def operatorForDisplay = isPositiveSpecificity ? '>=' : '<='
+
+println """
+P(f'=f) et P(f' $operatorForDisplay f)
+f	F	t	T
+$f	$F	$t $T
+P(f' = $f) = $px
+mode = $mode
+P(f' $operatorForDisplay $f) = $proba
+Specificity S$specifSign = $specif
+"""
+println "Result saved in: "+file.getAbsolutePath()
+
+//display the graphic
+monitor.syncExec(new Runnable() {
+	@Override
+	public void run() {	OpenSVGGraph.OpenSVGFile(file.getAbsolutePath(), "Specificity distribution") }
+});
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/macro/cqp/CreateCQPListMacro.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/macro/cqp/CreateCQPListMacro.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/macro/cqp/CreateCQPListMacro.groovy	(revision 258)
@@ -0,0 +1,118 @@
+// 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
+// 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.
+
+package org.txm.macro.cqp
+
+/*
+This macro allows you to define CQL lists which you can call in CQP queries during the current session.
+To use this macro for your own lists,
+1. Find below an example of the type of list you want to create
+   (case 1 = explicit list, or case 2 = list from file),
+2. Copy then paste this example (5 lines) after the given examples
+3. Give the name for your list as a string after list_name=
+4. Give the content of the list as a string after
+either list_value= (for case 1, explicit list)
+or list_path= (for case 2, list from file).
+5. Save this file (macro code)
+6. Run the macro by double-clicking on it.
+The lists are defined only for the current session.
+To use the same lists in a new session, just run the macro to generate the lists again.
+*/
+
+import org.txm.Toolbox
+import org.txm.searchengine.cqp.*
+
+def CQI = Toolbox.getCqiClient();
+if ((CQI instanceof NetCqiClient)) {
+	println "Error: only available in CQP memory mode"
+	return;
+}
+
+def list_name=""
+def list_value=""
+def list_path=""
+def cqp_value=""
+File f;
+try {
+
+// BEGIN CONFIGURATION HERE
+
+// 1st case : explicit lists
+list_name = "negatif"
+list_value = "rien non ne pas sans"
+
+cqp_statement = "define \$$list_name = \"$list_value\";"
+println "CQP executes : $cqp_statement"
+CQI.query(cqp_statement)
+
+// two other examples of 1st case (explicit list)
+// 1st explicit list
+list_name = "evaluation"
+list_value = "trop assez peu bien très beaucoup vraiment"
+
+cqp_statement = "define \$$list_name = \"$list_value\";"
+println "CQP executes : $cqp_statement"
+CQI.query(cqp_statement)
+
+// 2nd explicit list
+list_name = "categoriesmotsvides"
+list_value = "ABR ADV DET:ART DET:POS INT KON NUM PRO PRO:DEM PRO:IND PRO:PER PRO:POS PRO:REL PRP PRP:det PUN PUN:cit SENT SYM"
+
+cqp_statement = "define \$$list_name = \"$list_value\";"
+println "CQP executes : $cqp_statement"
+CQI.query(cqp_statement)
+
+// one example of regular expression list to be used with RE()
+list_name = "regexp_categoriesmotsvides"
+list_value = "ABR ADV DET.* INT KON NUM PRO.* PRP.* PUN.* SENT SYM"
+
+cqp_statement = "define \$$list_name = \"$list_value\";"
+println "CQP executes : $cqp_statement"
+CQI.query(cqp_statement)
+
+// 2nd case : list from a file
+
+list_name = "motsvides"
+list_path = System.getProperty("user.home")+"/TXM/cqp/listes/stopwords_fr_ranknl.txt"
+// Windows users must replace "/" with "\\". 
+// for instance : 
+// list_path = System.getProperty("user.home")+"\\TXM\\cqp\\listes\\stopwords_fr_ranknl.txt"
+f = new File(list_path);
+if (f.exists()) {
+	cqp_statement = "define \$$list_name < \"$list_path\";"
+	println "CQP executes : $cqp_statement"
+	CQI.query(cqp_statement)
+} else {
+	println "Error: \"$f\" file does not exists"
+}
+
+/*
+You can comment a group of several lines of code
+using stars and slash like this.
+*/
+
+// END OF CONFIGURATION
+
+} catch (Exception e) {
+	println "Error during the \"$list_name\" list creation with the \"$list_value\" value"
+	println "CPQ statement was \"$cqp_statement\""
+	if (f != null) println "Last CQL file path was \"$f\""
+}
Index: tmp/org.txm.core/src/groovy/org/txm/macro/cqp/ExecCQPMacro.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/macro/cqp/ExecCQPMacro.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/macro/cqp/ExecCQPMacro.groovy	(revision 258)
@@ -0,0 +1,173 @@
+package org.txm.macro.cqp
+// Copyright © 2014 ENS de Lyon
+//
+// Authors:
+// - Matthieu Decorde
+// - Serge Heiden
+//
+// Licence:
+// This file is part of the TXM platform.
+// 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.
+//
+// Version:
+// $LastChangedDate: 2014-11-01 16:00:01 +0100 (sam., 1 nov. 2014) $
+// $LastChangedRevision: XXXX $
+// $LastChangedBy: sheiden $
+//
+
+//Title:
+// EN:
+// Macro to call directly internal CQP corpus engine statements
+//
+// Warning: This macro must be used by advanced users,
+// at the risk of compromising CQP engine stability for the current TXM session
+//
+//FR:
+// Macro de demande d'exécution directe d'instructions au moteur de corpus interne CQP
+//
+// Avertissement : Cette macro doit être utilisée par des utilisateurs avertis,
+// au risque de compromettre la stabilité du moteur CQP pour la session TXM courante
+
+// Necessary declarations - Déclarations préalables
+import org.kohsuke.args4j.*
+import groovy.transform.Field
+import org.txm.rcpapplication.swt.widget.parameters.*
+import org.txm.Toolbox
+import org.txm.searchengine.cqp.*
+
+// Sanity check - Vérification de cohérence
+def CQI = Toolbox.getCqiClient();
+if ((CQI instanceof NetCqiClient)) {
+	println "Error: CQP eval only available in CQP memory mode"
+	return;
+}
+
+// Parameter declaration - Déclaration du paramètre
+@Field @Option(name="statement", usage="CQP statement to execute (mind the ';' at the end)", widget="String", required=true, def="set da enpos;")
+String statement;
+
+// Usefull CQP statements - Instructions CQP Utiles //
+//
+// 1] Set a CQP variable - régler une variable CQP :
+// "set variable valeur;"
+//
+// Useful CQP variables
+// A) da = DefaultNonbrackAttr variable setting: the implicit word property in subsequent CQL queries
+//    For example, when DefaultNonbrackAttr=word, the "the" CQL query is interpreted by CQP as the '[word="the"]' query
+// Example Statements:
+// - set da word;     set implicit word property to "word" ('word' meaning graphical form of the word)
+// - set da enlemma;	set implicit word property to "enlemma" ('enlemma' meaning TreeTagger based 'En'glish 'Lemma')
+// - set da enpos;	set implicit word property to "enpos" ('enpos' meaning TreeTagger based 'En'glish 'P'art 'O'f 'S'peech)
+//
+// B) ms = MatchingStrategy variable setting: the CQL query word level iterators (?, *, +) resolution strategy used by CQP
+// Possible Statements:
+// - set ms shortest: ?, *, + word level operators should match sequences with the minimal number of words.
+//                    Optional words at the begining or at the end of the query are ignored.
+// - set ms standard: early match of ?, *, + word level operators are considered.
+//                    Optional words at the end of the query are ignored.
+// - set ms longest: ?, *, + word level operators should match sequences with the maximum number of words.
+// - set ms traditional: early match of ?, *, + word level operators are considered. Every sequence is returned.
+//
+// Example resolutions for each MatchingStrategy type 
+// (from The CQP Query Language Tutorial, (CWB version 2.2.b90), Stefan Evert, 10 July 2005)
+//
+// for the query:
+// [enpos="DET"]? [enpos="ADJ"]* [enpos="NN"] ([enpos="PREP"] [enpos="DET"]? [enpos="ADJ"]* [enpos="NN"])*
+//
+// Input:
+//     the old book on the table in the room
+//
+// - 'shortest' match strategy: (3 matches)
+// r1=         book
+// r2=                     table
+// r3=                                  room
+//
+// - 'longest' match strategy: (1 match)
+// r1= the old book on the table in the room
+//
+// - 'standard' matching strategy: (3 matches)
+// r1= the old book
+// r2=                 the table
+// r3=                              the room
+//
+// - 'traditional' matching strategy: (7 overlapping matches)
+// r1= the old book
+// r2=     old book
+// r3=         book
+// r4=                 the table
+// r5=                     table
+// r6=                              the room
+// r7=                                  room
+//
+// C) sr = StrictRegions variable setting: CQL queries must match a single structure
+// Possible Statements:
+// - set sr on: ?, *, + word level operators cannot cross a boundary of the structure involved in the query
+// - set sr off: ?, *, + word level operators can cross any number of boundaries of the structure involved in the query
+
+// Parameters settings UI
+if (!ParametersDialog.open(this)) {
+	println("** ExecCQLMacro error: Impossible to open Parameters settings UI dialog box.")
+	return
+}
+
+// Actual CQP call
+CQI.query(statement)
+
+// End of the macro
+
+/////////////////////////////////////
+//// CQP variables documentation ////
+/////////////////////////////////////
+
+//// Useful CQP variables ///
+// [da]	DefaultNonbrackAttr - implicit word property in queries ('word' by default)
+// [ms]	MatchingStrategy    - shortest | standard | longest | traditional
+// [sr]	StrictRegions       - single structure match
+
+//// Maybe useful variables ////
+// [o]	Optimize - simple regular expressions infixe optimizer
+// [hf]	HistoryFile
+// [wh]	WriteHistory
+
+//// Useless variables ////
+// [p]	 Paging
+// [pg]	 Pager
+// [h]	 Highlighting
+// [col] Colour
+// [pb]	 ProgressBar
+// [pp]	 PrettyPrint
+// [c]	 Context
+// [lc]	 LeftContext
+// [rc]	 RightContext
+// [ld]	 LeftKWICDelim
+// [rd]	 RightKWICDelim
+// [pm]	 PrintMode
+// [po]	 PrintOptions
+// [ps]	 PrintStructures
+// [sta] ShowTagAttributes
+// [st]	 ShowTargets
+// [as]	 AutoShow
+// [es]	 ExternalSort
+// [esc] ExternalSortCommand
+// 	     AutoSave
+// 	     SaveOnExit
+// 	     Timing
+
+//// Variables that must not be changed ////
+// [r]	 Registry
+// [dd]	 DataDirectory
+// [sub] AutoSubquery
Index: tmp/org.txm.core/src/groovy/org/txm/macro/cqp/SetMatchingStrategyMacro.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/macro/cqp/SetMatchingStrategyMacro.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/macro/cqp/SetMatchingStrategyMacro.groovy	(revision 258)
@@ -0,0 +1,42 @@
+package org.txm.macro.cqp
+
+// STANDARD DECLARATIONS
+import org.kohsuke.args4j.*
+import groovy.transform.Field
+import org.txm.rcpapplication.swt.widget.parameters.*
+import org.txm.Toolbox
+import org.txm.searchengine.cqp.*
+
+def current = System.getProperty("cqp_matching_strategy")
+if (current != null)
+	println "Current strategy is: $current"
+
+def CQI = Toolbox.getCqiClient();
+if ((CQI instanceof NetCqiClient)) {
+	println "Error: only available in CQP memory mode"
+	return;
+}
+
+// BEGINNING OF PARAMETERS
+@Field @Option(name="matchingStrategy", usage="CQL matching strategy", widget="String", required=false, def="shortest | standard | longest | traditional")
+def matchingStrategy 
+// Open the parameters input dialog box
+if (!ParametersDialog.open(this)) return;
+// END OF PARAMETERS
+
+matchingStrategy = matchingStrategy.trim().toLowerCase();
+switch(matchingStrategy ) {
+	case "shortest":
+	case "standard":
+	case "longest":
+	case "traditional":
+		println "Setting Greedy to $matchingStrategy "
+		CQI.query("set MatchingStrategy ${matchingStrategy };")
+		System.setProperty("cqp_matching_strategy",matchingStrategy ) 
+	break
+	case "shortest | standard | longest | traditional":
+		println "You must choose between shortest, standard, longest or traditional"
+	break
+	default:
+		println "Unknown matching strategy: ${matchingStrategy}. Aborting "
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/macro/text/Text2TXTMacro.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/macro/text/Text2TXTMacro.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/macro/text/Text2TXTMacro.groovy	(revision 258)
@@ -0,0 +1,40 @@
+package org.txm.macro.text;
+// STANDARD DECLARATIONS
+
+import org.kohsuke.args4j.*
+import groovy.transform.Field
+import org.txm.rcpapplication.swt.widget.parameters.*
+import org.txm.doc.*;
+import org.txm.importer.*;
+
+// BEGINNING OF PARAMETERS
+@Field @Option(name="inputDirectory", usage="the directory containing the DOC/ODT/RTF files to convert", widget="Folder", required=true, def="")
+File inputDirectory
+
+@Field @Option(name="extension", usage="an example file", widget="String", required=true, def="(odt|doc|rtf|html)")
+String extension = "doc"
+
+// Open the parameters input dialog box
+if (!ParametersDialog.open(this)) return;
+
+boolean debug = false;
+
+ConvertDocument converter;
+def files = []
+try {
+	converter = new ConvertDocument();
+	inputDirectory.eachFileMatch(~/.+\.$extension/) { docFile ->
+		String name = docFile.getName()
+		name = name.substring(0, name.indexOf("."))
+		def txtFile = new File(docFile.getParentFile(), name+".txt")
+		converter.autoFile(docFile, txtFile, "txt")
+		files << docFile
+	}
+} catch(Exception e) {
+	println "Error while processing directory: "+e;
+	if (debug) e.printStackTrace();
+}
+if (converter != null) converter.stop();
+
+println "Processed directory: $inputDirectory"
+println "files: "+files
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/macro/xsl/ExecXSLMacro.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/macro/xsl/ExecXSLMacro.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/macro/xsl/ExecXSLMacro.groovy	(revision 258)
@@ -0,0 +1,68 @@
+package org.txm.macro.xsl;
+// STANDARD DECLARATIONS
+
+import org.kohsuke.args4j.*
+import groovy.transform.Field
+import org.txm.rcpapplication.swt.widget.parameters.*
+import org.txm.importer.ApplyXsl2;
+
+// BEGINNING OF PARAMETERS
+@Field @Option(name="XSLFile", usage="an example file", widget="File", required=true, def="file.xsl")
+def XSLFile = new File(System.getProperty("user.home"),"TXM/xsl/identity.xsl")
+
+@Field @Option(name="intputDirectory", usage="an example folder", widget="Folder", required=true, def="in")
+def intputDirectory = new File(System.getProperty("user.home"),"xml/TESTS2/xml")
+
+@Field @Option(name="outputDirectory", usage="an example folder", widget="Folder", required=true, def="out")
+def outputDirectory = new File("/tmp/xsltest")
+
+//@Field @Option(name="parameters", usage="an example folder", widget="Text", required=false, def="")
+def parameters = ""
+
+@Field @Option(name="debug", usage="Show debug messages, value = true|false", widget="String", required=true, def="false")
+def debug
+
+if (!ParametersDialog.open(this)) return;
+// END OF PARAMETERS
+
+debug = "true" == debug
+
+outputDirectory.mkdir()
+
+parameters = parameters.trim()
+if (parameters.length() == 0) {
+	parameters = null
+} else {
+	def split = parameters.split("\n")
+	parameters = []
+	for (def str : split) {
+		def split2 = str.split("=", 2)
+		if (split2.size() == 2) {
+			parameters << split2
+		}
+	}
+}
+
+println "Use XSL $XSLFile with parameters $parameters"
+println "Processed directory: $intputDirectory"
+
+def files = [] 
+ApplyXsl2 a = new ApplyXsl2(XSLFile.getAbsolutePath());
+intputDirectory.eachFileMatch(~/.+\.(xml|XML)/) { XMLFile ->
+	String name = XMLFile.getName()
+	try {
+		
+		def outFile = new File(outputDirectory, name)
+		if (parameters != null) {
+			for(def param : parameters) {
+				a.setParam(param[0], param[1])
+			}
+		}
+		a.process(XMLFile, outFile);
+		a.resetParams()
+		files << XMLFile
+	} catch (Exception e) {
+		println "Warning: XSL transformation of '$name' failed with error=$e with "
+		if (debug) e.printStackTrace(); 
+	}
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/ant/AntTest.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/ant/AntTest.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/ant/AntTest.groovy	(revision 258)
@@ -0,0 +1,20 @@
+package org.txm.ant;
+
+String userdir = System.getProperty("user.home");
+File libdir = new File(userdir, "Bureau/exportRCP/linux.gtk.x86/TXM/plugins");
+File srcdir = new File(userdir, "TXM/scripts/test")
+File destdir = new File(userdir, "TXM/scripts/bin")
+def ant = new AntBuilder().sequential {
+	//webinf = libdir.getAbsolutePath()
+	taskdef name: "groovyc", classname: "org.codehaus.groovy.ant.Groovyc"
+	groovyc srcdir: srcdir.getAbsolutePath(), destdir: destdir.getAbsolutePath(), {
+		classpath {
+			fileset dir: libdir.getAbsolutePath(), {
+		    	include name: "*.jar"
+			}
+			pathelement path: libdir.getAbsolutePath()+"/classes"
+		}
+		javac source: "1.5", target: "1.5", debug: "on"
+	}
+}
+println "fin"
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/org/txm/ant/Build3.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/ant/Build3.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/ant/Build3.groovy	(revision 258)
@@ -0,0 +1,19 @@
+package org.txm.ant;
+
+import java.io.IOException;
+
+import groovy.lang.Binding;
+import groovy.util.GroovyScriptEngine;
+import groovy.util.ResourceException;
+import groovy.util.ScriptException;
+
+		String userdir = System.getProperty("user.home");
+		String[] roots = [ userdir+"/TXM/scripts", userdir+"/TXM/scripts/test"];
+		GroovyScriptEngine gse = new GroovyScriptEngine(roots, this.getClass().getClassLoader());
+		//gse.loadScriptByName("test/B.groovy");
+		//System.out.println("B: " +gse.getResourceConnection("test/B.groovy"));
+		Binding binding = new Binding();
+		binding.setVariable("input", "world");
+		gse.run("test/A.groovy", binding);
+		
+	
Index: tmp/org.txm.core/src/groovy/org/txm/ant/package.html
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/ant/package.html	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/ant/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Contains prototypes of Ant Groovy scripts</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/org/txm/ant/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/ant/Build.java
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/ant/Build.java	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/ant/Build.java	(revision 258)
@@ -0,0 +1,184 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate: 2013-12-06 16:57:35 +0100 (ven., 06 déc. 2013) $
+// $LastChangedRevision: 2583 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.ant;
+
+import groovy.util.ResourceException;
+import groovy.util.ScriptException;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.types.selectors.FileSelector;
+import org.codehaus.groovy.ant.Groovyc;
+
+// TODO: Auto-generated Javadoc
+/**
+ *<taskdef name="groovyc"
+         classname="org.codehaus.groovy.ant.Groovyc"
+         classpathref=classpath/>
+ **/
+public class Build
+{
+
+	/**
+	 * Run.
+	 * @throws IOException 
+	 * @throws ScriptException 
+	 * @throws ResourceException 
+	 */
+	public void run() throws IOException, ResourceException, ScriptException
+	{
+		String userdir = System.getProperty("user.home");
+
+		Groovyc groovyc = new Groovyc();
+
+		groovyc.setCaseSensitive(true);
+		groovyc.setListfiles(true);
+		groovyc.setStacktrace(true);
+		groovyc.setVerbose(true);
+
+		System.out.println("Build project"); 
+		Project project = new Project();
+		project.setBaseDir(new File(userdir, "scripts"));
+		project.setName("Scripts");
+		project.setDescription("The TXM groovy scripts");
+		groovyc.setProject(project);
+		
+		System.out.println("Set libs classpath"); 
+		File libdir = new File(userdir, "Bureau/exportRCP/linux.gtk.x86/TXM/plugins");
+		Path classpath = groovyc.createClasspath();
+		FileSet fs = new FileSet();
+		fs.setDir(libdir);
+		fs.add(new FileSelector() {
+			@Override
+			public boolean isSelected(File arg0, String arg1, File arg2)
+					throws BuildException {
+					return true;
+			}
+		});
+		classpath.addFileset(fs);
+		classpath.setProject(project);	
+		
+		// src dir
+		Path srcdir = groovyc.createSourcepath();
+		srcdir.setLocation(new File(userdir, "scripts"));
+		srcdir.setProject(project);
+		
+		groovyc.setEncoding("UTF-8");
+		groovyc.setSrcdir(srcdir);
+		groovyc.setDestdir(new File(userdir, "scripts/bin"));
+		groovyc.setClasspath(classpath);
+
+		System.out.println("srcdir "+groovyc.getSrcdir());
+		System.out.println("destdir "+groovyc.getDestdir());
+		System.out.println("classpath "+groovyc.getClasspath());
+		System.out.println("encoding "+groovyc.getEncoding());
+
+		groovyc.execute();
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String args[])
+	{
+		try {
+			new Build().run();
+		} catch (IOException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (ResourceException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (ScriptException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+	}
+}
+/*
+class Build {
+String srcdirectory ="~/TXM/scripts/src"
+
+	AntBuilder ant = new AntBuilder().sequential {
+	def webinf = "."
+
+	taskdef name: "groovyc", classname: "org.codehaus.groovy.ant.Groovyc"
+	groovyc srcdir: "src", destdir: "${webinf}", encoding: "UTF-8", {
+		classpath {
+			fileset dir: "${webinf}/plugins", {
+		    	include name: "*.jar"
+			}
+			pathelement path: "${webinf}"
+		}
+		javac source: "1.5", target: "1.5", debug: "on"
+	}
+}
+
+
+   def base_dir = "./"
+   def src_dir = base_dir + "src"
+   def lib_dir = base_dir + "lib"
+   def build_dir = base_dir + "bin"
+   def dist_dir = base_dir + "dist"
+   def file_name = "mdecorde"
+
+   def clean() {
+      ant.delete(dir: "${build_dir}")
+      ant.delete(dir: "${dist_dir}")
+   }
+   def build() {
+      ant.mkdir(dir: "${build_dir}")
+      ant.javac(destdir: "${build_dir}", srcdir: "${src_dir}", classpath: "${classpath}")
+      ant.groovyc(destdir: "${build_dir}", srcdir: "${src_dir}", classpath: "${classpath}")              
+   }
+   def jar() {
+      clean()
+      build()
+      ant.mkdir(dir: "${dist_dir}")
+      ant.jar(destfile: "${dist_dir}/${file_name}.jar", basedir: "${build_dir}")
+   }
+   def static void main(args) {
+      Build b = new Build()
+      b.run(args)
+   }
+   void run(args) {
+      if ( args.size() > 0 ) { 
+         invokeMethod(args[0], null )
+      }
+      else {
+        // build()
+      } 
+   }
+}*/

Property changes on: tmp/org.txm.core/src/groovy/org/txm/ant/Build.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/org/txm/ant/Build2.java
===================================================================
--- tmp/org.txm.core/src/groovy/org/txm/ant/Build2.java	(revision 0)
+++ tmp/org.txm.core/src/groovy/org/txm/ant/Build2.java	(revision 258)
@@ -0,0 +1,19 @@
+package org.txm.ant;
+
+import groovy.lang.Binding;
+import groovy.util.GroovyScriptEngine;
+ 
+class Build2
+{
+	public void run() throws Exception
+	{
+		String userdir = System.getProperty("user.home");
+		String[] roots = new String[] { userdir+"/scripts"};
+		GroovyScriptEngine gse = new GroovyScriptEngine(roots, this.getClass().getClassLoader());
+		gse.run("A.groovy", new Binding());
+	}
+	public static void main(String args[]) throws Exception
+	{
+		new Build2().run();
+	}
+}

Property changes on: tmp/org.txm.core/src/groovy/org/txm/ant/Build2.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/filters/Tokeniser/TTTokenizer.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/filters/Tokeniser/TTTokenizer.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/filters/Tokeniser/TTTokenizer.groovy	(revision 258)
@@ -0,0 +1,290 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+
+
+package filters.Tokeniser
+import java.io.File;
+import java.util.regex.Pattern;
+import java.util.regex.Matcher;
+
+// TODO: Auto-generated Javadoc
+/**
+########################################################################
+#                                                                      #
+#  tokenization script for tagger preprocessing                        #
+#  Author: Helmut Schmid, IMS, University of Stuttgart                 #
+#          Serge Sharoff, University of Leeds                          #
+#  Groovy Translation: mdecorde                                        #
+#  Description:                                                        #
+#  - splits input text into tokens (one token per line)                #
+#  - cuts off punctuation, parentheses etc.                            #
+#  - disambiguates periods                                             #
+#  - preserves SGML markup                                             #
+#                                                                      #
+########################################################################
+*/
+class TTTokenizer {
+	
+	// characters which have to be cut off at the beginning of a word
+	
+	/** The P char. */
+	def PChar="\\[{(\\`\"‚„†‡‹‘’“”•–—›";
+	// characters which have to be cut off at the end of a word
+	
+	/** The F char. */
+	def FChar="\\]}'`\"),;:!?%‚„…†‡‰‹‘’“”•–—›";
+	// character sequences which have to be cut off at the beginning of a word
+	
+	/** The P clitic. */
+	def PClitic = "";
+	// character sequences which have to be cut off at the end of a word
+	
+	/** The F clitic. */
+	def FClitic = "";
+		
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args)
+	{
+		File input = new File("/home/mdecorde/xml/tokenizer/test.xml");
+		File output = new File("/home/mdecorde/xml/tokenizer/test-t.xml");
+		
+		def tokenizer = new TTTokenizer("", null);
+		tokenizer.run(input, output)
+	}
+	
+	
+	/** The Token. */
+	def Token = [:];
+	
+	/**
+	 * Instantiates a new tT tokenizer.
+	 *
+	 * @param lang the lang
+	 * @param abbr the abbr
+	 */
+	public TTTokenizer(String lang, File abbr) {
+		switch(lang) {
+		case "en": // English
+			  FClitic = "'(s|re|ve|d|m|em|ll)|n\'t";
+			  break;
+		case "it": // Italian
+			  PClitic = '[dD][ae]ll\'|[nN]ell\'|[Aa]ll\'|[lLDd]\'|[Ss]ull\'|[Qq]uest\'|[Uu]n\'|[Ss]enz\'|[Tt]utt\''
+			  break;
+		case "fr": // French
+			  PClitic = '[dcjlmnstDCJLNMST]\'|[Qq]u\'|[Jj]usqu\'|[Ll]orsqu\'';
+			  FClitic = '-t-elles?|-t-ils?|-t-on|-ce|-elles?|-ils?|-je|-la|-les?|-leur|-lui|-mmes?|-m\'|-moi|-nous|-on|-toi|-tu|-t\'|-vous|-en|-y|-ci|-l';
+			  break;
+		}
+		
+		if(abbr != null && abbr.canRead()) {
+			Reader reader = new FileReader(abbr);
+			String line = reader.readLine();
+			while(line != null) {
+				line = line.replaceAll("^[ \t\r\n]+", "");
+				line = line.replaceAll("^[ \t\r\n]+\$", "");
+				if(!(line.matches("^#") || line.matches("\\s\$"))) // ignore comments
+				{
+					Token.put(line, 1);
+				}
+				line = reader.readLine();
+			}
+			reader.close();
+		}
+	}
+	
+	/** The m. */
+	def m;
+	
+	/**
+	 * Run.
+	 *
+	 * @param input the input
+	 * @param output the output
+	 * @return true, if successful
+	 */
+	public boolean run(File input, File output) {
+		if(!input.canRead()){
+			println "Can't read input file: "+input
+			return false;
+		}
+		if(!output.getParentFile().canWrite()){
+			println "Can't write out file: "+input
+			return false;
+		}
+		
+		Reader reader = new FileReader(input);
+		Writer writer = new FileWriter(output);
+		String line = reader.readLine();
+		while(line != null) 
+		{
+			println "line: "+line
+			line = line.replaceAll("\t"," "); // replace newlines and tab characters with blanks
+			line = line.replaceAll("\n"," "); // replace newlines and tab characters with blanks
+			
+			String replace = line.replaceAll(/(<[^<> ]*) ([^<>]*>)/, '$1ÿ$2');
+			while(replace != line) // replace blanks within SGML tags
+			{
+				line = replace;
+				replace = replace.replaceAll(/(<[^<> ]*) ([^<>]*>)/, '$1ÿ$2');
+			}
+			line = replace;
+			
+			line = line.replaceAll(/ /, "þ"); // replace whitespace with a special character
+			// tr/\377\376/ \377/; // 377=ÿ , 376=þ
+			line = line.replaceAll(/ÿ/, " "); // restore SGML tags
+			line = line.replaceAll(/þ/, " ÿ"); // restore SGML tags
+			//line = line.replaceAll(/ÿ/," ");
+			
+			// prepare SGML-Tags for tokenization
+			line = line.replaceAll(/(<[^<>]*>)/, 'ÿ$1ÿ');
+			line = line.replaceAll(/^ÿ/,"");
+			line = line.replaceAll(/ÿ$/,"");
+			line = line.replaceAll(/ÿÿÿ*/,"ÿ");
+			
+			String[] split1 = line.split("ÿ");
+			boolean finish = true;
+			String suffix = "";
+			for(String s : split1)
+			{
+				if(s =~ /^<.*>$/) // SGML tag
+				{
+					writer.write("$s\n");
+				}
+				else { // add a blank at the beginning and the end of each segment
+					s = " $s ";
+					// insert missing blanks after punctuation
+					s = s.replaceAll(/(\.\.\.)/, " ... ");
+					s = s.replaceAll(/([;\!\?])([^ ])/, '$1 $2');
+					s = s.replaceAll(/([.,:])([^ 0-9.])/, '$1 $2');
+
+					for(String s2 : s.split(" "))
+					{
+						
+						finish = false;
+						suffix = "";
+						// separate punctuation and parentheses from words
+						while(!finish) 
+						{
+							//println "suffix: "+suffix
+							finish = true;
+						// 	cut off preceding punctuation
+							if((m = (s2 =~ /^([$PChar])(.*)$/)))
+							{
+								s2 = m[0][2]
+								writer.write(m[0][1]+"\n")
+								finish = false;
+							}
+							
+						// 	cut off trailing punctuation
+							if((m = (s2 =~ /^(.*)([$FChar])$/)))
+							{
+								s2 = m[0][1];
+								suffix = m[0][2] + "\n$suffix";
+								finish = false;
+								
+								if(s2.length() == 0)
+									writer.write(suffix)
+							}
+						
+							// cut off trailing periods if punctuation precedes
+							if((m = (s2 =~ /([$FChar])\.$/))) {
+								suffix = ".\n$suffix";
+								if(s2.length() == 0)
+								{
+									 s2 = m[0][1];
+								}
+								else
+								{
+									suffix = m[0][1]+"\n$suffix"
+									s2 = "";
+								}
+								finish = false;
+							}
+						}// end while
+						
+						// handle explicitly listed tokens
+						if(Token.containsKey(s2))
+						{
+							writer.write("$s2\n$suffix");
+							continue;
+						}
+						
+						// abbreviations of the form A. or U.S.A.
+						if(s2 =~ /^([A-Za-z-]\.)+$/)	
+						{
+							writer.write("$s2\n$suffix");
+							continue;
+						}
+						
+						// disambiguate periods
+						if((m = (s2 =~ /^(..*)\.$/)) && 
+								(s2 !="...") && 
+								!( s ==~ /^[0-9]+\.$/))
+						{
+							s2 = m[0][1];
+							suffix = ".\n$suffix";
+							if(Token.containsKey(s2))
+							{
+								writer.write("$s2\n$suffix");
+								continue;
+							}
+						}
+						
+						// cut off clitics
+						if(PClitic.length() > 0)
+						{
+							while((m = (s2 =~ /^($PClitic)(.*)/)))
+							{
+								s2 = m[0][2];
+								writer.write(m[0][1] + "\n")
+							}
+						}
+
+						if(FClitic.length() > 0)
+						{
+							while((m = (s2 =~ /(.*)($FClitic)$/)))
+							{
+								s2 = m[0][1];
+								writer.write(m[0][2] + "\n")
+							}
+						}
+						if(s2.length() > 0)
+							writer.write("$s2\n$suffix");
+					}
+				}	
+			}
+			line = reader.readLine();
+		}
+		writer.close()
+		reader.close()
+	}
+}
Index: tmp/org.txm.core/src/groovy/filters/Tokeniser/FastSimpleTokenizerXml.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/filters/Tokeniser/FastSimpleTokenizerXml.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/filters/Tokeniser/FastSimpleTokenizerXml.groovy	(revision 258)
@@ -0,0 +1,634 @@
+// 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
+// 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.
+
+//
+// This file is part of the TXM platform.
+//
+// The TXM platform is free software: you can redistribute it and/or modif y
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 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/>.
+//
+//
+//
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$
+//
+package filters.Tokeniser;
+
+import static groovy.transform.TypeCheckingMode.SKIP
+import groovy.transform.CompileStatic
+
+import java.util.regex.Matcher
+import java.util.regex.Pattern
+
+import javax.xml.stream.*
+
+import org.txm.importer.graal.PersonalNamespaceContext
+import org.txm.tokenizer.TokenizerClasses
+@CompileStatic
+public class FastSimpleTokenizerXml {
+
+	/** The word_tags. */
+	String word_tags = TokenizerClasses.word_tags;
+
+	/** The intraword_tags. */
+	String intraword_tags = TokenizerClasses.intraword_tags;
+
+	/** The punct_strong. */
+	def punct_strong = TokenizerClasses.punct_strong;
+
+	/** The punct_all. */
+	def punct_all = TokenizerClasses.punct_all;
+
+	/** The word_chars. */
+	def word_chars = TokenizerClasses.word_chars;
+	
+	def fclitics = null; // default behavior don't manage clitics
+	def pclitics = null; // default behavior don't manage clitics
+
+	/** The ignorable_tags. */
+	String ignorable_tags = "";
+	String startTag = null
+
+	/** The DEBUG. */
+	boolean DEBUG = false;
+
+	/** The outfile. */
+	File outfile;
+
+	/** The infile. */
+	File infile;
+	
+	String lang;
+
+	/** The buffer. */
+	StringBuffer buffer;
+
+	/** The writer. */
+	XMLStreamWriter writer;
+	BufferedOutputStream output;
+	
+	/** The parser. */
+	XMLStreamReader parser
+
+	/** The localname. */
+	String localname;
+
+	/** The prefix. */
+	String prefix;
+	String filename;
+	
+	def regElision;
+	def reg3pts;
+	def regPunct;
+	def regFClitics = null ;
+	String whitespaces;
+	Pattern regLN;
+	Pattern regCTRL;
+	Pattern regSplitWhiteSpaces;
+	
+	public FastSimpleTokenizerXml(File infile, File outfile)
+	{
+		this(infile, outfile, "");
+	}
+	
+	/**
+	 * Instantiates a new simple tokenizer xml.
+	 *
+	 * @param infile the infile
+	 * @param outfile the outfile
+	 */
+	public FastSimpleTokenizerXml(File infile, File outfile, String lang)
+	{
+		this.lang = lang;
+		if (lang != null)
+		if (lang.startsWith("en")) {
+			fclitics = TokenizerClasses.FClitic_en
+		} else if (lang.startsWith("fr")) {
+			fclitics = TokenizerClasses.FClitic_fr
+			pclitics = TokenizerClasses.PClitic_fr
+		} else if (lang.startsWith("gl")) {
+			fclitics = TokenizerClasses.FClitic_gl
+		} else if (lang.startsWith("it")) {
+			pclitics = TokenizerClasses.PClitic_it
+		}
+		
+		this.outfile = outfile;
+		this.infile = infile;
+		this.filename = infile.getName();
+		int index = filename.indexOf(".");
+		if (index > 0) filename = filename.substring(0, index);
+		
+		String strRegElision = TokenizerClasses.regElision;
+		String strRegPunct = TokenizerClasses.regPunct;
+		regElision = ~/\A(.*?)(\p{L}++$strRegElision)(.*)\Z/
+		reg3pts = ~/\A(.*)(\.\.\.)(.*)\Z/
+		regPunct = ~/\A(.*)($strRegPunct)(.*)\Z/
+		if (fclitics != null)
+			regFClitics = ~/(.+)($fclitics)/
+		whitespaces = ~TokenizerClasses.whitespaces;
+		
+		regSplitWhiteSpaces = Pattern.compile(TokenizerClasses.whitespaces);
+		regLN = Pattern.compile("/\n/");
+		regCTRL = Pattern.compile("/\\p{C}/");
+		
+	}
+
+	/**
+	 * Fill infos.
+	 *
+	 * @param event the event
+	 * @return the java.lang. object
+	 */
+	public fillInfos(int event)
+	{
+		if (event == XMLStreamConstants.START_ELEMENT || event == XMLStreamConstants.END_ELEMENT)
+		{
+			localname = parser.getLocalName();
+			prefix = parser.getPrefix();
+		}
+	}
+
+	/**
+	 * Donothing.
+	 *
+	 * @param event the event
+	 * @param wordid the wordid
+	 * @return the java.lang. object
+	 */
+	public donothing(int event, Integer wordid)
+	{
+		if (event == XMLStreamConstants.START_ELEMENT ) {
+			String namespace = parser.getNamespaceURI();
+
+			localname = parser.getLocalName();
+			if (prefix != null && prefix.length() > 0)
+				writer.writeStartElement(prefix+":"+localname);
+			else
+			//				if(namespace != null)
+			//					writer.writeStartElement(namespace, localname);
+			//				else
+			writer.writeStartElement(localname);
+
+			//			if(parser.getNamespaceCount() > 0)
+			//				writer.writeDefaultNamespace(parser.getNamespaceURI(0))
+			//			for(int i = 1 ; i < parser.getNamespaceCount() ; i++)
+			//				writer.writeNamespace(parser.getNamespacePrefix(i), parser.getNamespaceURI(i));
+
+			String namespace_prefix;
+			for (int i = 0 ; i<   parser.getNamespaceCount() ; i++) {
+				namespace_prefix = parser.getNamespacePrefix(i);
+				if ((namespace_prefix != null)&&   (namespace_prefix.length()>   0)) {
+					writer.writeNamespace(namespace_prefix, parser.getNamespaceURI(i));
+				} else {
+					writer.writeDefaultNamespace(parser.getNamespaceURI(i));
+				}
+			}
+
+			String attrprefix, attname;
+			boolean hasId = false;
+			boolean hasType = false
+			boolean hasN = false
+			for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
+				attname = parser.getAttributeLocalName(i);
+				attrprefix = parser.getAttributePrefix(i);
+				if ("id".equals(attname)) hasId = true;
+				if ("type".equals(attname)) hasType = true;
+				if ("n".equals(attname)) hasN = true;
+
+				if(attrprefix != null && attrprefix.length() > 0)
+					writer.writeAttribute(attrprefix+":"+attname, parser.getAttributeValue(i))
+				else
+					writer.writeAttribute(attname, parser.getAttributeValue(i))
+			}
+
+			if (wordid != null && !hasId && localname == "w")
+				writer.writeAttribute("id", "w_"+filename+"_"+wordcount);
+
+			if (!hasType && localname == "w")
+				writer.writeAttribute("type", "w");
+				
+			if (!hasN && localname == "w")
+				writer.writeAttribute("n", ""+wordcount);
+
+			writer.writeCharacters("\n");
+		}
+		else if(event == XMLStreamConstants.END_ELEMENT)
+		{
+			writer.writeEndElement();
+			writer.writeCharacters("\n");
+		}
+		else if(event == XMLStreamConstants.CHARACTERS)
+		{
+			//println parser.getText();
+			//writer.writeCharacters("𦟛");
+			
+			
+			// checks if the token starts with an high surrogate
+//			if(isHighSurrogate(parser.getText().charAt(0)))	{
+//				println "warning: invalid UTF-8 XML range, token " + parser.getText() + " has been replaced.";
+//				writer.writeCharacters("__invalidXMLChar__")
+//				//writer.writeCharacters("𦟛");
+//				println "high surrogate: " + Integer.toHexString((int)parser.getText().charAt(0)); 
+//				println "low surrogate: " + Integer.toHexString((int)parser.getText().charAt(1));
+//				int charSum = parser.getText().charAt(0) + parser.getText().charAt(1);
+//				println "char sum: " + charSum;
+//				println "test " + surrogatesPairToScalar(parser.getText().charAt(0), parser.getText().charAt(1));
+//				int scalar = surrogatesPairToScalar(parser.getText().charAt(0), parser.getText().charAt(1));
+//				//writer.writeCharacters(String.valueOf((char)112692));
+//				writer.writeCharacters("&#" + scalar + ";");
+//			}
+//			else
+			
+			
+			if (insideword) { // ensure there is not \t or \n in the word form value
+				writer.writeCharacters(parser.getText().trim().replace("\n", " ").replace("\t", " "));
+			} else {
+				writer.writeCharacters(parser.getText());
+			}
+			
+			
+			
+		}
+	}
+	
+	
+	/**
+	 * Converts the specified surrogates pair to scalar.
+	 * @param highSurrogate
+	 * @param lowSurrogate
+	 * @return
+	 */
+	public int surrogatesPairToScalar(char highSurrogate, char lowSurrogate)	{
+		return ((highSurrogate - 0xD800) * 0x400) + (lowSurrogate - 0xDC00) + 0x10000;
+	}
+	
+	/**
+	 * Checks if the specified character is an high/leading surrogate.
+	 * @param character
+	 * @return
+	 */
+	public boolean isHighSurrogate(char character)	{
+		return (character >= 0xD800 && character <= 0xDBFF);
+	}
+	
+	
+
+	/** The wordcount. */
+	int wordcount = 0;
+
+	/** The ignorecontent. */
+	boolean ignorecontent = true;//tokenize a partir de <body>
+	boolean insideword = false;
+	/**
+	 * Process.
+	 *
+	 * @return true, if successful
+	 */
+	public boolean process()
+	{
+		if (!infile.exists()) {
+			println "$infile does not exists"
+			return false;
+		}
+		XMLOutputFactory factory = XMLOutputFactory.newInstance();
+		output = new BufferedOutputStream(new FileOutputStream(outfile));
+		
+//		output = new OutputStreamWriter(new BufferedOutputStream(new FileOutputStream(outfile), 2048 * 1024), "UTF-8");
+		
+		writer = factory.createXMLStreamWriter(output, "UTF-8")
+		writer.setNamespaceContext(new PersonalNamespaceContext());
+
+		def inputData = infile.toURI().toURL().openStream();
+		def inputfactory = XMLInputFactory.newInstance();
+		//inputfactory.setProperty("http://apache.org/xml/properties/input-buffer-size", new Integer(2048));
+		//inputfactory.setExpandEntityReferences(false);
+		parser = inputfactory.createXMLStreamReader(inputData, "UTF-8");
+		//println "PARSER: "+parser.getClass()
+		writer.writeStartDocument("UTF-8","1.0");
+		writer.writeCharacters("\n");
+
+		int previousEvent = 0;
+		boolean startProcess = false;
+		if (startTag == null) // if no startTag specified we process from the start
+			startProcess = true;
+		buffer = new StringBuffer();
+		//println "process - start start tag: "+startTag+" startProcess: $startProcess"
+		ignorecontent = !startProcess;
+		try {
+			for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+				if (!startProcess) {
+					if (event == XMLStreamConstants.START_ELEMENT) {
+						if (parser.getLocalName().matches(startTag)) {
+
+							startProcess = true
+							ignorecontent = false;
+						}
+					}
+					if (!startProcess) {
+						donothing(event, null);
+						continue;
+					}
+				}
+
+				if (previousEvent == XMLStreamConstants.CHARACTERS && previousEvent != event) {
+					processWord(); // tokenize
+					buffer = new StringBuffer();
+				}
+				fillInfos(event);//get localname and prefix
+				if (event == XMLStreamConstants.START_ELEMENT) {
+					//println "Open: "+localname;
+
+					if (localname.matches(word_tags)) // ignore the content of the word but keep counting
+					{
+						//println "Found pretagged word";
+						wordcount++;
+						donothing(event, wordcount);
+						ignorecontent = true;
+						insideword = true;
+					} else if (localname.matches(ignorable_tags)) // ignore the content of the file
+					{
+						donothing(event, null);
+						ignorecontent = true;
+					} else {
+						donothing(event, null);
+					}
+				} else if(event == XMLStreamConstants.END_ELEMENT) {
+					//println "Close: "+localname;
+					if (localname.matches(word_tags)) {
+						ignorecontent = false;
+						insideword = false;
+						writer.writeEndElement();
+						writer.writeCharacters("\n");
+					} else if (localname.matches(ignorable_tags)) // ignore the content of the file
+					{
+						ignorecontent = false;
+						donothing(event, null);
+
+					} else {
+						donothing(event, null);
+					}
+				} else if (event == XMLStreamConstants.CHARACTERS) {
+					if (ignorecontent) {
+						//println " ignore chars: "+parser.getText().trim();
+						donothing(event, null);
+					} else {
+						//println " process chars: "+parser.getText().trim();
+						buffer.append(parser.getText());
+						if (buffer.length() >= 128 && buffer.charAt(buffer.length()-1) == " ") {
+							processWord();
+							buffer = new StringBuffer();
+						}
+					}
+				} else if (event == XMLStreamConstants.COMMENT) {
+					writer.writeComment(parser.getText())
+				} else if (event == XMLStreamConstants.DTD) {
+					//println "DTD!";
+				} else {
+					if (DEBUG) println "Warning in $infile: ignore XML event at location "+parser.getLocation()
+				}
+				previousEvent = event;
+			}
+
+			parser.close()
+			writer.close();
+			output.close();
+			inputData.close();
+		} catch (Exception e) {
+			System.err.println("Error : "+infile);
+			e.printStackTrace();
+			return false;
+		}
+		return true;
+	}
+
+
+	/**
+	 * Process word.
+	 */
+	protected void processWord()
+	{
+		String text = buffer.toString();//parser.getText().trim().replace("\t", " ");
+		if (DEBUG) println "-- chars: "+text+"--";
+		
+		text = regLN.matcher(text).replaceAll(" ");
+		text = regCTRL.matcher(text).replaceAll("");						// remove ctrl characters
+		//for (String s : text.split(whitespaces) )			// separate with unicode white spaces
+		for (String s : regSplitWhiteSpaces.split(text))			// separate with unicode white spaces
+		{
+			if (DEBUG){println "process $s"}
+			iterate(s);
+		}
+	}
+
+	/**
+	 * Iterate.
+	 *
+	 * @param s the s
+	 * @return the java.lang. object
+	 */
+	protected iterate(String s)
+	{
+		while (s != null && s.length() > 0) {
+			if (DEBUG){println "  > $s"}
+			s = standardChecks(s);
+		}
+	}
+
+
+	/**
+	 * Standard checks.
+	 *
+	 * @param s the s
+	 * @return the java.lang. object
+	 */
+//	@CompileStatic(SKIP)
+	protected String standardChecks(String s)
+	{
+		
+		Matcher m;
+		if (fclitics != null && (m = s =~ regFClitics) ) {
+//			println "CLITIC found: $s ->"+ m
+			if (m.group(1) != null && m.group(1).length() > 0) standardChecks(m.group(1));// process first part of the string
+			
+			wordcount++;
+			writer.writeStartElement("w");
+			writeWordAttributes();// id
+			writer.writeAttribute("type", "w");
+			writer.writeCharacters(m.group(2));
+			writer.writeEndElement();
+			writer.writeCharacters("\n");
+		}
+		else if ((m = s =~ regElision) )
+		{
+			iterate(m.group(1))
+
+			int sep = s.indexOf("'");
+			if (sep < 0)
+				sep = s.indexOf("’");
+			if (sep < 0)
+				sep = s.indexOf("‘");
+
+			wordcount++;
+			writer.writeStartElement("w");
+			writeWordAttributes();// id
+			writer.writeAttribute("type", "w");
+			writer.writeCharacters(m.group(2));
+			writer.writeEndElement();
+			writer.writeCharacters("\n");
+
+			return m.group(3);
+		}
+		else if ((m = s =~ reg3pts) )
+		{
+			iterate(m.group(1))
+
+			wordcount++;
+			writer.writeStartElement("w");
+			writeWordAttributes();// id
+			writer.writeAttribute("type","pon");
+			writer.writeCharacters("...");
+			writer.writeEndElement();
+			writer.writeCharacters("\n");
+
+			return m.group(3);
+		}
+		else if ((m = s =~ regPunct) )
+		//else if((m = s =~ /\A(.*)($punct_all)(.*)\Z/) )
+		{
+			iterate(m.group(1));
+
+			wordcount++;
+			writer.writeStartElement("w");
+			writeWordAttributes();// id
+			writer.writeAttribute("type","pon");
+			writer.writeCharacters(m.group(2));
+			writer.writeEndElement();
+			writer.writeCharacters("\n");
+
+			return m.group(3);
+		}
+		else
+		{
+			if(DEBUG){println "Other : "+s}
+			wordcount++;
+			writer.writeStartElement("w");
+			writeWordAttributes();// id
+			if(s.matches(/\p{P}/))
+				writer.writeAttribute("type","pon");
+			else
+				writer.writeAttribute("type","w");
+			writer.writeCharacters(s);
+			writer.writeEndElement();
+			writer.writeCharacters("\n");
+
+			return "";
+		}
+	}
+
+	/**
+	 * Write word attributes.
+	 *
+	 * @return the java.lang. object
+	 */
+	protected writeWordAttributes()
+	{
+		writer.writeAttribute("id", "w_"+filename+"_"+wordcount);
+		writer.writeAttribute("n",""+wordcount);
+	}
+
+	public void setStartTag(String tag)
+	{
+		this.startTag = tag;
+	}
+
+	/**
+	 * Tokenize.
+	 *
+	 * @param str the str
+	 * @return the list
+	 */
+	public List<String> tokenize(String str)
+	{
+		return str.tokenize()	// cut by whitespace
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args)
+	{
+		
+		
+		
+		// FIXME: tests UTF-8 XML ranges
+		
+		
+		
+		File inputDir = new File("C:/Tools/Textometrie/___corpus/xml/test_bug_import_chinois/")
+		File inputFile = new File(inputDir, "problem2.xml");
+
+		
+//		File inputDir = new File("/home/mdecorde/xml/SMS88Mil/out")
+//		File inputFile = new File(inputDir, "sms-sample.xml");
+		for (String lang : ["none", "en", "fr", null]) {
+			print "."
+			File outputFile = new File(inputDir, "test-${lang}.xml")
+			FastSimpleTokenizerXml tokenizer = new FastSimpleTokenizerXml(inputFile, outputFile, lang)
+			tokenizer.process();
+		}
+		
+		println ""
+		println "Done"
+		
+//		String lang = "en"
+//		File inDir = new File("/home/mdecorde/xml/ny911/cycle1/Data_Modif_Pour_Import_XML_Cycle1/xml_files/1xml_par_participant")
+//		File outDir = new File("/home/mdecorde/xml/ny911/cycle1/Data_Modif_Pour_Import_XML_Cycle1/xml_files/1xml_par_participant-t")
+//		outDir.deleteDir()
+//		outDir.mkdir()
+//		
+//		println "processing "+inDir.listFiles().size()+" files."
+//		for (def infile : inDir.listFiles()) {			
+//			if (!infile.getName().endsWith(".xml")) continue;
+//			
+//			print "."
+//			File outfile = new File(outDir, infile.getName())
+//			FastSimpleTokenizerXml tokenizer = new FastSimpleTokenizerXml(infile, outfile, lang)
+//			tokenizer.setDEBUG false
+//			tokenizer.process();
+//		}
+//		println ""
+//		println "Done"
+
+	}
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/filters/Tokeniser/Tokeniser.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/filters/Tokeniser/Tokeniser.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/filters/Tokeniser/Tokeniser.groovy	(revision 258)
@@ -0,0 +1,469 @@
+// 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
+// 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.
+//
+//
+//
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$
+//
+package filters.Tokeniser;
+
+import org.txm.importer.filters.*;
+import org.txm.tokenizer.TokenizerClasses;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class Tokeniser.
+ */
+class Tokeniser extends Filter {
+
+	public Tokeniser(File text)
+	{
+		this.filename = text.getName();
+		int index = filename.indexOf(".");
+		if(index > 0)
+			filename = filename.substring(0, index);
+	}
+
+	static public int DEBUG = 0;
+	/** The charerrors. */
+	HashSet<String> charerrors = new HashSet<String>();
+	/*
+	 * Elements processed by the tokenizer:
+	 * 
+	 * DEFS: - w|abbr|num (word_tags) - c|ex|caes|choice|corr|sic|reg
+	 * (intraword_tags) - <[^>]+> (tag_all)
+	 * 
+	 * INPUT: OUTPUT: MODE: COMMENTS:
+	 * 
+	 * - &apos; ' BEGIN - <\/($word_tags)> </w>+NL word - --> -->+NL comment -
+	 * <\/($head_name)> </($head_name)>+NL head - <\/note> </note>-->+NL note -
+	 * <(head|p) [^>]*lang=['"]fr['"] ibid text Editor's title - <w(
+	 * [^>]*)?>\s*)($tag_all\s*) ibid+NL if not </w> text - <note[^>]*>
+	 * NL+<!--$note text Note found - <\/note> </note>-->+NL text - $tag_all
+	 * ibid+NL text Line with tags only - <!-- NL+<!-- text XML comment found -
+	 * --> -->+NL - <($word_tags)([^>]*)> <w type=\"$tag_name\"
+	 * $tag_atts>$word</w>+NL text Tagged words, punctuation marks,
+	 * abbreviations and numbers - $tag_all ibid+NL text Separated tags - \.[^
+	 * .]+\. <w type=\"num\">$word</w>+NL text Numbers and abbreviations
+	 * surrounded with dots - $punct_all|['‘’] <w type=\"pon\">$word</w>+NL text
+	 * Punctuation marks - ($word_chars)*[\(\[]($word_cha <w >$word</w> text
+	 * Words with brackets rs)+[\)\]]($word_chars)+|($wor
+	 * d_chars)+[\(\[]($word_chars)+[ \)\]])(\s+|$punct_all) -
+	 * (((<[^>]+>)*($word_chars)+(<[^ <w >$word</w> text Other word patterns
+	 * without elision >]+>)*)+)(\s+|$punct_all) -
+	 * (((<[^>]+>)*($word_chars)+(<[^ <w >$word</w> text Other word patterns
+	 * with  >]+>)*)+)['’]
+	 */
+
+	/** The counter. */
+	int counter = 1;
+
+	/** The m. */
+	def m;
+
+	/** The segment. */
+	def segment;
+
+	/** The note. */
+	def note;
+
+	/** The tag. */
+	def tag;
+
+	/** The tag_name. */
+	def tag_name;
+
+	/** The tag_atts. */
+	def tag_atts;
+
+	/** The starttag. */
+	def starttag;
+
+	/** The endtag. */
+	def endtag;
+
+	/** The word. */
+	def word;
+
+	/** The linetype. */
+	def linetype = "text"; // input processing state, can be : text, word, comment, head, note
+
+	/** The head_name. */
+	def head_name;
+
+	/** The tag_all. */
+	def tag_all = "<[^>]+>";
+
+	/** The word_tags. */
+	def word_tags = TokenizerClasses.word_tags;
+
+	/** The intraword_tags. */
+	def intraword_tags = TokenizerClasses.intraword_tags;
+
+	/** The punct_strong. */
+	def punct_strong = TokenizerClasses.punct_strong;
+
+	/** The punct_all. */
+	def punct_all = TokenizerClasses.punct_all;
+
+	/** The word_chars. */
+	def word_chars = TokenizerClasses.word_chars;
+	def punct_quotes = TokenizerClasses.punct_quotes;
+	String filename;
+	int wordcount = 1;
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#SetUsedParam(java.lang.Object)
+	 */
+	void SetUsedParam(Object args)
+	{
+		try {
+			word_tags = args.get("word_tags");
+			intraword_tags = args.get("intraword_tags");
+			punct_strong = args.get("punct_strong");
+			punct_all = args.get("punct_all");
+			word_chars = args.get("word_chars");
+		} catch(Exception e) {
+			System.err.println(e)
+			System.err.println("tokenizer needs an \"args\" map with the following elements :\n word_tags, intraword_tags, punct_strong, " +
+					"punct_all, word_chars")
+		}
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#before()
+	 */
+	boolean before() {
+		// System.out.println("beginning of tokenizer processing");
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#after()
+	 */
+	void after() {
+		if (charerrors.size() > 0) {
+			System.out.print("Tokenizer unknown word chars in $filename: ");
+			println charerrors;
+			
+		}
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#filter()
+	 */
+	void filter()
+	{
+		String word;
+		// Write your code here, but don't forget to write to the output
+		// Example : output.print("TheStringToWrite " + line);
+		// The line variable contains the current line
+		segment = line+" ";
+		segment = segment.replace("&amp;", "&").replace("&apos;", "'").replace("&quot;","'");
+
+		if(DEBUG-- > 0)
+			println("Line: "+line);
+		while (true) {
+			if (DEBUG-- > 0)
+				println " segment: "+segment+"\n linetype: "+linetype;
+
+			if (linetype == "word") {
+				if(	(m = segment =~ /\A\s*(.*?)<\/($word_tags)>(.*)\Z/) )
+				{
+					segment = m[0][3];
+					linetype = "text";
+					output.print( m[0][1]+"</w>"+lineSeparator);
+					if (segment ==~ /\S/)
+					{
+						continue;
+					}
+				}
+				else
+				{
+					segment = (segment =~ /\A\s*/).replaceAll("");
+					segment = segment.trim();
+					output.print(segment);
+				}
+			}
+			else if (linetype == "comment")
+			{
+				if(	(m = segment =~ /\A\s*(.*?)-->(.*)\Z/))
+				{
+					linetype = "text";
+					output.print(m[0][1]+"-->"+lineSeparator);
+					//println(m[0][1]+"-->\n");
+					segment = m[0][2];
+					if(! (segment ==~ /^\s*$/))
+					{
+						continue;
+					}
+				}
+				else
+				{
+					segment = (segment =~ /\A\s*/).replaceAll("");
+					output.print(segment);
+					//println(segment);
+				}
+			}
+			else if (linetype == "head")
+			{
+				if(	(m = segment =~ /\A\s*(.*?)<\/($head_name)>\s*\Z/))
+				{
+					linetype = "text";
+					output.print(m[0][1]+"</$head_name>"+lineSeparator);
+					head_name = "";
+				}
+				else
+				{
+					output.print(segment);
+					//print "Editor's title: $segment\n";
+					//println("Editor's title: $segment\n");
+				}
+			}
+			else if (linetype == "note")
+			{
+				if(	(m = segment =~ /\A\s*(.*?)<\/note>/))
+				{
+					linetype = "text";
+					output.print(m[0][1]+"</note>-->"+lineSeparator);
+					//println(m[0][1]+"</note>\n");
+				}
+				else
+				{
+					segment = (segment =~ /\A\s*/).replaceAll("");
+					output.print(segment);
+					//println(segment);
+				}
+			}
+			else if (linetype == "text")
+			{
+				if(	(m = segment =~ /\A\s*<(head|p) [^>]*lang=['"]fr['"]/) )
+				{
+					if(DEBUG-- > 0)
+						println "  tag head|p: m01"+head_name;
+					head_name = m[0][1];
+					output.print(segment);
+					linetype = "head";
+				}
+				else if( (m = segment =~ /\A(\s*<w( [^>]*)?>\s*)($tag_all\s*)*\Z/))
+				{
+					String wordtag = m[0][1];
+					String tail = m[0][3].trim();
+					if(!wordtag.contains("id=\""))
+						wordtag ="<w id=\"w_"+filename+"_"+wordcount+"\""+ wordtag.substring(2);
+					wordcount++;
+					if(DEBUG-- > 0)
+						println "  tag w: m01"+head_name;
+					segment = tail;
+					if (segment == "</w>") {
+						println("\nEmpty word tag found, adding [???] content!\nsegment: '$wordtag[???]$tail'");
+						output.print(wordtag.trim()+"[???]"+tail.trim()+lineSeparator);
+					} else if( !(segment ==~ /<\/w>/)) {
+						linetype = "word";
+						output.print(wordtag.trim()+tail.trim());
+					}
+					else
+						output.print(wordtag.trim()+tail.trim()+lineSeparator);
+				}
+				else if( (m = segment =~ /\A\s*(<note[^>]*>)(.*)\Z/)){
+					if(DEBUG-- > 0)
+						println "  tag note: new seg="+m[0][2];
+					segment = m[0][2];
+					def note = m[0][1];
+					//println("Note found: $note");
+					output.print(lineSeparator+"<!--$note");
+					if( (m = segment =~ /\A(.*?)<\/note>(.*)\Z/)){
+						segment = m[0][2];
+						//println(m[0][1]+"</note>\n");
+						output.print(m[0][1]+"</note>-->"+lineSeparator);
+					}
+					else {
+						linetype = "note";
+						//println("$segment ");
+						output.print("$segment ");
+						segment = " ";
+					}
+				}
+				else if (segment ==~ /\A\s*($tag_all\s*)+\Z/)  {
+					//print "Line with tags only : $line\n";
+					if(DEBUG-- > 0)
+						println "  tag all: ";
+
+					output.print(segment+lineSeparator);
+				}
+				else if( (m = segment =~ /\A\s*(.*?)\s*\Z/)){
+
+
+					segment = m[0][1]+" ";
+					while(! (segment ==~ /\A\s*\Z/) )
+					{
+						if(DEBUG-- > 0)
+							println "  other: new seg="+segment;
+						if( (m = segment =~ /\A\s*<!--(.*)\Z/))
+						{
+							segment = m[0][1]+" ";
+							if(DEBUG-- > 0)
+								println("   comment: new seg="+segment);
+							output.print(lineSeparator+"<!--");
+							if( (m = segment =~ /\A(.*?)-->(.*)\Z/)) {
+								segment = m[0][2];
+								//println(m[0][1]+"-->"+lineSeparator);
+								output.print(m[0][1]+"-->"+lineSeparator);
+							}
+							else  {
+								linetype = "comment";
+								//println("$segment ");
+								output.print("$segment ");
+								segment = " ";
+							}
+						}
+						else if( (m = segment =~ /\A\s*<($word_tags)([^>]*)>(.*)\Z/)) {
+							if(DEBUG-- > 0)
+								println("   tag word: 1w="+m[0][1]+" 2="+m[0][2]+" 3seg="+m[0][3]);
+							segment = m[0][3];
+							tag_name = m[0][1];
+							tag_atts = m[0][2];
+							//print "Tagged words, punctuation marks, abbreviations and numbers : <$tag_name$tag_atts>\n";
+							output.print("<w");
+							if(!tag_atts.contains("id=\""))
+							{
+								tag_atts = " id=\"w_"+filename+"_"+wordcount+"\" ";
+							}
+							wordcount++;
+							if (tag_name ==~ /abbr|num/) {
+								output.print(" type=\"$tag_name\"");
+							}
+							output.print("$tag_atts>");
+							if( (m = segment =~ /\A(.*?)<\/($tag_name)>(.*)\Z/)) {
+								word = m[0][1];
+								segment = m[0][3];
+								word = (word =~ /^\s*(.*)\s*$/).replaceAll("\$1");
+								output.print("$word</w>"+lineSeparator);
+							}
+							else  {
+								linetype = "word";
+								output.print(segment);
+								segment = " ";
+							}
+						}
+						else if( (m = segment =~ /\A\s*($tag_all)\s+(.*)\Z/)) {
+							if(DEBUG-- > 0)
+								println "   Separated tags: 1w="+m[0][1]+" 2seg="+m[0][2];
+							segment = m[0][2];
+							tag = m[0][1];
+							output.print("$tag"+lineSeparator);
+						}
+						else if( (m = segment =~ /\A\s*([.·][^ .·]+[.·])(.*)\Z/))
+						{
+							if(DEBUG-- > 0)
+								println "   Numbers and abbreviations: 1w="+m[0][1]+" 2seg="+m[0][2];
+							segment = m[0][2];
+							word = m[0][1];
+							word = (word =~ /^\s*(.*)\s*$/).replaceAll("\$1");
+							output.print("<w id=\"w_"+filename+"_$wordcount\" type=\"num\">$word</w>"+lineSeparator);
+							wordcount++;
+							//push @numbers, $word;
+							//print "Number found: <w type=\"num\">$word</w>\n";
+						}
+						else if( (m = segment =~ /\A\s*($punct_all|[$punct_quotes])(.*)\Z/))
+						{
+							if(DEBUG-- > 0)
+								println "   Punctuation marks: 1w="+m[0][1]+" 2seg="+m[0][2]
+							segment = m[0][2];
+							word = m[0][1];
+							word = (word =~ /^\s*(.*)\s*$/).replaceAll("\$1");
+							word = word.replace("<", "&lt;");
+							output.print("<w id=\"w_"+filename+"_$wordcount\" type=\"pon\">"+word+"</w>"+lineSeparator);
+							wordcount++;
+						}
+						else if( (m = segment =~ /\A\s*(($word_chars)*[{\(\[]($word_chars)+[\)\]}]($word_chars)+|($word_chars)+[{\(\[]($word_chars)+[\)\]}])(\s+|$punct_all)(.*?)\Z/))						{
+							if(DEBUG-- > 0)
+								println "   Words with brackets: 1w="+m[0][1]+" 2="+m[0][2]+" 3="+m[0][3]+" 4="+m[0][4]+" 5="+m[0][5]+" 6="+m[0][6]+" 7seg="+m[0][7]+" 8seg="+m[0][8];
+							segment = m[0][7]+m[0][8];//"$7$8";
+							word = m[0][1];
+							word = (word =~ /^\s*(.*)\s*$/).replaceAll("\$1");
+							//push @w_brackets, $word;
+							def word_clean = word;
+							word_clean = (word_clean =~ /($tag_all)/).replaceAll("");
+							if (word_clean ==~ /[^0-9A-Za-zœÀ-ÿ'’\(\)\[\]–\-]/)
+							{	//System.err.println("Line $linecounter Error : " +word);
+								charerrors.add(word);
+							}
+							output.print("<w id=\"w_"+filename+"_$wordcount\">"+word+"</w>"+lineSeparator);
+							wordcount++;
+						}
+						else if( (m = segment =~ /\A\s*(((<[^>]+>)*($word_chars+)(<[^>]+>)*)+)(\s+|$punct_all)(.*?)\Z/))
+						{
+							segment = m[0][6]+m[0][7];//"$6$7";
+							word = m[0][1];
+
+							if(DEBUG-- > 0)
+							{
+								println "Other word without elision: 1w="+m[0][1]+" 2="+m[0][2]+" 3="+m[0][3]+" 4="+m[0][4]+" 5="+m[0][5]+" 6seg="+m[0][6]+" 7seg="+m[0][7];
+							}
+							def word_clean = word;
+							word_clean = (word_clean =~ /($tag_all)/).replaceAll("");
+							if (word_clean ==~ /[^0-9A-Za-zœÀ-ÿ'’()[\\]–\\-]/)
+							{
+								//System.err.println("Line $linecounter Error : " +word);
+								charerrors.add(word);
+							}
+							String towrite = "<w id=\"w_"+filename+"_$wordcount\">"+word.toString()+"</w>"+lineSeparator;
+							wordcount++;
+							output.print(towrite);
+						}
+						else if( (m = segment =~ /\A\s*(((<[^>]+>)*($word_chars)+(<[^>]+>)*)+)[$punct_quotes](.*?)\Z/))
+						{
+							if(DEBUG-- > 0)
+								println "   Other word patterns with elision: 1w="+m[0][1]+" 2="+m[0][2]+" 3="+m[0][3]+" 4="+m[0][4]+" 5="+m[0][5]+" 6seg="+m[0][6];
+							segment = m[0][6];
+							word = m[0][1]+"'";
+							def word_clean = word;
+							word_clean = (word_clean =~ /($tag_all)/).replaceAll("");
+							if (word_clean ==~ /[^0-9A-Za-zœÀ-ÿ'’\(\)\[\]–\-]/)                    			{
+								//System.err.println("Line $linecounter Error : " +word);
+								charerrors.add(word);
+							}
+							output.print("<w id=\"w_"+filename+"_$wordcount\">"+word+"</w>"+lineSeparator);
+							wordcount++;
+						}
+						else{
+							System.err.println("   Unknown word pattern $segment");
+							output.print("<note>Error! Unknown word pattern: $segment</note>"+lineSeparator);
+							segment = " ";
+						}
+					}
+				}
+				else
+				{
+					println(" line (?) : $segment \n");
+					System.exit(-1)
+				}
+			}
+			else
+			{
+				output.print(segment);
+			}
+			break;
+		}
+		// End
+	}
+}
Index: tmp/org.txm.core/src/groovy/filters/Tokeniser/OldSimpleTokenizerXml.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/filters/Tokeniser/OldSimpleTokenizerXml.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/filters/Tokeniser/OldSimpleTokenizerXml.groovy	(revision 258)
@@ -0,0 +1,617 @@
+// 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
+// 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.
+
+//
+// This file is part of the TXM platform.
+//
+// The TXM platform is free software: you can redistribute it and/or modif y
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 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/>.
+//
+//
+//
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$
+//
+package filters.Tokeniser;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.txm.importer.graal.PersonalNamespaceContext;
+import org.txm.objects.Base;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStreamReader;
+
+import javax.xml.stream.*;
+
+import java.net.URL;
+
+import org.txm.tokenizer.TokenizerClasses;
+
+public class OldSimpleTokenizerXml {
+
+	/** The word_tags. */
+	String word_tags = TokenizerClasses.word_tags;
+
+	/** The intraword_tags. */
+	String intraword_tags = TokenizerClasses.intraword_tags;
+
+	/** The punct_strong. */
+	def punct_strong = TokenizerClasses.punct_strong;
+
+	/** The punct_all. */
+	def punct_all = TokenizerClasses.punct_all;
+
+	/** The word_chars. */
+	def word_chars = TokenizerClasses.word_chars;
+
+	def fclitics = null; // default behavior don't manage clitics
+	def pclitics = null; // default behavior don't manage clitics
+
+	/** The ignorable_tags. */
+	String ignorable_tags
+	String outside_text_tags_keep_content
+	String outside_text_tags
+	String startTag = null
+
+	/** The DEBUG. */
+	public boolean DEBUG = false;
+
+	/** The outfile. */
+	File outfile;
+
+	/** The infile. */
+	File infile;
+
+	String lang;
+
+	/** The buffer. */
+	StringBuffer buffer;
+
+	/** The writer. */
+	XMLStreamWriter writer;
+	BufferedOutputStream output;
+
+	/** The parser. */
+	XMLStreamReader parser
+
+	/** The localname. */
+	String localname;
+
+	/** The prefix. */
+	String prefix;
+	String filename;
+
+	def regElision;
+	def reg3pts;
+	def regPunct;
+	def regFClitics = null ;
+	def regPClitics = null ;
+	String whitespaces;
+
+	public OldSimpleTokenizerXml(File infile, File outfile)
+	{
+		this(infile, outfile, "");
+	}
+
+	/**
+	 * Instantiates a new simple tokenizer xml.
+	 *
+	 * @param infile the infile
+	 * @param outfile the outfile
+	 */
+	public OldSimpleTokenizerXml(File infile, File outfile, String lang)
+	{
+		this.lang = lang;
+		if (lang != null)
+			if (lang.startsWith("en")) {
+				fclitics = TokenizerClasses.FClitic_en
+			} else if (lang.startsWith("fr")) {
+				fclitics = TokenizerClasses.FClitic_fr
+				pclitics = TokenizerClasses.PClitic_fr
+			} else if (lang.startsWith("gl")) {
+				fclitics = TokenizerClasses.FClitic_gl
+			} else if (lang.startsWith("it")) {
+				pclitics = TokenizerClasses.PClitic_it
+			}
+
+		this.outfile = outfile;
+		this.infile = infile;
+		this.filename = infile.getName();
+		int index = filename.indexOf(".");
+		if (index > 0) filename = filename.substring(0, index);
+
+		String strRegElision = TokenizerClasses.regElision;
+		String strRegPunct = TokenizerClasses.regPunct;
+		regElision = /\A(.*?)(\p{L}++$strRegElision)(.*)\Z/
+		reg3pts = /\A(.*)(\.\.\.)(.*)\Z/
+		regPunct = /\A(.*)($strRegPunct)(.*)\Z/
+		if (fclitics != null)
+			regFClitics = /(.+)($fclitics)(.*)/
+		if (pclitics != null)
+			regPClitics = /(.+)(pclitics)(.*)/
+		whitespaces = TokenizerClasses.whitespaces;
+	}
+
+	/**
+	 * Fill infos.
+	 *
+	 * @param event the event
+	 * @return the java.lang. object
+	 */
+	public fillInfos(int event)
+	{
+		if (event == XMLStreamConstants.START_ELEMENT || event == XMLStreamConstants.END_ELEMENT)
+		{
+			localname = parser.getLocalName();
+			prefix = parser.getPrefix();
+		}
+	}
+
+	/**
+	 * Donothing.
+	 *
+	 * @param event the event
+	 * @param wordid the wordid
+	 * @return the java.lang. object
+	 */
+	public donothing(int event, Integer wordid)
+	{
+		if (event == XMLStreamConstants.START_ELEMENT ) {
+			String namespace = parser.getNamespaceURI();
+
+			localname = parser.getLocalName();
+			if (prefix != null && prefix.length() > 0)
+				writer.writeStartElement(prefix+":"+localname);
+			else
+				//				if(namespace != null)
+				//					writer.writeStartElement(namespace, localname);
+				//				else
+				writer.writeStartElement(localname);
+
+			//			if(parser.getNamespaceCount() > 0)
+			//				writer.writeDefaultNamespace(parser.getNamespaceURI(0))
+			//			for(int i = 1 ; i < parser.getNamespaceCount() ; i++)
+			//				writer.writeNamespace(parser.getNamespacePrefix(i), parser.getNamespaceURI(i));
+
+			String namespace_prefix;
+			for (int i = 0 ; i<   parser.getNamespaceCount() ; i++) {
+				namespace_prefix = parser.getNamespacePrefix(i);
+				if ((namespace_prefix != null)&&   (namespace_prefix.length()>   0)) {
+					writer.writeNamespace(namespace_prefix, parser.getNamespaceURI(i));
+				} else {
+					writer.writeDefaultNamespace(parser.getNamespaceURI(i));
+				}
+			}
+
+			String attrprefix, attname;
+			boolean hasId = false;
+			boolean hasType = false
+			boolean hasN = false
+			for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
+				attname = parser.getAttributeLocalName(i);
+				attrprefix = parser.getAttributePrefix(i);
+				if ("id".equals(attname)) hasId = true;
+				if ("type".equals(attname)) hasType = true;
+				if ("n".equals(attname)) hasN = true;
+
+				if(attrprefix != null && attrprefix.length() > 0)
+					writer.writeAttribute(attrprefix+":"+attname, parser.getAttributeValue(i))
+				else
+					writer.writeAttribute(attname, parser.getAttributeValue(i))
+			}
+
+			if (wordid != null && !hasId && localname == "w")
+				writer.writeAttribute("id", "w_"+filename+"_"+wordcount);
+
+			if (!hasType && localname == "w")
+				writer.writeAttribute("type", "w");
+
+			if (!hasN && localname == "w")
+				writer.writeAttribute("n", ""+wordcount);
+
+			writer.writeCharacters("\n");
+		}
+		else if(event == XMLStreamConstants.END_ELEMENT)
+		{
+			writer.writeEndElement();
+			writer.writeCharacters("\n");
+		}
+		else if(event == XMLStreamConstants.CHARACTERS)
+		{
+			if (insideword) { // ensure there is not \t or \n in the word form value
+				writer.writeCharacters(parser.getText().trim().replace("\n", " ").replace("\t", " "));
+			} else {
+				writer.writeCharacters(parser.getText());
+			}
+		}
+	}
+
+	/** The wordcount. */
+	int wordcount = 0;
+
+	/** The ignorecontent. */
+	boolean ignorecontent = true;//tokenize a partir de <body>
+	boolean insideword = false;
+	/**
+	 * Process.
+	 *
+	 * @return true, if successful
+	 */
+	public boolean process()
+	{
+		if (!infile.exists()) {
+			println "$infile does not exists"
+			return false;
+		}
+		XMLOutputFactory factory = XMLOutputFactory.newInstance();
+		output = new BufferedOutputStream(new FileOutputStream(outfile))
+		writer = factory.createXMLStreamWriter(output, "UTF-8")
+		writer.setNamespaceContext(new PersonalNamespaceContext());
+
+		def inputData = infile.toURI().toURL().openStream();
+		def inputfactory = XMLInputFactory.newInstance();
+		//inputfactory.setProperty("http://apache.org/xml/properties/input-buffer-size", new Integer(2048));
+		//inputfactory.setExpandEntityReferences(false);
+		parser = inputfactory.createXMLStreamReader(inputData, "UTF-8");
+		//println "PARSER: "+parser.getClass()
+		writer.writeStartDocument("UTF-8","1.0");
+		writer.writeCharacters("\n");
+
+		int previousEvent = 0;
+		boolean startProcess = false;
+		if (startTag == null) // if no startTag specified we process from the start
+			startProcess = true;
+		buffer = new StringBuffer();
+		//println "process - start start tag: "+startTag+" startProcess: $startProcess"
+		ignorecontent = !startProcess;
+		try {
+			for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+				if (!startProcess) {
+					if (event == XMLStreamConstants.START_ELEMENT) {
+						if (parser.getLocalName().matches(startTag)) {
+
+							startProcess = true
+							ignorecontent = false;
+						}
+					}
+					if (!startProcess) {
+						donothing(event, null);
+						continue;
+					}
+				}
+
+				if (previousEvent == XMLStreamConstants.CHARACTERS && previousEvent != event) {
+					processWord(); // tokenize
+					buffer = new StringBuffer();
+				}
+				fillInfos(event);//get localname and prefix
+				if (event == XMLStreamConstants.START_ELEMENT) {
+					//println "Open: "+localname;
+
+					if (localname.matches(word_tags)) // ignore the content of the word but keep counting
+					{
+						//println "Found pretagged word";
+						wordcount++;
+						donothing(event, wordcount);
+						ignorecontent = true;
+						insideword = true;
+					} else if (outside_text_tags_keep_content != null && localname.matches(outside_text_tags_keep_content)) { // ignore the content of the tag ONLY
+						//just ignore the tag
+					} else if (ignorable_tags != null && localname.matches(ignorable_tags)) { // ignore the content of the tag ONLY
+						donothing(event, null);
+						ignorecontent = true;
+					} else if (outside_text_tags != null && localname.matches(outside_text_tags)) { // ignore the tag and its content of the tag
+						goToEndOfElement(localname);
+					} else {
+						donothing(event, null);
+					}
+				} else if(event == XMLStreamConstants.END_ELEMENT) {
+					//println "Close: "+localname;
+					if (localname.matches(word_tags)) {
+						ignorecontent = false;
+						insideword = false;
+						writer.writeEndElement();
+						writer.writeCharacters("\n");
+					} else if (ignorable_tags != null && localname.matches(ignorable_tags)) { // ignore the content of the tag
+						ignorecontent = false;
+						donothing(event, null);
+					} else if (outside_text_tags_keep_content != null && localname.matches(outside_text_tags_keep_content)) { // ignore the content of the tag ONLY
+						//just ignore the tag
+					} else {
+						donothing(event, null);
+					}
+				} else if (event == XMLStreamConstants.CHARACTERS) {
+					if (ignorecontent) {
+						//println " ignore chars: "+parser.getText().trim();
+						donothing(event, null);
+					} else {
+						//println " process chars: "+parser.getText().trim();
+						buffer.append(parser.getText());
+						if (buffer.length() >= 128 && buffer.charAt(buffer.length()-1) == " ") {
+							processWord();
+							buffer = new StringBuffer();
+						}
+					}
+				} else if (event == XMLStreamConstants.COMMENT) {
+					writer.writeComment(parser.getText())
+				} else if (event == XMLStreamConstants.DTD) {
+					//println "DTD!";
+				} else {
+					if (DEBUG) println "Warning in $infile: ignore XML event at location "+parser.getLocation()
+				}
+				previousEvent = event;
+			}
+
+			parser.close()
+			writer.close();
+			output.close();
+			inputData.close();
+		} catch (Exception e) {
+			System.err.println("Error : "+infile);
+			e.printStackTrace();
+			return false;
+		}
+		return true;
+	}
+
+	public void setOutSideElements(String regexp) {
+		this.outside_text_tags = regexp;
+	}
+
+	public void setOutSideTextTags(String regexp) {
+		this.outside_text_tags_keep_content = regexp;
+	}
+
+	protected void goToEndOfElement(String name) {
+		//println "START ignoring tag and content of $name"
+		def openedTags = []
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+			if (event == XMLStreamConstants.START_ELEMENT) {
+				openedTags << parser.getLocalName()
+				//println "append "+openedTags
+			} else if (event == XMLStreamConstants.END_ELEMENT) {
+				if (openedTags.size() == 0 && name == parser.getLocalName()) {
+					//println "END ignoring tag and content of $name"
+					return;
+				}
+				openedTags.pop()
+				//println "pop $openedTags"
+			}
+		}
+	}
+
+	/**
+	 * Process word.
+	 */
+	protected void processWord()
+	{
+		String text = buffer.toString();//parser.getText().trim().replace("\t", " ");
+		if (DEBUG) println "-- chars: "+text+"--";
+		text = text.replaceAll("\n", " ");
+		text = text.replaceAll("\\p{C}", "");						// remove ctrl characters
+		for (String s : text.split(whitespaces) )			// separate with unicode white spaces
+		{
+			if (DEBUG){println "process $s"}
+			iterate(s);
+		}
+	}
+
+	/**
+	 * Iterate. a String, should be called when a word is found in a String
+	 *
+	 * @param s the s
+	 * @return the java.lang. object
+	 */
+	protected iterate(String s)
+	{
+		while (s != null && s.length() > 0) {
+			if (DEBUG){println "  > $s"}
+			s = standardChecks(s);
+		}
+	}
+
+
+	/**
+	 * Standard checks.
+	 *
+	 * @param s the s
+	 * @return the java.lang. object
+	 */
+	protected standardChecks(String s)
+	{
+		def m;
+		if (fclitics != null && (m = s =~ regFClitics) ) {
+			if (DEBUG) println "CLITIC found: $s ->"+ m[0][1]+" + "+m[0][2]+" + "+m[0][3]
+			if (m[0][1] != null && m[0][1].length() > 0) iterate(m[0][1]);// process first part of the string
+
+			wordcount++;
+			writer.writeStartElement("w");
+			writeWordAttributes();// id
+			writer.writeAttribute("type", "w");
+			writer.writeCharacters(m[0][2]);
+			writer.writeEndElement();
+			writer.writeCharacters("\n");
+
+			return m[0][3];
+		} else if ((m = s =~ regElision)) {
+			if (DEBUG) println "Elision found: $s ->"+ m[0][1]+" + "+m[0][2]+" + "+m[0][3]
+			iterate(m[0][1])
+
+			int sep = s.indexOf("'");
+			if (sep < 0)
+				sep = s.indexOf("’");
+			if (sep < 0)
+				sep = s.indexOf("‘");
+
+			wordcount++;
+			writer.writeStartElement("w");
+			writeWordAttributes();// id
+			writer.writeAttribute("type", "w");
+			writer.writeCharacters(m[0][2]);
+			writer.writeEndElement();
+			writer.writeCharacters("\n");
+
+			return m[0][3];
+		}
+		else if ((m = s =~ reg3pts) )
+		{
+			if(DEBUG){println "REG '...' found: $s -> "+m[0][1]+" + "+m[0][2]+" + "+m[0][3]}
+			iterate(m[0][1])
+
+			wordcount++;
+			writer.writeStartElement("w");
+			writeWordAttributes();// id
+			writer.writeAttribute("type","pon");
+			writer.writeCharacters("...");
+			writer.writeEndElement();
+			writer.writeCharacters("\n");
+
+			return m[0][3];
+		}
+		else if ((m = s =~ regPunct) )
+			//else if((m = s =~ /\A(.*)($punct_all)(.*)\Z/) )
+		{
+			if(DEBUG){println "PUNCT found: $s ->"+m[0][1]+" + "+m[0][2]+" + "+m[0][3]}
+			iterate(m[0][1]);
+
+			wordcount++;
+			writer.writeStartElement("w");
+			writeWordAttributes();// id
+			writer.writeAttribute("type","pon");
+			writer.writeCharacters(m[0][2]);
+			writer.writeEndElement();
+			writer.writeCharacters("\n");
+
+			return m[0][3];
+		}
+		else
+		{
+			if(DEBUG){println "Other found: "+s}
+			wordcount++;
+			writer.writeStartElement("w");
+			writeWordAttributes();// id
+			if (s.matches(/\p{P}/))
+				writer.writeAttribute("type","pon");
+			else
+				writer.writeAttribute("type","w");
+			writer.writeCharacters(s);
+			writer.writeEndElement();
+			writer.writeCharacters("\n");
+
+			return "";
+		}
+	}
+
+	/**
+	 * Write word attributes.
+	 *
+	 * @return the java.lang. object
+	 */
+	protected writeWordAttributes()
+	{
+		writer.writeAttribute("id", "w_"+filename+"_"+wordcount);
+		writer.writeAttribute("n",""+wordcount);
+	}
+
+	public void setStartTag(String tag)
+	{
+		this.startTag = tag;
+	}
+
+	/**
+	 * Tokenize.
+	 *
+	 * @param str the str
+	 * @return the list
+	 */
+	public List<String> tokenize(String str)
+	{
+		return str.tokenize()	// cut by whitespace
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args)
+	{
+		File inputDir = new File("/home/mdecorde/xml/annotation/")
+		File inputFile = new File(inputDir, "test.xml");
+		for (String lang : ["fr", null]) {
+			print "."
+			File outputFile = new File(inputDir, "test-${lang}.xml")
+
+			OldSimpleTokenizerXml tokenizer = new OldSimpleTokenizerXml(inputFile, outputFile, lang)
+			tokenizer.DEBUG = true
+			tokenizer.process();
+		}
+
+		println ""
+		println "Done"
+
+		//		String lang = "en"
+		//		File inDir = new File("/home/mdecorde/xml/ny911/cycle1/Data_Modif_Pour_Import_XML_Cycle1/xml_files/1xml_par_participant")
+		//		File outDir = new File("/home/mdecorde/xml/ny911/cycle1/Data_Modif_Pour_Import_XML_Cycle1/xml_files/1xml_par_participant-t")
+		//		outDir.deleteDir()
+		//		outDir.mkdir()
+		//
+		//		println "processing "+inDir.listFiles().size()+" files."
+		//		for (def infile : inDir.listFiles()) {
+		//			if (!infile.getName().endsWith(".xml")) continue;
+		//
+		//			print "."
+		//			File outfile = new File(outDir, infile.getName())
+		//			OldSimpleTokenizerXml tokenizer = new OldSimpleTokenizerXml(infile, outfile, lang)
+		//			tokenizer.setDEBUG false
+		//			tokenizer.process();
+		//		}
+		//		println ""
+		//		println "Done"
+
+	}
+}
Index: tmp/org.txm.core/src/groovy/filters/Tokeniser/SimpleTokenizerXml.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/filters/Tokeniser/SimpleTokenizerXml.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/filters/Tokeniser/SimpleTokenizerXml.groovy	(revision 258)
@@ -0,0 +1,748 @@
+// 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
+// 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.
+
+//
+// This file is part of the TXM platform.
+//
+// The TXM platform is free software: you can redistribute it and/or modif y
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 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/>.
+//
+//
+//
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$
+//
+package filters.Tokeniser;
+
+import static groovy.transform.TypeCheckingMode.SKIP
+import groovy.transform.CompileStatic
+
+import java.util.regex.Matcher
+import java.util.regex.Pattern
+
+import javax.xml.stream.*
+
+import org.txm.importer.graal.PersonalNamespaceContext
+import org.txm.tokenizer.TokenizerClasses
+
+@CompileStatic
+public class SimpleTokenizerXml {
+
+	/** The word_tags. */
+	String word_tags = TokenizerClasses.word_tags;
+	Pattern reg_word_tags;
+	/** The intraword_tags. */
+	String intraword_tags = TokenizerClasses.intraword_tags;
+
+	/** The punct_strong. */
+	String punct_strong = TokenizerClasses.punct_strong;
+
+	/** The punct_all. */
+	String punct_all = TokenizerClasses.punct_all;
+
+	/** The word_chars. */
+	String word_chars = TokenizerClasses.word_chars;
+
+	String fclitics = null; // default behavior don't manage clitics
+	String pclitics = null; // default behavior don't manage clitics
+
+	/** The outside_text_tags_ignore_content. */
+	String note_content = null;
+	String outside_text_tags_keep_content = null // tag and content NOT removed but not tokenized
+	String outside_text_tags = null // tag and content removed
+	String startTag = null
+	Pattern reg_note_content;
+	Pattern reg_outside_text_tags_keep_content; 
+	Pattern reg_outside_text_tags;
+	Pattern reg_startTag;
+	
+	Pattern reg_punct_other = Pattern.compile("\\p{P}")
+
+	/** The DEBUG. */
+	public boolean DEBUG = false;
+
+	/** The outfile. */
+	File outfile;
+
+	/** The infile. */
+	File infile;
+
+	String lang;
+
+	/** The buffer. */
+	StringBuffer buffer;
+
+	/** The writer. */
+	XMLStreamWriter writer;
+	BufferedOutputStream output;
+
+	/** The parser. */
+	XMLStreamReader parser
+
+	/** The localname. */
+	String localname;
+
+	/** The prefix. */
+	String prefix;
+	String filename;
+
+	def regElision = null;
+	def reg3pts = null;
+	def regPunct;
+	def regFClitics = null ;
+	def regPClitics = null ;
+	String whitespaces;
+	Pattern regWhitespaces;
+	Pattern regLN;
+	Pattern regCTRL;
+	Pattern regSplitWhiteSpaces;
+
+	public SimpleTokenizerXml(File infile, File outfile) {
+		this(infile, outfile, "");
+	}
+
+	/**
+	 * Instantiates a new simple tokenizer xml.
+	 *
+	 * @param infile the infile
+	 * @param outfile the outfile
+	 */
+	public SimpleTokenizerXml(File infile, File outfile, String lang) {
+		this.lang = lang;
+		if (lang != null)
+			if (lang.startsWith("en")) {
+				fclitics = TokenizerClasses.FClitic_en
+			} else if (lang.startsWith("fr")) {
+				fclitics = TokenizerClasses.FClitic_fr
+				pclitics = TokenizerClasses.PClitic_fr
+			} else if (lang.startsWith("gl")) {
+				fclitics = TokenizerClasses.FClitic_gl
+			} else if (lang.startsWith("it")) {
+				pclitics = TokenizerClasses.PClitic_it
+			}
+
+		word_tags = TokenizerClasses.word_tags;
+		reg_word_tags = Pattern.compile(word_tags);
+		intraword_tags = TokenizerClasses.intraword_tags;
+		punct_strong = TokenizerClasses.punct_strong;
+		punct_all = TokenizerClasses.punct_all;
+		word_chars = TokenizerClasses.word_chars;
+
+		this.outfile = outfile;
+		this.infile = infile;
+		this.filename = infile.getName();
+		int index = filename.indexOf(".");
+		if (index > 0) filename = filename.substring(0, index);
+
+		String strRegElision = TokenizerClasses.regElision;
+		if (strRegElision != null && strRegElision.length() > 0)
+			regElision = ~/^([\p{L}-]++${strRegElision}[\p{L}-]++)(.*)$/ // the test must start with the start of string  ^
+		reg3pts = ~/^(.*?)(\.\.\.)(.*)$/
+		
+		String strRegPunct = TokenizerClasses.regPunct;
+		if (strRegPunct != null && strRegPunct.length() > 0)
+			regPunct = ~/^(.*?)($strRegPunct)(.*)$/
+		
+		if (fclitics != null && fclitics.length() > 0)
+			regFClitics = ~/(.+)($fclitics)$/ // the test must end with the end of string $
+			
+		if (pclitics != null && pclitics.length() > 0)
+			regPClitics = /^($pclitics)(.*)/ // the test must start with the start of string  ^
+			
+		if (TokenizerClasses.whitespaces != null && TokenizerClasses.whitespaces.length() > 0)
+			regWhitespaces = ~TokenizerClasses.whitespaces;
+
+		if (TokenizerClasses.whitespaces != null && TokenizerClasses.whitespaces.length() > 0)
+			regSplitWhiteSpaces = Pattern.compile(TokenizerClasses.whitespaces);
+			
+		regLN = Pattern.compile("/\n/");
+		regCTRL = Pattern.compile("/\\p{C}/");
+	}
+
+	/**
+	 * Fill infos.
+	 *
+	 * @param event the event
+	 * @return the java.lang. object
+	 */
+	public fillInfos(int event) {
+		if (event == XMLStreamConstants.START_ELEMENT || event == XMLStreamConstants.END_ELEMENT) {
+			localname = parser.getLocalName();
+			prefix = parser.getPrefix();
+		}
+	}
+
+	/**
+	 * Donothing: just write what is read
+	 * 
+	 * special processing for words: prefix id attributes with "w_" and remove special characters like \n \t etc.
+	 *
+	 * @param event the event
+	 * @param wordid the wordid
+	 * @return the java.lang. object
+	 */
+	public donothing(int event, Integer wordid) {
+		if (event == XMLStreamConstants.START_ELEMENT ) {
+			localname = parser.getLocalName();
+			if (prefix != null && prefix.length() > 0)
+				writer.writeStartElement(prefix+":"+localname);
+			else
+				//				if(namespace != null)
+				//					writer.writeStartElement(namespace, localname);
+				//				else
+				writer.writeStartElement(localname);
+
+			//			if(parser.getNamespaceCount() > 0)
+			//				writer.writeDefaultNamespace(parser.getNamespaceURI(0))
+			//			for(int i = 1 ; i < parser.getNamespaceCount() ; i++)
+			//				writer.writeNamespace(parser.getNamespacePrefix(i), parser.getNamespaceURI(i));
+
+			String namespace_prefix;
+			for (int i = 0 ; i<   parser.getNamespaceCount() ; i++) {
+				namespace_prefix = parser.getNamespacePrefix(i);
+				if ((namespace_prefix != null)&&   (namespace_prefix.length()>   0)) {
+					writer.writeNamespace(namespace_prefix, parser.getNamespaceURI(i));
+				} else {
+					writer.writeDefaultNamespace(parser.getNamespaceURI(i));
+				}
+			}
+
+			String attrprefix, attname;
+			boolean hasId = false;
+			//boolean hasType = false
+			boolean hasN = false
+			for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
+				attname = parser.getAttributeLocalName(i);
+				attrprefix = parser.getAttributePrefix(i);
+				if ("id".equals(attname)) hasId = true;
+				//if ("type".equals(attname)) hasType = true;
+				if ("n".equals(attname)) hasN = true;
+
+				if (attrprefix != null && attrprefix.length() > 0)
+					writer.writeAttribute(attrprefix+":"+attname, parser.getAttributeValue(i))
+				else
+					writer.writeAttribute(attname, parser.getAttributeValue(i))
+			}
+
+			if (wordid != null && !hasId && localname == "w")
+				writer.writeAttribute("id", "w_"+filename+"_"+wordcount);
+
+			//if (!hasType && localname == "w") writer.writeAttribute("type", "w");
+
+			if (!hasN && localname == "w")
+				writer.writeAttribute("n", ""+wordcount);
+
+			writer.writeCharacters("\n");
+		}
+		else if(event == XMLStreamConstants.END_ELEMENT)
+		{
+			writer.writeEndElement();
+			writer.writeCharacters("\n");
+		}
+		else if(event == XMLStreamConstants.CHARACTERS)
+		{
+			//println parser.getText();
+			//writer.writeCharacters("𦟛");
+
+
+			// checks if the token starts with an high surrogate
+			//			if(isHighSurrogate(parser.getText().charAt(0)))	{
+			//				println "warning: invalid UTF-8 XML range, token " + parser.getText() + " has been replaced.";
+			//				writer.writeCharacters("__invalidXMLChar__")
+			//				//writer.writeCharacters("𦟛");
+			//				println "high surrogate: " + Integer.toHexString((int)parser.getText().charAt(0));
+			//				println "low surrogate: " + Integer.toHexString((int)parser.getText().charAt(1));
+			//				int charSum = parser.getText().charAt(0) + parser.getText().charAt(1);
+			//				println "char sum: " + charSum;
+			//				println "test " + surrogatesPairToScalar(parser.getText().charAt(0), parser.getText().charAt(1));
+			//				int scalar = surrogatesPairToScalar(parser.getText().charAt(0), parser.getText().charAt(1));
+			//				//writer.writeCharacters(String.valueOf((char)112692));
+			//				writer.writeCharacters("&#" + scalar + ";");
+			//			}
+			//			else
+
+
+			if (insideword) { // ensure there is not \t or \n in the word form value
+				writer.writeCharacters(parser.getText().trim().replace("\n", " ").replace("\t", " "));
+			} else {
+				writer.writeCharacters(parser.getText());
+			}
+		}
+	}
+
+
+	/**
+	 * Converts the specified surrogates pair to scalar.
+	 * @param highSurrogate
+	 * @param lowSurrogate
+	 * @return
+	 */
+	public int surrogatesPairToScalar(char highSurrogate, char lowSurrogate)	{
+		return ((highSurrogate - 0xD800) * 0x400) + (lowSurrogate - 0xDC00) + 0x10000;
+	}
+
+	/**
+	 * Checks if the specified character is an high/leading surrogate.
+	 * @param character
+	 * @return
+	 */
+	public boolean isHighSurrogate(char character)	{
+		return (character >= 0xD800 && character <= 0xDBFF);
+	}
+
+
+
+	/** The wordcount. */
+	int wordcount = 0;
+
+	/** The ignorecontent. */
+	boolean ignorecontent = true; // tokenization starts with element name matching $reg_startTag
+	boolean insideword = false;
+	/**
+	 * Process.
+	 *
+	 * @return true, if successful
+	 */
+	public boolean process()
+	{
+		if (!infile.exists()) {
+			println "$infile does not exists"
+			return false;
+		}
+		XMLOutputFactory factory = XMLOutputFactory.newInstance();
+		output = new BufferedOutputStream(new FileOutputStream(outfile))
+		writer = factory.createXMLStreamWriter(output, "UTF-8")
+		writer.setNamespaceContext(new PersonalNamespaceContext());
+
+		def inputData = infile.toURI().toURL().openStream();
+		def inputfactory = XMLInputFactory.newInstance();
+		//inputfactory.setProperty("http://apache.org/xml/properties/input-buffer-size", new Integer(2048));
+		//inputfactory.setExpandEntityReferences(false);
+		parser = inputfactory.createXMLStreamReader(inputData, "UTF-8");
+		//println "PARSER: "+parser.getClass()
+		writer.writeStartDocument("UTF-8","1.0");
+		writer.writeCharacters("\n");
+
+		int previousEvent = 0;
+		boolean startProcess = false;
+		if (startTag == null) // if no startTag specified we process from the start
+			startProcess = true;
+		ignorecontent = !startProcess;
+		
+		buffer = new StringBuffer();
+		//println "process - start start tag: "+startTag+" startProcess: $startProcess"
+//		println "reg_outside_text_tags_keep_content=$reg_outside_text_tags_keep_content"
+//		println "reg_outside_text_tags=$reg_outside_text_tags"
+//		println "reg_note_content=$reg_note_content"
+		try {
+			for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+				if (!startProcess) {
+					if (event == XMLStreamConstants.START_ELEMENT) {
+						if (reg_startTag.matcher(parser.getLocalName()).matches()) {
+							startProcess = true
+							ignorecontent = false;
+						}
+					}
+					if (!startProcess) {
+						donothing(event, null);
+						continue;
+					}
+				}
+
+				if (previousEvent == XMLStreamConstants.CHARACTERS && previousEvent != event) {
+					processWord(); // tokenize now!
+					buffer.setLength(0);
+				}
+				fillInfos(event);//get localname and prefix
+				if (event == XMLStreamConstants.START_ELEMENT) {
+					//println "Open: "+localname;
+					localname = parser.getLocalName()
+					if (reg_word_tags.matcher(localname).matches()) { // ignore the content of the word but keep counting
+						//println "Found pretagged word";
+						wordcount++;
+						donothing(event, wordcount);
+						ignorecontent = true;
+						insideword = true;
+					} else if (reg_note_content != null && reg_note_content.matcher(localname).matches()) { // ignore the content of the tag ONLY
+						// ignore the tag only
+						donothing(event, null); // write the tag
+						//println "IGNORING NOTE CONTENT OF "+localname
+						ignorecontent = true;
+					} else if (reg_outside_text_tags_keep_content != null && reg_outside_text_tags_keep_content.matcher(localname).matches()) { // ignore the content of the tag ONLY
+						// 	ignore the content only
+						donothing(event, null); // write the tag
+						//println "IGNORING CONTENT OF "+localname
+						ignorecontent = true;
+					} else if (reg_outside_text_tags != null && reg_outside_text_tags.matcher(localname).matches()) { // ignore the tag and its content of the tag
+						goToEndOfElement(localname); // parse until the end of the element is passed
+					} else {
+						donothing(event, null);
+					}
+				} else if(event == XMLStreamConstants.END_ELEMENT) {
+					//println "Close: "+localname;
+					localname = parser.getLocalName()
+					if (reg_word_tags.matcher(localname).matches()) {
+						//ignorecontent = false;
+						insideword = false;
+						writer.writeEndElement();
+						writer.writeCharacters("\n");
+					} else if (reg_outside_text_tags_keep_content != null && reg_outside_text_tags_keep_content.matcher(localname).matches()) { // ignore the content of the tag
+						ignorecontent = false;
+						donothing(event, null);
+					} else if (reg_note_content != null && reg_note_content.matcher(localname).matches()) { // ignore the content of the tag ONLY
+						ignorecontent = false;
+						donothing(event, null);
+					} else {
+						donothing(event, null);
+					}
+				} else if (event == XMLStreamConstants.CHARACTERS) {
+					if (ignorecontent) {
+						//println " dont tokenize chars: "+parser.getText().trim();
+						donothing(event, null);
+					} else {
+						//println " process chars: "+parser.getText().trim();
+						buffer.append(parser.getText());
+						if (buffer.length() >= 128 && buffer.charAt(buffer.length()-1) == " ") {
+							processWord();
+							buffer = new StringBuffer();
+						}
+					}
+				} else if (event == XMLStreamConstants.COMMENT) {
+					writer.writeComment(parser.getText())
+				} else if (event == XMLStreamConstants.DTD) {
+					//println "DTD!";
+				} else {
+					if (DEBUG) println "Warning in $infile: ignore XML event at location "+parser.getLocation()
+				}
+				previousEvent = event;
+			}
+
+			parser.close()
+			writer.close();
+			output.close();
+			inputData.close();
+		} catch (Exception e) {
+			System.err.println("Error : "+infile);
+			e.printStackTrace();
+			return false;
+		}
+		return true;
+	}
+
+	/**
+	 * Set the element and content to ignore
+	 * 
+	 * @param regexp
+	 */
+	public void setOutSideTextTags(String regexp) {
+		this.outside_text_tags = regexp;
+		this.reg_outside_text_tags = Pattern.compile(outside_text_tags);
+	}
+	
+	/**
+	 * Set element content to NOT tokenize
+	 *
+	 * @param regexp
+	 */
+	public void setNote(String regexp) {
+		this.note_content = regexp;
+		this.reg_note_content = Pattern.compile(note_content);
+	}
+	
+	/**
+	 * Set the element to ignore but not their content
+	 *
+	 * @param regexp
+	 */
+	public void setOutSideTextTagsAndKeepContent(String regexp) {
+		this.outside_text_tags_keep_content = regexp;
+		this.reg_outside_text_tags_keep_content = Pattern.compile(outside_text_tags_keep_content);
+	}
+	
+	protected void goToEndOfElement(String name) {
+		//println "START ignoring tag and content of $name"
+		def openedTags = []
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+			if (event == XMLStreamConstants.START_ELEMENT) {
+				openedTags << parser.getLocalName()
+				//println "append "+openedTags
+			} else if (event == XMLStreamConstants.END_ELEMENT) {
+				if (openedTags.size() == 0 && name == parser.getLocalName()) {
+					//println "END ignoring tag and content of $name"
+					return;
+				}
+				openedTags.pop()
+				//println "pop $openedTags"
+			}
+		}
+	}
+	
+	public final static String WHITESPACE = " ";
+	public final static String EMPTY = "";
+	/**
+	 * Process word.
+	 */
+	protected void processWord() {
+		String text = buffer.toString();//parser.getText().trim().replace("\t", " ");
+		//if (DEBUG) println "-- chars: "+text+"--";
+		text = regLN.matcher(text).replaceAll(WHITESPACE);
+		text = regCTRL.matcher(text).replaceAll(EMPTY);						// remove ctrl characters
+		if (regSplitWhiteSpaces != null) {
+			for (String s : regSplitWhiteSpaces.split(text)) {		// separate with unicode white spaces
+				//	if (DEBUG){println "process $s"}
+					iterate(s);
+				}
+		} else {
+			iterate(text);
+		}
+	}
+
+	/**
+	 * Iterate. a String, should be called when a word is found in a String
+	 *
+	 * @param s the s
+	 * @return the java.lang. object
+	 */
+	protected iterate(String s) {
+		while (s != null && s.length() > 0) {
+		//	if (DEBUG){println "  > $s"}
+			s = standardChecks(s);
+		}
+	}
+
+	/**
+	 * Standard checks.
+	 *
+	 * @param s the s
+	 * @return the java.lang. object
+	 */
+	//	@CompileStatic(SKIP)
+	public String standardChecks(String s) {
+		Matcher m;
+		if (fclitics != null && (m = s =~ regFClitics) ) {
+		//	if (DEBUG) println "CLITIC found: $s ->"+ m
+			iterate(m.group(1))
+			
+			wordcount++;
+			writer.writeStartElement("w");
+			writeWordAttributes();// id
+			//writer.writeAttribute("type", "w");
+			writer.writeCharacters(m.group(2));
+			writer.writeEndElement();
+			writer.writeCharacters("\n");
+			
+			return "";
+		} else if (pclitics != null && (m = s =~ regPClitics) ) {
+			if (DEBUG) println "PCLITIC found: $s ->"+ m
+			
+			wordcount++;
+			writer.writeStartElement("w");
+			writeWordAttributes();// id
+			//writer.writeAttribute("type", "w");
+			writer.writeCharacters(m.group(1));
+			writer.writeEndElement();
+			writer.writeCharacters("\n");
+			
+			iterate(m.group(2))
+			
+			return "";
+		} else if (regElision != null && (m = s =~ regElision) ) {
+		//	if (DEBUG) println "Elision found: $s ->"+ m.group(1)+" + "+m.group(2)+" + "+m.group(3)
+			//iterate(m.group(1))
+
+//			int sep = s.indexOf("'");
+//			if (sep < 0)
+//				sep = s.indexOf("’");
+//			if (sep < 0)
+//				sep = s.indexOf("‘");
+
+			wordcount++;
+			writer.writeStartElement("w");
+			writeWordAttributes();// id
+			//writer.writeAttribute("type", "w");
+			writer.writeCharacters(m.group(1));
+			writer.writeEndElement();
+			writer.writeCharacters("\n");
+
+			iterate(m.group(2))
+			
+			return "";
+		} else if (reg3pts != null && (m = s =~ reg3pts) )	{
+		//	if(DEBUG){println "REG '...' found: $s -> "+m.group(1)+" + "+m.group(2)+" + "+m.group(3)}
+			iterate(m.group(1))
+
+			wordcount++;
+			writer.writeStartElement("w");
+			writeWordAttributes();// id
+			//writer.writeAttribute("type","pon");
+			writer.writeCharacters("...");
+			writer.writeEndElement();
+			writer.writeCharacters("\n");
+
+			return m.group(3);
+		} else if (regPunct != null && (m = s =~ regPunct) ) {
+			if(DEBUG){println "PUNCT found: $s ->"+m.group(1)+" + "+m.group(2)+" + "+m.group(3)}
+			iterate(m.group(1));
+
+			wordcount++;
+			writer.writeStartElement("w");
+			writeWordAttributes();// id
+			//writer.writeAttribute("type","pon");
+			writer.writeCharacters(m.group(2));
+			writer.writeEndElement();
+			writer.writeCharacters("\n");
+
+			return m.group(3);
+		} else {
+	//		if(DEBUG){println "Other found: "+s}
+			wordcount++;
+			writer.writeStartElement("w");
+			writeWordAttributes();// id
+//			if (reg_punct_other.matcher(s).matches())
+//				writer.writeAttribute("type","pon");
+//			else
+//				writer.writeAttribute("type","w");
+			writer.writeCharacters(s);
+			writer.writeEndElement();
+			writer.writeCharacters("\n");
+
+			return "";
+		}
+	}
+
+	/**
+	 * Write word attributes.
+	 *
+	 * @return the java.lang. object
+	 */
+	protected writeWordAttributes() {
+		writer.writeAttribute("id", "w_"+filename+"_"+wordcount);
+		writer.writeAttribute("n",""+wordcount);
+	}
+
+	public void setStartTag(String tag)
+	{
+		this.startTag = tag;
+		this.reg_startTag = Pattern.compile(startTag);
+	}
+
+	/**
+	 * Tokenize.
+	 *
+	 * @param str the str
+	 * @return the list
+	 */
+	public List<String> tokenize(String str)
+	{
+		return str.tokenize()	// cut by whitespace
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args)
+	{
+		File SVNDIR = new File(System.getProperty("user.home"), "SVN/TXMSVN/trunk/corpora/tokenizer");
+		Runtime.getRuntime().exec("svn", "update", SVNDIR.getAbsolutePath());
+		File inputFile = new File(SVNDIR, "test1.xml")
+		File outputFile = new File(SVNDIR, "test1-t.xml")
+		SimpleTokenizerXml tokenizer = new SimpleTokenizerXml(inputFile, outputFile, "fr")
+		tokenizer.DEBUG = true
+		tokenizer.setNote("note")
+		tokenizer.setOutSideTextTags("outside")
+		tokenizer.setOutSideTextTagsAndKeepContent("outsideToEdit")
+		println outputFile.toString() + " : "+tokenizer.process();
+		// FIXME: tests UTF-8 XML ranges
+		//		File inputDir = new File("C:/Tools/Textometrie/___corpus/xml/test_bug_import_chinois/")
+		//	File inputFile = new File(inputDir, "problem2.xml");
+
+		/*
+		File inputDir = new File("/home/mdecorde/xml/bvhepistemon2016")
+		File outputDir = new File("/home/mdecorde/xml/bvhepistemon2016/out-fast")
+		File outputDir2 = new File("/home/mdecorde/xml/bvhepistemon2016/out-slow")
+		File outputDir3 = new File("/home/mdecorde/xml/bvhepistemon2016/out-fast2")
+		File inputFile = new File(inputDir, "1542_RabelaisGrgt.xml");
+		outputDir.deleteDir()
+		outputDir2.deleteDir()
+		outputDir3.deleteDir()
+		outputDir.mkdir()
+		outputDir2.mkdir()
+		outputDir3.mkdir()
+		long time;
+		for (String lang : ["none"]) {
+			println "LANG: $lang"
+
+			time = System.currentTimeMillis();
+			File outputFile = new File(outputDir, "${lang}.xml")
+			SimpleTokenizerXml tokenizer = new SimpleTokenizerXml(inputFile, outputFile, lang)
+			tokenizer.process();
+			println "FAST $lang: "+(System.currentTimeMillis()-time)
+
+//			time = System.currentTimeMillis();
+//			File outputFile3 = new File(outputDir3, "${lang}.xml")
+//			FastSimpleTokenizerXml tokenizer3 = new FastSimpleTokenizerXml(inputFile, outputFile3, lang)
+//			tokenizer3.process();
+//			println "FAST2 $lang: "+(System.currentTimeMillis()-time)
+//			
+//			time = System.currentTimeMillis();
+//			File outputFile2 = new File(outputDir2, "${lang}.xml")
+//			OldSimpleTokenizerXml tokenizer2 = new OldSimpleTokenizerXml(inputFile, outputFile2, lang)
+//			tokenizer2.process();
+//			println "SLOW $lang: "+(System.currentTimeMillis()-time)
+		}
+*/
+		println ""
+		println "Done"
+
+		//		String lang = "en"
+		//		File inDir = new File("/home/mdecorde/xml/ny911/cycle1/Data_Modif_Pour_Import_XML_Cycle1/xml_files/1xml_par_participant")
+		//		File outDir = new File("/home/mdecorde/xml/ny911/cycle1/Data_Modif_Pour_Import_XML_Cycle1/xml_files/1xml_par_participant-t")
+		//		outDir.deleteDir()
+		//		outDir.mkdir()
+		//
+		//		println "processing "+inDir.listFiles().size()+" files."
+		//		for (def infile : inDir.listFiles()) {
+		//			if (!infile.getName().endsWith(".xml")) continue;
+		//
+		//			print "."
+		//			File outfile = new File(outDir, infile.getName())
+		//			SimpleTokenizerXml tokenizer = new SimpleTokenizerXml(infile, outfile, lang)
+		//			tokenizer.setDEBUG false
+		//			tokenizer.process();
+		//		}
+		//		println ""
+		//		println "Done"
+
+	}
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/filters/Tokeniser/package.html
===================================================================
--- tmp/org.txm.core/src/groovy/filters/Tokeniser/package.html	(revision 0)
+++ tmp/org.txm.core/src/groovy/filters/Tokeniser/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Main filter of the BFM tokenizer</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/filters/Tokeniser/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/filters/Tokeniser/test.xml
===================================================================
--- tmp/org.txm.core/src/groovy/filters/Tokeniser/test.xml	(revision 0)
+++ tmp/org.txm.core/src/groovy/filters/Tokeniser/test.xml	(revision 258)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<text><!--Fichier XML de test du tokenizer XML de TXM. Chaque div contient un cas particulier que le tokenizer doit gérer-->
+    <div id="ignore element"></div>
+    <div id="delete element"></div>    
+    <div id="delete element and its content"></div>
+    <div id="replace newlines with spaces"></div>
+    <div id="delete Ctrl (C class) characters"></div>
+    <div id="split using whitespaces regexp"></div>
+    <div id="fclitics"></div>
+    <div id="elision"></div>
+    <div id="..."></div>
+    <div id="punct"></div>
+    <div id="other things"></div>
+</text>

Property changes on: tmp/org.txm.core/src/groovy/filters/Tokeniser/test.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/filters/Tokeniser/TokenizerXml.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/filters/Tokeniser/TokenizerXml.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/filters/Tokeniser/TokenizerXml.groovy	(revision 258)
@@ -0,0 +1,398 @@
+// 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
+// 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.
+
+//
+// This file is part of the TXM platform.
+//
+// The TXM platform is free software: you can redistribute it and/or modif y
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 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/>.
+// 
+// 
+// 
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+package filters.Tokeniser;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.txm.objects.Base;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStreamReader;
+
+import javax.xml.stream.*;
+import java.net.URL;
+import org.txm.tokenizer.TokenizerClasses;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class TokenizerXml.
+ */
+public class TokenizerXml {
+	
+	/** The word_tags. */
+	String word_tags = TokenizerClasses.word_tags;
+	
+	/** The intraword_tags. */
+	String intraword_tags = TokenizerClasses.intraword_tags;
+	
+	/** The punct_strong. */
+	def punct_strong = TokenizerClasses.punct_strong;
+	
+	/** The punct_all. */
+	def punct_all = TokenizerClasses.punct_all;
+	
+	/** The word_chars. */
+	def word_chars = TokenizerClasses.word_chars;
+	
+	/** The ignorable_tags. */
+	String ignorable_tags = "note"
+	
+	/** The outfile. */
+	File outfile;
+	
+	/** The infile. */
+	File infile;
+	
+	/** The writer. */
+	XMLStreamWriter writer;
+	FileOutputStream output;
+	
+	/** The parser. */
+	XMLStreamReader parser
+	
+	/** The localname. */
+	String localname;
+	
+	/** The prefix. */
+	String prefix;
+	
+	/**
+	 * Instantiates a new tokenizer xml.
+	 *
+	 * @param infile the infile
+	 * @param outfile the outfile
+	 */
+	public TokenizerXml(File infile, File outfile)
+	{
+		this.outfile = outfile;
+		this.infile = infile;
+	}
+	
+	/**
+	 * Fill infos.
+	 *
+	 * @param event the event
+	 * @return the java.lang. object
+	 */
+	public fillInfos(int event)
+	{
+		if (event == XMLStreamConstants.START_ELEMENT || event == XMLStreamConstants.END_ELEMENT) 
+		{
+			localname = parser.getLocalName();
+			prefix = parser.getPrefix();
+		}
+	}
+	
+	/**
+	 * Donothing.
+	 *
+	 * @param event the event
+	 * @return the java.lang. object
+	 */
+	public donothing(int event)
+	{
+		if (event == XMLStreamConstants.START_ELEMENT ) {
+			if(prefix != null && prefix.length() > 0)
+				writer.writeStartElement(prefix+":"+localname);
+			else
+				writer.writeStartElement(localname);
+			String attrprefix;
+			for(int i = 0 ; i < parser.getAttributeCount() ; i++)
+			{
+				attrprefix = parser.getAttributePrefix(i);
+				if(attrprefix != null && attrprefix.length() > 0)
+					writer.writeAttribute(attrprefix+":"+parser.getAttributeLocalName(i), parser.getAttributeValue(i))
+				else
+					writer.writeAttribute(parser.getAttributeLocalName(i), parser.getAttributeValue(i))
+			}
+		}
+		else if(event == XMLStreamConstants.END_ELEMENT)
+		{
+			writer.writeEndElement();
+			writer.writeCharacters("\n");
+		}
+		else if(event == XMLStreamConstants.CHARACTERS)
+		{
+			writer.writeCharacters(parser.getText());
+		}
+	}
+	
+	/**
+	 * Process.
+	 */
+	public void process()
+	{
+		boolean ignorecontent = true;//tokenize a partir de <body>
+		int wordcount = 0;
+		
+		XMLOutputFactory factory = XMLOutputFactory.newInstance();
+		output = new FileOutputStream(outfile)
+		writer = factory.createXMLStreamWriter(output, "UTF-8")
+		
+		def inputData = infile.toURI().toURL().openStream();
+		def inputfactory = XMLInputFactory.newInstance();
+		parser = inputfactory.createXMLStreamReader(inputData);
+		
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) 
+		{
+			fillInfos(event);
+			if (event == XMLStreamConstants.START_ELEMENT) 
+			{
+				//println "Open: "+localname;
+				if(localname == "text")
+				{
+					ignorecontent = false;
+					donothing(event);
+				}
+				if(localname.matches(word_tags))
+				{
+					//println "Found pretagged word";
+					donothing(event);
+					wordcount++;
+					if(parser.getAttributeValue(null, "id") == null)
+						writer.writeAttribute("id", "w_"+wordcount);
+					if(parser.getAttributeValue(null, "type") == null)
+						writer.writeAttribute("type","w");
+					ignorecontent = true;
+				}
+				else if(localname.matches(ignorable_tags))
+				{
+					//println "Found note";
+					donothing(event);
+					ignorecontent = true;
+				}
+				else
+				{
+					donothing(event);
+				}
+			}
+			else if(event == XMLStreamConstants.END_ELEMENT) 
+			{
+				//println "Close: "+localname;
+				if(localname == "w")
+				{
+					ignorecontent = false;
+					writer.writeEndElement();
+					writer.writeCharacters("\n");
+				}
+				else if(localname == "note")
+				{
+					ignorecontent = false;
+					writer.writeEndElement();
+					writer.writeCharacters("\n");
+				}
+				else
+				{
+					donothing(event);
+				}
+			}
+			else if(event == XMLStreamConstants.CHARACTERS) 
+			{
+				if(ignorecontent)
+				{	
+					//println " ignore chars: "+parser.getText().trim();
+					donothing(event);
+				}
+				else
+				{
+					//println " chars: "+parser.getText().trim();
+					String text = parser.getText().trim().replace("\t"," ");
+					text = text.replaceAll("\\p{C}", "");
+					for(String s : tokenize(text))
+					{
+						if (s.matches(/\.[^ .]+\./)) {
+							wordcount++;	
+							writer.writeStartElement("w");
+							writer.writeAttribute("id","w_"+wordcount);
+							writer.writeAttribute("type","num");
+							writer.writeCharacters(s);
+							writer.writeEndElement();
+							writer.writeCharacters("\n");
+						} else if(s.matches(/$punct_all|['‘’]/))
+										{
+							wordcount++;	
+							writer.writeStartElement("w");
+							writer.writeAttribute("id","w_"+wordcount);
+							writer.writeAttribute("type","pon");
+							writer.writeCharacters(s);
+							writer.writeEndElement();
+							writer.writeCharacters("\n");
+						}
+						else if(s.matches(/[\[\(\{].*[\]\)\}]/))
+						{
+							wordcount++;	
+							writer.writeStartElement("w");
+							writer.writeAttribute("id","w_"+wordcount);
+							writer.writeStartElement("supplied");
+							writer.writeAttribute("rend","crochets");
+							writer.writeCharacters(s);
+							writer.writeEndElement();
+							writer.writeEndElement();
+							writer.writeCharacters("\n");
+						}
+						else if(s.contains("'") || s.contains("’"))
+						{
+							int sep = s.indexOf("'");
+							if(sep < 0)
+								sep = s.indexOf("’");
+
+							wordcount++;	
+							writer.writeStartElement("w");
+							writer.writeAttribute("id","w_"+wordcount);
+							writer.writeCharacters(s.substring(0,sep+1));
+							writer.writeEndElement();
+							writer.writeCharacters("\n");
+							
+							if(s.substring(sep+1).length() > 0)
+							{
+								wordcount++;	
+								writer.writeStartElement("w");
+								writer.writeAttribute("id","w_"+wordcount);
+								writer.writeCharacters(s.substring(sep+1));
+								writer.writeEndElement();
+								writer.writeCharacters("\n");
+							}
+						}
+						else if(s.matches(/($punct_all)(.*)/))
+						{
+							wordcount++;	
+							writer.writeStartElement("w");
+							writer.writeAttribute("id","w_"+wordcount);
+							writer.writeAttribute("type","pon");
+							writer.writeCharacters(s.substring(0, 1));
+							writer.writeEndElement();
+							writer.writeCharacters("\n");
+							
+							wordcount++;	
+							writer.writeStartElement("w");
+							writer.writeAttribute("id","w_"+wordcount);
+							writer.writeCharacters(s.substring(1));
+							writer.writeEndElement();
+							writer.writeCharacters("\n");
+						}
+						else if(s.matches(/(.*)($punct_all)/))
+						{
+							wordcount++;	
+							writer.writeStartElement("w");
+							writer.writeAttribute("id","w_"+wordcount);
+							writer.writeCharacters(s.substring(0, s.length()-1));
+							writer.writeEndElement();
+							writer.writeCharacters("\n");
+							
+							wordcount++;	
+							writer.writeStartElement("w");
+							writer.writeAttribute("id","w_"+wordcount);
+							writer.writeAttribute("type","pon");
+							writer.writeCharacters(s.substring(s.length()-1, s.length()));
+							writer.writeEndElement();
+							writer.writeCharacters("\n");
+						} else {
+							wordcount++;	
+							writer.writeStartElement("w");
+							writer.writeAttribute("id","w_"+wordcount);
+							writer.writeCharacters(s);
+							writer.writeEndElement();
+							writer.writeCharacters("\n");
+						}
+					}
+				}
+			}
+			else if(event == XMLStreamConstants.COMMENT) 
+			{
+				writer.writeComment(parser.getText())
+			}
+			else if(event == XMLStreamConstants.DTD) 
+			{
+				//println "DTD!";
+			}
+			else
+			{
+				
+			}
+		}
+		
+		parser.close()
+		writer.close();
+		output.close();
+		inputData.close();
+	}
+	
+	/**
+	 * Tokenize.
+	 *
+	 * @param str the str
+	 * @return the list
+	 */
+	public List<String> tokenize(String str)
+	{
+		return str.tokenize()//cut by whitespace
+	}
+	
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args)
+	{
+		File infile = new File("~/xml/quete","qgraal_cm.xml");
+		File outfile = new File("~/xml/quete","qgraal_cm-out.xml");
+		TokenizerXml tokenizer = new TokenizerXml(infile, outfile)
+		tokenizer.process();
+	}
+}
Index: tmp/org.txm.core/src/groovy/filters/Tokeniser/OneTagPerLine.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/filters/Tokeniser/OneTagPerLine.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/filters/Tokeniser/OneTagPerLine.groovy	(revision 258)
@@ -0,0 +1,295 @@
+// 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
+// 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.
+//
+//
+//
+// $LastChangedDate: 2017-01-24 18:11:42 +0100 (Tue, 24 Jan 2017) $
+// $LastChangedRevision: 3400 $
+// $LastChangedBy: mdecorde $
+//
+package filters.Tokeniser;
+
+import java.text.DateFormat;
+import java.util.Date;
+import java.util.ArrayList;
+import javax.xml.stream.*;
+import java.net.URL;
+import org.txm.importer.filters.*;
+import java.net.URLEncoder;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Used by the tokenizer. put one tag per line
+ * 
+ * @author mdecorde
+ */
+
+public class OneTagPerLine {
+
+	/** The url. */
+	private def url;
+
+	/** The input data. */
+	private def inputData;
+
+	/** The factory. */
+	private def factory;
+
+	/** The parser. */
+	private XMLStreamReader parser;
+
+	/** The output. */
+	private def output;
+
+	/** The solotags. */
+	ArrayList<String> solotags;
+
+	/**
+	 * Instantiates a new one tag per line.
+	 *
+	 * @param url the url
+	 * @param solotags the solotags
+	 */
+	public OneTagPerLine(URL url, ArrayList<String> solotags){
+		try {
+			this.url = url;
+			this.solotags = solotags;
+			inputData = url.openStream();
+			factory = XMLInputFactory.newInstance();
+			factory.setProperty(XMLInputFactory.IS_VALIDATING,false)
+			parser = factory.createXMLStreamReader(inputData);
+
+		} catch (XMLStreamException ex) {
+			System.out.println(ex);
+		}catch (IOException ex) {
+			System.out.println("IOException while parsing ");
+		}
+	}
+
+	/**
+	 * Creates the output.
+	 *
+	 * @param outfile the outfile
+	 * @return true, if successful
+	 */
+	private boolean createOutput(File outfile) {
+		try {
+			File f = outfile;
+			output = new OutputStreamWriter(new FileOutputStream(f), "UTF-8");
+
+			return true;
+		} catch (Exception e) {
+			System.out.println(e.getLocalizedMessage());
+			return false;
+		}
+	}
+
+	/**
+	 * Read next.
+	 *
+	 * @param n the n
+	 * @return the java.lang. object
+	 */
+	public def readNext(int n)
+	{
+		try
+		{
+			return parser.next()
+		}catch(Exception e){
+			if(n > 10)
+				return parser.next();
+			else
+				readNext(n+1)
+		}
+	}
+	boolean wordtag = false;
+	/**
+	 * Process.
+	 *
+	 * @param outfile the outfile
+	 * @return true, if successful
+	 */
+	public boolean process(File outfile) {
+
+		StringBuffer chars = new StringBuffer();
+		if (createOutput(outfile)) {
+
+			String lastopenlocalname= "";
+			String localname = "";
+			boolean word_part = false;
+			output.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n")
+			try {
+				for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = readNext(0)) {
+
+					String prefix = parser.getPrefix();
+					if (prefix == null || prefix == "")
+						prefix = "";
+					else
+						prefix +=":";
+
+					switch (event) {
+						case XMLStreamConstants.START_ELEMENT:
+							if (chars.length() > 0) {
+								output.write(chars.substring(0, chars.length()-1));
+								chars = new StringBuffer();
+							}
+							localname = parser.getLocalName();
+							lastopenlocalname = localname;
+							word_part = false;
+							for (int i= 0 ; i < parser.getAttributeCount() ;i++ )
+								if (parser.getAttributeValue(i).contains("word_part"))
+									word_part = true;
+
+						/*if(word_part == true)
+						 output.write("<"+prefix+localname);
+						 else*/
+						//						if(word_part)
+						//							output.write("<"+prefix+localname);
+						//						else
+							if (wordtag)
+								output.write("<"+prefix+localname);
+							else
+								output.write("\n<"+prefix+localname);
+							for (int i= 0 ; i < parser.getAttributeCount() ;i++ ) {
+								String ns = parser.getAttributePrefix(i);
+								if (ns == null || ns == "")
+									output.write(" "+parser.getAttributeLocalName(i)+"=\""+parser.getAttributeValue(i).replace("&","&amp; ").replace("<","&lt;")+"\"" );
+								else
+									output.write(" "+ns+":"+parser.getAttributeLocalName(i)+"=\""+parser.getAttributeValue(i).replace("&","&amp; ").replace("<","&lt;")+"\"" );
+
+							}
+
+							if (solotags.contains(localname))
+								output.write("/>");
+							else
+								output.write(">");
+
+						//						if(!word_part)
+							if (localname == "w") {
+								wordtag=true;
+							} else if(!wordtag) {
+								output.write("\n");
+							}
+							break;
+
+						case XMLStreamConstants.END_ELEMENT:
+							if (chars.length() > 0) {
+								output.write(chars.substring(0, chars.length()-1));
+								chars = new StringBuffer();
+							}
+
+							localname = parser.getLocalName();
+							switch (localname) {
+								default:
+									if(!solotags.contains(localname))
+									/*if(word_part) // see filter ReunitBrokenWords
+							 output.write("</"+prefix+localname+">");
+							 else*/
+									if (localname == "w") {
+										wordtag = false
+										output.write("</"+prefix+localname+">\n");
+									} else if (wordtag) {
+										output.write("</"+prefix+localname+">");
+									} else {
+										output.write("\n</"+prefix+localname+">\n");
+									}
+							}
+							break;
+
+						case XMLStreamConstants.CHARACTERS:
+							if (parser.getText().length() > 0) {
+								int start=0;
+								while (parser.getText().charAt(start) == "\n" || parser.getText().charAt(start) == " ")
+									if (start < parser.getText().length()-1) {
+										start++;
+									} else {
+										start++;
+										break;
+									}
+								//replace & by &amp; ; < by &lt; ; insecable space by space
+								chars.append(parser.getText().substring(start).replace("\t", " ").replace("&","&amp;").replace("<","&lt;").replace(" "," ").trim()+ " ");
+								//String text = URLEncoder.encode(parser.getText().substring(start))
+								//output.write(text);
+							}
+							break;
+					}
+				}
+				output.close();
+				parser.close();
+
+				Reader input = new InputStreamReader(new FileInputStream(outfile) , "UTF-8");
+				File temp = new File(outfile.getParent(),"temp");
+				output = new OutputStreamWriter(new FileOutputStream(temp) , "UTF-8");
+				String line = input.readLine();
+				while (line != null) {
+					if (line.length() > 0)
+						output.write(line+"\n");
+					line = input.readLine();
+				}
+				input.close();
+				output.close();
+
+				if (!(outfile.delete() && temp.renameTo(outfile))) println "Warning can't rename file "+temp+" to "+outfile
+			} catch (XMLStreamException ex) {
+				input.close();
+				output.close();
+				System.out.println(ex);
+				return false;
+			} catch (IOException ex) {
+				input.close();
+				output.close();
+				System.out.println("IOException while parsing " + inputData);
+				return false;
+			}
+		}
+		return true;
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args) {
+
+		String rootDir = "~/xml/Hyperprince/";
+		new File(rootDir + "/identity/").mkdir();
+
+		ArrayList<String> milestones = new ArrayList<String>();// the tags who
+		// you want them
+		// to stay
+		// milestones
+		milestones.add("tagUsage");
+		milestones.add("pb");
+		milestones.add("lb");
+
+		File srcfile = new File(rootDir, "Corpus-Hyperprince_2009-06-10.xml");
+		File resultfile = new File(rootDir,
+				"Corpus-Hyperprince_2009-06-10-T.xml");
+		println("prepare tokenizer file : " + srcfile + " to : " + resultfile);
+
+		def builder = new OneTagPerLine(srcfile.toURL(), milestones);
+		builder.process(resultfile);
+
+		return;
+	}
+
+}
Index: tmp/org.txm.core/src/groovy/filters/Tokeniser/TEITokenizer.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/filters/Tokeniser/TEITokenizer.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/filters/Tokeniser/TEITokenizer.groovy	(revision 258)
@@ -0,0 +1,264 @@
+package filters.Tokeniser;
+
+import java.net.URL;
+import java.util.regex.Pattern;
+
+import org.txm.importer.StaxIdentityParser;
+import org.txm.tokenizer.*;
+
+public class TEITokenizer extends StaxIdentityParser {
+
+	int DEBUG = 0;
+
+	enum STATES { WORD, TEXT, IGNORE, NOTE };
+	STATES state = STATES.IGNORE;
+	String STARTTAG = ".*"
+	String NOTETAG = ""
+	//String WORDTAG = TokenizerClasses.word_tags;
+
+	static String PONTEST = "[.;:,!?]";
+	static String TYPE = "type";
+	static String ID = "id"
+	static String PON = "pon"
+	static String NUM = "num"
+	static String ENDOFLINE = System.getProperty("line.separator");
+	def tests = TokenizerClasses.tests;
+
+	int firstElement = 1;
+	String filename = "";
+	int wordcount = 0;
+	String previousElem;
+
+	def word_tags = TokenizerClasses.word_tags;
+	def intraword_tags = TokenizerClasses.intraword_tags;
+	def punct_strong = TokenizerClasses.punct_strong;
+	def punct_all = TokenizerClasses.punct_all;
+	def word_chars = TokenizerClasses.word_chars;
+	def punct_quotes = TokenizerClasses.punct_quotes;
+
+	StringBuffer buffer = new StringBuffer();
+
+	public TEITokenizer(URL inputurl) {
+		super(inputurl);
+
+		this.filename = new File(inputurl.getFile()).getName();
+		int index = filename.indexOf(".");
+		if (index > 0)
+			filename = filename.substring(0, index);
+	}
+
+	protected void processBuffer() {
+		if (buffer.size() > 0) {
+			tokenize(buffer.toString());
+			buffer = new StringBuffer();
+		}
+	}
+
+	protected void processStartElement() {
+		//println "OPEN "+localname+" = "+buffer.toString()
+		if ((firstElement++) == 1) {
+			if (localname == "TEI") {
+				STARTTAG = "text"
+				NOTETAG = "note"
+			} else 
+				STARTTAG = localname
+		}
+		processBuffer();
+		switch (state) {
+			case STATES.IGNORE:
+				super.processStartElement();
+				if (localname.matches(STARTTAG)) {
+					//println "ENTER $STARTTAG"
+					state = STATES.TEXT;
+				}
+				break;
+			case STATES.TEXT:
+				if (localname.matches(NOTETAG)) {
+					super.processStartElement();
+					//println "ENTER $NOTETAG"
+					state = STATES.NOTE;
+				} else if (localname.matches(word_tags)) {
+					//println "ENTER $WORDTAG"
+					state = STATES.WORD;
+					processStartWordElement();
+				} else {
+					super.processStartElement();
+					writer.writeCharacters(ENDOFLINE);
+				}
+				break;
+			default: // note, comment
+				super.processStartElement();
+		}
+		previousElem = localname;
+	}
+
+	protected void processEndElement() {
+		//println "CLOSE "+localname+" = "+buffer.toString()
+		processBuffer();
+		switch (state) {
+			case STATES.NOTE:
+				super.processEndElement();
+				if (localname.matches(NOTETAG)) {
+					writer.writeCharacters(ENDOFLINE);
+					//println "EXIT $NOTETAG"
+					state = STATES.TEXT;
+				}
+				break;
+			case STATES.WORD:
+				super.processEndElement();
+				writer.writeCharacters(ENDOFLINE);
+				if (localname.matches(word_tags)) {
+					//println "EXIT $WORDTAG"
+					state = STATES.TEXT;
+				}
+				break;
+			case STATES.TEXT:
+				super.processEndElement();
+				writer.writeCharacters(ENDOFLINE);
+				if (localname.matches(STARTTAG)) {
+					//println "EXIT $STARTTAG"
+					state = STATES.IGNORE;
+				}
+				break;
+			default: // note, comment
+				super.processEndElement();
+		}
+		previousElem = localname;
+	}
+
+	protected void processStartWordElement() {
+		super.processStartElement();
+		wordcount++;
+	}
+
+	protected void tokenize(String text) {
+		if (DEBUG > 0) {println "buffer="+text}
+		text = text.replaceAll("\n", " ");
+		text = text.replaceAll("\\p{C}", "");						// remove ctrl characters
+		for (String s : text.split("[\\p{Z}\\p{C}]+") ) {
+			s = s.trim();
+			iterate(s);
+		}
+	}
+
+	/**
+	 * Iterate.
+	 *
+	 * @param s the s
+	 * @return the java.lang. object
+	 */
+	protected iterate(String s)
+	{
+		while (s != null && s.length() > 0) {
+			if (DEBUG > 0){println "  > $s"}
+			s = standardChecks(s);
+		}
+	}
+
+	/**
+	 * Standard checks.
+	 *
+	 * @param s the s
+	 * @return the java.lang. object
+	 */
+	protected standardChecks(String s)
+	{
+		if (DEBUG > 0){println "checks : "+s}
+		def m;
+
+		for (TTest test : tests) {
+			if ((m = s =~ test.regex)) {
+				if (DEBUG > 0){println "test : "+test.regex}
+				if (test.before > 0)
+					iterate(m[0][test.before])
+
+				if (test.hit > 0) {
+					DEBUG--
+					wordcount++;
+					writer.writeStartElement("w");
+					writeWordAttributes();// id
+					writer.writeAttribute("type",test.type);
+					writer.writeCharacters(m[0][test.hit]);
+					writer.writeEndElement();
+					writer.writeCharacters("\n");
+				}
+				if( test.after > 0)
+					return m[0][test.after];
+			}
+		}
+
+		if (DEBUG > 0) {println "Other : "+s}
+		//		def o = s.split("[\\p{Z}\\p{C}]+")
+		//		for (String sub : o) {
+		//			if (sub.length() == 0) continue
+		wordcount++;
+		writer.writeStartElement("w");
+		writeWordAttributes();// id
+		if (s.matches(/\p{P}/))
+			writer.writeAttribute("type","pon");
+		else
+			writer.writeAttribute("type","w");
+		writer.writeCharacters(s);
+		writer.writeEndElement();
+		writer.writeCharacters("\n");
+		//		}
+		return "";
+
+
+	}
+
+	/**
+	 * Write word attributes.
+	 *
+	 * @return the java.lang. object
+	 */
+	protected writeWordAttributes()
+	{
+		writer.writeAttribute("id", "w_"+filename+"_"+wordcount);
+		writer.writeAttribute("n",""+wordcount);
+	}
+
+	protected void processCharacters()
+	{
+		//println "TEXT: "+parser.getText()
+		switch (state) {
+			case STATES.TEXT:
+				buffer.append(parser.getText())
+			//tokenize();
+				break
+			default:
+				super.processCharacters();
+		}
+	}
+
+	public static void main(String[] args) {
+		long start = System.currentTimeMillis();
+		File dir = new File("/home/mdecorde/xml/txmrefman")
+		File infile = new File(dir, "TEI/refman.xml");
+		File outfile = new File(dir, "tokenization/refman-t3.xml");
+
+		TEITokenizer tokenizer = new TEITokenizer(infile.toURI().toURL());
+
+		if (tokenizer.process(outfile))
+			println "Done - OK"
+		else
+			println "Done - FAIL"
+
+		println "time: "+(System.currentTimeMillis()-start)/1000
+
+		for (File f : new File("/home/mdecorde/xml/txmrefman/tokenization").listFiles()) {
+			String text = f.getText("UTF-8")
+			f.withWriter("UTF-8") { writer ->
+				text = text.replaceAll(/ id="w_refman_.+" n="[^"]+"/, "")
+				text = text.replaceAll("xml:id=", "id=")
+				text = text.replaceAll("<w>", "<w type=\"w\">")
+//				text = text.replaceAll("</?(p|body|item|text|table|list|ref|anchor|cell|row|head|div|term|hi|index|figure|graphic|lb|note).+", "")
+//				text = text.replaceAll("\n[^<>\n]+\n", "\n")
+//				text = text.replaceAll("\n[^<>\n]+\n", "\n")
+//				text = text.replaceAll("\n[^<>\n]+\n", "\n")
+//				text = text.replaceAll("\n++", "\n")
+				writer.write(text)
+			}
+		}
+	}
+}
Index: tmp/org.txm.core/src/groovy/filters/CutHeader/package.html
===================================================================
--- tmp/org.txm.core/src/groovy/filters/CutHeader/package.html	(revision 0)
+++ tmp/org.txm.core/src/groovy/filters/CutHeader/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Deprecated package: Filter to cut TEIHeader of XML-TEI files</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/filters/CutHeader/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/filters/CutHeader/CutHeader.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/filters/CutHeader/CutHeader.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/filters/CutHeader/CutHeader.groovy	(revision 258)
@@ -0,0 +1,107 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+package filters.CutHeader;
+
+import java.util.regex.Matcher
+import java.util.regex.Pattern
+
+import org.txm.importer.filters.Filter;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class CutHeader.
+ */
+class CutHeader extends Filter
+{
+	
+	/** The xml header file. */
+	String xmlHeaderFile = ""; 
+	
+	/** The header. */
+	boolean header = true;
+	
+	/** The HEADER. */
+	OutputStreamWriter HEADER;
+	
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#SetUsedParam(java.lang.Object)
+	 */
+	void SetUsedParam(Object args) {
+		if (args.size() == 1) {
+			xmlHeaderFile = args[0].toString();
+		} else {
+			System.err.println("CutHeader needs 1 args\nString:xmlHEADERFilePath");
+			System.exit(-1);
+		}
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#after()
+	 */
+	void after()
+	{
+		HEADER.close();
+		//println("AFTER CUTHEADER");
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#filter()
+	 */
+	protected void filter()
+	{
+		if(header) {
+			//if(line ==~ /\s*<text>\s*/ )
+			if (line.startsWith("<text ") || line.startsWith("<text>")) {
+				header = false;
+				HEADER.close();
+				output.print(line+lineSeparator);
+			} else {
+				//print(line+lineSeparator);
+				HEADER.print(line+lineSeparator);
+			}
+		} else {
+			output.write(line+lineSeparator);	
+		}
+		//System.out.println( "!"+linecounter);
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#before()
+	 */
+	boolean before() {
+		if (xmlHeaderFile == "") {
+			println("need to define xmlHeaderFile before lauching this filter");
+			return false;
+		}
+		File outputFile = new File(xmlHeaderFile)
+		//HEADER = new PrintWriter(new BufferedWriter(new FileWriter(outputFile)));
+		HEADER = new OutputStreamWriter(new FileOutputStream(outputFile) , this.encodageSortie);
+		//println("BEFORE CUTHEADER");
+		return true;
+	}
+}
Index: tmp/org.txm.core/src/groovy/filters/EliminateWhiteSpaces/package.html
===================================================================
--- tmp/org.txm.core/src/groovy/filters/EliminateWhiteSpaces/package.html	(revision 0)
+++ tmp/org.txm.core/src/groovy/filters/EliminateWhiteSpaces/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Deprecated package: Filter to eliminate whitespace in the BFM tokenizer</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/filters/EliminateWhiteSpaces/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/filters/EliminateWhiteSpaces/EliminateWhiteSpaces.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/filters/EliminateWhiteSpaces/EliminateWhiteSpaces.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/filters/EliminateWhiteSpaces/EliminateWhiteSpaces.groovy	(revision 258)
@@ -0,0 +1,86 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+package filters.EliminateWhiteSpaces;
+
+import org.txm.importer.filters.*;
+import java.util.regex.*;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class EliminatingWhiteSpaces.
+ */
+class EliminatingWhiteSpaces extends Filter {
+	
+	/** The counter. */
+	int counter;
+	
+	/** The old. */
+	def old;
+
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#SetUsedParam(java.lang.Object)
+	 */
+	void SetUsedParam(Object args) {
+
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#before()
+	 */
+	boolean before() {
+		counter = 0;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#after()
+	 */
+	void after()
+	{
+		println "Deleted $counter whitespaces \n";
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#filter()
+	 */
+	void filter()
+	{
+		def m;
+		def segment;
+		// Write your code here, but don't forget to write in the output
+		// ex : output.write("TheStringToWrite " + line );
+		// in the var line is the current line
+		old = line;
+		line = (line =~ /\s+<\/w>/).replaceAll("<\\/w>");
+
+		if( old != line)
+			counter++;
+		
+		output.write(line+lineSeparator);
+		// End
+	}
+}
Index: tmp/org.txm.core/src/groovy/filters/FusionXmlHeaderBody/package.html
===================================================================
--- tmp/org.txm.core/src/groovy/filters/FusionXmlHeaderBody/package.html	(revision 0)
+++ tmp/org.txm.core/src/groovy/filters/FusionXmlHeaderBody/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Deprecated package: Filter to restore the XML-TEI header of XML-TEI files</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/filters/FusionXmlHeaderBody/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/filters/FusionXmlHeaderBody/FusionXmlHeaderBody.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/filters/FusionXmlHeaderBody/FusionXmlHeaderBody.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/filters/FusionXmlHeaderBody/FusionXmlHeaderBody.groovy	(revision 258)
@@ -0,0 +1,133 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+package filters.FusionXmlHeaderBody;
+
+import org.txm.importer.filters.*;
+import org.xml.sax.InputSource
+import org.xml.sax.helpers.ParserAdapter
+import org.xml.sax.helpers.*;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.parsers.SAXParser;
+import java.io.Reader;
+import groovy.xml.XmlUtil
+
+import javax.xml.transform.*;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.xml.sax.helpers.DefaultHandler
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class FusionXmlHeaderBody.
+ */
+class FusionXmlHeaderBody extends Filter
+{
+	
+	/** The body file. */
+	String bodyFile = "";
+	
+	/** The header file. */
+	String headerFile = "";
+	
+	/** The Lastinput. */
+	Reader Lastinput;
+	
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#SetUsedParam(java.lang.Object)
+	 */
+	void SetUsedParam(Object args)
+	{
+		
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#before()
+	 */
+	boolean before()
+	{
+		if(bodyFile == "" || headerFile == "")
+		{
+			System.out.println("FusionXmlHeaderBody need 2 args : \nString:XmlBodyFile\nString:XmlHeaderFile");
+		}
+		System.out.println("start fusionxmlheaderbody "+this);
+		Lastinput = this.input;
+		this.input = new BufferedReader(new java.io.StringReader("") );
+	}
+	
+	/**
+	 * Sets the used param.
+	 *
+	 * @param args the args
+	 */
+	void SetUsedParam(Object[] args)
+	{
+		if(args.size() == 2)
+		{
+			bodyFile = args[0];//needed to get back its ID
+			headerFile = args[1];
+		}
+		else
+		{
+			System.out.println("FusionXmlHeaderBody need 2 args : \nString:XmlBodyFile\nString:XmlHeaderFile");
+		}
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#after()
+	 */
+	void after()
+	{
+		this.input = this.Lastinput;
+		//System.out.println("input ready "+this.input.ready());
+		def body = new XmlSlurper().parse(this.input);
+		
+		def headers = new XmlSlurper().parse(headerFile)
+		
+		def id = bodyFile.split('\\.')[0]
+		def header = headers.discours.find{it.@file == id}
+		
+		this.output.withWriter{writer ->
+			def xmlBuilder = new groovy.xml.StreamingMarkupBuilder();
+			def xml = xmlBuilder.bind{
+				mkp.xmlDeclaration();
+				top (header <<body.children());	
+			};
+		
+			writer <<XmlUtil.serialize(xml);
+		}		
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#filter()
+	 */
+	void filter()
+	{
+	}
+	
+}
Index: tmp/org.txm.core/src/groovy/filters/FusionXmlHeaderBody/ReaderInputStream.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/filters/FusionXmlHeaderBody/ReaderInputStream.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/filters/FusionXmlHeaderBody/ReaderInputStream.groovy	(revision 258)
@@ -0,0 +1,231 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+package filters.FusionXmlHeaderBody;
+
+/*
+ * Copyright 2004-2005 The Apache Software Foundation.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Adapts a <code>Reader</code> as an <code>InputStream</code>. Adapted from
+ * <CODE>StringInputStream</CODE>.
+ */
+public class ReaderInputStream extends InputStream {
+	Reader input;
+
+	/** The encoding. */
+	String encoding = System.getProperty("file.encoding");
+
+	/** The slack. */
+	byte[] slack;
+
+	/** The begin. */
+	int begin;
+
+	/**
+	 * Construct a <CODE>ReaderInputStream</CODE> for the specified
+	 * <CODE>Reader</CODE>.
+	 * 
+	 * @param reader
+	 *            <CODE>Reader</CODE>. Must not be <code>null</code>.
+	 */
+	public ReaderInputStream(Reader reader) {
+		input = reader;
+	}
+
+	/**
+	 * Construct a <CODE>ReaderInputStream</CODE> for the specified
+	 * <CODE>Reader</CODE>, with the specified encoding.
+	 * 
+	 * @param reader
+	 *            non-null <CODE>Reader</CODE>.
+	 * @param encoding
+	 *            non-null <CODE>String</CODE> encoding.
+	 */
+	public ReaderInputStream(Reader reader, String encoding) {
+		this(reader);
+		if (encoding == null) {
+			throw new IllegalArgumentException("encoding must not be null");
+		} else {
+			this.encoding = encoding;
+		}
+	}
+
+	/**
+	 * Reads from the <CODE>Reader</CODE>, returning the same value.
+	 *
+	 * @return the value of the next character in the <CODE>Reader</CODE>.
+	 */
+	public synchronized int read() throws IOException {
+		if (input == null) {
+			throw new IOException("Stream Closed");
+		}
+
+		byte result;
+		if (slack != null && begin < slack.length) {
+			result = slack[begin];
+			if (++begin == slack.length) {
+				slack = null;
+			}
+		} else {
+			byte[] buf = new byte[1];
+			if (read(buf, 0, 1) <= 0) {
+				result = -1;
+			}
+			result = buf[0];
+		}
+
+		if (result < -1) {
+			result += 256;
+		}
+
+		return result;
+	}
+
+	/**
+	 * Reads from the <code>Reader</code> into a byte array.
+	 *
+	 * @param b the byte array to read into
+	 * @param off the offset in the byte array
+	 * @param len the length in the byte array to fill
+	 * @return the actual number read into the byte array, -1 at the end of the
+	 * stream
+	 */
+	public synchronized int read(byte[] b, int off, int len) throws IOException {
+		if (input == null) {
+			throw new IOException("Stream Closed");
+		}
+
+		while (slack == null) {
+			char[] buf = new char[len]; // might read too much
+			int n = input.read(buf);
+			if (n == -1) {
+				return -1;
+			}
+			if (n > 0) {
+				slack = new String(buf, 0, n).getBytes(encoding);
+				begin = 0;
+			}
+		}
+
+		if (len > slack.length - begin) {
+			len = slack.length - begin;
+		}
+
+		System.arraycopy(slack, begin, b, off, len);
+
+		if ((begin += len) >= slack.length) {
+			slack = null;
+		}
+
+		return len;
+	}
+
+	/**
+	 * Marks the read limit of the StringReader.
+	 * 
+	 * @param limit
+	 *            the maximum limit of bytes that can be read before the mark
+	 *            position becomes invalid
+	 */
+	public synchronized void mark(final int limit) {
+		try {
+			input.mark(limit);
+		} catch (IOException ioe) {
+			throw new RuntimeException(ioe.getMessage());
+		}
+	}
+
+	/**
+	 * Available.
+	 *
+	 * @return the current number of bytes ready for reading
+	 */
+	public synchronized int available() throws IOException {
+		if (input == null) {
+			throw new IOException("Stream Closed");
+		}
+		if (slack != null) {
+			return slack.length - begin;
+		}
+		if (input.ready()) {
+			return 1;
+		} else {
+			return 0;
+		}
+	}
+
+	/**
+	 * Mark supported.
+	 *
+	 * @return false - mark is not supported
+	 */
+	public boolean markSupported() {
+		return false; // would be imprecise
+	}
+
+	/**
+	 * Resets the StringReader.
+	 *
+	 */
+	public synchronized void reset() throws IOException {
+		if (input == null) {
+			throw new IOException("Stream Closed");
+		}
+		slack = null;
+		input.reset();
+	}
+
+	/**
+	 * Closes the Stringreader.
+	 *
+	 */
+	public synchronized void close() throws IOException {
+		if (input != null) {
+			input.close();
+			slack = null;
+			input = null;
+		}
+	}
+}
Index: tmp/org.txm.core/src/groovy/filters/FusionHeader/FusionHeader.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/filters/FusionHeader/FusionHeader.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/filters/FusionHeader/FusionHeader.groovy	(revision 258)
@@ -0,0 +1,125 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+package filters.FusionHeader;
+
+import java.io.File;
+
+import java.io.BufferedReader;
+import java.io.FileInputStream;
+import java.io.InputStreamReader;
+import org.txm.importer.filters.*;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class FusionHeader.
+ */
+class FusionHeader extends Filter {
+	
+	/** The xml header file. */
+	String xmlHeaderFile = "";
+	
+	/** The first loop. */
+	boolean firstLoop = true;
+	
+	/** The HEADER. */
+	BufferedReader HEADER;
+	
+	/** The cut headerfilter. */
+	Thread cutHeaderfilter;
+
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#SetUsedParam(java.lang.Object)
+	 */
+	void SetUsedParam(Object args) {
+		if (args.size() == 2) {
+			xmlHeaderFile = args[0].toString();
+			cutHeaderfilter = (Thread) args[1];
+		} else {
+			System.err
+					.println("CutHeader needs 2 args\nString:xmlHEADERFilePath\nThread:cutHeaderFilter");
+			System.exit(-1);
+		}
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#after()
+	 */
+	void after() {
+		try {
+			HEADER.close();
+			HEADER= null;
+		} catch (Exception e) {
+			System.err
+					.println("Can't close Header file, one cause might be that the header file is not correctly built");
+		}
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#before()
+	 */
+	boolean before() {
+		if (xmlHeaderFile == "" || cutHeaderfilter == null) {
+			System.err
+					.println("CutHeader needs 2 args\nString:xmlHEADERFilePath\nThread:cutHeaderFilter");
+		}
+		// System.out.println("start FUSIONHEADER");
+
+		return true;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#filter()
+	 */
+	protected void filter()
+	{
+		if (firstLoop) {
+			//println("BEGIN COPYING HEADER");
+		
+			String templine;
+			File inputFile = new File(xmlHeaderFile)
+			if ( !inputFile.exists()) {
+				System.err.println("ERROR : DOES NOT EXISTS "+xmlHeaderFile);
+			}
+			HEADER = new BufferedReader(new InputStreamReader(new FileInputStream(inputFile), encodage));
+			while (!HEADER.ready()) {
+				Thread.sleep(10);
+				//system.out.println("waiting for cutHeader to finish");
+			}
+			//HEADER = new FileReader("/home/ayepdieu/xml/header (copie).xml");
+			//System.out.println("ready ? "+HEADER.ready());
+			while ((templine = this.HEADER.readLine()) != null) {
+				//println(templine+lineSeparator);
+				output.print(templine+lineSeparator);
+			}
+			//println("FINISH COPYING HEADER");
+			firstLoop=false;
+			HEADER.close();
+		}
+		output.print(line+lineSeparator);
+	}
+}
Index: tmp/org.txm.core/src/groovy/filters/FusionHeader/package.html
===================================================================
--- tmp/org.txm.core/src/groovy/filters/FusionHeader/package.html	(revision 0)
+++ tmp/org.txm.core/src/groovy/filters/FusionHeader/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Deprecated package: Filter to restore the XML-TEI header of XML-TEI files</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/filters/FusionHeader/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/filters/ProcessEnclitics/package.html
===================================================================
--- tmp/org.txm.core/src/groovy/filters/ProcessEnclitics/package.html	(revision 0)
+++ tmp/org.txm.core/src/groovy/filters/ProcessEnclitics/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Deprecated package: Filter to process enclitics in the BFM tokenizer</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/filters/ProcessEnclitics/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/filters/ProcessEnclitics/ProcessEnclitics.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/filters/ProcessEnclitics/ProcessEnclitics.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/filters/ProcessEnclitics/ProcessEnclitics.groovy	(revision 258)
@@ -0,0 +1,103 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+package filters.ProcessEnclitics;
+
+import org.txm.importer.filters.*;
+import java.util.regex.*;
+import org.txm.tokenizer.TokenizerClasses;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class ProcessEnclitics.
+ */
+class ProcessEnclitics extends Filter {
+	
+	/** The counter. */
+	int counter;
+	
+	/** The enclitics. */
+	String enclitics = TokenizerClasses.enclitics;
+
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#SetUsedParam(java.lang.Object)
+	 */
+	void SetUsedParam(Object args)
+	{
+		try
+		{
+			enclitics = args.get("enclitics");
+
+		}
+		catch(Exception e)
+		{
+			System.err.println(e);
+			System.err.println("Processenclitics needs 1 Map with arg  :\n enclitics")
+		}
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#before()
+	 */
+	boolean before() {
+		counter = 0;
+		System.out.println("begin enclitics");
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#after()
+	 */
+	void after()
+	{
+		print "$counter enclitics with dashes found\n";
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#filter()
+	 */
+	void filter()
+	{
+		def m;
+		def segment;
+		// Write your code here, but don't forget to write in the output
+		// ex : output.write("TheStringToWrite " + line );
+		// in the var line is the current line
+		if( (m = line =~ /\A\s*(<w[^>]*>)(.*)-($enclitics)<\/w>\Z/))
+		{
+			counter++;
+			def word1_tag = (m[0][1]);
+			def word1 = (m[0][2]);
+			def word2 = (m[0][3]);
+			output.write("$word1_tag$word1-</w>\n<w>$word2</w>"+lineSeparator);
+		}
+		else 
+		{
+			output.write(line+lineSeparator);
+		}
+		// End
+	}
+}
Index: tmp/org.txm.core/src/groovy/filters/OneOpenTagPerLine/OneOpenTagPerLine.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/filters/OneOpenTagPerLine/OneOpenTagPerLine.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/filters/OneOpenTagPerLine/OneOpenTagPerLine.groovy	(revision 258)
@@ -0,0 +1,94 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+package filters.OneOpenTagPerLine;
+
+//Pre-processing extra-word tags (1)
+import org.txm.importer.filters.Filter;
+import org.txm.tokenizer.TokenizerClasses;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class OneOpenTagPerLine.
+ */
+class OneOpenTagPerLine extends Filter {
+	
+	/** The tag_all. */
+	String tag_all = TokenizerClasses.tag_all;
+	
+	/** The counterreg1. */
+	int counterreg1 = 0;
+	
+	/** The counterreg2. */
+	int counterreg2 = 0;
+
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#SetUsedParam(java.lang.Object)
+	 */
+	void SetUsedParam(Object args) {
+
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#before()
+	 */
+	boolean before() {
+
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#after()
+	 */
+	void after()
+	{
+		println "reg1 : $counterreg1";
+		println "reg2 : $counterreg2";
+	}
+
+	/** The segment. */
+	def segment;
+
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#filter()
+	 */
+	void filter()
+	{
+		segment = line.trim()
+		if(segment[0] == "<")
+			output.write(lineSeparator+line);
+		else
+		output.write(" "+segment)
+		/*if ( line ==~ /([^<])+>$/)
+		{
+			output.write(" "+line.trim())
+		}
+		else
+		{
+			output.write(lineSeparator+line);
+		}*/
+	}
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/filters/OneOpenTagPerLine/package.html
===================================================================
--- tmp/org.txm.core/src/groovy/filters/OneOpenTagPerLine/package.html	(revision 0)
+++ tmp/org.txm.core/src/groovy/filters/OneOpenTagPerLine/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Deprecated package: Filter to prepare the BFM tokenizer files</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/filters/OneOpenTagPerLine/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/filters/ProcessQuotes/package.html
===================================================================
--- tmp/org.txm.core/src/groovy/filters/ProcessQuotes/package.html	(revision 0)
+++ tmp/org.txm.core/src/groovy/filters/ProcessQuotes/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Deprecated package: Filter to process quotes in the BFM tokenizer</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/filters/ProcessQuotes/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/filters/ProcessQuotes/ProcessQuotes.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/filters/ProcessQuotes/ProcessQuotes.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/filters/ProcessQuotes/ProcessQuotes.groovy	(revision 258)
@@ -0,0 +1,84 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+package filters.ProcessQuotes;
+
+//Pre-processing extra-word tags (1)
+import org.txm.importer.filters.*;
+import java.util.regex.*;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class ProcessQuotes.
+ */
+class ProcessQuotes extends Filter {
+	
+	/** The counter. */
+	int counter;
+	
+	/** The old. */
+	def old;
+
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#SetUsedParam(java.lang.Object)
+	 */
+	void SetUsedParam(Object args) {
+
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#before()
+	 */
+	boolean before() {
+		counter = 0;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#after()
+	 */
+	void after()
+	{
+		println "Replaced $counter quotes\n";
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#filter()
+	 */
+	void filter()
+	{
+		def m;
+		def segment;
+
+		old = line;
+		line = (line =~ /&(quot|ldquo|rdquo);/).replaceAll("\"");
+		
+		if( old != line)
+			counter++;
+		
+		output.write(line+lineSeparator);
+	}
+}
Index: tmp/org.txm.core/src/groovy/filters/Concatenator/package.html
===================================================================
--- tmp/org.txm.core/src/groovy/filters/Concatenator/package.html	(revision 0)
+++ tmp/org.txm.core/src/groovy/filters/Concatenator/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Deprecated package: Filter to concat 2 files</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/filters/Concatenator/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/filters/Concatenator/Concatenator.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/filters/Concatenator/Concatenator.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/filters/Concatenator/Concatenator.groovy	(revision 258)
@@ -0,0 +1,103 @@
+// 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
+// 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.
+
+//
+// This file is part of the TXM platform.
+//
+// The TXM platform is free software: you can redistribute it and/or modif y
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 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/>.
+// 
+// 
+// 
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+package filters.Concatenator;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.OutputStreamWriter;
+import java.io.PrintStream;
+
+import org.txm.importer.filters.*;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class Concatenator.
+ */
+class Concatenator extends Filter {
+	
+	/** The destination. */
+	String destination;
+
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#before()
+	 */
+	boolean before() {
+		if (destination == "") {
+			println("You need to define destination file before launching this filter");
+			return false;
+		}
+		def f = new File(destination);
+		this.output = new OutputStreamWriter(new FileOutputStream(f), "UTF-8");
+		return true;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#SetUsedParam(java.lang.Object)
+	 */
+	void SetUsedParam(Object args) {
+		if (args.size() == 1) {
+			destination = args[0];
+		} else {
+			System.out
+					.println("Concatenator need 1 args : \nString:destinatione");
+		}
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#after()
+	 */
+	void after() {
+		System.out.println("Concatenator readed lines : " + linecounter);
+		this.output.close();
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#filter()
+	 */
+	void filter() {
+		output.write(line + lineSeparator);
+		output.flush();
+	}
+}
Index: tmp/org.txm.core/src/groovy/filters/RegexFilter/RegexFilter.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/filters/RegexFilter/RegexFilter.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/filters/RegexFilter/RegexFilter.groovy	(revision 258)
@@ -0,0 +1,79 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+package filters.RegexFilter;
+
+import org.txm.importer.filters.*;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.txm.importer.filters.Filter;
+
+// TODO: Auto-generated Javadoc
+/** Filters out lines not matching a regexp. @author jmague */
+public class RegexFilter extends Filter {
+	private Pattern pattern;
+
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#SetUsedParam(java.lang.Object)
+	 */
+	void SetUsedParam(Object args) {
+		if (args.size() == 1) {
+			pattern = Pattern.compile(args[0]);
+		} else {
+			System.out
+					.println("Regexfilter needs 1 args :\nString:patternRegex");
+		}
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#after()
+	 */
+	void after() {
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#before()
+	 */
+	boolean before() {
+		if (pattern == null) {
+			System.out
+					.println("Regex filter needs 1 args :\nString:patternRegex");
+			return false;
+		}
+		return true;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#filter()
+	 */
+	void filter() {
+		Matcher matcher = pattern.matcher(line);
+		if (matcher.matches())
+			output.write(line + lineSeparator);
+	}
+}
Index: tmp/org.txm.core/src/groovy/filters/RegexFilter/package.html
===================================================================
--- tmp/org.txm.core/src/groovy/filters/RegexFilter/package.html	(revision 0)
+++ tmp/org.txm.core/src/groovy/filters/RegexFilter/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Deprecated package: Filter to select lines with a regular expression</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/filters/RegexFilter/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/filters/WordInternalElement/package.html
===================================================================
--- tmp/org.txm.core/src/groovy/filters/WordInternalElement/package.html	(revision 0)
+++ tmp/org.txm.core/src/groovy/filters/WordInternalElement/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Deprecated package: Filter of the BFM tokenizer</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/filters/WordInternalElement/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/filters/WordInternalElement/WordInternalElement.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/filters/WordInternalElement/WordInternalElement.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/filters/WordInternalElement/WordInternalElement.groovy	(revision 258)
@@ -0,0 +1,102 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+package filters.WordInternalElement;
+
+import org.txm.importer.filters.*;
+import java.util.regex.*;
+import org.txm.tokenizer.*;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class WordInternalElement.
+ */
+class WordInternalElement extends Filter {
+	
+	/** The counter. */
+	int counter;
+	
+	/** The old. */
+	def old;
+	
+	/** The corr_tags_no_seg. */
+	String corr_tags_no_seg = TokenizerClasses.corr_tags_no_seg;
+
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#SetUsedParam(java.lang.Object)
+	 */
+	void SetUsedParam(Object args)
+	{
+		try
+		{
+			corr_tags_no_seg = args.get("corr_tags_no_seg");
+
+		}
+		catch(Exception e)
+		{
+			System.err.println(e);
+			System.err.println("wordinternal needs 1 Map with arg  :\n corr_tags_no_seg")
+		}
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#before()
+	 */
+	boolean before()
+	{
+		counter = 0;
+		println "begin wordinternal \n";
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#after()
+	 */
+	void after()
+	{
+		println "Deleted $counter wordinternalspaces \n";
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#filter()
+	 */
+	void filter()
+	{
+		def m;
+		def segment;
+		// Write your code here, but don't forget to write in the output
+		// ex : output.write("TheStringToWrite " + line );
+		// in the variable "line" is the current line value
+		old = line;
+		line = (line =~ /(<(corr_tags_no_seg) [^>]*word_part[^>]*>)\s*([^<]*?)\s*(<\/\2>)/).replaceAll("<seg type=\"word_part\">\$1\$3\$4<\\/seg>");
+		
+		if( old != line)
+			counter++;
+		
+		output.write(line+lineSeparator);
+		// End
+	}
+}
Index: tmp/org.txm.core/src/groovy/filters/TagSentences/TEISentencer.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/filters/TagSentences/TEISentencer.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/filters/TagSentences/TEISentencer.groovy	(revision 258)
@@ -0,0 +1,426 @@
+package filters.TagSentences
+
+import org.txm.importer.StaxIdentityParser;
+import org.txm.importer.ValidateXml;
+
+import java.net.URL;
+import filters.Tokeniser.TEITokenizer.STATES;
+
+class TEISentencer extends StaxIdentityParser {
+
+	boolean DEBUG = false;
+	String filename;
+	
+	enum STATES { IGNORE, NOTE, WORK, W };
+	enum SENT { IN, OUT };
+	STATES state = STATES.IGNORE;
+	SENT sentence = SENT.OUT;
+	
+	String STARTTAGS = "text"
+	String NOTETAGS = "note"
+	String WORDTAGS = "w"
+	String DIVTAGS = "div"
+	String QTAGS = "q"
+	String EDTAGS = "supplied"
+	def openTags = [];
+	
+	public TEISentencer(URL inputurl) {
+		super(inputurl);
+
+		this.filename = new File(inputurl.getFile()).getName();
+		int index = filename.indexOf(".");
+		if (index > 0)
+			filename = filename.substring(0, index);
+	}
+
+	protected void processStartElement() {
+
+		if (state == STATES.IGNORE) {
+			sentence = SENT.OUT;
+			if (localname == STARTTAGS) {
+				state = STATES.WORK;
+			}
+			super.processStartElement();
+		} else {
+			if (localname == NOTETAGS) {
+				state = STATES.NOTE;
+				super.processStartElement();
+				goToEnd(localname)
+			} else {
+				switch(sentence) {
+					case SENT.IN:
+						processStartElementIN();
+						break;
+					case SENT.OUT:
+						processStartElementOUT();
+						break;
+				}
+			}
+		}
+	}
+	
+	@Override
+	protected void processEndElement() {
+		if (state == STATES.IGNORE) {
+			super.processEndElement();
+		} else {
+			if (localname == STARTTAGS) {
+				state = STATES.IGNORE;
+				super.processEndElement();
+			} else {
+				switch(sentence) {
+					case SENT.IN:
+						processEndElementIN();
+						break;
+					case SENT.OUT:
+						processEndElementOUT();
+						break;
+				}
+			}
+		}
+	}
+	
+	protected void cutSentence() {
+		for( int i = 0 ; i < openTags.size() ; i++) {
+			writer.writeEndElement();
+		}
+		endSentence() // close sent
+		super.processStartElement();
+		startSentence()
+		for( Tag tag : openTags) {
+			tag.writeStart(writer);
+		}
+	}
+	
+	protected void cutSentenceAndClose() {
+		for( int i = 0 ; i < openTags.size() ; i++) {
+			writer.writeEndElement();
+		}
+		endSentence() // close sent
+		super.processEndElement();
+		startSentence()
+		for( Tag tag : openTags) {
+			tag.writeStart(writer);
+		}
+	}
+	
+	protected void closeRemainingSentence() {
+		def tags = []
+		while( openTags.size() > 0) {
+			writer.writeEndElement();
+			tags << openTags.pop()
+		}
+		writer.writeEndElement(); // close sent
+		sentence = SENT.OUT;
+	}
+	
+	protected void processStartElementIN() {
+		if (localname.matches(DIVTAGS)) {
+			if (openTags.size() == 0) {
+				endSentence();
+				super.processStartElement();
+				println "WARNING: start DIVTAG in sentence at "+getLocation()
+			} else {
+				cutSentence();
+				println "WARNING: DIVTAG opepened inside EDTAG at "+getLocation()
+			}
+		} else if (localname.matches(QTAGS)) {
+			if (openTags.size() == 0) {
+				endSentence();
+				super.processStartElement();
+			} else {
+				cutSentence();
+				println "WARNING: QTAG opepened inside EDTAG at "+getLocation()
+			}
+		} else if (localname.matches(EDTAGS)) {
+			if (openTags.size() == 0) {
+				if (hasMULTIS()) {
+					endSentence();
+				} else {
+					if (openTags.size() > 0 && openTags[0].localname == localname) {
+						println "STOP: openning same EDTAG $localname at "+getLocation()
+						closeForError();
+					}
+					openTags << new Tag(parser)
+				}
+				super.processStartElement();
+			} else {
+				if (hasMULTIS()) {
+					cutSentence();
+					println "WARNING: EDTAG opened  inside EDTAG"
+				} else {
+					super.processStartElement();
+					if (openTags.size() > 0 && openTags[0].localname == localname) {
+						println "STOP: openning same EDTAG $localname at "+getLocation()
+						closeForError();
+					}
+					openTags << new Tag(parser)
+				}
+			}
+		} else if (localname.matches(WORDTAGS)) {
+			boolean shouldClose = isWEndPunct()
+			if (openTags.size() == 0) {
+				super.processStartElement();
+				goToEnd(localname);
+				if (shouldClose) {
+					endSentence();
+				}
+			} else {
+				super.processStartElement();
+				goToEnd(localname);
+				if (shouldClose) {
+					println "WARNING: Strong ponctuation found inside EDTAG at "+getLocation()
+				}
+			}
+		} else { // OTHER TAGS
+			if (openTags.size() == 0) {
+				if (hasMULTIS()) {
+					endSentence();
+				} else {
+					if (openTags.size() > 0 && openTags[0].localname == localname) {
+						println "STOP: openning same EDTAG $localname at "+getLocation()
+						closeForError();
+					}
+					openTags << new Tag(parser)
+				}
+				super.processStartElement();
+			} else {
+				if (hasMULTIS()) {
+					cutSentence();
+					println "WARNING: multi_s tag opens inside EDTAG"
+				} else {
+					super.processStartElement();
+					if (openTags.size() > 0 && openTags[0].localname == localname) {
+						println "STOP: openning same TAG $localname at "+getLocation()
+						closeForError();
+					}
+					openTags << new Tag(parser);
+				}
+			}
+		}
+	}
+
+	protected void processEndElementIN() {
+		if (localname.matches(DIVTAGS)) {
+			if (openTags.size() == 0) {
+				endSentence();
+				super.processEndElement();
+			} else {
+				cutSentenceAndClose();
+				println "WARNING: DIVTAG closed  inside EDTAG"
+			}
+		} else if (localname.matches(QTAGS)) {
+			if (openTags.size() == 0) {
+				endSentence();
+				super.processEndElement();
+			} else {
+				cutSentenceAndClose();
+				println "WARNING: QTAG closed  inside EDTAG"
+			}
+		} else if (localname.matches(EDTAGS)) {
+			if (openTags.size() == 0) { // it was a multi_s EDTAG
+				endSentence();
+				super.processEndElement();
+			} else {
+				if (openTags[-1].localname == localname) {
+					super.processEndElement();
+					openTags.pop();
+				} else {
+					println "STOP: closing EDTAG does not match last opened EDTAG "+localname+" != "+openTags[-1].localname+" at "+getLocation()
+					closeForError()
+				}
+			}
+		} else if (localname.matches(WORDTAGS)) {
+			println "ERROR: processEndElementIN: </w> at "+getLocation();
+		} else {
+			if (openTags.size() == 0) {
+				super.processEndElement();
+			} else {
+				if (openTags[-1].localname == localname) {
+					super.processEndElement();
+					openTags.pop();
+				} else {
+					println "STOP: closing tag does not match last opened EDTAG "+localname+" != "+openTags[-1].localname+" at "+getLocation()
+					closeForError()
+				}
+			}
+		}
+	}
+
+	protected void processStartElementOUT() {
+		if (localname.matches(DIVTAGS)) {
+			super.processStartElement();
+		} else if (localname.matches(QTAGS)) {
+			super.processStartElement();
+		} else if (localname.matches(EDTAGS)) {
+			if (hasMULTIS()) {
+				super.processStartElement();
+			} else {
+				startSentence();
+				super.processStartElement();
+				if (openTags.size() > 0 && openTags[0].localname == localname) {
+					println "STOP: openning same EDTAG name at "+getLocation()
+					closeForError();
+				}
+				openTags << new Tag(parser);
+			}
+		} else if (localname.matches(WORDTAGS)) {
+			if (isWEndPunct()) {
+				startSentence();
+				super.processStartElement();
+				goToEnd(localname);
+				endSentence();
+				println "WARNING: empty sentence at "+getLocation();
+			} else {
+				startSentence();
+				super.processStartElement();
+				goToEnd(localname);
+			}
+
+		} else {
+
+			if (hasMULTIS()) {
+				super.processStartElement();
+			} else {
+				startSentence();
+				super.processStartElement();
+				if (openTags.size() > 0 && openTags[0].localname == localname) {
+					println "STOP: openning same TAG $localname name at "+getLocation()
+					closeForError();
+				}
+				openTags << new Tag(parser)
+				println "WARNING: unclassified tag: "+localname+" at "+getLocation();
+			}
+		}
+	}
+
+	protected void processEndElementOUT() {
+		if (localname.matches(DIVTAGS)) {
+			super.processEndElement();
+		} else if (localname.matches(QTAGS)) {
+			super.processEndElement();
+		} else if (localname.matches(EDTAGS)) {
+			super.processEndElement();
+		} else if (localname.matches(WORDTAGS)) {
+			println "ERROR: processEndElementOUT: </w> at "+getLocation();
+		} else {
+			super.processEndElement();
+		}
+	}
+
+	private static String STAG = "s"
+	protected void startSentence() {
+		sentence = SENT.IN;
+		writer.writeStartElement(STAG);
+	}
+
+	protected void endSentence() {
+		sentence = SENT.OUT;
+		writer.writeEndElement();
+	}
+
+	private static String ENDOFSENTENCE = "PONfrt"
+	protected boolean isWEndPunct() {
+		for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
+			if (parser.getAttributeValue(i) == ENDOFSENTENCE) return true;
+		}
+		return false;
+	}
+
+	private static String MULTI_S = "multi_s"
+	protected boolean hasMULTIS() {
+		for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
+			if (parser.getAttributeValue(i) == MULTI_S) return true;
+		}
+		return false;
+	}
+
+	public static void main(String[] args) {
+		File dir = new File ("/home/mdecorde/TXM/corpora/alceste/tokenized")
+		File outdir = new File ("/home/mdecorde/TXM/corpora/alceste/tokenized/s")
+		outdir.mkdir()
+		for (File infile : dir.listFiles()) {
+			long start = System.currentTimeMillis()
+			println infile
+			File outfile = new File(outdir, infile.getName())
+	
+			TEISentencer sentencer = new TEISentencer(infile.toURI().toURL());
+			if (sentencer.process(outfile)) {
+				println "DONE - OK: "+ValidateXml.test(outfile);
+			} else {
+				println "DONE - FAIL"
+			}
+			println "time: "+(System.currentTimeMillis()-start)/1000
+		}
+	}
+
+	public class Tag {
+		public String[] attnames, attvalues, attprefix;
+		public String localname, prefix
+		int count;
+		ArrayList<String> contents = [""];
+		public ArrayList<Tag> children = [];
+		boolean inChild = false;
+
+		public Tag(def parser) {
+			prefix = parser.getPrefix()
+			localname = parser.getLocalName();
+			count = parser.getAttributeCount()
+			attnames =  new String[count]
+			attvalues = new String[count]
+			attprefix = new String[count]
+			for (int i = 0 ; i < count ; i++) {
+				attnames[i] = parser.getAttributeLocalName(i)
+				attprefix[i] = parser.getAttributePrefix(i).toString()
+				attvalues[i] = parser.getAttributeValue(i).toString()
+			}
+		}
+
+		public void appendContent(String content) {
+			if (inChild) {
+				children[-1].appendContent(content);
+			} else {
+				this.contents[-1] += content;
+			}
+		}
+
+		public void endOfChild() {
+			contents << "";
+			inChild = false;
+		}
+
+		public void addChild(Tag child) {
+			if (inChild) {
+				children[-1].addChild(child);
+			} else {
+				children.add(child)
+				inChild = true;
+			}
+		}
+
+		public writeStart(def writer) {
+			if (prefix != null && prefix.length() > 0)
+				writer.writeStartElement(prefix+":"+localname)
+			else
+				writer.writeStartElement(localname)
+
+			for (int i = 0 ; i < count ; i++) {
+				if (attprefix[i] != null && attprefix[i].length() > 0) {
+					writer.writeAttribute(attprefix[i]+":"+attnames[i], attvalues[i])
+				} else {
+					writer.writeAttribute(attnames[i], attvalues[i])
+				}
+			}
+
+			//			for ( Tag child: children) {
+			//				child.write(writer)
+			//			}
+
+			//			writer.writeEndElement();
+		}
+
+		public String getContent() {
+			return contents.toString();
+		}
+	}
+}
Index: tmp/org.txm.core/src/groovy/filters/TagSentences/package.html
===================================================================
--- tmp/org.txm.core/src/groovy/filters/TagSentences/package.html	(revision 0)
+++ tmp/org.txm.core/src/groovy/filters/TagSentences/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Deprecated package:  BFM sentencer</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/filters/TagSentences/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/filters/TagSentences/TagSentences.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/filters/TagSentences/TagSentences.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/filters/TagSentences/TagSentences.groovy	(revision 258)
@@ -0,0 +1,481 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+package filters.TagSentences;
+
+import java.util.regex.*
+
+import org.txm.importer.filters.*
+import org.txm.tokenizer.*
+
+import filters.CutHeader.*
+import filters.FusionHeader.*
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class TagSentences.
+ */
+class TagSentences extends Filter {
+	
+	/** The counter. */
+	int counter;
+	
+	/** The m. */
+	def m;
+	
+	/** The segment. */
+	def segment;
+	
+	/** The linetype. */
+	def linetype = "out";
+	
+	/** The open_corr_tags. */
+	def open_corr_tags = new LinkedList<String>();
+	
+	/** The LAS topen_corr_tags. */
+	def LASTopen_corr_tags = "";
+	
+	/** The open_div_tags. */
+	def open_div_tags = new LinkedList<String>();
+	
+	/** The LAST open_div_tags. */
+	def LASTopen_div_tags = "";
+	
+	/** The corr. */
+	def corr = "no";
+	
+	/** The corr_name. */
+	def corr_name;
+	
+	/** The corr_tag. */
+	def corr_tag;
+	
+	/** The pending. */
+	def pending = "no";
+	
+	/** The scounter. */
+	def scounter = 0;
+	
+	/** The _before. */
+	def _before;
+	
+	/** The _after. */
+	def _after;
+	
+	/** The div_tags. */
+	def div_tags = TokenizerClasses.div_tags;
+	
+	/** The q_tags. */
+	def q_tags = TokenizerClasses.q_tags;
+	
+	/** The corr_tags_no_seg. */
+	def corr_tags_no_seg = TokenizerClasses.corr_tags_no_seg;
+	
+	/** The corr_tags. */
+	def corr_tags = TokenizerClasses.corr_tags;
+	
+	def strongPunct = TokenizerClasses.punct_strong;
+	
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#SetUsedParam(java.lang.Object)
+	 */
+	void SetUsedParam(Object args) {
+		try {
+			div_tags = args.get("div_tags");
+			q_tags = args.get("q_tags");
+			corr_tags_no_seg = args.get("corr_tags_no_seg");
+			corr_tags = args.get("corr_tags");
+		}
+		catch(Exception e) {
+			System.err.println(e);
+			System.err.println("TagginSentences needs 1 Map with args  :\n div_tags, q_tags, extraword_tags, " +
+					"corr_tags_no_seg, corr_tags, word_tags, intraword_tags")
+		}
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#before()
+	 */
+	boolean before() {
+		// System.out.println("begin sentences");
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#after()
+	 */
+	void after() {
+		// System.out.println("end sentences");
+	}
+	
+	/**
+	 * Test before after.
+	 *
+	 * @return true, if successful
+	 */
+	boolean testBeforeAfter() {
+		if (_before ==~ /\S/ || _after ==~ /\S/) {
+			print "TagSentences : ERROR: $line";
+			return false;
+		}
+		return true;
+	}
+	
+	/**
+	 * Affect13.
+	 *
+	 * @param m the m
+	 */
+	void affect13(def m) {
+		_before = m[0][1];
+		_after = m[0][3];
+		testBeforeAfter();
+	}
+	
+	/**
+	 * Affect12.
+	 *
+	 * @param m the m
+	 */
+	void affect12(def m) {
+		_before = m[0][1];
+		_after = m[0][2];
+		testBeforeAfter();
+	}
+	
+	/** The MINPRINT. */
+	int MINPRINT = 0
+	
+	/** The MAXPRINT. */
+	int MAXPRINT = 0
+	
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#filter()
+	 */
+	void filter() {
+		String tag;
+		// Write your code here, but don't forget to write in the output
+		// ex : output.print("TheStringToWrite " + line );
+		// in the var line is the current line
+		//line = line.trim()
+		
+		if( scounter > MINPRINT && scounter < MAXPRINT)
+			println linetype+"LINE : "+line;
+		
+		if (line ==~ /\A\s*<!--.*-->\s*\Z/) {		
+			output.print(line);
+		}
+		else if (linetype ==~ /out/) { 
+			//on est en dehors d'une phrase
+			if ( (m = line =~ /^(.*)<s( [^>]*)?>(.*)$/) ) { 
+				//on trouve une balise de phrase => on met à jour le numéro, on est dans une phrase
+				affect13(m);
+				if (pending == "yes") {
+					output.write("</s>\n")
+					pending = "no";
+				}
+				
+				scounter++;
+				line = (line =~ /<s( [^>]*)?>/).replaceAll("<s n=\""+scounter+"\">");
+				output.print(line+"\n");	
+				linetype = "in";
+			}
+			else if( (m = line =~ /^(.*)<\/s>(.*)$/) ) { ////on trouve une balise de phrase fermante
+				//println "found </s> "+line
+				affect12(m);
+				if (pending == "yes") {
+					linetype = "out";
+					pending = "no";
+					//pending = "no";
+					output.print(line);
+				}
+				else
+				{
+					//output.print(line);
+					System.err.println("Found </s>, but pending = no and linetype= out : "+line+" ; scount $scounter");
+				}
+			}
+			else if ( (	m = line =~ /^(.*)<w type="pon"[^>]*>.*<\/w>(.*)$/)  && pending ==~ /yes/) { 
+				// on trouve une ponctuation
+				// et la balise de la phrase précédente n'est pas fermée => on ne fait rien
+							//println "found w type pon"
+				affect12(m);
+				output.print(line);
+			}
+			
+			else if( (m = line =~ /^(.*)<w .*<\/w>(.*)/) ) //on rencontre un mot...
+			{ 	
+				//println "found <w> open a sentence"
+				affect12(m);
+				if(pending == "yes")
+				{
+					output.write("</s>\n")
+					pending = "no";
+				}
+				scounter++;
+				output.print("<s n=\""+scounter+"\">\n"+line);
+				linetype = "in";
+			}
+			else if( (m = line =~ /^\s*(<($corr_tags_no_seg)( [^>\/]*)?>)\s*$/) 
+			|| line.matches("<($corr_tags_no_seg)>"))
+			{ 
+				if(pending == "yes")
+				{
+					output.write("</s>\n")
+					pending = "no";
+				}
+				//System.out.println("OUT: found open corr "+line);
+				//on trouve une balise de correction ouvrante
+				def tag_name = m[0][2];
+				def tag_end = m[0][3];
+				
+				if (tag_end != null && tag_end.contains("multi_s")) // traite le corr comme un div tag
+				{ 
+					open_div_tags.push(tag_name);
+					LASTopen_div_tags = tag_name;
+				} else  { 
+					open_corr_tags.push(tag_name);
+
+					scounter++;
+					output.print("<s n=\""+scounter+"\">\n"); //on ouvre une <s>
+					linetype = "in";
+				}
+				if (scounter > MINPRINT && scounter < MAXPRINT) {
+					println "stacks "+open_corr_tags+" ; "+open_div_tags
+				}
+				output.print(line);
+			} else if( ( m = line =~ /^(.*)<\/($corr_tags_no_seg)>(.*)$/) ) 
+			{ 
+				//on trouve la balise fermante correspondante à la dernière correction ouverte	
+						affect13(m);
+				if (scounter > MINPRINT && scounter < MAXPRINT)
+					println "closing corr tag "+line
+				
+				if (open_corr_tags.size() == 0 )//il n'y a plus de simple balise de corr
+				{	
+					open_div_tags.pop();
+					if(open_div_tags.size() == 0)
+					{
+						if(pending == "yes")
+						{
+							output.print("</s>\n"+line);// comme une div tag
+							pending = "no";
+						}
+						else
+						{
+							output.print(line);// comme une div tag
+						}
+					}
+					else
+					{
+						output.print(line);// comme une div tag
+					}
+				}
+				else
+				{	
+					open_corr_tags.pop();
+					
+					if(pending == "yes")
+					{
+						if(open_corr_tags.size() == 0)
+						{
+							output.print("</s>\n");
+							output.print(line);
+							linetype = "out";
+							pending = "no";
+						}
+						else
+						{
+							output.print(line);
+						}
+					}
+					else
+					{
+						output.print(line);
+					}
+				}
+				if( scounter > MINPRINT && scounter < MAXPRINT)
+				{
+					println "stacks "+open_corr_tags+" ; "+open_div_tags
+				}
+			}
+			else if( (	m = line =~ /^(.*)<\/($div_tags|$q_tags)>(.*)$/) ||
+			line.matches("<($div_tags|$q_tags)>")) { ////on trouve une balise de citation ou division fermante
+				//println "found closing div|quote tag "+line
+				//affect13(m);
+				
+				if (pending == "yes") 
+				{	//println "a sentence was closed"
+					output.print("</s>\n$line");
+					pending = "no";
+				} else {
+					//println "was NOT in sentence"
+					output.print(line);
+				}
+			}
+			else if( (m = line =~ /^(.*)<($div_tags|$q_tags)>(.*)$/) ||
+			(m = line =~ /^(.*)<($div_tags|$q_tags)( [^>]*)?>(.*)$/) ||
+			line.matches("<($div_tags|$q_tags)( [^>]*)?>")) { //balise div ouvrante
+				
+				//pending = "no";
+				//push @s_errors, scounter;
+				if(pending == "yes")
+				{
+					output.print("</s>\n");
+					pending = "no";
+				}
+				
+				output.print("$line");
+			}		
+			else {	//println "ELSE de 'out'"
+				output.print(line);
+			}
+		}
+		else if (linetype ==~ /in/) //on est à l'intérieur d'une phrase
+				{ 	//println "in sentence"
+			
+				if( ( m = line =~ /^(.*)<w [^>]*>$strongPunct<\/w>(.*)/) ) { ////on trouve une ponctuation forte ==> on est à l'extérieur d'une phrase
+						//println "found word .!? "+line
+				affect12(m);
+				
+				if(open_corr_tags.size() == 0) // il n'y a pas de correction en cours
+				{
+					linetype = "out";
+					pending ="yes"
+					output.print(line);
+				}
+				else //on ne ferme pas desuite la phrase mais apres les corr
+				{
+					pending = "yes"
+					output.print(line);
+				}
+			}else if( (m = line =~ /^(.*)<w .*<\/w>(.*)/) || (m = line =~ /^(.*)<w( [^>]*)?>.*<\/w>(.*)/) ) //on rencontre un mot...
+			{ 	
+				//println "found <w> open a sentence"
+				affect12(m);
+				output.print(line);
+				
+			}
+			else if( (m = line =~ /^\s*(<($corr_tags_no_seg)( [^>\/]*)?>)\s*$/) 
+			|| line.matches("<($corr_tags_no_seg)>"))
+			{ 
+				if(scounter > MINPRINT && scounter < MAXPRINT)
+					System.out.println("open corr "+line);
+				//on trouve une balise de correction ouvrante
+				def tag_name = m[0][2];
+				def tag_end = m[0][3];
+				
+				if (tag_end != null && tag_end.contains("multi_s")) // traite le corr comme un div tag
+				{ 
+					open_div_tags.push(tag_name);
+					LASTopen_div_tags = tag_name;
+					output.print("</s>\n");
+					linetype="out"
+				}
+				else 
+				{ 
+					open_corr_tags.push(tag_name);
+				}
+				if(scounter > MINPRINT && scounter < MAXPRINT)
+				{
+					println "stacks "+open_corr_tags+" ; "+open_div_tags
+				}
+				output.print(line);
+			}
+			else if( ( m = line =~ /^(.*)<\/($corr_tags_no_seg)>(.*)$/) ) 
+			{ 
+				//on trouve la balise fermante correspondante à la dernière correction ouverte	
+				if(scounter > MINPRINT && scounter < MAXPRINT)
+					System.out.println("closing corr "+line);
+				affect13(m);
+				
+				if (open_corr_tags.size() == 0 )//il n'y a plus de simple balise de corr
+				{	
+					if (open_div_tags.size() > 1) {
+						output.print("</s>\n"+line);// comme une div tag
+						linetype = "out";
+						open_div_tags.pop();
+					} else {
+						println("error : found a non classified corr : "+line);
+					}
+				} else {	
+					open_corr_tags.pop();
+					output.print(line);
+					if (pending == "yes" && open_corr_tags.size() == 0) // c'était le dernier corr
+					{
+						output.print("</s>\n");
+						linetype = "out";
+						pending = "no";
+					}
+				}
+				if(scounter > MINPRINT && scounter < MAXPRINT)
+				{
+					println "stacks "+open_corr_tags+" ; "+open_div_tags
+				}
+			}
+			else if( (m = line =~ /^(.*)<\/s>(.*)$/) ) { ////on trouve une balise de phrase fermante
+				//println "found </s> "+line
+				affect12(m);
+				
+				linetype = "out";
+				//pending = "no";
+				output.print(line);
+			}
+			else if( (m = line =~ /^(.*)<\/($div_tags|$q_tags)>(.*)$/) ||
+			line.matches("</($div_tags|$q_tags)>")) { ////on trouve une balise de division ou de citation fermante ==> on ferme une </s>
+				//println "found div or quote closing tag "+line
+				//affect13(m);
+				
+				linetype = "out";
+				//pending = "no";
+				//push @s_errors, scounter;
+				output.print("</s>\n$line");
+			}
+			else if( (m = line =~ /^(.*)<($div_tags|$q_tags)>(.*)$/) ||
+			(m = line =~ /^(.*)<($div_tags|$q_tags)( [^>]*)?>(.*)$/) ||
+			line.matches("<($div_tags|$q_tags)( [^>]*)?>")) { ////on trouve une balise de division ou de citation fermante ==> on ferme une </s>
+				//println "found div or quote closing tag "+line
+				//affect13(m);
+
+				//push @s_errors, scounter;
+				output.print("</s>\n")
+				output.print("$line");
+				output.print("<s n=\""+scounter+"\">\n"); //on ouvre une <s>
+				
+			}		
+			else {
+				if(scounter > MINPRINT && scounter < MAXPRINT)
+					println "ELSE "+line
+				output.print(line);
+			}
+		}
+		else {
+			print "Error in sentence tagging : $line";
+			System.err.println("Error in sentence tagging : $line");
+		}
+		// End
+	}
+}
\ No newline at end of file
Index: tmp/org.txm.core/src/groovy/filters/TagSentences/TagSentencesXml.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/filters/TagSentences/TagSentencesXml.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/filters/TagSentences/TagSentencesXml.groovy	(revision 258)
@@ -0,0 +1,503 @@
+// 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
+// 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.
+
+//
+// This file is part of the TXM platform.
+//
+// The TXM platform is free software: you can redistribute it and/or modif y
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 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/>.
+//
+//
+//
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$
+//
+package filters.TagSentences;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.txm.importer.ValidateXml;
+import org.txm.tokenizer.TokenizerClasses;
+import org.txm.utils.AsciiUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStreamReader;
+
+import javax.xml.stream.*;
+import java.net.URL;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class TagSentencesXml.
+ */
+class TagSentencesXml {
+
+	/** The url. */
+	private def url;
+
+	/** The input data. */
+	private def inputData;
+
+	/** The parser. */
+	private XMLStreamReader parser;
+
+	/** The factory. */
+	XMLOutputFactory factory = XMLOutputFactory.newInstance();
+
+	/** The output. */
+	FileOutputStream output;
+
+	/** The writer. */
+	XMLStreamWriter writer;
+
+	/** The IN. */
+	boolean IN = false;
+	boolean WORD = false;
+
+	/** The pending. */
+	boolean pending = false;
+
+	/** The div_tags. */
+	List<String> div_tags = ["front","body","div","head","trailer","p","ab","sp","speaker","list","item"];
+
+	/** The flow_tags. */
+	List<String> flow_tags = ["seg","foreign","hi","title","name","supplied","subst","add","damage", "unclear", "corr", "sic"];
+
+	String startTag = "text";
+	String rendMulti = "MULTI_S";
+	boolean multi = false;
+	boolean startProcess = false;
+	String strongPunct = TokenizerClasses.punct_strong;
+
+	/** The localname. */
+	String localname;
+	boolean DEBUG = false;
+
+	/**
+	 * Instantiates a new tag sentences xml.
+	 *
+	 * @param discoursxml the discoursxml
+	 */
+	public TagSentencesXml(File discoursxml)
+	{
+		this.url = discoursxml.toURI().toURL();
+		//corr_tags.addAll(corr_tags_no_seg);
+
+		inputData = discoursxml.toURI().toURL().openStream();
+		XMLInputFactory factory = XMLInputFactory.newInstance();
+		parser = factory.createXMLStreamReader(inputData);
+	}
+
+	/**
+	 * Creates the output.
+	 *
+	 * @param outfile the outfile
+	 * @return true, if successful
+	 */
+	private boolean createOutput(File outfile){
+		try {
+			output = new BufferedOutputStream(new FileOutputStream(outfile))
+			writer = factory.createXMLStreamWriter(output, "UTF-8");//create a new file
+			writer.writeStartDocument("UTF-8", "1.0");
+			writer.writeCharacters("\n");
+			return true;
+		} catch (Exception e) {
+			System.out.println(e.getLocalizedMessage());
+			return false;
+		}
+	}
+
+	/** The s_id. */
+	int s_id = 1;
+
+	/**
+	 * Process.
+	 *
+	 * @param outfile the outfile
+	 * @return true, if successful
+	 */
+	public boolean process(File outfile)
+	{
+		s_id = 1;
+		if (!createOutput(outfile))
+			return false;
+		String localname = "";
+
+		try {
+			for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+				if (startProcess) {
+					if (IN) {
+						processIn(event);
+					} else {
+						processOut(event);
+					}
+				} else {
+					writeEvent(event);
+				}
+
+				//detect start tag
+				if (!startProcess)
+					if (event == XMLStreamConstants.START_ELEMENT)
+						if (parser.getLocalName() == startTag)
+							startProcess = true;
+			}
+			
+			writer.close()
+			output.close()
+			parser.close()
+		} catch (Exception ex) {
+			System.err.println(parser.getLocation().toString());
+			ex.printStackTrace();
+			
+			writer.close()
+			output.close()
+			parser.close()
+			return false;
+		}
+
+		return true;
+	}
+
+	/**
+	 * ignore content until the existing s is closed
+	 * this sentence may contains others sentence
+	 */
+	public void processContentExistingSentence() // we're IN
+	{
+		ArrayList<String> openedtags = [];
+		if(DEBUG) writer.writeComment("SENT+");
+		assert(IN == true);
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+			switch (event) {
+				case XMLStreamConstants.START_ELEMENT:
+					localname = parser.getLocalName();
+					openedtags.add(localname); // stack the openened tag
+					writeEvent(event);
+					break;
+
+				case XMLStreamConstants.END_ELEMENT:
+					localname = parser.getLocalName();
+					writeEvent(event);
+
+					if (localname == "s") {
+						//	println "end of word: "+parser.getLocation().getLineNumber();
+						if(openedtags.size() == 0) // it's the end of the existing sentence
+						{
+							IN = false; // we're now OUT
+							return; // we've finish to write the word
+						}
+					}
+					openedtags.pop(); // pop the tag stack
+					break;
+
+				case XMLStreamConstants.CHARACTERS:
+					writeEvent(event);
+					break;
+				case XMLStreamConstants.COMMENT:
+					writer.writeComment(parser.getText());
+					break;
+			}
+		}
+		if(DEBUG) writer.writeComment("+SENT");
+	}
+
+	/**
+	 * process the content of a word. start element must have been writen before calling this method
+	 */
+	public void processWordContent() // we're IN
+	{
+		if(DEBUG) writer.writeComment("WORD");
+		assert(IN == true);
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+			switch (event) {
+				case XMLStreamConstants.START_ELEMENT:
+					localname = parser.getLocalName();
+					if(localname == "w")
+						println "Error: found a word in a word: "+parser.getLocation();
+					writeEvent(event);
+					break;
+
+				case XMLStreamConstants.END_ELEMENT:
+					localname = parser.getLocalName();
+
+					if (localname == "w" && pending) // we've found a strong punct in a word
+					{
+						IN = false;
+						pending = false; // reset pending
+						writeEvent(event);
+						writer.writeEndElement();
+					} else {
+						writeEvent(event);
+					}
+
+					if (localname == "w") {
+						//	println "end of word: "+parser.getLocation().getLineNumber();
+						return; // we've finish to write the word
+					}
+
+					break;
+
+				case XMLStreamConstants.CHARACTERS: // detect end of sentence
+					String txt = parser.getText();
+					if (txt.matches(strongPunct)) {
+						pending = true;
+					}
+					writeEvent(event);
+					break;
+				case XMLStreamConstants.COMMENT:
+					writer.writeComment(parser.getText());
+					break;
+			}
+		}
+	}
+
+	/**
+	 * Process out.
+	 *
+	 * @param event the event
+	 */
+	public void processOut(int event)
+	{
+		if (DEBUG) writer.writeComment("OUT");
+		switch (event) {
+			case XMLStreamConstants.START_ELEMENT:
+				localname = parser.getLocalName();
+				if (localname == "s") {
+					IN = true;
+					writeEvent(event);
+					processContentExistingSentence();
+				} else if (localname == "w") {
+					IN = true;
+					writer.writeStartElement("s");
+					writer.writeAttribute("id", "s_"+s_id++)
+					writeEvent(event);
+					processWordContent();
+				} else if (flow_tags.contains(localname)) {
+					String rend = getRendAttribute();
+					if (!rend.contains(rendMulti)) {
+						IN = true;
+						writer.writeStartElement("s");
+						writer.writeAttribute("id", "s_"+s_id++)
+					} else {
+						multi = true;
+					}
+					writeEvent(event);
+				} else if (div_tags.contains(localname)) // found a tag out of sentences, we do nothing
+				{
+					writeEvent(event);
+				} else {
+					writeEvent(event);
+				}
+				break;
+
+			case XMLStreamConstants.END_ELEMENT:
+				localname = parser.getLocalName();
+				if (localname == "s") {
+					System.out.println("Error: found a closing s but we are OUT");
+				}
+				writeEvent(event);
+				break;
+
+			case XMLStreamConstants.CHARACTERS:
+				writeEvent(event);
+				break;
+			case XMLStreamConstants.COMMENT:
+				writer.writeComment(parser.getText());
+				break
+		}
+	}
+
+	public String getRendAttribute()
+	{
+		for (int i = 0 ; i < parser.getAttributeCount() ; i++)
+			if (parser.getAttributeLocalName(i) == "rend")
+				return parser.getAttributeValue(i);
+		return "";
+	}
+
+	/**
+	 * Process xml in a created sentence.
+	 *
+	 * @param event the event
+	 */
+	public void processIn(int event)
+	{
+		if(DEBUG) writer.writeComment("IN")
+		switch (event) {
+			case XMLStreamConstants.START_ELEMENT:
+				localname = parser.getLocalName();
+				if (localname == "s") // found opening s, we close ours and stay IN
+				{
+					writer.writeEndElement(); // close our sentence
+					writeEvent(event); // write the start element
+					processContentExistingSentence(); // process its content
+					//println "ERROR "+parser.getLocation();
+				} else if (localname == "w") // can't close s from here, see END_ELEMENT
+				{
+					writeEvent(event);
+					processWordContent();
+				} else if (flow_tags.contains(localname)) // flow tag = we stay in the sentence
+				{
+					String rend = getRendAttribute();
+					if (rend.contains(rendMulti)) // but this one must be seens as a div tag
+					{
+						writer.writeEndElement(); // close s
+						IN = false; // get out of the sentence
+						multi = true;
+					}
+					writeEvent(event);
+				} else if (div_tags.contains(localname)) // div tag = we must get out the sentence
+				{
+					writer.writeEndElement(); // close s
+					IN = false; // get out of the sentence
+					writeEvent(event);
+				} else {
+					writeEvent(event);
+				}
+				break;
+			case XMLStreamConstants.END_ELEMENT:
+				localname = parser.getLocalName();
+				if (localname == "s") // the sentence seems to already exists, we write the event and get OUT
+				{
+					IN = false;
+					writeEvent(event);
+				} else if (flow_tags.contains(localname)) // closing flow tag = we do nothing
+				{
+					if (multi)
+						println "end of multi?"
+					writeEvent(event);
+				} else if (div_tags.contains(localname)) // closing div tag = we close the current sentence
+				{
+					//println "closing s because of "+localname+" "+parser.getLocation();
+					writer.writeEndElement(); // close s
+					IN = false;
+					writeEvent(event);
+				} else {
+					writeEvent(event);
+				}
+				break;
+
+			case XMLStreamConstants.CHARACTERS: // detect end of sentence
+				writeEvent(event);
+				break;
+			case XMLStreamConstants.COMMENT:
+				writer.writeComment(parser.getText());
+				break
+		}
+	}
+
+	/** The prefix. */
+	String prefix;
+
+	/**
+	 * write the current event.
+	 *
+	 * @param event the stax event
+	 */
+	private void writeEvent(int event)
+	{
+		prefix = parser.getPrefix();
+		if (event == XMLStreamConstants.START_ELEMENT )
+		{
+			localname = parser.getLocalName();
+			if (prefix != null && prefix.length() > 0)
+				writer.writeStartElement(prefix+":"+localname);
+			else
+				writer.writeStartElement(localname);
+			String attrprefix;
+			for (int i = 0 ; i < parser.getAttributeCount() ; i++)
+			{
+				attrprefix = parser.getAttributePrefix(i);
+				if (attrprefix != null && attrprefix.length() > 0)
+					writer.writeAttribute(attrprefix+":"+parser.getAttributeLocalName(i), parser.getAttributeValue(i))
+				else
+					writer.writeAttribute(parser.getAttributeLocalName(i), parser.getAttributeValue(i))
+			}
+			//writer.writeCharacters("\n");
+		} else if (event == XMLStreamConstants.END_ELEMENT)
+		{
+			writer.writeEndElement();
+			//writer.writeCharacters("\n");
+		} else if (event == XMLStreamConstants.CHARACTERS)
+		{
+			writer.writeCharacters(parser.getText());
+		} else if (event == XMLStreamConstants.COMMENT)
+		{
+			writer.writeComment(parser.getText());
+		}
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args)
+	{
+		File dir = new File ("/home/mdecorde/TXM/corpora/alceste/tokenized")
+		File outdir = new File ("/home/mdecorde/TXM/corpora/alceste/tokenized/s")
+
+		def files = dir.listFiles();//scan directory split
+
+		println("Sentencing "+files.size()+" files")
+		for (File infile : files) {
+			print ".";
+			File result = new File(outdir, infile.getName())
+			TagSentencesXml sentencer = new TagSentencesXml(infile);
+			if (!sentencer.process(result)) {
+				println "error with: "+infile
+				return;
+			}
+
+			//validation
+			if (!ValidateXml.test(result)) {
+				println "validation failed with: "+infile
+				return;
+			}
+		}
+		println "done"
+
+	}
+}
Index: tmp/org.txm.core/src/groovy/filters/BuildXmlLiturgie/package.html
===================================================================
--- tmp/org.txm.core/src/groovy/filters/BuildXmlLiturgie/package.html	(revision 0)
+++ tmp/org.txm.core/src/groovy/filters/BuildXmlLiturgie/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Deprecated package: Filter to transform the "Liturgie" XML files</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/filters/BuildXmlLiturgie/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/filters/BuildXmlLiturgie/BuildXmlLiturgie.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/filters/BuildXmlLiturgie/BuildXmlLiturgie.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/filters/BuildXmlLiturgie/BuildXmlLiturgie.groovy	(revision 258)
@@ -0,0 +1,136 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+package filters.BuildXmlLiturgie
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.io.PrintStream;
+
+import org.txm.importer.filters.*;
+// TODO: Auto-generated Javadoc
+
+/**
+ * The Class BuildXmlLiturgie.
+ *
+ * @author ayepdieu
+ */
+
+public class BuildXmlLiturgie extends Filter
+{
+	/*
+	 * ville : msDescription>msIdentifier>settlement
+	 * cote : msDescription>msIdentifier>idno
+	 * institution : msDescription>msIdentifier>institution
+	 * usage : msDescription>msItem>respStmt>name
+	 * post : msDescription>history>origin>origDate , notBefore
+	 * ante : msDescription>history>origin>origDate , notAfter
+	 */
+	
+	/** The dir path name. */
+	String dirPathName;;
+	
+	/** The file name. */
+	String fileName;
+	
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#SetUsedParam(java.lang.Object)
+	 */
+	public void SetUsedParam(Object args)
+	{
+		
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#filter()
+	 */
+	public void filter()
+	{
+		
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#before()
+	 */
+	public boolean before()
+	{
+		this.readInput = false;
+		return true;
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#after()
+	 */
+	public void after() {
+		println("start transformPage");
+
+		def body = new XmlSlurper().parse(this.input);
+		def nodes = body.text.body.listBibl.msDescription;
+		def idNotice=1;
+		def idp=1;
+
+		def xmlBuilder = new groovy.xml.StreamingMarkupBuilder();
+		xmlBuilder.encoding = this.encodage;
+
+		def xml = xmlBuilder.bind{
+			mkp.declareNamespace("":"http://www.tei-c.org/ns/1.0") 
+
+				nodes.each {
+					//msDescription
+					def ville = it.msIdentifier.settlement.text();
+					def institution = it.msIdentifier.institution.text();
+					def cote = it.msIdentifier.idno.text();
+					def usage = it.msContents.msItem.respStmt.name.text();
+					def post = it.history.origin.origDate.'@notBefore';
+					def ante = it.history.origin.origDate.'@notAfter';
+					
+					def msitems = it.msContents.msItem.msItem;
+					//println msitems.size();
+					notice(n:idNotice, ville:ville, institution:institution, cote:cote, usage:usage,post:post,ante:ante )
+							{
+								idp=1;
+								msitems.each {
+									def pp = (it.p);
+									
+									pp.each {
+										it.attributes().put("n",idp) 
+										mkp.yield(it)
+										
+										idp++
+									}
+								}
+							}
+					idNotice++;
+				}
+		}
+		this.output.write(xml);
+	}
+}
Index: tmp/org.txm.core/src/groovy/filters/ReunitBrokenTags/ReunitBrokenTags.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/filters/ReunitBrokenTags/ReunitBrokenTags.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/filters/ReunitBrokenTags/ReunitBrokenTags.groovy	(revision 258)
@@ -0,0 +1,113 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+package filters.ReunitBrokenTags;
+
+//Pre-processing extra-word tags (1)
+import org.txm.importer.filters.*;
+import java.util.regex.*;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class ReunitBrokenTags.
+ */
+class ReunitBrokenTags extends Filter {
+	
+	/** The counter. */
+	int counter;
+
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#SetUsedParam(java.lang.Object)
+	 */
+	void SetUsedParam(Object args) {
+
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#before()
+	 */
+	boolean before() {
+		counter = 0;
+		System.out.println("begin reunitbroken");
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#after()
+	 */
+	void after()
+	{
+		println "$counter Reunited tags \n";
+	}
+
+	/** The printcounter. */
+	int printcounter = 0;
+
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#filter()
+	 */
+	void filter()
+	{
+		def m;
+		def segment = (line =~ / /).replaceAll(" ");
+		segment = (line =~ /&#160;|&nbsp;|&#xa0;/).replaceAll(" ");
+		while(! (segment ==~ /\A\s*\Z/)) 
+		{
+			if (segment ==~ /^[^<>]*$/) {
+				segment = (segment =~ /^\s+/).replaceFirst(" ");
+				//if(printcounter < 15)
+					//println(segment);
+				printcounter++;
+				output.write(segment+lineSeparator);
+				segment = " ";
+			}
+			else if (segment ==~ /^\s*([^<]*<[^>]+)$/) {
+				segment = (segment =~ /^\s+/).replaceFirst(" ");
+				segment = (segment =~ /\s+$/).replaceFirst(" ");
+				output.write(segment);
+				segment = " ";
+				counter++;
+			}
+			else if( (m = (segment =~ /^\s+([^<]*<[^>]+>)(.*)$/)) )	{
+				segment = m[0][2];
+				output.write(" "+m[0][1]);
+			}
+			else if( (m = (segment =~ /^([^< ]*<[^>]+>)(.*)$/)) ) {
+				segment = m[0][2];
+				output.write(m[0][1]);
+			}
+			else if( (m = (segment =~ /^\s*([^>]*)>(.*)$/)) ) {
+				segment = m[0][2];
+				output.write(" "+m[0][1]+">");
+			}
+			else {
+				output.write(segment+lineSeparator);
+				println "ERROR in tag restitution segment\n";
+				segment = " ";
+			}
+		}
+	}
+}
Index: tmp/org.txm.core/src/groovy/filters/ReunitBrokenTags/package.html
===================================================================
--- tmp/org.txm.core/src/groovy/filters/ReunitBrokenTags/package.html	(revision 0)
+++ tmp/org.txm.core/src/groovy/filters/ReunitBrokenTags/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Deprecated package: Filter of the BFM tokenizer</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/filters/ReunitBrokenTags/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/filters/ReunitBrokenWords/package.html
===================================================================
--- tmp/org.txm.core/src/groovy/filters/ReunitBrokenWords/package.html	(revision 0)
+++ tmp/org.txm.core/src/groovy/filters/ReunitBrokenWords/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Deprecated package: Filter of the BFM tokenizer</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/filters/ReunitBrokenWords/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/filters/ReunitBrokenWords/ReunitBrokenWords.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/filters/ReunitBrokenWords/ReunitBrokenWords.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/filters/ReunitBrokenWords/ReunitBrokenWords.groovy	(revision 258)
@@ -0,0 +1,241 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+package filters.ReunitBrokenWords;
+//Pre-processing extra-word tags (2)
+import org.txm.importer.filters.*;
+import org.txm.tokenizer.*;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class ReunitBrokenWords.
+ */
+class ReunitBrokenWords extends Filter
+{
+	
+	/** The tag_all. */
+	def tag_all = TokenizerClasses.tag_all;
+	
+	/** The div_tags. */
+	def div_tags = TokenizerClasses.div_tags;
+	
+	/** The q_tags. */
+	def q_tags = TokenizerClasses.q_tags;
+	
+	/** The extraword_tags. */
+	def extraword_tags = TokenizerClasses.extraword_tags;
+	
+	/** The corr_tags_no_seg. */
+	def corr_tags_no_seg = TokenizerClasses.corr_tags_no_seg;
+	
+	/** The corr_tags. */
+	def corr_tags = TokenizerClasses.corr_tags;
+	
+	/** The word_tags. */
+	def word_tags = TokenizerClasses.word_tags;
+	
+	/** The intraword_tags. */
+	def intraword_tags = TokenizerClasses.intraword_tags;
+	
+	/** The tag. */
+	def tag;
+	
+	/** The tag_end. */
+	def tag_end;
+	
+	/** The tag_name. */
+	def tag_name;
+	
+	/** The word_part_tags. */
+	List<String> word_part_tags = [];
+	
+	/** The unknowned. */
+	Set<String> unknowned = new HashSet<String>();
+	
+	/** The level. */
+	private String level = "extraword";
+	
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#SetUsedParam(java.lang.Object)
+	 */
+	void SetUsedParam(Object args)
+	{
+		try
+		{
+			div_tags = args.get("div_tags");
+			q_tags = args.get("q_tags");
+			extraword_tags = args.get("extraword_tags");
+			corr_tags_no_seg = args.get("corr_tags_no_seg");
+			corr_tags = args.get("corr_tags");
+			word_tags = args.get("word_tags");
+			intraword_tags = args.get("intraword_tags");
+		}
+		catch(Exception e)
+		{
+			System.err.println(e);
+			System.err.println("PreProcess2 needs 1 Map with args  :\n div_tags, q_tags, extraword_tags, " +
+					"corr_tags_no_seg, corr_tags, word_tags, intraword_tags")
+		}
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#before()
+	 */
+	boolean before(){	}
+	
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#after()
+	 */
+	void after()
+	{ 
+		if(unknowned.size() > 0)
+			println "Unknown tags: "+unknowned;
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#filter()
+	 */
+	void filter()
+	{
+		def m;
+		def segment;
+		boolean firstTest = true;
+
+		while(!(line ==~ /\A\s*\Z/))// tant que la ligne contient des charracters autres que des blancs
+		{
+			if ((m = line =~ /^([^<]*)$/)) 	 // si la ligne NE commence PAS par une balise
+			{
+				if(firstTest)
+				{
+					//output.print(lineSeparator);
+					firstTest=false;
+				}
+				output.print(line);//on ecrit la ligne
+				line = " "
+			}
+			else if ((m = line =~ /\A\s*(<\/?($extraword_tags)( [^>]*|\/)?>)(.*)\Z/)) // balise externe 	
+			{	
+				tag = m[0][1]; // le nom du tag
+				line = m[0][4];
+				//println "balise ext : "+tag
+				level = "extraword"; //di qu'on est ds un tag extern
+				output.print("\n$tag \n");
+			}
+			else if ((m = line =~ /\A\s*(<($corr_tags)( [^>]*|\/)?>)(.*)\Z/)) //balise corr ouvrante		
+			{   
+				tag = m[0][1];
+				String tag_end = m[0][3]; // ( [^>]*|\/)?>)
+				line = m[0][4];
+				//println "balise corr : "+tag+" end : "+tag_end
+				if(tag_end != null && tag_end.find("word_part")) //on trouve un word_part	
+				{
+					//println "set level : intra :"+tag
+					word_part_tags.add(m[0][2]);
+					level = "intraword";
+					output.print(tag);
+				}
+				else {
+					level = "extraword";
+					output.print("\n$tag\n");
+				}
+			} 
+			else if ((m = line =~ /^\s*(<($word_tags)( [^>]*|\/)?>)(.*)$/)) 				
+			{
+				tag = m[0][1];
+				line = m[0][4];
+				//println "balise word : "+tag
+				//output.print("\n$tag");
+				output.write(line)
+				level = "intraword";
+			}
+			else if ((m = line =~ /^\s*(<($intraword_tags)( [^>]*|\/)?>)(.*)$/))			
+			{
+				tag = m[0][1];
+				line = m[0][4];
+				//println "balise intra : "+tag
+				output.print(tag);
+				level = "intraword";
+			}
+			else if ((m = line =~ /^\s*(<\/($corr_tags|$word_tags|$intraword_tags)>)\s*(.*)$/))
+			{
+				tag = m[0][1];
+				tag_name = m[0][2];
+				line = m[0][3];
+				//println "balise tous : "+tag+" level : "+level
+				if (level ==~ /extraword/) 
+				{//println "write extra"
+					output.print("\n");
+				}//else{println "dont write intra"}
+				
+				output.print(tag);
+				if (tag_name ==~ /^($corr_tags|$word_tags)$/) 				
+				{
+					//println("> corrwordtags "+tag_name+" level "+level+" Word_part_tag "+word_part_tags)
+					if (level ==~ /extraword/) 
+					{
+						output.print("\n");
+					}
+					//else{println "dont write intra corr"}
+					if(word_part_tags.size() > 0)
+					{
+						//String word_part_tag = word_part_tags[-1];
+						//if(tag_name == word_part_tag)
+						//{
+							word_part_tags.remove(word_part_tags.size()-1)
+							if(word_part_tags.size() == 0 )
+							{
+								level = "extraword";
+								//output.print("\n");
+							}
+						//}
+					}
+					else
+						level = "extraword"
+				}
+			}
+			else if ((m = line =~ /^\s*($tag_all)(.*)$/)) 				
+			{
+				//println "balise autres : "+tag
+				tag = m[0][1];
+				line = m[0][2];
+				output.print("\n$tag\n");
+				if(!unknowned.contains(tag))
+				{
+					unknowned.add(tag)
+					//println "Warning: unknown tag $tag in line : "+line;
+				}
+				
+			}
+			else{			
+				println "Error in "+ line;
+				line = " ";
+			}
+			firstTest=false;
+		}
+		// End
+	}
+}
Index: tmp/org.txm.core/src/groovy/filters/eliminateNAttributes/package.html
===================================================================
--- tmp/org.txm.core/src/groovy/filters/eliminateNAttributes/package.html	(revision 0)
+++ tmp/org.txm.core/src/groovy/filters/eliminateNAttributes/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Deprecated package: Filter to remove attributes of XML-TEI files</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/filters/eliminateNAttributes/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/filters/eliminateNAttributes/eliminateNAttributes.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/filters/eliminateNAttributes/eliminateNAttributes.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/filters/eliminateNAttributes/eliminateNAttributes.groovy	(revision 258)
@@ -0,0 +1,85 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+package filters.eliminateNAttributes;
+
+import org.txm.importer.filters.*;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class eliminatingNAttributes.
+ */
+class eliminatingNAttributes extends Filter {
+	
+	/** The counter. */
+	int counter;
+	
+	/** The old. */
+	def old;
+
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#SetUsedParam(java.lang.Object)
+	 */
+	void SetUsedParam(Object args) {
+
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#before()
+	 */
+	boolean before() {
+		counter = 0;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#after()
+	 */
+	void after()
+	{
+		println "Deleted $counter PART='N' attributes\n";
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#filter()
+	 */
+	void filter()
+	{
+		def m;
+		def segment;
+		// Write your code here, but don't forget to write in the output
+		// ex : output.write("TheStringToWrite " + line );
+		// in the var line is the current line
+		old = line;
+		line = (line =~ / part=["']N['"]/).replaceAll("");
+		
+		if( old != line)
+			counter++;
+		
+		output.write(line+lineSeparator);
+		// End
+	}
+}
Index: tmp/org.txm.core/src/groovy/filters/MinimalFilter/package.html
===================================================================
--- tmp/org.txm.core/src/groovy/filters/MinimalFilter/package.html	(revision 0)
+++ tmp/org.txm.core/src/groovy/filters/MinimalFilter/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Deprecated package: Sample Filter</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/filters/MinimalFilter/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/filters/MinimalFilter/MinimalFilter.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/filters/MinimalFilter/MinimalFilter.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/filters/MinimalFilter/MinimalFilter.groovy	(revision 258)
@@ -0,0 +1,81 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+package filters.MinimalFilter;
+
+import org.txm.importer.filters.*;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class MinimalFilter.
+ */
+class MinimalFilter extends Filter {
+	
+	/** The linecounter. */
+	int linecounter = 0;
+
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#SetUsedParam(java.lang.Object)
+	 */
+	void SetUsedParam(Object args) {
+
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#before()
+	 */
+	boolean before() {
+		System.out.println("strat Minimal " + this);
+		return true;
+	}
+
+	/**
+	 * Sets the used param.
+	 *
+	 * @param args the args
+	 */
+	void SetUsedParam(Object[] args) {
+
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#after()
+	 */
+	void after() {
+		System.out.println("readed lines : " + linecounter);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#filter()
+	 */
+	void filter() {
+		linecounter++;
+		output.write(line + lineSeparator);
+		output.flush();
+	}
+
+}
Index: tmp/org.txm.core/src/groovy/filters/OneTagPerLine/package.html
===================================================================
--- tmp/org.txm.core/src/groovy/filters/OneTagPerLine/package.html	(revision 0)
+++ tmp/org.txm.core/src/groovy/filters/OneTagPerLine/package.html	(revision 258)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Deprecated package: Filter to prepare the BFM tokenizer files</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/src/groovy/filters/OneTagPerLine/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/groovy/filters/OneTagPerLine/OneTagPerLine.groovy
===================================================================
--- tmp/org.txm.core/src/groovy/filters/OneTagPerLine/OneTagPerLine.groovy	(revision 0)
+++ tmp/org.txm.core/src/groovy/filters/OneTagPerLine/OneTagPerLine.groovy	(revision 258)
@@ -0,0 +1,104 @@
+// 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
+// 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.
+// 
+// 
+// 
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+package filters.OneTagPerLine;
+
+//Pre-processing extra-word tags (1)
+import org.txm.importer.filters.*;
+import java.util.regex.*;
+import org.txm.tokenizer.TokenizerClasses;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class OneTagPerLine.
+ */
+class OneTagPerLine extends Filter {
+	
+	/** The tag_all. */
+	String tag_all = TokenizerClasses.tag_all;
+	
+	/** The counterreg1. */
+	int counterreg1 = 0;
+	
+	/** The counterreg2. */
+	int counterreg2 = 0;
+
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#SetUsedParam(java.lang.Object)
+	 */
+	void SetUsedParam(Object args) {
+
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#before()
+	 */
+	boolean before() {
+
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#after()
+	 */
+	void after() {
+
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.importer.filters.Filter#filter()
+	 */
+	void filter()
+	{
+		def m;
+		boolean firstTest = true;
+
+		while(!(line ==~ /\A\s*\Z/))
+		{
+			if (( m = line =~ /^([^<]+)(.*)$/) )// trucs(<balise>
+			{
+				if(firstTest)
+				{
+					output.write(lineSeparator);
+					firstTest=false;
+				}
+				output.write(m[0][1]);
+				line = m[0][2];
+			}
+			else if ((m = line =~ /^($tag_all)(.*)$/)) {//
+				firstTest=false;
+				output.write("\n"+m[0][1]);
+				line = m[0][2];
+			}
+			else
+			{
+				println "Error in "+ line;
+				line = " ";
+			}
+		}
+		// End
+	}
+}
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/hungarian.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/hungarian.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/hungarian.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 19186
+e	 5753
+a	 4627
+t	 4522
+s	 3480
+l	 3437
+n	 3137
+k	 3036
+i	 2527
+r	 2437
+z	 2399
+o	 2303
+�	 2039
+�	 1995
+g	 1978
+m	 1695
+y	 1338
+_a	 1256
+b	 1186
+d	 1148
+a_	 1108
+v	 1057
+t_	 901
+sz	 889
+el	 832
+,	 819
+,_	 818
+h	 792
+k_	 769
+.	 767
+et	 743
+gy	 711
+s_	 705
+_m	 702
+_a_	 695
+en	 671
+�	 662
+n_	 646
+_k	 645
+j	 623
+._	 613
+i_	 606
+eg	 601
+p	 586
+_e	 580
+u	 579
+le	 576
+�	 542
+er	 495
+f	 485
+ek	 477
+te	 477
+�s	 473
+_s	 471
+al	 464
+ta	 458
+�	 453
+_h	 444
+_t	 442
+an	 426
+ze	 425
+me	 406
+at	 405
+l_	 401
+es	 395
+�	 387
+y_	 381
+z_	 375
+tt	 374
+ke	 372
+_v	 369
+�s	 368
+ak	 367
+_�	 365
+ny	 363
+t�	 359
+c	 358
+re	 350
+to	 347
+A	 343
+e_	 340
+�	 332
+ne	 330
+os	 326
+�l	 320
+_f	 320
+az	 317
+zt	 317
+�r	 317
+_n	 315
+ko	 312
+_A	 303
+_sz	 302
+is	 301
+ve	 299
+gy_	 297
+�t	 293
+_b	 293
+ra	 291
+or	 289
+ol	 284
+_i	 281
+em	 279
+_l	 274
+la	 264
+ez	 262
+be	 260
+lt	 260
+ok	 260
+ye	 256
+_me	 252
+on	 251
+en_	 247
+ar	 245
+_az	 245
+in	 243
+�n	 242
+se	 242
+�g	 238
+egy	 237
+ha	 237
+r_	 237
+t�	 237
+�r	 235
+sze	 233
+�n	 226
+ly	 224
+g_	 221
+"	 221
+ll	 219
+iz	 214
+de	 214
+ek_	 213
+mi	 212
+rt	 211
+ba	 209
+ho	 209
+A_	 209
+�s_	 209
+az_	 205
+va	 204
+ag	 203
+ka	 202
+na	 202
+og	 201
+ik	 201
+nt	 200
+_A_	 199
+�	 199
+-	 198
+tt_	 198
+_az_	 197
+ni	 195
+cs	 194
+ki	 190
+k�	 187
+�t	 187
+_eg	 187
+nd	 186
+fe	 185
+_�s	 185
+l�	 182
+bi	 181
+nk	 180
+_le	 179
+an_	 179
+_�s_	 177
+t�s	 175
+k�	 174
+meg	 173
+_egy	 172
+ma	 171
+as	 170
+sa	 170
+s�	 169
+ge	 167
+ot	 167
+za	 167
+E	 166
+m_	 165
+_meg	 165
+_el	 165
+bb	 164
+ro	 164
+z�	 163
+he	 162
+m�	 161
+s�	 160
+_r	 160
+s�t	 160
+tos	 159
+ti	 159
+st	 158
+_j	 158
+�l	 157
+it	 156
+_ho	 156
+�l	 156
+_ha	 155
+v�	 154
+am	 152
+oz	 152
+ele	 151
+ya	 151
+zto	 150
+�	 149
+biz	 147
+so	 147
+et_	 145
+izto	 144
+izt	 144
+ap	 141
+"_	 141
+ed	 141
+ss	 140
+bizt	 140
+�k	 140
+bizto	 140
+iztos	 139
+�t	 139
+ztos	 139
+os�t	 138
+zet	 138
+os�	 138
+m�	 137
+_is	 137
+t,	 136
+tos�t	 136
+tos�	 136
+t,_	 136
+�_	 135
+agy	 135
+ztos�	 135
+li	 134
+om	 134
+_fe	 134
+ere	 133
+�g	 133
+t.	 132
+nek	 131
+vi	 129
+_d	 129
+zo	 128
+k,_	 128
+k,	 128
+_k�	 127
+_p	 127
+M	 126
+let	 126
+ak_	 125
+j�	 125
+ett	 125
+�	 124
+si	 124
+�sz	 123
+_E	 123
+�p	 123
+v�	 123
+r�	 123
+t._	 123
+is_	 123
+S	 123
+�t�s	 122
+�t�	 122
+kor	 121
+ai	 121
+fel	 120
+da	 120
+_mi	 120
+pe	 119
+ogy	 118
+ban	 118
+ad	 117
+ga	 116
+_va	 116
+ott	 114
+_ne	 114
+_ki	 113
+�r	 113
+z�	 112
+ben	 112
+_te	 111
+zi	 111
+s�	 110
+s�g	 109
+do	 109
+t�	 108
+em_	 108
+_"	 108
+_ta	 108
+_M	 107
+ogy_	 107
+_�	 107
+k.	 106
+�l	 105
+_ke	 105
+_g	 104
+:	 103
+gye	 102
+�k	 102
+hog	 102
+ri	 102
+mo	 101
+ok_	 101
+:_	 101
+hogy	 101
+il	 101
+el_	 100
+zer	 100
+ete	 99
+nn	 99
+nak	 98
+je	 98
+s�t�	 98
+sz�	 98
+yo	 98
+os�t�	 98
+s�t�s	 98
+_k�	 98
+_hog	 98
+l�	 97
+_S	 97
+_hogy	 97
+ig	 97
+_-	 96
+hogy_	 96
+ban_	 96
+ese	 95
+_bi	 94
+fo	 94
+ja	 94
+ul	 94
+�_	 94
+k._	 94
+_c	 93
+k�	 91
+es_	 91
+n�	 91
+�ny	 91
+g�	 91
+�s_	 91
+egy_	 90
+�b	 90
+rd	 89
+I	 89
+�ny	 89
+_biz	 89
+_fel	 88
+�v	 88
+ala	 88
+szer	 88
+po	 88
+_ma	 88
+leg	 88
+t�	 88
+ket	 87
+un	 87
+di	 87
+ai_	 87
+nek_	 87
+rm	 86
+tal	 86
+�v	 85
+_is_	 85
+nem	 85
+ti_	 84
+�z	 84
+szt	 84
+ut	 83
+ter	 83
+d�	 83
+kk	 83
+or_	 83
+b_	 82
+n�	 82
+os_	 82
+re_	 82
+rs	 82
+_bizt	 82
+min	 82
+ben_	 81
+ra_	 81
+ik_	 81
+go	 80
+len	 80
+lm	 80
+�t	 80
+ely	 80
+aj	 80
+�l	 80
+_sze	 80
+_be	 79
+ev	 79
+r�	 79
+ssz	 79
+nt_	 79
+gya	 79
+K	 79
+si_	 79
+sza	 78
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/chinese-gb2312.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/chinese-gb2312.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/chinese-gb2312.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 77350
+�	 7152
+_�	 5428
+�	 3924
+�	 3063
+�	 3020
+�	 2565
+�	 2491
+�	 2490
+_�	 2490
+�	 2438
+�	 2424
+�	 2394
+_�	 2391
+�	 2384
+�	 2349
+�_	 2233
+_��_	 2102
+��_	 2102
+��	 2102
+_��	 2102
+�	 2057
+�	 2043
+�	 2000
+�	 1999
+�	 1936
+�	 1856
+�	 1824
+�	 1824
+�	 1796
+�	 1780
+�	 1752
+�	 1728
+�	 1726
+�	 1696
+�_	 1637
+�	 1631
+�	 1630
+�	 1630
+�	 1596
+�	 1571
+�_	 1545
+�	 1535
+�	 1520
+��	 1505
+��_	 1500
+_��	 1470
+_��_	 1466
+�	 1450
+�	 1429
+�	 1425
+�	 1367
+�	 1364
+�	 1356
+�	 1335
+�	 1306
+_�	 1286
+�	 1215
+��_	 1173
+_��_	 1173
+_��	 1173
+��	 1173
+_�	 1141
+�	 1131
+_�	 1124
+�_	 1105
+�	 1083
+_�	 1076
+_�	 1048
+_�	 1038
+_�	 1026
+�	 1015
+�_	 1008
+�	 973
+�	 952
+�_	 947
+�_	 946
+�_	 932
+_�	 908
+_�	 904
+�	 876
+_�	 831
+_�	 823
+�_	 817
+_�	 808
+_�	 805
+_�	 803
+_�	 790
+_�	 785
+�_	 783
+_�	 768
+_�	 766
+�	 759
+_�	 759
+�_	 751
+_�	 749
+�	 744
+��_	 740
+_��	 740
+_��_	 740
+��	 740
+_�	 738
+�	 733
+�_	 720
+�	 708
+�	 694
+_�	 690
+�	 688
+_�	 686
+_�	 685
+��_	 674
+��	 674
+_��_	 674
+_��	 674
+�_	 663
+�_	 656
+_�	 651
+�	 643
+�_	 643
+_�	 632
+_�	 628
+�	 626
+�	 605
+�_	 593
+�	 586
+_�	 585
+�	 584
+�	 578
+_�	 574
+�	 563
+�	 562
+_�	 549
+�_	 534
+_�	 521
+��	 515
+��	 510
+�_	 507
+�_	 503
+�_	 493
+һ	 493
+_�	 482
+�_	 481
+�	 476
+��	 474
+�_	 470
+��	 468
+_��	 465
+��_	 465
+_��_	 465
+��_	 464
+�	 455
+�_	 450
+�	 449
+_�	 449
+�	 448
+_�	 448
+�	 445
+��	 445
+�	 441
+�_	 434
+_�	 432
+�_	 430
+�	 428
+��_	 427
+_��	 426
+_��_	 426
+��_	 426
+��	 426
+��	 425
+�_	 424
+_��	 423
+_һ	 419
+�	 419
+�	 417
+��_	 417
+_��_	 415
+�	 413
+�_	 412
+�_	 411
+�	 411
+�_	 410
+�	 409
+�_	 402
+�_	 400
+�	 398
+_��	 397
+_��	 397
+�_	 395
+_�	 393
+�_	 392
+�	 390
+�_	 387
+�	 386
+�	 385
+�_	 383
+_��_	 380
+��_	 379
+�_	 378
+_�	 372
+�	 368
+_��_	 368
+�_	 364
+�_	 359
+�_	 358
+�_	 356
+�_	 355
+�	 355
+�_	 349
+�_	 346
+�_	 343
+�_	 343
+�_	 340
+�	 340
+��	 338
+��	 338
+�_	 336
+�_	 331
+�	 329
+�_	 324
+һ_	 309
+��_	 306
+�	 304
+��	 300
+�_	 298
+�_	 297
+��	 296
+�_	 294
+�	 293
+_�	 290
+�	 289
+�_	 281
+_��	 276
+�_	 274
+ҵ	 274
+�_	 273
+��	 272
+�_	 270
+�	 270
+�	 270
+�_	 269
+_һ_	 269
+�_	 268
+�	 268
+_��	 267
+��	 267
+��	 266
+�_	 265
+�_	 264
+�_	 264
+_�	 262
+�	 258
+�_	 257
+�_	 256
+�_	 248
+ҵ_	 246
+��	 242
+�_	 242
+�	 242
+�_	 237
+��	 233
+��	 230
+��	 229
+��	 228
+Ϊ	 228
+��	 226
+_��	 225
+�_	 225
+�_	 224
+��	 224
+�_	 224
+��_	 223
+��	 223
+�_	 222
+�_	 222
+�_	 221
+��	 221
+_��	 220
+��	 220
+�_	 220
+�_	 219
+��	 218
+��_	 217
+_��_	 217
+_��	 217
+��_	 217
+_��	 214
+��	 210
+_��	 210
+�	 209
+��	 209
+��	 208
+��	 208
+�_	 208
+_��	 207
+�_	 207
+_��	 205
+��_	 205
+��_	 205
+��	 205
+_��_	 205
+_��_	 205
+_��	 205
+��	 205
+��	 204
+�_	 203
+��	 202
+�_	 202
+_��_	 201
+��	 201
+_��_	 200
+_��	 200
+��_	 200
+��_	 199
+�_	 197
+_��	 197
+��_	 197
+_��_	 197
+_��	 196
+�	 193
+_��	 191
+��	 189
+�_	 188
+_��	 186
+_��_	 186
+�_	 186
+��_	 186
+��	 183
+��	 183
+��	 182
+Ϊ_	 182
+��_	 180
+��	 179
+��	 179
+��	 178
+_��	 178
+�_	 177
+_��_	 177
+��_	 177
+�_	 176
+��	 175
+��	 174
+_Ϊ	 173
+ȫ	 171
+�_	 171
+��	 171
+��	 171
+��	 169
+_��_	 169
+_��	 169
+_��_	 169
+��_	 169
+��_	 169
+_��	 169
+_��	 168
+_��	 168
+�_	 168
+��_	 167
+_��	 166
+�_	 166
+��_	 166
+Ҫ	 165
+��	 164
+ʱ	 164
+_��	 164
+��_	 163
+�_	 160
+��_	 160
+��_	 159
+�	 158
+_��_	 157
+��_	 157
+��	 156
+_��_	 156
+_��_	 155
+��	 155
+��	 154
+��	 154
+_��	 154
+_��	 154
+��	 152
+_��	 151
+_��	 151
+��	 151
+ʡ	 149
+��	 148
+�_	 148
+_ʡ	 148
+��	 147
+_��	 146
+��_	 145
+_ȫ	 143
+ͬ	 143
+��	 142
+_��	 141
+��_	 140
+��	 140
+ѧ	 140
+ũ	 139
+Ҫ_	 139
+_��	 137
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/korean.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/korean.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/korean.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 11636
+�	 2659
+�	 1629
+�	 1578
+�	 1458
+�	 1397
+�	 1299
+�	 1118
+�	 1005
+�	 928
+�	 849
+�	 840
+_�	 809
+�	 808
+�	 780
+�	 773
+�	 764
+�	 674
+�	 640
+�	 591
+�	 580
+��	 538
+�	 526
+�	 519
+�	 518
+_�	 518
+�	 506
+�	 483
+�	 464
+�	 463
+�	 454
+��	 451
+�	 404
+�	 395
+�	 384
+_�	 382
+�	 377
+.	 374
+�	 373
+�	 358
+._	 347
+_�	 344
+��	 338
+�_	 333
+�_	 329
+��	 327
+_�	 319
+��_	 317
+��.	 313
+�.	 313
+�	 308
+�	 308
+��._	 301
+�._	 301
+�_	 299
+_�	 291
+�	 288
+�	 282
+��	 279
+�	 278
+�	 274
+��_	 271
+�_	 269
+,	 266
+�	 266
+��	 261
+��	 258
+,_	 258
+��	 250
+�	 248
+_�	 246
+�	 245
+��	 244
+�_	 243
+_�	 243
+_�	 242
+�	 238
+�	 235
+��	 234
+��_	 234
+��	 234
+_�	 233
+��	 228
+��	 227
+��	 222
+��	 222
+_�	 215
+��	 212
+_�	 210
+�_	 208
+_�	 206
+�_	 206
+�_	 205
+_�	 205
+�_	 204
+�	 198
+��	 198
+��_	 194
+��_	 193
+�	 193
+��_	 193
+��_	 192
+��	 192
+_��	 190
+�_	 189
+��_	 189
+_�	 189
+��	 188
+��	 188
+��_	 188
+_�	 186
+�	 177
+�	 175
+�	 171
+��	 161
+�	 154
+_��	 153
+�	 152
+��	 151
+��	 150
+��	 147
+�	 147
+��	 145
+��	 143
+�	 142
+��	 142
+_�	 141
+��	 140
+�	 139
+�	 138
+�	 138
+�	 137
+��	 136
+�	 134
+��	 134
+_��	 133
+�	 132
+�_	 127
+��	 125
+��_	 123
+��	 122
+��_	 121
+��	 121
+��	 118
+�	 117
+�	 116
+�_	 115
+��	 115
+�_	 115
+�	 114
+ִ	 113
+��	 112
+��	 111
+�	 109
+��	 109
+�	 108
+�	 108
+_�	 108
+��	 107
+��_	 107
+�	 107
+�	 106
+�ִ	 105
+ȸ	 103
+��	 101
+�_	 101
+�	 100
+_�ִ	 100
+õ	 100
+���	 100
+"	 98
+����	 97
+��	 97
+���	 97
+��	 95
+_��	 94
+��	 94
+��	 94
+_��	 94
+�	 94
+��	 94
+��	 92
+��	 92
+_�	 91
+�	 91
+ϰ	 90
+��	 90
+���_	 90
+�	 89
+�	 89
+�_	 89
+�_	 89
+����_	 89
+��	 89
+�	 88
+���	 88
+���	 88
+����	 88
+�	 87
+��_	 87
+��	 85
+_�	 85
+�_	 84
+��	 84
+���	 84
+��	 84
+��	 83
+��	 83
+_��	 82
+�ϰ	 82
+��	 81
+��	 80
+����_	 79
+���_	 79
+��_	 78
+�	 78
+��	 78
+�_	 78
+��	 78
+'	 77
+��	 77
+�	 77
+�	 77
+��	 77
+�_	 76
+��_	 76
+�	 76
+�_	 75
+(	 74
+)	 74
+��	 74
+��	 74
+��	 73
+_��	 72
+_��	 72
+_��	 72
+-	 72
+��	 72
+ִ�	 72
+��	 71
+�ִ�	 71
+��	 70
+��	 70
+��	 70
+��	 69
+��	 69
+��_	 69
+_�ִ�	 69
+_��	 69
+�_	 69
+ߴ	 69
+��	 68
+��	 68
+_�	 68
+_��	 68
+�_	 67
+ü	 67
+��	 66
+_��_	 66
+�ߴ	 66
+��	 65
+�	 65
+_�	 65
+_��	 65
+�ߴ�	 64
+ߴ�	 64
+_��	 63
+��	 62
+�	 62
+ϴ	 62
+��	 62
+��_	 62
+��	 61
+��	 61
+ϰ�	 61
+̴	 60
+��	 60
+�ϰ�	 60
+�	 59
+_��_	 59
+_��	 59
+��	 59
+��	 58
+�_	 58
+_��	 58
+�_	 58
+��	 57
+ߴ�.	 57
+�	 57
+�	 57
+�ߴ�.	 57
+��	 57
+��	 57
+ִ�.	 56
+�_	 56
+�ִ�.	 56
+��	 56
+ߴ�._	 56
+��	 56
+��	 55
+��	 55
+��	 55
+Ʈ	 55
+��	 55
+�̴	 55
+ִ�._	 54
+_��	 54
+��_	 53
+��	 53
+�	 53
+��	 53
+_��	 53
+��	 53
+��	 53
+��_	 53
+��	 53
+��	 52
+_��	 52
+�_	 52
+��	 52
+_��	 51
+���	 51
+��	 51
+��	 51
+ȭ	 51
+�	 50
+_��	 50
+���	 50
+ġ	 50
+ϰ�_	 49
+�ϰ�_	 49
+_��	 49
+�	 49
+�	 49
+_"	 48
+��	 48
+��	 48
+�̴�	 48
+��	 48
+_���	 48
+̴�	 48
+��	 47
+̴�.	 47
+_��	 47
+�̴�.	 47
+��_	 47
+_��	 47
+��	 47
+��	 47
+�_	 46
+��	 46
+�_	 46
+�_	 46
+�	 46
+�ϴ	 46
+_��	 45
+_��	 45
+_��	 45
+��	 45
+��	 45
+��	 45
+̴�._	 45
+��	 44
+��	 44
+��	 44
+��_	 43
+(_	 43
+��	 43
+��	 43
+�_	 43
+��	 42
+��	 42
+�_	 42
+��_	 42
+_��_	 42
+��_	 42
+��	 42
+��	 41
+��	 41
+���	 41
+��	 41
+��	 40
+�õ	 40
+��	 40
+�	 40
+��	 40
+_��	 40
+��	 40
+��	 40
+_��	 40
+��_	 39
+_��	 39
+��	 39
+��	 39
+�_	 39
+_��	 39
+��	 38
+���	 38
+��	 38
+�_	 38
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/estonian.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/estonian.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/estonian.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 20738
+a	 7004
+e	 5699
+i	 5321
+s	 4731
+t	 3769
+l	 3448
+u	 3446
+n	 2902
+k	 2584
+d	 2202
+m	 2043
+a_	 1758
+o	 1684
+r	 1429
+g	 1174
+v	 1151
+e_	 1139
+i_	 1136
+_k	 1136
+s_	 1077
+h	 1009
+,	 995
+,_	 995
+_t	 953
+p	 953
+j	 940
+�	 900
+is	 896
+st	 851
+se	 841
+_s	 822
+.	 821
+as	 801
+d_	 801
+le	 800
+ta	 794
+in	 793
+_m	 790
+�	 754
+._	 753
+t_	 746
+ma	 710
+_p	 680
+si	 677
+_v	 660
+es	 636
+al	 626
+us	 619
+el	 602
+_o	 596
+_e	 586
+ja	 580
+_j	 563
+te	 562
+�	 549
+li	 532
+va	 515
+id	 501
+ol	 498
+tu	 497
+da	 490
+_n	 480
+ku	 478
+ud	 459
+nu	 455
+na	 438
+ei	 432
+ks	 418
+mi	 411
+ee	 411
+u_	 407
+ka	 400
+n_	 394
+b	 394
+ga	 386
+_l	 384
+_a	 380
+an	 366
+ja_	 365
+et	 358
+me	 358
+l_	 350
+at	 348
+la	 341
+ad	 340
+st_	 339
+ne	 336
+ll	 333
+_ta	 332
+ra	 330
+_ja	 328
+ik	 323
+en	 318
+ni	 308
+ul	 305
+sa	 302
+_ol	 302
+nd	 299
+_ja_	 299
+nud	 296
+ii	 291
+ko	 286
+_se	 285
+le_	 283
+aa	 281
+is_	 281
+gi	 270
+_te	 269
+ag	 269
+_va	 268
+_ku	 267
+ed	 262
+em	 255
+_mi	 255
+ma_	 247
+ti	 246
+ri	 245
+_h	 242
+gu	 239
+id_	 238
+ast	 237
+it	 236
+ga_	 236
+un	 232
+de	 230
+ud_	 230
+ha	 230
+ak	 228
+ah	 228
+uu	 228
+il	 227
+�i	 226
+as_	 223
+ke	 222
+ar	 220
+a,	 220
+am	 220
+_ko	 220
+a,_	 220
+_ka	 220
+ai	 220
+eg	 216
+sin	 214
+est	 214
+ui	 214
+he	 214
+ks_	 213
+�	 213
+oo	 213
+ju	 207
+�r	 205
+ut	 203
+in_	 203
+oli	 201
+ki	 199
+su	 199
+es_	 199
+lt	 198
+ist	 188
+li_	 186
+ea	 186
+vi	 184
+im	 181
+mu	 181
+se_	 180
+ts	 180
+on	 178
+ise	 178
+ta_	 177
+ek	 176
+_oli	 176
+sel	 173
+nud_	 173
+_�	 172
+a.	 171
+nn	 170
+ema	 169
+ng	 168
+lu	 168
+ge	 167
+_si	 166
+_ei	 165
+_i	 165
+_ei_	 164
+ei_	 164
+_r	 163
+ole	 161
+pa	 160
+lle	 160
+a._	 160
+ust	 159
+du	 156
+er	 156
+v�	 153
+da_	 153
+min	 152
+et_	 151
+d,_	 149
+_M	 149
+ht	 149
+d,	 149
+M	 149
+kui	 148
+_et	 147
+K	 147
+_K	 146
+pe	 145
+gi_	 145
+_v�	 145
+or	 144
+_tu	 142
+lt_	 141
+_ma	 141
+asi	 140
+ve	 139
+us_	 138
+ig	 136
+sin_	 136
+ur	 135
+_ta_	 134
+di	 134
+_et_	 134
+s,_	 132
+tas	 132
+s,	 132
+_kui	 131
+sk	 131
+re	 130
+po	 129
+oli_	 129
+om	 129
+�i	 128
+inu	 128
+_na	 128
+_oli_	 128
+_sa	 128
+aj	 128
+mis	 127
+ui_	 127
+_me	 127
+_pa	 126
+tus	 125
+pi	 125
+te_	 124
+�l	 123
+-	 123
+est_	 122
+_on	 121
+kk	 121
+tt	 120
+aga	 119
+na_	 119
+_T	 119
+T	 119
+b_	 118
+al_	 118
+sta	 118
+_mu	 116
+_ju	 116
+ida	 116
+aks	 116
+gu_	 116
+_ni	 116
+s.	 116
+ad_	 116
+_pe	 114
+eks	 114
+ev	 114
+end	 113
+s._	 113
+use	 111
+�ra	 111
+_po	 111
+_min	 110
+S	 110
+aja	 110
+_la	 110
+ele	 109
+el_	 108
+on_	 108
+ab	 108
+_S	 108
+av	 107
+ing	 107
+kui_	 106
+_on_	 106
+au	 104
+ne_	 104
+ti_	 104
+ell	 103
+ae	 101
+k�	 101
+ed_	 100
+_ke	 99
+ata	 99
+iis	 99
+!	 98
+!_	 98
+sid	 98
+nda	 98
+eh	 98
+lle_	 97
+pu	 97
+��	 97
+v�i	 97
+ine	 96
+t,	 96
+e,_	 96
+ale	 96
+_v�i	 96
+t,_	 96
+e,	 96
+eda	 96
+uk	 95
+ast_	 95
+ld	 95
+?	 94
+_kui_	 94
+_sel	 93
+_k�	 93
+tul	 93
+ega	 93
+lg	 92
+sii	 92
+val	 92
+e.	 92
+_su	 92
+ug	 92
+oh	 92
+k�	 92
+d.	 91
+ee_	 91
+see	 91
+e._	 91
+��	 91
+oma	 91
+_ole	 90
+ses	 90
+stu	 90
+�t	 90
+��	 90
+_om	 89
+me_	 89
+ot	 89
+d._	 89
+_sii	 88
+to	 88
+_en	 87
+atu	 87
+?_	 87
+A	 86
+J	 86
+pea	 86
+j�	 85
+_A	 85
+_see	 85
+ime	 84
+_pi	 84
+_ha	 84
+m�	 84
+n�	 84
+_J	 84
+les	 84
+ste	 84
+kas	 84
+_�	 84
+v�	 83
+E	 83
+p�	 83
+_ve	 83
+_E	 83
+eis	 82
+_j�	 81
+_pea	 81
+_m�	 80
+um	 80
+_k�	 80
+iku	 80
+�d	 80
+all	 79
+eid	 79
+ba	 79
+_v�	 79
+ina	 78
+lj	 78
+sid_	 78
+hu	 78
+tun	 78
+l�	 78
+_oma	 77
+i,_	 77
+i,	 77
+agu	 77
+uh	 77
+lm	 76
+ras	 76
+ss	 76
+k�	 76
+ees	 76
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/welsh.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/welsh.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/welsh.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 78614
+a	 18113
+d	 17890
+y	 16837
+e	 14108
+n	 13902
+r	 13869
+i	 12928
+o	 9972
+l	 9188
+h	 7454
+g	 7165
+w	 7010
+t	 6296
+f	 6080
+u	 5400
+n_	 5159
+_y	 5051
+dd	 4946
+s	 4884
+r_	 4547
+m	 4364
+d_	 4223
+yn	 4082
+_a	 4020
+c	 3707
+th	 3301
+u_	 2900
+yd	 2900
+ae	 2649
+l_	 2588
+_g	 2547
+.	 2460
+'	 2458
+._	 2408
+wy	 2334
+yn_	 2331
+_d	 2307
+b	 2267
+ym	 2262
+ra	 2261
+an	 2235
+ar	 2228
+ol	 2218
+ia	 2212
+i_	 2199
+ed	 2191
+_yn	 2038
+_i	 2020
+y_	 1983
+_c	 1934
+_yn_	 1861
+ei	 1815
+it	 1796
+g_	 1787
+ith	 1779
+dd_	 1745
+h_	 1741
+ydd	 1731
+ai	 1709
+au	 1708
+'r_	 1655
+'r	 1655
+_y_	 1621
+di	 1615
+,	 1613
+,_	 1608
+da	 1585
+od	 1546
+_o	 1535
+ad	 1532
+th_	 1510
+ll	 1494
+au_	 1492
+_s	 1415
+er	 1359
+o_	 1350
+io	 1311
+a_	 1299
+ol_	 1294
+_e	 1273
+_h	 1249
+cy	 1246
+yr	 1243
+en	 1228
+p	 1217
+_f	 1212
+_cy	 1203
+mr	 1200
+gy	 1193
+ymr	 1185
+ha	 1172
+hy	 1164
+eg	 1159
+do	 1151
+edd	 1147
+G	 1134
+we	 1107
+C	 1089
+_ar	 1078
+_m	 1075
+yf	 1057
+de	 1048
+fe	 1047
+_G	 1045
+ch	 1043
+rae	 1023
+el	 1016
+no	 1010
+ni	 1010
+_b	 1009
+ne	 1001
+ef	 992
+ri	 983
+et	 978
+_C	 957
+_gy	 952
+_a_	 943
+eth	 943
+_.	 940
+_._	 939
+eit	 930
+eith	 927
+ys	 921
+wyd	 912
+ga	 901
+_i_	 893
+s_	 887
+mrae	 878
+mraeg	 878
+raeg	 878
+ymrae	 878
+aeg	 878
+ymra	 878
+mra	 878
+_p	 856
+aet	 850
+aeth	 850
+_n	 844
+un	 838
+on	 836
+ait	 833
+aith	 833
+nn	 830
+at	 827
+oe	 823
+li	 805
+_r	 801
+ddi	 795
+gw	 789
+ma	 783
+le	 777
+nt	 772
+ho	 769
+ff	 766
+yr_	 764
+na	 753
+la	 748
+rh	 747
+eg_	 734
+si	 733
+ng	 732
+dol	 732
+ro	 718
+al	 712
+_dd	 706
+wn	 705
+oed	 705
+Gy	 704
+dy	 701
+Cy	 696
+o'	 692
+ar_	 691
+ny	 690
+Gym	 678
+wr	 677
+id	 676
+_Gy	 672
+_o_	 668
+Gymr	 667
+if	 662
+ith_	 662
+_ar_	 660
+iad	 657
+_w	 657
+fo	 656
+eu	 655
+aeg_	 650
+raeg_	 650
+aith_	 648
+or	 648
+_Gym	 646
+fa	 642
+re	 638
+_Cy	 638
+_Gymr	 635
+_gw	 633
+fy	 633
+oedd	 633
+edd_	 629
+rd	 627
+od_	 622
+ac	 619
+ddo	 612
+an_	 607
+Gymra	 606
+er_	 605
+A	 604
+eth_	 601
+hw	 596
+ydd_	 591
+o'r	 586
+o'r_	 586
+es	 583
+ir	 579
+dw	 573
+go	 559
+yl	 548
+rw	 545
+aeth_	 545
+wydd	 543
+aw	 539
+_rh	 539
+dr	 537
+ly	 537
+fn	 534
+dau	 533
+_hy	 531
+t_	 531
+sg	 529
+'n	 529
+*	 528
+'n_	 523
+_*	 522
+nyd	 521
+nydd	 521
+M	 519
+st	 518
+Y	 516
+sy	 515
+yd_	 513
+lw	 512
+_ga	 508
+iai	 503
+il	 502
+_l	 499
+rt	 494
+ad_	 493
+_yr	 493
+_yr_	 492
+as	 492
+dol_	 492
+f_	 491
+dda	 491
+ig	 490
+og	 484
+wa	 479
+he	 478
+iaith	 477
+iait	 477
+oedd_	 475
+_ma	 473
+c_	 472
+Cym	 470
+te	 469
+_ym	 467
+am	 467
+_M	 465
+_ia	 462
+efn	 462
+i'	 460
+ie	 458
+_Cym	 458
+_ac	 457
+dau_	 456
+yw	 455
+ew	 453
+fr	 441
+fod	 441
+_A	 441
+du	 437
+_sy	 434
+e_	 432
+wi	 426
+Cymr	 426
+se	 425
+B	 424
+D	 424
+_Cymr	 423
+bl	 423
+lu	 420
+in	 417
+_t	 417
+tr	 414
+ac_	 413
+wed	 410
+os	 410
+_iai	 407
+_iait	 407
+el_	 405
+_ac_	 405
+rha	 404
+m_	 404
+is	 403
+on_	 401
+eu_	 393
+hi	 393
+rdd	 393
+id_	 389
+_Y	 388
+ry	 387
+odd	 387
+rwy	 387
+rf	 386
+io_	 380
+ynn	 380
+cyf	 380
+hr	 380
+_cyf	 379
+yddi	 379
+cyn	 372
+_de	 372
+rth	 371
+ru	 368
+S	 363
+wei	 363
+ysg	 362
+_B	 362
+u'	 361
+yddo	 360
+wn_	 360
+so	 359
+dio	 359
+_ei	 358
+N	 356
+dwy	 355
+_da	 353
+me	 353
+gan	 353
+gyf	 353
+w_	 352
+_o'	 351
+fer	 349
+nol	 347
+hyn	 346
+ddy	 346
+af	 346
+ta	 343
+ddol	 343
+_fe	 340
+nd	 340
+mae	 338
+_cyn	 338
+efnyd	 337
+fnydd	 337
+fny	 337
+efny	 337
+fnyd	 337
+iad_	 335
+_mae	 333
+ion	 333
+_ll	 330
+def	 330
+_gyf	 327
+nt_	 326
+i'r_	 326
+-	 326
+i'r	 326
+weith	 325
+weit	 325
+defn	 325
+defny	 325
+bo	 324
+hyd	 323
+by	 322
+_si	 321
+ir_	 321
+hau	 318
+nod	 318
+edi	 315
+I	 314
+fyd	 313
+wyr	 313
+ada	 311
+ddio	 310
+rif	 309
+sia	 307
+sa	 306
+fel	 305
+tha	 305
+_S	 302
+_ne	 302
+_u	 301
+fod_	 300
+_o'r	 300
+yg	 300
+_o'r_	 300
+_i'	 299
+ge	 299
+dia	 299
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/thai.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/thai.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/thai.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 6290
+�	 5252
+�	 4377
+�	 3920
+�	 3050
+�	 2984
+�	 2657
+�	 2522
+�	 2454
+�	 2369
+�	 2304
+�	 2158
+�	 1981
+�	 1908
+�	 1693
+�	 1543
+�	 1443
+�	 1422
+�	 1398
+�	 1398
+�	 1301
+�	 1245
+�	 1239
+�	 1210
+�	 1181
+�	 1081
+�	 1045
+�	 978
+��	 951
+�	 907
+�	 892
+��	 829
+�	 795
+��	 735
+�	 722
+���	 710
+�	 691
+��	 688
+�	 668
+ͧ	 595
+.	 588
+�	 553
+�	 543
+��	 532
+��	 528
+��	 522
+��	 522
+��	 477
+�	 452
+���	 451
+��	 443
+��	 441
+�	 422
+ҧ	 419
+��	 414
+�	 388
+�_	 378
+��	 367
+��	 360
+�	 354
+Ѻ	 349
+�_	 347
+��	 345
+���	 340
+��	 337
+��	 337
+��	 336
+���	 336
+�	 334
+ҹ	 333
+��	 332
+��	 328
+��	 325
+�	 322
+_�	 320
+�	 314
+�	 313
+��	 299
+ѧ	 297
+ҡ	 297
+��	 296
+��	 295
+Ѱ	 293
+�Ѱ	 293
+��	 290
+�	 289
+���	 288
+�	 285
+�	 280
+�	 273
+�	 268
+���	 268
+�	 266
+��	 263
+ѹ	 263
+�	 263
+��	 256
+��	 254
+��	 253
+��	 252
+���	 251
+��	 251
+�	 248
+�	 248
+��	 248
+��	 248
+��	 247
+��	 247
+��	 247
+��	 247
+͡	 245
+��	 245
+��	 244
+�	 244
+��	 243
+��	 241
+_�	 240
+��	 238
+�	 237
+_�	 236
+��	 234
+�	 227
+��	 225
+�	 221
+�	 216
+¡	 214
+ä	 213
+��	 211
+��	 211
+��	 211
+��	 210
+Թ	 209
+��	 206
+��	 202
+��	 202
+˹	 201
+��	 201
+_�	 200
+��	 197
+��	 196
+�_	 193
+��	 191
+��	 191
+��	 188
+��	 188
+��	 186
+�ͧ	 184
+��	 184
+���	 183
+��	 183
+��	 181
+��	 180
+��	 179
+���	 178
+�ҧ	 177
+��_	 176
+�ä	 176
+_�	 176
+����	 174
+��	 174
+���	 174
+���	 174
+Ѵ	 172
+Դ	 172
+���_	 171
+���	 167
+��	 167
+͹	 167
+ҵ	 167
+���	 167
+��ä	 166
+��	 166
+��	 165
+��	 165
+�	 163
+��	 162
+��	 161
+��	 161
+�_	 161
+�_	 154
+��	 154
+��	 154
+�ͧ	 151
+����	 151
+���	 151
+�	 150
+ѡ	 150
+�_	 148
+���	 147
+��	 146
+��	 146
+��	 146
+�_	 146
+�	 145
+��	 140
+�	 139
+�ҡ	 139
+��	 138
+��	 138
+��	 137
+��	 136
+��	 135
+�Ѻ	 134
+�¡	 133
+_�	 132
+��	 132
+��	 132
+��	 131
+�	 130
+��	 129
+ҵ�	 129
+_�	 128
+��	 128
+���	 128
+�Ѻ	 128
+ա	 128
+��	 127
+��	 127
+��	 126
+_��	 126
+�ҵ�	 126
+��	 126
+�ҵ	 126
+��	 126
+��	 126
+_��	 125
+��	 124
+��	 124
+����	 124
+���	 124
+��	 123
+Ҥ	 122
+�	 122
+�	 122
+��	 121
+��	 121
+��	 120
+���	 120
+ҷ	 119
+���	 119
+���	 118
+��	 118
+��	 117
+ǹ	 117
+��	 117
+����	 117
+����	 117
+���	 117
+�����	 117
+��	 116
+��	 116
+_���	 116
+���	 116
+���	 115
+��	 115
+�Ѱ��	 115
+��	 115
+�	 115
+Ѱ�	 115
+�.	 115
+Ѱ���	 115
+�Ѱ�	 115
+����	 115
+Ѱ��	 115
+�����	 115
+��	 115
+_���	 113
+��	 113
+��	 113
+��	 112
+�	 112
+_�	 112
+���	 111
+Ի	 111
+���	 111
+��	 111
+��	 110
+_�	 110
+��	 110
+_�	 110
+Ҩ	 109
+���	 108
+��¡	 108
+_�	 107
+ѭ	 107
+�ҹ	 107
+��	 106
+���	 106
+_�	 106
+����	 105
+��	 105
+Ե	 105
+��	 105
+��	 103
+��	 102
+�_	 102
+���	 102
+��	 102
+��	 102
+��	 101
+�	 100
+���	 100
+��	 100
+_�	 99
+��	 99
+��ͧ	 99
+��	 99
+�_	 98
+Ъ	 98
+��	 98
+����	 98
+¡�	 97
+��	 97
+�_	 97
+��	 97
+Ҫ	 97
+�_	 96
+��	 96
+Ѱ�	 94
+Ҿ	 94
+�Ѱ�	 94
+��	 94
+��	 94
+��	 93
+��	 93
+��	 93
+���	 92
+���	 92
+�.	 92
+Ѱ��	 92
+�ѹ	 92
+Ѱ���	 92
+��	 92
+�Ѱ��	 92
+���	 92
+����	 92
+֧	 92
+.�	 91
+���	 91
+á	 91
+_��	 90
+���	 90
+��.	 90
+��	 90
+����	 90
+���	 90
+���	 89
+.�.	 89
+��ҧ	 89
+��_	 89
+���ҧ	 89
+�ѧ	 89
+��	 89
+���	 88
+ͺ	 88
+_�	 88
+�.�	 87
+�ͧ	 87
+�Ъ	 87
+��	 87
+��	 87
+�ѧ	 87
+��.�.	 87
+�.�.	 87
+���_	 87
+�	 87
+��	 87
+���	 87
+��	 87
+��.�	 87
+��Ъ	 87
+��	 87
+'	 86
+��	 86
+��	 86
+���	 86
+_��.	 86
+�ҧ	 86
+��	 85
+��	 85
+§	 85
+._	 85
+���	 85
+��	 85
+��	 84
+��	 84
+���	 84
+��Ѱ	 84
+��	 84
+��	 84
+���	 84
+_��.�	 84
+��	 83
+��	 83
+���	 83
+����	 83
+ѵ	 82
+����	 82
+��	 82
+�_	 82
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/norwegian.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/norwegian.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/norwegian.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 22970
+e	 6833
+n	 4206
+r	 3516
+t	 3112
+a	 2587
+s	 2440
+i	 2112
+l	 1901
+o	 1900
+n_	 1875
+r_	 1761
+k	 1713
+g	 1630
+en	 1615
+m	 1508
+e_	 1450
+d	 1444
+er	 1436
+h	 1306
+t_	 1300
+_h	 1180
+_s	 1148
+er_	 1105
+v	 982
+en_	 976
+an	 919
+.	 901
+._	 791
+_.	 781
+et	 770
+g_	 762
+_._	 726
+�	 725
+u	 719
+f	 709
+p	 702
+ha	 682
+_ha	 672
+de	 657
+te	 651
+_e	 621
+et_	 614
+re	 581
+ne	 565
+_o	 554
+an_	 544
+ke	 534
+_,	 522
+,_	 522
+,	 522
+_,_	 522
+_f	 519
+_m	 515
+or	 503
+_d	 483
+_i	 480
+�_	 479
+se	 476
+m_	 469
+nn	 454
+b	 449
+me	 441
+�	 434
+_a	 413
+st	 404
+_t	 398
+og	 380
+_v	 377
+_og	 366
+ar	 364
+el	 364
+le	 361
+i_	 356
+om	 353
+og_	 351
+_og_	 351
+li	 350
+_k	 346
+_de	 339
+ge	 339
+han	 337
+y	 333
+_han	 332
+ve	 330
+kk	 323
+in	 311
+_b	 307
+fo	 301
+j	 301
+il	 298
+_H	 291
+H	 291
+han_	 288
+_han_	 288
+for	 287
+ik	 281
+l_	 278
+kke	 277
+tt	 276
+ti	 270
+ne_	 270
+d_	 269
+ed	 269
+om_	 268
+nne	 266
+_me	 264
+ng	 257
+_er	 257
+_fo	 256
+eg	 256
+_se	 256
+_g	 256
+un	 255
+ig	 255
+sk	 253
+_er_	 252
+_p	 252
+_for	 250
+ke_	 249
+_n	 238
+_l	 233
+al	 232
+�r	 222
+s_	 221
+ar_	 215
+at	 214
+_en	 211
+he	 211
+pe	 209
+_i_	 208
+am	 200
+es	 200
+si	 200
+enn	 197
+det	 195
+or_	 193
+vi	 190
+ns	 189
+ikk	 188
+det_	 185
+so	 185
+un_	 183
+il_	 181
+nd	 181
+te_	 181
+"_	 180
+"	 180
+_"_	 180
+_"	 180
+em	 179
+_ti	 176
+kke_	 176
+lig	 174
+ten	 174
+Ha	 173
+_Ha	 173
+re_	 172
+ikke	 168
+je	 165
+Han	 165
+ter	 165
+_Han	 165
+eg_	 164
+p�	 164
+_p�	 163
+_si	 163
+_�	 163
+_Han_	 162
+Han_	 162
+p�_	 162
+_p�_	 161
+til	 160
+som	 160
+_so	 159
+den	 159
+_det	 157
+ed_	 155
+ll	 155
+_ik	 155
+rt	 155
+som_	 153
+ra	 152
+a_	 152
+har	 152
+nt	 152
+de_	 152
+tr	 151
+v_	 151
+_har	 151
+ka	 151
+ig_	 150
+_som	 150
+for_	 150
+_som_	 150
+_en_	 149
+hu	 149
+_ikk	 148
+_ham	 148
+ham	 148
+ste	 148
+_det_	 148
+_ikke	 148
+enne	 148
+ikke_	 148
+har_	 147
+nge	 147
+D	 147
+_har_	 147
+_D	 147
+am_	 147
+ere	 147
+ham_	 146
+_ham_	 146
+it	 145
+_he	 144
+_til	 144
+av	 143
+va	 140
+men	 140
+�r	 140
+_ve	 140
+_hu	 139
+ta	 139
+pen	 137
+sp	 137
+_st	 135
+tte	 135
+la	 135
+_E	 133
+E	 133
+den_	 130
+is	 130
+til_	 128
+_r	 128
+tt_	 128
+�r_	 127
+k_	 124
+_�_	 124
+ri	 124
+_til_	 124
+at_	 123
+ene	 123
+seg	 123
+_av	 123
+med	 122
+_vi	 122
+_seg	 122
+seg_	 121
+_seg_	 121
+_for_	 120
+nne_	 120
+ut	 120
+_u	 119
+mm	 119
+mme	 119
+De	 118
+_De	 118
+_at	 118
+_hun	 117
+hun	 117
+ko	 117
+be	 116
+_at_	 115
+ter_	 115
+pen_	 114
+ker	 113
+hun_	 113
+_hun_	 113
+on	 111
+lig_	 111
+..	 110
+hen	 107
+_med	 107
+rs	 106
+ser	 106
+med_	 105
+_men	 104
+_hen	 104
+_sk	 104
+_med_	 104
+ak	 103
+ans	 103
+ker_	 102
+av_	 101
+_ka	 101
+no	 100
+ver	 100
+ler	 99
+J	 99
+spe	 99
+ten_	 99
+_J	 99
+ene_	 98
+ld	 98
+hv	 98
+_av_	 98
+ger	 97
+ni	 96
+gen	 96
+ie	 95
+ser_	 94
+_et	 94
+spen	 94
+_hv	 94
+men_	 93
+Espe	 92
+Es	 92
+_Esp	 92
+_Es	 92
+_Espe	 92
+Esp	 92
+_al	 92
+Espen	 92
+lle	 89
+rem	 89
+id	 89
+f�	 89
+ei	 88
+inn	 88
+rd	 88
+enne_	 88
+_henn	 87
+henne	 87
+henn	 87
+kt	 86
+spen_	 86
+_om	 86
+ler_	 86
+da	 86
+ett	 86
+itt	 86
+bl	 85
+to	 85
+_Je	 84
+ger_	 84
+Je	 84
+�	 84
+ma	 83
+ing	 83
+�r	 83
+ns_	 83
+eli	 82
+ang	 82
+_be	 82
+s�	 82
+_den	 82
+pp	 81
+rk	 81
+dr	 81
+oe	 81
+ss	 81
+_f�	 80
+ek	 80
+le_	 79
+_no	 79
+kj	 78
+elig	 78
+nes	 78
+nn_	 77
+nk	 77
+fr	 77
+sl	 77
+my	 77
+kan	 77
+s�_	 76
+as	 76
+_om_	 76
+_kan	 75
+_ko	 75
+_bl	 73
+Hu	 73
+nen	 73
+_Hu	 73
+eng	 73
+gj	 73
+rt_	 72
+ge_	 72
+ba	 72
+lv	 71
+rer	 71
+nde	 71
+ls	 70
+lo	 70
+ga	 70
+_noe	 70
+ro	 70
+_den_	 70
+_ut	 70
+noe	 70
+Hun	 69
+Hun_	 69
+_in	 69
+_Hun	 69
+_Hun_	 69
+ren	 68
+�re	 68
+�r_	 68
+sen	 68
+sa	 67
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/armenian.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/armenian.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/armenian.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 49002
+�	 12626
+�	 9480
+�	 8485
+�	 7623
+�	 7071
+�	 7010
+�	 6370
+�	 6320
+�	 5012
+�	 4656
+�	 4607
+�	 4506
+�	 4210
+�	 3775
+��	 3655
+�	 3369
+�	 3320
+�	 3208
+�	 3016
+��	 2832
+��	 2755
+�	 2552
+�	 2519
+,	 2502
+,_	 2492
+�_	 2177
+��	 2099
+�	 2034
+�	 2007
+�	 1918
+��	 1748
+��	 1703
+�	 1605
+�_	 1587
+�	 1558
+�	 1528
+ϳ	 1502
+:	 1483
+:_	 1482
+�	 1420
+_�	 1403
+�_	 1382
+�_	 1335
+�	 1307
+�	 1294
+ݻ	 1281
+�	 1274
+�	 1264
+��	 1229
+�	 1218
+��	 1184
+�	 1170
+��	 1154
+_�	 1139
+��	 1130
+_�	 1121
+�	 1085
+	 1065
+_�	 1046
+_�	 1036
+��	 1019
+�	 1017
+��	 1001
+���	 993
+��	 987
+�_	 964
+��	 962
+_�	 961
+�	 952
+ٳ	 951
+�_	 945
+�	 941
+�	 938
+ѳ	 934
+�	 929
+ݻ�	 919
+��	 918
+�	 915
+�_	 911
+��	 910
+ݳ	 910
+��_	 882
+��	 863
+��	 846
+�	 834
+��	 827
+��	 824
+�	 818
+��	 817
+��	 804
+���	 804
+_�	 791
+���	 787
+����	 787
+�	 781
+��	 753
+_�	 750
+�_	 748
+_�	 747
+�	 747
+���	 744
+_�	 732
+��	 730
+��	 723
+�	 710
+�_	 710
+��	 709
+_ѳ	 708
+_�	 705
+�	 703
+�	 702
+��	 697
+�	 695
+�_	 684
+_�	 683
+��	 682
+�	 672
+�ϳ	 671
+��	 669
+��	 666
+�	 659
+�	 659
+�	 658
+��	 658
+�	 653
+��	 649
+�	 641
+��	 641
+�	 640
+���	 636
+��	 635
+��	 631
+_�	 626
+��	 623
+۳	 620
+�_	 616
+_�	 615
+��_	 614
+���_	 613
+��	 601
+ϳ�	 597
+��	 596
+��_	 590
+��	 590
+��	 582
+�_	 581
+���	 576
+��	 574
+��	 574
+�	 566
+�	 564
+�	 555
+_�	 532
+��	 527
+��	 527
+��	 526
+�_	 524
+���	 517
+_�	 511
+�	 510
+_�	 507
+��	 500
+��	 500
+����	 497
+�	 496
+�	 488
+�	 485
+��	 480
+_��	 480
+�_	 478
+��_	 477
+��	 476
+���	 475
+����	 475
+�ϳ�	 473
+_�	 469
+�_	 466
+�	 465
+���	 465
+�����	 464
+_�	 463
+����	 459
+�����	 459
+�����	 459
+���	 454
+�	 449
+_��	 449
+�	 444
+_��	 442
+�_	 431
+ٻ	 428
+�_	 427
+_ϳ	 422
+���	 422
+���	 421
+��_	 416
+��	 416
+_��	 415
+��	 414
+_�	 413
+�	 408
+���	 405
+����	 405
+��_	 404
+����	 400
+󑩯	 399
+�󑩯	 399
+󑩯�	 399
+��_	 398
+�_	 395
+۳�	 394
+��_	 387
+-	 385
+���	 383
+���	 382
+��	 380
+�_	 379
+�	 377
+���	 377
+�_	 377
+��	 376
+ݻ��	 374
+��	 371
+���	 371
+��_	 371
+_�	 371
+�	 370
+�	 368
+�	 367
+_�_	 366
+��	 363
+��	 361
+�	 358
+.	 357
+��	 356
+_�	 351
+�	 347
+_��	 345
+�۳	 342
+��	 341
+_�	 341
+_�	 340
+ϳ�_	 339
+��	 338
+_�	 337
+�_	 331
+��_	 330
+��۳	 328
+���۳	 328
+��	 328
+��	 327
+��_	 324
+_��	 324
+��	 324
+_��_	 322
+��	 321
+���_	 321
+_ٻ	 318
+��	 317
+��	 317
+ٳ�	 316
+_�	 314
+��	 314
+�	 309
+_��	 309
+�ϳ�_	 307
+��	 306
+��	 306
+_�	 303
+��	 302
+��	 302
+��	 302
+��	 300
+��	 299
+�۳�	 299
+���	 299
+_��	 299
+_�_	 299
+��	 298
+����	 298
+�	 297
+��_	 294
+_��	 293
+_�	 292
+��	 291
+��	 291
+��۳�	 288
+��	 288
+��	 287
+��_	 286
+_�	 286
+�	 284
+�	 284
+��	 284
+˳	 283
+�	 283
+��_	 281
+��_	 281
+۳�_	 281
+`	 280
+��	 279
+`_	 279
+��	 279
+�ٳ	 278
+��_	 274
+��	 271
+�	 268
+_ٳ	 266
+��	 266
+��	 266
+��	 266
+ݻ��_	 266
+�	 264
+�,	 263
+��	 263
+�_	 262
+�	 262
+�,_	 262
+��	 259
+��	 258
+_�	 258
+ϻ	 257
+���	 257
+�_	 255
+��	 255
+_�	 255
+_��_	 255
+�	 255
+��	 253
+�ݻ	 252
+��_	 252
+��	 250
+��	 248
+�ݻ�	 248
+_��_	 247
+ݹ	 246
+��_	 246
+��	 245
+��	 244
+��	 244
+���	 244
+���	 244
+��	 243
+�۳�_	 243
+󑩁	 242
+�󑩁	 242
+��	 241
+��	 239
+��	 238
+�_	 238
+�ݳ	 237
+��	 237
+��	 237
+��	 237
+_�	 236
+����	 234
+��	 234
+���_	 233
+�_	 233
+ٳ�	 233
+�	 232
+����	 232
+���	 231
+�	 230
+��	 230
+���	 230
+_��	 228
+���	 228
+��	 228
+û	 227
+���	 227
+_��	 226
+ݳ�	 223
+����_	 223
+_-	 222
+��	 222
+��_	 222
+��	 220
+_�	 220
+_��	 218
+ϳ�	 217
+����	 216
+_�	 216
+���	 216
+�	 215
+�	 215
+󑩁�	 214
+��	 214
+_��	 213
+�	 213
+��	 213
+��	 212
+ѳ�	 211
+�	 210
+��	 210
+_��_	 210
+_��	 209
+��	 209
+_��_	 208
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/georgian.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/georgian.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/georgian.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 14926
+�	 7221
+�	 5780
+�	 4137
+�	 2966
+�	 2908
+�	 2607
+�	 2372
+�	 2260
+�	 2080
+�	 2078
+�	 2005
+�	 1598
+�	 1383
+�	 1363
+�_	 1248
+�_	 1149
+�	 1145
+��	 1009
+�	 974
+_�	 965
+�_	 964
+��	 912
+��	 901
+��	 897
+�	 820
+.	 813
+��	 767
+"	 762
+._	 735
+,	 720
+,_	 718
+��	 684
+_�	 669
+�	 653
+��	 631
+��	 622
+��	 575
+��	 570
+��	 567
+�	 551
+_�	 550
+�	 542
+_�	 526
+�	 518
+��	 517
+��	 485
+��	 479
+��	 478
+_�	 474
+��	 468
+_�	 436
+��	 435
+��	 420
+��	 419
+��	 418
+��	 416
+��	 412
+��_	 407
+_��	 404
+��_	 393
+��	 384
+��	 382
+�	 376
+_"	 374
+��_	 371
+�	 369
+��	 364
+��	 360
+��	 358
+��	 353
+��	 349
+�	 349
+��	 342
+�	 341
+��	 335
+��	 334
+��	 332
+��	 326
+_�	 322
+��	 321
+��	 319
+_�	 319
+_�	 319
+��	 317
+_��	 316
+��	 316
+��	 306
+�_	 299
+_�	 288
+��	 279
+���	 273
+��	 271
+�	 270
+�_	 267
+��	 267
+_��	 266
+��	 263
+��	 260
+�_	 256
+���	 255
+��	 238
+��	 238
+��	 234
+��	 233
+��	 230
+��	 229
+_�	 227
+"_	 225
+���	 224
+:	 224
+:_	 223
+�.	 221
+_��_	 217
+�	 215
+��	 213
+�,	 213
+�,_	 212
+_�	 211
+�_	 209
+_��	 208
+���	 208
+��	 206
+_��	 204
+��	 203
+���	 203
+��	 203
+�._	 201
+�.	 200
+-	 193
+��	 192
+���	 192
+�_	 189
+��	 188
+�	 188
+��	 187
+�_	 185
+���	 183
+��	 179
+�._	 177
+�_	 177
+��	 174
+��	 174
+��	 173
+��	 172
+_��	 172
+��	 172
+���	 171
+_��	 170
+��_	 170
+_��	 170
+_�	 169
+��	 166
+��	 166
+_�	 165
+��_	 165
+��_	 163
+��	 162
+_��	 160
+��	 158
+_�	 155
+��	 154
+���	 153
+�	 151
+�_	 149
+���	 148
+�,_	 147
+�,	 147
+��	 147
+��	 145
+����	 145
+��	 143
+���	 143
+��	 143
+���	 142
+��	 142
+���	 141
+��	 140
+��	 139
+���_	 139
+��	 139
+��	 138
+_�	 136
+��_	 135
+���	 133
+��_	 132
+���	 131
+��	 130
+��	 130
+��	 130
+���	 128
+��	 125
+��	 125
+��	 125
+�_	 124
+���	 124
+��_	 124
+���	 123
+_��	 123
+���	 122
+_��	 121
+��	 121
+_�	 120
+��	 120
+��	 116
+_�	 114
+���	 113
+���	 113
+���	 113
+��	 112
+��	 112
+��	 112
+��	 112
+���	 111
+��	 111
+��	 109
+��	 109
+��	 107
+��_	 107
+��_	 107
+���	 107
+���_	 106
+��	 106
+��_	 106
+_��	 105
+�	 104
+���	 104
+_��	 104
+���	 103
+_��	 103
+���	 103
+���	 103
+_�	 103
+��	 102
+_�	 102
+���	 102
+���	 102
+��	 102
+_���	 101
+_���	 101
+��	 100
+_����	 100
+���	 99
+��	 99
+��	 99
+��	 99
+��	 97
+��	 97
+���	 96
+��	 94
+��	 94
+_��	 94
+�,_	 93
+��	 93
+��	 93
+_��	 93
+�,	 93
+_��	 93
+��	 93
+��	 92
+���	 92
+��_	 92
+��	 91
+���	 91
+��	 91
+��	 90
+��_	 90
+���	 89
+����	 89
+��	 89
+���	 89
+���	 89
+��	 89
+�"	 89
+�.	 88
+��	 88
+���	 88
+��_	 87
+_���	 87
+��	 87
+���	 87
+���	 87
+��	 87
+���	 87
+���	 85
+��_	 85
+���	 85
+��	 85
+��	 85
+_�	 84
+��.	 84
+_��	 83
+�._	 83
+_�	 83
+_���	 83
+���	 83
+��._	 82
+���	 82
+��_	 82
+���	 82
+��	 81
+��_	 81
+"�	 81
+��	 80
+_"�	 80
+���	 80
+_��_	 79
+_��	 79
+��	 79
+��	 79
+����	 79
+��_	 79
+���	 79
+���	 78
+��,	 78
+��	 78
+��	 78
+����	 78
+���	 78
+��,_	 78
+���	 78
+��	 78
+_��_	 77
+��	 77
+��	 77
+�����	 77
+_��	 77
+���	 77
+���	 77
+����	 77
+��	 76
+��_	 75
+_��	 75
+��	 75
+��	 75
+��_	 75
+���	 75
+����	 74
+����	 74
+�����	 74
+���_	 74
+��	 73
+��	 73
+��	 73
+��	 73
+��	 73
+�����	 73
+��	 73
+���	 72
+��	 72
+_�	 72
+��	 71
+��_	 71
+��	 71
+��	 71
+��	 71
+���	 71
+�����	 71
+���	 70
+��_	 70
+��	 69
+��_	 69
+��	 69
+_���	 67
+�	 67
+���	 67
+���	 67
+���	 67
+�����	 67
+��	 67
+����	 66
+_����	 66
+��	 66
+���	 66
+����	 66
+���	 66
+����	 66
+_���	 66
+���	 65
+��	 65
+���	 65
+��	 65
+���_	 65
+���	 65
+��	 65
+_��	 64
+�_	 63
+��	 63
+",	 63
+��	 63
+���	 63
+��	 63
+��	 63
+��	 62
+�"	 62
+���	 62
+?	 62
+",_	 62
+!	 62
+_��	 62
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/quechua.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/quechua.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/quechua.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 5766
+a	 4900
+n	 1941
+i	 1666
+u	 1384
+s	 1032
+t	 995
+y	 939
+h	 929
+k	 915
+q	 909
+p	 882
+a_	 847
+an	 821
+r	 783
+m	 740
+c	 705
+l	 695
+ta	 637
+ch	 613
+ay	 587
+qa	 557
+pa	 490
+ha	 486
+e	 474
+ma	 457
+o	 441
+na	 434
+ku	 411
+j	 409
+un	 367
+w	 358
+in	 353
+,	 345
+,_	 344
+cha	 318
+ar	 317
+n_	 315
+as	 291
+wa	 289
+ta_	 269
+ll	 259
+man	 255
+_k	 248
+._	 243
+.	 243
+nt	 227
+am	 224
+pi	 222
+la	 222
+ka	 217
+ac	 214
+ni	 214
+at	 213
+aq	 213
+i_	 208
+ri	 207
+qa_	 204
+una	 204
+y_	 192
+aj	 192
+_p	 192
+is	 188
+_m	 181
+lla	 175
+ach	 174
+rq	 173
+us	 172
+an_	 171
+_ka	 171
+ata	 169
+rqa	 165
+sq	 163
+hu	 162
+sp	 161
+_w	 157
+nk	 157
+hay	 157
+_s	 156
+sqa	 155
+ki	 153
+kun	 152
+_c	 152
+al	 150
+nta	 149
+ap	 147
+ant	 146
+yk	 146
+ay_	 144
+spa	 141
+hi	 137
+_ch	 136
+_n	 136
+ya	 135
+'	 134
+j_	 133
+uy	 132
+ra	 132
+a,_	 132
+a,	 132
+ti	 130
+_a	 125
+nc	 125
+kuna	 122
+s_	 121
+su	 121
+ak	 121
+_ma	 118
+ana	 118
+ari	 115
+_t	 114
+ama	 114
+chi	 114
+�	 113
+a._	 111
+a.	 111
+nch	 111
+iy	 111
+all	 110
+aw	 110
+_r	 110
+anta	 109
+ayk	 109
+na_	 109
+chay	 108
+sa	 104
+_wa	 104
+si	 103
+chu	 102
+pa_	 101
+acha	 101
+_cha	 101
+pi_	 101
+qan	 100
+_pa	 99
+_q	 97
+aj_	 97
+awa	 97
+ank	 95
+nku	 95
+im	 94
+q_	 92
+uk	 92
+C	 92
+mu	 90
+tu	 89
+J	 89
+_ni	 88
+taj	 87
+_J	 87
+nin	 86
+_chay	 86
+u_	 86
+_C	 84
+wan	 83
+nta_	 81
+_j	 81
+mant	 80
+ut	 79
+in_	 79
+ik	 79
+manta	 79
+asq	 79
+yt	 78
+n,	 78
+asqa	 78
+n,_	 78
+pay	 78
+li	 77
+yn	 77
+nq	 76
+yta	 76
+ic	 76
+up	 76
+_Ch	 75
+yku	 75
+Ch	 75
+he	 75
+hay_	 74
+nan	 74
+ina	 74
+ur	 73
+er	 72
+S	 72
+arq	 72
+or	 72
+_l	 71
+_u	 71
+aq_	 70
+os	 70
+yp	 70
+anc	 69
+man_	 69
+mi	 69
+ich	 68
+_i	 68
+st	 67
+_S	 67
+arqa	 66
+it	 66
+anch	 66
+ru	 66
+aku	 65
+pu	 65
+�a	 65
+alla	 64
+mp	 64
+sqa_	 64
+'a	 64
+ayku	 63
+es	 63
+A	 63
+ia	 63
+_man	 63
+_Cha	 61
+Cha	 61
+taj_	 60
+api	 60
+_ll	 60
+wi	 60
+ayp	 60
+aman	 59
+g	 58
+anku	 58
+yki	 57
+ima	 57
+yni	 57
+oj	 57
+mana	 57
+anta_	 57
+_su	 57
+uc	 56
+isp	 56
+ispa	 56
+uch	 56
+M	 56
+ir	 56
+_h	 55
+nqa	 55
+kuy	 55
+ayt	 54
+_M	 54
+b	 54
+_y	 53
+_mana	 53
+:	 53
+uku	 53
+:_	 53
+nm	 53
+au	 52
+ayta	 52
+io	 52
+qo	 51
+an,_	 51
+apa	 51
+spa_	 51
+erq	 51
+_wi	 51
+erqa	 51
+_sa	 51
+an,	 51
+el	 50
+um	 50
+ana_	 50
+han	 50
+il	 50
+on	 49
+chay_	 49
+sta	 49
+_D	 49
+D	 49
+iku	 49
+aqa	 49
+che	 48
+en	 48
+yta_	 48
+Ma	 47
+P	 47
+_lla	 47
+_Je	 47
+yq	 47
+Je	 47
+ita	 47
+rqan	 47
+ypi	 46
+har	 46
+Jes	 46
+_Jes	 46
+ios	 46
+ayq	 46
+Dio	 46
+un_	 46
+kus	 46
+_Dio	 46
+taq	 46
+_Dios	 46
+_Ma	 46
+_Di	 46
+Dios	 46
+Di	 46
+d	 46
+kan	 45
+Chay	 45
+oq	 45
+_Chay	 45
+_pay	 45
+upa	 45
+mun	 45
+ata_	 44
+_tu	 44
+nis	 44
+re	 44
+paq	 44
+yo	 44
+ej	 44
+qay	 43
+ncha	 43
+ha_	 43
+_A	 43
+I	 43
+_kan	 43
+_nis	 43
+_P	 43
+nman	 43
+nma	 43
+ataj	 42
+ara	 42
+ku_	 42
+nata	 42
+nat	 42
+i,	 41
+tin	 41
+qh	 41
+t'	 41
+orq	 41
+nki	 41
+_ru	 41
+_ku	 41
+i,_	 41
+ip	 40
+ham	 40
+usq	 40
+_ya	 40
+qank	 39
+orqa	 39
+ayn	 39
+mana_	 39
+ray	 39
+ym	 39
+uma	 39
+_pu	 39
+par	 39
+kay	 39
+n.	 38
+qa,_	 38
+n._	 38
+sus	 38
+aypi	 38
+usqa	 38
+qanku	 38
+ill	 38
+qa,	 38
+was	 38
+pa,	 38
+pa,_	 38
+asp	 38
+qa._	 37
+_mu	 37
+paj	 37
+amp	 37
+hin	 37
+uti	 37
+rin	 37
+_im	 37
+_ima	 37
+ja	 37
+_ri	 37
+rqa_	 37
+taq_	 37
+qa.	 37
+sh	 36
+spa,_	 36
+cha_	 36
+spa,	 36
+achi	 36
+una_	 36
+rqank	 36
+jt	 36
+K	 36
+amu	 36
+aspa	 35
+_Jesu	 35
+Jesus	 35
+nispa	 35
+ki_	 35
+waw	 35
+ko	 35
+ne	 35
+esus	 35
+int	 35
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/belarus-windows1251.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/belarus-windows1251.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/belarus-windows1251.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 9440
+�	 4377
+�	 1855
+i	 1544
+�	 1436
+�	 1345
+�	 1246
+�	 1233
+�	 1215
+�	 1093
+�	 1090
+�	 1050
+�	 934
+�	 860
+�	 811
+�	 792
+�_	 740
+�	 724
+�	 699
+�	 643
+��	 589
+�	 580
+�	 531
+.	 480
+��	 467
+��	 458
+�_	 432
+i_	 430
+._	 418
+,	 402
+,_	 402
+�	 391
+��	 373
+��	 361
+�	 350
+��	 340
+�	 335
+��	 330
+�	 329
+_�	 328
+��	 315
+��	 307
+�_	 306
+_�	 305
+�_	 296
+��	 279
+�	 279
+_�	 274
+��	 271
+�	 269
+��	 250
+�_	 247
+�	 244
+_�	 240
+_�	 236
+_�	 221
+��	 221
+��	 220
+�i	 218
+��	 210
+��	 203
+_�	 199
+��	 197
+��	 195
+_�_	 194
+��	 193
+�i	 193
+��	 192
+_�	 190
+�i	 190
+_i	 189
+��	 187
+��	 185
+_�	 179
+�_	 178
+��	 176
+��	 174
+�	 171
+_��	 169
+��	 167
+_�	 166
+��_	 166
+��	 162
+_�	 161
+��	 160
+i�	 158
+�_	 154
+�	 154
+��	 154
+��	 151
+��	 151
+_�	 149
+i�	 148
+��	 147
+��	 146
+��	 145
+��	 142
+��	 141
+��	 140
+_i_	 140
+�_	 140
+"	 137
+��	 135
+��	 135
+��	 131
+��	 129
+_��	 129
+�_	 126
+���	 126
+��	 125
+��	 125
+��	 123
+_�	 122
+��	 122
+��_	 121
+���	 120
+_��	 120
+��	 120
+���	 119
+�	 119
+��	 116
+-	 113
+��	 112
+��	 112
+��	 112
+��_	 111
+��	 109
+��	 109
+_�	 107
+�i	 106
+���_	 105
+��	 103
+��_	 102
+�	 101
+_��	 100
+_�	 100
+_�	 99
+��	 99
+��	 98
+��	 96
+�	 95
+��	 94
+��	 94
+�i	 92
+��	 92
+�_	 91
+���	 91
+��	 91
+��	 91
+��	 91
+���	 90
+��	 88
+��	 88
+��_	 87
+���	 87
+�_	 87
+_�	 86
+��	 84
+��	 84
+i��	 83
+��	 83
+��	 83
+��	 83
+��	 82
+���	 81
+_��	 79
+��	 79
+��	 79
+��	 79
+��	 79
+��	 79
+_�_	 78
+�i_	 78
+��_	 78
+���	 77
+�i_	 75
+��	 74
+_��	 74
+i�	 74
+��	 73
+���	 73
+���	 72
+���	 72
+���	 72
+��	 72
+�	 71
+��	 71
+��	 71
+���	 71
+��_	 70
+��	 70
+���	 70
+_��_	 70
+��i	 69
+i�	 68
+�	 68
+�.	 68
+��	 68
+��	 68
+_��	 68
+��_	 67
+��_	 67
+���	 67
+���	 67
+��	 67
+_"	 67
+��	 67
+i,	 67
+�._	 67
+����	 67
+i,_	 67
+�����	 66
+�i	 66
+��	 66
+���	 66
+�����	 66
+����	 66
+��	 66
+����	 66
+_�	 65
+���	 65
+��	 65
+�	 65
+_��	 65
+��_	 65
+�	 64
+_�	 64
+���	 64
+���	 64
+_��	 64
+��	 63
+��	 63
+��	 63
+��	 62
+���	 62
+_�	 62
+�i	 62
+��	 62
+��_	 62
+��	 62
+i�	 62
+���	 62
+��	 61
+�,	 61
+��	 61
+_�	 61
+�,_	 61
+��	 61
+���	 60
+i�	 60
+�_	 60
+��_	 60
+I	 59
+��	 59
+����	 59
+_I	 59
+_�	 59
+��	 59
+�	 59
+_���	 59
+��	 59
+���	 59
+i�	 59
+��_	 59
+�.	 59
+_��	 58
+�._	 58
+�_	 57
+��	 57
+��	 57
+�i	 57
+��_	 57
+��	 57
+��	 56
+����	 56
+���	 56
+�i	 56
+��	 56
+���_	 55
+_��	 55
+����_	 54
+��	 54
+���_	 54
+��	 53
+��	 53
+�i	 53
+��	 53
+��	 53
+��	 53
+i�	 53
+�	 53
+��	 53
+_�i	 52
+_��	 52
+��	 52
+���	 51
+���	 51
+��	 51
+��	 50
+�,_	 50
+�,_	 50
+���	 50
+���	 50
+_�	 50
+�,	 50
+�,	 50
+���	 50
+��_	 50
+_�	 50
+��	 49
+��	 49
+i�	 49
+���	 49
+�_	 49
+�_	 48
+����	 48
+_�	 48
+_�	 47
+��	 47
+��	 47
+�i	 47
+_.	 47
+��	 47
+��	 47
+�i�	 46
+���	 46
+���	 46
+_._	 46
+��	 46
+��_	 46
+��	 46
+_��	 46
+��	 45
+��_	 45
+��	 45
+_-	 45
+_��	 45
+��_	 45
+�	 45
+_��	 45
+i�	 44
+_�	 44
+_���	 44
+����	 44
+�i�	 44
+��_	 44
+���	 43
+��	 43
+���	 43
+��	 43
+_��	 43
+��	 43
+�_	 43
+��	 43
+i�_	 42
+���_	 42
+��	 42
+���	 42
+���	 42
+���	 42
+����	 42
+..	 42
+_���	 42
+_����	 42
+���	 42
+���	 42
+��	 41
+_��	 41
+��	 41
+���	 41
+��	 41
+���	 41
+��	 41
+��	 41
+���	 40
+����	 40
+��_	 40
+�.	 40
+i���	 40
+�i	 40
+_��	 40
+���	 40
+�	 40
+"_	 40
+(	 40
+_�	 40
+��	 40
+���	 40
+�	 40
+��_	 40
+i��	 40
+_��	 40
+_(	 40
+���	 40
+��	 40
+)	 40
+���	 40
+��_	 39
+��i	 39
+_�	 39
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/finnish.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/finnish.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/finnish.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 19984
+a	 9133
+i	 8384
+t	 7797
+e	 6481
+n	 6431
+s	 5897
+l	 4504
+o	 4163
+u	 4106
+k	 4013
+�	 3354
+n_	 2868
+m	 2569
+a_	 1987
+v	 1905
+r	 1827
+ta	 1580
+en	 1553
+is	 1515
+h	 1508
+y	 1462
+st	 1390
+in	 1375
+p	 1342
+j	 1333
+an	 1139
+si	 1073
+tt	 1030
+te	 1008
+en_	 982
+_k	 980
+it	 974
+ll	 947
+aa	 942
+�_	 902
+va	 878
+el	 855
+_t	 851
+ka	 846
+i_	 835
+.	 832
+se	 818
+li	 806
+t�	 804
+oi	 767
+ai	 744
+._	 739
+tu	 734
+_o	 719
+mi	 715
+al	 703
+on	 684
+d	 681
+_v	 662
+et	 654
+_j	 641
+t_	 635
+ti	 632
+_m	 628
+_s	 620
+ja	 616
+ma	 596
+sa	 595
+la	 582
+ist	 575
+_e	 565
+to	 565
+ks	 557
+in_	 554
+es	 551
+il	 538
+an_	 536
+ki	 527
+,	 525
+ku	 525
+,_	 524
+us	 520
+as	 514
+nt	 512
+ri	 495
+ke	 494
+at	 491
+_p	 485
+le	 484
+ik	 483
+ss	 477
+ut	 469
+�	 469
+sta	 460
+ee	 459
+uu	 458
+ol	 457
+ta_	 451
+ne	 445
+��	 445
+ei	 443
+uo	 436
+ko	 433
+un	 430
+lu	 421
+ii	 420
+e_	 418
+nn	 413
+_h	 412
+ar	 408
+er	 402
+�n	 396
+ja_	 386
+im	 381
+on_	 365
+_va	 363
+aan	 354
+_a	 352
+me	 350
+ak	 345
+ssa	 331
+na	 330
+ie	 329
+pa	 327
+_ja	 326
+ia	 325
+t�_	 322
+_l	 319
+vi	 317
+ise	 316
+tta	 315
+de	 314
+os	 312
+lli	 309
+_ja_	 304
+jo	 295
+v�	 290
+su	 289
+au	 287
+lis	 286
+_on	 285
+s�	 284
+uk	 280
+am	 280
+ot	 280
+ty	 275
+ett	 271
+tt�	 270
+ni	 269
+l�	 267
+ksi	 264
+nk	 264
+ht	 263
+ul	 261
+ell	 261
+sa_	 259
+ha	 257
+sen	 257
+a.	 254
+isi	 253
+ste	 253
+aan_	 252
+_on_	 252
+_ka	 252
+sk	 251
+kk	 246
+itt	 245
+ok	 242
+a._	 239
+all	 239
+yt	 239
+m�	 237
+mu	 237
+av	 237
+_y	 236
+lla	 233
+taa	 231
+ais	 231
+een	 230
+K	 230
+lt	 228
+s_	 227
+ast	 227
+iv	 226
+ssa_	 225
+ra	 225
+-	 223
+kse	 223
+oit	 220
+om	 220
+T	 219
+_ku	 218
+�n_	 216
+aa_	 214
+at_	 214
+tel	 211
+ui	 210
+si_	 208
+rk	 207
+sta_	 207
+_jo	 203
+k�	 202
+_K	 201
+est	 200
+em	 200
+he	 199
+_n	 199
+vo	 198
+_ta	 196
+eh	 196
+_ol	 196
+S	 196
+nta	 196
+_ko	 194
+je	 194
+st�	 194
+�r	 193
+ust	 191
+mis	 191
+ns	 190
+pu	 189
+nen	 188
+�t	 188
+toi	 188
+iin	 187
+ten	 187
+min	 186
+ista	 185
+hd	 184
+a,	 184
+a,_	 184
+sen_	 183
+E	 182
+lle	 181
+vat	 179
+ill	 177
+no	 176
+p�	 176
+lm	 176
+llis	 175
+n.	 175
+io	 172
+ine	 171
+n._	 170
+pi	 169
+uks	 168
+ava	 168
+��n	 166
+nen_	 165
+ah	 165
+_mu	 164
+tus	 163
+mm	 162
+_to	 162
+ek	 160
+int	 159
+_r	 159
+lin	 158
+oim	 158
+_T	 158
+A	 158
+imi	 157
+t�	 157
+la_	 157
+j�	 157
+aj	 156
+yh	 155
+o_	 154
+lo	 154
+oli	 153
+een_	 153
+le_	 153
+_si	 153
+g	 152
+aik	 151
+vat_	 150
+L	 149
+ur	 149
+ti_	 149
+sia	 148
+ite	 147
+inen	 147
+ain	 146
+sti	 146
+lla_	 146
+ys	 145
+_mi	 145
+val	 144
+stu	 144
+�m	 144
+alli	 143
+pe	 143
+utt	 142
+et_	 141
+_tu	 141
+eri	 140
+_E	 140
+:	 140
+nki	 139
+ir	 139
+ll�	 138
+up	 138
+�i	 137
+ama	 137
+_ha	 135
+id	 135
+_se	 135
+po	 134
+inen_	 134
+tte	 133
+nna	 133
+ten_	 132
+or	 132
+ts	 131
+n�	 131
+yk	 131
+�s	 131
+_S	 130
+ses	 130
+ve	 130
+ess	 129
+�l	 129
+ita	 129
+lai	 129
+H	 129
+van	 127
+�k	 127
+kin	 127
+N	 127
+_te	 126
+den	 126
+tee	 126
+P	 126
+kaa	 126
+iin_	 125
+kun	 125
+ois	 125
+sit	 125
+oh	 124
+V	 124
+y�	 124
+�v	 124
+tav	 124
+voi	 124
+ia_	 123
+I	 123
+oll	 123
+maa	 122
+ih	 122
+oj	 122
+rj	 121
+ro	 121
+ikk	 120
+so	 120
+oo	 120
+oimi	 120
+do	 120
+pp	 119
+M	 119
+_ei	 118
+toim	 118
+op	 118
+uut	 118
+tet	 118
+_i	 118
+_ma	 117
+vai	 117
+l�_	 116
+u_	 116
+sy	 116
+kau	 116
+utta	 116
+un_	 115
+eu	 115
+ss�	 115
+tti	 115
+_sa	 115
+mp	 114
+eis	 114
+ka_	 112
+ett�	 112
+taa_	 111
+_et	 111
+hu	 111
+itu	 111
+suu	 111
+den_	 111
+ksen	 110
+ap	 110
+_ke	 110
+uv	 110
+tam	 110
+yv	 109
+aup	 109
+st�_	 109
+asta	 109
+�y	 109
+kan	 108
+nu	 108
+ukse	 108
+_toi	 107
+ien	 107
+hi	 107
+iss	 107
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/slovak-windows1250.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/slovak-windows1250.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/slovak-windows1250.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 8202
+o	 2145
+a	 1912
+e	 1763
+i	 1491
+n	 1415
+r	 1256
+t	 1127
+v	 1080
+s	 1004
+k	 824
+d	 739
+p	 739
+l	 735
+m	 685
+c	 620
+u	 597
+h	 531
+a_	 467
+j	 449
+_p	 445
+z	 439
+e_	 412
+�	 402
+_v	 369
+.	 361
+_s	 359
+ov	 330
+b	 327
+st	 312
+y	 309
+pr	 307
+._	 300
+o_	 297
+�	 278
+,	 268
+,_	 260
+to	 258
+�	 256
+_a	 254
+�	 253
+i_	 252
+_pr	 246
+ch	 242
+re	 233
+_z	 223
+ra	 220
+_n	 217
+ne	 214
+ie	 214
+po	 214
+en	 208
+ro	 205
+or	 204
+�	 199
+u_	 197
+an	 197
+ko	 194
+na	 189
+ni	 187
+va	 183
+�	 182
+�	 180
+os	 179
+v_	 176
+�	 173
+_o	 171
+ho	 170
+ia	 168
+no	 166
+li	 166
+h_	 166
+ed	 164
+j_	 161
+om	 160
+_k	 160
+�	 158
+ch_	 158
+ti	 155
+y_	 148
+m_	 147
+ej	 147
+_po	 145
+ci	 145
+_d	 140
+�_	 139
+do	 138
+_t	 137
+_m	 134
+ri	 129
+mi	 129
+od	 128
+te	 124
+_a_	 124
+la	 122
+al	 121
+aj	 120
+ej_	 120
+vo	 119
+ol	 119
+in	 118
+ve	 117
+me	 117
+tr	 116
+sk	 116
+ova	 116
+S	 111
+er	 110
+ob	 110
+_na	 109
+ad	 107
+je	 106
+at	 104
+_v_	 103
+_r	 102
+ic	 101
+�ch	 100
+pre	 100
+�c	 100
+av	 98
+es	 96
+ta	 95
+dn	 94
+ho_	 94
+lo	 94
+�_	 93
+_pre	 93
+it	 93
+V	 92
+de	 92
+kt	 89
+n�	 89
+za	 88
+A	 87
+le	 86
+�ch_	 86
+ok	 86
+ost	 85
+vi	 84
+ie_	 83
+ak	 82
+P	 82
+n�	 81
+R	 80
+sa	 80
+as	 79
+�i	 78
+na_	 77
+a�	 77
+�_	 77
+�	 76
+ar	 75
+di	 75
+_S	 74
+om_	 74
+_V	 73
+_do	 73
+_za	 72
+-	 72
+ck	 71
+vy	 71
+ka	 71
+f	 70
+tor	 70
+am	 70
+on	 70
+_-	 69
+_P	 69
+M	 68
+_i	 68
+_sa	 68
+nos	 68
+n�	 68
+�c	 67
+a�_	 67
+sl	 66
+il	 66
+r�	 66
+_c	 66
+_b	 66
+_-_	 64
+sa_	 64
+-_	 64
+kto	 64
+_j	 64
+ani	 64
+kr	 64
+sti	 63
+ou	 63
+ot	 63
+ne_	 63
+_sa_	 62
+v�	 62
+_na_	 62
+red	 62
+ku	 61
+is	 61
+n�	 60
+�_	 60
+so	 60
+sp	 60
+_st	 59
+g	 59
+tn	 59
+str	 58
+�e	 58
+nt	 58
+et	 57
+pra	 57
+ke	 57
+ov_	 57
+_vy	 57
+_M	 57
+nej	 56
+tu	 56
+l_	 56
+_je	 56
+nie	 56
+�n	 56
+k_	 56
+pe	 56
+_h	 55
+oz	 55
+�_	 55
+est	 55
+_�	 55
+va�	 55
+ma	 54
+n�_	 53
+t�	 53
+..	 53
+r�	 52
+ran	 52
+bo	 51
+nej_	 51
+ick	 51
+ti_	 51
+ia_	 51
+ktor	 51
+K	 51
+O	 51
+T	 51
+_ne	 51
+ou_	 50
+I	 50
+oc	 50
+to_	 50
+vn	 50
+sta	 50
+_.	 50
+da	 50
+�h	 49
+�ho	 49
+N	 49
+_ro	 49
+_ko	 49
+ac	 49
+ek	 49
+li_	 49
+�a	 49
+rov	 49
+oj	 48
+s_	 48
+s�	 48
+�ho_	 48
+va�_	 48
+je_	 48
+z�	 47
+ik	 47
+mo	 47
+mi_	 47
+si	 47
+_kto	 46
+_sp	 46
+_kt	 46
+E	 46
+_ktor	 46
+eb	 46
+n�c	 45
+_u	 45
+el	 45
+B	 45
+n�ch	 45
+pro	 45
+eni	 44
+_�	 44
+em	 44
+kon	 44
+pa	 44
+ky	 44
+uj	 44
+�e_	 44
+ova�	 44
+cie	 44
+hr	 44
+k�	 44
+n�ch_	 43
+pred	 43
+zo	 43
+ln	 43
+o�	 43
+tov	 43
+nu	 43
+e�	 43
+�c	 42
+�l	 42
+�m	 42
+pri	 42
+_to	 42
+l�	 41
+ce	 41
+�v	 41
+eh	 41
+_pro	 41
+rav	 41
+kej	 41
+ns	 41
+ali	 41
+oli	 40
+�_	 40
+_pri	 40
+oh	 40
+ud	 40
+_ak	 40
+ent	 40
+e�	 40
+prav	 39
+_pred	 39
+�i	 39
+zn	 39
+ny	 39
+ove	 39
+pol	 39
+ru	 39
+a,	 39
+ah	 39
+kej_	 39
+a,_	 38
+z_	 38
+aj_	 38
+r_	 38
+i�	 38
+ova�_	 38
+tre	 38
+pod	 37
+_z�	 37
+_ob	 37
+nost	 37
+sti_	 37
+van	 37
+up	 37
+osti	 36
+�ci	 36
+_�e	 36
+j�	 36
+co	 36
+_str	 36
+�i	 36
+_ma	 36
+ut	 36
+nsk	 36
+by	 36
+_ve	 35
+ko_	 35
+de_	 35
+�ia	 35
+_aj	 35
+_aj_	 35
+op	 35
+_pod	 34
+pr�	 34
+_in	 34
+ez	 34
+odn	 34
+dne	 34
+Z	 34
+tra	 34
+bn	 34
+�d	 34
+_�e_	 34
+_vo	 34
+�as	 34
+�t	 34
+d_	 34
+�	 34
+sto	 34
+ky_	 34
+ir	 33
+_z_	 33
+nie_	 33
+�t	 33
+ven	 33
+i�_	 33
+_s_	 33
+_B	 33
+�e	 33
+ens	 33
+spo	 32
+eho	 32
+lad	 32
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/manx.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/manx.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/manx.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 36004
+e	 9455
+a	 8302
+y	 6395
+n	 6395
+h	 5736
+r	 4939
+s	 4799
+o	 4429
+i	 4129
+l	 3462
+y_	 2896
+g	 2731
+n_	 2549
+d	 2232
+t	 2160
+_a	 1836
+m	 1823
+sh	 1774
+e_	 1746
+h_	 1645
+yn	 1550
+c	 1531
+ee	 1515
+gh	 1461
+s_	 1460
+_s	 1388
+ey	 1345
+_e	 1316
+ag	 1312
+a_	 1201
+r_	 1173
+agh	 1165
+in	 1148
+as	 1136
+_d	 1136
+u	 1124
+he	 1060
+yn_	 1025
+oo	 1012
+ey_	 1005
+_m	 1002
+er	 965
+v	 949
+_y	 941
+_v	 895
+_c	 891
+_as	 880
+'	 869
+,	 866
+_n	 832
+ll	 828
+,_	 827
+_sh	 818
+.	 802
+hi	 797
+as_	 770
+ee_	 768
+ne	 767
+_as_	 764
+b	 762
+re	 735
+ay	 730
+._	 730
+an	 726
+ar	 725
+gh_	 722
+ny	 709
+en	 703
+_r	 697
+ch	 688
+agh_	 687
+dy	 686
+t_	 677
+le	 667
+k	 658
+er_	 616
+oi	 612
+ea	 607
+_t	 601
+yr	 596
+_er	 585
+ra	 574
+_dy	 572
+in_	 570
+l_	 564
+f	 557
+_l	 556
+ha	 551
+_g	 548
+_ny	 534
+nn	 530
+"	 528
+_ch	 527
+_y_	 524
+ie	 514
+dy_	 514
+_dy_	 513
+aa	 510
+_f	 509
+j	 504
+sh_	 487
+oa	 480
+is	 478
+_h	 470
+rr	 468
+ny_	 467
+_ny_	 463
+_er_	 454
+ish	 445
+ho	 442
+ai	 441
+d_	 435
+ro	 423
+ht	 418
+ei	 417
+shi	 416
+il	 409
+me	 408
+_ay	 403
+_b	 403
+la	 400
+_j	 400
+my	 394
+va	 391
+ns	 386
+on	 385
+_o	 381
+ys	 380
+_shi	 379
+ia	 377
+ayn	 373
+_va	 371
+hen	 362
+she	 356
+ri	 345
+lle	 342
+ooi	 342
+mee	 340
+ley	 335
+_me	 331
+el	 330
+rt	 328
+ie_	 327
+eh	 324
+w	 316
+_ayn	 313
+al	 311
+g_	 309
+ish_	 308
+lley	 307
+mee_	 305
+_mee	 304
+ill	 301
+es	 299
+na	 299
+je	 298
+yns	 296
+C	 294
+_my	 291
+_she	 290
+ley_	 282
+V	 280
+_yn	 278
+_"	 278
+_mee_	 277
+ta	 272
+_V	 271
+ys_	 268
+-	 268
+lley_	 265
+hin	 264
+_ro	 259
+shin	 256
+_yn_	 255
+_je	 255
+do	 253
+va_	 253
+ne_	 253
+_va_	 252
+ns_	 252
+_shin	 251
+yns_	 250
+ayns	 248
+en_	 247
+che	 246
+_ayns	 246
+eh_	 246
+_do	 242
+ad	 241
+ney	 240
+o_	 240
+ym	 240
+ed	 239
+yr_	 239
+ayns_	 237
+ur	 237
+st	 234
+_C	 234
+rt_	 234
+'n	 232
+m_	 232
+p	 231
+li	 231
+or	 230
+ow	 228
+hin_	 225
+da	 225
+shen	 223
+"_	 223
+'n_	 223
+Va	 221
+ght	 220
+shin_	 219
+tr	 217
+_Va	 217
+ry	 216
+ve	 216
+_shen	 215
+ty	 214
+mo	 206
+_'	 205
+_ve	 205
+ma	 203
+be	 203
+te	 203
+hie	 203
+hey	 203
+nag	 202
+ll_	 201
+yl	 200
+w_	 200
+ss	 200
+aa_	 198
+nagh	 198
+an_	 197
+io	 195
+ow_	 194
+it	 194
+sy	 193
+ayr	 193
+ney_	 192
+E	 192
+sht	 192
+ni	 191
+_k	 190
+ha_	 190
+ain	 189
+u_	 189
+hy	 189
+aght	 188
+oo_	 188
+ree	 188
+lh	 187
+_tr	 186
+esh	 186
+_che	 183
+yrt	 182
+_da	 182
+oar	 182
+doo	 181
+k_	 181
+se	 180
+au	 180
+ille	 179
+ar_	 179
+_lh	 179
+ki	 177
+arr	 176
+ec	 176
+ol	 175
+_doo	 175
+T	 175
+row	 175
+_row	 174
+ge	 173
+so	 172
+oy	 171
+oil	 170
+_re	 170
+_ag	 170
+'e	 169
+rey	 169
+illey	 169
+ck	 168
+ad_	 168
+ann	 168
+n,	 166
+eea	 166
+_ta	 166
+ht_	 165
+ae	 162
+_row_	 162
+!	 162
+row_	 162
+ane	 161
+fe	 161
+dd	 160
+go	 159
+tyn	 159
+oin	 158
+ooa	 158
+n.	 158
+eg	 156
+_ec	 156
+_ma	 156
+_agh	 155
+n,_	 154
+_fe	 154
+Ch	 154
+nyn	 153
+fo	 152
+eay	 152
+nagh_	 152
+n._	 152
+_go	 151
+S	 150
+ke	 150
+hey_	 150
+enn	 150
+cha	 149
+rre	 149
+_fo	 149
+ghe	 149
+raa	 149
+G	 148
+lan	 148
+mm	 147
+ym_	 147
+A	 146
+c_	 146
+oill	 145
+hee	 144
+ooar	 144
+_E	 144
+nne	 143
+tey	 142
+ir	 141
+de	 141
+hyn	 140
+_he	 140
+nyn_	 140
+'s	 139
+_gh	 139
+_cha	 138
+L	 138
+yrt_	 138
+_Ch	 137
+e,	 137
+lla	 136
+Va_	 136
+ooin	 136
+ell	 135
+a'	 135
+os	 135
+_oo	 134
+am	 134
+rish	 133
+th	 133
+_mo	 133
+ris	 133
+iag	 133
+gg	 133
+_Va_	 132
+iagh	 132
+_G	 132
+e,_	 132
+ass	 132
+!_	 132
+my_	 132
+hoo	 131
+_T	 131
+nee	 130
+a'n_	 129
+rag	 129
+a'n	 129
+_'s	 129
+_so	 128
+co	 128
+rey_	 128
+_eh	 126
+_my_	 126
+nni	 126
+ou	 126
+_'sy	 125
+'sy	 125
+_p	 125
+vo	 125
+_S	 125
+H	 125
+_agh_	 125
+tra	 124
+moo	 124
+hu	 123
+ooy	 123
+ragh	 123
+al_	 123
+it_	 123
+hia	 122
+id	 122
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/malay.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/malay.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/malay.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 87128
+a	 50232
+n	 25424
+e	 18746
+i	 18605
+an	 14419
+u	 12470
+k	 11955
+t	 11875
+r	 11007
+d	 9856
+g	 9545
+m	 9390
+s	 8926
+l	 8631
+n_	 8004
+an_	 7095
+p	 6890
+a_	 6739
+b	 6645
+ng	 6630
+h	 5964
+da	 5153
+_d	 5107
+er	 4625
+ka	 4448
+la	 4339
+y	 4323
+i_	 4295
+en	 4159
+ya	 3800
+ang	 3778
+_m	 3750
+o	 3593
+.	 3539
+._	 3310
+at	 3288
+ah	 3216
+_b	 3199
+_s	 3177
+ta	 3076
+ra	 3036
+_k	 2949
+g_	 2939
+ng_	 2933
+ar	 2915
+_p	 2906
+me	 2884
+ga	 2781
+di	 2778
+ak	 2727
+al	 2705
+_me	 2671
+ang_	 2524
+h_	 2509
+ba	 2508
+pa	 2454
+kan	 2449
+in	 2437
+tu	 2411
+_t	 2376
+sa	 2338
+_da	 2276
+j	 2276
+pe	 2225
+,	 2150
+k_	 2147
+ma	 2143
+se	 2138
+am	 2131
+kan_	 2117
+_di	 2082
+,_	 2079
+ke	 2048
+un	 2004
+be	 1947
+_a	 1925
+na	 1871
+ti	 1868
+ri	 1861
+u_	 1857
+as	 1854
+ny	 1827
+ha	 1789
+te	 1788
+_pe	 1768
+em	 1750
+it	 1737
+_i	 1732
+_ke	 1711
+yan	 1706
+ad	 1698
+ia	 1673
+yang	 1673
+_y	 1668
+_ya	 1655
+yang_	 1653
+_se	 1648
+ah_	 1646
+_yan	 1639
+_yang	 1639
+ala	 1612
+nya	 1587
+el	 1576
+ik	 1571
+t_	 1568
+ai	 1549
+men	 1531
+eng	 1522
+_men	 1464
+nga	 1441
+dan	 1366
+_be	 1365
+si	 1343
+uk	 1328
+ada	 1299
+nt	 1291
+__	 1287
+ap	 1276
+ua	 1265
+___	 1238
+-	 1213
+ja	 1211
+ber	 1204
+gan	 1203
+_ba	 1193
+____	 1189
+ni	 1181
+_te	 1169
+c	 1143
+ran	 1141
+_____	 1140
+m_	 1127
+ara	 1118
+per	 1099
+le	 1084
+_dan	 1083
+dan_	 1079
+ngan	 1060
+_dan_	 1050
+ya_	 1046
+at_	 1044
+da_	 1021
+li	 1016
+aka	 1013
+A	 999
+r_	 999
+w	 997
+eb	 995
+lah	 980
+ata	 980
+ak_	 978
+nd	 974
+_ber	 955
+gi	 936
+is	 933
+il	 931
+tu_	 923
+s_	 920
+gan_	 915
+mb	 913
+wa	 904
+ag	 903
+ngan_	 898
+ter	 887
+nya_	 877
+S	 873
+ek	 853
+ru	 852
+_l	 838
+ela	 828
+itu	 824
+ol	 822
+aha	 822
+ada_	 820
+pu	 812
+di_	 807
+bu	 807
+am_	 804
+ur	 801
+tan	 790
+mp	 790
+_per	 786
+_sa	 784
+M	 782
+ut	 781
+us	 779
+era	 779
+lam	 778
+lah_	 775
+asa	 767
+ki	 761
+ir	 759
+de	 756
+enga	 750
+su	 748
+du	 741
+id	 739
+"	 733
+akan	 732
+apa	 728
+_S	 724
+ul	 721
+lu	 717
+ari	 717
+dal	 704
+et	 698
+es	 698
+pad	 688
+_ma	 688
+_M	 685
+ana	 684
+bi	 679
+pada	 673
+dala	 673
+l_	 671
+ep	 664
+f	 662
+_di_	 658
+B	 655
+ing	 655
+_j	 654
+ika	 653
+ku	 650
+_.	 644
+akan_	 642
+ama	 637
+pen	 636
+alam	 634
+eh	 634
+pada_	 633
+ai_	 632
+_ter	 632
+K	 631
+mu	 628
+ju	 628
+P	 626
+mem	 625
+au	 622
+_mem	 614
+lan	 612
+_._	 611
+ntu	 608
+lam_	 605
+um	 601
+on	 600
+gk	 597
+_in	 597
+ngk	 597
+a.	 584
+meng	 582
+_meng	 578
+alam_	 577
+_A	 576
+aa	 575
+uk_	 572
+_pen	 569
+ban	 569
+or	 569
+st	 566
+ay	 566
+dar	 565
+_pa	 564
+a._	 564
+_h	 562
+bah	 562
+_P	 560
+D	 559
+ri_	 558
+ini	 552
+_de	 551
+rt	 550
+aan	 545
+_it	 542
+_itu	 542
+nda	 540
+eri	 540
+dalam	 537
+_B	 533
+_dal	 532
+ip	 532
+_dala	 532
+ta_	 528
+_u	 527
+ung	 525
+ih	 524
+aw	 520
+_n	 519
+atu	 517
+ila	 513
+mi	 513
+leh	 513
+ian	 512
+tuk	 509
+awa	 508
+gu	 506
+ert	 506
+engan	 505
+ole	 504
+_K	 501
+seb	 497
+ca	 496
+gg	 493
+_ta	 489
+ra_	 488
+ngg	 488
+itu_	 487
+emb	 482
+ni_	 482
+ida	 482
+nj	 482
+_ti	 479
+man	 478
+den	 477
+_D	 474
+_ka	 473
+aj	 470
+oleh	 468
+n.	 468
+n._	 464
+ngka	 464
+gka	 464
+dak	 464
+anga	 461
+ena	 459
+san	 458
+pat	 458
+rk	 458
+(	 455
+ent	 454
+agi	 453
+)	 451
+ia_	 450
+ge	 450
+ab	 449
+im	 447
+_ini	 446
+ntuk	 445
+I	 445
+ar_	 440
+N	 439
+aan_	 436
+_la	 433
+pi	 432
+baha	 431
+deng	 430
+han	 430
+bag	 429
+eh_	 429
+hu	 429
+denga	 428
+_o	 427
+na_	 427
+T	 425
+leh_	 422
+_den	 422
+ka_	 419
+any	 415
+ud	 415
+rang	 414
+anya	 413
+gi_	 412
+angan	 412
+a,	 411
+_deng	 410
+ita	 409
+kat	 408
+re	 408
+_(	 406
+tuk_	 403
+aga	 401
+ne	 400
+and	 399
+aya	 398
+_dar	 397
+a,_	 396
+ro	 396
+ntuk_	 393
+eba	 392
+aran	 390
+_"	 387
+ed	 385
+end	 384
+ko	 383
+sa_	 381
+p_	 381
+ara_	 380
+_seb	 379
+alah	 379
+oleh_	 379
+an.	 378
+dak_	 378
+eg	 378
+hi	 376
+dari	 375
+an._	 375
+au_	 373
+bo	 373
+ti_	 371
+ula	 371
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/czech-iso8859_2.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/czech-iso8859_2.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/czech-iso8859_2.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 26378
+o	 5870
+e	 5354
+a	 4740
+n	 4462
+t	 3745
+s	 3438
+i	 3187
+v	 3118
+l	 2891
+r	 2754
+k	 2566
+d	 2508
+m	 2198
+u	 2197
+p	 2032
+�	 1924
+c	 1678
+h	 1572
+z	 1544
+�	 1522
+_p	 1299
+e_	 1266
+y	 1231
+a_	 1219
+j	 1219
+_s	 1156
+b	 1079
+o_	 1065
+�	 1043
+_v	 1038
+,	 952
+,_	 946
+st	 945
+_n	 911
+�	 878
+.	 870
+�_	 848
+�	 822
+._	 803
+n�	 782
+ov	 757
+_z	 723
+i_	 716
+u_	 684
+ro	 674
+en	 656
+�	 647
+�	 639
+po	 630
+ch	 629
+�	 625
+na	 599
+_a	 598
+sk	 592
+�	 563
+ho	 552
+_d	 551
+ra	 545
+m_	 539
+y_	 530
+_t	 512
+ko	 504
+_k	 503
+le	 502
+_j	 501
+_o	 486
+to	 479
+pr	 471
+ne	 468
+n�_	 462
+je	 458
+�_	 456
+ti	 455
+od	 433
+li	 432
+va	 432
+_po	 429
+_m	 428
+al	 424
+te	 424
+ou	 423
+ed	 418
+se	 415
+la	 410
+no	 397
+os	 382
+lo	 377
+an	 376
+_pr	 375
+�	 375
+v_	 372
+�e	 370
+_a_	 364
+em	 363
+at	 360
+ta	 359
+do	 357
+t_	 357
+_b	 355
+or	 349
+h_	 345
+_v_	 338
+ch_	 327
+S	 325
+ce	 323
+av	 323
+p�	 322
+ni	 319
+k�	 316
+er	 315
+n�	 315
+_na	 313
+na_	 312
+_ne	 311
+de	 308
+ic	 307
+in	 306
+_se	 306
+l_	 304
+dn	 302
+za	 298
+_p�	 293
+�_	 291
+ol	 290
+_je	 281
+ob	 280
+is	 277
+ve	 274
+ho_	 272
+es	 270
+ot	 268
+ak	 265
+vo	 263
+n�	 260
+il	 257
+se_	 257
+it	 256
+et	 253
+ad	 250
+by	 249
+P	 242
+_r	 242
+k_	 242
+ost	 241
+_se_	 241
+tr	 238
+me	 237
+pro	 234
+�e	 234
+ka	 230
+_za	 227
+om	 224
+el	 223
+_P	 223
+on	 218
+_pro	 216
+ou_	 216
+tu	 215
+O	 212
+mi	 212
+ku	 211
+_u	 210
+_do	 208
+_l	 207
+_na_	 206
+N	 205
+sk�	 205
+�m	 205
+�c	 205
+�_	 203
+m�	 203
+_S	 200
+oz	 200
+V	 200
+ze	 198
+da	 194
+sl	 192
+�_	 191
+ova	 190
+mo	 190
+re	 189
+so	 187
+vy	 186
+ej	 185
+r�	 184
+ar	 184
+s_	 183
+v�	 183
+A	 181
+ru	 180
+_st	 178
+f	 178
+�h	 177
+�ho	 176
+kt	 176
+tn	 175
+g	 174
+bo	 174
+ez	 173
+ci	 172
+k�	 172
+n�	 170
+M	 170
+�n	 169
+as	 168
+vi	 167
+�i	 167
+ac	 166
+�e_	 165
+�c	 165
+�_	 165
+ck	 164
+K	 164
+B	 164
+�ch	 164
+v�	 162
+_c	 162
+�ho_	 162
+en�	 161
+l�	 160
+_�	 160
+��	 160
+p�e	 159
+ec	 158
+�_	 157
+J	 156
+vn	 156
+_h	 155
+k�_	 155
+ok	 154
+sta	 154
+to_	 152
+v�	 152
+nt	 151
+�ch_	 149
+lo_	 149
+_by	 149
+dy	 149
+_p�e	 148
+ce_	 147
+R	 146
+n_	 146
+�d	 146
+pa	 145
+v�	 145
+am	 145
+mu	 145
+n�	 145
+ud	 144
+_�	 144
+_B	 142
+ter	 141
+n�_	 141
+�e	 140
+�e	 140
+_V	 140
+_ko	 140
+li_	 139
+d�	 137
+hl	 137
+je_	 137
+ji	 137
+ist	 135
+j�	 135
+-	 134
+ik	 133
+si	 133
+�l	 132
+em_	 132
+_to	 132
+_vy	 131
+sp	 130
+ut	 130
+_J	 130
+_�e	 130
+_M	 129
+di	 129
+kon	 128
+la_	 128
+t�	 128
+_ro	 127
+ns	 127
+ek	 126
+ick	 126
+T	 126
+yl	 125
+�n	 125
+rn	 125
+_�e_	 124
+op	 124
+sti	 124
+kte	 124
+�ed	 124
+edn	 123
+us	 121
+�m_	 120
+"	 119
+z_	 119
+str	 118
+ti_	 118
+�m	 118
+vat	 118
+d_	 118
+_ve	 118
+�v	 118
+en�_	 117
+iv	 117
+oj	 117
+_kt	 117
+�l	 117
+val	 116
+eb	 116
+_K	 115
+t�	 115
+_kte	 115
+�t	 115
+_i	 114
+_N	 114
+D	 114
+kl	 114
+ny	 114
+byl	 113
+ev	 113
+ri	 113
+�	 113
+ky	 111
+sm	 111
+oh	 111
+E	 110
+ma	 110
+�t	 110
+sk�	 110
+kter	 109
+nu	 109
+le_	 108
+ja	 107
+z�	 107
+t�	 106
+t�	 106
+zn	 106
+let	 105
+aj	 105
+sto	 105
+��	 105
+me_	 105
+-_	 105
+u,	 105
+sv	 104
+_le	 104
+pol	 104
+L	 104
+_-	 104
+ln	 104
+pod	 104
+H	 103
+zi	 103
+k�h	 103
+k�ho	 103
+_n�	 103
+ent	 102
+u,_	 102
+_od	 102
+n�_	 101
+_-_	 101
+al_	 101
+_kter	 101
+do_	 100
+nos	 100
+c�	 100
+rav	 99
+ran	 99
+_sv	 99
+k�	 98
+e�	 98
+n�m	 98
+bu	 97
+_z_	 97
+�ch	 97
+_byl	 97
+�n�	 96
+rov	 96
+kr	 96
+d�	 95
+ov�	 95
+dl	 95
+uj	 95
+nost	 95
+�m_	 95
+ech	 94
+ly	 94
+oc	 94
+v�_	 93
+_o_	 93
+dy_	 93
+ak_	 93
+nsk	 93
+_so	 93
+_ob	 92
+nc	 92
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/rumantsch.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/rumantsch.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/rumantsch.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 10888
+a	 3490
+e	 2268
+i	 2196
+s	 2169
+n	 1961
+t	 1555
+r	 1510
+l	 1281
+u	 1249
+a_	 1155
+c	 1060
+d	 954
+o	 815
+s_	 744
+g	 726
+m	 686
+h	 620
+p	 617
+n_	 559
+v	 493
+_s	 480
+er	 476
+ch	 469
+_d	 457
+in	 455
+da	 418
+_c	 404
+r_	 388
+_e	 377
+.	 358
+_p	 340
+as	 333
+l_	 328
+,	 327
+._	 320
+_i	 320
+,_	 315
+la	 313
+en	 312
+sc	 310
+an	 301
+ta	 300
+_da	 285
+f	 282
+_t	 268
+_a	 262
+nt	 259
+_m	 252
+un	 248
+ra	 247
+i_	 247
+na	 245
+ma	 245
+ia	 241
+ar	 234
+sch	 228
+b	 228
+da_	 217
+es	 214
+ai	 213
+st	 212
+'	 209
+e_	 208
+as_	 208
+er_	 200
+t_	 199
+re	 199
+_l	 195
+al	 193
+_n	 193
+el	 192
+tg	 192
+te	 188
+z	 187
+ha	 180
+_f	 180
+sa	 174
+_da_	 172
+ve	 169
+ei	 168
+_v	 165
+at	 165
+ss	 161
+is	 161
+_ch	 161
+on	 160
+la_	 158
+cu	 158
+ad	 158
+he	 156
+in_	 147
+va	 147
+_in	 146
+gl	 145
+ns	 141
+ur	 140
+�	 140
+u_	 138
+ts	 138
+pe	 136
+li	 134
+gi	 133
+et	 133
+de	 132
+ig	 132
+or	 130
+ti	 129
+il	 127
+d_	 126
+che	 123
+ut	 122
+us	 122
+cha	 121
+di	 120
+ia_	 120
+_b	 118
+_la	 117
+na_	 116
+ain	 115
+per	 115
+to	 115
+_cu	 113
+_sc	 112
+se	 111
+ls	 109
+-	 108
+iu	 108
+ca	 107
+si	 104
+ir	 102
+rt	 102
+ie	 102
+_g	 102
+un_	 102
+nd	 101
+av	 101
+ni	 100
+q	 99
+au	 97
+ls_	 97
+ll	 96
+qu	 96
+_pe	 96
+le	 96
+rs	 95
+pa	 95
+ri	 95
+_ma	 94
+_per	 93
+am	 93
+eg	 92
+_r	 92
+gn	 92
+me	 92
+pi	 91
+an_	 91
+en_	 91
+ga	 91
+ent	 90
+hi	 90
+_e_	 90
+it	 89
+ta_	 88
+ter	 87
+ns_	 86
+iv	 86
+igl	 86
+a.	 85
+em	 85
+I	 85
+chi	 84
+_en	 84
+int	 84
+ue	 83
+su	 82
+tt	 82
+a,	 82
+a,_	 82
+o_	 82
+_ve	 82
+a._	 82
+_q	 81
+_qu	 80
+ge	 80
+"	 80
+_la_	 80
+ar_	 80
+vi	 79
+gl_	 79
+tu	 78
+ng	 78
+ro	 76
+mi	 76
+sta	 75
+ed	 75
+lla	 74
+ei_	 73
+_o	 73
+ic	 73
+el_	 73
+_il	 73
+_in_	 72
+g_	 72
+pr	 71
+nu	 70
+ina	 70
+_h	 69
+scha	 68
+mai	 68
+pl	 68
+il_	 68
+os	 68
+ha_	 68
+be	 67
+uo	 67
+cun	 67
+ra_	 67
+_pa	 65
+ts_	 64
+s.	 64
+co	 64
+_u	 64
+fi	 64
+_I	 63
+sa_	 63
+s._	 63
+_re	 62
+�n	 62
+_nu	 62
+?	 62
+S	 62
+_se	 61
+no	 61
+nt_	 61
+E	 61
+tr	 61
+mp	 60
+igl_	 60
+_su	 60
+_st	 60
+ess	 60
+im	 60
+zi	 59
+?_	 59
+nc	 59
+_E	 58
+_-	 58
+_cun	 58
+_te	 58
+_sa	 58
+ant	 58
+main	 58
+eu	 57
+ssa	 57
+-_	 57
+iun	 57
+_-_	 57
+aint	 56
+op	 56
+al_	 56
+dal	 56
+j	 56
+ama	 55
+_tg	 55
+ua	 55
+M	 55
+per_	 55
+tsc	 54
+nta	 54
+tsch	 54
+um	 54
+fa	 54
+za	 54
+_di	 54
+pia	 54
+_per_	 54
+T	 54
+_M	 53
+ne	 53
+era	 53
+A	 53
+que	 53
+_dal	 53
+cr	 53
+_de	 53
+lla_	 53
+_che	 52
+h'	 52
+_me	 51
+ot	 51
+_pr	 51
+_pl	 51
+_sch	 51
+ch'	 50
+_S	 50
+opi	 50
+ou	 50
+tta	 50
+mo	 50
+ada	 50
+ba	 50
+_an	 49
+top	 49
+id	 49
+�	 49
+he_	 49
+C	 49
+va_	 49
+uto	 49
+ins	 48
+topi	 48
+L	 48
+ir_	 48
+ist	 48
+c_	 48
+_il_	 48
+P	 48
+ss_	 48
+ag	 47
+_no	 47
+res	 47
+las	 47
+_vi	 46
+s,	 46
+schi	 46
+_en_	 46
+tg_	 46
+s,_	 46
+_si	 46
+_que	 45
+_T	 45
+az	 45
+'i	 45
+cun_	 44
+_fa	 44
+_mi	 44
+utop	 44
+utopi	 44
+sche	 44
+_C	 44
+ur_	 44
+tge	 44
+po	 44
+es_	 44
+x	 44
+nz	 44
+_L	 44
+_cun_	 44
+man	 44
+_ch'	 43
+_fi	 43
+pu	 43
+ell	 43
+opia	 43
+_igl	 43
+_ig	 43
+sp	 43
+topia	 43
+ava	 42
+egn	 42
+che_	 42
+on_	 42
+ci	 42
+_P	 42
+ev	 42
+ond	 41
+_"	 41
+�	 41
+us_	 41
+_ha	 41
+D	 40
+_co	 40
+etg	 40
+'e	 40
+las_	 40
+est	 40
+ura	 40
+uel	 39
+ed_	 39
+vo	 39
+gia	 39
+bu	 39
+mu	 39
+nn	 39
+gli	 39
+_A	 39
+lu	 39
+cha_	 39
+ul	 38
+mal	 38
+_�n	 38
+ina_	 38
+_bu	 38
+_ca	 38
+_�	 38
+uc	 38
+nts	 38
+tra	 38
+_tu	 37
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/latin.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/latin.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/latin.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 20136
+e	 6892
+i	 5604
+a	 5443
+u	 4581
+t	 4552
+s	 4354
+r	 3923
+n	 3375
+m	 3063
+o	 2921
+c	 2224
+l	 1805
+e_	 1625
+s_	 1503
+p	 1424
+d	 1397
+,	 1285
+,_	 1276
+er	 1077
+qu	 1028
+q	 1028
+a_	 1019
+t_	 1018
+is	 942
+_a	 921
+re	 902
+m_	 891
+v	 858
+b	 821
+um	 808
+_s	 773
+us	 772
+en	 766
+nt	 733
+in	 729
+ue	 727
+te	 720
+g	 718
+_i	 710
+_p	 679
+it	 676
+_c	 669
+et	 653
+que	 652
+_e	 643
+at	 643
+ue_	 616
+ra	 614
+que_	 611
+f	 601
+or	 598
+ri	 576
+ti	 572
+ta	 559
+tu	 552
+an	 551
+ae	 527
+_m	 513
+am	 501
+_t	 493
+us_	 488
+is_	 487
+es	 479
+em	 479
+_f	 451
+um_	 443
+_v	 442
+ia	 442
+li	 438
+_d	 436
+.	 432
+i_	 430
+et_	 429
+ni	 412
+ne	 409
+h	 406
+de	 404
+ur	 396
+._	 392
+ar	 388
+os	 388
+mi	 382
+pe	 382
+la	 376
+st	 371
+s,	 368
+di	 367
+_et	 366
+s,_	 365
+_in	 363
+on	 360
+o_	 359
+_n	 351
+_et_	 351
+as	 346
+im	 336
+na	 327
+se	 320
+ma	 315
+cu	 307
+vi	 306
+si	 303
+ro	 303
+r_	 302
+su	 299
+un	 295
+_l	 291
+to	 291
+ec	 290
+ci	 288
+co	 287
+_r	 287
+ere	 286
+ce	 284
+tr	 280
+re_	 278
+ent	 275
+x	 275
+ct	 274
+ve	 271
+ru	 259
+ul	 256
+me	 255
+ui	 255
+c_	 252
+_o	 250
+ic	 249
+ns	 247
+_qu	 242
+_q	 242
+no	 241
+ant	 235
+am_	 235
+_co	 233
+sa	 231
+ca	 230
+t,	 226
+mu	 225
+t,_	 225
+_re	 223
+el	 222
+ib	 222
+id	 218
+om	 212
+_te	 211
+al	 209
+le	 209
+it_	 208
+mo	 208
+ol	 206
+_u	 203
+;	 199
+_h	 199
+ac	 198
+;_	 198
+bu	 197
+nu	 196
+ua	 195
+n_	 195
+ll	 194
+tis	 191
+A	 189
+rt	 188
+ge	 188
+nd	 187
+au	 187
+lu	 186
+iu	 185
+squ	 185
+per	 185
+sq	 185
+ter	 185
+pa	 183
+_A	 183
+em_	 183
+ia_	 180
+ed	 179
+_pe	 178
+m,	 176
+sque	 175
+_su	 175
+ae_	 175
+m,_	 175
+pr	 175
+bi	 175
+bus	 174
+_vi	 174
+os_	 173
+ta_	 172
+mqu	 171
+mq	 171
+ss	 170
+sque_	 169
+ibu	 167
+ad	 166
+ibus	 165
+I	 164
+nte	 163
+ra_	 163
+mque	 162
+_de	 162
+po	 161
+_se	 160
+ere_	 160
+nc	 160
+qua	 159
+T	 159
+lo	 157
+oc	 156
+mque_	 156
+_T	 155
+_pa	 155
+_pr	 155
+tem	 154
+bus_	 152
+nti	 149
+rum	 149
+er_	 149
+ab	 148
+ir	 148
+da	 147
+_ve	 146
+ibus_	 146
+ex	 146
+ut	 145
+pi	 145
+tur	 145
+_ca	 143
+_me	 142
+es_	 142
+gi	 142
+te_	 141
+_I	 141
+vo	 141
+do	 141
+_si	 140
+tus	 139
+il	 137
+_ar	 136
+du	 133
+nt_	 133
+uc	 133
+fa	 132
+as_	 132
+rr	 131
+ba	 130
+_ad	 128
+ne_	 127
+_ma	 127
+ens	 127
+gn	 126
+s.	 126
+y	 126
+min	 125
+ris	 124
+in_	 123
+tum	 123
+P	 123
+_g	 123
+mp	 123
+e,	 122
+io	 122
+_P	 122
+ea	 122
+hi	 122
+e,_	 121
+era	 120
+sc	 120
+_la	 120
+qui	 120
+unt	 120
+fe	 119
+_in_	 118
+_no	 118
+ore	 118
+iam	 118
+va	 117
+tis_	 117
+s._	 117
+at_	 117
+eri	 116
+d_	 116
+con	 115
+fu	 115
+pu	 114
+cum	 114
+ub	 114
+ng	 114
+ine	 113
+_au	 113
+:	 113
+_di	 112
+ag	 111
+_con	 111
+ect	 111
+i,	 111
+equ	 111
+i,_	 111
+be	 111
+eq	 111
+_po	 110
+so	 110
+:_	 110
+nis	 109
+ha	 109
+uo	 109
+_fa	 108
+na_	 107
+ip	 107
+is,	 107
+_cu	 106
+cr	 106
+ate	 105
+is,_	 105
+ig	 105
+tor	 105
+rat	 104
+_qua	 103
+eg	 103
+a,	 103
+a,_	 102
+tra	 102
+_mo	 101
+sp	 101
+mis	 100
+itu	 100
+D	 99
+ali	 99
+eb	 99
+eni	 99
+_sa	 98
+ie	 98
+imu	 98
+_ex	 97
+_D	 96
+res	 95
+est	 94
+tri	 94
+ene	 94
+_mi	 94
+str	 94
+enti	 93
+t.	 92
+av	 92
+_per	 91
+ur_	 91
+ora	 91
+lt	 91
+umqu	 90
+_vo	 90
+umq	 90
+up	 89
+t._	 88
+quo	 88
+_ne	 88
+gen	 88
+rum_	 87
+tqu	 87
+tq	 87
+_fu	 86
+ep	 86
+ma_	 86
+umque	 86
+it,_	 85
+ine_	 85
+it,	 85
+men	 85
+mus	 84
+ort	 83
+ven	 83
+ina	 83
+us,_	 83
+us,	 83
+tque	 82
+_ge	 82
+per_	 82
+mor	 82
+inc	 82
+are	 81
+tus_	 81
+_an	 81
+rim	 81
+tque_	 81
+ot	 81
+ani	 80
+H	 80
+_tu	 80
+ho	 80
+tem_	 80
+u_	 80
+ser	 79
+um,_	 79
+um,	 79
+S	 79
+ten	 79
+ver	 79
+sti	 79
+ntu	 78
+fer	 78
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/mingo.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/mingo.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/mingo.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 3156
+'	 991
+a	 829
+t	 788
+k	 788
+n	 752
+e	 640
+h	 602
+�	 551
+s	 495
+w	 466
+�	 422
+y	 403
+u	 397
+'_	 368
+_n	 330
+i	 269
+.	 269
+._	 240
+e'	 238
+�	 219
+a'	 209
+ne	 209
+e_	 194
+_ne	 184
+wa	 172
+_k	 164
+kw	 162
+�	 154
+e'_	 146
+_t	 145
+'t	 141
+"	 141
+�'	 134
+�	 132
+_h	 131
+�	 129
+ak	 129
+ne_	 126
+ta	 123
+_ne_	 123
+at	 121
+u'	 121
+hu	 118
+_u	 108
+ka	 107
+�	 106
+n�	 105
+N	 103
+�'	 100
+hs	 95
+ha	 95
+te	 94
+ya	 93
+_�	 92
+kh	 90
+'k	 86
+�	 85
+�	 84
+ni	 84
+'.	 84
+w�	 83
+ny	 83
+sh	 80
+_N	 80
+'._	 76
+�_	 76
+k�	 72
+_"	 71
+�n	 70
+th	 69
+yu	 66
+_w	 66
+�h	 66
+t_	 66
+�_	 66
+Ne	 65
+Ne'	 65
+'s	 64
+ne'	 64
+"_	 64
+_.	 63
+_._	 61
+Ne'_	 61
+,	 60
+ne'_	 58
+n�	 58
+kwa	 57
+_ne'	 57
+�t	 57
+a't	 57
+ek	 56
+s_	 56
+�t	 55
+i'	 55
+_hu	 54
+T	 54
+�_	 54
+_s	 54
+_Ne	 53
+t�	 53
+t�	 53
+_Ne'	 53
+_ne'_	 53
+ht	 53
+-	 53
+ts	 52
+ya'	 52
+�'_	 51
+_wa	 51
+_Ne'_	 51
+'�	 50
+�y	 50
+_ka	 50
+as	 50
+n�	 49
+un	 49
+�_	 49
+ty	 48
+hu_	 48
+ke	 48
+u_	 48
+,_	 47
+y�	 46
+he	 46
+ye	 46
+k�	 45
+si	 45
+n�	 44
+khu	 44
+a'k	 44
+_a	 43
+�k	 43
+wat	 42
+'�	 42
+n�'	 42
+w�	 42
+aw	 41
+an	 41
+we	 41
+�t	 41
+i_	 41
+_kh	 41
+tak	 41
+_te	 41
+ik	 41
+_khu	 40
+�s	 40
+y�	 40
+k_	 39
+khu_	 39
+yu'	 38
+h�	 38
+w�n	 38
+n-	 38
+�hs	 38
+_ha	 38
+wa'	 38
+_n-	 37
+sa	 37
+?	 37
+_T	 37
+�'	 37
+_un	 36
+h�	 36
+w�	 36
+ah	 36
+_khu_	 35
+iy	 35
+�k	 35
+ut	 35
+�k	 35
+�h	 35
+te'	 35
+u'_	 35
+_k�	 34
+y�_	 34
+ha'	 34
+st	 34
+ti	 34
+ta'	 34
+u't	 33
+ya't	 33
+'t_	 33
+'�_	 33
+akw	 33
+�k	 33
+n�y	 32
+'ta	 32
+ku	 32
+ui	 32
+_sh	 32
+aa	 31
+�n	 31
+ay	 31
+�n�	 31
+�	 30
+se	 30
+tw	 30
+y�	 30
+(_	 29
+_(_	 29
+_)_	 29
+us	 29
+_�hs	 29
+(	 29
+k�	 29
+_�h	 29
+ae	 29
+h�	 29
+_)	 29
+)_	 29
+_(	 29
+sy	 29
+)	 29
+��	 28
+�n	 28
+sk	 28
+t�	 28
+t�	 28
+tk	 28
+�n	 28
+k�_	 28
+a_	 28
+�n	 27
+_huik	 27
+�n	 27
+_hui	 27
+kw�	 27
+huik	 27
+�k	 27
+hui	 27
+uik	 27
+_na	 27
+na	 27
+a'_	 26
+uik�	 26
+_ni	 26
+."	 26
+��	 26
+wi	 26
+huik�	 26
+ik�	 26
+nya	 25
+."_	 25
+?"	 25
+t�'	 25
+�yu	 25
+aw�	 25
+sn	 25
+n�_	 24
+�'_	 24
+ik�_	 24
+ekh	 24
+'ke	 24
+uik�_	 24
+?"_	 24
+tek	 24
+�t	 24
+',	 24
+"N	 23
+_ta	 23
+'a	 23
+hk	 23
+t�	 23
+tsi	 23
+w�	 23
+yu'_	 23
+_"N	 23
+�yu'	 23
+n�yu	 23
+a'ta	 23
+�'	 23
+n�yu'	 23
+sh�	 22
+w�n�	 22
+kwa'	 22
+�n�	 22
+kw�	 22
+_u'	 22
+ey	 22
+�n�yu	 22
+K	 22
+ai	 22
+_sh�	 22
+�w	 22
+a�	 22
+�ht	 22
+�n�y	 22
+kwe	 22
+w�n�y	 22
+_he	 22
+_te'	 21
+�n	 21
+s.	 21
+n�h	 21
+��	 21
+_�k	 21
+'sh	 21
+k�'	 21
+ht�	 21
+H	 21
+ata	 21
+U	 20
+'h	 20
+_ha'	 20
+��'	 20
+ae_	 20
+a'ke	 20
+�ny	 20
+un�	 20
+we'	 20
+w�'	 20
+i'_	 20
+k�s	 20
+ya'ta	 19
+es	 19
+aw�n�	 19
+h�_	 19
+uk	 19
+aw�n	 19
+hw	 19
+�'.	 19
+�'	 19
+t�'	 19
+s�	 19
+�'�	 19
+�'._	 19
+'��	 19
+hkw	 19
+-a	 19
+twa	 19
+'kw	 18
+he_	 18
+_K	 18
+n�t	 18
+hsa	 18
+hsi	 18
+�ni	 18
+aya	 18
+is	 18
+��'	 18
+k�	 18
+skw	 18
+uw	 18
+',_	 18
+e't	 18
+k��	 18
+ka'	 18
+nae	 17
+sh�_	 17
+sat	 17
+niy	 17
+�ts	 17
+ath	 17
+ye'	 17
+�_	 17
+'��'	 17
+'u	 17
+_�t	 17
+�s_	 17
+_k�s	 17
+_y	 17
+kak	 17
+�'�	 17
+kat	 17
+_th	 17
+'�_	 17
+�t	 17
+u'k	 17
+_H	 17
+tekh	 17
+s._	 17
+w�	 17
+_nae	 17
+kw�	 17
+_sh�_	 17
+y�	 17
+�te	 16
+sha	 16
+ke_	 16
+k.	 16
+si'	 16
+h�'	 16
+y�	 16
+hta	 16
+kn	 16
+_nae_	 16
+hse	 16
+k�	 16
+�'�_	 16
+un�	 16
+nya'	 16
+nae_	 16
+n�	 16
+�'	 16
+�s	 16
+t�	 16
+a's	 16
+a'u	 16
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/russian-koi8_r.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/russian-koi8_r.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/russian-koi8_r.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 28256
+�	 8957
+�	 7206
+�	 6230
+�	 5966
+�	 5385
+�	 5338
+�	 4464
+�	 3984
+�	 3504
+�	 3335
+�	 2700
+�	 2441
+�	 2324
+�	 2230
+�	 1840
+�	 1562
+�	 1540
+_�	 1505
+,	 1492
+,_	 1492
+�	 1437
+�_	 1423
+�_	 1335
+��	 1286
+�	 1283
+�	 1233
+�	 1232
+�_	 1193
+��	 1175
+_�	 1146
+�	 1143
+_�	 1118
+_�	 1062
+�_	 1032
+.	 999
+��	 996
+��	 920
+��	 911
+._	 908
+�	 907
+��	 893
+��	 869
+��	 851
+��	 844
+�_	 808
+��	 786
+��	 775
+��	 768
+�	 763
+_�	 735
+��	 730
+��	 723
+_�	 721
+�	 696
+��	 667
+_��	 629
+_�	 626
+�_	 621
+��	 620
+�_	 616
+��	 599
+�_	 597
+_��	 592
+��	 589
+��	 584
+��	 579
+��	 576
+��	 566
+�_	 562
+��	 548
+��	 545
+��	 545
+��	 544
+��	 535
+��	 533
+��	 528
+_�	 522
+��	 520
+��	 520
+�	 518
+�	 510
+_�	 507
+��	 502
+��	 500
+��	 498
+��	 486
+��	 476
+��	 475
+��	 471
+��	 458
+��	 457
+��	 450
+�	 450
+��	 449
+�_	 448
+_��	 447
+��	 443
+��	 442
+_�	 438
+��	 431
+_�_	 430
+��	 428
+_��	 424
+��	 400
+��	 396
+_�	 392
+_�	 388
+��	 388
+��	 388
+_�_	 385
+_�	 382
+��_	 381
+��	 380
+��	 374
+��	 362
+�_	 361
+��	 350
+��_	 348
+���	 347
+��	 346
+��	 338
+�_	 336
+��	 335
+��	 328
+��	 326
+��	 323
+��	 321
+��_	 321
+��	 320
+��	 320
+���	 318
+��	 318
+��	 317
+��	 316
+��	 314
+-	 314
+��	 309
+��	 308
+�_	 307
+��	 306
+��_	 305
+��_	 302
+_�	 300
+��	 295
+_���	 291
+�	 289
+��	 288
+��	 285
+_�	 275
+_��	 274
+���	 274
+�	 273
+��_	 272
+��	 271
+_�	 271
+��	 267
+��	 266
+��	 265
+��_	 264
+���	 263
+��	 260
+��	 258
+��	 255
+��	 254
+��	 254
+���	 247
+��	 246
+��	 246
+�	 244
+�	 240
+_�	 239
+_�	 239
+�_	 238
+�	 237
+���	 237
+_��_	 236
+��	 234
+��	 234
+��	 229
+��	 228
+��	 226
+���	 224
+��	 224
+��_	 222
+��	 222
+��_	 222
+��	 220
+��	 218
+��	 216
+���	 216
+��	 214
+��	 213
+_��	 211
+���	 211
+��	 210
+_�	 210
+��	 209
+_�	 208
+��	 205
+���	 204
+_��	 204
+��_	 203
+_���	 203
+��	 202
+�_	 202
+��	 201
+��	 199
+���	 199
+���	 199
+_��_	 199
+���	 198
+��	 198
+��_	 197
+_�	 197
+_��	 195
+���	 194
+��	 193
+�_	 193
+��	 191
+��_	 190
+���_	 187
+_�	 187
+��	 186
+_��	 186
+��	 186
+_��	 185
+_��	 184
+_��	 184
+���	 183
+_�	 182
+��	 182
+��	 181
+_��	 180
+��	 180
+��	 180
+��	 173
+��	 172
+��	 172
+�_	 172
+���	 172
+��	 172
+���	 171
+��	 171
+��	 170
+��	 169
+�	 169
+���	 168
+��	 167
+���	 166
+���	 166
+���	 165
+���_	 164
+_���_	 163
+�	 163
+��_	 163
+��	 162
+�,_	 160
+�,	 160
+��	 160
+��	 159
+���	 158
+��	 157
+���	 157
+��	 156
+���	 156
+�	 155
+�,	 155
+���	 155
+_��	 155
+�,_	 155
+_��	 154
+��	 154
+��	 154
+_��	 154
+�,_	 153
+�,	 153
+���	 152
+_���	 151
+��	 150
+���	 150
+��_	 150
+��	 150
+��	 150
+_-	 149
+���	 148
+���	 147
+_���	 146
+���	 146
+��	 146
+_���	 145
+�	 145
+��	 145
+���	 145
+_�	 144
+_�_	 144
+��	 144
+_�_	 144
+_�	 144
+�_	 144
+��	 143
+���	 143
+��	 142
+���	 142
+���	 142
+��	 142
+��	 141
+���	 140
+-_	 140
+��	 139
+��	 139
+���	 138
+��_	 138
+�	 137
+��	 137
+��_	 137
+_�	 136
+�,	 136
+�,_	 136
+��	 136
+�_	 135
+_�	 135
+��	 134
+_��	 134
+���	 134
+���	 133
+��_	 133
+��	 133
+���	 133
+��	 133
+���	 132
+_-_	 131
+��	 131
+��	 131
+_��	 129
+��	 129
+���	 129
+��	 129
+���	 129
+_��	 127
+��	 127
+_��	 127
+���	 127
+���	 126
+��	 126
+_��	 126
+����	 126
+���	 125
+���	 125
+��_	 124
+��	 123
+��	 123
+��_	 123
+_��	 123
+����	 123
+�_	 122
+��	 122
+��	 122
+���	 121
+���	 121
+��_	 121
+��_	 121
+��	 121
+���	 121
+��	 120
+_��	 120
+��_	 119
+��	 119
+_��	 118
+���	 118
+_��	 117
+��_	 117
+���	 117
+�	 116
+_��	 116
+��	 116
+���	 115
+��	 115
+��	 115
+���	 114
+��	 114
+����	 113
+���_	 113
+��	 113
+��	 113
+��	 113
+���	 112
+���_	 112
+_�	 112
+���	 111
+��	 111
+_���	 111
+��	 111
+�,	 111
+���	 111
+�,_	 111
+���	 110
+��	 110
+���	 109
+��	 109
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/irish.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/irish.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/irish.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 8010
+a	 2622
+i	 1573
+h	 1334
+n	 1247
+r	 968
+_a	 847
+e	 830
+s	 817
+t	 747
+l	 639
+c	 636
+g	 598
+o	 590
+d	 554
+n_	 501
+a_	 487
+m	 432
+an	 415
+u	 413
+b	 379
+h_	 352
+ai	 350
+ch	 350
+ea	 346
+r_	 346
+�	 334
+�	 321
+_s	 309
+�	 306
+in	 281
+ar	 277
+.	 269
+_d	 266
+s_	 254
+ir	 253
+_b	 250
+f	 250
+an_	 246
+,	 241
+,_	 226
+ag	 225
+_an	 221
+bh	 218
+_c	 216
+._	 212
+ac	 210
+ha	 208
+_a_	 201
+"	 199
+_m	 199
+th	 198
+_t	 190
+ach	 182
+_ag	 180
+_an_	 179
+�_	 176
+_l	 168
+na	 168
+nn	 160
+e_	 159
+ar_	 158
+_g	 157
+�	 156
+_i	 152
+il	 150
+le	 150
+is	 143
+�	 142
+_bh	 138
+ei	 138
+g_	 135
+_f	 135
+dh	 135
+l_	 126
+t_	 125
+ig	 123
+�_	 122
+_n	 120
+gu	 120
+�_	 120
+mh	 118
+id	 117
+ch_	 117
+ad	 116
+he	 114
+ir_	 114
+ra	 109
+o_	 109
+ach_	 107
+ia	 105
+_ar	 105
+us	 104
+ui	 104
+_"	 101
+us_	 100
+T	 99
+am	 99
+ta	 98
+gus	 98
+gus_	 98
+_le	 97
+gh	 97
+_ch	 97
+agus	 94
+agus_	 94
+agu	 94
+�a	 93
+_agus	 93
+_agu	 93
+ean	 93
+na_	 92
+d_	 92
+�i	 91
+p	 89
+it	 89
+A	 89
+_ar_	 88
+rt	 86
+al	 85
+oi	 84
+sa	 84
+"_	 82
+hai	 81
+_r	 79
+nn_	 79
+hu	 79
+as	 79
+�i	 78
+_T	 78
+ma	 77
+air	 77
+at	 77
+ann	 76
+B	 76
+s�	 76
+h�	 75
+igh	 74
+st	 74
+ga	 73
+go	 71
+ua	 71
+ne	 71
+la	 71
+-	 71
+de	 71
+te	 71
+re	 70
+inn	 70
+ith	 69
+eac	 69
+_s�	 69
+in_	 68
+_go	 68
+hi	 68
+each	 68
+dh_	 68
+si	 67
+ag_	 67
+_go_	 66
+hea	 66
+go_	 66
+tha	 64
+om	 64
+_s�_	 63
+s�_	 63
+h�_	 63
+on	 62
+se	 61
+�i	 60
+nt	 60
+C	 60
+D	 59
+i_	 58
+_ag_	 58
+is_	 58
+�o	 58
+_de	 57
+_B	 56
+il_	 56
+or	 56
+_th	 54
+ca	 53
+fa	 53
+amh	 53
+_A	 53
+le_	 52
+?	 52
+S	 51
+io	 51
+_in	 51
+s�	 51
+li	 51
+rai	 50
+hf	 50
+ht	 50
+eo	 50
+sc	 50
+ri	 49
+:	 49
+igh_	 49
+gh_	 49
+_s�	 49
+:_	 49
+h�	 49
+_D	 49
+be	 49
+aig	 49
+h�	 48
+oc	 48
+idh	 48
+rt_	 48
+ho	 47
+os	 47
+ann_	 47
+_C	 46
+!	 46
+Bh	 46
+bhf	 45
+_si	 45
+lt	 45
+_bhf	 45
+irt	 45
+ear	 44
+_na	 44
+ta_	 44
+air_	 44
+_p	 44
+im	 44
+aga	 44
+_ma	 44
+_S	 44
+aigh	 43
+�n	 43
+_dh	 43
+uai	 43
+ao	 43
+cht	 43
+ain	 42
+bhe	 42
+ait	 42
+fh	 42
+sa_	 41
+m_	 41
+adh	 41
+ile	 41
+_�	 41
+ail	 41
+eir	 41
+�i	 41
+_Bh	 40
+as_	 40
+cha	 40
+idh_	 40
+h�i	 39
+_i_	 39
+bh_	 39
+th_	 39
+ad_	 39
+och	 39
+mh_	 39
+tr	 39
+rea	 38
+_se	 38
+ro	 38
+r�	 38
+hair	 38
+_is	 38
+uil	 37
+i�	 37
+�in	 37
+I	 37
+ll	 37
+m�	 37
+_be	 36
+ba	 36
+eann	 36
+t�	 36
+_o	 36
+M	 36
+aid	 36
+aith	 36
+ib	 36
+'	 36
+tea	 36
+_m�	 35
+chu	 35
+ibh	 35
+each_	 35
+ean_	 34
+irt_	 34
+_na_	 34
+N	 34
+ist	 34
+fu	 34
+mha	 34
+bea	 34
+h.	 34
+_bhe	 34
+l�	 34
+ic	 34
+_s�_	 33
+eis	 33
+bh�	 33
+ni	 33
+h�a	 33
+_sa	 33
+ith_	 33
+s�_	 33
+har	 33
+_bh�	 33
+ig_	 32
+ur	 32
+a�	 32
+hr	 32
+_am	 32
+_bh�_	 31
+da	 31
+�ir	 31
+hfu	 31
+_chu	 31
+ol	 31
+ne_	 31
+_fa	 31
+An	 31
+Bh�_	 31
+Bh�	 31
+n,	 31
+_ac	 31
+bh�_	 31
+_bhfu	 30
+_�	 30
+ana	 30
+_M	 30
+m�_	 30
+_fh	 30
+aigh_	 30
+bhfu	 30
+_m�_	 30
+t�	 29
+_le_	 29
+t�_	 29
+hean	 29
+h�in	 29
+sin	 29
+eir_	 29
+nne	 29
+c�	 29
+_aga	 29
+h._	 29
+T�	 29
+ibh_	 29
+iste	 28
+An_	 28
+do	 28
+hui	 28
+fui	 28
+n�	 28
+ste	 28
+acht	 28
+n,_	 28
+co	 28
+dea	 28
+ng	 28
+nach	 28
+id_	 28
+hfui	 28
+..	 28
+lei	 28
+nac	 28
+ce	 27
+a.	 27
+c_	 27
+lea	 27
+hfuil	 27
+_Bh�_	 27
+_bea	 27
+adh_	 27
+di	 27
+fuil	 27
+."	 27
+T�_	 27
+ha_	 27
+�_	 27
+uil_	 27
+."_	 27
+bhfui	 27
+_Bh�	 27
+�an	 27
+_do	 27
+lta	 27
+aoi	 27
+_lei	 27
+_mh	 26
+d�	 26
+fuil_	 26
+eat	 26
+-_	 26
+teac	 26
+ath	 26
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/basque.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/basque.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/basque.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 12114
+a	 5537
+e	 4040
+i	 3103
+t	 2567
+n	 2474
+r	 2406
+o	 1937
+k	 1761
+z	 1627
+u	 1561
+d	 1367
+l	 1075
+s	 1048
+b	 995
+n_	 958
+a_	 957
+en	 802
+g	 772
+_e	 736
+er	 680
+ra	 669
+.	 625
+at	 610
+_b	 594
+ar	 589
+an	 585
+_d	 580
+,	 569
+,_	 569
+h	 563
+ta	 563
+te	 555
+._	 520
+ko	 513
+m	 503
+o_	 486
+al	 481
+en_	 471
+tz	 458
+re	 435
+_a	 423
+ik	 416
+in	 409
+it	 392
+za	 391
+ak	 388
+ba	 358
+et	 357
+da	 352
+di	 351
+ka	 350
+ze	 349
+ai	 347
+p	 340
+ri	 335
+la	 329
+an_	 327
+de	 322
+ez	 318
+na	 314
+ti	 307
+be	 305
+i_	 302
+iz	 294
+k_	 293
+tu	 289
+eta	 287
+(	 280
+)	 280
+_i	 279
+or	 276
+_(	 270
+ko_	 269
+ek	 265
+rr	 264
+_h	 263
+e_	 260
+es	 260
+_ba	 258
+nt	 258
+ha	 255
+_g	 247
+era	 246
+ia	 240
+_be	 234
+oa	 229
+un	 229
+ta_	 218
+ma	 212
+on	 211
+z_	 209
+du	 207
+(_	 205
+_(_	 205
+:	 204
+tze	 204
+:_	 204
+us	 191
+u_	 191
+_da	 188
+ren	 183
+az	 183
+_)	 183
+ur	 182
+st	 182
+ea	 181
+_et	 181
+eta_	 179
+zi	 178
+si	 177
+zen	 177
+as	 176
+_n	 175
+go	 175
+_eta	 172
+il	 169
+tik	 169
+_z	 167
+_eta_	 167
+ne	 167
+bi	 166
+zk	 166
+sk	 165
+ag	 163
+t_	 162
+le	 160
+rt	 160
+ke	 158
+-	 150
+gu	 148
+au	 148
+tza	 147
+_de	 147
+ati	 146
+ut	 146
+A	 145
+li	 145
+hi	 145
+E	 144
+bat	 144
+_o	 143
+a,	 142
+a,_	 142
+_m	 141
+ntz	 141
+ad	 140
+ren_	 139
+_er	 138
+io	 138
+)_	 138
+_ez	 138
+ir	 137
+eh	 137
+ab	 135
+ate	 135
+ak_	 134
+sa	 134
+ra_	 134
+_bat	 133
+nd	 133
+_l	 133
+ki	 132
+ere	 131
+ika	 125
+ku	 125
+f	 124
+ga	 123
+ld	 122
+_di	 121
+arr	 120
+el	 120
+eg	 119
+uz	 119
+are	 116
+ng	 116
+os	 116
+_E	 115
+gi	 113
+_p	 113
+_du	 113
+mo	 113
+zen_	 112
+ib	 111
+_k	 110
+ber	 109
+ako	 108
+_iz	 107
+iza	 107
+ala	 107
+itz	 107
+har	 106
+eko	 106
+adi	 105
+l_	 105
+ie	 105
+ste	 105
+atu	 104
+am	 104
+ska	 104
+ah	 104
+_.	 104
+r_	 104
+zt	 103
+rri	 103
+ait	 103
+ua	 103
+tzen	 103
+ald	 103
+usk	 102
+aren	 102
+_._	 102
+ro	 102
+id	 100
+la_	 99
+_s	 98
+ue	 98
+tek	 97
+uska	 97
+atz	 96
+aren_	 96
+_ha	 95
+rre	 95
+"	 94
+atik	 94
+tzen_	 94
+ara	 94
+in_	 93
+ni	 93
+j	 92
+ge	 91
+ez_	 91
+ain	 91
+od	 91
+no	 91
+na_	 91
+ri_	 90
+tan	 90
+mat	 90
+do	 89
+_mo	 88
+ho	 88
+iko	 88
+beh	 88
+_ad	 88
+al_	 87
+_iza	 87
+I	 87
+zan	 87
+_ze	 87
+_adi	 87
+_A	 86
+uk	 86
+eha	 85
+dit	 85
+ru	 85
+pe	 85
+eko_	 84
+ela	 84
+ed	 84
+kar	 84
+n,_	 83
+ari	 83
+bil	 83
+_beh	 83
+bai	 83
+tu_	 83
+n,	 83
+ehar	 83
+_izan	 82
+itu	 82
+_ho	 82
+is	 82
+ean	 82
+ama	 82
+izan	 82
+_)_	 81
+ik_	 81
+B	 80
+koa	 80
+ot	 80
+_na	 79
+zu	 79
+beha	 78
+behar	 78
+_t	 78
+H	 78
+_ko	 78
+dir	 77
+mati	 76
+_j	 75
+at_	 75
+em	 74
+tika	 74
+K	 74
+_B	 74
+zte	 74
+ten	 74
+_beha	 74
+ter	 74
+matik	 73
+egi	 73
+_dir	 73
+a.	 72
+ago	 72
+kal	 72
+ram	 72
+ena	 72
+unt	 71
+lt	 71
+_H	 71
+su	 71
+mod	 71
+bo	 71
+G	 70
+_ber	 70
+lde	 70
+c	 69
+te_	 69
+ar_	 69
+me	 69
+ina	 69
+dal	 69
+ako_	 68
+L	 68
+rik	 68
+a._	 68
+ori	 68
+ite	 68
+raz	 67
+alde	 67
+)._	 67
+).	 67
+zio	 66
+_ez_	 66
+tan_	 66
+amat	 66
+atika	 66
+est	 66
+ntza	 65
+dut	 65
+izk	 65
+_ga	 65
+ia_	 65
+s_	 65
+ita	 65
+tea	 64
+ei	 64
+hal	 64
+_mod	 64
+pa	 64
+bu	 64
+re_	 63
+eu	 63
+ert	 63
+oa_	 63
+_era	 63
+ten_	 63
+_G	 63
+_eg	 63
+rama	 63
+odal	 63
+ramat	 63
+oda	 63
+amati	 62
+atze	 62
+gr	 62
+untz	 62
+eza	 62
+gra	 62
+_ge	 61
+gram	 61
+kat	 61
+abi	 61
+_gr	 60
+_gram	 60
+_gra	 60
+int	 60
+rd	 60
+_in	 60
+k,	 59
+_hi	 59
+zko	 59
+k,_	 59
+pr	 59
+rab	 59
+da_	 59
+ide	 58
+_)._	 57
+tat	 57
+ing	 57
+ira	 57
+tak	 57
+x	 57
+_).	 57
+_ed	 57
+_es	 57
+_bi	 57
+rak	 56
+_-	 56
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/greek-iso8859-7.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/greek-iso8859-7.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/greek-iso8859-7.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 89284
+�	 19666
+�	 16086
+�	 15826
+�	 14848
+�	 12766
+�	 12189
+�	 8776
+�	 8653
+�	 8399
+�	 7761
+�	 7529
+�	 6850
+�	 6284
+_�	 5918
+�	 5802
+�	 5371
+�_	 5272
+�	 5236
+�	 4739
+�	 4609
+�	 4489
+��	 4461
+�_	 4111
+��	 4075
+�_	 4033
+�_	 4019
+.	 3916
+_�	 3897
+�_	 3836
+._	 3810
+�_	 3661
+_�	 3414
+_�	 3333
+"	 3247
+_�	 3242
+_��	 3118
+,	 3106
+,_	 3068
+�	 3058
+_�	 2912
+�	 2689
+��	 2593
+�	 2455
+��	 2420
+�	 2411
+��	 2406
+��	 2406
+_�	 2353
+-	 2335
+-_	 2192
+�	 2171
+��	 2162
+��	 2151
+�	 2141
+�_	 2133
+��	 2100
+�	 2053
+�	 1989
+��_	 1974
+��	 1889
+_��	 1882
+��	 1864
+��_	 1802
+��	 1771
+��_	 1727
+��	 1709
+_�	 1647
+_"	 1619
+�_	 1609
+��	 1602
+��_	 1518
+��	 1501
+��	 1501
+���	 1495
+��	 1460
+_���	 1407
+_�	 1405
+_��	 1396
+�	 1364
+��	 1359
+��	 1300
+��	 1298
+�	 1274
+��	 1252
+�_	 1241
+_�	 1231
+�	 1223
+��	 1220
+_��_	 1196
+��	 1187
+��	 1184
+_�	 1183
+_��	 1177
+�	 1158
+_��	 1150
+�_	 1150
+_��	 1124
+��	 1115
+���	 1110
+_���	 1093
+��_	 1082
+��	 1078
+���_	 1061
+_��_	 1060
+_���_	 1053
+��	 1049
+��	 1048
+��	 1036
+��	 1024
+��_	 1018
+��	 1003
+��	 993
+_��	 984
+��_	 974
+��	 973
+_�	 967
+��	 947
+��	 936
+��_	 935
+��	 901
+��	 892
+_��	 890
+��	 884
+���_	 871
+��_	 869
+��	 865
+_���_	 854
+��	 841
+��_	 840
+��	 834
+��	 833
+��	 832
+��	 824
+��	 820
+��	 808
+_��	 804
+��	 796
+�	 796
+��	 783
+��	 777
+��	 772
+��	 766
+��	 762
+�	 759
+��	 745
+��	 742
+��_	 740
+���	 738
+�_	 730
+��_	 728
+�	 717
+�	 714
+_�	 711
+��	 705
+��	 704
+��	 697
+��_	 688
+��	 684
+��_	 683
+_�	 680
+_�	 675
+��	 671
+_�	 670
+���	 663
+���_	 658
+_���	 647
+�_	 645
+��_	 638
+_�	 633
+_�_	 631
+",	 630
+_��	 626
+_�	 624
+��	 624
+��	 623
+",_	 623
+���	 620
+���	 619
+��	 618
+��	 617
+���	 617
+_���	 616
+��	 612
+�_	 611
+��	 607
+��	 604
+��	 595
+_�	 594
+��	 590
+_��_	 586
+��	 580
+���_	 577
+��	 577
+_�	 575
+���_	 572
+��	 570
+��	 570
+_���_	 569
+��	 562
+���	 554
+���	 553
+��	 552
+���_	 551
+��	 547
+��	 547
+��	 544
+_�	 540
+��	 536
+��_	 534
+��	 528
+_�_	 525
+��	 520
+".	 519
+_���	 516
+_�	 515
+"._	 513
+��_	 512
+�.	 510
+���	 508
+���_	 504
+_���	 503
+�._	 501
+_��	 500
+��	 497
+���_	 496
+��	 493
+��	 492
+�	 491
+_���_	 490
+��	 489
+���	 489
+����	 485
+_����	 483
+_���	 483
+��_	 482
+_���_	 481
+��	 480
+��	 480
+_��	 479
+��	 477
+_���_	 475
+��	 473
+_�	 468
+"_	 463
+���	 463
+��	 461
+��	 452
+_��	 452
+��	 451
+��	 451
+_���	 450
+_��	 449
+��	 447
+��	 446
+��	 446
+_��	 445
+_���_	 443
+�.	 441
+�._	 441
+���	 439
+��	 439
+��	 439
+��	 438
+���	 437
+��	 432
+_��	 428
+_��	 427
+��_	 427
+��	 423
+;	 423
+_��	 422
+��	 421
+���	 421
+_�	 418
+���	 415
+��	 411
+��	 408
+���	 405
+�.	 403
+��	 402
+��	 402
+�,	 402
+�,_	 401
+�._	 398
+��	 397
+_��	 397
+��	 396
+_��	 395
+_�	 393
+_��	 392
+��	 391
+��	 391
+��	 390
+���	 389
+��	 389
+���	 388
+��	 388
+_��	 387
+��_	 386
+��	 384
+���	 384
+�	 383
+���	 382
+�_	 376
+���	 375
+��	 372
+_���	 370
+_��_	 367
+_���	 365
+_���	 362
+_��	 361
+��	 361
+���	 359
+��_	 358
+��	 358
+_��	 354
+_���	 354
+���	 352
+�.	 352
+�._	 351
+���	 351
+��	 350
+����	 348
+���	 348
+���_	 348
+��_	 347
+��	 346
+�	 346
+�.	 346
+���_	 346
+�._	 345
+���	 345
+���_	 345
+�,	 344
+�,_	 344
+���_	 344
+��	 343
+��	 343
+�-	 342
+��	 341
+_�.	 340
+���	 339
+���	 339
+_�._	 339
+��	 339
+�-_	 338
+��	 338
+��	 338
+��	 338
+����	 338
+_���	 338
+_���	 338
+_����	 337
+��	 336
+���	 336
+����	 336
+�����	 336
+����	 336
+_��	 334
+�����	 334
+_�	 334
+����	 334
+��_	 333
+��	 332
+���_	 331
+�	 331
+��	 330
+���	 330
+_��	 329
+��_	 328
+��	 328
+�	 326
+_���	 325
+_���_	 325
+��	 324
+��_	 324
+���	 324
+��	 323
+����_	 323
+���	 322
+_�	 321
+�����	 321
+��_	 321
+���_	 321
+_��	 321
+��	 320
+_���_	 320
+���	 320
+��	 318
+;"	 316
+;"_	 316
+�	 315
+��	 314
+��_	 313
+_��	 312
+��	 312
+_��_	 310
+��	 309
+��.	 309
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/japanese-euc_jp.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/japanese-euc_jp.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/japanese-euc_jp.lm	(revision 258)
@@ -0,0 +1,400 @@
+�	 78988
+�	 57258
+_	 34456
+�	 22280
+�	 18223
+�	 11290
+�	 11237
+�	 10621
+�	 9502
+�	 8859
+�	 8812
+��	 8266
+�	 8180
+�	 7520
+�	 7325
+�	 6982
+�	 6930
+�	 6929
+�	 6896
+�	 6865
+��	 6858
+�	 6261
+��	 6067
+��	 5926
+���	 5888
+�	 5878
+�	 5806
+�	 5562
+�	 5426
+�	 5314
+��	 5228
+�	 5011
+�	 4836
+��	 4775
+�	 4385
+�_	 4323
+��	 4310
+��	 4305
+��_	 4294
+�	 4253
+��	 4090
+��	 4075
+�	 4032
+�	 4029
+�	 3975
+�	 3947
+�	 3923
+�	 3853
+�	 3845
+�	 3759
+�	 3583
+��	 3485
+��	 3475
+�	 3367
+�	 3366
+�	 3366
+��	 3314
+�	 3313
+�	 3282
+�	 3273
+��	 3255
+�	 3207
+å	 3188
+��	 3182
+��	 3175
+�å	 3170
+��	 3131
+�	 3058
+��	 3035
+��	 3024
+���	 3000
+롣	 2952
+롣_	 2948
+�롣	 2947
+�롣_	 2943
+�	 2905
+�	 2893
+��	 2865
+��	 2848
+�	 2819
+Ȥ	 2791
+��	 2776
+���	 2749
+����	 2730
+����	 2729
+�����	 2729
+�	 2697
+�	 2689
+�	 2545
+��	 2543
+��	 2525
+���	 2473
+�����	 2459
+��	 2399
+.	 2395
+�	 2381
+,	 2380
+��	 2357
+��	 2346
+�	 2340
+�	 2328
+��	 2326
+��	 2316
+�	 2314
+�	 2293
+����	 2283
+���	 2283
+��	 2253
+._	 2251
+��	 2227
+���	 2222
+��	 2200
+_�	 2189
+Ǥ	 2172
+��	 2145
+ӥ	 2137
+��	 2112
+����	 2110
+���	 2110
+�	 2100
+��	 2061
+��	 2027
+�	 2017
+��	 2011
+��	 2007
+�ӥ	 2002
+ˤ	 1995
+���	 1983
+����	 1983
+�	 1947
+�	 1913
+�	 1861
+��	 1847
+��	 1834
+��	 1834
+��	 1826
+�	 1795
+���	 1791
+�	 1782
+�	 1782
+�ˤ	 1763
+�Ȥ	 1760
+��	 1716
+��	 1713
+�	 1709
+�	 1696
+ʤ	 1691
+��	 1688
+_�	 1686
+��	 1679
+���	 1669
+��	 1668
+�	 1666
+��	 1659
+�Ǥ	 1655
+��	 1638
+�	 1637
+��	 1612
+���	 1598
+���	 1584
+����	 1584
+�ʤ	 1570
+��	 1568
+��	 1565
+��	 1562
+��	 1554
+�	 1544
+Ƥ	 1541
+ƥ	 1538
+��	 1526
+��	 1525
+��	 1523
+���	 1523
+�	 1517
+��	 1510
+���	 1509
+-	 1490
+��	 1476
+��	 1465
+��	 1465
+�	 1464
+���	 1454
+��	 1454
+��å	 1453
+�å��	 1453
+�����	 1453
+�å�	 1453
+å��	 1453
+����	 1453
+�å�	 1453
+����	 1453
+���	 1453
+�å	 1453
+å�	 1453
+å���	 1453
+���	 1453
+�����	 1452
+�	 1450
+�	 1445
+�	 1441
+��	 1420
+�	 1419
+�	 1418
+���	 1415
+����	 1413
+����	 1413
+�����	 1413
+���	 1413
+��	 1413
+��	 1411
+ӥ�	 1406
+��ӥ	 1406
+���ӥ	 1406
+�ӥ�	 1406
+����	 1406
+���	 1406
+��	 1403
+�����	 1403
+��ӥ�	 1403
+�ƥ	 1396
+���	 1392
+���	 1383
+�	 1378
+��	 1372
+_�	 1368
+Υ	 1358
+T	 1354
+ϡ	 1341
+��	 1338
+��	 1337
+��	 1325
+�	 1323
+Τ	 1314
+�Υ	 1312
+���	 1311
+����	 1311
+Ԥ	 1308
+)	 1302
+_.	 1297
+�	 1294
+��	 1294
+���	 1292
+��	 1289
+���	 1284
+�Ƥ	 1284
+��	 1273
+��	 1260
+_._	 1244
+�	 1244
+�	 1238
+���	 1211
+��	 1190
+�	 1182
+_�	 1182
+���	 1152
+ȥ	 1151
+��	 1145
+����	 1130
+ǽ	 1129
+ե	 1126
+�	 1120
+�ե	 1113
+�ϡ	 1105
+��	 1103
+�	 1101
+�	 1084
+��	 1080
+��	 1062
+�	 1060
+��	 1051
+��	 1050
+���	 1043
+��	 1033
+��	 1033
+���	 1033
+���	 1032
+����	 1032
+ϡ�	 1030
+�ϡ�	 1030
+Ǥ�	 1022
+�Ǥ�	 1021
+Ǥ��	 1021
+�Ǥ��	 1020
+ǥ	 1012
+�	 1006
+��	 997
+��	 995
+��	 991
+ͣ	 988
+���	 985
+��	 984
+�ͣ	 983
+��	 981
+��	 976
+���	 974
+�Τ	 971
+���	 971
+��	 962
+���	 955
+�	 955
+�	 954
+�ȥ	 953
+�ǥ	 951
+��	 942
+��	 929
+��	 920
+�	 918
+�	 909
+��	 904
+�	 904
+�Ԥ	 903
+����	 900
+���	 900
+�_	 894
+��	 893
+-_	 892
+�,	 887
+�Ȥ	 886
+��,	 886
+��_	 884
+��	 881
+��	 881
+(	 878
+C	 877
+Ǥ���	 877
+I	 877
+��	 875
+��롣	 875
+i	 872
+��	 865
+��	 860
+֤	 857
+�	 856
+��	 855
+��	 855
+��	 846
+��	 841
+ޤ	 834
+���	 834
+e	 825
+���	 825
+��	 819
+����	 818
+���	 818
+��	 808
+��	 802
+�ǥ�	 796
+ǥ�	 796
+_�	 792
+a	 776
+�å�	 771
+å�	 771
+����	 770
+���	 770
+��	 767
+Ѥ	 748
+���	 743
+��	 743
+�ǥ��	 741
+ǥ��	 741
+�_	 738
+���	 732
+N	 729
+��	 728
+��	 728
+��	 727
+��	 724
+�롣	 722
+���	 718
+ˤ�	 716
+ˤ�	 716
+�ˤ�	 715
+�����	 715
+����	 715
+�ˤ�	 715
+ץ	 715
+�ץ	 711
+�����	 710
+����	 710
+�����	 710
+Ĥ	 705
+�	 702
+�	 701
+_��	 699
+���	 696
+��_	 694
+��	 694
+���	 692
+����	 692
+����	 692
+���	 686
+�Ѥ	 685
+�ʤ�	 685
+ʤ�	 685
+��	 684
+Ƥ�	 684
+n	 682
+�	 682
+��	 681
+��	 681
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/bosnian.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/bosnian.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/bosnian.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 9464
+a	 2787
+i	 2108
+e	 2077
+o	 2018
+j	 1396
+n	 1328
+s	 1170
+u	 1010
+r	 988
+d	 957
+a_	 889
+e_	 833
+t	 774
+je	 771
+k	 756
+l	 743
+m	 702
+v	 685
+p	 604
+c	 538
+i_	 538
+_s	 522
+u_	 476
+z	 463
+_p	 450
+o_	 433
+,_	 381
+,	 381
+_i	 369
+_n	 358
+b	 349
+_d	 349
+.	 346
+na	 341
+je_	 337
+._	 321
+_j	 307
+g	 299
+ra	 292
+st	 283
+ko	 278
+_je	 274
+ij	 254
+_o	 245
+ni	 240
+_k	 236
+an	 228
+oj	 227
+da	 226
+_u	 222
+pr	 221
+no	 219
+ma	 219
+la	 211
+ri	 206
+_je_	 203
+po	 203
+ci	 196
+_pr	 191
+os	 190
+od	 187
+ka	 186
+im	 185
+ti	 184
+li	 182
+vo	 178
+_po	 174
+ja	 171
+_i_	 169
+ov	 169
+al	 168
+re	 167
+ne	 167
+m_	 164
+ta	 160
+na_	 158
+ed	 157
+_m	 157
+_na	 157
+se	 156
+_u_	 154
+en	 153
+ic	 151
+sa	 151
+_b	 149
+ak	 141
+va	 140
+ad	 137
+h	 136
+ju	 135
+su	 134
+dj	 133
+ije	 133
+ar	 127
+ca	 127
+_z	 126
+nj	 125
+ji	 124
+da_	 124
+_ko	 123
+_da	 122
+il	 121
+"	 120
+av	 120
+_t	 118
+aj	 116
+ob	 115
+ro	 114
+am	 114
+vi	 114
+_su	 113
+om	 112
+dje	 112
+za	 112
+at	 111
+le	 111
+di	 110
+su_	 107
+iz	 107
+ve	 107
+lj	 106
+_se	 105
+ev	 105
+is	 105
+es	 103
+se_	 103
+do	 101
+ih	 100
+a,	 99
+_su_	 99
+a,_	 99
+on	 98
+bi	 98
+in	 97
+voj	 97
+az	 96
+ac	 95
+_da_	 95
+la_	 95
+_r	 93
+_g	 93
+jev	 92
+ma_	 92
+er	 92
+or	 91
+h_	 90
+_sa	 90
+e,	 90
+e,_	 90
+ba	 90
+ima	 89
+a.	 88
+ol	 88
+_do	 87
+dn	 87
+it	 87
+ko_	 86
+ne_	 86
+ost	 85
+ek	 85
+to	 85
+d_	 84
+as	 84
+ju_	 84
+ao	 84
+ih_	 84
+a._	 84
+te	 83
+evo	 83
+koj	 83
+pri	 82
+jevo	 82
+ce	 81
+_se_	 81
+og	 80
+go	 80
+jevoj	 79
+de	 79
+uc	 79
+evoj	 79
+_od	 78
+_za	 78
+tr	 78
+S	 77
+_koj	 76
+ke	 75
+_v	 75
+ao_	 75
+_dje	 74
+_bi	 74
+sta	 74
+_dj	 74
+cij	 74
+ik	 74
+djev	 73
+sl	 73
+_djev	 72
+ga	 72
+djevo	 72
+_ka	 71
+rij	 71
+_iz	 71
+P	 71
+_pri	 70
+_a	 69
+us	 68
+_S	 68
+mo	 67
+el	 67
+sk	 66
+me	 66
+zi	 66
+ija	 65
+n_	 65
+ku	 64
+im_	 63
+_st	 63
+ica	 63
+_na_	 62
+_ne	 62
+em	 61
+edn	 61
+jk	 61
+io	 61
+li_	 60
+ojk	 60
+evojk	 60
+_"	 60
+zn	 60
+vojk	 60
+pro	 59
+lo	 59
+ije_	 59
+jed	 58
+ke_	 58
+om_	 58
+jen	 58
+sti	 57
+_im	 57
+le_	 57
+_ra	 56
+e.	 56
+ze	 55
+_pro	 55
+nu	 55
+nje	 55
+ti_	 55
+ec	 55
+pre	 55
+oc	 54
+aci	 54
+no_	 54
+et	 54
+oji	 53
+si	 53
+ara	 53
+ama	 53
+z_	 53
+pos	 52
+rad	 52
+ran	 52
+ima_	 52
+ru	 52
+_P	 52
+tu	 52
+mu	 51
+e._	 51
+ja_	 50
+_pre	 50
+sa_	 49
+io_	 49
+od_	 48
+ni_	 48
+_nj	 48
+j_	 48
+_pos	 47
+_c	 47
+ila	 47
+K	 46
+_sa_	 46
+uz	 46
+N	 46
+_ni	 45
+zna	 45
+U	 45
+za_	 45
+_no	 45
+ako	 45
+u,	 44
+lu	 44
+ali	 44
+u,_	 44
+sto	 44
+ste	 44
+ve_	 44
+ani	 44
+oli	 44
+aka	 44
+_jed	 43
+i,_	 43
+ji_	 43
+uci	 43
+i,	 43
+ci_	 43
+osti	 43
+_N	 42
+dr	 42
+so	 42
+ust	 41
+ila_	 41
+B	 41
+-	 41
+red	 41
+jke	 41
+sv	 41
+_go	 41
+bar	 41
+g_	 41
+est	 40
+D	 40
+iv	 40
+vojke	 40
+aju	 40
+ta_	 40
+A	 40
+lje	 40
+jedn	 40
+bil	 40
+ojke	 40
+ova	 40
+ati	 39
+_mu	 39
+pa	 39
+M	 39
+_ba	 39
+ca_	 39
+O	 39
+ka_	 39
+_a_	 38
+_B	 38
+_ima	 38
+sn	 38
+nu_	 38
+T	 38
+to_	 38
+eg	 38
+ava	 38
+ros	 37
+ir	 37
+ala	 37
+og_	 37
+osl	 37
+ovi	 37
+koji	 37
+_sv	 37
+dv	 36
+ric	 36
+_za_	 36
+br	 36
+_on	 36
+odi	 36
+_koji	 36
+_jedn	 35
+nik	 35
+dno	 35
+_D	 35
+jo	 35
+tra	 35
+_M	 35
+sp	 35
+iz_	 35
+oz	 35
+vr	 35
+u.	 35
+eri	 35
+I	 35
+eko	 35
+ale	 35
+_ma	 34
+lik	 34
+_bil	 34
+c_	 34
+ut	 34
+je,_	 34
+u._	 34
+str	 34
+je,	 34
+adi	 34
+tit	 34
+_iz_	 34
+iti	 34
+i.	 33
+_rad	 33
+ici	 33
+rost	 33
+aju_	 33
+va_	 33
+_ob	 33
+nog	 33
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/turkish.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/turkish.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/turkish.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 23226
+i	 8957
+a	 7675
+e	 6219
+n	 5169
+&	 4950
+;	 4950
+l	 4674
+r	 4464
+&i	 3206
+&i;	 3206
+i;	 3206
+s	 3206
+k	 3009
+d	 2977
+t	 2442
+m	 2010
+y	 2001
+u	 1885
+n_	 1725
+g	 1584
+o	 1567
+b	 1470
+e_	 1426
+�	 1353
+ar	 1273
+la	 1236
+a_	 1209
+i_	 1169
+in	 1124
+_b	 1101
+an	 1097
+er	 1073
+le	 1058
+s;	 1036
+&s;	 1036
+&s	 1036
+;_	 1018
+de	 936
+;n	 918
+&i;n	 917
+i;n	 917
+,_	 872
+_,	 872
+_,_	 872
+,	 872
+i;_	 863
+&i;_	 863
+_k	 816
+en	 769
+r_	 762
+_y	 759
+da	 759
+il	 759
+k_	 750
+z	 739
+nd	 725
+&g;	 708
+g;	 708
+&g	 708
+ra	 697
+_a	 692
+_d	 692
+_s	 676
+'	 673
+_i	 644
+._	 641
+.	 641
+_.	 637
+_._	 637
+c	 637
+ka	 635
+v	 632
+;&	 624
+h	 615
+_g	 597
+ri	 596
+�	 596
+lar	 583
+li	 580
+ma	 559
+ya	 555
+ler	 553
+p	 547
+re	 529
+al	 529
+�	 527
+_t	 520
+ir	 508
+ak	 502
+bi	 500
+;l	 480
+in_	 478
+di	 477
+r&	 468
+el	 453
+et	 449
+ek	 445
+n&	 439
+_o	 439
+ol	 437
+da_	 434
+n&i	 433
+n&i;	 433
+ni	 429
+ti	 428
+de_	 425
+an_	 422
+eri	 421
+r&i	 417
+r&i;	 417
+s&	 413
+s&i	 413
+s&i;	 413
+ar&	 412
+me	 407
+te	 405
+a&	 404
+i&	 390
+ay	 387
+ne	 380
+_bi	 373
+_ka	 368
+ar&i;	 367
+ar&i	 367
+u_	 363
+as	 363
+_e	 362
+ta	 359
+&i;l	 352
+i;l	 352
+nda	 350
+ki	 347
+na	 346
+si	 343
+_v	 337
+;&i;	 334
+;&i	 334
+ve	 334
+ara	 333
+en_	 332
+;i	 331
+on	 328
+un	 326
+l&i;	 322
+l&	 322
+l&i	 322
+leri	 322
+ba	 318
+_m	 318
+ik	 315
+mi	 315
+f	 306
+lar&	 302
+lar&i	 302
+sa	 298
+_h	 297
+ld	 296
+&i;&	 290
+i;&	 290
+_ve	 288
+l_	 287
+ge	 286
+is	 285
+ed	 285
+i&s;	 284
+i&s	 284
+;r	 282
+_ya	 279
+_ol	 279
+d&i;	 278
+d&	 278
+d&i	 278
+nl	 277
+kl	 275
+;k	 274
+&i;n_	 271
+;n_	 271
+i;n_	 271
+ile	 270
+or	 269
+iy	 267
+a&s	 264
+a&s;	 264
+y&i;	 262
+ad	 262
+y&	 262
+y&i	 262
+ye	 259
+ha	 258
+es	 258
+t&	 257
+t&i	 257
+t&i;	 257
+ini	 253
+;nd	 253
+i;nd	 253
+�r	 253
+&i;nd	 253
+se	 248
+_ge	 248
+i;nda	 248
+;nda	 248
+;n&i;	 247
+i;n&	 247
+;n&	 247
+&i;n&	 247
+i;n&i	 247
+;n&i	 247
+bu	 245
+_'	 245
+_ba	 244
+as&i	 242
+as&i;	 242
+_de	 242
+as&	 242
+at	 240
+am	 240
+nda_	 239
+ar_	 231
+ve_	 230
+rin	 230
+_ve_	 228
+_bu	 227
+im	 227
+&i;r	 226
+i;r	 226
+ur	 221
+g;&i	 220
+g;&	 220
+&g;&	 220
+yo	 220
+&g;&i	 220
+g;&i;	 220
+ul	 215
+ak_	 215
+ke	 213
+nu	 213
+erin	 211
+g;i	 208
+&g;i	 208
+lan	 207
+bir	 205
+r&i;n	 205
+nde	 202
+rl	 202
+n&i;_	 201
+ko	 201
+ca	 200
+m_	 197
+rd	 196
+t_	 194
+er_	 194
+st	 193
+em	 193
+_sa	 190
+lm	 189
+rt	 188
+_�	 187
+i;k	 187
+�n	 187
+ola	 187
+&i;k	 187
+lerin	 185
+ce	 185
+'_	 185
+;m	 183
+az	 183
+rk	 182
+y�	 182
+;la	 181
+_bir	 181
+ir_	 180
+n&i;n	 180
+ru	 180
+lu	 180
+;nda_	 178
+e&	 177
+_�	 176
+_ha	 175
+_ko	 173
+esi	 171
+_�	 170
+ap	 170
+ni_	 168
+t�	 167
+den	 164
+ind	 161
+di_	 161
+be	 161
+s&i;n	 160
+nin	 159
+�z	 158
+ri_	 155
+y&i;l	 155
+_p	 154
+nin_	 153
+&s;_	 152
+_y&	 152
+edi	 152
+s;_	 152
+_y&i;	 152
+_y&i	 152
+yl	 151
+le_	 151
+inde	 150
+eti	 150
+ala	 150
+&i;&s	 149
+ele	 149
+i;&s;	 149
+;&s;	 149
+;&s	 149
+i;&s	 149
+ek_	 148
+ere	 148
+�i	 147
+du	 145
+�n	 145
+z_	 144
+na_	 144
+eri_	 143
+ec	 142
+g�	 142
+i;&g;	 141
+s&i;_	 141
+bir_	 141
+&i;&g	 141
+i;&g	 141
+ah	 141
+;&g;	 141
+;&g	 141
+_g�	 140
+lar_	 140
+eli	 140
+a&g;	 140
+a&g	 140
+dan	 140
+ac	 140
+i�	 140
+an&	 140
+u&	 139
+;&g;&	 138
+_y�	 138
+an&i	 138
+an&i;	 138
+pa	 138
+it	 137
+_ola	 137
+_bir_	 136
+;t	 135
+�r	 135
+ne_	 135
+ini_	 134
+lma	 134
+kan	 133
+ab	 132
+to	 131
+ba&	 131
+kar	 130
+r&i;_	 130
+_ar	 129
+ili	 129
+li_	 129
+ki_	 128
+bu_	 127
+anl	 127
+d�	 127
+ler_	 126
+_ba&	 126
+kon	 126
+ll	 125
+tl	 125
+ine	 125
+e&g;	 124
+e&g	 124
+_il	 124
+_bu_	 124
+re_	 124
+bil	 123
+&s;i	 123
+;&i;n	 123
+s;i	 123
+ede	 123
+zd	 123
+''	 122
+_da	 122
+_''	 122
+_t�	 122
+ret	 122
+_-_	 121
+_''_	 121
+mas	 121
+''_	 121
+-	 121
+dan_	 121
+leri_	 121
+;u	 121
+_-	 121
+ev	 121
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/frisian.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/frisian.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/frisian.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 46446
+e	 15767
+n	 9616
+i	 7837
+a	 7830
+t	 7562
+r	 7297
+s	 6307
+o	 4784
+n_	 4595
+d	 4564
+e_	 4213
+l	 4032
+k	 3951
+t_	 3079
+en	 2863
+m	 2605
+er	 2492
+y	 2462
+f	 2371
+_d	 2253
+de	 2124
+h	 1943
+in	 1899
+w	 1898
+en_	 1857
+_i	 1815
+u	 1769
+g	 1738
+an	 1690
+j	 1678
+p	 1651
+r_	 1619
+_f	 1602
+.	 1601
+ar	 1561
+te	 1545
+b	 1488
+s_	 1476
+._	 1435
+_s	 1370
+de_	 1235
+_de	 1224
+_w	 1181
+it	 1172
+ie	 1140
+,	 1078
+_o	 1056
+,_	 1056
+oa	 1045
+_e	 1040
+st	 1038
+an_	 1010
+_b	 972
+_de_	 965
+ke	 949
+_m	 947
+_t	 933
+ne	 920
+er_	 895
+at	 863
+sk	 856
+c	 850
+it_	 848
+_h	 838
+ei	 832
+k_	 817
+yn	 790
+ch	 784
+le	 772
+is	 769
+je	 765
+el	 761
+me	 758
+ea	 754
+_k	 740
+fa	 736
+in_	 735
+'	 733
+_it	 733
+_it_	 727
+ge	 727
+re	 725
+al	 724
+_fa	 684
+yn_	 640
+aa	 628
+fan	 626
+_y	 618
+ar_	 617
+et	 616
+ri	 615
+_fan	 613
+_n	 612
+li	 611
+_yn	 610
+_en	 598
+fan_	 594
+oe	 589
+_fan_	 584
+_en_	 583
+at_	 581
+_in	 570
+oar	 565
+_in_	 560
+y_	 555
+F	 549
+es	 540
+_a	 536
+ng	 523
+be	 514
+sj	 512
+nt	 510
+l_	 510
+_F	 506
+ns	 506
+D	 499
+te_	 499
+der	 497
+_yn_	 497
+ti	 493
+ek	 490
+ro	 476
+rs	 474
+rd	 473
+se	 470
+fo	 470
+ys	 462
+op	 461
+�	 461
+we	 456
+ry	 451
+da	 445
+d_	 443
+is_	 442
+_D	 440
+ur	 433
+i_	 432
+ha	 426
+_me	 425
+ear	 422
+_l	 417
+ed	 410
+as	 409
+om	 407
+ei_	 406
+Fr	 405
+nd	 404
+_fo	 394
+_p	 393
+oc	 390
+rys	 389
+ol	 386
+_Fr	 386
+och	 383
+fe	 381
+ik	 379
+ma	 379
+ra	 377
+nn	 374
+_g	 368
+_da	 367
+di	 363
+ts	 362
+ta	 361
+a_	 360
+ko	 359
+et_	 358
+ysk	 356
+Fry	 354
+Frys	 354
+z	 354
+ll	 350
+_be	 349
+ke_	 348
+I	 347
+ing	 346
+_'	 345
+m_	 343
+h_	 340
+ske	 339
+_ha	 338
+sje	 336
+_Fry	 336
+_Frys	 336
+wi	 335
+_op	 334
+p_	 334
+_is	 333
+ch_	 333
+tr	 330
+ten	 328
+ers	 327
+wa	 325
+ter	 322
+ji	 322
+rysk	 319
+_ne	 319
+je_	 312
+foa	 311
+�	 309
+jo	 307
+_is_	 307
+ste	 307
+_te	 306
+�	 301
+n.	 301
+nne	 300
+rt	 300
+foar	 299
+S	 299
+mei	 299
+_r	 298
+_oa	 297
+wu	 293
+ak	 291
+si	 290
+wur	 290
+ni	 290
+pe	 288
+Frysk	 287
+oan	 286
+n._	 285
+_mei	 284
+der_	 281
+_foar	 281
+_foa	 281
+ht	 278
+cht	 277
+-	 275
+�	 275
+_j	 274
+ne_	 273
+ken	 273
+fer	 271
+�n	 270
+am	 270
+on	 268
+nde	 264
+_S	 264
+B	 262
+ki	 261
+id	 261
+le_	 261
+dat	 260
+v	 259
+_I	 256
+oar_	 255
+op_	 254
+lle	 252
+la	 244
+tt	 243
+dat_	 242
+_fe	 242
+mm	 240
+inn	 239
+_wi	 239
+_dat	 237
+g_	 236
+mei_	 236
+al_	 235
+_B	 234
+e.	 234
+ld	 231
+_al	 230
+_wur	 230
+urd	 230
+_wu	 230
+_op_	 230
+De	 229
+inne	 228
+ng_	 227
+_mei_	 227
+'t	 226
+ks	 226
+'t_	 224
+_dat_	 224
+_ko	 223
+_st	 220
+�n	 219
+rk	 219
+sa	 219
+e._	 219
+tte	 218
+en.	 218
+n,	 217
+ier	 216
+ten_	 216
+_fer	 215
+mi	 215
+hi	 215
+ien	 214
+_wa	 213
+n,_	 213
+no	 213
+_te_	 212
+ig	 212
+_De	 212
+ske_	 212
+_der	 212
+W	 211
+H	 211
+_oan	 210
+ee	 209
+dy	 208
+ek_	 207
+en._	 207
+ic	 207
+mme	 206
+yk	 204
+pr	 204
+net	 203
+foar_	 203
+he	 203
+wurd	 201
+_der_	 199
+jen	 199
+_dy	 199
+kr	 198
+ka	 197
+im	 196
+_H	 196
+il	 196
+ze	 196
+_ma	 195
+by	 194
+oer	 194
+kt	 193
+us	 193
+M	 193
+sk_	 192
+wo	 192
+_hi	 191
+or	 190
+ing_	 190
+_W	 190
+ich	 189
+De_	 187
+rr	 186
+int	 185
+_�	 184
+:	 184
+ij	 184
+_ek	 183
+eg	 182
+:_	 180
+gen	 180
+as_	 180
+_se	 179
+e,	 178
+_net	 177
+e,_	 177
+ins	 177
+N	 177
+ls	 176
+st_	 176
+_wurd	 176
+ie_	 175
+E	 175
+nne_	 175
+_De_	 175
+sy	 175
+wer	 174
+gr	 174
+f_	 173
+nk	 172
+och_	 172
+net_	 169
+ad	 169
+_we	 169
+rde	 168
+sl	 168
+bi	 168
+of	 168
+so	 168
+_no	 167
+_ta	 167
+re_	 167
+to	 167
+den	 167
+J	 167
+t.	 166
+It	 165
+�t	 165
+inne_	 165
+ysk_	 165
+lik	 164
+sp	 163
+_ek_	 162
+ou	 162
+tsj	 162
+It_	 161
+_sa	 160
+A	 160
+wol	 160
+l�	 159
+_wo	 159
+ge_	 159
+l�n	 159
+ige	 158
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/amharic-utf.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/amharic-utf.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/amharic-utf.lm	(revision 258)
@@ -0,0 +1,400 @@
+�	 21403
+_	 10092
+�	 7734
+�	 6558
+_�	 5003
+�	 4717
+�	 4401
+�	 4274
+�	 4176
+�	 4054
+�	 3868
+�	 2728
+�	 1656
+�	 1591
+�	 1579
+�	 1425
+��	 1402
+_�	 1261
+_�	 1231
+�	 1217
+��	 1187
+��	 1183
+_�	 1160
+�	 1145
+��	 1123
+�	 1097
+ን	 1043
+��	 1043
+�	 1041
+��	 1004
+_�	 991
+�	 936
+�	 880
+��	 855
+ው	 855
+�	 849
+��	 805
+��	 783
+ት	 783
+�_	 763
+��	 709
+��	 704
+��	 682
+በ	 682
+��	 679
+�	 670
+��	 667
+በ�	 666
+���	 666
+��	 658
+�	 643
+የ	 637
+��	 637
+���	 627
+የ�	 627
+ለ	 614
+��	 614
+��	 611
+ር	 611
+�_	 588
+��_	 583
+ት_	 583
+_የ	 577
+_የ�	 574
+ለ�	 573
+���	 573
+ን�	 570
+���	 570
+መ	 563
+��	 563
+���	 557
+መ�	 557
+��	 554
+አ	 554
+አ�	 553
+ተ	 553
+���	 553
+��	 553
+ተ�	 547
+���	 547
+ም	 534
+��	 534
+��	 532
+-	 531
+ስ	 525
+��	 525
+--	 521
+ል	 515
+��	 515
+---	 512
+----	 503
+_በ	 499
+-----	 494
+_በ�	 487
+��	 479
+��	 477
+�_	 473
+���	 469
+ው�	 469
+ን_	 468
+��_	 468
+�	 465
+�	 464
+ያ	 457
+��	 457
+��	 444
+_አ	 424
+_አ�	 424
+ስ�	 423
+���	 423
+�_	 415
+��	 402
+�	 401
+�	 390
+��	 389
+�	 382
+��_	 378
+ው_	 378
+��	 365
+���	 364
+ያ�	 364
+�	 363
+ል�	 357
+���	 357
+�	 356
+�_	 351
+��	 347
+ች	 347
+��	 341
+ነ	 341
+ይ	 337
+��	 337
+።	 337
+��	 337
+��_	 337
+።_	 337
+��	 336
+�	 334
+��	 320
+እ	 320
+��	 320
+��	 320
+���	 318
+እ�	 318
+��_	 314
+ር_	 314
+��	 312
+��	 311
+��	 301
+ና	 300
+ገ	 300
+��	 300
+��	 300
+��	 299
+��	 297
+ር�	 294
+��	 294
+ግ	 294
+���	 294
+�	 293
+���	 291
+ከ	 291
+���	 291
+���	 291
+��	 291
+ም�	 291
+ገ�	 291
+ነ�	 291
+ደ	 288
+��	 288
+_እ	 285
+_እ�	 283
+�	 279
+���	 279
+ከ�	 279
+���	 279
+በ�	 279
+ን�	 276
+��	 276
+���	 276
+_�	 272
+��	 270
+ብ	 270
+�_	 269
+ግ�	 264
+���	 264
+���	 262
+��	 262
+መ�	 262
+��	 262
+ይ�	 261
+���	 261
+��	 260
+ማ	 260
+ደ�	 259
+���	 259
+ራ	 254
+��	 254
+ባ	 254
+��	 254
+�	 253
+��	 249
+��	 247
+��	 245
+��	 244
+ላ	 242
+��	 242
+የ�	 242
+���	 242
+ማ�	 238
+���	 238
+��	 237
+ረ	 237
+��	 237
+���	 236
+ተ�	 236
+ም_	 235
+��_	 235
+��	 234
+��	 233
+��	 233
+���	 230
+��	 230
+ባ�	 230
+ሚ	 230
+ድ	 228
+��	 228
+_መ	 227
+��	 227
+_መ�	 226
+���	 225
+ረ�	 225
+�	 225
+�።	 222
+�።_	 222
+��	 216
+እ�	 214
+ሚ�	 214
+���	 214
+���	 214
+��	 213
+��	 212
+��	 210
+���	 209
+ላ�	 209
+�	 208
+��	 207
+��	 206
+�_	 206
+���	 205
+ብ�	 205
+��	 202
+��	 200
+ታ	 200
+��	 200
+ሰ	 200
+���	 199
+ራ�	 199
+ሰ�	 198
+���	 198
+ት�	 195
+ወ	 195
+���	 195
+��	 195
+���	 194
+ወ�	 194
+��	 191
+�	 191
+��_	 189
+ች_	 189
+��	 188
+��	 186
+�	 186
+_ለ	 184
+_ለ�	 183
+ለ�	 183
+���	 183
+�ን	 180
+���	 179
+የ�	 179
+��	 178
+�	 177
+�ን�	 177
+_ከ	 175
+��	 174
+ጥ	 174
+���	 172
+አ�	 172
+_ከ�	 170
+�	 170
+�_	 169
+��ን	 169
+��	 166
+��	 166
+ል�	 165
+�_	 165
+���	 165
+ና_	 163
+��_	 163
+��	 160
+ቸ	 160
+ቸ�	 160
+���	 160
+��	 160
+��	 159
+��	 159
+��	 158
+ቀ	 158
+��	 158
+��	 156
+ቀ�	 155
+���	 155
+ች�	 154
+���	 154
+ል_	 154
+���	 154
+�ው	 154
+ቸ�	 154
+��_	 154
+��	 152
+��	 151
+��ው	 151
+��	 150
+_ነ	 150
+�	 150
+_ነ�	 150
+�	 150
+_ይ�	 150
+_ይ	 150
+���	 149
+ታ�	 149
+��።	 148
+���	 147
+ደ�	 147
+���	 147
+በ�	 147
+�	 146
+_ተ	 146
+_ተ�	 146
+ለ�	 145
+���	 145
+ድ�	 144
+��	 144
+��	 144
+���	 144
+ቅ	 143
+��	 143
+�_	 143
+ግ�	 142
+���	 142
+��	 141
+ዳ	 141
+��	 139
+ህ	 138
+��	 138
+���	 137
+ና�	 137
+��	 137
+�ን	 136
+��	 136
+አ�	 135
+���	 135
+��	 135
+ስ�	 134
+���	 134
+ጠ	 133
+ዳ�	 133
+��	 133
+ሆ�	 133
+���	 133
+ሆ	 133
+���	 133
+��	 133
+ሆ�	 132
+���	 132
+�ተ	 131
+ያ�	 131
+�ተ�	 131
+���	 131
+��	 129
+��	 128
+��	 128
+ክ	 128
+ፍ	 128
+��	 128
+��	 127
+���	 127
+ጠ�	 127
+��	 126
+ካ	 126
+��	 124
+በ�	 123
+��	 123
+ያ�	 123
+���	 123
+���	 123
+���	 122
+ከ�	 122
+���	 121
+ገ�	 121
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/swahili.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/swahili.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/swahili.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 16483
+a	 9342
+i	 5293
+a_	 4071
+u	 2730
+k	 2609
+n	 2351
+w	 2076
+m	 1928
+e	 1866
+h	 1800
+o	 1775
+wa	 1743
+l	 1486
+s	 1419
+i_	 1401
+t	 1399
+_k	 1306
+y	 1100
+_w	 969
+li	 945
+wa_	 911
+z	 891
+_wa	 890
+ka	 834
+ku	 799
+r	 770
+b	 733
+an	 727
+ma	 723
+o_	 711
+_m	 707
+na	 698
+ya	 675
+ha	 672
+g	 602
+al	 580
+d	 570
+at	 560
+am	 554
+_n	 549
+_ku	 549
+ik	 543
+_h	 515
+ya_	 514
+A	 494
+is	 487
+_y	 485
+hi	 474
+na_	 471
+_ya	 471
+ta	 468
+sh	 456
+ali	 449
+j	 426
+u_	 423
+ki	 418
+e_	 402
+p	 401
+ti	 401
+_wa_	 399
+f	 392
+_ya_	 390
+ba	 390
+ri	 385
+ng	 385
+il	 380
+c	 358
+hu	 356
+_na	 356
+ni	 355
+za	 354
+zi	 351
+ia	 344
+_na_	 343
+_a	 336
+in	 327
+_ma	 326
+ch	 322
+mb	 317
+ika	 314
+.	 311
+._	 309
+_ka	 307
+as	 306
+ak	 306
+ati	 301
+,	 300
+ka_	 296
+,_	 294
+_u	 292
+kw	 286
+ili	 278
+K	 274
+en	 271
+si	 266
+_kw	 262
+la	 261
+ni_	 261
+ma_	 261
+_s	 258
+kwa	 258
+ar	 256
+ut	 245
+za_	 245
+nd	 242
+mba	 241
+_kwa	 239
+_z	 234
+li_	 233
+un	 233
+ny	 230
+it	 229
+se	 229
+yo	 227
+ia_	 222
+M	 221
+sa	 221
+kat	 217
+_K	 214
+_i	 213
+ika_	 213
+ana	 212
+ish	 212
+kati	 206
+_ha	 204
+on	 201
+ai	 200
+I	 198
+aa	 196
+um	 195
+im	 190
+v	 188
+mu	 187
+amb	 187
+sha	 185
+em	 183
+fa	 181
+zi_	 180
+di	 179
+mi	 178
+_M	 178
+us	 176
+_ki	 176
+ha_	 175
+iw	 172
+ama	 172
+_kat	 168
+_kati	 168
+_hi	 166
+_l	 166
+ra	 166
+kwa_	 165
+la_	 164
+W	 164
+ja	 163
+U	 163
+N	 163
+amba	 161
+ao	 161
+_za	 160
+ji	 160
+B	 157
+iwa	 155
+tik	 155
+wal	 155
+le	 155
+tika	 154
+ge	 153
+lis	 153
+tu	 152
+atika	 152
+to	 152
+atik	 152
+uw	 152
+_kwa_	 151
+A_	 151
+ke	 150
+S	 147
+tika_	 145
+aj	 145
+we	 144
+cha	 144
+bi	 141
+az	 140
+er	 139
+ek	 138
+katik	 138
+ez	 138
+uwa	 137
+kut	 135
+_al	 134
+_B	 134
+ad	 134
+mu_	 133
+_ali	 133
+rik	 132
+_W	 131
+ba_	 131
+kuw	 131
+me	 130
+ali_	 128
+kuwa	 128
+ema	 127
+wan	 127
+bu	 126
+sem	 126
+_A	 125
+ir	 125
+ata	 125
+iz	 124
+_hu	 124
+ay	 124
+ul	 124
+af	 123
+iki	 122
+ema_	 121
+da	 120
+ti_	 120
+sema	 119
+aka	 118
+sema_	 118
+te	 118
+uz	 117
+yo_	 117
+_v	 117
+io	 116
+iy	 115
+uta	 115
+ani	 115
+_wal	 115
+he	 115
+if	 114
+_la	 114
+ab	 114
+go	 112
+_za_	 111
+ama_	 111
+sa_	 111
+pa	 110
+_t	 110
+zo	 110
+nge	 110
+wam	 109
+wali	 108
+ua	 107
+ur	 106
+_c	 106
+ise	 105
+_ch	 105
+isem	 105
+ho	 105
+ye	 104
+iyo	 104
+E	 104
+el	 104
+mo	 103
+ung	 103
+eri	 103
+_wali	 103
+_b	 102
+mba_	 102
+ari	 101
+ita	 101
+isema	 100
+ot	 99
+_la_	 99
+uk	 99
+ao_	 99
+di_	 99
+sha_	 99
+ini	 99
+kuwa_	 98
+uwa_	 98
+ana_	 98
+lise	 98
+lisem	 98
+uli	 97
+shi	 97
+ga	 96
+iwa_	 96
+fu	 96
+T	 96
+R	 95
+_il	 95
+wak	 94
+aw	 94
+isha	 94
+ri_	 93
+_am	 93
+ara	 92
+_cha	 92
+aji	 92
+_ili	 91
+ifa	 91
+O	 90
+_p	 90
+uh	 90
+iri	 90
+chi	 90
+asi	 89
+po	 89
+a.	 89
+ong	 89
+azi	 88
+_j	 88
+_kut	 88
+eny	 88
+nc	 88
+a._	 88
+ko	 87
+uu	 87
+id	 87
+w_	 87
+no	 87
+P	 86
+ah	 86
+ina	 86
+rika	 86
+_Bw	 85
+H	 85
+gu	 85
+uo	 85
+Bw_	 85
+_Bw_	 85
+_se	 85
+Bw	 85
+ib	 84
+_S	 84
+kam	 84
+hi_	 84
+nya	 84
+si_	 83
+a,	 82
+no_	 81
+pi	 81
+ok	 81
+i.	 81
+ip	 81
+kwam	 81
+i._	 81
+amba_	 80
+dh	 80
+end	 80
+ani_	 80
+a,_	 79
+wamb	 79
+kwamb	 79
+_sh	 79
+eza	 79
+nz	 79
+wi	 79
+_kwam	 79
+wamba	 79
+alis	 78
+_kuw	 78
+ngo	 78
+ap	 77
+_N	 77
+any	 77
+ili_	 77
+C	 77
+WA	 76
+vy	 76
+wana	 76
+_hiy	 75
+Wa	 75
+hiyo	 75
+nch	 75
+_hiyo	 75
+de	 75
+_kuwa	 75
+ing	 75
+hiy	 75
+vi	 75
+isha_	 74
+es	 74
+atu	 74
+_Wa	 74
+nchi	 74
+aki	 74
+lim	 73
+da_	 73
+ini_	 73
+ash	 73
+ala	 73
+i,	 73
+ano	 73
+i,_	 72
+_kam	 71
+_wan	 71
+ano_	 71
+mw	 71
+nde	 71
+ji_	 71
+ion	 70
+_amb	 70
+ndi	 70
+_Ka	 70
+eza_	 70
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/catalan.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/catalan.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/catalan.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 16604
+e	 5091
+a	 4937
+s	 3120
+r	 3037
+i	 2987
+l	 2747
+n	 2641
+t	 2466
+o	 2274
+d	 1775
+c	 1740
+u	 1515
+a_	 1460
+s_	 1416
+_d	 1116
+e_	 1067
+p	 1014
+m	 995
+es	 985
+de	 972
+_de	 842
+en	 700
+_l	 691
+re	 652
+_e	 637
+de_	 611
+el	 602
+_de_	 601
+_a	 600
+,	 599
+,_	 599
+er	 598
+la	 584
+ar	 583
+_p	 550
+l_	 547
+ci	 522
+n_	 518
+es_	 515
+an	 515
+ra	 499
+nt	 495
+ta	 495
+b	 476
+_c	 452
+al	 450
+v	 440
+g	 428
+.	 420
+on	 420
+or	 404
+t_	 402
+at	 396
+._	 377
+r_	 372
+i_	 371
+la_	 368
+_i	 364
+_la	 351
+_la_	 325
+f	 325
+le	 322
+te	 312
+'	 311
+_s	 308
+st	 308
+se	 305
+�	 302
+ue	 302
+na	 301
+os	 301
+qu	 300
+q	 300
+el_	 299
+it	 292
+co	 290
+ri	 277
+ca	 277
+ti	 273
+ac	 272
+in	 268
+ll	 264
+ic	 264
+me	 259
+un	 257
+que	 248
+C	 248
+tr	 244
+ns	 242
+i�	 238
+_i_	 236
+ad	 233
+ent	 232
+_el	 227
+ne	 226
+_t	 223
+_co	 221
+_m	 221
+_C	 217
+en_	 217
+li	 217
+ia	 212
+�	 212
+pe	 207
+_a_	 207
+pr	 206
+ci�	 203
+�_	 203
+pa	 203
+ro	 202
+o_	 198
+E	 198
+di	 197
+io	 197
+ls	 196
+h	 192
+_q	 192
+_qu	 192
+_en	 187
+aci	 186
+am	 186
+ec	 183
+to	 183
+as	 180
+om	 180
+ni	 180
+da	 179
+i�_	 179
+si	 178
+ls_	 176
+L	 175
+ma	 172
+res	 172
+ur	 171
+_el_	 162
+rt	 162
+ue_	 160
+A	 160
+os_	 159
+_que	 159
+que_	 158
+_r	 158
+po	 157
+_es	 155
+er_	 155
+_que_	 155
+M	 155
+_se	 153
+va	 153
+del	 153
+ci�_	 151
+_pr	 151
+is	 150
+_en_	 149
+P	 147
+_pe	 146
+_del	 145
+ts	 145
+lo	 145
+_M	 144
+ct	 144
+_u	 144
+ol	 143
+ve	 141
+_L	 140
+x	 140
+y	 140
+a,_	 139
+a,	 139
+nc	 138
+men	 137
+al_	 137
+_f	 137
+_re	 137
+_P	 136
+aci�	 136
+les	 136
+rs	 134
+est	 133
+tu	 131
+_E	 130
+et	 130
+s,_	 129
+_un	 129
+na_	 129
+_v	 129
+s,	 129
+ion	 127
+per	 126
+so	 125
+em	 125
+at_	 124
+no	 124
+j	 124
+br	 123
+nt_	 122
+ar_	 122
+sa	 121
+_n	 119
+les_	 118
+�	 118
+ce	 117
+il	 117
+ell	 116
+_per	 114
+�	 114
+ob	 113
+re_	 113
+ir	 113
+_A	 112
+ons	 112
+do	 112
+ua	 112
+con	 112
+ment	 111
+gu	 111
+ts_	 110
+ss	 110
+ns_	 109
+ant	 109
+ra_	 109
+Co	 109
+par	 108
+l'	 107
+d'	 107
+_l'	 107
+els	 107
+tat	 107
+sc	 106
+_d'	 106
+an_	 105
+_Co	 105
+vi	 104
+els_	 104
+ica	 104
+ran	 103
+ul	 102
+iv	 102
+S	 102
+_del_	 102
+del_	 102
+mb	 101
+mi	 101
+ita	 101
+nta	 100
+_pa	 99
+_o	 99
+_con	 98
+aci�_	 97
+rn	 96
+_in	 96
+ia_	 96
+z	 96
+im	 95
+rr	 95
+art	 94
+ta_	 93
+com	 93
+tre	 92
+_h	 92
+s.	 91
+mp	 90
+ie	 90
+J	 90
+s._	 89
+cio	 89
+_le	 89
+bre	 88
+_ca	 88
+_al	 88
+sta	 88
+_com	 88
+cu	 88
+�_	 87
+pre	 87
+fe	 86
+ba	 86
+tra	 86
+ge	 85
+pro	 85
+_les	 84
+des	 84
+ter	 84
+_po	 84
+_les_	 84
+T	 84
+_J	 84
+nd	 84
+cion	 84
+_S	 84
+ura	 83
+nci	 82
+va_	 81
+ha	 81
+ona	 81
+ent_	 80
+ues	 80
+oc	 80
+ea	 80
+nte	 80
+�s	 80
+_di	 79
+ui	 79
+as_	 78
+ut	 78
+ici	 78
+res_	 78
+us	 77
+ot	 77
+ara	 77
+ip	 75
+rm	 75
+ab	 75
+eg	 75
+_per_	 75
+ng	 75
+'a	 75
+I	 75
+per_	 75
+rec	 74
+du	 74
+_tr	 74
+�	 73
+cia	 73
+_no	 73
+b_	 73
+_par	 72
+ep	 72
+id	 72
+lle	 71
+rc	 71
+_pro	 70
+D	 69
+G	 69
+ga	 69
+fo	 69
+una	 68
+El	 68
+lit	 68
+un_	 68
+ques	 68
+amb	 67
+ix	 67
+�s_	 67
+_G	 67
+era	 67
+cr	 67
+)	 66
+da_	 66
+-	 66
+sp	 66
+y_	 66
+ada	 66
+tor	 66
+(	 66
+_(	 66
+_T	 65
+ment_	 65
+B	 65
+_es_	 65
+Ma	 65
+V	 65
+uc	 65
+ect	 65
+ame	 64
+iu	 64
+_Ma	 64
+orn	 64
+_B	 64
+_D	 64
+Ca	 64
+sti	 64
+_g	 63
+esc	 63
+rd	 63
+una_	 63
+l�	 62
+"	 62
+ed	 62
+amen	 61
+mo	 61
+ions	 61
+_El	 61
+_Ca	 61
+Jo	 61
+eu	 61
+ari	 61
+lt	 61
+F	 61
+u_	 61
+ament	 60
+_V	 60
+m_	 60
+fi	 60
+au	 60
+ev	 60
+La	 60
+itat	 59
+_ha	 59
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/french.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/french.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/french.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 20800
+e	 7258
+i	 4051
+s	 4003
+a	 3972
+n	 3903
+r	 3650
+t	 3590
+u	 2968
+o	 2823
+l	 2723
+e_	 2632
+d	 2241
+s_	 1721
+_d	 1693
+c	 1663
+p	 1528
+�	 1320
+m	 1297
+es	 1164
+t_	 1106
+_l	 1079
+de	 1048
+on	 959
+_de	 940
+en	 939
+_p	 852
+nt	 825
+le	 808
+es_	 791
+re	 777
+,	 721
+,_	 720
+n_	 703
+de_	 685
+'	 670
+an	 667
+_de_	 645
+v	 641
+_s	 610
+r_	 596
+_c	 594
+er	 585
+ai	 575
+_a	 558
+_e	 554
+ou	 554
+q	 549
+qu	 538
+is	 530
+te	 528
+ti	 525
+ur	 519
+it	 514
+g	 498
+a_	 490
+f	 480
+la	 476
+in	 475
+_le	 441
+me	 436
+nt_	 432
+.	 427
+b	 427
+ra	 423
+io	 416
+ent	 415
+._	 404
+ne	 395
+ns	 392
+ion	 383
+h	 381
+ue	 376
+se	 371
+le_	 370
+ar	 370
+ie	 362
+co	 361
+at	 359
+tr	 359
+et	 349
+pr	 342
+ce	 336
+au	 328
+u_	 321
+il	 314
+_r	 313
+_la	 304
+un	 303
+eu	 303
+st	 300
+re_	 296
+ro	 290
+la_	 288
+on_	 287
+_m	 286
+_la_	 283
+que	 281
+_qu	 280
+_q	 280
+po	 275
+tio	 273
+tion	 273
+pa	 273
+li	 271
+_t	 269
+nc	 268
+si	 266
+_pr	 265
+ri	 264
+al	 263
+ui	 262
+_co	 259
+i_	 255
+ta	 255
+�_	 251
+x	 247
+em	 244
+l_	 243
+et_	 238
+_l'	 236
+l'	 236
+les	 233
+ns_	 233
+ir	 232
+_le_	 228
+ent_	 227
+or	 226
+r�	 224
+_f	 224
+ne_	 222
+�	 221
+ve	 220
+ch	 220
+it_	 219
+di	 219
+oi	 217
+-	 216
+ni	 215
+�_	 215
+les_	 215
+d'	 214
+el	 212
+ss	 212
+_n	 212
+ut	 211
+our	 210
+des	 210
+"	 208
+ur_	 207
+nd	 207
+er_	 206
+ait	 206
+ion_	 204
+rs	 202
+_en	 201
+_et	 200
+j	 200
+_d'	 200
+ll	 199
+_des	 198
+des_	 197
+_pa	 197
+t�	 196
+_et_	 195
+_�	 195
+_�_	 195
+om	 193
+ma	 192
+ati	 190
+_des_	 189
+L	 188
+so	 187
+_u	 185
+�	 184
+_"	 183
+sa	 182
+_po	 181
+tre	 181
+d�	 181
+ue_	 180
+pe	 179
+en_	 179
+ont	 178
+_un	 178
+_L	 178
+us	 176
+_les	 176
+_les_	 176
+rt	 176
+is_	 173
+_i	 173
+du	 172
+e,_	 171
+e,	 171
+na	 171
+s,	 170
+s,_	 170
+as	 169
+men	 169
+M	 167
+ait_	 167
+'a	 166
+vi	 162
+ci	 159
+ant	 158
+_au	 158
+da	 157
+_M	 157
+ation	 155
+atio	 155
+con	 154
+que_	 153
+ons	 153
+eur	 151
+est	 149
+me_	 149
+mi	 149
+par	 148
+tion_	 148
+_so	 147
+te_	 147
+res	 144
+lo	 144
+ment	 144
+�s	 144
+ans	 143
+_du	 142
+du_	 141
+ux	 141
+un_	 140
+y	 138
+pro	 138
+_du_	 136
+_d�	 136
+ce_	 135
+_se	 134
+_re	 134
+pl	 133
+A	 132
+ge	 131
+ic	 131
+su	 130
+x_	 129
+ien	 129
+nce	 129
+"_	 129
+ac	 128
+il_	 128
+qui	 128
+_pro	 127
+no	 127
+av	 126
+_v	 125
+_o	 125
+rs_	 125
+ans_	 124
+eme	 124
+bl	 123
+emen	 122
+_en_	 122
+iqu	 122
+ct	 122
+iq	 122
+lle	 122
+nn	 121
+ts	 121
+ement	 121
+�t	 120
+_"_	 120
+�r	 119
+t�_	 119
+_ce	 119
+mp	 119
+ire	 119
+ui_	 119
+to	 118
+he	 117
+_�	 117
+ca	 117
+_j	 116
+ec	 116
+va	 116
+_par	 116
+�e	 115
+_con	 115
+se_	 114
+tre_	 113
+ique	 112
+dan	 111
+�c	 111
+ha	 110
+une	 110
+P	 110
+lu	 110
+ux_	 109
+_b	 108
+s.	 108
+pou	 108
+_pou	 108
+ier	 107
+C	 107
+ais	 106
+s._	 105
+ain	 104
+_un_	 104
+nte	 103
+'e	 103
+mo	 103
+mm	 103
+ment_	 102
+une_	 102
+com	 101
+_P	 101
+'i	 101
+_ma	 100
+do	 99
+ant_	 98
+anc	 98
+che	 97
+ap	 97
+ont_	 97
+_que	 97
+os	 97
+urs	 96
+_di	 96
+fi	 96
+im	 96
+pour	 96
+_pour	 96
+�	 95
+ts_	 95
+_g	 95
+our_	 94
+_sa	 94
+ntr	 94
+_da	 94
+_r�	 93
+rai	 93
+rm	 93
+_qui	 93
+e.	 92
+am	 92
+_com	 91
+uv	 91
+_C	 91
+D	 91
+qui_	 90
+e._	 90
+pu	 89
+_qui_	 88
+ia	 87
+_dan	 87
+_dans	 87
+dans	 87
+ter	 87
+fo	 87
+son	 87
+dans_	 87
+id	 86
+ag	 86
+ine	 86
+tu	 85
+ran	 85
+au_	 85
+ol	 85
+oc	 84
+est_	 84
+st_	 84
+enc	 84
+F	 82
+_tr	 81
+'u	 81
+tai	 81
+ell	 80
+R	 79
+_su	 79
+S	 79
+ions	 79
+pr�	 79
+s�	 78
+ab	 78
+n�	 77
+_que_	 77
+_in	 77
+_av	 76
+pour_	 76
+fa	 76
+rr	 76
+air	 75
+_ch	 75
+_a_	 75
+ba	 74
+_pl	 74
+gr	 74
+tt	 74
+ssi	 74
+rd	 73
+pas	 73
+bi	 73
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/albanian.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/albanian.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/albanian.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 19480
+�	 4099
+e	 4082
+t	 3635
+i	 3134
+a	 2893
+r	 2820
+n	 2610
+s	 2380
+h	 2060
+�_	 2055
+e_	 1825
+j	 1677
+u	 1489
+d	 1381
+o	 1370
+m	 1318
+k	 1264
+t�	 1091
+p	 1072
+_t	 1068
+sh	 998
+l	 936
+_n	 876
+a_	 822
+,	 816
+,_	 808
+t�_	 795
+i_	 770
+_p	 739
+_m	 702
+_s	 700
+te	 653
+�r	 620
+_d	 613
+_e	 607
+g	 602
+_k	 601
+_t�	 593
+.	 575
+_t�_	 574
+v	 567
+_e_	 554
+r_	 525
+._	 523
+ht	 503
+n_	 480
+he	 473
+n�	 462
+sht	 461
+te_	 457
+q	 454
+nd	 436
+ri	 432
+is	 414
+et	 403
+b	 402
+je	 401
+me	 395
+in	 391
+it	 381
+r�	 374
+_a	 374
+t_	 359
+ur	 353
+_i	 346
+ar	 342
+�s	 339
+er	 338
+n�_	 338
+�n	 338
+dh	 337
+en	 336
+p�	 334
+f	 328
+_v	 323
+j�	 318
+nj	 313
+ish	 312
+p�r	 294
+y	 285
+z	 282
+es	 281
+at	 274
+_me	 273
+_q	 273
+gj	 269
+ra	 261
+as	 258
+_n�	 256
+ku	 256
+j_	 250
+ta	 249
+re	 246
+nj�	 245
+o_	 243
+ni	 243
+_p�	 240
+hte	 240
+_nj	 239
+on	 239
+isht	 236
+pa	 234
+th	 233
+shte	 233
+_p�r	 232
+se	 228
+_g	 223
+ve	 221
+in_	 220
+s_	 219
+_n�_	 219
+do	 218
+hte_	 218
+m�	 216
+ti	 215
+aj	 212
+shte_	 212
+ej	 212
+u_	 211
+q�	 211
+_sh	 210
+nt	 207
+j�_	 206
+_b	 205
+_nj�	 203
+di	 202
+_pa	 201
+_i_	 201
+ll	 199
+_f	 199
+k�	 198
+me_	 197
+dhe	 195
+ishte	 195
+si	 194
+hi	 191
+he_	 188
+-	 187
+ja	 187
+_q�	 187
+ua	 186
+il	 184
+_dh	 184
+ur_	 183
+�r_	 182
+or	 180
+se_	 179
+q�_	 178
+S	 176
+�	 175
+_h	 173
+an	 172
+nj�_	 172
+ng	 170
+nte	 170
+_q�_	 169
+_S	 169
+r�_	 166
+dhe_	 165
+_me_	 164
+ka	 162
+im	 159
+h�	 158
+mi	 157
+to	 156
+tu	 156
+�n_	 155
+_nj�_	 154
+ha	 153
+nte_	 150
+tr	 148
+sa	 148
+�t	 148
+_gj	 148
+un	 147
+rr	 147
+�,	 147
+_dhe	 147
+ej_	 147
+ki	 146
+�,_	 146
+_ku	 145
+_-	 144
+_ng	 142
+ik	 141
+_nd	 140
+end	 138
+uk	 137
+et�	 135
+ko	 135
+_dhe_	 135
+_ve	 132
+va	 131
+_l	 131
+p�r_	 131
+shi	 131
+er�	 129
+ke	 127
+kis	 127
+s�	 126
+jo	 125
+li	 124
+ga	 124
+kish	 123
+_ki	 122
+po	 122
+_se	 122
+'	 121
+du	 120
+mb	 120
+_m�	 119
+Si	 115
+m�_	 115
+esh	 115
+_si	 114
+qe	 114
+l�	 114
+_kis	 113
+oh	 113
+_kish	 113
+_Si	 113
+pr	 112
+_u	 112
+uar	 111
+de	 111
+hu	 111
+_th	 111
+al	 111
+ta_	 109
+ilv	 108
+Sil	 108
+Silv	 108
+lv	 108
+k_	 108
+e,	 108
+ji	 107
+e,_	 106
+_Sil	 106
+_Silv	 106
+_r	 105
+os	 104
+_se_	 104
+kisht	 102
+_di	 102
+st	 101
+_p�r_	 101
+b�	 101
+tj	 100
+_nga	 99
+nga	 99
+_du	 98
+ra_	 98
+v�	 98
+gji	 98
+_ish	 96
+rt	 96
+_is	 96
+ro	 95
+ir	 94
+ga_	 94
+�sh	 94
+ont	 93
+c	 93
+t,	 93
+t,_	 93
+hin	 92
+a,	 92
+_at	 92
+und	 92
+jt	 91
+_mb	 91
+a,_	 91
+tje	 90
+_nga_	 90
+_do	 90
+_pr	 90
+rit	 90
+men	 90
+nga_	 90
+ri_	 89
+N	 89
+ma	 89
+it_	 88
+_k�	 88
+-_	 88
+m_	 87
+jo_	 87
+onte	 87
+at�	 87
+la	 87
+�ri	 87
+ilva	 86
+shin	 86
+�.	 86
+Silva	 86
+lva	 86
+s�_	 85
+jer	 85
+et_	 85
+_po	 85
+�s_	 84
+kur	 84
+ru	 84
+nin	 83
+ot	 83
+hin_	 83
+_N	 83
+her	 83
+ht�	 82
+ap	 82
+shin_	 82
+mo	 81
+ash	 81
+tha	 81
+_�	 81
+�._	 81
+�m	 81
+jit	 80
+_ta	 80
+ul	 80
+le	 80
+ho	 80
+_z	 79
+dr	 78
+jet	 78
+nin_	 78
+_m�_	 78
+gjit	 78
+A	 78
+hk	 78
+onte_	 78
+oni	 77
+lo	 77
+ba	 77
+her�	 77
+ndo	 76
+shk	 76
+mend	 75
+_v�	 75
+ha_	 75
+d�	 75
+tur	 74
+_A	 74
+el	 74
+bi	 74
+_ko	 74
+uk_	 73
+er�_	 73
+si_	 73
+_sa	 73
+ar_	 72
+P	 72
+rs	 72
+pas	 72
+ith	 72
+uar_	 71
+_isht	 71
+ai	 70
+e.	 70
+_vet	 70
+vet	 70
+_b�	 70
+zi	 70
+d_	 70
+jith	 70
+da	 70
+gjith	 69
+duk	 69
+na	 69
+hej	 69
+t�r	 68
+_men	 68
+_ka	 68
+am	 68
+nd_	 68
+_c	 67
+_pas	 67
+_duk	 67
+jes	 67
+ak	 67
+s,	 67
+e._	 67
+s,_	 67
+K	 67
+�sht	 67
+mu	 66
+kur_	 66
+yr	 66
+em	 65
+_s�	 65
+tha_	 65
+imi	 65
+ie	 65
+hej_	 64
+_s�_	 64
+_u_	 64
+?	 64
+fu	 64
+_P	 64
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/german.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/german.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/german.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 31586
+e	 15008
+n	 9058
+i	 7299
+r	 6830
+t	 5662
+s	 5348
+a	 4618
+h	 4176
+d	 4011
+er	 3415
+en	 3412
+u	 3341
+l	 3266
+n_	 2848
+c	 2636
+ch	 2460
+g	 2407
+o	 2376
+e_	 2208
+r_	 2128
+m	 2077
+_d	 1948
+de	 1831
+en_	 1786
+ei	 1718
+er_	 1570
+in	 1568
+te	 1505
+ie	 1505
+b	 1458
+t_	 1425
+f	 1306
+k	 1176
+ge	 1144
+s_	 1137
+un	 1113
+,	 1104
+,_	 1099
+w	 1099
+z	 1060
+nd	 1039
+he	 1004
+st	 989
+_s	 952
+_de	 949
+.	 909
+_e	 906
+ne	 906
+der	 880
+._	 847
+be	 841
+es	 829
+ic	 796
+_a	 791
+ie_	 779
+is	 769
+ich	 763
+an	 755
+re	 749
+di	 732
+ein	 730
+se	 730
+"	 720
+ng	 709
+_i	 706
+sc	 683
+sch	 681
+it	 673
+der_	 652
+h_	 651
+ch_	 642
+S	 630
+le	 609
+p	 609
+�	 607
+�	 603
+au	 603
+v	 602
+che	 599
+_w	 596
+d_	 585
+die	 576
+_di	 572
+m_	 562
+_die	 559
+el	 548
+_S	 540
+_der	 529
+li	 527
+_der_	 523
+si	 515
+al	 514
+ns	 507
+on	 501
+or	 495
+ti	 490
+ten	 487
+ht	 486
+die_	 485
+_die_	 483
+D	 479
+rt	 478
+nd_	 476
+_u	 470
+nt	 468
+A	 466
+in_	 464
+den	 461
+cht	 447
+und	 443
+me	 440
+_z	 429
+ung	 426
+ll	 423
+_un	 421
+_ei	 419
+_n	 415
+hr	 412
+ine	 412
+_A	 408
+_ein	 405
+ar	 404
+ra	 403
+_v	 400
+_g	 400
+as	 395
+zu	 392
+et	 389
+em	 385
+_D	 380
+eine	 376
+gen	 376
+g_	 376
+da	 368
+we	 366
+K	 365
+lt	 360
+B	 354
+_"	 353
+nde	 349
+ni	 347
+und_	 345
+E	 345
+ur	 345
+_m	 342
+ri	 341
+ha	 340
+eh	 339
+ten_	 338
+es_	 336
+_K	 336
+_und	 335
+ig	 335
+_b	 335
+hen	 334
+_und_	 332
+_au	 329
+_B	 327
+_da	 325
+_zu	 324
+_in	 322
+at	 321
+us	 318
+wi	 307
+n,	 305
+n,_	 304
+nn	 304
+te_	 301
+eit	 301
+_h	 300
+ter	 299
+M	 298
+n.	 295
+�	 294
+ng_	 289
+sche	 289
+-	 283
+rs	 282
+den_	 282
+_si	 280
+G	 280
+im	 278
+_ge	 277
+chen	 276
+rd	 273
+_E	 273
+n._	 270
+icht	 270
+rn	 268
+uf	 267
+isch	 264
+isc	 264
+nen	 263
+_in_	 262
+_M	 260
+_er	 257
+ich_	 255
+ac	 253
+lic	 252
+_G	 252
+ber	 252
+la	 251
+vo	 251
+eb	 250
+ke	 249
+F	 248
+as_	 248
+hen_	 248
+ach	 245
+en,	 244
+ung_	 243
+lich	 243
+ste	 243
+en,_	 243
+_k	 241
+ben	 241
+_f	 241
+en.	 241
+_be	 239
+it_	 239
+L	 238
+_se	 237
+mi	 236
+ve	 236
+na	 236
+on_	 236
+P	 235
+ss	 234
+ist	 234
+�	 234
+ht_	 233
+ru	 233
+st_	 229
+_F	 229
+ts	 227
+ab	 226
+W	 226
+ol	 225
+_eine	 225
+hi	 225
+so	 224
+em_	 223
+"_	 223
+ren	 222
+en._	 221
+chen_	 221
+R	 221
+ta	 221
+ere	 220
+ische	 219
+ers	 218
+ert	 217
+_P	 217
+tr	 217
+ed	 215
+ze	 215
+eg	 215
+ens	 215
+�r	 213
+ah	 212
+_vo	 212
+ne_	 211
+cht_	 210
+uc	 209
+_wi	 209
+nge	 208
+lle	 208
+fe	 207
+_L	 207
+ver	 206
+hl	 205
+V	 204
+ma	 203
+wa	 203
+auf	 201
+H	 198
+_W	 195
+T	 195
+nte	 193
+uch	 193
+l_	 192
+sei	 192
+nen_	 190
+u_	 189
+_den	 189
+_al	 189
+_V	 188
+t.	 188
+lte	 187
+ut	 186
+ent	 184
+sich	 183
+sic	 183
+il	 183
+ier	 182
+am	 181
+gen_	 180
+sen	 179
+f�	 178
+um	 178
+t._	 177
+f_	 174
+he_	 174
+ner	 174
+nst	 174
+ls	 174
+_sei	 173
+ro	 173
+ir	 173
+ebe	 173
+mm	 173
+ag	 172
+ern	 169
+t,_	 169
+t,	 169
+eu	 169
+ft	 168
+icht_	 167
+hre	 167
+Be	 166
+nz	 165
+nder	 165
+_T	 164
+_den_	 164
+iche	 163
+tt	 163
+zu_	 162
+and	 162
+J	 161
+rde	 160
+rei	 160
+_we	 159
+_H	 159
+ige	 159
+_Be	 158
+rte	 157
+hei	 156
+das	 155
+aus	 155
+che_	 154
+_das	 154
+_zu_	 154
+tz	 154
+_ni	 153
+das_	 153
+_R	 153
+N	 153
+des	 153
+_ve	 153
+_J	 152
+I	 152
+_das_	 152
+men	 151
+_so	 151
+_ver	 151
+_auf	 150
+ine_	 150
+_ha	 150
+rg	 149
+ind	 148
+eben	 148
+kt	 147
+mit	 147
+_an	 147
+her	 146
+Ge	 146
+Sc	 145
+_sich	 145
+U	 145
+Sch	 145
+_sic	 145
+end	 145
+Di	 144
+abe	 143
+ck	 143
+sse	 142
+�r_	 142
+ell	 142
+ik	 141
+o_	 141
+nic	 141
+nich	 141
+sa	 141
+_f�	 140
+hn	 140
+zi	 140
+no	 140
+nicht	 140
+im_	 139
+von_	 139
+von	 139
+_nic	 139
+_nich	 139
+eine_	 139
+oc	 138
+wei	 138
+io	 138
+schen	 138
+gt	 138
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/italian.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/italian.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/italian.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 25028
+a	 7570
+e	 6477
+i	 5481
+o	 5104
+l	 3905
+n	 3866
+r	 3502
+t	 2934
+c	 2862
+s	 2862
+a_	 2504
+e_	 2404
+d	 2004
+i_	 1749
+o_	 1679
+u	 1650
+v	 1611
+p	 1561
+m	 1414
+_c	 1325
+,	 1192
+,_	 1192
+_s	 1190
+_d	 1094
+g	 1067
+an	 925
+er	 915
+_a	 914
+_p	 895
+la	 858
+_l	 830
+re	 799
+ar	 769
+h	 762
+no	 753
+co	 726
+va	 698
+_e	 657
+n_	 656
+on	 656
+ra	 653
+to	 651
+f	 638
+di	 638
+_i	 634
+ch	 634
+ll	 633
+l_	 624
+la_	 598
+ta	 593
+el	 576
+in	 567
+_m	 558
+en	 529
+b	 528
+ri	 525
+_co	 523
+_n	 523
+_di	 522
+li	 513
+av	 507
+al	 501
+le	 494
+ia	 492
+se	 484
+ol	 479
+_f	 477
+or	 477
+te	 469
+_e_	 467
+ve	 454
+at	 449
+de	 447
+.	 443
+ne	 429
+va_	 428
+ca	 426
+._	 422
+tt	 422
+re_	 415
+nt	 415
+io	 411
+_v	 407
+pe	 405
+z	 392
+to_	 391
+_ch	 389
+na	 384
+si	 384
+'	 383
+he	 382
+no_	 379
+ci	 374
+_la	 373
+ro	 371
+_g	 370
+st	 368
+cc	 366
+he_	 362
+di_	 362
+ma	 358
+ev	 354
+che	 354
+es	 352
+me	 352
+pa	 351
+_t	 349
+ti	 348
+_di_	 347
+ss	 345
+che_	 344
+a,_	 337
+a,	 337
+nd	 335
+o,	 333
+o,_	 333
+ell	 330
+gl	 323
+sa	 322
+il	 322
+gli	 321
+da	 318
+as	 318
+do	 314
+_che	 308
+_che_	 306
+eva	 306
+_la_	 300
+lla	 298
+le_	 293
+un	 291
+_pe	 290
+_de	 288
+q	 283
+qu	 283
+ava	 280
+po	 277
+on_	 275
+r_	 273
+li_	 273
+_b	 269
+_il	 268
+_il_	 268
+il_	 268
+lo	 267
+om	 263
+e,	 263
+e,_	 263
+ni	 258
+tr	 258
+so	 255
+ra_	 253
+os	 251
+_in	 249
+_u	 248
+per	 244
+are	 243
+et	 243
+_se	 240
+ano	 239
+si_	 238
+_ca	 238
+_qu	 238
+lla_	 238
+_q	 238
+_a_	 236
+ac	 236
+_r	 234
+ic	 233
+_no	 232
+ie	 227
+fa	 227
+hi	 226
+del	 225
+ua	 222
+_per	 218
+ce	 218
+_ma	 216
+sc	 216
+_del	 215
+mi	 212
+_un	 208
+chi	 206
+era	 205
+i,	 205
+i,_	 205
+su	 203
+and	 202
+vo	 202
+_fa	 201
+eva_	 200
+ano_	 199
+gli_	 197
+non	 196
+pi	 196
+vi	 195
+er_	 195
+_al	 194
+se_	 193
+_ne	 192
+_non	 191
+am	 190
+is	 187
+ava_	 187
+_non_	 186
+non_	 186
+in_	 185
+ent	 185
+_si	 184
+_pa	 184
+com	 183
+!	 182
+_le	 182
+_su	 181
+uo	 181
+el_	 180
+!_	 180
+l'	 178
+ue	 177
+te_	 177
+_com	 177
+are_	 176
+pr	 176
+_in_	 176
+van	 172
+mo	 172
+ta_	 171
+gn	 167
+ere	 166
+na_	 166
+tto	 163
+it	 161
+_per_	 161
+per_	 161
+�	 161
+all	 160
+ess	 159
+ut	 159
+col	 158
+acc	 157
+gi	 155
+lo_	 154
+oc	 154
+vano	 153
+io_	 153
+_av	 151
+ndo	 151
+�_	 151
+ato	 149
+ave	 148
+_st	 147
+me_	 147
+'a	 146
+ia_	 144
+con	 143
+mp	 143
+fi	 142
+ett	 142
+_si_	 141
+_pi	 140
+era_	 140
+ti_	 140
+�	 140
+vano_	 140
+_gl	 139
+qua	 139
+ella	 139
+sta	 138
+ome	 137
+S	 137
+_gli	 137
+_S	 137
+ad	 136
+_ve	 134
+ant	 134
+ne_	 134
+�_	 133
+sp	 133
+do_	 133
+_po	 132
+ro_	 132
+ov	 132
+_le_	 131
+ella_	 130
+sse	 129
+_con	 128
+ir	 128
+_vi	 128
+ig	 127
+_gli_	 127
+_ave	 127
+vev	 127
+un_	 126
+ot	 126
+veva	 125
+dell	 125
+que	 125
+a.	 125
+_o	 125
+a._	 124
+tu	 124
+cia	 123
+za	 123
+_que	 123
+_da	 121
+par	 121
+_pr	 120
+cch	 120
+_dell	 120
+eg	 119
+_sa	 119
+o._	 119
+o.	 119
+_col	 118
+lt	 118
+_un_	 118
+rt	 118
+ur	 117
+_vo	 117
+_me	 117
+ome_	 117
+L	 116
+ap	 116
+_L	 116
+zi	 116
+nto	 116
+og	 115
+_an	 115
+_so	 115
+em	 114
+ag	 114
+be	 111
+ni_	 111
+im	 110
+cchi	 110
+ver	 110
+lle	 109
+nz	 109
+cci	 109
+_ri	 109
+nc	 108
+_er	 108
+come_	 107
+come	 107
+aveva	 107
+ui	 107
+avev	 107
+tto_	 107
+_come	 106
+ed	 106
+P	 105
+man	 105
+_P	 105
+rs	 105
+occ	 104
+ndo_	 103
+ato_	 103
+_qua	 103
+_era	 103
+ari	 102
+ba	 100
+_mo	 100
+nel	 100
+id	 99
+men	 98
+_fi	 98
+_all	 98
+rr	 97
+_do	 97
+_avev	 97
+att	 97
+l'a	 96
+ei	 96
+zz	 96
+;	 96
+vol	 95
+pp	 95
+tra	 95
+;_	 95
+ere_	 94
+lle_	 94
+nda	 94
+utt	 94
+est	 93
+_nel	 93
+ul	 92
+ola	 92
+iv	 92
+ando	 90
+ale	 90
+lu	 90
+rn	 90
+e.	 89
+e._	 89
+ll'	 89
+tta	 88
+nte	 87
+_l'	 87
+uel	 87
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/russian-windows1251.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/russian-windows1251.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/russian-windows1251.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 21836
+�	 5818
+�	 4506
+�	 4258
+�	 3769
+�	 3394
+�	 3254
+�	 2594
+�	 2470
+�	 2346
+�	 2227
+�	 1798
+�	 1709
+�	 1673
+�	 1638
+�	 1377
+,	 1187
+,_	 1172
+�_	 1160
+�	 1059
+�	 1024
+�	 1006
+�_	 966
+�	 945
+_�	 937
+�	 910
+_�	 907
+�_	 896
+��	 878
+�	 856
+_�	 828
+_�	 818
+�_	 801
+�	 795
+.	 789
+._	 761
+��	 655
+��	 617
+_�	 616
+��	 575
+�	 568
+�	 565
+��	 549
+��	 526
+��	 524
+�_	 522
+_�	 521
+_�	 497
+_�	 496
+�	 484
+_��	 477
+_�	 477
+��	 472
+��	 470
+�_	 461
+��	 456
+��	 454
+��	 452
+��	 432
+��	 431
+��	 425
+�	 413
+��	 403
+��	 402
+_�	 396
+_�	 396
+��	 395
+��	 388
+��_	 384
+�_	 383
+_��	 378
+_�_	 375
+��	 369
+��	 367
+_��	 365
+�_	 364
+��	 363
+��	 357
+�_	 357
+��	 353
+��	 352
+��	 350
+��	 344
+��	 344
+�_	 343
+��	 338
+��	 337
+��	 334
+��	 330
+��	 328
+��	 326
+��	 326
+��	 323
+-	 322
+��	 320
+��	 317
+�	 312
+��	 308
+��	 308
+�_	 302
+_�	 299
+�_	 296
+��	 292
+��_	 292
+��	 291
+��	 291
+_�	 291
+��	 286
+��	 283
+��	 283
+_��	 274
+��	 264
+��	 263
+�_	 260
+��	 253
+_-	 245
+_�	 245
+�_	 244
+��	 240
+��_	 238
+��	 235
+_��_	 235
+��	 233
+��	 229
+-_	 225
+��	 219
+_�_	 217
+��	 217
+��	 215
+��	 215
+��	 211
+��	 211
+��	 211
+��	 209
+��_	 209
+��	 208
+_�	 206
+�	 206
+��	 205
+�	 205
+���	 203
+��	 203
+��	 202
+_-_	 202
+_��	 199
+_���	 199
+��	 197
+��	 197
+��_	 197
+_�	 195
+��	 192
+_�	 191
+��	 190
+��	 190
+��	 188
+��	 188
+��	 185
+_��	 184
+_�	 183
+��	 182
+_��	 181
+��	 175
+�	 174
+_��	 172
+��	 170
+_�	 169
+��_	 168
+!	 168
+���_	 165
+��	 165
+��_	 164
+��	 164
+�_	 164
+��	 163
+���	 163
+�	 162
+_���_	 162
+_��	 159
+��	 158
+��	 157
+��	 156
+��	 154
+��	 154
+���	 153
+��	 153
+��	 153
+��	 153
+��	 152
+��	 150
+_��_	 149
+�_	 148
+��	 148
+_��	 146
+��_	 146
+��_	 146
+_�	 144
+���	 143
+��	 141
+�_	 141
+��_	 141
+!_	 139
+��	 139
+��	 139
+��	 137
+���	 136
+���	 136
+���_	 135
+_��	 134
+_��	 131
+��	 131
+���	 130
+��_	 129
+�,	 128
+_��	 128
+�,_	 127
+��	 127
+��	 126
+��	 126
+_��	 126
+��	 125
+��	 125
+�	 124
+��	 123
+��	 122
+_��	 122
+_��	 121
+_��	 120
+���	 120
+��	 120
+��	 120
+_�	 119
+���	 119
+���	 119
+��	 118
+�	 117
+_���	 117
+�,	 115
+��	 115
+_��	 115
+��_	 114
+_�	 114
+�,_	 114
+_�	 113
+_�	 113
+��	 112
+���	 112
+���	 110
+��	 110
+_��	 110
+��	 109
+��	 109
+���	 109
+_���	 109
+_��	 108
+���	 108
+��	 107
+��	 107
+��	 107
+��	 106
+�,	 106
+�	 106
+��	 105
+���	 105
+��	 105
+_��	 105
+_���	 104
+��	 104
+��_	 104
+��	 104
+��	 104
+�	 103
+�,_	 103
+��	 103
+��	 102
+���	 102
+_��	 102
+_�	 101
+���	 101
+��	 101
+���	 101
+�_	 101
+���	 100
+_�_	 100
+�,	 100
+��_	 100
+���	 100
+��	 100
+��	 100
+��	 100
+_�	 100
+_�	 99
+�,	 99
+��	 99
+���	 99
+��_	 99
+_��	 99
+��	 98
+��	 98
+_��	 98
+���_	 98
+�	 97
+���	 97
+��	 97
+_�	 97
+�,_	 97
+��	 96
+_��	 96
+�,_	 96
+��	 96
+��	 96
+��_	 95
+��	 95
+��	 94
+��_	 94
+_��	 94
+��	 94
+���	 93
+��	 93
+��_	 92
+_���	 91
+��	 91
+��	 90
+��	 90
+_��	 90
+?	 90
+���	 89
+���	 89
+_�_	 89
+��	 89
+�,	 89
+��	 88
+�	 88
+_���	 88
+��	 88
+��	 88
+��_	 87
+���	 87
+�,_	 87
+��_	 86
+�,	 86
+�,_	 86
+���	 86
+���	 86
+���	 86
+��	 86
+�	 86
+��	 85
+��_	 85
+���	 85
+��	 84
+_��_	 84
+_���	 84
+��	 84
+_���	 84
+_�	 84
+�_	 83
+��	 83
+��	 83
+�	 83
+���	 82
+��_	 82
+"	 82
+���	 82
+���_	 81
+���	 81
+���	 81
+��	 81
+��	 81
+���	 81
+���	 81
+���	 80
+��_	 79
+���	 79
+���	 79
+����	 79
+���	 79
+���	 79
+���	 79
+_��	 78
+���	 78
+_��	 78
+�.	 77
+_��	 77
+�._	 76
+�.	 76
+_��	 76
+��	 76
+��	 76
+��	 76
+���	 76
+�,	 75
+�	 75
+��_	 75
+�,_	 75
+��_	 75
+��	 74
+_��	 74
+���	 74
+��	 74
+��	 74
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/slovak-ascii.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/slovak-ascii.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/slovak-ascii.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 20064
+a	 4991
+o	 4983
+e	 3838
+n	 3342
+i	 3317
+r	 2583
+s	 2501
+v	 2383
+t	 2325
+c	 1918
+k	 1912
+l	 1888
+d	 1736
+u	 1725
+p	 1543
+a_	 1527
+y	 1371
+m	 1339
+z	 1227
+h	 1194
+e_	 956
+_p	 881
+_s	 828
+o_	 814
+na	 809
+b	 808
+_v	 798
+j	 797
+.	 796
+ov	 795
+._	 785
+st	 687
+i_	 665
+,	 657
+,_	 657
+_n	 625
+ch	 623
+u_	 618
+ro	 617
+po	 598
+_o	 546
+ne	 529
+en	 520
+v_	 519
+_a	 516
+ra	 506
+pr	 488
+y_	 481
+od	 476
+_z	 467
+ie	 462
+ni	 448
+an	 447
+vy	 434
+to	 433
+h_	 431
+_na	 429
+re	 416
+ch_	 404
+ho	 401
+al	 399
+ci	 394
+va	 387
+na_	 386
+_pr	 385
+_d	 384
+_k	 378
+la	 377
+ko	 375
+do	 374
+_po	 373
+si	 353
+_t	 346
+_r	 337
+os	 336
+no	 334
+in	 328
+tr	 324
+om	 321
+_v_	 320
+ny	 319
+m_	 319
+ri	 317
+S	 306
+ac	 302
+sa	 300
+ti	 300
+_m	 298
+za	 298
+er	 291
+ia	 290
+ce	 290
+li	 289
+yc	 286
+ych	 285
+ed	 284
+at	 281
+ob	 281
+ak	 280
+_na_	 280
+il	 279
+_,	 279
+_,_	 279
+ok	 277
+sk	 268
+ych_	 265
+_c	 262
+mi	 261
+ol	 260
+me	 260
+l_	 259
+t_	 259
+ku	 258
+ta	 256
+le	 256
+_b	 254
+or	 252
+_a_	 250
+lo	 247
+oc	 246
+vo	 246
+es	 244
+ve	 242
+_vy	 240
+on	 238
+_sa	 231
+as	 231
+da	 230
+aj	 228
+av	 218
+el	 216
+ova	 216
+ic	 215
+ne_	 209
+_do	 208
+sa_	 207
+ka	 205
+_sa_	 204
+te	 203
+j_	 201
+_ro	 199
+P	 198
+_za	 196
+ky	 196
+_S	 195
+je	 194
+ar	 193
+_.	 193
+it	 192
+s_	 192
+em	 191
+ej	 191
+ur	 190
+ad	 189
+_o_	 187
+_._	 187
+ov_	 185
+de	 180
+_%	 179
+om_	 179
+%	 179
+_u	 174
+pre	 173
+dn	 173
+D	 172
+rok	 170
+ie_	 170
+sp	 169
+pri	 167
+_pre	 167
+am	 165
+-	 164
+ke	 164
+eh	 162
+oz	 161
+k_	 160
+ost	 160
+_j	 156
+f	 155
+zn	 153
+g	 152
+kt	 152
+ho_	 151
+eho	 151
+hod	 150
+ku_	 148
+is	 148
+zi	 147
+cn	 147
+eho_	 146
+ej_	 145
+az	 145
+tu	 145
+_pri	 144
+cen	 144
+_st	 143
+ma	 142
+ast	 141
+_ce	 140
+rov	 140
+la_	 138
+ot	 138
+nych	 135
+nyc	 135
+_ob	 133
+z_	 133
+nych_	 131
+N	 130
+li_	 129
+ani	 129
+co	 128
+nt	 128
+ny_	 127
+E	 125
+_ne	 124
+)	 123
+_(	 123
+sti	 123
+A	 123
+(	 123
+cho	 122
+vi	 122
+_sp	 122
+di	 120
+pa	 120
+n_	 119
+ju	 118
+ys	 117
+bo	 117
+_P	 116
+_tr	 115
+V	 114
+je_	 114
+ln	 114
+_i	 113
+ze	 113
+spo	 112
+_N	 112
+nd	 111
+nu	 111
+so	 111
+red	 110
+vn	 110
+kl	 110
+kov	 110
+_cen	 110
+_rok	 109
+tn	 109
+du	 109
+nc	 109
+ap	 109
+d_	 108
+van	 108
+ca	 108
+M	 108
+chod	 107
+ti_	 107
+U	 106
+_ak	 106
+ru	 105
+sta	 105
+ym	 105
+_-	 104
+et	 103
+_h	 102
+est	 102
+_je	 102
+nos	 101
+aci	 101
+us	 100
+dov	 100
+pod	 100
+_to	 100
+tor	 99
+uc	 99
+ras	 98
+ky_	 98
+_s_	 98
+_mi	 97
+*	 97
+uj	 97
+nost	 97
+vys	 97
+ovy	 97
+ez	 97
+oku	 96
+_V	 96
+op	 96
+bc	 96
+rast	 96
+se	 95
+B	 95
+roku	 95
+kto	 94
+ove	 94
+by	 94
+-_	 94
+_ko	 93
+obc	 92
+nie	 91
+ia_	 91
+ka_	 91
+*_	 90
+ali	 90
+lo_	 89
+ovan	 89
+to_	 88
+iz	 88
+_bo	 88
+_l	 88
+odo	 87
+bch	 87
+bchod	 87
+bcho	 87
+sl	 86
+st_	 86
+pred	 86
+C	 86
+pol	 85
+_pred	 85
+R	 85
+ik	 84
+uro	 84
+pi	 84
+ek	 84
+zo	 83
+eni	 83
+obch	 83
+cie	 83
+oku_	 83
+obcho	 83
+ns	 83
+roku_	 82
+ii	 82
+tv	 82
+ba	 82
+ent	 82
+_spo	 81
+tov	 81
+pe	 81
+kon	 80
+kc	 80
+ec	 80
+kci	 80
+ck	 80
+x	 79
+osti	 79
+_Sk	 79
+mi_	 79
+_in	 79
+Sk	 79
+sia	 79
+br	 78
+rh	 78
+val	 78
+olo	 77
+_pod	 77
+%_	 77
+_%_	 77
+bu	 77
+_f	 77
+iv	 77
+_obc	 77
+_obch	 77
+eb	 76
+str	 76
+nej	 76
+_D	 76
+ni_	 75
+ou	 75
+im	 75
+ena	 74
+tre	 74
+_A	 74
+mo	 74
+su	 74
+rz	 73
+_trh	 73
+trh	 73
+_U	 73
+al_	 73
+_ra	 73
+_e	 72
+_C	 72
+sti_	 72
+zv	 72
+te_	 72
+cno	 72
+oj	 72
+ktor	 71
+_roku	 71
+ocn	 71
+ina	 71
+sil	 71
+nov	 71
+alo	 71
+odn	 70
+nan	 70
+oh	 70
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/indonesian.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/indonesian.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/indonesian.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 19406
+a	 10666
+n	 5455
+e	 4535
+i	 4387
+r	 2936
+t	 2902
+an	 2853
+u	 2841
+k	 2761
+s	 2311
+m	 2178
+d	 2134
+g	 2105
+l	 1780
+a_	 1506
+n_	 1476
+ng	 1449
+p	 1397
+b	 1275
+an_	 1270
+o	 1246
+h	 1130
+i_	 1108
+er	 1038
+ka	 1032
+_d	 1006
+y	 997
+,	 951
+en	 941
+ar	 914
+,_	 900
+_m	 880
+ya	 842
+ta	 838
+ang	 797
+di	 787
+da	 773
+.	 754
+la	 742
+._	 738
+me	 732
+ak	 728
+_s	 718
+at	 690
+ra	 688
+ga	 683
+_k	 671
+_me	 650
+in	 628
+ah	 601
+_t	 583
+_p	 570
+g_	 551
+_b	 551
+_di	 548
+ng_	 544
+ma	 536
+se	 526
+tu	 511
+na	 506
+al	 500
+ri	 490
+as	 483
+k_	 482
+j	 480
+si	 470
+ny	 467
+h_	 457
+sa	 452
+ang_	 439
+it	 424
+kan	 423
+ti	 418
+_se	 417
+pe	 412
+S	 409
+ba	 407
+ke	 407
+em	 405
+men	 405
+be	 403
+un	 401
+te	 401
+am	 396
+pa	 395
+nya	 390
+_men	 374
+el	 374
+t_	 371
+_a	 360
+_i	 356
+u_	 355
+kan_	 345
+_ke	 339
+is	 335
+ah_	 324
+_S	 324
+eng	 321
+nga	 320
+ia	 318
+_pe	 316
+ha	 313
+ap	 311
+r_	 308
+w	 305
+li	 301
+_da	 300
+s_	 299
+P	 296
+nd	 290
+_be	 287
+ik	 283
+ja	 281
+yan	 281
+ad	 275
+ek	 273
+uk	 272
+di_	 270
+bu	 269
+ya_	 268
+yang	 268
+ak_	 266
+ber	 265
+_y	 265
+_ya	 264
+_P	 263
+ru	 260
+K	 259
+yang_	 256
+_yang	 256
+_yan	 256
+nt	 255
+de	 253
+_te	 250
+wa	 249
+et	 247
+at_	 246
+ara	 245
+gan	 243
+A	 237
+ari	 235
+ala	 230
+itu	 229
+c	 225
+ol	 225
+ni	 225
+us	 225
+dan	 224
+_K	 224
+M	 224
+B	 223
+ata	 222
+ai	 221
+ur	 219
+nya_	 217
+ua	 215
+_ka	 214
+_ber	 210
+eb	 209
+ran	 206
+D	 206
+ela	 206
+_di_	 205
+_l	 204
+ngan	 204
+ter	 203
+re	 201
+-	 199
+aka	 198
+l_	 194
+_A	 191
+era	 191
+a,	 191
+e_	 190
+ir	 187
+I	 186
+tan	 185
+_B	 184
+ut	 184
+ku	 183
+a,_	 183
+il	 182
+J	 181
+um	 180
+_it	 180
+_itu	 180
+_ta	 179
+su	 179
+dan_	 177
+es	 177
+on	 177
+or	 177
+_dan	 176
+lu	 174
+_M	 172
+tu_	 172
+_dan_	 172
+enga	 171
+mb	 169
+R	 169
+si_	 168
+per	 168
+gan_	 168
+ngan_	 165
+"	 162
+_ter	 162
+a.	 161
+man	 161
+gk	 160
+a._	 160
+asi	 160
+ngk	 160
+ep	 160
+ag	 159
+ul	 158
+da_	 157
+m_	 155
+du	 155
+ada	 153
+ki	 153
+rt	 150
+mp	 150
+T	 150
+ama	 148
+ing	 148
+na_	 147
+_J	 147
+_D	 145
+ung	 145
+ana	 145
+n,	 144
+ju	 144
+ud	 144
+rin	 143
+gi	 143
+aw	 141
+lah	 138
+lan	 138
+_sa	 136
+ri_	 136
+meng	 136
+_meng	 135
+_ma	 134
+n,_	 134
+awa	 134
+st	 134
+eka	 133
+mi	 133
+mu	 132
+_T	 132
+po	 131
+ge	 131
+ar_	 130
+id	 129
+ko	 129
+le	 128
+_h	 128
+ena	 127
+_j	 126
+emb	 126
+ina	 125
+_r	 124
+itu_	 124
+ay	 123
+ngg	 123
+gg	 123
+rang	 123
+pi	 120
+nan	 120
+_ba	 119
+_la	 119
+apa	 119
+_I	 118
+p_	 118
+bi	 117
+ai_	 117
+ta_	 116
+san	 116
+Ke	 116
+ro	 115
+eri	 114
+kar	 113
+lah_	 113
+_itu_	 112
+aya	 111
+i,	 110
+an,	 110
+ra_	 110
+_per	 110
+im	 110
+ika	 109
+isi	 109
+mem	 109
+tah	 108
+_Ke	 108
+ian	 108
+_mem	 108
+akan	 108
+Se	 108
+to	 107
+ab	 107
+ngka	 106
+rs	 106
+gka	 106
+uk_	 105
+seb	 104
+_de	 104
+pu	 104
+i,_	 104
+ita	 104
+nda	 103
+_ti	 103
+ni_	 103
+ca	 103
+_Se	 103
+ers	 103
+pen	 103
+ini	 102
+an,_	 102
+angk	 101
+uh	 101
+han	 101
+nta	 100
+_in	 99
+f	 99
+nj	 99
+ok	 99
+aga	 99
+_R	 98
+as_	 98
+tr	 98
+mer	 97
+lam	 97
+and	 97
+end	 96
+anga	 96
+ne	 96
+Sa	 96
+ka_	 96
+arin	 95
+gu	 95
+_ha	 94
+Z	 94
+al_	 94
+ga_	 94
+_Z	 93
+_pen	 93
+dar	 93
+Ad	 93
+i._	 93
+ada_	 93
+atan	 93
+tak	 93
+i.	 93
+ia_	 92
+asa	 92
+ap_	 92
+ari_	 92
+kat	 92
+_seb	 92
+_Za	 91
+Za	 91
+den	 91
+n.	 90
+_u	 90
+_Ad	 90
+engan	 89
+ib	 89
+any	 89
+n._	 89
+o_	 89
+Zar	 88
+Zari	 88
+rina	 88
+_Zar	 88
+_Zari	 88
+Zarin	 88
+arina	 88
+ks	 88
+angka	 87
+oli	 87
+eg	 87
+kt	 86
+_Sa	 86
+hu	 85
+ih	 85
+us_	 85
+adi	 85
+om	 85
+eba	 85
+anya	 85
+_bu	 84
+denga	 83
+L	 83
+ed	 83
+dak	 83
+deng	 83
+ma_	 82
+asi_	 82
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/yiddish-utf.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/yiddish-utf.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/yiddish-utf.lm	(revision 258)
@@ -0,0 +1,400 @@
+�	 29767
+_	 13552
+_�	 6516
+�	 4273
+�	 3670
+א	 3670
+ע	 3261
+�	 3261
+��	 2826
+ע�	 2826
+א�	 2785
+��	 2785
+י	 2565
+�	 2565
+�	 2082
+ר	 2082
+��	 2062
+י�	 2062
+�	 1857
+ט	 1857
+�	 1828
+ַ	 1828
+�	 1793
+ן	 1793
+_א	 1537
+�_	 1532
+ן_	 1532
+��	 1527
+ַ�	 1527
+אַ	 1517
+�ַ	 1517
+ר�	 1355
+��	 1355
+�	 1270
+ל	 1270
+�	 1268
+אָ	 1268
+ָ	 1268
+�ָ	 1268
+�ַ�	 1240
+אַ�	 1240
+נ	 1232
+�	 1232
+אָ�	 1229
+�ָ�	 1229
+��	 1229
+ָ�	 1229
+נ�	 1181
+��	 1181
+ו	 1116
+�	 1116
+�	 1031
+ד	 1031
+ט�	 1012
+��	 1012
+ל�	 1007
+��	 1007
+ו�	 975
+��	 975
+ד�	 965
+��	 965
+פ�	 929
+�	 929
+פ	 929
+��	 929
+�ר	 873
+ער	 873
+א�	 870
+��	 870
+ז	 868
+�	 868
+�	 832
+ס	 832
+�	 797
+ק	 797
+_א�	 784
+מ	 766
+�	 766
+_א�	 752
+��	 747
+מ�	 747
+�	 742
+ג	 742
+�	 725
+ש	 725
+ט_	 699
+�_	 699
+װ	 691
+�	 691
+װ�	 674
+��	 674
+�	 667
+ײ	 667
+��	 664
+ג�	 664
+�	 661
+ֿ	 661
+ק�	 654
+��	 654
+��	 652
+ֿ�	 652
+ש�	 651
+��	 651
+��	 643
+ז�	 643
+פֿ	 641
+�ֿ	 641
+פֿ�	 638
+�ֿ�	 638
+_אַ	 638
+ר_	 592
+�_	 592
+_ד	 560
+_ד�	 554
+,	 551
+,_	 534
+ב	 517
+�	 517
+_פ�	 502
+_פ	 502
+ב�	 472
+��	 472
+ס�	 436
+��	 436
+צ	 436
+�	 436
+צ�	 433
+��	 433
+_װ	 430
+_װ�	 429
+�	 410
+ה	 410
+�ר_	 404
+_פֿ	 404
+ער_	 404
+_מ	 400
+_מ�	 396
+גע	 390
+�ע	 390
+_ז	 390
+_ז�	 386
+�ע�	 384
+ען	 384
+גע�	 384
+�ן	 384
+ער�	 382
+�ר�	 382
+.	 374
+אי	 372
+�י	 372
+ּ	 366
+�	 366
+��	 363
+ה�	 363
+�י�	 362
+אי�	 362
+_ג	 359
+ױ	 357
+�	 357
+_ג�	 356
+ון	 349
+�ן	 349
+י_	 346
+�_	 346
+ע_	 343
+�_	 343
+�ן_	 337
+ון_	 337
+�ע	 334
+דע	 334
+_אי	 331
+ך	 330
+�	 330
+�ע�	 323
+��	 323
+דע�	 323
+ּ�	 323
+��	 322
+ײ�	 322
+ען_	 321
+�ן_	 321
+��	 320
+ױ�	 320
+�י	 317
+די	 317
+�ַ	 311
+�ַר	 311
+ײ�	 311
+�ר	 311
+ַר	 311
+ײַ	 311
+��	 311
+לע	 310
+�ע	 310
+._	 307
+-	 305
+�_	 297
+ַ_	 297
+�	 294
+כ	 294
+�ע	 290
+נע	 290
+ס_	 289
+�_	 289
+פּ	 288
+�ּ	 288
+ײַ�	 287
+�ַ�	 287
+ך_	 283
+�_	 283
+�ַ_	 274
+אַ_	 274
+ַר�	 272
+�ר�	 272
+לע�	 261
+�ע�	 261
+_ה�	 260
+_ה	 260
+_צ	 259
+�ש	 257
+יש	 257
+_צ�	 256
+זי	 254
+�י	 254
+פּ�	 252
+�ּ�	 252
+מע	 248
+�ע	 248
+_ק	 247
+נע�	 247
+�ע�	 247
+טע	 245
+�ע	 245
+_ק�	 245
+או	 244
+�ו�	 244
+�ו	 244
+או�	 244
+�ל	 238
+על	 238
+�א	 235
+הא	 235
+הא�	 235
+שט	 235
+�ט	 235
+�א�	 235
+כ�	 234
+��	 234
+_ב�	 231
+�ער	 231
+_ב	 231
+ַנ	 229
+�נ	 229
+�נ�	 228
+ַנ�	 228
+_או	 227
+_גע	 226
+�	 219
+ם	 219
+"	 218
+�ע�	 217
+מע�	 217
+�ע	 217
+װע	 217
+�ל	 216
+ַל	 216
+_זי	 215
+_נ	 215
+על�	 212
+�ל�	 212
+�א	 211
+רא	 211
+_נ�	 211
+טע�	 211
+�ע�	 211
+װא	 210
+�א	 210
+_דע	 210
+�א�	 209
+װע�	 209
+װא�	 209
+�ע�	 209
+�ש�	 208
+יש�	 208
+�ק	 207
+יק	 207
+רא�	 206
+�א�	 206
+�_	 205
+ז_	 205
+�י	 196
+מי	 196
+_ש	 195
+מי�	 195
+�י�	 195
+�ַל	 193
+_ש�	 191
+ֿא	 189
+�א	 189
+�ֿא	 189
+ֿא�	 188
+�ו	 188
+ֿו�	 188
+ֿו	 188
+�ו�	 188
+�א�	 188
+�ון	 187
+�אָ	 186
+_הא	 185
+�ֿו	 184
+_ע	 179
+_די	 178
+�א	 176
+טא	 176
+טא�	 175
+�א�	 175
+ָס	 174
+�ָס	 174
+יט	 174
+�ט	 174
+�ס	 174
+ל_	 173
+�_	 173
+�י_	 173
+די_	 173
+ם_	 171
+�ל�	 171
+�_	 171
+ַל�	 171
+_ע�	 171
+�ָט	 169
+�ט	 169
+ָט	 169
+יך	 168
+�ך	 168
+�ָר	 166
+�י�	 166
+ָר	 166
+�ר	 166
+זי�	 166
+ני	 164
+ענ	 164
+�י	 164
+�נ	 164
+�י	 163
+רי	 163
+יך_	 163
+�ך_	 163
+�אָ	 162
+ענ�	 162
+�נ�	 162
+�אַ	 160
+�ט	 160
+עט	 160
+_י	 158
+�י�	 157
+�ר	 157
+רי�	 157
+יר	 157
+-�	 156
+ָס_	 155
+�ס_	 155
+�י	 154
+_מי	 154
+לי	 154
+קע	 153
+ונ	 153
+�ע	 153
+�נ	 153
+_װא	 152
+�י�	 152
+ני�	 152
+�ן	 151
+ין	 151
+אױ	 151
+�ױ	 151
+י�	 150
+�ט	 150
+�	 150
+��	 150
+יִ	 150
+�ִ	 150
+ִ	 150
+ַט	 150
+ִ�	 149
+�ִ�	 149
+��	 149
+יִ�	 149
+�י�	 148
+_י�	 148
+לי�	 148
+�ױ�	 146
+אױ�	 146
+�ַנ	 146
+_אױ	 145
+�ון	 145
+יז	 143
+�ז	 143
+�י�	 142
+די�	 142
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/hebrew-iso8859_8.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/hebrew-iso8859_8.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/hebrew-iso8859_8.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 81560
+�	 23072
+�	 19215
+�	 15606
+�	 12612
+�	 11293
+�	 11070
+�	 10090
+�	 9648
+�	 9601
+�	 9081
+�_	 7811
+�	 6685
+�	 6326
+_�	 5878
+�	 5542
+�	 5019
+�	 4669
+_�	 4570
+�_	 4267
+�	 3984
+_�	 3812
+�	 3769
+�	 3699
+�_	 3693
+��	 3535
+�_	 3489
+�	 3374
+�_	 3362
+��	 3130
+,	 3067
+_�	 3037
+_,	 3035
+_�	 2936
+�_	 2886
+_��	 2840
+�	 2768
+�	 2626
+�	 2424
+_�	 2395
+_��	 2291
+.	 2256
+�	 2215
+_.	 2205
+��	 2144
+�_	 2003
+_�	 1959
+_�	 1913
+"	 1815
+��	 1797
+��	 1742
+��	 1687
+��	 1665
+�_	 1647
+��	 1620
+�_	 1578
+��	 1525
+��	 1475
+�_	 1469
+��	 1411
+�	 1383
+��	 1353
+��	 1351
+��	 1343
+��	 1343
+��	 1315
+��	 1285
+��	 1236
+��_	 1211
+��	 1206
+��	 1192
+��	 1163
+��	 1155
+��	 1146
+��	 1138
+_��	 1137
+��	 1134
+��	 1087
+�_	 1080
+��	 1074
+��	 1067
+_�	 1062
+��	 1059
+��	 1052
+��	 1047
+-	 1024
+��_	 1008
+��	 973
+��	 967
+��	 954
+��_	 951
+��	 948
+_�	 941
+��	 896
+��	 888
+��	 883
+��	 873
+��	 871
+��	 867
+��	 850
+��	 843
+_-	 830
+�_	 830
+��	 824
+��	 820
+�_	 806
+��	 805
+_��	 799
+��	 784
+��	 773
+_��_	 748
+��	 746
+��	 743
+_�	 726
+_��_	 723
+�	 720
+_��	 719
+-_	 716
+_-_	 713
+��	 709
+��	 706
+��	 699
+��_	 690
+��	 686
+��	 683
+��	 678
+��	 675
+�_	 672
+��	 669
+_�	 668
+_�	 659
+_�	 655
+��	 652
+��	 649
+_��	 640
+��	 635
+��	 635
+��_	 632
+�_	 631
+��	 628
+��	 627
+_��	 624
+��	 624
+��_	 621
+��	 619
+��	 600
+��_	 599
+��	 599
+��	 596
+��	 595
+��	 586
+��	 578
+��	 575
+_��	 569
+��	 564
+_��_	 561
+��	 560
+��	 557
+��_	 557
+���	 554
+��	 548
+��_	 548
+���	 548
+���	 546
+��	 542
+��	 540
+"_	 540
+��	 539
+��_	 538
+��	 538
+���	 535
+��	 534
+��	 533
+��	 532
+����	 530
+�����	 530
+����	 530
+��	 527
+��	 525
+_��	 518
+��	 518
+��_	 511
+��_	 510
+_��	 509
+��	 506
+��	 502
+��_	 500
+��	 498
+��	 497
+��	 497
+��	 494
+_�	 485
+�_	 481
+���	 477
+_��	 477
+��	 472
+��	 470
+,�	 470
+_,�	 470
+�_	 469
+��	 468
+_��	 467
+��	 467
+��_	 466
+_��_	 463
+��	 462
+��	 462
+_��	 461
+�	 455
+��	 454
+���	 454
+��	 453
+��	 453
+��	 452
+���	 451
+_��	 447
+��	 443
+�_	 441
+��	 440
+���	 439
+��_	 439
+'	 435
+��_	 430
+.�	 429
+��	 429
+_.�	 428
+��	 427
+��	 423
+��	 417
+��	 417
+_��	 414
+��	 413
+��	 408
+�_	 405
+��	 400
+��	 400
+��	 399
+,�	 399
+_,�	 399
+��	 397
+��_	 396
+��	 396
+��	 394
+��_	 393
+���	 393
+���	 389
+_��	 385
+���	 384
+��_	 384
+��	 384
+��	 381
+��	 378
+��_	 377
+��	 374
+_�	 374
+��	 374
+��	 373
+��	 373
+��	 371
+��	 370
+��	 370
+_��	 370
+��	 367
+_��	 366
+_���	 364
+��	 363
+�_	 362
+_�	 360
+��	 360
+_��	 360
+��	 359
+,�	 358
+_,�	 357
+��	 356
+���	 353
+���	 353
+��_	 349
+��	 348
+���	 348
+��	 345
+�	 345
+���	 344
+��	 340
+_���	 340
+��	 338
+��	 338
+_���	 336
+���	 335
+_���	 335
+��_	 332
+��	 331
+_��	 329
+_���	 325
+��	 325
+��_	 325
+:	 324
+��	 324
+��_	 324
+��	 322
+��	 321
+��	 320
+�_	 320
+��_	 319
+��_	 319
+_:	 319
+��	 316
+���	 315
+_�	 315
+���	 315
+��	 315
+��	 313
+��_	 312
+��	 312
+_�	 310
+���	 309
+���_	 305
+����_	 305
+.��	 305
+_.��	 304
+��	 303
+���	 303
+_'	 303
+��	 302
+��_	 302
+_���	 301
+��	 298
+��	 294
+��	 293
+��	 293
+���	 292
+��	 292
+����	 292
+��	 292
+���	 290
+��	 289
+��	 289
+��	 289
+��	 287
+_��	 286
+,��	 285
+_,��	 285
+��	 284
+��	 282
+��	 282
+_��	 281
+��	 281
+_���	 281
+��	 280
+���	 278
+��_	 276
+��_	 276
+_��_	 275
+���	 274
+_���	 274
+��	 274
+��_	 271
+��_	 271
+��	 270
+��_	 269
+��	 268
+��	 267
+��	 267
+.�	 266
+_��	 266
+_����	 266
+���	 266
+_.�	 265
+����	 265
+���	 265
+���	 265
+��	 264
+��	 263
+��	 262
+���	 260
+_.�	 260
+.�	 260
+��_	 260
+��_	 259
+���	 258
+����	 258
+�����	 258
+�����	 257
+����	 257
+��_	 256
+��_	 256
+��	 255
+���	 255
+��_	 254
+���	 254
+��	 252
+��	 251
+��_	 251
+_��	 251
+���	 251
+_��	 249
+_��	 249
+_���	 249
+��	 248
+��	 247
+_��	 247
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/english.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/english.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/english.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 20326
+e	 6617
+t	 4843
+o	 3834
+n	 3653
+i	 3602
+a	 3433
+s	 2945
+r	 2921
+h	 2507
+e_	 2000
+d	 1816
+_t	 1785
+c	 1639
+l	 1635
+th	 1535
+he	 1351
+_th	 1333
+u	 1309
+f	 1253
+m	 1175
+p	 1151
+_a	 1145
+the	 1142
+_the	 1060
+s_	 978
+er	 968
+_o	 967
+he_	 928
+d_	 888
+t_	 885
+the_	 844
+_the_	 843
+on	 842
+in	 817
+y	 783
+n_	 773
+b	 761
+re	 754
+,	 734
+,_	 732
+an	 732
+g	 728
+w	 718
+_i	 707
+en	 676
+f_	 599
+y_	 595
+of	 594
+_of	 592
+es	 589
+ti	 587
+v	 580
+_of_	 575
+of_	 575
+nd	 568
+at	 549
+r_	 540
+_w	 534
+it	 522
+ed	 496
+_p	 494
+nt	 485
+_c	 462
+o_	 457
+io	 450
+_an	 439
+te	 432
+or	 425
+_b	 418
+nd_	 407
+to	 406
+st	 402
+is	 401
+_s	 396
+_in	 389
+ion	 385
+and	 385
+de	 384
+ve	 382
+ha	 375
+ar	 366
+_m	 361
+and_	 360
+_and	 360
+_and_	 358
+se	 353
+_to	 347
+me	 346
+to_	 344
+ed_	 339
+.	 330
+be	 329
+_f	 329
+._	 329
+_to_	 320
+co	 317
+ic	 316
+ns	 308
+al	 307
+le	 304
+ou	 304
+ce	 293
+ent	 279
+l_	 278
+_co	 277
+tio	 275
+on_	 274
+_d	 274
+tion	 268
+ri	 266
+_e	 264
+ng	 253
+hi	 251
+er_	 249
+ea	 246
+as	 245
+_be	 242
+pe	 242
+h_	 234
+_r	 232
+ec	 227
+ch	 223
+ro	 222
+ct	 220
+_h	 219
+pr	 217
+in_	 217
+ne	 214
+ll	 214
+rt	 213
+s,_	 210
+s,	 210
+li	 209
+ra	 208
+T	 207
+wh	 204
+a_	 203
+ac	 201
+_wh	 199
+_n	 196
+ts	 196
+di	 196
+es_	 195
+si	 194
+re_	 193
+at_	 192
+nc	 192
+ie	 190
+_a_	 188
+_in_	 185
+ing	 184
+us	 182
+_re	 182
+g_	 179
+ng_	 178
+op	 178
+con	 177
+tha	 175
+_l	 174
+_tha	 174
+ver	 173
+ma	 173
+ion_	 171
+_con	 171
+ci	 170
+ons	 170
+_it	 170
+po	 169
+ere	 168
+is_	 167
+ta	 167
+la	 166
+_pr	 165
+fo	 164
+ho	 164
+ir	 162
+ss	 161
+men	 160
+be_	 160
+un	 159
+ty	 159
+_be_	 158
+ing_	 157
+om	 156
+ot	 156
+hat	 155
+ly	 155
+_g	 155
+em	 153
+_T	 151
+rs	 150
+mo	 148
+ch_	 148
+wi	 147
+we	 147
+ad	 147
+ts_	 145
+res	 143
+_wi	 143
+I	 143
+hat_	 142
+ei	 141
+ly_	 141
+ni	 140
+os	 140
+ca	 139
+ur	 139
+A	 138
+ut	 138
+that	 138
+_that	 137
+ati	 137
+_fo	 137
+st_	 137
+il	 136
+or_	 136
+for	 136
+pa	 136
+ul	 135
+ate	 135
+ter	 134
+it_	 134
+nt_	 133
+that_	 132
+_ha	 129
+al_	 128
+el	 128
+as_	 127
+ll_	 127
+_ma	 125
+no	 124
+ment	 124
+an_	 124
+tion_	 122
+su	 122
+bl	 122
+_de	 122
+nce	 120
+pl	 120
+fe	 119
+tr	 118
+so	 118
+int	 115
+ov	 114
+e,	 114
+e,_	 114
+_u	 113
+ent_	 113
+Th	 113
+her	 113
+j	 112
+atio	 112
+ation	 112
+_Th	 111
+le_	 110
+ai	 110
+_it_	 110
+_on	 110
+_for	 109
+ect	 109
+k	 109
+hic	 108
+est	 108
+der	 107
+tu	 107
+na	 106
+_by_	 106
+by_	 106
+E	 106
+by	 106
+_by	 106
+ve_	 106
+_di	 106
+en_	 104
+vi	 104
+m_	 103
+_whi	 102
+iv	 102
+whi	 102
+ns_	 102
+_A	 101
+ich	 100
+ge	 100
+pro	 99
+ess	 99
+_whic	 99
+ers	 99
+hich	 99
+ce_	 99
+which	 99
+whic	 99
+all	 98
+ove	 98
+_is	 98
+ich_	 97
+ee	 97
+hich_	 97
+n,_	 96
+n,	 96
+im	 95
+ir_	 94
+hei	 94
+ions	 94
+sti	 94
+se_	 94
+per	 93
+The	 93
+_pa	 93
+heir	 93
+id	 93
+eir	 93
+eir_	 93
+ig	 93
+heir_	 93
+_no	 93
+ev	 93
+era	 92
+_int	 92
+ted	 91
+_The	 91
+ies	 91
+art	 91
+thei	 90
+_ar	 90
+_thei	 90
+their	 90
+_pro	 90
+et	 89
+_pe	 88
+_mo	 88
+ther	 88
+x	 87
+gh	 87
+S	 87
+_is_	 87
+ol	 87
+ty_	 87
+_I	 86
+nde	 86
+am	 86
+rn	 86
+nte	 86
+mp	 85
+_su	 84
+_we	 84
+par	 84
+_v	 84
+pu	 82
+his	 82
+ow	 82
+mi	 82
+go	 81
+N	 81
+ue	 81
+ple	 81
+ep	 80
+ab	 80
+;_	 80
+;	 80
+ex	 80
+ain	 80
+over	 80
+_un	 79
+q	 79
+qu	 79
+pp	 79
+ith	 79
+ry	 79
+_as	 79
+ber	 79
+ub	 78
+av	 78
+uc	 78
+s._	 77
+s.	 77
+enc	 77
+are	 77
+iti	 77
+gr	 76
+his_	 76
+ua	 76
+part	 76
+ff	 75
+eve	 75
+O	 75
+rea	 74
+ous	 74
+ia	 74
+The_	 73
+ag	 73
+mb	 73
+_go	 73
+fa	 72
+on,_	 72
+ern	 72
+t,_	 72
+on,	 72
+t,	 72
+_me	 71
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/breton.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/breton.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/breton.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 21447
+e	 6375
+a	 5414
+n	 3228
+r	 3039
+o	 2968
+t	 2392
+i	 1812
+h	 1751
+u	 1650
+l	 1630
+d	 1506
+a_	 1352
+z	 1319
+t_	 1310
+_e	 1168
+_a	 1168
+e_	 1133
+m	 1105
+s	 1100
+g	 1090
+r_	 998
+k	 997
+n_	 958
+et	 941
+v	 888
+_d	 868
+an	 859
+.	 846
+'	 841
+en	 836
+b	 757
+,	 749
+,_	 743
+._	 716
+ar	 703
+ou	 700
+et_	 689
+c	 686
+ez	 572
+'h	 572
+_g	 565
+er	 555
+p	 553
+_k	 535
+c'h	 530
+c'	 530
+nt	 513
+_h	 505
+re	 505
+ra	 478
+ha	 466
+�	 458
+ne	 456
+oa	 454
+_o	 442
+_b	 434
+-	 432
+zh	 422
+ar_	 415
+_m	 414
+_e_	 414
+nn	 384
+el	 376
+_a_	 356
+ur	 350
+o_	 346
+h_	 345
+ve	 340
+nt_	 340
+w	 339
+ke	 338
+de	 333
+a�	 332
+_p	 332
+s_	 327
+he	 325
+on	 318
+le	 318
+ga	 316
+ma	 315
+_ar	 312
+eu	 312
+_n	 310
+an_	 298
+ant	 296
+enn	 285
+z_	 282
+_ar_	 281
+be	 280
+_v	 276
+_r	 272
+al	 270
+en_	 268
+_ke	 267
+l_	 264
+em	 264
+_c	 263
+�_	 262
+da	 262
+_s	 261
+ho	 260
+di	 259
+_ha	 252
+ll	 250
+tr	 248
+oa_	 247
+me	 246
+us	 242
+_ga	 234
+la	 231
+ket	 227
+ant_	 219
+_da	 219
+_l	 216
+ur_	 216
+_oa	 215
+in	 214
+ket_	 211
+gan	 211
+_c'	 207
+_u	 207
+_c'h	 207
+ad	 207
+a�_	 207
+ao	 204
+_ma	 204
+_t	 204
+_ket	 201
+_an	 199
+_di	 197
+ezh	 196
+�	 196
+o�	 196
+_de	 195
+ev	 193
+?	 192
+st	 192
+ro	 192
+P	 192
+_ket_	 188
+er_	 188
+f	 186
+na	 186
+ue	 185
+da_	 184
+?_	 184
+_gan	 184
+_da_	 184
+_ne	 183
+ed	 182
+_P	 180
+g_	 180
+pe	 179
+m_	 178
+A	 177
+ri	 176
+us_	 175
+ta	 174
+ze	 174
+gant	 174
+ka	 174
+i_	 172
+d_	 171
+G	 167
+te	 167
+ae	 166
+zh_	 164
+ha_	 163
+_ha_	 163
+_he	 161
+_gant	 159
+do	 159
+oue	 159
+_G	 158
+eus	 158
+eo	 158
+'h_	 157
+_en	 157
+go	 157
+am	 157
+c'h_	 157
+_be	 156
+we	 156
+iz	 154
+_an_	 151
+_A	 150
+eus_	 147
+sk	 147
+li	 146
+as	 146
+_pe	 146
+j	 146
+_oa_	 146
+av	 144
+gant_	 143
+ut	 142
+no	 141
+vez	 140
+va	 140
+_ra	 140
+ge	 138
+ez_	 138
+bo	 137
+�	 137
+_ur	 136
+lo	 134
+he_	 134
+o�_	 133
+�_	 133
+_ur_	 132
+es	 130
+'ho	 129
+ni	 129
+uz	 129
+tra	 127
+se	 126
+it	 125
+ra_	 125
+out	 125
+is	 125
+at	 125
+hi	 125
+eg	 125
+ig	 124
+ko	 124
+io	 123
+k_	 123
+ch	 123
+_w	 121
+or	 121
+Pe	 121
+_ma_	 119
+ma_	 119
+gw	 118
+_em	 118
+_Pe	 118
+un	 118
+eme	 117
+ne_	 117
+nn_	 117
+c'ho	 117
+ol	 116
+ag	 116
+M	 115
+'ha	 115
+_en_	 115
+iv	 115
+vi	 113
+_ka	 113
+K	 113
+ud	 112
+_he_	 111
+ont	 110
+oc	 110
+vo	 110
+ec	 109
+wa	 109
+..	 107
+_M	 107
+_z	 107
+br	 107
+om	 106
+to	 105
+_f	 105
+N	 105
+_c'ho	 104
+ti	 104
+ut_	 104
+D	 104
+_o_	 103
+_la	 103
+_go	 101
+az	 101
+out_	 101
+ba	 101
+enn_	 101
+c'ha	 101
+our	 100
+oc'h	 100
+ell	 100
+oc'	 100
+etr	 99
+el_	 99
+_K	 99
+_D	 99
+:	 99
+:_	 99
+eve	 98
+_d'	 97
+all	 97
+d'	 97
+E	 97
+_ne_	 97
+_me	 95
+eo_	 95
+ak	 95
+bet	 95
+_eu	 95
+rc	 94
+_do	 94
+_gw	 94
+zi	 93
+oz	 93
+aou	 93
+etra	 92
+pa	 91
+ab	 90
+on_	 90
+ei	 90
+tra_	 90
+n,	 89
+zo	 89
+ag_	 89
+_ev	 88
+ul	 88
+'e	 88
+n'	 88
+n,_	 88
+ouz	 87
+v_	 86
+_n'	 86
+_eus	 84
+H	 83
+za	 83
+S	 83
+etra_	 83
+_eo	 82
+t,_	 82
+t,	 82
+il	 81
+ent	 81
+fe	 81
+rc'h	 81
+rc'	 81
+_eus_	 80
+ie	 80
+_bo	 79
+ele	 79
+_ve	 79
+mp	 79
+_bet	 78
+B	 78
+it_	 77
+_vo	 77
+'a	 77
+n.	 76
+_S	 76
+hag	 76
+hoa	 75
+_hag	 75
+len	 75
+_N	 75
+'hoa	 74
+_E	 74
+ir	 74
+hag_	 74
+_hag_	 74
+ma�	 74
+as_	 73
+eze	 73
+ont_	 73
+_.	 73
+i�	 73
+r,	 72
+pr	 72
+ed_	 72
+n._	 72
+re_	 72
+in_	 72
+r,_	 72
+_H	 71
+'he	 70
+t.	 70
+gou	 70
+em_	 70
+_br	 70
+rae	 70
+rez	 69
+t._	 69
+bet_	 69
+net	 69
+dr	 68
+_eo_	 68
+ll_	 68
+mo	 67
+po	 67
+oul	 67
+rou	 67
+c'hoa	 67
+a-	 67
+vel	 67
+oc'h_	 67
+nna	 66
+_B	 66
+met	 65
+ec'	 65
+ec'h	 65
+R	 64
+den	 64
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/arabic-iso8859_6.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/arabic-iso8859_6.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/arabic-iso8859_6.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 9692
+�	 7361
+�	 6120
+ا	 2417
+�	 2417
+_�	 1691
+ل	 1587
+�	 1587
+ا�	 1415
+��	 1415
+�	 1241
+_�	 1129
+_ا	 987
+�ل	 978
+ال	 978
+�	 952
+_ا�	 894
+م	 869
+�	 869
+ل�	 801
+��	 801
+�	 798
+ي	 798
+_ال	 771
+�	 757
+ت	 757
+ا�	 738
+��	 738
+و	 680
+�	 680
+ن	 659
+�	 659
+�	 622
+ل�	 619
+��	 619
+�ل�	 574
+ال�	 574
+�	 547
+ع	 547
+ر	 541
+�	 541
+�	 527
+�	 512
+ة	 512
+��	 504
+م�	 504
+�	 496
+��	 492
+ب	 490
+�	 490
+ة_	 482
+�_	 482
+�	 477
+_�	 470
+��	 461
+ي�	 461
+.	 430
+_��	 405
+�ل�	 352
+ال�	 352
+ك	 350
+�	 350
+�	 340
+د	 339
+�	 339
+ت�	 334
+��	 334
+�	 324
+�	 314
+ف	 314
+�	 302
+_و	 289
+��	 278
+م�	 278
+ن�	 276
+��	 276
+ع�	 270
+��	 270
+�	 267
+و�	 263
+��	 263
+ن_	 262
+�_	 262
+_م	 259
+�	 258
+ه	 258
+�	 258
+س	 258
+لا	 258
+�ا	 258
+�_	 257
+ب�	 252
+��	 252
+��	 252
+و�	 252
+�	 252
+�_	 250
+ا_	 250
+�	 242
+_�	 235
+ت_	 226
+�_	 226
+._	 223
+��	 213
+ر�	 213
+�ت	 206
+ات	 206
+�	 202
+ح	 202
+�_	 200
+��	 199
+ر�	 199
+�	 199
+��	 198
+ع�	 198
+��	 196
+ب�	 196
+ك�	 193
+��	 193
+ت�	 191
+لم	 191
+��	 191
+�م	 191
+..	 188
+ق	 184
+�	 184
+ج	 183
+ان	 180
+�ن	 180
+�لا	 178
+�_	 176
+ية	 176
+�ة	 176
+ي_	 176
+�	 175
+ف�	 175
+��	 175
+_ب	 171
+�	 171
+�لم	 170
+�	 166
+�_	 165
+و_	 165
+ه�	 163
+_ف	 163
+��	 163
+�	 162
+ش	 162
+ل_	 162
+�_	 162
+��	 161
+ي�	 161
+�	 160
+�	 159
+ية_	 158
+�ة_	 158
+�	 155
+ى	 155
+س�	 153
+��	 153
+ى_	 150
+�_	 150
+�	 150
+�	 148
+�ت_	 147
+ات_	 147
+�	 144
+_�	 144
+ص	 144
+�_	 142
+�م�	 139
+لم�	 139
+_ف�	 136
+_م�	 133
+ما	 130
+_ب�	 130
+�ا	 130
+ش�	 129
+��	 129
+_و_	 129
+��	 128
+د�	 128
+�_	 127
+��	 127
+_م�	 126
+ر_	 124
+�_	 124
+عل	 123
+�ل	 123
+في	 122
+�ي	 122
+ق�	 121
+_�	 121
+��	 121
+��	 119
+ح�	 119
+لا�	 118
+�ا�	 118
+�	 117
+�_	 117
+_ع	 117
+�	 116
+��	 115
+_ت	 115
+ن�	 115
+��	 113
+��	 113
+د�	 113
+�ن	 111
+مع	 111
+�ع	 111
+من	 111
+عل�	 110
+�ل�	 110
+_�	 109
+_ل	 108
+ك�	 108
+��	 108
+�ي_	 102
+ها	 102
+لا�	 102
+�ا�	 102
+في_	 102
+�ا	 102
+�	 101
+��	 101
+خ	 101
+_و�	 100
+ج�	 100
+_في	 99
+ف�	 99
+��	 99
+�	 98
+�_	 97
+ام	 97
+�م	 97
+د_	 97
+...	 94
+_من	 94
+�ا	 93
+�	 93
+با	 93
+_ا�	 93
+ط	 93
+�ا	 92
+�	 92
+وا	 92
+نت	 91
+�ت	 91
+�_	 90
+��	 89
+_�	 89
+�_	 88
+��	 87
+_ع�	 87
+لى	 85
+�ى	 85
+��	 84
+ذ	 84
+�ن_	 84
+س�	 84
+��	 84
+�ى_	 84
+�	 84
+لى_	 84
+من_	 84
+���	 84
+-	 83
+��	 83
+خ�	 83
+_�	 82
+�_	 82
+�س	 82
+اس	 82
+م_	 82
+_���	 81
+�م	 80
+�	 80
+وم	 80
+�_	 79
+ان�	 79
+�ن�	 79
+�_	 78
+�ا	 78
+�ا	 78
+عا	 78
+�ر	 78
+ها_	 78
+ع_	 78
+�_	 78
+�ا_	 78
+را	 78
+ار	 78
+��	 78
+ص�	 78
+.._	 77
+أ	 77
+..._	 77
+�	 77
+�	 77
+�ي	 76
+لي	 76
+�ر	 75
+تر	 75
+�	 74
+لك	 73
+ان_	 73
+ض	 73
+ث	 73
+��	 73
+ج�	 73
+�	 73
+�ن_	 73
+�ك	 73
+مع�	 72
+�ع�	 72
+��	 71
+��	 70
+�ا	 70
+نا	 70
+��	 69
+�_	 69
+ح�	 69
+��	 69
+�ت	 68
+لت	 68
+�ا	 68
+��	 68
+_ت�	 68
+يا	 68
+_�	 67
+�	 66
+�.	 66
+��	 66
+_�_	 65
+�ت	 65
+��	 65
+ست	 65
+_�	 65
+��	 65
+�	 64
+وم�	 64
+��	 64
+�م�	 64
+��	 63
+اس�	 63
+�	 63
+�س�	 63
+�_	 62
+-_	 62
+��	 61
+_-	 61
+�و	 61
+لو	 61
+_ان	 61
+��	 61
+�_	 61
+��_	 60
+�د	 60
+_و�	 60
+���	 60
+�	 60
+اد	 60
+��	 60
+�ت�	 59
+���	 59
+_-_	 59
+_عل	 59
+نت�	 59
+����	 58
+ه�	 58
+�	 58
+جا	 58
+��	 58
+�ب	 58
+لب	 58
+_ي	 58
+_��	 58
+ز	 58
+_ل�	 58
+�ا	 58
+�ا	 57
+�نت	 57
+�ل	 57
+كا	 57
+ول	 57
+�..	 56
+شب	 56
+�..._	 56
+�ب	 56
+��_	 56
+�...	 56
+�ي	 56
+بي	 56
+تع	 55
+عم	 55
+�لى	 55
+_ك	 55
+�ع	 55
+_._	 55
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/lithuanian.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/lithuanian.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/lithuanian.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 23070
+i	 8196
+a	 7763
+s	 5179
+e	 3458
+o	 3425
+u	 3371
+t	 3344
+r	 3240
+n	 3070
+k	 3019
+l	 2060
+p	 1889
+s_	 1756
+m	 1680
+d	 1640
+v	 1590
+,	 1501
+,_	 1497
+�	 1400
+g	 1302
+j	 1200
+o_	 1138
+.	 1128
+ai	 1113
+�	 1075
+_p	 1047
+_k	 1035
+i_	 990
+._	 984
+as	 975
+b	 937
+au	 903
+is	 863
+_n	 815
+ka	 811
+si	 804
+_s	 799
+ia	 796
+�	 759
+ta	 735
+ie	 731
+ti	 728
+y	 721
+_t	 711
+in	 697
+_i	 686
+us	 675
+pa	 658
+ir	 640
+ar	 633
+�	 620
+_a	 617
+r_	 609
+ne	 583
+a_	 578
+ri	 569
+_v	 558
+_pa	 541
+al	 540
+ra	 531
+li	 522
+�	 509
+u_	 493
+vi	 490
+_ka	 489
+da	 487
+_ne	 482
+_j	 481
+en	 478
+�_	 445
+os	 444
+ki	 442
+�	 441
+an	 440
+ik	 434
+ma	 433
+as_	 430
+st	 420
+_d	 420
+ai_	 417
+s,_	 396
+am	 396
+is_	 396
+s,	 396
+_ir	 390
+jo	 387
+ir_	 385
+at	 384
+_ir_	 383
+i�	 381
+ni	 377
+ga	 376
+_b	 367
+na	 366
+e_	 365
+to	 352
+pr	 337
+_g	 332
+_m	 332
+�	 328
+�	 326
+io	 323
+ei	 323
+�_	 321
+su	 320
+�i	 320
+uo	 319
+la	 317
+er	 303
+va	 299
+vo	 298
+�i	 293
+es	 291
+-	 290
+�_	 286
+-_	 285
+_vi	 284
+_-	 283
+ko	 283
+_-_	 283
+iau	 281
+sa	 278
+s.	 278
+iu	 276
+et	 274
+nu	 265
+ja	 262
+�_	 262
+_ta	 262
+s._	 259
+el	 258
+�j	 258
+os_	 256
+im	 255
+it	 254
+_pr	 253
+no	 252
+av	 251
+ur	 251
+_�	 248
+mi	 246
+ve	 245
+ak	 245
+ku	 243
+ek	 241
+tu	 241
+_�	 241
+ad	 241
+�	 238
+_l	 238
+_i�	 236
+us_	 236
+_su	 232
+oj	 231
+au_	 231
+ba	 224
+nt	 218
+me	 214
+te	 210
+jo_	 208
+ro	 205
+�s	 204
+i�	 203
+tai	 203
+_�	 201
+l�	 201
+pas	 200
+ip	 198
+iai	 197
+di	 195
+usi	 194
+vo_	 193
+kai	 190
+i,	 189
+i,_	 189
+sk	 187
+_r	 186
+aus	 184
+ap	 183
+gi	 182
+mo	 182
+uk	 181
+t_	 180
+_da	 177
+be	 176
+ien	 176
+o,	 174
+il	 174
+o,_	 173
+ti_	 173
+re	 172
+_nu	 171
+�ia	 171
+_pas	 169
+pri	 169
+�_	 169
+ok	 168
+d�	 166
+�l	 162
+bu	 161
+�i	 160
+on	 160
+asi	 159
+id	 158
+ul	 157
+ji	 157
+aip	 156
+ia_	 155
+_sa	 154
+ot	 154
+gal	 153
+nk	 153
+om	 152
+p_	 151
+_pri	 151
+od	 151
+vis	 150
+_at	 150
+vie	 150
+uv	 150
+ab	 150
+i�_	 149
+ama	 149
+n�	 149
+A	 149
+sta	 148
+kr	 148
+_A	 145
+ais	 144
+rt	 143
+J	 142
+_J	 142
+�jo	 142
+_�_	 141
+K	 140
+_K	 139
+pi	 139
+avo	 139
+ng	 139
+mas	 138
+du	 138
+ug	 137
+_ga	 137
+ol	 136
+tik	 135
+ali	 135
+..	 135
+_vis	 135
+iek	 134
+ini	 133
+kad	 133
+a,	 133
+le	 133
+k�	 133
+T	 133
+t�	 132
+i.	 132
+_T	 131
+d�	 131
+a,_	 131
+go	 131
+ip_	 131
+aip_	 131
+r�	 129
+a�	 129
+d�i	 129
+ke	 128
+k_	 128
+d_	 127
+ad_	 127
+_ti	 127
+_ma	 126
+_va	 125
+i._	 124
+z	 123
+�k	 123
+iau_	 121
+m_	 120
+kar	 119
+um	 119
+t�	 119
+_kad	 118
+u�	 117
+tr	 117
+_kai	 117
+as,	 116
+og	 116
+kad_	 116
+as,_	 116
+_ji	 116
+rie	 115
+yt	 114
+_ja	 114
+_ko	 114
+v�	 114
+ys	 114
+jau	 113
+ar_	 113
+pra	 112
+a�	 112
+ant	 112
+kl	 111
+tas	 111
+gu	 111
+_ku	 110
+si_	 110
+pe	 109
+eb	 109
+N	 109
+�jo_	 108
+_kad_	 108
+se	 108
+_ki	 108
+or	 107
+ly	 107
+lo	 107
+iai_	 107
+_la	 106
+ts	 106
+�s	 106
+ig	 105
+_N	 105
+ut	 105
+_u	 105
+�s_	 105
+avo_	 104
+ie_	 104
+a.	 104
+kt	 104
+em	 103
+do	 103
+je	 102
+ks	 102
+ats	 101
+_be	 101
+ris	 101
+l_	 101
+_vie	 101
+tin	 101
+ag	 100
+dam	 100
+_st	 100
+a._	 99
+_bu	 99
+?	 99
+V	 98
+io_	 98
+kas	 98
+_jo	 98
+vien	 97
+_gal	 97
+�t	 97
+kia	 97
+lia	 96
+c	 96
+uri	 96
+_V	 96
+?_	 96
+uvo	 95
+ru	 95
+ty	 95
+ep	 94
+nd	 94
+lai	 94
+_tai	 94
+ju	 93
+man	 92
+o.	 92
+buv	 92
+t�	 92
+_�i	 91
+i�_	 91
+_i�_	 91
+i�k	 90
+o._	 90
+_to	 90
+bi	 90
+up	 89
+po	 89
+rs	 89
+_prie	 88
+�,_	 88
+aik	 88
+ui	 88
+_tik	 88
+ij	 88
+�,	 88
+pat	 88
+prie	 88
+I	 87
+ies	 87
+tai_	 87
+n_	 87
+pasi	 87
+ius	 87
+�t	 87
+eik	 86
+_me	 86
+ina	 86
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/latvian.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/latvian.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/latvian.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 24504
+a	 8735
+i	 7353
+s	 6064
+t	 5176
+e	 4390
+r	 4339
+u	 4200
+n	 3422
+�	 3055
+m	 2817
+p	 2755
+k	 2703
+o	 2643
+s_	 2595
+d	 2131
+l	 2035
+j	 1972
+�	 1958
+ie	 1887
+v	 1822
+as	 1530
+u_	 1396
+_p	 1380
+b	 1357
+z	 1311
+�	 1267
+a_	 1261
+as_	 1217
+.	 1065
+,	 1048
+,_	 1033
+g	 1010
+ar	 970
+�	 965
+ti	 962
+c	 922
+_a	 876
+ja	 838
+st	 828
+_i	 822
+_v	 805
+pa	 792
+_t	 775
+._	 774
+um	 760
+_k	 749
+�_	 734
+_n	 728
+es	 712
+i_	 706
+at	 703
+is	 695
+_s	 680
+ai	 649
+ta	 635
+an	 631
+ka	 621
+r_	 615
+�b	 586
+ij	 585
+_u	 568
+_pa	 548
+un	 541
+no	 539
+va	 537
+ma	 525
+ra	 522
+ri	 515
+iz	 512
+in	 509
+vi	 508
+pr	 506
+sa	 487
+ju	 486
+t�	 483
+ik	 473
+n_	 472
+am	 454
+en	 452
+tie	 440
+na	 432
+�a	 430
+tu	 420
+ija	 420
+ir	 419
+o_	 415
+m_	 414
+li	 411
+ci	 409
+ku	 404
+mi	 401
+_no	 398
+ek	 398
+_un	 397
+t_	 395
+_l	 394
+un_	 393
+_d	 393
+ot	 392
+_un_	 392
+ies	 391
+ar_	 388
+n�	 387
+da	 387
+ei	 385
+em	 382
+_ti	 382
+pi	 380
+al	 368
+ba	 356
+ts	 355
+_iz	 353
+ap	 350
+jas	 349
+ko	 346
+au	 345
+�an	 339
+re	 339
+ni	 337
+k�	 328
+ro	 327
+et	 326
+r�	 325
+ga	 323
+mu	 322
+jas_	 321
+tr	 317
+_va	 312
+te	 310
+_pr	 307
+sp	 298
+sk	 297
+ne	 295
+�ba	 293
+�s	 289
+ijas	 287
+_ar	 283
+la	 283
+to	 282
+ad	 280
+dz	 278
+�g	 277
+t�	 277
+�j	 277
+_sa	 277
+j�	 274
+_m	 273
+ties	 273
+l�	 272
+ijas_	 269
+_at	 269
+ed	 267
+_pi	 267
+�	 267
+s,	 265
+s,_	 265
+�r	 261
+gu	 258
+f	 258
+si	 257
+m�	 256
+nt	 254
+tu_	 254
+_r	 253
+ru	 252
+�j	 251
+jum	 251
+�s_	 250
+�t	 249
+iem	 248
+_b	 248
+_vi	 245
+par	 244
+pie	 244
+rt	 243
+v�	 242
+_ne	 240
+�r	 240
+ai_	 239
+_.	 239
+_j	 237
+us	 237
+_ka	 236
+er	 232
+bas	 232
+_tie	 232
+_par	 230
+di	 229
+�	 228
+ms	 228
+�d	 226
+�bas	 224
+om	 220
+bu	 219
+umu	 217
+iek	 216
+kt	 216
+it	 216
+r�	 215
+_ko	 214
+ana	 211
+�k	 211
+or	 210
+de	 210
+in�	 207
+d�	 204
+ur	 203
+pri	 203
+_c	 202
+ta_	 202
+bas_	 201
+es_	 201
+_pie	 200
+il	 200
+os	 199
+�ana	 199
+id	 198
+L	 198
+_ie	 197
+bi	 194
+ak	 194
+ja_	 194
+�bas_	 193
+�t	 192
+�bu	 192
+_g	 191
+�	 189
+ma_	 189
+ien	 188
+kum	 187
+�	 187
+_ir	 186
+on	 186
+_ties	 185
+z�	 185
+ce	 185
+ied	 184
+ist	 183
+ts_	 183
+_�	 183
+�_	 182
+�m	 181
+vie	 180
+_�_	 180
+cij	 180
+ka_	 179
+_ap	 175
+s�	 174
+ir_	 174
+zi	 174
+uma	 173
+�l	 172
+_ir_	 172
+o�	 171
+_da	 169
+�_	 168
+ar�	 168
+)	 167
+do	 166
+ve	 166
+(	 165
+ls	 165
+bu_	 164
+val	 164
+mu_	 164
+isk	 163
+uz	 161
+av	 160
+par_	 160
+_v�	 159
+_par_	 158
+v�r	 158
+_ar_	 157
+rie	 157
+_uz	 157
+aj	 156
+�bu_	 156
+oj	 155
+k�_	 155
+ld	 154
+iet	 154
+iku	 154
+ks	 153
+du	 153
+ep	 153
+ms_	 152
+ec	 152
+V	 151
+ais	 150
+str	 150
+nie	 149
+am_	 149
+ums	 148
+_(	 147
+ju_	 146
+z_	 142
+ru_	 142
+�j	 142
+gum	 142
+u,_	 141
+u,	 141
+i�	 141
+uma_	 141
+�rt	 141
+�gu	 141
+me	 140
+d�	 140
+�t	 140
+ent	 139
+ikum	 138
+p�	 138
+em_	 138
+_L	 138
+lie	 136
+sta	 136
+r�_	 136
+lst	 136
+eik	 135
+se	 135
+s.	 134
+pro	 134
+rs	 134
+s._	 134
+tik	 134
+l�	 134
+ska	 133
+pap	 133
+kas	 133
+rm	 133
+�ju	 133
+p�	 132
+nu	 132
+T	 132
+p�	 131
+tei	 131
+nas	 131
+_V	 131
+jo	 131
+l�g	 131
+ut	 131
+iem_	 130
+ras	 129
+pu	 129
+_li	 129
+_ga	 128
+dar	 128
+_k�	 128
+umu_	 127
+�v	 126
+�gum	 126
+kas_	 126
+t�b	 125
+vai	 125
+l�gu	 125
+P	 125
+ar�_	 125
+ev	 124
+lai	 124
+�r	 124
+l�gum	 124
+tv	 123
+a�	 123
+_ar�_	 122
+_ar�	 122
+_vie	 121
+S	 121
+_T	 120
+�ju	 120
+teik	 120
+cija	 119
+rb	 119
+_�	 119
+j�_	 119
+nas_	 118
+t�j	 118
+v�rt	 118
+iec	 118
+_la	 117
+�d	 116
+_vai	 116
+�jum	 116
+vien	 116
+als	 116
+_l�	 116
+ap�r	 115
+rts	 115
+isi	 115
+p�r	 115
+pap�	 115
+pap�r	 115
+ap�	 115
+tsp	 115
+m�	 114
+im	 114
+be	 114
+is_	 114
+alst	 114
+_ja	 114
+rtspa	 113
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/polish.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/polish.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/polish.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 31480
+a	 7945
+i	 7766
+e	 7462
+o	 6838
+z	 5104
+n	 5077
+r	 4178
+w	 4139
+s	 3596
+c	 3580
+y	 3569
+t	 3381
+d	 3027
+k	 2819
+p	 2639
+m	 2494
+ie	 2484
+u	 2016
+l	 1947
+j	 1932
+ni	 1930
+e_	 1746
+_p	 1712
+�	 1649
+a_	 1496
+o_	 1431
+,	 1368
+,_	 1366
+b	 1296
+_w	 1257
+g	 1249
+i_	 1140
+.	 1118
+_s	 1045
+ze	 1041
+._	 1035
+_n	 997
+nie	 958
+cz	 956
+rz	 952
+h	 950
+_z	 933
+�	 918
+ow	 911
+ie_	 902
+y_	 899
+na	 885
+ch	 871
+po	 864
+pr	 863
+wi	 851
+st	 847
+�	 835
+�	 832
+an	 814
+�	 800
+ra	 778
+zy	 766
+ia	 726
+za	 718
+_t	 699
+wa	 692
+ro	 692
+_d	 683
+_pr	 675
+�	 661
+w_	 658
+sz	 652
+_po	 649
+_o	 628
+m_	 613
+li	 613
+dz	 611
+ki	 611
+en	 609
+mi	 593
+ta	 571
+ci	 564
+ej	 562
+nie_	 558
+_m	 553
+_k	 549
+ar	 543
+go	 541
+_i	 540
+em	 532
+od	 525
+yc	 520
+a�	 511
+rze	 508
+do	 504
+eg	 503
+ko	 502
+ac	 482
+to	 478
+_na	 467
+_ni	 467
+h_	 466
+ch_	 466
+�	 465
+i�	 461
+_b	 458
+on	 458
+u_	 458
+zi	 454
+ka	 450
+er	 448
+sk	 447
+si	 447
+wy	 444
+te	 437
+ak	 434
+�_	 431
+_j	 429
+je	 429
+z_	 427
+ny	 422
+aw	 422
+ne	 420
+�w	 418
+_w_	 415
+_c	 414
+ego	 412
+prz	 412
+_r	 410
+al	 407
+�a	 405
+"	 405
+re	 405
+es	 401
+_nie	 396
+dzi	 394
+ty	 389
+j_	 380
+ic	 380
+_prz	 379
+ad	 367
+ej_	 364
+le	 359
+�_	 358
+ed	 354
+ych	 346
+_za	 346
+_do	 344
+zn	 344
+go_	 344
+ani	 343
+_i_	 342
+no	 339
+or	 337
+�o	 336
+tr	 334
+P	 330
+os	 329
+am	 329
+da	 328
+ec	 327
+ol	 325
+�_	 325
+by	 322
+ego_	 321
+at	 321
+�e	 319
+ym	 317
+wie	 314
+�_	 312
+-	 310
+na_	 309
+_si	 303
+W	 301
+as	 301
+wo	 300
+pa	 299
+si�	 295
+nia	 293
+owa	 292
+o�	 286
+_P	 283
+el	 282
+_si�	 279
+ja	 278
+rzy	 276
+prze	 276
+_wy	 275
+i�_	 269
+in	 267
+_-	 267
+de	 267
+kie	 267
+dn	 264
+ob	 262
+_u	 261
+ych_	 260
+-_	 258
+ez	 257
+_-_	 256
+�c	 255
+ws	 255
+�ci	 254
+em_	 253
+_si�_	 253
+si�_	 253
+_nie_	 253
+kt	 252
+ski	 252
+we	 251
+_g	 251
+_W	 250
+t_	 249
+_prze	 249
+_je	 248
+aj	 247
+_a	 247
+�e_	 246
+_�	 244
+ia_	 243
+eni	 241
+om	 240
+la	 240
+k_	 235
+mo	 235
+f	 234
+pi	 232
+is	 231
+cze	 231
+_z_	 230
+�	 228
+nt	 227
+ce	 224
+sta	 221
+ry	 220
+ma	 219
+cj	 219
+zie	 218
+ek	 216
+oc	 213
+dy	 212
+owi	 208
+sp	 208
+K	 208
+t�	 205
+_"	 204
+ud	 203
+S	 202
+ier	 202
+pra	 202
+czn	 201
+ys	 200
+nia_	 199
+j�	 198
+_�e	 196
+oz	 194
+N	 192
+zo	 191
+dzie	 190
+ku	 190
+�w_	 189
+czy	 189
+_mi	 188
+_�e_	 187
+mie	 186
+do_	 186
+iej	 185
+ym_	 185
+_do_	 184
+cy	 184
+_pa	 183
+y�	 182
+_na_	 181
+zy_	 181
+ew	 180
+_l	 180
+_cz	 178
+_by	 178
+ru	 177
+to_	 175
+�c	 175
+_wi	 175
+ln	 174
+_K	 171
+ok	 170
+ot	 170
+raw	 169
+nych	 168
+nyc	 168
+az	 168
+ik	 167
+bi	 167
+i,_	 166
+i,	 166
+_te	 165
+tu	 163
+wan	 163
+et	 162
+J	 162
+�r	 161
+cie	 160
+_od	 160
+ba	 160
+oj	 159
+o�c	 158
+i�	 158
+_ro	 158
+og	 158
+mu	 158
+A	 158
+o�ci	 158
+d_	 157
+tw	 156
+io	 155
+gr	 155
+_J	 155
+_N	 155
+_to	 155
+us	 155
+�_	 154
+a�	 154
+ach	 154
+yd	 153
+_kt	 153
+_ko	 152
+_st	 152
+pow	 151
+yt	 150
+kr	 149
+_S	 149
+a�_	 149
+ak_	 149
+li_	 148
+T	 148
+ur	 148
+sa	 148
+op	 147
+yw	 147
+ent	 147
+bo	 146
+_sp	 145
+O	 145
+a,_	 144
+a,	 144
+iem	 144
+kt�	 143
+praw	 143
+wn	 142
+t�r	 142
+i�	 141
+�y	 141
+zu	 141
+dni	 140
+im	 139
+icz	 139
+r�	 139
+�e	 138
+kt�r	 137
+my	 137
+est	 136
+awi	 135
+przy	 134
+nych_	 134
+e,_	 132
+e,	 132
+ki_	 132
+pro	 131
+_kt�	 131
+_kt�r	 131
+_przy	 130
+_ja	 129
+szy	 127
+ia�	 127
+Po	 127
+ania	 127
+M	 126
+ze_	 125
+ne_	 125
+�s	 124
+_ty	 124
+sze	 124
+a�	 124
+nn	 124
+pod	 124
+a�_	 122
+B	 122
+za_	 122
+cza	 122
+�o_	 122
+Z	 122
+_to_	 121
+iu	 120
+zc	 119
+esz	 119
+skie	 118
+i.	 118
+_ka	 117
+so	 117
+trz	 117
+o�	 116
+ieg	 116
+nik	 116
+ga	 116
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/esperanto.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/esperanto.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/esperanto.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 57050
+a	 16035
+i	 12706
+e	 12227
+o	 12102
+n	 10393
+s	 8344
+l	 7707
+r	 7492
+t	 7134
+k	 5376
+u	 4558
+j	 3946
+a_	 3875
+m	 3783
+d	 3710
+p	 3693
+la	 2840
+s_	 2769
+e_	 2751
+.	 2706
+_l	 2635
+_k	 2619
+v	 2531
+n_	 2504
+o_	 2444
+i_	 2333
+._	 2278
+on	 2238
+,	 2193
+,_	 2182
+_la	 2100
+en	 2080
+j_	 2050
+as	 2028
+la_	 2012
+ta	 1956
+_la_	 1907
+an	 1882
+_p	 1850
+g	 1831
+_e	 1791
+_d	 1778
+is	 1737
+aj	 1658
+st	 1635
+_s	 1575
+c	 1526
+de	 1517
+oj	 1498
+er	 1476
+ti	 1456
+f	 1443
+_a	 1442
+b	 1427
+ro	 1379
+_m	 1351
+ra	 1341
+nt	 1293
+ka	 1270
+ri	 1258
+al	 1249
+as_	 1248
+aj_	 1213
+to	 1209
+_de	 1203
+_t	 1200
+te	 1179
+_n	 1176
+is_	 1171
+in	 1151
+ko	 1145
+or	 1114
+es	 1083
+re	 1034
+ia	 1029
+li	 1022
+de_	 1016
+_de_	 979
+ar	 974
+_v	 966
+vi	 942
+lo	 932
+x	 928
+io	 917
+ne	 855
+no	 848
+ni	 843
+mi	 835
+ma	 819
+_ka	 816
+el	 815
+pr	 771
+z	 744
+un	 734
+l_	 732
+po	 730
+_f	 725
+�	 724
+est	 691
+na	 687
+ki	 679
+kaj	 676
+si	 665
+u_	 663
+kaj_	 660
+"	 654
+tas	 651
+le	 650
+oj_	 648
+_i	 643
+tr	 642
+_pr	 630
+_es	 628
+jn	 626
+pe	 618
+_kaj	 616
+ig	 616
+_kaj_	 611
+do	 608
+sta	 606
+on_	 602
+ek	 602
+ci	 597
+r_	 595
+�	 594
+_r	 593
+il	 592
+_est	 587
+di	 586
+am	 586
+_mi	 582
+a�	 578
+_vi	 577
+mo	 575
+ant	 565
+_ne	 562
+en_	 561
+o.	 559
+�	 543
+iu	 538
+o,	 529
+ur	 527
+o._	 527
+om	 525
+o,_	 524
+at	 521
+va	 521
+-	 519
+_en	 518
+:	 513
+:_	 512
+_ti	 500
+M	 496
+h	 488
+nd	 484
+me	 484
+_al	 481
+_ko	 479
+ve	 478
+ie	 478
+_ki	 473
+it	 473
+L	 466
+_b	 465
+se	 462
+em	 452
+ol	 450
+nta	 449
+tu	 448
+ik	 444
+ov	 443
+da	 443
+_M	 440
+_po	 439
+tas_	 438
+ne_	 437
+et	 437
+_ma	 436
+_en_	 435
+su	 429
+pl	 426
+_L	 425
+pa	 420
+_o	 417
+vo	 408
+an_	 407
+ro_	 406
+sti	 406
+nu	 399
+kon	 396
+stas	 391
+m_	 391
+ir	 388
+n.	 386
+fa	 386
+jn_	 382
+ku	 382
+os	 376
+ke	 375
+n,	 375
+esta	 374
+n,_	 372
+_su	 362
+ta_	 362
+stas_	 359
+xi	 359
+Mi	 358
+_ne_	 356
+al_	 355
+nk	 353
+so	 353
+n._	 352
+id	 349
+_g	 348
+estas	 347
+ga	 346
+_h	 345
+per	 345
+_Mi	 340
+ok	 339
+K	 339
+mp	 337
+_esta	 337
+s,_	 335
+s,	 335
+_se	 333
+anta	 332
+ul	 326
+ran	 325
+_"	 323
+�_	 322
+te_	 320
+ak	 320
+a�_	 320
+ed	 320
+rt	 319
+ojn	 318
+gi	 318
+_�	 317
+tis	 316
+gx	 316
+mal	 316
+ia_	 315
+ks	 310
+_al_	 310
+mi_	 309
+S	 309
+lu	 309
+ns	 308
+kt	 305
+io_	 302
+ent	 300
+?	 300
+_K	 300
+ec	 300
+el_	 299
+_-	 299
+li_	 299
+E	 298
+�	 298
+_li	 297
+fo	 296
+ter	 296
+_re	 296
+A	 295
+nto	 294
+vi_	 292
+La	 292
+_mal	 290
+nte	 288
+sp	 287
+sa	 287
+_mi_	 279
+ut	 278
+op	 278
+_ke	 277
+bo	 277
+ajn	 276
+un_	 276
+T	 274
+to_	 272
+-_	 272
+bl	 272
+_an	 271
+_La	 271
+�i	 269
+_S	 268
+_pl	 267
+_fa	 266
+ni_	 266
+La_	 265
+_E	 264
+N	 263
+tis_	 263
+_tr	 263
+'	 262
+!	 262
+_-_	 262
+pro	 261
+iu_	 261
+i�	 261
+nc	 260
+_si	 259
+du	 257
+_kon	 256
+ru	 255
+_vi_	 254
+_j	 253
+ce	 251
+ke_	 249
+ap	 248
+us	 247
+be	 247
+im	 247
+B	 246
+_ku	 246
+_La_	 246
+tra	 245
+ad	 245
+uj	 245
+ac	 245
+ita	 243
+pre	 242
+_pro	 242
+co	 241
+rm	 241
+_ni	 238
+_pe	 236
+?_	 234
+on.	 234
+toj	 234
+"_	 234
+j.	 234
+_ke_	 233
+s.	 232
+_A	 231
+av	 230
+ri_	 230
+_el	 229
+por	 229
+`	 224
+ev	 224
+las	 223
+P	 223
+j._	 221
+eni	 220
+_T	 220
+_B	 219
+j,_	 218
+j,	 218
+era	 217
+_in	 216
+on._	 216
+cx	 216
+_N	 215
+ion	 215
+ab	 215
+..	 214
+)	 213
+fi	 213
+or_	 212
+pri	 212
+s._	 212
+_por	 210
+ez	 210
+in_	 210
+am_	 209
+on,_	 209
+ll	 209
+�i	 209
+on,	 209
+_ve	 208
+ris	 208
+esti	 208
+!_	 207
+men	 206
+vas	 205
+iel	 204
+taj	 203
+_c	 201
+aro	 201
+ank	 200
+_pri	 200
+jo	 200
+ja	 200
+ont	 200
+lt	 199
+_P	 199
+igi	 199
+_pa	 197
+oj.	 197
+(	 196
+au	 195
+oro	 195
+ng	 195
+_(	 194
+sto	 194
+ast	 194
+ag	 193
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/persian.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/persian.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/persian.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 12318
+?	 5938
+�	 2613
+?_	 1815
+�	 1745
+�	 1569
+�	 1546
+�	 1422
+-	 1333
+�	 1155
+�	 991
+�	 841
+_�	 778
+�	 761
+�	 693
+�	 664
+_�	 663
+�	 660
+�?	 631
+�_	 624
+_?	 601
+?�	 598
+�	 589
+_�	 565
+??	 564
+�	 513
+�_	 486
+_�	 473
+_�	 469
+�?	 459
+�	 428
+�_	 427
+_�	 398
+�_	 392
+�	 390
+�	 384
+�?	 379
+�?	 361
+_�	 337
+_-	 334
+>	 327
+�	 324
+_�?	 319
+�?	 313
+_�_	 308
+�	 305
+��	 303
+�_	 297
+?�	 290
+�?	 285
+��	 272
+-_	 271
+S	 266
+_�?	 265
+�	 259
+-�	 255
+�	 255
+??_	 255
+�?	 254
+�?	 250
+Y	 246
+��_	 245
+�	 243
+_�?	 238
+?�	 234
+_�	 229
+�	 229
+_S	 228
+��	 216
+��	 215
+?�	 215
+?�	 214
+_��	 214
+�	 208
+�?_	 207
+��	 203
+?-	 202
+_�	 199
+�?_	 199
+��	 195
+�_	 190
+�?_	 190
+_??	 189
+�?	 188
+.	 188
+_��_	 185
+_�	 183
+?�	 181
+_��	 180
+�?	 177
+*	 176
+�_	 176
+_�?_	 174
+?�	 173
+��	 172
+�_	 170
+��	 164
+�	 161
+�	 158
+-�?	 156
+�_	 155
+�?_	 155
+_�?	 152
+��	 151
+��	 150
+_�?	 146
+�?_	 144
+��	 143
+��	 141
+?�_	 140
+*_	 138
+��	 137
+?�	 136
+�	 133
+��	 132
+_��	 131
+-�	 131
+�?	 130
+?�	 129
+_.	 129
+��	 129
+�_	 128
+��	 124
+��	 121
+�-	 120
+��_	 120
+_��	 120
+_??_	 119
+�?	 119
+-�?_	 119
+�	 118
+-?	 118
+>_	 116
+��?	 114
+�_	 111
+��	 109
+_�?_	 109
+_��	 109
+_��_	 108
+_��?	 107
+�?�	 107
+�	 106
+_��	 106
+.�	 104
+?�	 103
+_?�	 103
+��	 103
+�?	 103
+��	 103
+�?	 102
+��	 100
+?�	 100
+?�?	 98
+�_	 98
+�?�	 96
+��	 95
+��?_	 95
+_�	 94
+�	 94
+Y_	 94
+_�?�	 93
+_�?�	 93
+��	 92
+��	 91
+_�?	 91
+_��?_	 91
+?�_	 90
+�?_	 90
+��	 90
+�?_	 90
+�-	 90
+��	 89
+:	 89
+��_	 88
+��?	 88
+��	 88
+_��	 87
+-�	 86
+��	 85
+_��	 83
+,	 82
+��_	 82
+��	 82
+?�_	 80
+�	 80
+?��	 79
+_��?	 79
+��	 77
+???	 77
+��	 76
+_-?	 75
+��	 75
+?�	 75
+?�	 75
+��	 74
+_��	 73
+�_	 73
+���	 73
+�?	 73
+���	 72
+����	 71
+��	 71
+?>	 71
+�?	 70
+_?�_	 70
+_.�	 70
+��	 69
+�	 69
+_�	 68
+���	 68
+����_	 67
+_�-	 67
+���	 67
+���_	 67
+��	 67
+��_	 67
+��	 67
+��_	 66
+?-_	 65
+��	 65
+�?�	 65
+���	 64
+��?	 64
+�_	 64
+?�	 63
+?-�	 63
+�-	 63
+_�?�	 62
+�?_	 62
+��_	 62
+_-�	 61
+��	 61
+�����	 60
+����	 60
+���	 60
+?�	 60
+���	 60
+_��	 60
+����	 60
+_���	 60
+-�?	 60
+�_	 60
+��	 60
+��?	 60
+��	 59
+�����	 59
+�?	 59
+_�?	 59
+����	 59
+��_	 59
+�??	 58
+�?�	 58
+_��	 58
+.-	 58
+?�	 58
+��	 57
+�	 57
+���	 57
+?�?_	 57
+�?�	 57
+�-	 57
+��_	 56
+�?�	 56
+��_	 56
+?��?	 56
+�?	 56
+�	 56
+�?�	 56
+��_	 55
+�?	 55
+�?�	 55
+_����	 55
+-�?�	 55
+�_	 55
+�?��	 55
+��_	 55
+S�	 55
+��	 54
+_S�	 53
+���_	 53
+_��	 53
+�	 53
+��	 53
+����_	 53
+��_	 52
+��?	 52
+��	 52
+��?	 52
+�>	 52
+-�	 52
+��?	 52
+��	 52
+�?	 52
+_�	 52
+�?	 52
+��	 52
+??�	 52
+��	 51
+��	 51
+-�	 51
+_��?	 51
+�?	 50
+_��	 50
+���_	 50
+.-�	 50
+�?�	 50
+�	 50
+_�?	 50
+��	 50
+_�?�	 49
+.��	 49
+��	 49
+�?�?	 49
+�-	 48
+_��	 48
+_�?��	 48
+��?_	 48
+�_	 48
+��	 48
+�?_	 48
+��_	 47
+�	 47
+�	 47
+.-�?	 47
+_��	 47
+>�	 47
+��	 47
+�?�	 47
+�	 47
+?��?_	 47
+?��	 47
+��	 46
+_.-	 46
+_�?�?	 46
+��	 46
+��	 46
+-�	 46
+_��	 46
+��	 46
+��	 45
+��	 45
+_��	 45
+�?-	 45
+��	 45
+_�	 45
+f	 45
+�-	 44
+_�-	 44
+��	 44
+_��?	 44
+�-�	 44
+-�	 44
+�	 44
+�?��?	 44
+��	 44
+.-�?_	 44
+��_	 44
+��	 44
+_-�?	 44
+�?�	 43
+�?	 43
+�	 43
+?�_	 43
+_����	 43
+��	 43
+?�	 43
+?�_	 43
+_���	 43
+�_	 43
+��	 43
+�??	 42
+Y?	 42
+�_	 42
+��	 42
+��	 42
+_��	 42
+��?	 42
+��	 42
+/	 42
+_�	 42
+???_	 42
+_���	 42
+_��	 42
+s	 42
+���	 42
+�?-�	 41
+��	 41
+��?	 41
+?*	 41
+S��	 41
+_�?�	 41
+��	 41
+_.-�	 41
+��	 41
+��	 41
+��	 41
+S��	 41
+��	 41
+�?�?_	 40
+���	 40
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/portuguese.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/portuguese.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/portuguese.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 35328
+a	 10423
+e	 10132
+o	 8919
+s	 6795
+r	 6033
+i	 5443
+n	 4588
+d	 4531
+t	 4217
+m	 3476
+u	 3404
+o_	 3240
+a_	 3029
+e_	 2879
+c	 2756
+s_	 2461
+_d	 2379
+l	 2307
+p	 2242
+_a	 1753
+de	 1751
+,	 1660
+,_	 1658
+_e	 1454
+es	 1447
+os	 1412
+ra	 1343
+_p	 1328
+nt	 1302
+_de	 1248
+do	 1215
+en	 1176
+re	 1150
+as	 1123
+v	 1115
+m_	 1113
+de_	 1096
+er	 1082
+g	 1053
+_c	 1047
+da	 1008
+co	 986
+os_	 975
+te	 974
+ar	 950
+or	 943
+q	 938
+qu	 938
+_s	 908
+ta	 902
+_de_	 901
+_o	 858
+se	 841
+ue	 831
+to	 799
+ad	 777
+.	 761
+que	 752
+em	 751
+an	 748
+f	 746
+r_	 745
+b	 732
+st	 718
+is	 716
+al	 712
+_qu	 706
+_q	 706
+in	 701
+as_	 696
+�	 695
+do_	 685
+ent	 678
+�o	 677
+_n	 671
+_co	 660
+_a_	 654
+_m	 646
+on	 645
+�	 624
+ri	 623
+_que	 619
+ma	 602
+po	 581
+ia	 580
+�o_	 575
+._	 573
+na	 572
+me	 564
+ro	 554
+_t	 544
+pa	 533
+da_	 528
+h	 523
+ue_	 515
+ca	 511
+que_	 509
+nte	 503
+no	 499
+tr	 498
+am	 496
+em_	 491
+_que_	 487
+_se	 485
+om	 471
+io	 460
+_do	 459
+ti	 448
+ci	 445
+_da	 444
+nd	 442
+ei	 435
+ra_	 435
+pr	 427
+_r	 423
+_e_	 420
+_f	 420
+ss	 412
+es_	 412
+el	 407
+id	 406
+_o_	 399
+_pa	 390
+um	 379
+pe	 378
+_po	 376
+la	 374
+ir	 371
+�	 371
+ic	 362
+di	 362
+li	 359
+�	 359
+_re	 353
+ve	 353
+mo	 350
+s,	 349
+s,_	 349
+ou	 347
+com	 340
+sa	 338
+si	 338
+men	 337
+rt	 331
+_i	 330
+con	 330
+o,	 327
+_da_	 326
+o,_	 326
+se_	 325
+_com	 325
+ado	 323
+to_	 322
+ai	 322
+it	 320
+A	 319
+ec	 316
+dos	 316
+_em	 312
+��o	 310
+a�	 310
+��	 310
+ara	 305
+so	 299
+tu	 299
+res	 297
+im	 296
+_pr	 295
+mi	 293
+ua	 292
+nto	 291
+ment	 290
+�	 290
+par	 288
+_do_	 287
+ce	 286
+est	 286
+u_	 284
+ente	 284
+S	 278
+l_	 278
+_u	 278
+"	 276
+ni	 276
+z	 274
+sta	 273
+nc	 272
+_em_	 270
+P	 269
+��o_	 267
+_v	 267
+at	 267
+dos_	 266
+_es	 262
+�	 259
+_�	 259
+te_	 258
+�	 257
+va	 255
+le	 252
+ur	 252
+_um	 252
+vi	 251
+_par	 250
+a,	 247
+a,_	 247
+_con	 247
+ant	 242
+lo	 240
+ia_	 240
+gu	 237
+ar_	 235
+ac	 235
+e,_	 234
+e,	 234
+no_	 232
+eg	 232
+il	 232
+ns	 232
+er_	 231
+_ma	 230
+por	 230
+_in	 228
+_l	 226
+�	 225
+ont	 224
+_no	 223
+_P	 222
+tra	 220
+E	 219
+ida	 218
+is_	 217
+ol	 216
+a��	 215
+ter	 215
+a��o	 215
+_A	 211
+un	 211
+-	 210
+_te	 210
+or_	 209
+ma_	 208
+_pe	 208
+ara_	 208
+C	 206
+ist	 202
+para	 202
+nta	 201
+ais	 201
+ut	 198
+nte_	 198
+j	 197
+dad	 196
+_na	 195
+am_	 195
+ade	 193
+ica	 191
+x	 190
+al_	 189
+O	 188
+des	 187
+_para	 187
+ada	 187
+nh	 186
+_se_	 186
+mp	 185
+ndo	 184
+R	 183
+_por	 181
+a��o_	 181
+para_	 179
+eir	 177
+ui	 177
+vo	 177
+ou_	 177
+ta_	 177
+M	 176
+ria	 175
+tos	 175
+rr	 174
+D	 174
+io_	 174
+br	 174
+_di	 173
+�	 173
+�e	 173
+fo	 173
+I	 172
+�es	 172
+_C	 171
+mo_	 171
+ov	 170
+pro	 169
+_os_	 169
+_os	 169
+das	 167
+iv	 166
+uma	 165
+gr	 165
+su	 164
+fi	 164
+um_	 162
+na_	 162
+ga	 162
+ais_	 161
+_S	 161
+lh	 159
+ort	 159
+cia	 158
+..	 157
+_est	 156
+cont	 156
+ig	 155
+�_	 154
+ran	 154
+�a	 154
+om_	 153
+_en	 152
+dade	 152
+_as	 152
+ho	 152
+ntr	 151
+nto_	 151
+fe	 150
+N	 149
+das_	 149
+uma_	 149
+ess	 149
+�_	 148
+ndo_	 147
+ob	 147
+�_	 147
+ul	 146
+ente_	 146
+go	 146
+ento	 144
+ver	 144
+_des	 144
+gi	 144
+ha	 142
+cu	 142
+idad	 142
+av	 141
+�es_	 141
+_pro	 141
+ura	 141
+ap	 139
+_com_	 139
+_ca	 139
+com_	 139
+ao	 139
+ne	 138
+od	 138
+_"	 137
+_M	 137
+pre	 137
+ras	 136
+_me	 136
+_ao	 136
+_no_	 134
+oc	 134
+str	 133
+tes	 133
+_b	 133
+and	 133
+_g	 133
+ro_	 133
+omo	 133
+_dos	 132
+_fo	 132
+_dos_	 132
+rn	 132
+mento	 131
+ito	 131
+ev	 131
+rio	 130
+ass	 130
+eu	 130
+be	 128
+os,	 128
+os,_	 128
+sp	 127
+_uma	 127
+ep	 126
+tad	 125
+s.	 125
+_uma_	 125
+_E	 125
+idade	 124
+_um_	 124
+n�	 124
+n�o	 124
+ct	 123
+ram	 123
+ado_	 123
+ela	 123
+omo_	 121
+iz	 121
+_an	 121
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/slovenian-iso8859_2.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/slovenian-iso8859_2.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/slovenian-iso8859_2.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 10406
+a	 2828
+e	 2676
+i	 2458
+o	 2418
+n	 1814
+r	 1484
+v	 1253
+l	 1248
+s	 1228
+t	 1172
+j	 1107
+d	 1085
+k	 911
+p	 880
+a_	 823
+m	 763
+i_	 681
+e_	 678
+_p	 603
+o_	 566
+u	 521
+z	 516
+b	 456
+_s	 435
+je	 434
+,	 416
+,_	 411
+ni	 399
+�	 383
+_v	 372
+_d	 356
+pr	 355
+g	 345
+ra	 336
+_n	 332
+st	 323
+an	 313
+po	 303
+re	 301
+na	 295
+h	 287
+ov	 276
+_pr	 276
+li	 275
+al	 274
+_z	 270
+je_	 259
+la	 255
+�	 253
+ne	 248
+en	 246
+ko	 244
+in	 237
+c	 234
+ti	 234
+v_	 234
+_po	 232
+no	 230
+ve	 230
+_k	 227
+_i	 224
+da	 224
+.	 221
+_j	 221
+ri	 220
+ja	 216
+_t	 214
+se	 213
+ed	 212
+._	 211
+em	 206
+te	 205
+za	 201
+od	 201
+av	 200
+lo	 196
+nj	 194
+_o	 194
+_je	 193
+il	 190
+or	 183
+ka	 181
+sk	 179
+_b	 178
+_je_	 178
+ih	 178
+n_	 177
+_za	 173
+h_	 171
+er	 171
+os	 171
+_na	 168
+va	 168
+ta	 164
+le	 163
+m_	 161
+ev	 157
+ij	 157
+ar	 157
+do	 155
+to	 155
+�	 154
+A	 153
+el	 150
+_m	 148
+ro	 147
+ol	 146
+_v_	 145
+aj	 145
+di	 143
+N	 142
+S	 142
+at	 140
+ih_	 139
+ki	 138
+de	 137
+_in	 135
+vo	 135
+ga	 134
+me	 131
+in_	 129
+vi	 129
+om	 127
+_in_	 125
+et	 124
+pre	 124
+O	 123
+bi	 120
+I	 119
+da_	 117
+ik	 117
+ma	 115
+E	 114
+so	 113
+bo	 112
+it	 112
+anj	 112
+eg	 110
+ni_	 109
+mi	 108
+ke	 108
+na_	 108
+u_	 108
+lj	 106
+iz	 105
+ob	 105
+_da	 103
+li_	 103
+is	 103
+im	 102
+red	 102
+_pre	 102
+dr	 100
+mo	 99
+P	 99
+_se	 99
+ji	 98
+r_	 97
+ad	 97
+pri	 97
+K	 97
+_l	 97
+tr	 95
+pa	 94
+no_	 94
+j_	 92
+ki_	 91
+ti_	 91
+_pri	 91
+dn	 89
+_P	 88
+ej	 88
+_da_	 87
+ne_	 86
+ega	 86
+_r	 86
+_bi	 86
+l_	 86
+em_	 86
+go	 86
+"	 85
+sl	 85
+ek	 84
+ali	 84
+ove	 84
+a�	 84
+ak	 84
+ci	 83
+ga_	 83
+ko_	 83
+se_	 82
+_S	 82
+jo	 81
+ot	 81
+ja_	 81
+_so	 80
+lov	 80
+L	 80
+D	 79
+V	 79
+as	 78
+_do	 78
+am	 78
+nje	 77
+es	 77
+za_	 77
+_pa	 76
+T	 75
+tu	 75
+_za_	 74
+sti	 74
+_dr	 74
+la_	 74
+_N	 74
+_de	 74
+ega_	 73
+_ko	 73
+og	 73
+ns	 72
+�e	 72
+ds	 72
+_bo	 71
+ora	 71
+vn	 71
+ost	 71
+_ne	 71
+i�	 70
+ven	 69
+z_	 69
+�i	 69
+_te	 68
+ce	 68
+_se_	 67
+�a	 67
+o�	 67
+M	 66
+_u	 66
+un	 65
+ln	 65
+pos	 64
+ju	 64
+sta	 64
+op	 64
+di_	 63
+ud	 63
+vs	 63
+t_	 62
+nsk	 62
+tv	 62
+on	 62
+ski	 62
+R	 62
+pa_	 62
+_ka	 62
+i,	 61
+so_	 61
+_iz	 60
+_pa_	 60
+s_	 60
+i,_	 60
+pro	 59
+del	 59
+rav	 59
+eni	 59
+oli	 58
+rj	 58
+e,	 57
+�e	 57
+ili	 57
+vr	 57
+d_	 57
+_le	 57
+pred	 57
+jo_	 56
+e,_	 56
+nik	 56
+love	 56
+_pred	 56
+ske	 56
+er_	 55
+str	 55
+�n	 54
+pra	 54
+J	 54
+_�	 54
+oven	 53
+_ra	 53
+tn	 53
+_na_	 53
+_so_	 53
+nih	 53
+loven	 53
+si	 52
+ke_	 52
+_g	 52
+ic	 52
+udi	 51
+bi_	 51
+eds	 51
+oj	 51
+ru	 51
+a,	 51
+_pro	 50
+_pos	 50
+nc	 50
+nih_	 50
+�u	 50
+a,_	 50
+_a	 50
+az	 50
+ok	 50
+B	 50
+let	 49
+udi_	 49
+_od	 49
+_K	 49
+aj_	 48
+_bi_	 48
+_ve	 48
+ra�	 48
+o,	 47
+_tu	 47
+ija	 47
+ter	 47
+ist	 47
+Z	 47
+reds	 46
+nd	 46
+ali_	 46
+A_	 46
+iti	 46
+bil	 46
+_ob	 46
+o,_	 46
+ati	 46
+tud	 45
+tudi	 45
+_ki	 45
+k_	 45
+be	 45
+a�	 45
+ir	 45
+�a	 45
+do_	 45
+sp	 45
+_ki_	 45
+_st	 45
+ep	 44
+_del	 44
+tudi_	 44
+r�	 44
+a�u	 44
+_ni	 44
+ah	 43
+ra�u	 43
+ra�un	 43
+i�	 43
+_mo	 43
+avn	 43
+_tud	 43
+�un	 43
+a�un	 43
+_tudi	 43
+_to	 42
+raz	 42
+kr	 42
+ova	 42
+_e	 42
+ogo	 42
+ani	 42
+_"	 42
+ev_	 42
+br	 42
+eb	 42
+sa	 42
+mi_	 42
+tem	 42
+ta_	 41
+prav	 41
+i.	 41
+slov	 41
+ens	 41
+bo_	 41
+�e	 41
+_T	 41
+_let	 41
+odo	 41
+slo	 41
+ensk	 40
+ka_	 40
+neg	 40
+ez	 40
+nos	 40
+e�	 40
+_sl	 40
+_V	 40
+r�a	 40
+nega	 40
+ili_	 39
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/spanish.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/spanish.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/spanish.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 25044
+e	 7830
+a	 7437
+o	 5102
+s	 4394
+n	 4358
+i	 4065
+r	 3998
+l	 3634
+d	 3118
+c	 2931
+t	 2834
+u	 2316
+a_	 2269
+e_	 2211
+s_	 1862
+de	 1679
+p	 1673
+_d	 1644
+m	 1447
+_de	 1443
+n_	 1332
+o_	 1301
+en	 1295
+_e	 1216
+es	 1177
+_l	 1132
+de_	 1080
+la	 1060
+os	 1028
+_de_	 1027
+_p	 963
+l_	 910
+ci	 890
+_c	 866
+_a	 866
+os_	 801
+ar	 777
+er	 775
+as	 768
+ra	 746
+nt	 736
+_la	 727
+re	 726
+,_	 724
+,	 724
+el	 722
+ta	 708
+ue	 701
+g	 678
+on	 674
+al	 670
+_s	 666
+co	 653
+b	 637
+an	 622
+v	 616
+la_	 616
+or	 612
+te	 599
+st	 596
+el_	 580
+_la_	 573
+y	 545
+to	 543
+r_	 517
+ad	 512
+�	 511
+do	 504
+ro	 504
+se	 488
+as_	 488
+q	 487
+qu	 487
+.	 479
+._	 478
+en_	 475
+ca	 460
+in	 459
+un	 456
+_co	 450
+es_	 449
+ic	 449
+_en	 440
+ac	 440
+que	 439
+na	 439
+lo	 430
+_m	 430
+f	 429
+ent	 428
+da	 412
+ue_	 411
+po	 405
+le	 399
+_q	 399
+_qu	 399
+que_	 393
+_que	 388
+ie	 386
+h	 385
+pa	 382
+y_	 371
+ti	 367
+_que_	 365
+_en_	 365
+_y	 361
+tr	 358
+_el	 353
+ri	 349
+ia	 342
+_el_	 333
+_se	 330
+i�	 330
+_y_	 330
+io	 329
+pr	 320
+�n	 317
+ec	 317
+no	 314
+id	 301
+�	 300
+mi	 299
+_t	 299
+i�n	 292
+nte	 292
+me	 286
+aci	 283
+do_	 279
+li	 276
+con	 276
+nd	 273
+est	 272
+ni	 272
+�	 271
+di	 270
+_es	 268
+_lo	 267
+ci�	 265
+ma	 265
+�n_	 264
+_pr	 263
+_r	 261
+ci�n	 255
+z	 254
+ra_	 251
+si	 247
+i�n_	 246
+oc	 245
+nc	 244
+_u	 244
+_po	 243
+los	 243
+or_	 242
+_con	 241
+is	 239
+del	 238
+_del	 237
+ado	 236
+se_	 233
+_i	 233
+los_	 231
+_re	 231
+por	 229
+_del_	 228
+sta	 228
+del_	 228
+al_	 228
+ne	 226
+_h	 226
+cu	 225
+_n	 225
+_a_	 224
+_v	 224
+_un	 223
+ce	 222
+so	 220
+ci�n_	 218
+res	 218
+vi	 217
+om	 216
+te_	 212
+_pa	 211
+ien	 210
+j	 209
+E	 208
+_los	 207
+_los_	 207
+to_	 206
+ol	 204
+it	 203
+am	 202
+aci�	 201
+rt	 201
+aci�n	 201
+pe	 197
+ha	 190
+_se_	 189
+nto	 188
+_o	 184
+_E	 184
+on_	 184
+sa	 183
+na_	 182
+ta_	 181
+su	 180
+cia	 180
+mo	 180
+ct	 178
+par	 178
+_f	 177
+_por	 176
+eg	 172
+_in	 172
+ur	 170
+L	 168
+ve	 166
+im	 164
+ga	 163
+_est	 161
+ar_	 161
+ab	 160
+_L	 159
+tu	 158
+at	 158
+no_	 157
+s,	 157
+s,_	 157
+_por_	 156
+por_	 156
+las	 156
+ba	 154
+o,_	 154
+o,	 154
+ento	 151
+et	 150
+C	 150
+_ha	 149
+A	 149
+tra	 148
+ient	 148
+_al	 147
+a,_	 146
+ica	 146
+a,	 146
+pro	 146
+ado_	 145
+ici	 144
+_ca	 144
+an_	 144
+las_	 143
+ara	 143
+nci	 143
+ente	 142
+�	 142
+rr	 142
+ir	 142
+da_	 141
+em	 141
+ll	 140
+il	 139
+�a	 138
+iv	 138
+_su	 138
+_par	 136
+ul	 136
+ant	 136
+_A	 135
+mp	 135
+_las_	 134
+_las	 134
+_C	 134
+_pro	 133
+men	 132
+P	 132
+des	 131
+com	 130
+ion	 130
+era	 130
+ed	 129
+ida	 129
+sp	 128
+gu	 127
+nte_	 127
+ns	 127
+za	 126
+dos	 125
+M	 125
+cio	 125
+les	 125
+_P	 124
+bl	 124
+_com	 122
+s._	 122
+s.	 122
+_M	 121
+ua	 120
+nta	 120
+mu	 119
+_no	 118
+dad	 118
+�	 117
+�	 116
+un_	 116
+va	 116
+ist	 116
+nes	 116
+iento	 115
+one	 114
+ara_	 113
+S	 113
+ada	 113
+_un_	 113
+fi	 111
+pre	 110
+tos	 110
+ter	 109
+ot	 109
+esta	 108
+_me	 107
+ido	 107
+ob	 107
+_g	 105
+br	 105
+go	 105
+ea	 104
+nto_	 104
+ona	 103
+pu	 103
+dos_	 103
+tro	 103
+ier	 103
+para	 102
+ment	 101
+ag	 101
+ero	 101
+gr	 101
+rec	 101
+bi	 101
+ia_	 100
+una	 100
+nic	 99
+ncia	 99
+�a_	 98
+a._	 98
+tos_	 98
+a.	 98
+ran	 98
+lo_	 97
+ones	 97
+rm	 96
+lu	 96
+ron	 95
+con_	 95
+�_	 95
+nes_	 95
+_ci	 95
+ante	 94
+ch	 94
+_con_	 94
+_para	 94
+ntr	 93
+una_	 93
+para_	 93
+mie	 92
+ico	 92
+fe	 92
+les_	 92
+uc	 92
+ip	 91
+sto	 91
+_ma	 91
+ui	 91
+sta_	 91
+_ve	 90
+cion	 90
+"	 90
+op	 90
+cal	 89
+_mu	 89
+_S	 89
+ro_	 89
+_pe	 88
+ste	 88
+ras	 88
+pl	 88
+_una	 88
+_di	 87
+ento_	 86
+ita	 86
+ione	 85
+ect	 85
+_una_	 85
+mien	 85
+tan	 85
+du	 84
+den	 84
+ndo	 84
+per	 84
+eri	 84
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/swedish.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/swedish.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/swedish.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 33494
+e	 8992
+n	 7900
+t	 7859
+a	 7781
+r	 7251
+s	 6435
+i	 5649
+l	 4541
+d	 4079
+o	 3724
+m	 3203
+k	 3058
+g	 2478
+en	 2403
+n_	 2389
+t_	 2073
+de	 1939
+r_	 1910
+v	 1890
+h	 1789
+u	 1782
+_s	 1768
+�	 1724
+er	 1709
+f	 1597
+en_	 1537
+a_	 1526
+an	 1357
+p	 1320
+et	 1317
+�	 1278
+�	 1261
+st	 1236
+ar	 1226
+c	 1191
+_d	 1158
+e_	 1116
+in	 1045
+_f	 1027
+te	 1000
+b	 997
+_a	 978
+s_	 974
+ra	 958
+.	 956
+tt	 935
+_i	 898
+_m	 890
+._	 886
+ll	 870
+ta	 844
+_o	 842
+_e	 839
+nd	 820
+ti	 804
+sk	 798
+re	 779
+at	 769
+_de	 754
+om	 743
+m_	 739
+�r	 720
+,	 697
+,_	 695
+ng	 686
+li	 673
+ka	 666
+oc	 662
+_h	 654
+on	 652
+et_	 647
+ch	 645
+ns	 643
+is	 642
+er_	 630
+�r	 625
+_v	 614
+_t	 614
+ni	 611
+i_	 609
+_oc	 592
+tt_	 587
+na	 586
+y	 586
+la	 579
+_b	 579
+h_	 577
+kt	 575
+ch_	 568
+ig	 564
+f�	 563
+och	 555
+or	 555
+_och	 554
+och_	 554
+_och_	 553
+me	 548
+den	 548
+om_	 535
+_i_	 531
+d_	 530
+j	 529
+ik	 520
+de_	 520
+f�r	 518
+ge	 498
+ad	 497
+_k	 491
+_f�	 487
+ri	 484
+el	 482
+il	 481
+so	 480
+al	 474
+g_	 469
+le	 464
+an_	 461
+_f�r	 447
+si	 437
+ar_	 437
+att	 435
+_p	 434
+es	 420
+ing	 413
+se	 407
+to	 404
+_u	 403
+_en	 403
+and	 398
+den_	 395
+nde	 393
+nn	 393
+_l	 391
+�_	 391
+D	 385
+�n	 383
+nt	 382
+l_	 381
+tr	 378
+_D	 372
+va	 370
+am	 369
+sa	 367
+_so	 365
+ga	 364
+_en_	 361
+�r_	 358
+ck	 357
+av	 354
+v_	 351
+ed	 347
+ma	 346
+da	 346
+som	 346
+rs	 344
+som_	 344
+ve	 342
+ter	 341
+att_	 341
+ha	 338
+ne	 337
+ut	 335
+as	 332
+ska	 329
+_at	 327
+_att	 326
+_som	 324
+_att_	 324
+_som_	 323
+vi	 322
+ikt	 317
+_av	 316
+det	 316
+_den	 315
+he	 315
+ss	 314
+un	 307
+ke	 304
+_g	 303
+us	 302
+di	 302
+_st	 300
+rn	 297
+_me	 296
+_�	 295
+ade	 294
+"	 290
+_ha	 290
+av_	 289
+ill	 288
+_n	 286
+_in	 279
+io	 275
+_r	 275
+der	 275
+it	 274
+_av_	 274
+sta	 274
+gen	 272
+isk	 270
+_ti	 269
+id	 265
+na_	 265
+ns_	 264
+ko	 262
+_den_	 261
+ag	 258
+det_	 257
+lig	 257
+era	 256
+ll_	 255
+_det	 252
+_�r	 251
+be	 249
+_�r_	 248
+ra_	 247
+ion	 244
+-	 241
+pr	 240
+oni	 233
+til	 231
+ten	 228
+_si	 225
+k_	 222
+p�	 222
+fr	 221
+ro	 219
+till	 219
+iv	 216
+ls	 216
+ande	 215
+�r_	 214
+_det_	 213
+�l	 212
+_p�	 211
+ts	 210
+ens	 209
+med	 209
+mm	 208
+rt	 208
+_till	 208
+_til	 208
+_va	 207
+_fr	 205
+_sk	 205
+var	 205
+nin	 204
+ning	 203
+ol	 201
+ka_	 200
+lle	 198
+ett	 198
+rd	 197
+em	 196
+p�_	 195
+x	 195
+rk	 194
+_ut	 194
+ste	 194
+ds	 193
+_vi	 192
+�r	 192
+S	 192
+nde_	 191
+are	 191
+ver	 190
+_p�_	 190
+nis	 189
+kr	 189
+_med	 188
+all	 188
+�n	 187
+nge	 185
+mo	 184
+os	 183
+ld	 182
+ade_	 181
+_S	 181
+ed_	 180
+r�	 176
+De	 175
+_-	 175
+kan	 174
+ta_	 173
+ng_	 172
+v�	 171
+f�r_	 170
+ill_	 170
+han	 170
+_De	 170
+pp	 169
+lt	 169
+sam	 168
+nte	 167
+ans	 167
+ton	 166
+ur	 165
+mi	 165
+ess	 165
+kl	 164
+ig_	 164
+ks	 164
+as_	 163
+und	 163
+men	 162
+med_	 161
+_med_	 161
+ak	 161
+Di	 160
+ot	 159
+rna	 159
+ul	 159
+_var	 159
+te_	 158
+gen_	 158
+het	 157
+kto	 157
+str	 156
+_Di	 155
+tad	 155
+lan	 154
+ga_	 154
+iska	 154
+fa	 154
+fi	 154
+s�	 154
+Dikt	 153
+Dik	 153
+pe	 153
+ska_	 152
+ja	 152
+H	 151
+res	 151
+ku	 151
+iu	 150
+ande_	 150
+till_	 150
+t.	 150
+ern	 150
+rm	 149
+_Dikt	 149
+_Dik	 149
+ie	 149
+bl	 148
+-_	 147
+od	 147
+_H	 147
+n.	 147
+ist	 147
+_di	 146
+ius	 146
+_"	 145
+la_	 145
+sl	 145
+man	 145
+ren	 145
+_f�r_	 145
+toni	 144
+kton	 144
+n._	 144
+ktoni	 144
+ikton	 144
+I	 144
+ikto	 144
+nius	 143
+ten_	 143
+onius	 143
+oniu	 143
+toniu	 143
+ing_	 143
+Dikto	 143
+niu	 143
+_ko	 143
+ic	 142
+_sa	 142
+_han	 142
+ett_	 142
+sm	 141
+ba	 141
+M	 141
+gr	 140
+l�	 140
+ex	 138
+t._	 138
+sp	 137
+lla	 137
+_et	 137
+_M	 137
+dr	 137
+r�	 136
+rad	 136
+ek	 136
+_be	 135
+tar	 135
+_-_	 135
+_om	 134
+rl	 134
+E	 134
+m�	 133
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/japanese-shift_jis.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/japanese-shift_jis.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/japanese-shift_jis.lm	(revision 258)
@@ -0,0 +1,400 @@
+�	 9970
+�	 2204
+_	 1555
+�	 1214
+�	 891
+A	 885
+�	 846
+�	 836
+�A	 831
+�	 818
+�	 815
+��	 790
+�	 739
+�	 729
+�	 618
+�	 607
+�	 589
+�	 568
+�	 566
+�	 555
+�	 552
+�	 528
+��	 527
+��	 500
+�	 489
+�	 481
+�	 461
+�	 460
+�	 453
+�	 449
+��	 449
+�	 445
+�	 440
+B	 419
+�	 411
+�B	 405
+�	 404
+��	 404
+��	 401
+�	 396
+�	 389
+��	 387
+�	 368
+�	 366
+��	 363
+��	 361
+���	 357
+��	 352
+��	 352
+��	 349
+��	 345
+�	 330
+��	 321
+�	 320
+��	 320
+���	 306
+��	 305
+�	 292
+�	 284
+@	 282
+_�	 281
+܂	 275
+��	 268
+v	 263
+�܂	 258
+Ȃ	 256
+�	 251
+�Ȃ	 240
+��	 239
+�	 238
+Ă	 234
+�	 232
+Ƃ	 231
+ł	 226
+�@	 220
+��	 217
+�Ƃ	 214
+�ł	 211
+_�	 210
+�Ă	 205
+��	 204
+��	 203
+���	 199
+�	 198
+̂	 195
+�	 194
+�	 194
+���	 182
+�	 182
+�	 181
+�	 180
+ɂ	 180
+A�	 176
+�	 176
+�	 173
+�ɂ	 172
+�̂	 172
+v�	 169
+�	 169
+��	 167
+�	 167
+�B_	 166
+N	 166
+B_	 166
+O	 165
+�	 165
+�A�	 165
+��	 164
+P	 163
+�	 163
+��	 159
+�	 159
+_�@	 157
+��	 156
+���	 155
+[	 153
+��	 153
+X	 153
+�	 148
+i	 148
+��	 148
+��	 147
+��B	 146
+��	 146
+���B	 145
+j	 142
+���	 142
+�P	 141
+���	 141
+����	 141
+͂	 141
+��	 141
+���	 137
+V	 137
+��	 135
+��	 135
+�	 134
+u	 133
+�[	 132
+��	 131
+l	 129
+�	 129
+s	 128
+�	 128
+�	 125
+��	 125
+S	 125
+g	 124
+��	 123
+��	 123
+�	 123
+���	 122
+��	 122
+�	 120
+��	 120
+��	 120
+�	 120
+\	 119
+́	 119
+�u	 119
+�v	 119
+��	 119
+߂	 118
+W	 118
+�́	 117
+�܂�	 117
+R	 117
+���	 117
+܂�	 117
+�	 114
+�	 114
+�	 113
+�	 113
+{	 113
+�N	 112
+��	 111
+�	 111
+���	 111
+o	 108
+�܂��	 107
+܂��	 107
+Q	 106
+�	 106
+��	 105
+܂��B	 104
+��	 103
+��	 103
+�	 103
+��	 103
+�	 102
+��	 102
+���	 100
+��	 100
+��	 100
+�߂	 99
+����	 98
+���	 98
+�	 97
+��	 96
+�	 96
+��	 96
+I	 95
+[�	 95
+�[�	 95
+�́A	 94
+��	 94
+́A	 94
+��	 93
+�Ă�	 92
+�	 92
+Ă�	 92
+��	 92
+E	 92
+�Q	 91
+�	 90
+w	 90
+�Ă��	 89
+Ă��	 89
+�	 89
+�	 88
+��	 87
+x	 87
+��	 86
+P�	 86
+�	 86
+���	 86
+n	 86
+�	 85
+���	 85
+����	 85
+���	 84
+��	 84
+�	 84
+�͂	 84
+�	 84
+��	 83
+���B	 83
+��B	 83
+�	 83
+��	 83
+�	 82
+�	 82
+�v�	 80
+��	 80
+�P�	 80
+���	 79
+�	 79
+A�	 77
+�	 77
+�	 77
+��	 77
+���Ă	 77
+��Ă	 77
+�	 76
+B�	 75
+�X	 75
+����	 75
+���	 74
+c	 74
+�	 74
+�O	 73
+��	 73
+��	 72
+i�	 72
+���	 71
+��	 71
+�B�	 71
+��	 70
+��	 70
+�	 70
+y	 70
+ǂ	 69
+T	 69
+p	 69
+�	 68
+��	 68
+���	 68
+���B_	 67
+�l	 67
+Z	 67
+��	 67
+��	 67
+��	 67
+�	 67
+��B_	 67
+�	 67
+X�	 66
+�	 66
+���	 66
+�	 66
+��	 66
+A�	 66
+��	 65
+���	 65
+�A�	 65
+U	 65
+��	 64
+�	 64
+��	 63
+���	 62
+C	 62
+����	 62
+��	 62
+�R	 62
+��	 62
+���	 62
+����	 62
+���	 62
+_�	 61
+�܂	 61
+���	 61
+��	 61
+^	 61
+��	 61
+��܂	 61
+�	 61
+l�	 61
+��	 61
+��	 60
+���v	 60
+��	 60
+���	 60
+�v	 60
+��v	 60
+�	 60
+��	 60
+���	 60
+�	 60
+�A�	 60
+�	 59
+��	 59
+�Ȃ�	 59
+Ȃ�	 59
+��	 59
+��	 59
+W�	 59
+��	 58
+�i	 58
+����	 58
+Q�	 58
+�j	 58
+��	 58
+N�	 58
+�{	 57
+���	 57
+��	 57
+�	 57
+���	 57
+̐	 56
+Ɂ	 56
+���A	 56
+e	 56
+�g	 56
+��A	 56
+ʂ	 56
+@�	 56
+	 55
+z	 55
+�I	 55
+Y	 55
+ł�	 55
+��	 55
+�A	 55
+A�	 55
+���	 54
+��	 54
+�X	 54
+���	 54
+t	 54
+�ł�	 54
+�j	 54
+���	 53
+�Ɂ	 53
+��Ƃ	 53
+�	 53
+���Ƃ	 53
+�	 53
+I�	 53
+��	 53
+��	 53
+�A�	 53
+�U	 53
+~	 53
+��	 52
+A�	 52
+x�	 52
+��A	 52
+�̐	 52
+�n	 52
+S�	 51
+�A�	 51
+b	 51
+j�	 51
+�ǂ	 51
+�Q�	 51
+���	 51
+�E	 51
+�	 51
+A�	 51
+��	 51
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/dutch.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/dutch.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/dutch.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 20104
+e	 9848
+n	 5323
+a	 3733
+t	 3683
+i	 3490
+r	 3195
+d	 2876
+o	 2845
+n_	 2443
+en	 2439
+s	 2195
+e_	 1842
+l	 1837
+g	 1522
+en_	 1500
+de	 1489
+er	 1388
+t_	 1377
+v	 1253
+u	 1217
+k	 1204
+_d	 1136
+h	 1102
+m	 1084
+an	 939
+te	 875
+j	 857
+in	 810
+_v	 793
+r_	 751
+de_	 742
+ee	 737
+p	 732
+et	 718
+ge	 716
+aa	 708
+b	 703
+_e	 686
+st	 669
+z	 668
+ie	 662
+_de	 655
+w	 631
+c	 611
+.	 604
+s_	 582
+_de_	 576
+_h	 572
+el	 570
+ij	 564
+._	 554
+et_	 531
+an_	 522
+he	 505
+_o	 497
+nd	 478
+_i	 475
+ar	 459
+_m	 451
+re	 442
+ve	 441
+'	 428
+or	 424
+ng	 421
+at	 418
+_s	 415
+oo	 403
+_z	 401
+le	 395
+_b	 394
+_a	 391
+_he	 386
+va	 385
+er_	 381
+me	 372
+_w	 368
+f	 361
+on	 351
+_t	 351
+_va	 345
+_g	 342
+di	 342
+nt	 340
+,	 335
+g_	 335
+,_	 334
+van	 327
+ch	 326
+is	 326
+ing	 325
+be	 325
+ni	 320
+it	 317
+een	 316
+_van	 315
+al	 310
+den	 309
+ti	 309
+van_	 307
+oe	 302
+ke	 302
+_van_	 299
+aar	 299
+d_	 295
+we	 293
+da	 292
+tu	 290
+_ee	 290
+ud	 287
+een_	 286
+li	 284
+es	 282
+_st	 281
+ver	 281
+ten	 281
+ri	 275
+nde	 275
+der	 274
+_in	 270
+k_	 268
+vo	 267
+het	 266
+oor	 264
+_het	 262
+het_	 262
+_het_	 259
+_een	 258
+l_	 258
+ze	 257
+_n	 254
+ro	 248
+gen	 243
+_een_	 241
+at_	 240
+op	 238
+n.	 238
+_en	 237
+rs	 237
+_da	 235
+stu	 232
+in_	 230
+_be	 229
+_ge	 228
+_k	 226
+rd	 226
+tud	 220
+_en_	 220
+n._	 217
+te_	 209
+ei	 208
+ent	 206
+_me	 203
+la	 202
+ek	 202
+ed	 201
+ra	 200
+stud	 200
+en.	 200
+ie_	 197
+ste	 196
+_vo	 195
+_in_	 193
+_stu	 191
+zi	 191
+om	 189
+ui	 189
+en._	 186
+ten_	 185
+_stud	 185
+ude	 184
+die	 183
+ns	 183
+_j	 181
+D	 179
+aan	 179
+se	 179
+ma	 178
+_ve	 176
+ne	 174
+_p	 174
+eg	 173
+p_	 172
+ar_	 172
+aar_	 171
+_te	 170
+ng_	 169
+_we	 169
+''	 167
+_D	 165
+ers	 164
+_op	 163
+dat	 161
+dat_	 160
+ig	 160
+ere	 159
+eer	 158
+_zi	 158
+voor	 156
+voo	 156
+nge	 155
+nder	 151
+nte	 151
+or_	 150
+ta	 150
+je	 149
+ing_	 148
+ll	 148
+_ver	 147
+jk	 146
+oor_	 146
+_dat	 145
+ijk	 145
+ren	 145
+is_	 145
+_dat_	 144
+_l	 144
+and	 144
+lij	 143
+ter	 143
+na	 142
+uden	 139
+tude	 138
+_voor	 136
+_voo	 136
+ond	 136
+ken	 135
+cht	 135
+_al	 135
+ht	 135
+wa	 134
+ho	 133
+em	 133
+den_	 133
+pe	 132
+sc	 132
+un	 131
+ur	 131
+_di	 130
+gen_	 130
+zo	 129
+rt	 129
+ev	 128
+mo	 128
+lijk	 127
+_is	 126
+stude	 124
+ha	 123
+to	 122
+el_	 121
+og	 121
+op_	 121
+sch	 120
+ol	 120
+ente	 119
+_u	 118
+pr	 118
+end	 118
+mi	 117
+iet	 116
+_aa	 116
+eli	 115
+dent	 115
+ijn	 115
+jn	 115
+ou	 115
+men	 114
+_'	 114
+tie	 113
+_is_	 113
+nie	 113
+tr	 112
+ak	 112
+id	 112
+udent	 111
+tuden	 111
+uit	 110
+_te_	 109
+aan_	 109
+ld	 109
+S	 108
+_aan	 108
+ede	 108
+ja	 107
+nten	 107
+it_	 107
+je_	 107
+ts	 107
+erd	 106
+est	 106
+E	 105
+_op_	 105
+ad	 104
+al_	 104
+_ze	 104
+_on	 104
+rk	 104
+lle	 103
+ens	 103
+gel	 103
+m_	 103
+len	 103
+_r	 102
+ec	 102
+inge	 102
+met	 102
+_met	 101
+si	 100
+die_	 100
+us	 100
+onde	 99
+_ni	 99
+De	 99
+eu	 99
+dente	 99
+enten	 99
+ic	 99
+_met_	 98
+f_	 98
+met_	 98
+no	 97
+ko	 96
+voor_	 96
+rde	 96
+H	 96
+ngen	 95
+lo	 95
+ot	 95
+as	 94
+zij	 93
+_nie	 92
+vi	 92
+eb	 92
+_De	 92
+_zij	 91
+ep	 91
+wi	 91
+_zo	 91
+kt	 91
+ege	 91
+G	 91
+bi	 90
+j_	 90
+ij_	 90
+ze_	 90
+do	 90
+lan	 89
+ov	 89
+udi	 89
+ord	 89
+onder	 89
+V	 88
+elij	 88
+_wa	 88
+elijk	 88
+ef	 88
+_die	 87
+ag	 86
+erk	 86
+eren	 86
+R	 85
+ik	 85
+_ma	 85
+gr	 85
+am	 85
+_mo	 84
+ul	 84
+nn	 83
+eve	 83
+De_	 83
+maa	 83
+ingen	 83
+wo	 83
+_''	 83
+O	 83
+tudi	 82
+I	 82
+nt_	 82
+tudie	 81
+ven	 81
+udie	 81
+nten_	 81
+_die_	 81
+jaa	 80
+ka	 80
+eke	 80
+ite	 80
+a_	 80
+_je	 80
+ac	 80
+jaar	 80
+_je_	 79
+_H	 79
+_zijn	 79
+zijn	 79
+n,	 78
+nen	 78
+N	 78
+n,_	 78
+ijn_	 77
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/nepali.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/nepali.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/nepali.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 7044
+f	 2698
+]	 1196
+g	 933
+s	 815
+l	 781
+/	 698
+;	 662
+k	 645
+d	 635
+]_	 630
+f_	 611
+sf	 549
+f]	 541
+n	 526
+t	 460
+o	 412
+j	 399
+f]_	 374
+L	 365
+_;	 364
+x	 356
+_k	 353
+{	 337
+b	 323
+u	 321
+'	 303
+df	 299
+sf]	 290
+_l	 283
+sf]_	 265
+g]	 245
+G	 232
+e	 231
+|	 227
+a	 222
+/_	 222
+L_	 211
+_g	 210
+c	 207
+df_	 207
+{_	 207
+_c	 201
+g_	 201
+kf	 184
+f/	 177
+_u	 171
+/f	 168
+P	 163
+_/	 162
+k|	 161
+_s	 161
+}	 159
++	 158
+h	 151
+fn	 150
+n]	 145
+of	 141
+tf	 140
+:	 136
+p	 136
+t_	 134
+.	 133
+_k|	 133
+._	 133
+_e	 131
+_d	 131
+_f	 129
+_._	 127
+_.	 127
+n]_	 123
+;f	 119
+lj	 118
+O	 118
+?	 118
+q	 118
+nf	 118
+y	 116
+_a	 113
+m	 111
+Ps	 110
+r	 110
+fg	 106
+w	 105
+sf_	 103
+lg	 102
+g]_	 100
+gf	 94
+_g]	 91
+Psf	 90
+x?	 89
+fd	 88
+fO	 88
+_lj	 85
+]s	 85
+z	 85
+s_	 84
+_p	 82
+_sf	 80
+D	 79
+kl	 78
+_;f	 78
+f/_	 77
+cf	 77
+}_	 76
+Psf]	 76
+jf	 76
+,	 75
+fl	 75
+\	 75
+_x	 74
+kfn	 74
+f{	 74
+_/f	 74
+]k	 73
+of]	 73
+,_	 72
+v	 72
+lt	 72
+_cf	 72
+_b	 71
+O{	 70
+i	 69
+xf	 68
+]kf	 68
+_/_	 68
+Psf]_	 68
+_h	 67
+g]kfn	 67
+g]k	 67
+d_	 67
+g]kf	 67
+O{_	 67
+]kfn	 67
+_g]k	 66
+g'	 66
+_g]kf	 66
+o_	 64
+"	 64
+;b	 63
+Gq	 63
+f+	 63
+n_	 63
+fk	 62
+sf/	 62
+/L	 62
+_kl	 62
+I	 61
+T	 61
+/s	 61
+If	 61
+dG	 60
+_j	 60
+]sf	 60
+;_	 59
+u_	 59
+yf	 59
+dGq	 58
+fO{	 58
+af	 57
+eP	 57
+fs	 57
+fO{_	 57
+fj	 56
+f;	 56
+qL	 56
+l/	 55
+\_	 55
+;D	 54
+dGqL	 54
+GqL	 54
+;+	 53
+g\	 53
+/sf	 52
+nfO	 51
+_kf	 51
+ug	 51
+pg	 51
+:t	 51
+fp	 50
+_ug	 50
+u/	 50
+lg_	 49
+ePs	 49
+fdf	 48
+cl	 48
+nfO{_	 48
+nfO{	 48
+;/	 48
+_cl	 47
+F	 47
+'/	 47
+g\_	 47
+_r	 47
+fo	 47
+_eP	 47
+]{	 46
+Z	 46
+/L_	 46
+_f_	 45
+ePsf	 45
+gd	 45
+_;D	 45
+if	 45
+Gb	 44
+lb	 44
+Q	 44
+_n	 44
+fsf	 44
+]sf]	 43
++;	 43
+nL	 43
+lx	 43
+_t	 43
+_:	 42
++;b	 42
+_o	 42
+fdf_	 42
+bf	 42
+hf	 42
+_lg	 42
+ePsf]	 41
+j_	 41
+ln	 41
+ef	 41
+/]	 41
+_df	 41
+To	 40
+klg_	 40
+_klg_	 40
+]sf]_	 40
+klg	 40
+_klg	 40
+_u/	 40
+f{_	 40
+_ePs	 40
+'g	 40
+Gg	 39
+:y	 39
+_g\	 39
+f}	 39
+kf_	 39
+:tf	 38
+]{_	 38
+fpg	 38
+b'	 38
+hg	 38
+g]{	 38
+jZ	 38
+_;+	 37
+gs	 37
+wf	 37
+o{	 37
+GqL_	 37
+l_	 37
+qL_	 37
+dGqL_	 37
+gf_	 37
+];	 37
+_ePsf	 36
+x'	 36
+?_	 36
+!	 36
+fx	 35
+u|	 34
+;d	 34
+_lb	 34
+fn_	 34
+_P	 34
+fg_	 34
+=	 34
+bn	 34
+Zj	 34
+o;	 34
+g]{_	 34
+_g\_	 34
+kIf	 33
+dl	 33
+kI	 33
+ljZj	 33
+jZj	 33
+rf	 33
++u	 33
+]d	 33
+ljZ	 33
+nL_	 32
+f+;	 32
+fnL	 32
+gL	 32
+;/sf	 32
+tf_	 32
+wfg	 32
+_;/	 32
+Qm	 32
+fb	 32
+f;_	 32
+ld	 32
+;/sf/	 32
+/sf/	 32
+_x'	 32
+;/s	 32
+;f+	 32
+_;f+	 32
+fu	 32
+x?_	 32
+;f+;	 31
+_k|:t	 31
+s'	 31
+_kI	 31
+_k|:	 31
+of]_	 31
+_kIf	 31
+_;f+;	 31
+]l	 31
+k|:	 31
+bg	 31
+_;/s	 31
+|:	 31
+f+;b	 31
+_;/sf	 31
+|:t	 31
+|]	 31
+k|:t	 31
+m_	 31
+;f+;b	 31
+Jo	 30
+k|wf	 30
+|w	 30
+|wf	 30
+k|w	 30
+km	 30
+J	 30
+k|wfg	 30
+|wfg	 30
+]t	 30
+@	 30
+;f]	 30
+b_	 29
+>	 29
+kfn_	 29
+fn]	 29
+gsf	 29
+sf+	 29
+Zjf	 29
+]kfn_	 29
+jif	 29
+ji	 29
+jf;	 29
+_k|w	 29
+fgd	 29
+_k|wf	 29
+Zjf;	 29
+ljZjf	 28
+jZjf;	 28
+]n	 28
+_z	 28
+_s'	 28
+_dG	 28
+|];	 28
+_;d	 28
+jZjf	 28
+u|]	 27
+gdGq	 27
+gdG	 27
+?n	 27
+x'g	 27
+|wfgd	 27
+wfgd	 27
+gdGqL	 27
++u|]	 27
+f+u	 27
+fgdG	 27
+u|];	 27
++u|];	 27
+wfgdG	 27
+dfg	 27
+a}	 27
+_dGq	 27
+f+u|	 27
+fgdGq	 27
+sf+u|	 27
+_sf+u	 27
+f+u|]	 27
++u|	 27
+sf+u	 27
+_sf+	 27
+x?n	 27
+S	 26
+_To	 26
+]kfnL	 26
+_!	 26
+_T	 26
+ul	 26
+/f]	 26
+fsf]	 26
+af_	 26
+;s	 26
+kfnL	 26
+|:tf	 26
+k|:tf	 26
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/ukrainian-koi8_r.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/ukrainian-koi8_r.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/ukrainian-koi8_r.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 21726
+�	 4832
+�	 4080
+�	 3253
+�	 2775
+�	 2747
+�	 2642
+�	 2481
+�	 2373
+�	 2066
+�	 1929
+�	 1806
+�	 1797
+�	 1760
+�	 1605
+�	 1347
+�	 1345
+�	 1061
+�	 1060
+�_	 971
+�_	 965
+�_	 916
+_�	 902
+�	 881
+_�	 869
+�_	 847
+�	 843
+�_	 810
+�	 760
+_�	 696
+.	 676
+�	 654
+�	 647
+_�	 623
+"	 621
+_�	 606
+��	 582
+_�	 565
+�	 543
+_�	 514
+��	 480
+._	 476
+��	 464
+��	 459
+צ	 457
+�_	 457
+�_	 451
+�	 450
+�_	 449
+_�	 443
+�	 438
+��	 431
+�	 428
+_�	 419
+��	 418
+��	 414
+��	 413
+�	 410
+��	 400
+��	 396
+�_	 394
+��	 377
+��	 375
+��	 373
+��	 358
+��	 356
+�_	 354
+�	 354
+_�	 350
+��	 346
+,	 343
+��	 341
+��	 340
+��	 336
+��	 333
+��	 331
+�	 328
+��	 326
+,_	 323
+��	 322
+��	 321
+��	 319
+��	 318
+��	 317
+�	 314
+_��	 314
+�	 312
+��	 310
+��	 310
+��	 305
+�	 295
+��	 295
+Φ	 294
+_��	 289
+_��	 288
+��	 288
+�	 287
+��	 282
+��	 282
+��_	 280
+��	 274
+�	 273
+��	 268
+_�	 268
+�	 267
+��	 266
+"_	 264
+���	 254
+��	 252
+��	 252
+_"	 251
+��_	 251
+��_	 249
+�_	 248
+�	 246
+��_	 245
+I	 245
+��	 244
+_�	 241
+�_	 239
+_��	 239
+��	 235
+��	 235
+�	 233
+_�	 232
+_�_	 228
+��	 228
+��	 228
+�_	 226
+��	 224
+_��	 221
+��	 219
+_��	 218
+��	 216
+��	 215
+��	 214
+��	 213
+_צ	 210
+��	 209
+_�	 207
+�_	 206
+��	 206
+��_	 204
+��	 203
+_�	 203
+�_	 202
+��	 201
+̦	 200
+�	 199
+���_	 199
+�	 197
+��_	 196
+��	 193
+��	 193
+_��_	 190
+_�	 190
+��	 188
+��	 187
+_�	 186
+��	 186
+��	 185
+��	 184
+��_	 184
+_�	 176
+_�_	 174
+_�	 174
+��	 173
+��	 173
+�	 173
+��	 170
+_��	 169
+��	 168
+��	 167
+�	 166
+��	 166
+��	 163
+�	 163
+Ҧ	 163
+�	 163
+�	 162
+��_	 161
+��	 160
+Φ_	 160
+��	 160
+��_	 159
+צ�	 159
+_�	 158
+Ԧ	 155
+_��	 155
+*	 154
+��	 153
+��	 153
+_*	 152
+��_	 152
+��_	 152
+��	 152
+_��	 151
+�_	 151
+��	 151
+*_	 151
+��	 151
+_*_	 150
+�	 149
+_�_	 149
+_��	 148
+_�	 147
+Ħ	 147
+��	 146
+��	 145
+_��_	 144
+���	 144
+��_	 143
+��	 142
+_��	 141
+��	 141
+��	 140
+�_	 139
+��	 138
+Ц	 137
+���	 137
+��	 136
+��	 136
+_��_	 136
+��	 135
+æ	 135
+_�	 134
+_��	 133
+��	 133
+��_	 133
+��	 132
+��	 131
+��	 130
+��	 129
+_��	 129
+��	 129
+_��	 129
+�_	 128
+��	 128
+��	 128
+ͦ	 128
+_��	 127
+��	 126
+�_	 126
+�צ	 123
+��	 123
+��	 122
+˦	 121
+:	 119
+_�	 118
+��	 118
+��	 116
+Ӧ	 116
+��	 115
+ϧ	 115
+��	 115
+��_	 115
+���	 114
+��_	 113
+_�	 113
+���	 113
+��	 113
+���	 112
+��	 112
+?	 111
+��	 110
+���	 109
+_�	 109
+��	 109
+��	 109
+��	 109
+��_	 108
+��	 108
+_�	 106
+�	 106
+��_	 106
+��	 106
+_צ�	 106
+��	 106
+��	 105
+¦	 105
+���	 105
+���	 104
+��	 104
+��	 104
+���	 104
+��	 103
+��	 103
+_�	 102
+_��	 102
+�_	 102
+��_	 102
+���	 102
+_�	 101
+_��	 101
+���	 101
+�	 100
+_��	 100
+��	 99
+���_	 99
+���	 99
+_��_	 98
+���	 98
+��	 98
+���	 97
+��_	 97
+��	 96
+��	 94
+���_	 94
+_�	 94
+��	 93
+!	 93
+_��	 93
+..	 93
+���	 92
+��	 92
+���	 92
+��	 92
+_���	 91
+��	 91
+���	 91
+_���	 91
+��	 91
+��	 89
+�	 89
+�_	 88
+���_	 88
+��	 88
+��	 86
+��	 86
+��	 86
+����	 86
+��	 85
+�_	 85
+��	 84
+���	 84
+���	 84
+_����	 83
+_Ц	 83
+_��	 82
+��	 82
+��	 82
+�	 81
+�	 81
+_�	 81
+��_	 81
+��	 81
+��	 81
+���	 81
+��_	 80
+_�	 79
+_�	 79
+��	 78
+��	 78
+��	 78
+��	 78
+��	 78
+_���	 77
+��_	 77
+��_	 77
+��	 77
+��	 77
+_�	 77
+_�	 77
+_��	 76
+_��	 76
+��_	 76
+��	 76
+��	 75
+��	 75
+���	 75
+��	 74
+���	 74
+���	 74
+����	 74
+ϧ_	 73
+_���	 73
+���	 72
+".	 72
+."	 72
+����	 72
+��	 72
+��	 71
+��_	 71
+��	 71
+�	 71
+_��	 71
+���	 71
+���	 71
+��_	 70
+_�	 70
+���	 70
+_��	 69
+�Φ	 69
+��	 68
+���	 68
+����	 68
+��	 68
+��_	 68
+����_	 68
+���	 68
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/icelandic.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/icelandic.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/icelandic.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 26104
+a	 6496
+r	 6044
+n	 5160
+i	 5123
+s	 3987
+e	 3891
+u	 3582
+t	 3300
+�	 3126
+l	 3071
+g	 2726
+m	 2459
+k	 2256
+f	 2230
+r_	 1967
+v	 1641
+ar	 1472
+�_	 1420
+_s	 1332
+�	 1248
+o	 1221
+�	 1197
+a_	 1155
+in	 1150
+i_	 1114
+h	 1023
+j	 975
+d	 974
+st	 929
+a�	 925
+.	 922
+n_	 875
+._	 875
+_v	 874
+m_	 854
+nn	 842
+_f	 840
+ur	 824
+_a	 806
+�	 785
+_h	 782
+�	 779
+i�	 771
+er	 765
+um	 727
+g_	 716
+y	 711
+_e	 709
+�	 672
+b	 672
+ir	 671
+ri	 670
+an	 667
+�	 650
+_�	 648
+a�_	 645
+u_	 633
+na	 631
+�_	 625
+ar_	 622
+_�	 608
+�_	 606
+_�	 595
+ta	 567
+ei	 566
+la	 558
+_m	 549
+_�_	 549
+um_	 547
+t_	 535
+ti	 529
+_o	 524
+ur_	 523
+_a�	 519
+i�_	 512
+�i	 496
+ve	 494
+og	 494
+�	 482
+og_	 479
+_og	 478
+_og_	 478
+nd	 469
+p	 464
+ra	 455
+un	 454
+ir_	 452
+_a�_	 451
+ni	 439
+en	 439
+�u	 439
+_�_	 436
+ng	 434
+il	 404
+ga	 395
+_t	 395
+nu	 393
+ki	 392
+ja	 383
+inn	 379
+_b	 375
+sk	 352
+s_	 350
+vi	 349
+r�	 347
+�a	 345
+ef	 339
+ag	 336
+_u	 330
+se	 324
+lu	 324
+af	 321
+_ve	 320
+tu	 318
+em	 307
+eg	 304
+nn_	 303
+_l	 303
+va	 301
+_k	 296
+,	 295
+ns	 292
+re	 292
+tt	 291
+,_	 291
+l_	 286
+am	 286
+es	 285
+yr	 285
+al	 281
+da	 277
+S	 275
+gu	 273
+_se	 271
+ver	 268
+_g	 266
+ing	 266
+_n	 262
+is	 258
+_er	 257
+sa	 256
+�ur	 255
+le	 255
+_st	 255
+_S	 254
+sem	 254
+ll	 254
+me	 253
+ha	 251
+li	 249
+kk	 249
+rs	 247
+_vi	 247
+rn	 246
+sl	 244
+gi	 243
+ss	 242
+rf	 241
+fy	 240
+�i_	 240
+mi	 238
+ka	 237
+ma	 231
+ld	 230
+�	 229
+rir	 227
+sta	 227
+fyr	 227
+v�	 227
+di	 226
+ru	 224
+var	 224
+_fy	 222
+ku	 221
+em_	 221
+nar	 220
+_sem_	 220
+_sem	 220
+sem_	 220
+he	 219
+yri	 217
+_fyr	 216
+si	 216
+yrir	 215
+au	 212
+er_	 212
+ek	 211
+_ha	 210
+�e	 209
+fyri	 207
+fyrir	 207
+_�e	 205
+fi	 204
+fr	 203
+ge	 201
+or	 200
+ne	 200
+ann	 198
+j�	 198
+_va	 196
+_fyri	 196
+_ver	 194
+fl	 192
+_er_	 191
+_um	 189
+�k	 188
+til	 187
+_he	 186
+fa	 186
+il_	 182
+_ti	 178
+_til	 177
+gar	 176
+_var	 176
+na_	 176
+�	 175
+e�	 171
+fu	 170
+nni	 169
+_me	 168
+ki_	 167
+vi�	 166
+ey	 165
+fn	 165
+arf	 164
+til_	 163
+st_	 162
+_til_	 162
+�a	 161
+num	 161
+_�a	 161
+as	 160
+_vi�	 160
+rt	 159
+el	 158
+u�	 156
+inn_	 155
+_um_	 154
+ra_	 153
+b�	 153
+tar	 151
+ta_	 151
+er�	 151
+�r	 148
+and	 148
+_sa	 146
+ig	 146
+_en	 146
+nga	 145
+rir_	 145
+us	 144
+jar	 143
+et	 143
+�r	 142
+_sk	 140
+ndi	 140
+��	 139
+var_	 139
+_r	 138
+av	 138
+�k	 137
+nna	 137
+�ur_	 136
+�l	 136
+ko	 135
+nin	 135
+vi�_	 135
+�l	 135
+ins	 134
+ik	 133
+E	 133
+K	 133
+yrir_	 133
+ns_	 133
+on	 133
+ein	 132
+_vi�_	 132
+�g	 132
+j�	 132
+�	 132
+�l	 132
+�s	 132
+_mi	 131
+f_	 131
+s�	 131
+sj	 131
+stu	 131
+nda	 130
+_var_	 130
+gr	 129
+�s	 128
+t�	 127
+ri_	 126
+haf	 126
+_s�	 125
+v�k	 124
+rin	 124
+te	 124
+r.	 124
+r._	 123
+H	 123
+nes	 123
+�t	 123
+ru_	 123
+kr	 122
+F	 122
+�r	 121
+num_	 121
+k_	 121
+a.	 121
+_H	 121
+_fr	 120
+_ge	 120
+r�	 120
+_E	 120
+_�	 120
+ug	 120
+ngu	 119
+an_	 119
+inga	 118
+_K	 118
+_haf	 118
+enn	 117
+ars	 117
+ri�	 117
+en_	 117
+sin	 116
+kur	 116
+it	 116
+�a_	 116
+ti_	 115
+r�i	 114
+tj	 114
+ni_	 114
+at	 114
+tarf	 114
+br	 113
+slu	 113
+kki	 113
+rg	 113
+m�	 113
+kv	 113
+_en_	 113
+a._	 112
+gar_	 112
+du	 112
+ju	 110
+ei�	 110
+und	 110
+lag	 110
+tur	 110
+ega	 109
+h�	 109
+��	 109
+gn	 109
+hef	 109
+kj	 109
+_hef	 109
+_sta	 108
+B	 108
+V	 108
+sam	 107
+_ei	 106
+_B	 106
+ft	 106
+ga_	 106
+G	 106
+_G	 105
+l�	 105
+kki_	 105
+star	 104
+in_	 104
+R	 104
+me�	 104
+_�r	 103
+_me�	 103
+ekk	 103
+inu	 103
+t�	 103
+_V	 103
+m.	 103
+a�i	 103
+j�	 102
+�j	 102
+_b�	 102
+ess	 102
+h�s	 101
+ut	 101
+gs	 101
+av�	 101
+mu	 101
+_R	 101
+_�	 101
+rst	 100
+�jar	 100
+leg	 100
+�ja	 100
+ja_	 99
+av�k	 99
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/tagalog.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/tagalog.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/tagalog.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 10664
+a	 6092
+n	 3421
+i	 2332
+g	 2149
+ng	 1488
+an	 1332
+g_	 1308
+ng_	 1243
+t	 1155
+a_	 1138
+o	 1137
+l	 1105
+s	 1067
+k	 1035
+_n	 957
+m	 909
+y	 801
+ang	 787
+u	 767
+ang_	 683
+p	 682
+na	 670
+_a	 634
+la	 596
+.	 572
+in	 561
+r	 559
+sa	 545
+_s	 502
+._	 487
+ma	 476
+ka	 473
+_na	 464
+b	 462
+_m	 458
+al	 448
+d	 445
+pa	 414
+n_	 412
+at	 394
+ak	 393
+h	 378
+ya	 358
+_k	 356
+ag	 350
+ni	 344
+_p	 339
+_sa	 335
+o_	 328
+ta	 308
+_an	 307
+iy	 300
+sa_	 296
+_ang	 294
+_ang_	 293
+t_	 290
+ay	 286
+ga	 283
+on	 280
+it	 275
+_sa_	 265
+ala	 258
+_ng	 256
+am	 252
+_i	 248
+_pa	 248
+i_	 243
+na_	 243
+an_	 240
+e	 239
+_ma	 237
+_ka	 235
+iya	 231
+y_	 229
+il	 228
+li	 228
+w	 226
+_ni	 225
+_na_	 224
+_ng_	 220
+as	 214
+ba	 207
+si	 206
+"	 195
+ti	 195
+ha	 186
+,	 179
+ar	 178
+ing	 173
+ra	 173
+A	 172
+ki	 168
+ong	 167
+_b	 167
+ap	 166
+,_	 162
+ong_	 161
+ko	 159
+ay_	 159
+un	 157
+ul	 155
+yo	 154
+to	 152
+_l	 150
+ah	 148
+is	 147
+hi	 147
+_t	 146
+lan	 145
+ama	 142
+niy	 139
+at_	 138
+_niy	 138
+aka	 136
+wa	 136
+niya	 135
+_niya	 135
+ab	 134
+-	 134
+di	 133
+_si	 132
+"_	 131
+aw	 129
+_d	 126
+_A	 126
+yan	 123
+ya_	 122
+ata	 120
+a.	 120
+gi	 120
+P	 120
+ing_	 118
+um	 115
+o.	 113
+aki	 113
+ri	 113
+ik	 112
+nd	 112
+ila	 111
+mo	 110
+da	 110
+a._	 110
+in_	 109
+la_	 107
+ali	 106
+S	 106
+man	 105
+ig	 105
+iya_	 105
+s_	 104
+_ak	 104
+_at	 103
+_h	 102
+yon	 102
+asa	 101
+ina	 101
+_P	 101
+n.	 99
+N	 98
+aa	 98
+ga_	 97
+_mo	 97
+_ba	 97
+_"	 95
+ito	 94
+bi	 94
+yang	 94
+n._	 93
+pag	 92
+lang	 92
+yang_	 92
+_la	 92
+o._	 90
+K	 90
+_at_	 90
+tu	 88
+_S	 88
+ara	 87
+nga	 87
+ro	 85
+apa	 83
+rr	 82
+lam	 82
+lo	 81
+nan	 81
+_N	 80
+aman	 79
+aha	 78
+mg	 78
+mga	 78
+mga_	 78
+_mga_	 78
+_mg	 78
+_mga	 78
+_K	 78
+siy	 77
+kan	 76
+it_	 76
+san	 76
+d_	 75
+ad	 75
+di_	 74
+tin	 74
+'	 74
+ati	 73
+siya	 73
+kin	 72
+M	 72
+lang_	 71
+mo_	 70
+_mo_	 70
+ako	 70
+uma	 70
+_pag	 69
+pi	 69
+l_	 68
+_siy	 68
+rrr	 68
+_siya	 67
+ula	 67
+_M	 66
+Pa	 66
+iyo	 66
+mi	 66
+bu	 66
+mu	 65
+no	 65
+pu	 65
+nag	 65
+ung	 65
+Na	 65
+ot	 64
+_Na	 64
+niya_	 64
+iyan	 64
+ku	 64
+k_	 63
+go	 62
+awa	 62
+ip	 61
+_Pa	 61
+lu	 61
+_di	 60
+pan	 60
+_ta	 60
+ini	 60
+isa	 60
+nt	 60
+iyang	 60
+_iyo	 59
+_iy	 59
+on_	 59
+tan	 59
+mang	 59
+aba	 59
+gan	 59
+ut	 58
+I	 58
+hin	 58
+nak	 58
+an.	 57
+akin	 57
+_r	 57
+han	 57
+Ka	 57
+_ay	 57
+_ako	 56
+may	 56
+iyon	 56
+rrrr	 55
+Sa	 55
+aga	 55
+to_	 55
+nit	 55
+_ko	 54
+er	 54
+ib	 54
+ari	 54
+ana	 54
+ili	 54
+an._	 54
+ahi	 54
+au	 54
+ala_	 54
+gk	 53
+pa_	 53
+_is	 53
+rin	 53
+ilan	 52
+_kan	 52
+_Ka	 52
+_it	 52
+_Sa	 51
+king	 51
+ko_	 51
+_nak	 51
+gin	 51
+_ay_	 50
+bo	 50
+_iyon	 50
+amang	 50
+'y	 49
+os	 49
+mang_	 49
+_pa_	 49
+kat	 49
+a,	 49
+An	 48
+Ma	 48
+ny	 48
+mag	 48
+_ku	 48
+_ito	 48
+_ha	 47
+yong	 47
+?	 47
+aking	 47
+T	 47
+ni_	 47
+yong_	 47
+_An	 47
+king_	 47
+_akin	 46
+sang	 46
+_nag	 46
+kas	 46
+_aki	 46
+_ni_	 46
+ayo	 45
+kit	 45
+'y_	 45
+mat	 45
+_Ma	 45
+lal	 45
+ot_	 45
+nya	 44
+ban	 44
+ndi	 44
+oo	 44
+_u	 44
+ngi	 44
+_hi	 44
+sang_	 44
+B	 43
+su	 43
+may_	 43
+rrrrr	 43
+p_	 43
+ita	 43
+wal	 43
+ika	 43
+abi	 43
+aan	 43
+_may	 43
+lama	 42
+naka	 42
+mal	 42
+_I	 42
+_ri	 42
+alan	 42
+any	 42
+im	 42
+_pu	 42
+ai	 42
+wala	 41
+anya	 41
+a,_	 41
+_B	 41
+ndi_	 41
+as_	 41
+pat	 41
+po	 41
+nang	 41
+_mag	 41
+laman	 40
+lala	 40
+kal	 40
+g-	 40
+..	 40
+ir	 40
+!	 40
+uk	 40
+gu	 39
+ito_	 39
+ro_	 39
+_g	 39
+_da	 39
+_isa	 39
+_lam	 39
+ilang	 39
+kanya	 39
+w_	 39
+kany	 39
+agk	 38
+pal	 38
+ka_	 38
+_naka	 38
+siya_	 38
+isan	 38
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/bulgarian-iso8859_5.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/bulgarian-iso8859_5.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/bulgarian-iso8859_5.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 11056
+�	 3428
+�	 3007
+�	 2501
+�	 2490
+�	 2179
+�	 2166
+�	 1596
+�	 1492
+�	 1159
+�_	 1144
+�	 1093
+�	 918
+�	 803
+�_	 803
+��	 724
+�	 720
+�	 702
+�_	 642
+�	 613
+_�	 577
+_�	 569
+�_	 556
+.	 537
+��	 534
+��	 473
+._	 467
+�	 462
+��	 455
+_�	 452
+_��	 446
+,_	 440
+,	 440
+�	 439
+�	 432
+��_	 422
+�	 405
+�	 382
+��	 376
+��	 360
+��	 360
+�	 355
+_�	 353
+��	 334
+��	 330
+�_	 324
+��	 322
+_��_	 316
+��	 310
+��	 308
+��	 305
+��	 303
+��	 301
+��	 281
+_�	 278
+_�	 275
+���	 262
+��	 262
+��	 262
+_�	 250
+��_	 248
+��	 242
+��	 236
+��	 235
+��	 230
+_�	 226
+��	 222
+��	 216
+�	 214
+��	 210
+��_	 203
+��	 198
+_�_	 196
+��	 196
+_��	 195
+��	 189
+��	 189
+���_	 189
+�_	 186
+��	 185
+��	 185
+_�	 184
+��	 178
+��	 177
+�	 175
+��	 175
+��_	 172
+��	 171
+��	 170
+_�	 169
+_��	 169
+_�	 165
+�_	 163
+��	 162
+�	 161
+��	 160
+��_	 159
+��	 156
+��	 156
+��	 155
+��	 154
+_�_	 152
+_�	 152
+��	 151
+��	 151
+_�	 150
+��	 149
+�	 148
+_��	 146
+��	 145
+��	 143
+��	 141
+_�	 138
+��	 137
+��	 135
+��	 134
+��	 133
+_��	 133
+��	 131
+��	 129
+�	 128
+��	 127
+_�	 126
+���	 124
+���	 123
+��	 123
+��_	 123
+��	 122
+��	 121
+_��	 120
+���	 119
+��	 118
+��	 116
+��_	 115
+��	 113
+��_	 112
+�	 112
+-	 111
+��_	 111
+��	 110
+���_	 109
+��	 108
+_��_	 108
+��	 108
+���	 107
+��	 107
+��	 107
+_��	 106
+��_	 105
+��	 103
+_�	 103
+_��_	 101
+��	 101
+��	 100
+_��	 99
+"	 99
+��	 99
+��	 99
+��	 98
+���	 97
+���	 97
+���	 97
+_�_	 97
+���	 96
+���	 96
+�	 93
+��_	 93
+��	 92
+��	 92
+���	 92
+��	 92
+��	 91
+��	 90
+��	 90
+��	 89
+���	 89
+��_	 89
+��	 88
+���_	 88
+_�	 88
+��	 88
+�,	 87
+���	 87
+��	 87
+�,_	 87
+_��_	 85
+_��_	 83
+��	 83
+���	 83
+��_	 83
+�	 82
+��	 81
+�_	 81
+_��	 81
+_�	 80
+���	 80
+���	 79
+��	 78
+��	 78
+����	 78
+��	 78
+�	 77
+���	 77
+��_	 77
+��	 77
+��_	 76
+_��	 76
+���	 75
+���	 75
+��	 75
+��	 75
+���	 74
+��	 73
+_��	 73
+��	 73
+�_	 73
+���	 73
+_���	 72
+��	 72
+��	 72
+����	 72
+���	 72
+���	 71
+��	 71
+�,_	 71
+�����	 71
+����_	 71
+���	 71
+����	 71
+�_	 71
+�,	 71
+��	 70
+��	 70
+���	 70
+��	 70
+���	 70
+��	 70
+_��	 70
+�_	 69
+��	 68
+���	 68
+��	 67
+��	 67
+���	 66
+���	 66
+����	 66
+�_	 66
+��	 66
+��	 65
+���	 65
+���	 64
+���	 64
+��	 64
+���	 64
+_�	 64
+����	 63
+���	 63
+_��	 63
+_�	 62
+_�	 62
+��_	 62
+�	 62
+��_	 62
+_.	 62
+��	 61
+��	 61
+��	 61
+��	 61
+��	 61
+_��	 61
+���	 60
+���	 60
+(	 60
+)	 60
+���	 59
+��	 59
+��	 59
+���	 59
+��	 59
+�.	 58
+�	 58
+���	 58
+_(	 58
+_���	 58
+��	 58
+��	 58
+_�	 57
+���_	 57
+���	 57
+���	 57
+���	 56
+�._	 56
+��	 56
+���	 56
+���	 56
+_���	 55
+��	 55
+���	 55
+���	 55
+_�_	 55
+��	 55
+_,_	 55
+_��	 55
+�����	 55
+���	 55
+����	 55
+_,	 55
+��_	 54
+�����	 54
+�	 54
+����	 54
+_-	 54
+����	 54
+-_	 53
+���	 53
+��	 53
+��_	 53
+�����	 53
+���	 53
+_��	 53
+��	 53
+_��	 52
+���	 52
+���	 52
+_-_	 52
+��	 51
+_�	 51
+��	 51
+��	 51
+�_	 50
+_�	 50
+���	 50
+���	 50
+��	 50
+�	 50
+_���	 50
+_��	 50
+_"	 50
+��	 49
+_��	 49
+��	 49
+����	 49
+��	 48
+���	 48
+���_	 48
+���	 48
+�����	 48
+_��	 48
+��	 48
+_._	 48
+���	 48
+��	 48
+����	 48
+��	 48
+����	 48
+���	 47
+��	 47
+�	 47
+�����	 47
+_��	 47
+����	 47
+���	 47
+�����	 47
+���	 47
+����	 47
+����	 47
+���	 47
+���	 47
+���	 46
+����	 46
+_���	 46
+���_	 46
+���	 46
+�����	 46
+_����	 45
+���	 45
+���	 45
+��	 45
+��	 45
+����	 45
+_��	 45
+��	 45
+��_	 45
+��	 45
+���	 45
+���	 45
+����	 44
+�����	 44
+_���	 44
+�����	 44
+_����	 44
+��_	 44
+���_	 44
+���	 44
+��_	 44
+����	 44
+�	 43
+����	 43
+���	 43
+�����	 43
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/slovenian-ascii.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/slovenian-ascii.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/slovenian-ascii.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 25262
+e	 6217
+a	 5964
+i	 5611
+o	 5538
+n	 4132
+s	 3349
+l	 3268
+r	 2913
+t	 2777
+j	 2672
+v	 2282
+k	 2175
+e_	 1958
+d	 1953
+p	 1786
+a_	 1700
+y	 1623
+m	 1559
+o_	 1542
+z	 1521
+i_	 1462
+_s	 1433
+je	 1383
+,	 1278
+,_	 1278
+b	 1230
+c	 1137
+_p	 1130
+_n	 1032
+je_	 997
+u	 986
+_j	 972
+g	 933
+_je	 877
+cy	 848
+_je_	 842
+_v	 793
+il	 786
+ni	 782
+st	 779
+na	 743
+ra	 726
+.	 723
+._	 716
+_z	 713
+in	 691
+_k	 685
+_b	 667
+al	 640
+h	 627
+po	 607
+ti	 584
+pr	 584
+ko	 584
+_d	 582
+el	 579
+n_	 579
+la	 577
+lo	 573
+l_	 571
+_t	 567
+se	 567
+ne	 562
+_i	 556
+no	 549
+en	 546
+_o	 534
+re	 524
+bi	 514
+li	 512
+ov	 496
+sy	 458
+_na	 457
+te	 453
+da	 451
+_po	 440
+_bi	 437
+ye	 436
+to	 424
+ri	 420
+an	 420
+_pr	 417
+ve	 410
+nj	 404
+ka	 403
+_m	 394
+le	 385
+ja	 377
+va	 374
+de	 374
+is	 371
+ed	 364
+v_	 362
+za	 361
+in_	 354
+bil	 353
+_se	 351
+aj	 347
+ga	 344
+ar	 343
+od	 339
+_in	 338
+_in_	 333
+tr	 332
+os	 332
+_bil	 332
+ta	 328
+vo	 327
+ki	 324
+ro	 324
+et	 320
+so	 315
+em	 313
+lo_	 311
+na_	 306
+av	 305
+ih	 305
+yi	 304
+h_	 295
+at	 294
+m_	 293
+ek	 292
+ol	 289
+se_	 289
+as	 284
+lj	 281
+_za	 277
+ob	 275
+om	 273
+me	 273
+zy	 272
+mi	 268
+eg	 265
+_v_	 263
+_g	 260
+or	 260
+es	 259
+_se_	 258
+do	 255
+ni_	 255
+ga_	 253
+oc	 251
+il_	 250
+vi	 249
+ak	 248
+no_	 243
+da_	 241
+pa	 240
+_ne	 238
+ot	 238
+_so	 238
+ocy	 237
+ya	 237
+la_	 234
+li_	 234
+ih_	 231
+_c	 229
+az	 229
+ik	 228
+on	 225
+ki_	 224
+go	 223
+im	 223
+sk	 223
+mo	 221
+cye	 219
+ti_	 217
+ji	 216
+_da	 216
+iz	 215
+ko_	 214
+ic	 213
+_l	 209
+u_	 209
+pre	 208
+_r	 208
+_ko	 208
+t_	 207
+z_	 206
+er	 206
+so_	 206
+ilo	 203
+r_	 201
+j_	 199
+ad	 195
+cyi	 193
+_na_	 193
+sa	 191
+ev	 191
+i,	 188
+i,_	 188
+it	 187
+sto	 186
+_da_	 184
+_ni	 183
+_so_	 182
+_ve	 182
+nje	 181
+a,	 181
+kr	 181
+a,_	 181
+dn	 177
+_st	 177
+di	 176
+ega	 176
+og	 174
+o,_	 174
+o,	 174
+ilo_	 172
+_ki	 171
+ma	 170
+-	 170
+ij	 169
+_cy	 169
+ost	 169
+e,	 168
+e,_	 168
+ne_	 168
+ok	 166
+ke	 165
+_pre	 165
+del	 165
+yn	 165
+al_	 165
+bo	 164
+_pa	 163
+_ki_	 163
+am	 159
+ns	 158
+ye_	 156
+sp	 155
+em_	 154
+_ka	 154
+_te	 153
+_iz	 152
+ega_	 151
+_ob	 150
+br	 149
+ec	 149
+pri	 148
+ap	 147
+ez	 147
+ali	 147
+raz	 144
+jo	 142
+to_	 141
+d_	 138
+a._	 137
+a.	 137
+cya	 137
+ova	 136
+anj	 136
+el_	 135
+V	 135
+si	 134
+sta	 134
+_pri	 132
+_to	 131
+_a	 130
+_bilo	 130
+bilo	 130
+oj	 129
+ecy	 128
+_od	 128
+gl	 128
+op	 127
+ju	 127
+rav	 126
+_u	 125
+s_	 125
+_V	 125
+ila	 125
+ce	 124
+_mo	 124
+ali_	 124
+ah	 122
+str	 122
+_sp	 121
+vr	 121
+aj_	 121
+_do	 121
+bilo_	 121
+N	 119
+iv	 117
+ru	 116
+vs	 116
+jal	 116
+pi	 115
+O	 115
+_z_	 113
+icy	 112
+k_	 112
+be	 112
+elo	 111
+dr	 110
+pra	 110
+sye	 110
+ved	 109
+rs	 108
+_tr	 108
+tv	 108
+oz	 108
+tn	 107
+_nj	 107
+le_	 107
+_N	 107
+_ni_	 106
+pa_	 106
+l,_	 105
+l,	 105
+ins	 105
+ako	 104
+ac	 104
+ist	 104
+ir	 104
+sl	 104
+ila_	 103
+nik	 103
+bi_	 103
+i.	 102
+i._	 102
+_vs	 102
+iti	 102
+_sy	 101
+P	 101
+val	 100
+ku	 100
+_P	 99
+pe	 99
+ala	 99
+bil_	 98
+eli	 98
+jen	 98
+ede	 98
+_zy	 98
+T	 96
+ja_	 96
+ran	 95
+_bo	 95
+S	 95
+ln	 95
+zn	 94
+nst	 93
+_pa_	 93
+_ra	 93
+_bil_	 93
+nil	 93
+ati	 92
+ej	 92
+ocyi	 92
+e.	 91
+_le	 91
+ud	 91
+nov	 91
+nja	 91
+sn	 91
+ar_	 91
+e._	 91
+kl	 91
+isy	 90
+zye	 90
+en_	 90
+sti	 90
+_ga	 90
+prav	 90
+_bi_	 90
+za_	 89
+lik	 89
+ton	 89
+kra	 88
+rt	 88
+W	 88
+_de	 88
+_ga_	 88
+M	 88
+ep	 87
+cyn	 87
+Wi	 87
+_S	 87
+ut	 87
+_W	 87
+inst	 87
+insto	 86
+ste	 86
+Wins	 86
+gov	 86
+nu	 86
+Win	 86
+_Wi	 86
+Winst	 86
+nsto	 86
+eti	 86
+ston	 86
+nston	 86
+_Win	 85
+_Wins	 85
+ili	 84
+bra	 83
+rat	 83
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/marathi.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/marathi.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/marathi.lm	(revision 258)
@@ -0,0 +1,400 @@
+�	 17815
+_	 14534
+��	 4035
+�_	 3087
+�	 2180
+�	 1762
+��	 1669
+�	 1654
+�	 1534
+�	 1480
+��	 1433
+�	 1342
+�	 1289
+�	 1237
+�	 1163
+�	 1158
+�	 1153
+��_	 1133
+�	 1099
+�	 1084
+�	 1062
+�	 1059
+�_	 1054
+��	 1054
+��	 1050
+���	 1039
+��	 989
+�	 983
+��	 968
+�	 965
+�	 949
+_�	 936
+.	 936
+��	 915
+��	 859
+��	 842
+��	 838
+��	 836
+��	 769
+��	 764
+�	 710
+��	 710
+��	 684
+���	 681
+._	 670
+��_	 637
+�	 609
+��	 578
+_�	 578
+_��	 569
+_�	 543
+��	 530
+_�	 530
+��	 524
+_�	 523
+�	 511
+�	 504
+�_	 495
+��_	 477
+���	 476
+��	 474
+_�	 474
+_�	 457
+_��	 447
+_��	 447
+���_	 446
+��	 444
+�	 438
+��	 423
+���	 422
+��	 409
+��	 388
+��	 387
+���	 381
+�_	 366
+���	 359
+�	 339
+���	 334
+_��	 332
+��	 331
+��	 324
+���	 320
+_��	 320
+���	 318
+�	 315
+_�	 315
+��_	 314
+�	 313
+��	 306
+��_	 303
+��	 301
+��	 297
+�	 297
+���	 295
+��	 284
+��	 280
+�	 274
+�_	 272
+���	 270
+���	 268
+���_	 268
+��	 264
+��	 264
+��	 263
+,	 258
+����	 256
+����	 256
+���_	 256
+,_	 255
+���	 255
+�	 249
+���	 247
+���	 243
+���	 241
+_�	 234
+_��	 233
+���	 232
+��	 232
+��	 231
+��_	 231
+���	 230
+���	 228
+�	 227
+�	 226
+���	 225
+�_	 223
+���	 221
+��	 220
+_�	 220
+��	 219
+��_	 218
+���	 217
+�.	 216
+��	 215
+_��	 213
+..	 209
+_���	 209
+����	 205
+���	 205
+����	 204
+�	 204
+���	 203
+����_	 202
+�_	 202
+���	 201
+�	 198
+_�	 198
+��	 193
+_�	 191
+���	 190
+�._	 189
+���	 188
+��	 188
+����	 187
+�	 186
+��	 186
+�	 185
+��_	 180
+��_	 180
+_��	 180
+��	 179
+�	 178
+_���	 176
+_���	 175
+_����	 175
+��	 175
+_��	 175
+���	 174
+���	 171
+��	 170
+_�	 170
+...	 168
+���	 167
+���	 166
+_�	 164
+���	 164
+���	 163
+����	 163
+��	 162
+���	 162
+_���	 162
+����_	 161
+��	 160
+��_	 159
+����	 159
+���	 157
+���	 154
+��	 154
+_��	 154
+_�	 154
+��	 153
+���	 153
+��	 151
+���	 151
+_�	 151
+����	 150
+��	 150
+��	 150
+�.	 149
+_����	 149
+��	 148
+���	 148
+��	 147
+��	 147
+ţ	 146
+���_	 146
+_��	 145
+�._	 145
+���	 144
+��	 143
+�	 142
+�	 140
+����	 140
+���	 139
+��	 139
+���	 137
+���	 136
+_��	 136
+��	 136
+_��	 135
+�.	 135
+���	 135
+'	 135
+�ţ	 134
+_��	 132
+����	 131
+����_	 131
+���	 129
+'_	 129
+_���	 129
+�._	 128
+��	 127
+....	 127
+�	 127
+��	 126
+���	 125
+_��	 124
+��_	 123
+����	 123
+�	 122
+;	 122
+_��	 121
+_���	 119
+�	 118
+���	 115
+���	 114
+��_	 114
+���	 113
+����	 113
+���	 113
+b	 113
+���	 112
+_'	 112
+s	 111
+&	 111
+���	 111
+���	 111
+����	 111
+p	 111
+�	 111
+_�	 110
+�����	 110
+bs	 109
+��	 109
+n	 109
+�	 109
+_���	 108
+&n	 107
+bsp;	 107
+nbsp;	 107
+sp;	 107
+nb	 107
+bsp	 107
+nbs	 107
+sp	 107
+nbsp	 107
+&nb	 107
+&nbsp	 107
+p;	 107
+&nbs	 107
+����	 106
+_'_	 106
+���	 106
+���	 106
+���	 106
+���_	 105
+���	 104
+���	 104
+��	 104
+��	 104
+_��	 103
+����	 103
+��	 103
+���	 102
+����	 101
+����	 100
+����	 99
+�,	 99
+_�	 98
+�,_	 98
+_�ţ	 98
+���	 98
+����_	 98
+_���	 97
+;&	 97
+_���	 97
+����	 97
+_����	 96
+��	 96
+�����	 96
+���	 96
+�	 96
+;&nb	 95
+p;&nb	 95
+;&n	 95
+p;&	 95
+;&nbs	 95
+bsp;&	 95
+.....	 95
+��_	 95
+sp;&n	 95
+sp;&	 95
+p;&n	 95
+�	 94
+_�	 94
+�	 94
+����_	 94
+����	 93
+���	 93
+���_	 93
+��_	 93
+���	 93
+_�	 92
+��	 92
+_���	 92
+���_	 92
+���	 92
+���_	 91
+��	 91
+��_	 90
+_���	 90
+_���	 90
+�����	 90
+�	 90
+����	 90
+��	 89
+��	 89
+����	 89
+���_	 89
+��	 89
+���	 89
+����	 89
+��	 89
+���	 89
+_��	 88
+��	 88
+�����	 88
+_��	 88
+_���	 88
+����	 87
+��	 87
+��	 87
+�����	 87
+_�	 87
+��	 87
+����	 87
+����	 86
+���_	 86
+_���	 85
+���	 85
+��	 85
+_�	 85
+���	 85
+_����	 84
+��	 84
+����	 83
+���	 83
+���	 83
+��	 83
+���	 83
+���_	 83
+_�	 82
+_����	 82
+����_	 82
+���_	 82
+�����	 82
+����	 82
+���_	 82
+_��	 82
+���_	 82
+���_	 81
+��	 81
+�._	 80
+���	 80
+_���	 80
+�.	 80
+��	 79
+_��	 79
+����_	 79
+�	 79
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/croatian-ascii.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/croatian-ascii.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/croatian-ascii.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 36598
+a	 9456
+o	 9050
+i	 8526
+e	 7955
+n	 5513
+j	 5379
+s	 4971
+t	 4125
+r	 3889
+u	 3423
+je	 3281
+l	 3231
+e_	 3177
+d	 3128
+k	 2992
+v	 2891
+a_	 2835
+o_	 2679
+m	 2645
+p	 2316
+_s	 2212
+i_	 2205
+y	 2174
+c	 1894
+z	 1867
+je_	 1613
+_n	 1593
+g	 1581
+_p	 1490
+b	 1386
+u_	 1382
+,	 1208
+,_	 1208
+st	 1203
+_j	 1202
+na	 1159
+_je	 1118
+_d	 1105
+_i	 1104
+.	 1069
+._	 1058
+ra	 1017
+ko	 981
+ni	 980
+_je_	 918
+ij	 914
+ti	 911
+no	 891
+da	 884
+to	 879
+_k	 863
+_o	 856
+cy	 839
+li	 838
+ne	 790
+sy	 786
+-	 785
+pr	 760
+_u	 748
+po	 734
+ta	 711
+_b	 705
+_t	 704
+la	 699
+ja	 699
+an	 691
+m_	 680
+ov	 674
+ije	 673
+_z	 669
+ka	 662
+ri	 652
+lo	 651
+vo	 643
+re	 641
+is	 626
+in	 623
+se	 623
+va	 622
+_m	 617
+oj	 614
+_po	 594
+_pr	 592
+bi	 588
+en	 582
+il	 578
+os	 576
+vi	 572
+nj	 569
+ak	 564
+_na	 558
+im	 558
+da_	 553
+od	 550
+ao	 550
+al	 549
+om	 545
+na_	 533
+_se	 524
+_i_	 523
+h	 517
+_g	 511
+ma	 508
+at	 502
+cj	 501
+og	 497
+--	 493
+ro	 493
+on	 485
+av	 480
+_da	 474
+_ne	 474
+ed	 472
+zy	 471
+se_	 466
+_se_	 458
+_bi	 457
+ao_	 452
+ad	 452
+lj	 445
+es	 444
+ji	 441
+_v	 433
+_c	 430
+za	 421
+go	 418
+_r	 413
+_u_	 411
+yi	 410
+ek	 406
+di	 403
+sa	 396
+et	 393
+ic	 391
+io	 390
+_da_	 389
+to_	 389
+as	 386
+_ko	 383
+ye	 378
+ar	 378
+mo	 373
+le	 367
+or	 364
+ju	 363
+el	 354
+tr	 354
+io_	 352
+ve	 345
+lo_	 344
+su	 344
+ol	 344
+am	 344
+iz	 343
+li_	 338
+ti_	 336
+sto	 323
+n_	 321
+it	 319
+_za	 319
+sta	 317
+_ni	 316
+te	 312
+nu	 312
+a,	 309
+a,_	 309
+ya	 309
+do	 304
+om_	 303
+la_	 300
+no_	 299
+_na_	 299
+d_	 297
+ko_	 296
+aj	 294
+ik	 292
+ru	 291
+ga	 291
+em	 288
+nje	 283
+dj	 281
+ne_	 281
+k_	 277
+_st	 276
+koj	 276
+ec	 274
+_ka	 272
+_su	 270
+ob	 265
+-_	 263
+az	 261
+sv	 260
+_koj	 260
+im_	 260
+ije_	 259
+pa	 258
+ot	 257
+yt	 256
+ok	 255
+su_	 255
+ih	 254
+me	 253
+dn	 253
+_cy	 253
+iv	 251
+syt	 248
+g_	 247
+--_	 246
+_-	 246
+kr	 246
+---	 246
+a.	 245
+e,_	 245
+---_	 245
+e,	 245
+er	 245
+a._	 244
+_iz	 244
+mi	 243
+_---_	 242
+cyi	 242
+_--	 242
+_---	 242
+jed	 240
+h_	 239
+_a	 239
+_sa	 237
+j_	 236
+_l	 231
+_sv	 229
+_to	 229
+sk	 228
+ih_	 224
+ja_	 223
+pro	 223
+yn	 222
+t_	 222
+ost	 221
+_do	 221
+oc	 219
+gl	 218
+_su_	 216
+og_	 216
+uc	 214
+s_	 214
+bil	 213
+oz	 213
+ki	 212
+ni_	 212
+nij	 209
+ako	 208
+eg	 208
+ut	 205
+pre	 205
+ci	 204
+ji_	 203
+_od	 203
+ilo	 202
+ati	 202
+ac	 201
+ns	 200
+_mo	 197
+rij	 196
+bo	 195
+ovo	 195
+ku	 195
+dje	 194
+ma_	 192
+_bil	 191
+cje	 186
+sti	 186
+_go	 186
+de	 185
+sl	 183
+_pro	 182
+ju_	 182
+nije	 181
+tv	 180
+lje	 179
+isy	 179
+pri	 178
+_pre	 177
+dr	 177
+e._	 177
+e.	 177
+op	 176
+ima	 176
+anj	 175
+jen	 175
+us	 172
+ilo_	 172
+_ra	 170
+S	 167
+ecj	 166
+iti	 166
+sp	 163
+_S	 161
+vr	 161
+i.	 161
+i._	 161
+zn	 161
+ali	 161
+i,_	 160
+i,	 160
+ap	 157
+nije_	 157
+nst	 156
+pi	 156
+ga_	 156
+_sy	 155
+_nj	 155
+jes	 155
+ran	 155
+vo_	 155
+yto	 154
+ev	 153
+_to_	 152
+_pri	 151
+est	 150
+N	 150
+ins	 150
+ist	 149
+ir	 149
+o,	 148
+vj	 148
+vje	 148
+o,_	 148
+B	 148
+zi	 147
+jec	 147
+gov	 147
+yto_	 147
+syto	 146
+ton	 146
+od_	 145
+O	 144
+rije	 144
+lik	 143
+on_	 142
+ocy	 142
+W	 142
+ba	 142
+_W	 141
+kao	 141
+Wi	 141
+_N	 141
+inst	 141
+_nij	 141
+_nije	 140
+_Wi	 140
+syto_	 140
+lic	 139
+P	 139
+ovi	 138
+_tr	 138
+rs	 137
+ez	 137
+edn	 136
+_P	 136
+si	 136
+ili	 136
+du	 136
+Winst	 135
+cye	 135
+nston	 135
+ston	 135
+ud	 135
+kao_	 135
+Wins	 135
+insto	 135
+oji	 135
+nsto	 135
+Win	 135
+raz	 135
+zye	 135
+_Win	 134
+ova	 134
+_Wins	 134
+_on	 133
+ako_	 133
+odi	 133
+cya	 133
+ila	 133
+icy	 133
+oj_	 133
+ke	 133
+va_	 132
+ija	 132
+_is	 132
+jel	 132
+oje	 130
+pu	 130
+cje_	 130
+bi_	 129
+rat	 128
+ce	 128
+tu	 128
+mu	 128
+ve_	 127
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/arabic-windows1256.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/arabic-windows1256.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/arabic-windows1256.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 3974
+�	 1252
+�	 958
+�	 626
+�	 534
+�	 498
+��	 496
+�	 482
+_�	 473
+_��	 408
+�	 345
+.	 335
+�	 326
+�	 303
+�	 269
+�	 260
+�_	 258
+�	 244
+_�	 235
+�	 202
+�_	 200
+..	 188
+�	 175
+�	 173
+�	 166
+�	 162
+�	 157
+�	 150
+�	 150
+_�	 145
+�_	 143
+._	 130
+��	 129
+�_	 129
+_�	 124
+�_	 120
+�	 117
+�	 116
+��	 115
+_�	 109
+�	 98
+...	 94
+�	 92
+_�	 92
+_�	 90
+��	 90
+�_	 90
+�_	 88
+��	 87
+���	 86
+��	 84
+_���	 83
+_�	 82
+�	 80
+�_	 79
+�	 77
+.._	 77
+..._	 77
+��	 72
+��	 71
+�_	 69
+��	 69
+�	 69
+��	 69
+�_	 68
+��	 68
+_�	 67
+��	 67
+��	 67
+�	 66
+�.	 66
+��	 65
+�	 64
+��	 63
+��	 63
+�	 63
+�_	 62
+��	 62
+���	 62
+�_	 62
+���	 61
+��	 60
+����	 60
+�	 60
+��_	 60
+_�_	 58
+_��	 58
+_�	 58
+��_	 57
+�..._	 56
+�..	 56
+�...	 56
+-_	 53
+-	 53
+_-	 52
+_-_	 52
+_��	 51
+��_	 50
+��	 50
+���	 50
+_��	 50
+��	 49
+��_	 48
+�	 48
+��	 47
+_�	 47
+�_	 47
+�_	 46
+_���	 45
+��_	 45
+��	 44
+�	 44
+��_	 44
+_��	 43
+_�	 43
+�_	 43
+��_	 43
+_��_	 43
+���_	 42
+����_	 42
+�	 42
+���	 41
+�	 41
+��	 41
+���_	 40
+_�	 40
+���	 40
+_��	 40
+��	 40
+��_	 39
+��	 39
+��	 39
+_���	 38
+��	 38
+��	 37
+��	 37
+_�	 37
+_��_	 36
+�_	 36
+��	 35
+_��	 35
+���	 35
+��	 35
+_��_	 35
+����	 35
+��	 34
+��_	 34
+�_	 34
+�	 34
+���	 34
+�����	 34
+����	 33
+�����	 33
+���	 33
+��	 33
+_�	 32
+��	 32
+��	 31
+���	 31
+��	 31
+��	 31
+��_	 31
+_�	 30
+��	 30
+���	 30
+��	 30
+_����	 30
+��	 30
+��	 30
+��	 30
+�	 30
+_�	 30
+�	 29
+��	 29
+��	 29
+��_	 29
+��	 29
+��	 29
+��	 29
+��	 29
+_��	 29
+�	 29
+��	 29
+_���_	 28
+���	 28
+_���	 28
+_���	 28
+��_	 28
+��	 27
+���_	 27
+_�	 27
+��	 27
+��	 27
+��	 27
+���	 27
+��	 27
+����	 27
+�_	 26
+_.	 26
+��_	 26
+��	 26
+_���	 26
+��	 26
+��_	 26
+��	 26
+���_	 26
+_._	 26
+��_	 25
+��	 25
+��	 25
+����_	 25
+��_	 25
+��	 24
+��	 24
+��	 24
+��	 24
+_��	 24
+��	 23
+���_	 23
+����	 23
+_����	 23
+��	 23
+��	 23
+���	 23
+��	 23
+���	 23
+��	 23
+���	 23
+����	 23
+����	 23
+���	 23
+�����	 23
+����_	 23
+_���	 23
+��	 23
+���	 23
+��	 23
+_���	 23
+���	 23
+���	 23
+����	 23
+_��	 23
+_����	 22
+�����	 22
+�	 22
+��	 22
+��	 22
+��_	 22
+_���	 22
+����	 22
+���_	 22
+����_	 22
+�_	 22
+_�	 21
+_��	 21
+���	 21
+��	 21
+��	 21
+��	 21
+���	 21
+��_	 21
+����	 21
+���	 21
+_����	 20
+��	 20
+��_	 20
+���	 20
+���	 20
+��_	 20
+��	 20
+��	 20
+_�	 20
+��	 20
+��	 20
+��	 19
+��	 19
+��	 19
+�_	 19
+��	 19
+��	 19
+���	 19
+��_	 19
+_��	 19
+��_	 19
+��	 19
+����_	 18
+��	 18
+����	 18
+���_	 18
+����_	 18
+��	 18
+��	 18
+���_	 18
+��_	 18
+��	 18
+���	 18
+��	 18
+_���	 18
+�����	 18
+_��	 18
+_����	 18
+����	 18
+���	 18
+��	 18
+��	 18
+�����	 18
+����	 18
+��	 18
+_��	 17
+���	 17
+���	 17
+��	 17
+��	 17
+�_	 17
+��_	 17
+���	 17
+�_	 17
+����_	 17
+��	 17
+��.	 17
+����	 17
+��	 17
+��	 17
+��	 17
+��	 17
+��	 17
+_��_	 17
+�����	 17
+��_	 17
+��	 16
+��	 16
+_��	 16
+��_	 16
+��_	 16
+�	 16
+_���	 16
+���	 16
+_��	 16
+_��	 16
+��	 16
+��	 16
+��	 16
+��	 16
+��	 16
+_���	 16
+��	 16
+�	 16
+���	 16
+��	 16
+��	 16
+_��	 15
+��	 15
+���_	 15
+����	 15
+���	 15
+_����	 15
+���	 15
+��_	 15
+���	 15
+_��	 15
+_���	 15
+����	 15
+�_	 15
+��	 15
+_����	 15
+��	 15
+���	 15
+��	 15
+_�	 15
+��	 15
+��	 14
+��	 14
+��_	 14
+!	 14
+���_	 14
+����	 14
+_��	 14
+�����	 14
+��	 14
+��_	 14
+���	 14
+��	 14
+����	 14
+_���	 14
+��	 14
+���	 14
+���	 14
+_��_	 14
+�_	 14
+��	 14
+��.	 14
+��	 14
+��	 13
+���_	 13
+���	 13
+_���	 13
+��	 13
+_��	 13
+��	 13
+���	 13
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/hindi.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/hindi.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/hindi.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 75620
+�	 19109
+U	 16333
+�	 11131
+�	 11107
+�	 10241
+��	 7855
+�	 6993
+�U	 6598
+�	 6322
+�	 6151
+�	 5887
+_�	 5800
+�	 5370
+�	 5168
+U_	 5118
+�_	 4935
+�	 4508
+�	 4467
+�	 4292
+�_	 3962
+_��	 3937
+�_	 3904
+�	 3718
+�_	 3609
+�	 3563
+�U	 3514
+_�	 3394
+�	 3363
+�	 2962
+�	 2907
+�U_	 2851
+_�	 2668
+_�	 2632
+_�	 2575
+�	 2527
+�	 2513
+�_	 2512
+�	 2451
+U�	 2336
+�	 2314
+_�	 2280
+_�	 2260
+�	 2187
+�	 2082
+�	 2078
+��	 1988
+�	 1913
+���	 1886
+��	 1881
+�	 1877
+��	 1860
+�	 1842
+�_	 1830
+��_	 1746
+�	 1714
+��	 1703
+�_	 1695
+��_	 1694
+��	 1631
+�	 1610
+_��	 1579
+_��	 1567
+�_	 1556
+��U	 1536
+��	 1528
+��	 1525
+U�	 1515
+_��_	 1488
+�_	 1411
+��_	 1407
+�	 1390
+_��	 1357
+��	 1357
+�	 1337
+�_	 1319
+_�	 1315
+��	 1300
+�	 1279
+�	 1270
+_�	 1258
+_���	 1209
+緤	 1203
+��	 1195
+_�	 1187
+�	 1181
+�	 1166
+��	 1163
+��	 1162
+�	 1157
+�	 1155
+_��	 1150
+��_	 1140
+���	 1127
+��_	 1092
+_��	 1086
+_��_	 1077
+�U	 1075
+_�U	 1071
+���_	 1065
+��U	 1062
+_��U	 1062
+��	 1053
+��	 1052
+��	 1038
+��	 1035
+_�	 1009
+��U	 972
+��	 970
+_緤	 967
+_���	 959
+�U�	 936
+�U�	 930
+_���_	 929
+���	 928
+�	 926
+_��	 904
+�U	 904
+�	 904
+�	 890
+�	 887
+�U	 885
+���U	 866
+_�	 865
+_�U	 862
+_�	 854
+��_	 850
+_�	 847
+_�	 837
+S	 834
+U�	 831
+_�	 830
+U�_	 823
+_�	 798
+��	 788
+�_	 783
+_�U	 773
+U�_	 770
+��	 753
+��	 752
+�	 749
+��_	 732
+��	 732
+�_	 704
+_�	 704
+��	 704
+_��	 697
+��	 695
+�U�	 693
+��_	 690
+�_	 688
+��U_	 685
+,	 684
+_�	 682
+���_	 679
+,_	 674
+_���	 670
+�	 665
+�U	 664
+��	 648
+_��	 647
+U�	 644
+�_	 643
+_�	 641
+緤_	 639
+�_	 639
+��	 633
+_��_	 633
+��	 623
+U�	 621
+��_	 615
+_���U	 611
+U�_	 599
+�U_	 595
+��	 594
+U�	 589
+�U�	 580
+_��U�	 580
+��U�	 580
+_�	 576
+_��	 573
+�U�_	 572
+��U�_	 572
+��	 569
+_�	 569
+_��	 569
+��	 561
+_緤_	 557
+�	 556
+��	 552
+��	 550
+��U	 549
+��	 544
+��	 538
+_���_	 535
+�_	 532
+��	 525
+��	 523
+���	 519
+��_	 502
+�	 501
+�	 498
+_��_	 495
+�	 494
+_��	 493
+��	 493
+��_	 490
+_��U	 485
+��	 484
+�	 481
+�	 478
+��	 469
+.	 459
+��U_	 458
+��	 449
+��	 449
+_��	 445
+��	 444
+��U_	 443
+��	 442
+_��	 440
+_��U_	 439
+��	 437
+��_	 435
+�	 434
+_�	 433
+�U�	 431
+�	 431
+_���	 430
+��	 427
+��	 425
+�_	 420
+��_	 419
+�U	 415
+�	 412
+��	 412
+��	 410
+�U	 405
+�U	 399
+��	 399
+���U_	 394
+U�	 394
+��_	 393
+��	 393
+��_	 392
+���_	 392
+��	 389
+�U�	 385
+��	 385
+Ǹ	 383
+��_	 382
+��	 381
+��	 379
+��	 375
+�_	 374
+�U�	 374
+�U�	 374
+��	 373
+��_	 372
+_���_	 371
+_��	 369
+��	 364
+��U	 364
+�U_	 362
+���	 358
+Ȥ	 357
+U��	 354
+�	 353
+�	 352
+�_	 350
+U�	 349
+���	 346
+��	 346
+����	 346
+��	 345
+��	 344
+��U	 342
+����	 342
+_��	 341
+_��	 341
+_��	 340
+�U_	 337
+_��U_	 337
+�	 337
+��U_	 337
+��	 336
+�U�_	 334
+��	 334
+�	 334
+_��_	 332
+��	 327
+���U	 327
+��	 326
+_�	 325
+U��	 323
+����U	 323
+U�	 322
+�U�	 321
+_��	 320
+ǸU	 319
+_��	 319
+��	 319
+��U_	 319
+_�U�	 318
+��	 317
+�_	 316
+_�	 316
+�	 313
+��	 310
+_�U�	 309
+��	 309
+�	 308
+��U	 308
+_��	 308
+_��U	 307
+_����	 304
+_���	 304
+���	 304
+_���U	 304
+_��	 304
+���U	 304
+���U_	 303
+_��	 303
+�U�_	 300
+U�_	 300
+_S	 300
+��	 300
+U�	 298
+�U�_	 296
+��	 296
+��	 294
+�U_	 294
+��_	 293
+��	 292
+��	 291
+_��	 290
+��_	 290
+��	 290
+��_	 289
+U�U	 288
+��U	 288
+U�	 288
+_��U	 286
+_�	 286
+_��U�	 285
+_��	 285
+��U�	 285
+淤	 284
+_��	 284
+��U�	 283
+U�_	 282
+��	 280
+_��	 280
+�U	 280
+��	 279
+_��	 278
+_��U	 278
+��U	 278
+�_	 277
+_��	 275
+���	 274
+��_	 273
+��	 272
+���	 272
+��	 272
+��_	 272
+_�U�	 272
+��_	 272
+-	 271
+��U	 271
+���U	 271
+�_	 271
+_���	 270
+�U�_	 270
+_���U	 269
+�U�U	 268
+��	 267
+��	 265
+��	 263
+��	 263
+���_	 262
+����_	 262
+���	 262
+��U	 258
+_��	 258
+��_	 258
+_���	 257
+�U	 256
+v	 253
+��	 252
+_�U�	 252
+��	 249
+��	 247
+��	 246
+_�	 246
+�U�	 246
+��	 245
+._	 245
+U�	 244
+�U	 243
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/sanskrit.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/sanskrit.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/sanskrit.lm	(revision 258)
@@ -0,0 +1,400 @@
+a	 15017
+_	 14975
+h	 5028
+i	 3820
+t	 2976
+s	 2788
+r	 2599
+|	 2437
+n	 2432
+aa	 2276
+ha	 2007
+m	 1982
+a_	 1802
+v	 1799
+d	 1768
+u	 1629
+y	 1599
+_|	 1470
+|_	 1470
+e	 1403
+k	 1371
+sh	 1330
+ra	 1243
+p	 1213
+va	 1152
+A	 1134
+ya	 1120
+ma	 1097
+na	 1091
+ar	 1080
+ta	 1054
+M	 1050
+.	 1047
+am	 1037
+an	 1006
+||	 967
+||_	 965
+_||	 965
+_||_	 963
+at	 962
+M_	 946
+as	 910
+_s	 882
+o	 848
+b	 844
+i_	 827
+aM	 764
+aM_	 685
+c	 630
+ch	 629
+sa	 623
+N	 616
+ad	 612
+H	 601
+pa	 595
+H_	 584
+g	 580
+_n	 579
+l	 554
+bh	 552
+hi	 547
+ka	 542
+it	 536
+ii	 535
+ama	 519
+_|_	 505
+e_	 477
+_p	 475
+dh	 475
+av	 469
+ak	 445
+aH	 444
+da	 440
+aH_	 439
+ay	 437
+j	 437
+_na	 432
+ana	 430
+hh	 428
+ti	 426
+ara	 425
+aa_	 410
+_k	 394
+shh	 389
+_v	 388
+_sa	 381
+.h	 379
+ah	 369
+_b	 368
+h_	 363
+.h_	 363
+cha	 362
+haa	 361
+_t	 358
+ri	 352
+sha	 345
+ap	 333
+vi	 330
+is	 329
+^	 321
+o_	 321
+_m	 320
+ai	 311
+_d	 311
+la	 302
+na_	 301
+.n	 298
+ava	 295
+al	 294
+_sh	 291
+ja	 288
+a.	 280
+aan	 277
+ish	 274
+aN	 273
+aya	 273
+ash	 266
+ha_	 265
+ga	 264
+st	 255
+ni	 255
+ii_	 254
+hu	 253
+Na	 253
+R	 248
+R^	 248
+^i	 247
+R^i	 247
+a.n	 243
+th	 241
+_c	 240
+_ch	 239
+maa	 238
+bha	 237
+vaa	 233
+ab	 228
+ir	 226
+\	 226
+ita	 223
+uu	 222
+dha	 220
+har	 218
+_a	 216
+_bh	 216
+nam	 212
+u_	 212
+he	 212
+m.h_	 211
+m.	 211
+m.h	 211
+ur	 210
+es	 209
+ata	 208
+te	 206
+yaa	 205
+_ma	 204
+esh	 202
+aka	 200
+id	 199
+pr	 199
+aha	 198
+hy	 198
+T	 197
+aat	 197
+_OM_	 196
+OM	 196
+_O	 196
+_OM	 196
+OM_	 196
+O	 196
+ti_	 195
+ari	 194
+raa	 193
+ag	 192
+_y	 192
+aas	 190
+_ta	 190
+_j	 189
+I	 189
+_na_	 187
+am.h_	 185
+am.h	 185
+am.	 185
+_pa	 183
+iv	 182
+de	 182
+ada	 178
+nd	 178
+_cha	 177
+_h	 176
+ati	 175
+taa	 173
+ev	 172
+nt	 171
+rii	 171
+ishh	 170
+ya_	 168
+_vi	 166
+ast	 165
+tr	 164
+abh	 164
+kh	 162
+ala	 160
+tha	 160
+apa	 160
+asa	 158
+naa	 158
+_nam	 156
+ru	 156
+A_	 155
+_ka	 154
+aar	 153
+_pr	 152
+_g	 151
+pra	 150
+ham	 150
+hha	 149
+aana	 149
+di	 149
+ra_	 147
+ik	 146
+.a	 144
+yat	 143
+ks	 143
+hA	 143
+hya	 143
+ksh	 143
+ut	 142
+sy	 141
+nama	 140
+_va	 140
+.\	 140
+paa	 140
+han	 139
+eva	 138
+U	 138
+mi	 138
+_r	 136
+_ja	 136
+asy	 135
+hr	 135
+sya	 134
+cha_	 132
+rv	 132
+tv	 130
+asya	 130
+kar	 130
+ho	 129
+yo	 129
+in	 128
+adh	 127
+yA	 127
+va_	 126
+su	 125
+_ya	 125
+shha	 124
+pu	 124
+R^it	 123
+sta	 123
+mu	 123
+^it	 123
+ty	 123
+_nama	 121
+ac	 120
+rii_	 120
+ach	 120
+aNa	 119
+tas	 119
+shi	 119
+iva	 119
+hav	 119
+tra	 118
+var	 118
+par	 118
+haM	 117
+aad	 117
+kaa	 117
+hch	 117
+mas	 117
+ai_	 117
+hc	 117
+sar	 116
+aam	 116
+_bha	 115
+_pra	 114
+et	 114
+haM_	 113
+aay	 113
+aj	 113
+ye	 113
+o.	 113
+An	 111
+arii	 111
+t.h	 110
+t.	 110
+ath	 110
+t.h_	 109
+man	 109
+te_	 108
+o.a	 108
+hara	 108
+rA	 108
+rva	 108
+tva	 108
+asta	 108
+up	 108
+shr	 107
+daa	 104
+me	 104
+dr	 104
+ram	 104
+arii_	 102
+_ni	 102
+arv	 102
+iH	 102
+hit	 101
+ras	 101
+aga	 101
+Am	 101
+mA	 101
+ba	 101
+amas	 100
+tu	 100
+yaM	 100
+ant	 99
+ud	 99
+uk	 98
+iH_	 98
+yaM_	 98
+kha	 98
+au	 98
+ira	 97
+shhT	 97
+rah	 97
+hT	 97
+hhT	 97
+D	 96
+_sar	 96
+re	 96
+eshh	 95
+sarv	 94
+amaa	 94
+and	 94
+arva	 94
+_ra	 93
+_dh	 93
+tt	 92
+tad	 92
+hm	 92
+raM_	 91
+dev	 91
+raM	 91
+C	 91
+ani	 91
+_sarv	 90
+atha	 89
+Ad	 89
+chi	 89
+tA	 88
+sarva	 88
+avi	 88
+taM	 87
+hava	 87
+anaa	 86
+vA	 86
+dd	 86
+nA	 85
+Ar	 85
+hv	 85
+taM_	 85
+dhi	 84
+ksha	 84
+ip	 84
+ma_	 84
+_sha	 84
+ati_	 83
+yai	 83
+vat	 83
+At	 83
+kR	 82
+kR^	 82
+bhi	 82
+_shr	 82
+to	 82
+ta_	 82
+br	 82
+ek	 82
+kR^i	 82
+tat	 81
+nta	 81
+hma	 81
+aaya	 80
+tam	 80
+en	 80
+us	 79
+bra	 79
+ke	 79
+kt	 79
+ddh	 79
+mo	 79
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/russian-iso8859_5.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/russian-iso8859_5.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/russian-iso8859_5.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 76249
+�	 19732
+�	 16714
+�	 14389
+�	 13942
+�	 13160
+�	 12444
+�	 9867
+�	 8461
+�	 7895
+�	 7330
+�	 6498
+�	 5935
+.	 5725
+�	 5287
+�	 5019
+�	 4877
+�	 4083
+,	 3899
+,_	 3878
+�	 3656
+�	 3376
+�_	 3167
+_�	 3144
+�_	 3135
+�_	 3098
+-	 3019
+�	 2983
+_�	 2952
+._	 2930
+_�	 2919
+�	 2887
+�	 2876
+�	 2797
+��	 2672
+_�	 2631
+��	 2585
+..	 2407
+_�	 2316
+��	 2300
+-_	 2294
+�	 2281
+�_	 2249
+��	 2057
+�_	 2029
+��	 1981
+��	 1950
+_�	 1944
+�	 1874
+��	 1856
+_�	 1774
+...	 1744
+��	 1709
+��	 1685
+��	 1636
+_-	 1625
+��	 1616
+��	 1595
+��	 1584
+_�	 1558
+_-_	 1531
+�_	 1521
+��	 1518
+�	 1509
+_�_	 1454
+��	 1433
+��	 1419
+��	 1396
+��	 1389
+�_	 1381
+��	 1375
+��	 1370
+_��	 1364
+��	 1345
+��	 1338
+��	 1337
+��	 1329
+��	 1306
+��	 1300
+_�	 1297
+_�	 1290
+��	 1284
+��	 1271
+��	 1256
+��	 1245
+....	 1232
+��	 1219
+��	 1212
+�	 1192
+�	 1187
+�_	 1168
+.....	 1167
+��	 1147
+��	 1144
+�	 1109
+��	 1101
+��	 1099
+�_	 1093
+��	 1076
+�_	 1074
+_��	 1063
+��	 1062
+��	 1045
+_��	 1034
+��	 1029
+_�	 1026
+��	 1000
+��	 998
+��	 996
+��	 993
+�_	 975
+��	 968
+��	 968
+_��	 966
+��	 946
+��	 943
+_�	 931
+_�	 923
+��	 913
+��	 910
+�_	 907
+��	 898
+�_	 898
+��	 889
+��_	 881
+��	 878
+��	 875
+��	 862
+_�_	 833
+_�	 816
+��	 816
+��	 807
+"	 786
+��_	 769
+��	 767
+��_	 762
+��	 754
+��	 748
+��	 747
+��	 741
+��	 730
+��_	 715
+�_	 713
+��	 711
+_�	 702
+��_	 697
+��	 694
+��	 692
+��	 687
+��	 662
+��	 660
+��	 656
+��	 649
+��	 646
+��	 638
+��	 629
+��_	 619
+_�	 615
+��	 612
+_�	 610
+�	 609
+��	 608
+.._	 605
+��	 604
+���	 604
+��	 604
+_��	 600
+��	 597
+��	 594
+��	 593
+_��_	 589
+_�	 587
+_��	 583
+��	 583
+��	 583
+��	 575
+���	 571
+�	 571
+�_	 570
+_�	 569
+_�	 559
+�	 556
+���	 544
+��	 540
+��	 536
+���	 533
+�	 525
+:	 519
+�	 513
+���	 511
+_��	 510
+��	 510
+�	 508
+_��	 508
+!	 503
+?	 501
+��	 498
+��_	 489
+�	 488
+���	 486
+_��	 485
+��	 484
+��	 484
+_��	 484
+��	 484
+���	 484
+:_	 484
+��_	 480
+_��	 477
+��	 470
+_�	 469
+..._	 465
+��	 464
+��	 464
+�	 462
+��	 461
+��	 459
+���	 458
+��	 454
+��	 454
+��	 445
+���	 442
+_��	 442
+��_	 441
+��	 440
+��	 437
+��_	 436
+���	 436
+���_	 435
+_�	 434
+���	 433
+��	 431
+���	 431
+��	 429
+_��	 429
+�	 425
+_��	 424
+_�	 424
+�_	 423
+��	 422
+��	 422
+_���	 422
+��	 419
+���	 418
+��	 418
+���	 415
+��	 413
+���	 411
+���	 411
+_��	 409
+��	 408
+��	 406
+�_	 406
+_�	 401
+�	 401
+��_	 399
+_���	 398
+_.	 397
+���	 396
+��	 396
+��	 394
+���	 394
+_"	 393
+��	 393
+�_	 392
+_��	 392
+�	 391
+_��_	 391
+���	 391
+����	 390
+�-	 390
+���	 388
+�,	 385
+��	 384
+��	 384
+_�_	 383
+�,_	 383
+��	 383
+?_	 383
+_��	 380
+_���	 380
+_��	 378
+_���	 376
+��	 375
+���	 375
+���	 374
+��	 373
+��_	 372
+���	 372
+��	 371
+_��	 369
+��	 369
+_�	 369
+��	 368
+���	 368
+��	 366
+����	 365
+��	 365
+���	 362
+_��	 360
+��	 360
+!_	 360
+���	 360
+���	 358
+��_	 358
+��	 358
+���	 358
+���	 356
+��_	 356
+�����	 354
+��	 352
+_��	 352
+���	 349
+��	 349
+_��	 348
+��_	 348
+�	 346
+_��	 344
+��	 344
+���	 343
+��	 342
+��	 341
+���_	 339
+��	 338
+���	 337
+����	 334
+��	 334
+��	 328
+_��	 328
+���	 328
+��	 327
+���_	 324
+��_	 323
+��	 323
+��	 322
+�_	 322
+_���_	 322
+���	 322
+��	 321
+�,_	 320
+�,	 320
+���	 319
+���	 319
+���	 318
+��	 318
+��	 317
+��_	 316
+���	 315
+���	 314
+�,	 314
+��_	 313
+��	 313
+�,_	 313
+���	 312
+��	 312
+���	 311
+��	 311
+���	 311
+_���	 310
+�	 309
+��	 309
+���	 309
+��	 309
+_��	 308
+���	 308
+���	 308
+��	 307
+���	 307
+_�	 305
+��	 305
+��	 303
+����	 302
+��	 300
+���	 300
+���	 300
+_���	 298
+��	 297
+_�	 297
+�,	 297
+�,_	 297
+_�_	 296
+_��	 296
+_._	 295
+���_	 295
+��	 294
+���	 293
+�,	 292
+�,_	 292
+_���	 291
+_�	 290
+���_	 290
+��_	 288
+_�	 288
+���	 286
+��_	 285
+��	 285
+���	 285
+���_	 285
+�_	 283
+_�	 283
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/afrikaans.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/afrikaans.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/afrikaans.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 23602
+e	 8036
+a	 4087
+n	 3782
+i	 3726
+o	 3314
+r	 2951
+s	 2885
+t	 2749
+d	 2479
+e_	 2118
+l	 1854
+k	 1741
+ie	 1670
+g	 1601
+n_	 1447
+m	 1440
+_d	 1219
+t_	 1143
+er	 1124
+h	 1124
+u	 1110
+ie_	 1079
+y	 1048
+w	 986
+s_	 982
+_s	 969
+_h	 956
+di	 924
+an	 922
+r_	 912
+aa	 882
+v	 876
+en	 807
+_di	 807
+.	 790
+y_	 747
+_v	 709
+et	 706
+._	 694
+die	 691
+die_	 667
+_n	 666
+_die	 651
+p	 639
+_m	 634
+_die_	 633
+_w	 632
+ee	 607
+ge	 606
+_o	 598
+b	 586
+te	 568
+,	 560
+in	 555
+k_	 550
+_e	 550
+,_	 548
+oo	 516
+et_	 511
+de	 509
+el	 489
+_g	 486
+f	 461
+ar	 451
+ni	 450
+nd	 442
+an_	 440
+en_	 437
+_i	 426
+he	 423
+g_	 418
+_t	 412
+oe	 410
+at	 406
+er_	 400
+om	 381
+wa	 378
+_a	 378
+_b	 377
+_k	 371
+nie	 371
+_he	 370
+aar	 355
+_ge	 351
+es	 351
+_ni	 348
+da	 346
+m_	 342
+ou	 338
+it	 335
+_nie	 335
+d_	 332
+l_	 330
+_wa	 329
+or	 327
+le	 326
+we	 326
+ek	 324
+het	 321
+me	 319
+_het	 319
+is	 318
+j	 315
+at_	 311
+on	 309
+se	 308
+_en	 298
+ma	 294
+st	 291
+as	 280
+va	 277
+_en_	 270
+re	 270
+"	 269
+'	 265
+het_	 261
+_het_	 260
+om_	 254
+al	 252
+ar_	 250
+li	 248
+te_	 247
+aar_	 247
+_da	 245
+u_	 242
+nde	 241
+ou_	 237
+_l	 231
+be	 229
+_'	 226
+rd	 224
+_va	 224
+ig	 223
+ng	 222
+ns	 221
+ve	 220
+it_	 218
+_j	 216
+_me	 216
+sy	 215
+ke	 213
+_sy	 212
+aan	 212
+van	 212
+_in	 210
+is_	 210
+in_	 208
+sy_	 206
+_sy_	 206
+'n	 205
+ro	 205
+ko	 204
+_'n	 203
+ra	 203
+'n_	 203
+_'n_	 202
+so	 202
+D	 202
+ho	 201
+rs	 200
+eer	 200
+ik	 199
+la	 198
+_te	 196
+_van	 196
+_ma	 195
+as_	 194
+ui	 194
+ver	 192
+e.	 192
+der	 191
+to	 188
+op	 187
+van_	 184
+ag	 184
+_ve	 182
+and	 180
+_van_	 178
+ha	 178
+f_	 176
+ka	 176
+ne	 175
+_is	 175
+sk	 174
+e._	 174
+oor	 174
+_ver	 170
+ek_	 170
+_hy	 170
+hy	 170
+p_	 168
+_be	 168
+ri	 168
+ur	 167
+nie_	 165
+_so	 165
+_D	 164
+si	 164
+ll	 164
+no	 164
+_in_	 163
+_hy_	 162
+hy_	 162
+ed	 161
+ers	 160
+_r	 156
+ak	 156
+_ho	 155
+_nie_	 153
+eg	 153
+nt	 152
+de_	 152
+_p	 151
+_we	 148
+_is_	 148
+ei	 147
+es_	 142
+maa	 142
+wee	 142
+na	 141
+nder	 139
+a_	 138
+ing	 138
+ew	 138
+S	 135
+lle	 135
+_om	 135
+_te_	 134
+eu	 134
+ie.	 134
+wo	 132
+em	 132
+wat	 131
+_no	 130
+_"	 130
+vo	 130
+E	 129
+H	 128
+_wat	 127
+ti	 126
+mo	 126
+A	 126
+e,	 126
+_ha	 125
+vi	 125
+el_	 125
+ter	 125
+e,_	 124
+dat	 124
+eer_	 124
+wat_	 124
+le_	 124
+ta	 124
+Di	 123
+dat_	 123
+_wat_	 122
+ie._	 122
+was	 121
+ste	 121
+_H	 121
+_se	 121
+se_	 120
+ul	 120
+al_	 120
+_was	 120
+_om_	 119
+_st	 119
+lik	 118
+"_	 118
+_ko	 118
+_maa	 118
+lo	 117
+_to	 117
+ns_	 115
+aan_	 115
+nie.	 114
+_vi	 114
+met	 114
+_nie.	 111
+nk	 110
+_Di	 110
+-	 110
+_op	 109
+_oo	 109
+_on	 108
+ir	 108
+ord	 108
+uit	 106
+ens	 105
+_was_	 105
+was_	 105
+een	 105
+_met	 105
+os	 105
+_S	 104
+nie._	 104
+ig_	 103
+_sk	 102
+op_	 101
+_ek	 101
+_wee	 101
+ir_	 101
+met_	 100
+_met_	 100
+rt	 100
+ik_	 99
+end	 99
+nd_	 99
+gt	 99
+ond	 98
+ot	 98
+_aa	 97
+og	 97
+vir_	 95
+vir	 95
+_ka	 94
+hu	 94
+_mo	 94
+_vir_	 94
+_vir	 94
+_dit	 93
+kr	 93
+am	 93
+ol	 93
+dit	 93
+_ek_	 93
+ki	 93
+sa	 93
+_aan	 92
+man	 92
+jy	 92
+ng_	 92
+aak	 92
+lle_	 91
+_hu	 91
+_na	 91
+_vo	 90
+ewe	 90
+of	 90
+jy_	 90
+_dit_	 90
+dit_	 90
+_jy	 89
+der_	 89
+jo	 89
+_f	 88
+_u	 88
+sie	 87
+_dat	 87
+_jy_	 87
+daa	 87
+do	 87
+vr	 87
+wi	 86
+ry	 86
+_dat_	 86
+eur	 86
+rs_	 85
+_jo	 85
+_wo	 84
+_ne	 84
+jie	 84
+ji	 84
+pe	 83
+moe	 83
+my	 82
+ull	 82
+Die	 81
+maar	 81
+_hom	 81
+ulle	 81
+_maar	 81
+hom	 81
+_uit	 80
+_ui	 80
+ges	 80
+raa	 80
+or_	 80
+ies	 80
+jou	 79
+_la	 79
+maar_	 79
+ulle_	 79
+_daa	 79
+Die_	 79
+daar	 78
+_daar	 78
+ien	 78
+_my	 78
+_jou	 78
+ok	 78
+il	 78
+lik_	 77
+sta	 77
+_Die	 77
+ur_	 77
+ga	 77
+ag_	 77
+kan	 77
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/vietnamese.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/vietnamese.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/vietnamese.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 88044
+n	 17000
+h	 12823
+t	 9071
+i	 8490
+c	 8394
+g	 8035
+ng	 6718
+_t	 6352
+_c	 5234
+a	 5083
+g_	 4883
+ng_	 4882
+_n	 4379
+n_	 4365
+i_	 4365
+u	 4149
+m	 3648
+�	 3635
+nh	 3480
+o	 3451
+�	 3193
+_�	 3168
+r	 3011
+l	 2692
+�	 2659
+,	 2328
+,_	 2295
+c_	 2279
+_l	 2263
+ch	 2226
+v	 2161
+th	 2158
+a_	 2132
+_th	 2113
+y	 2111
+.	 2107
+t_	 2106
+h_	 2074
+_v	 2057
+_h	 1888
+_m	 1834
+_ch	 1813
+s	 1749
+nh_	 1715
+u_	 1679
+�	 1668
+�_	 1649
+tr	 1611
+b	 1589
+_tr	 1581
+_nh	 1541
+_b	 1530
+m_	 1505
+p	 1483
+._	 1455
+k	 1429
+_s	 1415
+o_	 1380
+y_	 1371
+_k	 1367
+_ng	 1348
+�	 1343
+e	 1296
+�	 1208
+�	 1199
+�	 1181
+�	 1139
+�	 1132
+T	 1126
+hi	 1121
+�	 1081
+�	 1058
+�	 1055
+d	 1040
+_g	 1039
+kh	 1034
+_kh	 1027
+_T	 994
+�i	 967
+l�	 943
+_l�	 941
+"	 926
+�	 916
+ܩ	 901
+an	 893
+_d	 888
+�	 877
+�i_	 859
+on	 853
+�	 848
+N	 846
+�	 820
+�_	 813
+�	 801
+�n	 795
+ph	 776
+_p	 772
+_ph	 752
+�	 752
+�	 734
+h�	 728
+ho	 715
+v�	 709
+_v�	 703
+g�	 702
+�	 700
+_r	 696
+H	 693
+_l�_	 691
+l�_	 691
+ܩi	 684
+�n	 679
+�n	 677
+�ng	 676
+ha	 672
+gi	 663
+C	 656
+_gi	 655
+�	 654
+gܩi	 646
+gܩ	 646
+ܩi_	 624
+�ng_	 610
+ng�	 610
+_ng�	 608
+�c	 606
+�	 601
+ngܩ	 600
+ngܩi	 600
+_ngܩ	 598
+gܩi_	 594
+�a	 587
+c�	 586
+_c�	 585
+�t	 585
+c�a	 585
+�n_	 585
+_c�a	 584
+c�	 583
+�a_	 582
+_c�	 581
+c�a_	 581
+�	 581
+_c�a_	 580
+�t_	 578
+_N	 574
+c�_	 574
+�	 573
+_c�_	 572
+i�	 568
+�	 562
+�	 562
+m�	 557
+_C	 553
+_m�	 551
+p_	 540
+�	 540
+m�t	 538
+m�t_	 534
+_m�t	 532
+�n	 528
+_m�t_	 528
+ti	 526
+i�	 525
+�	 517
+�	 512
+�nh	 500
+..	 500
+�	 497
+v�_	 497
+_v�_	 496
+�	 491
+q	 490
+qu	 490
+_H	 487
+_q	 484
+_qu	 484
+ong	 481
+ong_	 471
+h�	 471
+x	 470
+h�	 468
+�	 466
+_"	 460
+ܮ	 456
+ro	 453
+�nh_	 445
+�_	 434
+_x	 434
+�_	 427
+�	 423
+_ti	 423
+in	 422
+�n	 421
+"_	 418
+i�	 415
+�n	 413
+ron	 412
+V	 411
+rong	 410
+�i	 410
+rong_	 409
+�c_	 405
+�	 400
+�n	 399
+h�n	 398
+�i	 395
+ay	 390
+_V	 387
+h�	 382
+h�	 380
+�y	 377
+�t	 376
+uy	 374
+��	 374
+_��	 373
+�i_	 372
+c�	 371
+_c�	 367
+n�	 366
+�_	 366
+h�	 366
+_n�	 365
+ra	 363
+h�ng	 362
+ho_	 359
+�n_	 356
+�n	 356
+�	 355
+�i_	 354
+ai	 352
+hu	 352
+cho	 352
+ܮc	 351
+�c	 351
+�n	 351
+_cho	 349
+tro	 347
+�t	 347
+�o	 347
+_tro	 346
+_tron	 346
+�	 346
+tron	 346
+trong	 346
+M	 345
+kh�	 340
+�u	 338
+_kh�	 338
+cho_	 337
+_cho_	 336
+h�ng_	 336
+ay_	 333
+ch_	 332
+��	 331
+�t_	 331
+(	 331
+_(	 330
+�	 329
+_��	 329
+�ܮ	 328
+_�ܮc	 328
+)	 328
+�ܮc	 328
+_�ܮ	 328
+kh�n	 324
+_�	 324
+_kh�n	 322
+��_	 322
+_��_	 320
+�	 318
+�n	 318
+kh�ng	 316
+�o_	 316
+ܮc_	 316
+�c_	 316
+nh�	 315
+�_	 315
+�ng	 313
+�ng_	 313
+�n	 313
+_nh�	 313
+Th	 312
+h�	 311
+�	 310
+h�n	 310
+h�ng_	 310
+h�ng	 310
+i�	 309
+gh	 309
+�u	 307
+ta	 307
+anh	 307
+�	 307
+ai_	 306
+�ng	 306
+�y_	 304
+�ܮc_	 298
+��	 295
+S	 295
+:	 294
+�t_	 294
+e_	 294
+:_	 290
+�_	 289
+ua	 288
+�n	 288
+�i	 286
+�u_	 285
+_nh�	 285
+nh�	 285
+nh�ng	 285
+nh�n	 285
+_nh�n	 285
+_Th	 285
+�n_	 284
+�n	 283
+�	 281
+_M	 281
+A	 281
+�c	 278
+L	 277
+�	 277
+��n	 276
+_ha	 276
+n,	 275
+�ng	 275
+��ng	 275
+an_	 272
+�i_	 271
+i�u	 269
+s�	 269
+n,_	 268
+�_	 268
+on_	 267
+_s�	 267
+c�c	 265
+�ng_	 265
+_c�c	 264
+anh_	 264
+ngh	 264
+_ta	 263
+hi_	 262
+h�n	 261
+�_	 261
+�u_	 261
+�n	 260
+�	 260
+_ngh	 257
+ia	 255
+�	 252
+...	 252
+�u	 251
+�c	 251
+i,	 249
+i�u_	 248
+nhi	 247
+B	 246
+i,_	 245
+�ng	 244
+�_	 244
+co	 244
+_nhi	 244
+�	 244
+ܧ	 244
+i�n	 243
+D	 243
+Tr	 241
+_S	 240
+h�_	 239
+�n	 237
+h�	 236
+h�	 233
+K	 233
+�ng_	 232
+�i	 232
+��ng_	 232
+�n_	 231
+_co	 231
+�n_	 229
+h�	 229
+�i	 229
+y�	 229
+�n	 229
+�n	 228
+�ng	 228
+_L	 227
+�ng_	 226
+inh	 226
+�i	 225
+m�	 225
+_�i	 225
+ng,	 224
+ang	 224
+P	 224
+�n	 224
+g,	 224
+g,_	 223
+_v�	 223
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/chinese-big5.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/chinese-big5.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/chinese-big5.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 30653
+�	 2524
+_�	 2123
+�	 1457
+�	 1406
+_�	 1245
+�	 1244
+_�	 1196
+_�	 1100
+�	 833
+M	 783
+M_	 764
+_�	 727
+�M_	 688
+�M	 688
+_�M_	 684
+_�M	 684
+�	 680
+�	 675
+�	 659
+�	 629
+�	 593
+�	 566
+_�	 560
+�	 533
+_�	 516
+�	 497
+_�	 495
+_�	 485
+�	 483
+�	 473
+�	 459
+�	 458
+�	 448
+_�	 442
+�	 436
+_�	 425
+�	 422
+_�	 422
+_�	 404
+�	 401
+�	 393
+�_	 385
+_�	 382
+_�	 374
+_�	 373
+�	 350
+C	 333
+�	 324
+��	 318
+�	 315
+_�	 314
+_�	 312
+�	 310
+��_	 303
+C_	 303
+_��	 303
+_��_	 302
+_�	 302
+@	 288
+_�	 279
+@_	 275
+�	 275
+�	 272
+_�	 269
+_�	 269
+|	 268
+Q	 265
+q	 260
+~	 260
+|_	 255
+~_	 250
+�	 241
+A	 235
+�	 234
+_�	 233
+�	 233
+�C_	 226
+�C	 226
+�_	 225
+�	 224
+_�C	 224
+_�C_	 224
+�_	 222
+A_	 218
+Q_	 217
+O	 210
+q_	 210
+D	 209
+_�	 206
+�	 202
+H	 200
+�@	 198
+�	 197
+�	 196
+O_	 196
+_�	 195
+�_	 192
+H_	 191
+�@_	 190
+_�@	 189
+_�@_	 189
+�_	 180
+�	 177
+P	 176
+D_	 175
+�	 173
+�	 172
+�_	 172
+�_	 170
+_�	 168
+�	 165
+u	 164
+_�	 162
+_�	 162
+_�|	 161
+�|	 161
+_�|_	 161
+�	 161
+L	 161
+�|_	 161
+�	 157
+p	 156
+o	 156
+�	 155
+_�	 155
+�_	 153
+�_	 151
+�A	 151
+�_	 151
+W	 151
+�Q	 151
+L_	 150
+�_	 150
+�	 149
+u_	 149
+�	 147
+�	 147
+�A_	 146
+_�	 145
+p_	 145
+�_	 143
+_�	 142
+_�A_	 142
+_�A	 142
+{	 141
+�	 140
+�	 140
+�_	 140
+P_	 139
+�_	 137
+W_	 136
+{_	 136
+�_	 135
+T	 134
+�	 134
+j	 134
+�	 132
+_�	 131
+�_	 131
+d	 130
+G	 130
+X	 130
+o_	 129
+j_	 127
+F	 126
+�_	 126
+F_	 125
+�	 124
+b	 123
+v	 122
+�	 122
+_�	 122
+�_	 121
+�_	 120
+�	 120
+d_	 120
+�_	 119
+b_	 118
+T_	 118
+�	 117
+X_	 116
+n	 116
+_�	 116
+e	 115
+�	 115
+�_	 115
+v_	 114
+w	 114
+a	 114
+�H	 114
+�_	 114
+i	 114
+�_	 113
+�_	 113
+�	 112
+�	 111
+�H_	 111
+_�H_	 110
+_�H	 110
+�	 109
+��	 109
+�_	 107
+w_	 107
+_��	 107
+��_	 106
+_��_	 106
+�_	 106
+��	 105
+�_	 105
+�	 105
+�Q_	 105
+a_	 104
+]	 104
+_�b_	 103
+_�b	 103
+h	 103
+_�Q	 103
+�b	 103
+�b_	 103
+_�Q_	 103
+�_	 102
+�	 102
+��_	 101
+��	 101
+k	 100
+_��_	 100
+e_	 100
+_��	 100
+k_	 100
+_��	 100
+��_	 100
+_��_	 100
+B	 99
+�	 99
+��	 98
+�_	 98
+s	 98
+_�	 98
+�_	 98
+�j	 98
+i_	 97
+]_	 97
+n_	 96
+�	 95
+h_	 95
+�_	 95
+U	 95
+�_	 94
+��	 94
+�j_	 94
+�_	 94
+_�j	 93
+_�j_	 93
+�q	 92
+�	 92
+�	 92
+�_	 92
+�_	 92
+�_	 91
+S	 90
+_��_	 90
+��_	 90
+_��	 90
+�	 90
+��	 89
+�	 89
+��	 88
+B_	 88
+�	 88
+_��_	 87
+_��	 87
+U_	 87
+�	 87
+��_	 87
+N	 87
+�~	 86
+_�~_	 86
+�_	 86
+�_	 86
+�	 86
+_�~	 86
+�~_	 86
+�	 85
+^	 85
+��	 84
+��_	 84
+�	 84
+�_	 84
+G_	 84
+N_	 83
+_��	 83
+_��_	 83
+_��	 83
+E	 83
+�_	 82
+��	 81
+��_	 81
+�_	 81
+��	 81
+_��_	 81
+�	 80
+�_	 80
+�_	 79
+��_	 79
+_��	 79
+_��_	 79
+�	 78
+_��	 78
+_��_	 78
+�_	 78
+��	 78
+��_	 78
+�_	 77
+S_	 77
+�O_	 77
+_�O_	 77
+_�O	 77
+_��_	 77
+��_	 77
+�_	 77
+_��	 77
+�O	 77
+�_	 77
+�_	 76
+�_	 76
+�_	 76
+�_	 75
+�	 74
+��	 72
+t	 72
+��_	 72
+_��	 72
+_��_	 72
+s_	 71
+K	 71
+�T	 71
+I	 71
+�_	 71
+��	 70
+��	 70
+��	 70
+�_	 70
+��_	 69
+�W	 69
+�_	 69
+_��_	 68
+�F_	 68
+_�F	 68
+_��_	 68
+�_	 68
+_�F_	 68
+_��	 68
+��_	 68
+��	 68
+�F	 68
+_��	 68
+�X	 67
+�	 67
+�	 66
+��_	 66
+��	 66
+J	 66
+_��_	 66
+�D	 66
+_�q	 66
+_��	 66
+_�D	 66
+l	 65
+�	 65
+z	 65
+_�W	 65
+�D_	 65
+_�D_	 65
+�	 65
+�	 65
+_�W_	 64
+�W_	 64
+�q_	 64
+J_	 64
+�_	 64
+_�q_	 64
+_�T	 63
+_�X_	 63
+�X_	 63
+_��	 63
+_�X	 63
+��_	 63
+��	 63
+_��_	 63
+��	 62
+Y	 62
+��_	 61
+�_	 61
+_��	 61
+_��_	 61
+ĵ	 61
+�_	 61
+ĵ_	 60
+_�T_	 60
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/romanian.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/romanian.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/romanian.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 20674
+a	 6376
+e	 5815
+i	 5746
+t	 3396
+r	 3280
+n	 3103
+u	 2835
+s	 2611
+c	 2582
+e_	 2235
+l	 2224
+o	 2149
+a_	 1974
+d	 1629
+m	 1528
+p	 1410
+i_	 1358
+in	 1308
+_c	 1167
+_s	 1118
+_d	 999
+re	 905
+ar	 898
+,	 791
+,_	 786
+_p	 785
+de	 771
+_a	 754
+te	 687
+_i	 667
+at	 654
+ti	 645
+ca	 639
+n_	 630
+ta	 617
+si	 614
+_de	 609
+f	 606
+st	 583
+ri	 581
+u_	 567
+nt	 553
+.	 542
+ra	 540
+_m	 534
+g	 528
+v	 516
+ul	 516
+de_	 513
+_in	 503
+b	 492
+_de_	 474
+._	 472
+le	 459
+l_	 444
+un	 443
+_si	 440
+es	 437
+tr	 426
+ea	 420
+t_	 412
+ce	 412
+ma	 407
+cu	 402
+er	 398
+_ca	 397
+si_	 388
+_f	 387
+_l	 383
+z	 382
+la	 381
+ne	 370
+sa	 364
+as	 360
+_e	 357
+in_	 356
+an	 352
+it	 351
+te_	 346
+or	 345
+el	 345
+ci	 339
+_si_	 333
+_n	 330
+are	 324
+pe	 319
+re_	 317
+al	 310
+_t	 309
+se	 304
+ic	 295
+ie	 290
+_u	 290
+ul_	 290
+ni	 289
+int	 285
+_o	 280
+en	 279
+ta_	 279
+ur	 261
+pa	 256
+co	 255
+_pe	 254
+ia	 252
+mi	 251
+pr	 249
+_ma	 249
+oa	 249
+me	 246
+lu	 246
+li	 241
+im	 238
+_in_	 237
+da	 237
+na	 237
+_sa	 235
+ac	 234
+-	 234
+ii	 232
+est	 231
+r_	 231
+h	 230
+_cu	 230
+le_	 229
+ai	 229
+ca_	 227
+il	 226
+ru	 223
+sc	 223
+_v	 221
+nu	 220
+tu	 220
+_un	 220
+nd	 220
+di	 219
+are_	 216
+to	 215
+am	 214
+on	 213
+o_	 208
+is	 208
+sa_	 203
+la_	 200
+_b	 200
+ste	 195
+et	 194
+ec	 191
+_r	 186
+car	 185
+ui	 180
+un_	 179
+lo	 178
+cu_	 177
+ei	 176
+e,	 175
+e,_	 175
+pe_	 171
+m_	 167
+_la	 166
+a,	 165
+a,_	 164
+_ce	 164
+rt	 163
+_co	 163
+ent	 162
+ro	 162
+ele	 162
+_pe_	 160
+po	 160
+ea_	 159
+"	 158
+ntr	 158
+_cu_	 158
+_pr	 157
+ut	 157
+nc	 156
+ata	 155
+care	 154
+um	 153
+au	 151
+va	 151
+_o_	 150
+_car	 150
+ii_	 145
+ind	 145
+_un_	 144
+os	 144
+ad	 141
+_la_	 140
+I	 140
+este	 138
+ste_	 138
+care_	 138
+ir	 137
+ga	 136
+ap	 136
+ol	 136
+ra_	 136
+_di	 134
+D	 134
+_care	 133
+se_	 133
+om	 133
+ara	 133
+ati	 133
+fi	 133
+_sa_	 131
+zi	 130
+vi	 130
+_ca_	 129
+_se	 128
+_nu	 128
+ai_	 127
+ch	 127
+pi	 124
+ve	 123
+fa	 122
+ot	 121
+_a_	 120
+este_	 120
+du	 119
+ine	 119
+s_	 118
+fo	 118
+_ci	 118
+ui_	 118
+ba	 118
+i,	 117
+i,_	 116
+ne_	 115
+us	 115
+_g	 115
+a.	 115
+fe	 114
+A	 114
+pu	 114
+ce_	 113
+ar_	 113
+_pa	 113
+oc	 112
+sta	 112
+lui	 112
+ns	 112
+em	 112
+'	 112
+oar	 112
+din	 111
+iu	 111
+_int	 111
+ate	 111
+mu	 111
+hi	 110
+ele_	 110
+mp	 109
+_D	 109
+S	 109
+sti	 108
+bi	 108
+ata_	 107
+ti_	 107
+tra	 107
+C	 107
+c_	 106
+tre	 106
+_al	 105
+rea	 105
+mai	 105
+j	 104
+a._	 104
+gi	 104
+e.	 103
+d_	 103
+_fa	 103
+E	 102
+mo	 102
+at_	 101
+_e_	 101
+nte	 101
+lt	 101
+sp	 101
+za	 100
+mai_	 100
+su	 99
+na_	 98
+tat	 97
+sin	 97
+ez	 96
+tru	 96
+e._	 96
+ie_	 96
+ia_	 96
+_re	 96
+tul	 96
+_fo	 96
+ina	 95
+art	 95
+_C	 95
+no	 95
+nu_	 94
+_es	 94
+_po	 94
+cr	 94
+inc	 93
+_da	 92
+_mai	 92
+lui_	 92
+_din	 92
+_est	 92
+pre	 91
+_mai_	 91
+io	 91
+chi	 91
+ge	 90
+pri	 90
+eu	 90
+uri	 90
+az	 90
+_nu_	 89
+_me	 89
+ct	 89
+au_	 88
+esc	 88
+ev	 88
+ei_	 88
+min	 87
+ace	 87
+op	 86
+ng	 86
+ici	 86
+_lu	 85
+ari	 85
+_mi	 84
+ita	 84
+_S	 84
+_tr	 84
+ere	 83
+or_	 83
+ast	 83
+ist	 83
+nt_	 83
+_se_	 82
+ou	 82
+tin	 82
+intr	 82
+con	 82
+do	 81
+_fi	 81
+str	 81
+am_	 80
+rat	 80
+ru_	 80
+ri_	 80
+par	 80
+oi	 80
+uc	 79
+ze	 79
+pl	 79
+res	 78
+_ac	 77
+ulu	 77
+din_	 76
+va_	 76
+ada	 76
+ului	 75
+_con	 75
+id	 75
+inte	 74
+ile	 73
+cit	 73
+_din_	 73
+lor	 73
+_"	 72
+ig	 72
+rin	 72
+da_	 72
+_st	 72
+-_	 71
+_-	 71
+it_	 71
+ani	 71
+nd_	 71
+ci_	 70
+ag	 70
+eri	 70
+i.	 70
+tru_	 70
+_ne	 70
+rm	 70
+P	 69
+_este	 69
+nta	 69
+bu	 69
+une	 69
+ma_	 69
+nti	 69
+imp	 68
+_-_	 68
+iv	 68
+ind_	 68
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/tamil.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/tamil.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/tamil.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 11468
+�	 2697
+�	 2533
+�	 1960
+�	 1786
+�	 1249
+�	 1103
+�	 990
+�	 976
+�	 849
+�	 847
+�	 831
+�	 821
+�	 794
+�	 758
+�	 750
+�	 721
+�	 715
+�	 713
+.	 702
+�_	 671
+�	 655
+�	 648
+�	 625
+._	 611
+�	 601
+�	 571
+�	 557
+��	 556
+�	 524
+_�	 520
+�	 518
+_�	 492
+�	 489
+_�	 488
+�	 484
+_�	 482
+�	 461
+�	 442
+�	 418
+�	 416
+�	 403
+�_	 398
+��	 373
+_�	 368
+�	 360
+�	 359
+_�	 349
+��	 348
+��	 342
+�	 337
+_�	 331
+�	 331
+�_	 323
+_�	 321
+��	 320
+_�	 310
+տ	 308
+�	 299
+��	 294
+�	 292
+��	 292
+��	 290
+է	 288
+��	 284
+�_	 279
+�	 271
+��	 266
+��	 265
+_�	 265
+��	 241
+_�	 234
+��	 232
+=	 231
+�	 229
+��	 227
+==	 221
+��	 218
+�_	 218
+է_	 213
+===	 211
+�_	 210
+====	 201
+�_	 199
+�_	 198
+��	 197
+=====	 191
+,	 188
+ؽ	 188
+��	 187
+�	 186
+_�	 184
+,_	 184
+�	 183
+ԯ	 181
+�_	 179
+Ԩ	 178
+�	 172
+��_	 171
+�	 169
+��	 168
+���	 165
+��	 165
+�_	 165
+�	 164
+�	 161
+�_	 160
+ͨ	 160
+_ͨ	 157
+�	 156
+_�	 156
+��	 152
+Դ	 152
+ٻ	 151
+�	 150
+_�	 149
+�	 149
+�	 146
+��	 146
+ؽ�	 145
+��	 143
+�	 142
+׶	 142
+��	 142
+��	 140
+�_	 139
+ԧ	 138
+_��	 138
+��	 138
+��	 137
+ը	 137
+�_	 136
+��	 133
+_׶	 132
+��	 128
+���	 128
+��	 127
+��	 127
+_�	 127
+�	 127
+_ؽ	 127
+��	 125
+��	 125
+��	 124
+��	 122
+��	 121
+ޣ	 120
+��	 119
+��	 119
+׽	 119
+��	 119
+_�	 118
+�_	 118
+�.	 117
+���	 116
+�տ	 115
+��	 115
+_��	 113
+�.	 113
+׻	 113
+�._	 112
+��_	 112
+��	 111
+ա	 111
+��	 109
+״	 109
+�	 109
+�._	 108
+_��	 107
+մ	 106
+�_	 105
+��	 104
+'	 104
+��	 103
+�_	 102
+��	 102
+ش	 101
+��	 100
+��	 100
+_��	 99
+_׻	 99
+��	 98
+���	 98
+�	 98
+_׽	 97
+�_	 97
+Ի	 97
+_���	 97
+Ԩ_	 97
+�_	 97
+�	 96
+��	 96
+״�	 96
+�Ԩ	 95
+�ޣ	 94
+տ_	 94
+ػ	 94
+�	 94
+��	 93
+�	 93
+_ؽ�	 93
+��	 93
+ը_	 92
+��_	 91
+��	 91
+_��	 90
+��	 90
+��	 90
+��	 90
+_��	 90
+���	 90
+ٹ	 89
+_��	 89
+_��_	 88
+_��	 88
+��_	 88
+�_	 86
+硴	 86
+��	 86
+��	 85
+��	 85
+���	 84
+��	 84
+��	 83
+ԥ	 83
+�	 83
+_�	 83
+��	 82
+�_	 81
+Դ_	 81
+�.	 80
+_��	 80
+�է	 80
+�	 80
+��	 80
+�_	 79
+���	 79
+_��	 79
+��	 79
+ԣ	 79
+��	 78
+�_	 78
+�._	 77
+_��	 77
+���	 77
+_��	 77
+�	 77
+��	 76
+ޣ_	 75
+��_	 75
+پ	 75
+¯	 75
+��	 74
+��	 73
+��	 72
+�	 72
+��_	 71
+ԧ_	 71
+��	 71
+��	 71
+��	 70
+�է	 70
+���	 70
+��	 69
+ٻ_	 69
+��	 69
+��	 69
+�_	 68
+��	 68
+ؾ	 67
+_ش	 67
+բ	 66
+��	 66
+�Ԩ_	 66
+�	 66
+_ǻ	 66
+ǻ	 66
+Թ	 66
+�	 66
+�է_	 65
+��	 65
+_��	 64
+�.	 64
+��	 63
+ե	 63
+ԡ	 63
+_״	 63
+_�	 63
+ٴ	 62
+���	 62
+տ�	 62
+�._	 61
+����	 61
+_��	 61
+_׻�	 61
+׻�	 61
+���	 61
+��	 60
+��տ	 60
+_�	 60
+_����	 60
+Ծ	 60
+��	 59
+׶�	 59
+�ޣ_	 59
+��	 59
+_��	 58
+��_	 58
+��	 58
+��	 58
+��	 58
+���տ	 58
+��	 58
+��	 57
+�ԯ	 57
+��	 57
+��	 57
+_��	 57
+�	 56
+��	 56
+_׶�	 55
+?	 55
+��	 54
+��	 54
+��	 54
+���	 54
+_״�	 54
+����	 53
+�տ_	 53
+_�	 53
+���	 53
+����	 53
+硴�	 52
+��	 52
+��_	 52
+��	 51
+�_	 51
+'_	 51
+_��	 51
+��	 51
+ͨ�	 51
+��	 51
+�	 51
+�	 51
+_ͨ�	 51
+�_	 51
+տ�	 51
+��	 51
+_ɧ	 50
+ɧ	 50
+��	 50
+�է_	 50
+׽�	 50
+���	 50
+��	 49
+�_	 49
+��	 49
+���	 49
+��	 49
+��_	 49
+���	 48
+�ԧ	 48
+�	 48
+ա�	 48
+դ	 48
+��	 48
+��	 48
+�տ	 48
+_�硴	 47
+�_	 47
+�	 47
+ͨ�_	 47
+׶ԧ	 47
+�硴	 47
+�_	 47
+_ͨ�_	 47
+?_	 46
+ؿ	 46
+Կ	 46
+_ػ	 46
+��	 46
+_�	 46
+���_	 46
+�	 45
+���_	 45
+�ٻ	 45
+��	 45
+��	 45
+_׽�	 44
+��	 44
+ԣ_	 44
+���	 44
+��	 44
+�	 44
+��	 44
+���	 44
+�ԣ	 44
+�.	 44
+_׶ԧ	 43
+��	 43
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/danish.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/danish.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/danish.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 21274
+e	 9291
+r	 5307
+n	 4733
+i	 3976
+t	 3948
+s	 3751
+a	 3296
+l	 3063
+d	 3025
+o	 2868
+g	 2471
+er	 2164
+k	 2002
+m	 1680
+e_	 1655
+en	 1613
+f	 1507
+de	 1484
+r_	 1379
+v	 1245
+u	 1176
+t_	 1081
+n_	 1032
+er_	 992
+b	 942
+.	 870
+ge	 868
+._	 831
+re	 816
+h	 816
+et	 813
+te	 813
+p	 806
+in	 788
+or	 775
+_s	 753
+_a	 749
+en_	 712
+_e	 691
+ti	 689
+an	 687
+,	 681
+,_	 677
+_f	 655
+_d	 645
+el	 642
+ng	 635
+nd	 634
+g_	 634
+se	 615
+le	 615
+st	 607
+s_	 601
+_o	 572
+ne	 560
+li	 537
+et_	 524
+es	 521
+_i	 512
+ri	 511
+sk	 510
+_de	 498
+�	 497
+ar	 475
+ed	 473
+ig	 463
+at	 452
+_m	 446
+is	 443
+fo	 441
+�	 441
+ve	 438
+_k	 434
+�	 432
+der	 429
+ke	 428
+ing	 427
+og	 426
+_b	 412
+me	 408
+il	 407
+for	 405
+ns	 394
+y	 389
+_h	 380
+_t	 374
+on	 371
+d_	 370
+al	 362
+be	 359
+_fo	 351
+af	 336
+de_	 335
+_og	 333
+_p	 332
+og_	 325
+om	 325
+_for	 324
+_og_	 313
+l_	 308
+nge	 302
+i_	 295
+_v	 294
+c	 289
+ter	 283
+ll	 280
+ni	 278
+nde	 278
+rs	 277
+_af	 277
+un	 275
+ra	 271
+ko	 271
+den	 270
+_i_	 268
+id	 265
+til	 265
+j	 265
+vi	 264
+D	 260
+ere	 256
+ma	 255
+si	 253
+f_	 252
+af_	 238
+_af_	 235
+ik	 235
+m_	 234
+�_	 232
+_ti	 227
+_D	 226
+_u	 226
+_er	 225
+nt	 224
+_en	 224
+ls	 221
+es_	 216
+lig	 216
+ger	 216
+re_	 210
+ag	 210
+_me	 207
+at_	 204
+lle	 200
+ge_	 200
+_til	 200
+ige	 199
+_er_	 199
+der_	 199
+em	 199
+ds	 197
+r.	 195
+io	 195
+r._	 195
+ud	 193
+_at	 192
+_at_	 191
+ta	 190
+els	 190
+_l	 190
+ha	 190
+il_	 189
+or_	 189
+ke_	 186
+rt	 185
+gen	 184
+ka	 183
+-	 180
+rk	 180
+ning	 178
+ol	 178
+nin	 178
+la	 177
+ld	 175
+De	 175
+it	 173
+ede	 172
+ed_	 171
+_ko	 171
+lse	 171
+ek	 168
+else	 167
+inge	 167
+p�	 167
+ng_	 167
+_p�	 167
+iv	 166
+�r	 166
+so	 165
+he	 165
+ens	 165
+ske	 165
+ind	 164
+til_	 163
+rn	 163
+ide	 162
+ev	 162
+den_	 162
+to	 162
+sen	 160
+_be	 160
+sa	 160
+bl	 158
+_g	 158
+an_	 157
+det	 156
+om_	 156
+ru	 156
+va	 155
+_til_	 155
+ste	 154
+rd	 153
+_p�_	 152
+k_	 152
+p�_	 152
+di	 152
+kr	 152
+K	 151
+_De	 149
+for_	 148
+te_	 148
+kon	 148
+ver	 147
+mm	 146
+am	 146
+_en_	 145
+_r	 145
+ne_	 144
+ing_	 144
+tr	 143
+le_	 142
+del	 142
+_in	 142
+gt	 140
+_st	 138
+S	 138
+eg	 138
+gs	 138
+tt	 138
+r,	 137
+ser	 137
+r,_	 137
+er.	 137
+ro	 137
+er._	 137
+_for_	 136
+ent	 136
+kt	 136
+eri	 135
+ur	 134
+lin	 134
+B	 133
+A	 133
+sti	 133
+ner	 133
+da	 133
+ris	 132
+ion	 132
+_K	 131
+ern	 131
+ers	 130
+ist	 130
+�r	 130
+ige_	 130
+_si	 130
+tte	 129
+E	 128
+_n	 128
+nn	 127
+_B	 126
+_ha	 126
+_.	 126
+rne	 125
+H	 125
+_ud	 125
+rin	 124
+na	 124
+und	 124
+ft	 124
+_der	 124
+ku	 123
+_A	 122
+ler	 120
+and	 120
+end	 120
+ns_	 120
+rg	 119
+op	 119
+er,_	 119
+er,	 119
+ar_	 118
+P	 118
+_S	 117
+_H	 117
+_._	 116
+ov	 116
+erne	 115
+tio	 115
+med	 115
+tion	 115
+_E	 115
+_P	 115
+det_	 114
+pr	 114
+e.	 113
+ter_	 113
+:	 113
+kk	 113
+e._	 113
+e,_	 113
+e,	 113
+od	 113
+kke	 113
+ten	 113
+ling	 113
+:_	 112
+mi	 112
+eli	 112
+lo	 111
+som	 111
+_den	 111
+rb	 110
+se_	 110
+ell	 110
+sid	 110
+nne	 109
+fi	 108
+lt	 107
+v_	 107
+_de_	 107
+ark	 106
+lige	 106
+ngen	 106
+ie	 105
+_med	 105
+_der_	 105
+ring	 105
+a_	 105
+_vi	 104
+-_	 104
+ys	 103
+gel	 103
+_so	 103
+ia	 103
+ive	 102
+ej	 101
+ati	 101
+ren	 101
+_det	 101
+side	 101
+ske_	 101
+br	 100
+gi	 100
+F	 100
+M	 100
+ul	 99
+isk	 99
+men	 99
+n,_	 99
+age	 99
+fr	 99
+n,	 99
+tu	 98
+ts	 98
+_ma	 98
+nder	 98
+ot	 97
+dt	 97
+R	 97
+med_	 96
+ho	 96
+ans	 95
+_kon	 95
+pe	 95
+ce	 94
+gr	 93
+mme	 92
+ret	 92
+lige_	 92
+mu	 91
+_med_	 91
+hv	 91
+v�	 91
+Det	 91
+ens_	 91
+kl	 91
+_M	 90
+T	 90
+ingen	 90
+rm	 90
+ill	 89
+elle	 89
+ef	 89
+ene	 89
+nds	 89
+ove	 89
+som_	 89
+C	 88
+_den_	 88
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/middle_frisian.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/middle_frisian.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/middle_frisian.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 60524
+e	 20138
+n	 10664
+t	 8674
+i	 7833
+a	 7549
+o	 7278
+r	 6963
+n_	 5391
+s	 5087
+d	 4731
+t_	 4327
+l	 4306
+e_	 4271
+en	 4068
+k	 3483
+m	 3346
+g	 2990
+er	 2965
+en_	 2835
+y	 2597
+w	 2481
+h	 2475
+j	 2441
+_d	 2375
+r_	 2250
+u	 2059
+s_	 1921
+ie	 1780
+_h	 1725
+z	 1710
+de	 1666
+_m	 1652
+_w	 1629
+_i	 1611
+et	 1550
+te	 1540
+b	 1538
+.	 1517
+er_	 1481
+in	 1420
+an	 1408
+p	 1392
+f	 1311
+,	 1280
+,_	 1273
+k_	 1266
+._	 1258
+y_	 1238
+_z	 1230
+oe	 1162
+v	 1144
+et_	 1138
+ne	 1131
+ee	 1125
+st	 1120
+_o	 1107
+_s	 1107
+_e	 1076
+_n	 1068
+_b	 989
+_t	 988
+l_	 983
+oo	 981
+ge	 975
+je	 963
+_g	 952
+at	 949
+me	 946
+ij	 943
+is	 913
+he	 899
+'	 892
+aa	 882
+el	 870
+_v	 864
+re	 843
+ar	 837
+_de	 805
+on	 800
+ke	 796
+de_	 788
+ei	 782
+_a	 776
+_'	 770
+le	 744
+at_	 742
+it	 741
+_k	 738
+or	 734
+an_	 729
+in_	 723
+da	 715
+te_	 703
+_he	 680
+_l	 664
+H	 661
+al	 652
+_H	 652
+a_	 650
+_da	 648
+D	 648
+d_	 646
+_D	 643
+es	 617
+g_	 608
+is_	 606
+�	 596
+_f	 594
+'t	 591
+_'t	 584
+'t_	 583
+_me	 580
+c	 576
+_'t_	 576
+ri	 571
+_en	 564
+yn	 563
+_en_	 559
+ze	 538
+m_	 535
+om	 535
+ik	 522
+_de_	 522
+ed	 521
+be	 517
+wi	 509
+ch	 509
+ol	 498
+ar_	 498
+ha	 496
+_ne	 495
+we	 494
+ou	 486
+nd	 474
+ma	 474
+ik_	 470
+J	 459
+_ik	 456
+_ik_	 451
+_J	 451
+ll	 450
+M	 446
+li	 443
+wa	 442
+_M	 442
+ien	 435
+ro	 432
+di	 421
+nn	 418
+ste	 415
+wo	 415
+yn_	 415
+_r	 413
+_ha	 411
+it_	 409
+tt	 408
+ve	 407
+S	 404
+_j	 399
+_S	 398
+_in	 395
+as	 395
+der	 395
+hi	 389
+_al	 388
+uw	 384
+tte	 384
+ng	 381
+_wi	 381
+nne	 381
+het	 380
+_het	 378
+lle	 376
+nt	 374
+ns	 373
+op	 373
+je_	 367
+E	 366
+ek	 363
+B	 363
+dat	 362
+_B	 362
+_ma	 362
+_in_	 361
+_dat	 359
+_wo	 359
+ier	 358
+og	 357
+_E	 354
+_ge	 352
+dat_	 349
+ne_	 349
+eer	 349
+het_	 348
+_het_	 348
+_is	 348
+_dat_	 348
+ey	 347
+W	 346
+_W	 343
+_te	 339
+eg	 337
+ra	 335
+rs	 335
+!	 332
+zi	 332
+gt	 329
+_He	 327
+He	 327
+_be	 324
+j_	 320
+ij_	 320
+u_	 319
+f_	 317
+_di	 316
+;	 315
+_we	 315
+_is_	 314
+rt	 313
+!_	 313
+;_	 312
+n.	 311
+p_	 310
+la	 310
+_wa	 310
+ea	 308
+_u	 308
+pe	 304
+ta	 304
+il	 301
+my	 300
+ig	 300
+n,	 300
+n,_	 298
+iet	 297
+sc	 297
+ter	 296
+sch	 296
+oor	 295
+no	 294
+_my	 293
+n._	 291
+ti	 290
+_zi	 289
+st_	 288
+el_	 283
+gen	 282
+se	 280
+K	 279
+_oo	 278
+ui	 278
+e,	 275
+ten	 274
+net	 274
+oon	 274
+ho	 274
+jn	 273
+e,_	 273
+ijn	 272
+ien_	 272
+ko	 272
+N	 271
+ni	 271
+_N	 269
+den	 269
+za	 268
+_net	 267
+i_	 266
+wol	 266
+een	 264
+va	 264
+am	 264
+do	 263
+ol_	 262
+le_	 261
+_te_	 260
+rd	 260
+ke_	 259
+ey_	 259
+ers	 258
+_K	 255
+_ie	 255
+ver	 254
+to	 254
+_hi	 253
+nde	 253
+:	 253
+der_	 252
+jo	 251
+net_	 251
+al_	 250
+_wol	 250
+_p	 250
+_no	 250
+aar	 248
+_za	 245
+_net_	 245
+nk	 242
+est	 241
+om_	 241
+_va	 241
+ak	 241
+tj	 239
+ae	 238
+_op	 237
+mo	 236
+tr	 236
+_st	 233
+ier_	 233
+_ve	 233
+mm	 232
+T	 231
+eu	 229
+_ze	 228
+:_	 228
+mi	 228
+ag	 227
+zo	 227
+_ko	 226
+vo	 225
+_T	 225
+nne_	 225
+F	 224
+..	 224
+fo	 224
+_F	 223
+en,	 223
+oe_	 222
+wie	 222
+en,_	 221
+kk	 221
+_ien	 220
+on_	 218
+wol_	 218
+_fo	 218
+I	 217
+_do	 216
+eit	 214
+ei_	 214
+mme	 214
+G	 213
+_I	 213
+as_	 213
+or_	 211
+A	 211
+_G	 210
+_A	 210
+lle_	 209
+Da	 208
+_Da	 207
+_wol_	 207
+ren	 206
+_ee	 206
+e.	 205
+van	 205
+jen	 205
+een_	 205
+_van	 204
+kke	 204
+en.	 204
+O	 204
+_vo	 204
+V	 203
+_O	 203
+_V	 203
+ken	 203
+_mo	 203
+ot	 202
+ie_	 201
+ou_	 201
+ur	 201
+tte_	 200
+em	 200
+_van_	 199
+L	 199
+van_	 199
+_zo	 199
+op_	 199
+_L	 197
+iet_	 196
+of	 194
+ten_	 194
+oer	 193
+_ien_	 193
+e._	 193
+oed	 192
+hie	 192
+zy	 191
+en._	 191
+De	 191
+_ver	 191
+_ho	 189
+_De	 189
+oa	 189
+den_	 188
+_zy	 188
+lo	 187
+dan	 187
+nt_	 186
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/serbian-ascii.lm
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/serbian-ascii.lm	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/language_fp/serbian-ascii.lm	(revision 258)
@@ -0,0 +1,400 @@
+_	 34122
+a	 9113
+o	 8135
+i	 7736
+e	 7535
+n	 5207
+s	 4860
+j	 3995
+t	 3797
+r	 3660
+u	 3224
+l	 3065
+d	 3061
+e_	 2941
+v	 2786
+a_	 2746
+k	 2701
+m	 2492
+o_	 2328
+y	 2238
+p	 2151
+_s	 2148
+i_	 2094
+je	 1887
+c	 1854
+z	 1731
+_n	 1437
+_p	 1432
+g	 1418
+b	 1368
+u_	 1333
+je_	 1237
+,	 1226
+,_	 1214
+_i	 1130
+st	 1105
+na	 1076
+.	 1056
+_d	 1033
+._	 1030
+_j	 967
+ra	 934
+ko	 908
+ni	 900
+cy	 893
+sy	 875
+_je	 871
+_o	 824
+ta	 799
+no	 780
+_u	 777
+re	 766
+_b	 764
+_k	 763
+da	 760
+ne	 754
+li	 750
+ti	 745
+se	 722
+po	 713
+to	 713
+_je_	 696
+an	 688
+ja	 683
+pr	 665
+va	 651
+lo	 634
+_z	 626
+m_	 625
+is	 625
+il	 622
+ov	 621
+la	 621
+_m	 615
+bi	 604
+_t	 603
+_po	 594
+en	 586
+_se	 578
+os	 578
+in	 576
+od	 576
+ka	 552
+ve	 548
+ij	 538
+_pr	 536
+al	 536
+vo	 535
+om	 530
+_i_	 525
+nj	 515
+ed	 509
+_na	 507
+na_	 503
+og	 499
+oj	 498
+ma	 493
+_bi	 492
+on	 489
+ak	 482
+im	 481
+ye	 481
+ro	 480
+vi	 473
+sa	 469
+ri	 464
+da_	 451
+av	 450
+at	 449
+se_	 447
+es	 446
+h	 443
+ao	 441
+ji	 437
+yi	 436
+_da	 433
+ad	 432
+_se_	 430
+lj	 428
+zy	 426
+za	 426
+_ne	 425
+de	 422
+tr	 417
+cj	 415
+_u_	 414
+_c	 412
+le	 402
+_v	 397
+ar	 390
+_g	 390
+ic	 384
+n_	 382
+ju	 379
+lo_	 377
+aj	 376
+_ko	 369
+ao_	 366
+ek	 361
+_da_	 359
+et	 356
+go	 354
+iz	 346
+_za	 345
+_r	 344
+or	 342
+mo	 341
+el	 340
+as	 339
+ik	 336
+te	 332
+_sa	 329
+d_	 323
+am	 320
+me	 318
+sto	 317
+di	 315
+ec	 311
+ol	 310
+a,_	 307
+a,	 307
+_ni	 302
+ya	 296
+do	 295
+yt	 294
+su	 292
+syt	 289
+li_	 288
+sta	 286
+ije	 284
+ko_	 277
+ti_	 277
+la_	 277
+ga	 276
+bil	 275
+no_	 274
+a.	 273
+nu	 272
+a._	 271
+ne_	 271
+om_	 268
+_cy	 266
+_na_	 263
+_bil	 263
+sv	 263
+ru	 259
+to_	 256
+_od	 253
+cyi	 253
+nje	 251
+it	 251
+pa	 250
+az	 248
+e,_	 245
+e,	 245
+ob	 244
+dn	 243
+ac	 242
+ost	 242
+k_	 240
+iv	 239
+io	 238
+_su	 238
+_iz	 237
+ilo	 235
+_sv	 234
+_ka	 233
+koj	 231
+mi	 229
+im_	 229
+ije_	 227
+g_	 226
+em	 223
+su_	 223
+ih	 223
+ji_	 221
+kr	 220
+ut	 220
+_koj	 220
+V	 218
+_st	 218
+ye_	 217
+_l	 214
+_V	 213
+ovo	 211
+j_	 210
+uc	 208
+ja_	 208
+h_	 207
+nij	 206
+sk	 206
+ot	 203
+io_	 203
+gl	 203
+_do	 201
+ok	 200
+ns	 199
+ilo_	 199
+er	 197
+ih_	 195
+pre	 193
+ci	 193
+og_	 193
+ki	 192
+sl	 191
+t_	 189
+ni_	 189
+_a	 189
+vr	 188
+ati	 187
+_su_	 186
+nije	 181
+pro	 181
+be	 180
+yn	 179
+cye	 178
+ju_	 178
+ku	 177
+isy	 177
+ta_	 174
+sye	 172
+_tr	 172
+O	 172
+jen	 172
+_to	 171
+pi	 168
+_pre	 168
+S	 168
+ima	 167
+nije_	 167
+_mo	 166
+eg	 166
+e._	 164
+za_	 164
+e.	 164
+_pro	 164
+gov	 163
+N	 162
+dr	 162
+ako	 162
+tv	 162
+_S	 160
+P	 159
+ma_	 159
+_on	 159
+sp	 158
+nst	 158
+anj	 158
+dj	 157
+oc	 157
+_sy	 156
+ev	 155
+ce	 155
+lik	 154
+_nij	 153
+_N	 152
+ist	 151
+_P	 151
+_nije	 151
+-	 151
+ba	 150
+jed	 150
+sti	 150
+ova	 149
+_is	 148
+id	 148
+ton	 148
+ke	 147
+pos	 147
+od_	 147
+osy	 146
+Vi	 146
+ila	 145
+ins	 145
+bo	 145
+_Vi	 145
+ir	 144
+_za_	 144
+oz	 144
+ecj	 144
+cje	 143
+on_	 143
+zn	 142
+_O	 141
+us	 141
+i,	 141
+i,_	 141
+mu	 140
+inst	 140
+cya	 140
+oji	 139
+esy	 139
+icy	 139
+lja	 138
+_go	 138
+i.	 138
+_re	 137
+_bilo	 137
+edn	 137
+acy	 137
+rat	 137
+bilo	 137
+ali	 136
+ecy	 136
+ija	 135
+pri	 135
+ad_	 135
+lic	 135
+i._	 135
+Vins	 134
+Vin	 134
+ston	 134
+Vinst	 134
+ga_	 134
+nston	 134
+insto	 134
+nsto	 134
+_Vins	 133
+_Vin	 133
+zi	 132
+ran	 131
+le_	 130
+ili	 130
+bilo_	 130
+_pos	 129
+ila_	 129
+est	 128
+_ve	 128
+tre	 128
+zye	 127
+_nj	 127
+si	 126
+f	 126
+alo	 125
+ako_	 125
+tra	 125
+sa_	 125
+pu	 124
+ud	 124
+z_	 124
+_ra	 124
+iti	 124
+_de	 124
+odi	 123
+T	 123
+-_	 122
+o,_	 121
+o,	 121
+du	 121
+rs	 121
+B	 120
+ka_	 119
+red	 119
+_od_	 118
+an_	 118
+nu_	 118
+iko	 117
+dno	 117
+_pa	 117
+s_	 116
Index: tmp/org.txm.core/res/org/knallgrau/utils/textcat/textcat.conf
===================================================================
--- tmp/org.txm.core/res/org/knallgrau/utils/textcat/textcat.conf	(revision 0)
+++ tmp/org.txm.core/res/org/knallgrau/utils/textcat/textcat.conf	(revision 258)
@@ -0,0 +1,15 @@
+org/knallgrau/utils/textcat/language_fp/german.lm	german
+org/knallgrau/utils/textcat/language_fp/english.lm	english
+org/knallgrau/utils/textcat/language_fp/french.lm	french
+org/knallgrau/utils/textcat/language_fp/spanish.lm	spanish
+org/knallgrau/utils/textcat/language_fp/italian.lm	italian
+org/knallgrau/utils/textcat/language_fp/swedish.lm	swedish
+org/knallgrau/utils/textcat/language_fp/polish.lm	polish
+org/knallgrau/utils/textcat/language_fp/dutch.lm	dutch
+org/knallgrau/utils/textcat/language_fp/norwegian.lm	norwegian
+org/knallgrau/utils/textcat/language_fp/finnish.lm	finnish
+org/knallgrau/utils/textcat/language_fp/albanian.lm	albanian
+org/knallgrau/utils/textcat/language_fp/slovak-ascii.lm	slovakian
+org/knallgrau/utils/textcat/language_fp/slovenian-ascii.lm	slovenian
+org/knallgrau/utils/textcat/language_fp/danish.lm	danish
+org/knallgrau/utils/textcat/language_fp/hungarian.lm	hungarian
Index: tmp/org.txm.core/res/org/txm/images/icons/center.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.core/res/org/txm/images/icons/center.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.core/res/org/txm/images/icons/in.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.core/res/org/txm/images/icons/in.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.core/res/org/txm/images/icons/out.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.core/res/org/txm/images/icons/out.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.core/res/org/txm/images/icons/help.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.core/res/org/txm/images/icons/help.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.core/res/org/txm/images/icons/movement-controls.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.core/res/org/txm/images/icons/movement-controls.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.core/res/org/txm/ts/tigersearch.logprop
===================================================================
--- tmp/org.txm.core/res/org/txm/ts/tigersearch.logprop	(revision 0)
+++ tmp/org.txm.core/res/org/txm/ts/tigersearch.logprop	(revision 258)
@@ -0,0 +1,13 @@
+
+# Default log configuration of the TIGERSearch suite
+
+log4j.rootLogger=WARN,Logfile
+log4j.logger.ims.tiger.gui.tigersearch.TIGERSearch=INFO
+
+log4j.appender.Logfile=org.apache.log4j.RollingFileAppender
+log4j.appender.Logfile.File=${user.home}/tigersearch/tigersearch.log
+log4j.appender.Logfile.MaxFileSize=500KB
+log4j.appender.Logfile.MaxBackupIndex=1
+
+log4j.appender.Logfile.layout=org.apache.log4j.PatternLayout
+log4j.appender.Logfile.layout.ConversionPattern=%5r %-5p [%t] %c{2} - %m%n
Index: tmp/org.txm.core/res/org/txm/css/transcriber.css
===================================================================
--- tmp/org.txm.core/res/org/txm/css/transcriber.css	(revision 0)
+++ tmp/org.txm.core/res/org/txm/css/transcriber.css	(revision 258)
@@ -0,0 +1,58 @@
+body
+{
+	padding-top:25px;
+	padding-bottom:25px;
+	padding-right:10px;
+	padding-left:10px;
+}
+
+.comment
+{
+	font-style:italic;
+	font-weight:normal;
+}
+
+.turn
+{
+
+}
+
+.spk
+{
+	font-variant: small-caps ; 
+}
+
+.event
+{
+	font-style:italic;
+}
+
+b .event
+{
+	font-style:italic;
+	font-weight:normal;
+}
+
+
+.sync
+{
+	vertical-align: super; 
+	font-weight:normal;
+	font-size: 70%;
+}
+table
+{
+margin-left: auto;
+margin-right: auto;
+margin-bottom: 50px;
+}
+
+td
+{
+padding: 5px;
+}
+
+h2
+{
+text-align: center;
+}
Index: tmp/org.txm.core/res/org/txm/css/doc.css
===================================================================
--- tmp/org.txm.core/res/org/txm/css/doc.css	(revision 0)
+++ tmp/org.txm.core/res/org/txm/css/doc.css	(revision 258)
@@ -0,0 +1,40 @@
+body {
+	padding-top:25px;
+	padding-bottom:25px;
+	padding-right:10px;
+	padding-left:10px;
+	width:600px;
+}
+
+table {
+	border: medium solid black;
+	border-collapse: collapse;
+	width: 100%;
+}
+
+th {
+	font-family: monospace;
+	border: thin solid black;
+	padding: 5px;
+	background-color: #D0E3FA;
+	background-image: url(sky.jpg);
+}
+
+td {
+	font-family: sans-serif;
+	border: thin solid black;
+	width: 50%;
+	padding: 5px;
+	text-align: center;
+	background-color: #ffffff;
+}
+
+h2 {
+
+}
+
+img {
+	display: block;
+	margin: 0 auto; 
+	padding: 5px;
+}
\ No newline at end of file
Index: tmp/org.txm.core/res/org/txm/css/tmx.css
===================================================================
--- tmp/org.txm.core/res/org/txm/css/tmx.css	(revision 0)
+++ tmp/org.txm.core/res/org/txm/css/tmx.css	(revision 258)
@@ -0,0 +1,38 @@
+body
+{
+	padding-top:25px;
+	padding-bottom:25px;
+	padding-right:10px;
+	padding-left:10px;
+}
+
+table
+{
+margin-left: auto;
+margin-right: auto;
+margin-bottom: 50px;
+}
+
+td
+{
+padding: 5px;
+}
+
+.header {
+
+}
+
+.tuTitle
+{
+text-align: center;
+}
+
+.seg
+{
+	
+}
+
+.note
+{
+	color:red;
+}
\ No newline at end of file
Index: tmp/org.txm.core/res/org/txm/css/txm.css
===================================================================
--- tmp/org.txm.core/res/org/txm/css/txm.css	(revision 0)
+++ tmp/org.txm.core/res/org/txm/css/txm.css	(revision 258)
@@ -0,0 +1,46 @@
+.txmeditionpage {
+	box-shadow: .3125em .3125em .625em 0 #888;
+	margin: 1.25em auto;
+	padding: 1.25em;
+	width: 100%
+	height: 100%
+}
+
+.txmeditionpb {
+
+}
+
+.txmeditionpb::before {
+	content: "- "
+}
+
+.txmeditionpb::after {
+	content: " -"
+}
+
+h2 {
+    font-variant: small-caps;
+	text-align: center
+}
+
+p {
+    	text-indent: 0.2cm;
+	text-align: justify;
+    	text-justify: inter-word
+}
+
+img {
+    margin: 10px 10px 10px 10px
+}
+
+td[rend="table-cell-align-right"] {
+	text-align: right
+}
+
+td[rend="table-cell-align-left"] {
+	text-align: left
+}
+
+td[rend="table-cell-align-center"] {
+	text-align: center
+}
\ No newline at end of file
Index: tmp/org.txm.core/res/org/txm/js/test_sel.html
===================================================================
--- tmp/org.txm.core/res/org/txm/js/test_sel.html	(revision 0)
+++ tmp/org.txm.core/res/org/txm/js/test_sel.html	(revision 258)
@@ -0,0 +1,27 @@
+<!doctype html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Demo</title>
+</head>
+<body>
+<button >TEST SELECTION</button>
+<script src="http://code.jquery.com/jquery-latest.js"></script>
+<script src="jquery.selection.js"></script>
+<script>
+$( document ).ready(function() {
+$( "button" ).click(function( event ) {
+var sel = window.getSelection()
+alert( $(sel).find("span");
+event.preventDefault();
+
+
+});
+});
+</script>
+
+<p>
+<span id="w_0" title="un">un</span> <span id="w_1" title="premier">premier</span> <span id="w_2" title="mot">mot</span>
+</p>
+</body>
+</html>

Property changes on: tmp/org.txm.core/res/org/txm/js/test_sel.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/js/jquery.selection.js
===================================================================
--- tmp/org.txm.core/res/org/txm/js/jquery.selection.js	(revision 0)
+++ tmp/org.txm.core/res/org/txm/js/jquery.selection.js	(revision 258)
@@ -0,0 +1,354 @@
+/*!
+ * jQuery.selection - jQuery Plugin
+ *
+ * Copyright (c) 2010-2014 IWASAKI Koji (@madapaja).
+ * http://blog.madapaja.net/
+ * Under The MIT License
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+(function($, win, doc) {
+    /**
+     * get caret status of the selection of the element
+     *
+     * @param   {Element}   element         target DOM element
+     * @return  {Object}    return
+     * @return  {String}    return.text     selected text
+     * @return  {Number}    return.start    start position of the selection
+     * @return  {Number}    return.end      end position of the selection
+     */
+    var _getCaretInfo = function(element){
+        var res = {
+            text: '',
+            start: 0,
+            end: 0
+        };
+
+        if (!element.value) {
+            /* no value or empty string */
+            return res;
+        }
+
+        try {
+            if (win.getSelection) {
+                /* except IE */
+                res.start = element.selectionStart;
+                res.end = element.selectionEnd;
+                res.text = element.value.slice(res.start, res.end);
+            } else if (doc.selection) {
+                /* for IE */
+                element.focus();
+
+                var range = doc.selection.createRange(),
+                    range2 = doc.body.createTextRange();
+
+                res.text = range.text;
+
+                try {
+                    range2.moveToElementText(element);
+                    range2.setEndPoint('StartToStart', range);
+                } catch (e) {
+                    range2 = element.createTextRange();
+                    range2.setEndPoint('StartToStart', range);
+                }
+
+                res.start = element.value.length - range2.text.length;
+                res.end = res.start + range.text.length;
+            }
+        } catch (e) {
+            /* give up */
+        }
+
+        return res;
+    };
+
+    /**
+     * caret operation for the element
+     * @type {Object}
+     */
+    var _CaretOperation = {
+        /**
+         * get caret position
+         *
+         * @param   {Element}   element         target element
+         * @return  {Object}    return
+         * @return  {Number}    return.start    start position for the selection
+         * @return  {Number}    return.end      end position for the selection
+         */
+        getPos: function(element) {
+            var tmp = _getCaretInfo(element);
+            return {start: tmp.start, end: tmp.end};
+        },
+
+        /**
+         * set caret position
+         *
+         * @param   {Element}   element         target element
+         * @param   {Object}    toRange         caret position
+         * @param   {Number}    toRange.start   start position for the selection
+         * @param   {Number}    toRange.end     end position for the selection
+         * @param   {String}    caret           caret mode: any of the following: "keep" | "start" | "end"
+         */
+        setPos: function(element, toRange, caret) {
+            caret = this._caretMode(caret);
+
+            if (caret === 'start') {
+                toRange.end = toRange.start;
+            } else if (caret === 'end') {
+                toRange.start = toRange.end;
+            }
+
+            element.focus();
+            try {
+                if (element.createTextRange) {
+                    var range = element.createTextRange();
+
+                    if (win.navigator.userAgent.toLowerCase().indexOf("msie") >= 0) {
+                        toRange.start = element.value.substr(0, toRange.start).replace(/\r/g, '').length;
+                        toRange.end = element.value.substr(0, toRange.end).replace(/\r/g, '').length;
+                    }
+
+                    range.collapse(true);
+                    range.moveStart('character', toRange.start);
+                    range.moveEnd('character', toRange.end - toRange.start);
+
+                    range.select();
+                } else if (element.setSelectionRange) {
+                    element.setSelectionRange(toRange.start, toRange.end);
+                }
+            } catch (e) {
+                /* give up */
+            }
+        },
+
+        /**
+         * get selected text
+         *
+         * @param   {Element}   element         target element
+         * @return  {String}    return          selected text
+         */
+        getText: function(element) {
+            return _getCaretInfo(element).text;
+        },
+
+        /**
+         * get caret mode
+         *
+         * @param   {String}    caret           caret mode
+         * @return  {String}    return          any of the following: "keep" | "start" | "end"
+         */
+        _caretMode: function(caret) {
+            caret = caret || "keep";
+            if (caret === false) {
+                caret = 'end';
+            }
+
+            switch (caret) {
+                case 'keep':
+                case 'start':
+                case 'end':
+                    break;
+
+                default:
+                    caret = 'keep';
+            }
+
+            return caret;
+        },
+
+        /**
+         * replace selected text
+         *
+         * @param   {Element}   element         target element
+         * @param   {String}    text            replacement text
+         * @param   {String}    caret           caret mode: any of the following: "keep" | "start" | "end"
+         */
+        replace: function(element, text, caret) {
+            var tmp = _getCaretInfo(element),
+                orig = element.value,
+                pos = $(element).scrollTop(),
+                range = {start: tmp.start, end: tmp.start + text.length};
+
+            element.value = orig.substr(0, tmp.start) + text + orig.substr(tmp.end);
+
+            $(element).scrollTop(pos);
+            this.setPos(element, range, caret);
+        },
+
+        /**
+         * insert before the selected text
+         *
+         * @param   {Element}   element         target element
+         * @param   {String}    text            insertion text
+         * @param   {String}    caret           caret mode: any of the following: "keep" | "start" | "end"
+         */
+        insertBefore: function(element, text, caret) {
+            var tmp = _getCaretInfo(element),
+                orig = element.value,
+                pos = $(element).scrollTop(),
+                range = {start: tmp.start + text.length, end: tmp.end + text.length};
+
+            element.value = orig.substr(0, tmp.start) + text + orig.substr(tmp.start);
+
+            $(element).scrollTop(pos);
+            this.setPos(element, range, caret);
+        },
+
+        /**
+         * insert after the selected text
+         *
+         * @param   {Element}   element         target element
+         * @param   {String}    text            insertion text
+         * @param   {String}    caret           caret mode: any of the following: "keep" | "start" | "end"
+         */
+        insertAfter: function(element, text, caret) {
+            var tmp = _getCaretInfo(element),
+                orig = element.value,
+                pos = $(element).scrollTop(),
+                range = {start: tmp.start, end: tmp.end};
+
+            element.value = orig.substr(0, tmp.end) + text + orig.substr(tmp.end);
+
+            $(element).scrollTop(pos);
+            this.setPos(element, range, caret);
+        }
+    };
+
+    /* add jQuery.selection */
+    $.extend({
+        /**
+         * get selected text on the window
+         *
+         * @param   {String}    mode            selection mode: any of the following: "text" | "html"
+         * @return  {String}    return
+         */
+        selection: function(mode) {
+            var getText = ((mode || 'text').toLowerCase() === 'text');
+
+            try {
+                if (win.getSelection) {
+                    if (getText) {
+                        // get text
+                        return win.getSelection().toString();
+                    } else {
+                        // get html
+                        var sel = win.getSelection(), range;
+
+                        if (sel.getRangeAt) {
+                            range = sel.getRangeAt(0);
+                        } else {
+                            range = doc.createRange();
+                            range.setStart(sel.anchorNode, sel.anchorOffset);
+                            range.setEnd(sel.focusNode, sel.focusOffset);
+                        }
+
+                        return $('<div></div>').append(range.cloneContents()).html();
+                    }
+                } else if (doc.selection) {
+                    if (getText) {
+                        // get text
+                        return doc.selection.createRange().text;
+                    } else {
+                        // get html
+                        return doc.selection.createRange().htmlText;
+                    }
+                }
+            } catch (e) {
+                /* give up */
+            }
+
+            return '';
+        }
+    });
+
+    /* add selection */
+    $.fn.extend({
+        selection: function(mode, opts) {
+            opts = opts || {};
+
+            switch (mode) {
+                /**
+                 * selection('getPos')
+                 * get caret position
+                 *
+                 * @return  {Object}    return
+                 * @return  {Number}    return.start    start position for the selection
+                 * @return  {Number}    return.end      end position for the selection
+                 */
+                case 'getPos':
+                    return _CaretOperation.getPos(this[0]);
+
+                /**
+                 * selection('setPos', opts)
+                 * set caret position
+                 *
+                 * @param   {Number}    opts.start      start position for the selection
+                 * @param   {Number}    opts.end        end position for the selection
+                 */
+                case 'setPos':
+                    return this.each(function() {
+                        _CaretOperation.setPos(this, opts);
+                    });
+
+                /**
+                 * selection('replace', opts)
+                 * replace the selected text
+                 *
+                 * @param   {String}    opts.text            replacement text
+                 * @param   {String}    opts.caret           caret mode: any of the following: "keep" | "start" | "end"
+                 */
+                case 'replace':
+                    return this.each(function() {
+                        _CaretOperation.replace(this, opts.text, opts.caret);
+                    });
+
+                /**
+                 * selection('insert', opts)
+                 * insert before/after the selected text
+                 *
+                 * @param   {String}    opts.text            insertion text
+                 * @param   {String}    opts.caret           caret mode: any of the following: "keep" | "start" | "end"
+                 * @param   {String}    opts.mode            insertion mode: any of the following: "before" | "after"
+                 */
+                case 'insert':
+                    return this.each(function() {
+                        if (opts.mode === 'before') {
+                            _CaretOperation.insertBefore(this, opts.text, opts.caret);
+                        } else {
+                            _CaretOperation.insertAfter(this, opts.text, opts.caret);
+                        }
+                    });
+
+                /**
+                 * selection('get')
+                 * get selected text
+                 *
+                 * @return  {String}    return
+                 */
+                case 'get':
+                    /* falls through */
+                default:
+                    return _CaretOperation.getText(this[0]);
+            }
+
+            return this;
+        }
+    });
+})(jQuery, window, window.document);
Index: tmp/org.txm.core/res/org/txm/js/viewer/toolbar-ext.css
===================================================================
--- tmp/org.txm.core/res/org/txm/js/viewer/toolbar-ext.css	(revision 0)
+++ tmp/org.txm.core/res/org/txm/js/viewer/toolbar-ext.css	(revision 258)
@@ -0,0 +1,43 @@
+.toolbar {
+	display: inline-block;
+	position: absolute;
+	right: 3px;
+	top: 3px;
+	z-index: 5;
+}
+.toolbarButton {
+	margin: 0 2px;
+	cursor: pointer;
+}
+.helptext {
+	-webkit-border-radius: 7px;
+	-khtml-border-radius: 7px;
+	-moz-border-radius: 7px;
+	border-radius: 7px;
+	background-color: #fff;
+	border:1px dotted #D0D0D0;
+	color:#404040;
+	font-size:12px;
+	height:150px;
+	overflow:auto;
+	padding:5px;
+	position:absolute;
+	right:11px;
+	top:11px;
+	width:300px;
+	z-index: 5;
+}
+.toolbar hr {
+	border-top: 0px solid #fff;
+	border-left: 0px solid #fff;
+	border-right: 0px solid #fff;
+	border-bottom: 1px dotted #808080;
+	margin: 1px 0px 7px 0px;
+}
+.movement-controls {
+	position: absolute;
+	right: 3px;
+	bottom: 3px;
+	z-index: 4;
+	border: 0 solid #FFFFFF;
+}
\ No newline at end of file
Index: tmp/org.txm.core/res/org/txm/js/viewer/toolbar-ext.js
===================================================================
--- tmp/org.txm.core/res/org/txm/js/viewer/toolbar-ext.js	(revision 0)
+++ tmp/org.txm.core/res/org/txm/js/viewer/toolbar-ext.js	(revision 258)
@@ -0,0 +1,136 @@
+viewer.toolbarImages="images/toolbar"
+viewer.toolbar = function(self) {
+	var toolbar = document.createElement('div');
+	toolbar.className='toolbar';
+	
+	var isEnterKey = function(event) {
+		var keyCode;
+		if(event.keyCode) // IE
+			keyCode = event.keyCode, event.returnValue = false;
+		else if(event.which) // Netscape/Firefox/Opera
+			keyCode = event.which, event.preventDefault();
+		return keyCode==13;
+	}
+	
+	var zoomIn = document.createElement('img');
+	zoomIn.className='toolbarButton';
+	zoomIn.title='Zoom in';
+	zoomIn.tabIndex="1";
+	zoomIn.src=viewer.toolbarImages+'/in.png';
+	zoomIn.onclick = zoomIn.onkeypress = function(event) {
+		event=event?event:window.event;
+		if (event.type == 'keypress') 
+			if(!isEnterKey(event))
+				return;
+		var frameDimension = self.getFrameDimension();
+		self.zoomTo(self.getZoomLevel()+1, frameDimension[0]/2,frameDimension[1]/2);
+	}
+	
+	var zoomOut = document.createElement('img');
+	zoomOut.className='toolbarButton';
+	zoomOut.title='Zoom out';
+	zoomOut.tabIndex="1";
+	zoomOut.src=viewer.toolbarImages+'/out.png';
+	zoomOut.onclick = zoomOut.onkeypress = function(event) {
+		event=event?event:window.event;
+		if (event.type == 'keypress') 
+			if(!isEnterKey(event))
+				return;
+		
+		var frameDimension = self.getFrameDimension();
+		self.zoomTo(self.getZoomLevel()-1, frameDimension[0]/2,frameDimension[1]/2);
+	}
+	
+	var center = document.createElement('img');
+	center.className='toolbarButton';
+	center.title='Center image';
+	center.tabIndex="1";
+	center.src=viewer.toolbarImages+'/center.png';
+	center.onclick = center.onkeypress = function(event) {
+		event=event?event:window.event;
+		if (event.type == 'keypress') 
+			if(!isEnterKey(event))
+				return;
+		self.reset();
+	}
+	
+	var help = document.createElement('img');
+	help.className='toolbarButton';
+	help.tabIndex="1";
+	help.src=viewer.toolbarImages+'/help.png';
+	var helpText = document.createElement('div');
+	helpText.className='helpText';
+	helpText.style.display='none';
+	helpText.innerHTML = '<h5 style="color:#40C0FF; font-size:12px; margin:2px 0;">How to use the image viewer?</h5>';
+	helpText.innerHTML = helpText.innerHTML + "Zooming<hr> Use the mouse wheel or the toolbar to zoom in/out. You can also zoom IN using '+','x' or '=' keys and zoom OUT using '-' or 'z' keys using the keyboard.";
+	helpText.innerHTML = helpText.innerHTML + "<br><br>Panning<hr> Click and drag the mouse to pan the image or use 'w','s','a' and 'd' keys for moving up,down,left and right respectively.<br>Alternatively you can use the arrow buttons to pan the image.";
+	helpText.innerHTML = helpText.innerHTML + "<br><br>Center Image<hr> Click on the 'Center image' icon on the toolbar or press 'c' to center image.";
+	
+	help.onclick = help.onkeypress = function(event) {
+		event=event?event:window.event;
+		if (event.type == 'keypress') 
+			if(!isEnterKey(event))
+				return;
+		if (helpText.style.display == 'none')
+			helpText.style.display = 'block';
+		else
+			helpText.style.display = 'none';
+	}
+	
+	var controls = document.createElement('img');
+	controls.className='movement-controls';
+	controls.src=viewer.toolbarImages+'/movement-controls.png';
+	controls.useMap="#controls";
+	var map = document.createElement('map');
+	map.name="controls";
+	
+	var up=document.createElement('area');
+	up.shape='rect';
+	up.coords="17,1,31,17";
+	up.style.cursor='pointer';
+	up.onmousedown = function() {
+		var dimension = self.getFrameDimension();
+		self.moveBy(0,dimension[1]*0.1); //10%
+	}
+	map.appendChild(up);
+	
+	var down=document.createElement('area');
+	down.shape='rect';
+	down.coords="17,31,31,47";
+	down.style.cursor='pointer';
+	down.onmousedown = function() {
+		var dimension = self.getFrameDimension();
+		self.moveBy(0,-1*dimension[1]*0.1);
+	}
+	map.appendChild(down);
+	
+	var left=document.createElement('area');
+	left.shape='rect';
+	left.coords="1,17,17,31";
+	left.style.cursor='pointer';
+	left.onmousedown = function() {
+		var dimension = self.getFrameDimension();
+		self.moveBy(dimension[0]*0.1,0);
+	}
+	map.appendChild(left);
+	
+	var right=document.createElement('area');
+	right.shape='rect';
+	right.coords="31,17,47,31";
+	right.style.cursor='pointer';
+	right.onmousedown = function() {
+		var dimension = self.getFrameDimension();
+		self.moveBy(-1*dimension[0]*0.1,0);
+	}
+	map.appendChild(right);
+	
+	toolbar.appendChild(zoomIn);
+	toolbar.appendChild(zoomOut);
+	toolbar.appendChild(center);
+	toolbar.appendChild(help);
+	toolbar.appendChild(helpText);
+	
+	self.frameElement.appendChild(toolbar);
+	self.frameElement.appendChild(controls);
+	self.frameElement.appendChild(map);
+}
\ No newline at end of file
Index: tmp/org.txm.core/res/org/txm/js/viewer/Simple_Viewer_beta_1.1-min-focus.js
===================================================================
--- tmp/org.txm.core/res/org/txm/js/viewer/Simple_Viewer_beta_1.1-min-focus.js	(revision 0)
+++ tmp/org.txm.core/res/org/txm/js/viewer/Simple_Viewer_beta_1.1-min-focus.js	(revision 258)
@@ -0,0 +1,666 @@
+/**
+ *  Simple Javascript Image 
+
+    Copyright (C) 2010  Munawwar Firoz
+
+    This program 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 3 of the License, or
+    (at your option) any later version.
+
+    This program 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 (http://www.gnu.org/licenses/)
+*/
+function getObjectXY(object) {
+	var left,top;
+	objectCopy=object;
+	if (object.offsetParent) {
+		left=top=0;
+		do {
+			left += object.offsetLeft;
+			if(object.style.borderLeftWidth!='')
+				left+=parseInt(object.style.borderLeftWidth);
+			else
+				object.style.borderLeftWidth='0px';
+			top += object.offsetTop;
+			if(object.style.borderTopWidth!='')
+				top+=parseInt(object.style.borderTopWidth);
+			else
+				object.style.borderTopWidth='0px';
+		}
+		while (object = object.offsetParent);
+	}
+	return [left-parseInt(objectCopy.style.borderLeftWidth),top-parseInt(objectCopy.style.borderLeftWidth)];
+}
+
+//String compare (Case-sensitive)
+function strcmp(string1,string2) {
+	return (string1.length===string2.length && string1.indexOf(string2)!=-1);
+}
+//String compare (Case-insensitive)
+function strcmpi(string1,string2) {
+	return (string1.length===string2.length && string1.toLowerCase().indexOf(string2.toLowerCase())!=-1);
+}
+//string1 should end with string2 to return true (Case-insensitive)
+function strEndsWith(string1,string2) {
+	var index=string1.length-string2.length;
+	return (string1.toLowerCase().lastIndexOf(string2.toLowerCase(),index)==index);
+}
+//Returns the constructor (which is a function) name
+function returnDataType(object) {
+	if(typeof object==='undefined')
+		return 'undefined';
+	if(typeof object==='null')
+		return 'null';
+	code=new String(object.constructor);
+	return code.substring( code.indexOf(' ')+1, code.indexOf('(') );
+}
+//Verifies wether the datatype of a variable is as you expect it to be
+function verifyDataType(object,Datatype_expected_in_string) {
+	return strcmpi( returnDataType(object), Datatype_expected_in_string );
+}
+function retInt(str, suffix) {
+	if(typeof str=='number')
+		return str;
+	var result=str.indexOf(suffix);
+	return parseInt(str.substring(0,(result!=-1)?result:str.length))
+}
+
+/*Mouse related functions*/
+//Used to retrieve the mouse cursor position on screen (but event is needed as argument)
+function getMouseXY(event) {
+	var posx = 0, posy = 0;
+	if (!event) event = window.event;	//firefox
+	if (event.pageX || event.pageY) {
+		posx = event.pageX;
+		posy = event.pageY;
+	}
+	else if (event.clientX || event.clientY) {	//IE
+		posx = event.clientX + document.body.scrollLeft
+			+ document.documentElement.scrollLeft;
+		posy = event.clientY + document.body.scrollTop
+			+ document.documentElement.scrollTop;
+	}
+	return [posx,posy];
+}
+
+function mouseWheel() {
+	var self=this;
+	/*Event handlers*/
+	/*Mouse wheel functions*/
+
+	//Default mouse wheel callback function
+	//Variable local to 'this'
+	var wheelCallback = function(event,object,delta){
+		/*Override this function and write your code there*/
+		/*
+			delta=-1 when mouse wheel is rolled backwards (towards yourself)
+			delta=1 when mouse wheel is rolled forward (away from one's self)
+			Note: Here is where you can call the getMouseXY function using the 'event' argument
+		*/
+	}
+	//Mouse wheel event handler
+	self.wheelHandler = function (event){
+		var delta = 0;
+		if (!event) //For IE
+			event = window.event;
+		if (event.wheelDelta) 	//IE
+		{
+			delta = event.wheelDelta/120;
+			//if (window.opera) delta = -delta; //for Opera...hmm I read somewhere opera 9 need the delta sign inverted...tried in opera 10 and it doesnt require this!?
+		}
+		else if (event.detail) //firefox
+			delta = -event.detail/3;
+
+		if (event.preventDefault)
+			event.preventDefault();
+		event.returnValue = false;
+		if (delta)
+			wheelCallback(event,this,delta);	//callback function
+	}
+	//Mouse wheel initialization
+	self.init = function(object,callback) {
+		if (object.addEventListener) //For firefox
+			object.addEventListener('DOMMouseScroll', this.wheelHandler, false); //Mouse wheel initialization
+		//For IE
+		object.onmousewheel = this.wheelHandler; //Mouse wheel initialization
+		wheelCallback=callback;
+	}
+	this.setCallback = function(callback){
+		wheelCallback=callback;
+	}
+}
+
+//Debugging
+function debug_msgs() {
+	this.counter=0;
+	this.clear=function() {
+		var div=document.getElementById('debug');
+		div.innerHTML='';
+		this.counter=0;
+	}
+	this.print=function(string) {
+	var div=document.getElementById('debug');
+		div.innerHTML+=string;
+	}
+	this.println=function(string) {
+		var div=document.getElementById('debug');
+		div.innerHTML+=string+'<br>';
+		this.counter++;
+	}
+}
+var debug=new debug_msgs();
+
+/*-------------The image viewer--------------*/
+function viewer(arguments) //argument array
+{
+	var self=this;
+
+	/*Properties*/
+	//Public access
+	self.outerFrame=null;
+	
+	//Private access
+	var image=null,imageSource=null,parent=null,replace=null,preLoader=null;
+	var frame=['400px','400px',true]; //Format: ['width in px or % (number)','height in px or % (number)', auto adjust frameElement to image (boolean)]
+	var borderClass=null;
+	var zoomFactor='10%'; //10% increase per zoom in			
+	var maxZoom='300%'; //Either 'percentage' or ['max width in pixel', 'max height in pixel']
+
+	/*Set user defined properties and configurations*/
+	/*
+		The following configurations are for pure javascript image viewers:
+			imageSource : string - Source to the image you want to show
+			
+			parent : HTMLElement - The parent element of the image viewer
+			or
+			replace: HTMLElement - The image viewer replace this HTML element
+			(Exactly one of the above two properties is absolutly needed)
+			
+			preLoader (optional) : string - Source to a pre-loader image. Useful in case of large images
+			
+		The following configurations are for partial javascript/partial HTML image viewers:
+			image - HTMLElement - The reference to the image HTML element
+		
+		Common to both:
+			frame - An array of format [width, height, widthIsMax, heightIsMax]
+				width and height are strings like '400px' or '100%'. width and height can be in px or %
+				widthIsMax and heightIsMax are optional boolean values. 
+				Say if widthIsMax is set to true, it treats the width as the maximum width limit.
+				So if the zoomed image isn't fitting exactly into the frameElement, the frameElement dimension is reduced and adjusted to fit the image.
+			
+			zoomFactor (optional) - number - Decides the amount zoomed per zoom event. Default is set to 10 (in %)
+			maxZoom (optional) - Sets the makimum image zoom in percentage or pixels. Format :Either 'percentage' or ['max width in pixel', 'max height in pixel']
+				Example: '150%' or ['500px,'500px']
+	*/
+	var key;
+	for (key in arguments) {
+		var temp=arguments[key];
+		eval(key + '=temp;');
+	}
+
+	/*Internal states,HTML elements and properties*/
+	self.frameElement = null;
+	var orignalW,orignalH, zoomLevel=1;
+	var lastMousePosition=null, speed=5;
+	var mouseWheelObject=null;
+	
+	/*Methods*/
+	self.getFrameDimension =  function() {
+		return [self.frameElement.clientWidth,self.frameElement.clientHeight];
+	}				
+	self.setDimension = function(width,height) { //width and height of image
+		image.width=Math.round(width);
+		image.height=Math.round(height);
+	}
+	self.getDimension =  function() {
+		return [image.width,image.height];
+	}
+	self.setPosition = function(x,y) { //x and y coordinate of image
+		image.style.left=(Math.round(x)+'px');
+		image.style.top=(Math.round(y)+'px');
+
+		self.updateFocusPosition();
+	}
+	self.getPosition = function() {
+		return [retInt(image.style.left,'px'),retInt(image.style.top,'px')];
+	}
+	self.setMouseCursor = function() {
+		var dimension = self.getDimension();
+		var frameDimension =  self.getFrameDimension();
+		
+		var cursor='crosshair';
+		if(dimension[0]>frameDimension[0] && dimension[1]>frameDimension[1])
+			cursor='move';
+		else if(dimension[0]>frameDimension[0])
+			cursor='e-resize';
+		else if(dimension[1]>frameDimension[1])
+			cursor='n-resize';
+		
+		image.style.cursor=cursor;
+	}
+	self.maxZoomCheck = function(width,height) {
+		if(typeof width=='undefined' || typeof height=='undefined') {
+			var temp = self.getDimension();
+			width=temp[0], height=temp[1];
+		}
+		if(typeof maxZoom=='number') {
+			return ((width/orignalW)>maxZoom || (height/orignalH)>maxZoom);
+		}
+		else if(typeof maxZoom=='object') {
+			return (width>maxZoom[0] || height>maxZoom[1]);
+		}
+	}
+	self.fitToFrame = function(width, height) { //width and height of image
+		if(typeof width=='undefined' || typeof height=='undefined') {
+			width=orignalW, height=orignalH;
+		}
+		var frameDimension = self.getFrameDimension(), newWidth,newHeight;
+		
+		newWidth = frameDimension[0];
+		newHeight = Math.round((newWidth*height)/width);
+		if(newHeight>(frameDimension[1])) {
+			newHeight = frameDimension[1];
+			newWidth = Math.round((newHeight*width)/height); 
+		}
+		return [newWidth,newHeight];
+		//return [width, height]; // to not resize the image but can't set zoom < 100%
+	}
+	self.getZoomLevel = function() {
+		return zoomLevel;
+	}
+	self.zoomTo = function(newZoomLevel, x, y) {
+		var frameDimension = self.getFrameDimension();
+		//check if x and y coordinate is within the self.frameElement
+		if(newZoomLevel<0 || x<0 || y<0 || x>=frameDimension[0] || y>=frameDimension[1])
+			return false;
+		
+		var dimension = self.fitToFrame(orignalW,orignalH);
+		for(var i=newZoomLevel; i>0;i--) {
+			dimension[0] *= zoomFactor;
+			dimension[1] *= zoomFactor;
+		}
+		
+		//Calculate percentage increase/decrease and fix the image over given x,y coordinate
+		var curWidth=image.width, curHeight=image.height;
+		var position = self.getPosition();
+		
+		//The Maths
+		/*
+			New point/Old point = New image width/Old image width
+		=>	New point = New width/Old width * Old point
+			
+			Difference between new and old point 
+			= New point - Old point
+			= New width/Old width * Old point - Old point
+			= Old Point * (New width/Old width - 1)
+			
+			Moving the image by this difference brings the zoomed image to the same (pivot) point.
+			
+			The point (x,y) sent into this function is relative to the self.frameElement. However, it should be relative to the image for the above formula to work.
+			Hence, point = (x-left, y-top).
+		*/
+		position[0]-=((x-position[0])*((dimension[0]/curWidth)-1));
+		position[1]-=((y-position[1])*((dimension[1]/curHeight)-1)); //Applying the above formula
+		
+		//Center image
+		position = self.centerImage(dimension[0],dimension[1], position[0],position[1]);
+		
+		//Set dimension and position
+		if(!self.maxZoomCheck(dimension[0],dimension[1])) {
+			zoomLevel = newZoomLevel;
+			self.setDimension(dimension[0],dimension[1]);
+			self.setPosition(position[0],position[1]);
+			self.setMouseCursor();
+		}
+		else
+			return false;
+		return true;
+	}
+	self.centerImage = function(width,height, x,y) { //width and height of image and (x,y) is the (left,top) of the image
+		if(typeof width=='undefined' || typeof height=='undefined') {
+			var temp = self.getDimension();
+			width=temp[0], height=temp[1];
+		}
+		if(typeof x=='undefined' || typeof y=='undefined') {
+			var temp = self.getPosition();
+			x=temp[0], y=temp[1];
+		}
+			
+		var frameDimension = self.getFrameDimension();
+		
+		if(width<=frameDimension[0])
+			x = Math.round((frameDimension[0] - width)/2);
+		if(height<=frameDimension[1])
+			y = Math.round((frameDimension[1] - height)/2);
+
+		if(width>frameDimension[0]) {
+			if(x>0)
+				x=0;
+			else
+			if((x+width)<frameDimension[0])
+				x=frameDimension[0]-width;
+		}
+
+		if(height>frameDimension[1]) {
+			if(y>0)
+				y=0;
+			else
+			if((y+height)<frameDimension[1])
+				y=frameDimension[1]-height;
+		}
+
+		return [x,y];
+	}
+	self.relativeToAbsolute = function(x,y) {
+		if(x<0 || y<0 || x>=self.frameElement.clientWidth || y>=self.frameElement.clientHeight)
+			return null;
+		return [x-retInt(image.style.left,'px'),y-retInt(image.style.top,'px')];
+	}
+	self.reset = function() {
+		var dimension = self.fitToFrame(orignalW,orignalH);
+		var position = self.centerImage(dimension[0],dimension[1], 0,0);
+		self.setDimension(dimension[0],dimension[1]);
+		self.setPosition(position[0],position[1]);
+		zoomLevel=0;
+	}
+	self.moveBy = function(x,y) {
+		var position = self.getPosition();
+		position = self.centerImage(image.width,image.height, position[0]+x,position[1]+y);
+		self.setPosition(position[0],position[1]);
+	}
+	self.hide = function() {
+		if(self.outerFrame)
+			self.outerFrame.style.display='none';
+		else
+			self.frameElement.style.display = 'none';
+	}
+	self.show = function() {
+		if(self.outerFrame)
+			self.outerFrame.style.display='block';
+		else
+			self.frameElement.style.display = 'block';
+	}
+
+	//Experimental
+	self.moveTo = function(x,y) { //Coordinates relative to (left,top) of image
+		if(x<0 || y<0 || x>=image.width || y>=image.height)
+			return;
+		var left = self.frameElement.clientWidth/2-x, top = self.frameElement.clientHeight/2-y;
+		var position = self.centerImage(image.width,image.height, left,top);
+		self.setPosition(position[0],position[1]);
+	}
+
+	/*User defined events*/
+	//Non-static events
+	self.onload = null;
+	
+	/*Event handlers*/
+	self.onmousewheel = function(event,object,direction) {
+		self.frameElement.focus();
+		if (!event) //For IE
+			event=window.event, event.returnValue = false;
+		else
+		if (event.preventDefault)
+			event.preventDefault();
+		
+		if((zoomLevel+direction)>=0) {
+			var mousePos = getMouseXY(event);
+			var framePos = getObjectXY(self.frameElement);
+			self.zoomTo(zoomLevel+direction, mousePos[0]-framePos[0], mousePos[1]-framePos[1]);
+		}
+	}
+	self.onmousemove = function(event) {
+		if (!event) //For IE
+			event=window.event, event.returnValue = false;
+		else
+		if (event.preventDefault)
+			event.preventDefault();
+		
+		var mousePosition=getMouseXY(event);
+		var position = self.getPosition();
+		position[0]+=(mousePosition[0]-lastMousePosition[0]), position[1]+=(mousePosition[1]-lastMousePosition[1]);
+		lastMousePosition=mousePosition;
+		
+		position = self.centerImage(image.width,image.height, position[0],position[1]);
+		self.setPosition(position[0],position[1]);
+	}
+	self.onmouseup_or_out = function(event) {
+		if (!event) //For IE
+			event=window.event, event.returnValue = false;
+		else
+		if (event.preventDefault)
+			event.preventDefault();
+		
+		image.onmousemove=image.onmouseup=image.onmouseout=null;
+		image.onmousedown=self.onmousedown;
+	}
+	self.onmousedown =  function(event) {
+		self.frameElement.focus();
+		if (!event) //For IE
+			event=window.event, event.returnValue = false;
+		else
+		if (event.preventDefault)
+			event.preventDefault();
+	
+		lastMousePosition=getMouseXY(event);
+		image.onmousemove = self.onmousemove;
+		image.onmouseup=image.onmouseout=self.onmouseup_or_out;
+	}
+	self.onkeypress = function(event) {
+		var keyCode;
+		if(window.event) // IE
+			event=window.event, keyCode = event.keyCode, event.returnValue = false;
+		else
+		if(event.which) // Netscape/Firefox/Opera
+			keyCode = event.which, event.preventDefault();
+		
+		keyCode = String.fromCharCode(keyCode);
+		
+		var position = self.getPosition();
+		var LEFT='a',UP='w',RIGHT='d',DOWN='s', CENTER_IMAGE='c', ZOOMIN='=', ZOOMOUT='-'; ///Keys a,w,d,s
+		if(keyCode==LEFT)
+			position[0]+=speed;
+		else if(keyCode==UP)
+			position[1]+=speed;
+		else if(keyCode==RIGHT)
+			position[0]-=speed;
+		else if(keyCode==DOWN)
+			position[1]-=speed;
+		else if(keyCode==CENTER_IMAGE || keyCode=='C')
+			self.reset();
+		else if(keyCode==ZOOMIN || keyCode=='+' || keyCode=='x' || keyCode=='X')
+			self.zoomTo(zoomLevel+1, self.frameElement.clientWidth/2, self.frameElement.clientHeight/2);
+		else if( (keyCode==ZOOMOUT || keyCode=='z' || keyCode=='Z') && zoomLevel>0)
+			self.zoomTo(zoomLevel-1, self.frameElement.clientWidth/2, self.frameElement.clientHeight/2);
+		
+		if(keyCode==LEFT || keyCode==UP || keyCode==RIGHT || keyCode==DOWN) {
+			position = self.centerImage(image.width,image.height, position[0],position[1]);
+			self.setPosition(position[0],position[1]);
+			speed+=2;
+		}
+	}
+	self.onkeyup = function(event) {
+		speed=5;
+	}
+	/*Initialization*/
+	self.setZoomProp = function(newZoomFactor,newMaxZoom) {
+		if(newZoomFactor==null)
+			zoomFactor=10;
+		zoomFactor=1 + retInt(newZoomFactor,'%')/100;
+		
+		if(typeof newMaxZoom=='string')
+			maxZoom = retInt(newMaxZoom,'%')/100;
+		else if(typeof newMaxZoom=='object' && newMaxZoom!=null) {
+			maxZoom[0]=retInt(newMaxZoom[0],'px');
+			maxZoom[1]=retInt(newMaxZoom[1],'px');
+		}
+		else maxZoom='300%';
+	}
+	self.setFrameProp = function(newFrameProp) {
+		self.frameElement.style.width=newFrameProp[0];
+		self.frameElement.style.height=newFrameProp[1];
+	}
+	self.initImage = function() {
+		image.style.maxWidth=image.style.width=image.style.maxHeight=image.style.height=null;
+		orignalW=image.width;
+		orignalH=image.height;
+
+		var dimension=self.fitToFrame(orignalW, orignalH);
+		self.setDimension(dimension[0],dimension[1]);
+		
+		if(frame[2]==true)
+			self.frameElement.style.width=(Math.round(dimension[0])+ 'px');
+		if(frame[3]==true)
+			self.frameElement.style.height=(Math.round(dimension[1]) + 'px');
+		var pos = self.centerImage(dimension[0],dimension[1], 0,0);
+		self.setPosition(pos[0],pos[1]);
+		self.setMouseCursor();
+		
+		var fitImageWidthToFrame = true;
+		if (fitImageWidthToFrame) {
+			var firstZoom = 0;
+			var widthLimit = self.getFrameDimension()[0];
+			var dimW = dimension[0]		
+			for(var i=1; i<20;i++) {
+				firstZoom +=1
+				dimW *= zoomFactor
+				if (dimW >= widthLimit) i = 21;
+			}
+			self.zoomTo(firstZoom -1, 0, 0);
+		}
+
+		//Set mouse handlers
+		mouseWheelObject = new mouseWheel();
+		mouseWheelObject.init(image, self.onmousewheel);
+		image.onmousedown = self.onmousedown;
+		
+		//Set keyboard handlers
+		self.frameElement.onkeypress = self.onkeypress;
+		self.frameElement.onkeyup = self.onkeyup;
+		
+		if(viewer.onload!=null)
+			viewer.onload(self);
+		if(self.onload!=null)
+			self.onload();
+	}
+	self.preInitImage = function() { //Triggers after pre-Loader image has been loaded					
+		if(preLoader!=null) 
+		{
+			image.style.left=((self.frameElement.clientWidth-image.width)/2) + 'px';
+			image.style.top=((self.frameElement.clientHeight-image.height)/2) + 'px';
+		}
+		image.onload=self.initImage;
+		image.src=imageSource;
+	}				
+	self.setNewImage = function(newImageSource,newPreLoader) {
+		if(typeof newImageSource=='undefined')
+			return;
+		imageSource=newImageSource;
+		if(typeof newPreLoader!=='undefined')
+			preLoader=newPreLoader;
+		if(preLoader!=null) {
+			image.onload=self.preInitImage;
+			image.src=preLoader;
+			return;
+		}
+		image.onload=self.initImage;
+		image.src=imageSource;
+	}
+
+	self.setFocusOn = function(x, y, width, height) {
+		self.focusX = x;
+		self.focusY = y;
+		self.focusW = width;
+		self.focusH = height;
+
+		self.updateFocusPosition();
+	}
+
+	self.updateFocusPosition = function() {
+		var x = self.focusX;
+		var y = self.focusY;
+		var width = self.focusW;
+		var height = self.focusH;
+
+		var curWidth=image.width, curHeight=image.height; // real image dimensions
+		var position = self.getPosition(); // real image position
+		
+		self.focusElement.style.width = (width*(curWidth/orignalW))+'px';
+		self.focusElement.style.height = (height*(curHeight/orignalH))+'px';
+		var left = position[0] + x*(curWidth/orignalW);
+		var top = position[1] + y*(curHeight/orignalH);
+		self.focusElement.style.left = left+'px';
+		self.focusElement.style.top = top+'px';
+	}
+	
+	/*Set a base*/
+	self.setZoomProp(zoomFactor,maxZoom);
+	//Create self.frameElement - One time initialization
+	self.frameElement=document.createElement('div');
+	self.frameElement.style.width=frame[0];
+	self.frameElement.style.height=frame[1];
+	self.frameElement.style.border="0px solid #000";
+	self.frameElement.style.margin="0px";
+	self.frameElement.style.padding="0px";
+	self.frameElement.style.overflow="hidden";
+	self.frameElement.style.position="relative";
+	self.frameElement.style.zIndex=2;
+	self.frameElement.tabIndex=1;
+
+	self.focusElement=document.createElement('div');
+	self.focusElement.style.border="0px solid #000";
+	self.focusElement.style.backgroundColor="rgba(0,255,0,0.5)";
+	self.focusElement.style.position="absolute";
+	self.focusElement.style.zIndex=4;
+	
+	if (image!=null) {
+		if (parent != null) {
+			image.parentNode.removeChild(image);
+			parent.appendChild(self.frameElement);
+		}
+		else if (replace != null) {
+			image.parentNode.removeChild(image);
+			replace.parentNode.replaceChild(self.frameElement, replace);
+		}
+		else
+			image.parentNode.replaceChild(self.frameElement,image);
+		
+		image.style.margin=image.style.padding="0";
+		image.style.borderWidth="0px";
+		image.style.position='absolute';
+		image.style.zIndex=3;
+		self.frameElement.appendChild(image);
+		self.frameElement.appendChild(self.focusElement);
+		
+		if(imageSource!=null)
+			self.preInitImage();
+		else
+			self.initImage();
+	}
+	else {		
+		if(parent!=null)
+			parent.appendChild(self.frameElement);
+		else if(replace!=null)
+			replace.parentNode.replaceChild(self.frameElement,replace);
+			
+		image=document.createElement('img');
+		image.style.position='absolute';
+		image.style.zIndex=3;
+		self.frameElement.appendChild(image);
+		self.frameElement.appendChild(self.focusElement);
+		
+		self.setNewImage(imageSource);
+	}
+	//Experimental
+	if(borderClass!=null) { //Browser rendering of borders with padding have been a problem.
+		self.outerFrame = document.createElement('div');
+		self.outerFrame.className=borderClass;
+		self.frameElement.parentNode.replaceChild(self.outerFrame,self.frameElement);
+		self.outerFrame.appendChild(self.frameElement);
+	}
+}
+//Static events
+viewer.onload = null;
\ No newline at end of file
Index: tmp/org.txm.core/res/org/txm/js/viewer/Simple_Viewer_beta_1.1-min.js
===================================================================
--- tmp/org.txm.core/res/org/txm/js/viewer/Simple_Viewer_beta_1.1-min.js	(revision 0)
+++ tmp/org.txm.core/res/org/txm/js/viewer/Simple_Viewer_beta_1.1-min.js	(revision 258)
@@ -0,0 +1,630 @@
+/**
+ *  Simple Javascript Image 
+
+    Copyright (C) 2010  Munawwar Firoz
+
+    This program 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 3 of the License, or
+    (at your option) any later version.
+
+    This program 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 (http://www.gnu.org/licenses/)
+*/
+function getObjectXY(object) {
+	var left,top;
+	objectCopy=object;
+	if (object.offsetParent) {
+		left=top=0;
+		do {
+			left += object.offsetLeft;
+			if(object.style.borderLeftWidth!='')
+				left+=parseInt(object.style.borderLeftWidth);
+			else
+				object.style.borderLeftWidth='0px';
+			top += object.offsetTop;
+			if(object.style.borderTopWidth!='')
+				top+=parseInt(object.style.borderTopWidth);
+			else
+				object.style.borderTopWidth='0px';
+		}
+		while (object = object.offsetParent);
+	}
+	return [left-parseInt(objectCopy.style.borderLeftWidth),top-parseInt(objectCopy.style.borderLeftWidth)];
+}
+
+//String compare (Case-sensitive)
+function strcmp(string1,string2) {
+	return (string1.length===string2.length && string1.indexOf(string2)!=-1);
+}
+//String compare (Case-insensitive)
+function strcmpi(string1,string2) {
+	return (string1.length===string2.length && string1.toLowerCase().indexOf(string2.toLowerCase())!=-1);
+}
+//string1 should end with string2 to return true (Case-insensitive)
+function strEndsWith(string1,string2) {
+	var index=string1.length-string2.length;
+	return (string1.toLowerCase().lastIndexOf(string2.toLowerCase(),index)==index);
+}
+//Returns the constructor (which is a function) name
+function returnDataType(object) {
+	if(typeof object==='undefined')
+		return 'undefined';
+	if(typeof object==='null')
+		return 'null';
+	code=new String(object.constructor);
+	return code.substring( code.indexOf(' ')+1, code.indexOf('(') );
+}
+//Verifies wether the datatype of a variable is as you expect it to be
+function verifyDataType(object,Datatype_expected_in_string) {
+	return strcmpi( returnDataType(object), Datatype_expected_in_string );
+}
+function retInt(str, suffix) {
+	if(typeof str=='number')
+		return str;
+	var result=str.indexOf(suffix);
+	return parseInt(str.substring(0,(result!=-1)?result:str.length))
+}
+
+/*Mouse related functions*/
+//Used to retrieve the mouse cursor position on screen (but event is needed as argument)
+function getMouseXY(event) {
+	var posx = 0, posy = 0;
+	if (!event) event = window.event;	//firefox
+	if (event.pageX || event.pageY) {
+		posx = event.pageX;
+		posy = event.pageY;
+	}
+	else if (event.clientX || event.clientY) {	//IE
+		posx = event.clientX + document.body.scrollLeft
+			+ document.documentElement.scrollLeft;
+		posy = event.clientY + document.body.scrollTop
+			+ document.documentElement.scrollTop;
+	}
+	return [posx,posy];
+}
+
+function mouseWheel() {
+	var self=this;
+	/*Event handlers*/
+	/*Mouse wheel functions*/
+
+	//Default mouse wheel callback function
+	//Variable local to 'this'
+	var wheelCallback = function(event,object,delta){
+		/*Override this function and write your code there*/
+		/*
+			delta=-1 when mouse wheel is rolled backwards (towards yourself)
+			delta=1 when mouse wheel is rolled forward (away from one's self)
+			Note: Here is where you can call the getMouseXY function using the 'event' argument
+		*/
+	}
+	//Mouse wheel event handler
+	self.wheelHandler = function (event){
+		var delta = 0;
+		if (!event) //For IE
+			event = window.event;
+		if (event.wheelDelta) 	//IE
+		{
+			delta = event.wheelDelta/120;
+			//if (window.opera) delta = -delta; //for Opera...hmm I read somewhere opera 9 need the delta sign inverted...tried in opera 10 and it doesnt require this!?
+		}
+		else if (event.detail) //firefox
+			delta = -event.detail/3;
+
+		if (event.preventDefault)
+			event.preventDefault();
+		event.returnValue = false;
+		if (delta)
+			wheelCallback(event,this,delta);	//callback function
+	}
+	//Mouse wheel initialization
+	self.init = function(object,callback) {
+		if (object.addEventListener) //For firefox
+			object.addEventListener('DOMMouseScroll', this.wheelHandler, false); //Mouse wheel initialization
+		//For IE
+		object.onmousewheel = this.wheelHandler; //Mouse wheel initialization
+		wheelCallback=callback;
+	}
+	this.setCallback = function(callback){
+		wheelCallback=callback;
+	}
+}
+
+//Debugging
+function debug_msgs() {
+	this.counter=0;
+	this.clear=function() {
+		var div=document.getElementById('debug');
+		div.innerHTML='';
+		this.counter=0;
+	}
+	this.print=function(string) {
+	var div=document.getElementById('debug');
+		div.innerHTML+=string;
+	}
+	this.println=function(string) {
+		var div=document.getElementById('debug');
+		div.innerHTML+=string+'<br>';
+		this.counter++;
+	}
+}
+var debug=new debug_msgs();
+
+/*-------------The image viewer--------------*/
+function viewer(arguments) //argument array
+{
+	var self=this;
+
+	/*Properties*/
+	//Public access
+	self.outerFrame=null;
+	
+	//Private access
+	var image=null,imageSource=null,parent=null,replace=null,preLoader=null;
+	var frame=['400px','400px',true]; //Format: ['width in px or % (number)','height in px or % (number)', auto adjust frameElement to image (boolean)]
+	var borderClass=null;
+	var zoomFactor='10%'; //10% increase per zoom in			
+	var maxZoom='300%'; //Either 'percentage' or ['max width in pixel', 'max height in pixel']
+
+	/*Set user defined properties and configurations*/
+	/*
+		The following configurations are for pure javascript image viewers:
+			imageSource : string - Source to the image you want to show
+			
+			parent : HTMLElement - The parent element of the image viewer
+			or
+			replace: HTMLElement - The image viewer replace this HTML element
+			(Exactly one of the above two properties is absolutly needed)
+			
+			preLoader (optional) : string - Source to a pre-loader image. Useful in case of large images
+			
+		The following configurations are for partial javascript/partial HTML image viewers:
+			image - HTMLElement - The reference to the image HTML element
+		
+		Common to both:
+			frame - An array of format [width, height, widthIsMax, heightIsMax]
+				width and height are strings like '400px' or '100%'. width and height can be in px or %
+				widthIsMax and heightIsMax are optional boolean values. 
+				Say if widthIsMax is set to true, it treats the width as the maximum width limit.
+				So if the zoomed image isn't fitting exactly into the frameElement, the frameElement dimension is reduced and adjusted to fit the image.
+			
+			zoomFactor (optional) - number - Decides the amount zoomed per zoom event. Default is set to 10 (in %)
+			maxZoom (optional) - Sets the makimum image zoom in percentage or pixels. Format :Either 'percentage' or ['max width in pixel', 'max height in pixel']
+				Example: '150%' or ['500px,'500px']
+	*/
+	var key;
+	for (key in arguments) {
+		var temp=arguments[key];
+		eval(key + '=temp;');
+	}
+
+	/*Internal states,HTML elements and properties*/
+	self.frameElement = null;
+	var orignalW,orignalH, zoomLevel=1;
+	var lastMousePosition=null, speed=5;
+	var mouseWheelObject=null;
+	
+	/*Methods*/
+	self.getFrameDimension =  function() {
+		return [self.frameElement.clientWidth,self.frameElement.clientHeight];
+	}				
+	self.setDimension = function(width,height) { //width and height of image
+		image.width=Math.round(width);
+		image.height=Math.round(height);
+	}
+	self.getDimension =  function() {
+		return [image.width,image.height];
+	}
+	self.setPosition = function(x,y) { //x and y coordinate of image
+		image.style.left=(Math.round(x)+'px');
+		image.style.top=(Math.round(y)+'px');
+	}
+	self.getPosition = function() {
+		return [retInt(image.style.left,'px'),retInt(image.style.top,'px')];
+	}
+	self.setMouseCursor = function() {
+		var dimension = self.getDimension();
+		var frameDimension =  self.getFrameDimension();
+		
+		var cursor='crosshair';
+		if(dimension[0]>frameDimension[0] && dimension[1]>frameDimension[1])
+			cursor='move';
+		else if(dimension[0]>frameDimension[0])
+			cursor='e-resize';
+		else if(dimension[1]>frameDimension[1])
+			cursor='n-resize';
+		
+		image.style.cursor=cursor;
+	}
+	self.maxZoomCheck = function(width,height) {
+		if(typeof width=='undefined' || typeof height=='undefined') {
+			var temp = self.getDimension();
+			width=temp[0], height=temp[1];
+		}
+		if(typeof maxZoom=='number') {
+			return ((width/orignalW)>maxZoom || (height/orignalH)>maxZoom);
+		}
+		else if(typeof maxZoom=='object') {
+			return (width>maxZoom[0] || height>maxZoom[1]);
+		}
+	}
+	self.fitToFrame = function(width, height) { //width and height of image
+		if(typeof width=='undefined' || typeof height=='undefined') {
+			width=orignalW, height=orignalH;
+		}
+		var frameDimension = self.getFrameDimension(), newWidth,newHeight;
+		
+		newWidth = frameDimension[0];
+		newHeight = Math.round((newWidth*height)/width);
+		if(newHeight>(frameDimension[1])) {
+			newHeight = frameDimension[1];
+			newWidth = Math.round((newHeight*width)/height); 
+		}
+		return [newWidth,newHeight];
+		//return [width, height]; // to not resize the image but can't set zoom < 100%
+	}
+	self.getZoomLevel = function() {
+		return zoomLevel;
+	}
+	self.zoomTo = function(newZoomLevel, x, y) {
+		var frameDimension = self.getFrameDimension();
+		//check if x and y coordinate is within the self.frameElement
+		if(newZoomLevel<0 || x<0 || y<0 || x>=frameDimension[0] || y>=frameDimension[1])
+			return false;
+		
+		var dimension = self.fitToFrame(orignalW,orignalH);
+		for(var i=newZoomLevel; i>0;i--) {
+			dimension[0] *= zoomFactor, dimension[1] *= zoomFactor;
+
+		}
+		
+		//Calculate percentage increase/decrease and fix the image over given x,y coordinate
+		var curWidth=image.width, curHeight=image.height;
+		var position = self.getPosition();
+		
+		//The Maths
+		/*
+			New point/Old point = New image width/Old image width
+		=>	New point = New width/Old width * Old point
+			
+			Difference between new and old point 
+			= New point - Old point
+			= New width/Old width * Old point - Old point
+			= Old Point * (New width/Old width - 1)
+			
+			Moving the image by this difference brings the zoomed image to the same (pivot) point.
+			
+			The point (x,y) sent into this function is relative to the self.frameElement. However, it should be relative to the image for the above formula to work.
+			Hence, point = (x-left, y-top).
+		*/
+		position[0]-=((x-position[0])*((dimension[0]/curWidth)-1)), position[1]-=((y-position[1])*((dimension[1]/curHeight)-1)); //Applying the above formula
+		
+		
+		//Center image
+		position = self.centerImage(dimension[0],dimension[1], position[0],position[1]);
+		
+		//Set dimension and position
+		if(!self.maxZoomCheck(dimension[0],dimension[1])) {
+			zoomLevel = newZoomLevel;
+			self.setDimension(dimension[0],dimension[1]);
+			self.setPosition(position[0],position[1]);
+			self.setMouseCursor();
+		}
+		else
+			return false;
+		return true;
+	}
+	self.centerImage = function(width,height, x,y) { //width and height of image and (x,y) is the (left,top) of the image
+		if(typeof width=='undefined' || typeof height=='undefined') {
+			var temp = self.getDimension();
+			width=temp[0], height=temp[1];
+		}
+		if(typeof x=='undefined' || typeof y=='undefined') {
+			var temp = self.getPosition();
+			x=temp[0], y=temp[1];
+		}
+			
+		var frameDimension = self.getFrameDimension();
+		
+		if(width<=frameDimension[0])
+			x = Math.round((frameDimension[0] - width)/2);
+		if(height<=frameDimension[1])
+			y = Math.round((frameDimension[1] - height)/2);
+
+		if(width>frameDimension[0]) {
+			if(x>0)
+				x=0;
+			else
+			if((x+width)<frameDimension[0])
+				x=frameDimension[0]-width;
+		}
+
+		if(height>frameDimension[1]) {
+			if(y>0)
+				y=0;
+			else
+			if((y+height)<frameDimension[1])
+				y=frameDimension[1]-height;
+		}
+
+		return [x,y];
+	}
+	self.relativeToAbsolute = function(x,y) {
+		if(x<0 || y<0 || x>=self.frameElement.clientWidth || y>=self.frameElement.clientHeight)
+			return null;
+		return [x-retInt(image.style.left,'px'),y-retInt(image.style.top,'px')];
+	}
+	self.reset = function() {
+		var dimension = self.fitToFrame(orignalW,orignalH);
+		var position = self.centerImage(dimension[0],dimension[1], 0,0);
+		self.setDimension(dimension[0],dimension[1]);
+		self.setPosition(position[0],position[1]);
+		zoomLevel=0;
+	}
+	self.moveBy = function(x,y) {
+		var position = self.getPosition();
+		position = self.centerImage(image.width,image.height, position[0]+x,position[1]+y);
+		self.setPosition(position[0],position[1]);
+	}
+	self.hide = function() {
+		if(self.outerFrame)
+			self.outerFrame.style.display='none';
+		else
+			self.frameElement.style.display = 'none';
+	}
+	self.show = function() {
+		if(self.outerFrame)
+			self.outerFrame.style.display='block';
+		else
+			self.frameElement.style.display = 'block';
+	}
+	//Experimental
+	self.moveTo = function(x,y) { //Coordinates relative to (left,top) of image
+		if(x<0 || y<0 || x>=image.width || y>=image.height)
+			return;
+		var left = self.frameElement.clientWidth/2-x, top = self.frameElement.clientHeight/2-y;
+		var position = self.centerImage(image.width,image.height, left,top);
+		self.setPosition(position[0],position[1]);
+	}
+
+	/*User defined events*/
+	//Non-static events
+	self.onload = null;
+	
+	/*Event handlers*/
+	self.onmousewheel = function(event,object,direction) {
+		self.frameElement.focus();
+		if (!event) //For IE
+			event=window.event, event.returnValue = false;
+		else
+		if (event.preventDefault)
+			event.preventDefault();
+		
+		if((zoomLevel+direction)>=0) {
+			var mousePos = getMouseXY(event);
+			var framePos = getObjectXY(self.frameElement);
+			self.zoomTo(zoomLevel+direction, mousePos[0]-framePos[0], mousePos[1]-framePos[1]);
+		}
+	}
+	self.onmousemove = function(event) {
+		if (!event) //For IE
+			event=window.event, event.returnValue = false;
+		else
+		if (event.preventDefault)
+			event.preventDefault();
+		
+		var mousePosition=getMouseXY(event);
+		var position = self.getPosition();
+		position[0]+=(mousePosition[0]-lastMousePosition[0]), position[1]+=(mousePosition[1]-lastMousePosition[1]);
+		lastMousePosition=mousePosition;
+		
+		position = self.centerImage(image.width,image.height, position[0],position[1]);
+		self.setPosition(position[0],position[1]);
+	}
+	self.onmouseup_or_out = function(event) {
+		if (!event) //For IE
+			event=window.event, event.returnValue = false;
+		else
+		if (event.preventDefault)
+			event.preventDefault();
+		
+		image.onmousemove=image.onmouseup=image.onmouseout=null;
+		image.onmousedown=self.onmousedown;
+	}
+	self.onmousedown =  function(event) {
+		self.frameElement.focus();
+		if (!event) //For IE
+			event=window.event, event.returnValue = false;
+		else
+		if (event.preventDefault)
+			event.preventDefault();
+	
+		lastMousePosition=getMouseXY(event);
+		image.onmousemove = self.onmousemove;
+		image.onmouseup=image.onmouseout=self.onmouseup_or_out;
+	}
+	self.onkeypress = function(event) {
+		var keyCode;
+		if(window.event) // IE
+			event=window.event, keyCode = event.keyCode, event.returnValue = false;
+		else
+		if(event.which) // Netscape/Firefox/Opera
+			keyCode = event.which, event.preventDefault();
+		
+		keyCode = String.fromCharCode(keyCode);
+		
+		var position = self.getPosition();
+		var LEFT='a',UP='w',RIGHT='d',DOWN='s', CENTER_IMAGE='c', ZOOMIN='=', ZOOMOUT='-'; ///Keys a,w,d,s
+		if(keyCode==LEFT)
+			position[0]+=speed;
+		else if(keyCode==UP)
+			position[1]+=speed;
+		else if(keyCode==RIGHT)
+			position[0]-=speed;
+		else if(keyCode==DOWN)
+			position[1]-=speed;
+		else if(keyCode==CENTER_IMAGE || keyCode=='C')
+			self.reset();
+		else if(keyCode==ZOOMIN || keyCode=='+' || keyCode=='x' || keyCode=='X')
+			self.zoomTo(zoomLevel+1, self.frameElement.clientWidth/2, self.frameElement.clientHeight/2);
+		else if( (keyCode==ZOOMOUT || keyCode=='z' || keyCode=='Z') && zoomLevel>0)
+			self.zoomTo(zoomLevel-1, self.frameElement.clientWidth/2, self.frameElement.clientHeight/2);
+		
+		if(keyCode==LEFT || keyCode==UP || keyCode==RIGHT || keyCode==DOWN) {
+			position = self.centerImage(image.width,image.height, position[0],position[1]);
+			self.setPosition(position[0],position[1]);
+			speed+=2;
+		}
+	}
+	self.onkeyup = function(event) {
+		speed=5;
+	}
+	/*Initializaion*/
+	self.setZoomProp = function(newZoomFactor,newMaxZoom) {
+		if(newZoomFactor==null)
+			zoomFactor=10;
+		zoomFactor=1 + retInt(newZoomFactor,'%')/100;
+		
+		if(typeof newMaxZoom=='string')
+			maxZoom = retInt(newMaxZoom,'%')/100;
+		else if(typeof newMaxZoom=='object' && newMaxZoom!=null) {
+			maxZoom[0]=retInt(newMaxZoom[0],'px');
+			maxZoom[1]=retInt(newMaxZoom[1],'px');
+		}
+		else maxZoom='300%';
+	}
+	self.setFrameProp = function(newFrameProp) {
+		self.frameElement.style.width=newFrameProp[0];
+		self.frameElement.style.height=newFrameProp[1];
+	}
+	self.initImage = function() {
+		image.style.maxWidth=image.style.width=image.style.maxHeight=image.style.height=null;
+		orignalW=image.width;
+		orignalH=image.height;
+
+		var dimension=self.fitToFrame(orignalW, orignalH);
+		self.setDimension(dimension[0],dimension[1]);
+		
+		if(frame[2]==true)
+			self.frameElement.style.width=(Math.round(dimension[0])+ 'px');
+		if(frame[3]==true)
+			self.frameElement.style.height=(Math.round(dimension[1]) + 'px');
+		var pos = self.centerImage(dimension[0],dimension[1], 0,0);
+		self.setPosition(pos[0],pos[1]);
+		self.setMouseCursor();
+		
+		var fitImageWidthToFrame = true;
+		if (fitImageWidthToFrame) {
+			var firstZoom = 0;
+			var widthLimit = self.getFrameDimension()[0];
+			var dimW = dimension[0]		
+			for(var i=1; i<20;i++) {
+				firstZoom +=1
+				dimW *= zoomFactor
+				if (dimW >= widthLimit) i = 21;
+			}
+			self.zoomTo(firstZoom -1, 0, 0);
+		}
+
+		//Set mouse handlers
+		mouseWheelObject = new mouseWheel();
+		mouseWheelObject.init(image, self.onmousewheel);
+		image.onmousedown = self.onmousedown;
+		
+		//Set keyboard handlers
+		self.frameElement.onkeypress = self.onkeypress;
+		self.frameElement.onkeyup = self.onkeyup;
+		
+		if(viewer.onload!=null)
+			viewer.onload(self);
+		if(self.onload!=null)
+			self.onload();
+	}
+	self.preInitImage = function() { //Triggers after pre-Loader image has been loaded					
+		if(preLoader!=null) 
+		{
+			image.style.left=((self.frameElement.clientWidth-image.width)/2) + 'px';
+			image.style.top=((self.frameElement.clientHeight-image.height)/2) + 'px';
+		}
+		image.onload=self.initImage;
+		image.src=imageSource;
+	}				
+	self.setNewImage = function(newImageSource,newPreLoader) {
+		if(typeof newImageSource=='undefined')
+			return;
+		imageSource=newImageSource;
+		if(typeof newPreLoader!=='undefined')
+			preLoader=newPreLoader;
+		if(preLoader!=null) {
+			image.onload=self.preInitImage;
+			image.src=preLoader;
+			return;
+		}
+		image.onload=self.initImage;
+		image.src=imageSource;
+	}
+
+	
+	/*Set a base*/
+	self.setZoomProp(zoomFactor,maxZoom);
+	//Create self.frameElement - One time initialization
+	self.frameElement=document.createElement('div');
+	self.frameElement.style.width=frame[0];
+	self.frameElement.style.height=frame[1];
+	self.frameElement.style.border="0px solid #000";
+	self.frameElement.style.margin="0px";
+	self.frameElement.style.padding="0px";
+	self.frameElement.style.overflow="hidden";
+	self.frameElement.style.position="relative";
+	self.frameElement.style.zIndex=2;
+	self.frameElement.tabIndex=1;
+			
+	if(image!=null) {
+		if (parent != null) {
+			image.parentNode.removeChild(image);
+			parent.appendChild(self.frameElement);
+		}
+		else if (replace != null) {
+			image.parentNode.removeChild(image);
+			replace.parentNode.replaceChild(self.frameElement, replace);
+		}
+		else
+			image.parentNode.replaceChild(self.frameElement,image);
+		
+		image.style.margin=image.style.padding="0";
+		image.style.borderWidth="0px";
+		image.style.position='absolute';
+		image.style.zIndex=3;
+		self.frameElement.appendChild(image);
+		
+		if(imageSource!=null)
+			self.preInitImage();
+		else
+			self.initImage();
+	}
+	else {		
+		if(parent!=null)
+			parent.appendChild(self.frameElement);
+		else if(replace!=null)
+			replace.parentNode.replaceChild(self.frameElement,replace);
+			
+		image=document.createElement('img');
+		image.style.position='absolute';
+		image.style.zIndex=3;
+		self.frameElement.appendChild(image);
+		
+		self.setNewImage(imageSource);
+	}
+	//Experimental
+	if(borderClass!=null) { //Browser rendering of borders with padding have been a problem.
+		self.outerFrame = document.createElement('div');
+		self.outerFrame.className=borderClass;
+		self.frameElement.parentNode.replaceChild(self.outerFrame,self.frameElement);
+		self.outerFrame.appendChild(self.frameElement);
+	}
+}
+//Static events
+viewer.onload = null;
\ No newline at end of file
Index: tmp/org.txm.core/res/org/txm/js/testjquery.html
===================================================================
--- tmp/org.txm.core/res/org/txm/js/testjquery.html	(revision 0)
+++ tmp/org.txm.core/res/org/txm/js/testjquery.html	(revision 258)
@@ -0,0 +1,27 @@
+<!doctype html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Demo</title>
+</head>
+<body>
+<button >TEST SELECTION</button>
+<script src="http://code.jquery.com/jquery-latest.js"></script>
+<script src="jquery.selection.js"></script>
+<script>
+$( document ).ready(function() {
+$( "button" ).click(function( event ) {
+var sel = window.getSelection()
+alert( $(sel).find("span");
+event.preventDefault();
+
+
+});
+});
+</script>
+
+<p>
+<span id="w_0" title="un">un</span> <span id="w_1" title="premier">premier</span> <span id="w_2" title="mot">mot</span>
+</p>
+</body>
+</html>

Property changes on: tmp/org.txm.core/res/org/txm/js/testjquery.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/schema/trans-14.dtd
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/schema/trans-14.dtd	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/schema/trans-14.dtd	(revision 258)
@@ -0,0 +1,98 @@
+<?xml encoding="UTF-8"?>
+
+<!ELEMENT Trans ((Speakers|Topics)*,Episode)>
+<!ATTLIST Trans
+	audio_filename	CDATA		#IMPLIED
+	scribe		CDATA		#IMPLIED
+	xml:lang	NMTOKEN		#IMPLIED
+	version		NMTOKEN		#IMPLIED
+	version_date	CDATA		#IMPLIED
+	elapsed_time	CDATA		"0"
+>
+
+<!ELEMENT Episode (Section*)>
+<!ATTLIST Episode
+	program		CDATA		#IMPLIED
+	air_date	CDATA		#IMPLIED
+>
+
+<!ELEMENT Section (Turn*)>
+<!ATTLIST Section
+	type		(report | nontrans | filler)	#REQUIRED
+	topic		IDREF		#IMPLIED
+	startTime	CDATA		#REQUIRED
+	endTime		CDATA		#REQUIRED
+>
+
+<!ELEMENT Turn (#PCDATA|Sync|Background|Comment|Who|Vocal|Event)*>
+<!ATTLIST Turn
+	speaker		IDREFS		#IMPLIED
+	startTime	CDATA		#REQUIRED
+	endTime		CDATA		#REQUIRED
+        mode		(spontaneous|planned)		#IMPLIED
+        fidelity	(high|medium|low)		#IMPLIED
+        channel		(telephone|studio)		#IMPLIED
+>
+
+<!ELEMENT Sync EMPTY>
+<!ATTLIST Sync
+	time		CDATA		#REQUIRED
+>
+
+<!ELEMENT Background EMPTY>
+<!ATTLIST Background
+	time		CDATA		#REQUIRED
+        type            NMTOKENS	#REQUIRED
+        level           NMTOKENS	#IMPLIED
+>
+
+<!ELEMENT Who EMPTY>
+<!ATTLIST Who
+	nb		NMTOKEN         #REQUIRED
+>
+
+<!-- **** Speech/non speech events, comments **** -->
+
+<!ELEMENT Vocal EMPTY>
+<!ATTLIST Vocal
+	desc		CDATA		#REQUIRED
+>
+
+<!ELEMENT Event EMPTY>
+<!ATTLIST Event
+	type		(noise|lexical|pronounce|language|entities)	"noise"
+	extent		(begin|end|previous|next|instantaneous)	"instantaneous"
+	desc		CDATA		#REQUIRED
+>
+
+<!ELEMENT Comment EMPTY>
+<!ATTLIST Comment
+	desc		CDATA		#REQUIRED
+>
+
+<!-- ********** List of Speakers ************** -->
+
+<!ELEMENT Speakers (Speaker*)>
+<!ATTLIST Speakers>
+
+<!ELEMENT Speaker EMPTY>
+<!ATTLIST Speaker
+	id		ID		#REQUIRED
+	name		CDATA		#REQUIRED
+	check		(yes|no)	#IMPLIED
+	type 		(male|female|child|unknown)	#IMPLIED
+	dialect		(native|nonnative)		#IMPLIED
+	accent		CDATA		#IMPLIED
+	scope		(local|global)	#IMPLIED
+>
+
+<!-- ********** List of Topics ************** -->
+
+<!ELEMENT Topics (Topic*)>
+<!ATTLIST Topics>
+
+<!ELEMENT Topic EMPTY>
+<!ATTLIST Topic
+	id		ID		#REQUIRED
+	desc		CDATA		#REQUIRED
+>

Property changes on: tmp/org.txm.core/res/org/txm/xml/schema/trans-14.dtd
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-corpusakkadien-xmlw_syllabes.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-corpusakkadien-xmlw_syllabes.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-corpusakkadien-xmlw_syllabes.xsl	(revision 258)
@@ -0,0 +1,108 @@
+<?xml version="1.0"?>
+<xsl:stylesheet
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns:xd="http://www.pnp-software.com/XSLTdoc"
+ version="2.0">
+  
+  <xd:doc type="stylesheet">
+    <xd:short>
+      Cette feuille de style permet de préparer les transcriptions de tablettes
+      d'argile (projet UMR PROCLAC) à l'import XML/W + CSV de TXM en tokenisant
+      le corpus au niveau des syllabes.
+      Les propriétés de mots sont projetées vers les propriétés des syllabes (line,
+      lemma, pos).
+      Les propriétés unclear et supplied prennent la valeur "yes" si la syllabe se
+      trouve à l'intérieur de la balise correspondante.
+    </xd:short>
+    <xd:detail>
+      This stylesheet is free software; you can redistribute it and/or
+      modify it under the terms of the GNU Lesser General Public
+      License as published by the Free Software Foundation; either
+      version 3 of the License, or (at your option) any later version.
+      
+      This stylesheet 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
+      Lesser General Public License for more details.
+      
+      You should have received a copy of GNU Lesser Public License with
+      this stylesheet. If not, see http://www.gnu.org/licenses/lgpl.html
+    </xd:detail>
+    <xd:author>Alexei Lavrentiev, alexei.lavrentev@ens-lyon.fr</xd:author>
+    <xd:copyright>2014-2015, CNRS / ICAR (équipe CACTUS)</xd:copyright>
+  </xd:doc>
+  
+  <xsl:output method="xml" encoding="utf-8" omit-xml-declaration="no"/>
+  
+  <xsl:template match="*">
+  	<xsl:copy>
+  		<xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>	
+  	</xsl:copy>
+  </xsl:template>
+
+  <xsl:template match="@*|comment()">
+    <xsl:copy/>
+  </xsl:template>
+	
+	<xsl:template match="processing-instruction()"/>
+  
+  <xsl:template match="*[local-name()='teiHeader']"/>
+  
+  <xsl:template match="*[local-name()='w']//text()">
+    <xsl:variable name="line"><xsl:value-of select="ancestor::*[local-name()='w']/@line"/></xsl:variable>
+    <xsl:variable name="lemma"><xsl:value-of select="ancestor::*[local-name()='w']/@lemma"/></xsl:variable>
+    <xsl:variable name="pos"><xsl:value-of select="ancestor::*[local-name()='w']/@pos"/></xsl:variable>
+    <xsl:variable name="word-form"><xsl:value-of select="ancestor::*[local-name()='w']"/></xsl:variable>
+    <xsl:variable name="unclear">
+      <xsl:choose>
+        <xsl:when test="ancestor::*[local-name()='unclear']">yes</xsl:when>
+        <xsl:otherwise>no</xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:variable name="supplied">
+      <xsl:choose>
+        <xsl:when test="ancestor::*[local-name()='supplied']">yes</xsl:when>
+        <xsl:otherwise>no</xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    
+    <xsl:analyze-string select="." regex="[-.]|\([^\)]*\)">
+      <xsl:matching-substring>
+        <w line="{$line}" lemma="{$lemma}" pos="{$pos}" word-form="{$word-form}" supplied="{$supplied}" unclear="{$unclear}"><xsl:value-of select="."/></w>
+      </xsl:matching-substring>
+      <xsl:non-matching-substring>
+        <w line="{$line}" lemma="{$lemma}" pos="{$pos}" word-form="{$word-form}" supplied="{$supplied}" unclear="{$unclear}"><xsl:value-of select="."/></w>
+      </xsl:non-matching-substring>
+    </xsl:analyze-string>    
+  </xsl:template>
+
+<xsl:template match="text()[not(ancestor::*[local-name()='w'])]">
+  <xsl:analyze-string select="." regex="\[…\]">
+    <xsl:matching-substring>
+      <w line="¤" lemma="¤" pos="¤" word-form="¤" supplied="¤" unclear="¤"><xsl:value-of select="."/></w>
+    </xsl:matching-substring>
+    <xsl:non-matching-substring><xsl:comment><xsl:copy-of select="."/></xsl:comment></xsl:non-matching-substring>
+  </xsl:analyze-string>
+</xsl:template>
+
+  <xsl:template match="*[local-name()='w']">
+  <word>
+    <xsl:apply-templates select="@*"/>
+    <xsl:attribute name="no-supplied">
+      <xsl:choose>
+        <xsl:when test="ancestor::*[local-name()='supplied']">¤</xsl:when>
+        <xsl:otherwise><xsl:apply-templates mode="nosupplied"/></xsl:otherwise>
+      </xsl:choose>
+    </xsl:attribute>
+    <xsl:attribute name="no-unclear">
+      <xsl:choose>
+        <xsl:when test="ancestor::*[local-name()='supplied'] or ancestor::*[local-name()='unclear']">¤</xsl:when>
+        <xsl:otherwise><xsl:apply-templates mode="nounclear"/></xsl:otherwise>
+      </xsl:choose>
+    </xsl:attribute>    
+    <xsl:apply-templates/>
+  </word>
+</xsl:template>
+
+
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-corpusakkadien-xmlw_syllabes.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-perseustreebank-xmlw.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-perseustreebank-xmlw.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-perseustreebank-xmlw.xsl	(revision 258)
@@ -0,0 +1,73 @@
+<?xml version="1.0"?>
+<xsl:stylesheet
+  xmlns:xd="http://www.pnp-software.com/XSLTdoc"
+  xmlns:edate="http://exslt.org/dates-and-times"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+  xmlns:treebank="http://nlp.perseus.tufts.edu/syntax/treebank/1.5"
+  exclude-result-prefixes="edate xd xsi treebank" version="2.0">
+  
+  
+  <xd:doc type="stylesheet">
+    <xd:short>
+      A stylesheet to prepare PERSEUS Treebank XML texts to TXM XML/w import.
+    </xd:short>
+    <xd:detail>
+      This stylesheet is free software; you can redistribute it and/or
+      modify it under the terms of the GNU Lesser General Public
+      License as published by the Free Software Foundation; either
+      version 3 of the License, or (at your option) any later version.
+      
+      This stylesheet 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
+      Lesser General Public License for more details.
+      
+      You should have received a copy of GNU Lesser Public License with
+      this stylesheet. If not, see http://www.gnu.org/licenses/lgpl.html
+    </xd:detail>
+    <xd:author>Alexei Lavrentiev alexei.lavrentev@ens-lyon.fr</xd:author>
+    <xd:copyright>2012, CNRS / ICAR (ICAR3 LinCoBaTO)</xd:copyright>
+  </xd:doc>
+  
+
+  <xsl:output method="xml" encoding="utf-8" omit-xml-declaration="no"/>
+  
+  <xsl:template match="*">
+    <xsl:copy>
+      <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>	
+    </xsl:copy>
+  </xsl:template>
+  
+  <xsl:template match="@*|comment()">
+    <xsl:copy/>
+  </xsl:template>
+  
+  <xsl:template match="processing-instruction()"/>
+  
+  <xsl:template match="text()"><xsl:value-of select="."/></xsl:template>
+  
+<xsl:template match="treebank">
+  <text type="treebank" version="{@version}" date="{normalize-space(child::date[1])}" annotator-short="{normalize-space(child::annotator[1]/short)}" annotator-name="{normalize-space(child::annotator[1]/name)}" annotator-address="{normalize-space(child::annotator[1]/address)}">
+    <xsl:apply-templates select="descendant::sentence"/>
+  </text>
+</xsl:template>
+
+<xsl:template match="annotator"/>
+  
+<xsl:template match="sentence">
+  <xsl:copy>
+    <xsl:apply-templates select="@*"/>
+    <xsl:attribute name="annotator"><xsl:value-of select="child::annotator"/></xsl:attribute>
+    <xsl:apply-templates/>
+  </xsl:copy>
+</xsl:template>
+  
+  <xsl:template match="word">
+    <w>
+      <xsl:apply-templates select="@*[not(name()='form')]"/>
+      <xsl:value-of select="@form"></xsl:value-of>
+    </w>
+  </xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-perseustreebank-xmlw.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/txm-edition-xtz-corpusakkadien-translit.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/txm-edition-xtz-corpusakkadien-translit.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/txm-edition-xtz-corpusakkadien-translit.xsl	(revision 258)
@@ -0,0 +1,204 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:edate="http://exslt.org/dates-and-times"
+	xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tei="http://www.tei-c.org/ns/1.0" xmlns:txm="http://textometrie.org/1.0"
+	exclude-result-prefixes="#all" version="2.0">
+	
+	<xsl:output method="xml" encoding="UTF-8" omit-xml-declaration="no" indent="no"  doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
+	
+	<xsl:strip-space elements="*"/>
+	
+	<xsl:param name="editionpagetag">pb</xsl:param>
+	
+	<xsl:param name="textcontainer">text</xsl:param>
+	
+	<!--<xsl:param name="frontmatter"></xsl:param>
+	
+	<xsl:param name="backmatter">back</xsl:param>-->
+	
+	<xsl:variable name="inputtype">
+		<xsl:choose>
+			<xsl:when test="//tei:w//txm:form">xmltxm</xsl:when>
+			<xsl:otherwise>xmlw</xsl:otherwise>
+		</xsl:choose>
+	</xsl:variable>
+	
+	<xsl:template match="/">
+		<html>
+			<head>
+				<title><xsl:value-of select="//tei:text[1]/@id"/></title>
+				<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
+			</head>
+			<body>
+				<a class="txm-page" title="1"/>
+				<div class="metadata-page">
+					<h1><xsl:value-of select="//tei:text[1]/@id"></xsl:value-of></h1>
+					<br/>
+					<table>
+						<xsl:for-each select="//tei:text[1]/@*">
+							<tr>
+								<td><xsl:value-of select="name()"/></td>
+								<td><xsl:value-of select="."/></td>
+							</tr>
+						</xsl:for-each>
+					</table>
+					<br/>
+					<br/>
+				</div>
+				<xsl:apply-templates select="descendant::*[local-name()=$textcontainer]"/>
+				
+				
+			</body>
+		</html>
+	</xsl:template>
+	
+	<xsl:template match="//*[local-name()=$textcontainer]">
+		<xsl:variable name="pbcount"></xsl:variable>
+		
+		<div class="text" style="margin-left:60px;">
+			<xsl:apply-templates/>
+		</div>
+	</xsl:template>
+	
+		
+	
+	<xsl:template match="*">
+		<xsl:choose>
+			<xsl:when test="descendant::tei:p|descendant::tei:ab">
+				<div>
+					<xsl:call-template name="addClass"/>
+					<xsl:apply-templates/></div>
+				<xsl:text>&#xa;</xsl:text>
+			</xsl:when>
+			<xsl:otherwise><span>
+				<xsl:call-template name="addClass"/>
+				<xsl:if test="self::tei:add[@del]">
+					<xsl:attribute name="title"><xsl:value-of select="@del"/></xsl:attribute>
+				</xsl:if>
+				<xsl:apply-templates/></span>
+			</xsl:otherwise>
+		</xsl:choose>
+	</xsl:template>
+	
+	<xsl:template match="@*|processing-instruction()|comment()">
+
+	</xsl:template>
+	
+	<xsl:template match="text()">
+		<xsl:value-of select="normalize-space(.)"/>
+	</xsl:template>
+	
+	<xsl:template name="addClass">
+		<xsl:attribute name="class">
+			<xsl:value-of select="local-name(.)"/>
+			<xsl:if test="@type"><xsl:value-of select="concat('-',@type)"/></xsl:if>
+			<xsl:if test="@subtype"><xsl:value-of select="concat('-',@subtype)"/></xsl:if>
+			<xsl:if test="@rend"><xsl:value-of select="concat('-',@rend)"/></xsl:if>
+		</xsl:attribute>                	
+	</xsl:template>
+	
+
+	
+	<xsl:template match="//word">
+		<xsl:choose>
+			<xsl:when test="@line = preceding::word[1]/@line"><xsl:text> </xsl:text></xsl:when>
+			<xsl:otherwise><br/><xsl:text>&#xa;</xsl:text><span style="position:relative"><span class="linenumber" style="position:absolute;width:40px;left:-50px;padding-right:20px;text-align:right"><xsl:value-of select="@line"/>&#xa0;</span></span></xsl:otherwise>
+		</xsl:choose>
+		<span>
+			<xsl:call-template name="addClass"/>
+			<xsl:apply-templates/>
+		</span>
+	</xsl:template>
+	
+	
+	
+	<!-- Page breaks -->                
+	<xsl:template match="//*[local-name()=$editionpagetag]">
+		<xsl:variable name="editionpagetype">
+			<xsl:choose>
+				<xsl:when test="ancestor::tei:ab">editionpageverse</xsl:when>
+				<xsl:otherwise>editionpage</xsl:otherwise>
+			</xsl:choose>
+		</xsl:variable>
+		<xsl:variable name="pagenumber">
+			<xsl:choose>
+				<xsl:when test="@n"><xsl:value-of select="@n"/></xsl:when>
+				<xsl:when test="@facs"><xsl:value-of select="substring-before(@facs,'.')"/></xsl:when>
+				<xsl:otherwise>[NN]</xsl:otherwise>
+			</xsl:choose>
+		</xsl:variable>
+		
+		<xsl:variable name="page_id"><xsl:value-of select="count(preceding::*[local-name()=$editionpagetag])"/></xsl:variable>
+		<xsl:if test="@break='no'"><span class="hyphen">-</span></xsl:if>
+		<xsl:if test="//tei:note[not(@place='inline') and not(matches(@type,'intern|auto'))][following::*[local-name()=$editionpagetag][1][count(preceding::*[local-name()=$editionpagetag]) = $page_id]]">
+			<xsl:text>&#xa;</xsl:text>
+			<br/>
+			<br/>			
+			<span class="footnotes">
+				<xsl:for-each select="//tei:note[not(@place='inline') and not(matches(@type,'intern|auto'))][following::*[local-name()=$editionpagetag][1][count(preceding::*[local-name()=$editionpagetag]) = $page_id]]">
+					<xsl:variable name="note_count"><xsl:value-of select="count(preceding::tei:note[not(@place='inline')]) + 1"/></xsl:variable>
+					<!--<p><xsl:value-of select="$note_count"/>. <a href="#noteref_{$note_count}" name="note_{$note_count}">[<xsl:value-of select="preceding::tei:cb[1]/@xml:id"/>, l. <xsl:value-of select="preceding::tei:lb[1]/@n"/>]</a><xsl:text> </xsl:text> <xsl:value-of select="."/></p>-->
+					<span class="note">
+						<span class="footnotenumber"><a href="#noteref_{$note_count}" name="note_{$note_count}"><xsl:value-of select="$note_count"/></a>. </span>
+						<xsl:apply-templates mode="#current"/>
+					</span>                                                                
+				</xsl:for-each></span><xsl:text>&#xa;</xsl:text>                                                                
+			
+		</xsl:if>                                
+		
+		<xsl:text>&#xa;</xsl:text>
+		<br/><xsl:text>&#xa;</xsl:text>
+		<a class="txm-page" title="{count(preceding::*[local-name()=$editionpagetag]) + 2}"/>
+		<span class="{$editionpagetype}"> - <xsl:value-of select="$pagenumber"/> - </span><br/><xsl:text>&#xa;</xsl:text>
+	</xsl:template>
+	
+	<!-- Notes -->
+<!--	<xsl:template match="tei:note[not(@place='inline') and not(matches(@type,'intern|auto'))]">
+		<!-\-<span style="color:violet"> [<b>Note :</b> <xsl:apply-templates/>] </span>-\->	
+		<xsl:variable name="note_count"><xsl:value-of select="count(preceding::tei:note[not(@place='inline') and not(matches(@type,'intern|auto'))]) + 1"/></xsl:variable>
+		<a title="{.}" class="noteref" href="#note_{$note_count}" name="noteref_{$note_count}">[<xsl:value-of select="$note_count"/>]</a>
+		<xsl:call-template name="spacing"/>                                
+	</xsl:template>
+-->	
+	
+	<xsl:template match="//w"><span class="w">
+		<xsl:if test="@id">
+			<xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
+		</xsl:if>
+		<xsl:attribute name="title">
+			<xsl:choose>
+				<xsl:when test="descendant::txm:ana">
+					<xsl:for-each select="descendant::txm:ana">
+						<xsl:value-of select="concat(substring(@type,2),': ',.,' ; ')"/>				
+					</xsl:for-each>
+					<xsl:value-of select="concat('translit : ',descendant::txm:form)"/>
+				</xsl:when>
+				<xsl:otherwise>
+					<xsl:for-each select="@*">
+						<xsl:value-of select="concat(name(),': ',.,' ; ')"/>				
+					</xsl:for-each>
+					<xsl:value-of select="concat('translit : ',.)"/>
+				</xsl:otherwise>
+			</xsl:choose>
+
+		</xsl:attribute>
+		<xsl:choose>
+			<xsl:when test="descendant::txm:form">
+				<xsl:apply-templates select="txm:form"/>
+			</xsl:when>
+			<xsl:otherwise>
+				<xsl:value-of select="."/>
+			</xsl:otherwise>
+		</xsl:choose>
+		
+	</span>
+		<xsl:if test="following-sibling::w">-</xsl:if>
+	</xsl:template>
+	
+	
+	                <xsl:template match="//txm:form">
+	                		<xsl:value-of select="."/>
+                </xsl:template>
+                
+	
+	
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/txm-edition-xtz-corpusakkadien-translit.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-teip5-teibfm.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-teip5-teibfm.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-teip5-teibfm.xsl	(revision 258)
@@ -0,0 +1,365 @@
+<?xml version="1.0"?>
+<xsl:stylesheet
+  xmlns:xd="http://www.pnp-software.com/XSLTdoc"
+  xmlns:edate="http://exslt.org/dates-and-times"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tei="http://www.tei-c.org/ns/1.0"
+  exclude-result-prefixes="tei edate xd" version="2.0">
+  
+  <xd:doc type="stylesheet">
+    <xd:short>
+      Feuille de style de préparation de fichiers TEI P5 à l'importation 
+      dans TXM. Permet de simplifier la structure du document afin
+      d'optimiser les index CWB
+    </xd:short>
+    <xd:detail>
+      This stylesheet is free software; you can redistribute it and/or
+      modify it under the terms of the GNU Lesser General Public
+      License as published by the Free Software Foundation; either
+      version 3 of the License, or (at your option) any later version.
+      
+      This stylesheet 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
+      Lesser General Public License for more details.
+      
+      You should have received a copy of GNU Lesser Public License with
+      this stylesheet. If not, see http://www.gnu.org/licenses/lgpl.html
+    </xd:detail>
+    <xd:author>Alexei Lavrentiev alexei.lavrentev@ens-lyon.fr</xd:author>
+    <xd:copyright>2012, CNRS / ICAR (ICAR3 LinCoBaTO)</xd:copyright>
+  </xd:doc>
+  
+
+  <xsl:output method="xml" encoding="utf-8" omit-xml-declaration="no"/>
+  
+  <!--
+    Modifications par AL le  2012-01-25
+    g dépalacé de "deleteAll" vers "deleteTag"
+    classe de balise "name" créée
+    (geogName, placeName, persName et name)
+  -->
+  
+  <!-- 
+    Modifications par LBe le 2012-02-17
+    Transformation automatique des esperluettes dans les métadonnées
+    Suppression des balises label et heraldry
+    Signed n'est plus transformé en ab
+    opener est transformé en ab
+    L'institution et le dépôt sont récupérés pour le lieu de conservation
+  -->
+  
+  <!-- Modifications par AL le 2012-02-20
+    rolename -> roleName
+    suppression des balises surname et forename
+  -->
+  
+  <!-- Modifications par LBe le 2012-03-09
+    Automatisation du nommage des sorties
+  -->
+  
+  <!-- Listes des balises par type de traitement (les templates sont plus bas) -->
+  
+  <!-- balises à supprimer avec leur contenu -->
+  <xsl:template match="tei:figDesc|tei:figure|tei:fw|tei:g
+    |tei:space|tei:titlePage ">
+    <xsl:call-template name="deleteAll"/>
+  </xsl:template>
+  
+  <!-- balises à supprimer, contenu à conserver -->  
+  <xsl:template match="tei:add|tei:app
+    |tei:caesura|tei:castItem|tei:castGroup[ancestor::tei:castList]
+    |tei:castList[ancestor::tei:p]|tei:cell|tei:choice|tei:cit|tei:corr|tei:date|tei:ex
+    |tei:forename|tei:g|tei:head[parent::tei:list]|tei:heraldry|tei:hi|tei:item|tei:label|tei:lem
+    |tei:list[ancestor::tei:p|ancestor::tei:ab]|tei:lg[child::tei:lg|ancestor::tei:sp]
+    |tei:p[ancestor::tei:sp]|tei:performance
+    |tei:ref|tei:reg|tei:role|tei:roleDesc
+    |tei:row|tei:salute|tei:signed[ancestor::tei:closer]|tei:speaker|tei:stage[ancestor::tei:p|ancestor::tei:ab]
+    |tei:surname|tei:table[ancestor::tei:p]|tei:subst|tei:term|tei:unclear">
+    <xsl:call-template name="deleteTag"/>
+  </xsl:template>
+  
+  <!-- balises à transformer en notes-->
+  <xsl:template match="tei:abbr[parent::tei:choice and not(ancestor::tei:note)]
+    |tei:bibl[not(ancestor::tei:note)]
+    |tei:del
+    |tei:orig[parent::tei:choice and not(ancestor::tei:note)]    
+    |tei:rdg[parent::tei:app and not(ancestor::tei:note)]
+    |tei:sic[parent::tei:choice and not(ancestor::tei:note)]
+    |tei:surplus[not(ancestor::tei:w)]">
+    <xsl:call-template name="makeNote"/>
+  </xsl:template>
+  
+  <!-- balises de noms à indexer -->
+  
+  <xsl:template match="tei:name
+    |tei:geogName
+    |tei:persName
+    |tei:placeName
+    |tei:roleName
+    |tei:orgName">
+    <xsl:call-template name="makeName"/>
+  </xsl:template>
+  
+  <!-- à transformer en W -->
+  
+  <xsl:template match="tei:abbr[not(parent::tei:choice)]
+    |tei:expan
+    |tei:num[matches(.,'.')]">
+    <xsl:call-template name="makeWord"/>
+  </xsl:template>
+  
+  <!-- à transformer en AB typé -->
+  
+  <xsl:template match="tei:byline|tei:lg[not(child::tei:lg or ancestor::tei:sp)]|tei:list[not(ancestor::tei:p|ancestor::tei:ab)]
+    |tei:closer|tei:opener|tei:sp|tei:castGroup[not(ancestor::tei:castList)]|tei:castList[not(ancestor::tei:p)]
+    |tei:signed[not(ancestor::tei:closer)]
+    |tei:stage[not(ancestor::tei:p|ancestor::tei:ab)]
+    |tei:table[not(ancestor::tei:p)]
+    |tei:trailer">
+    <xsl:call-template name="makeAb"/>
+  </xsl:template>
+  
+  <!-- à transformer en DIV typé -->
+  
+  <xsl:template match="tei:set">
+    <xsl:call-template name="makeDiv"/>
+  </xsl:template>
+
+<!-- Partie générale : on copie les éléments, les attributs, le texte, les commentaires, on supprime mes prrocessing intstructions -->
+
+<!--  <xsl:template match="/">
+      <xsl:apply-templates/>  
+  </xsl:template>
+-->
+  
+  <xsl:template match="*">    
+    <xsl:choose>
+      <xsl:when test="namespace-uri()=''">
+        <xsl:element namespace="http://www.tei-c.org/ns/1.0" name="{local-name(.)}">
+          <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
+        </xsl:element>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:copy>
+          <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
+        </xsl:copy>
+      </xsl:otherwise>
+    </xsl:choose>  
+  </xsl:template>
+
+  <xsl:template match="@*|comment()">
+    <xsl:copy/>
+  </xsl:template>
+
+  <xsl:template match="text()">
+    <xsl:analyze-string select="." regex="&amp;|&lt;|&gt;|--|\*(\w+)">
+      <xsl:matching-substring>
+        <xsl:choose>
+          <xsl:when test="matches(.,'&amp;')">
+            <expan xmlns="http://www.tei-c.org/ns/1.0">et</expan>
+          </xsl:when>
+          <xsl:when test="matches(.,'&lt;')">
+            <xsl:text>[</xsl:text>
+          </xsl:when>
+          <xsl:when test="matches(.,'&gt;')">
+            <xsl:text>]</xsl:text>
+          </xsl:when>
+          <!-- pose problème si se trouve dans les notes transformés en commentaires xml par le tokeniseur -->
+          <xsl:when test="matches(.,'--')">
+            <xsl:text> - </xsl:text>
+          </xsl:when>
+<!--          <!-\- Spécial FRANTEXT -\->
+          <xsl:when test="matches(.,'\*(\w+)')">
+            <name xmlns="http://www.tei-c.org/ns/1.0" type="maj"><xsl:value-of select="regex-group(1)"/></name>        		
+          </xsl:when>          -->
+          <xsl:otherwise>
+            <xsl:value-of select="."/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:matching-substring>
+      <xsl:non-matching-substring>         
+        <xsl:value-of select="."/>
+      </xsl:non-matching-substring>      
+    </xsl:analyze-string>
+  </xsl:template>
+  
+
+  <xsl:template match="processing-instruction()"/>
+
+<!-- On ne touche pas au teiHeader -->
+  
+  <xsl:template match="tei:teiHeader">    
+      <xsl:copy-of select="."/>    
+  </xsl:template>
+
+<!-- On supprime les balises et tout ce qu'elles contiennent pour les éléments hors texte à ignorer lors de l'import -->
+  
+  <xsl:template name="deleteAll"/>
+
+<!-- On supprime les balises non essentielles pour l'exploitation textométrique et susceptibles de poser des problèmes au tokeniseur,
+  mais on garde leur contenu qui fait partie du matériau textuel -->
+  
+  <xsl:template name="deleteTag">
+    <xsl:apply-templates/>
+  </xsl:template>
+
+<!-- on met en note les éléments hors texte qu'on aimerait garder pour l'édition, etc. -->
+  
+  <xsl:template name="makeNote">
+    <note type="{local-name()}" xmlns="http://www.tei-c.org/ns/1.0">
+      <xsl:apply-templates select="text()"/>
+    </note>
+  </xsl:template>
+  
+<!-- On supprime toutes les balises à l'intérieur des notes-->
+  <xsl:template match="tei:note">
+    <xsl:copy>
+      <xsl:apply-templates select="text()"/>
+    </xsl:copy>
+  </xsl:template>
+
+<!-- On transforme en DIV typés les balises de niveau de division textuelle (pouvant contenir des p) -->
+
+  <xsl:template name="makeDiv">
+    <div type="{local-name()}" xmlns="http://www.tei-c.org/ns/1.0">
+      <xsl:copy-of select="@*"/>
+      <xsl:apply-templates/>
+    </div>
+  </xsl:template>  
+
+<!-- On transforme en bloc anonyme les balises de niveau équivalent au paragraphe -->
+
+  <xsl:template name="makeAb">
+    <ab type="{local-name()}" xmlns="http://www.tei-c.org/ns/1.0">
+      <xsl:copy-of select="@*"/>
+      <xsl:apply-templates/>
+    </ab>
+  </xsl:template>
+
+  <!-- on pré-tokenise les éléments équivalents à un mot -->
+  
+  <xsl:template name="makeWord">
+    <xsl:variable name="wordType">
+      <xsl:choose>
+        <xsl:when test="@type">
+          <xsl:value-of select="concat(local-name(),'-',@type)"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="local-name()"></xsl:value-of>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:choose>
+      <xsl:when test="descendant::tei:w or ancestor::tei:w">
+<!--            <xsl:element namespace="http://www.tei-c.org/ns/1.0" name="seg">
+              <xsl:attribute name="type"><xsl:value-of select="local-name(.)"/></xsl:attribute>
+              <xsl:apply-templates select="*|@*[not(name()='type')]|processing-instruction()|comment()|text()"/>
+            </xsl:element>
+-->
+        <xsl:apply-templates/> <!-- on supprime ces balises pour éviter la réduplication des mots-->
+      </xsl:when>
+      <xsl:otherwise>
+        <w type="{$wordType}" xmlns="http://www.tei-c.org/ns/1.0"><xsl:apply-templates/></w>
+      </xsl:otherwise>
+    </xsl:choose>    
+  </xsl:template>  
+
+<xsl:template name="makeName">
+  <xsl:variable name="nameType">
+    <xsl:choose>
+      <xsl:when test="@type">
+        <xsl:choose>
+          <xsl:when test="local-name()='name'"><xsl:value-of select='@type'/></xsl:when>
+          <xsl:otherwise><xsl:value-of select="concat(local-name(),'-',@type)"/></xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="local-name()"></xsl:value-of>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+  <name type="{$nameType}" xmlns="http://www.tei-c.org/ns/1.0">
+    <xsl:apply-templates/>
+  </name>
+</xsl:template>
+
+<!-- les l sont transformés en lb -->
+  
+  <xsl:template match="tei:l">
+    <lb xmlns="http://www.tei-c.org/ns/1.0">
+      <xsl:if test="@n">
+        <xsl:attribute name="n"><xsl:value-of select="@n"/></xsl:attribute>
+      </xsl:if>
+    </lb>
+    <xsl:apply-templates/>
+  </xsl:template>
+  
+
+<!-- On met la ponctuation forte à l'extérieur de la balise foreign :
+Cet élément sera toujours à l'intérieur d'une phrase. Attention au risque
+de perdre les balises éventuelles à l'intérieur-->
+  
+  <xsl:template
+    match="tei:foreign[not(contains(@rend,'multi_s'))][matches(.,'[.!?]')]">
+    <xsl:variable name="lang">
+      <xsl:choose>
+        <xsl:when test="@lang"><xsl:value-of select="@lang"/></xsl:when>
+        <xsl:when test="@xml:lang"><xsl:value-of select="@xml:lang"/></xsl:when>
+        <xsl:otherwise>xx</xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:for-each select="child::node()">
+      <xsl:choose>
+        <xsl:when test="self::text()">
+          <xsl:analyze-string select="." regex="([^.!?]*)([.?!]+)">
+            <xsl:matching-substring>
+              <xsl:element name="foreign" namespace="http://www.tei-c.org/ns/1.0">
+                <xsl:attribute name="lang"><xsl:value-of select="$lang"/></xsl:attribute>
+                <xsl:analyze-string select="regex-group(1)" regex="&amp;">
+                  <xsl:matching-substring><expan xmlns="http://www.tei-c.org/ns/1.0">et</expan></xsl:matching-substring>
+                  <xsl:non-matching-substring>         
+                    <xsl:value-of select="."/>
+                  </xsl:non-matching-substring>      
+                </xsl:analyze-string>
+              </xsl:element>
+              <xsl:value-of select="regex-group(2)"/>
+              <xsl:text> </xsl:text>
+            </xsl:matching-substring>
+            <xsl:non-matching-substring>
+              <xsl:analyze-string select="." regex="&amp;">
+                <xsl:matching-substring><expan xmlns="http://www.tei-c.org/ns/1.0">et</expan></xsl:matching-substring>
+                <xsl:non-matching-substring>         
+                  <xsl:value-of select="."/>
+                </xsl:non-matching-substring>      
+              </xsl:analyze-string>              
+            </xsl:non-matching-substring>
+          </xsl:analyze-string>          
+        </xsl:when>
+        <xsl:when test="self::*[not(descendant::text())]">
+          <xsl:apply-templates/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:element name="foreign" namespace="http://www.tei-c.org/ns/1.0">
+            <xsl:attribute name="lang"><xsl:value-of select="$lang"/></xsl:attribute>
+            <xsl:apply-templates select="."/>          
+          </xsl:element>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:for-each>
+  </xsl:template>
+  
+  
+  <xsl:template name="persname">
+      <xsl:choose>
+         <xsl:when test="tei:surname"><xsl:value-of select="tei:forename"/>&#160;<xsl:value-of select="tei:surname"/></xsl:when>
+         <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
+      </xsl:choose>
+   </xsl:template>
+  
+  
+<!--  <!-\- traitement spécifique anciennes étiquettes bfm -\->
+  <xsl:template match="tei:w/@type[contains(.,'_')]">
+    <xsl:attribute name="type"><xsl:value-of select="substring-before(.,'_')"/></xsl:attribute>
+  </xsl:template>
+-->
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-teip5-teibfm.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/1-default-html.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/1-default-html.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/1-default-html.xsl	(revision 258)
@@ -0,0 +1,370 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:edate="http://exslt.org/dates-and-times"
+	xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+	xmlns:tei="http://www.tei-c.org/ns/1.0" 
+	xmlns:txm="http://textometrie.org/1.0"
+	xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                exclude-result-prefixes="#all" version="2.0">
+                
+	<xsl:output method="xml" encoding="UTF-8" omit-xml-declaration="no" indent="no"/>
+	
+	<!-- <xsl:output method="xml" encoding="UTF-8" omit-xml-declaration="no" indent="no"  doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/> -->
+	
+                
+                <xsl:strip-space elements="*"/>
+                
+	<xsl:param name="pagination-element">pb</xsl:param>
+	
+	<xsl:variable name="word-element">
+		<xsl:choose>
+			<xsl:when test="//tei:c//txm:form">c</xsl:when>
+			<xsl:otherwise>w</xsl:otherwise>
+		</xsl:choose>
+	</xsl:variable>
+
+	<xsl:variable name="page-number-adjust" as="xs:integer">
+		<xsl:choose>
+			<xsl:when test="//tei:c//txm:form">1</xsl:when>
+			<xsl:otherwise>2</xsl:otherwise>
+		</xsl:choose>
+	</xsl:variable>
+	
+
+                <xsl:variable name="inputtype">
+                	<xsl:choose>
+                		<xsl:when test="//tei:w//txm:form">xmltxm</xsl:when>
+                		<xsl:otherwise>xmlw</xsl:otherwise>
+                	</xsl:choose>
+                </xsl:variable>
+	
+	<xsl:variable name="filename">
+		<xsl:analyze-string select="document-uri(.)" regex="^(.*)/([^/]+)\.[^/]+$">
+			<xsl:matching-substring>
+				<xsl:value-of select="regex-group(2)"/>
+			</xsl:matching-substring>
+		</xsl:analyze-string>
+	</xsl:variable>
+                
+                <xsl:template match="/">
+                	<html>
+                		<head>
+                			<title><xsl:choose>
+                				<xsl:when test="//tei:text/@id"><xsl:value-of select="//tei:text[1]/@id"/></xsl:when>
+                				<xsl:otherwise><xsl:value-of select="$filename"/></xsl:otherwise>
+                			</xsl:choose></title>
+                			<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
+                			<link rel="stylesheet" media="all" type="text/css" href="css/txm.css" />
+                		</head>
+                			<xsl:apply-templates select="descendant::tei:text"/>
+                	</html>
+                </xsl:template>
+
+	<xsl:template match="tei:text">
+		<body>
+			<xsl:if test="$word-element='w'">
+				<a class="txm-page" title="1"  next-word-id="w_0"/>
+				<div class="metadata-page">
+					<h1><xsl:value-of select="@id"></xsl:value-of></h1>
+					<br/>
+					<table>
+						<xsl:for-each select="@*">
+							<tr>
+								<td><xsl:value-of select="name()"/></td>
+								<td><xsl:value-of select="."/></td>
+							</tr>
+						</xsl:for-each>
+					</table>
+				</div>
+				
+			</xsl:if>
+			<xsl:apply-templates/>		
+		</body>
+	</xsl:template>
+	
+                <xsl:template match="*">
+                                <xsl:choose>
+                                	<xsl:when test="descendant::tei:p|descendant::tei:ab">
+                                		<div>
+                                			<xsl:call-template name="addClass"/>
+                                			<xsl:apply-templates/></div>
+                                		<xsl:text>&#xa;</xsl:text>
+                                	</xsl:when>
+                                	<xsl:otherwise><span>
+                                		<xsl:call-template name="addClass"/>
+                                		<xsl:if test="self::tei:add[@del]">
+                                			<xsl:attribute name="title"><xsl:value-of select="@del"/></xsl:attribute>
+                                		</xsl:if>
+                                		<xsl:apply-templates/></span>
+                                	<xsl:call-template name="spacing"/>
+                                	</xsl:otherwise>
+                                </xsl:choose>
+                </xsl:template>
+                
+                <xsl:template match="@*|processing-instruction()|comment()">
+                                <!--<xsl:copy/>-->
+                </xsl:template>
+                
+<!--                <xsl:template match="comment()">
+                                <xsl:copy/>
+                </xsl:template>
+-->                
+                <xsl:template match="text()">
+                                <xsl:value-of select="normalize-space(.)"/>
+                </xsl:template>
+                
+                <xsl:template name="addClass">
+                	<xsl:attribute name="class">
+                		<xsl:value-of select="local-name(.)"/>
+                		<xsl:if test="@type"><xsl:value-of select="concat('-',@type)"/></xsl:if>
+                		<xsl:if test="@subtype"><xsl:value-of select="concat('-',@subtype)"/></xsl:if>
+                		<xsl:if test="@rend"><xsl:value-of select="concat('-',@rend)"/></xsl:if>
+                	</xsl:attribute>                	
+                </xsl:template>
+                
+                <xsl:template match="tei:p|tei:ab|tei:lg">
+                	<p>
+                		<xsl:call-template name="addClass"/>
+                		<xsl:apply-templates/>
+                	</p>
+                	<xsl:text>&#xa;</xsl:text>
+                </xsl:template>
+	
+	<xsl:template match="tei:head">
+		<h2>
+			<xsl:call-template name="addClass"/>
+			<xsl:apply-templates/>
+		</h2>
+	</xsl:template>
+	
+	<xsl:template match="tei:gap">
+		<span class="gap">
+			<xsl:if test="@quantity and @unit">
+				<xsl:attribute name="title"><xsl:value-of select="concat(@quantity,' ',@unit)"/></xsl:attribute>
+			</xsl:if>
+			<xsl:text>[...]</xsl:text>
+		</span>
+		<xsl:call-template name="spacing"/>
+	</xsl:template>
+                
+	<xsl:template match="//tei:lb">
+		<xsl:variable name="lbcount">
+			<xsl:choose>
+				<xsl:when test="ancestor::tei:ab"><xsl:number from="tei:ab" level="any"/></xsl:when>
+				<xsl:when test="ancestor::tei:p"><xsl:number from="tei:p" level="any"/></xsl:when>
+				<xsl:otherwise>999</xsl:otherwise>
+			</xsl:choose>
+		</xsl:variable>
+		<xsl:if test="@rend='hyphen(-)'"><span class="hyphen">-</span></xsl:if>
+		<xsl:if test="@rend='hyphen(=)'"><span class="hyphen">=</span></xsl:if>
+		<xsl:if test="ancestor::tei:w and not(contains(@rend,'hyphen'))"><span class="hyphen-added">-</span></xsl:if>
+		<xsl:if test="not($lbcount=1) or preceding-sibling::node()[matches(.,'\S')]"><br/><xsl:text>&#xa;</xsl:text></xsl:if>
+		<xsl:if test="@n and not(@rend='prose')">
+			<xsl:choose>
+				<xsl:when test="matches(@n,'^[0-9]*[05]$')">
+					<!--<a title="{@n}" class="verseline" style="position:relative"> </a>-->
+					<!--<span class="verseline"><span class="verselinenumber"><xsl:value-of select="@n"/></span></span>-->
+					<span class="verselinenumber"><xsl:value-of select="@n"/></span>
+					
+				</xsl:when>
+				<xsl:when test="matches(@n,'[^0-9]')">
+					<!--<a title="{@n}" class="verseline" style="position:relative"> </a>-->
+					<!--<span class="verseline"><span class="verselinenumber"><xsl:value-of select="@n"/></span></span>-->
+					<span class="verselinenumber"><xsl:value-of select="@n"/></span>
+				</xsl:when>
+				<xsl:otherwise>
+				</xsl:otherwise>
+			</xsl:choose>
+		</xsl:if>
+	</xsl:template>
+	
+	<!-- Page breaks -->                
+	<xsl:template match="//*[local-name()=$pagination-element]">
+		
+		<xsl:variable name="next-word-position" as="xs:integer">
+			<xsl:choose>
+				<xsl:when test="following::*[local-name()=$word-element]">
+					<xsl:value-of select="count(following::*[local-name()=$word-element][1]/preceding::*[local-name()=$word-element])"/>
+				</xsl:when>
+				<xsl:otherwise>0</xsl:otherwise>
+			</xsl:choose>
+		</xsl:variable>
+		<xsl:variable name="next-pb-position" as="xs:integer">
+			<xsl:choose>
+				<xsl:when test="following::*[local-name()=$pagination-element]">
+					<xsl:value-of select="count(following::*[local-name()=$pagination-element][1]/preceding::*[local-name()=$word-element])"/>
+				</xsl:when>
+				<xsl:otherwise>999999999</xsl:otherwise>
+			</xsl:choose>
+		</xsl:variable>
+		<xsl:variable name="next-word-id">
+			<xsl:choose>
+				<xsl:when test="$next-pb-position - $next-word-position = 999999999">w_0</xsl:when>
+				<xsl:when test="$next-pb-position &gt; $next-word-position"><xsl:value-of select="following::*[local-name()=$word-element][1]/@id"/></xsl:when>
+				<xsl:otherwise>w_0</xsl:otherwise>
+			</xsl:choose>
+		</xsl:variable>
+		
+		
+		<xsl:variable name="editionpagetype">
+			<xsl:choose>
+				<xsl:when test="ancestor::tei:ab">editionpageverse</xsl:when>
+				<xsl:otherwise>editionpage</xsl:otherwise>
+			</xsl:choose>
+		</xsl:variable>
+		<xsl:variable name="pagenumber">
+			<xsl:choose>
+				<xsl:when test="@n"><xsl:value-of select="@n"/></xsl:when>
+				<xsl:when test="@facs"><xsl:value-of select="substring-before(@facs,'.')"/></xsl:when>
+				<xsl:otherwise>[NN]</xsl:otherwise>
+			</xsl:choose>
+		</xsl:variable>
+		
+		<xsl:variable name="page_id"><xsl:value-of select="count(preceding::*[local-name()=$pagination-element])"/></xsl:variable>
+		
+		<xsl:if test="//tei:note[not(@place='inline') and not(matches(@type,'intern|auto'))][following::*[local-name()=$pagination-element][1][count(preceding::*[local-name()=$pagination-element]) = $page_id]]">
+			<xsl:text>&#xa;</xsl:text>
+			<br/>
+			<br/>			
+			<span style="display:block;border-top-style:solid;border-top-width:1px;border-top-color:gray;padding-top:5px">                                                
+				<xsl:for-each select="//tei:note[not(@place='inline') and not(matches(@type,'intern|auto'))][following::*[local-name()=$pagination-element][1][count(preceding::*[local-name()=$pagination-element]) = $page_id]]">
+					<xsl:variable name="note_count"><xsl:value-of select="count(preceding::tei:note[matches(@type,'^(apparat|identification|zoologique)$')]) + 1"/></xsl:variable>
+					<!--<p><xsl:value-of select="$note_count"/>. <a href="#noteref_{$note_count}" name="note_{$note_count}">[<xsl:value-of select="preceding::tei:cb[1]/@xml:id"/>, l. <xsl:value-of select="preceding::tei:lb[1]/@n"/>]</a><xsl:text> </xsl:text> <xsl:value-of select="."/></p>-->
+					<span class="note">
+						<span style="position:absolute;left:-30px"><a href="#noteref_{$note_count}" name="note_{$note_count}"><xsl:value-of select="$note_count"/></a>. </span>
+						<xsl:apply-templates mode="#current"/>
+					</span>                                                                
+				</xsl:for-each></span><xsl:text>&#xa;</xsl:text>                                                                
+			
+		</xsl:if>
+		
+		
+		<xsl:text>&#xa;</xsl:text>
+		<br/><xsl:text>&#xa;</xsl:text>
+		
+			<a class="txm-page" title="{count(preceding::*[local-name()=$pagination-element]) + $page-number-adjust}" next-word-id="{$next-word-id}"/>
+		
+		<span class="{$editionpagetype}"> &lt;<xsl:value-of select="$pagenumber"/>&gt; </span><br/><xsl:text>&#xa;</xsl:text>
+	</xsl:template>
+	
+	<!-- Notes -->
+	<xsl:template match="tei:note">
+		<!--<span style="color:violet"> [<b>Note :</b> <xsl:apply-templates/>] </span>-->	
+		<xsl:variable name="note_count"><xsl:value-of select="count(preceding::tei:note[matches(@type,'^(apparat|identification|zoologique)$')]) + 1"/></xsl:variable>
+		<xsl:variable name="note_content">
+			<xsl:choose>
+				<xsl:when test="descendant::txm:form">
+					<xsl:for-each select="descendant::txm:form">						
+						<xsl:value-of select="."/>
+						<xsl:if test="not(matches(following::txm:form[1],'^[.,\)]')) and not(matches(.,'^\S+[''’]$|^[‘\(]$'))">
+							<xsl:text> </xsl:text>
+						</xsl:if>
+					</xsl:for-each>
+				</xsl:when>
+				<xsl:otherwise><xsl:value-of select="normalize-space(.)"/></xsl:otherwise>
+			</xsl:choose>
+		</xsl:variable>
+		<xsl:choose>
+			<xsl:when test="matches(@type,'intern|auto')"></xsl:when>
+			<xsl:when test="@place='inline'"><span class="note"> (Note : <xsl:value-of select="$note_content"/>)</span></xsl:when>
+			<xsl:when test="not(@place='inline') and not(matches(@type,'intern|auto'))">
+				<a title="{$note_content}" style="font-size:75%;position:relative;top:-5px" href="#note_{$note_count}" name="noteref_{$note_count}">[<xsl:value-of select="$note_count"/>]</a>
+			</xsl:when>
+			<xsl:otherwise><span class="noteref" title="{$note_content}">[•]</span></xsl:otherwise>
+		</xsl:choose>
+		<xsl:call-template name="spacing"/>                                
+	</xsl:template>
+	
+	<xsl:template match="tei:bibl">
+		<span class="noteref" title="{normalize-space(.)}">[•]</span>
+	</xsl:template>
+	
+	<xsl:template match="a[@class='txmpageref']">
+		<xsl:copy-of select="."/>
+	</xsl:template>
+	
+	<!--<xsl:template match="tei:note[@place='inline']">
+		<span class="noteinline">
+			<xsl:apply-templates/>
+		</span>
+	</xsl:template>
+   -->             
+                <xsl:template match="//tei:w"><span class="w">
+                	<xsl:choose>
+                		<xsl:when test="descendant::tei:c//txm:form">
+                			<xsl:apply-templates select="descendant::tei:c"/>
+                		</xsl:when>
+                		<xsl:otherwise>
+                			<xsl:if test="@*:id">
+                				<xsl:attribute name="id"><xsl:value-of select="@*:id"/></xsl:attribute>
+                			</xsl:if>
+                			<xsl:attribute name="title">
+                				<xsl:for-each select="@*[not(matches(local-name(.),'id'))]">
+                					<xsl:value-of select="concat(name(.),' : ',.,' ; ')"/>
+                				</xsl:for-each>
+                				<xsl:if test="descendant::txm:ana">	
+                					<xsl:for-each select="descendant::txm:ana">
+                						<xsl:value-of select="concat(substring-after(@type,'#'),' : ',.,' ; ')"/>
+                					</xsl:for-each>
+                				</xsl:if>
+                			</xsl:attribute>
+                			<xsl:choose>
+                				<xsl:when test="descendant::txm:form">
+                					<xsl:apply-templates select="txm:form"/>
+                				</xsl:when>
+                				<xsl:otherwise><xsl:apply-templates/></xsl:otherwise>
+                			</xsl:choose>
+                		</xsl:otherwise>
+                	</xsl:choose>
+                                </span><xsl:call-template name="spacing"/></xsl:template>
+                
+<!--                <xsl:template match="//txm:form">
+                                <xsl:apply-templates/>
+                </xsl:template>
+-->                
+	
+
+	<xsl:template name="spacing">
+		<xsl:choose>
+			<xsl:when test="$inputtype='xmltxm'">
+				<xsl:call-template name="spacing-xmltxm"/>
+			</xsl:when>
+			<xsl:otherwise>
+				<xsl:call-template name="spacing-xmlw"/>
+			</xsl:otherwise>
+		</xsl:choose>
+	</xsl:template>
+	
+	<xsl:template name="spacing-xmlw">
+		<xsl:choose>
+			<xsl:when test="ancestor::tei:w"/>
+			<xsl:when test="following::tei:w[1][matches(.,'^\s*[.,)\]]+\s*$')]"/>			
+			<xsl:when test="matches(.,'^\s*[(\[‘]+$|\w(''|’)\s*$')"></xsl:when>
+			<xsl:when test="position()=last() and (ancestor::tei:choice or ancestor::tei:supplied[not(@rend='multi_s')])"></xsl:when>
+			<xsl:when test="following-sibling::*[1][self::tei:note]"></xsl:when>
+			<xsl:when test="following::tei:w[1][matches(.,'^\s*[:;!?]+\s*$')]">
+				<xsl:text>&#xa0;</xsl:text>
+			</xsl:when>
+			<xsl:otherwise>
+				<xsl:text> </xsl:text>
+			</xsl:otherwise>
+		</xsl:choose>                
+	</xsl:template>
+
+	<xsl:template name="spacing-xmltxm">
+		<xsl:choose>
+			<xsl:when test="ancestor::tei:w"/>
+			<xsl:when test="following::tei:w[1][matches(descendant::txm:form[1],'^[.,)\]]+$')]"/>			
+			<xsl:when test="matches(descendant::txm:form[1],'^[(\[‘]+$|\w(''|’)$')"></xsl:when>
+			<xsl:when test="position()=last() and (ancestor::tei:choice or ancestor::tei:supplied[not(@rend='multi_s')])"></xsl:when>
+			<xsl:when test="following-sibling::*[1][self::tei:note]"></xsl:when>
+			<xsl:when test="following::tei:w[1][matches(descendant::txm:form[1],'^[:;!?]+$')]">
+				<xsl:text>&#xa0;</xsl:text>
+			</xsl:when>
+			<xsl:otherwise>
+				<xsl:text> </xsl:text>
+			</xsl:otherwise>
+		</xsl:choose>                
+	</xsl:template>
+
+                
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/1-default-html.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/txm-edition-xtz.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/txm-edition-xtz.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/txm-edition-xtz.xsl	(revision 258)
@@ -0,0 +1,301 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:edate="http://exslt.org/dates-and-times"
+	xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tei="http://www.tei-c.org/ns/1.0" xmlns:txm="http://textometrie.org/1.0"
+                exclude-result-prefixes="#all" version="2.0">
+                
+	<xsl:output method="xml" encoding="UTF-8" omit-xml-declaration="no" indent="no"  doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
+                
+                <xsl:strip-space elements="*"/>
+                
+	<xsl:param name="editionpagetag">pb</xsl:param>
+                
+                <xsl:variable name="inputtype">
+                	<xsl:choose>
+                		<xsl:when test="//tei:w//txm:form">xmltxm</xsl:when>
+                		<xsl:otherwise>xmlw</xsl:otherwise>
+                	</xsl:choose>
+                </xsl:variable>
+	
+	<xsl:variable name="filename">
+		<xsl:analyze-string select="document-uri(.)" regex="^(.*)/([^/]+)\.[^/]+$">
+			<xsl:matching-substring>
+				<xsl:value-of select="regex-group(2)"/>
+			</xsl:matching-substring>
+		</xsl:analyze-string>
+	</xsl:variable>
+                
+                <xsl:template match="/">
+                	<html>
+                		<head>
+                			<title><xsl:choose>
+                				<xsl:when test="//tei:text/@id"><xsl:value-of select="//tei:text[1]/@id"/></xsl:when>
+                				<xsl:otherwise><xsl:value-of select="$filename"/></xsl:otherwise>
+                			</xsl:choose></title>
+                			<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
+                			<link rel="stylesheet" media="all" type="text/css" href="css/bvhepistemon2014.css" />
+<!--                			<title>
+                				<xsl:if test="$author[not(contains(.,'anonym'))]">
+                					<xsl:value-of select="$author"/><xsl:text> : </xsl:text>
+                				</xsl:if>
+                				<xsl:value-of select="$title-normal"/>
+                			</title>                                                                -->
+                		</head>
+                			<xsl:apply-templates select="descendant::tei:text"/>
+                	</html>
+                </xsl:template>
+
+<xsl:template match="tei:text">
+	<body>
+		<a class="txm-page" title="1"/>
+		<div class="metadata-page">
+			<h1><xsl:value-of select="@id"></xsl:value-of></h1>
+			<br/>
+			<table>
+				<xsl:for-each select="@*">
+					<tr>
+						<td><xsl:value-of select="name()"/></td>
+						<td><xsl:value-of select="."/></td>
+					</tr>
+				</xsl:for-each>
+			</table>
+		</div>
+		<xsl:apply-templates/>		
+	</body>
+</xsl:template>
+
+                <xsl:template match="*">
+                                <xsl:choose>
+                                	<xsl:when test="descendant::tei:p|descendant::tei:ab">
+                                		<div>
+                                			<xsl:call-template name="addClass"/>
+                                			<xsl:apply-templates/></div>
+                                		<xsl:text>&#xa;</xsl:text>
+                                	</xsl:when>
+                                	<xsl:otherwise><span>
+                                		<xsl:call-template name="addClass"/>
+                                		<xsl:if test="self::tei:add[@del]">
+                                			<xsl:attribute name="title"><xsl:value-of select="@del"/></xsl:attribute>
+                                		</xsl:if>
+                                		<xsl:apply-templates/></span>
+                                	<xsl:call-template name="spacing"/>
+                                	</xsl:otherwise>
+                                </xsl:choose>
+                </xsl:template>
+                
+                <xsl:template match="@*|processing-instruction()|comment()">
+                                <!--<xsl:copy/>-->
+                </xsl:template>
+                
+<!--                <xsl:template match="comment()">
+                                <xsl:copy/>
+                </xsl:template>
+-->                
+                <xsl:template match="text()">
+                                <xsl:value-of select="normalize-space(.)"/>
+                </xsl:template>
+                
+                <xsl:template name="addClass">
+                	<xsl:attribute name="class">
+                		<xsl:value-of select="local-name(.)"/>
+                		<xsl:if test="@type"><xsl:value-of select="concat('-',@type)"/></xsl:if>
+                		<xsl:if test="@subtype"><xsl:value-of select="concat('-',@subtype)"/></xsl:if>
+                		<xsl:if test="@rend"><xsl:value-of select="concat('-',@rend)"/></xsl:if>
+                	</xsl:attribute>                	
+                </xsl:template>
+                
+                <xsl:template match="tei:p|tei:ab|tei:lg">
+                	<p>
+                		<xsl:call-template name="addClass"/>
+                		<xsl:apply-templates/>
+                	</p>
+                	<xsl:text>&#xa;</xsl:text>
+                </xsl:template>
+	
+	<xsl:template match="tei:head">
+		<h2>
+			<xsl:call-template name="addClass"/>
+			<xsl:apply-templates/>
+		</h2>
+	</xsl:template>
+                
+	<xsl:template match="//tei:lb">
+		<xsl:variable name="lbcount">
+			<xsl:choose>
+				<xsl:when test="ancestor::tei:ab"><xsl:number from="tei:ab" level="any"/></xsl:when>
+				<xsl:when test="ancestor::tei:p"><xsl:number from="tei:p" level="any"/></xsl:when>
+				<xsl:otherwise>999</xsl:otherwise>
+			</xsl:choose>
+		</xsl:variable>
+		<xsl:if test="@rend='hyphen(-)'"><span class="hyphen">-</span></xsl:if>
+		<xsl:if test="@rend='hyphen(=)'"><span class="hyphen">=</span></xsl:if>
+		<xsl:if test="not($lbcount=1) or preceding-sibling::node()[matches(.,'\S')]"><br/><xsl:text>&#xa;</xsl:text></xsl:if>
+		<xsl:if test="@n and not(@rend='prose')">
+			<xsl:choose>
+				<xsl:when test="matches(@n,'^[0-9]*[05]$')">
+					<!--<a title="{@n}" class="verseline" style="position:relative"> </a>-->
+					<span class="verseline"><span class="verselinenumber"><xsl:value-of select="@n"/></span></span>
+				</xsl:when>
+				<xsl:when test="matches(@n,'[^0-9]')">
+					<!--<a title="{@n}" class="verseline" style="position:relative"> </a>-->
+					<span class="verseline"><span class="verselinenumber"><xsl:value-of select="@n"/></span></span>
+				</xsl:when>
+				<xsl:otherwise>
+				</xsl:otherwise>
+			</xsl:choose>
+		</xsl:if>
+	</xsl:template>
+	
+	<!-- Page breaks -->                
+	<xsl:template match="//*[local-name()=$editionpagetag][not(following-sibling::tei:cb)]">
+		<xsl:variable name="editionpagetype">
+			<xsl:choose>
+				<xsl:when test="ancestor::tei:ab">editionpageverse</xsl:when>
+				<xsl:otherwise>editionpage</xsl:otherwise>
+			</xsl:choose>
+		</xsl:variable>
+		<xsl:variable name="pagenumber">
+			<xsl:choose>
+				<xsl:when test="@n"><xsl:value-of select="@n"/></xsl:when>
+				<xsl:when test="@facs"><xsl:value-of select="substring-before(@facs,'.')"/></xsl:when>
+				<xsl:otherwise>[NN]</xsl:otherwise>
+			</xsl:choose>
+		</xsl:variable>
+		
+		<xsl:variable name="page_id"><xsl:value-of select="count(preceding::*[local-name()=$editionpagetag])"/></xsl:variable>
+		
+		<xsl:if test="//tei:note[not(@place='inline') and not(matches(@type,'intern|auto'))][following::*[local-name()=$editionpagetag][1][count(preceding::*[local-name()=$editionpagetag]) = $page_id]]">
+			<xsl:text>&#xa;</xsl:text>
+			<br/>
+			<br/>			
+			<span style="display:block;border-top-style:solid;border-top-width:1px;border-top-color:gray;padding-top:5px">                                                
+				<xsl:for-each select="//tei:note[not(@place='inline') and not(matches(@type,'intern|auto'))][following::*[local-name()=$editionpagetag][1][count(preceding::*[local-name()=$editionpagetag]) = $page_id]]">
+					<xsl:variable name="note_count"><xsl:value-of select="count(preceding::tei:note[not(@place='inline')]) + 1"/></xsl:variable>
+					<!--<p><xsl:value-of select="$note_count"/>. <a href="#noteref_{$note_count}" name="note_{$note_count}">[<xsl:value-of select="preceding::tei:cb[1]/@xml:id"/>, l. <xsl:value-of select="preceding::tei:lb[1]/@n"/>]</a><xsl:text> </xsl:text> <xsl:value-of select="."/></p>-->
+					<span class="note">
+						<span style="position:absolute;left:-30px"><a href="#noteref_{$note_count}" name="note_{$note_count}"><xsl:value-of select="$note_count"/></a>. </span>
+						<xsl:apply-templates mode="#current"/>
+					</span>                                                                
+				</xsl:for-each></span><xsl:text>&#xa;</xsl:text>                                                                
+			
+		</xsl:if>                                
+		
+		<xsl:text>&#xa;</xsl:text>
+		<br/><xsl:text>&#xa;</xsl:text>
+		<a class="txm-page" title="{count(preceding::*[local-name()=$editionpagetag]) + 2}"/>
+		<span class="{$editionpagetype}"> - <xsl:value-of select="$pagenumber"/> - </span><br/><xsl:text>&#xa;</xsl:text>
+	</xsl:template>
+	
+	<!-- Notes -->
+	<xsl:template match="tei:note[not(@place='inline') and not(matches(@type,'intern|auto'))]">
+		<!--<span style="color:violet"> [<b>Note :</b> <xsl:apply-templates/>] </span>-->	
+		<xsl:variable name="note_count"><xsl:value-of select="count(preceding::tei:note[not(@place='inline') and not(matches(@type,'intern|auto'))]) + 1"/></xsl:variable>
+		<xsl:variable name="note_content">
+			<xsl:choose>
+				<xsl:when test="descendant::txm:form">
+					<xsl:for-each select="descendant::txm:form">						
+						<xsl:value-of select="."/>
+						<xsl:if test="not(matches(following::txm:form[1],'^[.,\)]')) and not(matches(.,'^\S+[''’]$|^[‘\(]$'))">
+							<xsl:text> </xsl:text>
+						</xsl:if>
+					</xsl:for-each>
+				</xsl:when>
+				<xsl:otherwise><xsl:value-of select="normalize-space(.)"/></xsl:otherwise>
+			</xsl:choose>
+		</xsl:variable>
+		<a title="{$note_content}" style="font-size:75%;position:relative;top:-5px" href="#note_{$note_count}" name="noteref_{$note_count}">[<xsl:value-of select="$note_count"/>]</a>
+		<xsl:call-template name="spacing"/>                                
+	</xsl:template>
+	
+	<xsl:template match="tei:note[@place='inline']">
+		<span class="noteinline">
+			<xsl:apply-templates/>
+		</span>
+	</xsl:template>
+                
+                <xsl:template match="//tei:w"><span class="w">
+                                                <xsl:if test="@id">
+                                                	<xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
+                                                </xsl:if>
+                                	<xsl:attribute name="title">
+                                		<xsl:if test="@id">
+                                			<xsl:value-of select="@id"></xsl:value-of>
+                                		</xsl:if>
+                                		<xsl:if test="ancestor::tei:corr">
+                                			<xsl:value-of select="concat(' sic : ',@sic)"/>
+                                		</xsl:if>
+                                		<xsl:if test="ancestor::tei:reg">
+                                			<xsl:value-of select="concat(' orig : ',@orig)"/>
+                                		</xsl:if>
+                                		<xsl:choose>
+                                			<xsl:when test="descendant::txm:ana">	
+                                					<xsl:for-each select="descendant::txm:ana">
+                                						<xsl:value-of select="concat(' ',substring-after(@type,'#'),' : ',.)"/>
+                                					</xsl:for-each>
+                                			</xsl:when>
+                                			<xsl:otherwise>
+                                				<xsl:for-each select="@*[not(local-name()='id')]">
+                                					<xsl:value-of select="concat(' ',name(.),' : ',.)"/>
+                                				</xsl:for-each>                                				
+                                			</xsl:otherwise>
+                                		</xsl:choose>
+                                		<xsl:if test="@*[matches(name(.),'pos$')]">
+                                		</xsl:if>                                		
+                                	</xsl:attribute>
+                	<xsl:choose>
+                		<xsl:when test="descendant::txm:form">
+                			<xsl:apply-templates select="txm:form"/>
+                		</xsl:when>
+                		<xsl:otherwise><xsl:apply-templates/></xsl:otherwise>
+                	</xsl:choose>
+                	
+                                </span><xsl:call-template name="spacing"/></xsl:template>
+                
+<!--                <xsl:template match="//txm:form">
+                                <xsl:apply-templates/>
+                </xsl:template>
+-->                
+	<xsl:template name="spacing">
+		<xsl:choose>
+			<xsl:when test="$inputtype='xmltxm'">
+				<xsl:call-template name="spacing-xmltxm"/>
+			</xsl:when>
+			<xsl:otherwise>
+				<xsl:call-template name="spacing-xmlw"/>
+			</xsl:otherwise>
+		</xsl:choose>
+	</xsl:template>
+	
+	<xsl:template name="spacing-xmlw">
+		<xsl:choose>
+			<xsl:when test="ancestor::tei:w"/>
+			<xsl:when test="following::tei:w[1][matches(.,'^\s*[.,)\]]+\s*$')]"/>			
+			<xsl:when test="matches(.,'^\s*[(\[‘]+$|\w(''|’)\s*$')"></xsl:when>
+			<xsl:when test="position()=last() and (ancestor::tei:choice or ancestor::tei:supplied[not(@rend='multi_s')])"></xsl:when>
+			<xsl:when test="following-sibling::*[1][self::tei:note]"></xsl:when>
+			<xsl:when test="following::tei:w[1][matches(.,'^\s*[:;!?]+\s*$')]">
+				<xsl:text>&#xa0;</xsl:text>
+			</xsl:when>
+			<xsl:otherwise>
+				<xsl:text> </xsl:text>
+			</xsl:otherwise>
+		</xsl:choose>                
+	</xsl:template>
+
+	<xsl:template name="spacing-xmltxm">
+		<xsl:choose>
+			<xsl:when test="ancestor::tei:w"/>
+			<xsl:when test="following::tei:w[1][matches(descendant::txm:form[1],'^[.,)\]]+$')]"/>			
+			<xsl:when test="matches(descendant::txm:form[1],'^[(\[‘]+$|\w(''|’)$')"></xsl:when>
+			<xsl:when test="position()=last() and (ancestor::tei:choice or ancestor::tei:supplied[not(@rend='multi_s')])"></xsl:when>
+			<xsl:when test="following-sibling::*[1][self::tei:note]"></xsl:when>
+			<xsl:when test="following::tei:w[1][matches(descendant::txm:form[1],'^[:;!?]+$')]">
+				<xsl:text>&#xa0;</xsl:text>
+			</xsl:when>
+			<xsl:otherwise>
+				<xsl:text> </xsl:text>
+			</xsl:otherwise>
+		</xsl:choose>                
+	</xsl:template>
+
+                
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/txm-edition-xtz.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/concordance_simple.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/concordance_simple.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/concordance_simple.xsl	(revision 258)
@@ -0,0 +1,243 @@
+﻿<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
+								xmlns:exsl="http://exslt.org/common">
+	<!-- Revised 8 Feb 2012 by TMR -->
+	
+	<!-- Delimiter is tab. written as &#09; -->
+
+	<xsl:output method="text" encoding="UTF-8" indent="no" />
+
+	<xsl:param name="cx" select="15"/>
+	<!-- vary this value to change the size of the context -->
+	
+	<xsl:param name="ntTypes"></xsl:param>
+	<!-- non-terminal pivot features to show -->
+		
+	<xsl:param name="tTypes" >pos form</xsl:param>
+	<!-- terminal pivot features to show -->
+				
+	<xsl:key name="idkey" match="t|nt" use="@id"/>
+	<!-- Lezius' lookup key -->
+
+	<xsl:template match="/">
+		
+		<xsl:variable name="valueshownt" ><xsl:value-of select="$ntTypes" /></xsl:variable>
+		
+		<xsl:variable name="valueshowt" ><xsl:value-of select="$tTypes" /></xsl:variable>
+		
+		<!--Write a header-->
+				
+		<xsl:text>ID&#x09;LeftCxOutsideSnt&#x09;LeftCxInsideSnt&#x09;Pivot&#x09;</xsl:text>
+		
+		<xsl:for-each select="tokenize($valueshownt/node(), '\s+')">
+			
+			<xsl:value-of select="." /><xsl:text>&#x09;</xsl:text>
+			
+		</xsl:for-each>
+		
+		<xsl:for-each select="tokenize($valueshowt/node(), '\s+')">
+			
+			<xsl:value-of select="." /><xsl:text>&#x09;</xsl:text>
+			
+		</xsl:for-each>
+		
+		<xsl:text>RightCxInsideSnt&#x09;RightCxOutsideSnt&#x0D;&#x0A;</xsl:text>
+	
+		<xsl:for-each select="descendant::variable[@name='#pivot']">
+			
+			<!-- Each #pivot node in the document is selected -->
+
+			<xsl:variable name="inpivot">
+
+				<pivot>
+					<xsl:apply-templates select="key('idkey', @idref)" mode="get-terminals" />
+				</pivot>
+
+			</xsl:variable>
+
+			<xsl:variable name="inpivot-sort">
+				<pivot>
+					<xsl:for-each select="exsl:node-set($inpivot)//t">
+						<xsl:sort select="@id" />
+						<xsl:copy-of select="." />
+					</xsl:for-each>
+				</pivot>
+			</xsl:variable>
+
+			<xsl:variable name="firstpivotid">
+
+				<xsl:apply-templates select="exsl:node-set($inpivot-sort)//t[1]" mode="id" />
+					
+			</xsl:variable>
+
+			<xsl:variable name="lastpivotid">
+
+				<xsl:apply-templates select="exsl:node-set($inpivot-sort)//t[last()]" mode="id" />
+
+			</xsl:variable>
+
+			<!-- sentence ID -->
+
+			<xsl:apply-templates select="ancestor::s" mode="id" />			
+			<xsl:text>&#x09;</xsl:text>
+
+			<!-- left context -->
+
+			<xsl:apply-templates select="key('idkey', $firstpivotid)" mode="left-cx" /><xsl:text>&#x09;</xsl:text>
+
+			<!-- pivot text -->
+
+			<xsl:apply-templates select="ancestor::s" mode="pivot">
+				<xsl:with-param name="inpivot" select="exsl:node-set($inpivot-sort)" />
+			</xsl:apply-templates><xsl:text>&#x09;</xsl:text>
+			
+			<!-- pivot properties -->
+			
+			<xsl:variable name="thispivot" select="key('idkey', @idref)" />
+			
+			<xsl:for-each select="tokenize($valueshownt/node(), '\s+')">
+				
+				<xsl:variable name="attr" select="."/>
+				
+				<xsl:value-of select="$thispivot/@*[name()=$attr]"/><xsl:text>&#x09;</xsl:text>
+				
+			</xsl:for-each>
+			<xsl:for-each select="tokenize($valueshowt/node(), '\s+')">
+				
+				<xsl:variable name="attr" select="."/>
+				
+				<xsl:value-of select="$thispivot/@*[name()=$attr]"/><xsl:text>&#x09;</xsl:text>
+				
+			</xsl:for-each>
+				
+			<!-- right context -->
+			<xsl:apply-templates select="key('idkey', $lastpivotid)" mode="right-cx" /><xsl:text>&#x0D;&#x0A;</xsl:text>
+
+		</xsl:for-each>
+
+	</xsl:template>
+
+	<xsl:template match="t" mode="get-terminals">
+
+		<xsl:copy-of select="." />
+
+	</xsl:template>
+
+	<xsl:template match="t" mode="left-cx">
+		
+		<xsl:variable name="pivot-node" select="." />
+		<xsl:variable name="this-sid"><xsl:value-of select="ancestor::s/@id" /></xsl:variable>
+		
+		<xsl:for-each select="preceding::t[position() &lt; number($cx)]" >
+			<!-- xsl:sort select="@id" / -->
+			<xsl:choose>
+				<!-- switch from out-of-sentence to in-sentence context -->
+				<xsl:when test="ancestor::s[@id = $this-sid] and not(preceding-sibling::t)">
+					<xsl:text>&#x09;</xsl:text>
+				</xsl:when>
+				
+				<!-- first word of the context and in the same sentence -->
+				
+				<xsl:when test="position() = 1 and ancestor::s[@id=$this-sid]"><xsl:text>&#x09;</xsl:text></xsl:when>
+				
+				<!-- first word of the context -->
+				
+				<xsl:when test="position() = 1" />
+				
+				<!-- first word in a sentence -->
+				<xsl:when test="not(preceding-sibling::t)"><xsl:text> / </xsl:text></xsl:when>
+				
+				<xsl:otherwise><xsl:text> </xsl:text></xsl:otherwise>
+				
+			</xsl:choose>
+			
+			<xsl:apply-templates select="." mode="output" />
+			
+			<!-- add blank column if there's no in-sentence context -->
+			<xsl:if test="position() = last() and ancestor::s[@id != $this-sid]"><xsl:text>&#x09;</xsl:text></xsl:if>
+			
+		</xsl:for-each>
+		
+	</xsl:template>
+	
+	<xsl:template match="t" mode="right-cx">
+		
+		<xsl:variable name="pivot-node" select="." />
+		<xsl:variable name="this-sid"><xsl:value-of select="ancestor::s/@id" /></xsl:variable>
+		
+		<xsl:for-each select="following::t[position() &lt; number($cx)]" >
+			<!-- xsl:sort select="@id" / -->
+			<xsl:choose>
+				<!-- switch from in-sentence to out-of-sentence context -->
+				<xsl:when test="ancestor::s[@id != $this-sid] and preceding::t[position()=1]/ancestor::s[@id = $this-sid]">
+					<xsl:text>&#x09;</xsl:text>
+				</xsl:when>
+				
+				<!-- first word of the context -->
+				
+				<xsl:when test="position() = 1" />
+				
+				<!-- first word in a sentence -->
+				<xsl:when test="not(preceding-sibling::t)"><xsl:text> / </xsl:text></xsl:when>
+				
+				<xsl:otherwise><xsl:text> </xsl:text></xsl:otherwise>
+				
+			</xsl:choose>
+			<xsl:apply-templates select="." mode="output" />
+			<!-- add blank column if there's no out-of-sentence context -->
+			<xsl:if test="position() = last() and ancestor::s[@id = $this-sid]"><xsl:text>&#x09;</xsl:text></xsl:if>
+			
+		</xsl:for-each>
+		
+	</xsl:template>
+
+	<xsl:template match="s" mode="pivot">
+		<xsl:param name="inpivot" />
+
+			<xsl:variable name="firstpivotid">
+
+				<xsl:apply-templates select="$inpivot//t[1]" mode="id" />
+					
+			</xsl:variable>
+
+			<xsl:variable name="lastpivotid">
+				<xsl:apply-templates select="$inpivot//t[last()]" mode="id" />
+
+			</xsl:variable>
+
+		<xsl:for-each select="descendant::t" >
+			<xsl:variable name="thisid" select = "@id" />
+			<xsl:choose>
+				<xsl:when test="following-sibling::t[@id=$firstpivotid]" />
+				<xsl:when test="preceding-sibling::t[@id=$lastpivotid]" />
+				<xsl:when test="$inpivot//t[@id=$thisid]"><xsl:apply-templates select="." mode="output" /><xsl:text> </xsl:text></xsl:when>
+				<xsl:otherwise>[<xsl:apply-templates select="." mode="output" />]<xsl:text> </xsl:text></xsl:otherwise>
+			</xsl:choose>			
+		</xsl:for-each>
+
+	</xsl:template>
+
+	<xsl:template match="t" mode="output">
+		
+		<xsl:value-of select="@word" />
+
+	</xsl:template>
+
+	<xsl:template match="nt|t|s" mode="id">
+		
+		<xsl:value-of select="@id" />
+
+	</xsl:template>
+
+	<xsl:template match="nt" mode="get-terminals">
+
+		<xsl:for-each select="edge">
+
+			<xsl:apply-templates select="key('idkey', @idref)" mode="get-terminals" />
+	
+		</xsl:for-each>
+
+	</xsl:template>
+
+</xsl:stylesheet>
+

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/concordance_simple.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-teifrantext-teibfm.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-teifrantext-teibfm.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-teifrantext-teibfm.xsl	(revision 258)
@@ -0,0 +1,363 @@
+<?xml version="1.0"?>
+<xsl:stylesheet
+  xmlns:xd="http://www.pnp-software.com/XSLTdoc"
+  xmlns:edate="http://exslt.org/dates-and-times"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tei="http://www.tei-c.org/ns/1.0"
+  exclude-result-prefixes="tei edate xd" version="2.0">
+  
+  <xd:doc type="stylesheet">
+    <xd:short>
+      Feuille de style de préparation de fichiers TEI P5 à l'importation 
+      dans TXM. Permet de simplifier la structure du document afin
+      d'optimiser les index CWB
+    </xd:short>
+    <xd:detail>
+      This stylesheet is free software; you can redistribute it and/or
+      modify it under the terms of the GNU Lesser General Public
+      License as published by the Free Software Foundation; either
+      version 3 of the License, or (at your option) any later version.
+      
+      This stylesheet 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
+      Lesser General Public License for more details.
+      
+      You should have received a copy of GNU Lesser Public License with
+      this stylesheet. If not, see http://www.gnu.org/licenses/lgpl.html
+    </xd:detail>
+    <xd:author>Alexei Lavrentiev alexei.lavrentev@ens-lyon.fr</xd:author>
+    <xd:copyright>2012, CNRS / ICAR (ICAR3 LinCoBaTO)</xd:copyright>
+  </xd:doc>
+  
+
+  <xsl:output method="xml" encoding="utf-8" omit-xml-declaration="no"/>
+  
+  <!--
+    Modifications par AL le  2012-01-25
+    g dépalacé de "deleteAll" vers "deleteTag"
+    classe de balise "name" créée
+    (geogName, placeName, persName et name)
+  -->
+  
+  <!-- 
+    Modifications par LBe le 2012-02-17
+    Transformation automatique des esperluettes dans les métadonnées
+    Suppression des balises label et heraldry
+    Signed n'est plus transformé en ab
+    opener est transformé en ab
+    L'institution et le dépôt sont récupérés pour le lieu de conservation
+  -->
+  
+  <!-- Modifications par AL le 2012-02-20
+    rolename -> roleName
+    suppression des balises surname et forename
+  -->
+  
+  <!-- Modifications par LBe le 2012-03-09
+    Automatisation du nommage des sorties
+  -->
+  
+  <!-- Modification par AL le 2013-12-31 
+      harmonisation avec la feuille de style txm-filter-teip5-teibfm.xsl
+  -->
+  
+  <!-- Listes des balises par type de traitement (les templates sont plus bas) -->
+  
+  <!-- balises à supprimer avec leur contenu -->
+  <xsl:template match="tei:figDesc|tei:figure|tei:fw|tei:g
+    |tei:space|tei:titlePage ">
+    <xsl:call-template name="deleteAll"/>
+  </xsl:template>
+  
+  <!-- balises à supprimer, contenu à conserver -->  
+  <xsl:template match="tei:add|tei:app
+    |tei:caesura|tei:castItem|tei:castGroup[ancestor::tei:castList]
+    |tei:castList[ancestor::tei:p]|tei:cell|tei:choice|tei:cit|tei:corr|tei:date|tei:ex
+    |tei:forename|tei:g|tei:head[parent::tei:list]|tei:heraldry|tei:hi|tei:item|tei:label|tei:lem
+    |tei:list[ancestor::tei:p|ancestor::tei:ab]|tei:lg[child::tei:lg|ancestor::tei:sp]
+    |tei:p[ancestor::tei:sp]|tei:performance
+    |tei:ref|tei:reg|tei:role|tei:roleDesc
+    |tei:row|tei:salute|tei:signed[ancestor::tei:closer]|tei:speaker|tei:stage[ancestor::tei:p|ancestor::tei:ab]
+    |tei:surname|tei:table[ancestor::tei:p]|tei:subst|tei:term|tei:unclear">
+    <xsl:call-template name="deleteTag"/>
+  </xsl:template>
+  
+  <!-- balises à transformer en notes-->
+  <xsl:template match="tei:abbr[parent::tei:choice and not(ancestor::tei:note)]
+    |tei:bibl[not(ancestor::tei:note)]
+    |tei:del
+    |tei:orig[parent::tei:choice and not(ancestor::tei:note)]    
+    |tei:rdg[parent::tei:app and not(ancestor::tei:note)]
+    |tei:sic[parent::tei:choice and not(ancestor::tei:note)]
+    |tei:surplus[not(ancestor::tei:w)]">
+    <xsl:call-template name="makeNote"/>
+  </xsl:template>
+  
+  <!-- balises de noms à indexer -->
+  
+  <xsl:template match="tei:name
+    |tei:geogName
+    |tei:persName
+    |tei:placeName
+    |tei:roleName
+    |tei:orgName">
+    <xsl:call-template name="makeName"/>
+  </xsl:template>
+  
+  <!-- à transformer en W -->
+  
+  <xsl:template match="tei:abbr[not(parent::tei:choice)]
+    |tei:expan
+    |tei:num[matches(.,'.')]">
+    <xsl:call-template name="makeWord"/>
+  </xsl:template>
+  
+  <!-- à transformer en AB typé -->
+  
+  <xsl:template match="tei:byline|tei:lg[not(child::tei:lg or ancestor::tei:sp)]|tei:list[not(ancestor::tei:p|ancestor::tei:ab)]
+    |tei:closer|tei:opener|tei:sp|tei:castGroup[not(ancestor::tei:castList)]|tei:castList[not(ancestor::tei:p)]
+    |tei:signed[not(ancestor::tei:closer)]
+    |tei:stage[not(ancestor::tei:p|ancestor::tei:ab)]
+    |tei:table[not(ancestor::tei:p)]
+    |tei:trailer">
+    <xsl:call-template name="makeAb"/>
+  </xsl:template>
+  
+  <!-- à transformer en DIV typé -->
+  
+  <xsl:template match="tei:set">
+    <xsl:call-template name="makeDiv"/>
+  </xsl:template>
+
+<!-- Partie générale : on copie les éléments, les attributs, le texte, les commentaires, on supprime mes prrocessing intstructions -->
+
+<!--  <xsl:template match="/">
+      <xsl:apply-templates/>  
+  </xsl:template>
+-->
+  
+  <xsl:template match="*">    
+    <xsl:choose>
+      <xsl:when test="namespace-uri()=''">
+        <xsl:element namespace="http://www.tei-c.org/ns/1.0" name="{local-name(.)}">
+          <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
+        </xsl:element>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:copy>
+          <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
+        </xsl:copy>
+      </xsl:otherwise>
+    </xsl:choose>  
+  </xsl:template>
+
+  <xsl:template match="@*|comment()">
+    <xsl:copy/>
+  </xsl:template>
+
+  <xsl:template match="text()">
+    <xsl:analyze-string select="." regex="&amp;|&lt;|&gt;|--|\*(\w+)">
+      <xsl:matching-substring>
+        <xsl:choose>
+          <xsl:when test="matches(.,'&amp;')">
+            <expan xmlns="http://www.tei-c.org/ns/1.0">et</expan>
+          </xsl:when>
+          <xsl:when test="matches(.,'&lt;')">
+            <xsl:text>[</xsl:text>
+          </xsl:when>
+          <xsl:when test="matches(.,'&gt;')">
+            <xsl:text>]</xsl:text>
+          </xsl:when>
+          <!-- pose problème si se trouve dans les notes transformés en commentaires xml par le tokeniseur -->
+          <xsl:when test="matches(.,'--')">
+            <xsl:text> - </xsl:text>
+          </xsl:when>
+          <!-- Spécial FRANTEXT -->
+          <xsl:when test="matches(.,'\*(\w+)')">
+            <name xmlns="http://www.tei-c.org/ns/1.0" type="maj"><xsl:value-of select="regex-group(1)"/></name>        		
+          </xsl:when>          
+          <xsl:otherwise>
+            <xsl:value-of select="."/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:matching-substring>
+      <xsl:non-matching-substring>         
+        <xsl:value-of select="."/>
+      </xsl:non-matching-substring>      
+    </xsl:analyze-string>
+  </xsl:template>
+  
+
+  <xsl:template match="processing-instruction()"/>
+
+<!-- On ne touche pas au teiHeader -->
+  
+  <xsl:template match="tei:teiHeader">    
+      <xsl:copy-of select="."/>    
+  </xsl:template>
+
+<!-- On supprime les balises et tout ce qu'elles contiennent pour les éléments hors texte à ignorer lors de l'import -->
+  
+  <xsl:template name="deleteAll"/>
+
+<!-- On supprime les balises non essentielles pour l'exploitation textométrique et susceptibles de poser des problèmes au tokeniseur,
+  mais on garde leur contenu qui fait partie du matériau textuel -->
+  
+  <xsl:template name="deleteTag">
+    <xsl:apply-templates/>
+  </xsl:template>
+
+<!-- on met en note les éléments hors texte qu'on aimerait garder pour l'édition, etc. -->
+  
+  <xsl:template name="makeNote">
+    <note type="{local-name()}" xmlns="http://www.tei-c.org/ns/1.0">
+      <xsl:apply-templates select="text()"/>
+    </note>
+  </xsl:template>
+  
+<!-- On supprime toutes les balises à l'intérieur des notes-->
+  <xsl:template match="tei:note">
+    <xsl:copy>
+      <xsl:apply-templates select="text()"/>
+    </xsl:copy>
+  </xsl:template>
+
+<!-- On transforme en DIV typés les balises de niveau de division textuelle (pouvant contenir des p) -->
+
+  <xsl:template name="makeDiv">
+    <div type="{local-name()}" xmlns="http://www.tei-c.org/ns/1.0">
+      <xsl:copy-of select="@*"/>
+      <xsl:apply-templates/>
+    </div>
+  </xsl:template>  
+
+<!-- On transforme en bloc anonyme les balises de niveau équivalent au paragraphe -->
+
+  <xsl:template name="makeAb">
+    <ab type="{local-name()}" xmlns="http://www.tei-c.org/ns/1.0">
+      <xsl:copy-of select="@*"/>
+      <xsl:apply-templates/>
+    </ab>
+  </xsl:template>
+
+  <!-- on pré-tokenise les éléments équivalents à un mot -->
+  
+  <xsl:template name="makeWord">
+    <xsl:variable name="wordType">
+      <xsl:choose>
+        <xsl:when test="@type">
+          <xsl:value-of select="concat(local-name(),'-',@type)"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="local-name()"></xsl:value-of>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:choose>
+      <xsl:when test="descendant::tei:w or ancestor::tei:w">
+<!--            <xsl:element namespace="http://www.tei-c.org/ns/1.0" name="seg">
+              <xsl:attribute name="type"><xsl:value-of select="local-name(.)"/></xsl:attribute>
+              <xsl:apply-templates select="*|@*[not(name()='type')]|processing-instruction()|comment()|text()"/>
+            </xsl:element>
+-->
+        <xsl:apply-templates/> <!-- on supprime ces balises pour éviter la réduplication des mots-->
+      </xsl:when>
+      <xsl:otherwise>
+        <w type="{$wordType}" xmlns="http://www.tei-c.org/ns/1.0"><xsl:apply-templates/></w>
+      </xsl:otherwise>
+    </xsl:choose>    
+  </xsl:template>  
+
+<xsl:template name="makeName">
+  <xsl:variable name="nameType">
+    <xsl:choose>
+      <xsl:when test="@type">
+        <xsl:choose>
+          <xsl:when test="local-name()='name'"><xsl:value-of select='@type'/></xsl:when>
+          <xsl:otherwise><xsl:value-of select="concat(local-name(),'-',@type)"/></xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="local-name()"></xsl:value-of>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+  <name type="{$nameType}" xmlns="http://www.tei-c.org/ns/1.0">
+    <xsl:apply-templates/>
+  </name>
+</xsl:template>
+
+<!-- les l sont transformés en lb -->
+  
+  <xsl:template match="tei:l">
+    <lb xmlns="http://www.tei-c.org/ns/1.0">
+      <xsl:if test="@n">
+        <xsl:attribute name="n"><xsl:value-of select="@n"/></xsl:attribute>
+      </xsl:if>
+    </lb>
+    <xsl:apply-templates/>
+  </xsl:template>
+  
+
+<!-- On met la ponctuation forte à l'extérieur de la balise foreign :
+Cet élément sera toujours à l'intérieur d'une phrase. Attention au risque
+de perdre les balises éventuelles à l'intérieur-->
+  
+  <xsl:template
+    match="tei:foreign[not(contains(@rend,'multi_s'))][matches(.,'[.!?]')]">
+    <xsl:variable name="lang">
+      <xsl:choose>
+        <xsl:when test="@lang"><xsl:value-of select="@lang"/></xsl:when>
+        <xsl:when test="@xml:lang"><xsl:value-of select="@xml:lang"/></xsl:when>
+        <xsl:otherwise>xx</xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:for-each select="child::node()">
+      <xsl:choose>
+        <xsl:when test="self::text()">
+          <xsl:analyze-string select="." regex="([^.!?]*)([.?!]+)">
+            <xsl:matching-substring>
+              <xsl:element name="foreign" namespace="http://www.tei-c.org/ns/1.0">
+                <xsl:attribute name="lang"><xsl:value-of select="$lang"/></xsl:attribute>
+                <xsl:analyze-string select="regex-group(1)" regex="&amp;">
+                  <xsl:matching-substring><expan xmlns="http://www.tei-c.org/ns/1.0">et</expan></xsl:matching-substring>
+                  <xsl:non-matching-substring>         
+                    <xsl:value-of select="."/>
+                  </xsl:non-matching-substring>      
+                </xsl:analyze-string>
+              </xsl:element>
+              <xsl:value-of select="regex-group(2)"/>
+              <xsl:text> </xsl:text>
+            </xsl:matching-substring>
+            <xsl:non-matching-substring>
+              <xsl:analyze-string select="." regex="&amp;">
+                <xsl:matching-substring><expan xmlns="http://www.tei-c.org/ns/1.0">et</expan></xsl:matching-substring>
+                <xsl:non-matching-substring>         
+                  <xsl:value-of select="."/>
+                </xsl:non-matching-substring>      
+              </xsl:analyze-string>              
+            </xsl:non-matching-substring>
+          </xsl:analyze-string>          
+        </xsl:when>
+        <xsl:when test="self::*[not(descendant::text())]">
+          <xsl:apply-templates/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:element name="foreign" namespace="http://www.tei-c.org/ns/1.0">
+            <xsl:attribute name="lang"><xsl:value-of select="$lang"/></xsl:attribute>
+            <xsl:apply-templates select="."/>          
+          </xsl:element>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:for-each>
+  </xsl:template>
+  
+  
+  <xsl:template name="persname">
+      <xsl:choose>
+         <xsl:when test="tei:surname"><xsl:value-of select="tei:forename"/>&#160;<xsl:value-of select="tei:surname"/></xsl:when>
+         <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
+      </xsl:choose>
+   </xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-teifrantext-teibfm.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/concordance_mot-pivot.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/concordance_mot-pivot.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/concordance_mot-pivot.xsl	(revision 258)
@@ -0,0 +1,301 @@
+﻿<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
+				xmlns:exsl="http://exslt.org/common">
+
+	<xsl:output method="text" encoding="UTF-8" indent="no" />
+
+	<xsl:strip-space elements="*" />
+
+	<xsl:param name="cx" select="30"/>
+	<!-- vary this value to change the size of the context -->
+	
+	<xsl:param name="ntTypes">cat</xsl:param>
+	<!-- non-terminal pivot features to show -->
+	
+	<xsl:param name="tTypes" >pos</xsl:param>
+	<!-- terminal pivot features to show -->
+	
+	<xsl:variable name="valueshownt" ><xsl:value-of select="$ntTypes" /></xsl:variable>
+	
+	<xsl:variable name="valueshowt" ><xsl:value-of select="$tTypes" /></xsl:variable>
+
+	<xsl:key name="idkey" match="t|nt" use="@id"/>
+	<!-- Lezius' lookup key -->
+
+	<xsl:key name="idkey-reverse" match="edge" use="@idref"/>
+	<!-- reverse lookup key -->
+
+	<xsl:template match="/">
+		
+		<!--Write a header-->
+		
+		<xsl:text>ID&#x09;LeftCxOutsideSnt&#x09;LeftCxInsideSnt&#x09;Pivot&#x09;</xsl:text>
+		
+		<xsl:for-each select="tokenize($valueshowt/node(), '\s+')">
+			
+			<xsl:value-of select="." /><xsl:text>&#x09;</xsl:text>
+			
+		</xsl:for-each>
+		
+		<xsl:text>PivotStr&#x09;</xsl:text>
+		
+		<xsl:for-each select="tokenize($valueshownt/node(), '\s+')">
+			
+			<xsl:value-of select="." /><xsl:text>&#x09;</xsl:text>
+			
+		</xsl:for-each>
+	
+		<xsl:text>RightCxInsideSnt&#x09;RightCxOutsideSnt&#x0D;&#x0A;</xsl:text>
+
+		<xsl:for-each select=".//match">
+
+			<!-- only treat match nodes -->
+
+			<!-- first column: print sentence ID -->
+
+			<xsl:value-of select="ancestor::s/@id" />
+
+			<!-- next, verify that pivot is a terminal node -->
+
+			<xsl:variable name="pivot-var" select="./variable[@name='#pivot']" />
+
+			<xsl:variable name="pivot-node" select="key('idkey', exsl:node-set($pivot-var)/@idref)" />
+
+			<xsl:choose>
+
+				<xsl:when test="exsl:node-set($pivot-node)[self::t]">
+
+					<xsl:apply-templates select="exsl:node-set($pivot-node)" mode="write-table" />
+
+				</xsl:when>
+
+				<xsl:otherwise><xsl:text>&#x09;Query error: #pivot is not a terminal node</xsl:text></xsl:otherwise>
+
+			</xsl:choose>
+
+			<xsl:text>&#x0d;&#x0a;</xsl:text>
+
+		</xsl:for-each>
+
+	</xsl:template>
+
+	<xsl:template match="t" mode="write-table">
+		
+		<!-- Context node is a t-node pivot -->
+
+		<!-- First stage: produce left context -->
+
+		<xsl:text>&#x09;</xsl:text><xsl:apply-templates select="." mode="left-cx" />
+
+		<!-- Next stage, write the word in the pivot -->
+
+		<xsl:text>&#x09;</xsl:text><xsl:apply-templates select="." mode="output" />
+
+		<!-- Next stage, write other required terminal attributes -->
+		
+		<xsl:variable name="thispivot" select="." />
+		
+		<xsl:text>&#x09;</xsl:text>
+		<xsl:for-each select="tokenize($valueshowt/node(), '\s+')">
+			
+			<xsl:variable name="attr" select="."/>
+			
+			<xsl:value-of select="$thispivot/@*[name()=$attr]"/><xsl:text>&#x09;</xsl:text>
+			
+		</xsl:for-each>
+		
+		<!-- Next stage, write the lexical string contained in the parent NT node -->
+
+		<xsl:apply-templates select="key('idkey-reverse', @id)/ancestor::nt" mode="output" />
+
+		<!-- Next stage, write the required <nt /> properties -->
+		
+		<xsl:variable name="pivotnt" select="key('idkey-reverse', @id)/.." />
+		
+		<xsl:text>&#x09;</xsl:text>
+		<xsl:for-each select="tokenize($valueshownt/node(), '\s+')">
+			
+			<xsl:variable name="attr" select="."/>
+			
+			<xsl:value-of select="$pivotnt/@*[name()=$attr]"/><xsl:text>&#x09;</xsl:text>
+			
+		</xsl:for-each>
+
+		<!-- Next stage, write the right-cx -->
+
+		<xsl:apply-templates select="." mode="right-cx"/>
+
+	</xsl:template>
+
+	<xsl:template match="t" mode="left-cx">
+
+		<xsl:variable name="pivot-node" select="." />
+		<xsl:variable name="this-sid"><xsl:value-of select="ancestor::s/@id" /></xsl:variable>
+
+		<xsl:for-each select="preceding::t[position() &lt; number($cx)]" >
+			<!-- xsl:sort select="@id" / -->
+			<xsl:choose>
+				<!-- switch from out-of-sentence to in-sentence context -->
+				<xsl:when test="ancestor::s[@id = $this-sid] and not(preceding-sibling::t)">
+					<xsl:text>&#x09;</xsl:text>
+				</xsl:when>
+
+				<!-- first word of the context and in the same sentence -->
+
+				<xsl:when test="position() = 1 and ancestor::s[@id=$this-sid]"><xsl:text>&#x09;</xsl:text></xsl:when>
+
+				<!-- first word of the context -->
+
+				<xsl:when test="position() = 1" />
+
+				<!-- first word in a sentence -->
+				<xsl:when test="not(preceding-sibling::t)"><xsl:text> / </xsl:text></xsl:when>
+
+				<xsl:otherwise><xsl:text> </xsl:text></xsl:otherwise>
+
+			</xsl:choose>
+
+			<xsl:apply-templates select="." mode="output" />
+	
+			<!-- add blank column if there's no in-sentence context -->
+			<xsl:if test="position() = last() and ancestor::s[@id != $this-sid]"><xsl:text>&#x09;</xsl:text></xsl:if>
+
+		</xsl:for-each>
+
+	</xsl:template>
+
+	<xsl:template match="t" mode="right-cx">
+
+		<xsl:variable name="pivot-node" select="." />
+		<xsl:variable name="this-sid"><xsl:value-of select="ancestor::s/@id" /></xsl:variable>
+
+		<xsl:for-each select="following::t[position() &lt; number($cx)]" >
+			<!-- xsl:sort select="@id" / -->
+			<xsl:choose>
+				<!-- switch from in-sentence to out-of-sentence context -->
+				<xsl:when test="ancestor::s[@id != $this-sid] and preceding::t[position()=1]/ancestor::s[@id = $this-sid]">
+					<xsl:text>&#x09;</xsl:text>
+				</xsl:when>
+
+				<!-- first word of the context -->
+
+				<xsl:when test="position() = 1" />
+
+				<!-- first word in a sentence -->
+				<xsl:when test="not(preceding-sibling::t)"><xsl:text> / </xsl:text></xsl:when>
+
+				<xsl:otherwise><xsl:text> </xsl:text></xsl:otherwise>
+
+			</xsl:choose>
+			<xsl:apply-templates select="." mode="output" />
+			<!-- add blank column if there's no out-of-sentence context -->
+			<xsl:if test="position() = last() and ancestor::s[@id = $this-sid]"><xsl:text>&#x09;</xsl:text></xsl:if>
+
+		</xsl:for-each>
+
+	</xsl:template>
+
+	<xsl:template match="nt|t|s" mode="id">
+		
+		<xsl:value-of select="@id" />
+
+	</xsl:template>
+
+	<xsl:template match="variable" mode="name">
+		
+		<xsl:value-of select="@name" />
+
+	</xsl:template>
+
+	<xsl:template match="t" mode="output">
+		
+		<xsl:value-of select="@word" />
+
+	</xsl:template>
+
+
+
+	<xsl:template match="nt" mode="output">
+
+		<!-- prints lexical content of nt node in correct order with constituents not in the pivot bracketed -->
+
+		<!-- stuff a copy of all the tnodes in the pivot in $in-pivot -->
+		<xsl:variable name='in-pivot'>
+			<xsl:apply-templates select="." mode="get-terminals" />
+		</xsl:variable>
+
+		<!-- create a copy of terminals, with an attribute "in-pivot='True'" -->
+
+		<xsl:variable name="new-terminals">
+
+			<xsl:for-each select="ancestor::s//t">
+
+				<xsl:variable name="current-id"><xsl:value-of select="@id" /></xsl:variable>
+
+				<!-- copy element into variable -->
+
+				<xsl:copy>
+
+					<xsl:if test="exsl:node-set($in-pivot)//t[@id = $current-id]">
+						<xsl:attribute name="in-pivot">True</xsl:attribute>
+					</xsl:if>
+					<xsl:apply-templates select="@*" mode="copy"/>
+
+				</xsl:copy>
+
+			</xsl:for-each>
+
+		</xsl:variable>
+
+		<!-- $new-terminals is in the correct order, so we can calculate the limits of the segment -->
+
+		<xsl:variable name="first-pivot-id"><xsl:value-of select="exsl:node-set($new-terminals)//t[@in-pivot][position()=1]/@id" /></xsl:variable>
+
+		<xsl:variable name="last-pivot-id"><xsl:value-of select="exsl:node-set($new-terminals)//t[@in-pivot][position()=last()]/@id" /></xsl:variable>
+
+		<!-- At last! At last! We can output the MF! -->
+
+		<xsl:for-each select="exsl:node-set($new-terminals)//t">
+
+			<xsl:if test="@id = $first-pivot-id or @id = $last-pivot-id or (preceding-sibling::t[@id = $first-pivot-id] and following-sibling::t[@id = $last-pivot-id])">
+
+				<!-- print the word -->
+				
+				<xsl:if test="not(@id = $first-pivot-id)"><xsl:text> </xsl:text></xsl:if>
+
+				<xsl:choose>
+
+					<xsl:when test="@in-pivot"><xsl:apply-templates select="." mode="output" /></xsl:when>
+
+					<xsl:otherwise><xsl:text>[</xsl:text><xsl:apply-templates select="." mode="output" /><xsl:text>]</xsl:text></xsl:otherwise>
+
+				</xsl:choose>
+
+			</xsl:if>
+
+		</xsl:for-each>
+
+	</xsl:template>
+
+	<xsl:template match="@*" mode="copy">
+		<!-- returns a copy of all attribute nodes -->
+		<xsl:copy />
+	</xsl:template>	
+
+	<xsl:template match="t" mode="get-terminals">
+
+		<xsl:copy-of select="." />
+
+	</xsl:template>
+
+	<xsl:template match="nt" mode="get-terminals">
+
+		<xsl:for-each select="edge">
+
+			<xsl:apply-templates select="key('idkey', @idref)" mode="get-terminals" />
+	
+		</xsl:for-each>
+
+	</xsl:template>
+
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/concordance_mot-pivot.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-teip5-xmlw-preserve.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-teip5-xmlw-preserve.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-teip5-xmlw-preserve.xsl	(revision 258)
@@ -0,0 +1,113 @@
+<?xml version="1.0"?>
+<xsl:stylesheet
+  xmlns:xd="http://www.pnp-software.com/XSLTdoc"
+  xmlns:edate="http://exslt.org/dates-and-times"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tei="http://www.tei-c.org/ns/1.0"
+  exclude-result-prefixes="tei edate xd" version="2.0">
+  
+  <xd:doc type="stylesheet">
+    <xd:short>
+      Feuille de style de préparation de fichiers TEI à l'importation
+      TXM dans un format xml simple. 
+    </xd:short>
+    <xd:detail>
+      This stylesheet is free software; you can redistribute it and/or
+      modify it under the terms of the GNU Lesser General Public
+      License as published by the Free Software Foundation; either
+      version 3 of the License, or (at your option) any later version.
+      
+      This stylesheet 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
+      Lesser General Public License for more details.
+      
+      You should have received a copy of GNU Lesser Public License with
+      this stylesheet. If not, see http://www.gnu.org/licenses/lgpl.html
+    </xd:detail>
+    <xd:author>Alexei Lavrentiev alexei.lavrentev@ens-lyon.fr</xd:author>
+    <xd:copyright>2012, CNRS / ICAR (ICAR3 LinCoBaTO)</xd:copyright>
+  </xd:doc>
+  
+
+  <xsl:output method="xml" encoding="utf-8" omit-xml-declaration="no"/>
+  
+	<!-- Listes des balises par type de traitement. -->
+	
+	<!--Par défaut, les balises sont conservées (les espaces de nommage sont
+	respectés). On peut utiliser les paramètres ci-dessous pour indiquer les balises
+	à supprimer en conservant ou non leur contenu--> 
+	
+	<!-- balises à supprimer avec leur contenu -->
+	
+	<xsl:param name="deleteAll">teiHeader|facsimile</xsl:param>
+	
+	<xsl:template match="*[matches(name(),concat('^',$deleteAll,'$'))]"/>
+	
+	<!-- balises à supprimer en conservant le contenu-->
+	
+	<xsl:param name="deleteTag"></xsl:param>
+	
+	<xsl:template match="*[matches(name(),concat('^',$deleteTag,'$'))]">
+		<xsl:apply-templates/>
+	</xsl:template>
+	
+  
+  <xsl:template match="*">
+  	<xsl:copy>
+  		<xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>	
+  	</xsl:copy>
+  </xsl:template>
+
+  <xsl:template match="@*|comment()">
+    <xsl:copy/>
+  </xsl:template>
+	
+	<xsl:template match="processing-instruction()"/>
+	
+	<xsl:template match="text()"><xsl:value-of select="."/></xsl:template>
+
+	<!-- On supprime le teiHeader  pour l'import xml-w -->
+	
+	<xsl:template match="tei:teiHeader">    
+		<!--<xsl:copy-of select="."/>-->    
+	</xsl:template>
+	
+	<xsl:template match="tei:facsimile">    
+		<!--<xsl:copy-of select="."/>-->    
+	</xsl:template>
+	
+
+	<!-- ancien filtre pour les noeuds texte, n'est plus nécessaire pour l'import xml/w TXM 0.5 -->
+
+  <!--<xsl:template match="text()">
+  	<xsl:analyze-string select="." regex="&amp;lt;|&amp;gt;|&lt;|&gt;|-\-">
+      <xsl:matching-substring>
+        <xsl:choose>
+        	<xsl:when test="matches(.,'&amp;lt;')">
+        		<xsl:text>‹</xsl:text>
+        	</xsl:when>
+        	<xsl:when test="matches(.,'&amp;gt;')">
+        		<xsl:text>›</xsl:text>
+        	</xsl:when>
+          <xsl:when test="matches(.,'&lt;')">
+            <xsl:text>‹</xsl:text>
+          </xsl:when>
+          <xsl:when test="matches(.,'&gt;')">
+            <xsl:text>›</xsl:text>
+          </xsl:when>
+          <!-\- pose problème si se trouve dans les notes transformés en commentaires xml par le tokeniseur -\->
+          <xsl:when test="matches(.,'-\-')">
+            <xsl:text> - </xsl:text>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:value-of select="."/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:matching-substring>
+      <xsl:non-matching-substring>         
+            <xsl:value-of select="."/>
+      </xsl:non-matching-substring>      
+    </xsl:analyze-string>
+  </xsl:template>-->
+
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-teip5-xmlw-preserve.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-teip5-xmlw-simplify.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-teip5-xmlw-simplify.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-teip5-xmlw-simplify.xsl	(revision 258)
@@ -0,0 +1,231 @@
+<?xml version="1.0"?>
+<xsl:stylesheet
+  xmlns:xd="http://www.pnp-software.com/XSLTdoc"
+  xmlns:edate="http://exslt.org/dates-and-times"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tei="http://www.tei-c.org/ns/1.0"
+  exclude-result-prefixes="tei edate xd" version="2.0">
+  
+  <xd:doc type="stylesheet">
+    <xd:short>
+      Feuille de style de préparation de fichiers TEI P5 à l'importation 
+      dans TXM en utilisant le module d'import xml-w. Permet de supprimer
+      le contenu de teiHeader et des élements hors-texte et de supprimer
+      les balises non utilisées dans les index TXM.
+      Par défaut, toutes les balises sauf celles qui sont listées dans le
+      paramètre "copyAll" sont supprimées
+    </xd:short>
+    <xd:detail>
+      This stylesheet is free software; you can redistribute it and/or
+      modify it under the terms of the GNU Lesser General Public
+      License as published by the Free Software Foundation; either
+      version 3 of the License, or (at your option) any later version.
+      
+      This stylesheet 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
+      Lesser General Public License for more details.
+      
+      You should have received a copy of GNU Lesser Public License with
+      this stylesheet. If not, see http://www.gnu.org/licenses/lgpl.html
+    </xd:detail>
+    <xd:author>Alexei Lavrentiev alexei.lavrentev@ens-lyon.fr</xd:author>
+    <xd:copyright>2012, CNRS / ICAR (ICAR3 LinCoBaTO)</xd:copyright>
+  </xd:doc>
+  
+
+  <xsl:output method="xml" encoding="utf-8" omit-xml-declaration="no"/>
+  
+  <!-- Listes des balises par type de traitement. -->
+  
+	<!-- balises à supprimer avec leur contenu -->
+  
+	<xsl:param name="deleteAll">teiHeader|facsimile|note</xsl:param>
+	
+	<xsl:template match="*[matches(name(),concat('^',$deleteAll,'$'))]">
+		<xsl:call-template name="deleteAll"/>
+	</xsl:template>
+		
+	<!-- balises à conserver  -->
+	<xsl:param name="copyAll">ab|body|div|front|head|lb|p|pb|s|TEI|text|w</xsl:param>
+	
+	<xsl:template match="*[matches(name(),concat('^',$copyAll,'$'))]">
+		<xsl:call-template name="copyAll"></xsl:call-template>
+	</xsl:template>
+	
+	<!-- balises à supprimer, contenu à conserver, c'est la règle par défaut -->  
+	<xsl:template match="*">
+		<xsl:call-template name="deleteTag"/>
+	</xsl:template>
+  
+  <!-- balises à transformer en notes-->
+  <!--<xsl:template match="">
+    <xsl:call-template name="makeNote"/>
+  </xsl:template>-->
+  
+
+  <!-- balises à transformer en W -->
+  
+<!--  <xsl:template match="tei:abbr[not(parent::tei:choice)]
+    |tei:expan
+    |tei:num[matches(.,'.')]">
+    <xsl:call-template name="makeWord"/>
+  </xsl:template>-->
+  
+  <!-- à transformer en AB typé -->
+  
+<!--  <xsl:template match="">
+    <xsl:call-template name="makeAb"/>
+  </xsl:template>
+-->  
+  <!-- à transformer en DIV typé -->
+  
+<!--  <xsl:template match="">
+    <xsl:call-template name="makeDiv"/>
+  </xsl:template>
+-->
+<!-- Partie générale : on copie les éléments, les attributs, le texte, les commentaires, on supprime mes prrocessing intstructions -->
+
+  <xsl:template match="@*|comment()">
+    <xsl:copy/>
+  </xsl:template>
+
+<xsl:template match="processing-instruction()"/>
+
+<xsl:template match="text()"><xsl:value-of select="."/></xsl:template>
+
+	<!-- ancien filtre pour les noeuds texte, n'est plus nécessaire pour l'import xml/w TXM 0.5 -->
+	
+	<!--<xsl:template match="text()">
+  	<xsl:analyze-string select="." regex="&amp;lt;|&amp;gt;|&lt;|&gt;|-\-">
+      <xsl:matching-substring>
+        <xsl:choose>
+        	<xsl:when test="matches(.,'&amp;lt;')">
+        		<xsl:text>‹</xsl:text>
+        	</xsl:when>
+        	<xsl:when test="matches(.,'&amp;gt;')">
+        		<xsl:text>›</xsl:text>
+        	</xsl:when>
+          <xsl:when test="matches(.,'&lt;')">
+            <xsl:text>‹</xsl:text>
+          </xsl:when>
+          <xsl:when test="matches(.,'&gt;')">
+            <xsl:text>›</xsl:text>
+          </xsl:when>
+          <!-\- pose problème si se trouve dans les notes transformés en commentaires xml par le tokeniseur -\->
+          <xsl:when test="matches(.,'-\-')">
+            <xsl:text> - </xsl:text>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:value-of select="."/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:matching-substring>
+      <xsl:non-matching-substring>         
+            <xsl:value-of select="."/>
+      </xsl:non-matching-substring>      
+    </xsl:analyze-string>
+  </xsl:template>-->
+	
+
+<!-- On garde les balises utiles pour l'exploitation TXM -->
+  
+  <xsl:template name="copyAll">    
+  	<xsl:copy>
+  		<xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>	
+  	</xsl:copy>
+  </xsl:template>
+  
+
+<!-- On supprime les balises et tout ce qu'elles contiennent pour les éléments hors texte à ignorer lors de l'import -->
+  
+  <xsl:template name="deleteAll"/>
+
+<!-- On supprime les balises non essentielles pour l'exploitation textométrique et susceptibles de poser des problèmes au tokeniseur,
+  mais on garde leur contenu qui fait partie du matériau textuel -->
+  
+  <xsl:template name="deleteTag">
+    <xsl:apply-templates/>
+  </xsl:template>
+
+<!-- on met en note les éléments hors texte qu'on aimerait garder pour l'édition, etc. -->
+  
+  <xsl:template name="makeNote">
+    <note type="{local-name()}" xmlns="http://www.tei-c.org/ns/1.0">
+      <xsl:value-of select="."/>
+    </note>
+  </xsl:template>
+  
+<!-- On supprime toutes les balises à l'intérieur des notes-->
+<!--  <xsl:template match="tei:note">
+    <xsl:copy>
+      <xsl:value-of select="."></xsl:value-of>
+    </xsl:copy>
+  </xsl:template>
+-->
+  
+<!-- On transforme en DIV typés les balises de niveau de division textuelle (pouvant contenir des p) -->
+
+  <xsl:template name="makeDiv">
+    <div type="{local-name()}" xmlns="http://www.tei-c.org/ns/1.0">
+      <xsl:copy-of select="@*"/>
+      <xsl:apply-templates/>
+    </div>
+  </xsl:template>  
+
+<!-- On transforme en bloc anonyme les balises de niveau équivalent au paragraphe -->
+
+  <xsl:template name="makeAb">
+    <ab type="{local-name()}" xmlns="http://www.tei-c.org/ns/1.0">
+      <xsl:copy-of select="@*"/>
+      <xsl:apply-templates/>
+    </ab>
+  </xsl:template>
+
+  <!-- on pré-tokenise les éléments équivalents à un mot -->
+  
+  <xsl:template name="makeWord">
+    <xsl:variable name="wordType">
+      <xsl:choose>
+        <xsl:when test="@type">
+          <xsl:value-of select="concat(local-name(),'-',@type)"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="local-name()"></xsl:value-of>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <w type="{$wordType}" xmlns="http://www.tei-c.org/ns/1.0"><xsl:apply-templates/></w>
+  </xsl:template>  
+
+<!--<xsl:template name="makeName">
+  <xsl:variable name="nameType">
+    <xsl:choose>
+      <xsl:when test="@type">
+        <xsl:choose>
+          <xsl:when test="local-name()='name'"><xsl:value-of select='@type'/></xsl:when>
+          <xsl:otherwise><xsl:value-of select="concat(local-name(),'-',@type)"/></xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="local-name()"></xsl:value-of>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+  <name type="{$nameType}" xmlns="http://www.tei-c.org/ns/1.0">
+    <xsl:apply-templates/>
+  </name>
+</xsl:template>
+-->
+<!-- les l sont transformés en lb -->
+  
+  <xsl:template match="tei:l">
+    <lb xmlns="http://www.tei-c.org/ns/1.0">
+      <xsl:if test="@n">
+        <xsl:attribute name="n"><xsl:value-of select="@n"/></xsl:attribute>
+      </xsl:if>
+    </lb>
+    <xsl:apply-templates/>
+  </xsl:template>
+  
+
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-teip5-xmlw-simplify.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/breakByMilestone.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/breakByMilestone.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/breakByMilestone.xsl	(revision 258)
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" xmlns:tei="http://www.tei-c.org/ns/1.0" xmlns:me="http://www.menota.org/ns/1.0" xmlns:bfm="http://bfm.ens-lsh.fr/ns/1.0">
+
+    <!-- Based on a stylesheet for creating separate XML-TEI files for
+        each page by Paul Caton (posted on TEI-L 2008-12-11)-->
+
+    <xsl:output method="xml" encoding="UTF-8"/>
+
+    <xsl:param name="pbval1">7</xsl:param>
+    <xsl:param name="pbval2">8</xsl:param>
+
+    <xsl:function name="tei:page-content" as="node()*">
+        <xsl:param name="pb1" as="node()"/>
+        <xsl:param name="pb2" as="node()"/>
+        <xsl:param name="node" as="node()"/>
+        <xsl:choose>
+            <xsl:when test="$node[self::*]">
+                <!-- $node is an element() -->
+                <xsl:choose>
+                    <!--                    <xsl:when test="$node is $pb1">
+                        <xsl:copy-of select="$node"/>
+                    </xsl:when>
+-->
+                    <xsl:when
+                        test="some $n in $node/descendant::* satisfies ($n is $pb1 or $n is $pb2)">
+                        <xsl:element name="{name($node)}" namespace="http://www.tei-c.org/ns/1.0">
+                            <!--<xsl:attribute name="testttt">http://www.menota.org/ns/1.0</xsl:attribute>-->
+                            <xsl:sequence select="for $i in ( $node/node() | $node/@* ) return tei:page-content($pb1, $pb2, $i)"/>
+                        </xsl:element>
+                    </xsl:when>
+                    <xsl:when test="($node >> $pb1) and ($node &lt;&lt; $pb2)">
+                        <xsl:copy-of select="$node"/>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <!-- do nothing -->
+                    </xsl:otherwise>
+                </xsl:choose>
+            </xsl:when>
+            <xsl:when test="$node[count(. | ../@*) = count(../@*)]">
+                <!-- $node is an attribute -->
+                <xsl:attribute name="{name($node)}">
+                    <xsl:sequence select="data($node)"/>
+                </xsl:attribute>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:choose>
+                    <xsl:when test="($node >> $pb1) and ($node &lt;&lt; $pb2)">
+                        <xsl:copy-of select="$node"/>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <!-- do nothing -->
+                    </xsl:otherwise>
+                </xsl:choose>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:function>
+
+    <xsl:template match="*|text()|@*">
+        <xsl:copy>
+            <xsl:apply-templates select="@*"/>
+            <xsl:apply-templates/>
+        </xsl:copy>
+    </xsl:template>
+
+    <xsl:template match="processing-instruction()">
+        <xsl:copy>
+            <xsl:value-of select="."/>
+        </xsl:copy>
+    </xsl:template>
+
+    <xsl:template match="body">
+        <!-- <xsl:variable name="containingNode" select="//text"/> -->
+        <xsl:sequence select="tei:page-content(//pb[@id=$pbval1], //pb[@id=$pbval2], //body)"/>
+    </xsl:template>
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/breakByMilestone.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-teibvh-xmlw-posttok.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-teibvh-xmlw-posttok.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-teibvh-xmlw-posttok.xsl	(revision 258)
@@ -0,0 +1,369 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:edate="http://exslt.org/dates-and-times"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tei="http://www.tei-c.org/ns/1.0" xmlns:txm="http://textometrie.org/1.0"
+  exclude-result-prefixes="tei edate txm" xpath-default-namespace="http://www.tei-c.org/ns/1.0" version="2.0">
+
+  <xsl:output method="xml" encoding="utf-8" omit-xml-declaration="no"/> 
+  
+  
+<!-- Partie générale : on copie les éléments, les attributs, le texte, les commentaires, on supprime mes prrocessing intstructions -->
+  
+  <xsl:template match="*">      
+        <xsl:copy>
+          <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
+        </xsl:copy>    
+  </xsl:template>
+  
+  <xsl:template match="*" mode="position"><xsl:value-of select="count(preceding-sibling::*)"/></xsl:template>
+
+
+  <xsl:template match="@*|comment()|processing-instruction()">
+    <xsl:copy/>
+  </xsl:template>
+
+  <xsl:template match="text()">
+    <xsl:value-of select="."/>
+  </xsl:template>
+
+  <xsl:template match="teiHeader"/>
+  
+  <xsl:template match="text">
+    <xsl:copy>
+      <xsl:apply-templates select="@*"/>
+      <xsl:if test="not(child::*[1][self::pb])"><pb xmlns="http://www.tei-c.org/ns/1.0" n="title"/></xsl:if>
+      <xsl:apply-templates/>
+    </xsl:copy>
+  </xsl:template>
+
+  <xsl:template match="choice[not(@txm:wordPart)]">
+    <xsl:choose>
+      <xsl:when test="child::corr">
+        <corr xmlns="http://www.tei-c.org/ns/1.0">
+          <xsl:attribute name="sic"><xsl:value-of select="normalize-space(child::sic)"/></xsl:attribute>
+          <xsl:apply-templates select="child::corr/w"/>
+        	<xsl:if test="child::sic//lb and not(child::corr//lb)"><xsl:copy-of select="child::sic//lb"/></xsl:if>
+        </corr>
+      </xsl:when>
+      <xsl:when test="child::reg">
+        <reg xmlns="http://www.tei-c.org/ns/1.0">
+          <xsl:attribute name="orig"><xsl:value-of select="normalize-space(child::orig)"/></xsl:attribute>
+          <xsl:apply-templates select="child::reg/w"/>
+        	<xsl:if test="child::orig//lb  and not(child::reg//lb)"><xsl:copy-of select="child::orig//lb"/></xsl:if>
+        </reg>
+      </xsl:when>
+      <xsl:when test="child::expan">
+        <expan xmlns="http://www.tei-c.org/ns/1.0">
+          <xsl:attribute name="abbr"><xsl:value-of select="normalize-space(child::abbr)"/></xsl:attribute>
+          <xsl:apply-templates select="child::expan/w"/>
+        </expan>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:template>
+  
+  <xsl:template match="w">
+    <xsl:variable name="nextLb">
+      <xsl:choose>
+      	<xsl:when test="following::lb">
+      		<xsl:apply-templates select="following::lb[1]" mode="position"/>
+      	</xsl:when>      	
+<!--        <xsl:when test="following::lb[@rend='hyphen']">
+          <xsl:apply-templates select="following::lb[@rend='hyphen'][1]" mode="position"/>
+        </xsl:when>-->
+        <xsl:otherwise>99999999</xsl:otherwise>
+      </xsl:choose>      
+    </xsl:variable>
+    <xsl:variable name="nextW1">
+      <xsl:choose>
+        <xsl:when test="following-sibling::w[1]">
+          <xsl:apply-templates select="following::w[1]" mode="position"/>
+        </xsl:when>
+        <xsl:otherwise>0</xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>    
+    <xsl:variable name="nextW2">
+      <xsl:choose>
+        <xsl:when test="following::w[2]">
+          <xsl:apply-templates select="following::w[2]" mode="position"/>
+        </xsl:when>
+        <xsl:otherwise>0</xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:variable name="ref">
+      <xsl:choose>
+        <xsl:when test="preceding::pb[1][@n]">
+          <xsl:value-of select="concat(ancestor::text/@id,', p. ',preceding::pb[1]/@n)"/>
+        </xsl:when>
+        <xsl:when test="preceding::pb[1][@facs]">
+          <xsl:value-of select="concat(ancestor::text/@id,', p. ',substring-before(preceding::pb[1]/@facs,'.'))"/>
+        </xsl:when>
+        <xsl:otherwise><xsl:value-of select="ancestor::text/@id"/></xsl:otherwise>
+      </xsl:choose>
+      
+    </xsl:variable>
+    <xsl:variable name="lang">
+      <xsl:choose>
+        <xsl:when test="ancestor::*[@lang]"><xsl:value-of select="ancestor::*[@lang][1]/@lang"/></xsl:when>
+        <xsl:when test="ancestor::*[@xml:lang]"><xsl:value-of select="ancestor::*[@xml:lang][1]/@xml:lang"/></xsl:when>
+        <xsl:otherwise>frm</xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:variable name="nametype">
+      <xsl:choose>
+        <xsl:when test="ancestor::name">
+          <xsl:choose>
+            <xsl:when test="ancestor::name[1][@type]"><xsl:value-of select="ancestor::name[1]/@type"/></xsl:when>
+            <xsl:otherwise>name</xsl:otherwise>
+          </xsl:choose>
+        </xsl:when>
+        <xsl:otherwise>NA</xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:variable name="lb">
+      <xsl:choose>
+        <xsl:when test="preceding-sibling::*[1][self::lb]">avant</xsl:when>
+        <xsl:when test="following-sibling::*[1][self::lb or self::pb]">après</xsl:when>
+        <xsl:otherwise>non</xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:variable name="sic">
+      <xsl:choose>
+        <xsl:when test="parent::corr[parent::choice]">
+          <xsl:value-of select="ancestor::choice/sic/w[position()]"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="."></xsl:value-of>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:variable name="orig">
+      <xsl:choose>
+        <xsl:when test="parent::reg[parent::choice]">
+          <xsl:value-of select="ancestor::choice/orig/w[position()]"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="."></xsl:value-of>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:variable name="abbr">
+      <xsl:choose>
+        <xsl:when test="parent::expan[parent::choice]">
+          <xsl:value-of select="ancestor::choice/abbr/w[position()]"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="."></xsl:value-of>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:choose>
+      <xsl:when test="matches(.,'^\s*[\-=]\s*$') and ($nextW1 &gt; $nextLb)">
+        <xsl:comment>trait d'union effacé</xsl:comment>
+      </xsl:when>      
+      <xsl:when test="matches(.,'[\-=]\s*$') and ($nextW1 &gt; $nextLb)">
+        <w xmlns="http://www.tei-c.org/ns/1.0" ref="{$ref}" lang="{$lang}" nametype="{$nametype}" sic="{$sic}" orig="{$orig}" abbr="{$abbr}">
+          <xsl:apply-templates select="@*"/>
+          <xsl:attribute name="lb">milieu-marqué</xsl:attribute>
+          <xsl:analyze-string select="normalize-space(.)" regex="^(.+)(.)$">
+            <xsl:matching-substring><xsl:value-of select="regex-group(1)"/><lb rend="hyphen({regex-group(2)})"/></xsl:matching-substring>
+          </xsl:analyze-string>
+          <xsl:value-of select="normalize-space(following::w[1])"/>
+        </w>        
+      </xsl:when>
+      <xsl:when test="following::w[1][matches(.,'^\s*[\-=]\s*$')] and ($nextW2 &gt; $nextLb)">
+        <w xmlns="http://www.tei-c.org/ns/1.0" ref="{$ref}" lang="{$lang}" nametype="{$nametype}" sic="{$sic}" orig="{$orig}" abbr="{$abbr}">
+          <xsl:apply-templates select="@*"/>
+          <xsl:attribute name="lb">milieu-marqué2</xsl:attribute>
+          <xsl:value-of select="normalize-space(.)"/><lb rend="hyphen({normalize-space(following::w[1])})"/><xsl:value-of select="normalize-space(following::w[2])"/>
+        </w>
+      </xsl:when>
+      <xsl:when test="not(matches(.,'-\s*$')) and following-sibling::*[1][self::lb[@rend='hyphen']]">
+        <w xmlns="http://www.tei-c.org/ns/1.0" ref="{$ref}" lang="{$lang}" nametype="{$nametype}" sic="{$sic}" orig="{$orig}" abbr="{$abbr}">
+          <xsl:apply-templates select="@*"/>
+          <xsl:attribute name="lb">milieu-non-marqué</xsl:attribute>
+          <xsl:value-of select="normalize-space(.)"/><lb rend="noHyphen"/><xsl:value-of select="normalize-space(following::w[1])"/>
+        </w>
+      </xsl:when>
+      <xsl:when test="preceding-sibling::*[1][self::lb[@rend='hyphen']]">
+        <xsl:comment>fin de mot coupé : <xsl:value-of select="."/></xsl:comment>
+      </xsl:when>
+    	<xsl:when test="preceding-sibling::*[1][self::lb] and preceding-sibling::*[2][self::w[matches(.,'\w[\-=]\s*$')]]">
+    		<xsl:comment>fin de mot coupé (lb non marqué !) : <xsl:value-of select="."/></xsl:comment>
+    	</xsl:when>    	
+      <xsl:when test="preceding-sibling::*[1][matches(@txm:wordPart,'^(end|middle)$')]">
+        <xsl:comment>fin de mot coupé par une balise : <xsl:value-of select="normalize-space(.)"/></xsl:comment>
+      </xsl:when>
+      <xsl:when test="preceding-sibling::*[1][@txm:wordPart='start']">
+        <xsl:choose>
+          <xsl:when test="preceding-sibling::*[1][self::choice][child::reg]">
+            <reg>
+              <xsl:apply-templates select="preceding-sibling::choice[1]/reg/@*"/>
+              <w xmlns="http://www.tei-c.org/ns/1.0" ref="{$ref}" lang="{$lang}" nametype="{$nametype}" sic="{$sic}" abbr="{$abbr}" lb="{$lb}">
+                <xsl:attribute name="orig"><xsl:value-of select="concat(preceding-sibling::choice[1]/orig[1]/w[1],.)"/></xsl:attribute>
+                <xsl:apply-templates select="@*"/>
+                <xsl:value-of select="preceding-sibling::choice[1]/reg/w"/><xsl:apply-templates/>
+              </w>
+            </reg>
+          </xsl:when>
+          <xsl:when test="preceding-sibling::*[1][self::choice][child::corr]">
+            <corr>
+              <xsl:apply-templates select="preceding-sibling::choice[1]/corr/@*"/>
+              <w xmlns="http://www.tei-c.org/ns/1.0" ref="{$ref}" lang="{$lang}" nametype="{$nametype}" orig="{$orig}" abbr="{$abbr}" lb="{$lb}">
+                <xsl:attribute name="sic"><xsl:value-of select="concat(preceding-sibling::choice[1]/sic[1]/w[1],.)"/></xsl:attribute>
+                <xsl:apply-templates select="@*"/>
+                <xsl:value-of select="preceding-sibling::choice[1]/reg/w"/><xsl:apply-templates/>
+              </w>
+            </corr>
+          </xsl:when>
+          <xsl:when test="preceding-sibling::*[1][self::supplied]">
+            <w xmlns="http://www.tei-c.org/ns/1.0" ref="{$ref}" lang="{$lang}" nametype="{$nametype}" orig="{$orig}" abbr="{$abbr}" lb="{$lb}">
+              <xsl:attribute name="sic"><xsl:value-of select="."/></xsl:attribute>
+              <xsl:apply-templates select="@*"/>
+              <supplied xmlns="http://www.tei-c.org/ns/1.0"><xsl:value-of select="preceding-sibling::supplied[1]/w"/></supplied><xsl:apply-templates/>
+            </w>
+          </xsl:when>
+          <xsl:when test="preceding-sibling::*[1][self::subst][child::add]">
+            <w xmlns="http://www.tei-c.org/ns/1.0" ref="{$ref}" lang="{$lang}" nametype="{$nametype}" orig="{$orig}" abbr="{$abbr}" lb="{$lb}" del="{normalize-space(preceding-sibling::subst[1]/del)}">
+                <xsl:attribute name="del"><xsl:value-of select="concat('(',preceding-sibling::subst[1]/del[1]/w[1],')',.)"/></xsl:attribute>
+                <xsl:apply-templates select="@*"/>
+                <xsl:element name="add" namespace="http://www.tei-c.org/ns/1.0">
+<!--                  <xsl:attribute name="rend">inWord</xsl:attribute>-->
+                  <xsl:attribute name="del"><xsl:value-of select="normalize-space(preceding-sibling::subst[1]/del)"/></xsl:attribute>
+                  <xsl:apply-templates select="preceding-sibling::subst[1]/add/@*"/>
+                  <xsl:value-of select="preceding-sibling::subst[1]/add/w"/>
+                </xsl:element><xsl:apply-templates/>
+              </w>
+          </xsl:when>
+          <xsl:otherwise>
+            <w xmlns="http://www.tei-c.org/ns/1.0" ref="{$ref}" lang="{$lang}" nametype="{$nametype}" sic="{$sic}" orig="{$orig}" abbr="{$abbr}" lb="{$lb}">
+              <xsl:apply-templates select="@*"/>
+              <xsl:element name="{local-name(preceding-sibling::*[1])}" namespace="http://www.tei-c.org/ns/1.0">
+                <xsl:value-of select="preceding-sibling::*[1]//w"/>
+              </xsl:element>
+              <xsl:apply-templates/>
+            </w>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+      <xsl:when test="following-sibling::*[1][matches(@txm:wordPart,'^(end|middle)$')]">
+        <xsl:variable name="wordPartPosition">
+          <xsl:value-of select="following-sibling::*[1]/@txm:wordPart"/>
+        </xsl:variable>
+        <xsl:choose>
+          <xsl:when test="following-sibling::*[1][self::choice][child::reg]">
+            <reg>
+              <xsl:apply-templates select="following-sibling::choice[1]/reg/@*"/>
+              <w xmlns="http://www.tei-c.org/ns/1.0" ref="{$ref}" lang="{$lang}" nametype="{$nametype}" sic="{$sic}" abbr="{$abbr}" lb="{$lb}">
+                <xsl:attribute name="orig"><xsl:value-of select="concat(.,following-sibling::choice[1]/orig[1]/w[1])"/>
+                  <xsl:if test="$wordPartPosition='middle'"><xsl:value-of select="following-sibling::w[1]"/></xsl:if>
+                </xsl:attribute>
+                <xsl:apply-templates select="@*"/>
+                <xsl:apply-templates/>
+                <xsl:value-of select="following-sibling::choice[1]/reg/w"/>
+                <xsl:if test="$wordPartPosition='middle'"><xsl:value-of select="following-sibling::w[1]"/></xsl:if>
+              </w>
+            </reg>
+          </xsl:when>
+          <xsl:when test="following-sibling::*[1][self::choice][child::corr]">
+            <corr>
+              <xsl:apply-templates select="following-sibling::choice[1]/corr/@*"/>
+              <w xmlns="http://www.tei-c.org/ns/1.0" ref="{$ref}" lang="{$lang}" nametype="{$nametype}" orig="{$orig}" abbr="{$abbr}" lb="{$lb}">
+                <xsl:attribute name="sic"><xsl:value-of select="concat(.,following-sibling::choice[1]/sic[1]/w[1])"/>
+                  <xsl:if test="$wordPartPosition='middle'"><xsl:value-of select="following-sibling::w[1]"/></xsl:if>
+                </xsl:attribute>
+                <xsl:apply-templates select="@*"/>
+                <xsl:apply-templates/><xsl:value-of select="following-sibling::choice[1]/reg/w"/>
+                <xsl:if test="$wordPartPosition='middle'"><xsl:value-of select="following-sibling::w[1]"/></xsl:if>
+              </w>
+            </corr>
+          </xsl:when>
+          <xsl:when test="following-sibling::*[1][self::supplied]">
+            <w xmlns="http://www.tei-c.org/ns/1.0" ref="{$ref}" lang="{$lang}" nametype="{$nametype}" orig="{$orig}" abbr="{$abbr}" lb="{$lb}">
+              <xsl:attribute name="sic"><xsl:value-of select="."/></xsl:attribute>
+              <xsl:apply-templates select="@*"/>
+              <xsl:apply-templates/><supplied xmlns="http://www.tei-c.org/ns/1.0"><xsl:value-of select="following-sibling::supplied[1]/w"/></supplied>
+              <xsl:if test="$wordPartPosition='middle'"><xsl:value-of select="following-sibling::w[1]"/></xsl:if>
+            </w>
+          </xsl:when>
+          <xsl:when test="following-sibling::*[1][self::subst][child::add]">
+            <w xmlns="http://www.tei-c.org/ns/1.0" ref="{$ref}" lang="{$lang}" nametype="{$nametype}" orig="{$orig}" abbr="{$abbr}" lb="{$lb}" del="{normalize-space(following-sibling::subst[1]/del)}">
+              <xsl:attribute name="del"><xsl:value-of select="concat('(',following-sibling::subst[1]/del[1]/w[1],')',.)"/></xsl:attribute>
+              <xsl:apply-templates select="@*"/>
+              <xsl:apply-templates/>
+              <xsl:element name="add" namespace="http://www.tei-c.org/ns/1.0">
+<!--                <xsl:attribute name="rend">inWord</xsl:attribute>-->
+                <xsl:attribute name="del"><xsl:value-of select="normalize-space(following-sibling::subst[1]/del)"></xsl:value-of></xsl:attribute>
+                <xsl:apply-templates select="following-sibling::subst[1]/add/@*"/>
+                <xsl:value-of select="following-sibling::subst[1]/add/w"/>
+              </xsl:element>
+              <xsl:if test="$wordPartPosition='middle'"><xsl:value-of select="following-sibling::w[1]"/></xsl:if>
+            </w>
+          </xsl:when>
+          <xsl:otherwise>
+            <w xmlns="http://www.tei-c.org/ns/1.0" ref="{$ref}" lang="{$lang}" nametype="{$nametype}" sic="{$sic}" orig="{$orig}" abbr="{$abbr}" lb="{$lb}">
+              <xsl:apply-templates select="@*"/>
+              <xsl:apply-templates/>
+              <xsl:element name="{local-name(following-sibling::*[1])}" namespace="http://www.tei-c.org/ns/1.0">
+                <xsl:value-of select="following-sibling::*[1]//w"/>
+              </xsl:element>
+              <xsl:if test="$wordPartPosition='middle'"><xsl:value-of select="following-sibling::w[1]"/></xsl:if>
+            </w>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+      <xsl:otherwise>
+        <w xmlns="http://www.tei-c.org/ns/1.0" ref="{$ref}" lang="{$lang}" nametype="{$nametype}" sic="{$sic}" orig="{$orig}" abbr="{$abbr}" lb="{$lb}">
+          <xsl:apply-templates select="@*"/>
+          <xsl:apply-templates select="*|processing-instruction()|comment()|text()"/>
+        </w>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  
+  <xsl:template match="*[@txm:wordPart]">
+    <xsl:choose>
+      <xsl:when test="matches(local-name(.),'choice') and count(child::*[1]/tei:w) &gt; 1">
+        <xsl:comment>Attention : problème de tokenisation (choice) : <xsl:value-of select="normalize-space(.)"/></xsl:comment>
+        <xsl:for-each select="tei:corr|tei:reg|tei:expan">
+          <xsl:element name="{name(.)}">
+            <xsl:apply-templates select="descendant::tei:w[not(position()=1)]"/>
+          </xsl:element>
+        </xsl:for-each>
+      </xsl:when>
+      <xsl:when test="matches(local-name(.),'subst') and count(child::*[1]/tei:w) &gt; 1">
+        <xsl:comment>Attention : problème de tokenisation (subst) : <xsl:value-of select="normalize-space(.)"/></xsl:comment>
+        <xsl:copy>
+          <xsl:apply-templates select="@*[not(local-name()='wordPart')]"/>
+          <xsl:for-each select="tei:add|tei:del">
+            <xsl:element name="{name(.)}">
+              <xsl:apply-templates select="descendant::tei:w[not(position()=1)]"/>
+            </xsl:element>
+          </xsl:for-each>
+        </xsl:copy>
+      </xsl:when>      
+      <xsl:when test="count(child::w) &gt; 1">
+        <xsl:comment>Attention : problème de tokenisation : <xsl:value-of select="normalize-space(.)"/></xsl:comment>
+        <xsl:copy>
+          <xsl:apply-templates select="@*[not(local-name()='wordPart')]"/>
+          <xsl:apply-templates select="descendant::tei:w[not(position()=1)]"/>
+        </xsl:copy>
+      </xsl:when>
+      <xsl:otherwise><xsl:comment>Mot coupé par une balise : <xsl:value-of select="normalize-space(.)"/></xsl:comment></xsl:otherwise>
+    </xsl:choose>
+    
+  </xsl:template>
+  
+  <xsl:template match="lb[@rend='hyphen' and preceding-sibling::*[1][self::w]]">
+    <xsl:comment>lb déplacé à l'intérieur du mot précédent</xsl:comment>
+  </xsl:template>
+	
+	<xsl:template match="lb[not(@rend='hyphen') and matches(preceding-sibling::tei:w[1],'\w+-\s*$')]">
+		<xsl:comment>Attention : coupure de mot non marquée ! lb déplacé à l'intérieur du mot précédent</xsl:comment>
+		<!--<note xmlns="http://www.tei-c.org/ns/1.0" type="auto">Attention : coupure de mot non marquée !</note>-->
+	</xsl:template>
+	
+  
+  <xsl:template match="s">
+    <xsl:apply-templates/>
+  </xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-teibvh-xmlw-posttok.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/p4top5_perseus.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/p4top5_perseus.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/p4top5_perseus.xsl	(revision 258)
@@ -0,0 +1,843 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:edate="http://exslt.org/dates-and-times"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tei="http://www.tei-c.org/ns/1.0"
+  exclude-result-prefixes="tei edate" version="1.0">
+  <!-- 
+       
+       P4 to P5 converter 
+       
+       Sebastian Rahtz <sebastian.rahtz@oucs.ox.ac.uk>
+       
+       $Date: 2007-11-01 16:33:34 +0000 (Thu, 01 Nov 2007) $  $Id: p4top5.xsl 3927 2007-11-01 16:33:34Z rahtz $
+       
+       Copyright 2007 TEI Consortium
+       
+       Permission is hereby granted, free of charge, to any person obtaining
+       a copy of this software and any associated documentation gfiles (the
+       ``Software''), to deal in the Software without restriction, including
+       without limitation the rights to use, copy, modify, merge, publish,
+       distribute, sublicense, and/or sell copies of the Software, and to
+       permit persons to whom the Software is furnished to do so, subject to
+       the following conditions:
+       
+       The above copyright notice and this permission notice shall be included
+       in all copies or substantial portions of the Software.
+       
+  -->
+
+  <!-- Added changes specific to BFM
+       
+       Alexei Lavrentiev
+       
+       2009-11-13
+       
+       p[@rend='gv'] - ab
+       corr[@sic and @rend]
+       
+       2010-03-12
+       including w into corr (for tokenised texts)
+       
+  -->
+  <xsl:output method="xml" encoding="utf-8" cdata-section-elements="tei:eg"
+    omit-xml-declaration="no"/>
+
+  <xsl:variable name="processor">
+    <xsl:value-of select="system-property('xsl:vendor')"/>
+  </xsl:variable>
+
+  <xsl:variable name="today">
+    <xsl:choose>
+      <xsl:when test="function-available('edate:date-time')">
+        <xsl:value-of select="edate:date-time()"/>
+      </xsl:when>
+      <xsl:when test="contains($processor,'SAXON')">
+        <xsl:value-of select="Date:toString(Date:new())" xmlns:Date="/java.util.Date"/>
+      </xsl:when>
+      <xsl:otherwise>0000-00-00</xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:variable name="uc">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable>
+  <xsl:variable name="lc">abcdefghijklmnopqrstuvwxyz</xsl:variable>
+
+  <xsl:template match="*">
+    <xsl:choose>
+      <xsl:when test="namespace-uri()=''">
+        <xsl:element namespace="http://www.tei-c.org/ns/1.0" name="{local-name(.)}">
+          <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
+        </xsl:element>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:copy>
+          <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
+        </xsl:copy>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+
+  <xsl:template match="@*|processing-instruction()|comment()">
+    <xsl:copy/>
+  </xsl:template>
+
+
+  <xsl:template match="text()">
+    <xsl:value-of select="."/>
+  </xsl:template>
+
+
+  <!-- change of name, or replaced by another element -->
+  <xsl:template match="teiCorpus.2">
+    <teiCorpus xmlns="http://www.tei-c.org/ns/1.0">
+      <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
+    </teiCorpus>
+  </xsl:template>
+
+  <xsl:template match="witness/@sigil">
+    <xsl:attribute name="xml:id">
+      <xsl:value-of select="."/>
+    </xsl:attribute>
+  </xsl:template>
+
+  <xsl:template match="witList">
+    <listWit xmlns="http://www.tei-c.org/ns/1.0">
+      <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
+    </listWit>
+  </xsl:template>
+
+
+  <xsl:template match="TEI.2">
+    <TEI xmlns="http://www.tei-c.org/ns/1.0">
+      <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
+    </TEI>
+  </xsl:template>
+
+  <xsl:template match="xref">
+    <xsl:element namespace="http://www.tei-c.org/ns/1.0" name="ref">
+      <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
+    </xsl:element>
+  </xsl:template>
+
+
+  <xsl:template match="xptr">
+    <xsl:element namespace="http://www.tei-c.org/ns/1.0" name="ptr">
+      <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
+    </xsl:element>
+  </xsl:template>
+
+
+  <xsl:template match="figure[@url]">
+    <figure xmlns="http://www.tei-c.org/ns/1.0">
+      <graphic xmlns="http://www.tei-c.org/ns/1.0">
+        <xsl:copy-of select="@*"/>
+      </graphic>
+      <xsl:apply-templates/>
+    </figure>
+  </xsl:template>
+
+
+  <xsl:template match="figure/@url"/>
+
+  <xsl:template match="figure/@entity"/>
+
+  <xsl:template match="figure[@entity]">
+    <figure xmlns="http://www.tei-c.org/ns/1.0">
+      <graphic xmlns="http://www.tei-c.org/ns/1.0" url="{unparsed-entity-uri(@entity)}">
+        <xsl:apply-templates select="@*"/>
+      </graphic>
+      <xsl:apply-templates/>
+    </figure>
+  </xsl:template>
+
+  <xsl:template match="event">
+    <incident xmlns="http://www.tei-c.org/ns/1.0">
+      <xsl:apply-templates select="@*|*|text()|comment()|processing-instruction()"/>
+    </incident>
+  </xsl:template>
+
+  <xsl:template match="state">
+    <refState xmlns="http://www.tei-c.org/ns/1.0">
+      <xsl:apply-templates select="@*|*|text()|comment()|processing-instruction()"/>
+    </refState>
+  </xsl:template>
+
+
+  <!-- lost elements -->
+  <xsl:template match="dateRange">
+    <date xmlns="http://www.tei-c.org/ns/1.0">
+      <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
+    </date>
+  </xsl:template>
+
+
+  <xsl:template match="dateRange/@from">
+    <xsl:copy-of select="."/>
+  </xsl:template>
+
+  <xsl:template match="dateRange/@to">
+    <xsl:copy-of select="."/>
+  </xsl:template>
+
+  <xsl:template match="language">
+    <xsl:element namespace="http://www.tei-c.org/ns/1.0" name="language">
+      <xsl:if test="@id">
+        <xsl:attribute name="ident">
+          <xsl:value-of select="@id"/>
+        </xsl:attribute>
+      </xsl:if>
+      <xsl:apply-templates select="*|processing-instruction()|comment()|text()"/>
+    </xsl:element>
+  </xsl:template>
+
+  <!-- attributes lost -->
+  <!-- dropped from TEI. Added as new change records later -->
+  <xsl:template match="@date.created"/>
+
+  <xsl:template match="@date.updated"/>
+
+  <!-- dropped from TEI. No replacement -->
+  <xsl:template match="refsDecl/@doctype"/>
+
+  <!-- attributes changed name -->
+
+  <xsl:template match="date/@value">
+    <xsl:attribute name="when">
+      <xsl:value-of select="."/>
+    </xsl:attribute>
+  </xsl:template>
+
+
+  <xsl:template match="@url">
+    <xsl:attribute name="target">
+      <xsl:value-of select="."/>
+    </xsl:attribute>
+  </xsl:template>
+
+
+  <xsl:template match="@doc">
+    <xsl:attribute name="target">
+      <xsl:value-of select="unparsed-entity-uri(.)"/>
+    </xsl:attribute>
+  </xsl:template>
+
+
+  <xsl:template match="@id">
+    <xsl:choose>
+      <xsl:when test="parent::lang">
+        <xsl:attribute name="ident">
+          <xsl:value-of select="."/>
+        </xsl:attribute>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:attribute name="xml:id">
+          <xsl:value-of select="."/>
+        </xsl:attribute>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+
+  <xsl:template match="@lang">
+    <xsl:attribute name="xml:lang">
+      <xsl:value-of select="."/>
+    </xsl:attribute>
+  </xsl:template>
+
+
+  <xsl:template match="change/@date"/>
+
+  <xsl:template match="date/@certainty">
+    <xsl:attribute name="cert">
+      <xsl:value-of select="."/>
+    </xsl:attribute>
+  </xsl:template>
+
+  <!-- all pointing attributes preceded by # -->
+
+  <xsl:template match="variantEncoding/@location">
+    <xsl:copy-of select="."/>
+  </xsl:template>
+
+  <xsl:template
+    match="@ana|@active|@adj|@adjFrom|@adjTo|@children|@children|@class|@code|@code|@copyOf|@corresp|@decls|@domains|@end|@exclude|@fVal|@feats|@follow|@from|@hand|@inst|@langKey|@location|@mergedin|@new|@next|@old|@origin|@otherLangs|@parent|@passive|@perf|@prev|@render|@resp|@sameAs|@scheme|@script|@select|@since|@start|@synch|@target|@targetEnd|@to|@to|@value|@value|@who|@wit">
+    <xsl:attribute name="{name(.)}">
+      <xsl:call-template name="splitter">
+        <xsl:with-param name="val">
+          <xsl:value-of select="."/>
+        </xsl:with-param>
+      </xsl:call-template>
+    </xsl:attribute>
+  </xsl:template>
+
+
+  <xsl:template name="splitter">
+    <xsl:param name="val"/>
+    <xsl:choose>
+      <xsl:when test="contains($val,' ')">
+        <xsl:text>#</xsl:text>
+        <xsl:value-of select="substring-before($val,' ')"/>
+        <xsl:text> </xsl:text>
+        <xsl:call-template name="splitter">
+          <xsl:with-param name="val">
+            <xsl:value-of select="substring-after($val,' ')"/>
+          </xsl:with-param>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:text>#</xsl:text>
+        <xsl:value-of select="$val"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+
+  <!-- fool around with selected elements -->
+
+
+  <!-- imprint is no longer allowed inside bibl -->
+  <xsl:template match="bibl/imprint">
+    <xsl:apply-templates/>
+  </xsl:template>
+
+  <xsl:template match="editionStmt/editor">
+    <respStmt xmlns="http://www.tei-c.org/ns/1.0">
+      <resp>
+        <xsl:value-of select="@role"/>
+      </resp>
+      <name>
+        <xsl:apply-templates/>
+      </name>
+    </respStmt>
+  </xsl:template>
+
+  <!-- header -->
+  <!-- BFM special treatment 
+  <xsl:template match="teiHeader">
+    <teiHeader xmlns="http://www.tei-c.org/ns/1.0">
+      <xsl:apply-templates select="@*|*|comment()|processing-instruction()"/>
+      
+      <xsl:if test="not(revisionDesc) and (@date.created or @date.updated)">
+	<revisionDesc  xmlns="http://www.tei-c.org/ns/1.0">
+	  <xsl:if test="@date.updated">
+	    <change  xmlns="http://www.tei-c.org/ns/1.0">>
+	    <label>updated</label>
+	    <date  xmlns="http://www.tei-c.org/ns/1.0">
+	      <xsl:value-of select="@date.updated"/>
+	    </date>
+	    <label  xmlns="http://www.tei-c.org/ns/1.0">Date edited</label>
+	    </change>
+	  </xsl:if>
+	  <xsl:if test="@date.created">
+	    <change  xmlns="http://www.tei-c.org/ns/1.0">
+	      <label>created</label>
+	      <date  xmlns="http://www.tei-c.org/ns/1.0">
+		<xsl:value-of select="@date.created"/>
+	      </date>
+	      <label  xmlns="http://www.tei-c.org/ns/1.0">Date created</label>
+	    </change>
+	  </xsl:if>
+	</revisionDesc>
+      </xsl:if>
+     [comment]
+	  <change when="{$today}"  xmlns="http://www.tei-c.org/ns/1.0">Converted to TEI P5 XML by p4top5.xsl
+	  written by Sebastian
+	  Rahtz at Oxford University Computing Services.</change>
+	  </revisionDesc>
+	  </xsl:if>
+      [/comment]
+    </teiHeader>
+  </xsl:template>
+  -->
+  <xsl:template match="revisionDesc">
+    <revisionDesc xmlns="http://www.tei-c.org/ns/1.0">
+      <xsl:apply-templates select="@*|*|comment()|processing-instruction()"/>
+    </revisionDesc>
+  </xsl:template>
+
+  <xsl:template match="publicationStmt">
+    <publicationStmt xmlns="http://www.tei-c.org/ns/1.0">
+      <xsl:apply-templates select="@*|*|comment()|processing-instruction()"/>
+      <!--
+	  <availability xmlns="http://www.tei-c.org/ns/1.0">
+	  <p xmlns="http://www.tei-c.org/ns/1.0">Licensed under <ptr xmlns="http://www.tei-c.org/ns/1.0" target="http://creativecommons.org/licenses/by-sa/2.0/uk/"/></p>
+	  </availability>
+      -->
+    </publicationStmt>
+  </xsl:template>
+
+  <!-- space does not have @extent any more -->
+  <xsl:template match="space/@extent">
+    <xsl:attribute name="quantity">
+      <xsl:value-of select="."/>
+    </xsl:attribute>
+  </xsl:template>
+
+  <!-- tagsDecl has a compulsory namespace child now -->
+  <xsl:template match="tagsDecl">
+    <xsl:if test="*">
+      <tagsDecl xmlns="http://www.tei-c.org/ns/1.0">
+        <namespace name="http://www.tei-c.org/ns/1.0">
+          <xsl:apply-templates select="*|comment()|processing-instruction"/>
+        </namespace>
+      </tagsDecl>
+    </xsl:if>
+  </xsl:template>
+
+  <!-- orgTitle inside orgName? redundant -->
+  <xsl:template match="orgName/orgTitle">
+    <xsl:apply-templates/>
+  </xsl:template>
+
+  <!-- no need for empty <p> in sourceDesc -->
+  <xsl:template match="sourceDesc/p[string-length(.)=0]"/>
+
+  <!-- start creating the new choice element -->
+  <!-- corr & sic elements: BFM special treatment 
+  <xsl:template match="corr[@sic]">
+    <choice  xmlns="http://www.tei-c.org/ns/1.0">
+      <corr  xmlns="http://www.tei-c.org/ns/1.0">
+	<xsl:value-of select="text()" />
+      </corr>
+      <sic  xmlns="http://www.tei-c.org/ns/1.0">
+	<xsl:value-of select="@sic" />
+      </sic>
+    </choice>
+  </xsl:template>
+  
+  <xsl:template match="sic[@corr]">
+    <choice  xmlns="http://www.tei-c.org/ns/1.0">
+      <sic  xmlns="http://www.tei-c.org/ns/1.0">
+	<xsl:value-of select="text()" />
+      </sic>
+      <corr  xmlns="http://www.tei-c.org/ns/1.0">
+	<xsl:value-of select="@corr" />
+      </corr>
+    </choice>
+  </xsl:template>
+  -->
+  <xsl:template match="abbr[@expan]">
+    <choice xmlns="http://www.tei-c.org/ns/1.0">
+      <abbr xmlns="http://www.tei-c.org/ns/1.0">
+        <xsl:value-of select="text()"/>
+      </abbr>
+      <expan xmlns="http://www.tei-c.org/ns/1.0">
+        <xsl:value-of select="@expan"/>
+      </expan>
+    </choice>
+  </xsl:template>
+
+  <xsl:template match="expan[@abbr]">
+    <choice xmlns="http://www.tei-c.org/ns/1.0">
+      <expan xmlns="http://www.tei-c.org/ns/1.0">
+        <xsl:value-of select="text()"/>
+      </expan>
+      <abbr xmlns="http://www.tei-c.org/ns/1.0">
+        <xsl:value-of select="@abbr"/>
+      </abbr>
+    </choice>
+  </xsl:template>
+
+  <!-- special consideration for <change> element -->
+  <xsl:template match="change">
+    <change xmlns="http://www.tei-c.org/ns/1.0">
+
+      <xsl:apply-templates select="date"/>
+
+      <xsl:if test="respStmt/resp">
+        <label>
+          <xsl:value-of select="respStmt/resp/text()"/>
+        </label>
+      </xsl:if>
+      <xsl:for-each select="respStmt/name">
+        <name xmlns="http://www.tei-c.org/ns/1.0">
+          <xsl:apply-templates select="@*|*|comment()|processing-instruction()|text()"/>
+        </name>
+      </xsl:for-each>
+      <xsl:for-each select="item">
+        <xsl:apply-templates select="@*|*|comment()|processing-instruction()|text()"/>
+      </xsl:for-each>
+    </change>
+  </xsl:template>
+
+
+  <xsl:template match="respStmt[resp]">
+    <respStmt xmlns="http://www.tei-c.org/ns/1.0">
+      <xsl:choose>
+        <xsl:when test="resp/name">
+          <resp xmlns="http://www.tei-c.org/ns/1.0">
+            <xsl:value-of select="resp/text()"/>
+          </resp>
+          <xsl:for-each select="resp/name">
+            <name xmlns="http://www.tei-c.org/ns/1.0">
+              <xsl:apply-templates/>
+            </name>
+          </xsl:for-each>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:apply-templates/>
+          <name xmlns="http://www.tei-c.org/ns/1.0"> </name>
+        </xsl:otherwise>
+      </xsl:choose>
+    </respStmt>
+  </xsl:template>
+
+  <xsl:template match="q/@direct"/>
+
+  <xsl:template match="q">
+    <q xmlns="http://www.tei-c.org/ns/1.0">
+      <xsl:apply-templates select="@*|*|comment()|processing-instruction()|text()"/>
+    </q>
+  </xsl:template>
+
+
+  <!-- if we are reading the P4 with a DTD,
+       we need to avoid copying the default values
+       of attributes -->
+
+  <xsl:template match="@targOrder">
+    <xsl:if test="not(translate(.,$uc,$lc) ='u')">
+      <xsl:attribute name="targOrder">
+        <xsl:value-of select="."/>
+      </xsl:attribute>
+    </xsl:if>
+  </xsl:template>
+
+
+  <xsl:template match="@opt">
+    <xsl:if test="not(translate(.,$uc,$lc) ='n')">
+      <xsl:attribute name="opt">
+        <xsl:value-of select="."/>
+      </xsl:attribute>
+    </xsl:if>
+  </xsl:template>
+
+
+  <xsl:template match="@to">
+    <xsl:if test="not(translate(.,$uc,$lc) ='ditto')">
+      <xsl:attribute name="to">
+        <xsl:value-of select="."/>
+      </xsl:attribute>
+    </xsl:if>
+  </xsl:template>
+
+
+  <xsl:template match="@default">
+    <xsl:choose>
+      <xsl:when test="translate(.,$uc,$lc)= 'no'"/>
+      <xsl:otherwise>
+        <xsl:attribute name="default">
+          <xsl:value-of select="."/>
+        </xsl:attribute>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+
+  <xsl:template match="@part">
+    <xsl:if test="not(translate(.,$uc,$lc) ='n')">
+      <xsl:attribute name="part">
+        <xsl:value-of select="."/>
+      </xsl:attribute>
+    </xsl:if>
+  </xsl:template>
+
+
+  <xsl:template match="@full">
+    <xsl:if test="not(translate(.,$uc,$lc) ='yes')">
+      <xsl:attribute name="full">
+        <xsl:value-of select="."/>
+      </xsl:attribute>
+    </xsl:if>
+  </xsl:template>
+
+
+  <xsl:template match="@from">
+    <xsl:if test="not(translate(.,$uc,$lc) ='root')">
+      <xsl:attribute name="from">
+        <xsl:value-of select="."/>
+      </xsl:attribute>
+    </xsl:if>
+  </xsl:template>
+
+
+  <xsl:template match="@status">
+    <xsl:choose>
+      <xsl:when test="parent::teiHeader">
+        <xsl:if test="not(translate(.,$uc,$lc) ='new')">
+          <xsl:attribute name="status">
+            <xsl:value-of select="."/>
+          </xsl:attribute>
+        </xsl:if>
+      </xsl:when>
+      <xsl:when test="parent::del">
+        <xsl:if test="not(translate(.,$uc,$lc) ='unremarkable')">
+          <xsl:attribute name="status">
+            <xsl:value-of select="."/>
+          </xsl:attribute>
+        </xsl:if>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:attribute name="status">
+          <xsl:value-of select="."/>
+        </xsl:attribute>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+
+  <xsl:template match="@place">
+    <xsl:if test="not(translate(.,$uc,$lc) ='unspecified')">
+      <xsl:attribute name="place">
+        <xsl:value-of select="."/>
+      </xsl:attribute>
+    </xsl:if>
+  </xsl:template>
+
+
+  <xsl:template match="@sample">
+    <xsl:if test="not(translate(.,$uc,$lc) ='complete')">
+      <xsl:attribute name="sample">
+        <xsl:value-of select="."/>
+      </xsl:attribute>
+    </xsl:if>
+  </xsl:template>
+
+
+  <xsl:template match="@org">
+    <xsl:if test="not(translate(.,$uc,$lc) ='uniform')">
+      <xsl:attribute name="org">
+        <xsl:value-of select="."/>
+      </xsl:attribute>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template match="teiHeader/@type">
+    <xsl:if test="not(translate(.,$uc,$lc) ='text')">
+      <xsl:attribute name="type">
+        <xsl:value-of select="."/>
+      </xsl:attribute>
+    </xsl:if>
+  </xsl:template>
+
+  <!-- yes|no to boolean -->
+
+  <xsl:template match="@anchored">
+    <xsl:attribute name="anchored">
+      <xsl:choose>
+        <xsl:when test="translate(.,$uc,$lc)='yes'">true</xsl:when>
+        <xsl:when test="translate(.,$uc,$lc)='no'">false</xsl:when>
+      </xsl:choose>
+    </xsl:attribute>
+  </xsl:template>
+
+  <xsl:template match="sourceDesc/@default"/>
+
+  <xsl:template match="@tei">
+    <xsl:attribute name="tei">
+      <xsl:choose>
+        <xsl:when test="translate(.,$uc,$lc)='yes'">true</xsl:when>
+        <xsl:when test="translate(.,$uc,$lc)='no'">false</xsl:when>
+      </xsl:choose>
+    </xsl:attribute>
+  </xsl:template>
+
+  <xsl:template match="@langKey"/>
+
+  <xsl:template match="@TEIform"/>
+
+  <!-- assorted atts -->
+  <xsl:template match="@old"/>
+
+  <xsl:template match="@mergedin">
+    <xsl:attribute name="mergedIn">
+      <xsl:value-of select="."/>
+    </xsl:attribute>
+  </xsl:template>
+
+  <!-- deal with the loss of div0 -->
+
+  <xsl:template match="div1|div2|div3|div4|div5|div6">
+    <xsl:variable name="divName">
+      <xsl:choose>
+        <xsl:when test="ancestor::div0">
+          <xsl:text>div</xsl:text>
+          <xsl:value-of select="number(substring-after(local-name(.),'div')) + 1"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="local-name()"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:element name="{$divName}" namespace="http://www.tei-c.org/ns/1.0">
+      <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
+    </xsl:element>
+  </xsl:template>
+
+  <xsl:template match="div0">
+    <div1 xmlns="http://www.tei-c.org/ns/1.0">
+      <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
+    </div1>
+  </xsl:template>
+  
+ <xsl:template match="l">
+   <xsl:apply-templates/>
+ </xsl:template>
+  
+  <xsl:template match="lb">
+    <xsl:text>&#xA;</xsl:text>
+    <lb xmlns="http://www.tei-c.org/ns/1.0">
+      <xsl:apply-templates select="@*"></xsl:apply-templates>
+    </lb>
+  </xsl:template>
+  
+  <xsl:template match="sp[child::l]">
+    <sp xmlns="http://www.tei-c.org/ns/1.0">
+      <xsl:apply-templates select="@*"/>
+      <xsl:text>&#xA;</xsl:text>
+      <xsl:apply-templates select="speaker"/>
+      <xsl:text>&#xA;</xsl:text>
+      <ab><xsl:apply-templates select="l|lb"/></ab>
+    </sp>
+  </xsl:template>
+
+<!--
+  <!-\- BFM specific -\->
+
+  <xsl:template match="p[@rend]">
+    <ab xmlns="http://www.tei-c.org/ns/1.0">
+      <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
+    </ab>
+  </xsl:template>
+
+  <!-\- reducing header -\->
+  <xsl:template match="teiHeader">
+    <teiHeader xmlns="http://www.tei-c.org/ns/1.0">
+      <xsl:apply-templates select="fileDesc"/>
+    </teiHeader>
+  </xsl:template>
+
+  <xsl:template match="fileDesc">
+    <fileDesc xmlns="http://www.tei-c.org/ns/1.0">
+      <xsl:apply-templates select="titleStmt"/>
+      <publicationStmt xmlns="http://www.tei-c.org/ns/1.0"><p xmlns="http://www.tei-c.org/ns/1.0"></p></publicationStmt><sourceDesc xmlns="http://www.tei-c.org/ns/1.0"><p xmlns="http://www.tei-c.org/ns/1.0"></p></sourceDesc>
+    </fileDesc>
+  </xsl:template>
+  
+  <xsl:template match="titleStmt">
+    <titleStmt xmlns="http://www.tei-c.org/ns/1.0">
+      <xsl:choose>
+        <xsl:when test="descendant::title[@type='normal']">
+          <xsl:apply-templates select="title[@type='normal']|author"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <title xmlns="http://www.tei-c.org/ns/1.0"><xsl:value-of select="descendant::title[1]"/></title>
+        </xsl:otherwise>
+      </xsl:choose>
+      
+    </titleStmt>
+  </xsl:template>
+  
+
+  <xsl:template name="corr-crochets">
+    <xsl:value-of select="substring-before(@rend,'[')"/>
+    <xsl:element name="supplied" namespace="http://www.tei-c.org/ns/1.0">
+      <xsl:if test="string-length(@sic) &gt; 0">
+        <xsl:attribute name="rend">word_part</xsl:attribute>
+      </xsl:if>
+      <xsl:value-of select="substring-before(substring-after(@rend,'['),']')"/>
+    </xsl:element>
+    <xsl:value-of select="substring-after(@rend,']')"/>
+  </xsl:template>
+
+  <xsl:template match="corr[@sic]">
+    <choice xmlns="http://www.tei-c.org/ns/1.0">
+      <xsl:element name="corr" namespace="http://www.tei-c.org/ns/1.0">
+        <xsl:if test="@resp">
+          <xsl:attribute name="resp">
+            <xsl:value-of select="@resp"/>
+          </xsl:attribute>
+        </xsl:if>
+        <xsl:if test="@rend[not(contains(.,'crochets')) and not(contains(.,'['))]">
+          <xsl:attribute name="rend">
+            <xsl:value-of select="@rend"/>
+          </xsl:attribute>
+        </xsl:if>
+        <xsl:choose>
+          <xsl:when test="contains(@rend,'[') and contains(@rend,']')">
+            <xsl:choose>
+              <xsl:when test="child::w">
+                <xsl:text>&#xA;</xsl:text>
+                <xsl:element name="w" namespace="http://www.tei-c.org/ns/1.0">
+                  <xsl:call-template name="corr-crochets"/>
+                </xsl:element>
+                <xsl:text>&#xA;</xsl:text>
+              </xsl:when>
+              <xsl:otherwise>
+                <xsl:call-template name="corr-crochets"/>
+              </xsl:otherwise>
+            </xsl:choose>
+          </xsl:when>
+          <xsl:when test="string-length(@sic) = 0">
+            <xsl:element name="supplied" namespace="http://www.tei-c.org/ns/1.0">
+              <xsl:apply-templates select="@resp|@rend|*|text()"/>
+            </xsl:element>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:apply-templates select="@resp|@rend|*|text()"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:element>
+      <xsl:element name="sic" namespace="http://www.tei-c.org/ns/1.0">
+        <xsl:value-of select="@sic"/>
+      </xsl:element>
+    </choice>
+  </xsl:template>
+
+  <xsl:template match="sic[@corr]">
+    <choice xmlns="http://www.tei-c.org/ns/1.0">
+      <xsl:element name="corr" namespace="http://www.tei-c.org/ns/1.0">
+        <xsl:if test="@resp">
+          <xsl:attribute name="resp">
+            <xsl:value-of select="@resp"/>
+          </xsl:attribute>
+        </xsl:if>
+        <xsl:if test="@rend[not(contains(.,'crochets')) and not(contains(.,'['))]">
+          <xsl:attribute name="rend">
+            <xsl:value-of select="@rend"/>
+          </xsl:attribute>
+        </xsl:if>
+        <xsl:choose>
+          <xsl:when test="contains(@rend,'[') and contains(@rend,']')">
+            <xsl:choose>
+              <xsl:when test="child::w">
+                <xsl:text>&#xA;</xsl:text>
+                <xsl:element name="w" namespace="http://www.tei-c.org/ns/1.0">
+                  <xsl:call-template name="corr-crochets"/>
+                </xsl:element>
+                <xsl:text>&#xA;</xsl:text>
+              </xsl:when>
+              <xsl:otherwise>
+                <xsl:call-template name="corr-crochets"/>
+              </xsl:otherwise>
+            </xsl:choose>
+          </xsl:when>
+          <xsl:when test="string-length(.) = 0">
+            <xsl:element name="supplied" namespace="http://www.tei-c.org/ns/1.0">
+              <xsl:apply-templates select="@resp|@rend|*|text()"/>
+            </xsl:element>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:apply-templates select="@resp|@rend"/>
+            <xsl:value-of select="@corr"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:element>
+      <xsl:element name="sic" namespace="http://www.tei-c.org/ns/1.0">
+        <xsl:apply-templates/>
+      </xsl:element>
+    </choice>
+  </xsl:template>
+
+
+-->
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/p4top5_perseus.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-corpusakkadien-xmlw_syllabes-cuneiform.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-corpusakkadien-xmlw_syllabes-cuneiform.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-corpusakkadien-xmlw_syllabes-cuneiform.xsl	(revision 258)
@@ -0,0 +1,168 @@
+<?xml version="1.0"?>
+<xsl:stylesheet
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns:xd="http://www.pnp-software.com/XSLTdoc"
+ version="2.0">
+  
+  <xd:doc type="stylesheet">
+    <xd:short>
+      Cette feuille de style permet de préparer les transcriptions de tablettes
+      d'argile (projet UMR PROCLAC) à l'import XML/W + CSV de TXM en tokenisant
+      le corpus au niveau des syllabes.
+      Les propriétés de mots sont projetées vers les propriétés des syllabes (line,
+      lemma, pos).
+      Les propriétés unclear et supplied prennent la valeur "yes" si la syllabe se
+      trouve à l'intérieur de la balise correspondante.
+    </xd:short>
+    <xd:detail>
+      This stylesheet is free software; you can redistribute it and/or
+      modify it under the terms of the GNU Lesser General Public
+      License as published by the Free Software Foundation; either
+      version 3 of the License, or (at your option) any later version.
+      
+      This stylesheet 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
+      Lesser General Public License for more details.
+      
+      You should have received a copy of GNU Lesser Public License with
+      this stylesheet. If not, see http://www.gnu.org/licenses/lgpl.html
+    </xd:detail>
+    <xd:author>Alexei Lavrentiev, alexei.lavrentev@ens-lyon.fr</xd:author>
+    <xd:copyright>2014-2015, CNRS / ICAR (équipe CACTUS)</xd:copyright>
+  </xd:doc>
+  
+  <xsl:output method="xml" encoding="utf-8" omit-xml-declaration="no"/>
+  
+  <xsl:template match="*">
+  	<xsl:copy>
+  		<xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>	
+  	</xsl:copy>
+  </xsl:template>
+
+  <xsl:template match="@*|comment()">
+    <xsl:copy/>
+  </xsl:template>
+	
+	<xsl:template match="processing-instruction()"/>
+  
+  <xsl:template match="*[local-name()='teiHeader']"/>
+  
+<!--  <xsl:template match="*[local-name()='w']//text()">
+    <xsl:variable name="line"><xsl:value-of select="ancestor::*[local-name()='w']/@line"/></xsl:variable>
+    <xsl:variable name="lemma"><xsl:value-of select="ancestor::*[local-name()='w']/@lemma"/></xsl:variable>
+    <xsl:variable name="pos"><xsl:value-of select="ancestor::*[local-name()='w']/@pos"/></xsl:variable>
+    <xsl:variable name="word-form"><xsl:value-of select="ancestor::*[local-name()='w']"/></xsl:variable>
+    <xsl:variable name="unclear">
+      <xsl:choose>
+        <xsl:when test="ancestor::*[local-name()='unclear']">yes</xsl:when>
+        <xsl:otherwise>no</xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:variable name="supplied">
+      <xsl:choose>
+        <xsl:when test="ancestor::*[local-name()='supplied']">yes</xsl:when>
+        <xsl:otherwise>no</xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    
+    <xsl:analyze-string select="." regex="[-.]|\([^\)]*\)">
+      <xsl:matching-substring>
+        <w line="{$line}" lemma="{$lemma}" pos="{$pos}" word-form="{$word-form}" supplied="{$supplied}" unclear="{$unclear}"><xsl:value-of select="."/></w>
+      </xsl:matching-substring>
+      <xsl:non-matching-substring>
+        <w line="{$line}" lemma="{$lemma}" pos="{$pos}" word-form="{$word-form}" supplied="{$supplied}" unclear="{$unclear}"><xsl:value-of select="."/></w>
+      </xsl:non-matching-substring>
+    </xsl:analyze-string>    
+  </xsl:template>-->
+
+<!--<xsl:template match="text()[not(ancestor::*[local-name()='w'])]">
+  <xsl:analyze-string select="." regex="\[…\]">
+    <xsl:matching-substring>
+      <w line="¤" lemma="¤" pos="¤" word-form="¤" supplied="¤" unclear="¤"><xsl:value-of select="."/></w>
+    </xsl:matching-substring>
+    <xsl:non-matching-substring><xsl:comment><xsl:copy-of select="."/></xsl:comment></xsl:non-matching-substring>
+  </xsl:analyze-string>
+</xsl:template>-->
+  
+  <xsl:template match="*[local-name()='g']">
+    <xsl:variable name="line"><xsl:value-of select="ancestor::*[local-name()='w']/@line"/></xsl:variable>
+    <xsl:variable name="lemma"><xsl:value-of select="ancestor::*[local-name()='w']/@lemma"/></xsl:variable>
+    <xsl:variable name="pos"><xsl:value-of select="ancestor::*[local-name()='w']/@pos"/></xsl:variable>
+    <xsl:variable name="word-form">
+      <xsl:for-each select="ancestor::*[local-name()='w']/descendant::*[local-name()='g']">
+        <xsl:value-of select="."/>
+        <xsl:if test="following-sibling::*[local-name()='g']">-</xsl:if>
+      </xsl:for-each>
+    </xsl:variable>
+    <xsl:variable name="unclear">
+      <xsl:choose>
+        <xsl:when test="ancestor::*[local-name()='unclear']">yes</xsl:when>
+        <xsl:otherwise>no</xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:variable name="supplied">
+      <xsl:choose>
+        <xsl:when test="ancestor::*[local-name()='supplied']">yes</xsl:when>
+        <xsl:otherwise>no</xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:variable name="decimal">
+      <xsl:call-template name="hex2num"><xsl:with-param name="hex"><xsl:value-of select="substring(@refUnicode,4)"/></xsl:with-param></xsl:call-template>
+    </xsl:variable>
+    
+    <w line="{$line}" lemma="{$lemma}" pos="{$pos}" word-form="{$word-form}" supplied="{$supplied}" unclear="{$unclear}" ref-syllabaire="{@refSyllabaire}" ref-unicode="{@refUnicode}"><xsl:value-of select="."/></w>
+    
+  </xsl:template>
+
+  <xsl:template match="*[local-name()='w']">
+  <word>
+    <xsl:apply-templates select="@*"/>
+    <xsl:attribute name="no-supplied">
+      <xsl:choose>
+        <xsl:when test="ancestor::*[local-name()='supplied']">¤</xsl:when>
+        <xsl:otherwise>      
+          <xsl:for-each select="descendant::*[local-name()='g']">
+          <xsl:value-of select="."/>
+          <xsl:if test="following-sibling::*[local-name()='g']">-</xsl:if>
+        </xsl:for-each>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:attribute>
+    <xsl:attribute name="no-unclear">
+      <xsl:choose>
+        <xsl:when test="ancestor::*[local-name()='supplied'] or ancestor::*[local-name()='unclear']">¤</xsl:when>
+        <xsl:otherwise>
+          <xsl:for-each select="descendant::*[local-name()='g']">
+            <xsl:value-of select="."/>
+            <xsl:if test="following-sibling::*[local-name()='g']">-</xsl:if>
+          </xsl:for-each>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:attribute>    
+    <xsl:apply-templates/>
+  </word>
+</xsl:template>
+
+
+  <xsl:template name="hex2num">
+    <xsl:param name="hex"/>
+    <xsl:param name="num" select="0"/>
+    <xsl:param name="MSB" select="translate(substring($hex, 1, 1), 'abcdef', 'ABCDEF')"/>
+    <xsl:param name="value" select="string-length(substring-before('0123456789ABCDEF', $MSB))"/>
+    <xsl:param name="result" select="16 * $num + $value"/>
+    <xsl:choose>
+      <xsl:when test="string-length($hex) > 1">
+        <xsl:call-template name="hex2num">
+          <xsl:with-param name="hex" select="substring($hex, 2)"/>
+          <xsl:with-param name="num" select="$result"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$result"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-corpusakkadien-xmlw_syllabes-cuneiform.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-teicorpustextgrid-xmlw.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-teicorpustextgrid-xmlw.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-teicorpustextgrid-xmlw.xsl	(revision 258)
@@ -0,0 +1,82 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:edate="http://exslt.org/dates-and-times"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tei="http://www.tei-c.org/ns/1.0"
+  xmlns:xd="http://www.pnp-software.com/XSLTdoc"
+  xmlns:txm="http://textometrie.org/1.0"
+  exclude-result-prefixes="tei edate" version="2.0">
+
+  <xsl:output method="xml" encoding="utf-8" omit-xml-declaration="no"/>
+  
+  <xd:doc type="stylesheet">
+    <xd:short>
+      This stylesheet prepares TextGrid TEI corpus for TXM xml/w import module
+    </xd:short>
+    <xd:detail>
+      This stylesheet is free software; you can redistribute it and/or
+      modify it under the terms of the GNU Lesser General Public
+      License as published by the Free Software Foundation; either
+      version 3 of the License, or (at your option) any later version.
+      
+      This stylesheet 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
+      Lesser General Public License for more details.
+      
+      You should have received a copy of GNU Lesser Public License with
+      this stylesheet. If not, see http://www.gnu.org/licenses/lgpl.html
+    </xd:detail>
+    <xd:author>Alexei Lavrentiev alexei.lavrentev@ens-lyon.fr</xd:author>
+    <xd:copyright>2014, CNRS / ICAR (CACTUS)</xd:copyright>
+  </xd:doc>
+  
+  
+  
+<!-- Partie générale : on copie les éléments, les attributs, le texte, les commentaires, on supprime mes prrocessing intstructions -->
+<!-- + nommage auto des fichiers -->
+  
+  <xsl:variable name="filedir">
+    <xsl:analyze-string select="document-uri(.)" regex="^(.*)/([^/]+)$">
+      <xsl:matching-substring>
+        <xsl:value-of select="regex-group(1)"></xsl:value-of>
+      </xsl:matching-substring>
+    </xsl:analyze-string></xsl:variable>
+  
+  
+  <xsl:template match="/">
+  	<note>See output files in the OUT directory</note>
+  	<xsl:for-each select="descendant::tei:TEI">
+  		<xsl:variable name="author"><xsl:value-of select="tei:teiHeader[1]/tei:fileDesc[1]/tei:sourceDesc[1]/tei:biblFull[1]/tei:titleStmt[1]/tei:author[1]"></xsl:value-of></xsl:variable>
+  		<xsl:variable name="authorNorm"><xsl:value-of select="replace($author,'[, ]','')"/></xsl:variable>
+  		<xsl:variable name="title"><xsl:value-of select="tei:teiHeader[1]/tei:fileDesc[1]/tei:titleStmt[1]/tei:title[1]"></xsl:value-of></xsl:variable>
+  		<xsl:variable name="titleNorm"><xsl:value-of select="replace($title,'[, \[\]]','')"/></xsl:variable>
+  		<xsl:variable name="creationDate"><xsl:choose>
+  			<xsl:when test="tei:teiHeader[1]/tei:profileDesc[1]/tei:creation[1]/tei:date[1]/@when">
+  				<xsl:value-of select="tei:teiHeader[1]/tei:profileDesc[1]/tei:creation[1]/tei:date[1]/@when"/>
+  			</xsl:when>
+  			<xsl:when test="tei:teiHeader[1]/tei:profileDesc[1]/tei:creation[1]/tei:date[1]/@notAfter">
+  				<xsl:value-of select="tei:teiHeader[1]/tei:profileDesc[1]/tei:creation[1]/tei:date[1]/@notAfter"/>
+  			</xsl:when>
+  			<xsl:when test="tei:teiHeader[1]/tei:profileDesc[1]/tei:creation[1]/tei:date[1]/@notBefore">
+  				<xsl:value-of select="tei:teiHeader[1]/tei:profileDesc[1]/tei:creation[1]/tei:date[1]/@notBefore"/>
+  			</xsl:when>
+  			<xsl:otherwise>9999</xsl:otherwise>
+  		</xsl:choose>
+  		</xsl:variable>
+  		<xsl:result-document href="{$filedir}/out/{$creationDate}{$authorNorm}{$titleNorm}.xml">
+  			<xsl:copy>
+  				<xsl:copy-of select="@*"/>
+  				<xsl:comment>teiHeafer deleted for TXM xml/w import module</xsl:comment>
+  				<xsl:element name="text" namespace="http://www.tei-c.org/ns/1.0">
+  					<xsl:attribute name="author"><xsl:value-of select="$author"/></xsl:attribute>
+  					<xsl:attribute name="title"><xsl:value-of select="$title"/></xsl:attribute>
+  					<xsl:attribute name="creationDate"><xsl:value-of select="$creationDate"/></xsl:attribute>
+  					<xsl:for-each select="tei:text/*">
+  						<xsl:copy-of select="."/>
+  					</xsl:for-each>
+  				</xsl:element>
+  			</xsl:copy>
+  		</xsl:result-document>
+  	</xsl:for-each>  
+  </xsl:template>
+  
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-teicorpustextgrid-xmlw.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/svn2cl.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/svn2cl.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/svn2cl.xsl	(revision 258)
@@ -0,0 +1,500 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+	USAGE:
+	svn log --xml --verbose > foo.txt
+	xsltproc etc/svn2cl.xsl foo.txt > ChangeLog
+
+
+   svn2cl.xsl - xslt stylesheet for converting svn log to a normal
+                changelog
+
+   version 0.11
+
+   Usage (replace ++ with two minus signs which aren't allowed
+   inside xml comments):
+     svn ++verbose ++xml log | \
+       xsltproc ++stringparam strip-prefix `basename $(pwd)` \
+                ++stringparam linelen 75 \
+                ++stringparam groupbyday yes \
+                ++stringparam separate-daylogs yes \
+                ++stringparam include-rev yes \
+                ++stringparam include-actions yes \
+                ++stringparam breakbeforemsg yes/2 \
+                ++stringparam reparagraph yes \
+                ++stringparam authorsfile FILE \
+                ++stringparam ignore-message-starting \
+                svn2cl.xsl - > ChangeLog
+
+   This file is based on several implementations of this conversion
+   that I was not completely happy with and some other common
+   xslt constructs found on the web.
+
+   Copyright (C) 2004, 2005, 2006, 2007 Arthur de Jong.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in
+      the documentation and/or other materials provided with the
+      distribution.
+   3. The name of the author may not be used to endorse or promote
+      products derived from this software without specific prior
+      written permission.
+
+   THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+   IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+   WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+   DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+   GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+   IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+   OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+   IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+-->
+
+<!DOCTYPE xsl:stylesheet [
+ <!ENTITY tab "&#9;">
+ <!ENTITY newl "&#38;#xA;">
+ <!ENTITY space "&#32;">
+]>
+
+<xsl:stylesheet
+  version="1.0"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+ <xsl:output
+   method="text"
+   encoding="utf-8"
+   media-type="text/plain"
+   omit-xml-declaration="yes"
+   standalone="yes"
+   indent="no" />
+
+ <xsl:strip-space elements="*" />
+
+ <!-- the prefix of pathnames to strip -->
+ <xsl:param name="strip-prefix" select="'/'" />
+
+ <!-- the length of a line to wrap messages at -->
+ <xsl:param name="linelen" select="75" />
+
+ <!-- whether entries should be grouped by day -->
+ <xsl:param name="groupbyday" select="'no'" />
+
+ <!-- whether to seperate log messages by empty lines -->
+ <xsl:param name="separate-daylogs" select="'no'" />
+
+ <!-- whether a revision number should be included -->
+ <xsl:param name="include-rev" select="'no'" />
+
+ <!-- whether aaction labels should be added to files -->
+ <xsl:param name="include-actions" select="'no'" />
+
+ <!-- whether the log message should start on a new line -->
+ <xsl:param name="breakbeforemsg" select="'no'" />
+
+ <!-- whether the message should be rewrapped within one paragraph -->
+ <xsl:param name="reparagraph" select="'no'" />
+
+ <!-- whether certain messages should be ignored -->
+ <xsl:param name="ignore-message-starting" select="''" />
+
+ <!-- location of authors file if any -->
+ <xsl:param name="authorsfile" select="''" />
+ <xsl:key name="author-lookup" match="author" use="@uid" />
+ <xsl:variable name="authors-top" select="document($authorsfile)/authors" />
+
+ <!-- match the topmost log entry -->
+ <xsl:template match="log">
+  <xsl:choose>
+   <xsl:when test="$ignore-message-starting != ''">
+    <!-- only handle logentries with don't contain the string -->
+    <xsl:apply-templates select="logentry[not(starts-with(msg,$ignore-message-starting))]" />
+   </xsl:when>
+   <xsl:otherwise>
+    <xsl:apply-templates select="logentry" />
+   </xsl:otherwise>
+  </xsl:choose>
+  <!-- add newlines at the end of the changelog -->
+  <xsl:text>&newl;</xsl:text>
+ </xsl:template>
+
+ <!-- format one entry from the log -->
+ <xsl:template match="logentry">
+  <xsl:choose>
+   <!-- if we're grouping we should omit some headers -->
+   <xsl:when test="$groupbyday='yes'">
+    <!-- save log entry number -->
+    <xsl:variable name="pos" select="position()" />
+    <!-- fetch previous entry's date -->
+    <xsl:variable name="prevdate">
+     <xsl:apply-templates select="../logentry[position()=(($pos)-1)]/date" />
+    </xsl:variable>
+    <!-- fetch previous entry's author -->
+    <xsl:variable name="prevauthor">
+     <xsl:value-of select="normalize-space(../logentry[position()=(($pos)-1)]/author)" />
+    </xsl:variable>
+    <!-- fetch this entry's date -->
+    <xsl:variable name="date">
+     <xsl:apply-templates select="date" />
+    </xsl:variable>
+    <!-- fetch this entry's author -->
+    <xsl:variable name="author">
+     <xsl:value-of select="normalize-space(author)" />
+    </xsl:variable>
+    <!-- check if header is changed -->
+    <xsl:if test="($prevdate!=$date) or ($prevauthor!=$author)">
+     <!-- add newline -->
+     <xsl:if test="not(position()=1)">
+      <xsl:text>&newl;</xsl:text>
+     </xsl:if>
+     <!-- date -->
+     <xsl:value-of select="$date" />
+     <!-- two spaces -->
+     <xsl:text>&space;&space;</xsl:text>
+     <!-- author's name -->
+     <xsl:apply-templates select="author" />
+     <!-- two newlines -->
+     <xsl:text>&newl;</xsl:text>
+     <xsl:if test="$separate-daylogs!='yes'"><xsl:text>&newl;</xsl:text></xsl:if>
+    </xsl:if>
+   </xsl:when>
+   <!-- write the log header -->
+   <xsl:otherwise>
+    <!-- add newline -->
+    <xsl:if test="not(position()=1)">
+     <xsl:text>&newl;</xsl:text>
+    </xsl:if>
+    <!-- date -->
+    <xsl:apply-templates select="date" />
+    <!-- two spaces -->
+    <xsl:text>&space;&space;</xsl:text>
+    <!-- author's name -->
+    <xsl:apply-templates select="author" />
+    <!-- two newlines -->
+    <xsl:text>&newl;&newl;</xsl:text>
+   </xsl:otherwise>
+  </xsl:choose>
+  <!-- get paths string -->
+  <xsl:variable name="paths">
+   <xsl:apply-templates select="paths" />
+  </xsl:variable>
+  <!-- get revision number -->
+  <xsl:variable name="rev">
+   <xsl:if test="$include-rev='yes'">
+    <xsl:text>[r</xsl:text>
+    <xsl:value-of select="@revision" />
+    <xsl:text>]&space;</xsl:text>
+   </xsl:if>
+  </xsl:variable>
+  <!-- trim trailing newlines -->
+  <xsl:variable name="msg">
+   <!-- add a line break before the log message -->
+   <xsl:choose>
+    <xsl:when test="$breakbeforemsg='yes'">
+     <xsl:text>&newl;</xsl:text>
+    </xsl:when>
+    <xsl:when test="number($breakbeforemsg)&gt;0">
+     <xsl:call-template name="newlines">
+      <xsl:with-param name="count" select="number($breakbeforemsg)" />
+     </xsl:call-template>
+    </xsl:when>
+   </xsl:choose>
+   <xsl:call-template name="trim-newln">
+    <xsl:with-param name="txt" select="msg" />
+   </xsl:call-template>
+  </xsl:variable>
+  <!-- add newline here if separate-daylogs is in effect -->
+  <xsl:if test="$groupbyday='yes' and $separate-daylogs='yes'"><xsl:text>&newl;</xsl:text></xsl:if>
+  <!-- first line is indented (other indents are done in wrap template) -->
+  <xsl:text>&tab;*&space;</xsl:text>
+  <!-- set up the text to wrap -->
+  <xsl:variable name="txt">
+   <xsl:value-of select="$rev" />
+   <xsl:if test="$paths!=''">
+    <xsl:value-of select="concat($paths,':&space;')" />
+   </xsl:if>
+   <xsl:value-of select="$msg" />
+  </xsl:variable>
+  <!-- print the paths and message nicely wrapped -->
+  <xsl:call-template name="wrap">
+   <xsl:with-param name="txt" select="$txt" />
+  </xsl:call-template>
+ </xsl:template>
+
+ <!-- format date -->
+ <xsl:template match="date">
+  <xsl:variable name="date" select="normalize-space(.)" />
+  <!-- output date part -->
+  <xsl:value-of select="substring($date,1,10)" />
+  <!-- output time part -->
+  <xsl:if test="$groupbyday!='yes'">
+   <xsl:text>&space;</xsl:text>
+   <xsl:value-of select="substring($date,12,5)" />
+  </xsl:if>
+ </xsl:template>
+
+ <!-- format author -->
+ <xsl:template match="author">
+  <xsl:variable name="uid" select="normalize-space(.)" />
+  <!-- try to lookup author in authorsfile -->
+  <xsl:choose>
+   <xsl:when test="$authorsfile!=''">
+    <xsl:for-each select="$authors-top">
+     <xsl:variable name="author" select="key('author-lookup',$uid)" />
+     <!-- present result -->
+     <xsl:choose>
+      <xsl:when test="string($author/.)">
+       <xsl:apply-templates select="$author/node()" mode="copy" />
+      </xsl:when>
+      <xsl:otherwise>
+       <xsl:value-of select="$uid" />
+      </xsl:otherwise>
+     </xsl:choose>
+    </xsl:for-each>
+   </xsl:when>
+   <xsl:otherwise>
+    <xsl:value-of select="$uid" />
+   </xsl:otherwise>
+  </xsl:choose>
+ </xsl:template>
+
+ <!-- copy but normalize text -->
+ <xsl:template match="text()" mode="copy">
+  <xsl:value-of select="normalize-space(.)" />
+ </xsl:template>
+
+ <!-- simple copy template -->
+ <xsl:template match="@*|node()" mode="copy">
+  <xsl:copy>
+   <xsl:apply-templates select="@*|node()" mode="copy" />
+  </xsl:copy>
+ </xsl:template>
+
+ <!-- present a list of paths names -->
+ <xsl:template match="paths">
+  <xsl:choose>
+   <!-- only handle paths that begin with the path and strip the path -->
+   <xsl:when test="$strip-prefix != ''">
+    <!-- if strip-prefix does not start with a slash, prepend it -->
+    <xsl:variable name="tmpstrip1">
+     <xsl:choose>
+      <xsl:when test="starts-with($strip-prefix,'/')">
+       <xsl:value-of select="$strip-prefix" />
+      </xsl:when>
+      <xsl:otherwise>
+       <xsl:value-of select="concat('/',$strip-prefix)" />
+      </xsl:otherwise>
+     </xsl:choose>
+    </xsl:variable>
+    <!-- strip trailing slash from strip-prefix -->
+    <xsl:variable name="tmpstrip2">
+     <xsl:choose>
+      <xsl:when test="substring($tmpstrip1,string-length($tmpstrip1),1)='/'">
+       <xsl:value-of select="substring($tmpstrip1,1,string-length($tmpstrip1)-1)" />
+      </xsl:when>
+      <xsl:otherwise>
+       <xsl:value-of select="$tmpstrip1" />
+      </xsl:otherwise>
+     </xsl:choose>
+    </xsl:variable>
+    <!-- filter on all entries within directory -->
+    <xsl:for-each select="path[starts-with(concat(normalize-space(.),'/'),concat($tmpstrip2,'/'))]">
+     <xsl:sort select="normalize-space(.)" data-type="text" />
+     <!-- unless we are the first entry, add a comma -->
+     <xsl:if test="not(position()=1)">
+      <xsl:text>,&space;</xsl:text>
+     </xsl:if>
+     <!-- print the path name -->
+     <xsl:call-template name="printpath">
+      <xsl:with-param name="path" select="substring(normalize-space(.),string-length($strip-prefix)+3)" />
+     </xsl:call-template>
+     <!-- add the action flag -->
+     <xsl:if test="$include-actions='yes'">
+      <xsl:apply-templates select="." mode="action"/>
+     </xsl:if>
+    </xsl:for-each>
+   </xsl:when>
+   <!-- print a simple list of all paths -->
+   <xsl:otherwise>
+    <xsl:for-each select="path">
+     <xsl:sort select="normalize-space(.)" data-type="text" />
+     <!-- unless we are the first entry, add a comma -->
+     <xsl:if test="not(position()=1)">
+      <xsl:text>,&space;</xsl:text>
+     </xsl:if>
+     <!-- print the path name -->
+     <xsl:value-of select="normalize-space(.)" />
+     <!-- add the action flag -->
+     <xsl:if test="$include-actions='yes'">
+      <xsl:apply-templates select="." mode="action"/>
+     </xsl:if>
+    </xsl:for-each>
+   </xsl:otherwise>
+  </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="path" mode="action">
+  <xsl:choose>
+   <xsl:when test="@action='D'">
+    <xsl:text>[DEL]</xsl:text>
+   </xsl:when>
+   <xsl:when test="@copyfrom-path">
+    <xsl:text>[CPY]</xsl:text>
+   </xsl:when>
+   <xsl:when test="@action='D'">
+    <xsl:text>[ADD]</xsl:text>
+   </xsl:when>
+  </xsl:choose>
+ </xsl:template>
+
+ <!-- transform path to something printable -->
+ <xsl:template name="printpath">
+  <!-- fetch the pathname -->
+  <xsl:param name="path" />
+  <!-- strip leading slash -->
+  <xsl:variable name="tmp1">
+   <xsl:choose>
+    <xsl:when test="starts-with($path,'/')">
+     <xsl:value-of select="substring($path,2)" />
+    </xsl:when>
+    <xsl:otherwise>
+     <xsl:value-of select="$path" />
+    </xsl:otherwise>
+   </xsl:choose>
+  </xsl:variable>
+  <!-- translate empty string to dot -->
+  <xsl:choose>
+   <xsl:when test="$tmp1 = ''">
+    <xsl:text>.</xsl:text>
+   </xsl:when>
+   <xsl:otherwise>
+    <xsl:value-of select="$tmp1" />
+   </xsl:otherwise>
+  </xsl:choose>
+ </xsl:template>
+
+ <!-- string-wrapping template -->
+ <xsl:template name="wrap">
+  <xsl:param name="txt" />
+  <xsl:variable name="normtxt" select="normalize-space($txt)" />
+  <xsl:choose>
+   <xsl:when test="contains($txt,'&newl;')">
+     <!-- text contains newlines, do the first line -->
+     <xsl:call-template name="wrap">
+      <xsl:with-param name="txt" select="substring-before($txt,'&newl;')" />
+     </xsl:call-template>
+     <!-- print tab -->
+     <xsl:text>&tab;&space;&space;</xsl:text>
+     <!-- wrap the rest of the text -->
+     <xsl:call-template name="wrap">
+      <xsl:with-param name="txt" select="substring-after($txt,'&newl;')" />
+     </xsl:call-template>
+   </xsl:when>
+   <xsl:when test="(string-length($normtxt) &lt; (($linelen)-9)) or not(contains($normtxt,' '))">
+    <!-- this is easy, nothing to do -->
+    <xsl:value-of select="$normtxt" />
+    <!-- add newline -->
+    <xsl:text>&newl;</xsl:text>
+   </xsl:when>
+   <xsl:otherwise>
+    <!-- find the first line -->
+    <xsl:variable name="tmp" select="substring($normtxt,1,(($linelen)-9))" />
+    <xsl:variable name="line">
+     <xsl:choose>
+      <!-- if our attempt contains spaces wrap on that -->
+      <xsl:when test="contains($tmp,' ')">
+       <xsl:call-template name="find-line">
+        <xsl:with-param name="txt" select="$tmp" />
+       </xsl:call-template>
+      </xsl:when>
+      <!-- otherwise use the first non-space characters from the text -->
+      <xsl:otherwise>
+       <xsl:value-of select="substring-before($normtxt,' ')" />
+      </xsl:otherwise>
+     </xsl:choose>
+    </xsl:variable>
+    <!-- print line -->
+    <xsl:value-of select="$line" />
+    <!-- print newline and tab -->
+    <xsl:text>&newl;&tab;&space;&space;</xsl:text>
+    <!-- wrap the rest of the text -->
+    <xsl:call-template name="wrap">
+     <xsl:with-param name="txt" select="normalize-space(substring($normtxt,string-length($line)+1))" />
+    </xsl:call-template>
+   </xsl:otherwise>
+  </xsl:choose>
+ </xsl:template>
+
+ <!-- template to trim line to contain space as last char -->
+ <xsl:template name="find-line">
+  <xsl:param name="txt" />
+  <xsl:choose>
+   <xsl:when test="substring($txt,string-length($txt),1)=' '">
+    <xsl:value-of select="substring($txt,1,string-length($txt)-1)" />
+   </xsl:when>
+   <xsl:otherwise>
+    <xsl:call-template name="find-line">
+     <xsl:with-param name="txt" select="substring($txt,1,string-length($txt)-1)" />
+    </xsl:call-template>
+   </xsl:otherwise>
+  </xsl:choose>
+ </xsl:template>
+
+ <!-- template to trim trailing and starting newlines -->
+ <xsl:template name="trim-newln">
+  <xsl:param name="txt" />
+  <xsl:choose>
+   <!-- find starting newlines -->
+   <xsl:when test="substring($txt,1,1) = '&newl;'">
+    <xsl:call-template name="trim-newln">
+     <xsl:with-param name="txt" select="substring($txt,2)" />
+    </xsl:call-template>
+   </xsl:when>
+   <!-- find trailing newlines -->
+   <xsl:when test="substring($txt,string-length($txt),1) = '&newl;'">
+    <xsl:call-template name="trim-newln">
+     <xsl:with-param name="txt" select="substring($txt,1,string-length($txt)-1)" />
+    </xsl:call-template>
+   </xsl:when>
+   <!-- if the message has paragrapgs, find the first one -->
+   <xsl:when test="$reparagraph='yes' and contains($txt,'&newl;&newl;')">
+     <!-- remove newlines from first paragraph -->
+     <xsl:value-of select="normalize-space(substring-before($txt,'&newl;&newl;'))" />
+     <!-- paragraph separator -->
+     <xsl:text>&newl;&newl;</xsl:text>
+     <!-- do the rest of the text -->
+     <xsl:call-template name="trim-newln">
+      <xsl:with-param name="txt" select="substring-after($txt,'&newl;&newl;')" />
+     </xsl:call-template>
+   </xsl:when>
+   <!-- remove more single newlines -->
+   <xsl:when test="$reparagraph='yes'">
+    <xsl:value-of select="normalize-space($txt)" />
+   </xsl:when>
+   <!-- no newlines found, we're done -->
+   <xsl:otherwise>
+    <xsl:value-of select="$txt" />
+   </xsl:otherwise>
+  </xsl:choose>
+ </xsl:template>
+
+ <!-- insert a number of newlines -->
+ <xsl:template name="newlines">
+  <xsl:param name="count" />
+  <xsl:text>&newl;</xsl:text>
+  <xsl:if test="$count&gt;1">
+   <xsl:call-template name="newlines">
+    <xsl:with-param name="count" select="($count)-1" />
+   </xsl:call-template>
+  </xsl:if>
+ </xsl:template>
+
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/svn2cl.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/txm-edition-xtz-cuneiform.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/txm-edition-xtz-cuneiform.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/txm-edition-xtz-cuneiform.xsl	(revision 258)
@@ -0,0 +1,327 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:edate="http://exslt.org/dates-and-times"
+	xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tei="http://www.tei-c.org/ns/1.0" xmlns:txm="http://textometrie.org/1.0"
+	exclude-result-prefixes="#all" version="2.0">
+	
+	<xsl:output method="xml" encoding="UTF-8" omit-xml-declaration="no" indent="no"  doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
+	
+	<xsl:strip-space elements="*"/>
+	
+	<xsl:param name="editionpagetag">pb</xsl:param>
+	
+	<xsl:param name="textcontainer">text</xsl:param>
+	
+	<!--<xsl:param name="frontmatter"></xsl:param>
+	
+	<xsl:param name="backmatter">back</xsl:param>-->
+	
+	<xsl:variable name="inputtype">
+		<xsl:choose>
+			<xsl:when test="//tei:w//txm:form">xmltxm</xsl:when>
+			<xsl:otherwise>xmlw</xsl:otherwise>
+		</xsl:choose>
+	</xsl:variable>
+	
+	<xsl:template match="/">
+		<html>
+			<head>
+				<title><xsl:value-of select="//tei:text[1]/@id"/></title>
+				<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
+			</head>
+			<body>
+				<a class="txm-page" title="1"/>
+				<div class="metadata-page">
+					<h1><xsl:value-of select="//tei:text[1]/@id"></xsl:value-of></h1>
+					<br/>
+					<table>
+						<xsl:for-each select="//tei:text[1]/@*">
+							<tr>
+								<td><xsl:value-of select="name()"/></td>
+								<td><xsl:value-of select="."/></td>
+							</tr>
+						</xsl:for-each>
+					</table>
+					<br/>
+					<br/>
+				</div>
+				<xsl:apply-templates select="descendant::*[local-name()=$textcontainer]"/>
+				
+				
+<!--				<xsl:if test="//tei:note[not(@place='inline') and not(matches(@type,'intern|auto')) and not(following::*[local-name()=$editionpagetag]) and preceding::*[local-name()=$editionpagetag]]">
+					<br/>
+					<br/>			
+					<span class="footnotes">
+					<xsl:for-each select="//tei:note[not(@place='inline') and not(matches(@type,'intern|auto')) and not(following::*[local-name()=$editionpagetag]) and preceding::*[local-name()=$editionpagetag]]">
+						<xsl:variable name="note_count">
+							<xsl:value-of select="count(preceding::tei:note[not(@place='inline') and not(matches(@type,'intern|auto'))]) + 1"/>
+						</xsl:variable>
+						<!-\-<p><xsl:value-of select="$note_count"/>. <a href="#noteref_{$note_count}" name="note_{$note_count}">[<xsl:value-of select="preceding::tei:cb[1]/@xml:id"/>, l. <xsl:value-of select="preceding::tei:lb[1]/@n"/>]</a><xsl:text> </xsl:text> <xsl:value-of select="."/></p>-\->
+						<span class="note">
+							<span class="footnotenumber"><a href="#noteref_{$note_count}" name="note_{$note_count}"><xsl:value-of select="$note_count"/></a>. </span>
+							<xsl:apply-templates mode="#current"/>
+						</span>
+					</xsl:for-each>
+					</span>
+					
+				</xsl:if>
+-->				
+			</body>
+		</html>
+	</xsl:template>
+	
+	<xsl:template match="//*[local-name()=$textcontainer]">
+		<xsl:variable name="pbcount"></xsl:variable>
+		
+		<div class="text" style="margin-left:60px;">
+			<xsl:apply-templates/>
+		</div>
+	</xsl:template>
+	
+		
+	
+	<xsl:template match="*">
+		<xsl:choose>
+			<xsl:when test="descendant::tei:p|descendant::tei:ab">
+				<div>
+					<xsl:call-template name="addClass"/>
+					<xsl:apply-templates/></div>
+				<xsl:text>&#xa;</xsl:text>
+			</xsl:when>
+			<xsl:otherwise><span>
+				<xsl:call-template name="addClass"/>
+				<xsl:if test="self::tei:add[@del]">
+					<xsl:attribute name="title"><xsl:value-of select="@del"/></xsl:attribute>
+				</xsl:if>
+				<xsl:apply-templates/></span>
+				<!--<xsl:call-template name="spacing"/>-->
+			</xsl:otherwise>
+		</xsl:choose>
+	</xsl:template>
+	
+	<xsl:template match="@*|processing-instruction()|comment()">
+		<!--<xsl:copy/>-->
+	</xsl:template>
+	
+	<!--                <xsl:template match="comment()">
+                                <xsl:copy/>
+                </xsl:template>
+-->                
+	<xsl:template match="text()">
+		<xsl:value-of select="normalize-space(.)"/>
+	</xsl:template>
+	
+	<xsl:template name="addClass">
+		<xsl:attribute name="class">
+			<xsl:value-of select="local-name(.)"/>
+			<xsl:if test="@type"><xsl:value-of select="concat('-',@type)"/></xsl:if>
+			<xsl:if test="@subtype"><xsl:value-of select="concat('-',@subtype)"/></xsl:if>
+			<xsl:if test="@rend"><xsl:value-of select="concat('-',@rend)"/></xsl:if>
+		</xsl:attribute>                	
+	</xsl:template>
+	
+<!--	<xsl:template match="tei:p|tei:ab">
+		<p>
+			<xsl:call-template name="addClass"/>
+			<xsl:apply-templates/>
+		</p>
+		<xsl:text>&#xa;</xsl:text>
+	</xsl:template>-->
+	
+	<xsl:template match="//word">
+		<xsl:choose>
+			<xsl:when test="@line = preceding::word[1]/@line"><xsl:text> </xsl:text></xsl:when>
+			<xsl:otherwise><br/><xsl:text>&#xa;</xsl:text><span style="position:relative"><span class="linenumber" style="position:absolute;width:40px;left:-50px;padding-right:20px;text-align:right"><xsl:value-of select="@line"/>&#xa0;</span></span></xsl:otherwise>
+		</xsl:choose>
+		<span>
+			<xsl:call-template name="addClass"/>
+			<xsl:apply-templates/>
+		</span>
+	</xsl:template>
+	
+	
+	
+	<!-- Page breaks -->                
+	<xsl:template match="//*[local-name()=$editionpagetag]">
+		<xsl:variable name="editionpagetype">
+			<xsl:choose>
+				<xsl:when test="ancestor::tei:ab">editionpageverse</xsl:when>
+				<xsl:otherwise>editionpage</xsl:otherwise>
+			</xsl:choose>
+		</xsl:variable>
+		<xsl:variable name="pagenumber">
+			<xsl:choose>
+				<xsl:when test="@n"><xsl:value-of select="@n"/></xsl:when>
+				<xsl:when test="@facs"><xsl:value-of select="substring-before(@facs,'.')"/></xsl:when>
+				<xsl:otherwise>[NN]</xsl:otherwise>
+			</xsl:choose>
+		</xsl:variable>
+		
+		<xsl:variable name="page_id"><xsl:value-of select="count(preceding::*[local-name()=$editionpagetag])"/></xsl:variable>
+		<xsl:if test="@break='no'"><span class="hyphen">-</span></xsl:if>
+		<xsl:if test="//tei:note[not(@place='inline') and not(matches(@type,'intern|auto'))][following::*[local-name()=$editionpagetag][1][count(preceding::*[local-name()=$editionpagetag]) = $page_id]]">
+			<xsl:text>&#xa;</xsl:text>
+			<br/>
+			<br/>			
+			<span class="footnotes">
+				<xsl:for-each select="//tei:note[not(@place='inline') and not(matches(@type,'intern|auto'))][following::*[local-name()=$editionpagetag][1][count(preceding::*[local-name()=$editionpagetag]) = $page_id]]">
+					<xsl:variable name="note_count"><xsl:value-of select="count(preceding::tei:note[not(@place='inline')]) + 1"/></xsl:variable>
+					<!--<p><xsl:value-of select="$note_count"/>. <a href="#noteref_{$note_count}" name="note_{$note_count}">[<xsl:value-of select="preceding::tei:cb[1]/@xml:id"/>, l. <xsl:value-of select="preceding::tei:lb[1]/@n"/>]</a><xsl:text> </xsl:text> <xsl:value-of select="."/></p>-->
+					<span class="note">
+						<span class="footnotenumber"><a href="#noteref_{$note_count}" name="note_{$note_count}"><xsl:value-of select="$note_count"/></a>. </span>
+						<xsl:apply-templates mode="#current"/>
+					</span>                                                                
+				</xsl:for-each></span><xsl:text>&#xa;</xsl:text>                                                                
+			
+		</xsl:if>                                
+		
+		<xsl:text>&#xa;</xsl:text>
+		<br/><xsl:text>&#xa;</xsl:text>
+		<a class="txm-page" title="{count(preceding::*[local-name()=$editionpagetag]) + 2}"/>
+		<span class="{$editionpagetype}"> - <xsl:value-of select="$pagenumber"/> - </span><br/><xsl:text>&#xa;</xsl:text>
+	</xsl:template>
+	
+	<!-- Notes -->
+<!--	<xsl:template match="tei:note[not(@place='inline') and not(matches(@type,'intern|auto'))]">
+		<!-\-<span style="color:violet"> [<b>Note :</b> <xsl:apply-templates/>] </span>-\->	
+		<xsl:variable name="note_count"><xsl:value-of select="count(preceding::tei:note[not(@place='inline') and not(matches(@type,'intern|auto'))]) + 1"/></xsl:variable>
+		<a title="{.}" class="noteref" href="#note_{$note_count}" name="noteref_{$note_count}">[<xsl:value-of select="$note_count"/>]</a>
+		<xsl:call-template name="spacing"/>                                
+	</xsl:template>
+-->	
+	
+	<xsl:template match="//w"><span class="w" style="font-family:Santakku">
+		<xsl:variable name="unicode-chars" as="element()">
+			<unicode>
+				<xsl:choose>
+					<xsl:when test="contains(@ref-unicode,'&amp;')">
+						<char><xsl:call-template name="hex2num"><xsl:with-param name="hex"><xsl:value-of select="substring-before(substring(@ref-unicode,4),'&amp;')"/></xsl:with-param></xsl:call-template></char>
+						<char><xsl:call-template name="hex2num"><xsl:with-param name="hex"><xsl:value-of select="substring-after(@ref-unicode,'&amp;U+')"/></xsl:with-param></xsl:call-template></char>
+					</xsl:when>
+					<xsl:otherwise><char><xsl:call-template name="hex2num"><xsl:with-param name="hex"><xsl:value-of select="substring(@ref-unicode,4)"/></xsl:with-param></xsl:call-template></char></xsl:otherwise>
+				</xsl:choose>
+			</unicode>
+		</xsl:variable>
+		<xsl:if test="@id">
+			<xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
+		</xsl:if>
+		<xsl:attribute name="title">
+			<xsl:choose>
+				<xsl:when test="descendant::txm:ana">
+					<xsl:for-each select="descendant::txm:ana">
+						<xsl:value-of select="concat(substring(@type,2),': ',.,' ; ')"/>				
+					</xsl:for-each>
+					<xsl:value-of select="concat('translit : ',descendant::txm:form)"/>
+				</xsl:when>
+				<xsl:otherwise>
+					<xsl:for-each select="@*">
+						<xsl:value-of select="concat(name(),': ',.,' ; ')"/>				
+					</xsl:for-each>
+					<xsl:value-of select="concat('translit : ',.)"/>
+				</xsl:otherwise>
+			</xsl:choose>
+
+		</xsl:attribute>
+		<xsl:choose>
+			<xsl:when test="descendant::txm:form">
+				<xsl:apply-templates select="txm:form"/>
+			</xsl:when>
+			<xsl:otherwise>
+				<!--<xsl:value-of select="codepoints-to-string($unicode)"/>-->
+				<xsl:for-each select="$unicode-chars/char">
+					<xsl:value-of select="codepoints-to-string(.)"/>
+				</xsl:for-each>
+			</xsl:otherwise>
+		</xsl:choose>
+		
+	</span>
+		<!--<xsl:if test="following-sibling::tei:w"></xsl:if>-->
+	</xsl:template>
+	
+	<xsl:template name="hex2num">
+		<xsl:param name="hex"/>
+		<xsl:param name="num" select="0"/>
+		<xsl:param name="MSB" select="translate(substring($hex, 1, 1), 'abcdef', 'ABCDEF')"/>
+		<xsl:param name="value" select="string-length(substring-before('0123456789ABCDEF', $MSB))"/>
+		<xsl:param name="result" select="16 * $num + $value"/>
+		<xsl:choose>
+			<xsl:when test="string-length($hex) > 1">
+				<xsl:call-template name="hex2num">
+					<xsl:with-param name="hex" select="substring($hex, 2)"/>
+					<xsl:with-param name="num" select="$result"/>
+				</xsl:call-template>
+			</xsl:when>
+			<xsl:otherwise>
+				<xsl:value-of select="$result"/>
+			</xsl:otherwise>
+		</xsl:choose>
+	</xsl:template>
+	
+	
+	                <xsl:template match="//txm:form">
+	                	<xsl:variable name="unicode-chars" as="element()">
+	                		<unicode>
+	                			<xsl:choose>
+	                				<xsl:when test="contains(following-sibling::txm:ana[@type='#ref-unicode'],'&amp;')">
+	                					<char><xsl:call-template name="hex2num"><xsl:with-param name="hex"><xsl:value-of select="substring-before(substring(following-sibling::txm:ana[@type='#ref-unicode'],4),'&amp;')"/></xsl:with-param></xsl:call-template></char>
+	                					<char><xsl:call-template name="hex2num"><xsl:with-param name="hex"><xsl:value-of select="substring-after(following-sibling::txm:ana[@type='#ref-unicode'],'&amp;U+')"/></xsl:with-param></xsl:call-template></char>
+	                				</xsl:when>
+	                				<xsl:otherwise><char><xsl:call-template name="hex2num"><xsl:with-param name="hex"><xsl:value-of select="substring(following-sibling::txm:ana[@type='#ref-unicode'],4)"/></xsl:with-param></xsl:call-template></char></xsl:otherwise>
+	                			</xsl:choose>
+	                		</unicode>
+	                	</xsl:variable>
+	                	<!--<xsl:variable name="unicode">
+	                		<xsl:call-template name="hex2num"><xsl:with-param name="hex"><xsl:value-of select="ancestor::w/substring(child::txm:ana[@type='#ref-unicode'],4)"/></xsl:with-param></xsl:call-template>			
+	                	</xsl:variable>-->
+	                	
+	                	<!--<xsl:value-of select="codepoints-to-string($unicode)"/>-->
+	                	<xsl:for-each select="$unicode-chars/char">
+	                		<xsl:value-of select="codepoints-to-string(.)"/>
+	                		<!--<xsl:value-of select="."/>-->
+	                	</xsl:for-each>
+                </xsl:template>
+                
+<!--	<xsl:template name="spacing">
+		<xsl:choose>
+			<xsl:when test="$inputtype='xmltxm'">
+				<xsl:call-template name="spacing-xmltxm"/>
+			</xsl:when>
+			<xsl:otherwise>
+				<xsl:call-template name="spacing-xmlw"/>
+			</xsl:otherwise>
+		</xsl:choose>
+	</xsl:template>
+
+	<xsl:template name="spacing-xmlw">
+		<xsl:choose>
+			<xsl:when test="ancestor::tei:w"/>
+			<xsl:when test="following::tei:w[1][matches(.,'^\s*[.,)\]]+\s*$')]"/>			
+			<xsl:when test="matches(.,'^\s*[(\[]+$|\w(''|’)\s*$')"></xsl:when>
+			<xsl:when test="position()=last() and (ancestor::tei:choice or ancestor::tei:supplied[not(@rend='multi_s')])"></xsl:when>
+			<xsl:when test="following-sibling::*[1][self::tei:note]"></xsl:when>
+			<xsl:when test="following::tei:w[1][matches(.,'^\s*[:;!?]+\s*$')]">
+				<xsl:text>&#xa0;</xsl:text>
+			</xsl:when>
+			<xsl:otherwise>
+				<xsl:text> </xsl:text>
+			</xsl:otherwise>
+		</xsl:choose>                
+	</xsl:template>
+	
+	<xsl:template name="spacing-xmltxm">
+		<xsl:choose>
+			<xsl:when test="ancestor::tei:w"/>
+			<xsl:when test="following::tei:w[1][matches(descendant::txm:form[1],'^[.,)\]]+$')]"/>			
+			<xsl:when test="matches(descendant::txm:form[1],'^[(\[]+$|\w(''|’)$')"></xsl:when>
+			<xsl:when test="position()=last() and (ancestor::tei:choice or ancestor::tei:supplied[not(@rend='multi_s')])"></xsl:when>
+			<xsl:when test="following-sibling::*[1][self::tei:note]"></xsl:when>
+			<xsl:when test="following::tei:w[1][matches(descendant::txm:form[1],'^[:;!?]+$')]">
+				<xsl:text>&#xa0;</xsl:text>
+			</xsl:when>
+			<xsl:otherwise>
+				<xsl:text> </xsl:text>
+			</xsl:otherwise>
+		</xsl:choose>                
+	</xsl:template>-->
+	
+	
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/txm-edition-xtz-cuneiform.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/filter-out-sp.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/filter-out-sp.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/filter-out-sp.xsl	(revision 258)
@@ -0,0 +1,46 @@
+<?xml version="1.0"?>
+<xsl:stylesheet
+  xmlns:xd="http://www.pnp-software.com/XSLTdoc"
+  xmlns:edate="http://exslt.org/dates-and-times"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tei="http://www.tei-c.org/ns/1.0"
+  exclude-result-prefixes="tei edate xd" version="2.0">
+  
+  <xd:doc type="stylesheet">
+    <xd:short>
+      Feuille de style de suppression de certains éléments XML à utiliser comme
+      prétraitement de l'import XML/w+CSV. 
+    </xd:short>
+    <xd:detail>
+      This stylesheet is free software; you can redistribute it and/or
+      modify it under the terms of the GNU Lesser General Public
+      License as published by the Free Software Foundation; either
+      version 3 of the License, or (at your option) any later version.
+      
+      This stylesheet 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
+      Lesser General Public License for more details.
+      
+      You should have received a copy of GNU Lesser Public License with
+      this stylesheet. If not, see http://www.gnu.org/licenses/lgpl.html
+    </xd:detail>
+    <xd:author>Serge Heiden slh@ens-lyon.fr</xd:author>
+    <xd:copyright>2013, CNRS / ICAR (ICAR3 LinCoBaTO)</xd:copyright>
+  </xd:doc>
+  
+
+  <xsl:output method="xml" encoding="utf-8" omit-xml-declaration="yes"/>
+
+  <xsl:template match="@*|node()">
+    <xsl:copy>
+      <xsl:apply-templates select="@*|node()" />
+    </xsl:copy>
+  </xsl:template>
+  
+  <!-- On supprime tous les <sp> dont l'attribut @who vaut 'enqueteur' -->
+  
+  <xsl:template match="//sp[@who='enqueteur']">    
+      <!--<xsl:copy-of select="."/>-->    
+  </xsl:template>
+	
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/filter-out-sp.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-teitextgrid-xmlw-posttok.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-teitextgrid-xmlw-posttok.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-teitextgrid-xmlw-posttok.xsl	(revision 258)
@@ -0,0 +1,142 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:edate="http://exslt.org/dates-and-times"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xd="http://www.pnp-software.com/XSLTdoc" xmlns:tei="http://www.tei-c.org/ns/1.0" xmlns:txm="http://textometrie.org/1.0"
+  exclude-result-prefixes="tei edate txm" xpath-default-namespace="http://www.tei-c.org/ns/1.0" version="2.0">
+
+  <xd:doc type="stylesheet">
+    <xd:short>
+      This stylesheet is used on tokenized DARIAH-DE TextGrid files
+      in the TXM XML/w + csv import process.
+    </xd:short>
+    <xd:detail>
+      This stylesheet is free software; you can redistribute it and/or
+      modify it under the terms of the GNU Lesser General Public
+      License as published by the Free Software Foundation; either
+      version 3 of the License, or (at your option) any later version.
+      
+      This stylesheet 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
+      Lesser General Public License for more details.
+      
+      You should have received a copy of GNU Lesser Public License with
+      this stylesheet. If not, see http://www.gnu.org/licenses/lgpl.html
+    </xd:detail>
+    <xd:author>Alexei Lavrentiev alexei.lavrentev@ens-lyon.fr</xd:author>
+    <xd:copyright>2014, CNRS / ICAR (CACTUS)</xd:copyright>
+  </xd:doc>
+  
+
+  <xsl:output method="xml" encoding="utf-8" omit-xml-declaration="no"/> 
+
+  <!-- By default, copy all attributes, comments, processing instructions and text nodes -->
+
+  <xsl:template match="@*|comment()|processing-instruction()">
+    <xsl:copy/>
+  </xsl:template>
+  
+  <xsl:template match="text()">
+    <xsl:value-of select="."/>
+  </xsl:template>
+  
+  <!-- delete the teiHeader for xml/w import module-->
+  
+  <xsl:template match="teiHeader"/>
+  
+  
+<!-- The page breaks must be placed before the structural units (text divions) that 
+    start on a given page (to avoid empty elements creation when splitting the pages of the
+    TXM edition) -->
+
+  <xsl:template match="text">
+    <xsl:copy>
+      <xsl:apply-templates select="@*"/>
+      <xsl:if test="not(child::*[1][self::pb])"><pb xmlns="http://www.tei-c.org/ns/1.0" n="title"/></xsl:if>
+      <xsl:apply-templates/>
+    </xsl:copy>
+  </xsl:template>  
+
+  <xsl:template match="*">    
+    <xsl:if test="descendant::tei:pb and (parent::tei:text or preceding-sibling::*)">
+      <!-- on déplace les pb initiaux avant la balise de l'élément le plus haut -->
+      <xsl:call-template name="raisePb"/>
+    </xsl:if>
+    <xsl:choose>
+      <xsl:when test="namespace-uri()=''">
+        <xsl:element namespace="http://www.tei-c.org/ns/1.0" name="{local-name(.)}">
+          <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
+        </xsl:element>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:copy>
+          <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
+        </xsl:copy>
+      </xsl:otherwise>
+    </xsl:choose>  
+  </xsl:template>
+  
+  <xsl:template match="tei:pb[not(preceding-sibling::*) and not(parent::tei:text)]">
+    <xsl:comment>Pb déplacé plus haut</xsl:comment>
+  </xsl:template>
+  
+  <xsl:template name="raisePb">
+    <xsl:if test="descendant::tei:pb">
+      <xsl:for-each select="child::*[1][descendant-or-self::tei:pb]">
+        <xsl:choose>
+          <xsl:when test="self::tei:pb"><xsl:comment>Pb remonté</xsl:comment>
+            <xsl:copy>
+              <xsl:apply-templates select="@*"/>
+              <xsl:if test="not(@n) and not(@facs) and following-sibling::tei:fw[1 or 2][@type='pageNum']">
+                <xsl:attribute name="n"><xsl:value-of select="normalize-space(following-sibling::tei:fw[@type='pageNum'][1])"/></xsl:attribute>
+              </xsl:if>
+            </xsl:copy></xsl:when>
+          <xsl:otherwise><xsl:call-template name="raisePb"></xsl:call-template></xsl:otherwise>
+        </xsl:choose>
+      </xsl:for-each>
+    </xsl:if>
+  </xsl:template>
+  
+  
+<!-- add @ref to words (for concordances) -->
+
+  <xsl:variable name="filename">
+    <xsl:analyze-string select="document-uri(.)" regex="^(.*)/([^/]+)\.[^/]+$">
+      <xsl:matching-substring>
+        <xsl:value-of select="regex-group(2)"/>
+      </xsl:matching-substring>
+    </xsl:analyze-string>
+  </xsl:variable>
+  
+  <xsl:template match="w">
+    <xsl:variable name="ref">
+      <xsl:choose>
+        <xsl:when test="preceding::pb[1][@n]">
+          <xsl:value-of select="concat($filename,', p. ',preceding::pb[1]/@n)"/>
+        </xsl:when>
+        <xsl:otherwise><xsl:value-of select="$filename"/></xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+        <w xmlns="http://www.tei-c.org/ns/1.0" ref="{$ref}">
+          <xsl:apply-templates select="@*"/>
+          <xsl:apply-templates select="*|processing-instruction()|comment()|text()"/>
+        </w>
+  </xsl:template>
+
+<!-- transform speaker into an attribute of the sp element -->
+
+  <xsl:template match="sp">
+    <xsl:copy>
+      <xsl:if test="child::speaker">
+        <xsl:variable name="who">
+          <xsl:value-of select="speaker"/>
+        </xsl:variable>
+        <xsl:attribute name="who"><xsl:value-of select="normalize-space(replace($who,'\s*\p{P}+\s*$',''))"/></xsl:attribute>
+        <xsl:apply-templates/>
+      </xsl:if>
+    </xsl:copy>
+  </xsl:template>
+  
+  <xsl:template match="speaker"/>
+  
+
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-teitextgrid-xmlw-posttok.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/epub-print.css
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/epub-print.css	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/epub-print.css	(revision 258)
@@ -0,0 +1,78 @@
+/* 
+** Copyright 2008 TEI Consortium
+
+$Id: tei-print.css 6500 2009-06-05 12:24:45Z rahtz $
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+ This library 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
+Lesser General Public License for more details.
+ You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the 
+Free Software Foundation, Inc., 
+59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+@import url(stylesheet.css);
+
+/* elements */
+
+  /* Use Helvetica by preference for most body text. Style hyperlinks with 
+     color only. Use white-space:pre-wrap or equivalent for code blocks
+     so text doesn't get cut off. */
+
+a {
+   text-decoration: none;
+}
+
+a:visited {
+   color:inherit;
+}
+
+body { 
+   font-family: Helvetica, Arial, sans-serif;
+   font-size: 10pt;
+}
+
+div.pre, div.pre_eg, pre.eg {
+   font-family: courier, "Courier New", fixed, monospace;
+   font-size: 9pt;
+   /* see http://cheeaun.phoenity.com/weblog/2005/06/whitespace-and-generated-content.html
+      for explanation of the white-space property cascade. pre-wrap is needed so long
+      lines won't be cut off in print. When browser support for CSS 2.1 is solid, proprietary
+      properties may be removed. */
+   white-space: pre; /* CSS2 */
+   white-space: -moz-pre-wrap; /* Mozilla */
+   white-space: -o-pre-wrap; /* Opera 7 */
+   white-space: pre-wrap; /* CSS 2.1 */
+   white-space: pre-line; /* CSS 3 (and 2.1 as well, actually) */
+   word-wrap: break-word; /* IE */
+   }
+
+div.pre_eg, pre.eg {
+   page-break-inside:avoid;
+}
+
+
+td {
+   font-size: 10pt;
+}
+
+td.maintext, td.maintext p {
+   font-family: Helvetica, Arial, sans-serif;
+}
+   
+/* classes */
+
+.plain {
+   font-family: Helvetica, Arial, sans-serif;
+}
+
+div.pagebreak {
+    page-break-before: always;
+}
\ No newline at end of file
Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/teislides.css
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/teislides.css	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/teislides.css	(revision 258)
@@ -0,0 +1,319 @@
+/* teislides.css */
+
+body
+{
+    background: white;
+    font-family: Helvetica;
+    font-size: 24pt; 
+    color: black;
+}
+
+table,tr,td {
+    font-size: 20pt; 
+}
+.label {
+   font-weight: bold;
+   background-color: #AAAAAA;
+}
+
+
+p {
+  margin-top: 10px;
+  margin-bottom: 10px;
+  }
+
+li {
+   margin-bottom: 6px;
+   margin-top: 4px;
+}
+
+div.pre,div.eg {
+    background: #ffffcc;
+    padding: 6pt;
+    font-family: monospace;
+    white-space: pre ;
+    font-size: 16pt;
+    color: blue;
+    margin-left: 0em;
+    border-style: inset
+}
+
+div.docAuthor {
+    padding: 12pt;
+    font-size: 34pt;
+    color: green;
+}
+
+div.docDate {
+    padding: 12pt;
+    font-size:34pt;
+    color: blue;
+}
+
+p,ul,ol,li {
+    font-size: 24pt;
+    }
+
+p.box {
+    background: blue; 
+    color: white ;
+    padding: 10pt;
+    margin-left: 5%;
+    font-size: 24pt;
+    font-weight: bold;
+    margin-right: 5%;
+    margin-top: 12pt;
+    border-style: outset;
+}
+
+
+td
+{
+    color: black;
+    padding: 3px;
+    margin-left: 5%;
+    margin-right: 5%;
+    margin-top: 3%;
+}
+
+div.pre, code, tt, Code
+{
+    white-space: pre ;
+    font-family:  monospace;
+    color: blue;
+    font-size: 20pt;
+}
+
+tt.url {
+    font-family:  sans-serif;
+    }
+
+
+h2 {    margin-top: 24pt;
+    font-size: 32pt;
+    font-family: serif;
+    color: green;
+    background: white;
+        text-align: center;
+    border-width: 5pt;
+    border-color: white;
+    padding: 0pt;
+    margin: 0pt;
+    }
+
+
+ul,dl,ol {    
+    font-size: 24pt;
+     }
+
+li.lower {     font-style: normal; }
+
+
+
+blockquote
+{
+    margin-left: 5%;
+    margin-right: 5%;
+    margin-top: 0.5em;
+    margin-bottom: 1.5em;
+/*    color: gray; */
+    color: teal;
+    text-align: justify;
+    font-size: smaller;
+}
+
+address
+{
+    font-style:  normal;
+    font-family: cursive;
+    letter-spacing: .1em;
+    font-size: x-small;
+}
+
+a:link
+{
+    color:  blue;
+}
+
+
+a:visited
+{
+    color:  navy;
+}
+
+
+a:active
+{
+    color:  purple;
+    background: yellow;
+}
+
+
+a:hover
+{
+    color:  blue;
+    background:     silver;
+}
+
+.titlebar
+{
+    color: white;
+    background: navy;
+}
+
+
+
+div.slidemain {
+      clear: both;
+      height: 75%;
+      border-top: 2px;
+      border-left: 0;
+      border-bottom: 0;
+      border-right: 0;
+      border-style: solid;
+      border-color: blue;
+      padding-left: 5%;
+      padding-right: 5%;
+      padding-top: 10pt;
+
+	      }
+
+div.slidebottom-text {
+      font-style: italic;
+      font-size: 12pt;
+      float: right;
+}
+div.slidebottom-image {
+      float: left;
+}
+div.slidebottom {
+      clear:both;
+      height: 2%;
+      margin-top: 10pt;
+      border-top: 2px;
+      border-left: 0;
+      border-bottom: 0;
+      border-right: 0;
+	      }
+
+div.slidetop {
+      padding-top: 2%;
+}
+
+div.slidetitle {
+    height: 10%;
+    float: left;
+    color:red;
+    font-size: 35pt;
+    font-weight: bold;
+    font-family: sans-serif;
+    text-align: left;
+    margin-bottom: 12pt;
+    padding-left: 5%;
+}
+div.xref {
+    height: 10%;
+    float: right;
+    font-size: 12pt;
+    font-weight: bold;
+    margin-bottom: 12pt;
+}
+
+span.bottomright{
+    float: right;
+    margin-top:0;
+    margin-bottom: 8pt;
+}
+
+
+
+li.slidetoc {
+ display: inline;
+}	      
+
+li.slidetoc:before {
+  content: " * ";
+  font-style: italic;
+}
+
+
+
+img.simple {
+	   border-style: none;
+	   }
+img.inline {
+	   border-style: none;
+	   }
+img.right {
+	   float:right
+	   }
+img.left {
+	   float:left
+	   }
+.button {
+    font-family: Symbol;
+    padding: 2px;
+    font-weight: bold;
+    border-style: outset;
+    background: blue; 
+    color: white ;
+}
+a.xreflink:link {
+		        text-decoration: none;		 	    
+	    }		 
+a.xreflink:visited {
+		        text-decoration: none;		 	    
+	    }		 
+
+span.ident {
+    color: teal
+}
+
+
+div.pre_verbatim{
+    white-space: pre ;
+	border-style: solid ;
+	border-width: 1pt;
+	border-color: yellow;
+	border-style: inset;
+        background-color: #ffffcc;
+}
+
+strong { color: green;
+	font-weight: normal; 
+}
+
+
+dt {
+   font-weight: bold;
+   }
+
+tr.Odd {
+       }
+tr.Even {
+	background-color: #DDDDDD;
+	}
+
+/* generic <hi> */
+span.hi {
+   font-weight: bold;
+}
+/* verbatim display */
+span.element {
+ font-weight: bold;
+ color: blue;
+}
+
+span.attribute {
+    color: green;
+}
+span.attributevalue {
+    color: magenta;
+}
+span.comment {
+    color: orange;
+    font-style:italic;
+}
+span.namespace {
+    color: red;
+}
Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/i18n.xml
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/i18n.xml	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/i18n.xml	(revision 258)
@@ -0,0 +1,2072 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- interface translations for TEI XSL stylesheets -->
+<i18n>
+  <codes>
+    <code xml:lang="hr" lang3="hrv">
+      <desc>Croatian</desc>
+      <name>Neven Jovanović</name>
+      <email>neven.jovanovic@ffzg.hr</email>
+    </code>
+    <code xml:lang="ko" lang3="kor">
+      <desc>Korean</desc>
+      <name>Beom-mo Kang</name>
+      <email>bmkang@korea.ac.kr</email>
+    </code>
+    <code xml:lang="la" lang3="lat">
+      <desc>Latin</desc>
+      <name>Neven Jovanović</name>
+      <email>neven.jovanovic@ffzg.hr</email>
+    </code>
+    <code xml:lang="ru" lang3="rus">
+      <desc>Russian</desc>
+      <name>Ivan A Derzhanski</name>
+      <email>iad@math.bas.bg</email>
+    </code>
+    <code xml:lang="tr" lang3="tur">
+      <desc>Turkish</desc>
+      <name>Ivan A Derzhanski</name>
+      <email>iad@math.bas.bg</email>
+    </code>
+    <code xml:lang="el" lang3="ell">
+      <desc>Greek</desc>
+      <name>Ivan A Derzhanski</name>
+      <email>iad@math.bas.bg</email>
+    </code>
+    <code xml:lang="bg" lang3="bul">
+      <desc>Bulgarian</desc>
+      <name>Ivan A Derzhanski</name>
+      <email>iad@math.bas.bg</email>
+    </code>
+    <code xml:lang="nl" lang3="nld">
+      <desc>Dutch</desc>
+      <name>Bert Van Elsacker</name>
+      <email>bertvanelsacker@yahoo.com</email>
+    </code>
+    <code xml:lang="de" lang3="deu">
+      <desc>German</desc>
+      <name>Christian Wittern, Torsten Schassan </name>
+      <email>wittern@kanji.zinbun.kyoto-u.ac.jp,schassan@hab.de</email>
+    </code>
+    <code xml:lang="ja" lang3="jpn">
+      <desc>Japanese</desc>
+      <name>Christian Wittern and Ohya Kazushi</name>
+      <email>wittern@kanji.zinbun.kyoto-u.ac.jp,ohyakazushi@gmail.com</email>
+    </code>
+    <code xml:lang="ro" lang3="ron">
+      <desc>Romanian</desc>
+      <name>Adrian Dimulescu</name>
+      <email>adrian.dimulescu@free.fr</email>
+    </code>
+    <code xml:lang="fr" lang3="fra">
+      <desc>French</desc>
+      <name>Laurent Romary</name>
+      <email>Laurent.Romary@loria.fr</email>
+    </code>
+    <code xml:lang="pt" lang3="por">
+      <desc>Portuguese</desc>
+      <name>Leonor Barroca</name>
+      <email>l.barroca@open.ac.uk</email>
+    </code>
+    <code xml:lang="es" lang3="spa">
+      <desc>Spanish</desc>
+      <name>Carmen Arronis Llopis</name>
+      <email>arronis@ua.es</email>
+    </code>
+    <code xml:lang="it" lang3="ita">
+      <desc>Italian</desc>
+      <name>Fabio Ciotti, Arianna Ciula, Elena Pierazzo</name>
+      <email>fabio.ciott@uniroma1.it</email>
+    </code>
+    <code xml:lang="sl" lang3="slv">
+      <desc>Slovenian</desc>
+      <name>Matija Ogrin</name>
+      <email>matija.ogrin@zrc-sazu.si</email>
+    </code>
+    <code xml:lang="pl" lang3="pol">
+      <desc>Polish</desc>
+      <name>Radosław Moszczyński</name>
+      <email>r.moszczynski@uw.edu.pl</email>
+    </code>
+    <code xml:lang="sv" lang3="swe">
+      <desc>Swedish</desc>
+      <name>Monica Langerth Zetterman and Matthew Zimmerman</name>
+      <email>monica.langerth@ped.uu.se,matthew.zimmerman@nyu.edu</email>
+    </code>
+    <code xml:lang="no" lang3="nor">
+      <desc>Norwegian</desc>
+      <name>Øyvind Eide</name>
+      <email>oyvind.eide@muspro.uio.no</email>
+    </code>
+    <code xml:lang="zh-TW">
+      <desc>Chinese</desc>
+      <name>Marcus Bingenheimer</name>
+      <email>m.bingenheimer@gmail.com</email>
+    </code>
+    <code xml:lang="sr" lang3="srp">
+      <desc>Serbian</desc>
+      <name>Cvetana Krstev</name>
+      <email>cvetana@poincare.matf.bg.ac.yu</email>
+    </code>
+    <code xml:lang="hi" lang3="hin">
+      <desc>Hindi</desc>
+      <name>Paul Richards</name>
+      <email>paul.richards@ugs.com</email>
+    </code>
+    <code xml:lang="th" lang3="tha">
+      <desc>Thai</desc>
+      <name>Mananya Patamasoontorn</name>
+      <email>mananyap@hotmail.com</email>
+    </code>
+    <code xml:lang="ca" lang3="cat">
+      <desc>Catalan</desc>
+      <name>Mikel L. Forcada</name>
+      <email>mlf@dlsi.ua.es</email>
+    </code>
+  </codes>
+  <entry>
+    <key>TEI</key>
+    <text xml:lang="en" lang3="eng">Text Encoding Initiative</text>
+    <text xml:lang="de" lang3="deu">Text Encoding Initiative</text>
+    <text xml:lang="ro" lang3="ron">Iniţiativa de Codificare a Textului</text>
+    <text xml:lang="pt" lang3="por">Iniciativa de Codificação de Texto</text>
+    <text xml:lang="es" lang3="spa">Iniciativa de Codificación de Textos</text>
+    <text xml:lang="it" lang3="ita">Text Encoding Initiative</text>
+    <text xml:lang="sv" lang3="swe">Text Encoding Initiative</text>
+    <text xml:lang="no" lang3="nor">Text Encoding Initiative</text>
+    <text xml:lang="sr" lang3="srp">Podsticaj obeležavanju teksta</text>
+    <text xml:lang="pl" lang3="pol">Inicjatywa Kodowania Tekstów</text>
+    <text xml:lang="hi" lang3="hin">viShaya anuvAda prathama kAryavAhI</text>
+    <text xml:lang="th" lang3="tha">รหัสวิชา</text>
+    <text xml:lang="nl" lang3="nld">Tekstcoderingsinitiatief</text>
+    <text xml:lang="ru" lang3="rus">Инициатива по кодированию текстов</text>
+    <text xml:lang="tr" lang3="tur">Metin Kodlaması Girişimi</text>
+    <text xml:lang="bg" lang3="bul">Инициатива за кодиране на текстове</text>
+    <text xml:lang="el" lang3="ell">Πρωτοβουλία για την Κωδικοποίησης Κειμενών</text>
+    <text xml:lang="ca" lang3="cat">Iniciativa de Codificació de Textos</text>
+    <text xml:lang="la" lang3="lat">Stimulus textibus annotandis</text>
+    <text xml:lang="hr" lang3="hrv">Inicijativa za obilježavanje tekstova</text>
+    <text xml:lang="ko" lang3="kor">텍스트 부호화 주도</text>
+  </entry>
+  <entry>
+    <key>Attributes</key>
+    <text xml:lang="en" lang3="eng">Attributes</text>
+    <text xml:lang="de" lang3="deu">Attribute</text>
+    <text xml:lang="ro" lang3="ron">Atribute</text>
+    <text xml:lang="fr" lang3="fra">Attributs</text>
+    <text xml:lang="pt" lang3="por">Atributos</text>
+    <text xml:lang="es" lang3="spa">Atributos</text>
+    <text xml:lang="it" lang3="ita">Attributi</text>
+    <text xml:lang="sl" lang3="slv">Atributi</text>
+    <text xml:lang="sv" lang3="swe">Attribut</text>
+    <text xml:lang="no" lang3="nor">Attributt</text>
+    <text xml:lang="zh-TW">屬性</text>
+    <text xml:lang="sr" lang3="srp">Atributi</text>
+    <text xml:lang="ja" lang3="jpn">属性</text>
+    <text xml:lang="pl" lang3="pol">Atrybuty</text>
+    <text xml:lang="hi" lang3="hin">guNa</text>
+    <text xml:lang="th" lang3="tha">คุณสมบัติ</text>
+    <text xml:lang="nl" lang3="nld">Attributen</text>
+    <text xml:lang="ru" lang3="rus">Атрибуты</text>
+    <text xml:lang="tr" lang3="tur">Öznitelikler</text>
+    <text xml:lang="bg" lang3="bul">Атрибути</text>
+    <text xml:lang="el" lang3="ell">Χαρακτηριστικά</text>
+    <text xml:lang="ca" lang3="cat">Atributs</text>
+    <text xml:lang="la" lang3="lat">Attributa</text>
+    <text xml:lang="hr" lang3="hrv">Atributi</text>
+    <text xml:lang="ko" lang3="kor">속성</text>
+  </entry>
+  <entry>
+    <key>Class</key>
+    <text xml:lang="en" lang3="eng">Class</text>
+    <text xml:lang="de" lang3="deu">Klasse</text>
+    <text xml:lang="ro" lang3="ron">Clasă</text>
+    <text xml:lang="fr" lang3="fra">Classe</text>
+    <text xml:lang="pt" lang3="por">Classe</text>
+    <text xml:lang="es" lang3="spa">Clase</text>
+    <text xml:lang="it" lang3="ita">Classe</text>
+    <text xml:lang="sl" lang3="slv">Razred</text>
+    <text xml:lang="sv" lang3="swe">Klass</text>
+    <text xml:lang="no" lang3="nor">Klasse</text>
+    <text xml:lang="zh-TW">分類</text>
+    <text xml:lang="sr" lang3="srp">Klasa</text>
+    <text xml:lang="ja" lang3="jpn">クラス</text>
+    <text xml:lang="pl" lang3="pol">Klasa</text>
+    <text xml:lang="hi" lang3="hin">shreNI</text>
+    <text xml:lang="th" lang3="tha">ชั้นเรียน</text>
+    <text xml:lang="nl" lang3="nld">Klasse</text>
+    <text xml:lang="ru" lang3="rus">Класс</text>
+    <text xml:lang="tr" lang3="tur">Sınıf</text>
+    <text xml:lang="bg" lang3="bul">Клас</text>
+    <text xml:lang="el" lang3="ell">Κλάση</text>
+    <text xml:lang="ca" lang3="cat">Classe</text>
+    <text xml:lang="la" lang3="lat">Classis</text>
+    <text xml:lang="hr" lang3="hrv">Razred</text>
+    <text xml:lang="ko" lang3="kor">부류</text>
+  </entry>
+  <entry>
+    <key>Classes defined</key>
+    <text xml:lang="en" lang3="eng">Classes defined</text>
+    <text xml:lang="de" lang3="deu">Definierte Klassen</text>
+    <text xml:lang="ro" lang3="ron">Clase definite</text>
+    <text xml:lang="fr" lang3="fra">Classes définies</text>
+    <text xml:lang="pt" lang3="por">Classes definidas</text>
+    <text xml:lang="es" lang3="spa">Clases definidas</text>
+    <text xml:lang="it" lang3="ita">Classi definite</text>
+    <text xml:lang="sl" lang3="slv">Definirani razredi</text>
+    <text xml:lang="sv" lang3="swe">Definierade klasser</text>
+    <text xml:lang="no" lang3="nor">Definerte klasser klasser</text>
+    <text xml:lang="zh-TW">被定義的分類</text>
+    <text xml:lang="sr" lang3="srp">Definisane klase</text>
+    <text xml:lang="ja" lang3="jpn">定義済みクラス</text>
+    <text xml:lang="pl" lang3="pol">Zdefiniowane klasy</text>
+    <text xml:lang="hi" lang3="hin">Paribashith shreNI</text>
+    <text xml:lang="th" lang3="tha">หมายเลขชั้นเรียน</text>
+    <text xml:lang="nl" lang3="nld">Gedefinieerde klassen</text>
+    <text xml:lang="ru" lang3="rus">Описанные классы</text>
+    <text xml:lang="tr" lang3="tur">Tanımlı sınıflar</text>
+    <text xml:lang="bg" lang3="bul">Описани класове</text>
+    <text xml:lang="el" lang3="ell">Οριζόμενες κλάσες</text>
+    <text xml:lang="ca" lang3="cat">Classes definides</text>
+    <text xml:lang="la" lang3="lat">Classes definitae</text>
+    <text xml:lang="hr" lang3="hrv">Definirani razredi</text>
+    <text xml:lang="ko" lang3="kor">정의 부류</text>
+  </entry>
+  <entry>
+    <key>Datatype</key>
+    <text xml:lang="en" lang3="eng">Datatype</text>
+    <text xml:lang="de" lang3="deu">Datentyp</text>
+    <text xml:lang="ro" lang3="ron">Tipuri de date</text>
+    <text xml:lang="fr" lang3="fra">Type de données</text>
+    <text xml:lang="pt" lang3="por">Tipo de Dados</text>
+    <text xml:lang="es" lang3="spa">Tipo de datos</text>
+    <text xml:lang="it" lang3="ita">Tipo di dati</text>
+    <text xml:lang="sl" lang3="slv">Podatkovni tip</text>
+    <text xml:lang="sv" lang3="swe">Datatyp</text>
+    <text xml:lang="no" lang3="nor">Datatype</text>
+    <text xml:lang="zh-TW">資料類型</text>
+    <text xml:lang="sr" lang3="srp">Podatkovni tip</text>
+    <text xml:lang="ja" lang3="jpn">データ型</text>
+    <text xml:lang="pl" lang3="pol">Typ danych</text>
+    <text xml:lang="hi" lang3="hin">NirDishta varga</text>
+    <text xml:lang="th" lang3="tha">ชนิดของข้อมูล</text>
+    <text xml:lang="nl" lang3="nld">Datatype</text>
+    <text xml:lang="ru" lang3="rus">Тип данных</text>
+    <text xml:lang="tr" lang3="tur">Veri Türü</text>
+    <text xml:lang="bg" lang3="bul">Тип данни</text>
+    <text xml:lang="el" lang3="ell">Τύπος δεδομένων</text>
+    <text xml:lang="ca" lang3="cat">Tipus de dades</text>
+    <text xml:lang="la" lang3="lat">Datorum qualitas</text>
+    <text xml:lang="hr" lang3="hrv">Vrsta podataka</text>
+    <text xml:lang="ko" lang3="kor">자료 유형</text>
+  </entry>
+  <entry>
+    <key>Declaration</key>
+    <text xml:lang="en" lang3="eng">Declaration</text>
+    <text xml:lang="de" lang3="deu">Deklaration</text>
+    <text xml:lang="ro" lang3="ron">Declaraţie</text>
+    <text xml:lang="fr" lang3="fra">Declaration</text>
+    <text xml:lang="pt" lang3="por">Declaração</text>
+    <text xml:lang="es" lang3="spa">Declaración</text>
+    <text xml:lang="it" lang3="ita">Dichiarazione</text>
+    <text xml:lang="sl" lang3="slv">Deklaracija</text>
+    <text xml:lang="sv" lang3="swe">Deklaration</text>
+    <text xml:lang="no" lang3="nor">Deklarasjon</text>
+    <text xml:lang="zh-TW">宣告</text>
+    <text xml:lang="sr" lang3="srp">Deklaracija</text>
+    <text xml:lang="ja" lang3="jpn">宣言</text>
+    <text xml:lang="pl" lang3="pol">Deklaracja</text>
+    <text xml:lang="hi" lang3="hin">ghoShaNA</text>
+    <text xml:lang="th" lang3="tha">คำประกาศ</text>
+    <text xml:lang="nl" lang3="nld">Declaratie</text>
+    <text xml:lang="ru" lang3="rus">Описание</text>
+    <text xml:lang="tr" lang3="tur">Bildirim</text>
+    <text xml:lang="bg" lang3="bul">Декларация</text>
+    <text xml:lang="el" lang3="ell">Δήλωση</text>
+    <text xml:lang="ca" lang3="cat">Declaració</text>
+    <text xml:lang="la" lang3="lat">Declaratio</text>
+    <text xml:lang="hr" lang3="hrv">Deklaracija</text>
+    <text xml:lang="ko" lang3="kor">선언</text>
+  </entry>
+  <entry>
+    <key>Default</key>
+    <text xml:lang="en" lang3="eng">Default</text>
+    <text xml:lang="de" lang3="deu">Vorgabe</text>
+    <text xml:lang="ro" lang3="ron">Implicit</text>
+    <text xml:lang="fr" lang3="fra">Valeur par défaut</text>
+    <text xml:lang="pt" lang3="por">Valor por defeito</text>
+    <text xml:lang="es" lang3="spa">Por defecto</text>
+    <text xml:lang="it" lang3="ita">Valore di default</text>
+    <text xml:lang="sl" lang3="slv">Privzeta vrednost</text>
+    <text xml:lang="sv" lang3="swe">Standard</text>
+    <text xml:lang="no" lang3="nor">Standard</text>
+    <text xml:lang="zh-TW">預設值</text>
+    <text xml:lang="sr" lang3="srp">Pretpostavljena vrednost</text>
+    <text xml:lang="ja" lang3="jpn">初期値</text>
+    <text xml:lang="pl" lang3="pol">Wartość domyślna</text>
+    <text xml:lang="hi" lang3="hin">aparAdha</text>
+    <text xml:lang="th" lang3="tha">ค่าตั้งเริ่มต้น</text>
+    <text xml:lang="nl" lang3="nld">Defaultwaarde</text>
+    <text xml:lang="ru" lang3="rus">Величина по умолчанию</text>
+    <text xml:lang="tr" lang3="tur">Varsayılan</text>
+    <text xml:lang="bg" lang3="bul">Стойност по подразбиране</text>
+    <text xml:lang="el" lang3="ell">Προεπιλεγμένη τιμή</text>
+    <text xml:lang="ca" lang3="cat">Implícit</text>
+    <text xml:lang="la" lang3="lat">Valores implicitae</text>
+    <text xml:lang="hr" lang3="hrv">Polazne vrijednosti</text>
+    <text xml:lang="ko" lang3="kor">기본값</text>
+  </entry>
+  <entry>
+    <key>Element</key>
+    <text xml:lang="en" lang3="eng">Element</text>
+    <text xml:lang="de" lang3="deu">Element</text>
+    <text xml:lang="ro" lang3="ron">Element</text>
+    <text xml:lang="fr" lang3="fra">Elément</text>
+    <text xml:lang="pt" lang3="por">Elemento</text>
+    <text xml:lang="es" lang3="spa">Elemento</text>
+    <text xml:lang="it" lang3="ita">Elemento</text>
+    <text xml:lang="sl" lang3="slv">Element</text>
+    <text xml:lang="sv" lang3="swe">Element</text>
+    <text xml:lang="no" lang3="nor">Element</text>
+    <text xml:lang="zh-TW">元素</text>
+    <text xml:lang="sr" lang3="srp">Element</text>
+    <text xml:lang="ja" lang3="jpn">要素</text>
+    <text xml:lang="pl" lang3="pol">Element</text>
+    <text xml:lang="hi" lang3="hin">mUla</text>
+    <text xml:lang="nl" lang3="nld">Element</text>
+    <text xml:lang="ru" lang3="rus">Элемент</text>
+    <text xml:lang="tr" lang3="tur">Öğe</text>
+    <text xml:lang="bg" lang3="bul">Елемент</text>
+    <text xml:lang="el" lang3="ell">Στοιχείο</text>
+    <text xml:lang="ca" lang3="cat">Element</text>
+    <text xml:lang="la" lang3="lat">Elementum</text>
+    <text xml:lang="hr" lang3="hrv">Element</text>
+    <text xml:lang="ko" lang3="kor">요소</text>
+  </entry>
+  <entry>
+    <key>Elements defined</key>
+    <text xml:lang="en" lang3="eng">Elements defined</text>
+    <text xml:lang="de" lang3="deu">Definierte Elemente</text>
+    <text xml:lang="ro" lang3="ron">Elemente definite</text>
+    <text xml:lang="fr" lang3="fra">Eléments définis</text>
+    <text xml:lang="pt" lang3="por">Elementos definidos</text>
+    <text xml:lang="es" lang3="spa">Elementos definidos</text>
+    <text xml:lang="it" lang3="ita">Elementi definiti</text>
+    <text xml:lang="sl" lang3="slv">Definirani elementi</text>
+    <text xml:lang="sv" lang3="swe">Definierade element</text>
+    <text xml:lang="no" lang3="nor">Definerte elementer</text>
+    <text xml:lang="zh-TW">被定義的元素</text>
+    <text xml:lang="sr" lang3="srp">Definisani elementi</text>
+    <text xml:lang="ja" lang3="jpn">定義済み要素</text>
+    <text xml:lang="pl" lang3="pol">Zdefiniowane elementy</text>
+    <text xml:lang="hi" lang3="hin">Paribhasith Mula</text>
+    <text xml:lang="th" lang3="tha">ระบุเนื้อหา</text>
+    <text xml:lang="nl" lang3="nld">Gedefinieerde elementen</text>
+    <text xml:lang="ru" lang3="rus">Описанные элементы</text>
+    <text xml:lang="tr" lang3="tur">Tanımlı öğeler</text>
+    <text xml:lang="bg" lang3="bul">Описани елементи</text>
+    <text xml:lang="el" lang3="ell">Οριζόμενα στοιχεία</text>
+    <text xml:lang="ca" lang3="cat">Elements definits</text>
+    <text xml:lang="la" lang3="lat">Elementa definita</text>
+    <text xml:lang="hr" lang3="hrv">Definirani elementi</text>
+    <text xml:lang="ko" lang3="kor">정의 요소</text>
+  </entry>
+  <entry>
+    <key>Example</key>
+    <text xml:lang="en" lang3="eng">Example</text>
+    <text xml:lang="de" lang3="deu">Beispiel</text>
+    <text xml:lang="ro" lang3="ron">Exemplu</text>
+    <text xml:lang="fr" lang3="fra">Exemple</text>
+    <text xml:lang="pt" lang3="por">Exemplo</text>
+    <text xml:lang="es" lang3="spa">Ejemplo</text>
+    <text xml:lang="it" lang3="ita">Esempio</text>
+    <text xml:lang="sl" lang3="slv">Primer</text>
+    <text xml:lang="sv" lang3="swe">Exempel</text>
+    <text xml:lang="no" lang3="nor">Eksempel</text>
+    <text xml:lang="zh-TW">例子</text>
+    <text xml:lang="sr" lang3="srp">Primer</text>
+    <text xml:lang="ja" lang3="jpn">例</text>
+    <text xml:lang="pl" lang3="pol">Przykład</text>
+    <text xml:lang="hi" lang3="hin">udAharaNa</text>
+    <text xml:lang="th" lang3="tha">ตัวอย่าง</text>
+    <text xml:lang="nl" lang3="nld">Voorbeeld</text>
+    <text xml:lang="ru" lang3="rus">Пример</text>
+    <text xml:lang="tr" lang3="tur">Örnek</text>
+    <text xml:lang="bg" lang3="bul">Пример</text>
+    <text xml:lang="el" lang3="ell">Παράδειγμα</text>
+    <text xml:lang="ca" lang3="cat">Exemple</text>
+    <text xml:lang="la" lang3="lat">Exemplum</text>
+    <text xml:lang="hr" lang3="hrv">Primjer</text>
+    <text xml:lang="ko" lang3="kor">예</text>
+  </entry>
+  <entry>
+    <key>Global attributes and those inherited from</key>
+    <text xml:lang="es" lang3="spa">Atributos globales y los heredados de</text>
+    <text xml:lang="ca" lang3="cat">Atributs globals i els heretats de</text>
+    <text xml:lang="en" lang3="eng">Global attributes and those inherited from</text>
+    <text xml:lang="de" lang3="deu">Global gültige Attribute und solche ererbt von ...</text>
+    <text xml:lang="ro" lang3="ron">Atributele globale şi cele moştenite din</text>
+    <text xml:lang="fr" lang3="fra">Attributs globaux et hérités</text>
+    <text xml:lang="pt" lang3="por">Atributos globais e herdados de...</text>
+    <text xml:lang="it" lang3="ita">Attributi globali e quelli ereditati da</text>
+    <text xml:lang="sl" lang3="slv">Globalni atributi in tisti, sprejeti iz</text>
+    <text xml:lang="sv" lang3="swe">Globala attribut samt de som ärvts från</text>
+    <text xml:lang="no" lang3="nor">Globale attributter og de som arves fra</text>
+    <text xml:lang="zh-TW">全域屬性和從...繼承的屬性</text>
+    <text xml:lang="sr" lang3="srp">Globalni atributi i atributi koji se nasledjuju</text>
+    <text xml:lang="ja" lang3="jpn">グローバル属性または継承した属性</text>
+    <text xml:lang="pl" lang3="pol">Atrybuty globalne i odziedziczone po...</text>
+    <text xml:lang="hi" lang3="hin">Vishva Guna Aur Jinmese Adhikara Paya</text>
+    <text xml:lang="th" lang3="tha">คุณสมบัติโดยรวมและที่เทียบโอนมา</text>
+    <text xml:lang="nl" lang3="nld">Globale attributen en attributen geërfd van</text>
+    <text xml:lang="ru" lang3="rus">Глобальные атрибуты и атрибуты, унаследованные от</text>
+    <text xml:lang="tr" lang3="tur">Genel ve ~'dan kalıtsal öznitelikler</text>
+    <text xml:lang="bg" lang3="bul">Глобални атрибути и атрибути, наследени от</text>
+    <text xml:lang="el" lang3="ell">Χαρακτηριστικά καθολικά και κληρονομικά από</text>
+    <text xml:lang="ca" lang3="cat">Atributs globals i aquells heretats de</text>
+    <text xml:lang="la" lang3="lat">Attributa universalia et haereditaria</text>
+    <text xml:lang="hr" lang3="hrv">Globalni i naslijeđeni atributi</text>
+    <text xml:lang="ko" lang3="kor">전반적 속성 및 상속 속성</text>
+  </entry>
+  <entry>
+    <key>Global attributes only</key>
+    <text xml:lang="ca" lang3="cat">A més dels atributs globals i dels heretats de</text>
+    <text xml:lang="en" lang3="eng">Global attributes only</text>
+    <text xml:lang="de" lang3="deu">Nur global gültige Attribute</text>
+    <text xml:lang="ro" lang3="ron">Numai atributele globale</text>
+    <text xml:lang="fr" lang3="fra">Attributs globaux seulement</text>
+    <text xml:lang="pt" lang3="por">Só atributos globais</text>
+    <text xml:lang="es" lang3="spa">Solo atributos globales</text>
+    <text xml:lang="it" lang3="ita">Solo attributi globali</text>
+    <text xml:lang="sl" lang3="slv">Samo globalni atributi</text>
+    <text xml:lang="sv" lang3="swe">Endast globala attribut</text>
+    <text xml:lang="no" lang3="nor">Kun globale attributter</text>
+    <text xml:lang="zh-TW">僅全域屬性</text>
+    <text xml:lang="sr" lang3="srp">Isključivo globalni atributi</text>
+    <text xml:lang="ja" lang3="jpn">グローバル属性のみ</text>
+    <text xml:lang="pl" lang3="pol">Wyłącznie atrybuty globalne</text>
+    <text xml:lang="hi" lang3="hin">Keval Vishva Guna</text>
+    <text xml:lang="th" lang3="tha">คุณสมบัติโดยรวมเท่านั้น</text>
+    <text xml:lang="nl" lang3="nld">Enkel globale attributen</text>
+    <text xml:lang="ru" lang3="rus">Только глобальные атрибуты</text>
+    <text xml:lang="tr" lang3="tur">Sadece genel öznitelikler</text>
+    <text xml:lang="bg" lang3="bul">Само глобални атрибути</text>
+    <text xml:lang="el" lang3="ell">Μόνο καθολικά χαρακτηριστικά</text>
+    <text xml:lang="ca" lang3="cat">Només atributs globals</text>
+    <text xml:lang="la" lang3="lat">Attributa universalia tantum</text>
+    <text xml:lang="hr" lang3="hrv">Samo globalni atributi</text>
+    <text xml:lang="ko" lang3="kor">전체 속성만 허용</text>
+  </entry>
+  <entry>
+    <key>In addition to global attributes</key>
+    <text xml:lang="ca" lang3="cat">Els valors suggerits inclouen</text>
+    <text xml:lang="en" lang3="eng">In addition to global attributes</text>
+    <text xml:lang="de" lang3="deu">Neben global gültigen Attributen</text>
+    <text xml:lang="ro" lang3="ron">În plus faţă de atributele globale</text>
+    <text xml:lang="fr" lang3="fra">En complément des attributs globaux</text>
+    <text xml:lang="pt" lang3="por">Para além de atributos globais</text>
+    <text xml:lang="es" lang3="spa">Además de los atributos globales</text>
+    <text xml:lang="it" lang3="ita">Oltre agli attributi globali</text>
+    <text xml:lang="sl" lang3="slv">Poleg globalnih atributov</text>
+    <text xml:lang="sv" lang3="swe">Förutom globala attribut</text>
+    <text xml:lang="no" lang3="nor">I tillegg til globale attributter</text>
+    <text xml:lang="zh-TW">除全域屬性以外</text>
+    <text xml:lang="sr" lang3="srp">Pored globalnih atributa</text>
+    <text xml:lang="ja" lang3="jpn">グローバル属性の他</text>
+    <text xml:lang="pl" lang3="pol">Oprócz atrybutów globalnych</text>
+    <text xml:lang="hi" lang3="hin">Vishva Guna Ke Alava</text>
+    <text xml:lang="th" lang3="tha">คุณสมบัติโดยรวมเพิ่มเติม</text>
+    <text xml:lang="nl" lang3="nld">Naast de globale attributen</text>
+    <text xml:lang="ru" lang3="rus">Вдобавок к глобальным атрибутам</text>
+    <text xml:lang="tr" lang3="tur">Genel özniteliklerden başka</text>
+    <text xml:lang="bg" lang3="bul">Освен глобалните атрибути</text>
+    <text xml:lang="el" lang3="ell">Πλήν των καθολικών χαρακτηριστικών</text>
+    <text xml:lang="ca" lang3="cat">A més dels atributs globals</text>
+    <text xml:lang="la" lang3="lat">Praeter attributa universalia</text>
+    <text xml:lang="hr" lang3="hrv">Uz globalne atribute</text>
+    <text xml:lang="ko" lang3="kor">전체 속성에 부가</text>
+  </entry>
+  <entry>
+    <key>In addition to global attributes and those inherited from</key>
+    <text xml:lang="en" lang3="eng">In addition to global attributes and those inherited from</text>
+    <text xml:lang="de" lang3="deu">Neben global gültigen Attributen und solchen ererbt von ...</text>
+    <text xml:lang="ro" lang3="ron">În plus faţă de atributele globale şi de cele moştenite din</text>
+    <text xml:lang="fr" lang3="fra">En complément des attributs globaux et hérités</text>
+    <text xml:lang="pt" lang3="por">Para além de atributos globais e herdados de...</text>
+    <text xml:lang="it" lang3="ita">Oltre agli attributi globali e a quelli ereditati da</text>
+    <text xml:lang="sl" lang3="slv">Poleg globalnih atributov in tistih, sprejetih iz</text>
+    <text xml:lang="sv" lang3="swe">Förutom globala attribut samt de som ärvts från</text>
+    <text xml:lang="no" lang3="nor">I tillegg til globale attributter og de som arves fra</text>
+    <text xml:lang="zh-TW">除全域屬性和從...繼承的屬性以外</text>
+    <text xml:lang="sr" lang3="srp">Pored globalnih atributa i onih koji se nasledjuju</text>
+    <text xml:lang="ja" lang3="jpn">グローバル属性または継承した属性の他</text>
+    <text xml:lang="pl" lang3="pol">Oprócz atrybutów globalnych i odziedziczonych po...</text>
+    <text xml:lang="hi" lang3="hin">Vishva Guna Ke Alava Aur Jinmese Adhikara Paya</text>
+    <text xml:lang="th" lang3="tha">คุณสมบัติโดยรวมและที่เทียบโอนมาเพิ่มเติม</text>
+    <text xml:lang="nl" lang3="nld">Naast de globale attributen en de attributen geërfd van</text>
+    <text xml:lang="ru" lang3="rus">Вдобавок к глобальным атрибутам и атрибутам, унаследованным от</text>
+    <text xml:lang="tr" lang3="tur">Genel ve ~'dan kalıtsal özniteliklerden başka</text>
+    <text xml:lang="bg" lang3="bul">Освен глобалните атрибути и атрибутите, наследени от</text>
+    <text xml:lang="el" lang3="ell">Πλήν τωνχαρακτηριστικών καθολικών και κληρονομικών από</text>
+    <text xml:lang="ca" lang3="cat">A més dels atributs globals i els heretats de</text>
+    <text xml:lang="es" lang3="spa">Además de los atributos globales y los heredados de</text>
+    <text xml:lang="ko" lang3="kor">&gt;전체 속성 및 상속 속성에 부가</text>
+  </entry>
+  <entry>
+    <key>Legal values are</key>
+    <text xml:lang="en" lang3="eng">Legal values are</text>
+    <text xml:lang="de" lang3="deu">Gültige Werte</text>
+    <text xml:lang="ro" lang3="ron">Valorile admise sunt</text>
+    <text xml:lang="fr" lang3="fra">Les valeurs autorisées sont</text>
+    <text xml:lang="pt" lang3="por">Valores permitidos são</text>
+    <text xml:lang="es" lang3="spa">Los valores admitidos son</text>
+    <text xml:lang="it" lang3="ita">I valori legali sono</text>
+    <text xml:lang="sl" lang3="slv">Veljavne vrednosti so</text>
+    <text xml:lang="sv" lang3="swe">Tillåtna värden är</text>
+    <text xml:lang="no" lang3="nor">Lovlige verdier er</text>
+    <text xml:lang="zh-TW">合法的值是</text>
+    <text xml:lang="sr" lang3="srp">Dozvoljene vrednosti su</text>
+    <text xml:lang="ja" lang3="jpn">正当な値</text>
+    <text xml:lang="pl" lang3="pol">Dozwolone wartości to</text>
+    <text xml:lang="hi" lang3="hin">niyamAnukUla guNa Hai</text>
+    <text xml:lang="th" lang3="tha">คุณค่าทางกฎหมายคือ</text>
+    <text xml:lang="nl" lang3="nld">Geldige waarden zijn</text>
+    <text xml:lang="ru" lang3="rus">Разрешенные величины:</text>
+    <text xml:lang="tr" lang3="tur">Geçerli değerler:</text>
+    <text xml:lang="bg" lang3="bul">Разрешените стойности са</text>
+    <text xml:lang="el" lang3="ell">Οι νόμιμες τιμές είναι</text>
+    <text xml:lang="ca" lang3="cat">Els valors permesos són</text>
+    <text xml:lang="la" lang3="lat">Valores permissae</text>
+    <text xml:lang="hr" lang3="hrv">Dozvoljene su vrijednosti</text>
+    <text xml:lang="ko" lang3="kor">적법한 값은</text>
+  </entry>
+  <entry>
+    <key>Macros defined</key>
+    <text xml:lang="en" lang3="eng">Macros defined</text>
+    <text xml:lang="de" lang3="deu">Definierte Makros</text>
+    <text xml:lang="ro" lang3="ron">Macrouri definite</text>
+    <text xml:lang="fr" lang3="fra">Macros définies</text>
+    <text xml:lang="pt" lang3="por">Macros definidas</text>
+    <text xml:lang="es" lang3="spa">Macros definidas</text>
+    <text xml:lang="it" lang3="ita">Macro definite</text>
+    <text xml:lang="sl" lang3="slv">Definirani makri</text>
+    <text xml:lang="sv" lang3="swe">Definierade makron</text>
+    <text xml:lang="no" lang3="nor">Definerete makroer</text>
+    <text xml:lang="zh-TW">被定義的巨指令</text>
+    <text xml:lang="sr" lang3="srp">Definisani makroi</text>
+    <text xml:lang="ja" lang3="jpn">定義済みマクロ</text>
+    <text xml:lang="pl" lang3="pol">Zdefiniowane makra</text>
+    <text xml:lang="th" lang3="tha">โคร</text>
+    <text xml:lang="nl" lang3="nld">Gedefinieerde macro's</text>
+    <text xml:lang="ru" lang3="rus">Определенные макросы</text>
+    <text xml:lang="tr" lang3="tur">Tanımlı makrolar</text>
+    <text xml:lang="bg" lang3="bul">Дефинирани макроси</text>
+    <text xml:lang="el" lang3="ell">Οριζόμενες μακροεντολές</text>
+    <text xml:lang="ca" lang3="cat">Macros definides</text>
+    <text xml:lang="la" lang3="lat">Macromandata definita</text>
+    <text xml:lang="hr" lang3="hrv">Definirane makronaredbe</text>
+    <text xml:lang="ko" lang3="kor">정의 크로</text>
+  </entry>
+  <entry>
+    <key>Mandatory when applicable</key>
+    <text xml:lang="en" lang3="eng">Mandatory when applicable</text>
+    <text xml:lang="de" lang3="deu">Obligatorisch wenn zutreffend</text>
+    <text xml:lang="ro" lang3="ron">Obligatoriu dacă se potriveşte</text>
+    <text xml:lang="fr" lang3="fra">Obligatoire quand applicable</text>
+    <text xml:lang="pt" lang3="por">Obrigatório quando aplicável</text>
+    <text xml:lang="es" lang3="spa">Obligatorios cuando se aplican</text>
+    <text xml:lang="it" lang3="ita">Obbligatorio se applicabile</text>
+    <text xml:lang="sl" lang3="slv">Obvezen, če ustreza</text>
+    <text xml:lang="sv" lang3="swe">Obligatorisk om användbar</text>
+    <text xml:lang="no" lang3="nor">Obligatorisk når aktuelt</text>
+    <text xml:lang="zh-TW">可應用時必備的</text>
+    <text xml:lang="sr" lang3="srp">Obavezan, ako se može primeniti</text>
+    <text xml:lang="ja" lang3="jpn">使えるならば必須</text>
+    <text xml:lang="pl" lang3="pol">Obowiązkowe w stosownych przypadkach</text>
+    <text xml:lang="hi" lang3="hin">anivArya JaHa uchita</text>
+    <text xml:lang="th" lang3="tha">ต้องได้รับการอนุมัติเมื่อสมัครเรียน</text>
+    <text xml:lang="nl" lang3="nld">Verplicht indien van toepassing</text>
+    <text xml:lang="ru" lang3="rus">Обязательный, если применим</text>
+    <text xml:lang="tr" lang3="tur">Uygulanabilirse zorunlu</text>
+    <text xml:lang="bg" lang3="bul">Задължителен, ако е приложим</text>
+    <text xml:lang="el" lang3="ell">Υποχρεωτικός αν είναι εφαρμόσιμος</text>
+    <text xml:lang="ca" lang3="cat">Obligatoris quan siga possible</text>
+    <text xml:lang="la" lang3="lat">Obligatoria in loco proprio</text>
+    <text xml:lang="hr" lang3="hrv">Obavezno na odgovarajućem mjestu</text>
+    <text xml:lang="ko" lang3="kor">의무적 적용</text>
+  </entry>
+  <entry>
+    <key>Members</key>
+    <text xml:lang="en" lang3="eng">Members</text>
+    <text xml:lang="de" lang3="deu">Mitglieder</text>
+    <text xml:lang="ro" lang3="ron">Membri</text>
+    <text xml:lang="fr" lang3="fra">Membres</text>
+    <text xml:lang="pt" lang3="por">Membros</text>
+    <text xml:lang="es" lang3="spa">Miembros</text>
+    <text xml:lang="it" lang3="ita">Membri</text>
+    <text xml:lang="sl" lang3="slv">Člani</text>
+    <text xml:lang="sv" lang3="swe">Medlemmar</text>
+    <text xml:lang="no" lang3="nor">Medlemmer</text>
+    <text xml:lang="zh-TW"> 成員</text>
+    <text xml:lang="sr" lang3="srp">Članovi</text>
+    <text xml:lang="ja" lang3="jpn">構成</text>
+    <text xml:lang="pl" lang3="pol">Członkowie</text>
+    <text xml:lang="hi" lang3="hin">sadasya</text>
+    <text xml:lang="th" lang3="tha">สมาชิก</text>
+    <text xml:lang="nl" lang3="nld">Leden</text>
+    <text xml:lang="ru" lang3="rus">Члены</text>
+    <text xml:lang="tr" lang3="tur">Üyeler</text>
+    <text xml:lang="bg" lang3="bul">Членове</text>
+    <text xml:lang="el" lang3="ell">Μέλη</text>
+    <text xml:lang="ca" lang3="cat">Membres</text>
+    <text xml:lang="la" lang3="lat">Membra</text>
+    <text xml:lang="hr" lang3="hrv">Članovi</text>
+    <text xml:lang="ko" lang3="kor">원소</text>
+  </entry>
+  <entry>
+    <key>Module</key>
+    <text xml:lang="en" lang3="eng">Module</text>
+    <text xml:lang="de" lang3="deu">Modul</text>
+    <text xml:lang="ro" lang3="ron">Modul</text>
+    <text xml:lang="fr" lang3="fra">Module</text>
+    <text xml:lang="pt" lang3="por">Módulo</text>
+    <text xml:lang="es" lang3="spa">Módulo</text>
+    <text xml:lang="it" lang3="ita">Modulo</text>
+    <text xml:lang="sl" lang3="slv">Modul</text>
+    <text xml:lang="sv" lang3="swe">Modul</text>
+    <text xml:lang="no" lang3="nor">Modul</text>
+    <text xml:lang="zh-TW">組件</text>
+    <text xml:lang="sr" lang3="srp">Modul</text>
+    <text xml:lang="ja" lang3="jpn">モジュール</text>
+    <text xml:lang="pl" lang3="pol">Moduł</text>
+    <text xml:lang="th" lang3="tha">หลักสูตรการศึกษา</text>
+    <text xml:lang="nl" lang3="nld">Module</text>
+    <text xml:lang="ru" lang3="rus">Модуль</text>
+    <text xml:lang="tr" lang3="tur">Modül</text>
+    <text xml:lang="bg" lang3="bul">Модул</text>
+    <text xml:lang="el" lang3="ell">Στοιχείο</text>
+    <text xml:lang="ca" lang3="cat">Mòdul</text>
+    <text xml:lang="la" lang3="lat">Modulus</text>
+    <text xml:lang="hr" lang3="hrv">Modul</text>
+    <text xml:lang="ko" lang3="kor">모듈</text>
+  </entry>
+  <entry>
+    <key>Note</key>
+    <text xml:lang="en" lang3="eng">Note</text>
+    <text xml:lang="de" lang3="deu">Anmerkung</text>
+    <text xml:lang="ro" lang3="ron">Notă</text>
+    <text xml:lang="fr" lang3="fra">Note</text>
+    <text xml:lang="pt" lang3="por">Nota</text>
+    <text xml:lang="es" lang3="spa">Nota</text>
+    <text xml:lang="it" lang3="ita">Nota</text>
+    <text xml:lang="sl" lang3="slv">Opomba</text>
+    <text xml:lang="sv" lang3="swe">Notering</text>
+    <text xml:lang="no" lang3="nor">Note</text>
+    <text xml:lang="zh-TW">註</text>
+    <text xml:lang="sr" lang3="srp">Napomena</text>
+    <text xml:lang="ja" lang3="jpn">解説</text>
+    <text xml:lang="pl" lang3="pol">Uwagi</text>
+    <text xml:lang="hi" lang3="hin">lekha</text>
+    <text xml:lang="th" lang3="tha">หมายเหตุ</text>
+    <text xml:lang="nl" lang3="nld">Opmerking</text>
+    <text xml:lang="ru" lang3="rus">Примечание</text>
+    <text xml:lang="tr" lang3="tur">Not</text>
+    <text xml:lang="bg" lang3="bul">Забележка</text>
+    <text xml:lang="el" lang3="ell">Σχόλιο</text>
+    <text xml:lang="ca" lang3="cat">Nota</text>
+    <text xml:lang="la" lang3="lat">Notula</text>
+    <text xml:lang="hr" lang3="hrv">Bilješka</text>
+    <text xml:lang="ko" lang3="kor">주석</text>
+  </entry>
+  <entry>
+    <key>Optional</key>
+    <text xml:lang="en" lang3="eng">Optional</text>
+    <text xml:lang="de" lang3="deu">Optional</text>
+    <text xml:lang="ro" lang3="ron">Opţional</text>
+    <text xml:lang="fr" lang3="fra">Optionel</text>
+    <text xml:lang="pt" lang3="por">Opcional</text>
+    <text xml:lang="es" lang3="spa">Opcional</text>
+    <text xml:lang="it" lang3="ita">Opzionale</text>
+    <text xml:lang="sl" lang3="slv">Neobvezen</text>
+    <text xml:lang="sv" lang3="swe">Valfri</text>
+    <text xml:lang="no" lang3="nor">Valgfritt</text>
+    <text xml:lang="zh-TW">非必備的</text>
+    <text xml:lang="sr" lang3="srp">Neobavezan</text>
+    <text xml:lang="ja" lang3="jpn">任意</text>
+    <text xml:lang="pl" lang3="pol">Opcjonalny</text>
+    <text xml:lang="hi" lang3="hin">vaikalpika</text>
+    <text xml:lang="th" lang3="tha">ตัวเลือก</text>
+    <text xml:lang="nl" lang3="nld">Optioneel</text>
+    <text xml:lang="ru" lang3="rus">Факультативный</text>
+    <text xml:lang="tr" lang3="tur">Seçmeli</text>
+    <text xml:lang="bg" lang3="bul">Незадължителен</text>
+    <text xml:lang="el" lang3="ell">Προαιρετικός</text>
+    <text xml:lang="ca" lang3="cat">Opcional</text>
+    <text xml:lang="la" lang3="lat">Si libet</text>
+    <text xml:lang="hr" lang3="hrv">Po želji</text>
+    <text xml:lang="ko" lang3="kor">수의적</text>
+  </entry>
+  <entry>
+    <entry>
+      <key>Required</key>
+      <text xml:lang="en" lang3="eng">Required</text>
+      <text xml:lang="de" lang3="deu">Obligatorisch</text>
+      <text xml:lang="ro" lang3="ron">Obligatoriu</text>
+      <text xml:lang="fr" lang3="fra">Requis</text>
+      <text xml:lang="pt" lang3="por">Obrigatório</text>
+      <text xml:lang="es" lang3="spa">Necesario</text>
+      <text xml:lang="it" lang3="ita">Richiesto</text>
+      <text xml:lang="sl" lang3="slv">Zahtevan</text>
+      <text xml:lang="sv" lang3="swe">Nödvändig</text>
+      <text xml:lang="no" lang3="nor">Obligatorisk</text>
+      <text xml:lang="zh-TW">必備的</text>
+      <text xml:lang="sr" lang3="srp">Tražen</text>
+      <text xml:lang="ja" lang3="jpn">必須</text>
+      <text xml:lang="pl" lang3="pol">Wymagany</text>
+      <text xml:lang="hi" lang3="hin">Avashyaka</text>
+      <text xml:lang="th" lang3="tha">ต้องการข้อมูล</text>
+      <text xml:lang="nl" lang3="nld">Verplicht</text>
+      <text xml:lang="ru" lang3="rus">Обязательный</text>
+      <text xml:lang="tr" lang3="tur">Gerekli</text>
+      <text xml:lang="bg" lang3="bul">Задължителен</text>
+      <text xml:lang="el" lang3="ell">Απαραίτητος</text>
+      <text xml:lang="ca" lang3="cat">Requerit</text>
+      <text xml:lang="la" lang3="lat">Necessarium</text>
+      <text xml:lang="hr" lang3="hrv">Obavezno</text>
+      <text xml:lang="ko" lang3="kor">필수적</text>
+    </entry>
+    <key>Recommended</key>
+    <text xml:lang="en" lang3="eng">Recommended</text>
+    <text xml:lang="de" lang3="deu">Empfohlen</text>
+    <text xml:lang="ro" lang3="ron">Recomandat</text>
+    <text xml:lang="fr" lang3="fra">Recommendé</text>
+    <text xml:lang="pt" lang3="por">Recomendado</text>
+    <text xml:lang="es" lang3="spa">Recomendado</text>
+    <text xml:lang="it" lang3="ita">Consigliato</text>
+    <text xml:lang="sl" lang3="slv">Priporočen</text>
+    <text xml:lang="sv" lang3="swe">Rekommenderad</text>
+    <text xml:lang="no" lang3="nor">Anbefalt</text>
+    <text xml:lang="zh-TW">推薦的</text>
+    <text xml:lang="sr" lang3="srp">Preporučen</text>
+    <text xml:lang="ja" lang3="jpn">推薦される</text>
+    <text xml:lang="pl" lang3="pol">Zalecany</text>
+    <text xml:lang="hi" lang3="hin">svIkArniYa</text>
+    <text xml:lang="th" lang3="tha">คำแนะนำ</text>
+    <text xml:lang="nl" lang3="nld">Aanbevolen</text>
+    <text xml:lang="ru" lang3="rus">Рекомендуемый</text>
+    <text xml:lang="tr" lang3="tur">Önerilen</text>
+    <text xml:lang="bg" lang3="bul">Препоръчителен</text>
+    <text xml:lang="el" lang3="ell">Συστημένος</text>
+    <text xml:lang="ca" lang3="cat">Recomanat</text>
+    <text xml:lang="la" lang3="lat">Commendata</text>
+    <text xml:lang="hr" lang3="hrv">Preporučeno</text>
+    <text xml:lang="ko" lang3="kor">권고적</text>
+  </entry>
+  <entry>
+    <key>Recommended when applicable</key>
+    <text xml:lang="en" lang3="eng">Recommended when applicable</text>
+    <text xml:lang="de" lang3="deu">Empfohlen wenn zutreffend</text>
+    <text xml:lang="ro" lang3="ron">Recomandat dacă se potriveşte</text>
+    <text xml:lang="fr" lang3="fra">Recommendé quand applicable</text>
+    <text xml:lang="pt" lang3="por">Recomendado quando aplicável</text>
+    <text xml:lang="es" lang3="spa">Recomendado cuando se aplica</text>
+    <text xml:lang="it" lang3="ita">Consigliato se applicabile</text>
+    <text xml:lang="sl" lang3="slv">Priporočen, če ustreza</text>
+    <text xml:lang="sv" lang3="swe">Rekommenderad om användbar</text>
+    <text xml:lang="no" lang3="nor">Anbefalt når aktuelt</text>
+    <text xml:lang="zh-TW">可應用時推薦應用</text>
+    <text xml:lang="sr" lang3="srp">Preporučen, ako se može primeniti</text>
+    <text xml:lang="ja" lang3="jpn">利用できる場合は推奨．</text>
+    <text xml:lang="pl" lang3="pol">Zalecany w stosownych przypadkach</text>
+    <text xml:lang="hi" lang3="hin">Avashyaka JaHa uchita</text>
+    <text xml:lang="th" lang3="tha">ต้องการข้อมูลเมื่อสมัคร</text>
+    <text xml:lang="nl" lang3="nld">Aanbevolen indien van toepassing</text>
+    <text xml:lang="ca" lang3="cat">Recomanat quan siga possible</text>
+    <text xml:lang="la" lang3="lat">Commendata in loco proprio</text>
+    <text xml:lang="hr" lang3="hrv">Preporučeno na odgovarajućem mjestu</text>
+    <text xml:lang="ru" lang3="rus">Желателен, если применим</text>
+    <text xml:lang="tr" lang3="tur">Önerilen gereken</text>
+    <text xml:lang="bg" lang3="bul">Препоръчителен, където е приложим</text>
+    <text xml:lang="el" lang3="ell">Συνιστώμενος αν είναι εφαρμόσιμος</text>
+  </entry>
+
+  <entry>
+    <key>Sample values include</key>
+    <text xml:lang="en" lang3="eng">Sample values include</text>
+    <text xml:lang="de" lang3="deu">Beispielwerte sind etwa</text>
+    <text xml:lang="ro" lang3="ron">De exemplu, valorile pot fi</text>
+    <text xml:lang="fr" lang3="fra">Exemple de valeurs possibles</text>
+    <text xml:lang="pt" lang3="por">Exemplos de valores incluidos</text>
+    <text xml:lang="es" lang3="spa">Posibles valores</text>
+    <text xml:lang="it" lang3="ita">I valori esemplificativi includono</text>
+    <text xml:lang="sl" lang3="slv">Možne vrednosti so denimo</text>
+    <text xml:lang="sv" lang3="swe">Exempel på värden som kan inkluderas</text>
+    <text xml:lang="no" lang3="nor">Eksempler på mulige verdier er</text>
+    <text xml:lang="zh-TW">實例值包含</text>
+    <text xml:lang="sr" lang3="srp">Neke moguće vrednosti su</text>
+    <text xml:lang="ja" lang3="jpn">例としての値は以下の通り</text>
+    <text xml:lang="pl" lang3="pol">Przykładowe wartości obejmują</text>
+    <text xml:lang="hi" lang3="hin">misAla guNa mein Sammil Hai</text>
+    <text xml:lang="th" lang3="tha">รวมค่าตัวอย่าง</text>
+    <text xml:lang="nl" lang3="nld">Voorbeeldwaarden zijn onder meer</text>
+    <text xml:lang="ru" lang3="rus">Примерные величины включают</text>
+    <text xml:lang="tr" lang3="tur">Örnek değerler arasında</text>
+    <text xml:lang="bg" lang3="bul">Примерните стойности включват</text>
+    <text xml:lang="el" lang3="ell">Οι δειγματικές τιμές συμπεριλαμβάνουν</text>
+    <text xml:lang="ca" lang3="cat">Exemples de valors possibles</text>
+    <text xml:lang="la" lang3="lat">Valores exemplares</text>
+    <text xml:lang="hr" lang3="hrv">Primjer vrijednosti</text>
+    <text xml:lang="ko" lang3="kor">샘플 값은 다음을 포함한다 Sample values include</text>
+  </entry>
+  <entry>
+    <key>Status</key>
+    <text xml:lang="en" lang3="eng">Status</text>
+    <text xml:lang="de" lang3="deu">Zustand</text>
+    <text xml:lang="ro" lang3="ron">Stare</text>
+    <text xml:lang="fr" lang3="fra">Statut</text>
+    <text xml:lang="pt" lang3="por">Status</text>
+    <text xml:lang="es" lang3="spa">Estado</text>
+    <text xml:lang="it" lang3="ita">Stato</text>
+    <text xml:lang="sl" lang3="slv">Stanje</text>
+    <text xml:lang="sv" lang3="swe">Status</text>
+    <text xml:lang="no" lang3="nor">Status</text>
+    <text xml:lang="zh-TW">狀態</text>
+    <text xml:lang="sr" lang3="srp">Status</text>
+    <text xml:lang="ja" lang3="jpn">状態</text>
+    <text xml:lang="pl" lang3="pol">Status</text>
+    <text xml:lang="th" lang3="tha">สถานะ</text>
+    <text xml:lang="nl" lang3="nld">Status</text>
+    <text xml:lang="ru" lang3="rus">Состояние</text>
+    <text xml:lang="tr" lang3="tur">Durum</text>
+    <text xml:lang="bg" lang3="bul">Състояние</text>
+    <text xml:lang="el" lang3="ell">Κατάσταση</text>
+    <text xml:lang="ca" lang3="cat">Estat</text>
+    <text xml:lang="la" lang3="lat">Status</text>
+    <text xml:lang="hr" lang3="hrv">Stanje</text>
+    <text xml:lang="ko" lang3="kor">상태</text>
+  </entry>
+  <entry>
+    <key>Suggested values include</key>
+    <text xml:lang="es" lang3="spa">Los valores sugeridos incluyen</text>
+    <text xml:lang="en" lang3="eng">Suggested values include</text>
+    <text xml:lang="de" lang3="deu">Empfohlene Werte sind</text>
+    <text xml:lang="ro" lang3="ron">Valori recomandate sunt</text>
+    <text xml:lang="fr" lang3="fra">Les valeurs suggérées comprennent</text>
+    <text xml:lang="pt" lang3="por">Os valores sugeridos incluem</text>
+    <text xml:lang="it" lang3="ita">I valori suggeriti includono</text>
+    <text xml:lang="sl" lang3="slv">Priporočene vrednosti so denimo</text>
+    <text xml:lang="sv" lang3="swe">Förslag på värden som bör inkluderas</text>
+    <text xml:lang="no" lang3="nor">Eksempler på verdier som foreslås er</text>
+    <text xml:lang="zh-TW">被推薦的值包含</text>
+    <text xml:lang="sr" lang3="srp">Preporučene vrednosti su</text>
+    <text xml:lang="ja" lang3="jpn">提案する値は以下の通り</text>
+    <text xml:lang="pl" lang3="pol">Sugerowane wartości obejmują</text>
+    <text xml:lang="hi" lang3="hin">sujheeT guNa mein Sammil Hai</text>
+    <text xml:lang="th" lang3="tha">รวมค่าแนะนำ</text>
+    <text xml:lang="nl" lang3="nld">Voorgestelde waarden</text>
+    <text xml:lang="ru" lang3="rus">Рекомендуемые величины включают</text>
+    <text xml:lang="tr" lang3="tur">Önerilen değerler arasında</text>
+    <text xml:lang="bg" lang3="bul">Препоръчваните стойности включват</text>
+    <text xml:lang="el" lang3="ell">Οι συστημένες τιμές συμπεριλαμβάνουν</text>
+    <text xml:lang="ca" lang3="cat">Exemples de valors suggerits</text>
+    <text xml:lang="la" lang3="lat">Valores propositae sunt</text>
+    <text xml:lang="hr" lang3="hrv">Predložene su vrijednosti</text>
+    <text xml:lang="ko" lang3="kor">제안값은 다음을 포함한다</text>
+  </entry>
+  <entry>
+    <key>Values</key>
+    <text xml:lang="en" lang3="eng">Values</text>
+    <text xml:lang="de" lang3="deu">Werte</text>
+    <text xml:lang="ro" lang3="ron">Valori</text>
+    <text xml:lang="fr" lang3="fra">Valeurs</text>
+    <text xml:lang="pt" lang3="por">Valores</text>
+    <text xml:lang="es" lang3="spa">Valores</text>
+    <text xml:lang="it" lang3="ita">Valori</text>
+    <text xml:lang="sl" lang3="slv">Vrednosti</text>
+    <text xml:lang="sv" lang3="swe">Värden</text>
+    <text xml:lang="no" lang3="nor">Verdier</text>
+    <text xml:lang="zh-TW">值</text>
+    <text xml:lang="sr" lang3="srp">Vrednosti</text>
+    <text xml:lang="ja" lang3="jpn">値</text>
+    <text xml:lang="pl" lang3="pol">Wartości</text>
+    <text xml:lang="hi" lang3="hin">guNa</text>
+    <text xml:lang="nl" lang3="nld">Waarden</text>
+    <text xml:lang="ru" lang3="rus">Величины</text>
+    <text xml:lang="tr" lang3="tur">Değerler</text>
+    <text xml:lang="bg" lang3="bul">Стойности</text>
+    <text xml:lang="el" lang3="ell">Τιμές</text>
+    <text xml:lang="ca" lang3="cat">Valors</text>
+    <text xml:lang="la" lang3="lat">Valores</text>
+    <text xml:lang="hr" lang3="hrv">Vrijednosti</text>
+    <text xml:lang="ko" lang3="kor">값</text>
+  </entry>
+  <entry>
+    <key>include</key>
+    <text xml:lang="en" lang3="eng">include</text>
+    <text xml:lang="de" lang3="deu">enthalten</text>
+    <text xml:lang="ro" lang3="ron">conţin</text>
+    <text xml:lang="fr" lang3="fra">inclure</text>
+    <text xml:lang="pt" lang3="por">inclui (incluem)</text>
+    <text xml:lang="es" lang3="spa">incluir</text>
+    <text xml:lang="it" lang3="ita">include</text>
+    <text xml:lang="sl" lang3="slv">vsebuje</text>
+    <text xml:lang="sv" lang3="swe">inkludera</text>
+    <text xml:lang="no" lang3="nor">inkludere</text>
+    <text xml:lang="zh-TW">包含</text>
+    <text xml:lang="sr" lang3="srp">uključuje</text>
+    <text xml:lang="ja" lang3="jpn">含む</text>
+    <text xml:lang="pl" lang3="pol">włącz</text>
+    <text xml:lang="hi" lang3="hin">sammil</text>
+    <text xml:lang="th" lang3="tha">รวมถึง</text>
+    <text xml:lang="nl" lang3="nld">zijn onder meer</text>
+    <text xml:lang="ru" lang3="rus">включить</text>
+    <text xml:lang="tr" lang3="tur">içer</text>
+    <text xml:lang="bg" lang3="bul">включи</text>
+    <text xml:lang="el" lang3="ell">ενσωμάτωσης</text>
+    <text xml:lang="ca" lang3="cat">inclou</text>
+    <text xml:lang="la" lang3="lat">inclusum est</text>
+    <text xml:lang="hr" lang3="hrv">sadrži</text>
+    <text xml:lang="ko" lang3="kor">포함한다</text>
+  </entry>
+  <entry>
+    <key>appendixWords</key>
+    <text xml:lang="en" lang3="eng">Appendix</text>
+    <text xml:lang="de" lang3="deu">Anhang</text>
+    <text xml:lang="ro" lang3="ron">Apendice</text>
+    <text xml:lang="fr" lang3="fra">Annexe</text>
+    <text xml:lang="pt" lang3="por">Apêndice</text>
+    <text xml:lang="es" lang3="spa">Apéndice</text>
+    <text xml:lang="it" lang3="ita">Appendice</text>
+    <text xml:lang="sl" lang3="slv">Dodatek</text>
+    <text xml:lang="sv" lang3="swe">Bilaga</text>
+    <text xml:lang="no" lang3="nor">Vedlegg</text>
+    <text xml:lang="zh-TW">附錄</text>
+    <text xml:lang="sr" lang3="srp">Dodatak</text>
+    <text xml:lang="ja" lang3="jpn">付録</text>
+    <text xml:lang="pl" lang3="pol">Dodatek</text>
+    <text xml:lang="hi" lang3="hin">Atirikta</text>
+    <text xml:lang="th" lang3="tha">ภาคผนวก</text>
+    <text xml:lang="nl" lang3="nld">Appendix</text>
+    <text xml:lang="ru" lang3="rus">Приложение</text>
+    <text xml:lang="tr" lang3="tur">Ek</text>
+    <text xml:lang="bg" lang3="bul">Приложение</text>
+    <text xml:lang="el" lang3="ell">Παράρτημα</text>
+    <text xml:lang="ca" lang3="cat">Apèndix</text>
+    <text xml:lang="la" lang3="lat">Appendix</text>
+    <text xml:lang="hr" lang3="hrv">Dodatak</text>
+    <text xml:lang="ko" lang3="kor">부록</text>
+  </entry>
+  <entry>
+    <key>editorWord</key>
+    <text xml:lang="en" lang3="eng">Editor</text> 
+  </entry>
+  <entry>
+    <key>authorWord</key>
+    <text xml:lang="en" lang3="eng">Author</text>
+   <text xml:lang="de" lang3="deu">Autor</text>
+    <text xml:lang="ro" lang3="ron">Autor</text>
+    <text xml:lang="fr" lang3="fra">Auteur</text>
+    <text xml:lang="pt" lang3="por">Autor</text>
+    <text xml:lang="es" lang3="spa">Autor</text>
+    <text xml:lang="it" lang3="ita">Autore</text>
+    <text xml:lang="sl" lang3="slv">Avtor</text>
+    <text xml:lang="sv" lang3="swe">Författare</text>
+    <text xml:lang="no" lang3="nor">Forfatter</text>
+    <text xml:lang="zh-TW">作者</text>
+    <text xml:lang="sr" lang3="srp">Autor</text>
+    <text xml:lang="ja" lang3="jpn">著者</text>
+    <text xml:lang="pl" lang3="pol">Autor</text>
+    <text xml:lang="hi" lang3="hin">Lekhaka</text>
+    <text xml:lang="th" lang3="tha">ผู้แต่ง</text>
+    <text xml:lang="nl" lang3="nld">Auteur</text>
+    <text xml:lang="ru" lang3="rus">Автор</text>
+    <text xml:lang="tr" lang3="tur">Yazar</text>
+    <text xml:lang="bg" lang3="bul">Автор</text>
+    <text xml:lang="el" lang3="ell">Δημιουργός</text>
+    <text xml:lang="ca" lang3="cat">Autor</text>
+    <text xml:lang="la" lang3="lat">Auctor</text>
+    <text xml:lang="hr" lang3="hrv">Autor</text>
+    <text xml:lang="ko" lang3="kor">저자</text>
+  </entry>
+  <entry>
+    <key>biblioWords</key>
+    <text xml:lang="en" lang3="eng">Bibliography</text>
+    <text xml:lang="de" lang3="deu">Bibliographie</text>
+    <text xml:lang="ro" lang3="ron">Bibliografie</text>
+    <text xml:lang="fr" lang3="fra">Bibliographie</text>
+    <text xml:lang="pt" lang3="por">Bibiografia</text>
+    <text xml:lang="es" lang3="spa">Bibliografía</text>
+    <text xml:lang="it" lang3="ita">Bibliografia</text>
+    <text xml:lang="sl" lang3="slv">Bibliografija</text>
+    <text xml:lang="sv" lang3="swe">Bibliografi</text>
+    <text xml:lang="no" lang3="nor">Bibliografi</text>
+    <text xml:lang="zh-TW">參考書目</text>
+    <text xml:lang="sr" lang3="srp">Bibliografija</text>
+    <text xml:lang="ja" lang3="jpn">目録</text>
+    <text xml:lang="pl" lang3="pol">Bibliografia</text>
+    <text xml:lang="hi" lang3="hin">Bibliography</text>
+    <text xml:lang="th" lang3="tha">บรรณานุกรม</text>
+    <text xml:lang="nl" lang3="nld">Bibliografie</text>
+    <text xml:lang="ru" lang3="rus">Библиография</text>
+    <text xml:lang="tr" lang3="tur">Bibliyografya</text>
+    <text xml:lang="bg" lang3="bul">Литература</text>
+    <text xml:lang="el" lang3="ell">Βιβλιογραφία</text>
+    <text xml:lang="ca" lang3="cat">Bibliografia</text>
+    <text xml:lang="la" lang3="lat">Auctores</text>
+    <text xml:lang="hr" lang3="hrv">Bibliografija</text>
+    <text xml:lang="ko" lang3="kor">서지목록</text>
+  </entry>
+  <entry>
+    <key>contentsHeading</key>
+    <text xml:lang="en" lang3="eng">Sections in this document:</text>
+    <text xml:lang="de" lang3="deu">Abschnitte in diesem Dokument:</text>
+    <text xml:lang="ro" lang3="ron">Capitolele acestui document:</text>
+    <text xml:lang="fr" lang3="fra">Sections de ce document:</text>
+    <text xml:lang="pt" lang3="por">Índice geral:</text>
+    <text xml:lang="es" lang3="spa">Secciones en este documento:</text>
+    <text xml:lang="it" lang3="ita">Sommario di questo documento:</text>
+    <text xml:lang="sl" lang3="slv">Razdelki v tem dokumentu:</text>
+    <text xml:lang="sv" lang3="swe">Sektioner i detta dokument</text>
+    <text xml:lang="no" lang3="nor">Deler i dette dokumentet:</text>
+    <text xml:lang="zh-TW">本文章節:</text>
+    <text xml:lang="sr" lang3="srp">Odeljci u ovom dokumentu:</text>
+    <text xml:lang="ja" lang3="jpn">表題</text>
+    <text xml:lang="pl" lang3="pol">Sekcje zawarte w bieżącym dokumencie:</text>
+    <text xml:lang="th" lang3="tha">บทในเอกสารนี้</text>
+    <text xml:lang="nl" lang3="nld">Onderdelen van dit document:</text>
+    <text xml:lang="ru" lang3="rus">Разделы в этом документе:</text>
+    <text xml:lang="tr" lang3="tur">Bu belgenin bölümleri:</text>
+    <text xml:lang="bg" lang3="bul">Раздели в този документ:</text>
+    <text xml:lang="el" lang3="ell">Τμήματα αυτού του εγγράφου:</text>
+    <text xml:lang="ca" lang3="cat">Seccions en aquest document:</text>
+    <text xml:lang="la" lang3="lat">Capitula textus:</text>
+    <text xml:lang="hr" lang3="hrv">Odjeljci ovog dokumenta:</text>
+    <text xml:lang="ko" lang3="kor">본 문서의 절</text>
+  </entry>
+  <entry>
+    <key>contentsWord</key>
+    <text xml:lang="en" lang3="eng">Contents</text>
+    <text xml:lang="de" lang3="deu">Inhalt</text>
+    <text xml:lang="ro" lang3="ron">Cuprins</text>
+    <text xml:lang="fr" lang3="fra">Contenu</text>
+    <text xml:lang="pt" lang3="por">Índice geral</text>
+    <text xml:lang="es" lang3="spa">Contenidos</text>
+    <text xml:lang="sl" lang3="slv">Vsebina</text>
+    <text xml:lang="sv" lang3="swe">Innehåll</text>
+    <text xml:lang="no" lang3="nor">Innhold</text>
+    <text xml:lang="zh-TW">內容</text>
+    <text xml:lang="sr" lang3="srp">Sadržaj</text>
+    <text xml:lang="ja" lang3="jpn">目次</text>
+    <text xml:lang="pl" lang3="pol">Spis treści</text>
+    <text xml:lang="hi" lang3="hin">Mula Shabda</text>
+    <text xml:lang="th" lang3="tha">เนื้อหา</text>
+    <text xml:lang="nl" lang3="nld">Inhoud</text>
+    <text xml:lang="ru" lang3="rus">Оглавление</text>
+    <text xml:lang="tr" lang3="tur">İçerik</text>
+    <text xml:lang="bg" lang3="bul">Съдържание</text>
+    <text xml:lang="el" lang3="ell">Περιεχόμενα</text>
+    <text xml:lang="ca" lang3="cat">Índex general</text>
+    <text xml:lang="it" lang3="ita">Argomenti</text>
+    <text xml:lang="la" lang3="lat">Tabula contentorum</text>
+    <text xml:lang="hr" lang3="hrv">Sadržaj</text>
+    <text xml:lang="ko" lang3="kor">내용</text>
+  </entry>
+  <entry>
+    <key>dateWord</key>
+    <text xml:lang="en" lang3="eng">Date</text>
+    <text xml:lang="de" lang3="deu">Datum</text>
+    <text xml:lang="ro" lang3="ron">Data</text>
+    <text xml:lang="fr" lang3="fra">Date</text>
+    <text xml:lang="pt" lang3="por">Data</text>
+    <text xml:lang="es" lang3="spa">Fecha</text>
+    <text xml:lang="it" lang3="ita">Data</text>
+    <text xml:lang="sl" lang3="slv">Datum</text>
+    <text xml:lang="sv" lang3="swe">Datum</text>
+    <text xml:lang="no" lang3="nor">Dato</text>
+    <text xml:lang="zh-TW">日期</text>
+    <text xml:lang="sr" lang3="srp">Datum</text>
+    <text xml:lang="ja" lang3="jpn">日付</text>
+    <text xml:lang="pl" lang3="pol">Data</text>
+    <text xml:lang="hi" lang3="hin">Tarikha</text>
+    <text xml:lang="th" lang3="tha">วันที่</text>
+    <text xml:lang="nl" lang3="nld">Datum</text>
+    <text xml:lang="ru" lang3="rus">Дата</text>
+    <text xml:lang="tr" lang3="tur">Tarih</text>
+    <text xml:lang="bg" lang3="bul">Дата</text>
+    <text xml:lang="el" lang3="ell">Ημερομηνία</text>
+    <text xml:lang="ca" lang3="cat">Dataa</text>
+    <text xml:lang="la" lang3="lat">Die dato</text>
+    <text xml:lang="hr" lang3="hrv">Datum</text>
+    <text xml:lang="ko" lang3="kor">날짜</text>
+  </entry>
+  <entry>
+    <key>feedbackWords</key>
+    <text xml:lang="en" lang3="eng">Feedback</text>
+    <text xml:lang="de" lang3="deu">Kommentare</text>
+    <text xml:lang="ro" lang3="ron">Retur</text>
+    <text xml:lang="fr" lang3="fra">Commentaires</text>
+    <text xml:lang="pt" lang3="por">Comentários</text>
+    <text xml:lang="es" lang3="spa">Comentarios</text>
+    <text xml:lang="it" lang3="ita">Commenti e suggerimenti</text>
+    <text xml:lang="sl" lang3="slv">Odzivi</text>
+    <text xml:lang="sv" lang3="swe">Kommentarer</text>
+    <text xml:lang="no" lang3="nor">Kommentarer</text>
+    <text xml:lang="zh-TW">回饋</text>
+    <text xml:lang="sr" lang3="srp">Komentari</text>
+    <text xml:lang="ja" lang3="jpn">ご意見・ご感想</text>
+    <text xml:lang="pl" lang3="pol">Komentarze</text>
+    <text xml:lang="hi" lang3="hin">Tippani</text>
+    <text xml:lang="th" lang3="tha">ตอบกลับ</text>
+    <text xml:lang="nl" lang3="nld">Feedback</text>
+    <text xml:lang="ru" lang3="rus">Отзывы</text>
+    <text xml:lang="tr" lang3="tur">Geri besleme</text>
+    <text xml:lang="bg" lang3="bul">Коментари</text>
+    <text xml:lang="el" lang3="ell">Γνώμες</text>
+    <text xml:lang="ca" lang3="cat">Comentaris</text>
+    <text xml:lang="la" lang3="lat">Responsiones</text>
+    <text xml:lang="hr" lang3="hrv">Komentari</text>
+    <text xml:lang="ko" lang3="kor">피드백</text>
+  </entry>
+  <entry>
+    <key>figureWord</key>
+    <text xml:lang="en" lang3="eng">Figure</text>
+    <text xml:lang="de" lang3="deu">Abbildung</text>
+    <text xml:lang="ro" lang3="ron">Figura</text>
+    <text xml:lang="fr" lang3="fra">Figure</text>
+    <text xml:lang="pt" lang3="por">Figura</text>
+    <text xml:lang="es" lang3="spa">Imagen</text>
+    <text xml:lang="it" lang3="ita">Figura</text>
+    <text xml:lang="sl" lang3="slv">Slika</text>
+    <text xml:lang="sv" lang3="swe">Figur</text>
+    <text xml:lang="no" lang3="nor">Figur</text>
+    <text xml:lang="zh-TW">圖表</text>
+    <text xml:lang="sr" lang3="srp">Slika</text>
+    <text xml:lang="ja" lang3="jpn">図</text>
+    <text xml:lang="pl" lang3="pol">Rysunek</text>
+    <text xml:lang="hi" lang3="hin">Chitr</text>
+    <text xml:lang="th" lang3="tha">ภาพ</text>
+    <text xml:lang="nl" lang3="nld">Afbeelding</text>
+    <text xml:lang="ru" lang3="rus">Фигура</text>
+    <text xml:lang="tr" lang3="tur">Şekil</text>
+    <text xml:lang="bg" lang3="bul">Фигура</text>
+    <text xml:lang="el" lang3="ell">Σχήμα</text>
+    <text xml:lang="ca" lang3="cat">Figura</text>
+    <text xml:lang="la" lang3="lat">Figura</text>
+    <text xml:lang="hr" lang3="hrv">Ilustracija</text>
+    <text xml:lang="ko" lang3="kor">그림</text>
+  </entry>
+  <entry>
+    <key>figureWords</key>
+    <text xml:lang="en" lang3="eng">Figures</text>
+    <text xml:lang="de" lang3="deu">Abbildungen</text>
+    <text xml:lang="ro" lang3="ron">Figuri</text>
+    <text xml:lang="fr" lang3="fra">Figures</text>
+    <text xml:lang="pt" lang3="por">Figuras</text>
+    <text xml:lang="es" lang3="spa">Imágenes</text>
+    <text xml:lang="it" lang3="ita">Figure</text>
+    <text xml:lang="sl" lang3="slv">Slike</text>
+    <text xml:lang="sv" lang3="swe">Figurer</text>
+    <text xml:lang="no" lang3="nor">Figurer</text>
+    <text xml:lang="zh-TW">圖表</text>
+    <text xml:lang="sr" lang3="srp">Slike</text>
+    <text xml:lang="ja" lang3="jpn">図</text>
+    <text xml:lang="pl" lang3="pol">Rysunki</text>
+    <text xml:lang="hi" lang3="hin">Chitr</text>
+    <text xml:lang="th" lang3="tha">ภาพ</text>
+    <text xml:lang="nl" lang3="nld">Afbeeldingen</text>
+    <text xml:lang="ru" lang3="rus">Фигуры</text>
+    <text xml:lang="tr" lang3="tur">Şekiller</text>
+    <text xml:lang="bg" lang3="bul">Фигури</text>
+    <text xml:lang="el" lang3="ell">Σχήματα</text>
+    <text xml:lang="ca" lang3="cat">Figures</text>
+    <text xml:lang="la" lang3="lat">Figurae</text>
+    <text xml:lang="hr" lang3="hrv">Ilustracije</text>
+    <text xml:lang="ko" lang3="kor">그림들</text>
+  </entry>
+  <entry>
+    <key>nextWord</key>
+    <text xml:lang="en" lang3="eng">Next</text>
+    <text xml:lang="de" lang3="deu">Nächstes</text>
+    <text xml:lang="ro" lang3="ron">Următorul</text>
+    <text xml:lang="fr" lang3="fra">Suivant</text>
+    <text xml:lang="pt" lang3="por">Seguinte</text>
+    <text xml:lang="es" lang3="spa">Siguiente</text>
+    <text xml:lang="it" lang3="ita">Seguente</text>
+    <text xml:lang="sl" lang3="slv">Naslednji</text>
+    <text xml:lang="sv" lang3="swe">Nästa</text>
+    <text xml:lang="no" lang3="nor">Neste</text>
+    <text xml:lang="zh-TW">下一頁</text>
+    <text xml:lang="sr" lang3="srp">Sledeći</text>
+    <text xml:lang="ja" lang3="jpn">次</text>
+    <text xml:lang="pl" lang3="pol">Następny</text>
+    <text xml:lang="hi" lang3="hin">Agala</text>
+    <text xml:lang="th" lang3="tha">ต่อไป</text>
+    <text xml:lang="nl" lang3="nld">Volgende</text>
+    <text xml:lang="ru" lang3="rus">Следующий</text>
+    <text xml:lang="tr" lang3="tur">Sonraki</text>
+    <text xml:lang="bg" lang3="bul">Следващ</text>
+    <text xml:lang="el" lang3="ell">Επόμενος</text>
+    <text xml:lang="ca" lang3="cat">Següent</text>
+    <text xml:lang="la" lang3="lat">Porro</text>
+    <text xml:lang="hr" lang3="hrv">Dalje</text>
+    <text xml:lang="ko" lang3="kor">다음</text>
+  </entry>
+  <entry>
+    <key>noteHeading</key>
+    <text xml:lang="en" lang3="eng">Notes</text>
+    <text xml:lang="de" lang3="deu">Noten</text>
+    <text xml:lang="ro" lang3="ron">Note</text>
+    <text xml:lang="fr" lang3="fra">Notes</text>
+    <text xml:lang="pt" lang3="por">Nota</text>
+    <text xml:lang="es" lang3="spa">Notas</text>
+    <text xml:lang="it" lang3="ita">Note</text>
+    <text xml:lang="sl" lang3="slv">Opombe</text>
+    <text xml:lang="sv" lang3="swe">Noteringar</text>
+    <text xml:lang="no" lang3="nor">Noter</text>
+    <text xml:lang="zh-TW">註解</text>
+    <text xml:lang="sr" lang3="srp">Napomene</text>
+    <text xml:lang="ja" lang3="jpn">注釈</text>
+    <text xml:lang="pl" lang3="pol">Uwagi</text>
+    <text xml:lang="hi" lang3="hin">Dhyan</text>
+    <text xml:lang="th" lang3="tha">หมายเหตุ</text>
+    <text xml:lang="nl" lang3="nld">Opmerkingen</text>
+    <text xml:lang="ru" lang3="rus">Примечания</text>
+    <text xml:lang="tr" lang3="tur">Notlar</text>
+    <text xml:lang="bg" lang3="bul">Забележки</text>
+    <text xml:lang="el" lang3="ell">Σχόλια</text>
+    <text xml:lang="ca" lang3="cat">Notes</text>
+    <text xml:lang="la" lang3="lat">Notae</text>
+    <text xml:lang="hr" lang3="hrv">Bilješke</text>
+    <text xml:lang="ko" lang3="kor">주석</text>
+  </entry>
+  <entry>
+    <key>previousWord</key>
+    <text xml:lang="en" lang3="eng">Previous</text>
+    <text xml:lang="de" lang3="deu">Vorheriges</text>
+    <text xml:lang="ro" lang3="ron">Precedentul</text>
+    <text xml:lang="fr" lang3="fra">Précédent</text>
+    <text xml:lang="pt" lang3="por">Prévio</text>
+    <text xml:lang="es" lang3="spa">Anterior</text>
+    <text xml:lang="it" lang3="ita">Precedente</text>
+    <text xml:lang="sl" lang3="slv">Prejšnji</text>
+    <text xml:lang="sv" lang3="swe">Föregående</text>
+    <text xml:lang="no" lang3="nor">Forrige</text>
+    <text xml:lang="zh-TW">上一頁</text>
+    <text xml:lang="sr" lang3="srp">Prethodni</text>
+    <text xml:lang="ja" lang3="jpn">前</text>
+    <text xml:lang="pl" lang3="pol">Poprzedni</text>
+    <text xml:lang="hi" lang3="hin">Purva"</text>
+    <text xml:lang="nl" lang3="nld">Vorige</text>
+    <text xml:lang="ru" lang3="rus">Предыдущий</text>
+    <text xml:lang="tr" lang3="tur">Önceki</text>
+    <text xml:lang="bg" lang3="bul">Предходен</text>
+    <text xml:lang="el" lang3="ell">Προηγούμενος</text>
+    <text xml:lang="ca" lang3="cat">Anterior</text>
+    <text xml:lang="la" lang3="lat">Retro</text>
+    <text xml:lang="hr" lang3="hrv">Natrag</text>
+    <text xml:lang="ko" lang3="kor">이전</text>
+  </entry>
+  <entry>
+    <key>revisedWord</key>
+    <text xml:lang="en" lang3="eng">revised</text>
+    <text xml:lang="de" lang3="deu">überarbeitet</text>
+    <text xml:lang="ro" lang3="ron">revăzut</text>
+    <text xml:lang="fr" lang3="fra">révisé</text>
+    <text xml:lang="pt" lang3="por">revisto</text>
+    <text xml:lang="es" lang3="spa">Revisado</text>
+    <text xml:lang="it" lang3="ita">revisionato</text>
+    <text xml:lang="sl" lang3="slv">dopolnjeno</text>
+    <text xml:lang="sv" lang3="swe">Ändrad</text>
+    <text xml:lang="no" lang3="nor">Revidert</text>
+    <text xml:lang="zh-TW">修訂</text>
+    <text xml:lang="sr" lang3="srp">izmenjeno</text>
+    <text xml:lang="ja" lang3="jpn">改訂</text>
+    <text xml:lang="pl" lang3="pol">poprawione</text>
+    <text xml:lang="hi" lang3="hin">duharAnA</text>
+    <text xml:lang="th" lang3="tha">ทบทวน</text>
+    <text xml:lang="nl" lang3="nld">herzien</text>
+    <text xml:lang="ru" lang3="rus">Пересмотрено</text>
+    <text xml:lang="tr" lang3="tur">Düzeltilmiş</text>
+    <text xml:lang="bg" lang3="bul">Променено</text>
+    <text xml:lang="el" lang3="ell">Μετάβλητο</text>
+    <text xml:lang="ca" lang3="cat">Revisat</text>
+    <text xml:lang="la" lang3="lat">Accurate revisum</text>
+    <text xml:lang="hr" lang3="hrv">Pregledano</text>
+    <text xml:lang="ko" lang3="kor">수정</text>
+  </entry>
+  <entry>
+    <key>searchWords</key>
+    <text xml:lang="en" lang3="eng">Search</text>
+    <text xml:lang="de" lang3="deu">Suche</text>
+    <text xml:lang="ro" lang3="ron">Caută</text>
+    <text xml:lang="fr" lang3="fra">Recherche</text>
+    <text xml:lang="pt" lang3="por">Pesquisa</text>
+    <text xml:lang="es" lang3="spa">Buscar</text>
+    <text xml:lang="it" lang3="ita">Cerca</text>
+    <text xml:lang="sl" lang3="slv">Iskanje</text>
+    <text xml:lang="sv" lang3="swe">Sök</text>
+    <text xml:lang="no" lang3="nor">Sok</text>
+    <text xml:lang="zh-TW">搜尋</text>
+    <text xml:lang="sr" lang3="srp">Pretraga</text>
+    <text xml:lang="ja" lang3="jpn">検索</text>
+    <text xml:lang="pl" lang3="pol">Szukaj</text>
+    <text xml:lang="hi" lang3="hin">Khoj</text>
+    <text xml:lang="th" lang3="tha">ค้นหา</text>
+    <text xml:lang="nl" lang3="nld">Zoeken</text>
+    <text xml:lang="ru" lang3="rus">Поиск</text>
+    <text xml:lang="tr" lang3="tur">Ara</text>
+    <text xml:lang="bg" lang3="bul">Търси</text>
+    <text xml:lang="el" lang3="ell">Ψάχνε</text>
+    <text xml:lang="ca" lang3="cat">Cercar</text>
+    <text xml:lang="la" lang3="lat">Quaere</text>
+    <text xml:lang="hr" lang3="hrv">Pretraživanje</text>
+    <text xml:lang="ko" lang3="kor">검색</text>
+  </entry>
+  <entry>
+    <key>tableWord</key>
+    <text xml:lang="en" lang3="eng">Table</text>
+    <text xml:lang="de" lang3="deu">Tabelle</text>
+    <text xml:lang="ro" lang3="ron">Tabel</text>
+    <text xml:lang="fr" lang3="fra">Table</text>
+    <text xml:lang="pt" lang3="por">Tabela</text>
+    <text xml:lang="es" lang3="spa">Tabla</text>
+    <text xml:lang="it" lang3="ita">Tavola</text>
+    <text xml:lang="sl" lang3="slv">Tabela</text>
+    <text xml:lang="sv" lang3="swe">Tabell</text>
+    <text xml:lang="no" lang3="nor">Tabell</text>
+    <text xml:lang="zh-TW">表格</text>
+    <text xml:lang="sr" lang3="srp">Tabela</text>
+    <text xml:lang="ja" lang3="jpn">表</text>
+    <text xml:lang="pl" lang3="pol">Tabela</text>
+    <text xml:lang="hi" lang3="hin">Patti</text>
+    <text xml:lang="th" lang3="tha">ตาราง</text>
+    <text xml:lang="nl" lang3="nld">Tabel</text>
+    <text xml:lang="ru" lang3="rus">Таблица</text>
+    <text xml:lang="tr" lang3="tur">Tablo</text>
+    <text xml:lang="bg" lang3="bul">Таблица</text>
+    <text xml:lang="el" lang3="ell">Πίνακας</text>
+    <text xml:lang="ca" lang3="cat">Taula</text>
+    <text xml:lang="la" lang3="lat">Tabella</text>
+    <text xml:lang="hr" lang3="hrv">Tablica</text>
+    <text xml:lang="ko" lang3="kor">표</text>
+  </entry>
+  <entry>
+    <key>tableWords</key>
+    <text xml:lang="en" lang3="eng">Tables</text>
+    <text xml:lang="de" lang3="deu">Tabellen</text>
+    <text xml:lang="ro" lang3="ron">Tabele</text>
+    <text xml:lang="fr" lang3="fra">Tables</text>
+    <text xml:lang="pt" lang3="por">Tabelas</text>
+    <text xml:lang="es" lang3="spa">Tablas</text>
+    <text xml:lang="it" lang3="ita">Tavole</text>
+    <text xml:lang="sl" lang3="slv">Tabele</text>
+    <text xml:lang="sv" lang3="swe">Tabeller</text>
+    <text xml:lang="no" lang3="nor">Tabeller</text>
+    <text xml:lang="zh-TW">表格</text>
+    <text xml:lang="sr" lang3="srp">Tabele</text>
+    <text xml:lang="ja" lang3="jpn">表</text>
+    <text xml:lang="pl" lang3="pol">Tabele</text>
+    <text xml:lang="hi" lang3="hin">Pattiya</text>
+    <text xml:lang="th" lang3="tha">คาราง</text>
+    <text xml:lang="nl" lang3="nld">Tabellen</text>
+    <text xml:lang="ru" lang3="rus">Таблицы</text>
+    <text xml:lang="tr" lang3="tur">Tablolar</text>
+    <text xml:lang="bg" lang3="bul">Таблици</text>
+    <text xml:lang="el" lang3="ell">Πίνακες</text>
+    <text xml:lang="ca" lang3="cat">Taules</text>
+    <text xml:lang="la" lang3="lat">Tabellae</text>
+    <text xml:lang="hr" lang3="hrv">Tablice</text>
+    <text xml:lang="ko" lang3="kor">표들</text>
+  </entry>
+  <entry>
+    <key>tocWords</key>
+    <text xml:lang="en" lang3="eng">Table of contents</text>
+    <text xml:lang="de" lang3="deu">Inhalt</text>
+    <text xml:lang="ro" lang3="ron">Cuprins</text>
+    <text xml:lang="fr" lang3="fra">Contenu</text>
+    <text xml:lang="pt" lang3="por">Índice geral</text>
+    <text xml:lang="es" lang3="spa">Índice</text>
+    <text xml:lang="it" lang3="ita">Indice</text>
+    <text xml:lang="sl" lang3="slv">Kazalo</text>
+    <text xml:lang="sv" lang3="swe">Innehåll</text>
+    <text xml:lang="no" lang3="nor">Innhold</text>
+    <text xml:lang="zh-TW">內容</text>
+    <text xml:lang="sr" lang3="srp">Sadržaj</text>
+    <text xml:lang="ja" lang3="jpn">目次</text>
+    <text xml:lang="pl" lang3="pol">Spis treści</text>
+    <text xml:lang="hi" lang3="hin">mula</text>
+    <text xml:lang="th" lang3="tha">สารบัญ</text>
+    <text xml:lang="nl" lang3="nld">Inhoud</text>
+    <text xml:lang="ru" lang3="rus">Оглавление</text>
+    <text xml:lang="tr" lang3="tur">İçerik</text>
+    <text xml:lang="bg" lang3="bul">Съдържание</text>
+    <text xml:lang="el" lang3="ell">Περιεχόμενα</text>
+    <text xml:lang="ca" lang3="cat">Índice general</text>
+    <text xml:lang="la" lang3="lat">Tabula contentorum</text>
+    <text xml:lang="hr" lang3="hrv">Sadržaj</text>
+    <text xml:lang="ko" lang3="kor">목차</text>
+  </entry>
+  <entry>
+    <key>upWord</key>
+    <text xml:lang="en" lang3="eng">Up</text>
+    <text xml:lang="de" lang3="deu">Aufwärts</text>
+    <text xml:lang="ro" lang3="ron">Sus</text>
+    <text xml:lang="fr" lang3="fra">Haut</text>
+    <text xml:lang="pt" lang3="por">Topo</text>
+    <text xml:lang="es" lang3="spa">Arriba</text>
+    <text xml:lang="it" lang3="ita">Su</text>
+    <text xml:lang="sl" lang3="slv">Gor</text>
+    <text xml:lang="sv" lang3="swe">Upp</text>
+    <text xml:lang="no" lang3="nor">Opp</text>
+    <text xml:lang="zh-TW">往上</text>
+    <text xml:lang="sr" lang3="srp">Gore</text>
+    <text xml:lang="ja" lang3="jpn">上</text>
+    <text xml:lang="pl" lang3="pol">W górę</text>
+    <text xml:lang="hi" lang3="hin">Upara Shabda</text>
+    <text xml:lang="th" lang3="tha">ไปข้างบน</text>
+    <text xml:lang="nl" lang3="nld">Hoger</text>
+    <text xml:lang="ru" lang3="rus">Вверх</text>
+    <text xml:lang="tr" lang3="tur">Yukarı</text>
+    <text xml:lang="bg" lang3="bul">Нагоре</text>
+    <text xml:lang="el" lang3="ell">Ανω</text>
+    <text xml:lang="ca" lang3="cat">Amunt</text>
+    <text xml:lang="la" lang3="lat">Sursum</text>
+    <text xml:lang="hr" lang3="hrv">Gore</text>
+    <text xml:lang="ko" lang3="kor">상위</text>
+  </entry>
+  <entry>
+    <key>appearsintheoriginalas</key>
+    <text xml:lang="en" lang3="eng">Appears in the original as</text>
+    <text xml:lang="es" lang3="spa">Aparece en el original como</text>
+    <text xml:lang="ca" lang3="cat">Apareix en l'original com</text>
+    <text xml:lang="de" lang3="deu">Erscheint im Original als</text>
+    <text xml:lang="la" lang3="lat">In exemplari legitur</text>
+    <text xml:lang="hr" lang3="hrv">U izvorniku se pojavljuje kao</text>
+    <text xml:lang="ko" lang3="kor">와 같이 원본에 나타난다</text>
+  </entry>
+  <text xml:lang="it" lang3="ita">Nell'originale appare come</text>
+  <entry>
+    <key>shouldbereadas</key>
+    <text xml:lang="en" lang3="eng">Should be read as</text>
+    <text xml:lang="es" lang3="spa">Debería leerse como</text>
+    <text xml:lang="ca" lang3="cat">S'hi hauria de llegir</text>
+    <text xml:lang="it" lang3="ita">Da leggersi come</text>
+    <text xml:lang="de" lang3="deu">Sollte gelesen werden als</text>
+    <text xml:lang="la" lang3="lat">Legendum est</text>
+    <text xml:lang="hr" lang3="hrv">Čita se kao</text>
+    <text xml:lang="ko" lang3="kor">와 같이 해석해야 한다</text>
+  </entry>
+  <entry>
+    <key>page</key>
+    <text xml:lang="en" lang3="eng">Page</text>
+    <text xml:lang="es" lang3="spa">Página</text>
+    <text xml:lang="ca" lang3="cat">Pàgina</text>
+    <text xml:lang="it" lang3="ita">Pagina</text>
+    <text xml:lang="de" lang3="deu">Seite</text>
+    <text xml:lang="la" lang3="lat">Pagina</text>
+    <text xml:lang="hr" lang3="hrv">Stranica</text>
+    <text xml:lang="ko" lang3="kor">쪽</text>
+  </entry>
+  <entry>
+    <key>asfoundin</key>
+    <text xml:lang="en" lang3="eng">As found in</text>
+    <text xml:lang="es" lang3="spa">Tal como se encuentra en</text>
+    <text xml:lang="ca" lang3="cat">Tal com es troba en</text>
+    <text xml:lang="de" lang3="deu">So wie gefunden in</text>
+    <text xml:lang="it" lang3="ita">Da riferirsi a</text>
+    <text xml:lang="la" lang3="lat">Ut legitur in</text>
+    <text xml:lang="hr" lang3="hrv">Prema izvoru</text>
+    <text xml:lang="ko" lang3="kor">에서와 같이 발견된</text>
+  </entry>
+  <entry>
+    <key>otherreadings</key>
+    <text xml:lang="en" lang3="eng">Other readings</text>
+    <text xml:lang="es" lang3="spa">Otras lecturas</text>
+    <text xml:lang="ca" lang3="cat">D'altres lectures</text>
+    <text xml:lang="de" lang3="deu">Andere Lesarten</text>
+    <text xml:lang="it" lang3="ita">Altre intepretazioni</text>
+    <text xml:lang="la" lang3="lat">Aliae lectiones</text>
+    <text xml:lang="hr" lang3="hrv">Druga čitanja</text>
+    <text xml:lang="ko" lang3="kor">다른 해석</text>
+  </entry>
+  <entry>
+    <key>homeWord</key>
+    <text xml:lang="ca" lang3="cat">Principal</text>
+    <text xml:lang="en" lang3="eng">Home</text>
+    <text xml:lang="fr" lang3="fra">Accueil</text>
+    <text xml:lang="pl" lang3="pol">Strona główna</text>
+    <text xml:lang="sw" lang3="swe">Hem</text>
+    <text xml:lang="th" lang3="tha">หน้าแรก</text>
+    <text xml:lang="de" lang3="deu">Anfang</text>
+    <text xml:lang="pt" lang3="por">Página inicial</text>
+    <text xml:lang="ja" lang3="jpn">ホーム</text>
+    <text xml:lang="sl" lang3="slv">Domov</text>
+    <text xml:lang="zh-TW">首頁</text>
+    <text xml:lang="no" lang3="nor">Hjem</text>
+    <text xml:lang="ro" lang3="ron">Acasă</text>
+    <text xml:lang="it" lang3="ita">Home</text>
+    <text xml:lang="es" lang3="spa">Principal</text>
+    <text xml:lang="ko" lang3="kor">가정</text>
+  </entry>
+  <entry>
+    <key>Used by</key>
+    <text xml:lang="ca" lang3="cat">Usat per</text>
+    <text xml:lang="en" lang3="eng">Used by</text>
+    <text xml:lang="pl" lang3="pol">Użyto w</text>
+    <text xml:lang="sw" lang3="swe">Används av</text>
+    <text xml:lang="de" lang3="deu">Verwendet von</text>
+    <text xml:lang="pt" lang3="por">Usado por</text>
+    <text xml:lang="no" lang3="nor">Brukt av</text>
+    <text xml:lang="sl" lang3="slv">Uporabljen v</text>
+    <text xml:lang="ja" lang3="jpn">当該モジュールを使用するもの</text>
+    <text xml:lang="zh-TW">屬於</text>
+    <text xml:lang="th" lang3="tha">ใช้โดย</text>
+    <text xml:lang="ro" lang3="ron">Folosit de</text>
+    <text xml:lang="fr" lang3="fra">Utilisé par</text>
+    <text xml:lang="it" lang3="ita">Usato da</text>
+    <text xml:lang="es" lang3="spa">Usado por</text>
+    <text xml:lang="ko" lang3="kor">에 의해 사용된</text>
+  </entry>
+  <entry>
+    <key>May contain</key>
+    <text xml:lang="ca" lang3="cat">Pot contenir</text>
+    <text xml:lang="en" lang3="eng">May contain</text>
+    <text xml:lang="pl" lang3="pol">Może zawierać</text>
+    <text xml:lang="sw" lang3="swe">Kan innehålla</text>
+    <text xml:lang="de" lang3="deu">Kann enthalten</text>
+    <text xml:lang="pt" lang3="por">Pode conter</text>
+    <text xml:lang="th" lang3="tha">ประกอบด้วย</text>
+    <text xml:lang="ja" lang3="jpn">下位</text>
+    <text xml:lang="sl" lang3="slv">Lahko vsebuje</text>
+    <text xml:lang="zh-TW">可包含</text>
+    <text xml:lang="no" lang3="nor">Kan inneholde</text>
+    <text xml:lang="ro" lang3="ron">Poate conţine</text>
+    <text xml:lang="fr" lang3="fra">Peut contenir</text>
+    <text xml:lang="it" lang3="ita">Può contenere</text>
+    <text xml:lang="es" lang3="spa">Puede contener</text>
+    <text xml:lang="ko" lang3="kor">포함할 수 있다</text>
+  </entry>
+  <entry>
+    <key>Contained by</key>
+    <text xml:lang="ca" lang3="cat">Contingut en</text>
+    <text xml:lang="ro" lang3="ron">Conţinut de</text>
+    <text xml:lang="en" lang3="eng">Contained by</text>
+    <text xml:lang="pl" lang3="pol">Zawiera się w</text>
+    <text xml:lang="sw" lang3="swe">Ingår i</text>
+    <text xml:lang="de" lang3="deu">Enthalten in</text>
+    <text xml:lang="pt" lang3="por">Contido em</text>
+    <text xml:lang="sl" lang3="slv">Vsebovan v</text>
+    <text xml:lang="ja" lang3="jpn">上位</text>
+    <text xml:lang="zh-TW">可包含在於</text>
+    <text xml:lang="no" lang3="nor">Er en del av</text>
+    <text xml:lang="th" lang3="tha">บรรจุอยู่ใน</text>
+    <text xml:lang="fr" lang3="fra">Contenu dans</text>
+    <text xml:lang="it" lang3="ita">Contenuto in</text>
+    <text xml:lang="es" lang3="spa">Contenido en</text>
+    <text xml:lang="ko" lang3="kor">에 의해 포함된</text>
+  </entry>
+  <entry>
+    <key>Compact to XML format</key>
+    <text xml:lang="ca" lang3="cat">De format compacte a XML</text>
+    <text xml:lang="en" lang3="eng">Compact to XML format</text>
+    <text xml:lang="zh-TW">簡潔式轉到XML式</text>
+    <text xml:lang="it" lang3="ita">Compatta in formato XML</text>
+    <text xml:lang="fr" lang3="fra">Transformer en syntaxe XML</text>
+    <text xml:lang="pt" lang3="por">De Compact para formato XML</text>
+    <text xml:lang="ja" lang3="jpn">XML表記</text>
+    <text xml:lang="es" lang3="spa">De formato compacto a XML</text>
+    <text xml:lang="de" lang3="deu">Vom kompakten zum XML-Format</text>
+    <text xml:lang="ko" lang3="kor">XML 형식에 따른 규약?</text>
+  </entry>
+  <entry>
+    <key>XML format to compact</key>
+    <text xml:lang="ca" lang3="cat">De format XML a compacte</text>
+    <text xml:lang="en" lang3="eng">XML format to compact</text>
+    <text xml:lang="fr" lang3="fra">Transformer en syntaxe compact</text>
+    <text xml:lang="zh-TW">XML式轉到簡潔式</text>
+    <text xml:lang="it" lang3="ita">Formato XML da compattare</text>
+    <text xml:lang="pt" lang3="por">De formato XML para Compact</text>
+    <text xml:lang="ja" lang3="jpn">簡易表記</text>
+    <text xml:lang="es" lang3="spa">De formato XML a compacto</text>
+    <text xml:lang="de" lang3="deu">Vom XML-Format zum kompakten</text>
+    <text xml:lang="ko" lang3="kor">규약에 대한 XML 형식?</text>
+  </entry>
+  <entry>
+    <key>Empty element</key>
+    <text xml:lang="ca" lang3="cat">Element buit</text>
+    <text xml:lang="en" lang3="eng">Empty element</text>
+    <text xml:lang="fr" lang3="fra">Elément vide</text>
+    <text xml:lang="zh-TW">空白元素</text>
+    <text xml:lang="it" lang3="ita">Elemento vuoto</text>
+    <text xml:lang="pt" lang3="por">Elemento vazio</text>
+    <text xml:lang="ja" lang3="jpn">空要素</text>
+    <text xml:lang="es" lang3="spa">Elemento vacío</text>
+    <text xml:lang="de" lang3="deu">Leeres Element</text>
+    <text xml:lang="ko" lang3="kor">공백 요소</text>
+  </entry>
+  <entry>
+    <key>Character data only</key>
+    <text xml:lang="ca" lang3="cat">Sols dades de caràcters</text>
+    <text xml:lang="en" lang3="eng">Character data only</text>
+    <text xml:lang="fr" lang3="fra">Des données textuelles uniquement</text>
+    <text xml:lang="zh-TW">僅文字符號資料</text>
+    <text xml:lang="it" lang3="ita">Ammessi soltanto caratteri di testo</text>
+    <text xml:lang="ja" lang3="jpn">文字データのみ</text>
+    <text xml:lang="es" lang3="spa">Sólo datos de caracteres</text>
+    <text xml:lang="de" lang3="deu">Nur Zeichen</text>
+    <text xml:lang="ko" lang3="kor">문자 자료만 허용</text>
+  </entry>
+  <entry>
+    <key>separated by whitespace</key>
+    <text xml:lang="ca" lang3="cat">separat per espai en blanc</text>
+    <text xml:lang="en" lang3="eng">separated by whitespace</text>
+    <text xml:lang="fr" lang3="fra">séparé par un espace</text>
+    <text xml:lang="zh-TW">以空白鍵隔開</text>
+    <text xml:lang="it" lang3="ita">separato da spazio bianco</text>
+    <text xml:lang="pt" lang3="por">separado por espaços</text>
+    <text xml:lang="ja" lang3="jpn">空白文字で区切られる</text>
+    <text xml:lang="es" lang3="spa">separado por espacio en blanco</text>
+    <text xml:lang="de" lang3="deu">Durch Leerzeichen getrennt</text>
+    <text xml:lang="ko" lang3="kor">공백문자로 분리됨</text>
+  </entry>
+  <entry>
+    <key>Text body</key>
+    <text xml:lang="ca" lang3="cat">Cos del text</text>
+    <text xml:lang="en" lang3="eng">Text body</text>
+    <text xml:lang="fr" lang3="fra">Corps du texte</text>
+    <text xml:lang="zh-TW">正文</text>
+    <text xml:lang="it" lang3="ita">Corpo del testo</text>
+    <text xml:lang="pt" lang3="por">Texto</text>
+    <text xml:lang="ja" lang3="jpn">本文</text>
+    <text xml:lang="es" lang3="spa">Cuerpo del texto</text>
+    <text xml:lang="de" lang3="deu">Textkörper</text>
+    <text xml:lang="ko" lang3="kor">텍스트 본문</text>
+  </entry>
+  <entry>
+    <key>Back Matter</key>
+    <text xml:lang="ca" lang3="cat">Material final</text>
+    <text xml:lang="en" lang3="eng">Back Matter</text>
+    <text xml:lang="fr" lang3="fra">Annexes</text>
+    <text xml:lang="zh-TW">正文後資訊</text>
+    <text xml:lang="ja" lang3="jpn">後付</text>
+    <text xml:lang="it" lang3="ita">Sezioni conclusive</text>
+    <text xml:lang="pt" lang3="por">Anexos</text>
+    <text xml:lang="es" lang3="spa">Material final</text>
+    <text xml:lang="de" lang3="deu">Nachspann</text>
+    <text xml:lang="ko" lang3="kor">권말 부분</text>
+  </entry>
+  <entry>
+    <key>Front Matter</key>
+    <text xml:lang="ca" lang3="cat">Material preliminar</text>
+    <text xml:lang="en" lang3="eng">Front Matter</text>
+    <text xml:lang="fr" lang3="fra">Pièces liminaires</text>
+    <text xml:lang="zh-TW">正文前資訊</text>
+    <text xml:lang="it" lang3="ita">Sezioni preliminari</text>
+    <text xml:lang="pt" lang3="por">Front Matter</text>
+    <text xml:lang="ja" lang3="jpn">前付</text>
+    <text xml:lang="es" lang3="spa">Material preliminar</text>
+    <text xml:lang="de" lang3="deu">Vorspann</text>
+    <text xml:lang="ko" lang3="kor">책 앞부분</text>
+  </entry>
+  <entry>
+    <key>Getting the most recent version</key>
+    <text xml:lang="ca" lang3="cat">Obtenir la versió més recent</text>
+    <text xml:lang="en" lang3="eng">Getting the most recent version</text>
+    <text xml:lang="fr" lang3="fra">Obtenir la dernière version</text>
+    <text xml:lang="zh-TW">取得最新版本</text>
+    <text xml:lang="it" lang3="ita">Otteni la versione più recente</text>
+    <text xml:lang="pt" lang3="por">Como obter a versão mais recente</text>
+    <text xml:lang="ja" lang3="jpn">最新版の入手方法</text>
+    <text xml:lang="es" lang3="spa">Obtener la versión más reciente</text>
+    <text xml:lang="de" lang3="deu">Die aktuellste Version holen</text>
+    <text xml:lang="ko" lang3="kor">최신 버전 얻기</text>
+  </entry>
+  <entry>
+    <key>Sourceforge Subversion Repository</key>
+    <text xml:lang="ca" lang3="cat">Magatzem Subversion en Sourceforge</text>
+    <text xml:lang="en" lang3="eng">Sourceforge Subversion Repository</text>
+    <text xml:lang="fr" lang3="fra">Répertoire Subversion dans Sourceforge</text>
+    <text xml:lang="zh-TW">P5原始檔典藏@Sourceforge</text>
+    <text xml:lang="it" lang3="ita">Sourceforge Subversion Repository</text>
+    <text xml:lang="pt" lang3="por">Sourceforge Subversion Repository</text>
+    <text xml:lang="ja" lang3="jpn">各種データ(Sourceforge)</text>
+    <text xml:lang="es" lang3="spa">Almacén Subversion en Sourceforge</text>
+    <text xml:lang="de" lang3="deu">Sourceforge Subversion Repositorium</text>
+    <text xml:lang="ko" lang3="kor">소스 하위 버전 저장소 Sourceforge Subversion Repository</text>
+  </entry>
+  <entry>
+    <key>BugsFeatures</key>
+    <text xml:lang="ca" lang3="cat">Informes d'errors, peticions de característiques</text>
+    <text xml:lang="en" lang3="eng">Bug Reports, Feature Requests, etc.</text>
+    <text xml:lang="ja" lang3="jpn">バグ報告や要望など</text>
+    <text xml:lang="fr" lang3="fra">Rapports d'erreurs, demandes de modifications etc</text>
+    <text xml:lang="zh-TW">錯誤回報、功能要求等等。</text>
+    <text xml:lang="it" lang3="ita">Liste di bug, Richieste di nuove funzionalità, etc.</text>
+    <text xml:lang="pt" lang3="por">Relatório de Erros, Pedidos de Modificaçoes, etc.</text>
+    <text xml:lang="es" lang3="spa">Informes de errores, peticiones de características</text>
+    <text xml:lang="de" lang3="deu">Fehlerberichte, Anfragen zu Funktionen, etc.</text>
+    <text xml:lang="ko" lang3="kor">버그 보고, 특성 요구 등</text>
+  </entry>
+  <entry>
+    <key>Some Popular Sections</key>
+    <text xml:lang="ca" lang3="cat">Seccions populars</text>
+    <text xml:lang="ja" lang3="jpn">代表的な章</text>
+    <text xml:lang="en" lang3="eng">Some Popular Sections</text>
+    <text xml:lang="fr" lang3="fra">Parties les plus visitées</text>
+    <text xml:lang="zh-TW">一些受歡迎的章節</text>
+    <text xml:lang="it" lang3="ita">Alcune fra le sezioni più richieste</text>
+    <text xml:lang="pt" lang3="por">Algumas Secçoes Populares</text>
+    <text xml:lang="es" lang3="spa">Secciones populares</text>
+    <text xml:lang="de" lang3="deu">Einige beliebte Sektionen</text>
+    <text xml:lang="ko" lang3="kor">인기있는 절</text>
+  </entry>
+  <entry>
+    <key>GuidelinesTEI</key>
+    <text xml:lang="ca" lang3="cat">Directrius per a la codificació i l'intercanvi de textos electrònics</text>
+    <text xml:lang="ja" lang3="jpn">TEIガイドライン</text>
+    <text xml:lang="en" lang3="eng">Guidelines for Electronic Text Encoding and Interchange</text>
+    <text xml:lang="fr" lang3="fra">Principes directeurs pour l'encodage et l'échange de textes électroniques</text>
+    <text xml:lang="zh-TW">TEI指引</text>
+    <text xml:lang="it" lang3="ita">Linee guida per la codifica e l'interscambio del testo elettronico</text>
+    <text xml:lang="pt" lang3="por">Instruçoes para Electronic Text Encoding and Interchange</text>
+    <text xml:lang="es" lang3="spa">Directrices para la codificación y el intercambio de textos electrónicos</text>
+    <text xml:lang="de" lang3="deu">Richtlinien für die Auszeichnung und den Austausch elektronischer Texte</text>
+    <text xml:lang="ko" lang3="kor">전자 텍스트 부호화 및 교환에 대한 지침</text>
+  </entry>
+  <entry>
+    <key>edited by</key>
+    <text xml:lang="ca" lang3="cat">editat per</text>
+    <text xml:lang="en" lang3="eng">edited by</text>
+    <text xml:lang="fr" lang3="fra">édité par</text>
+    <text xml:lang="zh-TW">編輯者：</text>
+    <text xml:lang="it" lang3="ita">edito da</text>
+    <text xml:lang="pt" lang3="por">editado por</text>
+    <text xml:lang="ja" lang3="jpn">監修</text>
+    <text xml:lang="es" lang3="spa">editado por</text>
+    <text xml:lang="de" lang3="deu">ediert von</text>
+    <text xml:lang="ko" lang3="kor">에 의해 편집</text>
+  </entry>
+  <entry>
+    <key>Versions of the Guidelines</key>
+    <text xml:lang="ca" lang3="cat">Versions de les directrius</text>
+    <text xml:lang="en" lang3="eng">Versions of the Guidelines</text>
+    <text xml:lang="fr" lang3="fra">Versions des Principes directeurs</text>
+    <text xml:lang="zh-TW">指引版本</text>
+    <text xml:lang="it" lang3="ita">Versioni delle Linee guida</text>
+    <text xml:lang="pt" lang3="por">Versoes das instruçoes</text>
+    <text xml:lang="ko" lang3="kor">지침 버전</text>
+    <text xml:lang="ja" lang3="jpn">ガイドラインについて</text>
+    <text xml:lang="es" lang3="spa">Versiones de las directrices</text>
+    <text xml:lang="de" lang3="deu">Versionen der Richtlinien</text>
+  </entry>
+  <entry>
+    <key>Sorted alphabetically</key>
+    <text xml:lang="ca" lang3="cat">Ordenat alfabèticament</text>
+    <text xml:lang="en" lang3="eng">Sorted alphabetically</text>
+    <text xml:lang="it" lang3="ita">In ordine alfabetico</text>
+    <text xml:lang="zh-TW">按羅馬字母排序</text>
+    <text xml:lang="fr" lang3="fra">Trié alphabétiquement</text>
+    <text xml:lang="pt" lang3="por">Ordenado alfabeticamente</text>
+    <text xml:lang="ja" lang3="jpn">アルファベット順</text>
+    <text xml:lang="es" lang3="spa">Ordenado alfabéticamente</text>
+    <text xml:lang="de" lang3="deu">Alphabetisch geordnet</text>
+    <text xml:lang="ko" lang3="kor">알파벳 순</text>
+  </entry>
+  <entry>
+    <key>Show all</key>
+    <text xml:lang="ca" lang3="cat">Mostrar tot</text>
+    <text xml:lang="en" lang3="eng">Show all</text>
+    <text xml:lang="it" lang3="ita">Mostra tutto</text>
+    <text xml:lang="zh-TW">全部顯示</text>
+    <text xml:lang="fr" lang3="fra">Toute la liste</text>
+    <text xml:lang="pt" lang3="por">Mostre tudo</text>
+    <text xml:lang="ja" lang3="jpn">一括表示</text>
+    <text xml:lang="es" lang3="spa">Mostrar todo</text>
+    <text xml:lang="de" lang3="deu">Alle anzeigen</text>
+    <text xml:lang="ko" lang3="kor">모두 보기</text>
+  </entry>
+  <entry>
+    <key>Show by module</key>
+    <text xml:lang="ca" lang3="cat">Mostrar per mòdul</text>
+    <text xml:lang="en" lang3="eng">Show by module</text>
+    <text xml:lang="it" lang3="ita">Mostra modulo per modulo</text>
+    <text xml:lang="zh-TW">按模組顯示</text>
+    <text xml:lang="fr" lang3="fra">Par module</text>
+    <text xml:lang="pt" lang3="por">Mostre por módulo</text>
+    <text xml:lang="ja" lang3="jpn">モジュール別表示</text>
+    <text xml:lang="es" lang3="spa">Mostrar por módulo</text>
+    <text xml:lang="de" lang3="deu">Nach Modulen geordnet anzeigen</text>
+    <text xml:lang="ko" lang3="kor">모듈로 보기</text>
+  </entry>
+  <entry>
+    <key>occurrences of</key>
+    <text xml:lang="ca" lang3="cat">aparicions de</text>
+    <text xml:lang="en" lang3="eng">occurrences of</text>
+    <text xml:lang="es" lang3="spa">apariciones de</text>
+    <text xml:lang="de" lang3="deu">Vorkommen von</text>
+    <text xml:lang="it" lang3="ita">occorrenze di</text>
+    <text xml:lang="zh-TW">次可出現:</text>
+    <text xml:lang="ko" lang3="kor">출현</text>
+  </entry>
+  <entry>
+    <key>author</key>
+    <text xml:lang="en" lang3="eng">Author</text>
+    <text xml:lang="de" lang3="deu">Verfasser</text>
+    <text xml:lang="fr" lang3="fra">Auteur</text>
+    <text xml:lang="it" lang3="ita">Autore</text>
+    <text xml:lang="ko" lang3="kor">저자</text>
+  </entry>
+  <entry>
+    <key>title</key>
+    <text xml:lang="en" lang3="eng">Title</text>
+    <text xml:lang="de" lang3="deu">Titel</text>
+    <text xml:lang="fr" lang3="fra">Titre</text>
+    <text xml:lang="it" lang3="ita">Titolo</text>
+    <text xml:lang="ko" lang3="kor">제목</text>
+  </entry>
+  <entry>
+    <key>remarks</key>
+    <text xml:lang="en" lang3="eng">Remarks</text>
+    <text xml:lang="de" lang3="deu">Bemerkungen</text>
+    <text xml:lang="fr" lang3="fra">Remarques</text>
+    <text xml:lang="it" lang3="ita">Osservazioni</text>
+    <text xml:lang="ko" lang3="kor">해설</text>
+  </entry>
+  <entry>
+    <key>physDesc</key>
+    <text xml:lang="en" lang3="eng">Physical description</text>
+    <text xml:lang="de" lang3="deu">Äußere Beschreibung</text>
+    <text xml:lang="fr" lang3="fra">Description physique</text>
+    <text xml:lang="it" lang3="ita">Descrizione fisica</text>
+    <text xml:lang="ko" lang3="kor">물리적 기술</text>
+  </entry>
+  <entry>
+    <key>watermarks</key>
+    <text xml:lang="en" lang3="eng">Watermarks</text>
+    <text xml:lang="de" lang3="deu">Wasserzeichen</text>
+    <text xml:lang="fr" lang3="fra">Filigrane</text>
+    <text xml:lang="it" lang3="ita">Filigrana</text>
+    <text xml:lang="ko" lang3="kor">투명 표식</text>
+  </entry>
+  <entry>
+    <key>musicNotations</key>
+    <text xml:lang="en" lang3="eng">Musical notations</text>
+    <text xml:lang="de" lang3="deu">Musikalische Notationen</text>
+    <text xml:lang="fr" lang3="fra">Notation musicale</text>
+    <text xml:lang="it" lang3="ita">Notazioni musicali</text>
+    <text xml:lang="ko" lang3="kor">음악 표기법</text>
+  </entry>
+  <entry>
+    <key>history</key>
+    <text xml:lang="en" lang3="eng">History of the manuscript</text>
+    <text xml:lang="de" lang3="deu">Geschichte der Handschrift</text>
+    <text xml:lang="fr" lang3="fra">Histoire du manuscrit</text>
+    <text xml:lang="it" lang3="ita">Storia del manoscritto</text>
+    <text xml:lang="ko" lang3="kor">필사본 역사</text>
+  </entry>
+  <entry>
+    <key>availability</key>
+    <text xml:lang="en" lang3="eng">With kind permission of </text>
+    <text xml:lang="fr" lang3="fra">With kind permission of </text>
+    <text xml:lang="it" lang3="ita">With kind permission of </text>
+    <text xml:lang="de" lang3="deu">Mit freundlicher Genehmigung von</text>
+    <text xml:lang="ko" lang3="kor">친절한 허용</text>
+  </entry>
+  <entry>
+    <key>acquisition</key>
+    <text xml:lang="en" lang3="eng">Acquisition of the manuscript</text>
+    <text xml:lang="fr" lang3="fra">Acquisition du manuscrit</text>
+    <text xml:lang="it" lang3="ita">Acquisizione del manoscritto</text>
+    <text xml:lang="de" lang3="deu">Erwerb der Handschrift</text>
+    <text xml:lang="ko" lang3="kor">필사본의의 입수</text>
+  </entry>
+  <entry>
+    <key>additions</key>
+    <text xml:lang="en" lang3="eng">Additions</text>
+    <text xml:lang="fr" lang3="fra">Compléments à posteriori</text>
+    <text xml:lang="it" lang3="ita">Aggiunte</text>
+    <text xml:lang="de" lang3="deu">Spätere Ergänzungen</text>
+    <text xml:lang="ko" lang3="kor">추가사항</text>
+  </entry>
+  <entry>
+    <key>altIdentifier[@type="formerShelfmark"]</key>
+    <text xml:lang="en" lang3="eng">Former shelfmark</text>
+    <text xml:lang="fr" lang3="fra">Cote</text>
+    <text xml:lang="it" lang3="ita">segnatura</text>
+    <text xml:lang="de" lang3="deu">Frühere Signatur</text>
+    <text xml:lang="ko" lang3="kor">이전 서가기호</text>
+  </entry>
+  <entry>
+    <key>msPart</key>
+    <text xml:lang="en" lang3="eng">Manuscript part</text>
+    <text xml:lang="fr" lang3="fra">Partie du manuscrit</text>
+    <text xml:lang="it" lang3="ita">Sezione del manoscritto</text>
+    <text xml:lang="de" lang3="deu">Handschriftenteil</text>
+    <text xml:lang="ko" lang3="kor">필사본 부분</text>
+  </entry>
+  <entry>
+    <key>binding</key>
+    <text xml:lang="en" lang3="eng">Binding</text>
+    <text xml:lang="fr" lang3="fra">Couverture</text>
+    <text xml:lang="it" lang3="ita">Legatura</text>
+    <text xml:lang="de" lang3="deu">Einband</text>
+    <text xml:lang="ko" lang3="kor">제책</text>
+  </entry>
+  <entry>
+    <key>collation</key>
+    <text xml:lang="en" lang3="eng">Collation</text>
+    <text xml:lang="fr" lang3="fra">Composition des fascicules</text>
+    <text xml:lang="it" lang3="ita">Composizione dei fascicoli</text>
+    <text xml:lang="de" lang3="deu">Lagenstruktur</text>
+    <text xml:lang="ko" lang3="kor">쪽 순서 대조</text>
+  </entry>
+  <entry>
+    <key>condition</key>
+    <text xml:lang="en" lang3="eng">Condition</text>
+    <text xml:lang="fr" lang3="fra">Etat</text>
+    <text xml:lang="it" lang3="ita">Condizioni</text>
+    <text xml:lang="de" lang3="deu">Zustand</text>
+    <text xml:lang="ko" lang3="kor">상태</text>
+  </entry>
+  <entry>
+    <key>decoDesc</key>
+    <text xml:lang="en" lang3="eng">Decoration</text>
+    <text xml:lang="fr" lang3="fra">Reliure d'art</text>
+    <text xml:lang="it" lang3="ita">Decorazione</text>
+    <text xml:lang="de" lang3="deu">Buchschmuck</text>
+    <text xml:lang="ko" lang3="kor">장식</text>
+  </entry>
+  <entry>
+    <key>extent</key>
+    <text xml:lang="en" lang3="eng">Extent</text>
+    <text xml:lang="fr" lang3="fra">Volume</text>
+    <text xml:lang="it" lang3="ita">Dimensioni</text>
+    <text xml:lang="de" lang3="deu">Umfang</text>
+    <text xml:lang="ko" lang3="kor">분량</text>
+  </entry>
+  <entry>
+    <key>foliation</key>
+    <text xml:lang="en" lang3="eng">Foliation</text>
+    <text xml:lang="fr" lang3="fra">Numérotation des pages</text>
+    <text xml:lang="it" lang3="ita">Numerazione delle pagine</text>
+    <text xml:lang="de" lang3="deu">Seitennummerierung</text>
+    <text xml:lang="ko" lang3="kor">쪽수</text>
+  </entry>
+  <entry>
+    <key>handDesc</key>
+    <text xml:lang="en" lang3="eng">Writing and hands</text>
+    <text xml:lang="fr" lang3="fra">Type d'écritures et copistes</text>
+    <text xml:lang="it" lang3="ita">Tipo di scrittura e e mani</text>
+    <text xml:lang="de" lang3="deu">Schrift und Hände</text>
+    <text xml:lang="ko" lang3="kor">집필과 필체</text>
+  </entry>
+  <entry>
+    <key>msDesc/head/title</key>
+    <text xml:lang="en" lang3="eng">Author and title</text>
+    <text xml:lang="fr" lang3="fra">Auteur et titre</text>
+    <text xml:lang="it" lang3="ita">Autore e titolo</text>
+    <text xml:lang="de" lang3="deu">Autor und Titel</text>
+    <text xml:lang="ko" lang3="kor">저자와 제목</text>
+  </entry>
+  <entry>
+    <key>origPlace</key>
+    <text xml:lang="en" lang3="eng">Place of origin</text>
+    <text xml:lang="fr" lang3="fra">Origine</text>
+    <text xml:lang="it" lang3="ita">Luogo di origine</text>
+    <text xml:lang="de" lang3="deu">Entstehungsort</text>
+    <text xml:lang="ko" lang3="kor">원본 생산 장소</text>
+  </entry>
+  <entry>
+    <key>origDate</key>
+    <text xml:lang="en" lang3="eng">Date of origin</text>
+    <text xml:lang="fr" lang3="fra">Période</text>
+    <text xml:lang="it" lang3="ita">Datazione</text>
+    <text xml:lang="de" lang3="deu">Entstehungszeit</text>
+    <text xml:lang="ko" lang3="kor">원본 생산 날짜 </text>
+  </entry>
+  <entry>
+    <key>msDesc/head/note[@type="respStmt"]</key>
+    <text xml:lang="en" lang3="eng">Writer</text>
+    <text xml:lang="fr" lang3="fra">Scribe</text>
+    <text xml:lang="it" lang3="ita">Copista</text>
+    <text xml:lang="de" lang3="deu">Schreiber</text>
+    <text xml:lang="ko" lang3="kor">작가</text>
+  </entry>
+  <entry>
+    <key>provenance</key>
+    <text xml:lang="en" lang3="eng">Provenance of the manuscript</text>
+    <text xml:lang="fr" lang3="fra">Provenance du manuscrit</text>
+    <text xml:lang="it" lang3="ita">Provenienza del manoscritto</text>
+    <text xml:lang="de" lang3="deu">Provenienz der Handschrift</text>
+    <text xml:lang="ko" lang3="kor">필사본의 출처</text>
+  </entry>
+  <entry>
+    <key>layoutDesc | layout</key>
+    <text xml:lang="en" lang3="eng">Page layout</text>
+    <text xml:lang="fr" lang3="fra">Mise en page</text>
+    <text xml:lang="it" lang3="ita">Disposizione della pagina</text>
+    <text xml:lang="de" lang3="deu">Seiteneinrichtung</text>
+    <text xml:lang="ko" lang3="kor">페이지 레이아웃</text>
+  </entry>
+  <entry>
+    <key>msDesc/additional/listBibl</key>
+    <text xml:lang="en" lang3="eng">Bibliography</text>
+    <text xml:lang="fr" lang3="fra">Bibliographie</text>
+    <text xml:lang="it" lang3="ita">Bibliografia</text>
+    <text xml:lang="de" lang3="deu">Literaturverzeichnis</text>
+    <text xml:lang="ko" lang3="kor">서지항목</text>
+  </entry>
+  <entry>
+    <key>measure[@type="leaveSize"]</key>
+    <text xml:lang="en" lang3="eng">Format</text>
+    <text xml:lang="fr" lang3="fra">Format</text>
+    <text xml:lang="it" lang3="ita">Formato</text>
+    <text xml:lang="de" lang3="deu">Format</text>
+    <text xml:lang="ko" lang3="kor">형식</text>
+  </entry>
+  <entry>
+    <key>msContents</key>
+    <text xml:lang="en" lang3="eng">Contents</text>
+    <text xml:lang="fr" lang3="fra">Sommaire</text>
+    <text xml:lang="it" lang3="ita">Contenuto</text>
+    <text xml:lang="de" lang3="deu">Inhaltsangabe</text>
+    <text xml:lang="ko" lang3="kor">내용</text>
+  </entry>
+  <entry>
+    <key>origin</key>
+    <text xml:lang="en" lang3="eng">Origin of the manuscript</text>
+    <text xml:lang="fr" lang3="fra">Parution du manuscrit</text>
+    <text xml:lang="it" lang3="ita">Origine del manoscritto</text>
+    <text xml:lang="de" lang3="deu">Entstehung der Handschrift</text>
+    <text xml:lang="ko" lang3="kor">필사본의 유래</text>
+  </entry>
+  <entry>
+    <key>support</key>
+    <text xml:lang="en" lang3="eng">Support</text>
+    <text xml:lang="fr" lang3="fra">Support de substitution</text>
+    <text xml:lang="it" lang3="ita">Supporto materiale</text>
+    <text xml:lang="de" lang3="deu">Beschreibstoff</text>
+    <text xml:lang="ko" lang3="kor">지원</text>
+  </entry>
+  <entry>
+    <key>surrogates</key>
+    <text xml:lang="en" lang3="eng">Surrogates</text>
+    <text xml:lang="fr" lang3="fra">Surrogates</text>
+    <text xml:lang="it" lang3="ita">Surrogates</text>
+    <text xml:lang="de" lang3="deu">Sekundärformen</text>
+    <text xml:lang="ko" lang3="kor">대용</text>
+  </entry>
+  <entry>
+    <key>textLang</key>
+    <text xml:lang="en" lang3="eng">Main language</text>
+    <text xml:lang="fr" lang3="fra">Langue principale</text>
+    <text xml:lang="it" lang3="ita">Lingua principale</text>
+    <text xml:lang="de" lang3="deu">Hauptsprache</text>
+    <text xml:lang="ko" lang3="kor">주 언어</text>
+  </entry>
+  <entry>
+    <key>and</key>
+    <text xml:lang="en" lang3="eng">and</text>
+    <text xml:lang="de" lang3="deu">und</text>
+    <text xml:lang="es" lang3="spa">y</text>
+  </entry>
+</i18n>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/i18n.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/epub3/build-to.xml
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/epub3/build-to.xml	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/epub3/build-to.xml	(revision 258)
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<project basedir="." default="dist" name="teitoepub3">
+<!--
+	This library is free software; you can redistribute it and/or
+	modify it under the terms of the GNU Lesser General Public
+	License as published by the Free Software Foundation; either
+	version 2.1 of the License, or (at your option) any later version.
+	
+	This library 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
+	Lesser General Public License for more details.
+	
+	You should have received a copy of the GNU Lesser General Public
+	License along with this library; if not, write to the Free Software
+	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+	
+        Id: $Id: build-to.xml 10057 2012-01-21 16:57:14Z rahtz $
+        Copyright: 2011, TEI Consortium<
+-->
+  <!--
+ Convert TEI documents into ePUB files.
+ -->
+  <!-- Path to TEI XML file. -->
+  <property name="inputFile" value=""/>
+  <!-- Path where the output ePUB file will be saved. -->
+  <property name="outputFile" value=""/>
+  <!-- which profile -->
+  <property name="profile" value="default"/>
+  <!-- where does oxygen keep stuff -->
+  <property name="oxygenlib" value=""/>
+  <!-- Stylesheet for transformation -->
+  <property name="stylesheetFile"
+	    value="../profiles/${profile}/epub3/to.xsl"/>
+  <property name="listgraphics" value="../tools/makegraphicsanttask.xsl"/>
+  <dirname property="inputFileDir" file="${inputFile}"/>
+  <dirname property="outputDir" file="${outputFile}"/>
+  <property name="outputTempDir" value="${outputDir}/temp-dir-for-ant"/>
+  <path id="classpath">
+    <pathelement path="${java.class.path}"/>
+  </path>
+  <import file="../odds2/build-to.xml"/>
+  <target name="setup">
+    <delete dir="${outputTempDir}"/>
+    <mkdir dir="${outputTempDir}"/>
+  </target>
+  <target name="dist" depends="setup,odd,notodd,convert,cleanup"/>
+
+  <target name="convert">
+    <!-- Recreate temporary output directory -->
+    <!-- The transformation for EPUB output. -->
+    <echo level="info">XSLT generate epub3 files</echo>
+    <xslt force="yes" style="${stylesheetFile}" in="${outputTempDir}/tmp2.xml" out="${outputTempDir}/OPS/index.xhtml" classpath="classpath">
+      <xmlcatalog>
+        <catalogpath>
+          <pathelement location="../../../../catalog.xml"/>
+          <pathelement location="../../../../../xhtml11/dtd/xhtmlcatalog.xml"/>
+        </catalogpath>
+      </xmlcatalog>
+      <factory name="net.sf.saxon.TransformerFactoryImpl"/>
+      <classpath location="${oxygenlib}/saxon9ee.jar"/>
+      <param name="directory" expression="file:///${outputTempDir}"/>
+      <param name="inputDir" expression="${inputFileDir}/"/>
+      <param name="fixgraphicsurl" expression="true"/>
+      <!-- supply unique URN for ebook-->
+      <param name="uid" expression="${uid}" if="uid"/>
+      <!-- set splitting level-->
+      <param name="splitLevel" expression="${splitLevel}" if="splitLevel"/>
+      <!-- supply name of publisher for ebook-->
+      <param name="publisher" expression="${publisher}" if="publisher"/>
+      <!-- supply subject/category for ebook-->
+      <param name="subject" expression="${subject}" if="subject"/>
+      <!-- supply name of JPEG file for ebook cover-->
+      <param name="coverimage" expression="${coverimage}" if="coverimage"/>
+      <!-- supply name of CSS file-->
+      <param name="cssFile" expression="${cssFile}" if="cssFile"/>
+      <!-- name of media overlay file -->
+      <param name="mediaoverlay" expression="${mediaoverlay}" if="mediaoverlay"/>
+      <!-- file per page -->
+      <param name="filePerPage" expression="${filePerPage}" if="filePerPage"/>
+      <!-- epub viewport -->
+      <param name="viewPortHeight" expression="${viewPortHeight}" if="viewPortHeight"/>
+      <param name="viewPortWidth" expression="${viewPortWidth}" if="viewPortWidth"/>
+      <!-- supply name of language-->
+      <param name="lang" expression="${lang}" if="lang"/>
+      <!-- emit some diagnostics"-->
+      <param name="debug" expression="${debug}" if="debug"/>
+      <!-- be verbose-->
+      <param name="verbose" expression="${verbose}" if="verbose"/>
+      <!-- disable compression on the output ZIP -->
+      <param name="nocompress" expression="${nocompress}" if="nocompress"/>
+    </xslt>
+    <echo level="info">Get names of graphics files and write an ant task</echo>
+    <xslt force="yes" style="${listgraphics}" classpath="classpath" in="${outputTempDir}/tmp2.xml" out="${outputTempDir}/copy.xml">
+      <xmlcatalog>
+        <catalogpath>
+          <pathelement location="../../../../catalog.xml"/>
+          <pathelement location="../../../../../xhtml11/dtd/xhtmlcatalog.xml"/>
+        </catalogpath>
+      </xmlcatalog>
+      <factory name="net.sf.saxon.TransformerFactoryImpl"/>
+      <classpath location="${oxygenlib}/saxon9ee.jar"/>
+      <param name="inputDir" expression="${inputFileDir}"/>
+      <param name="mediaDir" expression="OPS/media"/>
+      <param name="mediaoverlay" expression="${mediaoverlay}" if="mediaoverlay"/>
+      <param name="filePerPage" expression="${filePerPage}" if="filePerPage"/>
+    </xslt>
+    <echo level="info">Copy image files</echo>
+    <ant antfile="${outputTempDir}/copy.xml"/>
+    <echo level="info">ZIP: put files from ${outputTempDir} together into ${outputFile}</echo>
+    <delete file="${outputFile}"/>
+    <zip destfile="${outputFile}" basedir="${outputTempDir}"
+	 compress="true" excludes="mimetype,tmp1.xml,tmp2.xml,copy.xml"/>
+    <zip destfile="${outputFile}" basedir="${outputTempDir}" includes="mimetype" update="true" keepcompression="true" compress="false"/>
+  </target>
+
+  <target name="cleanup" unless="debug">  
+    <delete dir="${outputTempDir}"/>
+  </target>
+</project>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/epub3/build-to.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/epub3/tei-to-epub3.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/epub3/tei-to-epub3.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/epub3/tei-to-epub3.xsl	(revision 258)
@@ -0,0 +1,885 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:iso="http://www.iso.org/ns/1.0" xmlns="http://www.w3.org/1999/xhtml" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:tei="http://www.tei-c.org/ns/1.0" xmlns:teix="http://www.tei-c.org/ns/Examples" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ncx="http://www.daisy.org/z3986/2005/ncx/" version="2.0" exclude-result-prefixes="iso tei teix dc html ncx" xpath-default-namespace="http://www.tei-c.org/ns/1.0">
+  <xsl:import href="../html5/tei.xsl"/>
+  <xsl:import href="../epub/epub-common.xsl"/>
+  <xsl:import href="../epub/epub-preflight.xsl"/>
+  <xsl:output method="xml" encoding="utf-8" doctype-system="" indent="no"/>
+  <xsl:key match="tei:graphic[not(ancestor::teix:egXML)]" use="1" name="G"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+    <desc>
+      <p>
+	TEI stylesheet for making ePub output. A lot learnt from
+	http://www.hxa.name/articles/content/epub-guide_hxa7241_2007.xhtml and
+	the stylesheets of the NZETC.
+      </p>
+      <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+      <p>Author: See AUTHORS</p>
+      <p>Id: $Id: tei-to-epub3.xsl 10057 2012-01-21 16:57:14Z rahtz $</p>
+      <p>Copyright: 2008, TEI Consortium</p>
+    </desc>
+  </doc>
+  <xsl:param name="opfPackageVersion">3.0</xsl:param>
+  <xsl:param name="STDOUT">false</xsl:param>
+  <xsl:param name="autoHead">true</xsl:param>
+  <xsl:param name="autoToc">true</xsl:param>
+  <xsl:param name="bottomNavigationPanel">false</xsl:param>
+  <xsl:param name="coverimage"/>
+  <xsl:param name="createanttask">false</xsl:param>
+  <xsl:param name="cssFile">../tei.css</xsl:param>
+  <xsl:param name="cssODDFile">../odd.css</xsl:param>
+  <xsl:param name="cssPrintFile">../epub-print.css</xsl:param>
+  <xsl:param name="debug">false</xsl:param>
+  <xsl:param name="directory">.</xsl:param>
+  <xsl:param name="doctypePublic"/>
+  <xsl:param name="doctypeSystem"/>
+  <xsl:param name="fixgraphicsurl">false</xsl:param>
+  <xsl:param name="inputDir">.</xsl:param>
+  <xsl:param name="institution"/>
+  <xsl:param name="linkPanel">false</xsl:param>
+  <xsl:param name="odd">false</xsl:param>
+  <xsl:param name="outputDir"><xsl:value-of select="$directory"/>/OPS</xsl:param>
+  <xsl:param name="outputMethod">xml</xsl:param>
+  <xsl:param name="outputSuffix">.xhtml</xsl:param>
+  <xsl:param name="outputTarget">epub3</xsl:param>
+  <xsl:param name="publisher"/>
+  <xsl:param name="splitLevel">0</xsl:param>
+  <xsl:param name="subject"/>
+  <xsl:param name="tocDepth">5</xsl:param>
+  <xsl:param name="tocFront">true</xsl:param>
+  <xsl:param name="topNavigationPanel">false</xsl:param>
+  <xsl:param name="uid"/>
+  <xsl:param name="useHeaderFrontMatter">false</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>(extensible) wrapper for root element</desc>
+  </doc>
+  <xsl:template match="/">
+    <xsl:call-template name="processTEI"/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>[epub] Override of top-level template. This does most of
+  the work: performing the normal transformation, fixing the links to graphics files so that they are
+  all relative, creating the extra output files, etc</desc>
+  </doc>
+  <xsl:template name="processTEI">
+    <xsl:variable name="stage1">
+      <xsl:apply-templates mode="preflight"/>
+    </xsl:variable>
+    <xsl:for-each select="$stage1">
+      <xsl:call-template name="processTEIHook"/>
+      <xsl:variable name="coverImageOutside">
+        <xsl:choose>
+          <xsl:when test="/tei:TEI/tei:text/tei:front/tei:titlePage[@facs]">
+            <xsl:for-each select="/tei:TEI/tei:text/tei:front/tei:titlePage[@facs][1]">
+              <xsl:for-each select="id(substring(@facs,2))">
+                <xsl:choose>
+                  <xsl:when test="count(tei:graphic)=1">
+                    <xsl:value-of select="tei:graphic/@url"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                    <xsl:value-of select="tei:graphic[2]/@url"/>
+                  </xsl:otherwise>
+                </xsl:choose>
+              </xsl:for-each>
+            </xsl:for-each>
+          </xsl:when>
+          <xsl:when test="not($coverimage='')">
+            <xsl:value-of select="$coverimage"/>
+          </xsl:when>
+        </xsl:choose>
+      </xsl:variable>
+      <xsl:variable name="coverImageInside">
+        <xsl:choose>
+          <xsl:when test="/tei:TEI/tei:text/tei:front/tei:titlePage[@facs]">
+            <xsl:for-each select="/tei:TEI/tei:text/tei:front/tei:titlePage[@facs][1]">
+              <xsl:for-each select="id(substring(@facs,2))">
+                <xsl:value-of select="tei:graphic[1]/@url"/>
+              </xsl:for-each>
+            </xsl:for-each>
+          </xsl:when>
+          <xsl:when test="not($coverimage='')">
+            <xsl:value-of select="$coverimage"/>
+          </xsl:when>
+        </xsl:choose>
+      </xsl:variable>
+      <xsl:choose>
+        <xsl:when test="$splitLevel='-1'">
+          <xsl:apply-templates/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:apply-templates mode="split"/>
+        </xsl:otherwise>
+      </xsl:choose>
+      <xsl:for-each select="*">
+        <xsl:variable name="TOC">
+          <TOC xmlns="http://www.w3.org/1999/xhtml">
+            <xsl:call-template name="mainTOC"/>
+          </TOC>
+        </xsl:variable>
+        <!--
+	    <xsl:result-document href="/tmp/TOC">
+	    <xsl:copy-of select="$TOC"/>
+	    </xsl:result-document>
+-->
+        <xsl:for-each select="tokenize($javascriptFiles,',')">
+          <xsl:variable name="file" select="normalize-space(.)"/>
+          <xsl:variable name="name" select="tokenize($file,'/')[last()]"/>
+          <xsl:if test="$verbose='true'">
+            <xsl:message>write Javascript file <xsl:value-of select="$name"/></xsl:message>
+          </xsl:if>
+          <xsl:result-document method="text" href="{concat($directory,'/OPS/',$name)}">
+            <xsl:for-each select="unparsed-text($file)">
+              <xsl:copy-of select="."/>
+            </xsl:for-each>
+          </xsl:result-document>
+        </xsl:for-each>
+        <xsl:if test="$verbose='true'">
+          <xsl:message>write file OPS/stylesheet.css</xsl:message>
+        </xsl:if>
+        <xsl:result-document method="text" href="{concat($directory,'/OPS/stylesheet.css')}">
+          <xsl:if test="not($cssFile='')">
+            <xsl:if test="$verbose='true'">
+              <xsl:message>reading file <xsl:value-of select="$cssFile"/></xsl:message>
+            </xsl:if>
+            <xsl:for-each select="tokenize(unparsed-text($cssFile),     '\r?\n')">
+              <xsl:call-template name="purgeCSS"/>
+            </xsl:for-each>
+          </xsl:if>
+          <xsl:if test="not($cssSecondaryFile='')">
+            <xsl:if test="$verbose='true'">
+              <xsl:message>reading secondary file <xsl:value-of select="$cssSecondaryFile"/></xsl:message>
+            </xsl:if>
+            <xsl:for-each select="tokenize(unparsed-text($cssSecondaryFile),       '\r?\n')">
+              <xsl:call-template name="purgeCSS"/>
+            </xsl:for-each>
+          </xsl:if>
+          <xsl:if test="$odd='true'">
+            <xsl:if test="$verbose='true'">
+              <xsl:message>reading file <xsl:value-of select="$cssODDFile"/></xsl:message>
+            </xsl:if>
+            <xsl:for-each select="tokenize(unparsed-text($cssODDFile),         '\r?\n')">
+              <xsl:call-template name="purgeCSS"/>
+            </xsl:for-each>
+          </xsl:if>
+          <xsl:if test="$odd='true'">
+            <xsl:if test="$verbose='true'">
+              <xsl:message>reading file <xsl:value-of select="$cssODDFile"/></xsl:message>
+            </xsl:if>
+            <xsl:for-each select="tokenize(unparsed-text($cssODDFile),         '\r?\n')">
+              <xsl:call-template name="purgeCSS"/>
+            </xsl:for-each>
+          </xsl:if>
+          <xsl:if test="$filePerPage='true'">
+            <xsl:text>body { width: </xsl:text>
+            <xsl:value-of select="$viewPortWidth"/>
+            <xsl:text>px;
+ height: </xsl:text>
+            <xsl:value-of select="$viewPortHeight"/>
+            <xsl:text>px;
+}
+img.fullpage {
+position: absolute;
+height: </xsl:text>
+            <xsl:value-of select="$viewPortHeight"/>
+            <xsl:text>px; left:0px; top:0px;}
+</xsl:text>
+          </xsl:if>
+        </xsl:result-document>
+        <xsl:if test="$verbose='true'">
+          <xsl:message>write file OPS/print.css</xsl:message>
+        </xsl:if>
+        <xsl:result-document method="text" href="{concat($directory,'/OPS/print.css')}">
+          <xsl:if test="$verbose='true'">
+            <xsl:message>reading file <xsl:value-of select="$cssPrintFile"/></xsl:message>
+          </xsl:if>
+          <xsl:for-each select="tokenize(unparsed-text($cssPrintFile),     '\r?\n')">
+            <xsl:call-template name="purgeCSS"/>
+          </xsl:for-each>
+        </xsl:result-document>
+        <xsl:if test="$verbose='true'">
+          <xsl:message>write file mimetype</xsl:message>
+        </xsl:if>
+        <xsl:result-document method="text" href="{concat($directory,'/mimetype')}">
+          <xsl:value-of select="$epubMimetype"/>
+        </xsl:result-document>
+        <xsl:if test="$verbose='true'">
+          <xsl:message>write file META-INF/container.xml</xsl:message>
+        </xsl:if>
+        <xsl:result-document method="xml" href="{concat($directory,'/META-INF/container.xml')}">
+          <container xmlns="urn:oasis:names:tc:opendocument:xmlns:container" version="1.0">
+            <rootfiles>
+              <rootfile full-path="OPS/package.opf" media-type="application/oebps-package+xml"/>
+            </rootfiles>
+          </container>
+        </xsl:result-document>
+        <xsl:if test="$verbose='true'">
+          <xsl:message>write file OPS/package.opf</xsl:message>
+        </xsl:if>
+	<xsl:variable name="A">
+	  <xsl:call-template name="generateAuthor"/>
+	</xsl:variable>
+	<xsl:variable name="printA">
+	  <xsl:analyze-string select="$A" regex="([^,]+), ([^,]+), (.+)">
+	    <xsl:matching-substring>
+	      <xsl:value-of select="regex-group(1)"/>
+	      <xsl:text>, </xsl:text>
+	      <xsl:value-of select="regex-group(2)"/>
+	    </xsl:matching-substring>
+	    <xsl:non-matching-substring>
+	      <xsl:value-of select="."/>
+	    </xsl:non-matching-substring>
+	  </xsl:analyze-string>
+	</xsl:variable>	
+        <xsl:result-document
+	    href="{concat($directory,'/OPS/package.opf')}"
+	    method="xml" indent="yes">
+          <package xmlns="http://www.idpf.org/2007/opf" unique-identifier="pub-id" version="{$opfPackageVersion}">
+	    <xsl:call-template name="opfmetadata">
+	      <xsl:with-param name="author" select="$A"/>
+	      <xsl:with-param name="printAuthor" select="$printA"/>
+	      <xsl:with-param name="coverImageOutside" select="$coverImageOutside"/>
+	    </xsl:call-template>
+            <manifest>
+              <!-- deal with intricacies of overlay files -->
+              <xsl:variable name="TL" select="key('Timeline',1)"/>
+              <xsl:if test="$mediaoverlay='true' and key('Timeline',1)">
+                <xsl:if test="$verbose='true'">
+                  <xsl:message>write file SMIL files</xsl:message>
+                </xsl:if>
+                <xsl:for-each select="key('Timeline',1)">
+                  <xsl:variable name="TLnumber">
+                    <xsl:number level="any"/>
+                  </xsl:variable>
+                  <xsl:variable name="audio">
+                    <xsl:text>media/audio</xsl:text>
+                    <xsl:number level="any"/>
+                    <xsl:text>.</xsl:text>
+                    <xsl:value-of select="tokenize(@corresp,'\.')[last()]"/>
+                  </xsl:variable>
+                  <item id="timeline-audio{$TLnumber}" href="{$audio}">
+                    <xsl:attribute name="media-type">
+                      <xsl:choose>
+                        <xsl:when test="contains($audio,'.m4a')">audio/m4a</xsl:when>
+                        <xsl:otherwise>audio/m4a</xsl:otherwise>
+                      </xsl:choose>
+                    </xsl:attribute>
+                  </item>
+                  <xsl:for-each select="key('PB',1)">
+                    <xsl:variable name="page">
+                      <xsl:value-of select="generate-id()"/>
+                    </xsl:variable>
+                    <xsl:variable name="target">
+                      <xsl:apply-templates select="." mode="ident"/>
+                    </xsl:variable>
+                    <xsl:if test="count(key('objectOnPage',$page))&gt;0">
+                      <item id="{$target}-audio" href="{$target}-overlay.smil" media-type="application/smil+xml"/>
+                      <xsl:result-document href="{concat($directory,'/OPS/',$target,'-overlay.smil')}" method="xml">
+                        <smil xmlns="http://www.w3.org/ns/SMIL" version="3.0" profile="http://www.ipdf.org/epub/30/profile/content/">
+                          <body>
+                            <xsl:for-each select="key('objectOnPage',$page)">
+                              <xsl:variable name="object" select="@xml:id"/>
+                              <xsl:for-each select="$TL">
+                                <xsl:for-each select="key('Object',$object)">
+                                  <par id="{@xml:id}">
+                                    <text src="{$target}.xhtml{@corresp}"/>
+                                    <audio src="{$audio}" clipBegin="{@from}{../@unit}" clipEnd="{@to}{../@unit}"/>
+                                  </par>
+                                </xsl:for-each>
+                              </xsl:for-each>
+                            </xsl:for-each>
+                          </body>
+                        </smil>
+                      </xsl:result-document>
+                    </xsl:if>
+                  </xsl:for-each>
+                </xsl:for-each>
+              </xsl:if>
+              <xsl:if test="not($coverImageOutside='')">
+                <item href="{$coverImageOutside}" id="cover-image" media-type="image/jpeg"/>
+              </xsl:if>
+              <xsl:if test="not($coverimage='') and not($coverimage=$coverImageOutside)">
+                <item href="{$coverimage}" id="cover-image-extra" media-type="image/jpeg"/>
+              </xsl:if>
+              <xsl:for-each select="tokenize($javascriptFiles,',')">
+                <xsl:variable name="name" select="tokenize(normalize-space(.),'/')[last()]"/>
+                <item href="{$name}" id="javascript{position()}" media-type="text/javascript"/>
+              </xsl:for-each>
+              <item id="css" href="stylesheet.css" media-type="text/css"/>
+              <item id="print.css" href="print.css" media-type="text/css"/>
+              <item href="titlepage.xhtml" id="titlepage" media-type="application/xhtml+xml"/>
+              <xsl:if test="$filePerPage='true'">
+                <item href="titlepageverso.xhtml" id="titlepageverso" media-type="application/xhtml+xml"/>
+              </xsl:if>
+              <xsl:for-each select="tei:text/tei:front/tei:titlePage">
+                <xsl:variable name="N" select="position()"/>
+                <item href="titlepage{$N}.xhtml" id="titlepage{$N}" media-type="application/xhtml+xml"/>
+              </xsl:for-each>
+              <item href="titlepageback.xhtml" id="titlepageback" media-type="application/xhtml+xml"/>
+              <item id="toc" properties="nav" href="toc.xhtml" media-type="application/xhtml+xml"/>
+              <item id="start" href="index.xhtml" media-type="application/xhtml+xml"/>
+              <xsl:choose>
+                <xsl:when test="$filePerPage='true'">
+                  <xsl:for-each select="key('PB',1)">
+                    <xsl:variable name="target">
+                      <xsl:apply-templates select="." mode="ident"/>
+                    </xsl:variable>
+                    <xsl:if test="@facs">
+                      <xsl:variable name="facstarget">
+                        <xsl:apply-templates select="." mode="ident"/>
+                        <xsl:text>-facs.xhtml</xsl:text>
+                      </xsl:variable>
+                      <item href="{$facstarget}" media-type="application/xhtml+xml">
+                        <xsl:attribute name="id">
+                          <xsl:text>pagefacs</xsl:text>
+                          <xsl:number level="any"/>
+                        </xsl:attribute>
+                      </item>
+                    </xsl:if>
+                    <item href="{$target}.xhtml" media-type="application/xhtml+xml">
+                      <xsl:if test="$mediaoverlay='true'">
+                        <xsl:attribute name="media-overlay">
+                          <xsl:value-of select="$target"/>
+                          <xsl:text>-audio</xsl:text>
+                        </xsl:attribute>
+                      </xsl:if>
+                      <xsl:attribute name="id">
+                        <xsl:text>page</xsl:text>
+                        <xsl:number level="any"/>
+                      </xsl:attribute>
+                    </item>
+                  </xsl:for-each>
+                </xsl:when>
+                <xsl:otherwise>
+                  <xsl:for-each select="$TOC/html:TOC/html:ul/html:li">
+                    <xsl:choose>
+                      <xsl:when test="not(html:a)"/>
+                      <xsl:when test="starts-with(html:a/@href,'#')"/>
+                      <xsl:otherwise>
+                        <item href="{html:a[1]/@href}" media-type="application/xhtml+xml">
+                          <xsl:attribute name="id">
+                            <xsl:text>section</xsl:text>
+                            <xsl:number count="html:li" level="any"/>
+                          </xsl:attribute>
+                        </item>
+                      </xsl:otherwise>
+                    </xsl:choose>
+                    <xsl:if test="html:ul">
+                      <xsl:for-each select="html:ul//html:li[html:a          and          not(contains(html:a/@href,'#'))]">
+                        <item href="{html:a[1]/@href}" media-type="application/xhtml+xml">
+                          <xsl:attribute name="id">
+                            <xsl:text>section</xsl:text>
+                            <xsl:number count="html:li" level="any"/>
+                          </xsl:attribute>
+                        </item>
+                      </xsl:for-each>
+                    </xsl:if>
+                  </xsl:for-each>
+                </xsl:otherwise>
+              </xsl:choose>
+              <!-- images -->
+              <xsl:for-each select="key('GRAPHICS',1)">
+                <xsl:variable name="img" select="@url|@facs"/>
+                <xsl:if test="not($img=$coverImageOutside)">
+                  <xsl:variable name="ID">
+                    <xsl:number level="any"/>
+                  </xsl:variable>
+                  <xsl:variable name="mimetype">
+                    <xsl:choose>
+                      <xsl:when test="@mimeType != ''">
+                        <xsl:value-of select="@mimeType"/>
+                      </xsl:when>
+                      <xsl:when test="contains($img,'.gif')">image/gif</xsl:when>
+                      <xsl:when test="contains($img,'.png')">image/png</xsl:when>
+                      <xsl:when test="contains($img,'.mpeg')">video/mpeg4</xsl:when>
+                      <xsl:when test="contains($img,'.mp4')">video/mpeg4</xsl:when>
+                      <xsl:when test="contains($img,'.m4v')">video/mpeg4</xsl:when>
+                      <xsl:otherwise>image/jpeg</xsl:otherwise>
+                    </xsl:choose>
+                  </xsl:variable>
+                  <item href="{$img}" id="image-{$ID}" media-type="{$mimetype}"/>
+                </xsl:if>
+              </xsl:for-each>
+              <!-- page images -->
+              <xsl:for-each select="key('PBGRAPHICS',1)">
+                <xsl:variable name="img" select="@facs"/>
+                <xsl:variable name="ID">
+                  <xsl:number level="any"/>
+                </xsl:variable>
+                <xsl:variable name="mimetype">
+                  <xsl:choose>
+                    <xsl:when test="@mimeType != ''">
+                      <xsl:value-of select="@mimeType"/>
+                    </xsl:when>
+                    <xsl:when test="contains($img,'.gif')">image/gif</xsl:when>
+                    <xsl:when test="contains($img,'.png')">image/png</xsl:when>
+                    <xsl:otherwise>image/jpeg</xsl:otherwise>
+                  </xsl:choose>
+                </xsl:variable>
+                <item href="{$img}" id="pbimage-{$ID}" media-type="{$mimetype}"/>
+              </xsl:for-each>
+              <item id="ncx" href="toc.ncx" media-type="application/x-dtbncx+xml"/>
+              <xsl:call-template name="epubManifestHook"/>
+            </manifest>
+            <spine toc="ncx">
+              <itemref idref="titlepage" linear="yes"/>
+              <xsl:if test="$filePerPage='true'">
+                <itemref idref="titlepageverso" linear="yes"/>
+              </xsl:if>
+              <xsl:for-each select="tei:text/tei:front/tei:titlePage">
+                <xsl:variable name="N" select="position()"/>
+                <itemref idref="titlepage{$N}" linear="yes"/>
+              </xsl:for-each>
+              <itemref idref="start" linear="yes"/>
+              <xsl:choose>
+                <xsl:when test="$filePerPage='true'">
+                  <xsl:for-each select="key('PB',1)">
+                    <xsl:if test="@facs">
+                      <itemref>
+                        <xsl:attribute name="idref">
+                          <xsl:text>pagefacs</xsl:text>
+                          <xsl:number level="any"/>
+                        </xsl:attribute>
+                        <xsl:attribute name="linear">yes</xsl:attribute>
+                      </itemref>
+                    </xsl:if>
+                    <itemref>
+                      <xsl:attribute name="idref">
+                        <xsl:text>page</xsl:text>
+                        <xsl:number level="any"/>
+                      </xsl:attribute>
+                      <xsl:attribute name="linear">yes</xsl:attribute>
+                    </itemref>
+                  </xsl:for-each>
+                </xsl:when>
+                <xsl:otherwise>
+                  <xsl:for-each select="$TOC/html:TOC/html:ul/html:li">
+                    <xsl:choose>
+                      <xsl:when test="not(html:a)"/>
+                      <xsl:when test="starts-with(html:a/@href,'#')"/>
+                      <xsl:otherwise>
+                        <itemref>
+                          <xsl:attribute name="idref">
+                            <xsl:text>section</xsl:text>
+                            <xsl:number count="html:li" level="any"/>
+                          </xsl:attribute>
+                          <xsl:attribute name="linear">yes</xsl:attribute>
+                        </itemref>
+                      </xsl:otherwise>
+                    </xsl:choose>
+                    <xsl:if test="html:ul">
+                      <xsl:for-each select="html:ul//html:li[html:a and not(contains(html:a/@href,'#'))]">
+                        <itemref>
+                          <xsl:attribute name="idref">
+                            <xsl:text>section</xsl:text>
+                            <xsl:number count="html:li" level="any"/>
+                          </xsl:attribute>
+                          <xsl:attribute name="linear">yes</xsl:attribute>
+                        </itemref>
+                      </xsl:for-each>
+                    </xsl:if>
+                  </xsl:for-each>
+                </xsl:otherwise>
+              </xsl:choose>
+              <itemref idref="titlepageback">
+                <xsl:attribute name="linear">
+                  <xsl:choose>
+                    <xsl:when test="$filePerPage='true'">yes</xsl:when>
+                    <xsl:otherwise>no</xsl:otherwise>
+                  </xsl:choose>
+                </xsl:attribute>
+              </itemref>
+              <xsl:call-template name="epubSpineHook"/>
+            </spine>
+            <guide>
+              <reference type="text" href="titlepage.xhtml" title="Cover"/>
+              <reference type="text" title="Start" href="index.xhtml"/>
+              <xsl:choose>
+                <xsl:when test="$filePerPage='true'">
+		</xsl:when>
+                <xsl:otherwise>
+                  <xsl:for-each select="$TOC/html:TOC/html:ul/html:li">
+                    <xsl:if test="html:a">
+                      <reference type="text" href="{html:a[1]/@href}">
+                        <xsl:attribute name="title">
+                          <xsl:value-of select="normalize-space(html:a[1])"/>
+                        </xsl:attribute>
+                      </reference>
+                    </xsl:if>
+                    <xsl:if test="contains(parent::html:ul/@class,'group')">
+                      <xsl:for-each select="html:ul//html:li">
+                        <xsl:choose>
+                          <xsl:when test="not(html:a)"/>
+                          <xsl:when test="contains(html:a/@href,'#')"/>
+                          <xsl:otherwise>
+                            <reference type="text" href="{html:a/@href}">
+                              <xsl:attribute name="title">
+                                <xsl:value-of select="normalize-space(html:a[1])"/>
+                              </xsl:attribute>
+                            </reference>
+                          </xsl:otherwise>
+                        </xsl:choose>
+                      </xsl:for-each>
+                    </xsl:if>
+                  </xsl:for-each>
+                </xsl:otherwise>
+              </xsl:choose>
+              <reference href="titlepageback.xhtml" type="text" title="About this book"/>
+            </guide>
+          </package>
+        </xsl:result-document>
+        <xsl:if test="$verbose='true'">
+          <xsl:message>write file OPS/titlepage.xhtml</xsl:message>
+        </xsl:if>
+        <xsl:result-document href="{concat($directory,'/OPS/titlepage.xhtml')}" method="xml">
+          <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+            <head>
+              <xsl:call-template name="metaHTML">
+                <xsl:with-param name="title">Title page</xsl:with-param>
+              </xsl:call-template>
+              <meta name="calibre:cover" content="true"/>
+              <title>Title page</title>
+              <style type="text/css" title="override_css">
+		@page {padding: 0pt; margin:0pt}
+		body { text-align: center; padding:0pt; margin: 0pt; }
+	      </style>
+            </head>
+            <body>
+              <xsl:choose>
+                <xsl:when test="$coverImageInside=''">
+                  <div>
+                    <xsl:attribute name="style">
+		      font-family: serif; 
+		      height:860;          
+		      font-size:30pt; 
+		      font-weight: bold;
+		      padding-top: 15pt;
+		      margin: 12pt;
+		      border: solid red 1pt; 
+		      text-align:center;
+		    </xsl:attribute>
+                    <xsl:call-template name="generateTitle"/>
+                  </div>
+                </xsl:when>
+                <xsl:otherwise>
+                  <div>
+                    <img width="1200" height="1700" alt="cover picture" src="{$coverImageInside}"/>
+                  </div>
+                </xsl:otherwise>
+              </xsl:choose>
+            </body>
+          </html>
+        </xsl:result-document>
+        <xsl:for-each select="tei:text/tei:front/tei:titlePage">
+          <xsl:variable name="N" select="position()"/>
+          <xsl:if test="$verbose='true'">
+            <xsl:message>write file OPS/titlepage<xsl:value-of select="$N"/>.xhtml</xsl:message>
+          </xsl:if>
+          <xsl:result-document href="{concat($directory,'/OPS/titlepage',$N,'.xhtml')}" method="xml">
+            <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+              <head>
+                <xsl:call-template name="metaHTML">
+                  <xsl:with-param name="title">Title page</xsl:with-param>
+                </xsl:call-template>
+                <xsl:call-template name="linkCSS">
+		  <xsl:with-param
+		      name="file">stylesheet.css</xsl:with-param>
+		</xsl:call-template>
+                <title>Title page</title>
+              </head>
+              <body>
+                <div class="titlePage">
+                  <xsl:apply-templates/>
+                </div>
+              </body>
+            </html>
+          </xsl:result-document>
+        </xsl:for-each>
+        <xsl:if test="$filePerPage='true'">
+          <xsl:if test="$verbose='true'">
+            <xsl:message>write file OPS/titlepageverso.xhtml</xsl:message>
+          </xsl:if>
+          <xsl:result-document href="{concat($directory,'/OPS/titlepageverso.xhtml')}" method="xml">
+            <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+              <head>
+                <xsl:call-template name="metaHTML">
+                  <xsl:with-param name="title">title page verso</xsl:with-param>
+                </xsl:call-template>
+                <title>title page verso</title>
+              </head>
+              <body>
+                <p/>
+              </body>
+            </html>
+          </xsl:result-document>
+        </xsl:if>
+        <xsl:if test="$verbose='true'">
+          <xsl:message>write file OPS/titlepageback.xhtml</xsl:message>
+        </xsl:if>
+        <xsl:result-document href="{concat($directory,'/OPS/titlepageback.xhtml')}" method="xml">
+          <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+            <head>
+              <xsl:call-template name="metaHTML">
+                <xsl:with-param name="title">About this book</xsl:with-param>
+              </xsl:call-template>
+              <title>About this book</title>
+            </head>
+            <body>
+              <div style="text-align: left; font-size: larger">
+                <h2>Information about this book</h2>
+                <xsl:for-each select="/*/tei:teiHeader/tei:fileDesc">
+                  <xsl:apply-templates mode="metadata"/>
+                </xsl:for-each>
+                <xsl:for-each select="/*/tei:teiHeader/tei:encodingDesc">
+                  <xsl:apply-templates mode="metadata"/>
+                </xsl:for-each>
+              </div>
+            </body>
+          </html>
+        </xsl:result-document>
+        <xsl:if test="$verbose='true'">
+          <xsl:message>write file OPS/toc.ncx</xsl:message>
+        </xsl:if>
+        <xsl:result-document href="{concat($directory,'/OPS/toc.ncx')}" method="xml">
+          <ncx xmlns="http://www.daisy.org/z3986/2005/ncx/" version="2005-1">
+            <head>
+              <meta name="dtb:uid">
+                <xsl:attribute name="content">
+                  <xsl:call-template name="generateID"/>
+                </xsl:attribute>
+              </meta>
+              <meta name="dtb:totalPageCount" content="0"/>
+              <meta name="dtb:maxPageNumber" content="0"/>
+            </head>
+            <docTitle>
+              <text>
+                <xsl:call-template name="generateSimpleTitle"/>
+              </text>
+            </docTitle>
+            <navMap>
+              <xsl:variable name="navPoints">
+                <navPoint>
+                  <navLabel>
+                    <text>[Cover]</text>
+                  </navLabel>
+                  <content src="titlepage.xhtml"/>
+                </navPoint>
+                <xsl:for-each select="tei:text/tei:front/tei:titlePage[1]">
+                  <xsl:variable name="N" select="position()"/>
+                  <navPoint>
+                    <navLabel>
+                      <text>[Title page]</text>
+                    </navLabel>
+                    <content src="titlepage{$N}.xhtml"/>
+                  </navPoint>
+                </xsl:for-each>
+                <xsl:choose>
+                  <xsl:when test="not($TOC/html:TOC/html:ul[@class='toc toc_body']/html:li)">
+                    <xsl:for-each select="$TOC/html:TOC/html:ul[@class='toc toc_front']">
+                      <xsl:apply-templates select="html:li"/>
+                    </xsl:for-each>
+                    <navPoint>
+                      <navLabel>
+                        <text>[The book]</text>
+                      </navLabel>
+                      <content src="index.xhtml"/>
+                    </navPoint>
+                    <xsl:for-each select="$TOC/html:TOC/html:ul[contains(@class,'group')]">
+                      <xsl:apply-templates select=".//html:li[not(contains(html:a/@href,'#'))]"/>
+                    </xsl:for-each>
+                    <xsl:for-each select="$TOC/html:TOC/html:ul[@class='toc toc_back']">
+                      <xsl:apply-templates select="html:li"/>
+                    </xsl:for-each>
+                  </xsl:when>
+                  <xsl:otherwise>
+                    <xsl:for-each select="$TOC/html:TOC/html:ul">
+                      <xsl:apply-templates select="html:li"/>
+                    </xsl:for-each>
+                  </xsl:otherwise>
+                </xsl:choose>
+                <navPoint>
+                  <navLabel>
+                    <text>[About this book]</text>
+                  </navLabel>
+                  <content src="titlepageback.xhtml"/>
+                </navPoint>
+              </xsl:variable>
+              <xsl:for-each select="$navPoints/ncx:navPoint">
+                <xsl:variable name="pos" select="position()"/>
+                <navPoint id="navPoint-{$pos}" playOrder="{$pos}">
+                  <xsl:copy-of select="*"/>
+                </navPoint>
+              </xsl:for-each>
+            </navMap>
+          </ncx>
+        </xsl:result-document>
+        <xsl:if test="$filePerPage='true'">
+          <xsl:if test="$verbose='true'">
+            <xsl:message>write file META-INF/com.apple.ibooks.display-options.xml</xsl:message>
+          </xsl:if>
+          <xsl:result-document href="{concat($directory,'/META-INF/com.apple.ibooks.display-options.xml')}">
+            <display_options xmlns="">
+              <platform name="*">
+                <option name="fixed-layout">true</option>
+              </platform>
+            </display_options>
+          </xsl:result-document>
+        </xsl:if>
+        <xsl:if test="$debug='true'">
+          <xsl:message>write file OPS/toc.html</xsl:message>
+        </xsl:if>
+        <xsl:result-document href="{concat($directory,'/OPS/toc.xhtml')}" method="xml" doctype-system="">
+          <html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops">
+            <head>
+              <title>
+                <xsl:call-template name="generateSimpleTitle"/>
+              </title>
+                <xsl:call-template name="linkCSS">
+		  <xsl:with-param
+		      name="file">stylesheet.css</xsl:with-param>
+		</xsl:call-template>
+            </head>
+            <body>
+              <section class="TableOfContents">
+                <header>
+                  <h1>Contents</h1>
+                </header>
+                <nav xmlns:epub="http://www.idpf.org/2007/ops" epub:type="toc" id="toc">
+                  <ol>
+                    <xsl:for-each select="$TOC/html:TOC/html:ul/html:li">
+                      <xsl:choose>
+                        <xsl:when test="not(html:a)"/>
+                        <xsl:when test="starts-with(html:a/@href,'#')"/>
+                        <xsl:when test="contains(@class,'headless')"/>
+                        <xsl:otherwise>
+                          <li>
+                            <a href="{html:a/@href}">
+                              <xsl:value-of select="html:span[@class='headingNumber']"/>
+                              <xsl:value-of select="normalize-space(html:a[1])"/>
+                            </a>
+                          </li>
+                        </xsl:otherwise>
+                      </xsl:choose>
+                    </xsl:for-each>
+                    <li>
+                      <a href="titlepageback.xhtml">[About this book]</a>
+                    </li>
+                  </ol>
+                </nav>
+                <nav xmlns:epub="http://www.idpf.org/2007/ops" epub:type="landmarks" id="guide">
+                  <h2>Guide</h2>
+                  <ol>
+                    <li>
+                      <a epub:type="titlepage" href="titlepage.xhtml">[Title page]</a>
+                    </li>
+                    <li>
+                      <a epub:type="bodymatter" href="index.xhtml">[The book]</a>
+                    </li>
+                    <li>
+                      <a epub:type="colophon" href="titlepageback.xhtml">[About this book]</a>
+                    </li>
+                  </ol>
+                </nav>
+              </section>
+            </body>
+          </html>
+        </xsl:result-document>
+
+      </xsl:for-each>
+    </xsl:for-each>
+  </xsl:template>
+
+  <xsl:template name="opfmetadata">
+    <xsl:param name="author"/>
+    <xsl:param name="printAuthor"/>
+    <xsl:param name="coverImageOutside"/>
+    <metadata xmlns="http://www.idpf.org/2007/opf"
+	      xmlns:dc="http://purl.org/dc/elements/1.1/"
+	      xmlns:dcterms="http://purl.org/dc/terms/" 
+	      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+	      xmlns:opf="http://www.idpf.org/2007/opf">
+      <dc:title id="title">
+	<xsl:call-template name="generateSimpleTitle"/>
+      </dc:title>
+      <meta refines="#title" property="title-type">main</meta>
+      <dc:creator id="creator">
+	<xsl:value-of select="$printAuthor"/>
+      </dc:creator>
+      <meta refines="#creator" property="file-as">
+	<xsl:value-of select="$author"/>
+      </meta>
+      <meta refines="#creator" property="role" scheme="marc:relators">aut</meta>
+      <dc:language>
+	<xsl:call-template name="generateLanguage"/>
+      </dc:language>
+      <xsl:call-template name="generateSubject"/>
+      <dc:identifier id="pub-id">
+	<xsl:call-template name="generateID"/>
+      </dc:identifier>
+      <meta refines="#pub-id" property="identifier-type" scheme="onix:codelist5">15</meta>
+      <dc:description>
+	<xsl:call-template name="generateSimpleTitle"/>
+	<xsl:text> / </xsl:text>
+	<xsl:value-of select="$author"/>
+      </dc:description>
+      <dc:publisher>
+	<xsl:call-template name="generatePublisher"/>
+      </dc:publisher>
+      <xsl:for-each select="tei:teiHeader/tei:profileDesc/tei:creation/tei:date[@notAfter]">
+	<dc:date id="creation">
+	  <xsl:value-of select="@notAfter"/>
+	</dc:date>
+      </xsl:for-each>
+      <xsl:for-each select="tei:teiHeader/tei:fileDesc/tei:sourceDesc//tei:date[@when][1]">
+	<dc:date id="original-publication">
+	  <xsl:value-of select="@when"/>
+	</dc:date>
+      </xsl:for-each>
+      <dc:date id="epub-publication">
+	<xsl:call-template name="generateDate"/>
+      </dc:date>
+      <dc:rights>
+	<xsl:call-template name="generateLicence"/>
+      </dc:rights>
+      <xsl:if test="not($coverImageOutside='')">
+	<meta name="cover" content="cover-image"/>
+      </xsl:if>
+      <meta property="dcterms:modified">
+	<xsl:call-template name="generateRevDate"/>
+      </meta>
+    </metadata>
+  </xsl:template>
+
+  <xsl:template name="epubSpineHook"/>
+  <xsl:template name="epubManifestHook"/>
+  <xsl:template name="processTEIHook"/>
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/epub3/tei-to-epub3.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/txt/tei-to-text.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/txt/tei-to-text.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/txt/tei-to-text.xsl	(revision 258)
@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet 
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xpath-default-namespace="http://www.tei-c.org/ns/1.0"
+    xmlns:tei="http://www.tei-c.org/ns/1.0"
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    version="2.0">
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: tei-to-text.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc>
+   </doc>
+
+   <xsl:output method="text"/>
+   <xsl:param name="makeCSV">false</xsl:param>
+   <xsl:variable name="q">"</xsl:variable>
+
+   <xsl:template match="/">
+     <xsl:apply-templates select="tei:preflight(*)"/>
+   </xsl:template>
+
+   <xsl:template match="teiHeader"/>
+
+   <xsl:template match="figDesc"/>
+
+   <xsl:template match="gap/desc"/>
+
+   <xsl:template match="choice">
+     <xsl:apply-templates select="*[1]"/>
+   </xsl:template>
+
+   <xsl:template match="speaker"/>
+
+   <xsl:template match="facsimile"/>
+
+   <!-- for when we need some context -->
+   <xsl:template match="text()">
+     <xsl:choose>
+       <xsl:when test="normalize-space()=''"/>
+       <xsl:when test="$makeCSV='true'">
+	 <xsl:text>"</xsl:text>
+	 <xsl:value-of select="replace(normalize-space(),'$q','$q$q')"/>
+	 <xsl:text>","</xsl:text>
+	 <xsl:for-each select="ancestor::*">
+	   <xsl:value-of select="name()"/>
+	   <xsl:text>[</xsl:text>
+	   <xsl:number/>
+	   <xsl:text>]/</xsl:text>
+	 </xsl:for-each>
+	 <xsl:text>"&#10;</xsl:text>
+       </xsl:when>
+       <xsl:otherwise>
+	 <xsl:value-of select="normalize-space()"/>
+	 <xsl:text>&#10;</xsl:text>
+       </xsl:otherwise>
+       </xsl:choose>
+   </xsl:template>
+
+   
+   <xsl:function name="tei:preflight" as="element()+">
+     <xsl:param name="n" as="element()"/>
+     <xsl:apply-templates select="$n" mode="preflight"/>
+   </xsl:function>
+   
+   <xsl:template match="@*|text()" mode="preflight">
+     <xsl:copy-of select="."/>
+   </xsl:template>
+   
+   <xsl:template match="lb|pb" mode="preflight"/>
+
+   <xsl:template match="*" mode="preflight">
+     <xsl:copy>
+       <xsl:apply-templates select="@*|*|text()" mode="preflight"/>
+     </xsl:copy>
+   </xsl:template>
+   
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/txt/tei-to-text.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/txt/build-to.xml
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/txt/build-to.xml	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/txt/build-to.xml	(revision 258)
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="utf-8"?>
+<project basedir="." default="dist" name="teitotext">
+<!--
+	This library is free software; you can redistribute it and/or
+	modify it under the terms of the GNU Lesser General Public
+	License as published by the Free Software Foundation; either
+	version 2.1 of the License, or (at your option) any later version.
+	
+	This library 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
+	Lesser General Public License for more details.
+	
+	You should have received a copy of the GNU Lesser General Public
+	License along with this library; if not, write to the Free Software
+	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+	
+        Id: $Id: build-to.xml 9319 2011-09-14 15:25:52Z rahtz $
+        Copyright: 2011, TEI Consortium<
+-->
+  <!--
+ Convert TEI documents into HTML files.
+ -->
+  <!-- Path to TEI XML file. -->
+  <property name="inputFile" value=""/>
+  <!-- Path where the outputfile will be saved. -->
+  <property name="outputFile" value=""/>
+  <!-- which profile -->
+  <property name="profile" value="default"/>
+  <!-- where does oxygen keep stuff -->
+  <property name="oxygenlib" value=""/>
+  <!-- Stylesheet for transformation -->
+  <property name="odd2text"   value="../profiles/${profile}/txt/to.xsl"/>
+  <property name="odd2oddxsl" value="../odds2/odd2odd.xsl"/>
+  <dirname property="inputFileDir" file="${inputFile}"/>
+  <dirname property="outputDir" file="${outputFile}"/>
+  <property name="outputTempDir" value="${outputDir}/temp-dir-for-ant"/>
+  <path id="classpath">
+    <pathelement path="${java.class.path}"/>
+  </path>
+  <target name="setup">
+    <delete dir="${outputTempDir}"/>
+    <mkdir dir="${outputTempDir}"/>
+  </target>
+
+  <target name="dist" depends="setup,convert,cleanup"/>
+
+  <target name="convert">
+    <!-- Recreate temporary output directory -->
+    <!-- The transformation for HTML output. -->
+    <echo level="info">XSLT generate text file</echo>
+    <xslt force="yes" style="${odd2text}" in="${inputFile}" out="${outputFile}" classpath="classpath">
+      <xmlcatalog>
+        <catalogpath>
+          <pathelement location="../../../../catalog.xml"/>
+          <pathelement location="../../../../../xhtml11/dtd/xhtmlcatalog.xml"/>
+        </catalogpath>
+      </xmlcatalog>
+      <factory name="net.sf.saxon.TransformerFactoryImpl"/>
+      <classpath location="${oxygenlib}/saxon9ee.jar"/>
+      <param name="directory" expression="file:///${outputTempDir}"/>
+      <!-- supply name of language-->
+      <param name="lang" expression="${lang}" if="lang"/>
+      <!-- emit some diagnostics"-->
+      <param name="debug" expression="${debug}" if="debug"/>
+      <!-- be verbose-->
+      <param name="verbose" expression="${verbose}" if="verbose"/>
+    </xslt>
+  </target>
+
+  <target name="cleanup" unless="debug">  
+    <delete dir="${outputTempDir}"/>
+  </target>
+
+</project>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/txt/build-to.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docbook/build-from.xml
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/docbook/build-from.xml	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/docbook/build-from.xml	(revision 258)
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="utf-8"?>
+<project basedir="." default="dist" name="teitohtml">
+<!--
+	This library is free software; you can redistribute it and/or
+	modify it under the terms of the GNU Lesser General Public
+	License as published by the Free Software Foundation; either
+	version 2.1 of the License, or (at your option) any later version.
+	
+	This library 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
+	Lesser General Public License for more details.
+	
+	You should have received a copy of the GNU Lesser General Public
+	License along with this library; if not, write to the Free Software
+	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+	
+        Id: $Id: build-to.xml 9886 2011-12-04 22:50:41Z rahtz $
+        Copyright: 2011, TEI Consortium<
+-->
+  <!--
+ Convert Docbook documents into TEI files.
+ -->
+  <!-- Path to Docbook XML file. -->
+  <property name="inputFile" value=""/>
+  <!-- Path where the output TEI file will be saved. -->
+  <property name="outputFile" value=""/>
+  <!-- which profile -->
+  <property name="profile" value="default"/>
+  <!-- where does oxygen keep stuff -->
+  <property name="oxygenlib" value=""/>
+  <!-- Stylesheet for transformation -->
+  <property name="docbook2tei"
+	    value="../profiles/${profile}/docbook/from.xsl"/>
+  <dirname property="inputFileDir" file="${inputFile}"/>
+  <dirname property="outputDir" file="${outputFile}"/>
+  <property name="outputTempDir" value="${outputDir}/temp-dir-for-ant"/>
+  <path id="classpath">
+    <pathelement path="${java.class.path}"/>
+  </path>
+  <target name="dist" depends="convert"/>
+
+  <target name="convert">
+    <echo level="info">XSLT generate TEI files</echo>
+    <xslt force="yes" style="${docbook2tei}" in="${inputFile}" out="${outputFile}" classpath="classpath">
+      <xmlcatalog>
+        <catalogpath>
+          <pathelement location="../../../../catalog.xml"/>
+          <pathelement location="../../../../../xhtml11/dtd/xhtmlcatalog.xml"/>
+        </catalogpath>
+      </xmlcatalog>
+      <factory name="net.sf.saxon.TransformerFactoryImpl"/>
+      <classpath location="${oxygenlib}/saxon9ee.jar"/>
+      <param name="directory" expression="file:///${outputTempDir}"/>
+      <!-- emit some diagnostics"-->
+      <param name="debug" expression="${debug}" if="debug"/>
+      <!-- be verbose-->
+      <param name="verbose" expression="${verbose}" if="verbose"/>
+    </xslt>
+  </target>
+
+</project>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docbook/build-from.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/dtd/to.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/dtd/to.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/dtd/to.xsl	(revision 258)
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet 
+                xmlns:m="http://www.w3.org/1998/Math/MathML"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                exclude-result-prefixes="tei m"
+                version="2.0">
+    <!-- import base conversion style -->
+
+    <xsl:import href="../../../odds2/odd2dtd.xsl"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: to.xsl 9703 2011-11-09 11:16:42Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc>
+   </doc>
+
+  
+    
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/dtd/to.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/rdf/to.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/rdf/to.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/rdf/to.xsl	(revision 258)
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet 
+    xmlns:html="http://www.w3.org/1999/xhtml"
+    xmlns:tei="http://www.tei-c.org/ns/1.0"
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    exclude-result-prefixes="tei html"
+    version="2.0">
+    <!-- import base conversion style -->
+
+    <xsl:import href="../../../rdf/tei2rdf.xsl"/>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: to.xsl 8884 2011-05-03 14:46:06Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc>
+   </doc>
+
+   <xsl:output method="xml" omit-xml-declaration="yes"/>
+    
+
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/rdf/to.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/latex/to.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/latex/to.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/latex/to.xsl	(revision 258)
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet 
+                xmlns:m="http://www.w3.org/1998/Math/MathML"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                exclude-result-prefixes="tei m"
+                version="2.0">
+    <!-- import base conversion style -->
+
+    <xsl:import href="../../../latex2/tei.xsl"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: to.xsl 9669 2011-11-07 19:17:54Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc>
+   </doc>
+
+  <xsl:param name="reencode">false</xsl:param>
+    
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/latex/to.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/epub3/cover.jpg
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/epub3/cover.jpg
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/epub3/cover-template.jpg
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/epub3/cover-template.jpg
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/epub3/to.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/epub3/to.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/epub3/to.xsl	(revision 258)
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                version="2.0"
+                exclude-result-prefixes="tei">
+    <xsl:import href="../../../epub3/tei-to-epub3.xsl"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+    <desc>
+      <p> TEI stylesheet for making ePub from TEI.</p>
+      <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+      <p>Author: See AUTHORS</p>
+      <p>Id: $Id: to.xsl 8698 2011-02-25 22:34:37Z rahtz $</p>
+      <p>Copyright: 2008, TEI Consortium</p>
+    </desc>
+  </doc>
+
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/epub3/to.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/txt/to.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/txt/to.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/txt/to.xsl	(revision 258)
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet 
+    xmlns="http://www.w3.org/1999/xhtml"
+    xmlns:html="http://www.w3.org/1999/xhtml"
+    xmlns:tei="http://www.tei-c.org/ns/1.0"
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    exclude-result-prefixes="tei html"
+    version="2.0">
+    <!-- import base conversion style -->
+    <xsl:import href="../../../txt/tei-to-text.xsl"/>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: to.xsl 8923 2011-05-25 13:11:45Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc>
+   </doc>
+
+   <xsl:output method="text"/>
+    
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/txt/to.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/docbook/from.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/docbook/from.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/docbook/from.xsl	(revision 258)
@@ -0,0 +1,714 @@
+<xsl:stylesheet 
+    xmlns="http://www.tei-c.org/ns/1.0"
+    xpath-default-namespace="http://docbook.org/ns/docbook"
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+    version="2.0">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: Sebastian Rahtz</p>
+         <p>Id: $Id: from.xsl 10017 2012-01-10 14:45:54Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc>
+   </doc>
+
+
+<xsl:output method="xml" indent="yes" encoding="utf-8"/>
+  <xsl:variable name="processor">
+    <xsl:value-of select="system-property('xsl:vendor')"/>
+  </xsl:variable>
+
+<xsl:template match="/">
+  <xsl:choose>
+    <xsl:when test="*[namespace-uri()='http://docbook.org/ns/docbook']">
+      <xsl:apply-templates/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:variable name="db5">
+	<xsl:apply-templates mode="convert"/>
+      </xsl:variable>
+      <xsl:apply-templates select="$db5/*"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="@*|text()|comment()" mode="convert">
+  <xsl:copy-of select="."/>
+</xsl:template>
+
+<xsl:template match="*" mode="convert">
+  <xsl:element name="{name()}" namespace="http://docbook.org/ns/docbook">
+    <xsl:apply-templates select="@*|text()|*|comment()" mode="convert"/>
+  </xsl:element>
+</xsl:template>
+
+
+<xsl:template match="abbrev">
+  <abbr>
+    <xsl:apply-templates/>
+  </abbr>
+</xsl:template>
+
+<xsl:template match="abstract">
+  <div type="abstract">
+    <xsl:call-template name="ID"/>
+    <xsl:apply-templates/>
+  </div>
+</xsl:template>
+
+<xsl:template match="ackno">
+ <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="acronym">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="address">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="affiliation">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="anchor">
+ <anchor>
+   <xsl:call-template name="ID"/>
+ </anchor>
+</xsl:template>
+
+<xsl:template match="appendix">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="application">
+ <ident type="application" >
+   <xsl:apply-templates/>
+ </ident>
+</xsl:template>
+
+<xsl:template match="info|artheader|articleinfo"/>
+
+<xsl:template match="info|artheader|articleinfo" mode="header">
+  <teiHeader >
+    <fileDesc>
+      <titleStmt>
+	<xsl:apply-templates select="title"/>
+	<author>
+	  <xsl:choose>
+	    <xsl:when test="author">
+	      <xsl:apply-templates select="author"/>
+	    </xsl:when>
+	    <xsl:otherwise>
+	      <xsl:text>unknown author</xsl:text>
+	  </xsl:otherwise>
+	  </xsl:choose>
+	</author>
+      </titleStmt>
+      <editionStmt>
+          <edition>
+            <date>
+	      <xsl:choose>
+		<xsl:when test="pubdate">
+		  <xsl:apply-templates select="pubdate"/>
+		</xsl:when>
+		<xsl:otherwise>
+		  <xsl:call-template name="whatsTheDate"/> 
+		</xsl:otherwise>
+	      </xsl:choose>
+            </date>
+          </edition>
+        </editionStmt>
+      <publicationStmt>
+        <p></p>
+      </publicationStmt>
+    <sourceDesc>
+      <p>Converted from a Docbook original</p>
+    </sourceDesc>
+    </fileDesc>
+    <xsl:if test="keywordset">
+      <profileDesc>
+        <textClass>
+	  <xsl:apply-templates select="keywordset"/>
+        </textClass>
+      </profileDesc>
+    </xsl:if>
+  </teiHeader>
+</xsl:template>
+
+<xsl:template match="article|book">
+  <TEI>
+    <xsl:call-template name="ID"/>
+    <xsl:apply-templates select="info|artheader|articleinfo" mode="header"/>
+    <text>
+      <xsl:choose>
+	<xsl:when test="artheader/abstract">
+	  <front>
+	    <xsl:apply-templates select="artheader/abstract"/>
+	  </front>
+	</xsl:when>
+	<xsl:when test="articleinfo/abstract">
+	  <front>
+	    <xsl:apply-templates select="articleinfo/abstract"/>
+	  </front>
+	</xsl:when>
+	<xsl:otherwise>
+	</xsl:otherwise>
+      </xsl:choose>
+      <body>
+	<xsl:apply-templates />
+      </body>
+    </text>
+  </TEI>
+</xsl:template>
+
+<xsl:template match="attribution">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="author">
+    <name>
+      <xsl:choose>
+	<xsl:when test="surname">
+	  <persName>
+	    <xsl:apply-templates/>
+	  </persName>
+	</xsl:when>
+	<xsl:otherwise>
+	  <xsl:apply-templates/>
+	</xsl:otherwise>
+      </xsl:choose>
+    </name>
+</xsl:template>
+
+<xsl:template match="authorblurb">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="authorgroup">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="bibliodiv">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="bibliography">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="bibliomisc">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="bibliomixed">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="blockquote">
+  <q>  
+    <xsl:apply-templates/>
+  </q>
+</xsl:template>
+
+<xsl:template match="chapter">
+  <div>  
+    <xsl:call-template name="ID"/>
+    <xsl:apply-templates/>
+  </div>
+</xsl:template>
+
+<xsl:template match="citation">
+  <cit>  
+    <xsl:apply-templates/>
+  </cit>
+</xsl:template>
+
+<xsl:template match="computeroutput">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="copyright">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="email">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="emphasis">
+  <xsl:choose>
+    <xsl:when test="@role='strong'">
+      <hi>
+	<xsl:apply-templates/>
+      </hi>
+    </xsl:when>
+    <xsl:otherwise>
+      <hi>
+	<xsl:call-template name="Role"/>
+	<xsl:apply-templates/>
+      </hi>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="entry">
+  <cell>
+    <xsl:apply-templates/>
+  </cell>
+</xsl:template>
+
+<xsl:template match="example">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="figure">
+  <figure>
+    <xsl:apply-templates/>
+    <figDesc></figDesc>
+  </figure>
+</xsl:template>
+
+<xsl:template match="foreignphrase">
+  <foreign><xsl:apply-templates/></foreign>
+</xsl:template>
+
+<xsl:template match="imageobject">
+  <graphic url="{imagedata/@fileref}"/>
+</xsl:template>
+
+<xsl:template match="imagedata">
+</xsl:template>
+
+<xsl:template match="inlinemediaobject|mediaobject">
+
+ <xsl:apply-templates/>
+
+</xsl:template>
+
+<xsl:template match="issuenum">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="itemizedlist">
+  <list  type="unordered">
+    <xsl:apply-templates/>
+  </list>
+</xsl:template>
+
+<xsl:template match="keyword">
+  <term>
+    <xsl:call-template name="Lang"/>
+    <xsl:apply-templates/>
+  </term>
+</xsl:template>
+
+<xsl:template match="keywordset">
+  <keywords scheme="adhoc">
+    <xsl:apply-templates/>
+  </keywords>
+</xsl:template>
+
+<xsl:template match="link">
+  <ref target="#{@linkend}">
+    <xsl:apply-templates/>
+  </ref>
+</xsl:template>
+
+<xsl:template match="listitem">
+  <item >
+    <xsl:apply-templates/>
+  </item>
+</xsl:template>
+
+<xsl:template match="literal">
+  <code rend="{@role}">
+    <xsl:apply-templates/>
+  </code>
+</xsl:template>
+
+<xsl:template match="literallayout">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="note">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="orderedlist">
+  <list  type="ordered">
+    <xsl:apply-templates/>
+  </list>
+</xsl:template>
+
+<xsl:template match="orgname">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="othercredit">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="para">
+  <xsl:choose>
+    <xsl:when test="normalize-space(.)=''"/>
+    <xsl:when test="parent::listitem and count(../para)=1">
+	<xsl:apply-templates/>
+    </xsl:when>
+    <xsl:when test="parent::footnote and count(../para)=1">
+	<xsl:apply-templates/>
+    </xsl:when>
+    <xsl:otherwise>
+      <p>  
+	<xsl:apply-templates/>
+      </p>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="productname">
+ <ident rend="productname">
+   <xsl:apply-templates/>
+ </ident>
+</xsl:template>
+
+<xsl:template match="pubdate">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="quote">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="row">
+  <row>
+    <xsl:if test="ancestor::thead">
+      <xsl:attribute name="role">label</xsl:attribute>
+    </xsl:if>
+    <xsl:apply-templates/>
+  </row>
+</xsl:template>
+
+<xsl:template match="screen">
+<eg >
+  <xsl:apply-templates/>
+</eg>
+</xsl:template>
+
+<xsl:template match="section|sect1|sect2|sect3|sect4">
+  <xsl:variable name="gi">
+    <xsl:choose>
+      <xsl:when test="local-name(.)='section'">div</xsl:when>
+      <xsl:otherwise>
+	<xsl:text>div</xsl:text>
+	<xsl:value-of select="substring-after(local-name(.),'sect')"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+  <xsl:element name="{$gi}">
+    <xsl:call-template name="ID"/>
+    <xsl:apply-templates/>
+  </xsl:element>
+</xsl:template>
+
+
+<xsl:template match="surname">
+  <surname >
+    <xsl:apply-templates/>
+  </surname>
+</xsl:template>
+
+<xsl:template match="symbol">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="table">
+  <table>
+    <xsl:apply-templates/>
+  </table>
+</xsl:template>
+
+<xsl:template match="tbody">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="tgroup">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="title">
+  <xsl:choose>
+    <xsl:when test="parent::articleinfo">
+      <title>
+	<xsl:apply-templates/>
+      </title>
+    </xsl:when>
+    <xsl:otherwise>
+      <head>
+	<xsl:apply-templates/>
+      </head>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="artheader/title">
+  <title>
+    <xsl:call-template name="Lang"/>
+    <xsl:apply-templates/>
+  </title>
+</xsl:template>
+
+<xsl:template match="toc"/>
+
+
+<xsl:template match="tocentry">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="token">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="ulink">
+ <ref target="{@url}" >
+   <xsl:apply-templates/>
+ </ref>
+</xsl:template>
+
+<xsl:template match="userinput">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="volumenum">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="warning">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="wordasword">
+ <w>
+  <xsl:apply-templates/>
+ </w>
+</xsl:template>
+
+<xsl:template match="xref">
+  <ptr target="#{@linkend}" type="{@role}" />
+</xsl:template>
+
+<xsl:template match="programlisting">
+  <eg>
+    <xsl:apply-templates/>
+  </eg>
+</xsl:template>
+
+<xsl:template match="firstname">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="jobtitle">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="orgdiv">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="simpara">
+  <xsl:choose>
+    <xsl:when test="following-sibling::simpara or
+		    preceding-sibling::simpara">
+      <p>
+	<xsl:apply-templates/>
+      </p>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:apply-templates/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="term">
+  <term>
+    <xsl:apply-templates/>
+  </term>
+</xsl:template>
+
+<xsl:template match="thead">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="variablelist">
+  <list type="gloss">
+    <xsl:apply-templates/>
+  </list>
+</xsl:template>
+
+<xsl:template match="varlistentry">
+    <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="varlistentry/term">
+  <label>
+    <xsl:apply-templates/>
+  </label>
+</xsl:template>
+
+<!-- more -->
+
+<xsl:template match="action">
+  <hi rend="Action">
+  <xsl:apply-templates/>
+  </hi>
+</xsl:template>
+
+<xsl:template match="command">
+  <hi rend="Command">
+  <xsl:apply-templates/>
+  </hi>
+</xsl:template>
+
+<xsl:template match="database">
+  <hi rend="Database">
+  <xsl:apply-templates/>
+  </hi>
+</xsl:template>
+
+<xsl:template match="function">
+  <hi rend="Function">
+  <xsl:apply-templates/>
+  </hi>
+</xsl:template>
+
+<xsl:template match="guilabel">
+  <hi rend="Label">
+    <xsl:apply-templates/>
+  </hi>
+</xsl:template>
+
+<xsl:template match="parameter">
+  <hi rend="Parameter">
+  <xsl:apply-templates/>
+  </hi>
+</xsl:template>
+
+<xsl:template match="remark">
+  <hi rend="Remark">
+  <xsl:apply-templates/>
+  </hi>
+</xsl:template>
+
+<xsl:template match="trademark">
+  <xsl:apply-templates/>
+  <xsl:text>™</xsl:text>
+</xsl:template>
+
+<xsl:template match="type">
+  <hi rend="Type">
+  <xsl:apply-templates/>
+  </hi>
+</xsl:template>
+
+<xsl:template match="varname">
+  <xsl:apply-templates/>
+</xsl:template>
+
+
+<xsl:template match="filename">
+  <hi rend="FileSpec">
+    <xsl:apply-templates/>
+  </hi>
+</xsl:template>
+
+<xsl:template match="footnote">
+  <note place="foot">
+    <xsl:apply-templates/>
+  </note>
+</xsl:template>
+
+<xsl:template match="informalexample">
+  <eg>
+    <xsl:apply-templates/>
+  </eg>
+</xsl:template>
+<xsl:template match="graphic">
+  <graphic target="@fileref">
+    <xsl:if test="@align">
+      <xsl:attribute name="rend" select="@align"/>
+    </xsl:if>
+  </graphic>
+</xsl:template>
+
+
+<!-- catch all -->
+
+<xsl:template match="*">
+  <xsl:message>Unknown element <xsl:value-of  select="name()"/></xsl:message>
+  <xsl:apply-templates/>
+</xsl:template>
+
+<!-- use general-purpose templates to add standard attributes -->
+<xsl:template name="Role">
+    <xsl:if test="@role">
+      <xsl:attribute name="rend">
+	<xsl:value-of select="@role"/>
+      </xsl:attribute>
+    </xsl:if>
+</xsl:template>
+
+<xsl:template name="Lang">
+    <xsl:if test="@lang">
+      <xsl:attribute name="xml:lang">
+	<xsl:value-of select="@lang"/>
+      </xsl:attribute>
+    </xsl:if>
+</xsl:template>
+
+<xsl:template name="ID">
+    <xsl:if test="@id">
+      <xsl:attribute name="xml:id">
+	<xsl:value-of select="@id"/>
+      </xsl:attribute>
+    </xsl:if>
+</xsl:template>
+
+  <xsl:template name="whatsTheDate">
+      <xsl:value-of select="format-dateTime(current-dateTime(),'[Y]-[M02]-[D02]T[H02]:[m02]:[s02]Z')"/>
+  </xsl:template>
+
+
+
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/docbook/from.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/p4/from.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/p4/from.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/p4/from.xsl	(revision 258)
@@ -0,0 +1,798 @@
+<?xml version="1.0"?>
+<xsl:stylesheet 
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:tei="http://www.tei-c.org/ns/1.0" 
+    xmlns="http://www.tei-c.org/ns/1.0"
+    version="2.0">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: from.xsl 10048 2012-01-18 10:03:59Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc>
+   </doc>
+
+  <!-- 
+       
+       P4 to P5 converter 
+       
+       Sebastian Rahtz <sebastian.rahtz@oucs.ox.ac.uk>
+       
+       $Date: 2012-01-18 10:03:59 +0000 (Wed, 18 Jan 2012) $  $Id: from.xsl 10048 2012-01-18 10:03:59Z rahtz $
+       
+  -->
+  <xsl:output method="xml" encoding="utf-8"
+    cdata-section-elements="tei:eg" omit-xml-declaration="yes"/>
+  
+  <xsl:variable name="processor">
+    <xsl:value-of select="system-property('xsl:vendor')"/>
+  </xsl:variable>
+  
+  <xsl:variable name="today">
+      <xsl:value-of select="format-dateTime(current-dateTime(),'[Y]-[M02]-[D02]T[H02]:[m02]:[s02]Z')"/>
+  </xsl:variable>
+  
+  <xsl:template match="*">
+    <xsl:choose>
+      <xsl:when test="namespace-uri()=''">
+	<xsl:element namespace="http://www.tei-c.org/ns/1.0" name="{local-name(.)}">
+	  <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
+	</xsl:element>
+      </xsl:when>
+      <xsl:otherwise>
+	<xsl:copy>
+	  <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
+	</xsl:copy>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  
+  
+  <xsl:template match="@*|processing-instruction()|comment()">
+    <xsl:copy/>
+  </xsl:template>
+  
+  
+  <xsl:template match="text()">
+    <xsl:value-of select="."/>
+  </xsl:template>
+  
+    <xsl:template match="teiCorpus.2">
+    <teiCorpus>
+      <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
+    </teiCorpus>
+  </xsl:template>
+  
+  <xsl:template match="witness/@sigil">
+    <xsl:attribute name="xml:id">
+      <xsl:value-of select="."/>
+    </xsl:attribute>
+  </xsl:template>
+
+  <xsl:template match="witList">
+    <listWit>
+      <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
+    </listWit>
+  </xsl:template>
+  
+  
+  <xsl:template match="TEI.2">
+    <TEI>
+      <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
+    </TEI>
+  </xsl:template>
+  
+  <xsl:template match="xref">
+    <xsl:element namespace="http://www.tei-c.org/ns/1.0" name="ref">
+      <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
+    </xsl:element>
+  </xsl:template>
+  
+  
+  <xsl:template match="xptr">
+    <xsl:element namespace="http://www.tei-c.org/ns/1.0" name="ptr">
+      <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
+    </xsl:element>
+  </xsl:template>
+  
+  
+  <xsl:template match="figure[@url]">
+    <figure>
+      <graphic>
+	<xsl:apply-templates select="@*"/>
+      </graphic>
+      <xsl:apply-templates/>
+    </figure>
+  </xsl:template>
+  
+ 
+  <xsl:template match="figure/@entity"/>
+
+  
+  <xsl:template match="figure[@entity]">
+    <figure>
+      <graphic>
+	<xsl:attribute name="url">
+	  <xsl:choose>
+	    <xsl:when test="unparsed-entity-uri(@entity)=''">
+	      <xsl:text>ENTITY_</xsl:text>
+	      <xsl:value-of select="@entity"/>
+	    </xsl:when>
+	    <xsl:otherwise>
+	      <xsl:value-of select="unparsed-entity-uri(@entity)"/>
+	    </xsl:otherwise>
+	  </xsl:choose>
+	</xsl:attribute>
+	<xsl:apply-templates select="@*"/>
+      </graphic>
+      <xsl:apply-templates/>
+    </figure>
+  </xsl:template>
+  
+  <xsl:template match="event">
+    <incident>
+      <xsl:apply-templates select="@*|*|text()|comment()|processing-instruction()"/>
+    </incident>
+  </xsl:template>
+  
+  <xsl:template match="state">
+    <refState>
+      <xsl:apply-templates select="@*|*|text()|comment()|processing-instruction()"/>
+    </refState>
+  </xsl:template>
+  
+  
+  <!-- lost elements -->
+  <xsl:template match="dateRange">
+    <date>
+      <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
+    </date>
+  </xsl:template>
+  
+  
+  <xsl:template match="dateRange/@from">
+    <xsl:copy-of select="."/>
+  </xsl:template>
+  
+  <xsl:template match="dateRange/@to">
+    <xsl:copy-of select="."/>
+  </xsl:template>
+  
+  <xsl:template match="language">
+    <xsl:element namespace="http://www.tei-c.org/ns/1.0" name="language">
+	<xsl:if test="@id">
+        <xsl:attribute name="ident">
+	  <xsl:value-of select="@id"/>
+        </xsl:attribute>
+        </xsl:if>
+      <xsl:apply-templates select="*|processing-instruction()|comment()|text()"/>
+    </xsl:element>
+  </xsl:template>
+  
+  <!-- attributes lost -->
+  <!-- dropped from TEI. Added as new change records later -->
+  <xsl:template match="@date.created"/>
+  
+  <xsl:template match="@date.updated"/>
+  
+  <!-- dropped from TEI. No replacement -->
+  <xsl:template match="refsDecl/@doctype"/>
+  
+  <!-- attributes changed name -->
+  
+  <xsl:template match="date/@value">
+    <xsl:attribute name="when">
+      <xsl:value-of select="."/>
+    </xsl:attribute>
+  </xsl:template>
+  
+  
+  <xsl:template match="@url">
+    <xsl:attribute name="target">
+      <xsl:value-of select="."/>
+    </xsl:attribute>
+  </xsl:template>
+  
+  <xsl:template match="figure/@url">
+    <xsl:attribute name="url">
+      <xsl:value-of select="."/>
+    </xsl:attribute>
+  </xsl:template>
+  
+  
+  <xsl:template match="@doc">
+    <xsl:attribute name="target">
+      <xsl:value-of select="unparsed-entity-uri(.)"/>
+    </xsl:attribute>
+  </xsl:template>
+  
+  
+  <xsl:template match="@id">
+    <xsl:choose>
+      <xsl:when test="parent::lang">
+	<xsl:attribute name="ident">
+	  <xsl:value-of select="."/>
+	</xsl:attribute>
+      </xsl:when>
+      <xsl:otherwise>
+	<xsl:attribute name="xml:id">
+	  <xsl:value-of select="."/>
+	</xsl:attribute>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  
+  
+  <xsl:template match="@lang">
+    <xsl:attribute name="xml:lang">
+      <xsl:value-of select="."/>
+    </xsl:attribute>
+  </xsl:template>
+  
+  
+  <xsl:template match="change/@date"/>
+  
+  <xsl:template match="date/@certainty">
+    <xsl:attribute name="cert">
+      <xsl:value-of select="."/>
+    </xsl:attribute>
+  </xsl:template>
+  
+  <!-- all pointing attributes preceded by # -->
+  
+  <xsl:template match="variantEncoding/@location">
+    <xsl:copy-of select="."/>
+  </xsl:template>
+
+  <xsl:template match="@ana|@active|@adj|@adjFrom|@adjTo|@children|@class|@code|@copyOf|@corresp|@decls|@domains|@end|@exclude|@fVal|@feats|@follow|@hand|@inst|@langKey|@location|@mergedin|@new|@next|@old|@origin|@otherLangs|@parent|@passive|@perf|@prev|@render|@resp|@sameAs|@scheme|@script|@select|@since|@start|@synch|@target|@targetEnd|@value|@value|@who|@wit">
+    <xsl:attribute name="{name(.)}">
+      <xsl:call-template name="splitter">
+	<xsl:with-param name="val">
+	  <xsl:value-of select="."/>
+	</xsl:with-param>
+      </xsl:call-template>
+    </xsl:attribute>
+  </xsl:template>
+  
+  
+  <xsl:template name="splitter">
+    <xsl:param name="val"/>
+    <xsl:choose>
+      <xsl:when test="contains($val,' ')">
+	<xsl:text>#</xsl:text>
+	<xsl:value-of select="substring-before($val,' ')"/>
+	<xsl:text> </xsl:text>
+	<xsl:call-template name="splitter">
+	  <xsl:with-param name="val">
+	    <xsl:value-of select="substring-after($val,' ')"/>
+	  </xsl:with-param>
+	</xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+	<xsl:text>#</xsl:text>
+	<xsl:value-of select="$val"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  
+  
+  <!-- fool around with selected elements -->
+  
+
+ <!-- imprint is no longer allowed inside bibl -->
+ <xsl:template match="bibl/imprint">
+    <xsl:apply-templates/>
+  </xsl:template>
+
+  <xsl:template match="editionStmt/editor">
+    <respStmt>    
+      <resp><xsl:value-of select="@role"/></resp>
+      <name><xsl:apply-templates/></name>
+    </respStmt>
+  </xsl:template>
+  
+  <!-- header -->  
+  
+  <xsl:template match="teiHeader">
+    <teiHeader>
+      <xsl:apply-templates select="@*|*|comment()|processing-instruction()"/>
+      
+      <xsl:if test="not(revisionDesc) and (@date.created or @date.updated)">
+	<revisionDesc>
+	  <xsl:if test="@date.updated">
+	    <change>>
+	    <label>updated</label>
+	    <date>
+	      <xsl:value-of select="@date.updated"/>
+	    </date>
+	    <label>Date edited</label>
+	    </change>
+	  </xsl:if>
+	  <xsl:if test="@date.created">
+	    <change>
+	      <label>created</label>
+	      <date>
+		<xsl:value-of select="@date.created"/>
+	      </date>
+	      <label>Date created</label>
+	    </change>
+	  </xsl:if>
+	</revisionDesc>
+      </xsl:if>
+      <!--
+	  <change when="{$today}">Converted to TEI P5 XML by p4top5.xsl
+	  written by Sebastian
+	  Rahtz at Oxford University Computing Services.</change>
+	  </revisionDesc>
+	  </xsl:if>
+      -->
+    </teiHeader>
+  </xsl:template>
+  
+  <xsl:template match="revisionDesc">
+    <revisionDesc>
+      <xsl:apply-templates
+	  select="@*|*|comment()|processing-instruction()"/>
+    </revisionDesc>
+  </xsl:template>
+  
+  <xsl:template match="publicationStmt">
+    <publicationStmt>
+      <xsl:apply-templates select="@*|*|comment()|processing-instruction()"/>
+      <!--
+	  <availability>
+	  <p>Licensed under <ptr target="http://creativecommons.org/licenses/by-sa/2.0/uk/"/></p>
+	  </availability>
+      -->
+    </publicationStmt>
+  </xsl:template>
+  
+ <!-- space does not have @extent any more -->
+  <xsl:template match="space/@extent">
+    <xsl:attribute name="quantity">
+      <xsl:value-of select="."/>
+    </xsl:attribute>
+  </xsl:template>
+
+ <!-- word key -->
+  <xsl:template match="entryFree/@key">
+    <xsl:attribute name="sortKey">
+      <xsl:value-of select="."/>
+    </xsl:attribute>
+  </xsl:template>
+
+  <!-- tagsDecl has a compulsory namespace child now -->
+  <xsl:template match="tagsDecl">
+    <xsl:if test="*">
+      <tagsDecl>
+	<namespace name="http://www.tei-c.org/ns/1.0">
+	  <xsl:apply-templates select="*|comment()|processing-instruction"/>
+	</namespace>
+      </tagsDecl>
+    </xsl:if>
+  </xsl:template>
+  
+  <!-- orgTitle inside orgName? redundant -->
+  <xsl:template match="orgName/orgTitle">
+      <xsl:apply-templates/>
+  </xsl:template>
+
+ <!-- no need for empty <p> in sourceDesc -->  
+  <xsl:template match="sourceDesc/p[string-length(.)=0]"/>
+  
+  <!-- start creating the new choice element -->
+  <xsl:template match="corr[@sic]">
+    <choice>
+      <corr>
+	<xsl:value-of select="text()" />
+      </corr>
+      <sic>
+	<xsl:value-of select="@sic" />
+      </sic>
+    </choice>
+  </xsl:template>
+  
+  <xsl:template match="gap/@desc"/>
+
+  <xsl:template match="gap">
+    <gap>
+      <xsl:apply-templates select="@*"/>
+      <xsl:if test="@desc">
+	<desc>
+	  <xsl:value-of select="@desc"/>
+	</desc>
+      </xsl:if>
+    </gap>
+  </xsl:template>
+
+  <xsl:template match="sic[@corr]">
+    <choice>
+      <sic>
+	<xsl:apply-templates/>
+      </sic>
+      <corr>
+	<xsl:value-of select="@corr" />
+      </corr>
+    </choice>
+  </xsl:template>
+  
+  <xsl:template match="abbr[@expan]">
+    <choice>
+      <abbr>
+	<xsl:apply-templates/>
+      </abbr>
+      <expan>
+	<xsl:value-of select="@expan" />
+      </expan>
+    </choice>
+  </xsl:template>
+  
+  <xsl:template match="expan[@abbr]">
+    <choice>
+      <expan>
+	<xsl:apply-templates/>
+      </expan>
+      <abbr>
+	<xsl:value-of select="@abbr" />
+      </abbr>
+    </choice>
+  </xsl:template>
+  
+  <!-- special consideration for <change> element -->
+  <xsl:template match="change">
+    <change>
+      <xsl:apply-templates select="item/@*"/>
+      
+      <xsl:apply-templates select="date"/>
+      
+      <xsl:if test="respStmt/resp">
+	<label>
+	  <xsl:value-of select="respStmt/resp/text()"/>
+	</label>
+      </xsl:if>
+	<xsl:for-each select="respStmt/name">
+	  <name>
+	    <xsl:apply-templates
+		select="@*|*|comment()|processing-instruction()|text()"/>
+	  </name>
+	</xsl:for-each>
+	<xsl:for-each select="item">
+	  <xsl:apply-templates
+	      select="*|comment()|processing-instruction()|text()"/>
+	</xsl:for-each>
+    </change>
+  </xsl:template>
+
+
+  <xsl:template match="respStmt[resp]">
+    <respStmt>
+      <xsl:choose>
+	<xsl:when test="resp/name">
+	  <resp>
+	    <xsl:value-of select="resp/text()"/>
+	  </resp>
+	    <xsl:for-each select="resp/name">
+	      <name>
+		<xsl:apply-templates/>
+	      </name>
+	    </xsl:for-each>
+	</xsl:when>
+	<xsl:otherwise>
+	  <xsl:apply-templates/>
+	  <name>
+	  </name>
+	</xsl:otherwise>
+      </xsl:choose>
+    </respStmt>
+  </xsl:template>
+
+  <xsl:template match="q/@direct"/>
+  
+  <xsl:template match="q">
+    <q>
+      <xsl:apply-templates
+	  select="@*|*|comment()|processing-instruction()|text()"/>
+    </q>
+  </xsl:template>
+
+  
+<!-- if we are reading the P4 with a DTD,
+       we need to avoid copying the default values
+       of attributes -->
+  
+  <xsl:template match="@targOrder">
+    <xsl:if test="not(lower-case(.) ='u')">
+      <xsl:attribute name="targOrder">
+	<xsl:value-of select="."/>
+      </xsl:attribute>
+    </xsl:if>
+  </xsl:template>
+  
+  
+  <xsl:template match="@opt">
+    <xsl:if test="not(lower-case(.) ='n')">
+      <xsl:attribute name="opt">
+	<xsl:value-of select="."/>
+      </xsl:attribute>
+    </xsl:if>
+  </xsl:template>
+  
+  
+  <xsl:template match="@to">
+    <xsl:if test="not(lower-case(.) ='ditto')">
+      <xsl:attribute name="to">
+	<xsl:value-of select="."/>
+      </xsl:attribute>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template match="xptr/@to">
+      <xsl:attribute name="target">
+	<xsl:value-of select="."/>
+      </xsl:attribute>
+  </xsl:template>
+  
+  <xsl:template match="interp/@value">
+      <xsl:attribute name="inst">
+	<xsl:value-of select="."/>
+      </xsl:attribute>
+  </xsl:template>
+  
+  
+  <xsl:template match="@default">
+    <xsl:choose>
+      <xsl:when test="lower-case(.)= 'no'"/>
+      <xsl:otherwise>
+	<xsl:attribute name="default">
+	  <xsl:value-of select="."/>
+	</xsl:attribute>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  
+  
+  <xsl:template match="@part">
+    <xsl:if test="not(lower-case(.) ='n')">
+      <xsl:attribute name="part">
+	<xsl:value-of select="."/>
+      </xsl:attribute>
+    </xsl:if>
+  </xsl:template>
+  
+  
+  <xsl:template match="@full">
+    <xsl:if test="not(lower-case(.) ='yes')">
+      <xsl:attribute name="full">
+	<xsl:value-of select="."/>
+      </xsl:attribute>
+    </xsl:if>
+  </xsl:template>
+  
+  
+  <xsl:template match="@from">
+    <xsl:if test="not(lower-case(.) ='root')">
+      <xsl:attribute name="from">
+	<xsl:value-of select="."/>
+      </xsl:attribute>
+    </xsl:if>
+  </xsl:template>
+  
+  
+  <xsl:template match="@status">
+    <xsl:choose>
+      <xsl:when test="parent::teiHeader">
+	<xsl:if test="not(lower-case(.) ='new')">
+	  <xsl:attribute name="status">
+	    <xsl:value-of select="."/>
+	  </xsl:attribute>
+	</xsl:if>
+      </xsl:when>
+      <xsl:when test="parent::del">
+	<xsl:if test="not(lower-case(.) ='unremarkable')">
+	  <xsl:attribute name="status">
+	    <xsl:value-of select="."/>
+	  </xsl:attribute>
+	</xsl:if>
+      </xsl:when>
+      <xsl:otherwise>
+	<xsl:attribute name="status">
+	  <xsl:value-of select="."/>
+	</xsl:attribute>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  
+  
+  <xsl:template match="@place">
+    <xsl:if test="not(lower-case(.) ='unspecified')">
+      <xsl:attribute name="place">
+	<xsl:value-of select="."/>
+      </xsl:attribute>
+    </xsl:if>
+  </xsl:template>
+  
+  
+  <xsl:template match="@sample">
+    <xsl:if test="not(lower-case(.) ='complete')">
+      <xsl:attribute name="sample">
+	<xsl:value-of select="."/>
+      </xsl:attribute>
+    </xsl:if>
+  </xsl:template>
+  
+  
+  <xsl:template match="@org">
+    <xsl:if test="not(lower-case(.) ='uniform')">
+      <xsl:attribute name="org">
+	<xsl:value-of select="."/>
+      </xsl:attribute>
+    </xsl:if>
+  </xsl:template>
+  
+  <xsl:template match="teiHeader/@type">
+    <xsl:if test="not(lower-case(.) ='text')">
+      <xsl:attribute name="type">
+	<xsl:value-of select="."/>
+      </xsl:attribute>
+    </xsl:if>
+  </xsl:template>
+  
+  <!-- yes|no to boolean -->
+  
+  <xsl:template match="@anchored">
+    <xsl:attribute name="anchored">
+      <xsl:choose>
+	<xsl:when test="lower-case(.)='yes'">true</xsl:when>
+	<xsl:when test="lower-case(.)='no'">false</xsl:when>
+      </xsl:choose>
+    </xsl:attribute>
+  </xsl:template>
+  
+  <xsl:template match="sourceDesc/@default"/>
+  
+  <xsl:template match="@tei">
+    <xsl:attribute name="tei">
+      <xsl:choose>
+	<xsl:when test="lower-case(.)='yes'">true</xsl:when>
+	<xsl:when test="lower-case(.)='no'">false</xsl:when>
+      </xsl:choose>
+    </xsl:attribute>
+  </xsl:template>
+  
+  <xsl:template match="@langKey"/>  
+  
+  <xsl:template match="@TEIform"/>  
+
+<!-- assorted atts -->
+
+  <xsl:template match="gi/@TEI">  	 
+    <xsl:if test=".='yes'">
+      <xsl:attribute name="scheme">TEI</xsl:attribute>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template match="@old"/>  
+
+  <xsl:template match="ref/@from"/>  
+
+  <xsl:template match="@mergedin">  
+    <xsl:attribute name="mergedIn">
+      <xsl:value-of select="."/>
+    </xsl:attribute>
+  </xsl:template>
+
+<!-- deal with the loss of div0 -->  
+
+  <xsl:template match="div0|div1|div2|div3|div4|div5|div6">
+    <xsl:element name="div" namespace="http://www.tei-c.org/ns/1.0">
+      <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
+    </xsl:element>
+  </xsl:template>
+
+
+<!-- from Conal Tuohy -->
+<xsl:template match="orig[@reg]">
+  <choice>
+    <orig>
+      <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
+    </orig>
+    <reg>
+      <xsl:value-of select="@reg"/>
+    </reg>
+  </choice>
+</xsl:template>
+
+<xsl:template match="reg[@orig]">
+  <choice>
+    <reg><xsl:apply-templates select="*|@*|processing-instruction()|
+    comment()|text()"/></reg>
+    <orig><xsl:value-of select="@orig"/></orig>
+  </choice>
+</xsl:template>
+
+<xsl:template match="@orig|@reg"/>
+
+<!-- remove default values for attributes -->
+
+<xsl:template match="row/@role[.='data']"/>
+<xsl:template match="cell/@role[.='data']"/>
+<xsl:template match="cell/@rows[.='1']"/>
+<xsl:template match="cell/@cols[.='1']"/>
+<xsl:template match="q/@broken[.='no']"/>
+
+  <xsl:template match="text[not(parent::TEI.2)]">
+    <floatingText>
+	<xsl:apply-templates 
+	    select="*|@*|processing-instruction()|comment()|text()"/>
+    </floatingText>
+  </xsl:template>
+
+<!-- from CES -->
+  <xsl:template match="cesdoc">
+    <cesDoc>
+    <xsl:apply-templates 
+        select="*|@*|processing-instruction()|comment()|text()"/>
+    </cesDoc>
+</xsl:template>
+
+<!-- found in Perseus -->
+
+  <xsl:template match="lg1|lg2|lg3|lg4">
+    <lg>
+    <xsl:apply-templates 
+        select="*|@*|processing-instruction()|comment()|text()"/>
+    </lg>
+  </xsl:template>
+
+<!-- from OTA DTD -->
+  <xsl:template match="spkr">
+    <speaker>
+    <xsl:apply-templates 
+        select="*|@*|processing-instruction()|comment()|text()"/>
+    </speaker>
+  </xsl:template>
+
+  <xsl:template match="letter">
+    <floatingText type="letter">
+      <body>
+	<xsl:apply-templates 
+	    select="*|@*|processing-instruction()|comment()|text()"/>
+      </body>
+    </floatingText>
+  </xsl:template>
+
+
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/p4/from.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/ibooks/cover-template.jpg
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/ibooks/cover-template.jpg
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/ibooks/to.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/ibooks/to.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/ibooks/to.xsl	(revision 258)
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                version="2.0"
+                exclude-result-prefixes="tei">
+    <xsl:import href="../../../ibooks/tei-to-ibooks.xsl"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+    <desc>
+      <p> TEI stylesheet for making iBooks from TEI.</p>
+      <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+      <p>Author: See AUTHORS</p>
+      <p>Id: $Id: to.xsl 8698 2011-02-25 22:34:37Z rahtz $</p>
+      <p>Copyright: 2008, TEI Consortium</p>
+    </desc>
+  </doc>
+
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/ibooks/to.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/ibooks/cover.jpg
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/ibooks/cover.jpg
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/odt/to.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/odt/to.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/odt/to.xsl	(revision 258)
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns="http://www.tei-c.org/ns/1.0"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                version="2.0"
+		>
+    <!-- import base conversion style -->
+
+    <xsl:import href="../../../odt/teitoodt.xsl"/>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+    <desc>
+      <p> TEI stylesheet for converting TEI to ODF</p>
+      <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+      <p>Author: See AUTHORS</p>
+      <p>Id: $Id: to.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+      <p>Copyright: 2008, TEI Consortium</p>
+    </desc>
+  </doc>
+<xsl:param name="freestanding">true</xsl:param>
+    
+    
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/odt/to.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/odt/from.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/odt/from.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/odt/from.xsl	(revision 258)
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns="http://www.tei-c.org/ns/1.0"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                version="2.0"
+		>
+    <!-- import base conversion style -->
+
+    <xsl:import href="../../../odt/odttotei.xsl"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+    <desc>
+      <p> TEI stylesheet for simplifying TEI ODD markup </p>
+      <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+      <p>Author: See AUTHORS</p>
+      <p>Id: $Id: from.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+      <p>Copyright: 2008, TEI Consortium</p>
+    </desc>
+  </doc>
+    
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/odt/from.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/odt/template.odt
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/odt/template.odt
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/tei-fo.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/tei-fo.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/tei-fo.xsl	(revision 258)
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet 
+                xmlns:m="http://www.w3.org/1998/Math/MathML"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:fotex="http://www.tug.org/fotex"
+                xmlns:fo="http://www.w3.org/1999/XSL/Format"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                exclude-result-prefixes="tei fotex fo m"
+                version="2.0">
+    <!-- import base conversion style -->
+
+    <xsl:import href="../../fo2/tei.xsl"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: tei-fo.xsl 9669 2011-11-07 19:17:54Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc>
+   </doc>
+
+  
+    
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/tei-fo.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/html5/to.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/html5/to.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/html5/to.xsl	(revision 258)
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet 
+    xmlns:tei="http://www.tei-c.org/ns/1.0"
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    exclude-result-prefixes="tei"
+    version="2.0">
+
+    <!-- import base conversion style -->
+
+    <xsl:import href="../../../html5/tei.xsl"/>
+    <xsl:import href="../../../html5/microdata.xsl"/>
+
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: to.xsl 8923 2011-05-25 13:11:45Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc>
+   </doc>
+
+
+
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/html5/to.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/epub/cover-template.jpg
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/epub/cover-template.jpg
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/epub/to.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/epub/to.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/epub/to.xsl	(revision 258)
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                version="2.0"
+                exclude-result-prefixes="tei">
+    <xsl:import href="../../../epub/tei-to-epub.xsl"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+    <desc>
+      <p> TEI stylesheet for making ePub from TEI.</p>
+      <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+      <p>Author: See AUTHORS</p>
+      <p>Id: $Id: to.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+      <p>Copyright: 2008, TEI Consortium</p>
+    </desc>
+  </doc>
+
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/epub/to.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/epub/cover.jpg
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/epub/cover.jpg
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/oddhtml/to.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/oddhtml/to.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/oddhtml/to.xsl	(revision 258)
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet 
+    xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
+    xmlns:fo="http://www.w3.org/1999/XSL/Format" 
+    xmlns:html="http://www.w3.org/1999/xhtml" 
+    xmlns:i="http://www.iso.org/ns/1.0"
+    xmlns:rng="http://relaxng.org/ns/structure/1.0"
+    xmlns:s="http://www.ascc.net/xml/schematron" 
+    xmlns:sch="http://purl.oclc.org/dsdl/schematron" 
+    xmlns:tei="http://www.tei-c.org/ns/1.0"
+    xmlns:teix="http://www.tei-c.org/ns/Examples" 
+    xmlns:xi="http://www.w3.org/2001/XInclude"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    exclude-result-prefixes="a fo html i rng s sch tei teix xi xs xsl"
+                version="2.0">
+
+    <!-- import base conversion style -->
+
+    <xsl:import href="../../../odds2/odd2html.xsl"/>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: to.xsl 9703 2011-11-09 11:16:42Z rahtz $</p>
+         <p>Copyright: 2010, TEI Consortium</p>
+      </desc>
+   </doc>
+
+  
+    
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/oddhtml/to.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/csv/to.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/csv/to.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/csv/to.xsl	(revision 258)
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<xsl:stylesheet version="2.0"
+	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+	xmlns:xs="http://www.w3.org/2001/XMLSchema"
+	xmlns:tei="http://www.tei-c.org/ns/1.0" exclude-result-prefixes="xs tei">
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: James Cummings </p>
+         <p>Id: $Id: to.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2010, TEI Consortium</p>
+	<p>
+		Usage:  saxon filename.xsl tei2csv.xsl 
+		<ul>
+		<li> This produces files named tableX.csv
+		where X is the number of the table in the 
+		document as a whole.</li>
+		<li> All other content is discarded</li>
+		<li> All output is in UTF-8, input-encoding is 
+		based on XML declaration in the original file.
+		</li>
+		</ul>
+	</p>
+      </desc>
+   </doc>
+   <xsl:output omit-xml-declaration="yes"/>
+
+  <xsl:param name="directory"></xsl:param>
+
+   <xsl:template match="/">
+     <xsl:for-each select="//tei:table">
+       <xsl:variable name="tableNum">
+	 <xsl:number level="any"/>
+       </xsl:variable>
+       <xsl:result-document href="{concat($directory,'table',$tableNum, '.csv')}"
+			    encoding="UTF-8" method="text">
+	 <xsl:for-each select="tei:row">
+	   <xsl:for-each select="tei:cell">
+	     <xsl:value-of select="concat('&quot;',normalize-space(.),'&quot;')"/>
+	     <xsl:if test="following-sibling::tei:cell[1]">,</xsl:if>
+	   </xsl:for-each>
+	   <xsl:text>&#xa;</xsl:text>
+	 </xsl:for-each>
+       </xsl:result-document>
+     </xsl:for-each>
+   </xsl:template>
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/csv/to.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/csv/from.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/csv/from.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/csv/from.xsl	(revision 258)
@@ -0,0 +1,133 @@
+<?xml version="1.0"?>
+
+<xsl:stylesheet version="2.0"
+	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+	xmlns:xs="http://www.w3.org/2001/XMLSchema"
+	xmlns:tei="http://www.tei-c.org/ns/1.0"
+	xmlns:jc="http://james.blushingbunny.net/ns.html"
+	exclude-result-prefixes="xs tei jc">
+	<xsl:param name="input-encoding" select="'UTF-8'" as="xs:string"/>
+	<xsl:output indent="yes" encoding="UTF-8"/>
+	<xsl:param name="input-uri" select="'filename.csv'"/>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: James Cummings</p>
+         <p>Id: $Id: from.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2010, TEI Consortium</p>
+<p>
+Usage:  saxon -it main styesheet.xsl input-uri=filename.csv
+
+<ul>
+<li> It assumes cells are comma separated and 
+rows are on individual lines...technically a linebreak 
+is allowed to occur inside a quoted CSV field, but in 
+this stylesheet it will be treated as two separate lines.</li>
+<li>If surrounded in double-quotes, it will remove 
+them.</li>
+<li>If there are extra or final commas, these will be changed 
+into empty <gi>cell/</gi> elements </li>
+<li> It assumes things are in UTF-8 but this can be 
+changed with the input-encoding parameter.  
+All output is converted to UTF-8.</li>
+</ul>
+</p>
+      </desc>
+   </doc>
+
+   <xsl:function name="jc:splitCSV" as="xs:string+">
+     <xsl:param name="str" as="xs:string"/>
+     <xsl:analyze-string select="concat($str, ',')"
+			 regex="((&quot;[^&quot;]*&quot;)+|[^,]*),">
+       <xsl:matching-substring>
+	 <xsl:sequence
+	     select="replace(regex-group(1), &quot;^&quot;&quot;|&quot;&quot;$|(&quot;&quot;)&quot;&quot;&quot;, &quot;$1&quot;)"
+	     />
+       </xsl:matching-substring>
+     </xsl:analyze-string>
+   </xsl:function>
+   
+   <xsl:template match="/" name="main">
+     <xsl:choose>
+       <xsl:when test="unparsed-text-available($input-uri, $input-encoding)">
+	 <xsl:variable name="csv"
+		       select="unparsed-text($input-uri, $input-encoding)"/>
+	 <xsl:variable name="lines" select="tokenize($csv, '&#xa;')"
+		       as="xs:string+"/>
+	 <TEI xmlns="http://www.tei-c.org/ns/1.0">
+	   <teiHeader>
+	     <fileDesc>
+	       <titleStmt>
+		 <title>A TEI file automatically converted from CSV</title>
+	       </titleStmt>
+	       <publicationStmt>
+		 <p>No publication statement</p>
+	       </publicationStmt>
+	       <sourceDesc>
+		 <p>A TEI file automatically converted from a CSV file.</p>
+		 
+	       </sourceDesc>
+	     </fileDesc>
+	   </teiHeader>
+	   <text>
+	     <body>
+	       <table>
+		 <xsl:for-each select="$lines">
+		   <row>
+		     <xsl:variable name="lineItems" select="jc:splitCSV(.)"
+				   as="xs:string+"/>
+		     
+		     <xsl:for-each select="$lineItems">
+		       <xsl:variable name="pos" select="position()"/>
+		       <cell n="{$pos}">
+			 <xsl:value-of select="$lineItems[$pos]"/>
+		       </cell>
+		     </xsl:for-each>
+		   </row>
+		 </xsl:for-each>
+	       </table>
+	     </body>
+	   </text>
+	 </TEI>
+       </xsl:when>
+       <xsl:otherwise>
+	 <xsl:message terminate="yes">
+	   <xsl:text>Cannot find the input csv file: </xsl:text>
+	   <xsl:value-of select="$input-uri"/>
+	 </xsl:message>
+       </xsl:otherwise>
+     </xsl:choose>
+   </xsl:template>
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/csv/from.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/csv/plugin.xml
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/csv/plugin.xml	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/csv/plugin.xml	(revision 258)
@@ -0,0 +1,32 @@
+<plugin>
+	<extension plugin-id="pl.psnc.dl.ege.root" point-id="XslConverter" id="CSVtoTEIconverter">
+		<parameter id="class" value="pl.psnc.dl.ege.MultiXslConverter"/>
+		<parameter id="name" value="CSV to TEI"/>
+		<parameter id="xsluri" value="profiles/default/csv/from.xsl" />
+		<parameter id="iMimeType" value="text/csv" />
+		<parameter id="iFormat" value="csv" />
+		<parameter id="iDescription" value="Comma-Separated Values (.csv)" />
+		<parameter id="iType" value="spreadsheet" />		
+		<parameter id="oMimeType" value="text/xml" />
+		<parameter id="oFormat" value="TEI" />
+		<parameter id="oDescription" value="TEI P5 XML Document" />		
+		<parameter id="oType" value="text" />
+		<parameter id="visibility" value="true" />
+		<parameter id="cost" value="9" />
+	</extension>
+	<extension plugin-id="pl.psnc.dl.ege.root" point-id="XslConverter" id="TEItoCSVconverter">
+		<parameter id="class" value="pl.psnc.dl.ege.MultiXslConverter"/>
+		<parameter id="name" value="TEI to CSV"/>
+		<parameter id="xsluri" value="profiles/default/csv/to.xsl" />
+		<parameter id="iMimeType" value="text/xml" />
+		<parameter id="iFormat" value="TEI" />
+		<parameter id="iDescription" value="TEI P5 XML Document" />
+		<parameter id="iType" value="text" />		
+		<parameter id="oMimeType" value="text/csv" />
+		<parameter id="oFormat" value="csv" />
+		<parameter id="oDescription" value="Comma-Separated Values (.csv)" />		
+		<parameter id="oType" value="spreadsheet" />
+		<parameter id="visibility" value="true" />
+		<parameter id="cost" value="11" />
+	</extension>
+</plugin>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/csv/plugin.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/lite/to.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/lite/to.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/lite/to.xsl	(revision 258)
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet 
+                xmlns:m="http://www.w3.org/1998/Math/MathML"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                exclude-result-prefixes="tei m"
+                version="2.0">
+
+    <!-- import base conversion style -->
+
+    <xsl:import href="../../../odds2/odd2lite.xsl"/>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: to.xsl 9703 2011-11-09 11:16:42Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc>
+   </doc>
+
+  
+    
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/lite/to.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/docx/default-functions.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/docx/default-functions.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/docx/default-functions.xsl	(revision 258)
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:iso="http://www.iso.org/ns/1.0"
+                xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006"
+                xmlns:o="urn:schemas-microsoft-com:office:office"
+                xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
+                xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"
+                xmlns:v="urn:schemas-microsoft-com:vml"
+                xmlns:fn="http://www.w3.org/2005/02/xpath-functions"
+                xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"
+                xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
+                xmlns:w10="urn:schemas-microsoft-com:office:word"
+                xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
+                xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml"
+                xmlns:mml="http://www.w3.org/1998/Math/MathML"
+                xmlns:tbx="http://www.lisa.org/TBX-Specification.33.0.html"
+                xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"
+                
+                xmlns:teidocx="http://www.tei-c.org/ns/teidocx/1.0"
+                version="2.0"
+                exclude-result-prefixes="ve o r m v wp w10 w wne mml tbx iso tei a xs pic fn">
+
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> Specialized TEI stylesheet for transforming tei into Word docx files for Vesta </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: default-functions.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc>
+   </doc>
+    
+    <!-- returns a listtype for a given stylename (return empty string to figure it out dynamically)-->
+    <xsl:function name="tei:get-listtype" as="xs:string">
+        <xsl:param name="style"/>
+        <xsl:choose>
+            <xsl:when test="starts-with($style,'dl')">
+                <xsl:text>gloss</xsl:text>
+            </xsl:when>
+            <xsl:when test="starts-with($style,$ListBullet)">
+                <xsl:text>unordered</xsl:text>
+            </xsl:when>
+            <xsl:when test="starts-with($style,$ListContinue)">
+                <xsl:text>unordered</xsl:text>
+            </xsl:when>
+            <xsl:when test="starts-with($style,$ListNumber)">
+                <xsl:text>ordered</xsl:text>
+            </xsl:when>
+            <xsl:when test="$style=$List">
+                <xsl:text>ordered</xsl:text>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:text/>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:function>
+    
+    <xsl:function name="tei:render-bold" as="xs:boolean">
+        <xsl:param name="element"/>
+        <xsl:for-each select="$element">
+            <xsl:choose>
+		<xsl:when test="ancestor-or-self::tei:cell[@rend='wovenodd-col1']">true</xsl:when>
+		<xsl:when test="ancestor-or-self::tei:cell[@role='label']">true</xsl:when>
+		<xsl:when test="self::tei:cell and parent::tei:row[@role='label']">true</xsl:when>
+                <xsl:when test="@rend='bold'">true</xsl:when>
+                <xsl:when test="@rend='label'">true</xsl:when>
+                <xsl:when test="@rend='odd_label'">true</xsl:when>
+                <xsl:when test="contains(@rend,'bold')">true</xsl:when>
+                <xsl:when test="parent::tei:hi[@rend='bold']">true</xsl:when>
+                <xsl:when test="parent::tei:hi[starts-with(@rend,'specList-')]">true</xsl:when>
+                <xsl:when test="self::tei:docAuthor">true</xsl:when>
+                <xsl:when test="self::tei:hi[@rend='label']">true</xsl:when>
+                <xsl:when test="self::tei:label[following-sibling::tei:item]">true</xsl:when>
+                <xsl:when test="self::tei:term">true</xsl:when>
+                <xsl:when test="starts-with(@rend,'specList-')">true</xsl:when>
+                <xsl:when test="starts-with(parent::tei:hi/@rend,'specList-')">true</xsl:when>
+                <xsl:otherwise>false</xsl:otherwise>
+            </xsl:choose>
+        </xsl:for-each>
+    </xsl:function>
+    
+
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/docx/default-functions.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/docx/template.docx
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/docx/template.docx
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/docx/template_orig.docx
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/docx/template_orig.docx
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/docx/to.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/docx/to.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/docx/to.xsl	(revision 258)
@@ -0,0 +1,392 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:iso="http://www.iso.org/ns/1.0"
+                xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006"
+                xmlns:o="urn:schemas-microsoft-com:office:office"
+                xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
+                xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"
+                xmlns:v="urn:schemas-microsoft-com:vml"
+                xmlns:fn="http://www.w3.org/2005/02/xpath-functions"
+                xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"
+                xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
+                xmlns:w10="urn:schemas-microsoft-com:office:word"
+                xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
+                xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml"
+                xmlns:mml="http://www.w3.org/1998/Math/MathML"
+                xmlns:tbx="http://www.lisa.org/TBX-Specification.33.0.html"
+                xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"
+                
+                xmlns:teidocx="http://www.tei-c.org/ns/teidocx/1.0"
+                version="2.0"
+                exclude-result-prefixes="ve o r m v wp w10 w wne mml tbx iso tei a xs pic fn tei teidocx">
+    <!-- import conversion style -->
+
+    <xsl:import href="../../../docx/to/teitodocx.xsl"/>
+    
+    <!-- import functions -->
+    <xsl:import href="default-functions.xsl"/>
+    
+    <xsl:param name="renderAddDel">true</xsl:param>
+    <xsl:param name="addColour">red</xsl:param>
+
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet for making Word docx files from TEI XML (see tei-docx.xsl)</p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: to.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc>
+   </doc>
+    
+    <xsl:param name="bulletOne">•</xsl:param>
+    <xsl:param name="bulletTwo"></xsl:param>
+
+    <xsl:param name="word-directory">..</xsl:param>
+    <xsl:param name="debug">false</xsl:param>
+    <xsl:param name="styleDoc">
+        <xsl:value-of select="concat($word-directory, '/word/styles.xml')"/>
+    </xsl:param>
+    
+    <!-- Styles -->
+    
+    <xsl:template match="tei:abbr" mode="get-style">abbr</xsl:template>
+    <xsl:template match="tei:cit" mode="get-style">Quote</xsl:template>
+    <xsl:template match="tei:date" mode="get-style">date</xsl:template>
+    <xsl:template match="tei:foreign" mode="get-style">teiforeign</xsl:template>
+    <xsl:template match="tei:formula" mode="get-style">Formula</xsl:template>
+    <xsl:template match="tei:mentioned" mode="get-style">teimentioned</xsl:template>
+    <xsl:template match="tei:orgName" mode="get-style">orgName</xsl:template>
+    <xsl:template match="tei:quote" mode="get-style">Quote</xsl:template>
+    <xsl:template match="tei:ref[@rend and not(@target)]" mode="get-style"><xsl:value-of select="@rend"/></xsl:template>
+    <xsl:template match="tei:seg[@rend]" mode="get-style"><xsl:value-of select="@rend"/></xsl:template>
+
+    <xsl:template match="tei:p[@rend]" mode="get-style">
+        <xsl:call-template name="getStyleName">
+            <xsl:with-param name="in" select="@rend"/>
+        </xsl:call-template>
+    </xsl:template>
+
+       <xsl:template match="tei:editionStmt">
+        <w:r>
+            <w:t>
+            <xsl:value-of select="tei:edition"/> Edition</w:t>
+        </w:r>
+    </xsl:template>
+
+    <xsl:template match="tei:label[following-sibling::tei:*[1]/self::tei:item]">
+        <xsl:param name="nop"/>   
+	<xsl:variable name="pair">
+	  <tei:list>
+	    <tei:glossListEntry count="{count(ancestor::tei:list)}">
+	      <tei:hi rend="bold">
+		<xsl:apply-templates mode="iden"/>
+	      </tei:hi>
+	      <tei:lb/>
+	      <xsl:for-each select="following-sibling::tei:item[1]">
+		<xsl:apply-templates mode="iden"/>
+	      </xsl:for-each>
+	    </tei:glossListEntry>
+	  </tei:list>
+	</xsl:variable>
+	<xsl:apply-templates select="$pair/tei:list/tei:glossListEntry"/>
+    </xsl:template>
+
+    <xsl:template match="tei:glossListEntry">
+      <xsl:call-template name="block-element">
+	<xsl:with-param name="style">dl</xsl:with-param>
+	<xsl:with-param name="pPr">
+	  <w:pPr>
+	    <w:pStyle w:val="dl"/>
+	    <w:ind w:left="360" w:hanging="360"/>
+	  </w:pPr>
+	</xsl:with-param>
+      </xsl:call-template>
+    </xsl:template>
+
+   
+    <xsl:template match="tei:seg[not(@*) and normalize-space(.)='']">
+      <w:r>
+	<w:t>
+	  <xsl:attribute name="xml:space">preserve</xsl:attribute>
+	  <xsl:text> </xsl:text>
+	</w:t>
+      </w:r>
+    </xsl:template>
+
+    
+    <!-- 
+        Block Templates:
+        Here we can overwrite how block elements are rendered
+    -->
+  
+    
+    <!-- Dates -->
+    <xsl:template match="tei:date[ancestor::tei:teiHeader]">
+        <w:r>
+            <w:rPr>
+                <w:rStyle w:val="date"/>
+            </w:rPr>
+            <w:t>
+                <xsl:value-of select="."/>
+            </w:t>
+        </w:r>
+    </xsl:template>
+
+    <!-- formulas -->
+    <xsl:template match="tei:formula">
+        <w:p>    
+            <w:pPr>
+                <w:pStyle w:val="Formula"/>
+            </w:pPr>
+            <xsl:call-template name="block-element">                   
+                <xsl:with-param name="nop">true</xsl:with-param>
+            </xsl:call-template>
+            <xsl:if test="@n">
+                <w:r>
+                    <w:tab/>
+                </w:r>
+                <w:r>
+                    <w:rPr>
+                        <w:rStyle w:val="FormulaReference"/>
+                    </w:rPr>
+                    <w:t xml:space="preserve"><xsl:value-of select="@n"/></w:t>
+                </w:r>
+            </xsl:if>
+        </w:p>
+    </xsl:template>
+    
+     
+    <!-- 
+        Special Notes (Footnotes) .. 
+        @TODO: Ideally this should go into the general template, but for some
+        reason xsl always calls the less specific tei:note template in here. 
+    -->
+    <xsl:template match="tei:note[@place]">
+        <xsl:choose>
+            <xsl:when test="@place='foot'  or @place='bottom' or @place='tablefoot' ">
+                <xsl:call-template name="create-footnote"/>
+            </xsl:when>
+            <xsl:when test="@place='end'">
+                <xsl:call-template name="create-endnote"/>
+            </xsl:when>
+	    <xsl:when test="@place='comment'">
+	      <xsl:call-template name="create-comment"/>
+	    </xsl:when>
+	</xsl:choose>
+    </xsl:template>
+    
+    
+    
+    <!-- Paragraphs in the front matter -->
+    <xsl:template match="tei:front/tei:div/tei:p">
+        <xsl:call-template name="block-element">
+            <xsl:with-param name="pPr">
+                <w:pPr>
+                    <w:pStyle>
+                        <xsl:attribute name="w:val">
+                            <xsl:value-of select="concat(upper-case(substring(parent::tei:div/@type,1,1)),substring(parent::tei:div/@type,2))"/>
+                        </xsl:attribute>
+                    </w:pStyle>
+                </w:pPr>
+            </xsl:with-param>
+        </xsl:call-template>
+    </xsl:template>
+   
+    
+    
+    <!-- who created this document -->
+    <xsl:template name="created-by">
+        <xsl:text>TEI XSL</xsl:text>
+    </xsl:template>
+
+
+    <!-- fake listPerson into an unordered list -->
+  <xsl:template match="tei:listPerson">
+      <xsl:variable name="mylist">
+         <tei:list type="unordered">
+	           <xsl:apply-templates/>
+         </tei:list>
+      </xsl:variable>
+      <xsl:apply-templates select="$mylist"/>
+  </xsl:template>
+
+  <xsl:template match="tei:person">
+      <tei:item>
+         <xsl:copy-of select="*|text()"/>
+      </tei:item>
+  </xsl:template>
+
+  <xsl:template match="tei:affiliation">
+      <w:r>
+        <w:br/>
+      </w:r>   
+     <xsl:apply-templates/>
+  </xsl:template>
+
+
+    <xsl:template name="defineOrderedLists">
+      <w:abstractNum w:abstractNumId="3">
+                    <w:multiLevelType w:val="multilevel"/>
+                    <w:lvl w:ilvl="0">
+                        <w:start w:val="1"/>
+                        <w:numFmt w:val="decimal"/>
+                        <w:pStyle w:val="ListNumber"/>
+                        <w:lvlText w:val="%1."/>
+                        <w:lvlJc w:val="left"/>
+                        <w:pPr>
+                            <w:ind w:left="360" w:hanging="360"/>
+                        </w:pPr>
+                        <w:rPr>
+                            <w:rFonts w:hint="default"/>
+                        </w:rPr>
+                    </w:lvl>
+                    <w:lvl w:ilvl="1">
+                        <w:start w:val="1"/>
+                        <w:numFmt w:val="lowerLetter"/>
+                        <w:pStyle w:val="ListNumber2"/>
+                        <w:lvlText w:val="%2)"/>
+                        <w:lvlJc w:val="left"/>
+                        <w:pPr>
+                            <w:ind w:left="720" w:hanging="360"/>
+                        </w:pPr>
+                        <w:rPr>
+                            <w:rFonts w:hint="default"/>
+                        </w:rPr>
+                    </w:lvl>
+                    <w:lvl w:ilvl="2">
+                        <w:start w:val="1"/>
+                        <w:numFmt w:val="lowerRoman"/>
+                        <w:pStyle w:val="ListNumber3"/>
+                        <w:lvlText w:val="%3)"/>
+                        <w:lvlJc w:val="left"/>
+                        <w:pPr>
+                            <w:ind w:left="1080" w:hanging="360"/>
+                        </w:pPr>
+                        <w:rPr>
+                            <w:rFonts w:hint="default"/>
+                        </w:rPr>
+                    </w:lvl>
+                    <w:lvl w:ilvl="3">
+                        <w:start w:val="1"/>
+                        <w:numFmt w:val="upperRoman"/>
+                        <w:pStyle w:val="ListNumber4"/>
+                        <w:lvlText w:val="%4)"/>
+                        <w:lvlJc w:val="left"/>
+                        <w:pPr>
+                            <w:ind w:left="1440" w:hanging="360"/>
+                        </w:pPr>
+                        <w:rPr>
+                            <w:rFonts w:hint="default"/>
+                        </w:rPr>
+                    </w:lvl>
+                    <w:lvl w:ilvl="4">
+                        <w:start w:val="1"/>
+                        <w:numFmt w:val="lowerLetter"/>
+                        <w:lvlText w:val="(%5)"/>
+                        <w:lvlJc w:val="left"/>
+                        <w:pPr>
+                            <w:ind w:left="1800" w:hanging="360"/>
+                        </w:pPr>
+                        <w:rPr>
+                            <w:rFonts w:hint="default"/>
+                        </w:rPr>
+                    </w:lvl>
+                    <w:lvl w:ilvl="5">
+                        <w:start w:val="1"/>
+                        <w:numFmt w:val="lowerRoman"/>
+                        <w:lvlText w:val="(%6)"/>
+                        <w:lvlJc w:val="left"/>
+                        <w:pPr>
+                            <w:ind w:left="2160" w:hanging="360"/>
+                        </w:pPr>
+                        <w:rPr>
+                            <w:rFonts w:hint="default"/>
+                        </w:rPr>
+                    </w:lvl>
+                    <w:lvl w:ilvl="6">
+                        <w:start w:val="1"/>
+                        <w:numFmt w:val="decimal"/>
+                        <w:lvlText w:val="%7."/>
+                        <w:lvlJc w:val="left"/>
+                        <w:pPr>
+                            <w:ind w:left="2520" w:hanging="360"/>
+                        </w:pPr>
+                        <w:rPr>
+                            <w:rFonts w:hint="default"/>
+                        </w:rPr>
+                    </w:lvl>
+                    <w:lvl w:ilvl="7">
+                        <w:start w:val="1"/>
+                        <w:numFmt w:val="lowerLetter"/>
+                        <w:lvlText w:val="%8."/>
+                        <w:lvlJc w:val="left"/>
+                        <w:pPr>
+                            <w:ind w:left="2880" w:hanging="360"/>
+                        </w:pPr>
+                        <w:rPr>
+                            <w:rFonts w:hint="default"/>
+                        </w:rPr>
+                    </w:lvl>
+                    <w:lvl w:ilvl="8">
+                        <w:start w:val="1"/>
+                        <w:numFmt w:val="lowerRoman"/>
+                        <w:lvlText w:val="%9."/>
+                        <w:lvlJc w:val="left"/>
+                        <w:pPr>
+                            <w:ind w:left="3240" w:hanging="360"/>
+                        </w:pPr>
+                        <w:rPr>
+                            <w:rFonts w:hint="default"/>
+                        </w:rPr>
+                    </w:lvl>
+                </w:abstractNum>
+
+    </xsl:template>
+
+    <xsl:template match="@*|text()|comment()|processing-instruction()" mode="iden">
+      <xsl:copy-of select="."/>
+    </xsl:template>
+    
+    <xsl:template match="*" mode="iden">
+      <xsl:copy>
+	        <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()" mode="iden"/>
+      </xsl:copy>
+    </xsl:template>
+ 
+
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/docx/to.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/docx/from.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/docx/from.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/docx/from.xsl	(revision 258)
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns="http://www.tei-c.org/ns/1.0"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:iso="http://www.iso.org/ns/1.0"
+                xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006"
+                xmlns:o="urn:schemas-microsoft-com:office:office"
+                xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
+                xmlns:rel="http://schemas.openxmlformats.org/package/2006/relationships"
+                xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"
+                xmlns:v="urn:schemas-microsoft-com:vml"
+                xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"
+                xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
+                xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"
+                xmlns:w10="urn:schemas-microsoft-com:office:word"
+                xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
+                xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml"
+                xmlns:mml="http://www.w3.org/1998/Math/MathML"
+		xmlns:html="http://www.w3.org/1999/xhtml"
+		xmlns:its="http://www.w3.org/2005/11/its"
+                xmlns:tbx="http://www.lisa.org/TBX-Specification.33.0.html"
+                version="2.0"
+                exclude-result-prefixes="ve o r m v wp html its w10 w wne mml tbx iso">
+    <!-- import base conversion style -->
+
+    <xsl:import href="../../../docx/from/docxtotei.xsl"/>
+    
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+    <desc>
+      <p> TEI stylesheet for simplifying TEI ODD markup </p>
+      <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+      <p>Author: See AUTHORS</p>
+      <p>Id: $Id: from.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+      <p>Copyright: 2008, TEI Consortium</p>
+    </desc>
+  </doc>
+    
+    <xsl:output indent="yes"/>
+
+    <xsl:template match="@rend[.='Body Text']" mode="pass2"/>
+    <xsl:template match="@rend[.='Body Text 2']" mode="pass2"/>
+    <xsl:template match="@rend[.='Body Text 3']" mode="pass2"/>
+    <xsl:template match="@rend[.='Text Body']" mode="pass2"/>
+    <xsl:template match="@rend[.='Text body']" mode="pass2"/>
+    <xsl:template match="@rend[.='Body Text Indent']" mode="pass2"/>
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/docx/from.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/relaxng/to.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/relaxng/to.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/relaxng/to.xsl	(revision 258)
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet 
+    xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
+    xmlns:fo="http://www.w3.org/1999/XSL/Format" 
+    xmlns:html="http://www.w3.org/1999/xhtml" 
+    xmlns:i="http://www.iso.org/ns/1.0"
+    xmlns:rng="http://relaxng.org/ns/structure/1.0"
+    xmlns:s="http://www.ascc.net/xml/schematron" 
+    xmlns:sch="http://purl.oclc.org/dsdl/schematron" 
+    xmlns:tei="http://www.tei-c.org/ns/1.0"
+    xmlns:teix="http://www.tei-c.org/ns/Examples" 
+    xmlns:xi="http://www.w3.org/2001/XInclude"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    exclude-result-prefixes="a fo html i rng s sch tei teix xi xs xsl"
+                version="2.0">
+
+    <!-- import base conversion style -->
+
+    <xsl:import href="../../../odds2/odd2relax.xsl"/>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: to.xsl 9703 2011-11-09 11:16:42Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc>
+   </doc>
+
+  
+    
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/relaxng/to.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/fo/to.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/fo/to.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/fo/to.xsl	(revision 258)
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet 
+                xmlns:m="http://www.w3.org/1998/Math/MathML"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                exclude-result-prefixes="tei m"
+                version="2.0">
+    <!-- import base conversion style -->
+
+    <xsl:import href="../../../fo2/tei.xsl"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: to.xsl 9669 2011-11-07 19:17:54Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc>
+   </doc>
+
+  
+    
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/fo/to.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/html/from.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/html/from.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/html/from.xsl	(revision 258)
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet 
+    xmlns="http://www.w3.org/1999/xhtml"
+    xmlns:html="http://www.w3.org/1999/xhtml"
+    xmlns:tei="http://www.tei-c.org/ns/1.0"
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    exclude-result-prefixes="tei html"
+    version="2.0">
+    <!-- import base conversion style -->
+
+    <xsl:import href="../../../tools/html2tei.xsl"/>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: to.xsl 8923 2011-05-25 13:11:45Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc>
+   </doc>
+
+
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/html/from.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/html/to.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/html/to.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/html/to.xsl	(revision 258)
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet 
+    xmlns="http://www.w3.org/1999/xhtml"
+    xmlns:html="http://www.w3.org/1999/xhtml"
+    xmlns:tei="http://www.tei-c.org/ns/1.0"
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    exclude-result-prefixes="tei html"
+    version="2.0">
+    <!-- import base conversion style -->
+
+    <xsl:import href="../../../xhtml2/tei.xsl"/>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: to.xsl 9669 2011-11-07 19:17:54Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc>
+   </doc>
+
+   <xsl:output method="xhtml" omit-xml-declaration="yes"/>
+    
+    <xsl:template match="html:*">
+      <xsl:element name="{local-name()}">
+	<xsl:copy-of select="@*"/>
+	<xsl:apply-templates/>
+      </xsl:element>
+    </xsl:template>
+    
+    <xsl:template match="html:*/comment()">
+      <xsl:copy-of select="."/>
+    </xsl:template>
+
+  <xsl:template match="tei:div[@type='frontispiece']">
+      <xsl:apply-templates/>
+  </xsl:template>
+
+  <xsl:template match="tei:div[@type='illustration']">
+      <xsl:apply-templates/>
+  </xsl:template>
+
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/profiles/default/html/to.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/core.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/core.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/core.xsl	(revision 258)
@@ -0,0 +1,1339 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet 
+                xmlns:fotex="http://www.tug.org/fotex"
+                xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
+                xmlns="http://www.w3.org/1999/XSL/Format"
+                xmlns:rng="http://relaxng.org/ns/structure/1.0"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                exclude-result-prefixes="a fotex rng tei teix"
+                version="2.0">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p>
+    TEI stylesheet dealing  with elements from the core module, making XSL-FO output.
+      </p>
+         <p>
+This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+      </p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: core.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2011, TEI Consortium</p>
+      </desc>
+   </doc>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process elements  processing-instruction()[name()='xmltex']</desc>
+   </doc>
+  <xsl:template match="processing-instruction()[name()='xmltex']">
+      <xsl:message>xmltex pi <xsl:value-of select="."/>
+      </xsl:message>
+      <xsl:copy-of select="."/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:ab">
+      <block>
+         <xsl:apply-templates/>
+      </block>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:abbr">
+      <xsl:apply-templates/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:add">
+      <xsl:choose>
+         <xsl:when test="@place='sup' or @place='above'">
+            <inline vertical-align="super">
+               <xsl:apply-templates/>
+            </inline>
+         </xsl:when>
+         <xsl:when test="@place='sub' or @place='below'">
+            <inline vertical-align="sub">
+               <xsl:apply-templates/>
+            </inline>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:apply-templates/>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:byline">
+      <block text-align="center">
+         <xsl:apply-templates/>
+      </block>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:cell//tei:lb">
+      <xsl:choose>
+         <xsl:when test="$foEngine='passivetex'">&#8232;</xsl:when>
+         <xsl:otherwise>
+            <inline linefeed-treatment="preserve">
+               <xsl:text>&#10;</xsl:text>
+            </inline>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:code">
+      <inline font-family="{$typewriterFont}">
+         <xsl:apply-templates/>
+      </inline>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:corr">
+      <xsl:text>[</xsl:text>
+      <xsl:apply-templates/>
+      <xsl:text>]</xsl:text>
+      <xsl:choose>
+         <xsl:when test="@sic">
+            <footnote>
+               <footnote-citation>
+                  <inline font-size="8pt" vertical-align="super">
+                     <xsl:number format="a" level="any" count="tei:corr"/>
+                  </inline>
+               </footnote-citation>
+               <list-block>
+                  <xsl:attribute name="provisional-distance-between-starts">
+                     <xsl:value-of select="$betweenStarts"/>
+                  </xsl:attribute>
+                  <xsl:attribute name="provisional-label-separation">
+                     <xsl:value-of select="$labelSeparation"/>
+                  </xsl:attribute>
+                  <list-item>
+                     <list-item-label end-indent="label-end()">
+                        <block>
+                           <inline font-size="{$footnoteSize}" vertical-align="super">
+                              <xsl:number format="a" level="any" count="tei:corr"/>
+                           </inline>
+                        </block>
+                     </list-item-label>
+                     <list-item-body start-indent="body-start()">
+                        <block font-size="{$footnoteSize}">
+                           <xsl:value-of select="@sic"/>
+                        </block>
+                     </list-item-body>
+                  </list-item>
+               </list-block>
+            </footnote>
+         </xsl:when>
+      </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:del">
+      <inline text-decoration="line-through">
+         <xsl:apply-templates/>
+      </inline>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:eg">
+      <block font-family="{$typewriterFont}" background-color="{$exampleBackgroundColor}"
+             color="{$exampleColor}"
+             white-space-treatment="preserve"
+             linefeed-treatment="preserve"
+             white-space-collapse="false"
+             wrap-option="no-wrap"
+             text-indent="0em"
+             hyphenate="false"
+             start-indent="{$exampleMargin}"
+             text-align="start"
+             font-size="{$exampleSize}"
+             space-before.optimum="4pt"
+             space-after.optimum="4pt">
+         <xsl:if test="not($flowMarginLeft='')">
+            <xsl:attribute name="padding-start">
+               <xsl:value-of select="$exampleMargin"/>
+            </xsl:attribute>
+         </xsl:if>
+         <xsl:if test="parent::tei:exemplum">
+            <xsl:text>&#10;</xsl:text>
+         </xsl:if>
+         <xsl:value-of select="translate(.,' ','&#160;')"/>
+      </block>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="teix:egXML">
+      <xsl:param name="simple">false</xsl:param>
+      <xsl:param name="highlight"/>
+      <block font-family="{$typewriterFont}" background-color="{$exampleBackgroundColor}"
+             color="{$exampleColor}"
+             white-space-treatment="preserve"
+             linefeed-treatment="preserve"
+             white-space-collapse="false"
+             wrap-option="no-wrap"
+             text-indent="0em"
+             hyphenate="false"
+             start-indent="{$exampleMargin}"
+             text-align="start"
+             font-size="{$exampleSize}"
+             space-before.optimum="4pt"
+             space-after.optimum="4pt">
+         <xsl:if test="not($flowMarginLeft='')">
+            <xsl:attribute name="padding-start">
+               <xsl:value-of select="$exampleMargin"/>
+            </xsl:attribute>
+         </xsl:if>
+         <xsl:apply-templates mode="verbatim">
+	           <xsl:with-param name="highlight">
+	              <xsl:value-of select="$highlight"/>
+	           </xsl:with-param>
+         </xsl:apply-templates>
+      </block>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:eg[@rend='kwic']/tei:lb"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:emph">
+      <inline font-style="italic">
+         <xsl:apply-templates/>
+      </inline>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:epigraph">
+      <block text-align="center" space-before.optimum="4pt" space-after.optimum="4pt"
+             start-indent="{$exampleMargin}">
+         <xsl:apply-templates/>
+      </block>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:epigraph/tei:lg">
+      <block text-align="center" space-before.optimum="4pt" space-after.optimum="4pt">
+         <xsl:apply-templates/>
+      </block>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:epigraph/tei:q">
+      <block space-before.optimum="4pt" space-after.optimum="4pt"
+             start-indent="{$exampleMargin}">
+         <xsl:apply-templates/>
+      </block>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:foreign">
+      <inline font-style="italic">
+         <xsl:apply-templates/>
+      </inline>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:gap">
+      <inline border-style="solid">
+         <xsl:text>[</xsl:text>
+         <xsl:value-of select="@reason"/>
+         <xsl:text>]</xsl:text>
+      </inline>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:gi">
+      <inline hyphenate="false" color="{$giColor}" font-family="{$typewriterFont}">
+         <xsl:text>&lt;</xsl:text>
+         <xsl:apply-templates/>
+         <xsl:text>&gt;</xsl:text>
+      </inline>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:att">
+      <inline hyphenate="false" color="{$giColor}" font-family="{$typewriterFont}"
+              font-weight="bold">
+         <xsl:text>@</xsl:text>
+         <xsl:apply-templates/>
+      </inline>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:gloss">
+      <xsl:apply-templates/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:hi">
+      <inline>
+         <xsl:call-template name="rend">
+            <xsl:with-param name="defaultvalue" select="string('bold')"/>
+            <xsl:with-param name="defaultstyle" select="string('font-weight')"/>
+            <xsl:with-param name="rend" select="@rend"/>
+         </xsl:call-template>
+         <xsl:apply-templates/>
+      </inline>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:ident">
+      <inline color="{$identColor}" font-family="{$sansFont}">
+         <xsl:apply-templates/>
+      </inline>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:index"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:interp">
+      <xsl:apply-templates/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:interpGrp">
+      <xsl:apply-templates/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:item" mode="catalogue">
+      <table-cell>
+         <block>
+            <xsl:choose>
+               <xsl:when test="tei:label">
+                  <inline font-weight="bold">
+                     <xsl:apply-templates select="tei:label" mode="print"/>
+                  </inline>
+               </xsl:when>
+               <xsl:otherwise>
+                  <inline font-weight="bold">
+                     <xsl:apply-templates mode="print" select="preceding-sibling::tei:*[1]"/>
+                  </inline>
+               </xsl:otherwise>
+            </xsl:choose>
+         </block>
+      </table-cell>
+      <table-cell>
+         <block>
+            <xsl:apply-templates/>
+         </block>
+      </table-cell>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:item|tei:biblStruct">
+      <xsl:call-template name="makeItem"/>
+  </xsl:template>
+  <xsl:template match="tei:item" mode="xref">
+      <xsl:variable name="listdepth" select="count(ancestor::tei:list)"/>
+      <xsl:if test="parent::tei:list[@type='bibliography']">
+         <xsl:text> [</xsl:text>
+      </xsl:if>
+      <xsl:variable name="listNFormat">
+         <xsl:choose>
+            <xsl:when test="$listdepth=1">
+               <xsl:text>1</xsl:text>
+            </xsl:when>
+            <xsl:when test="$listdepth=2">
+               <xsl:text>i</xsl:text>
+            </xsl:when>
+            <xsl:when test="$listdepth=3">
+               <xsl:text>a</xsl:text>
+            </xsl:when>
+            <xsl:when test="$listdepth=4">
+               <xsl:text>I</xsl:text>
+            </xsl:when>
+         </xsl:choose>
+      </xsl:variable>
+      <xsl:number format="{$listNFormat}"/>
+      <xsl:if test="parent::tei:list[@type='bibliography']">
+         <xsl:text>]</xsl:text>
+      </xsl:if>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:kw">
+      <inline font-style="italic">
+         <xsl:apply-templates/>
+      </inline>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:l">
+      <block space-before.optimum="0pt" space-after.optimum="0pt">
+         <xsl:choose>
+            <xsl:when test="starts-with(@rend,'indent(')">
+               <xsl:attribute name="text-indent">
+                  <xsl:value-of select="concat(substring-before(substring-after(@rend,'('),')'),'em')"/>
+               </xsl:attribute>
+            </xsl:when>
+            <xsl:when test="starts-with(@rend,'indent')">
+               <xsl:attribute name="text-indent">1em</xsl:attribute>
+            </xsl:when>
+         </xsl:choose>
+         <xsl:apply-templates/>
+      </block>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:label" mode="print">
+      <xsl:apply-templates/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:label"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:lb">
+      <xsl:choose>
+	<xsl:when test="$activeLinebreaks='true'">
+	  <xsl:choose>
+	    <!-- this is a *visible* linebreak character 
+		 PassiveTeX implements it as a real line break
+	    -->
+	    <xsl:when test="$foEngine='passivetex'">&#8232;</xsl:when>
+	    <xsl:when test="parent::tei:list">
+	      <list-item>
+		<list-item-label>
+		  <block/>
+		</list-item-label>
+		<list-item-body>
+		  <block/>
+		</list-item-body>
+	      </list-item>
+	    </xsl:when>
+	    <xsl:when test="parent::tei:hi">
+	      <inline
+		  white-space-treatment="preserve"
+		  white-space-collapse="false">&#xA;</inline>
+	    </xsl:when>
+	    <xsl:otherwise>
+	      <block/>
+	    </xsl:otherwise>
+	  </xsl:choose>
+	</xsl:when>
+	<xsl:otherwise>
+	  <inline font-size="8pt">
+	    <xsl:text>❡</xsl:text>
+	  </inline>
+	</xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:list|tei:listBibl">
+      <xsl:if test="child::tei:head">
+         <block font-style="italic" text-align="start" space-before.optimum="4pt">
+            <xsl:for-each select="tei:head">
+               <xsl:apply-templates/>
+            </xsl:for-each>
+         </block>
+      </xsl:if>
+      <xsl:choose>
+         <xsl:when test="@type='runin'">
+            <block>
+               <xsl:apply-templates mode="runin"/>
+            </block>
+         </xsl:when>
+         <xsl:otherwise>
+            <list-block>
+               <xsl:call-template name="setListIndents"/>
+               <xsl:apply-templates/>
+            </list-block>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>cit element</desc>
+   </doc>
+  <xsl:template match="tei:cit">
+    <xsl:choose>
+      <xsl:when test="@rend='display'">
+	<block font-size="8pt">
+	  <xsl:apply-templates/>
+	</block>
+      </xsl:when>
+      <xsl:otherwise>
+	<xsl:apply-templates/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Bibl elements</desc>
+   </doc>
+  <xsl:template match="tei:bibl">
+    <xsl:choose>
+      <xsl:when test="parent::tei:listBibl">
+	<xsl:call-template name="makeItem"/>
+      </xsl:when>
+      <xsl:otherwise>
+	<block>
+	  <xsl:apply-templates/>
+	</block>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:list[@type='catalogue']">
+      <block space-before="{$spaceAroundTable}" space-after="{$spaceAroundTable}">
+         <table>
+            <table-column column-number="1" column-width="20%">
+               <xsl:if test="$foEngine='passivetex'">
+                  <xsl:attribute name="column-align" namespace="http://www.tug.org/fotex">p</xsl:attribute>
+               </xsl:if>
+            </table-column>
+            <table-column column-number="2" column-width="80%">
+               <xsl:if test="$foEngine='passivetex'">
+                  <xsl:attribute name="column-align" namespace="http://www.tug.org/fotex">p</xsl:attribute>
+               </xsl:if>
+            </table-column>
+            <table-body>
+               <xsl:for-each select="tei:item">
+                  <table-row>
+                     <xsl:apply-templates select="." mode="catalogue"/>
+                  </table-row>
+               </xsl:for-each>
+            </table-body>
+         </table>
+      </block>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:lg">
+      <block start-indent="{$exampleMargin}" text-align="start" space-before.optimum="4pt"
+             space-after.optimum="4pt">
+         <xsl:apply-templates/>
+      </block>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:mentioned">
+      <inline>
+         <xsl:call-template name="rend">
+            <xsl:with-param name="defaultvalue" select="string('italic')"/>
+            <xsl:with-param name="defaultstyle" select="string('font-style')"/>
+         </xsl:call-template>
+         <xsl:apply-templates/>
+      </inline>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:milestone">
+      <block>
+         <xsl:text>******************</xsl:text>
+         <xsl:value-of select="@unit"/>
+         <xsl:text> </xsl:text>
+         <xsl:value-of select="@n"/>
+         <xsl:text>******************</xsl:text>
+      </block>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:name">
+      <xsl:apply-templates/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:note" mode="endnote">
+      <block id="{generate-id()}">
+         <xsl:call-template name="calculateEndNoteNumber"/>
+         <xsl:text>. </xsl:text>
+         <xsl:apply-templates/>
+      </block>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:note">
+      <xsl:choose>
+         <xsl:when test="ancestor::tei:p or ancestor::tei:item or ancestor::tei:cit">
+            <xsl:apply-templates select="." mode="real"/>
+         </xsl:when>
+         <xsl:otherwise>
+            <block>
+               <xsl:apply-templates select="." mode="real"/>
+            </block>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:note" mode="real">
+      <xsl:choose>
+         <xsl:when test="@place='end'">
+            <basic-link>
+               <xsl:attribute name="internal-destination">
+                  <xsl:value-of select="generate-id()"/>
+               </xsl:attribute>
+               <inline font-size="{$footnotenumSize}" vertical-align="super">
+                  <xsl:choose>
+                     <xsl:when test="@n">
+                        <xsl:value-of select="@n"/>
+                     </xsl:when>
+                     <xsl:otherwise>
+                        <xsl:call-template name="calculateEndNoteNumber"/>
+                     </xsl:otherwise>
+                  </xsl:choose>
+               </inline>
+            </basic-link>
+         </xsl:when>
+         <xsl:when test="@place='inline'">
+            <inline>
+               <xsl:text> (</xsl:text>
+               <xsl:apply-templates/>
+               <xsl:text>)</xsl:text>
+            </inline>
+         </xsl:when>
+         <xsl:when test="@place='display'">
+            <block text-indent="0pt" end-indent="{$exampleMargin}" start-indent="{$exampleMargin}"
+                   font-size="{$exampleSize}"
+                   space-before.optimum="{$exampleBefore}"
+                   space-after.optimum="{$exampleAfter}">
+               <xsl:apply-templates/>
+            </block>
+         </xsl:when>
+         <xsl:when test="@place='divtop'">
+            <block text-indent="0pt" end-indent="{$exampleMargin}" start-indent="{$exampleMargin}"
+                   font-style="italic"
+                   font-size="{$exampleSize}"
+                   space-before.optimum="{$exampleBefore}"
+                   space-after.optimum="{$exampleAfter}">
+               <xsl:apply-templates/>
+            </block>
+         </xsl:when>
+         <xsl:otherwise>
+	           <xsl:choose>
+	              <xsl:when test="parent::tei:item">
+	                 <block>
+	                    <xsl:call-template name="makeFootnote"/>
+	                 </block>
+	              </xsl:when>
+	              <xsl:otherwise>
+	                 <xsl:call-template name="makeFootnote"/>
+	              </xsl:otherwise>
+	           </xsl:choose>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Create a footnote</desc>
+   </doc>
+    
+  <xsl:template name="makeFootnote">
+        <xsl:variable name="FootID">
+          <xsl:choose>
+            <xsl:when test="@n">
+              <xsl:value-of select="@n"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:call-template name="calculateFootnoteNumber"/>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:variable>
+        <footnote>
+          <inline>
+            <xsl:if test="not(@target)">
+              <xsl:attribute name="font-size">
+                  <xsl:value-of select="$footnotenumSize"/>
+              </xsl:attribute>
+              <xsl:attribute name="vertical-align">super</xsl:attribute>
+              <xsl:value-of select="$FootID"/>
+            </xsl:if>
+          </inline>
+          <footnote-body>
+            <block end-indent="0pt" start-indent="0pt" text-align="start" font-style="normal"
+                   text-indent="{$parIndent}"
+                   font-size="{$footnoteSize}">
+              <xsl:if test="@xml:id">
+                  <xsl:attribute name="id">
+                     <xsl:value-of select="@xml:id"/>
+                  </xsl:attribute>
+              </xsl:if>
+              <xsl:if test="not(@target)">
+                  <inline font-size="{$footnotenumSize}" vertical-align="super">
+                     <xsl:value-of select="$FootID"/>
+                  </inline>
+                  <xsl:text> </xsl:text>
+              </xsl:if>
+              <xsl:apply-templates/>
+            </block>
+          </footnote-body>
+        </footnote>
+   </xsl:template>
+
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element tei:p</desc>
+   </doc>
+
+  <xsl:template match="tei:p">
+      <block>
+         <xsl:if test="preceding-sibling::tei:p">
+            <xsl:attribute name="text-indent">
+               <xsl:value-of select="$parIndent"/>
+            </xsl:attribute>
+            <xsl:attribute name="space-before.optimum">
+               <xsl:value-of select="$parSkip"/>
+            </xsl:attribute>
+            <xsl:attribute name="space-before.maximum">
+               <xsl:value-of select="$parSkipmax"/>
+            </xsl:attribute>
+         </xsl:if>
+         <xsl:if test="@xml:lang">
+            <xsl:attribute name="country">
+               <xsl:value-of select="substring-before(@xml:lang,'-')"/>
+            </xsl:attribute>
+            <xsl:attribute name="language">
+               <xsl:value-of select="substring-after(@xml:lang,'-')"/>
+            </xsl:attribute>
+         </xsl:if>
+         <xsl:apply-templates/>
+      </block>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:pb">
+      <xsl:variable name="e">
+         <xsl:choose>
+	   <xsl:when test="parent::tei:body or parent::tei:front or    parent::tei:back or parent::tei:div">
+	     <xsl:text>block</xsl:text>
+	   </xsl:when>
+	   <xsl:otherwise>
+	     <xsl:text>inline</xsl:text>
+	   </xsl:otherwise>
+         </xsl:choose>
+      </xsl:variable>
+      <xsl:choose>
+         <xsl:when test="parent::tei:list"/>
+         <xsl:when test="$pagebreakStyle='active'">
+	           <xsl:element name="{$e}">
+	              <xsl:attribute name="break-before">page</xsl:attribute>
+	              <xsl:if test="@xml:id">
+	                 <xsl:attribute name="id">
+	                    <xsl:value-of select="@xml:id"/>
+	                 </xsl:attribute>
+	              </xsl:if>
+	           </xsl:element>
+         </xsl:when>
+         <xsl:when test="$pagebreakStyle='visible'">
+	           <xsl:element name="{$e}">
+	              <xsl:if test="@xml:id">
+	                 <xsl:attribute name="id">
+	                    <xsl:value-of select="@xml:id"/>
+	                 </xsl:attribute>
+	              </xsl:if>
+	              <xsl:text>✁[</xsl:text>
+	              <xsl:value-of select="@unit"/>
+	              <xsl:text> Page </xsl:text>
+	              <xsl:value-of select="@n"/>
+	              <xsl:text>]✁</xsl:text>
+	           </xsl:element>
+         </xsl:when>
+      </xsl:choose>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:quote">
+      <block text-align="start" text-indent="0pt" end-indent="{$exampleMargin}"
+             start-indent="{$exampleMargin}"
+             font-size="{$quoteSize}"
+             space-before.optimum="{$exampleBefore}"
+             space-after.optimum="{$exampleAfter}">
+         <xsl:apply-templates/>
+      </block>
+  </xsl:template>
+
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:q">
+      <xsl:choose>
+         <xsl:when test="tei:text">
+            <xsl:apply-templates/>
+         </xsl:when>
+         <xsl:when test="@rend='display' or tei:p or tei:lg">
+            <block text-align="start" text-indent="0pt" end-indent="{$exampleMargin}"
+                   start-indent="{$exampleMargin}"
+                   font-size="{$quoteSize}"
+                   space-before.optimum="{$exampleBefore}"
+                   space-after.optimum="{$exampleAfter}">
+               <xsl:apply-templates/>
+            </block>
+         </xsl:when>
+         <xsl:when test="@rend='eg'">
+            <block text-align="start" font-size="{$exampleSize}" space-before.optimum="4pt"
+                   text-indent="0pt"
+                   space-after.optimum="4pt"
+                   start-indent="{$exampleMargin}"
+                   font-family="{$typewriterFont}">
+               <xsl:apply-templates/>
+            </block>
+         </xsl:when>
+         <xsl:when test="@rend = 'qwic'">
+            <block space-before="{$spaceAroundTable}" space-after="{$spaceAroundTable}">
+               <inline-container>
+                  <table font-size="{$exampleSize}" font-family="{$typewriterFont}"
+                         start-indent="{$exampleMargin}">
+                     <table-column column-number="1" column-width="">
+                        <xsl:if test="$foEngine='passivetex'">
+                           <xsl:attribute name="column-align" namespace="http://www.tug.org/fotex">p</xsl:attribute>
+                        </xsl:if>
+                     </table-column>
+                     <table-column column-number="2" column-width="">
+                        <xsl:if test="$foEngine='passivetex'">
+                           <xsl:attribute name="column-align" namespace="http://www.tug.org/fotex">l</xsl:attribute>
+                        </xsl:if>
+                     </table-column>
+                     <table-body>
+                        <xsl:for-each select="tei:q">
+                           <xsl:for-each select="tei:term">
+                              <table-row>
+                                 <table-cell>
+                                    <block>
+                                       <xsl:apply-templates select="preceding-sibling::node()"/>
+                                    </block>
+                                 </table-cell>
+                                 <table-cell>
+                                    <block>
+                                       <xsl:apply-templates/>
+                                       <xsl:apply-templates select="following-sibling::node()"/>
+                                    </block>
+                                 </table-cell>
+                              </table-row>
+                           </xsl:for-each>
+                        </xsl:for-each>
+                     </table-body>
+                  </table>
+               </inline-container>
+            </block>
+         </xsl:when>
+         <xsl:when test="starts-with(@rend,'kwic')">
+            <block space-before="{$spaceAroundTable}" space-after="{$spaceAroundTable}">
+               <inline-container>
+                  <table font-size="{$exampleSize}" start-indent="{$exampleMargin}"
+                         font-family="{$typewriterFont}">
+                     <table-column column-number="1" column-width="">
+                        <xsl:if test="$foEngine='passivetex'">
+                           <xsl:attribute name="column-align" namespace="http://www.tug.org/fotex">r</xsl:attribute>
+                        </xsl:if>
+                     </table-column>
+                     <table-column column-number="2" column-width="">
+                        <xsl:if test="$foEngine='passivetex'">
+                           <xsl:attribute name="column-align" namespace="http://www.tug.org/fotex">l</xsl:attribute>
+                        </xsl:if>
+                     </table-column>
+                     <table-body>
+                        <xsl:for-each select="tei:term">
+                           <table-row>
+                              <table-cell>
+                                 <block>
+                                    <xsl:value-of select="preceding-sibling::node()[1]"/>
+                                 </block>
+                              </table-cell>
+                              <table-cell>
+                                 <block>
+                                    <xsl:apply-templates/>
+                                    <xsl:value-of select="following-sibling::node()[1]"/>
+                                 </block>
+                              </table-cell>
+                           </table-row>
+                        </xsl:for-each>
+                     </table-body>
+                  </table>
+               </inline-container>
+            </block>
+         </xsl:when>
+         <xsl:when test="@rend='literal'">
+            <block white-space-collapse="false" wrap-option="no-wrap" font-size="{$exampleSize}"
+                   space-before.optimum="4pt"
+                   space-after.optimum="4pt"
+                   start-indent="{$exampleMargin}"
+                   font-family="{$typewriterFont}">
+               <xsl:apply-templates/>
+            </block>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:text>“</xsl:text>
+            <xsl:apply-templates/>
+            <xsl:text>”</xsl:text>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:reg">
+    <xsl:choose>
+      <xsl:when test="parent::tei:p">
+	<inline font-family="{$sansFont}">
+	  <xsl:apply-templates/>
+	</inline>
+      </xsl:when>
+      <xsl:otherwise>
+	<block font-family="{$sansFont}">
+	  <xsl:apply-templates/>
+	</block>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:rs">
+      <xsl:apply-templates/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:s">
+      <xsl:apply-templates/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:salute">
+      <block text-align="left">
+         <xsl:apply-templates/>
+      </block>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:seg">
+      <block font-family="{$typewriterFont}" background-color="yellow"
+             white-space-collapse="false"
+             wrap-option="no-wrap"
+             text-indent="0em"
+             start-indent="{$exampleMargin}"
+             text-align="start"
+             font-size="{$exampleSize}"
+             padding-before="8pt"
+             padding-after="8pt"
+             space-before.optimum="4pt"
+             space-after.optimum="4pt">
+         <xsl:apply-templates/>
+      </block>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:sic">
+      <xsl:apply-templates/>
+      <xsl:text> (sic)</xsl:text>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:signed">
+      <block text-align="left">
+         <xsl:apply-templates/>
+      </block>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:term">
+      <inline font-style="italic">
+         <xsl:apply-templates/>
+      </inline>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:unclear">
+      <inline text-decoration="blink">
+         <xsl:apply-templates/>
+      </inline>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[fo] </desc>
+   </doc>
+  <xsl:template name="addID">
+      <xsl:attribute name="id">
+         <xsl:choose>
+            <xsl:when test="@xml:id">
+               <xsl:value-of select="@xml:id"/>
+            </xsl:when>
+            <xsl:otherwise>
+               <xsl:value-of select="generate-id()"/>
+            </xsl:otherwise>
+         </xsl:choose>
+      </xsl:attribute>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[fo] process "rend" attribute<param name="value">value of "rend" attribute</param>
+      </desc>
+   </doc>
+  <xsl:template name="applyRend">
+      <xsl:param name="value"/>
+      <xsl:choose>
+         <xsl:when test="$value='gothic'">
+            <xsl:attribute name="font-family">fantasy</xsl:attribute>
+         </xsl:when>
+         <xsl:when test="$value='calligraphic'">
+            <xsl:attribute name="font-family">cursive</xsl:attribute>
+         </xsl:when>
+         <xsl:when test="$value='ital' or $value='italic' or $value='it' or $value='i' or $value='italics'">
+            <xsl:attribute name="font-style">italic</xsl:attribute>
+         </xsl:when>
+         <xsl:when test="$value='sc'">
+            <xsl:attribute name="font-variant">small-caps</xsl:attribute>
+         </xsl:when>
+         <xsl:when test="$value='code'">
+            <xsl:attribute name="font-family">
+               <xsl:value-of select="$typewriterFont"/>
+            </xsl:attribute>
+         </xsl:when>
+         <xsl:when test="$value='bo' or $value='bold'">
+            <xsl:attribute name="font-weight">bold</xsl:attribute>
+         </xsl:when>
+         <xsl:when test="$value='BO'">
+            <xsl:attribute name="font-style">italic</xsl:attribute>
+            <xsl:attribute name="text-decoration">underline</xsl:attribute>
+         </xsl:when>
+         <xsl:when test="$value='UL' or $value='ul'">
+            <xsl:attribute name="text-decoration">underline</xsl:attribute>
+         </xsl:when>
+         <xsl:when test="$value='sub'">
+            <xsl:attribute name="vertical-align">sub</xsl:attribute>
+         </xsl:when>
+         <xsl:when test="$value='small'">
+            <xsl:attribute name="font-size">small</xsl:attribute>
+         </xsl:when>
+         <xsl:when test="$value='strike'">
+            <xsl:attribute name="text-decoration">line-through</xsl:attribute>
+         </xsl:when>
+         <xsl:when test="$value='sup'">
+            <xsl:attribute name="vertical-align">super</xsl:attribute>
+         </xsl:when>
+      </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[fo] </desc>
+   </doc>
+  <xsl:template name="calculateEndNoteNumber">
+      <xsl:number level="any" format="i" count="tei:note[@place='end']"/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[fo] </desc>
+   </doc>
+  <xsl:template name="calculateFootnoteNumber">
+      <xsl:number from="tei:text" level="any" count="tei:note"/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[fo] </desc>
+   </doc>
+  <xsl:template name="makeItem">
+<!-- item behaviour depends on the type attribute of our parent:
+simple, bullets, ordered, gloss, unordered, or bibliography
+-->
+    <xsl:variable name="listdepth" select="count(ancestor::tei:list)"/>
+      <list-item>
+         <xsl:if test="not(parent::tei:note[@place='foot' or @place='bottom' ])">
+            <xsl:attribute name="space-before.optimum">
+               <xsl:value-of select="$listItemsep"/>
+            </xsl:attribute>
+         </xsl:if>
+         <list-item-label end-indent="label-end()">
+            <xsl:if test="@xml:id">
+               <xsl:attribute name="id">
+                  <xsl:value-of select="@xml:id"/>
+               </xsl:attribute>
+            </xsl:if>
+            <xsl:text>&#10;</xsl:text>
+            <block>
+               <xsl:choose>
+                  <xsl:when test="@n">
+                     <xsl:attribute name="text-align">end</xsl:attribute>
+                     <xsl:value-of select="@n"/>
+                  </xsl:when>
+                  <xsl:when test="../@type='bibliography'">
+                     <xsl:attribute name="text-align">end</xsl:attribute>
+                     <xsl:apply-templates mode="xref" select="."/>
+                  </xsl:when>
+                  <xsl:when test="../@type='ordered' or self::tei:bibl">
+                     <xsl:attribute name="text-align">end</xsl:attribute>
+                     <xsl:apply-templates mode="xref" select="."/>
+                     <xsl:text>.</xsl:text>
+                  </xsl:when>
+                  <xsl:when test="../@type='gloss'">
+                     <xsl:attribute name="text-align">start</xsl:attribute>
+                     <xsl:attribute name="font-weight">bold</xsl:attribute>
+                     <xsl:choose>
+		       <xsl:when test="tei:label">
+			 <xsl:apply-templates mode="print" select="tei:label"/>
+		       </xsl:when>
+		       <xsl:otherwise>
+			 <xsl:apply-templates mode="print" select="preceding-sibling::tei:*[1]"/>
+		       </xsl:otherwise>
+                     </xsl:choose>
+                  </xsl:when>
+                  <xsl:when test="../@type='numbered' or
+				  self::tei:biblStruct or self::tei:bibl">
+		    <!-- numbered support added rbl 26.3.2005 -->
+		    <xsl:attribute name="text-align">end</xsl:attribute>
+                     <xsl:number/>
+                     <xsl:text>.</xsl:text>
+                  </xsl:when>
+                  <xsl:when test="../@type='ordered'">
+		    <!-- numbered support added rbl 26.3.2005 -->
+		    <xsl:attribute name="text-align">end</xsl:attribute>
+		    <xsl:number/>
+		    <xsl:text>.</xsl:text>
+                  </xsl:when>
+                  <xsl:otherwise>
+		    <xsl:attribute name="text-align">end</xsl:attribute>
+		    <xsl:choose>
+		      <xsl:when test="$listdepth=0">
+			<xsl:value-of select="$bulletOne"/>
+		      </xsl:when>
+		      <xsl:when test="$listdepth=1">
+			<xsl:value-of select="$bulletOne"/>
+		      </xsl:when>
+		      <xsl:when test="$listdepth=2">
+			<xsl:value-of select="$bulletTwo"/>
+		      </xsl:when>
+		      <xsl:when test="$listdepth=3">
+			<xsl:value-of select="$bulletThree"/>
+		      </xsl:when>
+		      <xsl:when test="$listdepth=4">
+			<xsl:value-of select="$bulletFour"/>
+		      </xsl:when>
+		    </xsl:choose>
+                  </xsl:otherwise>
+               </xsl:choose>
+            </block>
+         </list-item-label>
+         <list-item-body start-indent="body-start()">
+	   <xsl:choose>
+	     <xsl:when test="* and tei:list">
+	       <xsl:for-each select="*">
+		 <xsl:choose>
+		   <xsl:when test="self::tei:list">
+		     <xsl:apply-templates select="."/>
+		   </xsl:when>
+		   <xsl:otherwise>
+		     <block font-weight="normal">
+		       <xsl:apply-templates/>
+		     </block>
+		   </xsl:otherwise>
+		 </xsl:choose>
+	       </xsl:for-each>
+	     </xsl:when>
+	     <xsl:otherwise>
+	       <block font-weight="normal">
+		 <xsl:apply-templates/>
+	       </block>
+	     </xsl:otherwise>
+	   </xsl:choose>
+         </list-item-body>
+      </list-item>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[fo] <param name="defaultvalue">defaultvalue</param>
+         <param name="defaultstyle">defaultstyle</param>
+         <param name="rend">rend</param>
+      </desc>
+   </doc>
+  <xsl:template name="rend">
+      <xsl:param name="defaultvalue"/>
+      <xsl:param name="defaultstyle"/>
+      <xsl:param name="rend"/>
+      <xsl:choose>
+         <xsl:when test="$rend=''">
+            <xsl:attribute name="{$defaultstyle}">
+               <xsl:value-of select="$defaultvalue"/>
+            </xsl:attribute>
+         </xsl:when>
+         <xsl:when test="contains($rend,';')">
+            <xsl:call-template name="applyRend">
+               <xsl:with-param name="value" select="substring-before($rend,';')"/>
+            </xsl:call-template>
+            <xsl:call-template name="rend">
+               <xsl:with-param name="rend" select="substring-after($rend,';')"/>
+            </xsl:call-template>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:call-template name="applyRend">
+               <xsl:with-param name="value" select="$rend"/>
+            </xsl:call-template>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[fo] Spacing setup for list blocks</desc>
+   </doc>
+  <xsl:template name="setListIndents">
+      <xsl:attribute name="provisional-distance-between-starts">
+         <xsl:choose>
+            <xsl:when test="self::tei:listBibl[tei:biblStruct]">
+               <xsl:value-of select="$betweenBiblStarts"/>
+            </xsl:when>
+            <xsl:when test="@type='gloss'">
+               <xsl:value-of select="$betweenGlossStarts"/>
+            </xsl:when>
+            <xsl:otherwise>
+               <xsl:value-of select="$betweenStarts"/>
+            </xsl:otherwise>
+         </xsl:choose>
+      </xsl:attribute>
+      <xsl:attribute name="provisional-label-separation">
+         <xsl:value-of select="$labelSeparation"/>
+      </xsl:attribute>
+      <xsl:attribute name="text-indent">0em</xsl:attribute>
+      <xsl:attribute name="margin-right">
+         <xsl:value-of select="$listRightMargin"/>
+      </xsl:attribute>
+      <xsl:variable name="listdepth" select="count(ancestor::tei:list)"/>
+      <xsl:choose>
+         <xsl:when test="$listdepth=0">
+            <xsl:attribute name="space-before">
+               <xsl:value-of select="$listAbove-1"/>
+            </xsl:attribute>
+            <xsl:attribute name="space-after">
+               <xsl:value-of select="$listBelow-1"/>
+            </xsl:attribute>
+         </xsl:when>
+         <xsl:when test="$listdepth=1">
+            <xsl:attribute name="space-before">
+               <xsl:value-of select="$listAbove-2"/>
+            </xsl:attribute>
+            <xsl:attribute name="space-after">
+               <xsl:value-of select="$listBelow-2"/>
+            </xsl:attribute>
+         </xsl:when>
+         <xsl:when test="$listdepth=2">
+            <xsl:attribute name="space-before">
+               <xsl:value-of select="$listAbove-3"/>
+            </xsl:attribute>
+            <xsl:attribute name="space-after">
+               <xsl:value-of select="$listBelow-3"/>
+            </xsl:attribute>
+         </xsl:when>
+         <xsl:when test="$listdepth=3">
+            <xsl:attribute name="space-before">
+               <xsl:value-of select="$listAbove-4"/>
+            </xsl:attribute>
+            <xsl:attribute name="space-after">
+               <xsl:value-of select="$listBelow-4"/>
+            </xsl:attribute>
+         </xsl:when>
+      </xsl:choose>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element soCalled</desc>
+   </doc>
+  <xsl:template match="tei:soCalled">
+      <xsl:value-of select="$preQuote"/>
+      <xsl:apply-templates/>
+      <xsl:value-of select="$postQuote"/>
+  </xsl:template>
+
+   <xsl:template name="emphasize">
+      <xsl:param name="class"/>
+      <xsl:param name="content"/>
+      <xsl:choose>
+         <xsl:when test="$class='titlem'">
+            <inline>
+	      <xsl:attribute name="font-style">italic</xsl:attribute>
+	      <xsl:copy-of select="$content"/>
+            </inline>
+         </xsl:when>
+         <xsl:when test="$class='titlea'">
+            <xsl:text>‘</xsl:text>
+	    <xsl:copy-of select="$content"/>
+            <xsl:text>’</xsl:text>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:copy-of select="$content"/>
+         </xsl:otherwise>
+      </xsl:choose>
+   </xsl:template>
+
+  <xsl:template name="applyRendition"/>
+
+  <xsl:template name="makeSpan">
+    <xsl:apply-templates/>
+  </xsl:template>
+
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/core.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/header.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/header.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/header.xsl	(revision 258)
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet 
+                xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
+                xmlns="http://www.w3.org/1999/XSL/Format"
+                xmlns:rng="http://relaxng.org/ns/structure/1.0"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                exclude-result-prefixes="a rng tei teix"
+                version="2.0">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p>
+    TEI stylesheet
+    dealing  with elements from the
+      header module, making XSL-FO output.
+      </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: header.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2011, TEI Consortium</p>
+      </desc>
+   </doc>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:docAuthor">
+      <block font-size="{$authorSize}">
+         <inline font-style="italic">
+            <xsl:apply-templates/>
+         </inline>
+      </block>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:docDate">
+      <block font-size="{$dateSize}">
+         <xsl:apply-templates/>
+      </block>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:docTitle">
+      <block text-align="left" font-size="{$titleSize}">
+         <xsl:if test="ancestor::tei:group/tei:text/tei:front">
+            <xsl:attribute name="id">
+               <xsl:choose>
+                  <xsl:when test="ancestor::tei:text[1]/@xml:id">
+                     <xsl:value-of select="translate(ancestor::tei:text[1]/@xml:id,'_','-')"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:value-of select="generate-id()"/>
+                  </xsl:otherwise>
+               </xsl:choose>
+            </xsl:attribute>
+         </xsl:if>
+         <xsl:apply-templates select="tei:titlePart"/>
+      </block>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+    
+         <p xmlns="http://www.w3.org/1999/XSL/Format"> Ignore the header </p>
+    
+      </desc>
+   </doc>
+  <xsl:template match="tei:teiHeader">
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[fo] </desc>
+   </doc>
+  <xsl:template name="textTitle">
+      <xsl:param name="N"/>
+      <xsl:apply-templates select="tei:front"/>
+  </xsl:template>
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/header.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/linking.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/linking.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/linking.xsl	(revision 258)
@@ -0,0 +1,131 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet 
+                xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
+                xmlns="http://www.w3.org/1999/XSL/Format"
+		xmlns:xs="http://www.w3.org/2001/XMLSchema"                
+                xmlns:rng="http://relaxng.org/ns/structure/1.0"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                exclude-result-prefixes="a rng tei teix xs"
+                version="2.0">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p>
+    TEI stylesheet
+    dealing  with elements from the
+      linking module, making XSL-FO output.
+      </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: linking.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2011, TEI Consortium</p>
+      </desc>
+   </doc>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[fo] <param name="where">target of link</param>
+      </desc>
+   </doc>
+  <xsl:template name="generateEndLink">
+      <xsl:param name="where"/>
+      <xsl:value-of select="$where"/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[fo] <param name="ptr">whether the destination URL is also the body
+    of the link</param>
+         <param name="dest">destination URL</param>
+      </desc>
+   </doc>
+  <xsl:template name="makeExternalLink">
+      <xsl:param name="ptr" as="xs:boolean" select="false()"/>
+      <xsl:param name="dest"/>
+      <basic-link external-destination="url({$dest})">
+         <xsl:choose>
+            <xsl:when test="$ptr">
+               <xsl:call-template name="showXrefURL">
+                  <xsl:with-param name="dest">
+                     <xsl:value-of select="$dest"/>
+                  </xsl:with-param>
+               </xsl:call-template>
+            </xsl:when>
+            <xsl:otherwise>
+               <xsl:apply-templates/>
+            </xsl:otherwise>
+         </xsl:choose>
+      </basic-link>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[fo] <param name="ptr">ptr</param>
+         <param name="target">target</param>
+         <param name="dest">destination</param>
+         <param name="body">body</param>
+      </desc>
+   </doc>
+  <xsl:template name="makeInternalLink">
+      <xsl:param name="ptr" as="xs:boolean" select="false()"/>
+      <xsl:param name="class"/>
+      <xsl:param name="target"/>
+      <xsl:param name="dest"/>
+      <xsl:param name="body"/>
+      <xsl:variable name="W">
+         <xsl:choose>
+            <xsl:when test="$target">
+               <xsl:value-of select="$target"/>
+            </xsl:when>
+            <xsl:when test="contains($dest,'#')">
+               <xsl:value-of select="substring($dest,2)"/>
+            </xsl:when>
+            <xsl:otherwise>
+               <xsl:value-of select="$dest"/>
+            </xsl:otherwise>
+         </xsl:choose>
+      </xsl:variable>
+      <basic-link internal-destination="{$W}">
+         <xsl:call-template name="linkStyle"/>
+         <xsl:choose>
+            <xsl:when test="not($body='')">
+               <xsl:value-of select="$body"/>
+            </xsl:when>
+            <xsl:when test="$ptr">
+               <xsl:apply-templates mode="xref" select="id($W)">
+                  <xsl:with-param name="minimal" select="$minimalCrossRef"/>
+               </xsl:apply-templates>
+            </xsl:when>
+            <xsl:otherwise>
+               <xsl:apply-templates/>
+            </xsl:otherwise>
+         </xsl:choose>
+      </basic-link>
+  </xsl:template>
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/linking.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/figures.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/figures.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/figures.xsl	(revision 258)
@@ -0,0 +1,472 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet 
+                xmlns:fotex="http://www.tug.org/fotex"
+                xmlns:m="http://www.w3.org/1998/Math/MathML"
+                xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
+                xmlns="http://www.w3.org/1999/XSL/Format"
+                xmlns:rng="http://relaxng.org/ns/structure/1.0"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                exclude-result-prefixes=" a fotex rng tei teix"
+                version="2.0">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p>
+    TEI stylesheet
+    dealing  with elements from the
+      figures module, making XSL-FO output.
+      </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: figures.xsl 10042 2012-01-13 15:23:16Z rahtz $</p>
+         <p>Copyright: 2011, TEI Consortium</p>
+      </desc>
+   </doc>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Deal with elements in math mode (just copy them)</desc>
+   </doc>
+  <xsl:template match="m:*|@*|comment()|processing-instruction()|text()" mode="math">
+      <xsl:copy>
+         <xsl:apply-templates mode="math" select="*|@*|processing-instruction()|text()"/>
+      </xsl:copy>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process math elements</desc>
+   </doc>
+  <xsl:template match="m:math">
+      <m:math>
+         <xsl:copy-of select="@*"/>
+         <xsl:apply-templates mode="math"/>
+      </m:math>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:cell">
+      <table-cell>
+         <xsl:if test="@cols &gt; 1">
+            <xsl:attribute name="number-columns-spanned">
+               <xsl:value-of select="@cols"/>
+            </xsl:attribute>
+         </xsl:if>
+         <xsl:if test="@rows &gt; 1">
+            <xsl:attribute name="number-rows-spanned">
+               <xsl:value-of select="@rows"/>
+            </xsl:attribute>
+         </xsl:if>
+         <xsl:call-template name="cellProperties"/>
+         <block>
+            <xsl:choose>
+               <xsl:when test="@role='label' or parent::tei:row[@role='label' or parent::tei:row[@role='header']]">
+                  <xsl:attribute name="font-weight">bold</xsl:attribute>
+               </xsl:when>
+            </xsl:choose>
+            <xsl:apply-templates/>
+         </block>
+      </table-cell>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:figDesc"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:figure">
+      <xsl:choose>
+         <xsl:when test="@rend='display' or tei:head or tei:p">
+            <float>
+               <xsl:call-template name="addID"/>
+               <block text-align="center">
+                  <xsl:choose>
+                     <xsl:when test="@url or @entity">
+                        <xsl:call-template name="makePic"/>
+                     </xsl:when>
+                     <xsl:otherwise>
+                        <xsl:apply-templates/>
+                     </xsl:otherwise>
+                  </xsl:choose>
+               </block>
+               <block>
+                  <xsl:call-template name="figureCaptionstyle"/>
+                  <xsl:call-template name="calculateFigureNumber"/>
+                  <xsl:text>. </xsl:text>
+                  <xsl:apply-templates select="tei:head"/>
+               </block>
+            </float>
+         </xsl:when>
+         <xsl:otherwise>
+	           <block>
+	              <xsl:choose>
+	                 <xsl:when test="@url or @entity">
+	                    <xsl:call-template name="makePic"/>
+	                 </xsl:when>
+	                 <xsl:otherwise>
+	                    <xsl:apply-templates/>
+	                 </xsl:otherwise>
+	              </xsl:choose>
+	           </block>
+            <xsl:choose>
+               <xsl:when test="$captionInlineFigures='true'">
+                  <block>
+                     <xsl:call-template name="figureCaptionstyle"/>
+                     <xsl:call-template name="calculateFigureNumber"/>
+                     <xsl:text>. </xsl:text>
+                     <xsl:apply-templates select="tei:head"/>
+                  </block>
+               </xsl:when>
+               <xsl:otherwise>
+                  <xsl:if test="tei:head">
+                     <block text-align="center">
+                        <xsl:apply-templates select="tei:head"/>
+                     </block>
+                  </xsl:if>
+               </xsl:otherwise>
+            </xsl:choose>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:figure" mode="xref">
+      <xsl:if test="$showFloatLabel">
+         <xsl:call-template name="i18n">
+            <xsl:with-param name="word">figureWord</xsl:with-param>
+         </xsl:call-template>
+         <xsl:text> </xsl:text>
+      </xsl:if>
+      <xsl:call-template name="calculateFigureNumber"/>
+      <xsl:if test="$showFloatHead='true' and tei:head">
+         <xsl:text> (</xsl:text>
+         <xsl:apply-templates select="tei:head"/>
+         <xsl:text>)</xsl:text>
+      </xsl:if>
+      <xsl:if test="$xrefShowPage='true'">
+    on page
+    <page-number-citation>
+            <xsl:attribute name="ref-id">
+               <xsl:choose>
+                  <xsl:when test="@xml:id">
+                     <xsl:value-of select="@xml:id"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:value-of select="generate-id()"/>
+                  </xsl:otherwise>
+               </xsl:choose>
+            </xsl:attribute>
+         </page-number-citation> 
+      </xsl:if>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:formula">
+      <wrapper>
+         <xsl:if test="@xml:id">
+            <xsl:attribute name="id">
+               <xsl:value-of select="@xml:id"/>
+            </xsl:attribute>
+         </xsl:if>
+         <xsl:apply-templates/>
+      </wrapper>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:formula" mode="xref">
+      <xsl:number/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:formula[@type='display']/m:math">
+      <m:math display="block">
+         <xsl:copy-of select="@*"/>
+         <xsl:apply-templates mode="math"/>
+      </m:math>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:formula[@type='subeqn']/m:math">
+      <xsl:apply-templates mode="math"/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:graphic">
+      <xsl:call-template name="makePic"/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:row[@role='header']">
+      <xsl:text>&#10;</xsl:text>
+      <table-header>
+         <xsl:apply-templates select="tei:cell"/>
+      </table-header>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:table" mode="xref">
+      <xsl:if test="$showFloatLabel">
+         <xsl:call-template name="i18n">
+            <xsl:with-param name="word">tableWord</xsl:with-param>
+         </xsl:call-template>
+         <xsl:text> </xsl:text>
+      </xsl:if>
+      <xsl:if test="$showFloatHead='true' and tei:head">
+         <xsl:text> (</xsl:text>
+         <xsl:apply-templates select="tei:head"/>
+         <xsl:text>)</xsl:text>
+      </xsl:if>
+      <xsl:call-template name="calculateTableNumber"/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:table">
+      <xsl:choose>
+         <xsl:when test="@rend='eqnarray' and $foEngine='passivetex'">
+            <fotex:eqnarray>
+               <xsl:apply-templates select=".//tei:formula"/>
+            </fotex:eqnarray>
+         </xsl:when>
+         <xsl:when test=".//tei:formula[@type='subeqn'] and $foEngine='passivetex'">
+            <fotex:eqnarray>
+               <xsl:apply-templates select=".//tei:formula"/>
+            </fotex:eqnarray>
+         </xsl:when>
+         <xsl:when test="$inlineTables or @rend='inline'">
+            <xsl:if test="tei:head">
+               <block>
+                  <xsl:call-template name="tableCaptionstyle"/>
+                  <xsl:call-template name="addID"/>
+                  <xsl:if test="$makeTableCaption='true'">
+		    <xsl:call-template name="calculateTableNumber"/>
+                     <xsl:text>. </xsl:text>
+                  </xsl:if>
+                  <xsl:apply-templates select="tei:head"/>
+               </block>
+            </xsl:if>
+            <xsl:call-template name="blockTable"/>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:call-template name="floatTable"/>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:table[@rend='eqnarray']">
+      <xsl:choose>
+         <xsl:when test="$foEngine='passivetex'">
+            <fotex:eqnarray>
+               <xsl:for-each select="tei:row">
+                  <xsl:apply-templates select=".//tei:formula"/>
+                  <xsl:if test="following-sibling::tei:row">
+<!--        <character character="&#x2028;"/>-->
+              <xsl:processing-instruction name="xmltex">\\</xsl:processing-instruction>
+                  </xsl:if>
+               </xsl:for-each>
+            </fotex:eqnarray>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:apply-templates/>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[fo] </desc>
+   </doc>
+  <xsl:template name="blockTable">
+      <table text-align="{$tableAlign}" font-size="{$tableSize}">
+         <xsl:call-template name="addID"/>
+         <xsl:call-template name="deriveColSpecs"/>
+         <xsl:apply-templates select="tei:row[@role='header']"/>
+         <table-body text-indent="0pt">
+            <xsl:for-each select="tei:row[not(@role='header')]">
+               <xsl:text>&#10;</xsl:text>
+               <table-row>
+                  <xsl:apply-templates select="tei:cell"/>
+               </table-row>
+            </xsl:for-each>
+         </table-body>
+      </table>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[fo] table cell properties</desc>
+   </doc>
+  <xsl:template name="cellProperties">
+      <xsl:if test="@role='hi' or @role='label' or   parent::tei:row/@role='label'  or parent::tei:row/@role='header'">
+         <xsl:attribute name="background-color">
+            <xsl:value-of select="$defaultCellLabelBackground"/>
+         </xsl:attribute>
+      </xsl:if>
+      <xsl:choose>
+         <xsl:when test="ancestor::tei:table[1][@rend='frame']">
+            <xsl:if test="not(parent::tei:row/preceding-sibling::tei:row)">
+               <xsl:attribute name="border-before-style">solid</xsl:attribute>
+            </xsl:if>
+            <xsl:attribute name="border-after-style">solid</xsl:attribute>
+            <xsl:if test="not(following-sibling::tei:cell)">
+               <xsl:attribute name="border-end-style">solid</xsl:attribute>
+            </xsl:if>
+            <xsl:attribute name="border-start-style">solid</xsl:attribute>
+         </xsl:when>
+         <xsl:otherwise>
+  </xsl:otherwise>
+      </xsl:choose>
+      <xsl:if test="not(ancestor::tei:table/@rend='tight')">
+         <xsl:attribute name="padding">
+            <xsl:value-of select="$tableCellPadding"/>
+         </xsl:attribute>
+      </xsl:if>
+      <xsl:choose>
+         <xsl:when test="@align">
+            <xsl:attribute name="text-align">
+               <xsl:value-of select="@align"/>
+            </xsl:attribute>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:variable name="thiscol">
+               <xsl:value-of select="position()"/>
+            </xsl:variable>
+            <xsl:variable name="tid">
+               <xsl:value-of select="ancestor::tei:table/@xml:id"/>
+            </xsl:variable>
+            <xsl:variable name="align">
+               <xsl:value-of select="$tableSpecs/Info/TableSpec[@xml:id=$tid]/table-column[@column-number=$thiscol]/@fotex:column-align"/>
+            </xsl:variable>
+            <!--
+    <xsl:message>    Cell: whats my position: <xsl:value-of select="$thiscol"/>, <xsl:value-of select="$align"/>, <xsl:value-of select="$tid"/>
+</xsl:message>
+-->
+        <xsl:choose>
+               <xsl:when test="$align='R'">
+                  <xsl:attribute name="text-align">right</xsl:attribute>
+               </xsl:when>
+               <xsl:when test="$align='L'">
+                  <xsl:attribute name="text-align">left</xsl:attribute>
+               </xsl:when>
+               <xsl:when test="$align='C'">
+                  <xsl:attribute name="text-align">center</xsl:attribute>
+               </xsl:when>
+               <xsl:when test="not($align='')">
+                  <xsl:attribute name="text-align">
+                     <xsl:value-of select="$align"/>
+                  </xsl:attribute>
+               </xsl:when>
+               <xsl:otherwise>
+                  <xsl:attribute name="text-align">
+                     <xsl:value-of select="$cellAlign"/>
+                  </xsl:attribute>
+               </xsl:otherwise>
+            </xsl:choose>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[fo] </desc>
+   </doc>
+  <xsl:template name="floatTable">
+      <table-and-caption>
+         <xsl:if test="rend='landscape'">
+            <xsl:attribute name="reference-direction">-90</xsl:attribute>
+         </xsl:if>
+         <xsl:call-template name="addID"/>
+         <table-caption>
+            <block text-align="{$tableCaptionAlign}" space-after="{$spaceBelowCaption}">
+               <xsl:call-template name="i18n">
+                  <xsl:with-param name="word">tableWord</xsl:with-param>
+               </xsl:call-template>
+               <xsl:call-template name="calculateTableNumber"/>
+               <xsl:text>. </xsl:text>
+               <xsl:apply-templates select="tei:head"/>
+            </block>
+         </table-caption>
+         <xsl:call-template name="blockTable"/>
+      </table-and-caption>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[fo] Insert reference to graphics file </desc>
+   </doc>
+  <xsl:template name="makePic">
+      <xsl:variable name="File">
+         <xsl:choose>
+            <xsl:when test="@url">
+               <xsl:value-of select="@url"/>
+            </xsl:when>
+            <xsl:when test="@entity">
+               <xsl:value-of select="unparsed-entity-uri(@entity)"/>
+            </xsl:when>
+         </xsl:choose>
+      </xsl:variable>
+      <external-graphic>
+         <xsl:call-template name="addID"/>
+         <xsl:attribute name="src">
+            <xsl:text>url(</xsl:text>
+            <xsl:if test="not(starts-with($File,'./'))">
+               <xsl:value-of select="$graphicsPrefix"/>
+            </xsl:if>
+            <xsl:value-of select="$File"/>
+            <xsl:if test="not(contains($File,'.'))">
+               <xsl:value-of select="$graphicsSuffix"/>
+            </xsl:if>
+            <xsl:text>)</xsl:text>
+         </xsl:attribute>
+         <xsl:call-template name="graphicsAttributes">
+            <xsl:with-param name="mode">fo</xsl:with-param>
+         </xsl:call-template>
+      </external-graphic>
+  </xsl:template>
+
+  <xsl:template match="tei:binaryObject">
+    <external-graphic>
+      <xsl:attribute name="src">
+	<xsl:text>url('data:image/auto;base64,</xsl:text>
+	<xsl:value-of select="."/>
+	<xsl:text>')</xsl:text>
+      </xsl:attribute>
+      <xsl:call-template name="graphicsAttributes">
+	<xsl:with-param name="mode">fo</xsl:with-param>
+      </xsl:call-template>
+    </external-graphic>  
+  </xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/figures.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/tei-makecolspec.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/tei-makecolspec.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/tei-makecolspec.xsl	(revision 258)
@@ -0,0 +1,139 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet 
+                xmlns:fotex="http://www.tug.org/fotex"
+                xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
+                xmlns="http://www.w3.org/1999/XSL/Format"
+                xmlns:rng="http://relaxng.org/ns/structure/1.0"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                exclude-result-prefixes=" a rng tei teix"
+                version="2.0">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p>
+    TEI stylesheet for making table specifications, making XSL-FO output.
+      </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: tei-makecolspec.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2011, TEI Consortium</p>
+      </desc>
+   </doc>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[fo] </desc>
+   </doc>
+  <xsl:template name="calculateTableSpecs">
+      <xsl:variable name="tds">
+         <xsl:for-each select=".//tei:cell">
+            <xsl:variable name="stuff">
+               <xsl:apply-templates/>
+            </xsl:variable>
+            <cell>
+               <xsl:attribute name="col">
+                  <xsl:number/>
+               </xsl:attribute>
+               <xsl:value-of select="string-length($stuff)"/>
+            </cell>
+         </xsl:for-each>
+      </xsl:variable>
+      <xsl:variable name="total">
+         <xsl:value-of select="sum($tds/cell)"/>
+      </xsl:variable>
+      <xsl:for-each select="$tds/cell">
+         <xsl:sort select="@col" data-type="number"/>
+         <xsl:variable name="c" select="@col"/>
+         <xsl:if test="not(preceding-sibling::cell[$c=@col])">
+            <xsl:variable name="len">
+               <xsl:value-of select="sum(following-sibling::cell[$c=@col]) + current()"/>
+            </xsl:variable>
+            <xsl:text>&#10;</xsl:text>
+            <table-column column-number="{@col}" column-width="{$len div $total * 100}%">
+               <xsl:if test="$foEngine='passivetex'">
+                  <xsl:attribute name="column-align" namespace="http://www.tug.org/fotex">L</xsl:attribute>
+               </xsl:if>
+            </table-column>
+         </xsl:if>
+      </xsl:for-each>
+      <xsl:text>&#10;</xsl:text>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[fo] </desc>
+   </doc>
+  <xsl:template name="deriveColSpecs">
+      <xsl:variable name="no">
+         <xsl:call-template name="generateTableID"/>
+      </xsl:variable>
+      <xsl:choose>
+         <xsl:when test="$readColSpecFile">
+            <xsl:variable name="specs">
+               <xsl:value-of select="count($tableSpecs/Info/TableSpec[$no=@xml:id])"/>
+            </xsl:variable>
+            <xsl:choose>
+               <xsl:when test="$specs &gt; 0">
+                  <xsl:for-each select="$tableSpecs/Info/TableSpec[$no=@xml:id]/table-column">
+                     <xsl:copy-of select="."/>
+                  </xsl:for-each>
+               </xsl:when>
+               <xsl:otherwise>
+<!--
+ <xsl:message>Build specs for Table <xsl:value-of select="$no"/></xsl:message>
+-->
+            <xsl:call-template name="calculateTableSpecs"/>
+               </xsl:otherwise>
+            </xsl:choose>
+         </xsl:when>
+         <xsl:otherwise>
+<!--
+ <xsl:message>Build specs for Table <xsl:value-of select="$no"/></xsl:message>
+-->
+        <xsl:call-template name="calculateTableSpecs"/>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[fo] </desc>
+   </doc>
+  <xsl:template name="generateTableID">
+      <xsl:choose>
+         <xsl:when test="@xml:id">
+            <xsl:value-of select="@xml:id"/>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:text>Table-</xsl:text>
+            <xsl:number level="any"/>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/tei-makecolspec.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/textstructure.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/textstructure.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/textstructure.xsl	(revision 258)
@@ -0,0 +1,1442 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet 
+                xmlns:fotex="http://www.tug.org/fotex"
+                xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
+                xmlns="http://www.w3.org/1999/XSL/Format"
+                xmlns:rng="http://relaxng.org/ns/structure/1.0"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                exclude-result-prefixes="fotex a rng tei teix"
+                version="2.0">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p>
+    TEI stylesheet
+    dealing  with elements from the
+      textstructure module, making XSL-FO output.
+      </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: textstructure.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2011, TEI Consortium</p>
+      </desc>
+   </doc>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process elements  * in inner mode</desc>
+   </doc>
+  <xsl:template match="*" mode="innertext">
+      <xsl:apply-templates select="."/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:*" mode="heading">
+      <xsl:apply-templates/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:TEI">
+      <root>
+         <xsl:call-template name="setupPagemasters"/>
+         <xsl:call-template name="mainAction"/>
+      </root>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:back">
+      <xsl:comment>Back matter</xsl:comment>
+      <xsl:choose>
+         <xsl:when test="ancestor::tei:group">
+            <xsl:apply-templates/>
+         </xsl:when>
+         <xsl:otherwise>
+            <page-sequence format="{$formatBackpage}" text-align="{$alignment}" hyphenate="{$hyphenate}"
+                           language="{$language}">
+               <xsl:call-template name="choosePageMaster">
+                  <xsl:with-param name="where">
+                     <xsl:value-of select="$backMulticolumns"/>
+                  </xsl:with-param>
+               </xsl:call-template>
+               <!-- static areas -->
+          <xsl:choose>
+                  <xsl:when test="$twoSided='true'">
+                     <xsl:call-template name="headers-footers-twoside-back"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:call-template name="headers-footers-oneside-back"/>
+                  </xsl:otherwise>
+               </xsl:choose>
+               <!-- now start the main flow -->
+          <flow flow-name="xsl-region-body" font-family="{$bodyFont}" font-size="{$bodySize}">
+                  <xsl:apply-templates/>
+                  <xsl:call-template name="afterBodyHook"/>
+               </flow>
+            </page-sequence>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:body">
+      <xsl:choose>
+         <xsl:when test="ancestor::tei:floatingText">
+            <xsl:apply-templates/>
+         </xsl:when>
+         <xsl:when test="ancestor::tei:p">
+            <xsl:apply-templates/>
+         </xsl:when>
+         <xsl:when test="ancestor::tei:group">
+            <xsl:apply-templates/>
+         </xsl:when>
+         <xsl:otherwise>
+<!-- start page sequence -->
+        <page-sequence format="{$formatBodypage}" text-align="{$alignment}" hyphenate="{$hyphenate}"
+                           language="{$language}"
+                           initial-page-number="1">
+               <xsl:call-template name="choosePageMaster">
+                  <xsl:with-param name="where">
+                     <xsl:value-of select="$bodyMulticolumns"/>
+                  </xsl:with-param>
+               </xsl:call-template>
+               <!-- static areas -->
+          <xsl:choose>
+                  <xsl:when test="$twoSided='true'">
+                     <xsl:call-template name="headers-footers-twoside"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:call-template name="headers-footers-oneside"/>
+                  </xsl:otherwise>
+               </xsl:choose>
+               <!-- now start the main  flow -->
+          <flow flow-name="xsl-region-body" font-family="{$bodyFont}" font-size="{$bodySize}">
+                  <xsl:if test="not($flowMarginLeft='')">
+                     <xsl:attribute name="margin-left">
+                        <xsl:value-of select="$flowMarginLeft"/>
+                     </xsl:attribute>
+                  </xsl:if>
+                  <!--include front matter if there is no separate titlepage -->
+            <xsl:if test="not($titlePage='true') and not(preceding-sibling::tei:front)">
+                     <xsl:call-template name="Header"/>
+                  </xsl:if>
+                  <xsl:apply-templates/>
+                  <xsl:if test=".//tei:note[@place='end']">
+                     <block>
+                        <xsl:call-template name="setupDiv2"/>
+                        <xsl:text>Notes</xsl:text>
+                     </block>
+                     <xsl:apply-templates select=".//tei:note[@place='end']" mode="endnote"/>
+                  </xsl:if>
+               </flow>
+            </page-sequence>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:closer">
+      <block space-before.optimum="4pt" space-after.optimum="4pt"
+             end-indent="{$exampleMargin}"
+             start-indent="{$exampleMargin}">
+         <xsl:apply-templates/>
+      </block>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:dateline">
+      <block text-align="end">
+         <xsl:apply-templates/>
+      </block>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+    
+         <p xmlns="http://www.w3.org/1999/XSL/Format"> Normal headings </p>
+    
+      </desc>
+   </doc>
+  <xsl:template match="tei:div">
+      <xsl:text>&#10;</xsl:text>
+      <xsl:choose>
+         <xsl:when test="@type='bibliog'">
+            <xsl:apply-templates/>
+         </xsl:when>
+         <xsl:when test="@type='abstract'">
+            <block keep-with-next.within-page="always" end-indent="{$exampleMargin}"
+                   start-indent="{$exampleMargin}">
+               <xsl:attribute name="text-align">center</xsl:attribute>
+               <xsl:call-template name="setupDiv2"/>
+               <inline font-style="italic">Abstract</inline>
+            </block>
+            <xsl:apply-templates/>
+         </xsl:when>
+         <xsl:when test="@type='ack'">
+            <block keep-with-next.within-page="always">
+               <xsl:attribute name="text-align">start</xsl:attribute>
+               <xsl:call-template name="setupDiv3"/>
+               <inline font-style="italic">Acknowledgements</inline>
+            </block>
+            <xsl:apply-templates/>
+         </xsl:when>
+         <xsl:otherwise>
+<!-- behaviour depends on the nesting level of <div> elements -->
+        <xsl:variable name="divlevel" select="count(ancestor::tei:div)"/>
+            <xsl:call-template name="NumberedHeading">
+               <xsl:with-param name="level">
+                  <xsl:value-of select="$divlevel"/>
+               </xsl:with-param>
+            </xsl:call-template>
+            <xsl:apply-templates/>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+    
+         <p xmlns="http://www.w3.org/1999/XSL/Format"> headings in TOC </p>
+    
+      </desc>
+   </doc>
+  <xsl:template match="tei:div" mode="toc">
+      <xsl:variable name="divlevel">
+         <xsl:value-of select="count(ancestor::tei:div)"/>
+      </xsl:variable>
+      <xsl:call-template name="tocheading">
+         <xsl:with-param name="level">
+            <xsl:value-of select="$divlevel"/>
+         </xsl:with-param>
+      </xsl:call-template>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:div" mode="xref">
+      <xsl:variable name="divlevel" select="count(ancestor::tei:div)"/>
+      <xsl:call-template name="xheading">
+         <xsl:with-param name="level">div<xsl:value-of select="$divlevel"/>
+         </xsl:with-param>
+      </xsl:call-template>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:div1|tei:div2|tei:div3|tei:div4|tei:div5">
+    <xsl:call-template name="NumberedHeading">
+      <xsl:with-param name="level">
+	<xsl:value-of select="substring-after(local-name(),'div')"/>
+      </xsl:with-param>
+    </xsl:call-template>
+    <xsl:apply-templates/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process elements
+      tei:div1|tei:div2|tei:div3|tei:div4|tei:div5 (toc mode)</desc>
+   </doc>
+  <xsl:template match="tei:div1|tei:div2|tei:div3|tei:div4|tei:div5" mode="toc">
+      <xsl:call-template name="tocheading">
+         <xsl:with-param name="level">
+            <xsl:value-of select="substring-after(local-name(),'div')"/>
+         </xsl:with-param>
+      </xsl:call-template>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template mode="xref" match="tei:div1|tei:div2|tei:div3|tei:div4|tei:div5">
+      <xsl:call-template name="xheading">
+         <xsl:with-param name="level">
+            <xsl:value-of select="local-name()"/>
+         </xsl:with-param>
+      </xsl:call-template>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:div[@type='canto']">
+      <xsl:variable name="divlevel" select="count(ancestor::tei:div)"/>
+      <xsl:call-template name="NumberedHeading">
+         <xsl:with-param name="level">
+            <xsl:value-of select="$divlevel"/>
+         </xsl:with-param>
+      </xsl:call-template>
+      <xsl:apply-templates/>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>    
+         <p xmlns="http://www.w3.org/1999/XSL/Format">Table of contents </p>
+      </desc>
+   </doc>
+  <xsl:template match="tei:divGen">
+      <xsl:choose>
+         <xsl:when test="@type='toc' and ancestor::tei:text/tei:group">
+            <xsl:call-template name="bookTOC"/>
+         </xsl:when>
+         <xsl:when test="@type='toc'">
+            <xsl:call-template name="mainTOC"/>
+         </xsl:when>
+      </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:front">
+      <xsl:comment>Front matter</xsl:comment>
+      <xsl:choose>
+         <xsl:when test="ancestor::tei:floatingText">
+            <xsl:apply-templates/>
+         </xsl:when>
+         <xsl:when test="ancestor::tei:p">
+            <xsl:apply-templates/>
+         </xsl:when>
+         <xsl:when test="ancestor::tei:group">
+            <xsl:apply-templates/>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:if test="$titlePage='true'">
+               <page-sequence format="{$formatFrontpage}" force-page-count="end-on-even"
+                              hyphenate="{$hyphenate}"
+                              language="{$language}">
+                  <xsl:call-template name="choosePageMaster">
+                     <xsl:with-param name="where">
+                        <xsl:value-of select="$frontMulticolumns"/>
+                     </xsl:with-param>
+                  </xsl:call-template>
+                  <static-content flow-name="xsl-region-before">
+                     <block/>
+                  </static-content>
+                  <static-content flow-name="xsl-region-after">
+                     <block/>
+                  </static-content>
+                  <flow flow-name="xsl-region-body" font-family="{$bodyFont}">
+                     <xsl:call-template name="Header"/>
+                  </flow>
+               </page-sequence>
+            </xsl:if>
+            <page-sequence format="{$formatFrontpage}" text-align="{$alignment}" hyphenate="{$hyphenate}"
+                           language="{$language}"
+                           initial-page-number="1">
+               <xsl:call-template name="choosePageMaster">
+                  <xsl:with-param name="where">
+                     <xsl:value-of select="$frontMulticolumns"/>
+                  </xsl:with-param>
+               </xsl:call-template>
+               <!-- static areas -->
+          <xsl:choose>
+                  <xsl:when test="$twoSided='true'">
+                     <xsl:call-template name="headers-footers-twoside"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:call-template name="headers-footers-oneside"/>
+                  </xsl:otherwise>
+               </xsl:choose>
+               <!-- now start the main flow -->
+          <flow flow-name="xsl-region-body" font-family="{$bodyFont}" font-size="{$bodySize}">
+                  <xsl:for-each select="tei:*">
+                     <xsl:comment>Start <xsl:value-of select="name(.)"/>
+                     </xsl:comment>
+                     <xsl:apply-templates select="."/>
+                     <xsl:comment>End <xsl:value-of select="name(.)"/>
+                     </xsl:comment>
+                  </xsl:for-each>
+               </flow>
+            </page-sequence>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:group/tei:text">
+      <xsl:variable name="N">
+         <xsl:number/>
+      </xsl:variable>
+      <page-sequence format="1" text-align="{$alignment}" hyphenate="{$hyphenate}"
+                     language="{$language}"
+                     master-reference="twoside1">
+         <xsl:attribute name="initial-page-number">
+            <xsl:choose>
+               <xsl:when test="$N = 1">1</xsl:when>
+               <xsl:otherwise>auto-odd</xsl:otherwise>
+            </xsl:choose>
+         </xsl:attribute>
+         <xsl:call-template name="grouptextStatic"/>
+         <flow flow-name="xsl-region-body" font-family="{$bodyFont}">
+            <xsl:call-template name="textTitle">
+               <xsl:with-param name="N" select="$N"/>
+            </xsl:call-template>
+            <xsl:apply-templates select="tei:body"/>
+            <xsl:apply-templates select="tei:back"/>
+         </flow>
+      </page-sequence>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:group/tei:text/tei:body">
+      <xsl:apply-templates/>
+      <xsl:if test=".//tei:note[@place='end']">
+         <block>
+            <xsl:call-template name="setupDiv2"/>
+            <xsl:text>Notes</xsl:text>
+         </block>
+         <xsl:apply-templates select=".//tei:note[@place='end']" mode="endnote"/>
+      </xsl:if>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+    
+         <p xmlns="http://www.w3.org/1999/XSL/Format"> Simple head </p>
+    
+      </desc>
+   </doc>
+  <xsl:template match="tei:head" mode="section">
+<!-- if we have multiple <head> elements together, 
+  separate by spaces -->
+<!--
+   <xsl:if test="preceding-sibling::tei:head">
+	<xsl:text> </xsl:text>
+     </xsl:if>
+-->
+    <xsl:apply-templates/>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element head in heading mode</desc>
+   </doc>
+  <xsl:template match="tei:head" mode="makeheading">
+      <xsl:apply-templates/>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+    
+         <p xmlns="http://www.w3.org/1999/XSL/Format"> unqualified &lt;head&gt; </p>
+    
+      </desc>
+   </doc>
+  <xsl:template match="tei:head"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:opener">
+      <block space-before.optimum="4pt" space-after.optimum="4pt"
+             end-indent="{$exampleMargin}"
+             start-indent="{$exampleMargin}">
+         <xsl:apply-templates/>
+      </block>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+    
+         <p xmlns="http://www.w3.org/1999/XSL/Format"> headings when cross-referenced </p>
+    
+      </desc>
+   </doc>
+  <xsl:template match="tei:text" mode="xref">
+      <xsl:choose>
+         <xsl:when test="@n">
+            <xsl:value-of select="@n"/>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:number/>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:text">
+      <xsl:choose>
+         <xsl:when test="parent::tei:TEI">
+            <xsl:apply-templates/>
+         </xsl:when>
+         <xsl:when test="parent::tei:group">
+            <xsl:apply-templates/>
+         </xsl:when>
+         <xsl:otherwise>
+            <block text-align="start" text-indent="0pt" end-indent="{$exampleMargin}"
+                   start-indent="{$exampleMargin}"
+                   font-size="{$exampleSize}"
+                   border-top-style="solid"
+                   border-bottom-style="solid"
+                   space-before.optimum="{$exampleBefore}"
+                   space-after.optimum="{$exampleAfter}">
+               <xsl:apply-templates mode="innertext"/>
+            </block>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:text" mode="toc">
+      <block>
+         <xsl:attribute name="font-weight">bold</xsl:attribute>
+         <xsl:number/>
+         <xsl:text> </xsl:text>
+         <inline>
+            <xsl:choose>
+               <xsl:when test="tei:front/tei:docTitle[@n]">
+                  <xsl:value-of select="tei:front/tei:docTitle/@n"/>
+               </xsl:when>
+               <xsl:otherwise>
+                  <xsl:value-of select="tei:front/tei:docTitle"/>
+               </xsl:otherwise>
+            </xsl:choose>
+         </inline>
+         <leader rule-thickness="0pt"/>
+         <inline>
+            <xsl:call-template name="linkStyle"/>
+            <xsl:variable name="pagref">
+               <xsl:choose>
+                  <xsl:when test="@xml:id">
+                     <xsl:value-of select="@xml:id"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:value-of select="generate-id()"/>
+                  </xsl:otherwise>
+               </xsl:choose>
+            </xsl:variable>
+            <basic-link internal-destination="{$pagref}">
+               <page-number-citation ref-id="{$pagref}"/>
+            </basic-link>
+         </inline>
+      </block>
+      <block font-style="italic" space-after="10pt" space-before="6pt">
+         <xsl:apply-templates select="tei:front//tei:docAuthor" mode="heading"/>
+      </block>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:titlePage">
+      <block text-align="center">
+         <xsl:apply-templates/>
+      </block>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:titlePage//tei:titlePart[@type='main']">
+      <block font-size="{$titleSize}" space-after="8pt" text-align="center">
+         <xsl:apply-templates/>
+      </block>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:titlePage//tei:titlePart[@type='sub']">
+      <block>
+         <block font-size="{$authorSize}" space-after="8pt" text-align="center">
+            <xsl:apply-templates/>
+         </block>
+      </block>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:titlePart">
+      <xsl:apply-templates/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:titlePart[@type='running']"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:trailer">
+      <block>
+         <xsl:apply-templates/>
+      </block>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process elements  text()</desc>
+   </doc>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[fo] </desc>
+   </doc>
+  <xsl:template name="Header">
+      <block font-size="12pt" padding-before="6pt">
+         <inline>
+	           <xsl:value-of select="$institution"/>
+         </inline>
+      </block>
+    
+      <block font-size="12pt" font-weight="bold">
+         <xsl:call-template name="generateTitle"/>
+      </block>
+    
+      <block>
+         <xsl:call-template name="generateAuthor"/>
+      </block>
+    
+      <block padding-after="6pt">
+         <xsl:call-template name="generateDate"/>
+      </block>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[fo] <param name="level">level</param>
+      </desc>
+   </doc>
+  <xsl:template name="NumberedHeading">
+      <xsl:param name="level"/>
+      <block keep-with-next.within-page="always">
+         <xsl:variable name="divid">
+            <xsl:choose>
+               <xsl:when test="@xml:id">
+                  <xsl:value-of select="@xml:id"/>
+               </xsl:when>
+               <xsl:otherwise>
+                  <xsl:value-of select="generate-id()"/>
+               </xsl:otherwise>
+            </xsl:choose>
+         </xsl:variable>
+         <xsl:attribute name="id">
+            <xsl:value-of select="$divid"/>
+         </xsl:attribute>
+         <xsl:attribute name="text-align">start</xsl:attribute>
+         <xsl:attribute name="font-family">
+            <xsl:value-of select="$divFont"/>
+         </xsl:attribute>
+         <xsl:choose>
+            <xsl:when test="$level=0">
+               <xsl:call-template name="setupDiv0"/>
+            </xsl:when>
+            <xsl:when test="$level=1">
+               <xsl:call-template name="setupDiv1"/>
+            </xsl:when>
+            <xsl:when test="$level=2">
+               <xsl:call-template name="setupDiv2"/>
+            </xsl:when>
+            <xsl:when test="$level=3">
+               <xsl:call-template name="setupDiv3"/>
+            </xsl:when>
+            <xsl:when test="$level=4">
+               <xsl:call-template name="setupDiv4"/>
+            </xsl:when>
+            <xsl:when test="$level=5">
+               <xsl:call-template name="setupDiv5"/>
+            </xsl:when>
+            <xsl:when test="$level=6">
+               <xsl:call-template name="setupDiv6"/>
+            </xsl:when>
+         </xsl:choose>
+         <xsl:call-template name="blockStartHook"/>
+         <xsl:variable name="Number">
+            <xsl:if test="$numberHeadings='true' and $numberHeadingsDepth &gt; $level">
+               <xsl:call-template name="calculateNumber">
+                  <xsl:with-param name="numbersuffix">
+	                    <xsl:call-template name="headingNumberSuffix"/>
+	                 </xsl:with-param>
+               </xsl:call-template>
+            </xsl:if>
+         </xsl:variable>
+         <!--
+<xsl:message>**  Calculated   [<xsl:value-of select="$Number"/>] [<xsl:value-of select="$headingNumberSuffix"/>] for <xsl:value-of select="@xml:id"/></xsl:message>
+-->
+      <xsl:value-of select="$Number"/>
+         <xsl:apply-templates mode="section" select="tei:head"/>
+         <xsl:if test="$divRunningheads='true'">
+<!-- markers for use in running heads -->
+        <xsl:choose>
+               <xsl:when test="$level=0">
+                  <marker marker-class-name="section1"/>
+                  <marker marker-class-name="section2"/>
+                  <marker marker-class-name="section3"/>
+                  <marker marker-class-name="section4"/>
+                  <marker marker-class-name="section5"/>
+               </xsl:when>
+               <xsl:when test="$level=1">
+                  <marker marker-class-name="section2"/>
+                  <marker marker-class-name="section3"/>
+                  <marker marker-class-name="section4"/>
+                  <marker marker-class-name="section5"/>
+               </xsl:when>
+               <xsl:when test="$level=2">
+                  <marker marker-class-name="section3"/>
+                  <marker marker-class-name="section4"/>
+                  <marker marker-class-name="section5"/>
+               </xsl:when>
+               <xsl:when test="$level=3">
+                  <marker marker-class-name="section4"/>
+                  <marker marker-class-name="section5"/>
+               </xsl:when>
+               <xsl:when test="$level=4">
+                  <marker marker-class-name="section5"/>
+               </xsl:when>
+               <xsl:when test="$level=5"/>                     
+            </xsl:choose>
+            <marker marker-class-name="section{$level}">
+               <xsl:if test="$numberHeadings='true'">
+                  <xsl:value-of select="$Number"/>
+                  <xsl:call-template name="headingNumberSuffix"/>
+               </xsl:if>
+               <xsl:value-of select="tei:head"/>
+            </marker>
+         </xsl:if>
+         <xsl:choose>
+            <xsl:when test="$foEngine='passivetex'">
+<!-- Passive TeX extension, to get PDF bookmarks -->
+          <fotex:bookmark fotex-bookmark-level="{$level}" fotex-bookmark-label="{$divid}">
+                  <xsl:if test="$numberHeadings='true'">
+                     <xsl:value-of select="$Number"/>
+                  </xsl:if>
+                  <xsl:value-of select="tei:head"/>
+               </fotex:bookmark>
+            </xsl:when>
+         </xsl:choose>
+      </block>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[fo] </desc>
+   </doc>
+  <xsl:template name="bookTOC">
+      <page-sequence format="1" initial-page-number="{$tocStartPage}" master-reference="twoside1">
+         <xsl:call-template name="headers-footers-twoside">
+            <xsl:with-param name="runeven">even page running head</xsl:with-param>
+            <xsl:with-param name="runodd">&#160;odd page running head</xsl:with-param>
+         </xsl:call-template>
+         <flow flow-name="xsl-region-body" font-family="{$bodyFont}">
+            <block text-align="center">
+               <xsl:attribute name="font-size">
+                  <xsl:value-of select="$tocSize"/>
+               </xsl:attribute>
+               <xsl:attribute name="text-indent">
+                  <xsl:value-of select="$headingOutdent"/>
+               </xsl:attribute>
+               <xsl:attribute name="font-weight">bold</xsl:attribute>
+               <xsl:attribute name="space-after">24pt</xsl:attribute>
+               <xsl:attribute name="space-before.optimum">24pt</xsl:attribute>
+               <xsl:text>Contents</xsl:text>
+            </block>
+            <xsl:for-each select="ancestor::tei:text/tei:group/tei:text">
+               <xsl:apply-templates select="." mode="toc"/>
+            </xsl:for-each>
+         </flow>
+      </page-sequence>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[fo] <param name="where">where</param>
+         <param name="force">force</param>
+      </desc>
+   </doc>
+  <xsl:template name="choosePageMaster">
+      <xsl:param name="where"/>
+      <xsl:param name="force"/>
+      <xsl:variable name="mn">
+         <xsl:choose>
+            <xsl:when test="$forcePageMaster">
+               <xsl:value-of select="$forcePageMaster"/>
+            </xsl:when>
+            <xsl:when test="not($where='')">
+               <xsl:choose>
+                  <xsl:when test="$twoSided='true'">twoside2</xsl:when>
+                  <xsl:otherwise>oneside2</xsl:otherwise>
+               </xsl:choose>
+            </xsl:when>
+            <xsl:otherwise>
+               <xsl:choose>
+                  <xsl:when test="$twoSided='true'">twoside1</xsl:when>
+                  <xsl:otherwise>oneside1</xsl:otherwise>
+               </xsl:choose>
+            </xsl:otherwise>
+         </xsl:choose>
+      </xsl:variable>
+      <xsl:attribute name="master-reference">
+         <xsl:value-of select="$mn"/>
+      </xsl:attribute>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[fo] </desc>
+   </doc>
+  <xsl:template name="grouptextStatic">
+      <static-content flow-name="xsl-region-after-right">
+         <block text-align="end" font-size="{$bodySize}">
+            <page-number/>
+         </block>
+      </static-content>
+      <static-content flow-name="xsl-region-after-left">
+         <block text-align="start" font-size="{$bodySize}">
+            <page-number/>
+         </block>
+      </static-content>
+      <static-content flow-name="xsl-region-before-left">
+         <block text-indent="0em" background-color="blue" font-weight="bold" padding="3pt"
+                color="white"
+                font-family="{$runFont}"
+                text-align="justify"
+                font-size="{$runSize}">
+            <inline>
+               <xsl:number/>
+            </inline>
+            <leader rule-thickness="0pt"/>
+            <inline>
+               <xsl:choose>
+                  <xsl:when test="front/tei:docTitle[@n]">
+                     <xsl:value-of select="tei:front/tei:docTitle[@n]"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:value-of select="tei:front/tei:docTitle"/>
+                  </xsl:otherwise>
+               </xsl:choose>
+            </inline>
+         </block>
+      </static-content>
+      <static-content flow-name="xsl-region-before-right">
+         <block background-color="blue" text-indent="0em" font-weight="bold" padding="3pt"
+                color="white"
+                text-align="left"
+                font-family="{$runFont}"
+                font-size="{$runSize}">
+            <xsl:value-of select="tei:front//tei:docAuthor"/>
+         </block>
+      </static-content>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[fo] <param name="runhead">runhead</param>
+      </desc>
+   </doc>
+  <xsl:template name="headers-footers-oneside">
+      <xsl:param name="runhead"/>
+      <static-content flow-name="xsl-region-before">
+         <block font-size="{$bodySize}">
+            <xsl:choose>
+               <xsl:when test="$runhead='true'">
+                  <xsl:value-of select="$runhead"/>
+               </xsl:when>
+               <xsl:otherwise>
+                  <xsl:call-template name="runninghead-author"/>
+               </xsl:otherwise>
+            </xsl:choose>
+         </block>
+      </static-content>
+      <static-content flow-name="xsl-region-after">
+         <block text-align="center" font-size="{$bodySize}">
+            <page-number/>
+         </block>
+      </static-content>
+      <static-content flow-name="xsl-region-before-first">
+        </static-content>
+      <static-content flow-name="xsl-region-after-first">
+         <block text-align="center" font-size="{$bodySize}">
+            <page-number/>
+         </block>
+      </static-content>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[fo] <param name="runhead">runhead</param>
+      </desc>
+   </doc>
+  <xsl:template name="headers-footers-oneside-back">
+      <xsl:param name="runhead"/>
+      <xsl:call-template name="headers-footers-oneside">
+         <xsl:with-param name="runhead">
+            <xsl:value-of select="$runhead"/>
+         </xsl:with-param>
+      </xsl:call-template>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[fo] <param name="runodd">odd page running head</param>
+         <param name="runeven">even page running head</param>
+      </desc>
+   </doc>
+  <xsl:template name="headers-footers-twoside">
+      <xsl:param name="runodd"/>
+      <xsl:param name="runeven"/>
+      <static-content flow-name="xsl-region-before-right">
+         <block text-align="justify" text-align-last="justify" font-size="{$bodySize}">
+            <xsl:choose>
+               <xsl:when test="$runodd">
+                  <xsl:value-of select="$runodd"/>
+               </xsl:when>
+               <xsl:when test="$sectionHeaders='true'">
+                  <block>
+                     <xsl:if test="$divRunningheads='true'">
+                        <inline>
+                           <retrieve-marker retrieve-class-name="section2"/>
+                        </inline>
+                     </xsl:if>
+                     <leader rule-thickness="0pt"/>
+                     <inline>
+                        <page-number/>
+                     </inline>
+                  </block>
+               </xsl:when>
+               <xsl:otherwise>
+                  <xsl:call-template name="runninghead-title"/>
+               </xsl:otherwise>
+            </xsl:choose>
+         </block>
+      </static-content>
+      <static-content flow-name="xsl-region-before-left">
+         <block text-align="justify" font-size="{$bodySize}">
+            <xsl:choose>
+               <xsl:when test="$runeven">
+                  <xsl:value-of select="$runeven"/>
+               </xsl:when>
+               <xsl:when test="$sectionHeaders='true'">
+                  <block>
+                     <inline>
+                        <page-number/>
+                     </inline>
+                     <leader rule-thickness="0pt"/>
+                     <xsl:if test="$divRunningheads='true'">
+                        <inline>
+                           <retrieve-marker retrieve-class-name="section1"/>
+                        </inline>
+                     </xsl:if>
+                  </block>
+               </xsl:when>
+               <xsl:otherwise>
+                  <xsl:call-template name="runninghead-author"/>
+               </xsl:otherwise>
+            </xsl:choose>
+         </block>
+      </static-content>
+      <static-content flow-name="xsl-region-before-first">
+         <block/>
+      </static-content>
+      <static-content flow-name="xsl-region-after-right">
+         <block text-align="end" font-size="{$bodySize}">
+            <page-number/>
+         </block>
+      </static-content>
+      <static-content flow-name="xsl-region-after-left">
+         <block text-align="start" font-size="{$bodySize}">
+            <page-number/>
+         </block>
+      </static-content>
+      <static-content flow-name="xsl-region-after-first">
+         <block font-size="{$bodySize}" text-align="end">
+            <page-number/>
+         </block>
+      </static-content>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[fo] <param name="runodd">odd page running head</param>
+         <param name="runeven">even page running head</param>
+      </desc>
+   </doc>
+  <xsl:template name="headers-footers-twoside-back">
+      <xsl:param name="runodd"/>
+      <xsl:param name="runeven"/>
+      <xsl:call-template name="headers-footers-twoside">
+         <xsl:with-param name="runeven">
+            <xsl:value-of select="$runeven"/>
+         </xsl:with-param>
+         <xsl:with-param name="runodd">
+            <xsl:value-of select="$runodd"/>
+         </xsl:with-param>
+      </xsl:call-template>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[fo] </desc>
+   </doc>
+  <xsl:template name="mainAction">
+      <xsl:choose>
+         <xsl:when test="tei:text/tei:group">
+            <xsl:apply-templates select="tei:text/tei:front"/>
+            <xsl:apply-templates select="tei:text/tei:group"/>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:apply-templates select="tei:text/tei:front"/>
+            <xsl:apply-templates select="tei:text/tei:body"/>
+         </xsl:otherwise>
+      </xsl:choose>
+      <xsl:apply-templates select="tei:text/tei:back"/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[fo] </desc>
+   </doc>
+  <xsl:template name="mainTOC">
+      <block>
+         <xsl:call-template name="setupDiv1"/>
+         <xsl:call-template name="i18n">
+            <xsl:with-param name="word">contentsWord</xsl:with-param>
+         </xsl:call-template>
+      </block>
+      <xsl:choose>
+         <xsl:when test="ancestor::tei:text/tei:group">
+            <xsl:for-each select="ancestor::tei:text/tei:group">
+               <xsl:apply-templates select="tei:text" mode="toc"/>
+            </xsl:for-each>
+         </xsl:when>
+         <xsl:when test="ancestor::tei:text/tei:body/tei:div1">
+            <xsl:if test="$tocFront='true'">
+               <xsl:for-each select="ancestor::tei:text/tei:front/tei:div1|ancestor::tei:text/tei:front//tei:div2|ancestor::tei:text/tei:front//tei:div3">
+                  <xsl:apply-templates mode="toc" select="(.)"/>
+               </xsl:for-each>
+            </xsl:if>
+            <xsl:for-each select="ancestor::tei:text/tei:body/tei:div1|ancestor::tei:text/tei:body//tei:div2|ancestor::tei:text/tei:body//tei:div3">
+               <xsl:apply-templates mode="toc" select="(.)"/>
+            </xsl:for-each>
+            <xsl:if test="$tocBack='true'">
+               <xsl:for-each select="ancestor::tei:text/tei:back/tei:div1|ancestor::tei:text/tei:back//tei:div2|ancestor::tei:text/tei:back//tei:div3">
+                  <xsl:apply-templates mode="toc" select="(.)"/>
+               </xsl:for-each>
+            </xsl:if>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:call-template name="tocBits"/>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[fo] </desc>
+   </doc>
+  <xsl:template name="runninghead-author">
+      <xsl:choose>
+         <xsl:when test="ancestor::tei:text[1]/tei:front//tei:docAuthor[@type='running']">
+            <xsl:apply-templates select="ancestor-or-self::tei:text[1]/tei:front//tei:docAuthor[@type='running']"
+                                 mode="heading"/>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:apply-templates select="ancestor-or-self::tei:text[1]/tei:front//tei:docAuthor" mode="heading"/>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[fo] </desc>
+   </doc>
+  <xsl:template name="runninghead-title">
+      <xsl:comment>Running Head: title</xsl:comment>
+      <xsl:choose>
+         <xsl:when test="ancestor-or-self::tei:text[1]/tei:front//tei:docTitle[1]/tei:titlePart[@type='running']">
+            <xsl:apply-templates select="ancestor-or-self::tei:text[1]/tei:front//tei:docTitle[1]/tei:titlePart[@type='running']"
+                                 mode="heading"/>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:apply-templates select="ancestor-or-self::tei:text[1]/tei:front//tei:docTitle[1]/tei:titlePart"
+                                 mode="heading"/>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[fo] </desc>
+   </doc>
+  <xsl:template name="setupPagemasters">
+      <layout-master-set>
+<!-- one sided, single column -->
+      <simple-page-master master-name="simple1" page-width="{$pageWidth}" page-height="{$pageHeight}"
+                             margin-top="{$pageMarginTop}"
+                             margin-bottom="{$pageMarginBottom}"
+                             margin-left="{$pageMarginLeft}"
+                             margin-right="{$pageMarginRight}">
+            <region-body margin-bottom="{$bodyMarginBottom}" margin-top="{$bodyMarginTop}"/>
+            <region-before extent="{$regionBeforeExtent}"/>
+            <region-after extent="{$regionAfterExtent}"/>
+         </simple-page-master>
+         <!-- for left-hand/tei:even pages in twosided mode, single column -->
+      <simple-page-master master-name="left1" page-width="{$pageWidth}" page-height="{$pageHeight}"
+                             margin-top="{$pageMarginTop}"
+                             margin-bottom="{$pageMarginBottom}"
+                             margin-left="{$pageMarginLeft}"
+                             margin-right="{$pageMarginRight}">
+            <region-body margin-bottom="{$bodyMarginBottom}" margin-top="{$bodyMarginTop}"/>
+            <region-before region-name="xsl-region-before-left" extent="{$regionBeforeExtent}"/>
+            <region-after region-name="xsl-region-after-left" extent="{$regionAfterExtent}"/>
+         </simple-page-master>
+         <!-- for right-hand/tei:odd pages in twosided mode, single column -->
+      <simple-page-master master-name="right1" page-width="{$pageWidth}" page-height="{$pageHeight}"
+                             margin-top="{$pageMarginTop}"
+                             margin-bottom="{$pageMarginBottom}"
+                             margin-left="{$pageMarginLeft}"
+                             margin-right="{$pageMarginRight}">
+            <region-body margin-bottom="{$bodyMarginBottom}" margin-top="{$bodyMarginTop}"/>
+            <region-before region-name="xsl-region-before-right" extent="{$regionBeforeExtent}"/>
+            <region-after region-name="xsl-region-after-right" extent="{$regionAfterExtent}"/>
+         </simple-page-master>
+         <!-- special case of first page in either mode, single column -->
+      <simple-page-master master-name="first1" page-width="{$pageWidth}" page-height="{$pageHeight}"
+                             margin-top="{$pageMarginTop}"
+                             margin-bottom="{$pageMarginBottom}"
+                             margin-left="{$pageMarginLeft}"
+                             margin-right="{$pageMarginRight}">
+            <region-body margin-bottom="{$bodyMarginBottom}" margin-top="{$bodyMarginTop}"/>
+            <region-before region-name="xsl-region-before-first" extent="{$regionBeforeExtent}"/>
+            <region-after region-name="xsl-region-after-first" extent="{$regionAfterExtent}"/>
+         </simple-page-master>
+         <!-- for pages in one-side mode, 2 column -->
+      <simple-page-master master-name="simple2" page-width="{$pageWidth}" page-height="{$pageHeight}"
+                             margin-top="{$pageMarginTop}"
+                             margin-bottom="{$pageMarginBottom}"
+                             margin-left="{$pageMarginLeft}"
+                             margin-right="{$pageMarginRight}">
+            <region-body column-count="{$columnCount}" margin-bottom="{$bodyMarginBottom}"
+                         margin-top="{$bodyMarginTop}"/>
+            <region-before extent="{$regionBeforeExtent}"/>
+            <region-after extent="{$regionAfterExtent}"/>
+         </simple-page-master>
+         <!-- for left-hand/tei:even pages in twosided mode, 2 column -->
+      <simple-page-master master-name="left2" page-width="{$pageWidth}" page-height="{$pageHeight}"
+                             margin-top="{$pageMarginTop}"
+                             margin-bottom="{$pageMarginBottom}"
+                             margin-left="{$pageMarginLeft}"
+                             margin-right="{$pageMarginRight}">
+            <region-body column-count="{$columnCount}" margin-bottom="{$bodyMarginBottom}"
+                         margin-top="{$bodyMarginTop}"/>
+            <region-before region-name="xsl-region-before-left" extent="{$regionBeforeExtent}"/>
+            <region-after region-name="xsl-region-after-left" extent="{$regionAfterExtent}"/>
+         </simple-page-master>
+         <!-- for right-hand/tei:odd pages in twosided mode, 2 column -->
+      <simple-page-master master-name="right2" page-width="{$pageWidth}" page-height="{$pageHeight}"
+                             margin-top="{$pageMarginTop}"
+                             margin-bottom="{$pageMarginBottom}"
+                             margin-left="{$pageMarginLeft}"
+                             margin-right="{$pageMarginRight}">
+            <region-body column-count="{$columnCount}" margin-bottom="{$bodyMarginBottom}"
+                         margin-top="{$bodyMarginTop}"/>
+            <region-before region-name="xsl-region-before-right" extent="{$regionBeforeExtent}"/>
+            <region-after region-name="xsl-region-after-right" extent="{$regionAfterExtent}"/>
+         </simple-page-master>
+         <!-- special case of first page in either mode -->
+      <simple-page-master master-name="first2" page-width="{$pageWidth}" page-height="{$pageHeight}"
+                             margin-top="{$pageMarginTop}"
+                             margin-bottom="{$pageMarginBottom}"
+                             margin-left="{$pageMarginLeft}"
+                             margin-right="{$pageMarginRight}">
+            <region-body column-count="{$columnCount}" margin-bottom="{$bodyMarginBottom}"
+                         margin-top="{$bodyMarginTop}"/>
+            <region-before region-name="xsl-region-before-first" extent="{$regionBeforeExtent}"/>
+            <region-after region-name="xsl-region-after-first" extent="{$regionAfterExtent}"/>
+         </simple-page-master>
+         <!-- setup for double-sided, 1 column, no first page -->
+      <page-sequence-master master-name="twoside1nofirst">
+            <repeatable-page-master-alternatives>
+               <conditional-page-master-reference master-reference="right1" odd-or-even="odd"/>
+               <conditional-page-master-reference master-reference="left1" odd-or-even="even"/>
+            </repeatable-page-master-alternatives>
+         </page-sequence-master>
+         <!-- setup for double-sided, 1 column -->
+      <page-sequence-master master-name="twoside1">
+            <repeatable-page-master-alternatives>
+               <conditional-page-master-reference master-reference="first1" page-position="first"/>
+               <conditional-page-master-reference master-reference="right1" odd-or-even="odd"/>
+               <conditional-page-master-reference master-reference="left1" odd-or-even="even"/>
+            </repeatable-page-master-alternatives>
+         </page-sequence-master>
+         <!-- setup for single-sided, 1 column -->
+      <page-sequence-master master-name="oneside1">
+            <repeatable-page-master-alternatives>
+               <conditional-page-master-reference master-reference="first1" page-position="first"/>
+               <conditional-page-master-reference master-reference="simple1"/>
+            </repeatable-page-master-alternatives>
+         </page-sequence-master>
+         <!-- setup for double-sided, 2 column -->
+      <page-sequence-master master-name="twoside2">
+            <repeatable-page-master-alternatives>
+               <conditional-page-master-reference master-reference="first2" page-position="first"/>
+               <conditional-page-master-reference master-reference="right2" odd-or-even="odd"/>
+               <conditional-page-master-reference master-reference="left2" odd-or-even="even"/>
+            </repeatable-page-master-alternatives>
+         </page-sequence-master>
+         <!-- setup for single-sided, 2 column -->
+      <page-sequence-master master-name="oneside2">
+            <repeatable-page-master-alternatives>
+               <conditional-page-master-reference master-reference="first2" page-position="first"/>
+               <conditional-page-master-reference master-reference="simple2"/>
+            </repeatable-page-master-alternatives>
+         </page-sequence-master>
+         <xsl:call-template name="pageMasterHook"/>
+      </layout-master-set>
+      <xsl:if test="$foEngine='xep'">
+<!-- PDF bookmarks using XEP -->
+      <outline xmlns="http://www.renderx.com/XSL/Extensions">
+            <xsl:for-each select="/tei:TEI/tei:text/tei:front/tei:div">
+               <xsl:call-template name="makeBookMark"/>
+            </xsl:for-each>
+            <xsl:for-each select="/tei:TEI/tei:text/tei:body/tei:div">
+               <xsl:call-template name="makeBookMark"/>
+            </xsl:for-each>
+            <xsl:for-each select="/tei:TEI/tei:text/tei:back/tei:div">
+               <xsl:call-template name="makeBookMark"/>
+            </xsl:for-each>
+            <!-- now try numbered divs -->
+        <xsl:for-each select="/tei:TEI/tei:text/tei:front/tei:div1">
+               <xsl:call-template name="makeBookMarkN"/>
+            </xsl:for-each>
+            <xsl:for-each select="/tei:TEI/tei:text/tei:body/tei:div1">
+               <xsl:call-template name="makeBookMarkN"/>
+            </xsl:for-each>
+            <xsl:for-each select="/tei:TEI/tei:text/tei:back/tei:div1">
+               <xsl:call-template name="makeBookMarkN"/>
+            </xsl:for-each>
+         </outline>
+      </xsl:if>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[fo] Make an XEP bookmark</desc>
+   </doc>
+  <xsl:template name="makeBookMark">
+      <xsl:if test="tei:head">
+         <bookmark xmlns="http://www.renderx.com/XSL/Extensions">
+            <xsl:variable name="depth" select="count(ancestor::tei:div)"/>
+            <xsl:attribute name="internal-destination">
+               <xsl:choose>
+                  <xsl:when test="@xml:id">
+                     <xsl:value-of select="@xml:id"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:value-of select="generate-id()"/>
+                  </xsl:otherwise>
+               </xsl:choose>
+            </xsl:attribute>
+            <bookmark-label>
+               <xsl:if test="$numberHeadings='true' and $numberHeadingsDepth &gt; $depth">
+                  <xsl:call-template name="calculateNumber">
+                     <xsl:with-param name="numbersuffix">
+		                      <xsl:call-template name="headingNumberSuffix"/>
+	                    </xsl:with-param>
+                  </xsl:call-template>
+                  <xsl:text> </xsl:text>
+               </xsl:if>
+               <xsl:value-of select="tei:head"/>
+            </bookmark-label>
+            <xsl:for-each select="tei:div">
+               <xsl:call-template name="makeBookMark"/>
+            </xsl:for-each>
+         </bookmark>
+      </xsl:if>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[fo] Make an XEP bookmark for numbered divs</desc>
+   </doc>
+  <xsl:template name="makeBookMarkN">
+      <xsl:if test="tei:head">
+         <xsl:variable name="depth" select="substring-after(local-name(.),'div')"/>
+         <bookmark xmlns="http://www.renderx.com/XSL/Extensions">
+            <xsl:attribute name="internal-destination">
+               <xsl:choose>
+                  <xsl:when test="@xml:id">
+                     <xsl:value-of select="@xml:id"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:value-of select="generate-id()"/>
+                  </xsl:otherwise>
+               </xsl:choose>
+            </xsl:attribute>
+            <bookmark-label>
+               <xsl:if test="$numberHeadings='true' and $numberHeadingsDepth &gt; $depth">
+                  <xsl:call-template name="calculateNumber">
+                     <xsl:with-param name="numbersuffix">
+		                      <xsl:call-template name="headingNumberSuffix"/>
+	                    </xsl:with-param>
+                  </xsl:call-template>
+                  <xsl:text> </xsl:text>
+               </xsl:if>
+               <xsl:value-of select="tei:head"/>
+            </bookmark-label>
+            <xsl:choose>
+               <xsl:when test="$depth='0'">
+                  <xsl:for-each select="tei:div1">
+                     <xsl:call-template name="makeBookMarkN"/>
+                  </xsl:for-each>
+               </xsl:when>
+               <xsl:when test="$depth='1'">
+                  <xsl:for-each select="tei:div2">
+                     <xsl:call-template name="makeBookMarkN"/>
+                  </xsl:for-each>
+               </xsl:when>
+               <xsl:when test="$depth='2'">
+                  <xsl:for-each select="tei:div3">
+                     <xsl:call-template name="makeBookMarkN"/>
+                  </xsl:for-each>
+               </xsl:when>
+               <xsl:when test="$depth='3'">
+                  <xsl:for-each select="tei:div4">
+                     <xsl:call-template name="makeBookMarkN"/>
+                  </xsl:for-each>
+               </xsl:when>
+               <xsl:when test="$depth='4'">
+                  <xsl:for-each select="tei:div5">
+                     <xsl:call-template name="makeBookMarkN"/>
+                  </xsl:for-each>
+               </xsl:when>
+               <xsl:when test="$depth='5'">
+                  <xsl:for-each select="tei:div6">
+                     <xsl:call-template name="makeBookMarkN"/>
+                  </xsl:for-each>
+               </xsl:when>
+            </xsl:choose>
+         </bookmark>
+      </xsl:if>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[fo] </desc>
+   </doc>
+  <xsl:template name="tocBits">
+      <xsl:if test="$tocFront='true'">
+         <xsl:for-each select="ancestor::tei:text/tei:front//tei:div">
+            <xsl:apply-templates mode="toc" select="(.)"/>
+         </xsl:for-each>
+      </xsl:if>
+      <xsl:for-each select="ancestor::tei:text/tei:body//tei:div">
+         <xsl:apply-templates mode="toc" select="(.)"/>
+      </xsl:for-each>
+      <xsl:if test="$tocBack='true'">
+         <xsl:for-each select="ancestor::tei:text/tei:back//tei:div">
+            <xsl:apply-templates mode="toc" select="(.)"/>
+         </xsl:for-each>
+      </xsl:if>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[fo] <param name="level">level</param>
+      </desc>
+   </doc>
+  <xsl:template name="tocheading">
+      <xsl:param name="level"/>
+      <xsl:variable name="tocindent">
+         <xsl:choose>
+            <xsl:when test="$level='0'">
+               <xsl:value-of select="$div0Tocindent"/>
+            </xsl:when>
+            <xsl:when test="$level='1'">
+               <xsl:value-of select="$div1Tocindent"/>
+            </xsl:when>
+            <xsl:when test="$level='2'">
+               <xsl:value-of select="$div2Tocindent"/>
+            </xsl:when>
+            <xsl:when test="$level='3'">
+               <xsl:value-of select="$div3Tocindent"/>
+            </xsl:when>
+            <xsl:when test="$level='4'">
+               <xsl:value-of select="$div4Tocindent"/>
+            </xsl:when>
+            <xsl:when test="$level='5'">
+               <xsl:value-of select="$div5Tocindent"/>
+            </xsl:when>
+            <xsl:otherwise>
+               <xsl:value-of select="$div1Tocindent"/>
+            </xsl:otherwise>
+         </xsl:choose>
+      </xsl:variable>
+      <block>
+         <xsl:if test="$level='0'">
+            <xsl:attribute name="font-weight">bold</xsl:attribute>
+         </xsl:if>
+         <xsl:attribute name="text-indent">
+            <xsl:value-of select="$tocindent"/>
+         </xsl:attribute>
+         <xsl:variable name="Number">
+            <xsl:if test="$numberHeadings='true' and $numberHeadingsDepth &gt; $level">
+               <xsl:call-template name="calculateNumber">
+                  <xsl:with-param name="numbersuffix" select="$tocNumberSuffix"/>
+               </xsl:call-template>
+            </xsl:if>
+         </xsl:variable>
+         <xsl:value-of select="$Number"/>
+         <xsl:text> </xsl:text>
+         <inline>
+            <xsl:apply-templates mode="section" select="tei:head"/>
+         </inline>
+         <leader rule-thickness="0pt"/>
+         <inline>
+            <xsl:call-template name="linkStyle"/>
+            <xsl:variable name="pagref">
+               <xsl:choose>
+                  <xsl:when test="@xml:id">
+                     <xsl:value-of select="@xml:id"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:value-of select="generate-id()"/>
+                  </xsl:otherwise>
+               </xsl:choose>
+            </xsl:variable>
+            <basic-link internal-destination="{$pagref}">
+               <page-number-citation ref-id="{$pagref}"/>
+            </basic-link>
+         </inline>
+      </block>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[fo] <param name="level">level</param>
+      </desc>
+   </doc>
+  <xsl:template name="xheading">
+      <xsl:param name="level"/>
+      <xsl:if test="$numberHeadings='true'">
+         <xsl:call-template name="calculateNumber"/>
+      </xsl:if>
+      <xsl:call-template name="divXRefHeading"/>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[fo] Work out the number of a section <param name="numbersuffix">suffix to add after number (typically ". ")</param>
+      </desc>
+   </doc>
+  <xsl:template name="calculateNumber">
+      <xsl:param name="numbersuffix"/>
+      <xsl:choose>
+         <xsl:when test="$prenumberedHeadings='true' and @n">
+            <xsl:value-of select="@n"/>
+            <xsl:value-of select="$numbersuffix"/>
+         </xsl:when>
+         <xsl:when test="ancestor::tei:front">
+            <xsl:if test="not($numberFrontHeadings='')">
+               <xsl:number count="tei:div|tei:div1|tei:div2|tei:div3|tei:div4"
+                           format="{$numberFrontHeadings}"
+                           from="tei:front"
+                           level="multiple"/>
+               <xsl:value-of select="$numbersuffix"/>
+            </xsl:if>
+         </xsl:when>
+         <xsl:when test="ancestor::tei:back">
+            <xsl:if test="not($numberBackHeadings='')">
+               <xsl:call-template name="i18n">
+                  <xsl:with-param name="word">appendixWords</xsl:with-param>
+               </xsl:call-template>
+               <xsl:text> </xsl:text>
+               <xsl:number count="tei:div|tei:div1|tei:div2|tei:div3|tei:div4"
+                           format="{$numberBackHeadings}"
+                           from="tei:back"
+                           level="multiple"/>
+               <xsl:value-of select="$numbersuffix"/>
+            </xsl:if>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:number count="tei:div|tei:div1|tei:div2|tei:div3|tei:div4" from="tei:body"
+                        level="multiple"/>
+	           <xsl:value-of select="$numbersuffix"/>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/textstructure.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/textcrit.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/textcrit.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/textcrit.xsl	(revision 258)
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet 
+                xmlns:fotex="http://www.tug.org/fotex"
+                xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
+                xmlns="http://www.w3.org/1999/XSL/Format"
+                xmlns:rng="http://relaxng.org/ns/structure/1.0"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                exclude-result-prefixes="a fotex rng tei teix"
+                version="2.0">
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet dealing with elements from the textcrit
+      module, making FO output. </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: textcrit.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2011, TEI Consortium</p>
+      </desc>
+   </doc>
+
+   <xsl:template name="appReading">
+     <xsl:param name="lemma"/>
+     <xsl:param name="lemmawitness"/>
+     <xsl:param name="readings"/>
+     <footnote>
+       <footnote-citation>
+	 <inline font-size="8pt" vertical-align="super">
+	 </inline>
+       </footnote-citation>
+       <list-block>
+	 <xsl:attribute name="provisional-distance-between-starts">
+	   <xsl:value-of select="$betweenStarts"/>
+	 </xsl:attribute>
+	 <xsl:attribute name="provisional-label-separation">
+	   <xsl:value-of select="$labelSeparation"/>
+	 </xsl:attribute>
+	 <list-item>
+	   <list-item-label end-indent="label-end()">
+	     <block>
+	       <inline font-size="{$footnoteSize}" vertical-align="super">
+	       </inline>
+	     </block>
+	   </list-item-label>
+	   <list-item-body start-indent="body-start()">
+	     <block font-size="{$footnoteSize}">
+	       <xsl:copy-of select="$readings"/>
+	     </block>
+	   </list-item-body>
+	 </list-item>
+       </list-block>
+     </footnote>
+
+  </xsl:template>
+
+
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/textcrit.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/corpus.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/corpus.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/corpus.xsl	(revision 258)
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet 
+                xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
+                xmlns="http://www.w3.org/1999/XSL/Format"
+                xmlns:rng="http://relaxng.org/ns/structure/1.0"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                exclude-result-prefixes="a rng tei teix"
+                version="2.0">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p>
+    TEI stylesheet
+    dealing  with elements from the
+      corpus module, making XSL-FO output.
+      </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: corpus.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2011, TEI Consortium</p>
+      </desc>
+   </doc>
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/corpus.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/teiCustom.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/teiCustom.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/teiCustom.xsl	(revision 258)
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:fotex="http://www.tug.org/fotex"
+                xmlns="http://www.w3.org/1999/XSL/Format"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                version="1.0">
+    <xsl:import href="tei.xsl"/>
+    
+    <!-- oXygen begin change -->
+    <!--
+        The default value of the 'tableAlign' param set in common/ tei-param.xsl is 
+        'leftTable' which is not a standard XSL-FO value for this param. It is reported 
+        as error by both Apache FOP and XEP. We set the default value to a 
+        standard one.
+    -->
+    <xsl:param name="tableAlign">left</xsl:param>
+    <!-- oXygen end change -->
+    
+    <xsl:template match="tei:table">
+        <xsl:choose>
+            <xsl:when test="@rend='eqnarray' and $foEngine='passivetex'">
+                <fotex:eqnarray>
+                    <xsl:apply-templates select=".//tei:formula"/>
+                </fotex:eqnarray>
+            </xsl:when>
+            <xsl:when test=".//tei:formula[@type='subeqn'] and $foEngine='passivetex'">
+                <fotex:eqnarray>
+                    <xsl:apply-templates select=".//tei:formula"/>
+                </fotex:eqnarray>
+            </xsl:when>
+            <xsl:when test="$inlineTables or @rend='inline'">
+                <xsl:if test="tei:head">
+                    <block>
+                        <xsl:call-template name="tableCaptionstyle"/>
+                        <!-- oXygen begin change -->
+                        <!-- 
+                            The same ID attribute value generated from the same node of the XML
+                            source cannot be added to two different elements of the XSL-FO result,
+                            that is an fo:block and a child element fo:table. Here we skip adding the ID
+                            attribute for the child element.
+                        -->
+                        <!-- <xsl:call-template name="addID"/> -->
+                        <!-- oXygen end change -->
+                        <xsl:if test="$makeTableCaption='true'">
+                            <xsl:call-template name="calculateTableNumber"/>
+                            <xsl:text>. </xsl:text>
+                        </xsl:if>
+                        <xsl:apply-templates select="tei:head"/>
+                    </block>
+                </xsl:if>
+                <xsl:call-template name="blockTable"/>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:call-template name="floatTable"/>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/teiCustom.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/transcr.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/transcr.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/transcr.xsl	(revision 258)
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet 
+                xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
+                xmlns="http://www.w3.org/1999/XSL/Format"
+                xmlns:rng="http://relaxng.org/ns/structure/1.0"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"
+                xmlns:html="http://www.w3.org/1999/xhtml"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                exclude-result-prefixes=" a  rng tei teix"
+                version="2.0">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p>
+    TEI stylesheet
+    dealing  with elements from the
+    transcr module, making XSL FO output.
+      </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: transcr.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2011, TEI Consortium</p>
+      </desc>
+   </doc>
+
+  <xsl:template match="tei:facsimile"/>
+
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/transcr.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/tei-param.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/tei-param.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/tei-param.xsl	(revision 258)
@@ -0,0 +1,858 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet 
+                xmlns="http://www.w3.org/1999/XSL/Format"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                exclude-result-prefixes="tei"
+                version="2.0">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p>
+    TEI stylesheet
+    customization module for 
+      fo output.</p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: tei-param.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2011, TEI Consortium</p>
+      </desc>
+   </doc>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="figures" type="string">
+      <desc>
+How to scale figures if no width and height specified (pass to XSL FO content-width)
+</desc>
+   </doc>
+  <xsl:param name="autoScaleFigures"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="figures" type="boolean">
+      <desc>
+Put captions on inline figures
+</desc>
+   </doc>
+  <xsl:param name="captionInlineFigures">false</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="figures">
+      <desc>[fo] Set attributes for display of figures</desc>
+   </doc>
+  <xsl:template name="figureCaptionstyle">
+      <xsl:attribute name="text-align">center</xsl:attribute>
+      <xsl:attribute name="font-style">italic</xsl:attribute>
+      <xsl:attribute name="end-indent">
+         <xsl:value-of select="$exampleMargin"/>
+      </xsl:attribute>
+      <xsl:attribute name="start-indent">
+         <xsl:value-of select="$exampleMargin"/>
+      </xsl:attribute>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="figures" type="boolean">
+      <desc>
+Show the contents of &lt;head&gt; in a cross-reference to table or figure
+</desc>
+   </doc>
+  <xsl:param name="showFloatHead">false</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="figures" type="boolean">
+      <desc>
+Show a title for figures or tables (eg Table or Figure) in a cross-reference
+</desc>
+   </doc>
+  <xsl:param name="showFloatLabel">false</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="figures" type="boolean">
+      <desc>
+Show the page number in a cross-reference to table or figure
+</desc>
+   </doc>
+  <xsl:param name="xrefShowPage">false</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="hook">
+      <desc>[fo] Hook where extra material can be inserted after the
+    &lt;body&gt; has been processed</desc>
+   </doc>
+  <xsl:template name="afterBodyHook"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="hook">
+      <desc>[fo] Hook where work can be done at the start of each block</desc>
+   </doc>
+  <xsl:template name="blockStartHook"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="hook">
+      <desc>[fo] Hook where extra page masters can be defined</desc>
+   </doc>
+  <xsl:template name="pageMasterHook"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="boolean">
+      <desc>
+Put back matter in multiple columns
+</desc>
+   </doc>
+  <xsl:param name="backMulticolumns">false</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="string">
+      <desc>
+Margin at bottom of text body
+</desc>
+   </doc>
+  <xsl:param name="bodyMarginBottom">24pt</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="string">
+      <desc>
+Margin at top of text body
+</desc>
+   </doc>
+  <xsl:param name="bodyMarginTop">24pt</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="boolean">
+      <desc>
+Put body matter in multiple columns
+</desc>
+   </doc>
+  <xsl:param name="bodyMulticolumns">false</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="string">
+      <desc>
+Symbol for 4th level itemized list
+</desc>
+   </doc>
+  <xsl:param name="bulletFour">+</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="string">
+      <desc>
+Symbol for top-level itemized list
+</desc>
+   </doc>
+  <xsl:param name="bulletOne">•</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="string">
+      <desc>
+Symbol for 3rd level itemized list
+</desc>
+   </doc>
+  <xsl:param name="bulletThree">*</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="string">
+      <desc>
+Symbol for 2nd level itemized list
+</desc>
+   </doc>
+  <xsl:param name="bulletTwo">–</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="integer">
+      <desc>
+Number of columns, when multiple-column work is requested
+</desc>
+   </doc>
+  <xsl:param name="columnCount">1</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="string">
+      <desc>
+XSL FO "provisional-distance-between starts"
+</desc>
+   </doc>
+  <xsl:param name="betweenStarts">18pt</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="string">
+      <desc>
+XSL FO "provisional-distance-between starts" for gloss lists
+</desc>
+   </doc>
+  <xsl:param name="betweenGlossStarts">42pt</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="string">
+      <desc>
+XSL FO "provisional-distance-between starts" for bibliographies
+</desc>
+   </doc>
+  <xsl:param name="betweenBiblStarts">14pt</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="boolean">
+      <desc>
+Display section headings in running heads
+</desc>
+   </doc>
+  <xsl:param name="divRunningheads">false</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="string">
+      <desc>
+Space below examples
+</desc>
+   </doc>
+  <xsl:param name="exampleAfter">4pt</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="string">
+      <desc>
+Space above examples
+</desc>
+   </doc>
+  <xsl:param name="exampleBefore">4pt</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="string">
+      <desc>
+Left margin for examples
+</desc>
+   </doc>
+  <xsl:param name="exampleMargin">12pt</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="string">
+      <desc>
+Left margin of flow
+</desc>
+   </doc>
+  <xsl:param name="flowMarginLeft"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="string">
+      <desc>
+Which named page master name to use
+</desc>
+   </doc>
+  <xsl:param name="forcePageMaster"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="string">
+      <desc>
+How to format page numbers in back matter (use XSLT number format)
+</desc>
+   </doc>
+  <xsl:param name="formatBackpage">1</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="string">
+      <desc>
+How to format page numbers in main matter (use XSLT number format)
+</desc>
+   </doc>
+  <xsl:param name="formatBodypage">1</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="string">
+      <desc>
+How to format page numbers in front matter (use XSLT number format)
+</desc>
+   </doc>
+  <xsl:param name="formatFrontpage">i</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="boolean">
+      <desc>
+Put front matter in multiple columns
+</desc>
+   </doc>
+  <xsl:param name="frontMulticolumns">false</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="string">
+      <desc>
+XSL FO "provisional-label-separation"
+</desc>
+   </doc>
+  <xsl:param name="labelSeparation">6pt</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="string">
+      <desc>
+Space above lists at top level
+</desc>
+   </doc>
+  <xsl:param name="listAbove-1">6pt</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="string">
+      <desc>
+Space above lists at 2nd level
+</desc>
+   </doc>
+  <xsl:param name="listAbove-2">4pt</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="string">
+      <desc>
+Space above lists at 3rd level
+</desc>
+   </doc>
+  <xsl:param name="listAbove-3">0pt</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="string">
+      <desc>
+Space above lists at 4th level
+</desc>
+   </doc>
+  <xsl:param name="listAbove-4">0pt</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="string">
+      <desc>
+Space below lists at top level
+</desc>
+   </doc>
+  <xsl:param name="listBelow-1">6pt</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="string">
+      <desc>
+Space below lists at 2nd level
+</desc>
+   </doc>
+  <xsl:param name="listBelow-2">4pt</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="string">
+      <desc>
+Space below lists at 3rd level
+</desc>
+   </doc>
+  <xsl:param name="listBelow-3">0pt</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="string">
+      <desc>
+Space below lists at 4th level
+</desc>
+   </doc>
+  <xsl:param name="listBelow-4">0pt</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="string">
+      <desc>
+Spacing between list items
+</desc>
+   </doc>
+  <xsl:param name="listItemsep">4pt</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="string">
+      <desc>
+Left margin for gloss lists
+</desc>
+   </doc>
+  <xsl:param name="listLeftGlossIndent">0.5in</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="string">
+      <desc>
+Left margin for nested gloss lists
+</desc>
+   </doc>
+  <xsl:param name="listLeftGlossInnerIndent">0.25in</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="string">
+      <desc>
+Indentation for lists
+</desc>
+   </doc>
+  <xsl:param name="listLeftIndent">0pt</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="string">
+      <desc>
+Right margin for lists
+</desc>
+   </doc>
+  <xsl:param name="listRightMargin">10pt</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="string">
+      <desc>
+Paper height
+</desc>
+   </doc>
+  <xsl:param name="pageHeight">297mm</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="string">
+      <desc>
+Margin at bottom of text area
+</desc>
+   </doc>
+  <xsl:param name="pageMarginBottom">100pt</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="string">
+      <desc>
+Left margin
+</desc>
+   </doc>
+  <xsl:param name="pageMarginLeft">80pt</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="string">
+      <desc>
+Right margin
+</desc>
+   </doc>
+  <xsl:param name="pageMarginRight">150pt</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="string">
+      <desc>
+Margin at top of text area
+</desc>
+   </doc>
+  <xsl:param name="pageMarginTop">75pt</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="string">
+      <desc>
+Paper width
+</desc>
+   </doc>
+  <xsl:param name="pageWidth">211mm</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="string">
+      <desc>
+Maximum space allowed between paragraphs
+</desc>
+   </doc>
+  <xsl:param name="parSkipmax">12pt</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="anyURI">
+      <desc>
+External XML file containing specifications for column sizes for
+tables in document
+</desc>
+   </doc>
+  <xsl:param name="readColSpecFile"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="string">
+      <desc>
+Region after
+</desc>
+   </doc>
+  <xsl:param name="regionAfterExtent">14pt</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="string">
+      <desc>
+Region before
+</desc>
+   </doc>
+  <xsl:param name="regionBeforeExtent">14pt</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="boolean">
+      <desc>
+Construct running headers from page number and section headings
+</desc>
+   </doc>
+  <xsl:param name="sectionHeaders">true</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="string">
+      <desc>
+Space after bibliography
+</desc>
+   </doc>
+  <xsl:param name="spaceAfterBibl">0pt</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="string">
+      <desc>
+Space above and below a table
+</desc>
+   </doc>
+  <xsl:param name="spaceAroundTable">8pt</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="string">
+      <desc>
+Space above bibliography
+</desc>
+   </doc>
+  <xsl:param name="spaceBeforeBibl">4pt</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="string">
+      <desc>
+Space below caption of figure or table
+</desc>
+   </doc>
+  <xsl:param name="spaceBelowCaption">4pt</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="boolean">
+      <desc>
+Make title page
+</desc>
+   </doc>
+  <xsl:param name="titlePage">true</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="boolean">
+      <desc>
+Make 2-page spreads
+</desc>
+   </doc>
+  <xsl:param name="twoSided">true</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="output" type="string">
+      <desc>
+Language (for hyphenation)
+</desc>
+   </doc>
+  <xsl:param name="language">en_US</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="output" type="string">
+      <desc>
+         <p>Name of intended XSL FO engine</p>
+         <p>This is used to tailor the result for different XSL FO processors.
+By default, no special measures are taken, so
+there are no bookmarks or other such features. Possible values are
+<ul xmlns="http://www.w3.org/1999/XSL/Format">
+               <li>passivetex (the TeX-based PassiveTeX processor</li>
+               <li>xep   (XEP)</li>
+               <li>fop (FOP)</li>
+               <li>antenna  (Antenna House)</li>
+            </ul>
+         </p>
+      </desc>
+   </doc>
+  <xsl:param name="foEngine"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="style" type="boolean">
+      <desc>
+Make &lt;lb&gt; active (ie cause a line break)
+</desc>
+   </doc>
+  <xsl:param name="activeLinebreaks">true</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="style" type="string">
+      <desc>
+Alignment of text (ie justified or ragged)
+</desc>
+   </doc>
+  <xsl:param name="alignment">justify</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="style" type="string">
+      <desc>
+Font size for display of author name 
+</desc>
+   </doc>
+  <xsl:param name="authorSize">14pt</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="style" type="string">
+      <desc>
+Font size for bibliography
+</desc>
+   </doc>
+  <xsl:param name="biblSize">16pt</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="style" type="string">
+      <desc>
+Default font for body
+</desc>
+   </doc>
+  <xsl:param name="bodyFont">Times</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="style" type="string">
+      <desc>
+Default font size for body (without dimension)
+</desc>
+   </doc>
+  <xsl:param name="bodyMaster">10</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="style" type="string">
+      <desc>
+Calculation of normal body font size (add dimension)
+</desc>
+   </doc>
+  <xsl:param name="bodySize">
+      <xsl:value-of select="$bodyMaster"/>
+      <xsl:text>pt</xsl:text>
+  </xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="style" type="string">
+      <desc>
+Font size for display of date
+</desc>
+   </doc>
+  <xsl:param name="dateSize">14pt</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="style" type="string">
+      <desc>
+Font for section headings
+</desc>
+   </doc>
+  <xsl:param name="divFont">Times</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="style">
+      <desc>[fo] How to display section headings in a cross-reference <param name="head">section title</param>
+      </desc>
+   </doc>
+  <xsl:template name="divXRefHeading">
+      <xsl:param name="head">
+         <xsl:apply-templates mode="section" select="tei:head"/>
+      </xsl:param>
+      <xsl:text> (</xsl:text>
+      <xsl:value-of select="normalize-space($head)"/>
+      <xsl:text>)</xsl:text>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="style" type="string">
+      <desc>
+Colour for display of &lt;eg&gt; blocks.
+</desc>
+   </doc>
+  <xsl:param name="exampleColor">black</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="style" type="string">
+      <desc>
+Colour for background display of &lt;eg&gt; blocks.
+</desc>
+   </doc>
+  <xsl:param name="exampleBackgroundColor">gray</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="style" type="string">
+      <desc>
+Calculation of font size for examples (add dimension)
+</desc>
+   </doc>
+  <xsl:param name="exampleSize">
+      <xsl:value-of select="$bodyMaster * 0.6"/>
+      <xsl:text>pt</xsl:text>
+  </xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="style" type="string">
+      <desc>
+Calculation of font size for quotations
+</desc>
+   </doc>
+  <xsl:param name="quoteSize">
+      <xsl:value-of select="$bodyMaster * 0.9"/>
+      <xsl:text>pt</xsl:text>
+  </xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="style" type="string">
+      <desc>
+Font size for footnotes
+</desc>
+   </doc>
+  <xsl:param name="footnoteSize">
+      <xsl:value-of select="$bodyMaster * 0.8"/>
+  </xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="style" type="string">
+      <desc>
+Font size for footnote numbers
+</desc>
+   </doc>
+  <xsl:param name="footnotenumSize">
+    <xsl:value-of select="$bodyMaster * 0.7"/>
+  </xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="style" type="string">
+      <desc>
+Colour for display of element names
+</desc>
+   </doc>
+  <xsl:param name="giColor">black</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="style" type="string">
+      <desc>
+Indentation of headings
+</desc>
+   </doc>
+  <xsl:param name="headingOutdent">0em</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="style" type="boolean">
+      <desc>
+Hyphenate text
+</desc>
+   </doc>
+  <xsl:param name="hyphenate">true</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="style" type="string">
+      <desc>
+Colour for display of &lt;ident&gt; values
+    Customization parameter.
+</desc>
+   </doc>
+  <xsl:param name="identColor">black</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="style">
+      <desc>[fo] Set attributes for display of links</desc>
+   </doc>
+  <xsl:template name="linkStyle">
+      <xsl:attribute name="text-decoration">underline</xsl:attribute>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="style" type="string">
+      <desc>
+Font family for running header and footer
+</desc>
+   </doc>
+  <xsl:param name="runFont">sans-serif</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="style" type="string">
+      <desc>
+Font size for running header and footer
+</desc>
+   </doc>
+  <xsl:param name="runSize">9pt</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="style" type="string">
+      <desc>
+Sans-serif font
+</desc>
+   </doc>
+  <xsl:param name="sansFont">Helvetica</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="style">
+      <desc>[fo] Set attributes for display of heading for chapters (level 0)</desc>
+   </doc>
+  <xsl:template name="setupDiv0">
+      <xsl:attribute name="font-size">18pt</xsl:attribute>
+      <xsl:attribute name="text-align">left</xsl:attribute>
+      <xsl:attribute name="font-weight">bold</xsl:attribute>
+      <xsl:attribute name="space-after">6pt</xsl:attribute>
+      <xsl:attribute name="space-before.optimum">12pt</xsl:attribute>
+      <xsl:attribute name="text-indent">
+         <xsl:value-of select="$headingOutdent"/>
+      </xsl:attribute>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="style">
+      <desc>[fo] Set attributes for display of heading for 1st level sections</desc>
+   </doc>
+  <xsl:template name="setupDiv1">
+      <xsl:attribute name="font-size">14pt</xsl:attribute>
+      <xsl:attribute name="text-align">left</xsl:attribute>
+      <xsl:attribute name="font-weight">bold</xsl:attribute>
+      <xsl:attribute name="space-after">3pt</xsl:attribute>
+      <xsl:attribute name="space-before.optimum">9pt</xsl:attribute>
+      <xsl:attribute name="text-indent">
+         <xsl:value-of select="$headingOutdent"/>
+      </xsl:attribute>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="style">
+      <desc>[fo] Set attributes for display of heading for 2nd level sections </desc>
+   </doc>
+  <xsl:template name="setupDiv2">
+      <xsl:attribute name="font-size">12pt</xsl:attribute>
+      <xsl:attribute name="text-align">left</xsl:attribute>
+      <xsl:attribute name="font-weight">bold</xsl:attribute>
+      <xsl:attribute name="font-style">italic</xsl:attribute>
+      <xsl:attribute name="space-after">2pt</xsl:attribute>
+      <xsl:attribute name="space-before.optimum">4pt</xsl:attribute>
+      <xsl:attribute name="text-indent">
+         <xsl:value-of select="$headingOutdent"/>
+      </xsl:attribute>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="style">
+      <desc>[fo]Set attributes for display of heading for 3rd level sections </desc>
+   </doc>
+  <xsl:template name="setupDiv3">
+      <xsl:attribute name="font-size">10pt</xsl:attribute>
+      <xsl:attribute name="text-align">left</xsl:attribute>
+      <xsl:attribute name="font-style">italic</xsl:attribute>
+      <xsl:attribute name="space-after">0pt</xsl:attribute>
+      <xsl:attribute name="space-before.optimum">4pt</xsl:attribute>
+      <xsl:attribute name="text-indent">
+         <xsl:value-of select="$headingOutdent"/>
+      </xsl:attribute>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="style">
+      <desc>[fo] Set attributes for display of heading for 4th level sections </desc>
+   </doc>
+  <xsl:template name="setupDiv4">
+      <xsl:attribute name="font-size">10pt</xsl:attribute>
+      <xsl:attribute name="text-align">left</xsl:attribute>
+      <xsl:attribute name="font-style">italic</xsl:attribute>
+      <xsl:attribute name="space-after">0pt</xsl:attribute>
+      <xsl:attribute name="space-before.optimum">4pt</xsl:attribute>
+      <xsl:attribute name="text-indent">
+         <xsl:value-of select="$headingOutdent"/>
+      </xsl:attribute>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="style">
+      <desc>[fo] Set attributes for display of heading for 5th level sections </desc>
+   </doc>
+  <xsl:template name="setupDiv5">
+      <xsl:attribute name="font-size">10pt</xsl:attribute>
+      <xsl:attribute name="text-align">left</xsl:attribute>
+      <xsl:attribute name="font-style">italic</xsl:attribute>
+      <xsl:attribute name="space-after">0pt</xsl:attribute>
+      <xsl:attribute name="space-before.optimum">4pt</xsl:attribute>
+      <xsl:attribute name="text-indent">
+         <xsl:value-of select="$headingOutdent"/>
+      </xsl:attribute>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="style">
+      <desc>[fo] Set attributes for display of heading for 6th level sections </desc>
+   </doc>
+  <xsl:template name="setupDiv6">
+      <xsl:attribute name="font-size">10pt</xsl:attribute>
+      <xsl:attribute name="text-align">left</xsl:attribute>
+      <xsl:attribute name="font-style">italic</xsl:attribute>
+      <xsl:attribute name="space-after">0pt</xsl:attribute>
+      <xsl:attribute name="space-before.optimum">4pt</xsl:attribute>
+      <xsl:attribute name="text-indent">
+         <xsl:value-of select="$headingOutdent"/>
+      </xsl:attribute>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="style">
+      <desc>[fo] How to display the link text of a &lt;ptr&gt;<param name="dest">the URL being linked to</param>
+      </desc>
+   </doc>
+  <xsl:template name="showXrefURL">
+      <xsl:param name="dest"/>
+      <xsl:value-of select="$dest"/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="style" type="string">
+      <desc>
+Calculation of small font size (add dimension)
+</desc>
+   </doc>
+  <xsl:param name="smallSize">
+      <xsl:value-of select="$bodyMaster * 0.9"/>
+      <xsl:text>pt</xsl:text>
+  </xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="style" type="string">
+      <desc>
+Create font size for tables, by reference to $bodyMaster
+</desc>
+   </doc>
+  <xsl:param name="tableSize">
+      <xsl:value-of select="$bodyMaster * 0.9"/>
+      <xsl:text>pt</xsl:text>
+  </xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="style" type="string">
+      <desc>
+Font size for display of title
+</desc>
+   </doc>
+  <xsl:param name="titleSize">16pt</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="style" type="string">
+      <desc>
+Font size for TOC heading
+</desc>
+   </doc>
+  <xsl:param name="tocSize">16pt</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="style" type="string">
+      <desc>
+Font for literal code
+</desc>
+   </doc>
+  <xsl:param name="typewriterFont">Courier</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="tables" type="string">
+      <desc>
+Default colour for background of table cells which are labelling rows
+or columns</desc>
+   </doc>
+  <xsl:param name="defaultCellLabelBackground">silver</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="tables" type="boolean">
+      <desc>
+Force tables to appear inline
+</desc>
+   </doc>
+  <xsl:param name="inlineTables">false</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="tables" type="boolean">
+      <desc>
+Put a caption on tables  
+</desc>
+   </doc>
+  <xsl:param name="makeTableCaption">true</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="tables" type="string">
+      <desc>
+Alignment of table captions
+</desc>
+   </doc>
+  <xsl:param name="tableCaptionAlign">center</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="tables">
+      <desc>[fo] Set attributes for display of table </desc>
+   </doc>
+  <xsl:template name="tableCaptionstyle">
+      <xsl:attribute name="text-align">center</xsl:attribute>
+      <xsl:attribute name="font-style">italic</xsl:attribute>
+      <xsl:attribute name="end-indent">
+         <xsl:value-of select="$exampleMargin"/>
+      </xsl:attribute>
+      <xsl:attribute name="start-indent">
+         <xsl:value-of select="$exampleMargin"/>
+      </xsl:attribute>
+      <xsl:attribute name="space-before">
+         <xsl:value-of select="$spaceAroundTable"/>
+      </xsl:attribute>
+      <xsl:attribute name="space-after">
+         <xsl:value-of select="$spaceBelowCaption"/>
+      </xsl:attribute>
+      <xsl:attribute name="keep-with-next">always</xsl:attribute>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="tables" type="string">
+      <desc>
+Default padding on table cells
+</desc>
+   </doc>
+  <xsl:param name="tableCellPadding">2pt</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="toc" type="string">
+      <desc>
+Indentation for level 0 TOC entries
+</desc>
+   </doc>
+  <xsl:param name="div0Tocindent">0in</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="toc" type="string">
+      <desc>
+Indentation for level 1 TOC entries
+</desc>
+   </doc>
+  <xsl:param name="div1Tocindent">0.25in</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="toc" type="string">
+      <desc>
+Indentation for level 2 TOC entries
+</desc>
+   </doc>
+  <xsl:param name="div2Tocindent">0.5in</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="toc" type="string">
+      <desc>
+Indentation for level 3 TOC entries
+</desc>
+   </doc>
+  <xsl:param name="div3Tocindent">0.75in</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="toc" type="string">
+      <desc>
+Indentation for level 4 TOC entries
+</desc>
+   </doc>
+  <xsl:param name="div4Tocindent">1in</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="toc" type="string">
+      <desc>
+    Indentation for level 5 TOC entries
+  </desc>
+   </doc>
+  <xsl:param name="div5Tocindent">1.25in</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="toc" type="boolean">
+      <desc>
+Make TOC for sections in &lt;back&gt;
+</desc>
+   </doc>
+  <xsl:param name="tocBack">true</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="toc" type="boolean">
+      <desc>
+Make TOC for sections in &lt;front&gt;
+</desc>
+   </doc>
+  <xsl:param name="tocFront">true</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="toc" type="string">
+      <desc>
+Punctuation to insert after a section number in a TOC
+</desc>
+   </doc>
+  <xsl:param name="tocNumberSuffix">. </xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="toc" type="integer">
+      <desc>
+Page number on which TOC should start
+</desc>
+   </doc>
+  <xsl:param name="tocStartPage">1</xsl:param>
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/tei-param.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/tei.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/tei.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/tei.xsl	(revision 258)
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet 
+                xmlns:m="http://www.w3.org/1998/Math/MathML"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:fotex="http://www.tug.org/fotex"
+                xmlns="http://www.w3.org/1999/XSL/Format"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                exclude-result-prefixes="tei fotex m"
+                version="2.0">
+  <xsl:import href="../common2/tei.xsl"/>
+  <xsl:import href="tei-param.xsl"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p>
+    TEI stylesheet making XSL-FO output.
+      </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: tei.xsl 9669 2011-11-07 19:17:54Z rahtz $</p>
+         <p>Copyright: 2011, TEI Consortium</p>
+      </desc>
+   </doc>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" type="string">
+      <desc>
+    Stylesheet constant for the input document.
+  </desc>
+   </doc>
+  <xsl:variable name="top" select="/"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" type="string">
+      <desc>
+    Stylesheet constant for table specifications
+  </desc>
+   </doc>
+  <xsl:variable name="tableSpecs">
+      <xsl:choose>
+         <xsl:when test="$readColSpecFile">
+            <xsl:copy-of select="document($readColSpecFile,$top)/Info"/>
+         </xsl:when>
+         <xsl:otherwise>
+            <Info/>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:variable>
+  <xsl:output indent="no" encoding="utf-8"/>
+  <xsl:strip-space elements="tei:cell"/>
+  <xsl:key name="DIVS"
+            match="tei:div|tei:div1|tei:div2|tei:div3|tei:div4|tei:div5"
+            use="'1'"/>
+  <xsl:include href="tei-makecolspec.xsl"/>
+  <xsl:include href="core.xsl"/>
+  <xsl:include href="corpus.xsl"/>
+  <xsl:include href="drama.xsl"/>
+  <xsl:include href="figures.xsl"/>
+  <xsl:include href="header.xsl"/>
+  <xsl:include href="linking.xsl"/>
+  <xsl:include href="namesdates.xsl"/>
+  <xsl:include href="tagdocs.xsl"/>
+  <xsl:include href="textcrit.xsl"/>
+  <xsl:include href="textstructure.xsl"/>
+  <xsl:include href="transcr.xsl"/>
+  <xsl:include href="verse.xsl"/>
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/tei.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/drama.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/drama.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/drama.xsl	(revision 258)
@@ -0,0 +1,243 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet 
+                xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
+                xmlns="http://www.w3.org/1999/XSL/Format"
+                xmlns:rng="http://relaxng.org/ns/structure/1.0"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                exclude-result-prefixes="a rng tei teix"
+                version="2.0">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p>
+    TEI stylesheet
+    dealing  with elements from the
+      drama module, making XSL-FO output.
+      </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: drama.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2011, TEI Consortium</p>
+      </desc>
+   </doc>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:actor">
+      <inline>
+         <xsl:call-template name="rend">
+            <xsl:with-param name="defaultvalue" select="string('normal')"/>
+            <xsl:with-param name="defaultstyle" select="string('font-style')"/>
+         </xsl:call-template>
+         <xsl:apply-templates/>
+      </inline>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:camera">
+      <inline>
+         <xsl:call-template name="rend">
+            <xsl:with-param name="defaultvalue" select="string('normal')"/>
+            <xsl:with-param name="defaultstyle" select="string('font-style')"/>
+         </xsl:call-template>
+         <xsl:apply-templates/>
+      </inline>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:caption">
+      <inline>
+         <xsl:call-template name="rend">
+            <xsl:with-param name="defaultvalue" select="string('normal')"/>
+            <xsl:with-param name="defaultstyle" select="string('font-style')"/>
+         </xsl:call-template>
+         <xsl:apply-templates/>
+      </inline>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:castGroup">
+      <xsl:apply-templates/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:castItem">
+      <xsl:call-template name="makeItem"/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process elements castItem (when @type is 'list')</desc>
+   </doc>
+  <xsl:template match="tei:castItem[@type='list']">
+      <list-item>
+         <xsl:attribute name="space-before.optimum">
+            <xsl:value-of select="$listItemsep"/>
+         </xsl:attribute>
+         <list-item-label end-indent="label-end()">
+            <xsl:if test="@xml:id">
+               <xsl:attribute name="id">
+                  <xsl:value-of select="@xml:id"/>
+               </xsl:attribute>
+            </xsl:if>
+            <xsl:text>&#10;</xsl:text>
+            <block/>
+         </list-item-label>
+         <list-item-body start-indent="body-start()">
+            <block>
+               <xsl:call-template name="rend">
+                  <xsl:with-param name="defaultvalue" select="string('italic')"/>
+                  <xsl:with-param name="defaultstyle" select="string('font-style')"/>
+               </xsl:call-template>
+               <xsl:text>(</xsl:text>
+               <xsl:apply-templates/>
+               <xsl:text>)</xsl:text>
+            </block>
+         </list-item-body>
+      </list-item>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:castList">
+      <xsl:if test="child::tei:head">
+         <block font-style="italic" text-align="start" space-before.optimum="4pt">
+            <xsl:for-each select="tei:head">
+               <xsl:apply-templates/>
+            </xsl:for-each>
+         </block>
+      </xsl:if>
+      <list-block>
+         <xsl:call-template name="setListIndents"/>
+         <xsl:apply-templates/>
+      </list-block>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:sp">
+      <block text-align="justify" start-indent="1em" text-indent="-1em" space-before="3pt">
+         <xsl:apply-templates/>
+      </block>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+    
+         <p xmlns="http://www.w3.org/1999/XSL/Format"> paragraphs inside speeches do very little</p>
+    
+      </desc>
+   </doc>
+  <xsl:template match="tei:sp/tei:p">
+      <inline>
+         <xsl:apply-templates/>
+      </inline>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:speaker">
+      <inline>
+         <xsl:call-template name="rend">
+            <xsl:with-param name="defaultvalue" select="string('italic')"/>
+            <xsl:with-param name="defaultstyle" select="string('font-style')"/>
+         </xsl:call-template>
+         <xsl:apply-templates/>
+         <xsl:text> </xsl:text>
+      </inline>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:stage">
+      <block>
+         <xsl:attribute name="text-indent">1em</xsl:attribute>
+         <xsl:call-template name="rend">
+            <xsl:with-param name="defaultvalue" select="string('italic')"/>
+            <xsl:with-param name="defaultstyle" select="string('font-style')"/>
+         </xsl:call-template>
+         <xsl:apply-templates/>
+      </block>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:p/tei:stage">
+      <inline>
+         <xsl:call-template name="rend">
+            <xsl:with-param name="defaultvalue" select="string('italic')"/>
+            <xsl:with-param name="defaultstyle" select="string('font-style')"/>
+         </xsl:call-template>
+         <xsl:apply-templates/>
+      </inline>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:sp/tei:stage">
+      <inline>
+         <xsl:call-template name="rend">
+            <xsl:with-param name="defaultvalue" select="string('italic')"/>
+            <xsl:with-param name="defaultstyle" select="string('font-style')"/>
+         </xsl:call-template>
+         <xsl:apply-templates/>
+      </inline>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:tech">
+      <inline>
+         <xsl:call-template name="rend">
+            <xsl:with-param name="defaultvalue" select="string('italic')"/>
+            <xsl:with-param name="defaultstyle" select="string('font-style')"/>
+         </xsl:call-template>
+         <xsl:apply-templates/>
+      </inline>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:view">
+      <inline>
+         <xsl:call-template name="rend">
+            <xsl:with-param name="defaultvalue" select="string('italic')"/>
+            <xsl:with-param name="defaultstyle" select="string('font-style')"/>
+         </xsl:call-template>
+         <xsl:apply-templates/>
+      </inline>
+  </xsl:template>
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/drama.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/namesdates.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/namesdates.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/namesdates.xsl	(revision 258)
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet 
+                xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
+                xmlns="http://www.w3.org/1999/XSL/Format"
+                xmlns:rng="http://relaxng.org/ns/structure/1.0"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                exclude-result-prefixes=" a rng tei teix"
+                version="2.0">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p>
+    TEI stylesheet
+    dealing  with elements from the
+      namesdates module, making XSL-FO output.
+      </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: namesdates.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2011, TEI Consortium</p>
+      </desc>
+   </doc>
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/namesdates.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/tagdocs.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/tagdocs.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/tagdocs.xsl	(revision 258)
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet 
+                xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
+                xmlns="http://www.w3.org/1999/XSL/Format"
+                xmlns:rng="http://relaxng.org/ns/structure/1.0"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                exclude-result-prefixes=" a rng tei teix"
+                version="2.0">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p>
+    TEI stylesheet
+    dealing  with elements from the
+      tagdocs module, making XSL-FO output.
+      </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: tagdocs.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2011, TEI Consortium</p>
+      </desc>
+   </doc>
+
+  <xsl:template name="specHook">
+      <xsl:param name="name"/>
+  </xsl:template>
+
+
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/tagdocs.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/verse.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/verse.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/verse.xsl	(revision 258)
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet 
+                xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
+                xmlns="http://www.w3.org/1999/XSL/Format"
+                xmlns:rng="http://relaxng.org/ns/structure/1.0"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                exclude-result-prefixes=" a rng tei teix"
+                version="2.0">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p>
+    TEI stylesheet
+    dealing  with elements from the
+      verse module, making XSL-FO output.
+      </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: verse.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2011, TEI Consortium</p>
+      </desc>
+   </doc>
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/fo2/verse.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/html5/build-to.xml
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/html5/build-to.xml	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/html5/build-to.xml	(revision 258)
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="utf-8"?>
+<project basedir="." default="dist" name="teitohtml">
+<!--
+	This library is free software; you can redistribute it and/or
+	modify it under the terms of the GNU Lesser General Public
+	License as published by the Free Software Foundation; either
+	version 2.1 of the License, or (at your option) any later version.
+	
+	This library 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
+	Lesser General Public License for more details.
+	
+	You should have received a copy of the GNU Lesser General Public
+	License along with this library; if not, write to the Free Software
+	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+	
+        Id: $Id: build-to.xml 9703 2011-11-09 11:16:42Z rahtz $
+        Copyright: 2011, TEI Consortium<
+-->
+  <!--
+ Convert TEI documents into HTML files.
+ -->
+  <!-- Path to TEI XML file. -->
+  <property name="inputFile" value=""/>
+  <!-- Path where the output ePUB file will be saved. -->
+  <property name="outputFile" value=""/>
+  <!-- which profile -->
+  <property name="profile" value="default"/>
+  <!-- where does oxygen keep stuff -->
+  <property name="oxygenlib" value=""/>
+  <!-- Stylesheet for transformation -->
+  <property name="stylesheetFile"  value="../profiles/${profile}/html5/to.xsl"/>
+  <dirname property="inputFileDir" file="${inputFile}"/>
+  <dirname property="outputDir" file="${outputFile}"/>
+  <property name="outputTempDir" value="${outputDir}/temp-dir-for-ant"/>
+  <path id="classpath">
+    <pathelement path="${java.class.path}"/>
+  </path>
+  <import file="../odds2/build-to.xml"/>
+  <target name="setup">
+    <delete dir="${outputTempDir}"/>
+    <mkdir dir="${outputTempDir}"/>
+  </target>
+
+ 
+  <target name="transform">
+    <echo level="info">XSLT generate HTML5 files</echo>
+    <xslt force="yes" style="${stylesheetFile}" in="${outputTempDir}/tmp2.xml" out="${outputFile}" classpath="classpath">
+      <xmlcatalog>
+        <catalogpath>
+          <pathelement location="../../../../catalog.xml"/>
+          <pathelement location="../../../../../xhtml11/dtd/xhtmlcatalog.xml"/>
+        </catalogpath>
+      </xmlcatalog>
+      <factory name="net.sf.saxon.TransformerFactoryImpl"/>
+      <classpath location="${oxygenlib}/saxon9ee.jar"/>
+      <param name="directory" expression="file:///${outputTempDir}"/>
+      <param name="inputDir" expression="${inputFileDir}/"/>
+      <param name="cssFile" expression="${cssFile}" if="cssFile"/>
+      <!-- name of media overlay file -->
+      <param name="mediaoverlay" expression="${mediaoverlay}" if="mediaoverlay"/>
+      <!-- file per page -->
+      <param name="filePerPage" expression="${filePerPage}" if="filePerPage"/>
+      <!-- supply name of language-->
+      <param name="lang" expression="${lang}" if="lang"/>
+      <!-- emit some diagnostics"-->
+      <param name="debug" expression="${debug}" if="debug"/>
+      <!-- be verbose-->
+      <param name="verbose" expression="${verbose}" if="verbose"/>
+    </xslt>
+  </target>
+
+ <target name="dist" depends="setup,odd,notodd,transform,cleanup"/>
+
+  <target name="cleanup" unless="debug">  
+    <delete dir="${outputTempDir}"/>
+  </target>
+
+</project>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/html5/build-to.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/html5/tei.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/html5/tei.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/html5/tei.xsl	(revision 258)
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet 
+    xmlns:tei="http://www.tei-c.org/ns/1.0"
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    exclude-result-prefixes="tei"
+    version="2.0">
+    <!-- import base conversion style -->
+
+    <xsl:import href="../xhtml2/tei.xsl"/>
+    <xsl:import href="textstructure.xsl"/>
+    <xsl:output method="xml" omit-xml-declaration="yes" doctype-system="about:legacy-compat" />
+    <xsl:param name="outputTarget">html5</xsl:param>
+    <xsl:param name="doctype-system">about:legacy-compat</xsl:param>
+    <xsl:param name="doctype-public"/>
+    <xsl:param name="divOffset">1</xsl:param>
+
+    <xsl:template match="/">
+	<xsl:call-template name="processTEI"/>
+    </xsl:template>
+
+<!--
+    <xsl:template match="@*|text()|comment()|processing-instruction()"  mode="html5">
+      <xsl:copy-of select="."/>
+    </xsl:template>
+        
+    <xsl:template match="*" mode="html5">
+      <xsl:element name="{local-name()}">
+         <xsl:apply-templates
+	     select="*|@*|processing-instruction()|comment()|text()"  mode="html5"/>
+      </xsl:element>
+   </xsl:template>
+-->
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/html5/tei.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/html5/microdata.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/html5/microdata.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/html5/microdata.xsl	(revision 258)
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet 
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+    version="2.0"
+    xpath-default-namespace="http://www.tei-c.org/ns/1.0">
+
+  <xsl:template name="microdata">
+    <xsl:choose>
+      <xsl:when test="self::p"/>
+      <xsl:when test="starts-with(local-name(),'div')">
+	<xsl:attribute name="itemscope">itemscope</xsl:attribute>
+	<xsl:attribute name="itemtype">http://www.tei-c.org/ns/1.0/</xsl:attribute>
+      </xsl:when>
+      <xsl:when test="self::docDate|self::date">
+	<xsl:attribute name="itemprop">date</xsl:attribute>
+      </xsl:when>
+      <xsl:otherwise>
+	<xsl:attribute name="itemprop" select="local-name()"/>
+      </xsl:otherwise>
+    </xsl:choose>
+    <xsl:if test="@when">
+      <xsl:attribute name="data-when">
+	<xsl:value-of select="@when"/>
+      </xsl:attribute>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template name="bodyMicroData">
+    <xsl:attribute name="itemscope">itemscope</xsl:attribute>
+    <xsl:attribute name="itemtype">http://www.tei-c.org/ns/1.0/</xsl:attribute>
+    <xsl:attribute name="itemprop">TEI</xsl:attribute>
+  </xsl:template>
+
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/html5/microdata.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/html5/textstructure.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/html5/textstructure.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/html5/textstructure.xsl	(revision 258)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet 
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+    version="2.0"
+    xmlns="http://www.w3.org/1999/xhtml"
+    xpath-default-namespace="http://www.tei-c.org/ns/1.0">
+
+  <xsl:template match="front|body|back">
+    <div class="tei_{local-name()}">
+      <xsl:apply-templates/>
+    </div>
+  </xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/html5/textstructure.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/lists/lists.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/lists/lists.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/lists/lists.xsl	(revision 258)
@@ -0,0 +1,231 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
+                xmlns:cals="http://www.oasis-open.org/specs/tm9901"
+                xmlns:contypes="http://schemas.openxmlformats.org/package/2006/content-types"
+                xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties"
+                xmlns:dc="http://purl.org/dc/elements/1.1/"
+                xmlns:dcmitype="http://purl.org/dc/dcmitype/"
+                xmlns:dcterms="http://purl.org/dc/terms/"
+                xmlns:html="http://www.w3.org/1999/xhtml"
+                xmlns:iso="http://www.iso.org/ns/1.0"
+                xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"
+                xmlns:mml="http://www.w3.org/1998/Math/MathML"
+                xmlns:o="urn:schemas-microsoft-com:office:office"
+                xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"
+                xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
+                xmlns:tbx="http://www.lisa.org/TBX-Specification.33.0.html"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teidocx="http://www.tei-c.org/ns/teidocx/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"
+                xmlns:v="urn:schemas-microsoft-com:vml"
+                xmlns:fn="http://www.w3.org/2005/02/xpath-functions"
+                xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006"
+                xmlns:w10="urn:schemas-microsoft-com:office:word"
+                xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
+                xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml"
+                xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"
+                
+                xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="2.0"
+                exclude-result-prefixes="cp ve o r m v wp w10 w wne mml tbx iso      tei a xs pic fn xsi dc dcterms dcmitype     contypes teidocx teix html cals">
+
+
+    <xsl:key name="AN"
+	 match="w:abstractNum"
+	 use="w:lvl/w:pStyle/@w:val"/>
+    <xsl:key name="NUMS"
+	     match="w:num[not(w:lvlOverride)]"
+	     use="w:abstractNumId/@w:val"/>
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet for making Word docx files from TEI XML </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: lists.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc>
+   </doc>
+
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+        Handle value lists
+    </desc>
+   </doc>
+    <xsl:template match="tei:label[following-sibling::tei:*[1]/self::tei:item]">
+        <xsl:param name="nop"/>
+
+        <w:p>
+            <w:pPr>
+                <w:pStyle w:val="dl"/>
+                <w:ind w:left="567" w:hanging="567"/>
+            </w:pPr>
+            <xsl:apply-templates>
+                <xsl:with-param name="nop">true</xsl:with-param>
+            </xsl:apply-templates>
+            <w:r>
+                <w:tab/>
+            </w:r>
+            <xsl:for-each select="following-sibling::tei:item[1]">
+                <xsl:apply-templates>
+                    <xsl:with-param name="nop">true</xsl:with-param>
+                </xsl:apply-templates>
+            </xsl:for-each>
+        </w:p>
+    </xsl:template>
+
+    <xsl:template match="tei:item/tei:list">
+        <xsl:param name="nop"/>
+        <xsl:apply-templates>
+            <xsl:with-param name="nop">false</xsl:with-param>
+        </xsl:apply-templates>
+    </xsl:template>
+
+    <xsl:template match="tei:item[preceding-sibling::tei:*[1]/self::tei:label]"/>
+
+
+    <xsl:template match="comment()"/>
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc> 
+        Handle list items
+    </desc>
+   </doc>
+    <xsl:template match="tei:item">
+        <xsl:param name="nop"/>
+        <xsl:variable name="listStyle">
+            <xsl:choose>
+                <xsl:when test="../@type='unordered' or ../@type='simple' or not(../@type)">
+                    <xsl:call-template name="getStyleName">
+                        <xsl:with-param name="in">
+                            <xsl:text>List Continue</xsl:text>
+                            <xsl:call-template name="listNumberDepth"/>
+                        </xsl:with-param>
+                    </xsl:call-template>
+                </xsl:when>
+                <xsl:when test="../@type='ordered'">
+                    <xsl:call-template name="getStyleName">
+                        <xsl:with-param name="in">
+                            <xsl:text>List Number</xsl:text>
+                            <xsl:call-template name="listNumberDepth"/>
+                        </xsl:with-param>
+                    </xsl:call-template>
+                </xsl:when>
+                <xsl:when test="../@type='termlist'"/>
+                <xsl:otherwise>
+                    <xsl:text>ListParagraph</xsl:text>
+                </xsl:otherwise>
+            </xsl:choose>
+        </xsl:variable>
+        <xsl:variable name="pPr">
+            <w:pPr>
+                <xsl:if test="string-length($listStyle) &gt; 1">
+                    <w:pStyle w:val="{$listStyle}"/>
+                </xsl:if>
+                <xsl:choose>
+                    <xsl:when test="../@type='unordered' or not(../@type)">
+                        <w:numPr>
+                            <w:ilvl>
+                                <xsl:attribute name="w:val">
+                                    <xsl:value-of select="count(ancestor::tei:list) - 1"/>
+                                </xsl:attribute>
+                            </w:ilvl>
+			    <w:numId>
+			      <xsl:attribute name="w:val">
+				<xsl:choose>
+				  <xsl:when
+				      test="$isofreestanding='true'">
+				    <xsl:text>2</xsl:text>
+				  </xsl:when>
+				  <xsl:otherwise>
+				    <xsl:for-each select="document(concat($wordDirectory,'/word/numbering.xml'))">
+				      <xsl:variable name="abstractNumId"
+						    select="key('AN',$listStyle)/@w:abstractNumId"/>
+				      <xsl:value-of select="key('NUMS',$abstractNumId)/@w:numId"/>
+				    </xsl:for-each>
+				  </xsl:otherwise>
+				</xsl:choose>
+			      </xsl:attribute>
+			    </w:numId>
+			</w:numPr>
+                    </xsl:when>
+                    <xsl:when test="../@type='ordered'">
+                        <w:numPr>
+                            <w:ilvl>
+                                <xsl:attribute name="w:val">
+                                    <xsl:value-of select="count(ancestor::tei:list) - 1"/>
+                                </xsl:attribute>
+                            </w:ilvl>
+                            <w:numId>
+			      <xsl:attribute name="w:val">
+				<!-- @see template: numbering-definition ordered lists -->
+				<xsl:variable name="CurrentList">
+				  <xsl:value-of select="generate-id(..)"/>
+				</xsl:variable>
+				<xsl:for-each select="key('OL',1)">
+				  <xsl:if test="$CurrentList=generate-id(.)">
+				    <xsl:value-of select="position()+100"/>
+				  </xsl:if>
+				</xsl:for-each>
+			      </xsl:attribute>
+                            </w:numId>
+                        </w:numPr>
+                    </xsl:when>
+                </xsl:choose>
+            </w:pPr>
+        </xsl:variable>
+	<!--
+	    <xsl:message>List item <xsl:value-of select="."/>, <xsl:value-of
+	    select="$nop"/>, <xsl:value-of select="$listStyle"/></xsl:message>
+	-->
+        <xsl:call-template name="block-element">
+            <xsl:with-param name="pPr" select="$pPr"/>
+            <xsl:with-param name="nop" select="$nop"/>
+        </xsl:call-template>
+    </xsl:template>
+
+    <xsl:template name="listNumberDepth">
+        <xsl:choose>
+            <xsl:when test="ancestor::tei:glossListEntry">
+                <xsl:value-of select="count(ancestor::tei:list)                 + ancestor::tei:glossListEntry/@count"/>
+            </xsl:when>
+            <xsl:when test="parent::tei:list/ancestor::tei:list">
+                <xsl:text> </xsl:text>
+                <xsl:value-of select="count(ancestor::tei:list)"/>
+            </xsl:when>
+        </xsl:choose>
+    </xsl:template>
+
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/lists/lists.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/templates/default.xml
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/templates/default.xml	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/templates/default.xml	(revision 258)
@@ -0,0 +1,48 @@
+<TEI xmlns="http://www.tei-c.org/ns/1.0" xmlns:tei="http://www.tei-c.org/ns/1.0"
+     xmlns:rel="http://schemas.openxmlformats.org/package/2006/relationships"
+     xmlns:teidocx="http://www.tei-c.org/ns/teidocx/1.0"
+     xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
+     xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"
+     xml:lang="en">
+  <text>
+      <fw xml:id="rId101" type="footer">
+         <p rend="Footer">
+            <teidocx:dynamicContent type="pagenumber"/>
+            <c rend="ptab" type="center">	</c>
+            <c rend="ptab" type="right">	</c></p>
+      </fw>
+      <fw xml:id="rId102" type="footer">
+         <p rend="Footer">
+	   <c rend="ptab" type="center">	</c>
+	   <c rend="ptab" type="right">	</c>
+	   <teidocx:dynamicContent type="pagenumber"/>
+         </p>
+      </fw>
+      <fw xml:id="rId103" type="footer">
+         <p rend="Footer">
+	   <c rend="ptab" type="center">	</c>
+	   <teidocx:dynamicContent type="pagenumber"/>
+         </p>
+      </fw>
+      <fw xml:id="rId104" type="header">
+         <p rend="Header"><seg> </seg>
+         </p>
+      </fw>
+      <fw xml:id="rId105" type="header">
+         <p rend="Header"><seg> </seg>
+         </p>
+      </fw>
+      <fw xml:id="rId106" type="header">
+         <p rend="Header"><seg> </seg>
+         </p>
+      </fw>
+      <milestone unit="section">
+	<teidocx:footer type="even" ref="rId101"/>
+	<teidocx:footer type="default" ref="rId102"/>
+	<teidocx:footer type="first" ref="rId103"/>
+	<teidocx:header type="even" ref="rId104"/>
+	<teidocx:header type="default" ref="rId105"/>
+	<teidocx:header type="first" ref="rId106"/>
+      </milestone>
+  </text>
+</TEI>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/templates/default.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/docxfiles/headers.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/docxfiles/headers.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/docxfiles/headers.xsl	(revision 258)
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
+                xmlns:cals="http://www.oasis-open.org/specs/tm9901"
+                xmlns:contypes="http://schemas.openxmlformats.org/package/2006/content-types"
+                xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties"
+                xmlns:dc="http://purl.org/dc/elements/1.1/"
+                xmlns:dcmitype="http://purl.org/dc/dcmitype/"
+                xmlns:dcterms="http://purl.org/dc/terms/"
+                xmlns:html="http://www.w3.org/1999/xhtml"
+                xmlns:iso="http://www.iso.org/ns/1.0"
+                xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"
+                xmlns:mml="http://www.w3.org/1998/Math/MathML"
+                xmlns:o="urn:schemas-microsoft-com:office:office"
+                xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"
+                xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
+                xmlns:tbx="http://www.lisa.org/TBX-Specification.33.0.html"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teidocx="http://www.tei-c.org/ns/teidocx/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"
+                xmlns:v="urn:schemas-microsoft-com:vml"
+                xmlns:fn="http://www.w3.org/2005/02/xpath-functions"
+                xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006"
+                xmlns:w10="urn:schemas-microsoft-com:office:word"
+                xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
+                xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml"
+                xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"
+                
+                xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="2.0"
+                exclude-result-prefixes="cp ve o r m v wp w10 w wne mml tbx iso      tei a xs pic fn xsi dc dcterms dcmitype     contypes teidocx teix html cals">
+    
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet for making Word docx files from TEI XML </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: headers.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc>
+   </doc>
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+        
+    </desc>
+   </doc>
+    <xsl:template name="write-docxfile-header-files">
+        <xsl:choose>
+            <xsl:when test="count(key('ALLHEADERS',1))=0">
+                <xsl:for-each select="document($defaultHeaderFooterFile)">
+                    <xsl:call-template name="write-docxfile-specific-header-file"/>
+                </xsl:for-each>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:call-template name="write-docxfile-specific-header-file"/>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+        
+    </desc>
+   </doc>
+    <xsl:template name="write-docxfile-specific-header-file">
+        <xsl:for-each select="key('ALLHEADERS',1)">
+	        <xsl:if test="$debug='true'">
+	           <xsl:message>Writing out <xsl:value-of select="concat($wordDirectory,'/word/header',position(),'.xml')"/>
+            </xsl:message>
+	        </xsl:if>
+
+            <xsl:result-document href="{concat($wordDirectory,'/word/header',position(),'.xml')}">
+                <w:hdr xmlns:mv="urn:schemas-microsoft-com:mac:vml"
+                   xmlns:mo="http://schemas.microsoft.com/office/mac/office/2008/main">
+                    <xsl:apply-templates select="."/>
+                </w:hdr>
+            </xsl:result-document>
+        </xsl:for-each>
+    </xsl:template>
+    
+    
+    
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/docxfiles/headers.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/docxfiles/content-types.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/docxfiles/content-types.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/docxfiles/content-types.xsl	(revision 258)
@@ -0,0 +1,183 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
+                xmlns:cals="http://www.oasis-open.org/specs/tm9901"
+                xmlns:contypes="http://schemas.openxmlformats.org/package/2006/content-types"
+                xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties"
+                xmlns:dc="http://purl.org/dc/elements/1.1/"
+                xmlns:dcmitype="http://purl.org/dc/dcmitype/"
+                xmlns:dcterms="http://purl.org/dc/terms/"
+                xmlns:html="http://www.w3.org/1999/xhtml"
+                xmlns:iso="http://www.iso.org/ns/1.0"
+                xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"
+                xmlns:mml="http://www.w3.org/1998/Math/MathML"
+                xmlns:o="urn:schemas-microsoft-com:office:office"
+                xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"
+                xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
+                xmlns:tbx="http://www.lisa.org/TBX-Specification.33.0.html"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teidocx="http://www.tei-c.org/ns/teidocx/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"
+                xmlns:v="urn:schemas-microsoft-com:vml"
+                xmlns:fn="http://www.w3.org/2005/02/xpath-functions"
+                xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006"
+                xmlns:w10="urn:schemas-microsoft-com:office:word"
+                xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
+                xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml"
+                xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"
+                
+                xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="2.0"
+                exclude-result-prefixes="cp ve o r m v wp w10 w wne mml tbx iso      tei a xs pic fn xsi dc dcterms dcmitype     contypes teidocx teix html cals">
+    
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet for making Word docx files from TEI XML </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: content-types.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc>
+   </doc>
+    
+    <xsl:template name="write-docxfile-content-types">
+	     <xsl:if test="$debug='true'">
+	        <xsl:message>Writing out <xsl:value-of select="concat($wordDirectory,'/%5BContent_Types%5D.xml')"/>
+         </xsl:message>
+	     </xsl:if>
+
+        <xsl:result-document href="{concat($wordDirectory,'/%5BContent_Types%5D.xml')}">
+            
+            <Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
+                
+                <Default Extension="jpeg" ContentType="image/jpeg"/>
+                <Default Extension="jpg" ContentType="image/jpeg"/>
+                <Default Extension="png" ContentType="image/png"/>
+                <Default Extension="tiff" ContentType="image/tiff"/>
+                <Default Extension="rels"
+                     ContentType="application/vnd.openxmlformats-package.relationships+xml"/>
+                <Default Extension="xml" ContentType="application/xml"/>
+                <Default Extension="bin"
+                     ContentType="application/vnd.openxmlformats-officedocument.oleObject"/>
+                <Default Extension="wmf" ContentType="image/x-wmf"/>
+                <Default Extension="emf" ContentType="image/x-emf"/>
+                
+                
+                <!-- docprops -->
+                <Override PartName="/docProps/core.xml"
+                      ContentType="application/vnd.openxmlformats-package.core-properties+xml"/>
+                <Override PartName="/docProps/app.xml"
+                      ContentType="application/vnd.openxmlformats-officedocument.extended-properties+xml"/>
+                <Override PartName="/docProps/custom.xml"
+                      ContentType="application/vnd.openxmlformats-officedocument.custom-properties+xml"/>
+                
+                <!-- word -->
+                <Override PartName="/word/document.xml"
+                      ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"/>
+                <Override PartName="/word/styles.xml"
+                      ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml"/>
+                <Override PartName="/word/numbering.xml"
+                      ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml"/>
+                <Override PartName="/word/webSettings.xml"
+                      ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.webSettings+xml"/>
+                
+                <Override PartName="/word/endnotes.xml"
+                      ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml"/>
+                <Override PartName="/word/fontTable.xml"
+                      ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml"/>
+                <Override PartName="/word/footnotes.xml"
+                      ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml"/>
+                <Override PartName="/word/settings.xml"
+                      ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml"/>
+		<Override PartName="/word/comments.xml"
+                      ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml"/>
+
+                <!-- others -->
+                <Override PartName="/word/theme/theme1.xml"
+                      ContentType="application/vnd.openxmlformats-officedocument.theme+xml"/>
+                
+                <!-- headers -->
+                <xsl:choose>
+                    <xsl:when test="count(key('ALLHEADERS',1))=0">
+                        <xsl:for-each select="document($defaultHeaderFooterFile)">
+                            <xsl:call-template name="write-docxfile-content-types-header-references"/>
+                        </xsl:for-each>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <xsl:call-template name="write-docxfile-content-types-header-references"/>
+                    </xsl:otherwise>
+                </xsl:choose>
+                
+                
+                <!-- footers -->
+                <xsl:choose>
+                    <xsl:when test="count(key('ALLFOOTERS',1))=0">
+                        <xsl:for-each select="document($defaultHeaderFooterFile)">
+                            <xsl:call-template name="write-docxfile-content-types-footer-references"/>
+                        </xsl:for-each>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <xsl:call-template name="write-docxfile-content-types-footer-references"/>
+                    </xsl:otherwise>
+                </xsl:choose>
+            </Types>
+            
+        </xsl:result-document>
+    </xsl:template>
+    
+    
+    
+    <xsl:template name="write-docxfile-content-types-footer-references">
+        <xsl:for-each select="key('ALLFOOTERS',1)">
+            <Override xmlns="http://schemas.openxmlformats.org/package/2006/content-types"
+                   ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml">
+                <xsl:attribute name="PartName" select="concat('/word/footer', position(), '.xml')"/>
+            </Override>            
+        </xsl:for-each>
+    </xsl:template>
+    
+    <xsl:template name="write-docxfile-content-types-header-references">
+        <xsl:for-each select="key('ALLHEADERS',1)">
+            <Override xmlns="http://schemas.openxmlformats.org/package/2006/content-types"
+                   ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml">
+                <xsl:attribute name="PartName" select="concat('/word/header', position(), '.xml')"/>
+            </Override>
+        </xsl:for-each>
+    </xsl:template>
+    
+    
+    
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/docxfiles/content-types.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/docxfiles/numbering-definition.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/docxfiles/numbering-definition.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/docxfiles/numbering-definition.xsl	(revision 258)
@@ -0,0 +1,965 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
+                xmlns:cals="http://www.oasis-open.org/specs/tm9901"
+                xmlns:contypes="http://schemas.openxmlformats.org/package/2006/content-types"
+                xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties"
+                xmlns:dc="http://purl.org/dc/elements/1.1/"
+                xmlns:dcmitype="http://purl.org/dc/dcmitype/"
+                xmlns:dcterms="http://purl.org/dc/terms/"
+                xmlns:html="http://www.w3.org/1999/xhtml"
+                xmlns:iso="http://www.iso.org/ns/1.0"
+                xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"
+                xmlns:mml="http://www.w3.org/1998/Math/MathML"
+                xmlns:o="urn:schemas-microsoft-com:office:office"
+                xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"
+                xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
+                xmlns:tbx="http://www.lisa.org/TBX-Specification.33.0.html"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teidocx="http://www.tei-c.org/ns/teidocx/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"
+                xmlns:v="urn:schemas-microsoft-com:vml"
+                xmlns:fn="http://www.w3.org/2005/02/xpath-functions"
+                xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006"
+                xmlns:w10="urn:schemas-microsoft-com:office:word"
+                xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
+                xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml"
+                xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"
+                
+                xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="2.0"
+                exclude-result-prefixes="cp ve o r m v wp w10 w wne mml tbx iso      tei a xs pic fn xsi dc dcterms dcmitype     contypes teidocx teix html cals">
+    
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet for making Word docx files from TEI XML </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: numbering-definition.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc>
+   </doc>
+    
+    
+     <xsl:template name="write-docxfile-numbering-definition">
+	     <xsl:if test="$debug='true'">
+	        <xsl:message>Writing out <xsl:value-of select="concat($wordDirectory,'/word/numbering.xml')"/>
+         </xsl:message>
+	     </xsl:if>
+
+        <xsl:result-document href="{concat($wordDirectory,'/word/numbering.xml')}">
+            <w:numbering>
+
+                <!-- for headlines -->
+                <w:abstractNum w:abstractNumId="1">
+                    <w:multiLevelType w:val="multilevel"/>
+                    <w:name w:val="heading"/>
+                    <w:lvl w:ilvl="0">
+                        <w:start w:val="1"/>
+                        <w:numFmt w:val="decimal"/>
+                        <w:pStyle w:val="Heading1"/>
+                        <w:lvlText w:val="%1"/>
+                        <w:lvlJc w:val="left"/>
+                        <w:pPr>
+                            <w:ind w:left="432" w:hanging="432"/>
+                        </w:pPr>
+                        <w:rPr>
+                            <w:rFonts w:hint="default"/>
+                        </w:rPr>
+                    </w:lvl>
+                    <w:lvl w:ilvl="1">
+                        <w:start w:val="1"/>
+                        <w:numFmt w:val="decimal"/>
+                        <w:pStyle w:val="Heading2"/>
+                        <w:lvlText w:val="%1.%2"/>
+                        <w:lvlJc w:val="left"/>
+                        <w:pPr>
+                            <w:ind w:left="648" w:hanging="648"/>
+                        </w:pPr>
+                        <w:rPr>
+                            <w:rFonts w:hint="default"/>
+                        </w:rPr>
+                    </w:lvl>
+                    <w:lvl w:ilvl="2">
+                        <w:start w:val="1"/>
+                        <w:numFmt w:val="decimal"/>
+                        <w:pStyle w:val="Heading3"/>
+                        <w:lvlText w:val="%1.%2.%3"/>
+                        <w:lvlJc w:val="left"/>
+                        <w:pPr>
+                            <w:ind w:left="864" w:hanging="864"/>
+                        </w:pPr>
+                        <w:rPr>
+                            <w:rFonts w:hint="default"/>
+                        </w:rPr>
+                    </w:lvl>
+                    <w:lvl w:ilvl="3">
+                        <w:start w:val="1"/>
+                        <w:numFmt w:val="decimal"/>
+                        <w:pStyle w:val="Heading4"/>
+                        <w:lvlText w:val="%1.%2.%3.%4"/>
+                        <w:lvlJc w:val="left"/>
+                        <w:pPr>
+                            <w:ind w:left="1080" w:hanging="1080"/>
+                        </w:pPr>
+                        <w:rPr>
+                            <w:rFonts w:hint="default"/>
+                        </w:rPr>
+                    </w:lvl>
+                    <w:lvl w:ilvl="4">
+                        <w:start w:val="1"/>
+                        <w:numFmt w:val="decimal"/>
+                        <w:pStyle w:val="Heading5"/>
+                        <w:lvlText w:val="%1.%2.%3.%4.%5"/>
+                        <w:lvlJc w:val="left"/>
+                        <w:pPr>
+                            <w:ind w:left="1296" w:hanging="1296"/>
+                        </w:pPr>
+                        <w:rPr>
+                            <w:rFonts w:hint="default"/>
+                        </w:rPr>
+                    </w:lvl>
+                    <w:lvl w:ilvl="5">
+                        <w:start w:val="1"/>
+                        <w:numFmt w:val="decimal"/>
+                        <w:pStyle w:val="Heading6"/>
+                        <w:lvlText w:val="%1.%2.%3.%4.%5.%6"/>
+                        <w:lvlJc w:val="left"/>
+                        <w:pPr>
+                            <w:ind w:left="1512" w:hanging="1512"/>
+                        </w:pPr>
+                        <w:rPr>
+                            <w:rFonts w:hint="default"/>
+                        </w:rPr>
+                    </w:lvl>
+                    <w:lvl w:ilvl="6">
+                        <w:start w:val="1"/>
+                        <w:numFmt w:val="decimal"/>
+                        <w:pStyle w:val="Heading7"/>
+                        <w:lvlText w:val="%1.%2.%3.%4.%5.%6.%7"/>
+                        <w:lvlJc w:val="left"/>
+                        <w:pPr>
+                            <w:ind w:left="1728" w:hanging="1728"/>
+                        </w:pPr>
+                        <w:rPr>
+                            <w:rFonts w:hint="default"/>
+                        </w:rPr>
+                    </w:lvl>
+                    <w:lvl w:ilvl="7">
+                        <w:start w:val="1"/>
+                        <w:numFmt w:val="decimal"/>
+                        <w:pStyle w:val="Heading8"/>
+                        <w:lvlText w:val="%1.%2.%3.%4.%5.%6.%7.%8"/>
+                        <w:lvlJc w:val="left"/>
+                        <w:pPr>
+                            <w:ind w:left="1944" w:hanging="1944"/>
+                        </w:pPr>
+                        <w:rPr>
+                            <w:rFonts w:hint="default"/>
+                        </w:rPr>
+                    </w:lvl>
+                    <w:lvl w:ilvl="8">
+                        <w:start w:val="1"/>
+                        <w:numFmt w:val="decimal"/>
+                        <w:pStyle w:val="Heading9"/>
+                        <w:lvlText w:val="%1.%2.%3.%4.%5.%6.%7.%8.%9"/>
+                        <w:lvlJc w:val="left"/>
+                        <w:pPr>
+                            <w:ind w:left="2160" w:hanging="2160"/>
+                        </w:pPr>
+                        <w:rPr>
+                            <w:rFonts w:hint="default"/>
+                        </w:rPr>
+                    </w:lvl>
+                </w:abstractNum>
+
+
+                <!-- unordered lists -->
+		<xsl:call-template name="defineUnorderedLists"/>
+
+                <!-- ordered lists -->
+		<xsl:call-template name="defineOrderedLists"/>
+
+
+                <!-- for sections in Annex -->
+                <w:abstractNum w:abstractNumId="4">
+                    <w:multiLevelType w:val="multilevel"/>
+                    <w:lvl w:ilvl="0">
+                        <w:start w:val="1"/>
+                        <w:numFmt w:val="upperLetter"/>
+                        <w:pStyle w:val="ANNEX"/>
+                        <w:suff w:val="nothing"/>
+                        <w:lvlText w:val="Annex %1: "/>
+                        <w:lvlJc w:val="left"/>
+                        <w:pPr>
+                            <w:ind w:left="0" w:firstLine="0"/>
+                        </w:pPr>
+                        <w:rPr>
+                            <w:rFonts w:hint="default"/>
+                        </w:rPr>
+                    </w:lvl>
+                    <w:lvl w:ilvl="1">
+                        <w:start w:val="1"/>
+                        <w:numFmt w:val="decimal"/>
+                        <w:pStyle w:val="a2"/>
+                        <w:lvlText w:val="%1.%2"/>
+                        <w:lvlJc w:val="left"/>
+                        <w:pPr>
+                            <w:ind w:left="720" w:hanging="720"/>
+                        </w:pPr>
+                        <w:rPr>
+                            <w:rFonts w:hint="default"/>
+                        </w:rPr>
+                    </w:lvl>
+                    <w:lvl w:ilvl="2">
+                        <w:start w:val="1"/>
+                        <w:numFmt w:val="decimal"/>
+                        <w:pStyle w:val="a3"/>
+                        <w:lvlText w:val="%1.%2.%3"/>
+                        <w:lvlJc w:val="left"/>
+                        <w:pPr>
+                            <w:ind w:left="936" w:hanging="936"/>
+                        </w:pPr>
+                        <w:rPr>
+                            <w:rFonts w:hint="default"/>
+                        </w:rPr>
+                    </w:lvl>
+                    <w:lvl w:ilvl="3">
+                        <w:start w:val="1"/>
+                        <w:numFmt w:val="decimal"/>
+                        <w:pStyle w:val="a4"/>
+                        <w:lvlText w:val="%1.%2.%3.%4"/>
+                        <w:lvlJc w:val="left"/>
+                        <w:pPr>
+                            <w:ind w:left="1152" w:hanging="1152"/>
+                        </w:pPr>
+                        <w:rPr>
+                            <w:rFonts w:hint="default"/>
+                        </w:rPr>
+                    </w:lvl>
+                    <w:lvl w:ilvl="4">
+                        <w:start w:val="1"/>
+                        <w:numFmt w:val="decimal"/>
+                        <w:pStyle w:val="a5"/>
+                        <w:lvlText w:val="%1.%2.%3.%4.%5"/>
+                        <w:lvlJc w:val="left"/>
+                        <w:pPr>
+                            <w:ind w:left="1368" w:hanging="1368"/>
+                        </w:pPr>
+                        <w:rPr>
+                            <w:rFonts w:hint="default"/>
+                        </w:rPr>
+                    </w:lvl>
+                    <w:lvl w:ilvl="5">
+                        <w:start w:val="1"/>
+                        <w:numFmt w:val="decimal"/>
+                        <w:pStyle w:val="a6"/>
+                        <w:lvlText w:val="%1.%2.%3.%4.%5.%6"/>
+                        <w:lvlJc w:val="left"/>
+                        <w:pPr>
+                            <w:ind w:left="1584" w:hanging="1584"/>
+                        </w:pPr>
+                        <w:rPr>
+                            <w:rFonts w:hint="default"/>
+                        </w:rPr>
+                    </w:lvl>
+                    <w:lvl w:ilvl="6">
+                        <w:start w:val="1"/>
+                        <w:numFmt w:val="decimal"/>
+                        <w:lvlText w:val="%1.%2.%3.%4.%5.%6.%7"/>
+                        <w:lvlJc w:val="left"/>
+                        <w:pPr>
+                            <w:ind w:left="1800" w:hanging="1800"/>
+                        </w:pPr>
+                        <w:rPr>
+                            <w:rFonts w:hint="default"/>
+                        </w:rPr>
+                    </w:lvl>
+                    <w:lvl w:ilvl="7">
+                        <w:start w:val="1"/>
+                        <w:numFmt w:val="decimal"/>
+                        <w:lvlText w:val="%1.%2.%3.%4.%5.%6.%7.%8"/>
+                        <w:lvlJc w:val="left"/>
+                        <w:pPr>
+                            <w:ind w:left="2016" w:hanging="2016"/>
+                        </w:pPr>
+                        <w:rPr>
+                            <w:rFonts w:hint="default"/>
+                        </w:rPr>
+                    </w:lvl>
+                    <w:lvl w:ilvl="8">
+                        <w:start w:val="1"/>
+                        <w:numFmt w:val="decimal"/>
+                        <w:lvlText w:val="%1.%2.%3.%4.%5.%6.%7.%8.%9"/>
+                        <w:lvlJc w:val="left"/>
+                        <w:pPr>
+                            <w:ind w:left="2232" w:hanging="2232"/>
+                        </w:pPr>
+                        <w:rPr>
+                            <w:rFonts w:hint="default"/>
+                        </w:rPr>
+                    </w:lvl>
+                </w:abstractNum>
+
+                <!-- for tables -->
+                <w:abstractNum w:abstractNumId="5">
+                    <w:multiLevelType w:val="hybridMultilevel"/>
+                    <w:lvl w:ilvl="0">
+                        <w:start w:val="1"/>
+                        <w:numFmt w:val="decimal"/>
+                        <w:pStyle w:val="Tabletitle"/>
+                        <w:suff w:val="space"/>
+                        <w:lvlText w:val="Table %1"/>
+                        <w:lvlJc w:val="left"/>
+                        <w:pPr>
+                            <w:ind w:left="720" w:hanging="360"/>
+                        </w:pPr>
+                        <w:rPr>
+                            <w:rFonts w:hint="default"/>
+                        </w:rPr>
+                    </w:lvl>
+                    <w:lvl w:ilvl="1">
+                        <w:start w:val="1"/>
+                        <w:numFmt w:val="lowerLetter"/>
+                        <w:lvlText w:val="%2."/>
+                        <w:lvlJc w:val="left"/>
+                        <w:pPr>
+                            <w:ind w:left="1440" w:hanging="360"/>
+                        </w:pPr>
+                    </w:lvl>
+                    <w:lvl w:ilvl="2">
+                        <w:start w:val="1"/>
+                        <w:numFmt w:val="lowerRoman"/>
+                        <w:lvlText w:val="%3."/>
+                        <w:lvlJc w:val="right"/>
+                        <w:pPr>
+                            <w:ind w:left="2160" w:hanging="180"/>
+                        </w:pPr>
+                    </w:lvl>
+                    <w:lvl w:ilvl="3">
+                        <w:start w:val="1"/>
+                        <w:numFmt w:val="decimal"/>
+                        <w:lvlText w:val="%4."/>
+                        <w:lvlJc w:val="left"/>
+                        <w:pPr>
+                            <w:ind w:left="2880" w:hanging="360"/>
+                        </w:pPr>
+                    </w:lvl>
+                    <w:lvl w:ilvl="4">
+                        <w:start w:val="1"/>
+                        <w:numFmt w:val="lowerLetter"/>
+                        <w:lvlText w:val="%5."/>
+                        <w:lvlJc w:val="left"/>
+                        <w:pPr>
+                            <w:ind w:left="3600" w:hanging="360"/>
+                        </w:pPr>
+                    </w:lvl>
+                    <w:lvl w:ilvl="5">
+                        <w:start w:val="1"/>
+                        <w:numFmt w:val="lowerRoman"/>
+                        <w:lvlText w:val="%6."/>
+                        <w:lvlJc w:val="right"/>
+                        <w:pPr>
+                            <w:ind w:left="4320" w:hanging="180"/>
+                        </w:pPr>
+                    </w:lvl>
+                    <w:lvl w:ilvl="6">
+                        <w:start w:val="1"/>
+                        <w:numFmt w:val="decimal"/>
+                        <w:lvlText w:val="%7."/>
+                        <w:lvlJc w:val="left"/>
+                        <w:pPr>
+                            <w:ind w:left="5040" w:hanging="360"/>
+                        </w:pPr>
+                    </w:lvl>
+                    <w:lvl w:ilvl="7">
+                        <w:start w:val="1"/>
+                        <w:numFmt w:val="lowerLetter"/>
+                        <w:lvlText w:val="%8."/>
+                        <w:lvlJc w:val="left"/>
+                        <w:pPr>
+                            <w:ind w:left="5760" w:hanging="360"/>
+                        </w:pPr>
+                    </w:lvl>
+                    <w:lvl w:ilvl="8">
+                        <w:start w:val="1"/>
+                        <w:numFmt w:val="lowerRoman"/>
+                        <w:lvlText w:val="%9."/>
+                        <w:lvlJc w:val="right"/>
+                        <w:pPr>
+                            <w:ind w:left="6480" w:hanging="180"/>
+                        </w:pPr>
+                    </w:lvl>
+                </w:abstractNum>
+
+                <!-- for bibliography -->
+                <w:abstractNum w:abstractNumId="6">
+                    <w:multiLevelType w:val="hybridMultilevel"/>
+                    <w:lvl w:ilvl="0">
+                        <w:start w:val="1"/>
+                        <w:numFmt w:val="decimal"/>
+                        <w:pStyle w:val="Bibliography"/>
+                        <w:lvlText w:val="[%1]"/>
+                        <w:lvlJc w:val="left"/>
+                        <w:pPr>
+                            <w:ind w:left="1080" w:hanging="1080"/>
+                        </w:pPr>
+                        <w:rPr>
+                            <w:rFonts w:hint="default"/>
+                        </w:rPr>
+                    </w:lvl>
+                    <w:lvl w:ilvl="1">
+                        <w:start w:val="1"/>
+                        <w:numFmt w:val="lowerLetter"/>
+                        <w:lvlText w:val="%2."/>
+                        <w:lvlJc w:val="left"/>
+                        <w:pPr>
+                            <w:ind w:left="1440" w:hanging="360"/>
+                        </w:pPr>
+                    </w:lvl>
+                    <w:lvl w:ilvl="2">
+                        <w:start w:val="1"/>
+                        <w:numFmt w:val="lowerRoman"/>
+                        <w:lvlText w:val="%3."/>
+                        <w:lvlJc w:val="right"/>
+                        <w:pPr>
+                            <w:ind w:left="2160" w:hanging="180"/>
+                        </w:pPr>
+                    </w:lvl>
+                    <w:lvl w:ilvl="3">
+                        <w:start w:val="1"/>
+                        <w:numFmt w:val="decimal"/>
+                        <w:lvlText w:val="%4."/>
+                        <w:lvlJc w:val="left"/>
+                        <w:pPr>
+                            <w:ind w:left="2880" w:hanging="360"/>
+                        </w:pPr>
+                    </w:lvl>
+                    <w:lvl w:ilvl="4">
+                        <w:start w:val="1"/>
+                        <w:numFmt w:val="lowerLetter"/>
+                        <w:lvlText w:val="%5."/>
+                        <w:lvlJc w:val="left"/>
+                        <w:pPr>
+                            <w:ind w:left="3600" w:hanging="360"/>
+                        </w:pPr>
+                    </w:lvl>
+                    <w:lvl w:ilvl="5">
+                        <w:start w:val="1"/>
+                        <w:numFmt w:val="lowerRoman"/>
+                        <w:lvlText w:val="%6."/>
+                        <w:lvlJc w:val="right"/>
+                        <w:pPr>
+                            <w:ind w:left="4320" w:hanging="180"/>
+                        </w:pPr>
+                    </w:lvl>
+                    <w:lvl w:ilvl="6">
+                        <w:start w:val="1"/>
+                        <w:numFmt w:val="decimal"/>
+                        <w:lvlText w:val="%7."/>
+                        <w:lvlJc w:val="left"/>
+                        <w:pPr>
+                            <w:ind w:left="5040" w:hanging="360"/>
+                        </w:pPr>
+                    </w:lvl>
+                    <w:lvl w:ilvl="7">
+                        <w:start w:val="1"/>
+                        <w:numFmt w:val="lowerLetter"/>
+                        <w:lvlText w:val="%8."/>
+                        <w:lvlJc w:val="left"/>
+                        <w:pPr>
+                            <w:ind w:left="5760" w:hanging="360"/>
+                        </w:pPr>
+                    </w:lvl>
+                    <w:lvl w:ilvl="8">
+                        <w:start w:val="1"/>
+                        <w:numFmt w:val="lowerRoman"/>
+                        <w:lvlText w:val="%9."/>
+                        <w:lvlJc w:val="right"/>
+                        <w:pPr>
+                            <w:ind w:left="6480" w:hanging="180"/>
+                        </w:pPr>
+                    </w:lvl>
+                </w:abstractNum>
+
+                <!-- for figures -->
+                <w:abstractNum w:abstractNumId="7">
+                    <w:multiLevelType w:val="hybridMultilevel"/>
+                    <w:lvl w:ilvl="0">
+                        <w:start w:val="1"/>
+                        <w:numFmt w:val="decimal"/>
+                        <w:pStyle w:val="Figuretitle"/>
+                        <w:suff w:val="space"/>
+                        <w:lvlText w:val="Figure %1"/>
+                        <w:lvlJc w:val="left"/>
+                        <w:pPr>
+                            <w:ind w:left="0" w:firstLine="0"/>
+                        </w:pPr>
+                        <w:rPr>
+                            <w:rFonts w:hint="default"/>
+                        </w:rPr>
+                    </w:lvl>
+                    <w:lvl w:ilvl="1">
+                        <w:start w:val="1"/>
+                        <w:numFmt w:val="lowerLetter"/>
+                        <w:lvlText w:val="%2."/>
+                        <w:lvlJc w:val="left"/>
+                        <w:pPr>
+                            <w:ind w:left="1440" w:hanging="360"/>
+                        </w:pPr>
+                    </w:lvl>
+                    <w:lvl w:ilvl="2">
+                        <w:start w:val="1"/>
+                        <w:numFmt w:val="lowerRoman"/>
+                        <w:lvlText w:val="%3."/>
+                        <w:lvlJc w:val="right"/>
+                        <w:pPr>
+                            <w:ind w:left="2160" w:hanging="180"/>
+                        </w:pPr>
+                    </w:lvl>
+                    <w:lvl w:ilvl="3">
+                        <w:start w:val="1"/>
+                        <w:numFmt w:val="decimal"/>
+                        <w:lvlText w:val="%4."/>
+                        <w:lvlJc w:val="left"/>
+                        <w:pPr>
+                            <w:ind w:left="2880" w:hanging="360"/>
+                        </w:pPr>
+                    </w:lvl>
+                    <w:lvl w:ilvl="4">
+                        <w:start w:val="1"/>
+                        <w:numFmt w:val="lowerLetter"/>
+                        <w:lvlText w:val="%5."/>
+                        <w:lvlJc w:val="left"/>
+                        <w:pPr>
+                            <w:ind w:left="3600" w:hanging="360"/>
+                        </w:pPr>
+                    </w:lvl>
+                    <w:lvl w:ilvl="5">
+                        <w:start w:val="1"/>
+                        <w:numFmt w:val="lowerRoman"/>
+                        <w:lvlText w:val="%6."/>
+                        <w:lvlJc w:val="right"/>
+                        <w:pPr>
+                            <w:ind w:left="4320" w:hanging="180"/>
+                        </w:pPr>
+                    </w:lvl>
+                    <w:lvl w:ilvl="6">
+                        <w:start w:val="1"/>
+                        <w:numFmt w:val="decimal"/>
+                        <w:lvlText w:val="%7."/>
+                        <w:lvlJc w:val="left"/>
+                        <w:pPr>
+                            <w:ind w:left="5040" w:hanging="360"/>
+                        </w:pPr>
+                    </w:lvl>
+                    <w:lvl w:ilvl="7">
+                        <w:start w:val="1"/>
+                        <w:numFmt w:val="lowerLetter"/>
+                        <w:lvlText w:val="%8."/>
+                        <w:lvlJc w:val="left"/>
+                        <w:pPr>
+                            <w:ind w:left="5760" w:hanging="360"/>
+                        </w:pPr>
+                    </w:lvl>
+                    <w:lvl w:ilvl="8">
+                        <w:start w:val="1"/>
+                        <w:numFmt w:val="lowerRoman"/>
+                        <w:lvlText w:val="%9."/>
+                        <w:lvlJc w:val="right"/>
+                        <w:pPr>
+                            <w:ind w:left="6480" w:hanging="180"/>
+                        </w:pPr>
+                    </w:lvl>
+                </w:abstractNum>
+
+                <!-- for headlines -->
+                <w:num w:numId="1">
+                    <w:abstractNumId w:val="1"/>
+                </w:num>
+
+                <!-- unordered lists -->
+                <w:num w:numId="2">
+                    <w:abstractNumId w:val="2"/>
+                </w:num>
+
+                <!-- for annex sections -->
+                <w:num w:numId="3">
+                    <w:abstractNumId w:val="4"/>
+                </w:num>
+
+                <!-- for tables -->
+                <w:num w:numId="5">
+                    <w:abstractNumId w:val="5"/>
+                </w:num>
+
+                <!-- for bibliography -->
+                <w:num w:numId="6">
+                    <w:abstractNumId w:val="6"/>
+                </w:num>
+
+                <!-- for figures -->
+                <w:num w:numId="7">
+                    <w:abstractNumId w:val="7"/>
+                </w:num>
+
+                <!-- for the ordered lists style -->
+                <w:num w:numId="8">
+                    <w:abstractNumId w:val="3"/>
+                    <w:lvlOverride w:ilvl="0">
+                        <w:startOverride w:val="1"/>
+                    </w:lvlOverride>
+                    <w:lvlOverride w:ilvl="1">
+                        <w:startOverride w:val="1"/>
+                    </w:lvlOverride>
+                    <w:lvlOverride w:ilvl="2">
+                        <w:startOverride w:val="1"/>
+                    </w:lvlOverride>
+                    <w:lvlOverride w:ilvl="3">
+                        <w:startOverride w:val="1"/>
+                    </w:lvlOverride>
+                    <w:lvlOverride w:ilvl="4">
+                        <w:startOverride w:val="1"/>
+                    </w:lvlOverride>
+                    <w:lvlOverride w:ilvl="5">
+                        <w:startOverride w:val="1"/>
+                    </w:lvlOverride>
+                    <w:lvlOverride w:ilvl="6">
+                        <w:startOverride w:val="1"/>
+                    </w:lvlOverride>
+                    <w:lvlOverride w:ilvl="7">
+                        <w:startOverride w:val="1"/>
+                    </w:lvlOverride>
+                    <w:lvlOverride w:ilvl="8">
+                        <w:startOverride w:val="1"/>
+                    </w:lvlOverride>
+                </w:num>
+
+                <!-- for the unordered lists style -->
+                <w:num w:numId="9">
+                    <w:abstractNumId w:val="2"/>
+                </w:num>
+
+
+                <!-- ordered lists -->
+                <!-- 
+                    We have to generate an instance for each list present in the
+                    document.
+                -->
+                <xsl:for-each select="key('OL',1)">
+                    <w:num>
+                        <xsl:attribute name="w:numId">
+                            <xsl:value-of select="position()+100"/>
+                        </xsl:attribute>
+                        <w:abstractNumId w:val="3"/>
+                        <w:lvlOverride w:ilvl="0">
+                            <w:startOverride w:val="1"/>
+                        </w:lvlOverride>
+                        <w:lvlOverride w:ilvl="1">
+                            <w:startOverride w:val="1"/>
+                        </w:lvlOverride>
+                        <w:lvlOverride w:ilvl="2">
+                            <w:startOverride w:val="1"/>
+                        </w:lvlOverride>
+                        <w:lvlOverride w:ilvl="3">
+                            <w:startOverride w:val="1"/>
+                        </w:lvlOverride>
+                        <w:lvlOverride w:ilvl="4">
+                            <w:startOverride w:val="1"/>
+                        </w:lvlOverride>
+                        <w:lvlOverride w:ilvl="5">
+                            <w:startOverride w:val="1"/>
+                        </w:lvlOverride>
+                        <w:lvlOverride w:ilvl="6">
+                            <w:startOverride w:val="1"/>
+                        </w:lvlOverride>
+                        <w:lvlOverride w:ilvl="7">
+                            <w:startOverride w:val="1"/>
+                        </w:lvlOverride>
+                        <w:lvlOverride w:ilvl="8">
+                            <w:startOverride w:val="1"/>
+                        </w:lvlOverride>
+                    </w:num>
+                </xsl:for-each>
+
+
+            </w:numbering>
+        </xsl:result-document>
+    </xsl:template>
+    
+    
+    
+    
+    <xsl:template name="defineUnorderedLists">
+        <w:abstractNum w:abstractNumId="2">
+            <w:multiLevelType w:val="multilevel"/>
+            <w:lvl w:ilvl="0">
+                <w:start w:val="1"/>
+                <w:numFmt w:val="bullet"/>
+                <w:pStyle w:val="ListBullet"/>
+                <w:lvlText w:val="{$bulletOne}"/>
+                <w:lvlJc w:val="left"/>
+                <w:pPr>
+                    <w:ind w:left="360" w:hanging="0"/>
+                </w:pPr>
+                <w:rPr>
+                    <w:rFonts w:ascii="Symbol" w:hAnsi="Symbol" w:hint="default"/>
+                    <w:color w:val="auto"/>
+                </w:rPr>
+            </w:lvl>
+            <w:lvl w:ilvl="1">
+                <w:start w:val="1"/>
+                <w:numFmt w:val="bullet"/>
+                <w:pStyle w:val="ListBullet"/>
+                <w:lvlText w:val="{$bulletTwo}"/>
+                <w:lvlJc w:val="left"/>
+                <w:pPr>
+                    <w:ind w:left="720" w:hanging="360"/>
+                </w:pPr>
+                <w:rPr>
+                    <w:rFonts w:ascii="Symbol" w:hAnsi="Symbol" w:hint="default"/>
+                    <w:color w:val="auto"/>
+                </w:rPr>
+            </w:lvl>
+            <w:lvl w:ilvl="2">
+                <w:start w:val="1"/>
+                <w:numFmt w:val="bullet"/>
+                <w:pStyle w:val="ListBullet"/>
+                <w:lvlText w:val="{$bulletThree}"/>
+                <w:lvlJc w:val="left"/>
+                <w:pPr>
+                    <w:ind w:left="1080" w:hanging="360"/>
+                </w:pPr>
+                <w:rPr>
+                    <w:rFonts w:ascii="Symbol" w:hAnsi="Symbol" w:hint="default"/>
+                    <w:color w:val="auto"/>
+                </w:rPr>
+            </w:lvl>
+            <w:lvl w:ilvl="3">
+                <w:start w:val="1"/>
+                <w:numFmt w:val="bullet"/>
+                <w:pStyle w:val="ListBullet"/>
+                <w:lvlText w:val="{$bulletFour}"/>
+                <w:lvlJc w:val="left"/>
+                <w:pPr>
+                    <w:ind w:left="1440" w:hanging="360"/>
+                </w:pPr>
+                <w:rPr>
+                    <w:rFonts w:ascii="Symbol" w:hAnsi="Symbol" w:hint="default"/>
+                    <w:color w:val="auto"/>
+                </w:rPr>
+            </w:lvl>
+            <w:lvl w:ilvl="4">
+                <w:start w:val="1"/>
+                <w:numFmt w:val="bullet"/>
+                <w:pStyle w:val="ListBullet"/>
+                <w:lvlText w:val="{$bulletFive}"/>
+                <w:lvlJc w:val="left"/>
+                <w:pPr>
+                    <w:ind w:left="1800" w:hanging="360"/>
+                </w:pPr>
+                <w:rPr>
+                    <w:rFonts w:ascii="Symbol" w:hAnsi="Symbol" w:hint="default"/>
+                    <w:color w:val="auto"/>
+                </w:rPr>
+            </w:lvl>
+            <w:lvl w:ilvl="5">
+                <w:start w:val="1"/>
+                <w:numFmt w:val="bullet"/>
+                <w:pStyle w:val="ListBullet"/>
+                <w:lvlText w:val="{$bulletSix}"/>
+                <w:lvlJc w:val="left"/>
+                <w:pPr>
+                    <w:ind w:left="2160" w:hanging="360"/>
+                </w:pPr>
+                <w:rPr>
+                    <w:rFonts w:ascii="Symbol" w:hAnsi="Symbol" w:hint="default"/>
+                    <w:color w:val="auto"/>
+                </w:rPr>
+            </w:lvl>
+            <w:lvl w:ilvl="6">
+                <w:start w:val="1"/>
+                <w:numFmt w:val="bullet"/>
+                <w:pStyle w:val="ListBullet"/>
+                <w:lvlText w:val="{$bulletSeven}"/>
+                <w:lvlJc w:val="left"/>
+                <w:pPr>
+                    <w:ind w:left="2520" w:hanging="360"/>
+                </w:pPr>
+                <w:rPr>
+                    <w:rFonts w:ascii="Symbol" w:hAnsi="Symbol" w:hint="default"/>
+                    <w:color w:val="auto"/>
+                </w:rPr>
+            </w:lvl>
+            <w:lvl w:ilvl="7">
+                <w:start w:val="1"/>
+                <w:numFmt w:val="bullet"/>
+                <w:pStyle w:val="ListBullet"/>
+                <w:lvlText w:val="{$bulletEight}"/>
+                <w:lvlJc w:val="left"/>
+                <w:pPr>
+                    <w:ind w:left="2880" w:hanging="360"/>
+                </w:pPr>
+                <w:rPr>
+                    <w:rFonts w:ascii="Symbol" w:hAnsi="Symbol" w:hint="default"/>
+                    <w:color w:val="auto"/>
+                </w:rPr>
+            </w:lvl>
+            
+        </w:abstractNum>
+    </xsl:template>
+    
+    <!-- ordered lists -->
+    <xsl:template name="defineOrderedLists">
+        <w:abstractNum w:abstractNumId="3">
+            <w:multiLevelType w:val="multilevel"/>
+            <w:lvl w:ilvl="0">
+                <w:start w:val="1"/>
+                <w:numFmt w:val="lowerLetter"/>
+                <w:pStyle w:val="ListNumber"/>
+                <w:lvlText w:val="%1)"/>
+                <w:lvlJc w:val="left"/>
+                <w:pPr>
+                    <w:ind w:left="360" w:hanging="360"/>
+                </w:pPr>
+                <w:rPr>
+                    <w:rFonts w:hint="default"/>
+                </w:rPr>
+            </w:lvl>
+            <w:lvl w:ilvl="1">
+                <w:start w:val="1"/>
+                <w:numFmt w:val="decimal"/>
+                <w:pStyle w:val="ListNumber2"/>
+                <w:lvlText w:val="%2)"/>
+                <w:lvlJc w:val="left"/>
+                <w:pPr>
+                    <w:ind w:left="720" w:hanging="360"/>
+                </w:pPr>
+                <w:rPr>
+                    <w:rFonts w:hint="default"/>
+                </w:rPr>
+            </w:lvl>
+            <w:lvl w:ilvl="2">
+                <w:start w:val="1"/>
+                <w:numFmt w:val="lowerRoman"/>
+                <w:pStyle w:val="ListNumber3"/>
+                <w:lvlText w:val="%3)"/>
+                <w:lvlJc w:val="left"/>
+                <w:pPr>
+                    <w:ind w:left="1080" w:hanging="360"/>
+                </w:pPr>
+                <w:rPr>
+                    <w:rFonts w:hint="default"/>
+                </w:rPr>
+            </w:lvl>
+            <w:lvl w:ilvl="3">
+                <w:start w:val="1"/>
+                <w:numFmt w:val="upperRoman"/>
+                <w:pStyle w:val="ListNumber4"/>
+                <w:lvlText w:val="%4)"/>
+                <w:lvlJc w:val="left"/>
+                <w:pPr>
+                    <w:ind w:left="1440" w:hanging="360"/>
+                </w:pPr>
+                <w:rPr>
+                    <w:rFonts w:hint="default"/>
+                </w:rPr>
+            </w:lvl>
+            <w:lvl w:ilvl="4">
+                <w:start w:val="1"/>
+                <w:numFmt w:val="lowerLetter"/>
+                <w:lvlText w:val="(%5)"/>
+                <w:lvlJc w:val="left"/>
+                <w:pPr>
+                    <w:ind w:left="1800" w:hanging="360"/>
+                </w:pPr>
+                <w:rPr>
+                    <w:rFonts w:hint="default"/>
+                </w:rPr>
+            </w:lvl>
+            <w:lvl w:ilvl="5">
+                <w:start w:val="1"/>
+                <w:numFmt w:val="lowerRoman"/>
+                <w:lvlText w:val="(%6)"/>
+                <w:lvlJc w:val="left"/>
+                <w:pPr>
+                    <w:ind w:left="2160" w:hanging="360"/>
+                </w:pPr>
+                <w:rPr>
+                    <w:rFonts w:hint="default"/>
+                </w:rPr>
+            </w:lvl>
+            <w:lvl w:ilvl="6">
+                <w:start w:val="1"/>
+                <w:numFmt w:val="decimal"/>
+                <w:lvlText w:val="%7."/>
+                <w:lvlJc w:val="left"/>
+                <w:pPr>
+                    <w:ind w:left="2520" w:hanging="360"/>
+                </w:pPr>
+                <w:rPr>
+                    <w:rFonts w:hint="default"/>
+                </w:rPr>
+            </w:lvl>
+            <w:lvl w:ilvl="7">
+                <w:start w:val="1"/>
+                <w:numFmt w:val="lowerLetter"/>
+                <w:lvlText w:val="%8."/>
+                <w:lvlJc w:val="left"/>
+                <w:pPr>
+                    <w:ind w:left="2880" w:hanging="360"/>
+                </w:pPr>
+                <w:rPr>
+                    <w:rFonts w:hint="default"/>
+                </w:rPr>
+            </w:lvl>
+            <w:lvl w:ilvl="8">
+                <w:start w:val="1"/>
+                <w:numFmt w:val="lowerRoman"/>
+                <w:lvlText w:val="%9."/>
+                <w:lvlJc w:val="left"/>
+                <w:pPr>
+                    <w:ind w:left="3240" w:hanging="360"/>
+                </w:pPr>
+                <w:rPr>
+                    <w:rFonts w:hint="default"/>
+                </w:rPr>
+            </w:lvl>
+        </w:abstractNum>
+        
+    </xsl:template>
+    
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/docxfiles/numbering-definition.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/docxfiles/endnotes.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/docxfiles/endnotes.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/docxfiles/endnotes.xsl	(revision 258)
@@ -0,0 +1,138 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
+                xmlns:cals="http://www.oasis-open.org/specs/tm9901"
+                xmlns:contypes="http://schemas.openxmlformats.org/package/2006/content-types"
+                xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties"
+                xmlns:dc="http://purl.org/dc/elements/1.1/"
+                xmlns:dcmitype="http://purl.org/dc/dcmitype/"
+                xmlns:dcterms="http://purl.org/dc/terms/"
+                xmlns:html="http://www.w3.org/1999/xhtml"
+                xmlns:iso="http://www.iso.org/ns/1.0"
+                xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"
+                xmlns:mml="http://www.w3.org/1998/Math/MathML"
+                xmlns:o="urn:schemas-microsoft-com:office:office"
+                xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"
+                xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
+                xmlns:tbx="http://www.lisa.org/TBX-Specification.33.0.html"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teidocx="http://www.tei-c.org/ns/teidocx/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"
+                xmlns:v="urn:schemas-microsoft-com:vml"
+                xmlns:fn="http://www.w3.org/2005/02/xpath-functions"
+                xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006"
+                xmlns:w10="urn:schemas-microsoft-com:office:word"
+                xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
+                xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml"
+                xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"
+                
+                xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="2.0"
+                exclude-result-prefixes="cp ve o r m v wp w10 w wne mml tbx iso      tei a xs pic fn xsi dc dcterms dcmitype     contypes teidocx teix html cals">
+    
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet for making Word docx files from TEI XML </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: endnotes.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc>
+   </doc>
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+        Create the endnotes file
+    </desc>
+   </doc>
+    <xsl:template name="write-docxfile-endnotes-file">
+	     <xsl:if test="$debug='true'">
+	        <xsl:message>Writing out <xsl:value-of select="concat($wordDirectory,'/word/endnotes.xml')"/>
+         </xsl:message>
+	     </xsl:if>
+
+        <xsl:result-document href="{concat($wordDirectory,'/word/endnotes.xml')}">
+            <w:endnotes>
+                <w:endnote w:type="separator" w:id="-1">
+                    <w:p>
+                        <w:pPr>
+                            <w:spacing w:after="0" w:line="240" w:lineRule="auto"/>
+                        </w:pPr>
+                        <w:r>
+                            <w:separator/>
+                        </w:r>
+                    </w:p>
+                    <w:p/>
+                    <w:p/>
+                </w:endnote>
+                <w:endnote w:type="continuationSeparator" w:id="0">
+                    <w:p>
+                        <w:pPr>
+                            <w:spacing w:after="0" w:line="240" w:lineRule="auto"/>
+                        </w:pPr>
+                        <w:r>
+                            <w:continuationSeparator/>
+                        </w:r>
+                    </w:p>
+                    <w:p/>
+                    <w:p/>
+                </w:endnote>
+                
+                <xsl:for-each select="key('ENDNOTES',1)">
+                    <xsl:variable name="id" select="position()+1"/>
+                    <w:endnote w:id="{$id}">
+                        <xsl:call-template name="block-element">
+                            <xsl:with-param name="pPr">
+                                <w:pPr>
+                                    <w:pStyle w:val="EndnoteText"/>
+                                </w:pPr>
+                                <w:r>
+                                    <w:rPr>
+                                        <w:rStyle w:val="EndnoteReference"/>
+                                    </w:rPr>
+                                    <w:endnoteRef/>
+                                </w:r>
+				<w:r><w:t xml:space="preserve"> </w:t></w:r>
+			    </xsl:with-param>
+                        </xsl:call-template>
+                    </w:endnote>
+                </xsl:for-each>
+                
+            </w:endnotes>
+        </xsl:result-document>
+    </xsl:template>
+    
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/docxfiles/endnotes.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/docxfiles/footnotes.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/docxfiles/footnotes.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/docxfiles/footnotes.xsl	(revision 258)
@@ -0,0 +1,148 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
+                xmlns:cals="http://www.oasis-open.org/specs/tm9901"
+                xmlns:contypes="http://schemas.openxmlformats.org/package/2006/content-types"
+                xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties"
+                xmlns:dc="http://purl.org/dc/elements/1.1/"
+                xmlns:dcmitype="http://purl.org/dc/dcmitype/"
+                xmlns:dcterms="http://purl.org/dc/terms/"
+                xmlns:html="http://www.w3.org/1999/xhtml"
+                xmlns:iso="http://www.iso.org/ns/1.0"
+                xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"
+                xmlns:mml="http://www.w3.org/1998/Math/MathML"
+                xmlns:o="urn:schemas-microsoft-com:office:office"
+                xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"
+                xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
+                xmlns:tbx="http://www.lisa.org/TBX-Specification.33.0.html"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teidocx="http://www.tei-c.org/ns/teidocx/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"
+                xmlns:v="urn:schemas-microsoft-com:vml"
+                xmlns:fn="http://www.w3.org/2005/02/xpath-functions"
+                xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006"
+                xmlns:w10="urn:schemas-microsoft-com:office:word"
+                xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
+                xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml"
+                xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"
+                
+                xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="2.0"
+                exclude-result-prefixes="cp ve o r m v wp w10 w wne mml tbx iso      tei a xs pic fn xsi dc dcterms dcmitype     contypes teidocx teix html cals">
+    
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet for making Word docx files from TEI XML </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: footnotes.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc>
+   </doc>
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+        
+    </desc>
+   </doc>
+    <xsl:template name="write-docxfile-footnotes-file">
+      <xsl:if test="$debug='true'">
+	<xsl:message>Writing out <xsl:value-of select="concat($wordDirectory,'/word/footnotes.xml')"/>    </xsl:message>
+      </xsl:if>
+        <xsl:result-document href="{concat($wordDirectory,'/word/footnotes.xml')}">
+            <w:footnotes>
+                <w:footnote w:type="separator" w:id="-1">
+                    <w:p>
+                        <w:pPr>
+                            <w:spacing w:after="0" w:line="240" w:lineRule="auto"/>
+                        </w:pPr>
+                        <w:r>
+                            <w:separator/>
+                        </w:r>
+                    </w:p>
+                </w:footnote>
+                <w:footnote w:type="continuationSeparator" w:id="0">
+                    <w:p>
+                        <w:pPr>
+                            <w:spacing w:after="0" w:line="240" w:lineRule="auto"/>
+                        </w:pPr>
+                        <w:r>
+                            <w:continuationSeparator/>
+                        </w:r>
+                    </w:p>
+                    <w:p/>
+                    <w:p/>
+                </w:footnote>
+                
+                <xsl:for-each select="key('FOOTNOTES',1)">
+                    <xsl:variable name="id" select="position()+1"/>
+                    <w:footnote w:id="{$id}">
+                        <xsl:call-template name="block-element">
+                            <xsl:with-param name="pPr">
+                                <w:pPr>
+                                    <w:pStyle w:val="FootnoteText"/>
+                                </w:pPr>
+                                <w:r>
+                                    <w:rPr>
+                                        <w:rStyle w:val="FootnoteReference"/>
+                                    </w:rPr>
+                                    <w:footnoteRef/>
+                                </w:r>
+				<xsl:choose>
+				  <xsl:when test="ancestor::tei:bibl">
+				    <w:r>
+				      <w:rPr>
+					<w:rStyle w:val="FootnoteReference"/>
+				      </w:rPr>
+				      <w:t>)</w:t>
+				    </w:r>
+				  </xsl:when>
+				  <xsl:otherwise>
+				    <w:r>
+				      <w:t xml:space="preserve"> </w:t>
+				    </w:r>	
+				  </xsl:otherwise>
+				</xsl:choose>
+                            </xsl:with-param>
+                        </xsl:call-template>
+                    </w:footnote>
+                </xsl:for-each>
+            </w:footnotes>
+        </xsl:result-document>
+    </xsl:template>
+    
+    
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/docxfiles/footnotes.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/docxfiles/settings.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/docxfiles/settings.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/docxfiles/settings.xsl	(revision 258)
@@ -0,0 +1,138 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
+                xmlns:cals="http://www.oasis-open.org/specs/tm9901"
+                xmlns:contypes="http://schemas.openxmlformats.org/package/2006/content-types"
+                xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties"
+                xmlns:dc="http://purl.org/dc/elements/1.1/"
+                xmlns:dcmitype="http://purl.org/dc/dcmitype/"
+                xmlns:dcterms="http://purl.org/dc/terms/"
+                xmlns:html="http://www.w3.org/1999/xhtml"
+                xmlns:iso="http://www.iso.org/ns/1.0"
+                xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"
+                xmlns:mml="http://www.w3.org/1998/Math/MathML"
+                xmlns:o="urn:schemas-microsoft-com:office:office"
+                xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"
+                xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
+                xmlns:tbx="http://www.lisa.org/TBX-Specification.33.0.html"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teidocx="http://www.tei-c.org/ns/teidocx/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"
+                xmlns:v="urn:schemas-microsoft-com:vml"
+                xmlns:fn="http://www.w3.org/2005/02/xpath-functions"
+                xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006"
+                xmlns:w10="urn:schemas-microsoft-com:office:word"
+                xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
+                xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml"
+                xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"
+                
+                xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="2.0"
+                exclude-result-prefixes="cp ve o r m v wp w10 w wne mml tbx iso      tei a xs pic fn xsi dc dcterms dcmitype     contypes teidocx teix html cals">
+    
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet for making Word docx files from TEI XML </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: settings.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc>
+   </doc>
+    
+    
+    
+    
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+        write: word/settings.xml 
+    </desc>
+   </doc>
+    <xsl:template name="write-docxfile-settings">
+	     <xsl:if test="$debug='true'">
+	        <xsl:message>Writing out <xsl:value-of select="concat($wordDirectory,'/word/settings.xml')"/>
+         </xsl:message>
+	     </xsl:if>
+
+        <xsl:result-document href="{concat($wordDirectory,'/word/settings.xml')}" standalone="yes">
+            
+            <w:settings xmlns:sl="http://schemas.openxmlformats.org/schemaLibrary/2006/main">
+                <w:zoom w:percent="100"/>
+                <w:stylePaneSortMethod w:val="0000"/>
+                <w:defaultTabStop w:val="720"/>
+                <w:evenAndOddHeaders/>
+                <w:characterSpacingControl w:val="doNotCompress"/>
+                <w:footnotePr>
+                    <w:footnote w:id="-1"/>
+                    <w:footnote w:id="0"/>
+                </w:footnotePr>
+                <w:endnotePr>
+                    <w:endnote w:id="-1"/>
+                    <w:endnote w:id="0"/>
+                </w:endnotePr>
+                <w:compat/>
+                <m:mathPr>
+                    <m:mathFont m:val="Cambria Math"/>
+                    <m:brkBin m:val="before"/>
+                    <m:brkBinSub m:val="--"/>
+                    <m:smallFrac/>
+                    <m:dispDef/>
+                    <m:lMargin m:val="432"/>
+                    <m:rMargin m:val="0"/>
+                    <m:defJc m:val="left"/>
+                    <m:wrapIndent m:val="1440"/>
+                    <m:intLim m:val="subSup"/>
+                    <m:naryLim m:val="undOvr"/>
+                </m:mathPr>
+                <w:attachedSchema w:val="ActionsPane3"/>
+                <w:themeFontLang w:val="en-US"/>
+                <w:clrSchemeMapping w:bg1="light1" w:t1="dark1" w:bg2="light2" w:t2="dark2" w:accent1="accent1"
+                                w:accent2="accent2"
+                                w:accent3="accent3"
+                                w:accent4="accent4"
+                                w:accent5="accent5"
+                                w:accent6="accent6"
+                                w:hyperlink="hyperlink"
+                                w:followedHyperlink="followedHyperlink"/>
+                <w:decimalSymbol w:val="."/>
+                <w:listSeparator w:val=","/>
+            </w:settings>
+        </xsl:result-document>
+    </xsl:template>
+    
+    
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/docxfiles/settings.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/docxfiles/footers.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/docxfiles/footers.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/docxfiles/footers.xsl	(revision 258)
@@ -0,0 +1,110 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
+                xmlns:cals="http://www.oasis-open.org/specs/tm9901"
+                xmlns:contypes="http://schemas.openxmlformats.org/package/2006/content-types"
+                xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties"
+                xmlns:dc="http://purl.org/dc/elements/1.1/"
+                xmlns:dcmitype="http://purl.org/dc/dcmitype/"
+                xmlns:dcterms="http://purl.org/dc/terms/"
+                xmlns:html="http://www.w3.org/1999/xhtml"
+                xmlns:iso="http://www.iso.org/ns/1.0"
+                xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"
+                xmlns:mml="http://www.w3.org/1998/Math/MathML"
+                xmlns:o="urn:schemas-microsoft-com:office:office"
+                xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"
+                xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
+                xmlns:tbx="http://www.lisa.org/TBX-Specification.33.0.html"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teidocx="http://www.tei-c.org/ns/teidocx/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"
+                xmlns:v="urn:schemas-microsoft-com:vml"
+                xmlns:fn="http://www.w3.org/2005/02/xpath-functions"
+                xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006"
+                xmlns:w10="urn:schemas-microsoft-com:office:word"
+                xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
+                xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml"
+                xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"
+                
+                xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="2.0"
+                exclude-result-prefixes="cp ve o r m v wp w10 w wne mml tbx iso      tei a xs pic fn xsi dc dcterms dcmitype     contypes teidocx teix html cals">
+    
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet for making Word docx files from TEI XML </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: footers.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc>
+   </doc>
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+        
+    </desc>
+   </doc>
+    <xsl:template name="write-docxfile-footer-files">
+        <xsl:choose>
+            <xsl:when test="count(key('ALLFOOTERS',1))=0">
+                <xsl:for-each select="document($defaultHeaderFooterFile)">
+                    <xsl:call-template name="write-docxfile-specific-footer-file"/>
+                </xsl:for-each>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:call-template name="write-docxfile-specific-footer-file"/>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+    <xsl:template name="write-docxfile-specific-footer-file">
+        <xsl:for-each select="key('ALLFOOTERS',1)">
+	        <xsl:if test="$debug='true'">
+	           <xsl:message>Writing out <xsl:value-of select="concat($wordDirectory,'/word/footer',position(),'.xml')"/>
+            </xsl:message>
+	        </xsl:if>
+
+            <xsl:result-document href="{concat($wordDirectory,'/word/footer',position(),'.xml')}">
+                <w:ftr xmlns:mv="urn:schemas-microsoft-com:mac:vml"
+                   xmlns:mo="http://schemas.microsoft.com/office/mac/office/2008/main">
+                    <xsl:apply-templates select="."/>
+                </w:ftr>
+            </xsl:result-document>
+        </xsl:for-each>
+    </xsl:template>
+    
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/docxfiles/footers.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/docxfiles/application.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/docxfiles/application.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/docxfiles/application.xsl	(revision 258)
@@ -0,0 +1,195 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
+                xmlns:cals="http://www.oasis-open.org/specs/tm9901"
+                xmlns:contypes="http://schemas.openxmlformats.org/package/2006/content-types"
+                xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties"
+                xmlns:dc="http://purl.org/dc/elements/1.1/"
+                xmlns:dcmitype="http://purl.org/dc/dcmitype/"
+                xmlns:dcterms="http://purl.org/dc/terms/"
+                xmlns:html="http://www.w3.org/1999/xhtml"
+                xmlns:iso="http://www.iso.org/ns/1.0"
+                xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"
+                xmlns:mml="http://www.w3.org/1998/Math/MathML"
+                xmlns:o="urn:schemas-microsoft-com:office:office"
+                xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"
+                xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
+                xmlns:tbx="http://www.lisa.org/TBX-Specification.33.0.html"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teidocx="http://www.tei-c.org/ns/teidocx/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"
+                xmlns:v="urn:schemas-microsoft-com:vml"
+                xmlns:fn="http://www.w3.org/2005/02/xpath-functions"
+                xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006"
+                xmlns:w10="urn:schemas-microsoft-com:office:word"
+                xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
+                xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml"
+                xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"
+                
+                xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="2.0"
+                exclude-result-prefixes="cp ve o r m v wp w10 w wne mml tbx iso      tei a xs pic fn xsi dc dcterms dcmitype     contypes teidocx teix html cals">
+
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet for making Word docx files from TEI XML </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: application.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc>
+   </doc>
+
+    <xsl:template name="write-docxfile-docprops-core">
+        <xsl:variable name="now" select="tei:whatsTheDate()"/>
+
+        <xsl:variable name="coreFile">
+            <xsl:value-of select="$wordDirectory"/>
+            <xsl:text>/docProps/core.xml</xsl:text>
+        </xsl:variable>
+
+        <xsl:variable name="createdDate">
+            <xsl:choose>
+                <xsl:when test="doc-available($coreFile)">
+                    <xsl:for-each select="document($coreFile)">
+                        <xsl:value-of select="cp:coreProperties/dcterms:created"/>
+                    </xsl:for-each>
+                </xsl:when>
+                <xsl:otherwise>
+                    <xsl:value-of select="$now"/>
+                </xsl:otherwise>
+            </xsl:choose>
+        </xsl:variable>
+
+        <xsl:variable name="revision">
+            <xsl:choose>
+                <xsl:when test="doc-available($coreFile)">
+                    <xsl:for-each select="document($coreFile)">
+                        <xsl:value-of select="cp:coreProperties/cp:revision + 1"/>
+                    </xsl:for-each>
+                </xsl:when>
+                <xsl:otherwise>1</xsl:otherwise>
+            </xsl:choose>
+        </xsl:variable>
+
+        <!-- after opening core.xml, we cannot write back to it; so save
+            under new name -->
+	<xsl:if test="$debug='true'">
+	        <xsl:message>Writing out <xsl:value-of select="concat($wordDirectory,'/docProps/newcore.xml')"/>
+         </xsl:message>
+	     </xsl:if>
+
+        <xsl:result-document href="{concat($wordDirectory,'/docProps/newcore.xml')}" standalone="yes">
+            <cp:coreProperties>
+                <dc:title>
+		  <xsl:variable name="t">
+                    <xsl:call-template name="generateTitle"/>
+		  </xsl:variable>
+		  <xsl:value-of select="$t"/>
+                </dc:title>
+                <dc:creator>
+		  <xsl:variable name="a">
+                    <xsl:call-template name="generateAuthor"/>
+		  </xsl:variable>
+		  <xsl:value-of select="$a"/>
+                </dc:creator>
+                <cp:lastModifiedBy>TEI stylesheets</cp:lastModifiedBy>
+                <cp:revision>
+                    <xsl:value-of select="$revision"/>
+                </cp:revision>
+                <dcterms:created xsi:type="dcterms:W3CDTF">
+                    <xsl:value-of select="$createdDate"/>
+                </dcterms:created>
+                <dcterms:modified xsi:type="dcterms:W3CDTF">
+                    <xsl:value-of select="$now"/>
+                </dcterms:modified>
+            </cp:coreProperties>
+        </xsl:result-document>
+    </xsl:template>
+
+
+    <xsl:template name="write-docxfile-docprops-app">
+	     <xsl:if test="$debug='true'">
+	        <xsl:message>Writing out <xsl:value-of select="concat($wordDirectory,'/docProps/app.xml')"/>
+         </xsl:message>
+	     </xsl:if>
+
+        <xsl:result-document href="{concat($wordDirectory,'/docProps/app.xml')}" standalone="yes">
+            <Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties"
+                     xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes">
+                <Template>STD_3_0_0.dotx</Template>
+                <Application>TEIISO tei-docx.xsl</Application>
+                <DocSecurity>0</DocSecurity>
+                <SharedDoc>true</SharedDoc>
+                <AppVersion>1.0</AppVersion>
+            </Properties>
+        </xsl:result-document>
+    </xsl:template>
+
+    <!-- after opening custom.xml, we cannot write back to it; so save
+	 under new name -->
+    <xsl:template name="write-docxfile-docprops-custom">
+	     <xsl:if test="$debug='true'">
+	        <xsl:message>Writing out <xsl:value-of select="concat($wordDirectory,'/docProps/newcustom.xml')"/>    </xsl:message>
+	     </xsl:if>
+        <xsl:result-document href="{concat($wordDirectory,'/docProps/newcustom.xml')}" standalone="yes">
+            <Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/custom-properties"
+                     xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes">
+                <property pid="1001" name="TEI_toDOCX">
+                    <xsl:attribute name="fmtid">
+                        <xsl:text>{D5CDD505-2E9C-101B-9397-08002B2CF9AE}</xsl:text>
+                    </xsl:attribute>
+                    <vt:lpwstr>2.15.0</vt:lpwstr>
+                </property>
+                <xsl:for-each select="ancestor-or-self::tei:TEI/tei:teiHeader/tei:encodingDesc/tei:appInfo/tei:application">
+                    <xsl:if test="not(@ident='TEI_toDOCX')">
+                        <property name="{@ident}">
+                            <xsl:attribute name="pid">
+                                <xsl:value-of select="position()+1001"/>
+                            </xsl:attribute>
+                            <xsl:attribute name="fmtid">
+                                <xsl:text>{D5CDD505-2E9C-101B-9397-08002B2CF9AE}</xsl:text>
+                            </xsl:attribute>
+                            <vt:lpwstr>
+                                <xsl:value-of select="@version"/>
+                            </vt:lpwstr>
+                        </property>
+                    </xsl:if>
+                </xsl:for-each>
+            </Properties>
+        </xsl:result-document>
+    </xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/docxfiles/application.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/docxfiles/relationships.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/docxfiles/relationships.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/docxfiles/relationships.xsl	(revision 258)
@@ -0,0 +1,266 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
+                xmlns:cals="http://www.oasis-open.org/specs/tm9901"
+                xmlns:contypes="http://schemas.openxmlformats.org/package/2006/content-types"
+                xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties"
+                xmlns:dc="http://purl.org/dc/elements/1.1/"
+                xmlns:dcmitype="http://purl.org/dc/dcmitype/"
+                xmlns:dcterms="http://purl.org/dc/terms/"
+                xmlns:html="http://www.w3.org/1999/xhtml"
+                xmlns:iso="http://www.iso.org/ns/1.0"
+                xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"
+                xmlns:mml="http://www.w3.org/1998/Math/MathML"
+                xmlns:o="urn:schemas-microsoft-com:office:office"
+                xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"
+                xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
+                xmlns:tbx="http://www.lisa.org/TBX-Specification.33.0.html"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teidocx="http://www.tei-c.org/ns/teidocx/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"
+                xmlns:v="urn:schemas-microsoft-com:vml"
+                xmlns:fn="http://www.w3.org/2005/02/xpath-functions"
+                xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006"
+                xmlns:w10="urn:schemas-microsoft-com:office:word"
+                xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
+                xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml"
+                xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"
+                
+                xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="2.0"
+                exclude-result-prefixes="cp ve o r m v wp w10 w wne mml tbx iso      tei a xs pic fn xsi dc dcterms dcmitype     contypes teidocx teix html cals">
+    
+    
+  <!-- <xsl:key name="TARGETS" use="1" match="tei:ref[@target]|tei:ptr[@target]"/>-->
+    <xsl:key name="GRAPHICS" use="1" match="tei:graphic[@url]"/>
+    <xsl:key name="OLEOBJECTS" use="1" match="o:OLEObject"/>
+    <xsl:key name="IMAGEDATA" use="1" match="v:imagedata"/>
+
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet for making Word docx files from TEI XML </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: relationships.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc>
+   </doc>
+    
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+        Write _rels/.rels
+    </desc>
+   </doc>
+    <xsl:template name="write-docxfile-main-relationships">
+      <xsl:if test="$debug='true'">
+	<xsl:message>Writing out <xsl:value-of select="concat($wordDirectory,'/_rels/.rels')"/>
+	</xsl:message>
+      </xsl:if>
+
+        <xsl:result-document href="{concat($wordDirectory,'/_rels/.rels')}" standalone="yes">
+            <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
+                <Relationship Id="rId1"
+                          Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"
+                          Target="word/document.xml"/>
+                <Relationship Id="rId2"
+                          Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties"
+                          Target="docProps/core.xml"/>
+                <Relationship Id="rId3"
+                          Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties"
+                          Target="docProps/app.xml"/>
+                <Relationship Id="rId4"
+                          Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties"
+                          Target="docProps/custom.xml"/>
+            </Relationships>
+        </xsl:result-document>
+    </xsl:template>
+    
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+        Write word/_rels/document.xml.rels
+    </desc>
+   </doc>
+    <xsl:template name="write-docxfile-relationships">
+      <xsl:if test="$debug='true'">
+	<xsl:message>Writing out <xsl:value-of select="concat($wordDirectory,'/word/_rels/document.xml.rels')"/>
+	</xsl:message>
+      </xsl:if>
+
+        <xsl:result-document href="{concat($wordDirectory,'/word/_rels/document.xml.rels')}"
+                           standalone="yes">
+            <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
+                
+                <!-- Mandatory Relationships -->
+                <Relationship Id="rId3"
+                          Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering"
+                          Target="numbering.xml"/>
+                <Relationship Id="rId4"
+                          Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles"
+                          Target="styles.xml"/>
+                <Relationship Id="rId5"
+                          Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings"
+                          Target="settings.xml"/>
+                <Relationship Id="rId7"
+                          Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes"
+                          Target="footnotes.xml"/>
+                <Relationship Id="rId8"
+                          Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes"
+                          Target="endnotes.xml"/>
+                <Relationship Id="rId9"
+                          Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments"
+                          Target="comments.xml"/>
+                <!-- odd stuff -->
+                <Relationship Id="rId18"
+                          Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable"
+                          Target="fontTable.xml"/>
+                
+                <!-- Any raw blips left in? -->
+                
+                <xsl:for-each select="key('BLIP',1)">
+                    <xsl:choose>
+                        <xsl:when test="@r:embed">
+                            <Relationship Id="rId{position() + 200}"
+                                   Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image"
+                                   Target="{@r:embed}"/>
+                        </xsl:when>
+                        <xsl:otherwise>
+                            <Relationship Id="rId{position() + 200}"
+                                   Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image"
+                                   Target="{@r:link}"
+                                   TargetMode="External"/>
+                        </xsl:otherwise>
+                    </xsl:choose>
+                </xsl:for-each>
+
+		<!-- TEI images -->
+                
+                <xsl:for-each select="key('GRAPHICS',1)">
+
+		  <xsl:variable name="n">
+		    <xsl:number level="any"/>
+		  <!--
+		    <xsl:choose>
+		      <xsl:when test="@n">
+			<xsl:number level="any"/>
+		      </xsl:when>
+		      <xsl:otherwise>
+			<xsl:number level="any"/>
+		      </xsl:otherwise>
+		    </xsl:choose>
+		    -->
+		  </xsl:variable>
+                    <Relationship Id="rId{$n + 300}"
+                             Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image"
+                             Target="media/resource{$n}.{tokenize(@url,'\.')[last()]}"/>
+                </xsl:for-each>
+                
+                <!-- hyperlinks -->
+
+		<!-- 
+		<xsl:for-each select="key('TARGETS',1)">
+		  <xsl:if test="not(starts-with(@target,'#'))">
+                    <Relationship 
+			Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink"
+			Target="{@target}" 
+			TargetMode="External">
+		      <xsl:attribute name="Id">
+			<xsl:text>rId</xsl:text>
+			<xsl:variable name="n">
+			  <xsl:number level="any"/>
+			</xsl:variable>
+			<xsl:value-of select="$n + 3000"/>
+		      </xsl:attribute>
+		    </Relationship>
+		  </xsl:if>
+		</xsl:for-each>
+		-->
+
+                <!-- Formulas -->
+                <xsl:for-each select="key('IMAGEDATA',1)">
+                    <Relationship Id="rId{position() + 1000}"
+                             Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image"
+                             Target="{@r:id}"/>
+                </xsl:for-each>
+                
+                <xsl:for-each select="key('OLEOBJECTS',1)">
+                    <Relationship Id="rId{position() + 2000}"
+                             Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject"
+                             Target="{@r:id}"/>
+                </xsl:for-each>
+                
+                
+                
+                <!-- our headers and footers -->
+                <xsl:choose>
+                    <xsl:when test="count(key('ALLHEADERS',1))=0 and count(key('ALLFOOTERS',1))=0">
+                        <xsl:for-each select="document($defaultHeaderFooterFile)">
+                            <xsl:call-template name="writeRelationshipsHeadersAndFooters"/>
+                        </xsl:for-each>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <xsl:call-template name="writeRelationshipsHeadersAndFooters"/>
+                    </xsl:otherwise>
+                </xsl:choose>
+            </Relationships>
+        </xsl:result-document>
+        
+    </xsl:template>
+    
+    <xsl:template name="writeRelationshipsHeadersAndFooters">
+        <xsl:for-each select="key('ALLFOOTERS',1)">
+            <xsl:variable name="num">
+                <xsl:number/>
+            </xsl:variable>
+            <Relationship xmlns="http://schemas.openxmlformats.org/package/2006/relationships"
+                       Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer"
+                       Target="{concat('footer',position(),'.xml')}"
+                       Id="{concat('rId',100+$num)}"/>
+        </xsl:for-each>
+        
+        <!-- count all footers -->
+        <xsl:for-each select="key('ALLHEADERS',1)">
+            <xsl:variable name="num">
+                <xsl:number/>
+            </xsl:variable>
+            <Relationship xmlns="http://schemas.openxmlformats.org/package/2006/relationships"
+                       Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/header"
+                       Target="{concat('header',position(),'.xml')}"
+                       Id="{concat('rId',100+$num)}"/>
+        </xsl:for-each>
+    </xsl:template>
+    
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/docxfiles/relationships.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/docxfiles/comments.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/docxfiles/comments.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/docxfiles/comments.xsl	(revision 258)
@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
+                xmlns:cals="http://www.oasis-open.org/specs/tm9901"
+                xmlns:contypes="http://schemas.openxmlformats.org/package/2006/content-types"
+                xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties"
+                xmlns:dc="http://purl.org/dc/elements/1.1/"
+                xmlns:dcmitype="http://purl.org/dc/dcmitype/"
+                xmlns:dcterms="http://purl.org/dc/terms/"
+                xmlns:html="http://www.w3.org/1999/xhtml"
+                xmlns:iso="http://www.iso.org/ns/1.0"
+                xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"
+                xmlns:mml="http://www.w3.org/1998/Math/MathML"
+                xmlns:o="urn:schemas-microsoft-com:office:office"
+                xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"
+                xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
+                xmlns:tbx="http://www.lisa.org/TBX-Specification.33.0.html"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teidocx="http://www.tei-c.org/ns/teidocx/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"
+                xmlns:v="urn:schemas-microsoft-com:vml"
+                xmlns:fn="http://www.w3.org/2005/02/xpath-functions"
+                xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006"
+                xmlns:w10="urn:schemas-microsoft-com:office:word"
+                xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
+                xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml"
+                xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"
+                
+                xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="2.0"
+                exclude-result-prefixes="cp ve o r m v wp w10 w wne mml tbx iso     tei a xs pic fn xsi dc dcterms dcmitype     contypes teidocx teix html cals">
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet for making Word docx files from TEI XML </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: comments.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc>
+   </doc>
+    
+    <xsl:key name="COMMENTS" match="tei:note[@place='comment']"    use="1"/>
+
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+        Create the comments file
+    </desc>
+   </doc>
+    <!-- write out comments -->
+    <xsl:template name="write-docxfile-comments-file">
+
+      <xsl:if test="count(key('COMMENTS',1))&gt;0">
+	<xsl:if test="$debug='true'">
+	  <xsl:message>Writing out <xsl:value-of select="concat($wordDirectory,'word/comments.xml')"/>
+	  </xsl:message>
+	</xsl:if>
+	<xsl:result-document href="{concat($wordDirectory,'/word/comments.xml')}" standalone="yes">
+	  <w:comments>
+	    <xsl:for-each select="key('COMMENTS',1)">
+	      <w:comment w:id="{position()-1}" w:author="{@resp}">
+		<xsl:attribute name="w:date">
+		  <xsl:choose>
+		  <xsl:when test="tei:date/@when">
+		    <xsl:value-of select="tei:date/@when"/>
+		  </xsl:when>
+		  <xsl:otherwise>
+		    <xsl:value-of select="tei:whatsTheDate()"/>
+		  </xsl:otherwise>
+		  </xsl:choose>
+		</xsl:attribute>
+		<w:p>
+		  <w:pPr>
+		  <w:pStyle w:val="CommentText"/></w:pPr>
+		  <w:r>
+		    <w:rPr>
+		      <w:rStyle w:val="CommentReference"/>
+		    </w:rPr>
+		    <w:annotationRef/>
+		  </w:r>
+		  <xsl:apply-templates/>
+		</w:p>
+	      </w:comment>
+	    </xsl:for-each>
+	  </w:comments>
+	</xsl:result-document>
+      </xsl:if>
+    </xsl:template>
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/docxfiles/comments.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/graphics/graphics.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/graphics/graphics.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/graphics/graphics.xsl	(revision 258)
@@ -0,0 +1,464 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
+                xmlns:cals="http://www.oasis-open.org/specs/tm9901"
+                xmlns:contypes="http://schemas.openxmlformats.org/package/2006/content-types"
+                xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties"
+                xmlns:dc="http://purl.org/dc/elements/1.1/"
+                xmlns:dcmitype="http://purl.org/dc/dcmitype/"
+                xmlns:dcterms="http://purl.org/dc/terms/"
+                xmlns:html="http://www.w3.org/1999/xhtml"
+                xmlns:iso="http://www.iso.org/ns/1.0"
+                xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"
+                xmlns:mml="http://www.w3.org/1998/Math/MathML"
+                xmlns:o="urn:schemas-microsoft-com:office:office"
+                xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"
+                xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
+		xmlns:rel="http://schemas.openxmlformats.org/package/2006/relationships"
+                xmlns:tbx="http://www.lisa.org/TBX-Specification.33.0.html"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teidocx="http://www.tei-c.org/ns/teidocx/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"
+                xmlns:v="urn:schemas-microsoft-com:vml"
+                xmlns:fn="http://www.w3.org/2005/02/xpath-functions"
+                xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006"
+                xmlns:w10="urn:schemas-microsoft-com:office:word"
+                xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
+                xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml"
+                xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"
+                
+                xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="2.0"
+                exclude-result-prefixes="cp ve o r m v wp w10 w wne
+					 mml tbx iso  tei a xs
+					 pic fn xsi dc dcterms
+					 dcmitype rel contypes teidocx teix html cals">
+    
+
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet for making Word docx files from TEI XML
+         </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: graphics.xsl 9998 2012-01-02 18:27:15Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc>
+   </doc>
+
+
+    <xsl:key name="W" match="image" use="@url"/>
+    <xsl:key name="H" match="image" use="@url"/>
+
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+        Guides the identity transformation for graphics
+    </desc>
+   </doc>
+    <xsl:template match="a:blip" mode="iden">
+        <xsl:variable name="me" select="generate-id()"/>
+        <a:blip>
+            <xsl:variable name="rId">
+                <xsl:for-each select="key('BLIP',1)">
+                    <xsl:if test="generate-id()=$me">
+                        <xsl:value-of select="concat('rId', string(200 + position()))"/>
+                    </xsl:if>
+                </xsl:for-each>
+            </xsl:variable>
+            <xsl:choose>
+                <xsl:when test="@r:embed">
+                    <xsl:attribute name="r:embed" select="$rId"/>
+                </xsl:when>
+                <xsl:otherwise>
+                    <xsl:attribute name="r:link" select="$rId"/>
+                </xsl:otherwise>
+            </xsl:choose>
+        </a:blip>
+    </xsl:template>
+    
+    <!-- 
+        Handle figures 
+    -->
+    
+    <xsl:template match="tei:figure">
+      <xsl:choose>
+	<xsl:when test="@rend='inline' or @place='inline'">
+	  <xsl:apply-templates/>
+	</xsl:when>
+	<xsl:otherwise>
+	  <xsl:call-template name="block-element">
+            <xsl:with-param name="pPr">
+	      <w:pPr>
+		<w:spacing w:before="240"/>
+		<w:jc w:val="{$alignFigures}"/>
+	      </w:pPr>
+            </xsl:with-param>
+	  </xsl:call-template>
+	</xsl:otherwise>
+      </xsl:choose>
+    </xsl:template>
+
+    <xsl:template match="tei:figure/tei:figDesc"/>
+    
+    <xsl:template match="tei:figure/tei:head">
+      <xsl:variable name="number">
+	<xsl:number level="any"/>
+      </xsl:variable>
+      <xsl:choose>
+	<xsl:when test="../@xml:id">
+	    <!-- we want a bookmark for referencing this figure -->
+	  <xsl:call-template name="block-element">
+            <xsl:with-param name="style">
+	      <xsl:choose>
+		<xsl:when test="ancestor::tei:back">Figuretitleannex</xsl:when>
+		<xsl:otherwise>Figuretitle</xsl:otherwise>
+	      </xsl:choose>
+	    </xsl:with-param>
+	    <xsl:with-param name="bookmark-id">
+	      <xsl:value-of select="1000+$number"/>
+	    </xsl:with-param>
+	    <xsl:with-param name="bookmark-name">
+	      <xsl:text>_</xsl:text>
+	      <xsl:value-of select="../@xml:id"/>
+	    </xsl:with-param>
+	  </xsl:call-template>
+	</xsl:when>
+	<xsl:otherwise>  
+	  <xsl:call-template name="block-element">
+            <xsl:with-param name="style">
+	      <xsl:choose>
+		<xsl:when test="ancestor::tei:back">Figuretitleannex</xsl:when>
+		<xsl:otherwise>Figuretitle</xsl:otherwise>
+	      </xsl:choose>
+	    </xsl:with-param>
+	  </xsl:call-template>
+	</xsl:otherwise>
+      </xsl:choose>
+    </xsl:template>
+    
+    <xsl:template match="tei:graphic">
+        <!-- perform some tests on the graphic -->
+	<xsl:variable name="maxWidth" select="number(number($pageWidth)*100) cast as xs:integer"/>
+	<xsl:variable name="maxHeight"
+		      select="number(number($pageHeight)*100) cast as
+			      xs:integer"/>
+	<xsl:variable name="filename">
+	  <xsl:text>media/resource</xsl:text>
+	  <xsl:number level="any"/>
+	  <xsl:text>.</xsl:text>
+	  <xsl:value-of select="tokenize(@url,'\.')[last()]"/>
+	</xsl:variable>
+	<xsl:variable name="origheight">
+	  <xsl:choose>
+	    <xsl:when test="@teidocx:height">
+	      <xsl:value-of select="@teidocx:height"/>
+	    </xsl:when>
+	    <xsl:when test="doc-available(concat($wordDirectory,'/image-size-info.xml'))">
+		<xsl:for-each select="document(concat($wordDirectory,'/image-size-info.xml'))">
+		  <xsl:value-of select="(number(key('H',$filename)/height) div 72) * 9144"/>
+		</xsl:for-each>
+	    </xsl:when>
+	    <xsl:otherwise>0</xsl:otherwise>
+	  </xsl:choose>
+	</xsl:variable>
+
+	<xsl:variable name="origwidth">
+	  <xsl:choose>
+	    <xsl:when test="@teidocx:width">
+	      <xsl:value-of select="@teidocx:width"/>
+	    </xsl:when>
+	    <xsl:when test="doc-available(concat($wordDirectory,'/image-size-info.xml'))">
+		<xsl:for-each select="document(concat($wordDirectory,'/image-size-info.xml'))">
+		  <xsl:value-of select="(number(key('W',$filename)/width) div 72) * 9144"/>
+		</xsl:for-each>
+	    </xsl:when>
+	    <xsl:otherwise>0</xsl:otherwise>
+	  </xsl:choose>
+	</xsl:variable>
+	<xsl:choose>
+	  <xsl:when test="$filename and  ( ($origwidth &gt; 0 and $origheight &gt; 0) or (@width and @height))">
+            
+            <!--
+                
+                is there a number present?
+                
+                not(number(substring(@width,0,string-length(@width)-1))=NAN) and 
+                not(number(substring(@height,0,string-length(@height)-1))=NAN)">
+                
+            -->
+            
+            <xsl:variable name="Width">
+	      <!-- remembering that pageWidth is already divided by 100 -->
+                <xsl:choose>
+                    <xsl:when test="contains(@width,'%')">
+                        <xsl:value-of select="number($pageWidth * number(substring-before(@width,'%'))) cast as xs:integer"/>
+                    </xsl:when>
+                    <xsl:when test="@width">
+                        <xsl:value-of select="tei:convert-dim-emu(@width)"/>
+                    </xsl:when>
+                    <xsl:when test="@scale and $origwidth">
+                        <xsl:value-of select="($origwidth *  number(@scale)) cast as xs:integer"/>
+                    </xsl:when>
+                    <xsl:when test="@height and $origheight and $origwidth">
+		      <xsl:variable name="h">
+			<xsl:choose>
+			  <xsl:when test="contains(@height,'%')">
+			    <xsl:value-of select="number($pageHeight * (number(substring-before(@height,'%')))) cast as xs:integer"/>
+			  </xsl:when>
+			  <xsl:otherwise>
+			    <xsl:value-of
+				select="tei:convert-dim-emu(@height)"/>
+			  </xsl:otherwise>
+			</xsl:choose>
+		      </xsl:variable>
+		      <xsl:value-of select="number(($h * $origwidth) div $origheight)    cast as xs:integer"/>
+                    </xsl:when>
+                    <xsl:when test="$origwidth">
+                        <xsl:value-of select="$origwidth"/>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <xsl:message terminate="yes">no way to work out image width for
+                            <xsl:value-of select="$filename"/>
+                        </xsl:message>
+                    </xsl:otherwise>
+                </xsl:choose>
+            </xsl:variable>
+            
+            <xsl:variable name="Height">
+                <xsl:choose>
+                    <xsl:when test="contains(@height,'%')">
+                        <xsl:value-of select="number($pageHeight * (number(substring-before(@height,'%')))) cast as xs:integer"/>
+                    </xsl:when>
+                    <xsl:when test="@height">
+                        <xsl:value-of select="tei:convert-dim-emu(@height)"/>
+                    </xsl:when>
+                    <xsl:when test="@scale and $origheight">
+                        <xsl:value-of select="($origheight * number(@scale)) cast as xs:integer"/>
+                    </xsl:when>
+                    <xsl:when test="@width and $origheight and $origwidth">
+                        <xsl:value-of select="number(  ($Width *  $origheight) div $origwidth) cast as xs:integer"/>
+                    </xsl:when>
+                    <xsl:when test="$origheight">
+                        <xsl:value-of select="$origheight"/>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <xsl:message terminate="yes">no way to work out image height for
+                            <xsl:value-of select="$filename"/>
+                        </xsl:message>
+                    </xsl:otherwise>
+                </xsl:choose>
+            </xsl:variable>
+            
+	    <!-- check for sense -->
+            <xsl:variable name="imageWidth">
+	      <xsl:choose>
+		<xsl:when test="$Width = -1">
+		  <xsl:value-of select="$maxWidth"/>
+		</xsl:when>
+		<xsl:when test="$Width &gt; $maxWidth">
+		  <xsl:value-of select="$maxWidth"/>
+		</xsl:when>
+		<xsl:otherwise>
+		  <xsl:value-of select="$Width"/>
+		</xsl:otherwise>
+	      </xsl:choose>
+	    </xsl:variable>
+            <xsl:variable name="imageHeight">
+	      <xsl:choose>
+		<xsl:when test="$Height = -1">
+		  <xsl:value-of select="$maxHeight"/>
+		</xsl:when>
+		<xsl:when test="$Height &gt; $maxHeight">
+		  <xsl:value-of select="$maxHeight"/>
+		</xsl:when>
+		<xsl:when test="$Width &gt; $maxWidth">
+		  <xsl:value-of select="($Height * ($maxWidth div
+					$Width) ) cast as xs:integer"/>
+		</xsl:when>
+		<xsl:otherwise>
+		  <xsl:value-of select="$Height"/>
+		</xsl:otherwise>
+	      </xsl:choose>
+	    </xsl:variable>
+	    <!--
+		
+		<xsl:message>
+		========================
+		<xsl:for-each select="@*">
+		- @<xsl:value-of select="name(.)"/>: <xsl:value-of select="."/>
+		</xsl:for-each>
+		
+		- maxWidth: <xsl:value-of select="$maxWidth"/>
+		- maxHeight: <xsl:value-of select="$maxHeight"/>
+		- Width: <xsl:value-of select="$Width"/>
+		- Height: <xsl:value-of select="$Height"/>
+		* imageWidth: <xsl:value-of select="$imageWidth"/>
+		* imageHeight: <xsl:value-of select="$imageHeight"/>
+		</xsl:message>
+	    -->
+	    <!-- prepare actual graphic -->
+	    <xsl:variable name="generatedID">
+	      <xsl:number level="any"/>
+	    <!--
+		<xsl:choose>
+		<xsl:when test="@n">
+		  <xsl:value-of select="@n"/>
+		</xsl:when>
+		<xsl:otherwise>
+		  <xsl:number level="any"/>
+		</xsl:otherwise>
+	      </xsl:choose>
+	      -->
+	    </xsl:variable>
+
+            <xsl:variable name="graphic-element">
+                <a:graphic>
+                    <a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/picture">
+                        <pic:pic>
+                            <pic:nvPicPr>
+                                <pic:cNvPr name="{tokenize($filename, '/')[last()]}">
+                                    <xsl:attribute name="id">
+                                        <xsl:number level="any"/>
+                                    </xsl:attribute>
+                                </pic:cNvPr>
+                                <pic:cNvPicPr/>
+                            </pic:nvPicPr>
+                            <pic:blipFill>
+                                <a:blip>
+				  <xsl:attribute name="r:embed">
+				    <xsl:choose>
+				      <xsl:when test="$isofreestanding='true'">
+					<xsl:text>rId</xsl:text>
+					<xsl:value-of
+					    select="number($generatedID)
+						    + 300"/>
+				      </xsl:when>
+				      <xsl:otherwise>
+					<xsl:value-of select="document(concat($wordDirectory,'/word/_rels/document.xml.rels'))//rel:Relationship[@Target=$filename]/@Id"/>
+				      </xsl:otherwise>
+				    </xsl:choose>
+				  </xsl:attribute>
+				</a:blip>
+				<a:stretch>
+				  <a:fillRect/>
+                                </a:stretch>
+                            </pic:blipFill>
+                            <pic:spPr>
+                                <a:xfrm>
+                                    <a:off x="0" y="0"/>
+                                    <a:ext cx="{$imageWidth}00" cy="{$imageHeight}00"/>
+                                </a:xfrm>
+                                <a:prstGeom prst="rect">
+                                    <a:avLst/>
+                                </a:prstGeom>
+				<xsl:if test="$shadowGraphics='true'
+					      and parent::tei:figure">
+				  <a:effectLst>
+				    <a:outerShdw blurRad="50800" dist="88900" dir="2700000" algn="tl" rotWithShape="0">
+				      <a:schemeClr val="tx1">
+					<a:alpha val="49000"/>
+				      </a:schemeClr>
+				    </a:outerShdw>
+				  </a:effectLst>
+				</xsl:if>
+                            </pic:spPr>
+                        </pic:pic>
+                    </a:graphicData>
+                </a:graphic>
+            </xsl:variable>
+            <!-- end graphic element -->
+            
+            <w:r>
+                <w:drawing>
+                    <!-- choose between inline and block -->
+                    <xsl:choose>
+		      <xsl:when test="parent::tei:figure[@place='left'
+				      or @place='centre' or @place='right' or @place='center']">
+			<wp:anchor simplePos="0" relativeHeight="10" behindDoc="0" locked="0" layoutInCell="1"
+				   allowOverlap="1">
+			  <wp:simplePos x="0" y="0"/>
+			  <wp:positionH relativeFrom="margin">
+			    <wp:align>
+			      <xsl:value-of select="parent::tei:figure/@place"/>
+			    </wp:align>
+			  </wp:positionH>
+			  <wp:positionV relativeFrom="paragraph">
+			    <wp:align>center</wp:align>
+			  </wp:positionV>
+			  <wp:extent cx="{$imageWidth}00" cy="{$imageHeight}00"/>
+			  <xsl:if test="$shadowGraphics='true'">
+			    <wp:effectExtent l="50800" t="25400" r="101600" b="63500"/>
+			  </xsl:if>
+			  <wp:wrapSquare wrapText="bothSides"/>
+			  <wp:docPr  name="{tokenize($filename, '/')[last()]}">
+			    <xsl:attribute name="id">
+			      <xsl:value-of select="$generatedID"/>
+			    </xsl:attribute>
+			  </wp:docPr>                                
+			  <xsl:if test="$shadowGraphics='true'">
+			    <wp:cNvGraphicFramePr/>
+			  </xsl:if>
+			  <xsl:copy-of select="$graphic-element"/>
+			</wp:anchor>
+		      </xsl:when>
+		      <xsl:otherwise>
+			<wp:inline distT="0" distB="0" distL="0" distR="0">
+			  <wp:extent cx="{$imageWidth}00" cy="{$imageHeight}00"/>
+			  <xsl:if test="$shadowGraphics='true'">
+			    <wp:effectExtent l="50800" t="25400" r="101600" b="63500"/>
+			  </xsl:if>
+			  <wp:docPr  name="{tokenize($filename, '/')[last()]}">
+			    <xsl:attribute name="id">
+			      <xsl:value-of select="$generatedID"/>
+			    </xsl:attribute>
+			  </wp:docPr>                                
+			  <xsl:if test="$shadowGraphics='true'">
+			    <wp:cNvGraphicFramePr/>
+			  </xsl:if>
+			  <xsl:copy-of select="$graphic-element"/>
+			</wp:inline>
+		      </xsl:otherwise>
+                    </xsl:choose>
+                </w:drawing>
+            </w:r>
+	  </xsl:when>
+	  <xsl:otherwise>
+	    <xsl:message terminate="yes">ERROR. no image size info for  <xsl:value-of select="$filename"/>, cannot proceed</xsl:message>
+
+	  </xsl:otherwise>
+	</xsl:choose>
+    </xsl:template>
+    
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/graphics/graphics.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/wordsections/wordsections.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/wordsections/wordsections.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/wordsections/wordsections.xsl	(revision 258)
@@ -0,0 +1,164 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
+                xmlns:cals="http://www.oasis-open.org/specs/tm9901"
+                xmlns:contypes="http://schemas.openxmlformats.org/package/2006/content-types"
+                xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties"
+                xmlns:dc="http://purl.org/dc/elements/1.1/"
+                xmlns:dcmitype="http://purl.org/dc/dcmitype/"
+                xmlns:dcterms="http://purl.org/dc/terms/"
+                xmlns:html="http://www.w3.org/1999/xhtml"
+                xmlns:iso="http://www.iso.org/ns/1.0"
+                xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"
+                xmlns:mml="http://www.w3.org/1998/Math/MathML"
+                xmlns:o="urn:schemas-microsoft-com:office:office"
+                xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"
+                xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
+                xmlns:tbx="http://www.lisa.org/TBX-Specification.33.0.html"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teidocx="http://www.tei-c.org/ns/teidocx/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"
+                xmlns:v="urn:schemas-microsoft-com:vml"
+                xmlns:fn="http://www.w3.org/2005/02/xpath-functions"
+                xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006"
+                xmlns:w10="urn:schemas-microsoft-com:office:word"
+                xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
+                xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml"
+                xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"
+                
+                xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="2.0"
+                exclude-result-prefixes="cp ve o r m v wp w10 w wne mml tbx iso      tei a xs pic fn xsi dc dcterms dcmitype     contypes teidocx teix html cals">
+    
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet for making Word docx files from TEI XML </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: wordsections.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc>
+   </doc>
+    
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+        Dealing with sections
+    </desc>
+   </doc>
+    <xsl:template match="tei:milestone">
+        <xsl:param name="final-section">false</xsl:param>
+        
+        
+        <!-- construct sectPr -->
+        <xsl:variable name="sectPr">
+            <w:sectPr>
+	      <xsl:for-each select="tei:footer">
+		<xsl:variable name="ref" select="@ref"/>
+		<xsl:if test="count(key('FOOTERS',$ref))&gt;0">
+		  <xsl:variable name="footernum">
+		    <xsl:for-each select="key('FOOTERS',$ref)">
+		      <xsl:number level="any"/>
+		    </xsl:for-each>
+		  </xsl:variable>
+		  <w:footerReference w:type="{@type}" r:id="{concat('rId',100+$footernum)}"/>
+		</xsl:if>
+	      </xsl:for-each>
+	      
+	      <xsl:for-each select="tei:header">
+		<xsl:variable name="ref" select="@ref"/>
+		<xsl:if test="count(key('HEADERS',$ref))&gt;0">
+		  <xsl:variable name="headernum">
+		    <xsl:for-each select="key('HEADERS',$ref)">
+		      <xsl:number level="any"/>
+		    </xsl:for-each>
+		  </xsl:variable>
+		  <w:headerReference w:type="{@type}" r:id="{concat('rId',100+$headernum)}"/>
+		</xsl:if>
+	      </xsl:for-each>
+	      
+	      <w:pgSz>
+		<xsl:choose>
+		  <!-- landscape -->
+		  <xsl:when test="tei:orientation/@type='landscape'">
+		    <xsl:attribute name="w:orient">landscape</xsl:attribute>
+		    <xsl:attribute name="w:w">15840</xsl:attribute>
+		    <xsl:attribute name="w:h">12240</xsl:attribute>
+		  </xsl:when>
+		  <!-- portrait -->
+		  <xsl:otherwise>
+		    <xsl:attribute name="w:w">12240</xsl:attribute>
+		    <xsl:attribute name="w:h">15840</xsl:attribute>
+		  </xsl:otherwise>
+		</xsl:choose>
+	      </w:pgSz>
+	      <w:pgMar w:top="1440" w:right="1440" w:bottom="1440" w:left="1440" w:gutter="0"
+		       w:footer="720"
+		       w:header="720"/>
+	      <xsl:if test="tei:pageNumbering">
+		<w:pgNumType>
+		  <xsl:if test="tei:pageNumbering/@start">
+		    <xsl:attribute name="w:start" select="tei:pageNumbering/@start"/>
+		  </xsl:if>
+		  <xsl:if test="tei:pageNumbering/@type">
+		    <xsl:attribute name="w:fmt" select="tei:pageNumbering/@type"/>
+		  </xsl:if>
+		</w:pgNumType>
+	      </xsl:if>
+	      <xsl:if test="tei:header/@type='first' or tei:footer/@type='first'">
+		<w:titlePg/>
+	      </xsl:if>
+	      <w:docGrid w:linePitch="360"/>
+	    </w:sectPr>
+	</xsl:variable>
+        
+        <!-- write out sectPr -->
+        <xsl:choose>
+            <xsl:when test="$final-section='false'">
+                <w:p>
+                    <w:pPr>
+                        <xsl:copy-of select="$sectPr"/>
+                    </w:pPr>
+                </w:p>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:copy-of select="$sectPr"/>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+    
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/wordsections/wordsections.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/drama/drama.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/drama/drama.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/drama/drama.xsl	(revision 258)
@@ -0,0 +1,143 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
+                xmlns:cals="http://www.oasis-open.org/specs/tm9901"
+                xmlns:contypes="http://schemas.openxmlformats.org/package/2006/content-types"
+                xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties"
+                xmlns:dc="http://purl.org/dc/elements/1.1/"
+                xmlns:dcmitype="http://purl.org/dc/dcmitype/"
+                xmlns:dcterms="http://purl.org/dc/terms/"
+                xmlns:html="http://www.w3.org/1999/xhtml"
+                xmlns:iso="http://www.iso.org/ns/1.0"
+                xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"
+                xmlns:mml="http://www.w3.org/1998/Math/MathML"
+                xmlns:o="urn:schemas-microsoft-com:office:office"
+                xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"
+                xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
+		xmlns:rel="http://schemas.openxmlformats.org/package/2006/relationships"
+                xmlns:tbx="http://www.lisa.org/TBX-Specification.33.0.html"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teidocx="http://www.tei-c.org/ns/teidocx/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"
+                xmlns:v="urn:schemas-microsoft-com:vml"
+                xmlns:fn="http://www.w3.org/2005/02/xpath-functions"
+                xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006"
+                xmlns:w10="urn:schemas-microsoft-com:office:word"
+                xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
+                xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml"
+                xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"
+                
+                xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="2.0"
+                exclude-result-prefixes="cp ve o r m v wp w10 w wne
+					 mml tbx iso tei a xs
+					 pic fn xsi dc dcterms
+					 dcmitype rel contypes teidocx teix html cals">
+    
+
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet for making Word docx files from TEI XML
+         </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: drama.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc>
+   </doc>
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+        A speaker's name
+    </desc>
+   </doc>
+    <xsl:template match="tei:sp/tei:speaker" >
+      <xsl:call-template name="block-element">
+	<xsl:with-param name="style">teispeaker</xsl:with-param>
+      </xsl:call-template>
+    </xsl:template>
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+        A bit of speech name
+    </desc>
+   </doc>
+    <xsl:template match="tei:sp/tei:p" >
+      <xsl:call-template name="block-element">
+	<xsl:with-param name="style">teispeech</xsl:with-param>
+      </xsl:call-template>
+    </xsl:template>
+
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+        A stage direction
+    </desc>
+   </doc>
+    <xsl:template match="tei:sp/tei:stage" >
+      <xsl:call-template name="block-element">
+            <xsl:with-param name="style">teistage</xsl:with-param>
+      </xsl:call-template>
+    </xsl:template>
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+        A line of verse
+    </desc>
+   </doc>
+    <xsl:template match="tei:l">
+      <xsl:call-template name="block-element">
+	<xsl:with-param name="style">teil</xsl:with-param>
+      </xsl:call-template>
+    </xsl:template>
+
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+        A block of verse
+    </desc>
+    </doc>
+    <xsl:template match="tei:lg">
+      <xsl:apply-templates/>
+      <w:p>
+	<w:pPr>
+	  <w:pStyle w:val="teilg"/>
+	</w:pPr>
+        <w:r>
+	  <w:br/>
+        </w:r>
+      </w:p>
+    </xsl:template>
+
+
+
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/drama/drama.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/dynamic/dynamic.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/dynamic/dynamic.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/dynamic/dynamic.xsl	(revision 258)
@@ -0,0 +1,143 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
+                xmlns:cals="http://www.oasis-open.org/specs/tm9901"
+                xmlns:contypes="http://schemas.openxmlformats.org/package/2006/content-types"
+                xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties"
+                xmlns:dc="http://purl.org/dc/elements/1.1/"
+                xmlns:dcmitype="http://purl.org/dc/dcmitype/"
+                xmlns:dcterms="http://purl.org/dc/terms/"
+                xmlns:html="http://www.w3.org/1999/xhtml"
+                xmlns:iso="http://www.iso.org/ns/1.0"
+                xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"
+                xmlns:mml="http://www.w3.org/1998/Math/MathML"
+                xmlns:o="urn:schemas-microsoft-com:office:office"
+                xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"
+                xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
+                xmlns:tbx="http://www.lisa.org/TBX-Specification.33.0.html"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teidocx="http://www.tei-c.org/ns/teidocx/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"
+                xmlns:v="urn:schemas-microsoft-com:vml"
+                xmlns:fn="http://www.w3.org/2005/02/xpath-functions"
+                xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006"
+                xmlns:w10="urn:schemas-microsoft-com:office:word"
+                xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
+                xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml"
+                xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"
+                
+                xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="2.0"
+                exclude-result-prefixes="cp ve o r m v wp w10 w wne mml tbx iso     tei a xs pic fn xsi dc dcterms dcmitype     contypes teidocx teix html cals">
+    
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet for making Word docx files from TEI XML </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: dynamic.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc>
+   </doc>
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc> 
+        dynamic content
+    </desc>
+   </doc>    
+    <xsl:template match="tei:dynamicContent">
+        <xsl:choose>
+            <xsl:when test="@type='pagenumber'">
+                <w:fldSimple w:instr=" PAGE \* MERGEFORMAT ">
+                    <w:r>
+                        <w:rPr>
+                            <w:noProof/>
+                        </w:rPr>
+                        <w:t>1</w:t>
+                    </w:r>
+                </w:fldSimple>
+            </xsl:when>
+        </xsl:choose>
+    </xsl:template>
+    
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+        Dealing with divGens
+    </desc>
+   </doc>
+    <xsl:template match="tei:divGen">
+        <xsl:choose>
+            <xsl:when test="@type='toc'">
+                <xsl:call-template name="generate-toc"/>
+            </xsl:when>
+        </xsl:choose>
+        
+    </xsl:template>
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+        Table of Contents:
+        Feel free to overwrite this one.
+    </desc>
+   </doc>
+    <xsl:template name="generate-toc">
+        <w:p>
+            <w:pPr>
+                <w:pStyle w:val="TOC1"/>
+                <w:tabs>
+                    <w:tab w:val="right" w:leader="dot" w:pos="9350"/>
+                </w:tabs>
+            </w:pPr>
+            <w:r>
+                <w:fldChar w:fldCharType="begin"/>
+            </w:r>
+            <w:r>
+                <w:rPr>
+                    <w:noProof/>
+                </w:rPr>
+                <w:instrText xml:space="preserve"> TOC \o "1-6" \h \z </w:instrText>
+            </w:r>
+            <w:r>
+                <w:fldChar w:fldCharType="separate"/>
+            </w:r>
+            <w:r>
+                <w:fldChar w:fldCharType="end"/>
+            </w:r>
+        </w:p>
+    </xsl:template>
+    
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/dynamic/dynamic.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/teitodocx.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/teitodocx.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/teitodocx.xsl	(revision 258)
@@ -0,0 +1,2388 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:cals="http://www.oasis-open.org/specs/tm9901" xmlns:contypes="http://schemas.openxmlformats.org/package/2006/content-types" xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcmitype="http://purl.org/dc/dcmitype/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:iso="http://www.iso.org/ns/1.0" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:tbx="http://www.lisa.org/TBX-Specification.33.0.html" xmlns:tei="http://www.tei-c.org/ns/1.0" xmlns:teidocx="http://www.tei-c.org/ns/teidocx/1.0" xmlns:teix="http://www.tei-c.org/ns/Examples" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:fn="http://www.w3.org/2005/02/xpath-functions" xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:its="http://www.w3.org/2005/11/its" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" exclude-result-prefixes="cp ve o r m v wp w10 w wne mml tbx iso its tei a xs pic fn xsi dc dcterms dcmitype contypes teidocx teix html cals">
+  <xsl:import href="placeholders.xsl"/>
+  <xsl:import href="../../common2/functions.xsl"/>
+  <xsl:import href="../utils/functions.xsl"/>
+  <xsl:import href="../utils/variables.xsl"/>
+  <xsl:import href="../utils/identity/identity.xsl"/>
+  <xsl:import href="../utils/verbatim/tei-docx-verbatim.xsl"/>
+  <xsl:import href="../utils/maths/mml2omml.xsl"/>
+  <xsl:import href="../../common2/core.xsl"/>
+  <xsl:import href="../../common2/msdescription.xsl"/>
+  <!-- Deals with dynamic text creation such as toc -->
+  <xsl:include href="dynamic/dynamic.xsl"/>
+  <!-- Templates transforming graphic elements -->
+  <xsl:include href="graphics/graphics.xsl"/>
+  <!-- Templates transforming elements from drama -->
+  <xsl:include href="drama/drama.xsl"/>
+  <!-- Templates transforming lists -->
+  <xsl:include href="lists/lists.xsl"/>
+  <!-- Templates transforming math elements -->
+  <xsl:include href="maths/maths.xsl"/>
+  <!-- Templates transforming ODD-related elements -->
+  <xsl:include href="odds/tagdocs.xsl"/>
+  <!-- Templates transforming tei milestones into sectPr -->
+  <xsl:include href="wordsections/wordsections.xsl"/>
+  <!-- Load stylesheets helping with the creation of special files -->
+  <xsl:include href="docxfiles/application.xsl"/>
+  <xsl:include href="docxfiles/content-types.xsl"/>
+  <xsl:include href="docxfiles/endnotes.xsl"/>
+  <xsl:include href="docxfiles/footers.xsl"/>
+  <xsl:include href="docxfiles/comments.xsl"/>
+  <xsl:include href="docxfiles/footnotes.xsl"/>
+  <xsl:include href="docxfiles/headers.xsl"/>
+  <xsl:include href="docxfiles/numbering-definition.xsl"/>
+  <xsl:include href="docxfiles/relationships.xsl"/>
+  <xsl:include href="docxfiles/settings.xsl"/>
+  <xsl:param name="createanttask">false</xsl:param>
+  <xsl:param name="useHeaderFrontMatter">false</xsl:param>
+  <xsl:param name="useFixedDate">false</xsl:param>
+  <!--
+        A4 is 210mm x 297mm; leaving 1in margin (25mm),
+        gives 160 x 247 approx useable area. For figures,
+	Microsoft use English metrical units (emu), in which
+        1mm = 3600 units. So page size is 57600 * 889200
+        Divide by 100 to avoid overflow in calculations.
+
+        For other measurements in Word, see useful discussion at
+	http://startbigthinksmall.wordpress.com/2010/01/04/points-inches-and-emus-measuring-units-in-office-open-xml/
+    -->
+  <xsl:param name="pageWidth">576</xsl:param>
+  <xsl:param name="pageHeight">890</xsl:param>
+  <xsl:param name="tableWidthPercentage"></xsl:param>
+  <xsl:param name="defaultHeaderFooterFile">templates/default.xml</xsl:param>
+  <xsl:param name="postQuote">’</xsl:param>
+  <xsl:param name="preQuote">‘</xsl:param>
+  <xsl:param name="bulletOne"></xsl:param>
+  <xsl:param name="bulletTwo">•</xsl:param>
+  <xsl:param name="bulletThree">*</xsl:param>
+  <xsl:param name="bulletFour">+</xsl:param>
+  <xsl:param name="bulletFive">•</xsl:param>
+  <xsl:param name="bulletSix">•</xsl:param>
+  <xsl:param name="bulletSeven">•</xsl:param>
+  <xsl:param name="bulletEight">•</xsl:param>
+  <xsl:param name="word-directory">..</xsl:param>
+  <xsl:param name="inputDir">.</xsl:param>
+  <xsl:param name="debug">false</xsl:param>
+  <xsl:param name="styleDoc">
+    <xsl:value-of select="concat($wordDirectory, '/word/styles.xml')"/>
+  </xsl:param>
+  <xsl:param name="docDoc">
+    <xsl:value-of select="concat($wordDirectory, '/word/document.xml')"/>
+  </xsl:param>
+  <xsl:param name="shadowGraphics">false</xsl:param>
+  <xsl:param name="alignFigures">center</xsl:param>
+  <xsl:param name="renderAddDel">true</xsl:param>
+  <xsl:param name="addColour">red</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+    <desc>
+      <p> TEI stylesheet for making Word docx files from TEI XML </p>
+      <p><h1 xmlns="">Stylesheet documentation</h1><h2 xmlns="">template modes</h2><h3 xmlns="">get-style</h3><h1 xmlns="">License</h1>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+      <p>Author: See AUTHORS</p>
+      <p>Id: $Id: teitodocx.xsl 9998 2012-01-02 18:27:15Z rahtz $</p>
+      <p>Copyright: 2008, TEI Consortium</p>
+    </desc>
+  </doc>
+  <xsl:strip-space elements="*"/>
+  <xsl:preserve-space elements="tei:text"/>
+  <xsl:output method="xml" version="1.0" encoding="UTF-8"/>
+  <xsl:param name="isofreestanding">true</xsl:param>
+  <xsl:key name="FOOTERS" match="tei:fw[@type='footer']" use="@xml:id"/>
+  <xsl:key name="HEADERS" match="tei:fw[@type='header']" use="@xml:id"/>
+  <xsl:key name="ALLFOOTERS" match="tei:fw[@type='footer']" use="1"/>
+  <xsl:key name="ALLHEADERS" match="tei:fw[@type='header']" use="1"/>
+  <xsl:key name="ENDNOTES" match="tei:note[@place='end']" use="1"/>
+  <xsl:key name="FOOTNOTES" match="tei:note[@place='foot' or @place='bottom' ]" use="1"/>
+  <xsl:key name="OL" match="tei:list[@type='ordered']" use="1"/>
+  <xsl:key name="BLIP" match="a:blip" use="1"/>
+  <xsl:key name="Styles" match="w:style/w:name" use="@w:val"/>
+  <xsl:variable name="align">right</xsl:variable>
+  <xsl:variable name="wordDirectory">
+    <xsl:value-of select="translate($word-directory,'\\','/')"/>
+  </xsl:variable>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>
+        Generic template from msDescription for high-level section
+    </desc>
+  </doc>
+  <xsl:template name="msSection">
+    <xsl:param name="level"/>
+    <xsl:param name="implicitBlock"/>
+    <xsl:param name="heading"/>
+    <w:p>
+      <w:pPr>
+        <w:pStyle w:val="tei{local-name()}"/>
+      </w:pPr>
+      <w:r>
+        <w:t>
+          <xsl:value-of select="$heading"/>
+        </w:t>
+      </w:r>
+    </w:p>
+    <xsl:call-template name="block-element"/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>
+        Generic template from msDescription for inline objects
+    </desc>
+  </doc>
+  <xsl:template name="msInline">
+    <xsl:param name="before"/>
+    <xsl:param name="after"/>
+    <xsl:param name="style"/>
+    <w:r>
+      <w:rPr>
+        <w:rStyle w:val="tei{local-name()}"/>
+        <xsl:choose>
+          <xsl:when test="$style='italic'">
+            <w:i/>
+          </xsl:when>
+          <xsl:when test="$style='bold'">
+            <w:b/>
+          </xsl:when>
+        </xsl:choose>
+        <xsl:if test="$renderAddDel='true' and ancestor-or-self::tei:del">
+          <w:strike/>
+        </xsl:if>
+      </w:rPr>
+      <w:t>
+        <xsl:value-of select="$before"/>
+        <xsl:value-of select="."/>
+        <xsl:value-of select="$after"/>
+      </w:t>
+    </w:r>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>
+        Generic template from msDescription for mid-level block
+    </desc>
+  </doc>
+  <xsl:template name="msBlock">
+    <xsl:param name="style"/>
+    <xsl:call-template name="block-element">
+      <xsl:with-param name="style">
+        <xsl:value-of select="$style"/>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>
+        Generic template from msDescription for labelled object
+    </desc>
+  </doc>
+  <xsl:template name="msLabelled">
+    <xsl:param name="before"/>
+    <w:r>
+      <w:rPr>
+        <w:i/>
+      </w:rPr>
+      <w:t>
+        <xsl:attribute name="xml:space">preserve</xsl:attribute>
+        <xsl:value-of select="$before"/>
+        <xsl:text>: </xsl:text>
+      </w:t>
+    </w:r>
+    <w:r>
+      <w:rPr>
+        <w:rStyle w:val="tei{local-name()}"/>
+      </w:rPr>
+      <w:t>
+        <xsl:value-of select="."/>
+      </w:t>
+    </w:r>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>
+        Generic template from msDescription for literal text
+    </desc>
+  </doc>
+  <xsl:template name="msLiteral">
+    <xsl:param name="text"/>
+    <w:r>
+      <w:rPr/>
+      <w:t>
+        <xsl:attribute name="xml:space">preserve</xsl:attribute>
+        <xsl:value-of select="$text"/>
+      </w:t>
+    </w:r>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>
+        The starting point in the conversion to docx.
+    </desc>
+  </doc>
+  <xsl:template match="/tei:TEI">
+    <xsl:call-template name="write-docxfiles"/>
+    <xsl:call-template name="create-document-dot-xml"/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>
+        Calls templates that are responsible for creating all necessary files besides the
+            main document.xml
+    </desc>
+  </doc>
+  <xsl:template name="write-docxfiles">
+    <!-- header and footers -->
+    <xsl:call-template name="write-docxfile-header-files"/>
+    <!-- footer files -->
+    <xsl:call-template name="write-docxfile-footer-files"/>
+    <!-- numbering file -->
+    <xsl:call-template name="write-docxfile-numbering-definition"/>
+    <!-- footnotes file -->
+    <xsl:call-template name="write-docxfile-footnotes-file"/>
+    <!-- endnotes file -->
+    <xsl:call-template name="write-docxfile-endnotes-file"/>
+    <!-- comments file -->
+    <xsl:call-template name="write-docxfile-comments-file"/>
+    <!-- main relationships -->
+    <xsl:call-template name="write-docxfile-main-relationships"/>
+    <!-- relationships -->
+    <xsl:call-template name="write-docxfile-relationships"/>
+    <!-- write Content Types -->
+    <xsl:call-template name="write-docxfile-content-types"/>
+    <!-- settings -->
+    <xsl:call-template name="write-docxfile-settings"/>
+    <!-- app files -->
+    <xsl:call-template name="write-docxfile-docprops-core"/>
+    <xsl:call-template name="write-docxfile-docprops-app"/>
+    <xsl:call-template name="write-docxfile-docprops-custom"/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>
+        Create the contents of the main document.xml file, that contains all "real" content.
+    </desc>
+  </doc>
+  <xsl:template name="create-document-dot-xml">
+    <w:document>
+      <w:body>
+        <!-- Front -->
+        <xsl:call-template name="write-document-dot-xml-frontmatter"/>
+        <!-- Main -->
+        <xsl:call-template name="write-document-dot-xml-maincontent"/>
+        <!-- Back -->
+        <xsl:call-template name="write-document-dot-xml-backmatter"/>
+        <!-- Clearing up at the end -->
+        <xsl:call-template name="write-document-dot-xml-postclearing"/>
+      </w:body>
+    </w:document>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>
+        Handles the front matter
+    </desc>
+  </doc>
+  <xsl:template name="write-document-dot-xml-frontmatter">
+    <!-- are there specific titlepages -->
+    <xsl:call-template name="titlepages"/>
+    <!-- header components -->
+    <xsl:call-template name="headerParts"/>
+    <!-- The front matter -->
+    <xsl:apply-templates select="tei:text/tei:front"/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>
+        Handles the main content
+    </desc>
+  </doc>
+  <xsl:template name="write-document-dot-xml-maincontent">
+    <!-- document title -->
+    <xsl:call-template name="document-title"/>
+    <!-- Describes the main part of the document -->
+    <xsl:apply-templates select="tei:text/tei:body"/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>
+        Handles the back matter
+    </desc>
+  </doc>
+  <xsl:template name="write-document-dot-xml-backmatter">
+    <!-- Describes the back matter of the document -->
+    <xsl:apply-templates select="tei:text/tei:back"/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>
+      <p>Inserts final word specific sections</p>
+      <p> Inserts a final sectPr section if we need one </p>
+    </desc>
+  </doc>
+  <xsl:template name="write-document-dot-xml-postclearing">
+    <!-- write out final sectPr .. if exists -->
+    <xsl:choose>
+      <xsl:when test="tei:text/tei:milestone">
+        <xsl:apply-templates select="tei:text/tei:milestone[1]">
+          <xsl:with-param name="final-section">true</xsl:with-param>
+        </xsl:apply-templates>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:apply-templates select="document($defaultHeaderFooterFile)/tei:TEI/tei:text/tei:milestone">
+          <xsl:with-param name="final-section">true</xsl:with-param>
+        </xsl:apply-templates>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>
+      <p>Template used to process block elements:</p>
+      <ul>
+        <li><b>style</b>: A style for all the <gi>w:p</gi>s</li>
+        <li><b>pPr</b>: An entire <gi>pPr</gi> element to use </li>
+        <li><b>nop</b>: a w:p has already been created and no new w:p is to be created </li>
+        <li><b>bookmark-id</b>: if present in conjunction with bookmark-name, a bookmark is created around the current element </li>
+        <li><b>bookmark-name</b>: see bookmark-id </li>
+      </ul>
+    </desc>
+  </doc>
+  <xsl:template name="block-element">
+    <xsl:param name="style"/>
+    <xsl:param name="select" select="."/>
+    <xsl:param name="pPr"/>
+    <xsl:param name="nop">false</xsl:param>
+    <xsl:param name="bookmark-id"/>
+    <xsl:param name="bookmark-name"/>
+    <xsl:for-each select="$select">
+      <xsl:for-each-group select="*|processing-instruction()|text()" group-adjacent="1">
+        <xsl:call-template name="_process-blockelement">
+          <xsl:with-param name="style" select="$style"/>
+          <xsl:with-param name="pPr" select="$pPr"/>
+          <xsl:with-param name="nop" select="$nop"/>
+          <xsl:with-param name="bookmark-id" select="$bookmark-id"/>
+          <xsl:with-param name="bookmark-name" select="$bookmark-name"/>
+        </xsl:call-template>
+      </xsl:for-each-group>
+    </xsl:for-each>
+  </xsl:template>
+  <!-- end template block-element -->
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>
+      <p>
+            This template processes block elements (or better to say the children of a block element)
+            and should never be called directly 
+            (call block-element instead). The function processes all children and puts
+            all inline elements into one w:p. If it encounters a nested block element
+            (e.g. a note inside a p) then it closes the previous w:p processes that block
+            element and then again starts putting all following inline elements into another
+            w:p element.
+            
+            @see block-element
+        </p>
+    </desc>
+  </doc>
+  <xsl:template name="_process-blockelement">
+    <xsl:param name="style"/>
+    <xsl:param name="pPr"/>
+    <xsl:param name="nop"/>
+    <xsl:param name="bookmark-id"/>
+    <xsl:param name="bookmark-name"/>
+    <!-- Process Child elements -->
+    <xsl:for-each-group select="current-group()" group-starting-with="*[not(tei:is-inline(.))]">
+      <xsl:choose>
+        <!-- if the current item is a block element, we process that one,
+                     and then take call this function recursively was all the other
+                     elements -->
+        <xsl:when test="self::*[not(tei:is-inline(.))]">
+          <!-- process block element -->
+          <xsl:apply-templates select=".">
+            <xsl:with-param name="style" select="$style"/>
+            <xsl:with-param name="pPr" select="$pPr"/>
+            <xsl:with-param name="nop" select="$nop"/>
+          </xsl:apply-templates>
+          <!-- process all the other elements in the current group -->
+          <xsl:for-each-group select="current-group() except ." group-adjacent="1">
+            <xsl:call-template name="_process-blockelement">
+              <xsl:with-param name="style" select="$style"/>
+              <xsl:with-param name="pPr" select="$pPr"/>
+              <xsl:with-param name="nop" select="$nop"/>
+            </xsl:call-template>
+          </xsl:for-each-group>
+        </xsl:when>
+        <!-- we encountered an inline element. This means that the current group only
+                     contains inline elements -->
+        <xsl:otherwise>
+          <!--
+	  <xsl:message>+@@ <xsl:value-of select="name()"/>: pPr:	  <xsl:if test="not(empty($pPr))"><xsl:copy-of
+	  select="$pPr"/></xsl:if>; style: <xsl:if
+	  test="not(empty($style))"><xsl:copy-of
+	  select="$style"/></xsl:if></xsl:message>
+-->
+          <!-- create all text runs for each item in the current group. we will later
+                         on decide whether we are grouping them together in a w:p or not. -->
+          <xsl:variable name="innerRuns">
+            <!-- add paragraph properties (if nobody else created a w:p ($nop)) -->
+            <xsl:if test="$nop!='true'">
+              <xsl:choose>
+                <xsl:when test="not($style='')">
+                  <w:pPr>
+                    <w:pStyle>
+                      <xsl:attribute name="w:val" select="$style"/>
+                    </w:pStyle>
+                  </w:pPr>
+                </xsl:when>
+                <xsl:when test="not(empty($pPr))">
+                  <xsl:copy-of select="$pPr"/>
+                </xsl:when>
+              </xsl:choose>
+            </xsl:if>
+            <!-- bookmark start -->
+            <xsl:if test="string-length($bookmark-name) &gt; 0 and string-length($bookmark-id) &gt; 0">
+              <w:bookmarkStart w:id="{$bookmark-id}" w:name="{$bookmark-name}"/>
+            </xsl:if>
+            <!-- Create text runs -->
+            <xsl:for-each select="current-group()">
+              <xsl:apply-templates select=".">
+                <xsl:with-param name="style" select="$style"/>
+                <xsl:with-param name="pPr" select="$pPr"/>
+              </xsl:apply-templates>
+            </xsl:for-each>
+            <!-- bookmark end-->
+            <xsl:if test="string-length($bookmark-name) &gt; 0 and string-length($bookmark-id) &gt; 0">
+              <w:bookmarkEnd w:id="{$bookmark-id}"/>
+            </xsl:if>
+          </xsl:variable>
+          <!-- write out text runs.
+                         if someone has already created a w:p ($nop) we may not create another one. -->
+          <xsl:choose>
+            <xsl:when test="$nop='true'">
+              <xsl:copy-of select="$innerRuns"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <w:p>
+                <xsl:copy-of select="$innerRuns"/>
+              </w:p>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:for-each-group>
+    <!-- end process children -->
+  </xsl:template>
+  <!-- end template _process-blockelement -->
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>
+        Anchors
+    </desc>
+  </doc>
+  <xsl:template match="tei:anchor">
+    <xsl:variable name="N">
+      <xsl:number level="any"/>
+    </xsl:variable>
+    <w:bookmarkStart w:id="{number($N) + 20000}" w:name="{@xml:id}"/>
+    <w:bookmarkEnd w:id="{number($N) + 20000}"/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>
+        Handles text sections. Adds a bookmark if they are the
+	first text in this object. 
+    </desc>
+  </doc>
+  <xsl:template match="text()">
+    <xsl:param name="character-style"/>
+    <xsl:choose>
+      <xsl:when test="ancestor::tei:head"/>
+      <xsl:when test="ancestor::tei:bibl"/>
+      <xsl:when test="preceding-sibling::text()"/>
+      <xsl:when test="parent::tei:head/parent::tei:*/@xml:id">
+        <xsl:for-each select="parent::tei:head/parent::tei:*">
+          <xsl:variable name="N">
+            <xsl:number level="any"/>
+          </xsl:variable>
+          <w:bookmarkStart w:id="{number($N) + 10000}" w:name="{@xml:id}"/>
+        </xsl:for-each>
+      </xsl:when>
+      <xsl:when test="../@xml:id">
+        <xsl:for-each select="..">
+          <xsl:variable name="N">
+            <xsl:number level="any"/>
+          </xsl:variable>
+          <w:bookmarkStart w:id="{number($N) + 10000}" w:name="{@xml:id}"/>
+        </xsl:for-each>
+      </xsl:when>
+    </xsl:choose>
+    <xsl:if test="parent::tei:head/parent::tei:div[@iso:status]">
+      <w:r>
+        <w:t>
+          <xsl:attribute name="xml:space">preserve</xsl:attribute>
+          <xsl:text> (</xsl:text>
+          <xsl:value-of select="../../@iso:status"/>
+          <xsl:text>) </xsl:text>
+        </w:t>
+      </w:r>
+    </xsl:if>
+    <!-- if no specific style is assigned we might check for any other indication to assign 
+	   some style ... -->
+    <xsl:variable name="renderingProperties">
+      <xsl:for-each select="..">
+        <xsl:call-template name="applyRend"/>
+      </xsl:for-each>
+    </xsl:variable>
+    <xsl:variable name="rProps">
+      <xsl:if test="string-length($character-style) &gt; 0 or not(empty($renderingProperties))">
+        <w:rPr>
+          <xsl:if test="string-length($character-style) &gt; 0">
+            <w:rStyle>
+              <xsl:choose>
+                <!-- this is a rogue - trap it and kill it -->
+                <xsl:when test="$character-style='footnote reference'">
+                  <xsl:attribute name="w:val" select="'FootnoteReference'"/>
+                </xsl:when>
+                <xsl:otherwise>
+                  <xsl:attribute name="w:val" select="$character-style"/>
+                </xsl:otherwise>
+              </xsl:choose>
+            </w:rStyle>
+          </xsl:if>
+          <xsl:copy-of select="$renderingProperties"/>
+          <xsl:if test="ancestor::*[@xml:lang]">
+            <w:lang w:val="{ancestor::*[@xml:lang][1]/@xml:lang}"/>
+          </xsl:if>
+        </w:rPr>
+      </xsl:if>
+    </xsl:variable>
+    <xsl:choose>
+      <xsl:when test="$renderAddDel='true'">
+        <w:r>
+          <xsl:copy-of select="$rProps"/>
+          <w:t>
+            <xsl:call-template name="Text"/>
+          </w:t>
+        </w:r>
+      </xsl:when>
+      <xsl:when test="parent::tei:del">
+        <w:del>
+          <xsl:variable name="N">
+            <xsl:for-each select="..">
+              <xsl:number level="any"/>
+            </xsl:for-each>
+          </xsl:variable>
+          <xsl:attribute name="w:id" select="number($N) + 50000"/>
+          <xsl:if test="../@when">
+            <xsl:attribute name="w:date">
+              <xsl:value-of select="../@when"/>
+            </xsl:attribute>
+          </xsl:if>
+          <w:r>
+            <xsl:copy-of select="$rProps"/>
+            <w:delText>
+              <xsl:call-template name="Text"/>
+            </w:delText>
+          </w:r>
+        </w:del>
+      </xsl:when>
+      <xsl:when test="parent::tei:add">
+        <w:ins>
+          <xsl:variable name="N">
+            <xsl:for-each select="..">
+              <xsl:number level="any"/>
+            </xsl:for-each>
+          </xsl:variable>
+          <xsl:attribute name="w:id" select="number($N) + 50000"/>
+          <xsl:if test="../@when">
+            <xsl:attribute name="w:date">
+              <xsl:value-of select="../@when"/>
+            </xsl:attribute>
+          </xsl:if>
+          <w:r>
+            <xsl:copy-of select="$rProps"/>
+            <w:t>
+              <xsl:call-template name="Text"/>
+            </w:t>
+          </w:r>
+        </w:ins>
+      </xsl:when>
+      <xsl:otherwise>
+        <w:r>
+          <xsl:copy-of select="$rProps"/>
+          <w:t>
+            <xsl:call-template name="Text"/>
+          </w:t>
+        </w:r>
+      </xsl:otherwise>
+    </xsl:choose>
+    <xsl:choose>
+      <xsl:when test="ancestor::tei:head"/>
+      <xsl:when test="ancestor::tei:bibl"/>
+      <xsl:when test="following-sibling::text()"/>
+      <xsl:when test="../@xml:id">
+        <xsl:for-each select="..">
+          <xsl:variable name="N">
+            <xsl:number level="any"/>
+          </xsl:variable>
+          <w:bookmarkEnd w:id="{number($N) + 10000}"/>
+        </xsl:for-each>
+      </xsl:when>
+      <xsl:when test="parent::tei:head/parent::tei:*/@xml:id">
+        <xsl:for-each select="parent::tei:head/parent::tei:*">
+          <xsl:variable name="N">
+            <xsl:number level="any"/>
+          </xsl:variable>
+          <w:bookmarkEnd w:id="{number($N) + 10000}"/>
+        </xsl:for-each>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:template>
+  <xsl:template name="Text">
+    <xsl:choose>
+      <xsl:when test="parent::w:body">
+        <xsl:message terminate="yes">CDATA found in body! [<xsl:value-of select="."/>]</xsl:message>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:variable name="out">
+          <xsl:choose>
+            <xsl:when test=".=' ' or ../@xml:space='preserve'">
+              <xsl:value-of select="."/>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:if test="starts-with(.,' ') or starts-with(.,'&#10;')">
+                <xsl:text> </xsl:text>
+              </xsl:if>
+              <xsl:value-of select="normalize-space(.)"/>
+              <xsl:choose>
+                <xsl:when test="substring(.,string-length(.),1)=' '">
+                  <xsl:text> </xsl:text>
+                </xsl:when>
+                <xsl:when test="substring(.,string-length(.),1)='&#9;'">
+                  <xsl:text> </xsl:text>
+                </xsl:when>
+                <xsl:when test="substring(.,string-length(.),1)='&#10;'">
+                  <xsl:text> </xsl:text>
+                </xsl:when>
+              </xsl:choose>
+              <xsl:if test="substring(.,string-length(.),1)='&#10;'">
+                <xsl:text> </xsl:text>
+              </xsl:if>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:variable>
+        <xsl:choose>
+          <xsl:when test="contains($out,'ߛ')">
+            <xsl:attribute name="xml:space">preserve</xsl:attribute>
+            <xsl:value-of select="substring-before($out,'ߛ')"/>
+            <w:noBreakHyphen/>
+            <xsl:attribute name="xml:space">preserve</xsl:attribute>
+            <xsl:value-of select="substring-after($out,'ߛ')"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:attribute name="xml:space">preserve</xsl:attribute>
+            <xsl:value-of select="$out"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>
+        
+            Style definition templates: 
+            No default Style for any block or inline element
+        
+    </desc>
+  </doc>
+  <xsl:template match="*" mode="get-style"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc> 
+        to a given style name, this template returns the correct style id
+        looking it up in styles.xml 
+    </desc>
+  </doc>
+  <xsl:template name="getStyleName">
+    <xsl:param name="in"/>
+    <xsl:for-each select="document($styleDoc,/)">
+      <xsl:for-each select="key('Styles',$in)">
+        <xsl:value-of select="parent::w:style/@w:styleId"/>
+      </xsl:for-each>
+    </xsl:for-each>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>
+        Tests whether to add rendering elements to a run.
+        Word styles cannot not be added in applyRend. If you want to add
+        a style go for a get-style template. The order of these
+	elements in Word does matter, by the way. 
+     </desc>
+  </doc>
+  <xsl:template name="applyRend">
+    <!-- use a custom font -->
+    <xsl:choose>
+      <xsl:when test="@iso:font">
+        <w:rFonts w:ascii="{@iso:font}" w:hAnsi="{@iso:font}"/>
+      </xsl:when>
+      <!-- typewriter font -->
+      <xsl:when test="contains(@rend,'typewriter') or tei:render-typewriter(.)">
+        <w:rFonts w:ascii="Courier" w:hAnsi="Courier"/>
+      </xsl:when>
+      <xsl:when test="contains(@rend, 'Special') or matches(@iso:style,'font-family')">
+        <xsl:call-template name="getStyleFonts">
+          <xsl:with-param name="css" select="@iso:style"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:when test="matches(parent::*/@iso:style,'font-family')">
+        <xsl:call-template name="getStyleFonts">
+          <xsl:with-param name="css" select="parent::*/@iso:style"/>
+        </xsl:call-template>
+      </xsl:when>
+    </xsl:choose>
+    <!-- bold -->
+    <xsl:choose>
+      <xsl:when test="tei:render-bold(.)">
+        <w:b/>
+      </xsl:when>
+      <xsl:when test="self::tei:hi[not(@rend)]">
+        <w:b/>
+      </xsl:when>
+      <xsl:when test="self::tbx:hi[@style='bold']">
+        <w:i/>
+      </xsl:when>
+      <xsl:when test="contains(@rend,'bold')">
+        <w:b/>
+      </xsl:when>
+      <xsl:when test="contains(@rend,'normalweight')">
+        <w:b w:val="0"/>
+      </xsl:when>
+    </xsl:choose>
+    <!-- italic -->
+    <xsl:choose>
+      <xsl:when test="tei:render-italic(.)">
+        <w:i/>
+      </xsl:when>
+      <xsl:when test="self::tei:emph">
+        <w:i/>
+      </xsl:when>
+      <xsl:when test="self::tbx:hi[@style='italics']">
+        <w:i/>
+      </xsl:when>
+      <xsl:when test="self::tbx:hi[@style='it']">
+        <w:i/>
+      </xsl:when>
+    </xsl:choose>
+    <!-- small caps -->
+    <xsl:if test="tei:render-smallcaps(.)">
+      <w:smallCaps/>
+    </xsl:if>
+    <!-- all caps -->
+    <xsl:if test="contains(@rend,'capsall')">
+      <w:caps/>
+    </xsl:if>
+    <!-- strikethrough -->
+    <xsl:choose>
+      <xsl:when test="$renderAddDel='true' and ancestor-or-self::tei:del">
+        <w:strike/>
+      </xsl:when>
+      <xsl:when test="contains(@rend,'strikethrough')">
+        <w:strike/>
+      </xsl:when>
+      <xsl:when test="contains(@rend,'strikedoublethrough')">
+        <w:dstrike/>
+      </xsl:when>
+    </xsl:choose>
+    <!-- colour -->
+    <xsl:choose>
+      <xsl:when test="$renderAddDel='true' and ancestor-or-self::tei:add">
+        <w:color w:val="{$addColour}"/>
+      </xsl:when>
+      <xsl:when test="contains(@rend,'color(')">
+        <w:color w:val="{substring-before(substring-after(@rend,'color('),')')}"/>
+      </xsl:when>
+    </xsl:choose>
+    <!-- background color -->
+    <xsl:if test="contains(@rend,'background(')">
+      <w:highlight w:val="{substring-before(substring-after(@rend,'background('),')')}"/>
+    </xsl:if>
+    <!-- underline -->
+    <xsl:choose>
+      <xsl:when test="contains(@rend,'underline') ">
+        <w:u w:val="single"/>
+      </xsl:when>
+      <xsl:when test="contains(@rend,'underwavyline') ">
+        <w:u w:val="wave"/>
+      </xsl:when>
+      <xsl:when test="contains(@rend,'underdoubleline')">
+        <w:u w:val="double"/>
+      </xsl:when>
+    </xsl:choose>
+    <!-- sub- and superscript -->
+    <xsl:choose>
+      <xsl:when test="contains(@iso:style,'position')">
+        <w:position>
+          <xsl:attribute name="w:val">
+            <xsl:value-of select="normalize-space(substring-before((substring-after(@iso:style,'position:')),';'))"/>
+          </xsl:attribute>
+        </w:position>
+      </xsl:when>
+      <xsl:when test="self::tbx:hi[@style='subscript']">
+        <w:vertAlign w:val="subscript"/>
+      </xsl:when>
+      <xsl:when test="contains(@rend,'subscript')">
+        <w:vertAlign w:val="subscript"/>
+      </xsl:when>
+      <xsl:when test="contains(@rend,'sub')">
+        <w:vertAlign w:val="subscript"/>
+      </xsl:when>
+    </xsl:choose>
+    <xsl:choose>
+      <xsl:when test="self::tbx:hi[@style='superscript']">
+        <w:vertAlign w:val="superscript"/>
+      </xsl:when>
+      <xsl:when test="contains(@rend,'superscript')">
+        <w:vertAlign w:val="superscript"/>
+      </xsl:when>
+      <xsl:when test="contains(@rend,'sup')">
+        <w:vertAlign w:val="sup"/>
+      </xsl:when>
+    </xsl:choose>
+    <!-- text direction -->
+    <xsl:if test="@its:dir!=''">
+      <!-- only handling RTL at the moment -->
+      <xsl:if test="matches(@its:dir,'rtl')">
+        <w:rtl/>
+      </xsl:if>
+    </xsl:if>
+  </xsl:template>
+  <!-- 
+        Footnotes
+    -->
+  <xsl:template name="create-footnote">
+    <xsl:variable name="num">
+      <xsl:number count="tei:note[@place='foot' or @place='bottom' ]" level="any"/>
+    </xsl:variable>
+    <xsl:variable name="id" select="number($num)+1"/>
+    <w:r>
+      <w:rPr>
+        <w:rStyle w:val="FootnoteReference"/>
+      </w:rPr>
+      <w:footnoteReference w:id="{$id}"/>
+    </w:r>
+    <w:r>
+      <w:t xml:space="preserve"> </w:t>
+    </w:r>
+  </xsl:template>
+  <xsl:template name="create-comment">
+    <w:r>
+      <w:rPr>
+        <w:rStyle w:val="CommentReference"/>
+        <w:vanish/>
+      </w:rPr>
+      <xsl:variable name="n">
+        <xsl:number level="any" count="tei:note[@place='comment']"/>
+      </xsl:variable>
+      <w:commentReference w:id="{$n - 1}"/>
+    </w:r>
+  </xsl:template>
+  <!-- 
+        Endnotes
+    -->
+  <xsl:template name="create-endnote">
+    <xsl:variable name="num">
+      <xsl:number count="tei:note[@place='end']" level="any"/>
+    </xsl:variable>
+    <xsl:variable name="id" select="$num+1"/>
+    <w:r>
+      <w:rPr>
+        <w:rStyle w:val="EndnoteReference"/>
+        <w:noProof/>
+      </w:rPr>
+      <w:endnoteReference w:id="{$id}"/>
+    </w:r>
+    <w:r>
+      <w:t xml:space="preserve"> </w:t>
+    </w:r>
+  </xsl:template>
+  <!--
+        Headers and Sections  
+    -->
+  <xsl:template match="tei:head[parent::tei:div or parent::tei:div1 or parent::tei:div2 or parent::tei:div3 or parent::tei:div4 or parent::tei:div5 or parent::tei:div6 or parent::tei:div7]">
+    <xsl:param name="pPr"/>
+    <!-- find out what level we are at -->
+    <xsl:variable name="level">
+      <xsl:value-of select="count(ancestor-or-self::tei:div| ancestor-or-self::tei:div1| ancestor-or-self::tei:div2| ancestor-or-self::tei:div3| ancestor-or-self::tei:div4| ancestor-or-self::tei:div5| ancestor-or-self::tei:div6| ancestor-or-self::tei:div7)"/>
+    </xsl:variable>
+    <xsl:variable name="number">
+      <xsl:number level="any"/>
+    </xsl:variable>
+    <xsl:variable name="getstyle" select="tei:get-headingstyle(.,$level)"/>
+    <xsl:call-template name="block-element">
+      <!-- we want a bookmark for referencing this section -->
+      <xsl:with-param name="bookmark-id">
+        <xsl:value-of select="1000+$number"/>
+      </xsl:with-param>
+      <xsl:with-param name="bookmark-name">
+        <xsl:choose>
+          <xsl:when test="parent::tei:div/@xml:id">
+            <xsl:value-of select="parent::tei:div/@xml:id"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:text>_SECTION_</xsl:text>
+            <xsl:value-of select="1000+$number"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:with-param>
+      <!-- find the correct header style -->
+      <xsl:with-param name="style">
+        <xsl:choose>
+          <xsl:when test="not($pPr  instance of xs:string)">
+            <xsl:value-of select="$pPr/w:pPr/w:pStyle/@w:val"/>
+          </xsl:when>
+          <xsl:when test="string-length($getstyle) &gt; 0">
+            <xsl:call-template name="getStyleName">
+              <xsl:with-param name="in" select="$getstyle"/>
+            </xsl:call-template>
+          </xsl:when>
+          <xsl:when test="parent::tei:div/parent::tei:back">
+            <xsl:text>ANNEX</xsl:text>
+          </xsl:when>
+          <xsl:when test="ancestor::tei:back">
+            <xsl:value-of select="concat('a',$level)"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:call-template name="getStyleName">
+              <xsl:with-param name="in">
+                <xsl:text>heading </xsl:text>
+                <xsl:value-of select="$level"/>
+              </xsl:with-param>
+            </xsl:call-template>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <!-- quoted text; if it surrounds egXML, just pass on -->
+  <xsl:template match="tei:q|tei:said|tei:soCalled">
+    <xsl:choose>
+      <xsl:when test="*[not(tei:is-inline(.))] or parent::tei:cit|parent::tei:div">
+        <xsl:call-template name="block-element"/>
+      </xsl:when>
+      <xsl:when test="tei:l">
+        <xsl:apply-templates/>
+      </xsl:when>
+      <xsl:otherwise>
+        <w:r>
+          <w:t>
+            <xsl:value-of select="$preQuote"/>
+          </w:t>
+        </w:r>
+        <xsl:apply-templates/>
+        <w:r>
+          <w:t>
+            <xsl:value-of select="$postQuote"/>
+          </w:t>
+        </w:r>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <!-- 
+        GI
+    -->
+  <xsl:template match="tei:hi[@rend='specList-elementSpec']">
+    <xsl:apply-templates/>
+  </xsl:template>
+  <xsl:template match="tei:gi">
+    <w:r>
+      <w:t>&lt;</w:t>
+    </w:r>
+    <xsl:apply-templates/>
+    <w:r>
+      <w:t>&gt;</w:t>
+    </w:r>
+  </xsl:template>
+  <xsl:template match="tei:caesura">
+    <w:r>
+      <w:t>   </w:t>
+    </w:r>
+  </xsl:template>
+  <!-- 
+        Handle examples
+    -->
+  <xsl:template match="teix:egXML|tei:p[@rend='eg']">
+    <xsl:param name="simple">false</xsl:param>
+    <xsl:param name="highlight"/>
+    <xsl:call-template name="block-element">
+      <xsl:with-param name="select">
+        <tei:p rend="Special" iso:style="font-family:DejaVu Sans Mono; font-size:18; text-align:left;">
+          <xsl:call-template name="create-egXML-section"/>
+        </tei:p>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <xsl:template match="tei:eg">
+    <xsl:variable name="content">
+      <xsl:apply-templates select="*|processing-instruction()|comment()|text()" mode="egcopy"/>
+    </xsl:variable>
+    <xsl:for-each select="$content">
+      <xsl:call-template name="block-element">
+        <xsl:with-param name="style">Special</xsl:with-param>
+        <xsl:with-param name="select">
+          <tei:p rend="Special" iso:style="font-family:DejaVu Sans Mono; font-size:18;text-align:left;">
+            <xsl:copy-of select="*|processing-instruction()|comment()|text()"/>
+          </tei:p>
+        </xsl:with-param>
+      </xsl:call-template>
+    </xsl:for-each>
+  </xsl:template>
+  <xsl:template match="text()" mode="egcopy">
+    <xsl:for-each select="tokenize(.,'\n')">
+      <xsl:choose>
+        <xsl:when test="position()=last()">
+          <xsl:value-of select="."/>
+        </xsl:when>
+        <xsl:when test=".='' and position()=1">
+          <xsl:value-of select="."/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="."/>
+          <tei:lb/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:for-each>
+  </xsl:template>
+  <xsl:template match="@*|comment()|processing-instruction()" mode="egcopy">
+    <xsl:copy-of select="."/>
+  </xsl:template>
+  <xsl:template match="*" mode="egcopy">
+    <xsl:copy>
+      <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()" mode="egcopy"/>
+    </xsl:copy>
+  </xsl:template>
+  <!-- 
+        Handle TEI tables 
+    -->
+  <xsl:template match="tei:table">
+    <xsl:call-template name="table-body"/>
+    <xsl:call-template name="table-header"/>
+  </xsl:template>
+  <xsl:template name="table-body">
+    <w:tbl>
+      <xsl:choose>
+        <xsl:when test="w:tblPr">
+          <xsl:copy-of select="w:tblPr"/>
+        </xsl:when>
+        <xsl:when test="@rend='attDef'">
+          <w:tblPr>
+            <w:tblW w:w="0" w:type="auto"/>
+            <w:jc w:val="left"/>
+            <w:tblBorders>
+              <w:top w:val="nil" w:space="0" w:color="auto"/>
+              <w:left w:val="nil" w:space="0" w:color="auto"/>
+              <w:bottom w:val="nil" w:space="0" w:color="auto"/>
+              <w:right w:val="nil" w:space="0" w:color="auto"/>
+              <w:insideH w:val="nil" w:space="0" w:color="auto"/>
+              <w:insideV w:val="nil" w:space="0" w:color="auto"/>
+            </w:tblBorders>
+          </w:tblPr>
+        </xsl:when>
+        <xsl:when test="@rend='attList'">
+          <w:tblPr>
+            <w:tblW w:w="0" w:type="auto"/>
+            <w:jc w:val="left"/>
+            <w:tblBorders>
+              <w:top w:val="nil" w:space="0" w:color="auto"/>
+              <w:left w:val="nil" w:space="0" w:color="auto"/>
+              <w:bottom w:val="nil" w:space="0" w:color="auto"/>
+              <w:right w:val="nil" w:space="0" w:color="auto"/>
+              <w:insideH w:val="nil" w:space="0" w:color="auto"/>
+              <w:insideV w:val="nil" w:space="0" w:color="auto"/>
+            </w:tblBorders>
+          </w:tblPr>
+        </xsl:when>
+        <xsl:when test="@rend='norules'">
+          <w:tblPr>
+            <w:tblW w:w="0" w:type="auto"/>
+            <w:jc w:val="left"/>
+            <w:tblBorders>
+              <w:top w:val="nil" w:space="0" w:color="auto"/>
+              <w:left w:val="nil" w:space="0" w:color="auto"/>
+              <w:bottom w:val="nil" w:space="0" w:color="auto"/>
+              <w:right w:val="nil" w:space="0" w:color="auto"/>
+              <w:insideH w:val="nil" w:space="0" w:color="auto"/>
+              <w:insideV w:val="nil" w:space="0" w:color="auto"/>
+            </w:tblBorders>
+          </w:tblPr>
+        </xsl:when>
+        <xsl:when test="@rend='wovenodd'">
+          <w:tblPr>
+            <w:tblW w:w="0" w:type="auto"/>
+            <w:jc w:val="left"/>
+            <w:tblBorders>
+              <w:top w:val="single" w:sz="6" w:space="0" w:color="auto"/>
+              <w:left w:val="single" w:sz="6" w:space="0" w:color="auto"/>
+              <w:bottom w:val="single" w:sz="6" w:space="0" w:color="auto"/>
+              <w:right w:val="single" w:sz="6" w:space="0" w:color="auto"/>
+              <w:insideH w:val="single" w:sz="6" w:space="0" w:color="auto"/>
+              <w:insideV w:val="single" w:sz="6" w:space="0" w:color="auto"/>
+            </w:tblBorders>
+          </w:tblPr>
+        </xsl:when>
+        <xsl:otherwise>
+          <w:tblPr>
+            <w:tblW w:w="0" w:type="auto"/>
+            <w:jc w:val="center"/>
+            <w:tblBorders>
+              <w:top w:val="single" w:sz="6" w:space="0" w:color="auto"/>
+              <w:left w:val="single" w:sz="6" w:space="0" w:color="auto"/>
+              <w:bottom w:val="single" w:sz="6" w:space="0" w:color="auto"/>
+              <w:right w:val="single" w:sz="6" w:space="0" w:color="auto"/>
+              <w:insideH w:val="single" w:sz="6" w:space="0" w:color="auto"/>
+              <w:insideV w:val="single" w:sz="6" w:space="0" w:color="auto"/>
+            </w:tblBorders>
+          </w:tblPr>
+        </xsl:otherwise>
+      </xsl:choose>
+      <xsl:choose>
+        <xsl:when test="html:colgroup">
+          <w:tblGrid>
+            <xsl:for-each select="html:colgroup/html:col">
+              <w:gridCol w:w="{tei:convert-dim-pt20(@width)}"/>
+            </xsl:for-each>
+          </w:tblGrid>
+        </xsl:when>
+        <!-- if it is defined in word's namespace -->
+        <xsl:when test="w:tblGrid">
+          <xsl:copy-of select="w:tblGrid"/>
+        </xsl:when>
+        <xsl:otherwise>
+	  <xsl:variable name="maxcols" select="max(.//tei:row/count(tei:cell))"/>
+          <w:tblGrid>
+            <xsl:for-each select="1 to $maxcols">
+              <w:gridCol w:type="pct" w:w="{round((100 div $maxcols) *  50)}"/>
+            </xsl:for-each>
+          </w:tblGrid>
+        </xsl:otherwise>
+      </xsl:choose>
+      <xsl:apply-templates select="tei:row"/>
+    </w:tbl>
+    <w:p/>
+  </xsl:template>
+  <xsl:template name="table-header">
+    <xsl:if test="tei:head">
+      <xsl:variable name="number">
+        <xsl:number level="any"/>
+      </xsl:variable>
+      <xsl:for-each select="tei:head[1]">
+        <xsl:choose>
+          <xsl:when test="../@xml:id">
+            <xsl:call-template name="block-element">
+              <xsl:with-param name="style">Tabletitle</xsl:with-param>
+              <!-- we want a bookmark for referencing this table -->
+              <xsl:with-param name="bookmark-id">
+                <xsl:value-of select="1000+$number"/>
+              </xsl:with-param>
+              <xsl:with-param name="bookmark-name">
+                <xsl:value-of select="../@xml:id"/>
+              </xsl:with-param>
+            </xsl:call-template>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:call-template name="block-element">
+              <xsl:with-param name="style">Tabletitle</xsl:with-param>
+            </xsl:call-template>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:for-each>
+    </xsl:if>
+  </xsl:template>
+  <xsl:template match="tei:row">
+    <w:tr>
+      <xsl:choose>
+        <xsl:when test="w:trPr">
+          <xsl:copy-of select="w:trPr"/>
+        </xsl:when>
+        <xsl:otherwise> </xsl:otherwise>
+      </xsl:choose>
+      <w:tblPrEx>
+        <w:tblLayout w:type="autofit"/>
+      </w:tblPrEx>
+      <xsl:apply-templates select="tei:cell"/>
+    </w:tr>
+  </xsl:template>
+  <xsl:template match="tei:cell">
+    <w:tc>
+      <xsl:choose>
+        <xsl:when test="w:tcPr">
+          <xsl:copy-of select="w:tcPr"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <w:tcPr>
+            <!--w:tcW w:w="1915" w:type="dxa"/-->
+            <xsl:if test="@cols">
+              <w:gridSpan w:val="{@cols}"/>
+            </xsl:if>
+          </w:tcPr>
+        </xsl:otherwise>
+      </xsl:choose>
+      <xsl:choose>
+        <xsl:when test="tei:note">
+          <xsl:apply-templates/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:call-template name="block-element">
+            <xsl:with-param name="pPr">
+              <w:pPr>
+                <xsl:choose>
+                  <xsl:when test="@rend">
+                    <xsl:variable name="sName">
+                      <xsl:call-template name="getStyleName">
+                        <xsl:with-param name="in" select="@rend"/>
+                      </xsl:call-template>
+                    </xsl:variable>
+                    <xsl:choose>
+                      <xsl:when test="$sName=''">
+                        <w:pStyle w:val="{$TableText}"/>
+                      </xsl:when>
+                      <xsl:otherwise>
+                        <w:pStyle w:val="{$sName}"/>
+                      </xsl:otherwise>
+                    </xsl:choose>
+                  </xsl:when>
+                  <xsl:otherwise>
+                    <w:pStyle w:val="{$TableText}"/>
+                  </xsl:otherwise>
+                </xsl:choose>
+                <xsl:choose>
+                  <xsl:when test="@teidocx:align">
+                    <w:jc w:val="{@teidocx:align}"/>
+                  </xsl:when>
+                  <xsl:when test="parent::tei:row[@role='label']          or @role='label'">
+                    <w:jc w:val="left"/>
+                  </xsl:when>
+                  <xsl:when test="starts-with(.,'[0-9]')">
+                    <w:jc w:val="right"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                    <w:jc w:val="left"/>
+                  </xsl:otherwise>
+                </xsl:choose>
+              </w:pPr>
+            </xsl:with-param>
+          </xsl:call-template>
+        </xsl:otherwise>
+      </xsl:choose>
+      <!-- If we have no children, put an empty p here -->
+      <xsl:if test="not(descendant::text())">
+        <w:p>
+          <w:pPr>
+            <w:pStyle w:val="Tabletext9"/>
+          </w:pPr>
+          <w:r>
+            <w:t/>
+          </w:r>
+        </w:p>
+      </xsl:if>
+    </w:tc>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Turn iso:style attribute back into Word styles for
+        table, or work out some defaults based on @rowsep and
+        @colsep</desc>
+  </doc>
+  <xsl:template name="calculateTableBorders">
+    <xsl:param name="htmlStyles"/>
+    <xsl:choose>
+      <xsl:when test="$htmlStyles!=''">
+        <xsl:for-each select="tokenize($htmlStyles,';')">
+          <xsl:variable name="val">
+            <xsl:value-of select="normalize-space(substring-after(.,':'))"/>
+          </xsl:variable>
+          <xsl:if test="matches(.,'border-top')">
+            <xsl:choose>
+              <xsl:when test="$val=0">
+                <w:top w:val="nil"/>
+              </xsl:when>
+              <xsl:otherwise>
+                <w:top w:val="single" w:sz="{$val}" w:space="0" w:color="auto"/>
+              </xsl:otherwise>
+            </xsl:choose>
+          </xsl:if>
+          <xsl:if test="matches(.,'border-left')">
+            <xsl:choose>
+              <xsl:when test="$val=0">
+                <w:left w:val="nil"/>
+              </xsl:when>
+              <xsl:otherwise>
+                <w:left w:val="single" w:sz="{$val}" w:space="0" w:color="auto"/>
+              </xsl:otherwise>
+            </xsl:choose>
+          </xsl:if>
+          <xsl:if test="matches(.,'border-bottom')">
+            <xsl:choose>
+              <xsl:when test="$val=0">
+                <w:bottom w:val="nil"/>
+              </xsl:when>
+              <xsl:otherwise>
+                <w:bottom w:val="single" w:sz="{$val}" w:space="0" w:color="auto"/>
+              </xsl:otherwise>
+            </xsl:choose>
+          </xsl:if>
+          <xsl:if test="matches(.,'border-right')">
+            <xsl:choose>
+              <xsl:when test="$val=0">
+                <w:right w:val="nil"/>
+              </xsl:when>
+              <xsl:otherwise>
+                <w:right w:val="single" w:sz="{$val}" w:space="0" w:color="auto"/>
+              </xsl:otherwise>
+            </xsl:choose>
+          </xsl:if>
+        </xsl:for-each>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:if test="@rowsep='1' or (not(@rowsep ='0') and ancestor::cals:tgroup/@rowsep='1')">
+          <w:top w:val="single" w:sz="1"/>
+        </xsl:if>
+        <xsl:if test="@colsep='1' or (not(@colsep ='0') and ancestor::cals:tgroup/@colsep='1')">
+          <w:left w:val="single" w:sz="1"/>
+        </xsl:if>
+        <xsl:if test="@rowsep='1' or (not(@rowsep ='0') and ancestor::cals:tgroup/@rowsep='1')">
+          <w:bottom w:val="single" w:sz="1"/>
+        </xsl:if>
+        <xsl:if test="@colsep='1' or (not(@colsep ='0') and ancestor::cals:tgroup/@colsep='1')">
+          <w:right w:val="single" w:sz="1"/>
+        </xsl:if>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <!-- Handle CALS tables -->
+  <xsl:template match="cals:table">
+    <xsl:call-template name="tableheading-from-cals"/>
+    <w:tbl>
+      <w:tblPr>
+        <w:tblW>
+	  <xsl:choose>
+	    <xsl:when test="not($tableWidthPercentage='')">
+	      <xsl:attribute name="w:w">
+		<xsl:value-of  select="round(number($tableWidthPercentage)* 50)"/>
+	      </xsl:attribute>
+	      <xsl:attribute name="w:type">pct</xsl:attribute>
+	    </xsl:when>
+	    <xsl:otherwise>
+	      <xsl:attribute name="w:w">0</xsl:attribute>
+	      <xsl:attribute name="w:type">auto</xsl:attribute>
+	    </xsl:otherwise>
+	  </xsl:choose>
+	</w:tblW>
+        <w:jc w:val="center"/>
+        <w:tblBorders>
+          <xsl:variable name="tblBorders">
+            <xsl:call-template name="calculateTableBorders">
+              <xsl:with-param name="htmlStyles">
+                <xsl:value-of select="@iso:style"/>
+              </xsl:with-param>
+            </xsl:call-template>
+          </xsl:variable>
+          <xsl:choose>
+            <!-- only @frame turns borders on/off. If a
+		   border is 'on' *and* there is a corresponding 
+		   border in $tblBorders (ie created from
+		   info in iso:style) then the size from $tblBorders
+		   overrides the default size -->
+            <xsl:when test="@frame='none'">
+              <w:top w:val="none" w:sz="0" w:space="0" w:color="auto"/>
+              <w:left w:val="none" w:sz="0" w:space="0" w:color="auto"/>
+              <w:bottom w:val="none" w:sz="0" w:space="0" w:color="auto"/>
+              <w:right w:val="none" w:sz="0" w:space="0" w:color="auto"/>
+            </xsl:when>
+            <xsl:when test="@frame='top'">
+              <xsl:choose>
+                <xsl:when test="$tblBorders/w:top">
+                  <xsl:copy-of select="$tblBorders/w:top"/>
+                </xsl:when>
+                <xsl:otherwise>
+                  <w:top w:val="none" w:sz="6" w:space="0" w:color="auto"/>
+                </xsl:otherwise>
+              </xsl:choose>
+              <w:left w:val="none" w:sz="0" w:space="0" w:color="auto"/>
+              <w:bottom w:val="none" w:sz="0" w:space="0" w:color="auto"/>
+              <w:right w:val="none" w:sz="0" w:space="0" w:color="auto"/>
+            </xsl:when>
+            <xsl:when test="@frame='bottom'">
+              <w:top w:val="none" w:sz="0" w:space="0" w:color="auto"/>
+              <w:left w:val="none" w:sz="0" w:space="0" w:color="auto"/>
+              <xsl:choose>
+                <xsl:when test="$tblBorders/w:bottom">
+                  <xsl:copy-of select="$tblBorders/w:bottom"/>
+                </xsl:when>
+                <xsl:otherwise>
+                  <w:bottom w:val="single" w:sz="6" w:space="0" w:color="auto"/>
+                </xsl:otherwise>
+              </xsl:choose>
+              <w:right w:val="none" w:sz="0" w:space="0" w:color="auto"/>
+            </xsl:when>
+            <xsl:when test="@frame='topbot'">
+              <xsl:choose>
+                <xsl:when test="$tblBorders/w:top">
+                  <xsl:copy-of select="$tblBorders/w:top"/>
+                </xsl:when>
+                <xsl:otherwise>
+                  <w:top w:val="none" w:sz="6" w:space="0" w:color="auto"/>
+                </xsl:otherwise>
+              </xsl:choose>
+              <w:left w:val="none" w:sz="0" w:space="0" w:color="auto"/>
+              <xsl:choose>
+                <xsl:when test="$tblBorders/w:bottom">
+                  <xsl:copy-of select="$tblBorders/w:bottom"/>
+                </xsl:when>
+                <xsl:otherwise>
+                  <w:bottom w:val="single" w:sz="6" w:space="0" w:color="auto"/>
+                </xsl:otherwise>
+              </xsl:choose>
+              <w:right w:val="none" w:sz="0" w:space="0" w:color="auto"/>
+            </xsl:when>
+            <xsl:when test="@frame='sides'">
+              <w:top w:val="none" w:sz="0" w:space="0" w:color="auto"/>
+              <xsl:choose>
+                <xsl:when test="$tblBorders/w:left">
+                  <xsl:copy-of select="$tblBorders/w:left"/>
+                </xsl:when>
+                <xsl:otherwise>
+                  <w:left w:val="single" w:sz="6" w:space="0" w:color="auto"/>
+                </xsl:otherwise>
+              </xsl:choose>
+              <w:bottom w:val="none" w:sz="0" w:space="0" w:color="auto"/>
+              <xsl:choose>
+                <xsl:when test="$tblBorders/w:right">
+                  <xsl:copy-of select="$tblBorders/w:right"/>
+                </xsl:when>
+                <xsl:otherwise>
+                  <w:right w:val="single" w:sz="6" w:space="0" w:color="auto"/>
+                </xsl:otherwise>
+              </xsl:choose>
+            </xsl:when>
+            <xsl:when test="@frame='all'">
+              <xsl:choose>
+                <xsl:when test="$tblBorders/w:top">
+                  <xsl:copy-of select="$tblBorders/w:top"/>
+                </xsl:when>
+                <xsl:otherwise>
+                  <w:top w:val="single" w:sz="6" w:space="0" w:color="auto"/>
+                </xsl:otherwise>
+              </xsl:choose>
+              <xsl:choose>
+                <xsl:when test="$tblBorders/w:left">
+                  <xsl:copy-of select="$tblBorders/w:left"/>
+                </xsl:when>
+                <xsl:otherwise>
+                  <w:left w:val="single" w:sz="6" w:space="0" w:color="auto"/>
+                </xsl:otherwise>
+              </xsl:choose>
+              <xsl:choose>
+                <xsl:when test="$tblBorders/w:bottom">
+                  <xsl:copy-of select="$tblBorders/w:bottom"/>
+                </xsl:when>
+                <xsl:otherwise>
+                  <w:bottom w:val="single" w:sz="6" w:space="0" w:color="auto"/>
+                </xsl:otherwise>
+              </xsl:choose>
+              <xsl:choose>
+                <xsl:when test="$tblBorders/w:right">
+                  <xsl:copy-of select="$tblBorders/w:right"/>
+                </xsl:when>
+                <xsl:otherwise>
+                  <w:right w:val="single" w:sz="6" w:space="0" w:color="auto"/>
+                </xsl:otherwise>
+              </xsl:choose>
+            </xsl:when>
+          </xsl:choose>
+          <xsl:choose>
+            <xsl:when test="@rowsep=1">
+              <w:insideH w:val="single" w:sz="6" w:space="0" w:color="auto"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <w:insideH w:val="none" w:sz="6" w:space="0" w:color="auto"/>
+            </xsl:otherwise>
+          </xsl:choose>
+          <xsl:choose>
+            <xsl:when test="@colsep=1">
+              <w:insideV w:val="single" w:sz="6" w:space="0" w:color="auto"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <w:insideV w:val="none" w:sz="6" w:space="0" w:color="auto"/>
+            </xsl:otherwise>
+          </xsl:choose>
+        </w:tblBorders>
+        <w:tblLayout w:type="fixed"/>
+      </w:tblPr>
+      <xsl:variable name="maxcols" select="max(.//cals:row/count(cals:entry))"/>
+      <xsl:choose>
+        <xsl:when test="cals:tgroup/cals:colspec">
+          <w:tblGrid>
+	    <xsl:variable name="totunits" select="sum(cals:tgroup/cals:colspec[ends-with(@colwidth,'*')]/number(substring-before(@colwidth,'*')))"/>
+            <xsl:for-each select="cals:tgroup/cals:colspec">
+              <w:gridCol>
+		  <xsl:choose>
+		    <!-- cell widths are specified in 50th of a percent -->
+		    <xsl:when test="ends-with(@colwidth,'*')">
+		      <xsl:attribute name="w:type">pct</xsl:attribute>
+		      <xsl:attribute name="w:w">
+			<xsl:value-of  select="round((number(substring-before(@colwidth,'*')) * 5000) div $totunits)"/>
+		      </xsl:attribute>
+		    </xsl:when>
+		    <xsl:otherwise>
+		      <xsl:attribute name="w:w">
+			<xsl:value-of select="tei:convert-dim-pt20(@colwidth)"/>
+		      </xsl:attribute>
+		    </xsl:otherwise>
+		  </xsl:choose>
+	      </w:gridCol>
+	    </xsl:for-each>
+          </w:tblGrid>
+        </xsl:when>
+        <xsl:otherwise>
+          <w:tblGrid>
+            <xsl:for-each select="1 to $maxcols">
+              <w:gridCol w:type="pct" w:w="{round((100 div $maxcols) *  50)}"/>
+            </xsl:for-each>
+          </w:tblGrid>
+        </xsl:otherwise>
+      </xsl:choose>
+      <xsl:apply-templates select="cals:tgroup"/>
+    </w:tbl>
+    <w:p/>
+  </xsl:template>
+  <xsl:template name="tableheading-from-cals">
+    <xsl:if test="cals:title">
+      <xsl:for-each select="cals:title[1]">
+        <w:p>
+          <w:pPr>
+            <w:pStyle>
+              <xsl:attribute name="w:val">Tabletitle</xsl:attribute>
+            </w:pStyle>
+          </w:pPr>
+          <xsl:if test="not(normalize-space(.)='')">
+            <w:r>
+              <w:t xml:space="preserve">— </w:t>
+            </w:r>
+          </xsl:if>
+          <xsl:apply-templates/>
+        </w:p>
+      </xsl:for-each>
+      <xsl:for-each select="preceding-sibling::tei:p[@rend='Table units']">
+        <w:p>
+          <w:pPr>
+            <w:pStyle>
+              <xsl:attribute name="w:val">Tableunits</xsl:attribute>
+            </w:pStyle>
+          </w:pPr>
+          <xsl:apply-templates/>
+        </w:p>
+      </xsl:for-each>
+    </xsl:if>
+  </xsl:template>
+  <xsl:template match="cals:tgroup">
+    <xsl:variable name="TABLE">
+      <xsl:copy>
+        <xsl:attribute name="iso:style">
+          <xsl:copy-of select="ancestor::cals:table/@iso:style"/>
+        </xsl:attribute>
+        <xsl:copy-of select="@*"/>
+        <xsl:copy-of select="cals:colspec"/>
+        <xsl:for-each select="cals:tbody|cals:thead">
+          <xsl:copy>
+            <xsl:for-each select="cals:row">
+              <xsl:copy>
+                <xsl:copy-of select="@*"/>
+                <xsl:for-each select="cals:entry">
+                  <xsl:copy>
+                    <xsl:copy-of select="@*"/>
+                    <xsl:apply-templates mode="contents" select="."/>
+                  </xsl:copy>
+                  <xsl:variable name="rows" select="@rowsep"/>
+                  <xsl:variable name="cols" select="@colsep"/>
+                  <xsl:choose>
+                    <xsl:when test="@namest and ancestor::cals:tgroup/cals:colspec[@colname=current()/@namest]">
+                      <xsl:variable name="start">
+                        <xsl:for-each select="ancestor::cals:tgroup/cals:colspec[@colname=current()/@namest]">
+                          <xsl:choose>
+                            <xsl:when test="@colnum">
+                              <xsl:value-of select="@colnum"/>
+                            </xsl:when>
+                            <xsl:otherwise>
+                              <xsl:number/>
+                            </xsl:otherwise>
+                          </xsl:choose>
+                        </xsl:for-each>
+                      </xsl:variable>
+                      <xsl:variable name="end">
+                        <xsl:for-each select="ancestor::cals:tgroup/cals:colspec[@colname=current()/@nameend]">
+                          <xsl:choose>
+                            <xsl:when test="@colnum">
+                              <xsl:value-of select="@colnum"/>
+                            </xsl:when>
+                            <xsl:otherwise>
+                              <xsl:number/>
+                            </xsl:otherwise>
+                          </xsl:choose>
+                        </xsl:for-each>
+                      </xsl:variable>
+                      <xsl:for-each select="ancestor::cals:tgroup/cals:colspec[position()&gt;$start and position()&lt;=$end]">
+                        <cals:entry DUMMY="true" colname="{@colname}" colsep="{$cols}" rowsep="{$rows}"/>
+                      </xsl:for-each>
+                    </xsl:when>
+                    <xsl:when test="@namest">
+                      <xsl:message terminate="yes">ERROR Column <xsl:value-of select="@namest"/> 
+				    <xsl:text> referenced with @namest attribute </xsl:text>
+				    <xsl:text>is not named in the list of  &lt;colspec&gt; elements for this table</xsl:text>
+				  </xsl:message>
+                    </xsl:when>
+                  </xsl:choose>
+                </xsl:for-each>
+              </xsl:copy>
+            </xsl:for-each>
+          </xsl:copy>
+        </xsl:for-each>
+      </xsl:copy>
+    </xsl:variable>
+    <!--
+	<xsl:variable name="count">
+	  <xsl:number level="any"/>
+	</xsl:variable>
+	  <xsl:result-document indent="yes" href="/tmp/T{$count}.xml">
+	    <xsl:copy-of select="$TABLE"/>
+	  </xsl:result-document>
+-->
+    <xsl:for-each select="$TABLE/cals:tgroup">
+      <xsl:apply-templates/>
+    </xsl:for-each>
+  </xsl:template>
+  <xsl:template match="cals:row">
+    <xsl:variable name="borders">
+      <xsl:if test="@colsep='1' or (not(@colsep ='0') and ancestor::cals:tgroup/@colsep='1')">
+        <w:left w:val="single" w:sz="1"/>
+      </xsl:if>
+    </xsl:variable>
+    <xsl:variable name="ROWPOS">
+      <xsl:number/>
+    </xsl:variable>
+    <xsl:variable name="TEMPLATE">
+      <xsl:for-each select="ancestor::cals:tgroup/cals:colspec">
+        <CELL name="{@colname}" num="{@colnum}" rowpos="{$ROWPOS}"/>
+      </xsl:for-each>
+    </xsl:variable>
+    <xsl:variable name="lastColnum">
+      <xsl:value-of select="ancestor::cals:tgroup/cals:colspec[last()]/@colnum"/>
+    </xsl:variable>
+    <xsl:variable name="lastColname">
+      <xsl:value-of select="ancestor::cals:tgroup/cals:colspec[last()]/@colname"/>
+    </xsl:variable>
+    <xsl:variable name="ME" select="."/>
+    <xsl:variable name="topEdge">
+      <xsl:choose>
+        <xsl:when test="parent::cals:tbody">
+          <xsl:if test="not(parent::cals:tbody/preceding-sibling::cals:thead/cals:row)">true</xsl:if>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:if test="not(preceding-sibling::cals:row)">true</xsl:if>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:variable name="bottomEdge">
+      <xsl:choose>
+        <xsl:when test="parent::cals:thead">
+          <xsl:if test="not(parent::cals:thead/following-sibling::cals:tbody/cals:row)">true</xsl:if>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:if test="not(following-sibling::cals:row)">true</xsl:if>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <w:tr>
+      <w:tblPrEx>
+        <w:tblLayout w:type="autofit"/>
+      </w:tblPrEx>
+      <xsl:for-each select="$TEMPLATE/CELL">
+        <xsl:variable name="N" select="@name"/>
+        <xsl:variable name="leftEdge">
+          <xsl:choose>
+            <xsl:when test="$N='c1' or $N='1'">true</xsl:when>
+            <xsl:when test="not(preceding-sibling::CELL)">true</xsl:when>
+          </xsl:choose>
+        </xsl:variable>
+        <xsl:variable name="rightEdge">
+          <xsl:choose>
+            <xsl:when test="not(following-sibling::CELL)">true</xsl:when>
+          </xsl:choose>
+        </xsl:variable>
+        <xsl:choose>
+          <xsl:when test="$ME/cals:entry[@colname=$N and @DUMMY='true']"/>
+          <xsl:when test="$ME/cals:entry[@colname=$N]">
+            <xsl:apply-templates select="$ME/cals:entry[@colname=$N]">
+              <xsl:with-param name="topEdge" select="$topEdge"/>
+              <xsl:with-param name="bottomEdge" select="$bottomEdge"/>
+              <xsl:with-param name="leftEdge" select="$leftEdge"/>
+              <xsl:with-param name="rightEdge" select="$rightEdge"/>
+            </xsl:apply-templates>
+          </xsl:when>
+          <xsl:otherwise>
+            <w:tc>
+              <w:tcPr>
+                <w:vMerge/>
+                <xsl:if test="$borders/w:left">
+                  <w:tcBorders>
+                    <xsl:copy-of select="$borders/w:left"/>
+                  </w:tcBorders>
+                </xsl:if>
+              </w:tcPr>
+              <w:p>    </w:p>
+            </w:tc>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:for-each>
+    </w:tr>
+  </xsl:template>
+  <xsl:template match="cals:entry">
+    <xsl:param name="topEdge"/>
+    <xsl:param name="bottomEdge"/>
+    <xsl:param name="leftEdge"/>
+    <xsl:param name="rightEdge"/>
+    <xsl:variable name="cellBorders">
+      <xsl:call-template name="calculateTableBorders">
+        <xsl:with-param name="htmlStyles">
+          <xsl:value-of select="@iso:style"/>
+        </xsl:with-param>
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:variable name="tableBorders">
+      <xsl:call-template name="calculateTableBorders">
+        <xsl:with-param name="htmlStyles">
+          <xsl:value-of select="ancestor::cals:tgroup/@iso:style"/>
+        </xsl:with-param>
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:variable name="colname" select="@colname"/>
+    <w:tc>
+      <w:tcPr>
+        <xsl:if test="@namest">
+          <xsl:variable name="start">
+            <xsl:for-each select="ancestor::cals:tgroup/cals:colspec[@colname=current()/@namest]">
+              <xsl:choose>
+                <xsl:when test="@colnum">
+                  <xsl:value-of select="@colnum"/>
+                </xsl:when>
+                <xsl:otherwise>
+                  <xsl:number/>
+                </xsl:otherwise>
+              </xsl:choose>
+            </xsl:for-each>
+          </xsl:variable>
+          <xsl:variable name="end">
+            <xsl:for-each select="ancestor::cals:tgroup/cals:colspec[@colname=current()/@nameend]">
+              <xsl:choose>
+                <xsl:when test="@colnum">
+                  <xsl:value-of select="@colnum"/>
+                </xsl:when>
+                <xsl:otherwise>
+                  <xsl:number/>
+                </xsl:otherwise>
+              </xsl:choose>
+            </xsl:for-each>
+          </xsl:variable>
+          <w:gridSpan w:val="{number($end)-number($start)+1}"/>
+        </xsl:if>
+        <xsl:if test="@morerows">
+          <w:vMerge w:val="restart"/>
+        </xsl:if>
+        <!--
+	    <xsl:message><xsl:value-of select="$colname"/>
+	    (<xsl:value-of select="."/>):    <xsl:value-of
+	    select="@rowsep"/> and <xsl:value-of
+	    select="parent::cals:row/preceding-sibling::cals:row[1]/cals:entry[@colname=$colname]/@rowsep"/></xsl:message>
+	    -->
+        <xsl:variable name="borders">
+          <!-- top border -->
+          <xsl:choose>
+            <xsl:when test="parent::cals:row/preceding-sibling::cals:row[1]/cals:entry[@colname=$colname]/@rowsep=0">
+              <w:top w:val="nil"/>
+            </xsl:when>
+            <xsl:when test="$topEdge='true'">
+              <!-- HERE -->
+              <xsl:if test="$tableBorders/w:top[@w:sz]">
+                <w:top w:val="single" w:sz="{$tableBorders/w:top/@w:sz}" w:space="0" w:color="auto"/>
+              </xsl:if>
+            </xsl:when>
+            <xsl:when test="@rowsep=0">
+              <w:top w:val="nil"/>
+            </xsl:when>
+            <xsl:when test="$cellBorders/w:top">
+              <xsl:copy-of select="$cellBorders/w:top"/>
+            </xsl:when>
+          </xsl:choose>
+          <!-- left border -->
+          <xsl:choose>
+            <xsl:when test="$leftEdge='true'">
+              <xsl:if test="$tableBorders/w:left[@w:sz]">
+                <w:left w:val="single" w:sz="{$tableBorders/w:left/@w:sz}" w:space="0" w:color="auto"/>
+              </xsl:if>
+            </xsl:when>
+            <xsl:when test="$cellBorders/w:left">
+              <xsl:copy-of select="$cellBorders/w:left"/>
+            </xsl:when>
+          </xsl:choose>
+          <!-- bottom border -->
+          <xsl:choose>
+            <xsl:when test="$bottomEdge='true'">
+              <xsl:if test="$tableBorders/w:bottom[@w:sz]">
+                <w:bottom w:val="single" w:sz="{$tableBorders/w:bottom/@w:sz}" w:space="0" w:color="auto"/>
+              </xsl:if>
+            </xsl:when>
+            <xsl:when test="@rowsep=0 or parent::cals:row/@rowsep=0">
+              <w:bottom w:val="nil"/>
+            </xsl:when>
+            <xsl:when test="@rowsep=1 or parent::cals:row/@rowsep=1">
+              <xsl:choose>
+                <xsl:when test="$cellBorders/w:bottom">
+                  <xsl:copy-of select="$cellBorders/w:bottom"/>
+                </xsl:when>
+                <xsl:otherwise>
+                  <w:bottom w:val="single" w:sz="6" w:space="0" w:color="auto"/>
+                </xsl:otherwise>
+              </xsl:choose>
+            </xsl:when>
+          </xsl:choose>
+          <!-- right border -->
+          <xsl:choose>
+            <xsl:when test="following-sibling::cals:entry[1]/@colsep=0">
+              <w:right w:val="nil"/>
+            </xsl:when>
+            <xsl:when test="$rightEdge='true'">
+              <xsl:if test="$tableBorders/w:right[@w:sz]">
+                <w:right w:val="single" w:sz="{$tableBorders/w:right/@w:sz}" w:space="0" w:color="auto"/>
+              </xsl:if>
+            </xsl:when>
+            <xsl:when test="@colsep=0">
+              <w:right w:val="nil"/>
+            </xsl:when>
+            <xsl:when test="@colsep=1">
+              <xsl:choose>
+                <xsl:when test="$cellBorders/w:right">
+                  <xsl:copy-of select="$cellBorders/w:right"/>
+                </xsl:when>
+                <xsl:otherwise>
+                  <w:right w:val="single" w:sz="6" w:space="0" w:color="auto"/>
+                </xsl:otherwise>
+              </xsl:choose>
+            </xsl:when>
+          </xsl:choose>
+        </xsl:variable>
+        <xsl:if test="$borders/*">
+          <w:tcBorders>
+            <xsl:copy-of select="$borders/w:top"/>
+            <xsl:copy-of select="$borders/w:left"/>
+            <xsl:copy-of select="$borders/w:bottom"/>
+            <xsl:copy-of select="$borders/w:right"/>
+          </w:tcBorders>
+        </xsl:if>
+        <xsl:if test="@rotate='1'">
+          <w:textDirection w:val="btLr"/>
+        </xsl:if>
+        <xsl:if test="@valign">
+          <w:vAlign>
+            <xsl:attribute name="w:val">
+              <xsl:attribute name="valign">
+                <xsl:choose>
+                  <xsl:when test="@valign='middle'">center</xsl:when>
+                  <xsl:otherwise>
+                    <xsl:value-of select="@valign"/>
+                  </xsl:otherwise>
+                </xsl:choose>
+              </xsl:attribute>
+            </xsl:attribute>
+          </w:vAlign>
+        </xsl:if>
+      </w:tcPr>
+      <xsl:copy-of select="*"/>
+    </w:tc>
+  </xsl:template>
+  <xsl:template match="cals:entry" mode="contents">
+    <xsl:call-template name="block-element">
+      <xsl:with-param name="pPr">
+        <w:pPr>
+          <xsl:choose>
+            <xsl:when test="@rend">
+              <xsl:variable name="sName">
+                <xsl:call-template name="getStyleName">
+                  <xsl:with-param name="in" select="@rend"/>
+                </xsl:call-template>
+              </xsl:variable>
+              <xsl:choose>
+                <xsl:when test="$sName=''">
+                  <w:pStyle w:val="{$TableText}"/>
+                </xsl:when>
+                <xsl:otherwise>
+                  <w:pStyle w:val="{$sName}"/>
+                </xsl:otherwise>
+              </xsl:choose>
+            </xsl:when>
+            <xsl:otherwise>
+              <w:pStyle w:val="{$TableText}"/>
+            </xsl:otherwise>
+          </xsl:choose>
+          <xsl:choose>
+            <xsl:when test="@align">
+              <w:jc w:val="{@align}"/>
+            </xsl:when>
+            <xsl:when test="parent::tei:row[@role='label']    or @role='label'">
+              <w:jc w:val="left"/>
+            </xsl:when>
+            <xsl:when test="starts-with(.,'[0-9]')">
+              <w:jc w:val="right"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <w:jc w:val="left"/>
+            </xsl:otherwise>
+          </xsl:choose>
+        </w:pPr>
+      </xsl:with-param>
+      <xsl:with-param name="nop">
+        <xsl:choose>
+          <xsl:when test="not(text()) and tei:note[(not(@place))]">true</xsl:when>
+          <!--NEN: next when commented to make footnotes in table possible-->
+          <!--<xsl:when test="not(text()) and tei:note[@place='foot']">true</xsl:when>-->
+	    <xsl:otherwise>false</xsl:otherwise>
+        </xsl:choose>
+      </xsl:with-param>
+    </xsl:call-template>
+    <!-- If we have no children, put an empty p here -->
+    <xsl:choose>
+      <xsl:when test="*"/>
+      <xsl:when test="text()"/>
+      <xsl:otherwise>
+        <w:p>
+          <w:pPr>
+            <w:pStyle w:val="Tabletext9"/>
+          </w:pPr>
+          <w:r>
+            <w:t/>
+          </w:r>
+        </w:p>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <!-- 
+	 Inline Templates:
+    -->
+  <xsl:template match="tei:g[@ref='x:tab']">
+    <w:r>
+      <w:tab/>
+    </w:r>
+  </xsl:template>
+  <xsl:template match="tei:c[@rend='ptab']">
+    <w:r>
+      <w:ptab w:relativeTo="margin" w:alignment="{@type}" w:leader="none"/>
+    </w:r>
+  </xsl:template>
+  <xsl:template match="tei:lb">
+    <w:r>
+      <w:br/>
+    </w:r>
+  </xsl:template>
+  <!-- hyperlink -->
+  <xsl:template match="tei:ptr">
+    <xsl:call-template name="linkMe">
+      <xsl:with-param name="anchor">
+        <xsl:choose>
+          <xsl:when test="@type='cit'">[</xsl:when>
+          <xsl:when test="@type='figure'">Figure </xsl:when>
+          <xsl:when test="@type='table'">Table </xsl:when>
+        </xsl:choose>
+        <xsl:choose>
+          <xsl:when test="starts-with(@target,'#')  and id(substring(@target,2))">
+            <xsl:variable name="target" select="substring(@target,2)"/>
+            <xsl:apply-templates select="id($target)" mode="xref"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:value-of select="@target"/>
+          </xsl:otherwise>
+        </xsl:choose>
+        <xsl:choose>
+          <xsl:when test="@type='cit'">]</xsl:when>
+        </xsl:choose>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <xsl:template match="tei:ref[@target]">
+    <xsl:choose>
+      <xsl:when test="starts-with(@target,'#') and id(substring(@target,2))">
+        <xsl:call-template name="linkMe">
+          <xsl:with-param name="anchor">
+            <xsl:apply-templates/>
+          </xsl:with-param>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:apply-templates/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <xsl:template name="linkMeUsingHyperlink">
+    <xsl:param name="anchor"/>
+    <xsl:choose>
+      <xsl:when test="starts-with(@target,'#')">
+        <w:r>
+          <w:fldChar w:fldCharType="begin"/>
+        </w:r>
+        <w:r>
+          <w:instrText>HYPERLINK "<xsl:value-of select="@target"/>" \h</w:instrText>
+        </w:r>
+        <w:r>
+          <w:fldChar w:fldCharType="separate"/>
+        </w:r>
+        <w:r w:rsidR="00765EBE">
+          <w:rPr>
+            <w:rStyle w:val="Hyperlink"/>
+            <w:u w:val="none"/>
+            <xsl:if test="ancestor::tei:cell">
+              <w:sz w:val="18"/>
+            </xsl:if>
+          </w:rPr>
+          <w:t>
+            <xsl:copy-of select="$anchor"/>
+          </w:t>
+        </w:r>
+        <w:r>
+          <w:fldChar w:fldCharType="end"/>
+        </w:r>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:variable name="rid">
+          <xsl:text>rId</xsl:text>
+          <xsl:variable name="n">
+            <xsl:number level="any"/>
+          </xsl:variable>
+          <xsl:value-of select="$n + 3000"/>
+        </xsl:variable>
+        <w:hyperlink r:id="{$rid}">
+          <w:r>
+            <w:rPr>
+              <w:rStyle w:val="Hyperlink"/>
+            </w:rPr>
+            <w:t>
+              <xsl:copy-of select="$anchor"/>
+            </w:t>
+          </w:r>
+        </w:hyperlink>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <xsl:template name="linkMe">
+    <xsl:param name="anchor"/>
+    <!-- create the field codes for the complex field -->
+    <!-- based on information in tei:ref/@tei:rend -->
+    <xsl:variable name="instrText">
+      <xsl:choose>
+        <xsl:when test="starts-with(@target,'#')">
+          <xsl:variable name="target" select="substring(@target,2)"/>
+          <xsl:variable name="rend" select="@rend"/>
+          <xsl:choose>
+            <xsl:when test="contains($rend,'noteref')">
+              <xsl:text>NOTEREF </xsl:text>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:text>REF </xsl:text>
+            </xsl:otherwise>
+          </xsl:choose>
+          <xsl:value-of select="$target"/>
+          <xsl:for-each select="id($target)">
+            <xsl:choose>
+              <xsl:when test="contains($rend,'instr_')">
+                <xsl:if test="contains($rend,'instr_f')">
+                  <xsl:text> \f</xsl:text>
+                </xsl:if>
+                <xsl:if test="contains($rend,'instr_r')">
+                  <xsl:text> \r</xsl:text>
+                </xsl:if>
+                <xsl:if test="contains($rend,'instr_n')">
+                  <xsl:text> \n</xsl:text>
+                </xsl:if>
+              </xsl:when>
+              <xsl:when test="@type='refdoc'"/>
+              <xsl:otherwise>
+                <xsl:text> \n</xsl:text>
+              </xsl:otherwise>
+            </xsl:choose>
+          </xsl:for-each>
+          <xsl:text> \h</xsl:text>
+          <xsl:if test="contains(@rend,'mergeformat')">
+            <xsl:text> \* MERGEFORMAT</xsl:text>
+          </xsl:if>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:text>HYPERLINK "</xsl:text>
+          <xsl:value-of select="@target"/>
+          <xsl:text>" \h</xsl:text>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <w:r>
+      <w:fldChar w:fldCharType="begin"/>
+    </w:r>
+    <w:r>
+      <w:instrText>
+        <xsl:value-of select="$instrText"/>
+      </w:instrText>
+    </w:r>
+    <w:r>
+      <w:fldChar w:fldCharType="separate"/>
+    </w:r>
+    <w:r>
+      <xsl:variable name="rPr">
+        <xsl:apply-templates>
+          <xsl:with-param name="character-style" select="@iso:class"/>
+        </xsl:apply-templates>
+      </xsl:variable>
+      <w:rPr>
+        <xsl:if test="$rPr/w:r/w:rPr/w:rStyle/@w:val">
+          <w:rStyle w:val="{$rPr/w:r/w:rPr/w:rStyle/@w:val}"/>
+        </xsl:if>
+        <xsl:copy-of select="$anchor/w:r/w:rPr/*[not(self::w:rStyle)]"/>
+        <!-- oucs0037: why are we overriding special font styles??
+	       Comment this out for now! -->
+        <!--	  <xsl:if test="ancestor::tei:p[@rend='Special']">
+	    <w:rFonts w:ascii="Courier New" w:hAnsi="Courier New"/>
+	  </xsl:if> -->
+        <xsl:if test="$rPr/w:r/w:rPr/w:rStyle/@w:val='Hyperlink'">
+          <w:u w:val="none"/>
+        </xsl:if>
+      </w:rPr>
+      <xsl:choose>
+        <xsl:when test="$anchor/w:r">
+          <xsl:copy-of select="$anchor/w:r/w:t"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <w:t>
+            <xsl:copy-of select="$anchor"/>
+          </w:t>
+        </xsl:otherwise>
+      </xsl:choose>
+    </w:r>
+    <w:r>
+      <w:fldChar w:fldCharType="end"/>
+    </w:r>
+  </xsl:template>
+  <xsl:template match="tei:bibl|tei:biblStruct" mode="xref">
+    <xsl:number/>
+  </xsl:template>
+  <xsl:template match="tei:note|tei:figure|tei:table|tei:item" mode="xref">
+    <xsl:number/>
+  </xsl:template>
+  <xsl:template match="tei:div" mode="xref">
+    <xsl:choose>
+      <xsl:when test="ancestor::tei:front">
+        <xsl:number count="tei:div" from="tei:front" format="i" level="multiple"/>
+      </xsl:when>
+      <xsl:when test="ancestor::tei:body">
+        <xsl:number count="tei:div" from="tei:body" format="1" level="multiple"/>
+      </xsl:when>
+      <xsl:when test="ancestor::tei:back">
+	   Annex <xsl:number count="tei:div" from="tei:back" format="A.1.1" level="multiple"/>
+         </xsl:when>
+    </xsl:choose>
+  </xsl:template>
+  <!-- 
+       §< Handle elements from different namespaces, such as wordML, wordMathML, MathML ...
+        -->
+  <xsl:template match="w:drawing">
+    <w:r>
+      <xsl:apply-templates select="." mode="iden"/>
+    </w:r>
+  </xsl:template>
+  <xsl:template match="iso:wordObject">
+    <xsl:apply-templates/>
+  </xsl:template>
+  <xsl:template match="w:*">
+    <xsl:if test="ancestor::w:tbl">
+      <xsl:copy>
+        <xsl:copy-of select="@*"/>
+        <xsl:apply-templates/>
+      </xsl:copy>
+    </xsl:if>
+  </xsl:template>
+  <xsl:template match="tei:titlePage">
+    <xsl:apply-templates/>
+  </xsl:template>
+  <xsl:template match="tei:docTitle/tei:titlePart[@type='main']">
+    <xsl:call-template name="block-element">
+      <xsl:with-param name="style">Title</xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <xsl:template match="tei:docTitle/tei:titlePart[not(@type)]">
+    <xsl:call-template name="block-element">
+      <xsl:with-param name="style">Title</xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <xsl:template match="tei:titlePage/tei:titlePart">
+    <xsl:call-template name="block-element">
+      <xsl:with-param name="style">Title</xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <xsl:template match="tei:docTitle/tei:titlePart[@type='sub']">
+    <xsl:call-template name="block-element">
+      <xsl:with-param name="style">Subtitle</xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <xsl:template match="tei:docTitle/tei:titlePart[2]" priority="99">
+    <xsl:call-template name="block-element">
+      <xsl:with-param name="style">Subtitle</xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <xsl:template match="tei:titlePage/tei:docAuthor" priority="99">
+    <xsl:call-template name="block-element">
+      <xsl:with-param name="style">Author</xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <xsl:template match="tei:titlePage/tei:byline" priority="99">
+    <xsl:call-template name="block-element">
+      <xsl:with-param name="style">Author</xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <xsl:template match="tei:titlePage/tei:docDate" priority="99">
+    <xsl:call-template name="block-element">
+      <xsl:with-param name="style">Docdate</xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <!-- place holders, used by ISO profile -->
+  <xsl:template name="getStyleFonts">
+    <xsl:param name="css"/>
+  </xsl:template>
+  <!-- no handling of index terms -->
+  <xsl:template match="tei:index"/>
+  <xsl:template name="applyRendition"/>
+  <xsl:template name="emphasize">
+    <xsl:param name="class"/>
+    <xsl:param name="content"/>
+    <w:r>
+      <xsl:choose>
+        <xsl:when test="$class='titlem'">
+          <w:rPr>
+            <w:i/>
+          </w:rPr>
+        </xsl:when>
+        <xsl:when test="$class='titlej'">
+          <w:rPr>
+            <w:i/>
+          </w:rPr>
+        </xsl:when>
+      </xsl:choose>
+      <w:t>
+        <xsl:attribute name="xml:space">preserve</xsl:attribute>
+        <xsl:choose>
+          <xsl:when test="$class='titles'">
+            <xsl:text>, </xsl:text>
+          </xsl:when>
+          <xsl:when test="$class='titleu'">
+            <xsl:text>‘</xsl:text>
+          </xsl:when>
+          <xsl:when test="$class='titlea'">
+            <xsl:text>‘</xsl:text>
+          </xsl:when>
+        </xsl:choose>
+        <xsl:value-of select="$content"/>
+        <xsl:choose>
+          <xsl:when test="$class='titleu'">
+            <xsl:text>’</xsl:text>
+          </xsl:when>
+          <xsl:when test="$class='titlea'">
+            <xsl:text>’</xsl:text>
+          </xsl:when>
+        </xsl:choose>
+      </w:t>
+    </w:r>
+  </xsl:template>
+  <!-- List Bibl -->
+  <xsl:template match="tei:listBibl">
+    <xsl:for-each select="tei:bibl|tei:biblStruct">
+      <xsl:choose>
+        <xsl:when test="@xml:id">
+          <xsl:variable name="number">
+            <xsl:number level="any"/>
+          </xsl:variable>
+          <xsl:call-template name="block-element">
+            <xsl:with-param name="style">Bibliography</xsl:with-param>
+            <xsl:with-param name="bookmark-id">
+              <xsl:value-of select="9000+$number"/>
+            </xsl:with-param>
+            <xsl:with-param name="bookmark-name">
+              <xsl:value-of select="@xml:id"/>
+            </xsl:with-param>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:call-template name="block-element">
+            <xsl:with-param name="style">Bibliography</xsl:with-param>
+          </xsl:call-template>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:for-each>
+  </xsl:template>
+  <xsl:template name="tei:makeText">
+    <xsl:param name="letters"/>
+    <w:r>
+      <w:t>
+        <xsl:attribute name="xml:space">preserve</xsl:attribute>
+        <xsl:value-of select="$letters"/>
+      </w:t>
+    </w:r>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>
+	Page break
+      </desc>
+  </doc>
+  <xsl:template match="tei:pb">
+    <w:r>
+      <w:br w:type="page"/>
+    </w:r>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>
+        A signature block
+    </desc>
+  </doc>
+  <xsl:template match="tei:signed">
+    <xsl:call-template name="block-element">
+      <xsl:with-param name="style">teisigned</xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>
+	If you meet an inline element with a link inside it, pass by
+	on the other side
+      </desc>
+  </doc>
+  <xsl:template match="tei:title[tei:ref]|tei:hi[tei:ref]" priority="-1">
+    <xsl:apply-templates/>
+  </xsl:template>
+  <xsl:template name="makeSpan">
+    <xsl:apply-templates/>
+  </xsl:template>
+  <xsl:template name="makeExternalLink">
+    <xsl:param name="ptr" as="xs:boolean" select="false()"/>
+    <xsl:param name="dest"/>
+    <xsl:value-of select="$dest"/>
+  </xsl:template>
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/teitodocx.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/odds/tagdocs.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/odds/tagdocs.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/odds/tagdocs.xsl	(revision 258)
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
+                xmlns:cals="http://www.oasis-open.org/specs/tm9901"
+                xmlns:contypes="http://schemas.openxmlformats.org/package/2006/content-types"
+                xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties"
+                xmlns:dc="http://purl.org/dc/elements/1.1/"
+                xmlns:dcmitype="http://purl.org/dc/dcmitype/"
+                xmlns:dcterms="http://purl.org/dc/terms/"
+                xmlns:html="http://www.w3.org/1999/xhtml"
+                xmlns:iso="http://www.iso.org/ns/1.0"
+                xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"
+                xmlns:mml="http://www.w3.org/1998/Math/MathML"
+                xmlns:o="urn:schemas-microsoft-com:office:office"
+                xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"
+                xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
+                xmlns:tbx="http://www.lisa.org/TBX-Specification.33.0.html"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teidocx="http://www.tei-c.org/ns/teidocx/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"
+                xmlns:v="urn:schemas-microsoft-com:vml"
+                xmlns:fn="http://www.w3.org/2005/02/xpath-functions"
+                xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006"
+                xmlns:w10="urn:schemas-microsoft-com:office:word"
+                xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
+                xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml"
+                xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"
+                
+                xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="2.0"
+                exclude-result-prefixes="cp ve o r m v wp w10 w wne mml tbx iso      tei a xs pic fn xsi dc dcterms dcmitype     contypes teidocx teix html cals">
+
+
+   <xsl:template match="tei:seg[@rend='specChildModule']">
+    <w:r>
+      <w:rPr>
+        <w:rStyle w:val="tei{local-name()}"/>
+	<w:b/>
+      </w:rPr>
+      <w:t>
+	<xsl:attribute name="xml:space">preserve</xsl:attribute>
+	<xsl:text> </xsl:text>
+      </w:t>
+      <w:t>
+	<xsl:attribute name="xml:space">preserve</xsl:attribute>
+	<xsl:value-of select="."/>
+      </w:t>
+    </w:r>
+   </xsl:template>
+
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/odds/tagdocs.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/placeholders.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/placeholders.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/placeholders.xsl	(revision 258)
@@ -0,0 +1,205 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
+                xmlns:cals="http://www.oasis-open.org/specs/tm9901"
+                xmlns:contypes="http://schemas.openxmlformats.org/package/2006/content-types"
+                xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties"
+                xmlns:dc="http://purl.org/dc/elements/1.1/"
+                xmlns:dcmitype="http://purl.org/dc/dcmitype/"
+                xmlns:dcterms="http://purl.org/dc/terms/"
+                xmlns:html="http://www.w3.org/1999/xhtml"
+                xmlns:iso="http://www.iso.org/ns/1.0"
+                xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"
+                xmlns:mml="http://www.w3.org/1998/Math/MathML"
+                xmlns:o="urn:schemas-microsoft-com:office:office"
+                xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"
+                xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
+                xmlns:tbx="http://www.lisa.org/TBX-Specification.33.0.html"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teidocx="http://www.tei-c.org/ns/teidocx/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"
+                xmlns:v="urn:schemas-microsoft-com:vml"
+                xmlns:fn="http://www.w3.org/2005/02/xpath-functions"
+                xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006"
+                xmlns:w10="urn:schemas-microsoft-com:office:word"
+                xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
+                xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml"
+                xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"
+                
+                xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="2.0"
+                exclude-result-prefixes="cp ve o r m v wp w10 w wne mml tbx iso      tei a xs pic fn xsi dc dcterms dcmitype     contypes teidocx teix html cals">
+    
+       <xsl:import href="../../common2/header.xsl"/>
+       <xsl:import href="../../common2/i18n.xsl"/>
+
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet for making Word docx files from TEI XML </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: placeholders.xsl 9669 2011-11-07 19:17:54Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc>
+   </doc>
+
+
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+        A callback for any titlepages that belong to the front matter.
+    </desc>
+   </doc>
+    <xsl:template name="titlepages">
+    </xsl:template>
+    
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+	Title of document        
+    </desc>
+   </doc>
+    <xsl:template name="document-title">
+        <xsl:choose>
+            <xsl:when test="/tei:TEI/tei:text/tei:front/tei:titlePage"/>
+            <xsl:when test="/tei:TEI/tei:text/tei:front/tei:docTitle"/>
+            <xsl:when
+		test="/tei:TEI/tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:title[@type='main']">
+                <xsl:for-each select="/tei:TEI/tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:title[@type='main']">
+                    <xsl:call-template name="block-element">
+                        <xsl:with-param name="style">GeneratedTitle</xsl:with-param>
+                    </xsl:call-template>
+                </xsl:for-each>
+                <xsl:for-each select="/tei:TEI/tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:title[@type='sub']">
+                    <xsl:call-template name="block-element">
+                        <xsl:with-param name="style">GeneratedSubtitle</xsl:with-param>
+                    </xsl:call-template>
+                </xsl:for-each>
+	    </xsl:when>
+	    <xsl:otherwise>
+	      <xsl:for-each select="/tei:TEI/tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:title">
+		<xsl:call-template name="block-element">
+		  <xsl:with-param name="style">GeneratedTitle</xsl:with-param>
+		</xsl:call-template>
+	      </xsl:for-each>
+	    </xsl:otherwise>  
+        </xsl:choose>
+    </xsl:template>
+    
+    
+    <xsl:template name="created-by"/>
+    <xsl:template name="headerParts"/>
+
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+        
+        Template for all simple block elements.
+        This template looks for a style definition template (mode="get-style") that
+        matches the block element that is currently processed. If none is specified
+        it copies the style definition from the parent element.
+        
+        If some special rendering is required you should overwrite this template.
+        
+    </desc>
+   </doc>
+    <xsl:template match="*[not(tei:is-inline(.))]" priority="-10">
+        <xsl:param name="style"/>
+        <xsl:param name="pPr"/>
+        <xsl:param name="nop"/>
+        <!-- calculate style definition -->
+        <xsl:variable name="newStyle">
+            <xsl:apply-templates select="." mode="get-style"/>
+        </xsl:variable>
+        <xsl:variable name="styleToPassOn">
+            <xsl:choose>
+                <xsl:when test="string-length($newStyle) &gt; 0">
+                    <xsl:value-of select="$newStyle"/>
+                </xsl:when>
+                <xsl:otherwise>
+                    <xsl:value-of select="$style"/>
+                </xsl:otherwise>
+            </xsl:choose>
+        </xsl:variable>
+
+        <!-- process children  -->
+        <xsl:call-template name="block-element">
+            <xsl:with-param name="style" select="$styleToPassOn"/>
+            <xsl:with-param name="pPr" select="$pPr"/>
+            <xsl:with-param name="nop" select="$nop"/>
+        </xsl:call-template>
+    </xsl:template>
+
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+        
+            Template for all simple inline elements
+            This template looks for a character style definition template (mode="get-style")
+            for the currently processed element.
+        
+    </desc>
+   </doc>
+
+    <xsl:template match="*[tei:is-inline(.)]" priority="-10">
+        <xsl:param name="character-style"/>
+        <xsl:param name="style"/>
+        <xsl:param name="pPr"/>
+        <xsl:variable name="style">
+            <xsl:apply-templates select="." mode="get-style"/>
+        </xsl:variable>
+
+	<xsl:variable name="iso-style">
+	  <xsl:if test=".//tbx:termNote/@iso:style">
+	    <xsl:value-of select=".//tbx:termNote/@iso:style"/>
+	  </xsl:if>
+	</xsl:variable>
+
+        <xsl:variable name="use-style">
+            <xsl:choose>
+                <xsl:when test="(string-length($style) &gt; 0)">
+                    <xsl:value-of select="$style"/>
+                </xsl:when>
+		<xsl:when test="(string-length($iso-style) &gt; 0)">
+		  <xsl:value-of select="$iso-style"/>
+		</xsl:when>
+                <xsl:otherwise>
+                    <xsl:value-of select="$character-style"/>
+                </xsl:otherwise>
+            </xsl:choose>
+        </xsl:variable>
+
+        <xsl:apply-templates>
+	  <xsl:with-param name="character-style" select="$use-style"/>
+        </xsl:apply-templates>
+    </xsl:template>
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/placeholders.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/maths/maths.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/maths/maths.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/maths/maths.xsl	(revision 258)
@@ -0,0 +1,168 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
+		xmlns:rel="http://schemas.openxmlformats.org/package/2006/relationships"
+                xmlns:cals="http://www.oasis-open.org/specs/tm9901"
+                xmlns:contypes="http://schemas.openxmlformats.org/package/2006/content-types"
+                xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties"
+                xmlns:dc="http://purl.org/dc/elements/1.1/"
+                xmlns:dcmitype="http://purl.org/dc/dcmitype/"
+                xmlns:dcterms="http://purl.org/dc/terms/"
+                xmlns:html="http://www.w3.org/1999/xhtml"
+                xmlns:iso="http://www.iso.org/ns/1.0"
+                xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"
+                xmlns:mml="http://www.w3.org/1998/Math/MathML"
+                xmlns:o="urn:schemas-microsoft-com:office:office"
+                xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"
+                xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
+                xmlns:tbx="http://www.lisa.org/TBX-Specification.33.0.html"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teidocx="http://www.tei-c.org/ns/teidocx/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"
+                xmlns:v="urn:schemas-microsoft-com:vml"
+                xmlns:fn="http://www.w3.org/2005/02/xpath-functions"
+                xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006"
+                xmlns:w10="urn:schemas-microsoft-com:office:word"
+                xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
+                xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml"
+                xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"
+                
+                xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="2.0"
+                exclude-result-prefixes="cp ve o r m v wp w10 w wne mml tbx iso   rel  tei a xs pic fn xsi dc dcterms dcmitype     contypes teidocx teix html cals">
+    
+    
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet for making Word docx files from TEI XML </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: maths.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc>
+   </doc>
+
+    <xsl:template match="m:oMath">
+        <xsl:apply-templates select="." mode="iden"/>
+    </xsl:template>
+    
+    
+    <xsl:template match="mml:math">
+      <oMath xmlns="http://schemas.openxmlformats.org/officeDocument/2006/math">
+	        <xsl:apply-templates mode="mml"/>
+      </oMath>
+    </xsl:template>
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+        Process Word objects
+    </desc>
+   </doc>
+   <xsl:template match="w:object">
+     <xsl:variable name="renderingProperties">
+       <xsl:for-each select="..">
+	 <xsl:call-template name="applyRend"/>
+       </xsl:for-each>
+     </xsl:variable>
+     <w:r>
+       <xsl:if test="$renderingProperties/*">
+	 <w:rPr>
+	   <xsl:copy-of select="$renderingProperties"/>
+	 </w:rPr>
+       </xsl:if>
+       <xsl:copy>
+	 <xsl:apply-templates mode="iden"/>
+       </xsl:copy>
+     </w:r>
+   </xsl:template>
+
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+        Image data 
+    </desc>
+   </doc>
+    <xsl:template match="v:imagedata" mode="iden">
+        <xsl:variable name="current" select="@r:id"/>
+	<xsl:copy>
+	    <!-- override r:id -->
+            <xsl:attribute name="r:id">
+	      <xsl:choose>
+		<xsl:when test="$isofreestanding='true'">
+		  <xsl:variable name="me" select="generate-id()"/>
+		  <xsl:for-each select="key('IMAGEDATA',1)">
+		    <xsl:if test="generate-id()=$me">
+		      <xsl:value-of select="concat('rId', string(1000 + position()))"/>
+		    </xsl:if>
+		  </xsl:for-each>
+		</xsl:when>
+		<xsl:otherwise>
+		  <xsl:value-of select="document(concat($wordDirectory,'/word/_rels/document.xml.rels'))//rel:Relationship[@Target=$current]/@Id"/>
+		</xsl:otherwise>
+	      </xsl:choose>
+            </xsl:attribute>
+	</xsl:copy>
+    </xsl:template>
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+        OLE objects
+    </desc>
+   </doc>
+    <xsl:template match="o:OLEObject" mode="iden">
+        <xsl:variable name="current" select="@r:id"/>
+        <xsl:copy>
+            <!-- copy all attributes -->
+            <xsl:copy-of select="@*"/>
+            <!-- set rId -->
+            <xsl:attribute name="r:id">
+	      <xsl:choose>
+		<xsl:when test="$isofreestanding='true'">
+		  <xsl:variable name="me" select="generate-id()"/>
+		  <xsl:for-each select="key('OLEOBJECTS',1)">
+		    <xsl:if test="generate-id()=$me">
+		      <xsl:value-of select="concat('rId', string(2000 + position()))"/>
+		    </xsl:if>
+		  </xsl:for-each>
+		</xsl:when>
+		<xsl:otherwise>
+		  <xsl:value-of select="document(concat($wordDirectory,'/word/_rels/document.xml.rels'))//rel:Relationship[@Target=$current]/@Id"/>
+		</xsl:otherwise>
+	      </xsl:choose>
+            </xsl:attribute>
+	</xsl:copy>
+    </xsl:template>
+    
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/to/maths/maths.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/wordsections/wordsections.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/wordsections/wordsections.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/wordsections/wordsections.xsl	(revision 258)
@@ -0,0 +1,125 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:prop="http://schemas.openxmlformats.org/officeDocument/2006/custom-properties"
+                xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
+                xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties"
+                xmlns:dc="http://purl.org/dc/elements/1.1/"
+                xmlns:dcterms="http://purl.org/dc/terms/"
+                xmlns:dcmitype="http://purl.org/dc/dcmitype/"
+                xmlns:iso="http://www.iso.org/ns/1.0"
+                xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"
+                xmlns:mml="http://www.w3.org/1998/Math/MathML"
+                xmlns:mo="http://schemas.microsoft.com/office/mac/office/2008/main"
+                xmlns:mv="urn:schemas-microsoft-com:mac:vml"
+                xmlns:o="urn:schemas-microsoft-com:office:office"
+                xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"
+                xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
+                xmlns:rel="http://schemas.openxmlformats.org/package/2006/relationships"
+                xmlns:tbx="http://www.lisa.org/TBX-Specification.33.0.html"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teidocx="http://www.tei-c.org/ns/teidocx/1.0"
+                xmlns:v="urn:schemas-microsoft-com:vml"
+                xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006"
+                xmlns:w10="urn:schemas-microsoft-com:office:word"
+                xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
+                xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml"
+                xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"
+                
+                xmlns="http://www.tei-c.org/ns/1.0"
+                version="2.0"
+                exclude-result-prefixes="a cp dc dcterms dcmitype prop     iso m mml mo mv o pic r rel     tbx tei teidocx v xs ve w10 w wne wp">
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet for converting Word docx files to TEI </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: wordsections.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc>
+   </doc>
+    
+    
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+         <p>match strange word sections</p>
+         <p>
+            See comment at begin of document to understand why this template is calling
+            a named template. It matches strange Word "sections".
+        </p>
+      </desc>
+   </doc>
+    <xsl:template match="w:p[w:pPr/w:sectPr]|w:sectPr" mode="paragraph">
+        <xsl:call-template name="paragraph-sectpr"/>
+    </xsl:template>
+    
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+        Template called by a match on w:p[w:pPr/w:sectPr]|w:sectPr
+    </desc>
+   </doc>
+    <xsl:template name="paragraph-sectpr">
+      <xsl:if test="$preserveWordSections='true'">
+        <xsl:for-each select="descendant-or-self::w:sectPr">
+            <milestone unit="section">
+                <xsl:for-each select="w:headerReference">
+                    <tei:header type="{@w:type}" ref="{@r:id}"/>
+                </xsl:for-each>
+                <xsl:for-each select="w:footerReference">
+                    <tei:footer type="{@w:type}" ref="{@r:id}"/>
+                </xsl:for-each>
+                <xsl:if test="w:pgSz/@w:orient='landscape'">
+                    <tei:orientation type="landscape"/>
+                </xsl:if>
+                <xsl:if test="w:pgNumType">
+                    <tei:pageNumbering>
+                        <xsl:if test="w:pgNumType/@w:start">
+                            <xsl:attribute name="start" select="w:pgNumType/@w:start"/>
+                        </xsl:if>
+                        <xsl:if test="w:pgNumType/@w:fmt">
+                            <xsl:attribute name="type" select="w:pgNumType/@w:fmt"/>
+                        </xsl:if>
+                    </tei:pageNumbering>
+                </xsl:if>
+            </milestone>
+        </xsl:for-each>
+      </xsl:if>
+      <xsl:next-match/>
+    </xsl:template>
+    
+    
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/wordsections/wordsections.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/dynamic/fields.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/dynamic/fields.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/dynamic/fields.xsl	(revision 258)
@@ -0,0 +1,135 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:prop="http://schemas.openxmlformats.org/officeDocument/2006/custom-properties"
+                xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
+                xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties"
+                xmlns:dc="http://purl.org/dc/elements/1.1/"
+                xmlns:dcterms="http://purl.org/dc/terms/"
+                xmlns:dcmitype="http://purl.org/dc/dcmitype/"
+                xmlns:iso="http://www.iso.org/ns/1.0"
+                xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"
+                xmlns:mml="http://www.w3.org/1998/Math/MathML"
+                xmlns:mo="http://schemas.microsoft.com/office/mac/office/2008/main"
+                xmlns:mv="urn:schemas-microsoft-com:mac:vml"
+                xmlns:o="urn:schemas-microsoft-com:office:office"
+                xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"
+                xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
+                xmlns:rel="http://schemas.openxmlformats.org/package/2006/relationships"
+                xmlns:tbx="http://www.lisa.org/TBX-Specification.33.0.html"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teidocx="http://www.tei-c.org/ns/teidocx/1.0"
+                xmlns:v="urn:schemas-microsoft-com:vml"
+                xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006"
+                xmlns:w10="urn:schemas-microsoft-com:office:word"
+                xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
+                xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml"
+                xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"
+                
+                xmlns="http://www.tei-c.org/ns/1.0"
+                version="2.0"
+                exclude-result-prefixes="a cp dc dcterms dcmitype prop     iso m mml mo mv o pic r rel     tbx tei teidocx v xs ve w10 w wne wp">
+        
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet for converting Word docx files to TEI </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: fields.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc>
+   </doc>
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+        Handle simple fields
+    </desc>
+   </doc>
+    <xsl:template match="w:fldSimple">
+      <xsl:variable name="rstyle">
+	<xsl:value-of select="w:r/w:rPr/w:rStyle/@w:val"/>
+      </xsl:variable>
+      <xsl:variable name="rends">
+	<r>fldSimple</r>
+	<xsl:if test="contains(@w:instr,'NOTEREF')"><r>noteref</r></xsl:if>
+	<xsl:if test="contains(@w:instr,'MERGEFORMAT')"><r>mergeformat</r></xsl:if>
+	<xsl:if test="contains(@w:instr,' \r')"><r>instr_r</r></xsl:if>
+	<xsl:if test="contains(@w:instr,' \f')"><r>instr_f</r></xsl:if>
+	<xsl:if test="contains(@w:instr,' \n')"><r>instr_n</r></xsl:if>
+      </xsl:variable>
+<!--      <xsl:message>rends=<xsl:copy-of select="$rends"/></xsl:message> -->
+      <xsl:choose>
+	<!-- cross ref -->
+	<!-- <w:fldSimple w:instr=" REF _Ref260736521 \r \h  \* MERGEFORMAT ">            -->
+	<xsl:when test="contains(@w:instr,'NOTEREF _Ref')">
+	  <xsl:variable name="ref">
+	    <xsl:value-of select="substring-before(substring-after(@w:instr,'_'),' ')"/>
+	  </xsl:variable>
+	  <ref>
+	    <xsl:attribute name="rend">
+	      <xsl:value-of select="string-join(($rends/tei:r),' ')"/>
+	    </xsl:attribute>
+	    <xsl:attribute name="target" select="concat('#',$ref)"/>
+	    <xsl:if test="$rstyle!=''">
+	      <xsl:attribute name="iso:class"><xsl:value-of select="$rstyle"/></xsl:attribute>
+	    </xsl:if>
+	    <xsl:apply-templates/>
+	  </ref>	    
+	</xsl:when>
+	<xsl:when test="contains(@w:instr,'REF _Ref')">
+	  <xsl:variable name="ref">
+	    <xsl:value-of select="substring-before(substring-after(@w:instr,'_'),' ')"/>
+	  </xsl:variable>
+	  <ref>
+	    <xsl:attribute name="rend">
+	      <xsl:value-of select="string-join(($rends/tei:r),' ')"/>
+	    </xsl:attribute>
+	    <xsl:attribute name="target" select="concat('#',$ref)"/>
+	    <xsl:if test="$rstyle!=''">
+	      <xsl:attribute name="iso:class"><xsl:value-of select="$rstyle"/></xsl:attribute>
+	    </xsl:if>
+	    <xsl:apply-templates/>
+	  </ref>	    
+	</xsl:when>
+	<xsl:when test="contains(@w:instr,'PAGE')"><!-- Page number -->
+	  <tei:dynamicContent type="pagenumber"/>
+	</xsl:when>
+	<xsl:when test="contains(@w:instr,'SEQ')"/><!-- not sure -->
+	<xsl:otherwise>
+	  <xsl:message terminate="yes">fldSimple: unrecognized type <xsl:value-of select="@w:instr"/></xsl:message>
+	</xsl:otherwise>
+      </xsl:choose>
+    </xsl:template>
+    
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/dynamic/fields.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/dynamic/tests/test-toc-scenario.xml
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/dynamic/tests/test-toc-scenario.xml	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/dynamic/tests/test-toc-scenario.xml	(revision 258)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<x:description 
+    xmlns:x="http://www.jenitennison.com/xslt/xspec"
+    xmlns:tei="http://www.tei-c.org/ns/1.0"
+    xmlns="http://www.tei-c.org/ns/1.0"
+    
+    stylesheet="../toc.xsl">
+    <x:scenario label="test creating table of contents">
+        <x:call template="tocSection"/>
+        <x:expect label="a divGen element should be created">
+            <divGen type="toc"/>
+        </x:expect>
+    </x:scenario>
+</x:description>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/dynamic/tests/test-toc-scenario.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/dynamic/tests/xspec/test-toc-scenario.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/dynamic/tests/xspec/test-toc-scenario.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/dynamic/tests/xspec/test-toc-scenario.xsl	(revision 258)
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:test="http://www.jenitennison.com/xslt/unit-test"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:s="http://www.jenitennison.com/xslt/xspec"
+                xmlns:o="http://www.w3.org/1999/XSL/TransformAliasAlias"
+                xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                xmlns:x="http://www.jenitennison.com/xslt/xspec"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns="http://www.tei-c.org/ns/1.0"
+                version="2.0">
+   <xsl:import href="file:/usr/local/bin/xspec-v0.1/generate-tests-utils.xsl"/>
+   <xsl:import href="file:/Users/amittelbach/EDV%20Dienstleistungen/Kunden/OUCS/TEIISO/workspace/Stylesheets/docx/from/dynamic/toc.xsl"/>
+   <xsl:namespace-alias stylesheet-prefix="o" result-prefix="xsl"/>
+   <xsl:variable name="s:stylesheet-uri" as="xs:string"
+                 select="'file:/Users/amittelbach/EDV%20Dienstleistungen/Kunden/OUCS/TEIISO/workspace/Stylesheets/docx/from/dynamic/toc.xsl'"/>
+   <xsl:output method="xml" indent="yes"/>
+   <xsl:template name="s:main">
+      <xsl:message>
+         <xsl:text>Testing with </xsl:text>
+         <xsl:value-of select="system-property('xsl:product-name')"/>
+         <xsl:text> </xsl:text>
+         <xsl:value-of select="system-property('xsl:product-version')"/>
+      </xsl:message>
+      <xsl:processing-instruction name="xml-stylesheet">type="text/xsl" href="file:/usr/local/bin/xspec-v0.1/format-xspec-report.xsl"</xsl:processing-instruction>
+      <s:report stylesheet="{$s:stylesheet-uri}" date="{current-dateTime()}">
+         <xsl:call-template name="s:d4e1"/>
+      </s:report>
+   </xsl:template>
+   <xsl:template name="s:d4e1">
+      <xsl:message>test creating table of contents</xsl:message>
+      <s:scenario label="test creating table of contents">
+         <s:call template="tocSection"/>
+         <xsl:variable name="actual-result" as="item()*">
+            <xsl:call-template name="tocSection"/>
+         </xsl:variable>
+         <xsl:call-template name="test:report-value">
+            <xsl:with-param name="value" select="$actual-result"/>
+            <xsl:with-param name="wrapper-name" select="'s:result'"/>
+            <xsl:with-param name="wrapper-ns" select="'http://www.jenitennison.com/xslt/xspec'"/>
+         </xsl:call-template>
+         <xsl:call-template name="s:d4e3">
+            <xsl:with-param name="actual-result" select="$actual-result"/>
+         </xsl:call-template>
+      </s:scenario>
+   </xsl:template>
+   <xsl:template name="s:d4e3">
+      <xsl:param name="actual-result" as="item()*" required="yes"/>
+      <xsl:message>    a divGen element should be created</xsl:message>
+      <xsl:variable name="expected-result-doc" as="document-node()">
+         <xsl:document>
+            <divGen type="toc"/>
+         </xsl:document>
+      </xsl:variable>
+      <xsl:variable name="expected-result" select="$expected-result-doc/node()"/>
+      <xsl:variable name="successful" as="xs:boolean"
+                    select="test:deep-equal($expected-result, $actual-result, 2)"/>
+      <xsl:if test="not($successful)">
+         <xsl:message>      FAILED</xsl:message>
+      </xsl:if>
+      <s:test label="a divGen element should be created" successful="{$successful}">
+         <s:expect>
+            <divGen type="toc"/>
+         </s:expect>
+      </s:test>
+   </xsl:template>
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/dynamic/tests/xspec/test-toc-scenario.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/dynamic/tests/xspec/test-toc-scenario-result.xml
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/dynamic/tests/xspec/test-toc-scenario-result.xml	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/dynamic/tests/xspec/test-toc-scenario-result.xml	(revision 258)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?xml-stylesheet type="text/xsl" href="file:/usr/local/bin/xspec-v0.1/format-xspec-report.xsl"?><s:report xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+          xmlns:tei="http://www.tei-c.org/ns/1.0"
+          xmlns:xs="http://www.w3.org/2001/XMLSchema"
+          xmlns:test="http://www.jenitennison.com/xslt/unit-test"
+          xmlns="http://www.tei-c.org/ns/1.0"
+          xmlns:x="http://www.jenitennison.com/xslt/xspec"
+          xmlns:s="http://www.jenitennison.com/xslt/xspec"
+          stylesheet="file:/Users/amittelbach/EDV%20Dienstleistungen/Kunden/OUCS/TEIISO/workspace/Stylesheets/docx/from/dynamic/toc.xsl"
+          date="2009-10-13T11:55:35.44+02:00">
+   <s:scenario label="test creating table of contents">
+      <s:call template="tocSection"/>
+      <s:result>
+         <divGen type="toc"/>
+      </s:result>
+      <s:test label="a divGen element should be created" successful="true">
+         <s:expect>
+            <divGen type="toc"/>
+         </s:expect>
+      </s:test>
+   </s:scenario>
+</s:report>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/dynamic/tests/xspec/test-toc-scenario-result.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/dynamic/tests/xspec/test-toc-scenario-result.html
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/dynamic/tests/xspec/test-toc-scenario-result.html	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/dynamic/tests/xspec/test-toc-scenario-result.html	(revision 258)
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?><html xmlns:test="http://www.jenitennison.com/xslt/unit-test" xmlns="http://www.w3.org/1999/xhtml">
+   <head>
+      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+      <title>Test Report for Users/amittelbach/EDV Dienstleistungen/Kunden/OUCS/TEIISO/workspace/Stylesheets/docx/from/dynamic/toc.xsl</title>
+      <link rel="stylesheet" type="text/css" href="file:/usr/local/bin/xspec-v0.1/test-report.css" />
+   </head>
+   <body>
+      <h1>Test Report</h1>
+      <p>Stylesheet:  <a href="file:/Users/amittelbach/EDV%20Dienstleistungen/Kunden/OUCS/TEIISO/workspace/Stylesheets/docx/from/dynamic/toc.xsl">Users/amittelbach/EDV Dienstleistungen/Kunden/OUCS/TEIISO/workspace/Stylesheets/docx/from/dynamic/toc.xsl</a></p>
+      <p>Tested: 13 Oktober 2009 at 11:55</p>
+      <h2>Contents</h2>
+      <table class="xspec">
+         <col width="85%" />
+         <col width="15%" />
+         <thead>
+            <tr>
+               <th style="text-align: right; font-weight: normal; ">passed/pending/failed/total</th>
+               <th>1/0/0/1</th>
+            </tr>
+         </thead>
+         <tbody>
+            <tr class="successful">
+               <th><a href="#d3e4">test creating table of contents</a></th>
+               <th>1/0/0/1</th>
+            </tr>
+         </tbody>
+      </table>
+      <div id="d3e4">
+         <h2>test creating table of contents</h2>
+         <table class="xspec" id="d3e4">
+            <col width="85%" />
+            <col width="15%" />
+            <thead>
+               <tr>
+                  <th style="text-align: right; font-weight: normal; ">passed/pending/failed/total</th>
+                  <th>1/0/0/1</th>
+               </tr>
+            </thead>
+            <tbody>
+               <tr class="successful">
+                  <th>test creating table of contents</th>
+                  <th>1/0/0/1</th>
+               </tr>
+               <tr class="successful">
+                  <td>a divGen element should be created</td>
+                  <td>Success</td>
+               </tr>
+            </tbody>
+         </table>
+      </div>
+   </body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/dynamic/tests/xspec/test-toc-scenario-result.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/dynamic/toc.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/dynamic/toc.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/dynamic/toc.xsl	(revision 258)
@@ -0,0 +1,213 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:prop="http://schemas.openxmlformats.org/officeDocument/2006/custom-properties"
+                xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
+                xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties"
+                xmlns:dc="http://purl.org/dc/elements/1.1/"
+                xmlns:dcterms="http://purl.org/dc/terms/"
+                xmlns:dcmitype="http://purl.org/dc/dcmitype/"
+                xmlns:iso="http://www.iso.org/ns/1.0"
+                xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"
+                xmlns:mml="http://www.w3.org/1998/Math/MathML"
+                xmlns:mo="http://schemas.microsoft.com/office/mac/office/2008/main"
+                xmlns:mv="urn:schemas-microsoft-com:mac:vml"
+                xmlns:o="urn:schemas-microsoft-com:office:office"
+                xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"
+                xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
+                xmlns:rel="http://schemas.openxmlformats.org/package/2006/relationships"
+                xmlns:tbx="http://www.lisa.org/TBX-Specification.33.0.html"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teidocx="http://www.tei-c.org/ns/teidocx/1.0"
+                xmlns:v="urn:schemas-microsoft-com:vml"
+                xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006"
+                xmlns:w10="urn:schemas-microsoft-com:office:word"
+                xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
+                xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml"
+                xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"
+                
+                xmlns="http://www.tei-c.org/ns/1.0"
+                version="2.0"
+                exclude-result-prefixes="a cp dc dcterms dcmitype prop     iso m mml mo mv o pic r rel     tbx tei teidocx v xs ve w10 w wne wp">
+    
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet for converting Word docx files to TEI </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: toc.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc>
+   </doc>
+    
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc> Process a paragraph with a TOC style, which means parsing
+      the instrText field </desc>
+<!--
+        Handle TOC
+{ TOC [Switches ] }
+
+Builds a table of contents. The TOC field collects entries for a table of 
+contents using heading levels, specified styles (style: A combination of 
+formatting characteristics, such as font, font size, and indentation, that 
+you name and store as a set. When you apply a style, all of the formatting 
+instructions in that style are applied at one time.), or entries specified by 
+TC (Table of Contents Entry) fields. Microsoft Word inserts the TOC field 
+when you use the Index and Tables command from the Reference submenu on the 
+Insert menu.
+
+Note  If the table of contents created by the TOC field affects the 
+pagination of the document, you may have to update the field again to reflect 
+the correct page numbers.
+
+Switches
+
+\a Identifier 
+Lists items captioned with the Caption command (Insert menu, Reference 
+submenu) but omits caption labels and numbers. The identifier corresponds to 
+the caption label. For example, although a caption on page 12 is "Figure 8: 
+Mercury", the field { TOC \a figures } displays entries as 
+"Mercury............12".
+Use the \c switch to build a table of captions with labels and numbers.
+
+\b BookmarkName 
+Collects entries only from the portion of the document marked by the 
+specified bookmark (bookmark: A location or selection of text in a file that 
+you name for reference purposes. Bookmarks identify a location within your 
+file that you can later refer or link to.). 
+\c "SEQIdentifier" 
+Lists figures, tables, charts, or other items that are numbered by a SEQ 
+(Sequence) field. Word uses SEQ fields to number items captioned with the 
+Caption command (Insert menu, Reference submenu). SEQIdentifier, which 
+corresponds to the caption label, must match the identifier in the SEQ field. 
+For example, { TOC \c "tables" } lists all numbered tables. 
+\f EntryIdentifier 
+Builds a table from TC fields. If EntryIdentifier is specified, the table is 
+built only from TC fields with the same identifier (typically a letter). For 
+example, { TOC \f t } builds a table of contents from TC fields such as { TC 
+"Entry Text" \f t }. 
+\h Hyperlinks 
+Inserts TOC entries as hyperlinks (hyperlink: Colored and underlined text or 
+a graphic that you click to go to a file, a location in a file, a Web page on 
+the World Wide Web, or a Web page on an intranet. Hyperlinks can also go to 
+newsgroups and to Gopher, Telnet, and FTP sites.). 
+\l Levels 
+Builds a table of contents from TC fields that assign entries to one of the 
+specified levels. For example, { TOC \l 1-4 } builds a table of contents from 
+TC fields that assign entries to levels 1-4. TC fields that assign entries to 
+lower levels are skipped. 
+\n Levels 
+Omits page numbers from the table of contents. Page numbers are omitted from 
+all levels unless a range of entry levels is specified. For example, { TOC \n 
+3-4 } omits page numbers from levels 3 and 4. Delete this switch to include 
+page numbers. 
+\o "Headings" 
+Builds a table of contents from paragraphs formatted with built-in heading 
+styles (heading style: Formatting applied to a heading. Microsoft Word has 
+nine different built-in styles: Heading 1 through Heading 9.). For example, { 
+TOC \o "1-3" } lists only headings formatted with the styles Heading 1 
+through Heading 3. If no heading range is specified, all heading levels used 
+in the document are listed. Enclose the range numbers in quotation marks. 
+\p "Separators" 
+Specifies the characters that separate an entry and its page number. For 
+example, the field { TOC \p "— " }, with an em dash, displays a result such 
+as "Selecting Text— 53." The default is a tab with leader dots. You can use 
+up to five characters, which must be enclosed in quotation marks. 
+\s Identifier 
+Includes a number such as a chapter number before the page number. The 
+chapter or other item must be numbered with a SEQ field. Identifier must 
+match the identifier in the SEQ field. For example, if you insert { SEQ 
+chapter } before each chapter heading, { TOC \o "1-3" \s chapter } displays 
+page numbers as 2-14, where "2" is the chapter number. 
+\d "Separator" 
+When used with the \s switch, specifies the number of characters that 
+separate the sequence numbers and page numbers. Enclose the characters in 
+quotation marks. Word uses a hyphen (-) if no \d switch is specified. In the 
+table of contents generated by { TOC \o "1-3" \s chapter \d ":" }, a colon 
+(:) separates chapter numbers and page numbers— for example, "2:14." 
+\t "Style,Level, Style,Level,..." 
+Builds a table of contents from paragraphs formatted with styles other than 
+the built-in heading styles. For example, { TOC \t "chaptertitle,1, 
+chapterhead,2" } builds a table of contents from paragraphs formatted with 
+the styles "chaptertitle" and "chapterhead." The number after each style name 
+indicates the table of contents entry level that corresponds to that style. 
+You can use both the \o switch and the \t switch to build a table of 
+contents from built-in heading styles and other styles.
+
+\u 
+Builds a table of contents by using the applied paragraph outline level 
+(outline level: Paragraph formatting you can use to assign a hierarchical 
+level (Level 1 through Level 9) to paragraphs in your document. For example, 
+after you assign outline levels, you can work with the document in outline 
+view or in the Document Map.). 
+\w 
+Preserves tab entries within table entries. 
+\x 
+Preserves newline characters within table entries. 
+\z 
+Hides tab leader and page numbers in Web layout view (Web layout view: A 
+view of a document as it will appear in a Web browser. For example, the 
+document appears as one long page (without page breaks) and text and tables 
+wrap to fit in the window.).
+-->
+   </doc>
+    <xsl:template name="tocSection">
+        <divGen type="toc"/>
+    </xsl:template>
+
+    <xsl:template name="_tocSection">
+      <xsl:variable name="typestring">
+	<xsl:value-of select="(.//w:instrText)[1]"/>
+      </xsl:variable>
+	<xsl:message>TOC: test [<xsl:value-of select="$typestring"/>]</xsl:message>
+    <xsl:analyze-string select='$typestring' regex='\s*([A-z]+)\s+(.*)\s+"([^,]+),(.*)"\s*'>
+      <xsl:matching-substring>
+	<xsl:message>TOC ok, found [<xsl:value-of select="regex-group(1)"/>][<xsl:value-of select="regex-group(2)"/>][<xsl:value-of select="regex-group(3)"/>]</xsl:message>
+      </xsl:matching-substring>
+      <xsl:non-matching-substring>
+	<xsl:message>TOC panic on <xsl:value-of select="."/></xsl:message>
+      </xsl:non-matching-substring>
+    </xsl:analyze-string>
+<!--
+        <w:instrText xml:space="preserve"> TOC \o "1-2" \h \z \t "ITLP H3,3" </w:instrText>
+
+        <w:instrText xml:space="preserve"> TOC \h \z \t "ITLP Ex Heading,2" </w:instrText>
+-->
+        <divGen type="toc"/>
+    </xsl:template>
+    
+    
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/dynamic/toc.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/pass0/pass0.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/pass0/pass0.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/pass0/pass0.xsl	(revision 258)
@@ -0,0 +1,132 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns="http://www.tei-c.org/ns/1.0"
+                xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006"
+                xmlns:o="urn:schemas-microsoft-com:office:office"
+                xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
+		xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"
+                xmlns:v="urn:schemas-microsoft-com:vml"
+                xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"
+                xmlns:w10="urn:schemas-microsoft-com:office:word"
+                xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
+                xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml"
+                xmlns:mml="http://www.w3.org/1998/Math/MathML"
+                xmlns:tbx="http://www.lisa.org/TBX-Specification.33.0.html"
+                
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="2.0"
+                exclude-result-prefixes="ve o r m v wp w10 w wne mml
+					 tei tbx">
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI Utility stylesheet for making Word docx files from TEI XML (see tei-docx.xsl)</p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: pass0.xsl 10152 2012-03-12 22:58:02Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc>
+   </doc>
+
+  <xsl:key name="STYLES" match="w:style" use="@w:styleId"/>
+  <xsl:param name="word-directory">..</xsl:param>
+  <xsl:param name="debug">false</xsl:param>  
+  
+  <xsl:template match="@*|text()|comment()|processing-instruction()" mode="pass0">
+      <xsl:copy-of select="."/>
+  </xsl:template>
+  
+  <xsl:template match="w:body" mode="pass0">
+    <xsl:copy>
+      <xsl:choose>
+	<xsl:when test="w:p[tei:is-firstlevel-heading(.)]"/>
+	<xsl:otherwise>
+	  <w:p>
+	    <w:pPr>
+	      <w:pStyle w:val="Heading 1"/>
+	    </w:pPr>
+	    <w:r>
+	      <w:rPr>
+		<w:sz w:val="36"/>
+	      </w:rPr>
+	      <w:t/>
+	    </w:r>
+	  </w:p>
+	</xsl:otherwise>
+      </xsl:choose>
+      <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()" mode="pass0"/>
+    </xsl:copy>
+  </xsl:template>
+
+  
+  <xsl:template match="*" mode="pass0">
+      <xsl:copy>
+         <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()" mode="pass0"/>
+      </xsl:copy>
+  </xsl:template>
+
+  <xsl:template match="w:pStyle/@w:val|w:rStyle/@w:val" mode="pass0">
+      <xsl:variable name="old" select="."/>
+      <xsl:variable name="new">
+	<xsl:for-each select="$styledoc">
+	  <xsl:value-of select="key('STYLES',$old)/w:name/@w:val"/>
+	</xsl:for-each>
+      </xsl:variable>
+      <xsl:attribute name="w:val">
+         <xsl:choose>
+	   <xsl:when test="$new=''">
+	     <xsl:value-of select="$old"/>
+	     <xsl:if test="$debug='true'">
+	       <xsl:message>! style <xsl:value-of select="$old"/> ... NOT FOUND    </xsl:message>
+	     </xsl:if>
+	   </xsl:when>
+	   <xsl:when test="not($new=$old)">
+	     <xsl:if test="$debug='true'">
+	       <xsl:message>! style <xsl:value-of select="$old"/> ... CHANGED ...  <xsl:value-of select="$new"/>
+	       </xsl:message>
+	     </xsl:if>
+	     <xsl:value-of select="$new"/>
+	   </xsl:when>
+	   <xsl:otherwise>
+	     <xsl:value-of select="$old"/>
+	   </xsl:otherwise>
+         </xsl:choose>
+      </xsl:attribute>
+  </xsl:template>
+  
+
+  <xsl:template
+      match="w:r[w:instrText][normalize-space(w:instrText)='']" mode="pass0"/>
+
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/pass0/pass0.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/docxtotei.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/docxtotei.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/docxtotei.xsl	(revision 258)
@@ -0,0 +1,496 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:prop="http://schemas.openxmlformats.org/officeDocument/2006/custom-properties"
+                xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
+                xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties"
+                xmlns:dc="http://purl.org/dc/elements/1.1/"
+                xmlns:dcterms="http://purl.org/dc/terms/"
+                xmlns:dcmitype="http://purl.org/dc/dcmitype/"
+                xmlns:iso="http://www.iso.org/ns/1.0"
+                xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"
+                xmlns:mml="http://www.w3.org/1998/Math/MathML"
+                xmlns:mo="http://schemas.microsoft.com/office/mac/office/2008/main"
+                xmlns:mv="urn:schemas-microsoft-com:mac:vml"
+                xmlns:o="urn:schemas-microsoft-com:office:office"
+                xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"
+                xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
+                xmlns:rel="http://schemas.openxmlformats.org/package/2006/relationships"
+                xmlns:tbx="http://www.lisa.org/TBX-Specification.33.0.html"
+		xmlns:html="http://www.w3.org/1999/xhtml"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teidocx="http://www.tei-c.org/ns/teidocx/1.0"
+                xmlns:v="urn:schemas-microsoft-com:vml"
+                xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006"
+                xmlns:w10="urn:schemas-microsoft-com:office:word"
+                xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
+                xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml"
+                xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"
+                
+                xmlns="http://www.tei-c.org/ns/1.0"
+                version="2.0"
+                exclude-result-prefixes="a cp dc dcterms dcmitype prop
+					  iso m mml mo mv o pic r rel   html    tbx tei teidocx v xs ve w10 w wne wp">
+
+	  <xsl:import href="../../common2/functions.xsl"/>
+	  <xsl:import href="../utils/maths/omml2mml.xsl"/>
+	  <xsl:import href="../utils/functions.xsl"/>
+	  <xsl:import href="../utils/variables.xsl"/>
+	  <xsl:import href="../utils/identity/identity.xsl"/>
+
+	  <xsl:import href="parameters.xsl"/>
+	  <xsl:include href="pass0/pass0.xsl"/>
+	  <xsl:include href="pass2/pass2.xsl"/>
+	
+	  <xsl:include href="dynamic/fields.xsl"/>
+	  <xsl:include href="dynamic/toc.xsl"/>
+	  <xsl:include href="graphics/graphics.xsl"/>
+	  <xsl:include href="lists/lists.xsl"/>
+	  <xsl:include href="marginals/marginals.xsl"/>
+	  <xsl:include href="maths/maths.xsl"/>
+	  <xsl:include href="paragraphs/paragraphs.xsl"/>
+	  <xsl:include href="tables/tables.xsl"/>
+	  <xsl:include href="templates/tei-templates.xsl"/>
+	  <xsl:include href="textruns/textruns.xsl"/>
+	  <xsl:include href="utils/utility-templates.xsl"/>
+	  <xsl:include href="wordsections/wordsections.xsl"/>
+	
+	
+	  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet for converting Word docx files to TEI </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: docxtotei.xsl 10200 2012-03-30 15:45:18Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc>
+   </doc>
+
+	  <xsl:variable name="processor">
+		    <xsl:value-of select="system-property('xsl:vendor')"/>
+	  </xsl:variable>
+	  <xsl:variable name="digits">1234567890</xsl:variable>
+	  <xsl:variable name="characters">~!@#$%^&amp;*()&lt;&gt;{}[]|:;,.?`'"=+-_</xsl:variable>
+
+
+	  <xsl:variable name="wordDirectory">
+	    <xsl:value-of
+		select="translate($word-directory,'\\','/')"/>
+	  </xsl:variable>
+	  <xsl:variable name="docProps" select="doc(concat($wordDirectory,'/docProps/core.xml'))"/>
+	  <xsl:variable name="styledoc" select="doc(concat($wordDirectory,'/word/styles.xml'))"/>
+
+	<xsl:strip-space elements="*"/>
+	  <xsl:preserve-space elements="w:t"/>
+	  <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
+
+	  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+         <p>The main template that starts the conversion from docx to TEI</p>
+	 <p><b>IMPORTING STYLESHEETS AND OVERRIDING MATCHED TEMPLATES:</b></p>
+		
+	<p>When importing a stylesheet (xsl:import) all the templates
+	in the imported stylesheet get a lower import-precedence than
+	the ones in the importing stylesheet. If the importing
+	stylesheet wants to override, let's say a general template to
+	match all &lt;w:p&gt; elements where no more specialized rule
+	applies it can't, since it will automatically override all
+	w:p[somepredicate] template in the imported stylesheet as
+	well.  In this case we have outsourced the processing of the
+	general template into a named template and all the imported
+	stylesheet does is to call the named template. Now, the
+	importing stylesheet can simply override the named template,
+	and everything works out fine.</p>
+		
+	<p>See templates: - w:p (mode: paragraph)</p>
+	
+	<p>Modes:</p>
+	<ul>
+	  <li>pass0: a normalization process for styles. Can also
+	  detect illegal styles.</li>
+	  
+	  <li>pass2: templates that apply in the second stage
+	  of the conversion, cleaning TEI elements created in the
+	  first ise."</li>
+	  
+	  <li>inSectionGroup: defines a template that works on a
+	  group of consecutive elements (w:p or w:tbl elements) that
+	  form a section (a normal section, not to be confused with
+	  w:sectPr).</li>
+	  
+	  <li>paragraph: defines that the template
+	  works on an individual element (usually
+	  starting with a w:p element).  </li>
+	  
+	  <li>iden: simply copies the content</li>
+	</ul>
+	
+      </desc>
+   </doc>
+   <xsl:template match="/">
+     <!-- Do an initial normalization and store everything in $pass0 -->
+     <xsl:variable name="pass0">
+       <xsl:apply-templates mode="pass0"/>
+     </xsl:variable>
+     
+     <!-- Do the main transformation and store everything in the variable pass1 -->
+     <xsl:variable name="pass1">
+       <xsl:for-each select="$pass0">
+	 <xsl:apply-templates/>
+       </xsl:for-each>
+     </xsl:variable>		  
+     <!-- debug
+	 <xsl:result-document href="/tmp/foo.xml">
+	 <xsl:copy-of select="$pass1"/>
+	 </xsl:result-document>
+     -->
+     <!-- Do the final parse and create valid TEI -->
+
+     <xsl:apply-templates select="$pass1" mode="pass2"/>
+     
+     <xsl:call-template name="fromDocxFinalHook"/>
+   </xsl:template>
+   
+   <xsl:template name="fromDocxFinalHook"/>
+   
+   <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+     <desc>
+		Main document template
+     </desc>
+   </doc>
+	  <xsl:template match="w:document">
+	    <TEI>
+	      <!-- create teiHeader -->
+	      <xsl:call-template name="create-tei-header"/>
+	      
+	      <!-- convert main and back matter -->
+	      <xsl:apply-templates select="w:body"/>
+	    </TEI>
+	  </xsl:template>
+
+
+	  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+	    <desc>
+	      Create the basic text; worry later about dividing it up
+	    </desc>
+	  </doc>
+	  <xsl:template match="w:body">
+	    <text>
+	      <!-- Create forme work -->
+	      <xsl:call-template name="extract-forme-work"/>
+	      
+	      <!-- create TEI body -->
+	      <body>
+		<xsl:call-template name="mainProcess"/>
+	      </body>
+	    </text>
+	  </xsl:template>
+
+	  
+	  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+	    <desc>
+	      Process the text by high-level divisions
+	    </desc>
+	  </doc>
+	  <xsl:template name="mainProcess">
+	    <!-- 
+		 group all paragraphs that form a first level section.
+	    -->
+	    <xsl:for-each-group select="w:sdt|w:p|w:tbl"
+				group-starting-with="w:p[tei:is-firstlevel-heading(.)]">
+	      
+	      <xsl:choose>
+		
+		<!-- We are dealing with a first level section, we now have
+		     to further divide the section into subsections that we can then
+		     finally work on -->
+		
+		<xsl:when test="tei:is-heading(.)">
+		  <xsl:call-template name="group-by-section"/>
+		</xsl:when>
+		
+		<!-- We have found some loose paragraphs. These are most probably
+		     front matter paragraps. We can simply convert them without further
+		     trying to split them up into sub sections. -->
+		<xsl:otherwise>
+		  <xsl:apply-templates select="." mode="inSectionGroup"/>
+		</xsl:otherwise>
+	      </xsl:choose>
+	    </xsl:for-each-group>
+	    
+	    <!-- I have no idea why I need this, but I apparently do. 
+		 //TODO: find out what is going on-->
+	    <xsl:apply-templates select="w:sectPr" mode="paragraph"/>
+	  </xsl:template>
+	  
+	  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+	    <desc>
+	      <p>Bookmarks in section mode</p>
+	      <p>
+		There are certain elements that we don't really care about, but that
+		force us to regroup everything from the next sibling on.
+		
+		@see grouping in construction of headline outline.
+	      </p>
+	    </desc>
+	  </doc>
+	  <xsl:template match="w:bookmarkStart|w:bookmarkEnd"
+			mode="inSectionGroup">
+	    <xsl:for-each-group select="current-group() except ." group-adjacent="1">
+	      <xsl:apply-templates select="." mode="inSectionGroup"/>
+	    </xsl:for-each-group>
+	  </xsl:template>
+
+
+	  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+	    <desc>
+	      <p>Bookmarks in normal mode</p>
+	      <p>Copy bookmarks for processing in pass 2</p>
+	    </desc>
+	  </doc>
+	  <xsl:template match="w:bookmarkStart|w:bookmarkEnd" >
+	    <xsl:choose>
+	    <xsl:when test="starts-with(@w:name,'_Ref')">
+	      <xsl:copy-of select="."/>
+	    </xsl:when>
+	    <xsl:when test="self::w:bookmarkEnd"/>
+	    <xsl:otherwise>
+	      <ANCHOR>
+		<xsl:attribute name="xml:id" select="substring(@w:name,2)"/>
+	      </ANCHOR>
+	    </xsl:otherwise>
+	    </xsl:choose>
+	  </xsl:template>
+	  
+	  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+         <p>Grouping consecutive elements that belong together</p>
+         <p>
+		We are now working on a group of all elements inside some group bounded by
+		headings. These need to be further split up into smaller groups for figures,
+		list etc. and into individual groups for simple paragraphs...
+		</p>
+      </desc>
+	  </doc>
+	  <xsl:template match="w:tbl|w:p" mode="inSectionGroup">
+	    
+	    <!-- 
+		 We are looking for:
+		 - Lists -> 1
+		 - Table of Contents -> 2
+		 - Figures -> 3
+		 
+		 Anything else is assigned a number of position()+100. This should be
+		 sufficient even if we find lots more things to group.
+	    -->
+	    <xsl:for-each-group 
+		select="current-group()"
+		group-adjacent="if       (tei:is-list(.))  then 1
+				else  if (tei:is-toc(.))   then 2
+				else  if (tei:is-figure(.)) then 3
+				else  if (tei:is-line(.)) then 4
+				else position() + 100">
+	      
+	      <!-- For each defined grouping call a specific template. If there is no
+		   grouping defined, apply templates with mode
+		   paragraph -->
+	      <xsl:choose>
+		<xsl:when test="current-grouping-key()=1">
+		  <xsl:call-template name="listSection"/>
+		</xsl:when>
+		<xsl:when test="current-grouping-key()=2">
+		  <xsl:call-template name="tocSection"/>
+		</xsl:when>
+		<xsl:when test="current-grouping-key()=3">
+		  <xsl:call-template name="figureSection"/>
+		</xsl:when>
+		<xsl:when test="current-grouping-key()=4">
+		  <xsl:call-template name="lineSection"/>
+		</xsl:when>
+		<!-- it is not a defined grouping .. apply templates -->
+		<xsl:otherwise>
+		  <xsl:apply-templates select="." mode="paragraph"/>
+		</xsl:otherwise>
+	      </xsl:choose>
+	    </xsl:for-each-group>
+	  </xsl:template>
+
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+	Creating a group of a figure
+      </desc>
+   </doc>
+    <xsl:template name="figureSection">
+      <figure>
+	<xsl:for-each select="current-group()">
+	  <xsl:apply-templates select="." mode="paragraph"/>
+	</xsl:for-each>
+      </figure>
+    </xsl:template>
+
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+	Creating a gloss list
+      </desc>
+   </doc>
+
+    <xsl:template name="glossListSection">
+      <list type="gloss">
+	<xsl:for-each select="current-group()">
+	  <xsl:apply-templates select="." mode="paragraph"/>
+	</xsl:for-each>
+      </list>
+    </xsl:template>
+
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+	Creating a group of a figure
+      </desc>
+   </doc>
+    <xsl:template name="lineSection">
+      <lg>
+	<xsl:for-each select="current-group()">
+	  <xsl:apply-templates select="." mode="paragraph"/>
+	</xsl:for-each>
+      </lg>
+    </xsl:template>
+
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+	Groups the document by headings and thereby creating the document structure. 
+      </desc>
+   </doc>
+   <xsl:template name="group-by-section">
+     <xsl:variable name="Style" select="w:pPr/w:pStyle/@w:val"/>
+     <xsl:variable name="NextHeader" select="tei:get-nextlevel-header($Style)"/>
+     <div>
+       <!-- generate the head -->
+       <xsl:call-template name="generate-section-heading">
+	 <xsl:with-param name="Style" select="$Style"/>
+       </xsl:call-template>
+       <!-- Process sub-sections -->
+       <xsl:for-each-group select="current-group() except ."
+			   group-starting-with="w:p[w:pPr/w:pStyle/@w:val=$NextHeader]">
+	 <xsl:choose>
+	   <xsl:when test="tei:is-heading(.)">
+	     <xsl:call-template name="group-by-section"/>
+	   </xsl:when>
+	   <xsl:otherwise>
+	     <xsl:apply-templates select="." mode="inSectionGroup"/>
+	   </xsl:otherwise>
+	 </xsl:choose>
+       </xsl:for-each-group>
+     </div>
+   </xsl:template>
+   
+
+   <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+     <desc>
+       <p>Looks through the document to find forme work related sections.</p>
+       <p>
+	 Creates a &lt;fw&gt; element for each forme work related section. These include
+	 running headers and footers. The corresponding elements in OOXML are w:headerReference
+	 and w:footerReference. These elements only define a reference that to a header or
+	 footer definition file. The reference itself is resolved in the file word/_rels/document.xml.rels.
+       </p>
+     </desc>
+   </doc>
+	  <xsl:template name="extract-forme-work">
+	    <xsl:if test="preserveWordHeadersFooters='true'">
+		    <xsl:for-each-group select="//w:headerReference|//w:footerReference" group-by="@r:id">
+			      <fw>
+				        <xsl:attribute name="xml:id">
+					          <xsl:value-of select="@r:id"/>
+				        </xsl:attribute>
+				        <xsl:attribute name="type">
+					          <xsl:choose>
+						            <xsl:when test="self::w:headerReference">header</xsl:when>
+						            <xsl:otherwise>footer</xsl:otherwise>
+					          </xsl:choose>
+				        </xsl:attribute>
+
+				        <xsl:variable name="rid" select="@r:id"/>
+				        <xsl:variable name="h-file">
+					          <xsl:value-of select="document(concat($wordDirectory,'/word/_rels/document.xml.rels'))//rel:Relationship[@Id=$rid]/@Target"/>
+				        </xsl:variable>
+
+				        <!-- for the moment, just copy content -->
+				<xsl:if test="doc-available(concat($wordDirectory,'/word/', $h-file))">
+					          <xsl:for-each-group select="document(concat($wordDirectory,'/word/', $h-file))/*[1]/w:*"
+                                   group-adjacent="1">
+						            <xsl:apply-templates select="." mode="inSectionGroup"/>
+					          </xsl:for-each-group>
+				        </xsl:if>
+
+			      </fw>
+		    </xsl:for-each-group>
+	    </xsl:if>
+	  </xsl:template>
+
+   <xsl:template match="w:hyperlink">
+      <ref>
+	<xsl:variable name="rid" select="@r:id"/>
+	<xsl:attribute name="target">
+	  <xsl:choose>
+	    <xsl:when test="ancestor::w:endnote">
+	      <xsl:value-of
+		  select="document(concat($wordDirectory,'/word/_rels/endnotes.xml.rels'))//rel:Relationship[@Id=$rid]/@Target"/>
+	    </xsl:when>
+	    <xsl:otherwise>
+	      <xsl:value-of
+		  select="document(concat($wordDirectory,'/word/_rels/document.xml.rels'))//rel:Relationship[@Id=$rid]/@Target"/>
+	    </xsl:otherwise>
+	  </xsl:choose>
+	</xsl:attribute>
+	<xsl:apply-templates/>
+      </ref>
+   </xsl:template>
+
+   <xsl:template match="w:instrText">
+      <xsl:choose>
+         <xsl:when test="contains(.,'REF _')"></xsl:when>
+         <xsl:when test="starts-with(.,'HYPERLINK')"></xsl:when>
+         <xsl:when test="starts-with(.,' XE')"></xsl:when>
+         <xsl:when test="starts-with(.,'XE')"></xsl:when>
+         <xsl:otherwise>
+            <xsl:value-of select="."/>
+         </xsl:otherwise>
+      </xsl:choose>
+   </xsl:template>
+
+    <xsl:template match="@rend[.='Body_Text']" mode="pass2"/>
+
+    <xsl:template match="@rend[.='Normal (Web)']" mode="pass2"/>
+
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/docxtotei.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/paragraphs/paragraphs.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/paragraphs/paragraphs.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/paragraphs/paragraphs.xsl	(revision 258)
@@ -0,0 +1,291 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:prop="http://schemas.openxmlformats.org/officeDocument/2006/custom-properties"
+                xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
+                xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties"
+                xmlns:dc="http://purl.org/dc/elements/1.1/"
+                xmlns:dcterms="http://purl.org/dc/terms/"
+                xmlns:dcmitype="http://purl.org/dc/dcmitype/"
+                xmlns:iso="http://www.iso.org/ns/1.0"
+                xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"
+                xmlns:mml="http://www.w3.org/1998/Math/MathML"
+                xmlns:mo="http://schemas.microsoft.com/office/mac/office/2008/main"
+                xmlns:mv="urn:schemas-microsoft-com:mac:vml"
+                xmlns:o="urn:schemas-microsoft-com:office:office"
+                xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"
+                xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
+                xmlns:rel="http://schemas.openxmlformats.org/package/2006/relationships"
+                xmlns:tbx="http://www.lisa.org/TBX-Specification.33.0.html"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teidocx="http://www.tei-c.org/ns/teidocx/1.0"
+                xmlns:v="urn:schemas-microsoft-com:vml"
+                xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006"
+                xmlns:w10="urn:schemas-microsoft-com:office:word"
+                xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
+                xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml"
+                xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"
+                xmlns="http://www.tei-c.org/ns/1.0"
+                version="2.0"
+                exclude-result-prefixes="a cp dc dcterms dcmitype prop     iso m mml mo mv o pic r rel     tbx tei teidocx v xs ve w10 w wne wp">
+    
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet for converting Word docx files to TEI </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: paragraphs.xsl 10152 2012-03-12 22:58:02Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc>
+   </doc>
+    
+   <xsl:variable name="dblq">"</xsl:variable>
+   <xsl:variable name="dblqplusr">" \r "</xsl:variable>
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+         <p>Calls the named template paragraph-wp that can be overriden.</p>
+         <p>
+            See comment at begin of document to understand why this template is calling
+            a named template.
+            
+            This stylesheet is handling simple paragraphs that we know nothing else
+            about.
+        </p>
+      </desc>
+   </doc>
+    <xsl:template match="w:p" mode="paragraph">
+      <xsl:variable name="style" select="w:pPr/w:pStyle/@w:val"/>
+      <xsl:choose>
+	<xsl:when test="$style='tei_lg'"/>
+	<xsl:when test="$style='GeneratedTitle'"/>
+	<xsl:when test="$style='GeneratedSubTitle'"/>
+
+	<xsl:when test="$style='tei_l'">
+	  <l>
+	    <xsl:apply-templates/>
+	  </l>
+	</xsl:when>
+	<xsl:when test="$style='Tabletitle'">
+	  <head>
+	    <xsl:apply-templates/>
+	  </head>
+	</xsl:when>
+	<xsl:when test="$style='dl'">
+	  <GLOSSITEM>
+	    <xsl:apply-templates/>
+	  </GLOSSITEM>
+	</xsl:when>
+	<xsl:when test="$style='tei_signed'">
+	  <signed>
+	    <xsl:apply-templates/>
+	  </signed>
+	</xsl:when>
+	<xsl:when test="$style='tei_speaker'">
+	  <speaker>
+	    <xsl:apply-templates/>
+	  </speaker>
+	</xsl:when>
+	<xsl:when test="$style='tei_speech'">
+	  <speech>
+	    <xsl:apply-templates/>
+	  </speech>
+	</xsl:when>
+	<xsl:otherwise>
+	  <xsl:call-template name="paragraph-wp">
+	    <xsl:with-param name="style" select="$style"/>
+	  </xsl:call-template>
+	</xsl:otherwise>
+      </xsl:choose>
+    </xsl:template>
+    
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+        Named template for handling w:p; we 
+       use the Word style (if provided) to make a TEI rend attribute,
+       and check for change records.
+    </desc>
+   </doc>
+   <xsl:template name="paragraph-wp">
+     <xsl:param name="style"/>
+     <xsl:element name="p">
+       <xsl:if test="$style and not($style='Default')">
+	 <xsl:attribute name="rend">
+	   <xsl:value-of select="$style"/>
+	 </xsl:attribute>
+       </xsl:if>
+       <xsl:if test="w:pPr/w:pStyle/w:rPr/w:rtl">
+	 <xsl:attribute name="dir"
+			xmlns="http://www.w3.org/2005/11/its">
+	   <xsl:text>rtl</xsl:text>
+	 </xsl:attribute>
+       </xsl:if>
+       <xsl:choose>
+	 <xsl:when test="w:pPr/w:rPr/w:ins">
+	   <add when="{w:pPr/w:rPr/w:ins/@w:date}" 
+		type="para">
+	     <xsl:call-template name="identifyChange">
+	       <xsl:with-param name="who"
+			       select="w:pPr/w:rPr/w:ins/@w:author"/>
+	     </xsl:call-template>
+	     <xsl:call-template name="process-checking-for-crossrefs"/>
+	   </add>
+	 </xsl:when>
+	 <xsl:otherwise>
+	   <xsl:call-template name="process-checking-for-crossrefs"/>
+	 </xsl:otherwise>
+       </xsl:choose>
+     </xsl:element>
+   </xsl:template>
+   
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+	Named template for handling processing any cross-references found.
+    </desc>
+    </doc>
+    <xsl:template name="process-checking-for-crossrefs">
+      <xsl:choose>
+	<xsl:when
+	    test="w:r/w:fldChar[@w:fldCharType='begin']">
+	  <xsl:for-each-group select="w:*|m:*"
+			      group-starting-with="w:r[w:fldChar/@w:fldCharType[matches(.,'begin|end')]]">
+	    <xsl:choose>
+	      <xsl:when test="self::w:r/w:fldChar[@w:fldCharType='begin']">
+		<xsl:variable name="rends">
+		  <!-- collect all the rends for concatenation later -->
+		  <xsl:choose>
+		    <xsl:when
+			test="contains(following-sibling::w:r[w:instrText][1],'NOTEREF')"><r>noteref</r></xsl:when>
+		    <xsl:when
+			test="contains(following-sibling::w:r[w:instrText][1],'SEQ')"><r>SEQ</r></xsl:when>
+		    <xsl:when test="contains(following-sibling::w:r[w:instrText][1],'XE')"><r>index</r></xsl:when>
+		    <xsl:when test="contains(following-sibling::w:r[w:instrText][1],'REF')"><r>ref</r></xsl:when>
+		  </xsl:choose>
+		  <xsl:if test="contains(following-sibling::w:r[w:instrText][1],'\r')"><r>instr_r</r></xsl:if>
+		  <xsl:if test="contains(following-sibling::w:r[w:instrText][1],'\f')"><r>instr_f</r></xsl:if>
+		  <xsl:if test="contains(following-sibling::w:r[w:instrText][1],'\n')"><r>instr_n</r></xsl:if>
+		  <xsl:if test="contains(following-sibling::w:r[w:instrText][1],'MERGEFORMAT')"><r>mergeformat</r></xsl:if>
+		</xsl:variable>
+		<xsl:choose>
+		  <xsl:when test="$rends/tei:r='index'">
+		    <index>
+		      <term>
+		      <xsl:for-each
+			  select="current-group()//w:instrText">
+			<xsl:choose>
+			  <xsl:when test=".='XE'"/>
+			  <xsl:when test="normalize-space(.)=$dblq"/>
+			  <xsl:when test="starts-with(normalize-space(.),$dblqplusr)"/>
+			  <xsl:otherwise>
+			    <xsl:apply-templates/>
+			  </xsl:otherwise>
+			</xsl:choose>
+		      </xsl:for-each>
+		      </term>
+		    </index>
+		  </xsl:when>
+		  <xsl:when test="$rends/tei:r='SEQ'">
+		    <xsl:variable name="What"
+				  select="following-sibling::w:r/w:instrText[1]"/>
+		    <xsl:number level="any" count="w:r[w:fldChar/@w:fldCharType='begin'][following-sibling::w:r/w:instrText=$What]"/>
+		  </xsl:when>
+		  <xsl:otherwise>
+		    <ref>
+		      <xsl:if test="$rends/tei:r">
+			<xsl:attribute name="rend">
+			  <xsl:value-of select="string-join(($rends/tei:r),' ')"/>
+			</xsl:attribute>
+		      </xsl:if>
+		      <xsl:if test="following-sibling::w:r[w:rPr][1]/w:rStyle">
+			<xsl:attribute name="iso:class">
+			  <xsl:value-of select="following-sibling::w:r[w:rPr][1]/w:rStyle/w:rPr/w:rStyle/@w:val"/>
+			</xsl:attribute>
+		      </xsl:if> 
+		      <xsl:for-each select="current-group()">
+			<xsl:if test="self::w:r[w:instrText]">			    
+			  <xsl:variable name="ref">
+			    <xsl:choose>
+			      <xsl:when test="contains(w:instrText,'REF _')"> <!-- this will also catch NOTEREF _ -->
+				<xsl:text>#</xsl:text>
+				<xsl:value-of select="substring-before(substring-after(w:instrText,'_'),'&#32;')"/>
+			      </xsl:when>
+			      <xsl:when test="contains(w:instrText,'HYPERLINK')">
+				<xsl:value-of select="substring-before(substring-after(w:instrText,'&#x0022;'),'&#x0022;')"/>
+			      </xsl:when>
+			    </xsl:choose>
+			  </xsl:variable>
+			  <xsl:attribute name="target" select="$ref"/>
+			</xsl:if>
+		      </xsl:for-each>
+		      <xsl:for-each select="current-group()">
+			<xsl:choose>
+			  <xsl:when  test="self::w:bookmarkStart">
+			    <xsl:apply-templates select="."/>
+			  </xsl:when>
+			  <xsl:otherwise>
+			    <xsl:apply-templates select="."/>
+			  </xsl:otherwise>
+			</xsl:choose>
+		      </xsl:for-each>
+		    </ref>
+		  </xsl:otherwise>
+		</xsl:choose>
+	      </xsl:when>
+	      <xsl:when
+		  test="self::w:r[w:fldChar/@w:fldCharType[matches(.,'end')]]">
+		<xsl:for-each select="current-group()">
+		  <xsl:choose>
+		    <xsl:when
+			test="self::w:r[w:fldChar/@w:fldCharType[matches(.,'end')]]">
+		    </xsl:when>
+		    <xsl:otherwise>
+		      <xsl:apply-templates select="."/>
+		    </xsl:otherwise>
+		  </xsl:choose>
+		</xsl:for-each>
+	      </xsl:when>
+	      <xsl:otherwise>
+		<xsl:apply-templates select="current-group()"/>
+	      </xsl:otherwise>
+	    </xsl:choose>
+	  </xsl:for-each-group>
+	</xsl:when>
+	<xsl:otherwise>
+	  <xsl:apply-templates/>
+	</xsl:otherwise>
+      </xsl:choose>
+    </xsl:template>
+
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/paragraphs/paragraphs.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/parameters.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/parameters.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/parameters.xsl	(revision 258)
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:prop="http://schemas.openxmlformats.org/officeDocument/2006/custom-properties"
+                xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
+                xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties"
+                xmlns:dc="http://purl.org/dc/elements/1.1/"
+                xmlns:dcterms="http://purl.org/dc/terms/"
+                xmlns:dcmitype="http://purl.org/dc/dcmitype/"
+                xmlns:iso="http://www.iso.org/ns/1.0"
+                xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"
+                xmlns:mml="http://www.w3.org/1998/Math/MathML"
+                xmlns:mo="http://schemas.microsoft.com/office/mac/office/2008/main"
+                xmlns:mv="urn:schemas-microsoft-com:mac:vml"
+                xmlns:o="urn:schemas-microsoft-com:office:office"
+                xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"
+                xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
+                xmlns:rel="http://schemas.openxmlformats.org/package/2006/relationships"
+                xmlns:tbx="http://www.lisa.org/TBX-Specification.33.0.html"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teidocx="http://www.tei-c.org/ns/teidocx/1.0"
+                xmlns:v="urn:schemas-microsoft-com:vml"
+                xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006"
+                xmlns:w10="urn:schemas-microsoft-com:office:word"
+                xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
+                xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml"
+                xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"
+                
+                xmlns="http://www.tei-c.org/ns/1.0"
+                version="2.0"
+                exclude-result-prefixes="a cp dc dcterms dcmitype prop     iso m mml mo mv o pic r rel     tbx tei teidocx v xs ve w10 w wne wp">
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet for converting Word docx files to TEI </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: parameters.xsl 9999 2012-01-02 18:43:24Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc>
+   </doc>
+    
+    <xsl:param name="convert-graphics">true</xsl:param>
+    
+    <xsl:param name="convert-headers">true</xsl:param>
+    
+    <xsl:param name="mathMethod">mml</xsl:param>
+    
+    <xsl:param name="termMethod">tei</xsl:param>
+    
+    <xsl:param name="tableMethod">tei</xsl:param>
+    
+    <xsl:param name="word-directory">.</xsl:param>
+    
+    <xsl:param name="preserveWordSections">false</xsl:param>
+
+    <xsl:param name="preserveWordHeadersFooters">false</xsl:param>    
+
+    <xsl:param name="preserveEffects">false</xsl:param>
+
+    <xsl:param name="verbose">false</xsl:param>
+
+    <xsl:param name="pageWidth">0</xsl:param>
+
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/parameters.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/pass2/pass2.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/pass2/pass2.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/pass2/pass2.xsl	(revision 258)
@@ -0,0 +1,458 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:cals="http://www.oasis-open.org/specs/tm9901"
+                xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:prop="http://schemas.openxmlformats.org/officeDocument/2006/custom-properties"
+                xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
+                xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties"
+                xmlns:dc="http://purl.org/dc/elements/1.1/"
+                xmlns:dcterms="http://purl.org/dc/terms/"
+                xmlns:dcmitype="http://purl.org/dc/dcmitype/"
+		xmlns:html="http://www.w3.org/1999/xhtml"
+                xmlns:iso="http://www.iso.org/ns/1.0"
+                xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"
+                xmlns:mml="http://www.w3.org/1998/Math/MathML"
+                xmlns:mo="http://schemas.microsoft.com/office/mac/office/2008/main"
+                xmlns:mv="urn:schemas-microsoft-com:mac:vml"
+                xmlns:o="urn:schemas-microsoft-com:office:office"
+                xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"
+                xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
+                xmlns:rel="http://schemas.openxmlformats.org/package/2006/relationships"
+                xmlns:tbx="http://www.lisa.org/TBX-Specification.33.0.html"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teidocx="http://www.tei-c.org/ns/teidocx/1.0"
+                xmlns:v="urn:schemas-microsoft-com:vml"
+                xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006"
+                xmlns:w10="urn:schemas-microsoft-com:office:word"
+                xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
+                xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml"
+                xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"
+                
+                xmlns="http://www.tei-c.org/ns/1.0"
+                version="2.0"
+                exclude-result-prefixes="a cp dc dcterms dcmitype prop  html   iso m mml mo mv o pic r rel cals     tbx tei teidocx v xs ve w10 w wne wp">
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet for converting Word docx files to TEI </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: pass2.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc>
+   </doc>
+    
+    
+    <xsl:template match="@*|comment()|processing-instruction()" mode="pass2">
+        <xsl:copy-of select="."/>
+    </xsl:template>
+    
+    <xsl:template match="*" mode="pass2">
+        <xsl:copy>
+            <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()" mode="pass2"/>
+        </xsl:copy>
+    </xsl:template>
+    
+    
+    <xsl:template match="text()" mode="pass2">
+	  <xsl:value-of select="."/>
+    </xsl:template>
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+         <p>     Zap empty p and item </p>
+      </desc>
+    </doc>
+ 
+   <xsl:template match="tei:p[not(*) and string-length(.)=0]"
+		 mode="pass2" priority="99"/>
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+         <p>     Inner lists in lists must be moved to inside items
+	 </p>
+      </desc>
+    </doc>
+    <xsl:template match="tei:list/tei:list" mode="pass2"/>
+    <xsl:template match="tei:item" mode="pass2">
+      <xsl:choose>
+	<xsl:when test="not(*) and string-length(.)=0"/>
+	<xsl:otherwise>
+	  <item>
+	    <xsl:copy-of select="@*"/>
+	    <xsl:variable name="me" select="generate-id()"/>
+	    <xsl:apply-templates mode="pass2"/>
+	    <!-- find following sibling lists and notes -->
+	    <xsl:for-each select="following-sibling::tei:list[preceding-sibling::tei:item[1][generate-id()=$me]]">
+	      <list>
+		<xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()" mode="pass2"/>
+	      </list>
+	    </xsl:for-each>
+	  </item>
+	</xsl:otherwise>
+      </xsl:choose>
+    </xsl:template>
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+         <p>     Zap emdashes at start of head </p>
+      </desc>
+    </doc>
+    <xsl:template match="tei:head/text()" mode="pass2">
+        <xsl:choose>
+            <xsl:when test="starts-with(.,'— ')">
+                <xsl:value-of select="substring(.,3)"/>
+            </xsl:when>
+            <xsl:when test="starts-with(.,'&#160;— ')">
+                <xsl:value-of select="substring(.,4)"/>
+            </xsl:when>
+            <xsl:when test="starts-with(.,' — ')">
+                <xsl:value-of select="substring(.,4)"/>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:value-of select="."/>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+         <p>     A &lt;seg&gt; which does nothing is not worth having </p>
+      </desc>
+    </doc>
+    <xsl:template match="tei:seg[not(@*)]" mode="pass2">
+        <xsl:choose>
+            <xsl:when test="parent::tei:formula and normalize-space(.)=''"/>
+	    <xsl:when test=".=' ' and following-sibling::node()[1][self::tei:hi]/@rend=
+			    preceding-sibling::node()[1][self::tei:hi]/@rend"/>
+
+            <xsl:when test="parent::*/text()">
+                <xsl:value-of select="."/>
+            </xsl:when>
+	    <xsl:when test="parent::tei:hi[count(*)=1]">
+	      <xsl:value-of select="."/>
+
+	    </xsl:when>
+            <xsl:otherwise>
+                <xsl:copy-of select="."/>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+         <p>Look at the sections we have generated, and put
+        them in &lt;front&gt; or &lt;body&gt; as appropriate</p>
+      </desc>
+    </doc>
+
+    <xsl:template match="tei:text" mode="pass2">
+        <text>
+            <xsl:for-each select="tei:fw">
+                <xsl:copy-of select="."/>
+            </xsl:for-each>
+            <body>
+                <xsl:for-each select="tei:body/tei:*">
+                    <xsl:apply-templates select="." mode="pass2"/>
+                </xsl:for-each>
+            </body>
+        </text>
+    </xsl:template>
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+         <p>     A &lt;p&gt; inside a listBibl is moved out</p>
+      </desc>
+    </doc>
+    <xsl:template match="tei:listBibl/tei:p" mode="pass2"/>
+    
+    <xsl:template match="tei:listBibl" mode="pass2">
+        <xsl:for-each select="tei:p">
+            <p>
+                <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()" mode="pass2"/>
+            </p>
+        </xsl:for-each>
+        <listBibl>
+            <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()" mode="pass2"/>
+        </listBibl>
+    </xsl:template>
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+         <p>  Gloss list from tei to docx</p>
+      </desc>
+    </doc>
+    <!-- <GLOSSITEM>
+	 <hi rend="bold">100</hi>
+	 <lb/>first item </GLOSSITEM>
+    -->
+    <xsl:template match="tei:GLOSSITEM" mode="pass2">
+      <label>
+	<xsl:for-each select="tei:hi">
+	  <xsl:apply-templates/>
+	</xsl:for-each>
+      </label>
+      <item>
+	<xsl:apply-templates mode="inglossitem"/>
+      </item>
+    </xsl:template>
+
+    <xsl:template match="*" mode="inglossitem">
+      <xsl:apply-templates select="." mode="pass2"/>
+    </xsl:template>
+
+    <xsl:template match="tei:lb" mode="inglossitem"/>
+    <xsl:template match="tei:hi[@rend='bold']" mode="inglossitem"/>
+
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+         <p>     Top of a weird gloss list </p>
+      </desc>
+    </doc>
+    <xsl:template match="tei:list[@type='gloss']/tei:label[.='where']" mode="pass2">
+        <head>
+            <xsl:apply-templates/>
+        </head>
+    </xsl:template>
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+         <p>     A tab in a &lt;bibl&gt;? no. </p>
+      </desc>
+    </doc>
+    <xsl:template match="tei:bibl/tei:g[@ref='x:tab']" mode="pass2"/>
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+         <p>     A tab in a &lt;gloss&gt;? no. </p>
+      </desc>
+    </doc>
+    <xsl:template match="tei:gloss//tei:g[@ref='x:tab']" mode="pass2"/>
+    
+    
+    <!-- removed 2010-03-15, seems to screw up formulae
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+         <p>     A tab in a &lt;formula&gt;? no. </p>
+      </desc>
+    </doc>
+
+    <xsl:template match="tei:formula//tei:g[@ref='x:tab']" mode="pass2"/>
+    -->
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+         <p>     A tab in a &lt;head&gt;? no. </p>
+      </desc>
+    </doc>
+    <xsl:template match="tei:head/tei:g[@ref='x:tab']" mode="pass2"/>
+    
+
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+         <p>     An empty item</p>
+      </desc>
+    </doc>
+    <xsl:template match="tei:item[not(*) and not(text())]" mode="pass2"/>
+    
+
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl"  >
+    <desc>Zap empty &lt;bibl&gt; </desc></doc>
+    
+    <xsl:template match="tei:bibl[not(*) and not(text())]" mode="pass2"/>
+
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl"  >
+    <desc>Zap empty &lt;availability&gt; </desc></doc>
+   
+    <xsl:template match="tei:availability[not(*) and not(text())]"
+		  mode="pass2"/>
+
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl"  >
+    <desc>Zap empty &lt;note&gt; </desc></doc>
+   
+    <xsl:template match="tei:note[not(*) and not(text())]"
+		  mode="pass2">
+    </xsl:template>
+
+    <xsl:template match="tei:list[@type='gloss']/tei:item/tei:g[@ref='x:tab']" mode="pass2"/>
+    
+
+    <xsl:template match="tei:hi[@rend='footnote_reference' and
+			 count(*)=1 and tei:note]" mode="pass2" priority="99">
+          <xsl:apply-templates mode="pass2"/>
+    </xsl:template>
+
+  <xsl:template match="tei:hi[not(@rend) and not(*) and string-length(.)=0]" mode="pass2">
+  </xsl:template>
+
+  <xsl:template match="tei:hi[@rend='Endnote_anchor']" mode="pass2" priority="99">
+    <xsl:apply-templates mode="pass2"/>
+  </xsl:template>
+
+  <xsl:template match="tei:hi[@rend='EndnoteReference']" mode="pass2"  priority="99">
+    <xsl:apply-templates mode="pass2"/>
+  </xsl:template>
+
+  <xsl:template match="tei:hi[@rend='EndnoteCharacters']" mode="pass2"
+		 priority="99">
+    <xsl:apply-templates mode="pass2"/>
+  </xsl:template>
+ 
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Clean up <gi>hi</gi> by merging adjacent &lt;hi&gt;s </desc>
+  </doc>
+
+  <xsl:template match="tei:hi[@rend]" mode="pass2">
+    <xsl:variable name="r" select="@rend"/>
+    <xsl:choose>
+      <xsl:when test="count(parent::tei:speaker/*)=1 and not
+		      (parent::tei:speaker/text())">
+	<xsl:apply-templates/>
+      </xsl:when>
+      <xsl:when test="parent::tei:head and .='&#160;'"/>
+      <xsl:when test ="not(*) and string-length(.)=0"/>
+      <xsl:when test="parent::tei:item/parent::tei:list[@type='gloss']
+		      and tei:g[@ref='x:tab']"/>
+      <xsl:when
+	  test="preceding-sibling::node()[1][self::tei:hi[@rend=$r]]">
+      </xsl:when>
+      <xsl:when
+	  test="preceding-sibling::node()[1][self::tei:seg and .=' ']
+		and
+		preceding-sibling::node()[2][self::tei:hi[@rend=$r]]">
+      </xsl:when>
+      <xsl:when test="@rend='bold' and .=' '">
+	<xsl:text> </xsl:text>
+      </xsl:when>
+      <xsl:when test="@rend='italic' and .=' '">
+	<xsl:text> </xsl:text>
+      </xsl:when>
+      <xsl:otherwise>
+	<xsl:variable name="ename">
+	  <xsl:choose>
+	    <xsl:when test="@rend='italic' and
+			    ancestor::tei:bibl">title</xsl:when>
+	    <xsl:otherwise>hi</xsl:otherwise>
+	  </xsl:choose>
+	</xsl:variable>
+	<xsl:element name="{$ename}">
+	  <xsl:copy-of select="@*"/>
+	  <xsl:apply-templates mode="pass2"/>
+	  <xsl:call-template name="nextHi">
+	    <xsl:with-param name="r" select="$r"/>
+	  </xsl:call-template>
+	</xsl:element>
+      </xsl:otherwise>
+    </xsl:choose>
+   </xsl:template>
+
+   <xsl:template name="nextHi">
+      <xsl:param name="r"/>
+      <xsl:for-each select="following-sibling::node()[1]">
+         <xsl:choose>
+	   <xsl:when test="self::tei:hi[@rend=$r]">
+            <xsl:apply-templates mode="pass2"/>
+            <xsl:call-template name="nextHi">
+	              <xsl:with-param name="r" select="$r"/>
+            </xsl:call-template>
+	   </xsl:when>
+	   <xsl:when test="self::tei:seg and .=' ' and
+			   following-sibling::node()[1][self::tei:hi[@rend=$r]]">
+            <xsl:apply-templates mode="pass2"/>
+            <xsl:call-template name="nextHi">
+	              <xsl:with-param name="r" select="$r"/>
+	    </xsl:call-template>
+	   </xsl:when>
+	 </xsl:choose>
+      </xsl:for-each>
+   </xsl:template>
+
+   <xsl:template match="tei:div[tei:head/tei:ANCHOR]" mode="pass2">
+     <xsl:copy>
+       <xsl:attribute name="xml:id"
+		      select="tei:head/tei:ANCHOR[1]/@xml:id"/>
+       <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()" mode="pass2"/>
+     </xsl:copy>
+   </xsl:template>
+
+   <xsl:template match="tei:ANCHOR" mode="pass2"/>
+
+   <xsl:template match="w:bookmarkStart" mode="pass2">
+       <anchor>
+        <xsl:attribute name="xml:id">
+            <xsl:value-of select="substring(@w:name,2)"/>
+        </xsl:attribute>
+	</anchor>
+   </xsl:template>
+
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl"  >
+    <desc>Paragraphs in cells not allowed</desc></doc>
+   
+    <xsl:template match="tei:cell/tei:p" mode="pass2">
+      <xsl:if test="preceding-sibling::tei:p">
+	<lb/>
+      </xsl:if>
+      <xsl:apply-templates mode="pass2"/>
+    </xsl:template>
+
+    <xsl:template match="tei:speech" mode="pass2"/>
+    <xsl:template match="tei:speech" mode="keep">
+      <p>
+	<xsl:apply-templates mode="pass2"/>
+      </p>
+    </xsl:template>
+
+    <xsl:template match="tei:speaker" mode="pass2">
+      <sp>
+	<speaker>
+	  <xsl:choose>	
+	    <xsl:when test="count(*)=1 and not(text()) and tei:hi[@rend]">
+	      <xsl:attribute name="rend" select="tei:hi/@rend"/>
+	      <xsl:for-each select="tei:hi">
+	      <xsl:apply-templates mode="pass2"/>
+	      </xsl:for-each>
+	    </xsl:when>
+	    <xsl:otherwise>
+	      <xsl:apply-templates mode="pass2"/>
+	    </xsl:otherwise>
+	  </xsl:choose>
+	</speaker>
+	<xsl:apply-templates
+	    select="following-sibling::tei:speech[1]" mode="keep"/>
+      </sp>
+    </xsl:template>
+
+
+
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/pass2/pass2.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/tables/tables.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/tables/tables.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/tables/tables.xsl	(revision 258)
@@ -0,0 +1,585 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:prop="http://schemas.openxmlformats.org/officeDocument/2006/custom-properties"
+                xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
+                xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties"
+                xmlns:dc="http://purl.org/dc/elements/1.1/"
+                xmlns:dcterms="http://purl.org/dc/terms/"
+                xmlns:dcmitype="http://purl.org/dc/dcmitype/"
+                xmlns:iso="http://www.iso.org/ns/1.0"
+                xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"
+                xmlns:mml="http://www.w3.org/1998/Math/MathML"
+                xmlns:mo="http://schemas.microsoft.com/office/mac/office/2008/main"
+                xmlns:mv="urn:schemas-microsoft-com:mac:vml"
+                xmlns:o="urn:schemas-microsoft-com:office:office"
+                xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"
+                xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
+                xmlns:rel="http://schemas.openxmlformats.org/package/2006/relationships"
+                xmlns:tbx="http://www.lisa.org/TBX-Specification.33.0.html"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teidocx="http://www.tei-c.org/ns/teidocx/1.0"
+                xmlns:v="urn:schemas-microsoft-com:vml"
+                xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006"
+                xmlns:w10="urn:schemas-microsoft-com:office:word"
+                xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
+                xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml"
+                xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"
+                xmlns:html="http://www.w3.org/1999/xhtml"                
+                
+                xmlns="http://www.tei-c.org/ns/1.0"
+                version="2.0"
+                exclude-result-prefixes="a cp dc dcterms dcmitype prop     iso m mml mo mv o pic r rel     tbx tei teidocx v xs ve w10 w wne wp">
+    
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet for converting Word docx files to TEI </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: tables.xsl 9719 2011-11-09 18:18:03Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc>
+   </doc>
+
+   <xsl:template name="getTableBorderStyles">
+     <xsl:param name="tblBorders"/>
+     <xsl:if test="$tblBorders//w:left[@w:sz!='']">
+       <xsl:text>border-left: </xsl:text><xsl:value-of select="$tblBorders//w:left[1]/@w:sz"/><xsl:text>; </xsl:text>
+     </xsl:if>
+     <xsl:if test="$tblBorders//w:left[@w:val='nil']">
+       <xsl:text>border-left: 0; </xsl:text>
+     </xsl:if>
+     <xsl:if test="$tblBorders//w:bottom[@w:sz!='']">
+       <xsl:text>border-bottom: </xsl:text><xsl:value-of select="$tblBorders//w:bottom[1]/@w:sz"/><xsl:text>; </xsl:text>
+     </xsl:if>
+     <xsl:if test="$tblBorders//w:bottom[@w:val='nil']">
+       <xsl:text>border-bottom: 0; </xsl:text>
+     </xsl:if>
+     <xsl:if test="$tblBorders//w:right[@w:sz!='']">
+       <xsl:text>border-right: </xsl:text><xsl:value-of select="$tblBorders//w:right[1]/@w:sz"/><xsl:text>; </xsl:text>
+     </xsl:if>
+     <xsl:if test="$tblBorders//w:right[@w:val='nil']">
+       <xsl:text>border-right: 0; </xsl:text>
+     </xsl:if>
+     <xsl:if test="$tblBorders//w:top[@w:sz!='']">
+       <xsl:text>border-top: </xsl:text><xsl:value-of select="$tblBorders//w:top[1]/@w:sz"/><xsl:text>; </xsl:text>
+     </xsl:if>
+     <xsl:if test="$tblBorders//w:top[@w:val='nil']">
+       <xsl:text>border-top: 0; </xsl:text>
+     </xsl:if>
+   </xsl:template>
+    
+    	<xsl:template match="w:tbl" mode="paragraph">
+	     <xsl:choose>
+	        <xsl:when test="$tableMethod='word'">
+	           <xsl:copy>
+		             <xsl:copy-of select="@*"/>
+		             <xsl:apply-templates/>
+	           </xsl:copy>
+	        </xsl:when>
+	        <xsl:when test="$tableMethod='cals'">
+	      <!-- preprocess the table to expand colspans, add row numbers, and
+		   simplify vertical merge info -->
+
+	      <xsl:variable name="TABLE">
+
+	      <xsl:variable name="tableBorders">
+		<xsl:choose>
+		  <xsl:when test="w:tblPr/w:tblBorders/w:top[@w:val='single']">
+		    <xsl:copy-of select="w:tblPr/w:tblBorders/w:top"/>
+		  </xsl:when>
+		  <xsl:when test=".//w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:top[@w:val='single']">
+		    <xsl:copy-of select=".//w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:top"/>
+		  </xsl:when>
+		</xsl:choose>
+		<xsl:choose>
+		  <xsl:when test="w:tblPr/w:tblBorders/w:left[@w:val='single']">
+		    <xsl:copy-of select="w:tblPr/w:tblBorders/w:left"/>
+		  </xsl:when>
+		  <xsl:when test=".//w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:left[@w:val='single']">
+		    <xsl:copy-of select=".//w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:left"/>
+		  </xsl:when>
+		</xsl:choose>
+		<xsl:choose>
+		  <xsl:when test="w:tblPr/w:tblBorders/w:bottom[@w:val='single']">
+		    <xsl:copy-of select="w:tblPr/w:tblBorders/w:bottom"/>
+		  </xsl:when>
+		  <xsl:when test=".//w:tr[last()]/w:tc[last()]/w:tcPr/w:tcBorders/w:bottom[@w:val='single']">
+		    <xsl:copy-of select=".//w:tr[last()]/w:tc[last()]/w:tcPr/w:tcBorders/w:bottom"/>
+		  </xsl:when>
+		</xsl:choose>
+		<xsl:choose>
+		  <xsl:when test="w:tblPr/w:tblBorders/w:right[@w:val='single']">
+		    <xsl:copy-of select="w:tblPr/w:tblBorders/w:right"/>
+		  </xsl:when>
+		  <xsl:when test=".//w:tr[last()]/w:tc[last()]/w:tcPr/w:tcBorders/w:right[@w:val='single']">
+		    <xsl:copy-of select=".//w:tr[last()]/w:tc[last()]/w:tcPr/w:tcBorders/w:right"/>
+		  </xsl:when>
+		</xsl:choose>		
+	      </xsl:variable>
+	      <xsl:variable name="tableBorderStyles">
+		<xsl:call-template name="getTableBorderStyles">
+		  <xsl:with-param name="tblBorders" select="$tableBorders"/>
+		</xsl:call-template>
+	      </xsl:variable>
+		             <table xmlns="http://www.oasis-open.org/specs/tm9901">
+			       <xsl:if test="normalize-space($tableBorderStyles)!=''">
+				 <xsl:attribute name="iso:style">
+				   <xsl:value-of select="normalize-space($tableBorderStyles)"/>
+				 </xsl:attribute>
+			       </xsl:if>
+			       <xsl:attribute name="frame">
+		                   <xsl:choose>
+		      <!-- lets face it, most tables do have
+			   borders, especially in ISO; but not in footers! -->
+		      <xsl:when test="not(w:tblPr/w:tblBorders) and
+				      parent::w:ftr">
+			                        <xsl:text>none</xsl:text>
+		                      </xsl:when>
+		                      <xsl:when test="not($tableBorders)">
+					<!-- if really no info on borders, default 
+					     to all (? is this really what we want?) -->
+					<xsl:text>all</xsl:text>
+		                      </xsl:when>
+		                      <xsl:otherwise>
+					<xsl:for-each select="$tableBorders">
+					  <xsl:choose>
+					    <xsl:when test="    w:top/@w:val='single'
+							    and w:bottom/@w:val='single'
+							    and w:right/@w:val='single'        
+							    and w:left/@w:val='single'">all</xsl:when>
+					    <xsl:when test="    w:top/@w:val='single' 
+							    and w:bottom/@w:val='single'
+							    and not(w:right/@w:val='single') 
+							    and not(w:left/@w:val='single')">topbot</xsl:when>
+					    <xsl:when test="    w:top/@w:val='single' 
+							    and not(w:bottom/@w:val='single') 
+							    and not(w:right/@w:val='single') 
+							    and not(w:left/@w:val='single')">top</xsl:when>
+					    <xsl:when test="    not(w:top/@w:val='single') 
+							    and w:bottom/@w:val='single' 
+							    and not(w:right/@w:val='single') 
+							    and not(w:left/@w:val='single')">bottom</xsl:when>
+					    <xsl:when test="    not(w:top/@w:val='single') 
+							    and not(w:bottom/@w:val='single') 
+							    and w:right/@w:val='single' 
+							    and w:left/@w:val='single'">sides</xsl:when>
+					    <xsl:otherwise>
+					      <!-- start guessing -->
+					      <xsl:variable name="sideBorders">
+						<xsl:choose>
+						  <xsl:when test="w:left/@w:val='single' 
+								  or w:right/@w:val='single'
+								  or ../../w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:left[@w:val='single']
+								  or ../../w:tr[last()]/w:tc[last()]/w:tcPr/w:tcBorders/w:right[@w:val='single']">true</xsl:when> 
+						  <xsl:otherwise>false</xsl:otherwise>
+						</xsl:choose>
+					      </xsl:variable>
+					      <xsl:choose>
+						<xsl:when test="$sideBorders='true'
+								and(w:bottom/@w:val='single' or w:top/@w:val='single')">all</xsl:when>
+						<xsl:otherwise>
+						  <xsl:text>none</xsl:text>
+						</xsl:otherwise>
+					      </xsl:choose>
+					    </xsl:otherwise>
+					  </xsl:choose>
+					</xsl:for-each>
+		                      </xsl:otherwise>
+		                   </xsl:choose>
+		                </xsl:attribute>
+		                <xsl:attribute name="colsep">
+		                   <xsl:choose>
+		                      <xsl:when test="w:tblPr/w:tblBorders/w:insideV/@w:val='single'">1</xsl:when>
+		                      <xsl:otherwise>0</xsl:otherwise>
+		                   </xsl:choose>
+		                </xsl:attribute>
+		                <xsl:attribute name="rowsep">
+		                   <xsl:choose>
+		                      <xsl:when test="w:tblPr/w:tblBorders/w:insideH/@w:val='single'">1</xsl:when>
+		                      <xsl:otherwise>0</xsl:otherwise>
+		                   </xsl:choose>
+		                </xsl:attribute>
+		                <xsl:call-template name="cals-table-header"/>
+		                <tgroup>
+		                   <xsl:for-each select="w:tblGrid/w:gridCol">
+		                      <colspec colnum="{position()}" colname="c{position()}">
+			                        <xsl:attribute name="colwidth" select="concat(number(@w:w) div 20,'pt')"/>
+		                      </colspec>
+		                   </xsl:for-each>
+		                   <tbody>
+		                      <xsl:for-each select="w:tr">
+			                        <xsl:copy>
+			                           <xsl:variable name="ROWPOS">
+			                              <xsl:number/>
+			                           </xsl:variable>
+			                           <xsl:for-each select="w:tc">
+						     <xsl:variable name="cellBorderStyles">
+						       <xsl:choose>
+							 <xsl:when test="w:tcBorders">
+							   <xsl:call-template name="getTableBorderStyles">
+							     <xsl:with-param name="tblBorders" select="w:tcBorders"/>
+							   </xsl:call-template>
+							 </xsl:when>
+							 <xsl:when test="w:tcPr/w:tcBorders">
+							   <xsl:call-template name="getTableBorderStyles">
+							     <xsl:with-param name="tblBorders" select="w:tcPr/w:tcBorders"/>
+							   </xsl:call-template>
+							 </xsl:when>
+						       </xsl:choose>
+						     </xsl:variable>
+			                              <xsl:variable name="VMERGE">
+			                                 <xsl:choose>
+				                                   <xsl:when test="w:tcPr/w:vMerge/@w:val='restart'">
+				                                      <xsl:text>start</xsl:text>
+				                                   </xsl:when>
+				                                   <xsl:when test="w:tcPr[not(w:vMerge)]">
+				                                      <xsl:text>start</xsl:text>
+				                                   </xsl:when>
+				                                   <xsl:otherwise>
+				                                      <xsl:text>continue</xsl:text>
+				                                   </xsl:otherwise>
+			                                 </xsl:choose>
+			                              </xsl:variable>
+			                              <xsl:variable name="innards">
+			                                 <xsl:copy-of select="w:tcPr"/>
+			                              </xsl:variable>
+			                              <xsl:copy>
+			                                 <xsl:variable
+							     name="N"
+							     select="position()"/>
+							 <xsl:if test="normalize-space($cellBorderStyles)!=''">
+							   <xsl:attribute name="iso:style">
+							     <xsl:value-of select="normalize-space($cellBorderStyles)"/>
+							   </xsl:attribute>
+							 </xsl:if>
+			                                 <xsl:attribute name="rowsep">
+				                                   <xsl:choose>
+				                                      <xsl:when test="w:tcPr/w:tcBorders/w:bottom[@w:sz=0 or @w:val='nil']">
+				                                         <xsl:text>0</xsl:text>
+				                                      </xsl:when>
+				                                      <xsl:when test="w:tcPr/w:tcBorders/w:bottom[@w:sz&gt;0]">
+				                                         <xsl:text>1</xsl:text>
+				                                      </xsl:when>
+				                                      <xsl:when test="parent::w:tr/following-sibling::w:tr[1]/w:tc[$N]/w:tcPr/w:tcBorders/w:top[@w:sz&gt;0]">
+				                                         <xsl:text>1</xsl:text>
+				                                      </xsl:when>
+				                                      <xsl:when test="ancestor::w:tbl/w:tblPr/w:tblBorders/w:insideH[@w:sz=0          or @w:val='nil']">
+				                                         <xsl:text>0</xsl:text>
+				                                      </xsl:when>
+				                                      <xsl:when test="ancestor::w:tbl/w:tblPr/w:tblBorders/w:insideH">
+				                                         <xsl:text>1</xsl:text>
+				                                      </xsl:when>
+				                                      <xsl:when test="not(parent::w:tr/following-sibling::w:tr)          and not(ancestor::w:ftr)">
+				                                         <xsl:text>1</xsl:text>
+				                                      </xsl:when>
+				                                      <xsl:otherwise>
+				                                         <xsl:text>0</xsl:text>
+				                                      </xsl:otherwise>
+				                                   </xsl:choose>
+			                                 </xsl:attribute>
+			                                 <xsl:attribute name="colsep">
+				                                   <xsl:choose>
+				                                      <xsl:when test="following-sibling::w:tc[1]/w:tcPr/w:tcBorders/w:left[@w:sz&gt;0]">
+				                                         <xsl:text>1</xsl:text>
+				                                      </xsl:when>
+				                                      <xsl:when test="w:tcPr/w:tcBorders/w:right[@w:sz=0 or @w:val='nil']">
+				                                         <xsl:text>0</xsl:text>
+				                                      </xsl:when>
+				                                      <xsl:when test="w:tcPr/w:tcBorders/w:right[@w:sz&gt;0]">
+				                                         <xsl:text>1</xsl:text>
+				                                      </xsl:when>
+				                                      <xsl:when test="ancestor::w:tbl/w:tblPr/w:tblBorders/w:insideV[@w:sz=0          or @w:val='nil']">
+				                                         <xsl:text>0</xsl:text>
+				                                      </xsl:when>
+				                                      <xsl:when test="not(ancestor::w:tbl/w:tblPr/w:tblBorders)          and ancestor::w:ftr">
+				                                         <xsl:text>0</xsl:text>
+				                                      </xsl:when>
+				                                      <xsl:otherwise>
+				                                         <xsl:text>1</xsl:text>
+				                                      </xsl:otherwise>
+				                                   </xsl:choose>
+			                                 </xsl:attribute>
+			                                 <xsl:attribute name="ROWPOS" select="$ROWPOS"/>
+			                                 <xsl:attribute name="VMERGE" select="$VMERGE"/>
+			                                 <xsl:copy-of select="@*"/>
+			                                 <xsl:copy-of select="*"/>
+			                              </xsl:copy>
+			                              <xsl:if test="w:tcPr/w:gridSpan/@w:val">
+			                                 <xsl:variable name="N" select="number(w:tcPr/w:gridSpan/@w:val)           cast as xs:integer"/>
+			                                 <xsl:for-each select="2 to $N">
+				                                   <w:tc DUMMY="yes">
+								     <xsl:copy-of select="$innards"/>
+				                                   </w:tc>
+			                                 </xsl:for-each>
+			                              </xsl:if>
+			                           </xsl:for-each>
+			                        </xsl:copy>
+		                      </xsl:for-each>
+		                   </tbody>
+		                </tgroup>
+		             </table>
+		             <!--
+		    <xsl:comment>START</xsl:comment>
+		    <TABLE>
+		    <xsl:copy-of select="$TABLE"/>
+		    </TABLE>
+		    <xsl:comment>END</xsl:comment>
+		-->
+	      </xsl:variable>
+	      <xsl:variable name="n">
+		<xsl:number level="any"/>
+	      </xsl:variable>
+	      <xsl:for-each select="$TABLE">
+		<xsl:apply-templates mode="insideCalsTable">
+		  <xsl:with-param name="n" select="$n" tunnel="yes"/>
+		</xsl:apply-templates>
+	      </xsl:for-each>
+	    </xsl:when>
+	    <xsl:otherwise>
+	      <table rend="rules">
+		<xsl:call-template name="table-header"/>
+		<xsl:for-each select="w:tr">
+		  <row>
+		    <xsl:for-each select="w:tc">
+		      <cell>
+			<xsl:if test="preserveEffects='true'">
+			  <xsl:attribute name="tei:align">
+			    <xsl:choose>
+			      <xsl:when test="w:p/w:pPr/w:jc">
+				<xsl:value-of
+				  select="w:p[1]/w:pPr/w:jc/@w:val"/>
+			      </xsl:when>
+			      <xsl:otherwise>
+				<xsl:text>left</xsl:text>
+			      </xsl:otherwise>
+			    </xsl:choose>
+			  </xsl:attribute>
+			</xsl:if>
+			<xsl:if test="w:tcPr/w:gridSpan">
+			  <xsl:attribute name="cols" select="w:tcPr/w:gridSpan/@w:val"/>
+			</xsl:if>
+			<xsl:variable name="val" select="w:p[1]/w:pPr/w:pStyle/@w:val"/>
+			<xsl:choose>
+			  <xsl:when test="$val='[No Paragraph Style]'"/>
+			  <xsl:when test="$val='Table text (9)'"/>
+			  <xsl:when test="$val='Table Contents'"/>
+			  <xsl:when test="string-length($val)=0"/>
+			  <xsl:otherwise>
+			    <xsl:attribute name="rend">
+			      <xsl:value-of select="replace($val,' ','_')"/>
+			      <xsl:if test="w:tcPr/w:shd/@w:fill and not(w:tcPr/w:shd/@w:fill='auto')">
+				<xsl:text> background-color(</xsl:text>
+				<xsl:value-of select="w:tcPr/w:shd/@w:fill"/>
+				<xsl:text>)</xsl:text>
+			      </xsl:if>
+			    </xsl:attribute>
+			  </xsl:otherwise>
+			  </xsl:choose>
+			  <xsl:if test="w:tcPr/w:gridSpan">
+			    <xsl:attribute name="cols">
+			      <xsl:value-of select="w:tcPr/w:gridSpan/@w:val"/>
+			    </xsl:attribute>
+			  </xsl:if>
+			  <xsl:call-template name="mainProcess"/>
+		      </cell>
+		    </xsl:for-each>
+		  </row>
+		</xsl:for-each>
+	      </table>
+	    </xsl:otherwise>
+	  </xsl:choose>
+	</xsl:template>
+	
+	  <xsl:template match="*" mode="insideCalsTable">
+	     <xsl:copy>
+	        <xsl:copy-of select="@*"/>
+	        <xsl:apply-templates mode="insideCalsTable"/>	    
+	     </xsl:copy>
+	  </xsl:template>
+
+	  <xsl:template match="w:tr" mode="insideCalsTable">
+	     <row xmlns="http://www.oasis-open.org/specs/tm9901">
+	        <xsl:for-each select="w:tc[not(@DUMMY='yes')]">
+		  <xsl:variable name="cellBorderStyles">
+		    <xsl:call-template name="getTableBorderStyles">
+		      <xsl:with-param name="tblBorders" select="w:tcPr/w:tcBorders"/>
+		    </xsl:call-template>
+		  </xsl:variable>
+	           <xsl:choose>
+		             <xsl:when test="w:tcPr/w:vMerge[not(@w:val='restart')]"/>
+		             <xsl:otherwise>
+		                <entry>
+		                   <xsl:variable name="ROWPOS" select="@ROWPOS"/>
+		                   <xsl:variable name="COLPOS">
+		                      <xsl:number/>
+		                   </xsl:variable>
+		                   <xsl:copy-of select="@rowsep"/>
+		                   <xsl:copy-of select="@colsep"/>
+		                   <xsl:attribute name="colname">
+		                      <xsl:text>c</xsl:text>
+		                      <xsl:value-of select="$COLPOS"/>
+		                   </xsl:attribute>
+				   <xsl:if test="normalize-space($cellBorderStyles)!=''">
+				     <xsl:attribute
+					 name="iso:style">
+				       <xsl:value-of select="normalize-space($cellBorderStyles)"/>
+				     </xsl:attribute>
+				   </xsl:if>
+		                   <xsl:if test="w:p/w:pPr/w:jc">
+		                      <xsl:attribute name="align">
+			                        <xsl:value-of select="w:p[w:pPr/w:jc/@w:val][1]/w:pPr/w:jc/@w:val"/>
+		                      </xsl:attribute>
+		                   </xsl:if>
+		                   <xsl:if test="w:tcPr/w:gridSpan">
+		                      <xsl:attribute name="namest">
+			                        <xsl:text>c</xsl:text>
+			                        <xsl:value-of select="$COLPOS"/>
+		                      </xsl:attribute>
+		                      <xsl:attribute name="nameend">
+			                        <xsl:text>c</xsl:text>
+			                        <xsl:value-of select="$COLPOS+number(w:tcPr/w:gridSpan/@w:val)-1"/>
+		                      </xsl:attribute>
+		                   </xsl:if>
+		                   <xsl:if test="w:tcPr/w:vAlign">
+		                      <xsl:attribute name="valign">
+			                        <xsl:choose>
+			                           <xsl:when test="w:tcPr/w:vAlign/@w:val='center'">middle</xsl:when>
+			                           <xsl:otherwise>
+			                              <xsl:value-of select="w:tcPr/w:vAlign/@w:val"/>
+			                           </xsl:otherwise>
+			                        </xsl:choose>
+		                      </xsl:attribute>
+		                   </xsl:if>
+		                   <xsl:if test="w:tcPr/w:textDirection[@w:val='btLr']">
+		                      <xsl:attribute name="rotate">
+			                        <xsl:text>1</xsl:text>
+		                      </xsl:attribute>
+		                   </xsl:if>
+		                   <xsl:if test="w:tcPr/w:vMerge/@w:val='restart'">
+		                      <xsl:variable name="MOREROWS">
+			                        <xsl:choose>
+			                           <xsl:when test="parent::w:tr/following-sibling::w:tr/w:tc[position()=$COLPOS][@VMERGE='start']">
+			                              <xsl:for-each select="(parent::w:tr/following-sibling::w:tr/w:tc[position()=$COLPOS][@VMERGE='start'])[1]">
+			                                 <xsl:value-of select="@ROWPOS"/>
+			                              </xsl:for-each>
+			                           </xsl:when>
+			                           <xsl:otherwise>
+			                              <xsl:value-of select="parent::w:tr/following-sibling::w:tr[last()]/w:tc/@ROWPOS"/>
+			                           </xsl:otherwise>
+			                        </xsl:choose>
+		                      </xsl:variable>
+		                      <!--
+			  <xsl:message>start a merged cell at <xsl:value-of
+			  select="$ROWPOS"/>/<xsl:value-of select="$COLPOS"/>
+			  <xsl:text>: </xsl:text>
+			  <xsl:value-of select="$MOREROWS"/>-<xsl:value-of
+			  select="$ROWPOS"/> =<xsl:value-of select="."/>
+			  </xsl:message>
+		      -->
+		      <xsl:attribute name="morerows">
+			<xsl:value-of select="number($MOREROWS) -            number($ROWPOS) -1"/>
+		      </xsl:attribute>
+				   </xsl:if>
+				   <xsl:choose>
+				     <xsl:when test="count(w:p)&gt;1
+						     or w:p/w:pPr/w:pStyle">
+					<xsl:call-template name="cellContents"/>
+		                      </xsl:when>
+		                      <xsl:otherwise>
+			                        <xsl:apply-templates/>
+		                      </xsl:otherwise>
+		                   </xsl:choose>
+		                </entry>
+		             </xsl:otherwise>
+	           </xsl:choose>
+	        </xsl:for-each>
+	     </row>
+
+	  </xsl:template>
+
+	  <xsl:template name="cellContents">
+	     <xsl:apply-templates select="w:p" mode="inTable"/> 
+	  </xsl:template>
+
+	  <xsl:template match="w:p" mode="inTable">
+	     <p rend="{w:pPr/w:pStyle/@w:val}">
+	        <xsl:apply-templates/>
+	     </p>
+	  </xsl:template>
+
+	  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+	    getting the basic table structure
+    </desc>
+   </doc>
+	  <xsl:template match="w:gridCol|w:tblBorders|w:tblCellMar|w:tblGrid|w:tblLayout|w:tblLook|w:tblPr|w:tblW|w:tc|w:tcBorders|w:tcPr|w:tcW|w:tr|w:trPr|w:vAlign|w:top|w:left|w:bottom|w:right|w:insideH|w:insideV">
+
+		    <xsl:choose>
+			      <xsl:when test="$tableMethod='word'">
+				        <xsl:copy>
+					          <xsl:copy-of select="@*"/>
+					          <xsl:apply-templates/>
+				        </xsl:copy>
+			      </xsl:when>
+			      <xsl:otherwise>
+				        <xsl:apply-templates/>
+			      </xsl:otherwise>
+		    </xsl:choose>
+	  </xsl:template>
+
+
+
+    <xsl:template name="table-header">
+        <xsl:variable name="precedingTableTitle"
+                    select="preceding-sibling::w:p[w:pPr/w:pStyle/@w:val='TableTitle'             or w:pPr/w:pStyle/@w:val=$Tabletitle][1]"/>
+        <xsl:if test="$precedingTableTitle and $precedingTableTitle/following-sibling::w:tbl[1] and generate-id()=generate-id($precedingTableTitle/following-sibling::w:tbl[1])">
+            <head>
+                <xsl:apply-templates select="$precedingTableTitle"/>
+            </head>
+        </xsl:if>
+    </xsl:template>
+    
+    <xsl:template name="cals-table-header">
+        <xsl:variable name="precedingTableTitle"
+                    select="preceding-sibling::w:p[w:pPr/w:pStyle/@w:val='TableTitle'             or w:pPr/w:pStyle/@w:val=$Tabletitle][1]"/>
+        <xsl:if test="$precedingTableTitle and $precedingTableTitle/following-sibling::w:tbl[1] and generate-id()=generate-id($precedingTableTitle/following-sibling::w:tbl[1])">
+            <title xmlns="http://www.oasis-open.org/specs/tm9901">
+                <xsl:apply-templates select="$precedingTableTitle"/>
+            </title>
+        </xsl:if>
+    </xsl:template>
+    
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/tables/tables.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/maths/maths.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/maths/maths.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/maths/maths.xsl	(revision 258)
@@ -0,0 +1,198 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:prop="http://schemas.openxmlformats.org/officeDocument/2006/custom-properties"
+                xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
+                xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties"
+                xmlns:dc="http://purl.org/dc/elements/1.1/"
+                xmlns:dcterms="http://purl.org/dc/terms/"
+                xmlns:dcmitype="http://purl.org/dc/dcmitype/"
+                xmlns:iso="http://www.iso.org/ns/1.0"
+                xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"
+                xmlns:mml="http://www.w3.org/1998/Math/MathML"
+                xmlns:mo="http://schemas.microsoft.com/office/mac/office/2008/main"
+                xmlns:mv="urn:schemas-microsoft-com:mac:vml"
+                xmlns:o="urn:schemas-microsoft-com:office:office"
+                xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"
+                xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
+                xmlns:rel="http://schemas.openxmlformats.org/package/2006/relationships"
+                xmlns:tbx="http://www.lisa.org/TBX-Specification.33.0.html"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teidocx="http://www.tei-c.org/ns/teidocx/1.0"
+                xmlns:v="urn:schemas-microsoft-com:vml"
+                xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006"
+                xmlns:w10="urn:schemas-microsoft-com:office:word"
+                xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
+                xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml"
+                xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"
+                
+                xmlns="http://www.tei-c.org/ns/1.0"
+                version="2.0"
+                exclude-result-prefixes="a cp dc dcterms dcmitype prop     iso m mml mo mv o pic r rel     tbx tei teidocx v xs ve w10 w wne wp">
+    
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet for converting Word docx files to TEI </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: maths.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc>
+   </doc>
+    
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Handles a single paragraph that contains a math object</desc>
+   </doc>
+    <xsl:template match="w:p[w:pPr/w:pStyle/@w:val='Formula']" mode="paragraph">
+        <xsl:call-template name="paragraph-formula"/>
+    </xsl:template>
+    
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+        
+            //TODO: figure out why there is a priority=-1
+        
+    </desc>
+   </doc>
+    <xsl:template match="w:p[m:oMathPara]" mode="paragraph" priority="-1">
+        <p>
+            <formula>
+                <xsl:apply-templates select="m:oMathPara/m:oMath"/>
+            </formula>
+        </p>
+    </xsl:template>
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+        
+            //TODO: figure out why there is a priority=-1
+        
+    </desc>
+   </doc>
+    <xsl:template match="w:p[m:oMath]" mode="paragraph" priority="-1">
+        <p>
+            <formula>
+                <xsl:apply-templates select="m:oMath"/>
+            </formula>
+        </p>
+    </xsl:template>
+    
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>named template for w:p[w:pPr/w:pStyle/@w:val='Formula'</desc>
+   </doc>
+    <xsl:template name="paragraph-formula">
+        <p>
+            <formula>
+                <xsl:if test="w:r/w:rPr/w:rStyle/@w:val='FormulaReference'">
+                    <xsl:attribute name="n">
+                        <xsl:value-of select="w:r[w:rPr/w:rStyle/@w:val='FormulaReference']/w:t"/>
+                    </xsl:attribute>
+                </xsl:if>
+                <xsl:apply-templates/>
+            </formula>
+        </p>
+    </xsl:template>
+
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+        Depending on the math mode, omml is either converted to mathML or an identity transformation is started
+    </desc>
+   </doc>
+    <xsl:template match="m:oMath">
+        <xsl:choose>
+            <xsl:when test="$mathMethod='omml'">
+                <xsl:apply-templates select="." mode="iden"/>
+            </xsl:when>
+            <xsl:otherwise>
+                <mml:math>
+                    <xsl:apply-templates/>
+                </mml:math>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+
+    
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+         <p>Handles a w:object by copying it</p>
+      </desc>
+   </doc>
+    <xsl:template match="w:object">
+      <xsl:copy>
+	<xsl:apply-templates mode="iden"/>
+      </xsl:copy>
+    </xsl:template>
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+        Guides the identity transformation of imagedata in math
+    </desc>
+   </doc>
+    <xsl:template match="v:imagedata" mode="iden">
+            <xsl:variable name="rid" select="@r:id"/>
+            <xsl:variable name="file">
+                <xsl:value-of
+		    select="document(concat($wordDirectory,'/word/_rels/document.xml.rels'))//rel:Relationship[@Id=$rid]/@Target"/>
+	    </xsl:variable>
+	    <v:imagedata r:id="{$file}"/>
+    </xsl:template>
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+        Guides the identity transformation of ole in maths
+    </desc>
+   </doc>
+    <xsl:template match="o:OLEObject" mode="iden">
+        <o:OLEObject>
+            <xsl:copy-of select="@*"/>
+            <xsl:variable name="rid" select="@r:id"/>
+            <xsl:variable name="file">
+                <xsl:value-of
+		    select="document(concat($wordDirectory,'/word/_rels/document.xml.rels'))//rel:Relationship[@Id=$rid]/@Target"/>
+	    </xsl:variable>
+            <xsl:attribute name="r:id">
+                <xsl:value-of select="$file"/>
+            </xsl:attribute>
+        </o:OLEObject>
+    </xsl:template>
+    
+
+    
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/maths/maths.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/textruns/textruns.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/textruns/textruns.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/textruns/textruns.xsl	(revision 258)
@@ -0,0 +1,643 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:xs="http://www.w3.org/2001/XMLSchema"
+		xmlns:html="http://www.w3.org/1999/xhtml"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:prop="http://schemas.openxmlformats.org/officeDocument/2006/custom-properties"
+                xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
+                xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties"
+                xmlns:dc="http://purl.org/dc/elements/1.1/"
+                xmlns:dcterms="http://purl.org/dc/terms/"
+                xmlns:dcmitype="http://purl.org/dc/dcmitype/"
+                xmlns:iso="http://www.iso.org/ns/1.0"
+                xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"
+                xmlns:mml="http://www.w3.org/1998/Math/MathML"
+                xmlns:mo="http://schemas.microsoft.com/office/mac/office/2008/main"
+                xmlns:mv="urn:schemas-microsoft-com:mac:vml"
+                xmlns:o="urn:schemas-microsoft-com:office:office"
+                xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"
+                xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
+                xmlns:rel="http://schemas.openxmlformats.org/package/2006/relationships"
+                xmlns:tbx="http://www.lisa.org/TBX-Specification.33.0.html"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teidocx="http://www.tei-c.org/ns/teidocx/1.0"
+                xmlns:v="urn:schemas-microsoft-com:vml"
+                xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006"
+                xmlns:w10="urn:schemas-microsoft-com:office:word"
+                xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
+                xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml"
+                xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"
+                xmlns="http://www.tei-c.org/ns/1.0"
+                version="2.0"
+                exclude-result-prefixes="a cp dc dcterms dcmitype prop    html iso m mml mo mv o pic r rel     tbx tei teidocx v xs ve w10 w wne wp">
+    
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet for converting Word docx files to TEI </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: textruns.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc>
+   </doc>
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Processing an inline run of text with its styling</desc>
+   </doc>
+
+    <xsl:template match="w:commentReference">
+      <xsl:variable name="commentN" select="@w:id"/>
+      <xsl:for-each
+	  select="document(concat($wordDirectory,'/word/comments.xml'))/w:comments/w:comment[@w:id=$commentN]">
+	<note place="comment" resp="{translate(@w:author,' ','_')}">
+	  <date when="{@w:date}"/>
+	  <xsl:apply-templates/>
+	</note>
+      </xsl:for-each>
+    </xsl:template>
+
+    <xsl:template match="w:r">
+      <xsl:call-template name="processTextrun"/>
+    </xsl:template>
+
+
+   <xsl:template name="processTextrun">
+     <xsl:variable name="style">
+       <xsl:value-of select="w:rPr/w:rStyle/@w:val"/>
+     </xsl:variable>
+     <xsl:choose>
+       <xsl:when test="$style='CommentReference'">
+	   <xsl:apply-templates/>
+       </xsl:when>
+
+       <xsl:when test="$style='mentioned'">
+	 <mentioned>
+	   <xsl:apply-templates/>
+	 </mentioned>
+       </xsl:when>
+
+       <xsl:when test="$style='Hyperlink' and ancestor::w:hyperlink">
+	 <xsl:call-template name="basicStyles"/>
+       </xsl:when>
+
+       <xsl:when test="$style='Hyperlink' and ancestor::w:fldSimple">
+	 <xsl:call-template name="basicStyles"/>
+       </xsl:when>
+       
+       <xsl:when test="$style='Hyperlink' and preceding-sibling::w:r[w:instrText][1]/w:instrText">
+	 <ref>
+	   <xsl:attribute name="target">
+	     <xsl:for-each
+		 select="preceding-sibling::w:r[w:instrText][1]/w:instrText">
+	       <xsl:value-of select="substring-before(substring-after(.,'&#x0022;'),'&#x0022;')"/>
+	     </xsl:for-each>
+	   </xsl:attribute>
+	   <xsl:call-template name="basicStyles"/>
+	 </ref>
+       </xsl:when>
+       
+       <xsl:when test="$style='ref'">
+	 <ref>
+	   <xsl:apply-templates/>
+	 </ref>
+       </xsl:when>
+       
+       <xsl:when test="$style='date'">
+	 <date>
+	   <xsl:apply-templates/>
+	 </date>
+       </xsl:when>
+       
+       <xsl:when test="$style='orgName'">
+	 <orgName>
+	   <xsl:apply-templates/>
+	 </orgName>
+       </xsl:when>
+       
+       <xsl:when test="not($style='')">
+	 <hi rend="{replace($style,' ','_')}">
+	   <xsl:apply-templates/>
+	 </hi>
+       </xsl:when>
+       
+       <xsl:otherwise>
+	 <xsl:call-template name="basicStyles"/>
+       </xsl:otherwise>
+       
+     </xsl:choose>
+        
+   </xsl:template>
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>If there is no special style defined, look at the Word
+      underlying basic formatting. We can ignore the run's font change if 
+      a) it's not a special para AND the font is the ISO default, OR 
+      b) the font for the run is the same as its parent paragraph.
+      </desc>
+   </doc>
+    <xsl:template name="basicStyles">
+
+      <xsl:variable name="styles">
+	<xsl:if test="w:rPr/w:rFonts//@w:ascii">
+	  <xsl:if test="(not(matches(parent::w:p/w:pPr/w:pStyle/@w:val,'Special')) and not(matches(w:rPr/w:rFonts/@w:ascii,'Calibri'))) or
+			not(w:rPr/w:rFonts/@w:ascii = parent::w:p/w:pPr/w:rPr/w:rFonts/@w:ascii)">
+	    <xsl:if test="$preserveEffects='true'">
+	      <s n="font-family">
+		<xsl:value-of select="w:rPr/w:rFonts/@w:ascii"/>
+	      </s>
+	    </xsl:if>
+	    <!-- w:ascii="Courier New" w:hAnsi="Courier New" w:cs="Courier New" -->
+	    <!-- what do we want to do about cs (Complex Scripts), hAnsi (high ANSI), eastAsia etc? -->
+	  </xsl:if>
+	</xsl:if>
+	<xsl:if test="w:rPr/w:sz">
+	  <s n="font-size">
+	    <xsl:value-of select="number(w:rPr/w:sz/@w:val) div 2"/>
+	    <xsl:text>pt</xsl:text>
+	  </s>
+	</xsl:if>
+	<xsl:if test="w:rPr/w:position/@w:val and not(w:rPr/w:position/@w:val='0')">
+	  <s n="position">
+	    <xsl:value-of select="w:rPr/w:position/@w:val"/>
+	  </s>
+	</xsl:if>
+      </xsl:variable>
+
+      <xsl:variable name="dir">
+	<!-- right-to-left text -->
+	<xsl:if test="w:rPr/w:rtl or parent::w:p/w:pPr/w:rPr/w:rtl">
+	  <xsl:text>rtl</xsl:text>
+	</xsl:if>
+      </xsl:variable>
+     
+      <xsl:variable name="effects">
+	<xsl:if test="w:rPr/w:position[number(@w:val)&lt;-2]">
+	  <n>subscript</n>
+	</xsl:if>
+	
+	<xsl:if test="w:rPr/w:i">
+	  <n>italic</n>
+	</xsl:if>
+
+	<xsl:choose>
+	  <xsl:when test="w:rPr/w:b/@w:val='0'">
+	    <n>normalweight</n>
+	  </xsl:when>
+	  <xsl:when test="w:rPr/w:b">
+	    <n>bold</n>
+	  </xsl:when>
+	</xsl:choose>
+
+	<xsl:if test="w:rPr/w:position[number(@w:val)&gt;2]">
+	  <n>superscript</n>
+	</xsl:if>
+
+	<xsl:if test="w:rPr/w:vertAlign">
+	  <n>
+	    <xsl:value-of select="w:rPr/w:vertAlign/@w:val"/>
+	  </n>
+	</xsl:if>
+
+	<xsl:if test="w:rPr/w:strike">
+	  <n>strikethrough</n>
+	</xsl:if>
+
+	<xsl:if test="w:rPr/w:dstrike">
+	  <n>strikedoublethrough</n>
+	</xsl:if>
+
+	<xsl:if test="w:rPr/w:u[@w:val='single']">
+	  <n>underline</n>
+	</xsl:if>
+
+	<xsl:if test="w:rPr/w:u[@w:val='wave']">
+	  <n>underwavyline</n>
+	</xsl:if>
+
+	<xsl:if test="w:rPr/w:u[@w:val='double']">
+	  <n>underdoubleline</n>
+	</xsl:if>
+
+	<xsl:if test="w:rPr/w:smallCaps">
+	  <n>smallcaps</n>
+	</xsl:if>
+
+	<xsl:if test="w:rPr/w:caps">
+	  <n>capsall</n>
+	</xsl:if>
+
+	<xsl:if test="w:rPr/w:color and
+		      not(w:rPr/w:color/@w:val='000000' or w:rPr/w:color/@w:val='auto')">
+	  <n>
+	    <xsl:text>color(</xsl:text>
+	    <xsl:value-of select="w:rPr/w:color/@w:val"/>
+	    <xsl:text>)</xsl:text>
+	  </n>
+	</xsl:if>
+
+	<xsl:if test="w:rPr/w:highlight">
+	  <n>
+	    <xsl:text>background(</xsl:text>
+	    <xsl:value-of select="w:rPr/w:highlight/@w:val"/>
+	    <xsl:text>)</xsl:text>
+	  </n>
+	</xsl:if>
+		
+      </xsl:variable>
+
+	<xsl:choose>
+	<xsl:when test="$effects/* or ($styles/* and $preserveEffects='true')">
+	  <hi>
+	    <xsl:if test="$dir!='' and $preserveEffects='true'">
+	      <xsl:attribute name="dir"
+			     xmlns="http://www.w3.org/2005/11/its"
+			     select="$dir"/>
+	    </xsl:if>
+	    <xsl:choose>
+	      <xsl:when test="$effects/*">
+		<xsl:attribute name="rend">
+		  <xsl:for-each select="$effects/*">
+		    <xsl:value-of select="."/>
+		    <xsl:if test="following-sibling::*">
+		      <xsl:text> </xsl:text>
+		    </xsl:if>
+		  </xsl:for-each>
+		</xsl:attribute>
+	      </xsl:when>
+	      <xsl:when test="$preserveEffects='true'">
+		<xsl:attribute name="rend">
+		  <xsl:text>isoStyle</xsl:text>
+		</xsl:attribute>
+	      </xsl:when>
+	    </xsl:choose>
+	    <xsl:if test="$styles/* and $preserveEffects='true'">
+	      <xsl:attribute name="html:style">
+		<xsl:for-each select="$styles/*">
+		  <xsl:value-of select="@n"/>
+		  <xsl:text>:</xsl:text>
+		  <xsl:value-of select="."/>
+		  <xsl:text>;</xsl:text>
+		</xsl:for-each>
+	      </xsl:attribute>
+	    </xsl:if>
+	    <xsl:apply-templates/>
+	  </hi>
+	</xsl:when>
+	<xsl:otherwise>
+	  <xsl:apply-templates/>
+	</xsl:otherwise> 
+      </xsl:choose>
+    </xsl:template>
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+        Handle Text, Comments, Tabs, Symbols etc. 
+    </desc>
+   </doc>
+    <xsl:template match="w:t">
+        <xsl:variable name="t">
+            <xsl:choose>
+                <xsl:when test="@xml:space='preserve' and string-length(normalize-space(.))=0">
+                    <seg><xsl:text> </xsl:text></seg>
+                </xsl:when>
+                <xsl:when test="@xml:space='preserve'">
+                    <xsl:value-of select="."/>
+                </xsl:when>
+                <xsl:otherwise>
+                    <xsl:value-of select="normalize-space(.)"/>
+                </xsl:otherwise>
+            </xsl:choose>
+        </xsl:variable>
+        <xsl:choose>
+            <xsl:when test="parent::w:r/w:rPr/w:rFonts[starts-with(@w:ascii,'ISO')]">
+                <seg html:style="font-family:{parent::w:r/w:rPr/w:rFonts/@w:ascii};">
+                    <xsl:value-of select="$t"/>
+                </seg>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:copy-of select="$t"/>
+            </xsl:otherwise>
+            
+        </xsl:choose>
+    </xsl:template>
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+        Convert special characters (w:syms) into Unicode characters or
+	<gi>g</gi> elements. Symbol to Unicode mapping from http://unicode.org/Public/MAPPINGS/VENDORS/ADOBE/symbol.txt
+    </desc>
+   </doc>
+    <xsl:template match="w:sym">
+      <xsl:choose>
+	<xsl:when test="@w:font='Symbol' or @w:font='MT Symbol'">
+	  <xsl:choose>
+<xsl:when test="@w:char='F022'">&#x2200;</xsl:when><!--	# FOR ALL # universal -->
+<xsl:when test="@w:char='F024'">&#x2203;</xsl:when><!--	# THERE EXISTS # existential -->
+<xsl:when test="@w:char='F025'">&#x0025;</xsl:when><!--	# PERCENT SIGN # percent -->
+<xsl:when test="@w:char='F026'">&#x0026;</xsl:when><!--	# AMPERSAND # ampersand -->
+<xsl:when test="@w:char='F027'">&#x220B;</xsl:when><!--	# CONTAINS AS MEMBER	# suchthat -->
+<xsl:when test="@w:char='F028'">&#x0028;</xsl:when><!--	# LEFT PARENTHESIS	# parenleft -->
+<xsl:when test="@w:char='F029'">&#x0029;</xsl:when><!--	# RIGHT PARENTHESIS	# parenright -->
+<xsl:when test="@w:char='F02A'">&#x2217;</xsl:when><!--	# ASTERISK OPERATOR	# asteriskmath -->
+<xsl:when test="@w:char='F02B'">&#x002B;</xsl:when><!--	# PLUS SIGN # plus -->
+<xsl:when test="@w:char='F02C'">&#x002C;</xsl:when><!--	# COMMA	# comma -->
+<xsl:when test="@w:char='F02D'">&#x2212;</xsl:when><!--	# MINUS SIGN # minus -->
+<xsl:when test="@w:char='F02E'">&#x002E;</xsl:when><!--	# FULL STOP # period -->
+<xsl:when test="@w:char='F02F'">&#x002F;</xsl:when><!--	# SOLIDUS # slash -->
+<xsl:when test="@w:char='F030'">&#x0030;</xsl:when>
+<xsl:when test="@w:char='F031'">&#x0031;</xsl:when><!--	# DIGIT ONE # one -->
+<xsl:when test="@w:char='F032'">&#x0032;</xsl:when><!--	# DIGIT TWO # two -->
+<xsl:when test="@w:char='F033'">&#x0033;</xsl:when><!--	# DIGIT THREE # three -->
+<xsl:when test="@w:char='F034'">&#x0034;</xsl:when><!--	# DIGIT FOUR # four -->
+<xsl:when test="@w:char='F035'">&#x0035;</xsl:when><!--	# DIGIT FIVE # five -->
+<xsl:when test="@w:char='F036'">&#x0036;</xsl:when><!--	# DIGIT SIX # six -->
+<xsl:when test="@w:char='F037'">&#x0037;</xsl:when><!--	# DIGIT SEVEN # seven -->
+<xsl:when test="@w:char='F038'">&#x0038;</xsl:when>
+<xsl:when test="@w:char='F039'">&#x0039;</xsl:when><!--	# DIGIT NINE # nine -->
+<xsl:when test="@w:char='F03A'">&#x003A;</xsl:when><!--	# COLON	# colon -->
+<xsl:when test="@w:char='F03B'">&#x003B;</xsl:when><!--	# SEMICOLON # semicolon -->
+<xsl:when test="@w:char='F03C'">&#x003C;</xsl:when><!--	# LESS-THAN SIGN	# less -->
+<xsl:when test="@w:char='F03D'">&#x003D;</xsl:when><!--	# EQUALS SIGN # equal -->
+<xsl:when test="@w:char='F03E'">&#x003E;</xsl:when><!--	# GREATER-THAN SIGN	# greater -->
+<xsl:when test="@w:char='F03F'">&#x003F;</xsl:when><!--	# QUESTION MARK	# question -->
+<xsl:when test="@w:char='F040'">&#x2245;</xsl:when><!--	# APPROXIMATELY EQUAL TO	# congruent -->
+<xsl:when test="@w:char='F041'">&#x0391;</xsl:when><!--	# GREEK CAPITAL LETTER ALPHA	# Alpha -->
+<xsl:when test="@w:char='F042'">&#x0392;</xsl:when><!--	# GREEK CAPITAL LETTER BETA	# Beta -->
+<xsl:when test="@w:char='F043'">&#x03A7;</xsl:when><!--	# GREEK CAPITAL LETTER CHI	# Chi -->
+<xsl:when test="@w:char='F044'">&#x0394;</xsl:when><!--	# GREEK CAPITAL LETTER DELTA	# Delta -->
+<xsl:when test="@w:char='F044'">&#x2206;</xsl:when><!--	# INCREMENT # Delta -->
+<xsl:when test="@w:char='F045'">&#x0395;</xsl:when><!--	# GREEK CAPITAL LETTER EPSILON	# Epsilon -->
+<xsl:when test="@w:char='F046'">&#x03A6;</xsl:when><!--	# GREEK CAPITAL LETTER PHI	# Phi -->
+<xsl:when test="@w:char='F047'">&#x0393;</xsl:when><!--	# GREEK CAPITAL LETTER GAMMA	# Gamma -->
+<xsl:when test="@w:char='F048'">&#x0397;</xsl:when><!--	# GREEK CAPITAL LETTER ETA	# Eta -->
+<xsl:when test="@w:char='F049'">&#x0399;</xsl:when><!--	# GREEK CAPITAL LETTER IOTA	# Iota -->
+<xsl:when test="@w:char='F04A'">&#x03D1;</xsl:when><!--	# GREEK THETA SYMBOL	# theta1 -->
+<xsl:when test="@w:char='F04B'">&#x039A;</xsl:when><!--	# GREEK CAPITAL LETTER KAPPA	# Kappa -->
+<xsl:when test="@w:char='F04C'">&#x039B;</xsl:when><!--	# GREEK CAPITAL LETTER LAMDA	# Lambda -->
+<xsl:when test="@w:char='F04D'">&#x039C;</xsl:when><!--	# GREEK CAPITAL LETTER MU	# Mu -->
+<xsl:when test="@w:char='F04E'">&#x039D;</xsl:when><!--	# GREEK CAPITAL LETTER NU	# Nu -->
+<xsl:when test="@w:char='F04F'">&#x039F;</xsl:when><!--	# GREEK CAPITAL LETTER OMICRON	# Omicron -->
+<xsl:when test="@w:char='F050'">&#x03A0;</xsl:when><!--	# GREEK CAPITAL LETTER PI	# Pi -->
+<xsl:when test="@w:char='F051'">&#x0398;</xsl:when><!--	# GREEK CAPITAL LETTER THETA	# Theta -->
+<xsl:when test="@w:char='F052'">&#x03A1;</xsl:when><!--	# GREEK CAPITAL LETTER RHO	# Rho -->
+<xsl:when test="@w:char='F053'">&#x03A3;</xsl:when><!--	# GREEK CAPITAL LETTER SIGMA	# Sigma -->
+<xsl:when test="@w:char='F054'">&#x03A4;</xsl:when><!--	# GREEK CAPITAL LETTER TAU	# Tau -->
+<xsl:when test="@w:char='F055'">&#x03A5;</xsl:when><!--	# GREEK CAPITAL LETTER UPSILON	# Upsilon -->
+<xsl:when test="@w:char='F056'">&#x03C2;</xsl:when>
+<xsl:when test="@w:char='F057'">&#x03A9;</xsl:when><!--	# GREEK CAPITAL LETTER OMEGA	# Omega -->
+<xsl:when test="@w:char='F057'">&#x2126;</xsl:when><!--	# OHM SIGN # Omega -->
+<xsl:when test="@w:char='F058'">&#x039E;</xsl:when><!--	# GREEK CAPITAL LETTER XI	# Xi -->
+<xsl:when test="@w:char='F059'">&#x03A8;</xsl:when><!--	# GREEK CAPITAL LETTER PSI	# Psi -->
+<xsl:when test="@w:char='F05A'">&#x0396;</xsl:when><!--	# GREEK CAPITAL LETTER ZETA	# Zeta -->
+<xsl:when test="@w:char='F05B'">&#x005B;</xsl:when><!--	# LEFT SQUARE BRACKET	# bracketleft -->
+<xsl:when test="@w:char='F05C'">&#x2234;</xsl:when><!--	# THEREFORE # therefore -->
+<xsl:when test="@w:char='F05D'">&#x005D;</xsl:when><!--	# RIGHT SQUARE BRACKET	# bracketright -->
+<xsl:when test="@w:char='F05E'">&#x22A5;</xsl:when><!--	# UP TACK # perpendicular -->
+<xsl:when test="@w:char='F05F'">&#x005F;</xsl:when><!--	# LOW LINE # underscore -->
+<xsl:when test="@w:char='F060'">&#xF8E5;</xsl:when><!--	# RADICAL EXTENDER	# radicalex (CUS) -->
+<xsl:when test="@w:char='F061'">&#x03B1;</xsl:when><!--	# GREEK SMALL LETTER ALPHA	# alpha -->
+<xsl:when test="@w:char='F062'">&#x03B2;</xsl:when><!--	# GREEK SMALL LETTER BETA	# beta -->
+<xsl:when test="@w:char='F063'">&#x03C7;</xsl:when><!--	# GREEK SMALL LETTER CHI	# chi -->
+<xsl:when test="@w:char='F064'">&#x03B4;</xsl:when><!--	# GREEK SMALL LETTER DELTA	# delta -->
+<xsl:when test="@w:char='F065'">&#x03B5;</xsl:when><!--	# GREEK SMALL LETTER EPSILON	# epsilon -->
+<xsl:when test="@w:char='F066'">&#x03C6;</xsl:when><!--	# GREEK SMALL LETTER PHI	# phi -->
+<xsl:when test="@w:char='F067'">&#x03B3;</xsl:when><!--	# GREEK SMALL LETTER GAMMA	# gamma -->
+<xsl:when test="@w:char='F068'">&#x03B7;</xsl:when><!--	# GREEK SMALL LETTER ETA	# eta -->
+<xsl:when test="@w:char='F069'">&#x03B9;</xsl:when><!--	# GREEK SMALL LETTER IOTA	# iota -->
+<xsl:when test="@w:char='F06A'">&#x03D5;</xsl:when><!--	# GREEK PHI SYMBOL	# phi1 -->
+<xsl:when test="@w:char='F06B'">&#x03BA;</xsl:when><!--	# GREEK SMALL LETTER KAPPA	# kappa -->
+<xsl:when test="@w:char='F06C'">&#x03BB;</xsl:when><!--	# GREEK SMALL LETTER LAMDA	# lambda -->
+<xsl:when test="@w:char='F06D'">&#x00B5;</xsl:when><!--	# MICRO SIGN # mu -->
+<xsl:when test="@w:char='F06D'">&#x03BC;</xsl:when><!--	# GREEK SMALL LETTER MU	# mu -->
+<xsl:when test="@w:char='F06E'">&#x03BD;</xsl:when><!--	# GREEK SMALL LETTER NU	# nu -->
+<xsl:when test="@w:char='F06F'">&#x03BF;</xsl:when><!--	# GREEK SMALL LETTER OMICRON	# omicron -->
+<xsl:when test="@w:char='F070'">&#x03C0;</xsl:when><!--	# GREEK SMALL LETTER PI	# pi -->
+<xsl:when test="@w:char='F071'">&#x03B8;</xsl:when>
+<xsl:when test="@w:char='F072'">&#x03C1;</xsl:when><!--	# GREEK SMALL LETTER RHO	# rho -->
+<xsl:when test="@w:char='F073'">&#x03C3;</xsl:when><!--	# GREEK SMALL LETTER SIGMA	# sigma -->
+<xsl:when test="@w:char='F074'">&#x03C4;</xsl:when><!--	# GREEK SMALL LETTER TAU	# tau -->
+<xsl:when test="@w:char='F075'">&#x03C5;</xsl:when><!--	# GREEK SMALL LETTER UPSILON	# upsilon -->
+<xsl:when test="@w:char='F076'">&#x03D6;</xsl:when><!--	# GREEK PI SYMBOL	# omega1 -->
+<xsl:when test="@w:char='F077'">&#x03C9;</xsl:when><!--	# GREEK SMALL LETTER OMEGA	# omega -->
+<xsl:when test="@w:char='F078'">&#x03BE;</xsl:when><!--	# GREEK SMALL LETTER XI	# xi -->
+<xsl:when test="@w:char='F079'">&#x03C8;</xsl:when><!--	# GREEK SMALL LETTER PSI	# psi -->
+<xsl:when test="@w:char='F07A'">&#x03B6;</xsl:when><!--	# GREEK SMALL LETTER ZETA	# zeta -->
+<xsl:when test="@w:char='F07B'">&#x007B;</xsl:when><!--	# LEFT CURLY BRACKET	# braceleft -->
+<xsl:when test="@w:char='F07C'">&#x007C;</xsl:when><!--	# VERTICAL LINE	# bar -->
+<xsl:when test="@w:char='F07D'">&#x007D;</xsl:when><!--	# RIGHT CURLY BRACKET	# braceright -->
+<xsl:when test="@w:char='F07E'">&#x223C;</xsl:when><!--	# TILDE OPERATOR	# similar -->
+<xsl:when test="@w:char='F0A0'">&#x20AC;</xsl:when><!--	# EURO SIGN # Euro -->
+<xsl:when test="@w:char='F0A1'">&#x03D2;</xsl:when><!--	# GREEK UPSILON WITH HOOK SYMBOL	# Upsilon1 -->
+<xsl:when test="@w:char='F0A2'">&#x2032;</xsl:when><!--	# PRIME	# minute -->
+<xsl:when test="@w:char='F0A3'">&#x2264;</xsl:when><!--	# LESS-THAN OR EQUAL TO	# lessequal -->
+<xsl:when test="@w:char='F0A4'">&#x2044;</xsl:when><!--	# FRACTION SLASH	# fraction -->
+<xsl:when test="@w:char='F0A4'">&#x2215;</xsl:when><!--	# DIVISION SLASH	# fraction -->
+<xsl:when test="@w:char='F0A5'">&#x221E;</xsl:when><!--	# INFINITY # infinity -->
+<xsl:when test="@w:char='F0A6'">&#x0192;</xsl:when><!--	# LATIN SMALL LETTER F WITH HOOK	# florin -->
+<xsl:when test="@w:char='F0A7'">&#x2663;</xsl:when><!--	# BLACK CLUB SUIT	# club -->
+<xsl:when test="@w:char='F0A8'">&#x2666;</xsl:when><!--	# BLACK DIAMOND SUIT	# diamond -->
+<xsl:when test="@w:char='F0A9'">&#x2665;</xsl:when><!--	# BLACK HEART SUIT	# heart -->
+<xsl:when test="@w:char='F0AA'">&#x2660;</xsl:when><!--	# BLACK SPADE SUIT	# spade -->
+<xsl:when test="@w:char='F0AB'">&#x2194;</xsl:when><!--	# LEFT RIGHT ARROW	# arrowboth -->
+<xsl:when test="@w:char='F0AC'">&#x2190;</xsl:when><!--	# LEFTWARDS ARROW	# arrowleft -->
+<xsl:when test="@w:char='F0AD'">&#x2191;</xsl:when><!--	# UPWARDS ARROW	# arrowup -->
+<xsl:when test="@w:char='F0AE'">&#x2192;</xsl:when><!--	# RIGHTWARDS ARROW	# arrowright -->
+<xsl:when test="@w:char='F0AF'">&#x2193;</xsl:when><!--	# DOWNWARDS ARROW	# arrowdown -->
+<xsl:when test="@w:char='F0B0'">&#x00B0;</xsl:when><!--	# DEGREE SIGN # degree -->
+<xsl:when test="@w:char='F0B1'">&#x00B1;</xsl:when><!--	# PLUS-MINUS SIGN	# plusminus -->
+<xsl:when test="@w:char='F0B2'">&#x2033;</xsl:when><!--	# DOUBLE PRIME # second -->
+<xsl:when test="@w:char='F0B3'">&#x2265;</xsl:when><!--	# GREATER-THAN OR EQUAL TO	# greaterequal -->
+<xsl:when test="@w:char='F0B4'">&#x00D7;</xsl:when><!--	# MULTIPLICATION SIGN	# multiply -->
+<xsl:when test="@w:char='F0B5'">&#x221D;</xsl:when><!--	# PROPORTIONAL TO	# proportional -->
+<xsl:when test="@w:char='F0B6'">&#x2202;</xsl:when><!--	# PARTIAL DIFFERENTIAL	# partialdiff -->
+<xsl:when test="@w:char='F0B7'">&#x2022;</xsl:when><!--	# BULLET # bullet -->
+<xsl:when test="@w:char='F0B8'">&#x00F7;</xsl:when><!--	# DIVISION SIGN	# divide -->
+<xsl:when test="@w:char='F0B9'">&#x2260;</xsl:when><!--	# NOT EQUAL TO # notequal -->
+<xsl:when test="@w:char='F0BA'">&#x2261;</xsl:when><!--	# IDENTICAL TO # equivalence -->
+<xsl:when test="@w:char='F0BB'">&#x2248;</xsl:when><!--	# ALMOST EQUAL TO	# approxequal -->
+<xsl:when test="@w:char='F0BC'">&#x2026;</xsl:when><!--	# HORIZONTAL ELLIPSIS	# ellipsis -->
+<xsl:when test="@w:char='F0BD'">&#xF8E6;</xsl:when><!--	# VERTICAL ARROW EXTENDER	# arrowvertex (CUS) -->
+<xsl:when test="@w:char='F0BE'">&#xF8E7;</xsl:when><!--	# HORIZONTAL ARROW EXTENDER	# arrowhorizex (CUS) -->
+<xsl:when test="@w:char='F0BF'">&#x21B5;</xsl:when><!--	# DOWNWARDS ARROW WITH CORNER LEFTWARDS	# carriagereturn -->
+<xsl:when test="@w:char='F0C0'">&#x2135;</xsl:when><!--	# ALEF SYMBOL # aleph -->
+<xsl:when test="@w:char='F0C1'">&#x2111;</xsl:when><!--	# BLACK-LETTER CAPITAL I	# Ifraktur -->
+<xsl:when test="@w:char='F0C2'">&#x211C;</xsl:when><!--	# BLACK-LETTER CAPITAL R	# Rfraktur -->
+<xsl:when test="@w:char='F0C3'">&#x2118;</xsl:when><!--	# SCRIPT CAPITAL P	# weierstrass -->
+<xsl:when test="@w:char='F0C4'">&#x2297;</xsl:when><!--	# CIRCLED TIMES	# circlemultiply -->
+<xsl:when test="@w:char='F0C5'">&#x2295;</xsl:when><!--	# CIRCLED PLUS # circleplus -->
+<xsl:when test="@w:char='F0C6'">&#x2205;</xsl:when><!--	# EMPTY SET # emptyset -->
+<xsl:when test="@w:char='F0C7'">&#x2229;</xsl:when><!--	# INTERSECTION # intersection -->
+<xsl:when test="@w:char='F0C8'">&#x222A;</xsl:when><!--	# UNION	# union -->
+<xsl:when test="@w:char='F0C9'">&#x2283;</xsl:when><!--	# SUPERSET OF # propersuperset -->
+<xsl:when test="@w:char='F0CA'">&#x2287;</xsl:when><!--	# SUPERSET OF OR EQUAL TO	# reflexsuperset -->
+<xsl:when test="@w:char='F0CB'">&#x2284;</xsl:when><!--	# NOT A SUBSET OF	# notsubset -->
+<xsl:when test="@w:char='F0CC'">&#x2282;</xsl:when><!--	# SUBSET OF # propersubset -->
+<xsl:when test="@w:char='F0CD'">&#x2286;</xsl:when><!--	# SUBSET OF OR EQUAL TO	# reflexsubset -->
+<xsl:when test="@w:char='F0CE'">&#x2208;</xsl:when><!--	# ELEMENT OF # element -->
+<xsl:when test="@w:char='F0CF'">&#x2209;</xsl:when><!--	# NOT AN ELEMENT OF	# notelement -->
+<xsl:when test="@w:char='F0D0'">&#x2220;</xsl:when><!--	# ANGLE	# angle -->
+<xsl:when test="@w:char='F0D1'">&#x2207;</xsl:when><!--	# NABLA	# gradient -->
+<xsl:when test="@w:char='F0D2'">&#xF6DA;</xsl:when><!--	# REGISTERED SIGN SERIF	# registerserif (CUS) -->
+<xsl:when test="@w:char='F0D3'">&#xF6D9;</xsl:when><!--	# COPYRIGHT SIGN SERIF	# copyrightserif (CUS) -->
+<xsl:when test="@w:char='F0D4'">&#xF6DB;</xsl:when><!--	# TRADE MARK SIGN SERIF	# trademarkserif (CUS) -->
+<xsl:when test="@w:char='F0D5'">&#x220F;</xsl:when><!--	# N-ARY PRODUCT	# product -->
+<xsl:when test="@w:char='F0D6'">&#x221A;</xsl:when><!--	# SQUARE ROOT # radical -->
+<xsl:when test="@w:char='F0D7'">&#x22C5;</xsl:when><!--	# DOT OPERATOR # dotmath -->
+<xsl:when test="@w:char='F0D8'">&#x00AC;</xsl:when><!--	# NOT SIGN # logicalnot -->
+<xsl:when test="@w:char='F0D9'">&#x2227;</xsl:when><!--	# LOGICAL AND # logicaland -->
+<xsl:when test="@w:char='F0DA'">&#x2228;</xsl:when><!--	# LOGICAL OR # logicalor -->
+<xsl:when test="@w:char='F0DB'">&#x21D4;</xsl:when><!--	# LEFT RIGHT DOUBLE ARROW	# arrowdblboth -->
+<xsl:when test="@w:char='F0DC'">&#x21D0;</xsl:when><!--	# LEFTWARDS DOUBLE ARROW	# arrowdblleft -->
+<xsl:when test="@w:char='F0DD'">&#x21D1;</xsl:when><!--	# UPWARDS DOUBLE ARROW	# arrowdblup -->
+<xsl:when test="@w:char='F0DE'">&#x21D2;</xsl:when><!--	# RIGHTWARDS DOUBLE ARROW	# arrowdblright -->
+<xsl:when test="@w:char='F0DF'">&#x21D3;</xsl:when><!--	# DOWNWARDS DOUBLE ARROW	# arrowdbldown -->
+<xsl:when test="@w:char='F0E0'">&#x25CA;</xsl:when><!--	# LOZENGE # lozenge -->
+<xsl:when test="@w:char='F0E1'">&#x2329;</xsl:when><!--	# LEFT-POINTING ANGLE BRACKET	# angleleft -->
+<xsl:when test="@w:char='F0E2'">&#xF8E8;</xsl:when><!--	# REGISTERED SIGN SANS SERIF	# registersans (CUS) -->
+<xsl:when test="@w:char='F0E3'">&#xF8E9;</xsl:when><!--	# COPYRIGHT SIGN SANS SERIF	# copyrightsans (CUS) -->
+<xsl:when test="@w:char='F0E4'">&#xF8EA;</xsl:when><!--	# TRADE MARK SIGN SANS SERIF	# trademarksans (CUS) -->
+<xsl:when test="@w:char='F0E5'">&#x2211;</xsl:when><!--	# N-ARY SUMMATION	# summation -->
+<xsl:when test="@w:char='F0E6'">&#xF8EB;</xsl:when><!--	# LEFT PAREN TOP	# parenlefttp (CUS) -->
+<xsl:when test="@w:char='F0E7'">&#xF8EC;</xsl:when><!--	# LEFT PAREN EXTENDER	# parenleftex (CUS) -->
+<xsl:when test="@w:char='F0E8'">&#xF8ED;</xsl:when><!--	# LEFT PAREN BOTTOM	# parenleftbt (CUS) -->
+<xsl:when test="@w:char='F0E9'">&#xF8EE;</xsl:when><!--	# LEFT SQUARE BRACKET TOP	# bracketlefttp (CUS) -->
+<xsl:when test="@w:char='F0EA'">&#xF8EF;</xsl:when><!--	# LEFT SQUARE BRACKET EXTENDER	# bracketleftex (CUS) -->
+<xsl:when test="@w:char='F0EB'">&#xF8F0;</xsl:when><!--	# LEFT SQUARE BRACKET BOTTOM	# bracketleftbt (CUS) -->
+<xsl:when test="@w:char='F0EC'">&#xF8F1;</xsl:when><!--	# LEFT CURLY BRACKET TOP	# bracelefttp (CUS) -->
+<xsl:when test="@w:char='F0ED'">&#xF8F2;</xsl:when><!--	# LEFT CURLY BRACKET MID	# braceleftmid (CUS) -->
+<xsl:when test="@w:char='F0EE'">&#xF8F3;</xsl:when><!--	# LEFT CURLY BRACKET BOTTOM	# braceleftbt (CUS) -->
+<xsl:when test="@w:char='F0EF'">&#xF8F4;</xsl:when><!--	# CURLY BRACKET EXTENDER	# braceex (CUS) -->
+<xsl:when test="@w:char='F0F1'">&#x232A;</xsl:when><!--	# RIGHT-POINTING ANGLE BRACKET	# angleright -->
+<xsl:when test="@w:char='F0F2'">&#x222B;</xsl:when><!--	# INTEGRAL # integral -->
+<xsl:when test="@w:char='F0F3'">&#x2320;</xsl:when><!--	# TOP HALF INTEGRAL	# integraltp -->
+<xsl:when test="@w:char='F0F4'">&#xF8F5;</xsl:when><!--	# INTEGRAL EXTENDER	# integralex (CUS) -->
+<xsl:when test="@w:char='F0F5'">&#x2321;</xsl:when><!--	# BOTTOM HALF INTEGRAL	# integralbt -->
+<xsl:when test="@w:char='F0F6'">&#xF8F6;</xsl:when><!--	# RIGHT PAREN TOP	# parenrighttp (CUS) -->
+<xsl:when test="@w:char='F0F7'">&#xF8F7;</xsl:when><!--	# RIGHT PAREN EXTENDER	# parenrightex (CUS) -->
+<xsl:when test="@w:char='F0F8'">&#xF8F8;</xsl:when><!--	# RIGHT PAREN BOTTOM	# parenrightbt (CUS) -->
+<xsl:when test="@w:char='F0F9'">&#xF8F9;</xsl:when><!--	# RIGHT SQUAREBRACKET TOP	# bracketrighttp (CUS) -->
+<xsl:when test="@w:char='F0FA'">&#xF8FA;</xsl:when><!--	# RIGHT SQUARE BRACKET EXTENDER	# bracketrightex (CUS) -->
+<xsl:when test="@w:char='F0FB'">&#xF8FB;</xsl:when><!--	# RIGHT SQUARE BRACKET BOTTOM	# bracketrightbt (CUS) -->
+<xsl:when test="@w:char='F0FC'">&#xF8FC;</xsl:when><!--	# RIGHT CURLY BRACKET TOP	# bracerighttp (CUS) -->
+<xsl:when test="@w:char='F0FD'">&#xF8FD;</xsl:when><!--	# RIGHT CURLY BRACKET MID	# bracerightmid (CUS) -->
+<xsl:when test="@w:char='F0FE'">&#xF8FE;</xsl:when><!--	# RIGHT CURLY BRACKET BOTTOM	# bracerightbt (CUS) -->
+	<xsl:otherwise> 	  
+	  <g html:style="font-family:{@w:font};" n="{@w:char}"/>
+	</xsl:otherwise>       
+      </xsl:choose> 	
+    </xsl:when>
+    <xsl:when test="@w:font='Wingdings 2' and @w:char='F050'">&#x2713;</xsl:when><!-- tick mark-->
+	<xsl:otherwise> 	  
+	  <g html:style="font-family:{@w:font};" n="{@w:char}"/>
+	</xsl:otherwise>       
+      </xsl:choose>
+    </xsl:template>     
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+        handle tabs
+    </desc>
+   </doc>
+    <xsl:template match="w:r/w:tab">
+      <xsl:text>	</xsl:text>
+    </xsl:template>
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+        handle ptabs (absolute position tab character)
+    </desc>
+   </doc>
+    <xsl:template match="w:r/w:ptab">
+        <c rend="ptab" type="{@w:alignment}">
+            <xsl:text>	</xsl:text>
+        </c>
+    </xsl:template>
+    
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+        capture line breaks
+    </desc>
+   </doc>
+    <xsl:template match="w:br">
+        <xsl:choose>
+            <xsl:when test="@w:type='page'">
+                <pb/>
+            </xsl:when>
+            <xsl:otherwise>
+                <lb/>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+        Contains text that has been tracked as a revision. 
+    </desc>
+   </doc>
+
+    <xsl:template match="w:del">
+      <del when="{@w:date}">
+	<xsl:call-template name="identifyChange">
+	  <xsl:with-param name="who" select="@w:author"/>
+	</xsl:call-template>
+	<xsl:apply-templates/>
+      </del>
+    </xsl:template>
+
+    <xsl:template match="w:rPr/w:del"/>
+
+    <xsl:template match="w:delText">
+      <xsl:apply-templates/>
+    </xsl:template>
+
+    <xsl:template match="w:ins">
+      <add when="{@w:date}">
+	<xsl:call-template name="identifyChange">
+	   <xsl:with-param name="who" select="@w:author"/>
+	</xsl:call-template>
+	<xsl:call-template name="processTextrun"/>
+      </add>
+    </xsl:template>
+
+    <xsl:template match="w:rPr/w:ins"/>
+ 
+    
+  <xsl:template match="w:noBreakHyphen">
+    <xsl:text>&#x2011;</xsl:text>
+  </xsl:template>
+
+
+
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/textruns/textruns.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/marginals/marginals.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/marginals/marginals.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/marginals/marginals.xsl	(revision 258)
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:prop="http://schemas.openxmlformats.org/officeDocument/2006/custom-properties"
+                xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
+                xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties"
+                xmlns:dc="http://purl.org/dc/elements/1.1/"
+                xmlns:dcterms="http://purl.org/dc/terms/"
+                xmlns:dcmitype="http://purl.org/dc/dcmitype/"
+                xmlns:iso="http://www.iso.org/ns/1.0"
+                xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"
+                xmlns:mml="http://www.w3.org/1998/Math/MathML"
+		xmlns:html="http://www.w3.org/1999/xhtml"
+                xmlns:mo="http://schemas.microsoft.com/office/mac/office/2008/main"
+                xmlns:mv="urn:schemas-microsoft-com:mac:vml"
+                xmlns:o="urn:schemas-microsoft-com:office:office"
+                xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"
+                xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
+                xmlns:rel="http://schemas.openxmlformats.org/package/2006/relationships"
+                xmlns:tbx="http://www.lisa.org/TBX-Specification.33.0.html"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teidocx="http://www.tei-c.org/ns/teidocx/1.0"
+                xmlns:v="urn:schemas-microsoft-com:vml"
+                xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006"
+                xmlns:w10="urn:schemas-microsoft-com:office:word"
+                xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
+                xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml"
+                xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"
+                
+                xmlns="http://www.tei-c.org/ns/1.0"
+                version="2.0"
+                exclude-result-prefixes="a cp dc dcterms dcmitype prop  html   iso m mml mo mv o pic r rel     tbx tei teidocx v xs ve w10 w wne wp">
+    
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet for converting Word docx files to TEI </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: marginals.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc>
+   </doc>
+    
+    
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+        Handle footnotes
+    </desc>
+   </doc>
+    <xsl:template match="w:footnoteReference">
+        <note place="foot">
+            <xsl:variable name="referenced-id" select="@w:id"/>
+            <xsl:for-each select="document(concat($wordDirectory,'/word/footnotes.xml'))//w:footnote[@w:id=$referenced-id]">
+                <xsl:apply-templates mode="paragraph"/>
+            </xsl:for-each>
+        </note>
+    </xsl:template>
+    
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+        Handle endnotes
+    </desc>
+   </doc>
+    <xsl:template match="w:endnoteReference">
+        <note place="end">
+            <xsl:variable name="referenced-id" select="@w:id"/>
+            <xsl:for-each select="document(concat($wordDirectory,'/word/endnotes.xml'))//w:endnote[@w:id=$referenced-id]">
+                <xsl:apply-templates mode="paragraph"/>
+            </xsl:for-each>
+        </note>
+    </xsl:template>
+    
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/marginals/marginals.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/lists/lists.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/lists/lists.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/lists/lists.xsl	(revision 258)
@@ -0,0 +1,183 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:prop="http://schemas.openxmlformats.org/officeDocument/2006/custom-properties"
+                xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
+                xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties"
+                xmlns:dc="http://purl.org/dc/elements/1.1/"
+                xmlns:dcterms="http://purl.org/dc/terms/"
+                xmlns:dcmitype="http://purl.org/dc/dcmitype/"
+                xmlns:iso="http://www.iso.org/ns/1.0"
+                xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"
+                xmlns:mml="http://www.w3.org/1998/Math/MathML"
+                xmlns:mo="http://schemas.microsoft.com/office/mac/office/2008/main"
+                xmlns:mv="urn:schemas-microsoft-com:mac:vml"
+                xmlns:o="urn:schemas-microsoft-com:office:office"
+                xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"
+                xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
+                xmlns:rel="http://schemas.openxmlformats.org/package/2006/relationships"
+                xmlns:tbx="http://www.lisa.org/TBX-Specification.33.0.html"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teidocx="http://www.tei-c.org/ns/teidocx/1.0"
+                xmlns:v="urn:schemas-microsoft-com:vml"
+                xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006"
+                xmlns:w10="urn:schemas-microsoft-com:office:word"
+                xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
+                xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml"
+                xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"
+                
+                xmlns="http://www.tei-c.org/ns/1.0"
+                version="2.0"
+                exclude-result-prefixes="a cp dc dcterms dcmitype prop     iso m mml mo mv o pic r rel     tbx tei teidocx v xs ve w10 w wne wp">
+    
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet for converting Word docx files to TEI </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: lists.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc>
+   </doc>
+    
+    
+    <!-- 
+        This template handles lists and takes care of nested lists.
+    -->
+    <xsl:template name="listSection">
+        <xsl:variable name="level">
+            <xsl:value-of select="w:pPr/w:pStyle/@w:val"/>
+        </xsl:variable>
+        <list>
+	  <xsl:call-template name="listType"/>
+	  
+	  <!-- ISO Notes are be handled by a specific handler -->
+	  <xsl:for-each-group select="current-group()"
+			      group-adjacent="if(w:pPr/w:pStyle/@w:val=$level)  then 0 
+					      else if(w:pPr/w:pStyle/@w:val='Note') then 0                 
+					      else if(w:pPr/w:pStyle/@w:val='dl') then 1                
+					      else 1">
+	    <xsl:choose>
+	      <!-- we are still on the same level -->
+	      <xsl:when test="current-grouping-key()=0">
+		<xsl:for-each select="current-group()">
+		  <!-- put items and notes as siblings  for now -->
+		  <xsl:choose>
+		    <xsl:when test="tei:is-list(.)">
+		      <item>
+			<xsl:apply-templates/>
+		      </item>
+		    </xsl:when>
+		    <xsl:otherwise>
+		      <xsl:apply-templates select="." mode="paragraph"/>
+		    </xsl:otherwise>
+		  </xsl:choose>
+		</xsl:for-each>
+	      </xsl:when>
+	      <xsl:otherwise>
+		<xsl:call-template name="listSection"/>
+	      </xsl:otherwise>
+	    </xsl:choose>
+	    
+	  </xsl:for-each-group>
+        </list>
+    </xsl:template>
+    
+    <!--
+        Trying to figure out the style of a list.
+    -->
+    <xsl:template name="listType">
+        <xsl:variable name="style">
+            <xsl:value-of select="w:pPr/w:pStyle/@w:val"/>
+        </xsl:variable>
+        <xsl:variable name="type" select="tei:get-listtype($style)"/>
+        
+        <xsl:attribute name="type">
+            <xsl:choose>
+                <xsl:when test="string-length($type) &gt; 0">
+                    <xsl:value-of select="$type"/>
+                </xsl:when>
+                
+                <!-- try to figure it out by looking at the corresponding numbering file -->
+                <xsl:otherwise>
+                    
+                    <!-- look up the numbering definition .. either in document.xml or in styles.xml  -->
+                    <xsl:variable name="numbering-def">
+                        <xsl:choose>
+                            <xsl:when test="w:pPr/w:numPr/w:numId/@w:val">
+                                <xsl:value-of select="w:pPr/w:numPr/w:numId/@w:val"/>
+                            </xsl:when>
+                            <xsl:otherwise>
+                                <!-- we might want to follow the basedOn reference, but not at the moment -->
+                                <xsl:value-of select="document(concat($wordDirectory,'/word/styles.xml'))//w:style[w:name/@w:val=$style]/w:pPr/w:numPr/w:numId/@w:val"/>
+                            </xsl:otherwise>
+                        </xsl:choose>
+                    </xsl:variable>
+                    
+                    <!-- look up the level .. either in document.xml or in styles.xml  -->
+                    <xsl:variable name="numbering-level">
+                        <xsl:choose>
+                            <xsl:when test="w:pPr/w:numPr/w:ilvl/@w:val">
+                                <xsl:value-of select="w:pPr/w:numPr/w:ilvl/@w:val"/>
+                            </xsl:when>
+                            <xsl:otherwise>
+                                <!-- we might want to follow the basedOn reference, but not at the moment -->
+                                <xsl:value-of select="document(concat($wordDirectory,'/word/styles.xml'))//w:style[w:name/@w:val=$style]/w:pPr/w:numPr/w:ilvl/@w:val"/>
+                            </xsl:otherwise>
+                        </xsl:choose>
+                    </xsl:variable>
+                    
+                    <!-- find the abstract numbering definition and then the corresponding numfmt -->
+                    <xsl:variable name="abstract-def"
+                             select="document(concat($wordDirectory,'/word/numbering.xml'))//w:num[@w:numId=$numbering-def]/w:abstractNumId/@w:val"/>
+                    <xsl:variable name="numfmt">
+                        <xsl:value-of select="document(concat($wordDirectory,'/word/numbering.xml'))//w:abstractNum[@w:abstractNumId=$abstract-def]/w:lvl[@w:ilvl=$numbering-level]/w:numFmt/@w:val"/>
+                    </xsl:variable>
+                    
+                    
+                    <!-- figure out what numbering scheme to use -->
+                    <xsl:choose>
+		        <xsl:when test="$style='dl'">gloss</xsl:when>
+                        <xsl:when test="string-length($numfmt)=0">unordered</xsl:when>
+                        <xsl:when test="$numfmt='bullet'">unordered</xsl:when>
+                        <xsl:otherwise>ordered</xsl:otherwise>
+                    </xsl:choose>
+                </xsl:otherwise>
+            </xsl:choose>
+        </xsl:attribute>
+    </xsl:template>
+    
+    
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/lists/lists.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/templates/tei-templates.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/templates/tei-templates.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/templates/tei-templates.xsl	(revision 258)
@@ -0,0 +1,138 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:prop="http://schemas.openxmlformats.org/officeDocument/2006/custom-properties"
+                xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
+                xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties"
+                xmlns:dc="http://purl.org/dc/elements/1.1/"
+                xmlns:dcterms="http://purl.org/dc/terms/"
+                xmlns:dcmitype="http://purl.org/dc/dcmitype/"
+                xmlns:iso="http://www.iso.org/ns/1.0"
+                xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"
+                xmlns:mml="http://www.w3.org/1998/Math/MathML"
+                xmlns:mo="http://schemas.microsoft.com/office/mac/office/2008/main"
+                xmlns:mv="urn:schemas-microsoft-com:mac:vml"
+                xmlns:o="urn:schemas-microsoft-com:office:office"
+                xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"
+                xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
+                xmlns:rel="http://schemas.openxmlformats.org/package/2006/relationships"
+                xmlns:tbx="http://www.lisa.org/TBX-Specification.33.0.html"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teidocx="http://www.tei-c.org/ns/teidocx/1.0"
+                xmlns:v="urn:schemas-microsoft-com:vml"
+                xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006"
+                xmlns:w10="urn:schemas-microsoft-com:office:word"
+                xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
+                xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml"
+                xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"
+                
+                xmlns="http://www.tei-c.org/ns/1.0"
+                version="2.0"
+                exclude-result-prefixes="a cp dc dcterms dcmitype prop     iso m mml mo mv o pic r rel     tbx tei teidocx v xs ve w10 w wne wp">
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet for converting Word docx files to TEI </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: tei-templates.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc>
+   </doc>
+    
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+    	simple teiHeader. For a more sophisticated header, think about overriding
+        this template
+    </desc>
+   </doc>
+    <xsl:template name="create-tei-header">
+        <teiHeader>
+            <fileDesc>
+                <titleStmt>
+                    <title>
+                        <xsl:call-template name="getDocTitle"/>
+                    </title>
+                    <author>
+                        <xsl:call-template name="getDocAuthor"/>
+                    </author>
+                </titleStmt>
+                <editionStmt>
+                    <edition>
+                        <date>
+                            <xsl:call-template name="getDocDate"/>
+                        </date>
+                    </edition>
+                </editionStmt>
+                <publicationStmt>
+                    <p>unknown</p>
+                </publicationStmt>
+                <sourceDesc>
+                    <p>Converted from a Word document </p>
+                </sourceDesc>
+            </fileDesc>
+	        <encodingDesc>
+	           <xsl:call-template name="generateAppInfo"/>
+	        </encodingDesc>
+            <revisionDesc>
+	           <change>
+		             <date>
+		                <xsl:text>$LastChangedDate: </xsl:text>
+		                <xsl:value-of select="tei:whatsTheDate()"/>
+		                <xsl:text>$</xsl:text>
+		             </date>
+			     <name>
+			       <xsl:call-template name="getDocAuthor"/>
+			     </name>
+	           </change>
+            </revisionDesc>
+        </teiHeader>
+    </xsl:template>
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+     generates a section heading. If you need something specific, feel free
+        to overwrite this template
+    </desc>
+   </doc>
+    <xsl:template name="generate-section-heading">
+        <xsl:param name="Style"/>
+        <head>
+            <xsl:apply-templates/>
+        </head>
+    </xsl:template>
+    
+    
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/templates/tei-templates.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/graphics/graphics.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/graphics/graphics.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/graphics/graphics.xsl	(revision 258)
@@ -0,0 +1,186 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:prop="http://schemas.openxmlformats.org/officeDocument/2006/custom-properties"
+                xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
+                xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties"
+                xmlns:dc="http://purl.org/dc/elements/1.1/"
+                xmlns:dcterms="http://purl.org/dc/terms/"
+                xmlns:dcmitype="http://purl.org/dc/dcmitype/"
+                xmlns:iso="http://www.iso.org/ns/1.0"
+                xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"
+                xmlns:mml="http://www.w3.org/1998/Math/MathML"
+                xmlns:mo="http://schemas.microsoft.com/office/mac/office/2008/main"
+                xmlns:mv="urn:schemas-microsoft-com:mac:vml"
+                xmlns:o="urn:schemas-microsoft-com:office:office"
+                xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"
+                xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
+                xmlns:rel="http://schemas.openxmlformats.org/package/2006/relationships"
+                xmlns:tbx="http://www.lisa.org/TBX-Specification.33.0.html"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teidocx="http://www.tei-c.org/ns/teidocx/1.0"
+                xmlns:v="urn:schemas-microsoft-com:vml"
+                xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006"
+                xmlns:w10="urn:schemas-microsoft-com:office:word"
+                xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
+                xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml"
+                xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"
+                
+                xmlns="http://www.tei-c.org/ns/1.0"
+                version="2.0"
+                exclude-result-prefixes="a cp dc dcterms dcmitype prop     iso m mml mo mv o pic r rel     tbx tei teidocx v xs ve w10 w wne wp">
+    
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet for converting Word docx files to TEI </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: graphics.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc>
+   </doc>
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+        Convert Word drawing objects
+    </desc>
+   </doc>
+    <xsl:template match="w:drawing">
+      <xsl:param name="n" tunnel="yes"/>
+        <xsl:choose>
+            <xsl:when test="$convert-graphics='true'">
+                <xsl:choose>
+                    <xsl:when test="descendant::a:blip[1]/@r:embed">
+                        <graphic>
+			    <xsl:variable name="c">
+			      <xsl:choose>
+			      <xsl:when test="ancestor::w:tbl">
+				<xsl:number level="any" from="w:tbl"/>
+			      </xsl:when>
+			      <xsl:otherwise>
+				<xsl:number level="any"/>
+			      </xsl:otherwise>
+			      </xsl:choose>
+			    </xsl:variable>
+			    <xsl:attribute name="n">
+			      <xsl:choose>
+				<xsl:when test="number($n)">
+				  <xsl:value-of select="($n * 100) + $c"/>
+				</xsl:when>
+				<xsl:otherwise>
+				  <xsl:text>100</xsl:text>
+				  <xsl:number level="any"/>
+				</xsl:otherwise>
+			      </xsl:choose>
+			    </xsl:attribute>
+			  <xsl:attribute name="width"
+					 select="concat(number(descendant::wp:extent[1]/@cx) div 360000,'cm')"/>
+			  <xsl:attribute name="height"
+					 select="concat(number(descendant::wp:extent[1]/@cy) div 360000,'cm')"/>
+				 <xsl:variable name="media-url" select="descendant::pic:cNvPr/@descr"/>
+			 <xsl:choose>
+				 <xsl:when test="starts-with($media-url,'movie::' )">
+					 <xsl:attribute name="url">
+						 <!-- The proper way to do it would be to extract the name from this
+						      <xsl:value-of select="substring-after($media-url, 'movie::')"/>
+						-->
+						 <xsl:value-of select="descendant::pic:cNvPr/@name"/>
+					 </xsl:attribute>
+					 <xsl:attribute name="mimeType">video/x-something</xsl:attribute>
+				 </xsl:when>
+
+				 <xsl:otherwise>
+					 <xsl:attribute name="url">
+						 <xsl:variable name="rid" select="descendant::a:blip[1]/@r:embed"/>
+						 <xsl:value-of select="document(concat($wordDirectory,'/word/_rels/document.xml.rels'))//rel:Relationship[@Id=$rid]/@Target"/>
+					 </xsl:attribute>
+				 </xsl:otherwise>
+			 </xsl:choose>
+
+				 <!-- inline or block -->
+			  <xsl:attribute name="rend">
+                                <xsl:choose>
+                                    <xsl:when test="wp:anchor">block</xsl:when>
+                                    <xsl:otherwise>inline</xsl:otherwise>
+                                </xsl:choose>
+                            </xsl:attribute>
+			    <xsl:if test=".//wp:docPr/@descr">
+			      <xsl:element name="desc">
+				<xsl:value-of select=".//wp:docPr/@descr"/>
+			      </xsl:element>
+			    </xsl:if>                            
+                        </graphic>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <graphic> Linked Graphic: <xsl:variable name="rid" select="@r:link"/>
+                            <xsl:value-of select="document(concat($wordDirectory,'/word/_rels/document.xml.rels'))//rel:Relationship[@Id=$rid]/@Target"/>
+                        </graphic>
+                    </xsl:otherwise>
+                </xsl:choose>
+            </xsl:when>
+            <xsl:otherwise>
+                <w:drawing>
+                    <xsl:apply-templates mode="iden"/>
+                </w:drawing>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+        Guides the identity transformation of blips
+    </desc>
+   </doc>
+    <xsl:template match="a:blip" mode="iden">
+        <a:blip>
+            <xsl:choose>
+                <xsl:when test="@r:embed">
+                    <xsl:variable name="rid" select="@r:embed"/>
+                    <xsl:attribute name="r:embed">
+                        <xsl:value-of select="document(concat($wordDirectory,'/word/_rels/document.xml.rels'))//rel:Relationship[@Id=$rid]/@Target"/>
+                    </xsl:attribute>
+                </xsl:when>
+                <xsl:otherwise>
+                    <xsl:variable name="rid" select="@r:link"/>
+                    <xsl:attribute name="r:link">
+                        <xsl:value-of select="document(concat($wordDirectory,'/word/_rels/document.xml.rels'))//rel:Relationship[@Id=$rid]/@Target"/>
+                    </xsl:attribute>
+                </xsl:otherwise>
+            </xsl:choose>
+            
+        </a:blip>
+    </xsl:template>
+    
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/graphics/graphics.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/utils/utility-templates.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/utils/utility-templates.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/utils/utility-templates.xsl	(revision 258)
@@ -0,0 +1,127 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet 
+                xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:prop="http://schemas.openxmlformats.org/officeDocument/2006/custom-properties"
+                xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
+                xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties"
+                xmlns:dc="http://purl.org/dc/elements/1.1/"
+                xmlns:dcterms="http://purl.org/dc/terms/"
+                xmlns:dcmitype="http://purl.org/dc/dcmitype/"
+                xmlns:iso="http://www.iso.org/ns/1.0"
+                xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"
+                xmlns:mml="http://www.w3.org/1998/Math/MathML"
+                xmlns:mo="http://schemas.microsoft.com/office/mac/office/2008/main"
+                xmlns:mv="urn:schemas-microsoft-com:mac:vml"
+                xmlns:o="urn:schemas-microsoft-com:office:office"
+                xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"
+                xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
+                xmlns:rel="http://schemas.openxmlformats.org/package/2006/relationships"
+                xmlns:tbx="http://www.lisa.org/TBX-Specification.33.0.html"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teidocx="http://www.tei-c.org/ns/teidocx/1.0"
+                xmlns:v="urn:schemas-microsoft-com:vml"
+                xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006"
+                xmlns:w10="urn:schemas-microsoft-com:office:word"
+                xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
+                xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml"
+                xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"
+                
+                xmlns="http://www.tei-c.org/ns/1.0"
+                version="2.0"
+                exclude-result-prefixes="a cp dc dcterms dcmitype prop     iso m mml mo mv o pic r rel     tbx tei teidocx v xs ve w10 w wne wp ">
+
+
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet for converting Word docx files to TEI </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: utility-templates.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc>
+   </doc>
+
+    <xsl:template name="generateAppInfo">
+      <appInfo>
+	        <application ident="TEI_fromDOCX" version="2.15.0">
+	           <label>DOCX to TEI</label>
+	        </application>
+	        <xsl:if test="doc-available(concat($wordDirectory,'/docProps/custom.xml'))">
+	           <xsl:for-each select="document(concat($wordDirectory,'/docProps/custom.xml'))/prop:Properties">
+	              <xsl:for-each select="prop:property">
+	                 <xsl:choose>
+		                   <xsl:when test="@name='TEI_fromDOCX'"/>
+		                   <xsl:when test="contains(@name,'TEI')">
+		                      <application ident="{@name}" version="{.}">
+		                         <label>
+		                            <xsl:value-of select="@name"/>
+		                         </label>
+		                      </application>
+		                   </xsl:when>
+	                 </xsl:choose>
+	              </xsl:for-each>
+		      <xsl:if test="prop:property[@name='WordTemplateURI']">
+			<application ident="WordTemplate" version="{prop:property[@name='WordTemplate']}">
+			  <label>Word template file</label>
+			  <ptr target="{prop:property[@name='WordTemplateURI']}"/>
+			</application>
+		      </xsl:if>
+	           </xsl:for-each>
+	        </xsl:if>
+      </appInfo>
+    </xsl:template>
+
+    <xsl:template name="getDocTitle">
+      <xsl:value-of select="$docProps/cp:coreProperties/dc:title"/>
+    </xsl:template>
+
+    <xsl:template name="getDocAuthor">
+      <xsl:value-of select="$docProps/cp:coreProperties/dc:creator"/>
+    </xsl:template>
+
+    <xsl:template name="getDocDate">
+      <xsl:value-of select="substring-before($docProps/cp:coreProperties/dcterms:created,'T')"/>
+    </xsl:template>
+
+    <xsl:template name="identifyChange">
+      <xsl:param name="who"/>
+      <xsl:attribute name="resp">
+	<xsl:text>#</xsl:text>
+	<xsl:value-of select="translate($who,' ','_')"/>
+      </xsl:attribute>
+    </xsl:template>
+
+
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/from/utils/utility-templates.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/misc/checkword.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/misc/checkword.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/misc/checkword.xsl	(revision 258)
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns="http://www.tei-c.org/ns/1.0"
+                xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006"
+                xmlns:o="urn:schemas-microsoft-com:office:office"
+                xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
+                xmlns:rel="http://schemas.openxmlformats.org/package/2006/relationships"
+                xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"
+                xmlns:v="urn:schemas-microsoft-com:vml"
+                xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"
+                xmlns:w10="urn:schemas-microsoft-com:office:word"
+                xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
+                xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml"
+                xmlns:mml="http://www.w3.org/1998/Math/MathML"
+                xmlns:tbx="http://www.lisa.org/TBX-Specification.33.0.html"
+                version="2.0"
+                exclude-result-prefixes="ve o r m v wp w10 w wne mml tbx">
+
+  <xsl:key name="RIDS" match="*[@r:id]" use="1"/>
+  <xsl:key name="RIDS" match="*[@r:embed]" use="1"/>
+  <xsl:key name="STYLES" match="w:rStyle" use="1"/>
+  <xsl:key name="STYLES" match="w:pStyle" use="1"/>
+  <xsl:key name="STYLELIST" match="w:pStyle" use="@w:val"/>
+  <xsl:key name="STYLELIST" match="w:rStyle" use="@w:val"/>
+  <xsl:key name="R" match="rel:Relationship" use="@Id"/>
+  <xsl:key name="S" match="w:style" use="@w:styleId"/>
+  <xsl:output indent="yes"/>
+  <xsl:template match="/">
+      <xsl:message>Check whether styles used match styles defined: </xsl:message>
+      <xsl:for-each select="key('STYLES',1)">
+         <xsl:if test="generate-id() =generate-id(key('STYLELIST',@w:val)[1])">
+	           <xsl:variable name="v" select="@w:val"/>
+	           <xsl:message>Examine style <xsl:value-of select="$v"/>
+            </xsl:message>
+	           <xsl:for-each select="document('styles.xml',/)">
+	              <xsl:choose>
+	                 <xsl:when test="count(key('S',$v))=0">
+	                    <xsl:message>ERROR: no entry for <xsl:value-of select="$v"/>
+                     </xsl:message>
+	                 </xsl:when>
+	                 <xsl:otherwise>
+	                    <xsl:for-each select="key('S',$v)">
+		                      <xsl:message> .... <xsl:value-of select="$v"/>: <xsl:value-of select="w:name/@w:val"/>
+		                      </xsl:message>
+	                    </xsl:for-each>
+	                 </xsl:otherwise>
+	              </xsl:choose>
+	           </xsl:for-each>
+         </xsl:if>
+      </xsl:for-each>
+
+      <xsl:message>Check whether rIds are listed in document rels: </xsl:message>
+      <xsl:for-each select="key('RIDS',1)">
+         <xsl:variable name="i">
+	   <xsl:value-of select="@r:id|@r:embed"/>
+	 </xsl:variable>
+	 <xsl:for-each select="document('_rels/document.xml.rels',/)">
+	   <xsl:choose>
+	     <xsl:when test="count(key('R',$i))=0">
+	       <xsl:message>ERROR: no entry for <xsl:value-of select="$i"/>
+	       </xsl:message>
+	     </xsl:when>
+	     <xsl:otherwise>
+	       <xsl:for-each select="key('R',$i)">
+		 <xsl:message> .... <xsl:value-of select="$i"/>: <xsl:value-of select="@Target"/>
+		 </xsl:message>
+	       </xsl:for-each>
+	     </xsl:otherwise>
+	   </xsl:choose>
+         </xsl:for-each>
+      </xsl:for-each>
+  </xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/misc/checkword.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/misc/check-docx-and-annotate.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/misc/check-docx-and-annotate.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/misc/check-docx-and-annotate.xsl	(revision 258)
@@ -0,0 +1,286 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:dc="http://purl.org/dc/elements/1.1/"
+                xmlns:dcterms="http://purl.org/dc/terms/"
+                xmlns:dcmitype="http://purl.org/dc/dcmitype/"
+                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:iso="http://www.iso.org/ns/1.0"
+                xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties"
+                xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006"
+                xmlns:o="urn:schemas-microsoft-com:office:office"
+                xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
+                xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"
+                xmlns:v="urn:schemas-microsoft-com:vml"
+                xmlns:fn="http://www.w3.org/2005/02/xpath-functions"
+                xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"
+                xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
+                xmlns:w10="urn:schemas-microsoft-com:office:word"
+                xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
+                xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml"
+                xmlns:mml="http://www.w3.org/1998/Math/MathML"
+                xmlns:tbx="http://www.lisa.org/TBX-Specification.33.0.html"
+                xmlns:con="http://schemas.openxmlformats.org/package/2006/content-types"
+                xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"
+                xmlns:teidocx="http://www.tei-c.org/ns/teidocx/1.0"
+                version="2.0"
+                exclude-result-prefixes="cp con ve o r m v wp w10 w wne mml tbx iso tei a xs pic fn xsi dc dcterms dcmitype">
+    
+    <xsl:output method="xml" version="1.0" encoding="UTF-8"/>
+    
+    <xsl:param name="word-directory">..</xsl:param>
+    <xsl:param name="styleDoc">
+        <xsl:value-of select="concat($wordDirectory, '/word/styles.xml')"/>
+    </xsl:param>
+    
+    <xsl:key name="Styles" match="w:style/w:name" use="@w:val"/>
+    
+    <xsl:template match="/">
+        <xsl:variable name="comments">
+            <xsl:apply-templates mode="comments"/>
+        </xsl:variable>
+        <xsl:variable name="relations">
+            <xsl:apply-templates select="doc(concat($wordDirectory,'/word/_rels/document.xml.rels'))"
+                              mode="relations"/>
+        </xsl:variable>
+        <xsl:variable name="content-types">
+            <xsl:apply-templates mode="content-types" select="doc(concat($wordDirectory,'/Content_Types.xml'))"/>
+        </xsl:variable>
+        
+        <xsl:message>produce actual document</xsl:message>
+        <xsl:apply-templates mode="document"/>    
+        
+        <xsl:message>write out relations</xsl:message>
+        <xsl:call-template name="write-out-relations">
+            <xsl:with-param name="relations" select="$relations"/>
+        </xsl:call-template>
+
+        <xsl:message>write out content types</xsl:message>
+        <xsl:call-template name="write-out-content-types">
+            <xsl:with-param name="types" select="$content-types"/>
+        </xsl:call-template>
+        
+
+        <xsl:message>write out comments</xsl:message>
+        <xsl:call-template name="write-out-comments">
+            <xsl:with-param name="comments" select="$comments"/>
+        </xsl:call-template>
+        
+        <xsl:message>lock down document</xsl:message>
+        <xsl:call-template name="lock-down-document"/>
+    </xsl:template>
+    
+    <!-- identity transform  document-->
+    <xsl:template match="@*|text()|comment()|processing-instruction()" mode="document">
+        <xsl:copy-of select="."/>
+    </xsl:template>
+    
+    <xsl:template match="*" mode="document">
+        <xsl:copy>
+            <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()" mode="document"/>
+        </xsl:copy>
+    </xsl:template>
+    
+    <!-- identity transform relations -->
+    <xsl:template match="@*|text()|comment()|processing-instruction()" mode="relations">
+        <xsl:copy-of select="."/>
+    </xsl:template>
+    
+    <xsl:template match="*" mode="relations">
+        <xsl:copy>
+            <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()" mode="document"/>
+        </xsl:copy>
+    </xsl:template>
+    
+    <!-- copy nothing for comments -->
+    <xsl:template match="@*|text()|comment()|processing-instruction()" mode="comments"/>
+        
+    
+    <xsl:template match="*" mode="comments">
+        <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()" mode="comments"/>
+    </xsl:template>
+    
+    <!-- identity transform content types -->
+    <xsl:template match="@*|text()|comment()|processing-instruction()" mode="content-types">
+        <xsl:copy-of select="."/>
+    </xsl:template>
+    
+    <xsl:template match="*" mode="content-types">
+        <xsl:copy>
+            <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()" mode="content-types"/>
+        </xsl:copy>
+    </xsl:template>    
+
+    <!-- comment helper -->
+    <xsl:template name="create-comment">
+        <xsl:param name="id"/>
+        <xsl:param name="text"/>
+        <w:comment w:id="{$id}" w:author="TEIISO" w:date="2008-09-28T14:17:00Z" w:initials="SPQR">
+            <w:p>
+                <w:pPr>
+                    <w:pStyle w:val="CommentText"/>
+                </w:pPr>
+                <w:r>
+                    <w:annotationRef/>
+		</w:r>
+		<xsl:apply-templates select="$text"/>
+            </w:p>
+        </w:comment>
+    </xsl:template>
+    
+    <!-- put back correct styles -->
+    <xsl:template match="w:pStyle" mode="document">
+        <w:pStyle>
+            <xsl:attribute name="w:val">
+                <xsl:call-template name="getStyleName">
+                    <xsl:with-param name="in" select="@w:val"/>
+                </xsl:call-template>
+            </xsl:attribute>
+        </w:pStyle>
+    </xsl:template>
+    
+    <xsl:template match="w:rStyle" mode="document">
+        <w:rStyle>
+            <xsl:attribute name="w:val">
+                <xsl:call-template name="getStyleName">
+                    <xsl:with-param name="in" select="@w:val"/>
+                </xsl:call-template>
+            </xsl:attribute>
+        </w:rStyle>
+    </xsl:template>
+    
+
+    <xsl:template name="getStyleName">
+        <xsl:param name="in"/>
+        <xsl:for-each select="document($styleDoc,/)">
+            <xsl:for-each select="key('Styles',$in)">
+                <xsl:value-of select="parent::w:style/@w:styleId"/>
+            </xsl:for-each>
+        </xsl:for-each>
+    </xsl:template>
+    
+    
+    <!-- content types -->
+    <xsl:template match="con:Override[@PartName='/word/comments.xml']"/>
+    <!-- write out content-types -->
+    <xsl:template name="write-out-content-types">
+        <xsl:param name="types"/>
+	     <xsl:if test="$debug='true'">
+	        <xsl:message>Writing out <xsl:value-of select="concat($wordDirectory,'/Content_Types_new.xml')"/>
+         </xsl:message>
+	     </xsl:if>
+        <xsl:result-document href="{concat($wordDirectory,'/Content_Types_new.xml')}" standalone="yes">
+            <Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
+                <xsl:for-each select="$types/child::node()/*">
+                    <xsl:copy-of select="."/>
+                </xsl:for-each>
+                <Override PartName="/word/comments.xml"
+                      ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml"/>
+            </Types>
+        </xsl:result-document>
+    </xsl:template>
+    
+    
+    <!-- write out relations -->
+    <xsl:template name="write-out-relations">
+        <xsl:param name="relations"/>
+	     <xsl:if test="$debug='true'">
+	        <xsl:message>Writing out <xsl:value-of select="concat($wordDirectory,'word/_rels/document_new.xml.rels')"/>
+         </xsl:message>
+	     </xsl:if>
+        <xsl:result-document href="{concat($wordDirectory,'/word/_rels/document_new.xml.rels')}"
+                           standalone="yes">
+            <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
+                <xsl:for-each select="$relations/child::node()/*">
+                    <xsl:copy-of select="."/>
+                </xsl:for-each>
+                <Relationship Id="rId9999"
+                          Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments"
+                          Target="comments.xml"/>
+            </Relationships>
+        </xsl:result-document>
+    </xsl:template>
+    
+    <!-- write out comments -->
+    <xsl:template name="write-out-comments">
+        <xsl:param name="comments"/>
+	     <xsl:if test="$debug='true'">
+	        <xsl:message>Writing out <xsl:value-of select="concat($wordDirectory,'word/_rels/comments.xml')"/>
+         </xsl:message>
+	     </xsl:if>
+        <xsl:result-document href="{concat($wordDirectory,'/word/comments.xml')}" standalone="yes">
+            <w:comments xmlns:mv="urn:schemas-microsoft-com:mac:vml"
+                     xmlns:mo="http://schemas.microsoft.com/office/mac/office/2008/main">
+                <xsl:copy-of select="$comments"/>
+            </w:comments>
+        </xsl:result-document>
+    </xsl:template>
+    
+    <!-- writes settings.xml and app.xml to lock down the document -->
+    <xsl:template name="lock-down-document">
+        <xsl:result-document href="{concat($wordDirectory,'/docProps/app.xml')}" standalone="yes">
+            <Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties"
+                     xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes">
+                <Template>STD_3_0_0.dotx</Template>
+                <Application>TEIISO tei-docx.xsl</Application>
+                <DocSecurity>8</DocSecurity>
+                <SharedDoc>true</SharedDoc>
+                <AppVersion>1.0</AppVersion>
+            </Properties>
+        </xsl:result-document>
+        
+        <xsl:result-document href="{concat($wordDirectory,'/word/settings.xml')}" standalone="yes">
+            <w:settings xmlns:sl="http://schemas.openxmlformats.org/schemaLibrary/2006/main">
+                <w:zoom w:percent="100"/>
+                <w:attachedTemplate r:id="rId1"/>
+                <w:linkStyles/>
+                <w:doNotTrackMoves/>
+                <w:documentProtection w:edit="readOnly" w:enforcement="1"/>
+                <w:defaultTabStop w:val="720"/>
+                <w:hyphenationZone w:val="425"/>
+                <w:evenAndOddHeaders/>
+                <w:drawingGridHorizontalSpacing w:val="110"/>
+                <w:displayHorizontalDrawingGridEvery w:val="2"/>
+                <w:characterSpacingControl w:val="doNotCompress"/>
+                <w:hdrShapeDefaults>
+                    <o:shapedefaults v:ext="edit" spidmax="2050"/>
+                </w:hdrShapeDefaults>
+                <w:compat/>
+                <w:rsids/>
+                <m:mathPr>
+                    <m:mathFont m:val="MT Symbol"/>
+                    <m:brkBin m:val="before"/>
+                    <m:brkBinSub m:val="--"/>
+                    <m:smallFrac m:val="off"/>
+                    <m:dispDef/>
+                    <m:lMargin m:val="0"/>
+                    <m:rMargin m:val="0"/>
+                    <m:defJc m:val="centerGroup"/>
+                    <m:wrapIndent m:val="1440"/>
+                    <m:intLim m:val="subSup"/>
+                    <m:naryLim m:val="undOvr"/>
+                </m:mathPr>
+                <w:attachedSchema w:val="ActionsPane3"/>
+                <w:themeFontLang w:val="en-GB"/>
+                <w:clrSchemeMapping w:bg1="light1" w:t1="dark1" w:bg2="light2" w:t2="dark2" w:accent1="accent1"
+                                w:accent2="accent2"
+                                w:accent3="accent3"
+                                w:accent4="accent4"
+                                w:accent5="accent5"
+                                w:accent6="accent6"
+                                w:hyperlink="hyperlink"
+                                w:followedHyperlink="followedHyperlink"/>
+                <w:shapeDefaults>
+                    <o:shapedefaults v:ext="edit" spidmax="2050"/>
+                    <o:shapelayout v:ext="edit">
+                        <o:idmap v:ext="edit" data="1"/>
+                    </o:shapelayout>
+                </w:shapeDefaults>
+                <w:decimalSymbol w:val="."/>
+                <w:listSeparator w:val=","/>
+            </w:settings>
+            
+        </xsl:result-document>
+    </xsl:template>
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/misc/check-docx-and-annotate.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/build-to.xml
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/build-to.xml	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/build-to.xml	(revision 258)
@@ -0,0 +1,147 @@
+<?xml version="1.0" encoding="utf-8"?>
+<project basedir="." default="dist" name="teidocx">
+<!--
+	This library is free software; you can redistribute it and/or
+	modify it under the terms of the GNU Lesser General Public
+	License as published by the Free Software Foundation; either
+	version 2.1 of the License, or (at your option) any later version.
+	
+	This library 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
+	Lesser General Public License for more details.
+	
+	You should have received a copy of the GNU Lesser General Public
+	License along with this library; if not, write to the Free Software
+	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+	
+        Id: $Id: build-to.xml 9875 2011-12-04 18:27:43Z rahtz $
+        Copyright: 2011, TEI Consortium<
+-->
+  <!--
+ Convert TEI documents into docx files.
+ -->
+  <!-- Path to TEI XML file. -->
+  <property name="inputFile" value=""/>
+  <!-- Path where the output docx file will be saved. -->
+  <property name="outputFile" value=""/>
+  <!-- which profile directory-->
+  <property name="profileDir" value="../profiles"/>
+  <!-- which profile -->
+  <property name="profile" value="default"/>
+  <!-- which language -->
+  <property name="lang" value="en"/>
+  <!-- where does oxygen keep stuff -->
+  <property name="oxygenlib" value=""/>
+  <!-- Stylesheet for transformation -->
+  <property name="teitoDocx"       value="${profileDir}/${profile}/docx/to.xsl"/>
+  <property name="listgraphics"    value="../tools/makegraphicsanttask.xsl"/>
+  <dirname property="xslDir"       file="${teitoDocx}"/>
+  <dirname property="inputFileDir" file="${inputFile}"/>
+  <dirname property="outputDir"    file="${outputFile}"/>
+  <property name="outputTempDir"   value="${outputDir}/temp-dir-for-ant"/>
+
+  <path id="classpath">
+    <pathelement path="${java.class.path}"/>
+  </path>
+
+  <condition property="makecoverpages">
+    <available file="${profileDir}/${profile}/docx/makecoverpages.xsl"/>
+  </condition>
+  <import file="../odds2/build-to.xml"/>
+  <target name="setup">
+    <!-- Recreate temporary output directory -->
+    <taskdef name="images" classname="ImageTask" classpath="../tools/ImageInfo/ImageInfo.jar"/>
+    <delete dir="${outputTempDir}"/>
+    <mkdir  dir="${outputTempDir}"/>
+  </target>
+
+  <target name="nocoverpages" unless="makecoverpages">
+    <move file="${outputTempDir}/newdocument.xml" tofile="${outputTempDir}/word/document.xml" overwrite="true"/>
+  </target>
+
+  <target name="coverpages" if="makecoverpages">
+    <echo>Make cover pages</echo>
+    <xslt
+	  style="${profileDir}/${profile}/docx/makecoverpages.xsl" 
+	  in="${outputTempDir}/word/document.xml" 
+	  out="${outputTempDir}/tmp3.xml" 
+	  classpath="classpath">
+      <xmlcatalog>
+	<catalogpath>
+	  <pathelement location="../../../../catalog.xml"/>
+	  <pathelement location="../../../../../xhtml11/dtd/xhtmlcatalog.xml"/>
+	</catalogpath>
+      </xmlcatalog>
+      <factory name="net.sf.saxon.TransformerFactoryImpl"/>
+      <classpath location="${oxygenlib}/saxon9he.jar"/>
+      <param name="headerFile"   expression="file:///${outputTempDir}/tmp2.xml"/>
+      <param name="documentFile" expression="file:///${outputTempDir}/newdocument.xml"/>
+    </xslt>
+    <move file="${outputTempDir}/tmp3.xml" tofile="${outputTempDir}/word/document.xml" overwrite="true"/>
+    <delete file="${outputTempDir}/newdocument.xml"/>
+  </target>
+
+
+
+  <target name="transform">
+    <!-- The transformation for DOCX output. -->
+    <echo level="info">unzip Word template</echo>
+    <unzip src="${xslDir}/template.docx" dest="${outputTempDir}"/>
+    <echo level="info">Get names of graphics files and write an ant task</echo>
+    <xslt force="yes" style="${listgraphics}" classpath="classpath" in="${outputTempDir}/tmp2.xml" out="${outputTempDir}/copy.xml">
+      <xmlcatalog>
+        <catalogpath>
+          <pathelement location="../../../../catalog.xml"/>
+          <pathelement location="../../../../../xhtml11/dtd/xhtmlcatalog.xml"/>
+        </catalogpath>
+      </xmlcatalog>
+      <factory name="net.sf.saxon.TransformerFactoryImpl"/>
+      <classpath location="${oxygenlib}/saxon9ee.jar"/>
+      <param name="inputDir" expression="${inputFileDir}"/>
+      <param name="mediaDir" expression="word/media"/>
+    </xslt>
+    <echo level="info">Copy image files by running ant task</echo>
+    <ant antfile="${outputTempDir}/copy.xml"/>
+    <echo level="info">Read dimensions of image files and write info file</echo>
+    <images outputFile="${outputTempDir}/image-size-info.xml">
+      <fileset dir="${outputTempDir}/word" includes="media/*.*"/>
+    </images>
+    <echo level="info">XSLT generate files for docx </echo>
+    <xslt force="yes" style="${teitoDocx}" in="${outputTempDir}/tmp2.xml" out="${outputTempDir}/newdocument.xml" classpath="classpath">
+      <xmlcatalog>
+        <catalogpath>
+          <pathelement location="../../../../catalog.xml"/>
+          <pathelement location="../../../../../xhtml11/dtd/xhtmlcatalog.xml"/>
+        </catalogpath>
+      </xmlcatalog>
+      <factory name="net.sf.saxon.TransformerFactoryImpl"/>
+      <classpath location="${oxygenlib}/saxon9ee.jar"/>
+      <param name="word-directory" expression="file:///${outputTempDir}"/>
+      <param name="inputDir" expression="${inputFileDir}"/>
+      <!-- supply name of language-->
+      <param name="lang" expression="${lang}" if="lang"/>
+      <!-- emit some diagnostics"-->
+      <param name="debug" expression="${debug}" if="debug"/>
+      <!-- be verbose-->
+      <param name="verbose" expression="${verbose}" if="verbose"/>
+    </xslt>
+    <move file="${outputTempDir}/docProps/newcore.xml" tofile="${outputTempDir}/docProps/core.xml" overwrite="true"/>
+    <move file="${outputTempDir}/docProps/newcustom.xml" tofile="${outputTempDir}/docProps/custom.xml" overwrite="true"/>
+  </target>
+
+  <target name="zip">
+    <echo level="info">ZIP: put files from ${outputTempDir} together into ${outputFile}</echo>
+    <zip destfile="${outputDir}/temp-for-ant.zip" basedir="${outputTempDir}" compress="true" excludes="tmp1.xml,tmp2.xml,image-size-info.xml,copy.xml"/>
+    <move file="${outputDir}/temp-for-ant.zip" tofile="${outputFile}" overwrite="true"/>
+  </target>
+
+  <target name="cleanup" unless="debug">
+    <delete dir="${outputTempDir}"/>
+  </target>
+
+  <target name="dist"
+	  depends="setup,odd,notodd,transform,nocoverpages,coverpages,zip,cleanup"/>
+
+
+</project>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/build-to.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/build-from.xml
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/build-from.xml	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/build-from.xml	(revision 258)
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="utf-8"?>
+<project basedir="." default="dist" name="docxtei">
+<!--
+	This library is free software; you can redistribute it and/or
+	modify it under the terms of the GNU Lesser General Public
+	License as published by the Free Software Foundation; either
+	version 2.1 of the License, or (at your option) any later version.
+	
+	This library 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
+	Lesser General Public License for more details.
+	
+	You should have received a copy of the GNU Lesser General Public
+	License along with this library; if not, write to the Free Software
+	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+	
+        Id: $Id: build-from.xml 9316 2011-09-13 08:06:05Z rahtz $
+        Copyright: 2011, TEI Consortium<
+-->
+  <!--
+ Convert docx files to TEI documents.
+ -->
+  <!-- Path to docx file. -->
+  <property name="inputFile" value=""/>
+  <!-- Path where the output TEI file will be saved. -->
+  <property name="outputFile" value=""/>
+  <!-- which profile -->
+  <property name="profile" value="default"/>
+  <!-- which language -->
+  <property name="lang" value="en"/>
+  <!-- where does oxygen keep stuff -->
+  <property name="oxygenlib" value=""/>
+  <!-- Stylesheet for transformation -->
+  <property name="docxtoTEI"  value="../profiles/${profile}/docx/from.xsl"/>
+  <dirname property="inputFileDir" file="${inputFile}"/>
+  <dirname property="outputDir"    file="${outputFile}"/>
+  <property name="outputTempDir"   value="${outputDir}/temp-dir-for-ant"/>
+
+  <path id="classpath">
+    <pathelement path="${java.class.path}"/>
+  </path>
+
+  <target name="setup">
+    <!-- Recreate temporary output directory -->
+    <delete dir="${outputTempDir}"/>
+    <mkdir  dir="${outputTempDir}"/>
+  </target>
+
+  <target name="dist" depends="convert,mediadir.check,picturecopy,cleanup"/>
+
+  <target name="convert" depends="setup">
+    <echo>Convert using ${docxtoTEI}</echo>
+    <unzip src="${inputFile}" dest="${outputTempDir}"/>
+    <xslt force="yes" style="${docxtoTEI}" classpath="classpath" in="${outputTempDir}/word/document.xml" out="${outputFile}">
+      <xmlcatalog>
+        <catalogpath>
+          <pathelement location="../../../../catalog.xml"/>
+          <pathelement location="../../../../../xhtml11/dtd/xhtmlcatalog.xml"/>
+        </catalogpath>
+      </xmlcatalog>
+      <factory name="net.sf.saxon.TransformerFactoryImpl"/>
+      <classpath location="${oxygenlib}/saxon9ee.jar"/>
+      <param name="word-directory" expression="file:///${outputTempDir}"/>
+      <param name="inputDir" expression="${inputFileDir}"/>
+      <param name="mediaDir" expression="word/media"/>
+    </xslt>
+  </target>
+
+  <target name="mediadir.check">
+    <condition property="mediadir.exists">
+      <available file="${outputTempDir}/word/media" type="dir"/>
+    </condition>
+  </target>
+
+  <target name="picturecopy" if="${mediadir.exists}">
+    <mkdir dir="${outputDir}/media"/>
+    <move todir="${outputDir}/media"  overwrite="true">
+      <fileset dir="${outputTempDir}/word/media"/>
+    </move>
+  </target>
+
+  <target name="cleanup" unless="debug">
+    <delete dir="${outputTempDir}"/>
+  </target>
+
+</project>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/build-from.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/utils/identity/identity.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/utils/identity/identity.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/utils/identity/identity.xsl	(revision 258)
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="2.0">
+
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI utility stylesheet for identity transformation </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: identity.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc>
+   </doc>
+
+    <!-- identity transform -->
+    
+    <xsl:template match="@*|text()|comment()|processing-instruction()" mode="iden">
+        <xsl:copy-of select="."/>
+    </xsl:template>
+    
+    <xsl:template match="*" mode="iden">
+        <xsl:copy>
+            <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()" mode="iden"/>
+	     </xsl:copy>
+    </xsl:template>
+        
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/utils/identity/identity.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/utils/verbatim/verbatim.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/utils/verbatim/verbatim.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/utils/verbatim/verbatim.xsl	(revision 258)
@@ -0,0 +1,603 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:sch="http://www.ascc.net/xml/schematron" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:dbk="http://docbook.org/ns/docbook" xmlns:rng="http://relaxng.org/ns/structure/1.0" xmlns:tei="http://www.tei-c.org/ns/1.0" xmlns:teix="http://www.tei-c.org/ns/Examples" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" exclude-result-prefixes="xlink xhtml dbk rng sch m tei teix atom">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+    <desc>
+      <p> TEI stylesheet for creating verbatim XML </p>
+      <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+      <p>Author: See AUTHORS</p>
+      <p>Id: $Id: verbatim.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+      <p>Copyright: 2008, TEI Consortium</p>
+    </desc>
+  </doc>
+  <xsl:strip-space elements="teix:* rng:* xsl:* xhtml:* atom:* m:*"/>
+  <xsl:param name="startComment">&lt;span class="comment"&gt;</xsl:param>
+  <xsl:param name="endComment">&lt;/span&gt;</xsl:param>
+  <xsl:param name="startElement">&lt;span class="element"&gt;</xsl:param>
+  <xsl:param name="endElement">&lt;/span&gt;</xsl:param>
+  <xsl:param name="startElementName">&lt;span class="elementname"&gt;</xsl:param>
+  <xsl:param name="endElementName">&lt;/span&gt;</xsl:param>
+  <xsl:param name="startAttribute">&lt;span class="attribute"&gt;</xsl:param>
+  <xsl:param name="endAttribute">&lt;/span&gt;</xsl:param>
+  <xsl:param name="startAttributeValue">&lt;span class="attributevalue"&gt;</xsl:param>
+  <xsl:param name="endAttributeValue">&lt;/span&gt;</xsl:param>
+  <xsl:param name="startNamespace">&lt;span class="namespace"&gt;</xsl:param>
+  <xsl:param name="endNamespace">&lt;/span&gt;</xsl:param>
+  <xsl:param name="spaceCharacter">&#160;</xsl:param>
+  <xsl:param name="showNamespaceDecls">true</xsl:param>
+  <xsl:param name="forceWrap">false</xsl:param>
+  <xsl:param name="wrapLength">65</xsl:param>
+  <xsl:param name="attLength">40</xsl:param>
+  <xsl:param name="attsOnSameLine">3</xsl:param>
+  <xsl:key name="Namespaces" match="*[ancestor::teix:egXML]" use="namespace-uri()"/>
+  <xsl:key name="Namespaces" match="*[not(ancestor::*)]" use="namespace-uri()"/>
+  <xsl:template name="verbatim-newLine"/>
+  <xsl:template name="verbatim-getNamespacePrefix">
+    <xsl:variable name="ns" select="namespace-uri()"/>
+    <xsl:choose>
+      <xsl:when test="$ns='http://www.w3.org/XML/1998/namespace'">xml</xsl:when>
+      <xsl:when test="$ns='http://www.tei-c.org/ns/1.0'">tei</xsl:when>
+      <xsl:when test="$ns='http://docbook.org/ns/docbook'">dbk</xsl:when>
+      <xsl:when test="$ns='http://www.w3.org/2001/XMLSchema'">xsd</xsl:when>
+      <xsl:when test="$ns='http://www.ascc.net/xml/schematron'">sch</xsl:when>
+      <xsl:when test="$ns='http://www.w3.org/1998/Math/MathML'">m</xsl:when>
+      <xsl:when test="$ns='http://purl.oclc.org/dsdl/nvdl/ns/structure/1.0'">nvdl</xsl:when>
+      <xsl:when test="$ns='http://relaxng.org/ns/compatibility/annotations/1.0'">a</xsl:when>
+      <xsl:when test="$ns='http://www.w3.org/1999/xhtml'">xhtml</xsl:when>
+      <xsl:when test="$ns='http://www.w3.org/1999/xlink'">xlink</xsl:when>
+      <xsl:when test="$ns='http://relaxng.org/ns/structure/1.0'">rng</xsl:when>
+      <xsl:when test="$ns='http://earth.google.com/kml/2.1'">kml</xsl:when>
+      <xsl:when test="$ns='http://www.w3.org/2005/11/its'">its</xsl:when>
+      <xsl:when test="$ns='http://www.w3.org/1999/XSL/Transform'">xsl</xsl:when>
+      <xsl:when test="$ns='http://www.w3.org/2005/Atom'">atom</xsl:when>
+      <xsl:when test="$ns='http://purl.org/rss/1.0/modules/event/'">ev</xsl:when>
+    </xsl:choose>
+  </xsl:template>
+  <xsl:template name="verbatim-lineBreak">
+    <xsl:param name="id"/>
+    <xsl:text>&#10;</xsl:text>
+  </xsl:template>
+  <xsl:template match="comment()" mode="verbatim">
+    <xsl:choose>
+      <xsl:when test="ancestor::Wrapper"/>
+      <xsl:when test="ancestor::xhtml:Wrapper"/>
+      <xsl:otherwise>
+        <xsl:call-template name="verbatim-lineBreak">
+          <xsl:with-param name="id">21</xsl:with-param>
+        </xsl:call-template>
+        <xsl:value-of disable-output-escaping="yes" select="$startComment"/>
+        <xsl:text>&lt;!--</xsl:text>
+        <xsl:choose>
+          <xsl:when test="$forceWrap='true'">
+            <xsl:call-template name="verbatim-reformatText">
+              <xsl:with-param name="sofar">0</xsl:with-param>
+              <xsl:with-param name="indent">
+                <xsl:text> </xsl:text>
+              </xsl:with-param>
+              <xsl:with-param name="text">
+                <xsl:value-of select="normalize-space(.)"/>
+              </xsl:with-param>
+            </xsl:call-template>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:value-of select="."/>
+          </xsl:otherwise>
+        </xsl:choose>
+        <xsl:text>--&gt;</xsl:text>
+        <xsl:value-of disable-output-escaping="yes" select="$endComment"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <xsl:template match="text()" mode="verbatim">
+    <xsl:choose>
+      <xsl:when test="$forceWrap='true'">
+        <xsl:variable name="indent">
+          <xsl:for-each select="parent::*">
+            <xsl:call-template name="verbatim-makeIndent"/>
+          </xsl:for-each>
+        </xsl:variable>
+        <xsl:if test="string-length(.)&gt;$wrapLength or parent::sch:assert">
+          <xsl:text>&#10;</xsl:text>
+          <xsl:value-of select="$indent"/>
+        </xsl:if>
+        <xsl:call-template name="verbatim-reformatText">
+          <xsl:with-param name="sofar">0</xsl:with-param>
+          <xsl:with-param name="indent">
+            <xsl:value-of select="$indent"/>
+          </xsl:with-param>
+          <xsl:with-param name="text">
+            <xsl:value-of select="normalize-space(.)"/>
+          </xsl:with-param>
+        </xsl:call-template>
+        <xsl:if test="string-length(.)&gt;$wrapLength or parent::sch:assert">
+          <xsl:text>&#10;</xsl:text>
+          <xsl:value-of select="$indent"/>
+        </xsl:if>
+      </xsl:when>
+      <xsl:when test="not(preceding-sibling::node() or         contains(.,'&#10;'))">
+        <xsl:if test="starts-with(.,' ')">
+          <xsl:text> </xsl:text>
+        </xsl:if>
+        <xsl:call-template name="verbatim-Text">
+          <xsl:with-param name="words">
+            <xsl:value-of select="normalize-space(.)"/>
+          </xsl:with-param>
+        </xsl:call-template>
+        <xsl:if test="substring(.,string-length(.),1)=' '">
+          <xsl:text> </xsl:text>
+        </xsl:if>
+      </xsl:when>
+      <xsl:when test="normalize-space(.)=''">
+        <xsl:for-each select="following-sibling::*[1]">
+          <xsl:call-template name="verbatim-lineBreak">
+            <xsl:with-param name="id">7</xsl:with-param>
+          </xsl:call-template>
+          <xsl:call-template name="verbatim-makeIndent"/>
+        </xsl:for-each>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="verbatim-wraptext">
+          <xsl:with-param name="count">0</xsl:with-param>
+          <xsl:with-param name="indent">
+            <xsl:for-each select="parent::*">
+              <xsl:call-template name="verbatim-makeIndent"/>
+            </xsl:for-each>
+          </xsl:with-param>
+          <xsl:with-param name="text">
+            <xsl:choose>
+              <xsl:when test="starts-with(.,'&#10;') and not          (preceding-sibling::node())">
+                <xsl:value-of select="translate(substring(.,2),'&#10;','⌤')"/>
+              </xsl:when>
+              <xsl:otherwise>
+                <xsl:value-of select="translate(.,'&#10;','⌤')"/>
+              </xsl:otherwise>
+            </xsl:choose>
+          </xsl:with-param>
+        </xsl:call-template>
+        <!--
+	<xsl:if test="substring(.,string-length(.))=' '">
+	  <xsl:text> </xsl:text>
+	</xsl:if>
+	-->
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <xsl:template name="verbatim-reformatText">
+    <xsl:param name="indent"/>
+    <xsl:param name="text"/>
+    <xsl:param name="sofar"/>
+    <xsl:choose>
+      <xsl:when test="$sofar&gt;$wrapLength">
+        <xsl:text>&#10;</xsl:text>
+        <xsl:value-of select="$indent"/>
+        <xsl:call-template name="verbatim-reformatText">
+          <xsl:with-param name="text">
+            <xsl:value-of select="$text"/>
+          </xsl:with-param>
+          <xsl:with-param name="sofar">
+            <xsl:text>0</xsl:text>
+          </xsl:with-param>
+          <xsl:with-param name="indent">
+            <xsl:value-of select="$indent"/>
+          </xsl:with-param>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:when test="not(contains($text,' '))">
+        <xsl:call-template name="verbatim-Text">
+          <xsl:with-param name="words">
+            <xsl:value-of select="$text"/>
+          </xsl:with-param>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:variable name="chunk">
+          <xsl:value-of select="substring-before($text,' ')"/>
+        </xsl:variable>
+        <xsl:call-template name="verbatim-Text">
+          <xsl:with-param name="words">
+            <xsl:value-of select="$chunk"/>
+            <xsl:text> </xsl:text>
+          </xsl:with-param>
+        </xsl:call-template>
+        <xsl:call-template name="verbatim-reformatText">
+          <xsl:with-param name="text">
+            <xsl:value-of select="substring-after($text,' ')"/>
+          </xsl:with-param>
+          <xsl:with-param name="sofar">
+            <xsl:value-of select="$sofar + string-length($chunk) + 1"/>
+          </xsl:with-param>
+          <xsl:with-param name="indent">
+            <xsl:value-of select="$indent"/>
+          </xsl:with-param>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <xsl:template name="verbatim-wraptext">
+    <xsl:param name="indent"/>
+    <xsl:param name="text"/>
+    <xsl:param name="count">0</xsl:param>
+    <xsl:variable name="finalSpace">
+      <xsl:choose>
+        <xsl:when test="substring($text,string-length($text),1)=' '">
+          <xsl:text> </xsl:text>
+        </xsl:when>
+        <xsl:when test="substring($text,string-length($text),1)='⌤'">
+          <xsl:text> </xsl:text>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:text/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <!--
+<xsl:message>my text is [<xsl:value-of select="$text"/>]</xsl:message>
+<xsl:message>my space is [<xsl:value-of select="$finalSpace"/>]</xsl:message>
+-->
+    <xsl:choose>
+      <xsl:when test="normalize-space($text)=''"/>
+      <xsl:when test="contains($text,'⌤')">
+        <xsl:if test="$count &gt; 0">
+          <xsl:value-of select="$indent"/>
+          <xsl:text> </xsl:text>
+        </xsl:if>
+        <xsl:if test="starts-with($text,' ')">
+          <xsl:text> </xsl:text>
+        </xsl:if>
+        <xsl:call-template name="verbatim-Text">
+          <xsl:with-param name="words">
+            <xsl:value-of select="normalize-space(substring-before($text,'⌤'))"/>
+          </xsl:with-param>
+        </xsl:call-template>
+        <!--	<xsl:if test="not(substring-after($text,'&#10;')='')">-->
+        <xsl:call-template name="verbatim-lineBreak">
+          <xsl:with-param name="id">6</xsl:with-param>
+        </xsl:call-template>
+        <xsl:value-of select="$indent"/>
+        <xsl:call-template name="verbatim-wraptext">
+          <xsl:with-param name="indent">
+            <xsl:value-of select="$indent"/>
+          </xsl:with-param>
+          <xsl:with-param name="text">
+            <xsl:value-of select="normalize-space(substring-after($text,'⌤'))"/>
+            <xsl:value-of select="$finalSpace"/>
+          </xsl:with-param>
+          <xsl:with-param name="count">
+            <xsl:value-of select="$count + 1"/>
+          </xsl:with-param>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:if test="starts-with($text,' ')">
+          <xsl:text> </xsl:text>
+        </xsl:if>
+        <xsl:if test="$count &gt; 0 and parent::*">
+          <xsl:value-of select="$indent"/>
+          <xsl:text> </xsl:text>
+        </xsl:if>
+        <xsl:call-template name="verbatim-Text">
+          <xsl:with-param name="words">
+            <xsl:value-of select="normalize-space($text)"/>
+            <xsl:value-of select="$finalSpace"/>
+          </xsl:with-param>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <xsl:template name="verbatim-Text">
+    <xsl:param name="words"/>
+    <xsl:analyze-string select="." regex="(&amp;)">
+      <xsl:matching-substring>
+        <xsl:text>&amp;amp;</xsl:text>
+      </xsl:matching-substring>
+      <xsl:non-matching-substring>
+        <xsl:value-of select="."/>
+      </xsl:non-matching-substring>
+    </xsl:analyze-string>
+  </xsl:template>
+  <xsl:template match="*" mode="verbatim">
+    <xsl:choose>
+      <xsl:when test="parent::xhtml:Wrapper"/>
+      <!--      <xsl:when test="child::node()[last()]/self::text()[not(.='')] and child::node()[1]/self::text()[not(.='')]"/>-->
+      <xsl:when test="not(parent::*)  or parent::teix:egXML">
+        <xsl:choose>
+          <xsl:when test="preceding-sibling::node()[1][self::text()]      and following-sibling::node()[1][self::text()]"/>
+          <xsl:when test="preceding-sibling::*">
+            <xsl:call-template name="verbatim-lineBreak">
+              <xsl:with-param name="id">-1</xsl:with-param>
+            </xsl:call-template>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:call-template name="verbatim-newLine"/>
+            <!-- <xsl:call-template name="makeIndent"/>-->
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+      <xsl:when test="not(preceding-sibling::node())">
+        <xsl:call-template name="verbatim-lineBreak">
+          <xsl:with-param name="id">-2</xsl:with-param>
+        </xsl:call-template>
+        <xsl:call-template name="verbatim-makeIndent"/>
+      </xsl:when>
+      <xsl:when test="preceding-sibling::node()[1]/self::*">
+        <xsl:call-template name="verbatim-lineBreak">
+          <xsl:with-param name="id">1</xsl:with-param>
+        </xsl:call-template>
+        <xsl:call-template name="verbatim-makeIndent"/>
+      </xsl:when>
+      <xsl:when test="preceding-sibling::node()[1]/self::text()"> </xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="verbatim-lineBreak">
+          <xsl:with-param name="id">9</xsl:with-param>
+        </xsl:call-template>
+        <xsl:call-template name="verbatim-makeIndent"/>
+      </xsl:otherwise>
+    </xsl:choose>
+    <xsl:value-of disable-output-escaping="yes" select="$startElement"/>
+    <xsl:text>&lt;</xsl:text>
+    <xsl:call-template name="verbatim-makeElementName">
+      <xsl:with-param name="start">true</xsl:with-param>
+    </xsl:call-template>
+    <xsl:apply-templates select="@*" mode="verbatim"/>
+    <xsl:if test="$showNamespaceDecls='true' or parent::teix:egXML[@rend='full']">
+      <!--
+	  <xsl:variable name="me" select="."/>
+	  <xsl:message><xsl:value-of select="name()"/>: </xsl:message>
+	  <xsl:for-each select="in-scope-prefixes(.)">
+	  <xsl:message>  .. <xsl:value-of select="."/>: <xsl:value-of select="namespace-uri-for-prefix(.,$me)"/> </xsl:message>
+	  </xsl:for-each>
+      -->
+      <!-- 2009-02-01 stop emitting xmlns at all -->
+      <!--
+      <xsl:choose>
+        <xsl:when test="not(parent::*)">
+          <xsl:apply-templates select="." mode="ns"/>
+        </xsl:when>
+        <xsl:when test="parent::teix:egXML and not(preceding-sibling::*)">
+          <xsl:apply-templates select="." mode="ns"/>
+        </xsl:when>
+      </xsl:choose>
+      -->
+    </xsl:if>
+    <xsl:choose>
+      <xsl:when test="child::node()">
+        <xsl:text>&gt;</xsl:text>
+        <xsl:value-of disable-output-escaping="yes" select="$endElement"/>
+        <xsl:apply-templates mode="verbatim"/>
+        <xsl:choose>
+          <xsl:when test="child::node()[last()]/self::text() and child::node()[1]/self::text()"/>
+          <xsl:when test="not(parent::*)  or parent::teix:egXML">
+            <xsl:call-template name="verbatim-lineBreak">
+              <xsl:with-param name="id">23</xsl:with-param>
+            </xsl:call-template>
+          </xsl:when>
+          <xsl:when test="child::node()[last()]/self::text()[normalize-space(.)='']">
+            <xsl:call-template name="verbatim-lineBreak">
+              <xsl:with-param name="id">3</xsl:with-param>
+            </xsl:call-template>
+            <xsl:call-template name="verbatim-makeIndent"/>
+          </xsl:when>
+          <xsl:when test="child::node()[last()]/self::comment()">
+            <xsl:call-template name="verbatim-lineBreak">
+              <xsl:with-param name="id">4</xsl:with-param>
+            </xsl:call-template>
+            <xsl:call-template name="verbatim-makeIndent"/>
+          </xsl:when>
+          <xsl:when test="child::node()[last()]/self::*">
+            <xsl:call-template name="verbatim-lineBreak">
+              <xsl:with-param name="id">5</xsl:with-param>
+            </xsl:call-template>
+            <xsl:call-template name="verbatim-makeIndent"/>
+          </xsl:when>
+        </xsl:choose>
+        <xsl:value-of disable-output-escaping="yes" select="$startElement"/>
+        <xsl:text>&lt;/</xsl:text>
+        <xsl:call-template name="verbatim-makeElementName">
+          <xsl:with-param name="start">false</xsl:with-param>
+        </xsl:call-template>
+        <xsl:text>&gt;</xsl:text>
+        <xsl:value-of disable-output-escaping="yes" select="$endElement"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:text>/&gt;</xsl:text>
+        <xsl:value-of disable-output-escaping="yes" select="$endElement"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <xsl:template name="verbatim-createElement">
+    <xsl:param name="special"/>
+    <xsl:param name="name"/>
+    <xsl:value-of select="$name"/>
+  </xsl:template>
+  <xsl:template name="verbatim-createAttribute">
+    <xsl:param name="name"/>
+    <xsl:value-of select="$name"/>
+  </xsl:template>
+  <xsl:template name="verbatim-makeElementName">
+    <xsl:param name="start"/>
+    <!-- get namespace prefix -->
+    <xsl:variable name="ns-prefix">
+      <xsl:call-template name="verbatim-getNamespacePrefix"/>
+    </xsl:variable>
+    <xsl:variable name="ns-parent">
+      <xsl:for-each select="parent::*">
+        <xsl:value-of select="namespace-uri()"/>
+      </xsl:for-each>
+    </xsl:variable>
+    <xsl:variable name="ns">
+      <xsl:value-of select="namespace-uri()"/>
+    </xsl:variable>
+    <xsl:choose>
+      <xsl:when test="namespace-uri()='http://www.tei-c.org/ns/Examples'">
+        <xsl:call-template name="verbatim-createElement">
+          <xsl:with-param name="name" select="local-name(.)"/>
+          <xsl:with-param name="special"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:when test="string-length($ns-prefix) &gt; 0">
+        <xsl:call-template name="verbatim-createElement">
+          <xsl:with-param name="name" select="concat($ns-prefix,concat(':',local-name(.)))"/>
+          <xsl:with-param name="special"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:when test="$ns-parent=$ns">
+        <xsl:call-template name="verbatim-createElement">
+          <xsl:with-param name="name" select="local-name(.)"/>
+          <xsl:with-param name="special"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:when test="not($ns='')">
+        <xsl:call-template name="verbatim-createElement">
+          <xsl:with-param name="name" select="local-name(.)"/>
+          <xsl:with-param name="special"/>
+        </xsl:call-template>
+        <xsl:if test="$start='true'">
+          <xsl:text> xmlns="</xsl:text>
+          <xsl:value-of select="namespace-uri()"/>
+          <xsl:text>"</xsl:text>
+          <xsl:call-template name="verbatim-lineBreak">
+            <xsl:with-param name="id">5</xsl:with-param>
+          </xsl:call-template>
+          <xsl:call-template name="verbatim-makeIndent"/>
+        </xsl:if>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of disable-output-escaping="yes" select="$startElementName"/>
+        <xsl:value-of select="local-name(.)"/>
+        <xsl:value-of disable-output-escaping="yes" select="$endElementName"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <xsl:template name="verbatim-makeIndent">
+    <xsl:variable name="depth" select="count(ancestor::*[not(namespace-uri()='http://www.tei-c.org/ns/1.0')])"/>
+    <xsl:call-template name="verbatim-makeSpace">
+      <xsl:with-param name="d">
+        <xsl:value-of select="$depth"/>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <xsl:template name="verbatim-makeSpace">
+    <xsl:param name="d"/>
+    <xsl:if test="number($d)&gt;1">
+      <xsl:value-of select="$spaceCharacter"/>
+      <xsl:call-template name="verbatim-makeSpace">
+        <xsl:with-param name="d">
+          <xsl:value-of select="$d -1"/>
+        </xsl:with-param>
+      </xsl:call-template>
+    </xsl:if>
+  </xsl:template>
+  <xsl:template match="@*" mode="verbatim">
+    <xsl:variable name="L">
+      <xsl:for-each select="../@*">
+        <xsl:value-of select="."/>
+      </xsl:for-each>
+    </xsl:variable>
+    <xsl:if test="count(../@*)&gt;$attsOnSameLine or      string-length($L)&gt;$attLength or     ancestor::tei:cell[not(@rend='wovenodd-col2')] or     namespace-uri()='http://www.w3.org/2005/11/its' or     string-length(.)+string-length(name(.)) &gt;     $attLength">
+      <xsl:call-template name="verbatim-lineBreak">
+        <xsl:with-param name="id">5</xsl:with-param>
+      </xsl:call-template>
+      <xsl:call-template name="verbatim-makeIndent"/>
+    </xsl:if>
+    <xsl:value-of select="$spaceCharacter"/>
+    <xsl:variable name="ns-prefix">
+      <xsl:call-template name="verbatim-getNamespacePrefix"/>
+    </xsl:variable>
+    <xsl:variable name="name">
+      <xsl:choose>
+        <xsl:when test="string-length($ns-prefix) &gt; 0">
+          <xsl:value-of select="$ns-prefix"/>
+          <xsl:text>:</xsl:text>
+          <xsl:value-of select="local-name(.)"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="local-name(.)"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:call-template name="verbatim-createAttribute">
+      <xsl:with-param name="name" select="$name"/>
+    </xsl:call-template>
+    <xsl:text>="</xsl:text>
+    <xsl:value-of disable-output-escaping="yes" select="$startAttributeValue"/>
+    <xsl:apply-templates select="." mode="attributetext"/>
+    <xsl:value-of disable-output-escaping="yes" select="$endAttributeValue"/>
+    <xsl:text>"</xsl:text>
+  </xsl:template>
+  <xsl:template match="@*" mode="attributetext">
+    <xsl:choose>
+      <xsl:when test="string-length(.)&gt;$attLength and contains(.,' ')">
+        <xsl:call-template name="verbatim-reformatText">
+          <xsl:with-param name="sofar">0</xsl:with-param>
+          <xsl:with-param name="indent">
+            <xsl:text> </xsl:text>
+          </xsl:with-param>
+          <xsl:with-param name="text">
+            <xsl:value-of select="normalize-space(.)"/>
+          </xsl:with-param>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="."/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <xsl:template match="text()|comment()|processing-instruction()" mode="ns"/>
+  <xsl:template match="@*|*" mode="ns">
+    <xsl:variable name="ns" select="namespace-uri()"/>
+    <xsl:choose>
+      <xsl:when test="$ns=''"/>
+      <xsl:when test="$ns='http://relaxng.org/ns/structure/1.0'"/>
+      <xsl:when test="$ns='http://www.w3.org/2001/XInclude'"/>
+      <xsl:when test="$ns='http://www.tei-c.org/ns/Examples'"/>
+      <xsl:when test="$ns='http://www.ascc.net/xml/schematron'"/>
+      <xsl:when test="$ns='http://relaxng.org/ns/compatibility/annotations/1.0'"/>
+      <xsl:when test="$ns='http://www.w3.org/XML/1998/namespace'"/>
+      <xsl:otherwise>
+      </xsl:otherwise>
+    </xsl:choose>
+    <xsl:apply-templates mode="ns" select="@*|*"/>
+  </xsl:template>
+  <xsl:template name="ns">
+    <xsl:param name="nsname"/>
+    <xsl:call-template name="verbatim-lineBreak">
+      <xsl:with-param name="id">22</xsl:with-param>
+    </xsl:call-template>
+    <xsl:text>&#160;&#160;&#160;</xsl:text>
+    <xsl:text>xmlns:</xsl:text>
+    <xsl:value-of select="name(.)"/>
+    <xsl:text>="</xsl:text>
+    <xsl:value-of select="."/>
+    <xsl:text>"</xsl:text>
+  </xsl:template>
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/utils/verbatim/verbatim.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/utils/verbatim/tei-docx-verbatim.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/utils/verbatim/tei-docx-verbatim.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/utils/verbatim/tei-docx-verbatim.xsl	(revision 258)
@@ -0,0 +1,119 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:sch="http://www.ascc.net/xml/schematron"
+                xmlns:m="http://www.w3.org/1998/Math/MathML"
+                xmlns:atom="http://www.w3.org/2005/Atom"
+                xmlns:xlink="http://www.w3.org/1999/xlink"
+                xmlns:xhtml="http://www.w3.org/1999/xhtml"
+                xmlns:dbk="http://docbook.org/ns/docbook"
+                xmlns:rng="http://relaxng.org/ns/structure/1.0"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+		xmlns:iso="http://www.iso.org/ns/1.0"
+		xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
+                version="2.0"
+                exclude-result-prefixes="xlink xhtml dbk iso rng sch m tei teix atom">
+    
+    <xsl:import href="../../../common2/verbatim.xsl"/>
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI Utility stylesheet to create verbatim XML for the TEI to Word conversion </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: tei-docx-verbatim.xsl 9669 2011-11-07 19:17:54Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc>
+   </doc>
+    
+    <!--
+        <xsl:param name="startComment">&lt;span class="comment"&gt;</xsl:param>
+    <xsl:param name="endComment">&lt;/span&gt;</xsl:param>
+    <xsl:param name="startElement">&lt;span class="element"&gt;</xsl:param>
+    <xsl:param name="endElement">&lt;/span&gt;</xsl:param>
+    <xsl:param name="startElementName">&lt;span class="elementname"&gt;</xsl:param>
+    <xsl:param name="endElementName">&lt;/span&gt;</xsl:param>
+    <xsl:param name="startAttribute">&lt;span class="attribute"&gt;</xsl:param>
+    <xsl:param name="endAttribute">&lt;/span&gt;</xsl:param>
+    <xsl:param name="startAttributeValue">&lt;span class="attributevalue"&gt;</xsl:param>
+    <xsl:param name="endAttributeValue">&lt;/span&gt;</xsl:param>
+    <xsl:param name="startNamespace">&lt;span class="namespace"&gt;</xsl:param>
+    <xsl:param name="endNamespace">&lt;/span&gt;</xsl:param>
+    
+    <xsl:param name="spaceCharacter">&#xA0;</xsl:param>
+    <xsl:param name="showNamespaceDecls">true</xsl:param> -->
+    
+    <xsl:param name="startComment"/>
+    <xsl:param name="endComment"/>
+    <xsl:param name="startElement"/>
+    <xsl:param name="endElement"/>
+    <xsl:param name="startElementName"/>
+    <xsl:param name="endElementName"/>
+    <xsl:param name="startAttribute"/>
+    <xsl:param name="endAttribute"/>
+    <xsl:param name="startAttributeValue"/>
+    <xsl:param name="endAttributeValue"/>
+    <xsl:param name="startNamespace"/>
+    <xsl:param name="endNamespace"/>
+    
+    <xsl:param name="spaceCharacter">&#160;</xsl:param>
+    <xsl:param name="showNamespaceDecls">true</xsl:param>
+    
+    <xsl:template name="verbatim-lineBreak">
+        <xsl:param name="id"/>
+        <tei:lb/>
+    </xsl:template>
+    
+    <xsl:template name="verbatim-createElement">
+        <xsl:param name="name"/>
+        <xsl:param name="special"/>
+        <tei:hi rend="bold">
+            <xsl:value-of select="$name"/>
+        </tei:hi>
+    </xsl:template>
+    
+    <xsl:template name="verbatim-createAttribute">
+        <xsl:param name="name"/>
+        <tei:hi rend="bold">
+            <xsl:value-of select="$name"/>
+        </tei:hi>
+    </xsl:template>    
+    
+    
+    
+    <xsl:template name="create-egXML-section">
+        <xsl:apply-templates mode="verbatim"/>
+    </xsl:template>
+    
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/utils/verbatim/tei-docx-verbatim.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/utils/maths/mml2omml.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/utils/maths/mml2omml.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/utils/maths/mml2omml.xsl	(revision 258)
@@ -0,0 +1,3722 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Beta Version 070708 --><xsl:stylesheet xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:mml="http://www.w3.org/1998/Math/MathML"
+                xmlns="http://schemas.openxmlformats.org/officeDocument/2006/math"
+                xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"
+                version="2.0"
+                exclude-result-prefixes="mml m w">
+  <xsl:output method="xml" encoding="UTF-8"/>
+
+
+  <xsl:variable name="StrUCAlphabet">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable>
+  <xsl:variable name="StrLCAlphabet">abcdefghijklmnopqrstuvwxyz</xsl:variable>
+
+
+<!--
+  <xsl:template match="/">
+    <oMath>
+      <xsl:apply-templates mode="mml"  />
+    </oMath>
+  </xsl:template>
+-->
+
+  <!-- %%Template: SReplace
+
+		Replace all occurences of sOrig in sInput with sReplacement
+		and return the resulting string. -->
+  <xsl:template name="SReplace">
+      <xsl:param name="sInput"/>
+      <xsl:param name="sOrig"/>
+      <xsl:param name="sReplacement"/>
+
+      <xsl:choose>
+         <xsl:when test="not(contains($sInput, $sOrig))">
+            <xsl:value-of select="$sInput"/>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:variable name="sBefore" select="substring-before($sInput, $sOrig)"/>
+            <xsl:variable name="sAfter" select="substring-after($sInput, $sOrig)"/>
+            <xsl:variable name="sAfterProcessed">
+               <xsl:call-template name="SReplace">
+                  <xsl:with-param name="sInput" select="$sAfter"/>
+                  <xsl:with-param name="sOrig" select="$sOrig"/>
+                  <xsl:with-param name="sReplacement" select="$sReplacement"/>
+               </xsl:call-template>
+            </xsl:variable>
+
+            <xsl:value-of select="concat($sBefore, concat($sReplacement, $sAfterProcessed))"/>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+  <!-- %%Template: OutputText
+
+		Post processing on the string given and otherwise do
+		a xsl:value-of on it -->
+  <xsl:template name="OutputText">
+      <xsl:param name="sInput"/>
+
+      <!-- Add local Variable as you add new post processing tasks -->
+
+    <!-- 1. Remove any unwanted characters -->
+    <xsl:variable name="sCharStrip">
+         <xsl:value-of select="translate($sInput, '⁢​', '')"/>
+      </xsl:variable>
+
+      <!-- 2. Replace any characters as needed -->
+    <!--	Replace &#x2A75; <-> ==			 -->
+    <xsl:variable name="sCharReplace">
+         <xsl:call-template name="SReplace">
+            <xsl:with-param name="sInput" select="$sCharStrip"/>
+            <xsl:with-param name="sOrig" select="'⩵'"/>
+            <xsl:with-param name="sReplacement" select="'=='"/>
+         </xsl:call-template>
+      </xsl:variable>
+
+      <!-- Finally, return the last value -->
+    <xsl:value-of select="$sCharReplace"/>
+  </xsl:template>
+
+
+  <!-- Template that determines whether or the given node 
+	     ndCur is a token element that doesn't have an mglyph as 
+			 a child.
+	-->
+  <xsl:template name="FNonGlyphToken">
+      <xsl:param name="ndCur" select="."/>
+      <xsl:choose>
+         <xsl:when test="$ndCur/self::mml:mi[not(child::mml:mglyph)] |                        $ndCur/self::mml:mn[not(child::mml:mglyph)] |                        $ndCur/self::mml:mo[not(child::mml:mglyph)] |                        $ndCur/self::mml:ms[not(child::mml:mglyph)] |                        $ndCur/self::mml:mtext[not(child::mml:mglyph)]">1</xsl:when>
+         <xsl:otherwise>0</xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+
+  <!-- Template used to determine if the current token element (ndCur) is the beginning of a run. 
+			 A token element is the beginning of if:
+			 
+			 the count of preceding elements is 0 
+			 or 
+			 the directory preceding element is not a non-glyph token.
+	-->
+  <xsl:template name="FStartOfRun">
+      <xsl:param name="ndCur" select="."/>
+      <xsl:variable name="fPrecSibNonGlyphToken">
+         <xsl:call-template name="FNonGlyphToken">
+            <xsl:with-param name="ndCur" select="$ndCur/preceding-sibling::*[1]"/>
+         </xsl:call-template>
+      </xsl:variable>
+      <xsl:choose>
+         <xsl:when test="count($ndCur/preceding-sibling::*)=0             or $fPrecSibNonGlyphToken=0">1</xsl:when>
+         <xsl:otherwise>0</xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+  <!-- Template that determines if ndCur is the argument of an nary expression. 
+			 
+			 ndCur is the argument of an nary expression if:
+			 
+			 1.  The preceding sibling is one of the following:  munder, mover, msub, msup, munder, msubsup, munderover
+			 and
+			 2.  The preceding sibling's child is an nary char as specified by the template "isNary"
+	-->
+  <xsl:template name="FIsNaryArgument">
+      <xsl:param name="ndCur" select="."/>
+
+      <xsl:variable name="fNary">
+         <xsl:call-template name="isNary">
+            <xsl:with-param name="ndCur" select="$ndCur/preceding-sibling::*[1]/child::*[1]"/>
+         </xsl:call-template>
+      </xsl:variable>
+      <xsl:choose>
+         <xsl:when test="preceding-sibling::*[1][self::mml:munder or self::mml:mover or self::mml:munderover or                                                     self::mml:msub or self::mml:msup or self::mml:msubsup]              and $fNary='true'">1</xsl:when>
+         <xsl:otherwise>0</xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+  <!-- %%Template: mml:mrow | mml:mstyle
+
+		 if this row is the next sibling of an n-ary (i.e. any of 
+         mover, munder, munderover, msupsub, msup, or msub with 
+         the base being an n-ary operator) then ignore this. Otherwise
+         pass through -->
+  <xsl:template mode="mml" match="mml:mrow|mml:mstyle">
+      <xsl:variable name="fNaryArgument">
+         <xsl:call-template name="FIsNaryArgument">
+            <xsl:with-param name="ndCur" select="."/>
+         </xsl:call-template>
+      </xsl:variable>
+      <xsl:if test="$fNaryArgument=0">
+         <xsl:variable name="fLinearFrac">
+            <xsl:call-template name="FLinearFrac">
+               <xsl:with-param name="ndCur" select="."/>
+            </xsl:call-template>
+         </xsl:variable>
+         <xsl:choose>
+            <xsl:when test="$fLinearFrac=1">
+               <xsl:call-template name="MakeLinearFraction">
+                  <xsl:with-param name="ndCur" select="."/>
+               </xsl:call-template>
+            </xsl:when>
+            <xsl:otherwise>
+               <xsl:variable name="fFunc">
+                  <xsl:call-template name="FIsFunc">
+                     <xsl:with-param name="ndCur" select="."/>
+                  </xsl:call-template>
+               </xsl:variable>
+               <xsl:choose>
+                  <xsl:when test="$fFunc=1">
+                     <xsl:call-template name="WriteFunc">
+                        <xsl:with-param name="ndCur" select="."/>
+                     </xsl:call-template>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:apply-templates mode="mml"/>
+                  </xsl:otherwise>
+               </xsl:choose>
+            </xsl:otherwise>
+         </xsl:choose>
+      </xsl:if>
+  </xsl:template>
+  <xsl:template mode="mml"
+                 match="mml:mi[not(child::mml:mglyph)] |                        mml:mn[not(child::mml:mglyph)] |                        mml:mo[not(child::mml:mglyph)] |                        mml:ms[not(child::mml:mglyph)] |                        mml:mtext[not(child::mml:mglyph)]">
+
+    <!-- tokens with mglyphs as children are tranformed
+			 in a different manner than "normal" token elements.  
+			 Where normal token elements are token elements that
+			 contain only text -->
+    <xsl:variable name="fStartOfRun">
+         <xsl:call-template name="FStartOfRun">
+            <xsl:with-param name="ndCur" select="."/>
+         </xsl:call-template>
+      </xsl:variable>
+
+      <!--In MathML, successive characters that are all part of one string are sometimes listed as separate 
+			tags based on their type (identifier (mi), name (mn), operator (mo), quoted (ms), literal text (mtext)), 
+			where said tags act to link one another into one logical run.  In order to wrap the text of successive mi's, 
+			mn's, and mo's into one m:t, we need to denote where a run begins.  The beginning of a run is the first mi, mn, 
+			or mo whose immediately preceding sibling either doesn't exist or is something other than a "normal" mi, mn, mo, 
+			ms, or mtext tag-->
+
+    <!-- If this mi/mo/mn/ms . . . is part the numerator or denominator of a linear fraction, then don't collect. -->
+    <xsl:variable name="fLinearFracParent">
+         <xsl:call-template name="FLinearFrac">
+            <xsl:with-param name="ndCur" select="parent::*"/>
+         </xsl:call-template>
+      </xsl:variable>
+      <!-- If this mi/mo/mn/ms . . . is part of the name of a function, then don't collect. -->
+    <xsl:variable name="fFunctionName">
+         <xsl:call-template name="FIsFunc">
+            <xsl:with-param name="ndCur" select="parent::*"/>
+         </xsl:call-template>
+      </xsl:variable>
+      <xsl:variable name="fShouldCollect"
+                    select="($fLinearFracParent=0 and $fFunctionName=0) and (parent::mml:mrow or parent::mml:mstyle or       parent::mml:msqrt or parent::mml:menclose or      parent::mml:math or parent::mml:mphantom or       parent::mml:mtd or parent::mml:maction)"/>
+
+      <!--In MathML, the meaning of the different parts that make up mathematical structures, such as a fraction 
+			having a numerator and a denominator, is determined by the relative order of those different parts.  
+			For instance, In a fraction, the numerator is the first child and the denominator is the second child.  
+			To allow for more complex structures, MathML allows one to link a group of mi, mn, and mo's together 
+			using the mrow, or mstyle tags.  The mi, mn, and mo's found within any of the above tags are considered 
+			one run.  Therefore, if the parent of any mi, mn, or mo is found to be an mrow or mstyle, then the contiguous 
+			mi, mn, and mo's will be considered one run.-->
+    <xsl:choose>
+         <xsl:when test="$fShouldCollect">
+            <xsl:choose>
+               <xsl:when test="$fStartOfRun=1">
+            <!--If this is the beginning of the run, pass all run attributes to CreateRunWithSameProp.-->
+            <xsl:call-template name="CreateRunWithSameProp">
+                     <xsl:with-param name="mathbackground">
+								<!-- Look for the unqualified mathml attribute mathbackground.
+										 Fall back to the qualified mathml attribute if necessary.
+										 This priority of unqualified over qualified will be 
+										 followed throughout this xslt. -->
+                <xsl:choose>
+                           <xsl:when test="@mathbackground">
+                              <xsl:value-of select="@mathbackground"/>
+                           </xsl:when>
+                           <xsl:otherwise>
+                              <xsl:value-of select="@mml:mathbackground"/>
+                           </xsl:otherwise>
+                        </xsl:choose>
+                     </xsl:with-param>
+                     <xsl:with-param name="mathcolor">
+                        <xsl:choose>
+                           <xsl:when test="@mathcolor">
+                              <xsl:value-of select="@mathcolor"/>
+                           </xsl:when>
+                           <xsl:otherwise>
+                              <xsl:value-of select="@mml:mathcolor"/>
+                           </xsl:otherwise>
+                        </xsl:choose>
+                     </xsl:with-param>
+                     <xsl:with-param name="mathvariant">
+                        <xsl:choose>
+                           <xsl:when test="@mathvariant">
+                              <xsl:value-of select="@mathvariant"/>
+                           </xsl:when>
+                           <xsl:otherwise>
+                              <xsl:value-of select="@mml:mathvariant"/>
+                           </xsl:otherwise>
+                        </xsl:choose>
+                     </xsl:with-param>
+                     <xsl:with-param name="color">
+                        <xsl:choose>
+                           <xsl:when test="@color">
+                              <xsl:value-of select="@color"/>
+                           </xsl:when>
+                           <xsl:otherwise>
+                              <xsl:value-of select="@mml:color"/>
+                           </xsl:otherwise>
+                        </xsl:choose>
+                     </xsl:with-param>
+                     <xsl:with-param name="font-family">
+                        <xsl:choose>
+                           <xsl:when test="@font-family">
+                              <xsl:value-of select="@font-family"/>
+                           </xsl:when>
+                           <xsl:otherwise>
+                              <xsl:value-of select="@mml:font-family"/>
+                           </xsl:otherwise>
+                        </xsl:choose>
+                     </xsl:with-param>
+                     <xsl:with-param name="fontsize">
+                        <xsl:choose>
+                           <xsl:when test="@fontsize">
+                              <xsl:value-of select="@fontsize"/>
+                           </xsl:when>
+                           <xsl:otherwise>
+                              <xsl:value-of select="@mml:fontsize"/>
+                           </xsl:otherwise>
+                        </xsl:choose>
+                     </xsl:with-param>
+                     <xsl:with-param name="fontstyle">
+                        <xsl:choose>
+                           <xsl:when test="@fontstyle">
+                              <xsl:value-of select="@fontstyle"/>
+                           </xsl:when>
+                           <xsl:otherwise>
+                              <xsl:value-of select="@mml:fontstyle"/>
+                           </xsl:otherwise>
+                        </xsl:choose>
+                     </xsl:with-param>
+                     <xsl:with-param name="fontweight">
+                        <xsl:choose>
+                           <xsl:when test="@fontweight">
+                              <xsl:value-of select="@fontweight"/>
+                           </xsl:when>
+                           <xsl:otherwise>
+                              <xsl:value-of select="@mml:fontweight"/>
+                           </xsl:otherwise>
+                        </xsl:choose>
+                     </xsl:with-param>
+                     <xsl:with-param name="mathsize">
+                        <xsl:choose>
+                           <xsl:when test="@mathsize">
+                              <xsl:value-of select="@mathsize"/>
+                           </xsl:when>
+                           <xsl:otherwise>
+                              <xsl:value-of select="@mml:mathsize"/>
+                           </xsl:otherwise>
+                        </xsl:choose>
+                     </xsl:with-param>
+                     <xsl:with-param name="ndTokenFirst" select="."/>
+                  </xsl:call-template>
+               </xsl:when>
+            </xsl:choose>
+         </xsl:when>
+         <xsl:otherwise>
+        <!--Only one element will be part of run-->
+        <r>
+          <!--Create Run Properties based on current node's attributes-->
+          <xsl:call-template name="CreateRunProp">
+                  <xsl:with-param name="mathvariant">
+                     <xsl:choose>
+                        <xsl:when test="@mathvariant">
+                           <xsl:value-of select="@mathvariant"/>
+                        </xsl:when>
+                        <xsl:otherwise>
+                           <xsl:value-of select="@mml:mathvariant"/>
+                        </xsl:otherwise>
+                     </xsl:choose>
+                  </xsl:with-param>
+                  <xsl:with-param name="fontstyle">
+                     <xsl:choose>
+                        <xsl:when test="@fontstyle">
+                           <xsl:value-of select="@fontstyle"/>
+                        </xsl:when>
+                        <xsl:otherwise>
+                           <xsl:value-of select="@mml:fontstyle"/>
+                        </xsl:otherwise>
+                     </xsl:choose>
+                  </xsl:with-param>
+                  <xsl:with-param name="fontweight">
+                     <xsl:choose>
+                        <xsl:when test="@fontweight">
+                           <xsl:value-of select="@fontweight"/>
+                        </xsl:when>
+                        <xsl:otherwise>
+                           <xsl:value-of select="@mml:fontweight"/>
+                        </xsl:otherwise>
+                     </xsl:choose>
+                  </xsl:with-param>
+                  <xsl:with-param name="mathcolor">
+                     <xsl:choose>
+                        <xsl:when test="@mathcolor">
+                           <xsl:value-of select="@mathcolor"/>
+                        </xsl:when>
+                        <xsl:otherwise>
+                           <xsl:value-of select="@mml:mathcolor"/>
+                        </xsl:otherwise>
+                     </xsl:choose>
+                  </xsl:with-param>
+                  <xsl:with-param name="mathsize">
+                     <xsl:choose>
+                        <xsl:when test="@mathsize">
+                           <xsl:value-of select="@mathsize"/>
+                        </xsl:when>
+                        <xsl:otherwise>
+                           <xsl:value-of select="@mml:mathsize"/>
+                        </xsl:otherwise>
+                     </xsl:choose>
+                  </xsl:with-param>
+                  <xsl:with-param name="color">
+                     <xsl:choose>
+                        <xsl:when test="@color">
+                           <xsl:value-of select="@color"/>
+                        </xsl:when>
+                        <xsl:otherwise>
+                           <xsl:value-of select="@mml:color"/>
+                        </xsl:otherwise>
+                     </xsl:choose>
+                  </xsl:with-param>
+                  <xsl:with-param name="fontsize">
+                     <xsl:choose>
+                        <xsl:when test="@fontsize">
+                           <xsl:value-of select="@fontsize"/>
+                        </xsl:when>
+                        <xsl:otherwise>
+                           <xsl:value-of select="@mml:fontsize"/>
+                        </xsl:otherwise>
+                     </xsl:choose>
+                  </xsl:with-param>
+                  <xsl:with-param name="ndCur" select="."/>
+                  <xsl:with-param name="fNor">
+                     <xsl:call-template name="FNor">
+                        <xsl:with-param name="ndCur" select="."/>
+                     </xsl:call-template>
+                  </xsl:with-param>
+                  <xsl:with-param name="fLit">
+                     <xsl:call-template name="FLit">
+                        <xsl:with-param name="ndCur" select="."/>
+                     </xsl:call-template>
+                  </xsl:with-param>
+               </xsl:call-template>
+               <t>
+                  <xsl:call-template name="OutputText">
+                     <xsl:with-param name="sInput" select="normalize-space(.)"/>
+                  </xsl:call-template>
+               </t>
+            </r>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+  <!-- %%Template: CreateRunWithSameProp
+	-->
+  <xsl:template name="CreateRunWithSameProp">
+      <xsl:param name="mathbackground"/>
+      <xsl:param name="mathcolor"/>
+      <xsl:param name="mathvariant"/>
+      <xsl:param name="color"/>
+      <xsl:param name="font-family"/>
+      <xsl:param name="fontsize"/>
+      <xsl:param name="fontstyle"/>
+      <xsl:param name="fontweight"/>
+      <xsl:param name="mathsize"/>
+      <xsl:param name="ndTokenFirst"/>
+
+      <!--Given mathcolor, color, mstyle's (ancestor) color, and precedence of 
+			said attributes, determine the actual color of the current run-->
+    <xsl:variable name="sColorPropCur">
+         <xsl:choose>
+            <xsl:when test="$mathcolor!=''">
+               <xsl:value-of select="$mathcolor"/>
+            </xsl:when>
+            <xsl:when test="$color!=''">
+               <xsl:value-of select="$color"/>
+            </xsl:when>
+            <xsl:when test="$ndTokenFirst/ancestor::mml:mstyle[@color][1]/@color!=''">
+               <xsl:value-of select="$ndTokenFirst/ancestor::mml:mstyle[@color][1]/@color"/>
+            </xsl:when>
+            <xsl:when test="$ndTokenFirst/ancestor::mml:mstyle[@mml:color][1]/@mml:color!=''">
+               <xsl:value-of select="$ndTokenFirst/ancestor::mml:mstyle[@color][1]/@mml:color"/>
+            </xsl:when>
+            <xsl:otherwise>
+               <xsl:value-of select="''"/>
+            </xsl:otherwise>
+         </xsl:choose>
+      </xsl:variable>
+
+      <!--Given mathsize, and fontsize and precedence of said attributes, 
+			determine the actual font size of the current run-->
+    <xsl:variable name="sSzCur">
+         <xsl:choose>
+            <xsl:when test="$mathsize!=''">
+               <xsl:value-of select="$mathsize"/>
+            </xsl:when>
+            <xsl:when test="$fontsize!=''">
+               <xsl:value-of select="$fontsize"/>
+            </xsl:when>
+            <xsl:otherwise>
+               <xsl:value-of select="''"/>
+            </xsl:otherwise>
+         </xsl:choose>
+      </xsl:variable>
+
+      <!--Given mathvariant, fontstyle, and fontweight, and precedence of 
+			the attributes, determine the actual font of the current run-->
+    <xsl:variable name="sFontCur">
+         <xsl:call-template name="GetFontCur">
+            <xsl:with-param name="mathvariant" select="$mathvariant"/>
+            <xsl:with-param name="fontstyle" select="$fontstyle"/>
+            <xsl:with-param name="fontweight" select="$fontweight"/>
+            <xsl:with-param name="ndCur" select="$ndTokenFirst"/>
+         </xsl:call-template>
+      </xsl:variable>
+
+      <!-- The omml equivalent structure for mml:mtext is an omml run with the run property m:nor (normal) set.
+         Therefore, we can only collect mtexts with  other mtext elements.  Suppose the $ndTokenFirst is an 
+         mml:mtext, then if any of its following siblings are to be grouped, they must also be mml:text elements.  
+         The inverse is also true, suppose the $ndTokenFirst isn't an mml:mtext, then if any of its following siblings 
+         are to be grouped with $ndTokenFirst, they can't be mml:mtext elements-->
+    <xsl:variable name="fNdTokenFirstIsMText">
+         <xsl:choose>
+            <xsl:when test="$ndTokenFirst/self::mml:mtext">1</xsl:when>
+            <xsl:otherwise>0</xsl:otherwise>
+         </xsl:choose>
+      </xsl:variable>
+
+      <!--In order to determine the length of the run, we will find the number of nodes before the inital node in the run and
+			the number of nodes before the first node that DOES NOT belong to the current run.  The number of nodes that will
+			be printed is One Less than the difference between the latter and the former-->
+
+    <!--Find index of current node-->
+    <xsl:variable name="nndBeforeFirst" select="count($ndTokenFirst/preceding-sibling::*)"/>
+
+      <!--Find index of next change in run properties.
+		
+		    The basic idea is that we want to find the position of the last node in the longest 
+				sequence of nodes, starting from ndTokenFirst, that can be grouped into a run.  For
+				example, nodes A and B can be grouped together into the same run iff they have the same 
+				props.
+				
+				To accomplish this grouping, we want to find the next sibling to ndTokenFirst that shouldn't be 
+				included in the run of text.  We do this by counting the number of elements that precede the first
+				such element that doesn't belong.  The xpath that accomplishes this is below.
+				    
+						Count the number of siblings the precede the first element after ndTokenFirst that shouldn't belong.
+						count($ndTokenFirst/following-sibling::*[ . . . ][1]/preceding-sibling::*)
+						
+				Now, the hard part to this is what is represented by the '. . .' above.  This conditional expression is 
+				defining what elements *don't* belong to the current run.  The conditions are as follows:
+				
+				The element is not a token element (mi, mn, mo, ms, or mtext)
+				
+				or
+				
+				The token element contains a glyph child (this is handled separately).
+				
+				or
+				
+				The token is an mtext and the run didn't start with an mtext, or the token isn't an mtext and the run started 
+				with an mtext.  We do this check because mtext transforms into an omml m:nor property, and thus, these mtext
+				token elements need to be grouped separately from other token elements.
+				
+				// We do an or not( . . . ), because it was easier to define what token elements match than how they don't match.
+				// Thus, this inner '. . .' defines how token attributes equate to one another.  We add the 'not' outside of to accomplish
+				// the goal of the outer '. . .', which is the find the next element that *doesn't* match.
+				or not(
+				   The background colors match.
+					 
+					 and
+					 
+							The current font (sFontCur) matches the mathvariant
+					 
+							or
+							
+							sFontCur is normal and matches the current font characteristics
+							
+							or 
+							
+							sFontCur is italic and matches the current font characteristics
+							
+							or 
+							
+							. . .
+				
+					 and
+					 
+					 The font family matches the current font family.
+					 ) // end of not().-->
+    <xsl:variable name="nndBeforeLim"
+                    select="count($ndTokenFirst/following-sibling::*      [(not(self::mml:mi) and not(self::mml:mn) and not(self::mml:mo) and not(self::mml:ms) and not(self::mml:mtext))      or      (self::mml:mi[child::mml:mglyph] or self::mml:mn[child::mml:mglyph] or self::mml:mo[child::mml:mglyph] or self::mml:ms[child::mml:mglyph] or self::mml:mtext[child::mml:mglyph])      or      (($fNdTokenFirstIsMText=1 and not(self::mml:mtext)) or ($fNdTokenFirstIsMText=0 and self::mml:mtext))      or        not(       ((($sFontCur=@mathvariant or $sFontCur=@mml:mathvariant)        or        ($sFontCur='normal'         and ((@mathvariant='normal' or @mml:mathvariant='normal')            or (((not(@mathvariant) or @mathvariant='') and (not(@mml:mathvariant) or @mml:mathvariant=''))              and (                     ((@fontstyle='normal' or @mml:fontstyle='normal') and (not(@fontweight='bold') and not(@mml:fontweight='bold')))                     or (self::mml:mi and string-length(normalize-space(.)) &gt; 1)                    )               )           )        )        or        ($sFontCur='italic'          and ((@mathvariant='italic' or @mml:mathvariant='italic')            or (((not(@mathvariant) or @mathvariant='') and (not(@mml:mathvariant) or @mml:mathvariant=''))             and (                     ((@fontstyle='italic' or @mml:fontstyle='italic') and (not(@fontweight='bold') and not(@mml:fontweight='bold')))                    or                  (self::mml:mn                  or self::mml:mo                 or (self::mml:mi and string-length(normalize-space(.)) &lt;= 1))                    )               )           )        )         or        ($sFontCur='bold'         and ((@mathvariant='bold' or @mml:mathvariant='bold')            or (((not(@mathvariant) or @mathvariant='') and (not(@mml:mathvariant) or @mml:mathvariant=''))                and (                     ((@fontweight='bold' or @mml:fontweight='bold')                     and ((@fontstyle='normal' or @mml:fontstyle='normal') or (self::mml:mi and string-length(normalize-space(.)) &lt;= 1))                    )               )             )             )        )         or        (($sFontCur='bi' or $sFontCur='bold-italic')         and (            (@mathvariant='bold-italic' or @mml:mathvariant='bold-italic')            or (((not(@mathvariant) or @mathvariant='') and (not(@mml:mathvariant) or @mml:mathvariant=''))             and (                ((@fontweight='bold' or @mml:fontweight='bold') and (@fontstyle='italic' or @mml:fontstyle='italic'))                or ((@fontweight='bold' or @mml:fontweight='bold')                   and (self::mml:mn                       or self::mml:mo                     or (self::mml:mi and string-length(normalize-space(.)) &lt;= 1)))                    )               )           )        )               or               (($sFontCur=''                   and (                      ((not(@mathvariant) or @mathvariant='')                         and (not(@mml:mathvariant) or @mml:mathvariant='')                         and (not(@fontstyle) or @fontstyle='')                         and (not(@mml:fontstyle) or @mml:fontstyle='')                         and (not(@fontweight)or @fontweight='')                         and (not(@mml:fontweight) or @mml:fontweight='')                 )                        or                          (@mathvariant='italic' or @mml:mathvariant='italic')                         or (                            ((not(@mathvariant) or @mathvariant='') and (not(@mml:mathvariant) or @mml:mathvariant=''))                                and (                                   (((@fontweight='normal' or @mml:fontweight='normal')                                    and (@fontstyle='italic' or @mml:fontstyle='italic'))                                   )                                   or                                   ((not(@fontweight) or @fontweight='') and (not(@mml:fontweight) or @mml:fontweight=''))                                    and (@fontstyle='italic' or @mml:fontstyle='italic')                                   or                                   ((not(@fontweight) or @fontweight='') and (not(@mml:fontweight) or @mml:fontweight=''))                                    and (not(@fontstyle) or @fontstyle='')                                    and (not(@mml:fontstyle) or @mml:fontstyle=''))                             )                 )                ))        or               ($sFontCur='normal'                 and ((self::mml:mi                       and (not(@mathvariant) or @mathvariant='')                   and (not(@mml:mathvariant) or @mml:mathvariant)                   and (not(@fontstyle) or @fontstyle='')                    and (not(@mml:fontstyle) or @mml:fontstyle='')                   and (not(@fontweight) or @fontweight='')                    and (not(@mml:fontweight) or @mml:fontweight='')                   and (string-length(normalize-space(.)) &gt; 1)                   )                  or ((self::mml:ms or self::mml:mtext)                    and (not(@mathvariant) or @mathvariant='')                   and (not(@mml:mathvariant) or @mml:mathvariant)                   and (not(@fontstyle) or @fontstyle)                   and (not(@fontstyle) or @fontstyle='')                   and (not(@fontweight) or @fontweight)                   and (not(@mml:fontweight) or @mml:fontweight='')                   )                  )               )           )       and             (($font-family = @font-family or $font-family = @mml:font-family)               or (($font-family='' or not($font-family))                and (not(@font-family) or @font-family='')                and (not(@mml:font-family) or @mml:font-family='')               )              )      ))      ][1]/preceding-sibling::*)"/>
+
+      <xsl:variable name="cndRun" select="$nndBeforeLim - $nndBeforeFirst"/>
+
+      <!--Contiguous groups of like-property mi, mn, and mo's are separated by non- mi, mn, mo tags, or mi,mn, or mo
+			tags with different properties.  nndBeforeLim is the number of nodes before the next tag which separates contiguous 
+			groups of like-property mi, mn, and mo's.  Knowing this delimiting tag allows for the aggregation of the correct 
+			number of mi, mn, and mo tags.-->
+    <r>
+
+      <!--The beginning and ending of the current run has been established. Now we should open a run element-->
+      <xsl:choose>
+
+        <!--If cndRun > 0, then there is a following diffrent prop, or non- Token, 
+						although there may or may not have been a preceding different prop, or non-
+						Token-->
+        <xsl:when test="$cndRun &gt; 0">
+               <xsl:call-template name="CreateRunProp">
+                  <xsl:with-param name="mathvariant" select="$mathvariant"/>
+                  <xsl:with-param name="fontstyle" select="$fontstyle"/>
+                  <xsl:with-param name="fontweight" select="$fontweight"/>
+                  <xsl:with-param name="mathcolor" select="$mathcolor"/>
+                  <xsl:with-param name="mathsize" select="$mathsize"/>
+                  <xsl:with-param name="color" select="$color"/>
+                  <xsl:with-param name="fontsize" select="$fontsize"/>
+                  <xsl:with-param name="ndCur" select="$ndTokenFirst"/>
+                  <xsl:with-param name="fNor">
+                     <xsl:call-template name="FNor">
+                        <xsl:with-param name="ndCur" select="$ndTokenFirst"/>
+                     </xsl:call-template>
+                  </xsl:with-param>
+                  <xsl:with-param name="fLit">
+                     <xsl:call-template name="FLit">
+                        <xsl:with-param name="ndCur" select="$ndTokenFirst"/>
+                     </xsl:call-template>
+                  </xsl:with-param>
+               </xsl:call-template>
+               <t>
+                  <xsl:call-template name="OutputText">
+                     <xsl:with-param name="sInput">
+                        <xsl:choose>
+                           <xsl:when test="namespace-uri($ndTokenFirst) = 'http://www.w3.org/1998/Math/MathML' and local-name($ndTokenFirst) = 'ms'">
+                              <xsl:call-template name="OutputMs">
+                                 <xsl:with-param name="msCur" select="$ndTokenFirst"/>
+                              </xsl:call-template>
+                           </xsl:when>
+                           <xsl:otherwise>
+                              <xsl:value-of select="normalize-space($ndTokenFirst)"/>
+                           </xsl:otherwise>
+                        </xsl:choose>
+                        <xsl:for-each select="$ndTokenFirst/following-sibling::*[position() &lt; $cndRun]">
+                           <xsl:choose>
+                              <xsl:when test="namespace-uri(.) = 'http://www.w3.org/1998/Math/MathML' and               local-name(.) = 'ms'">
+                                 <xsl:call-template name="OutputMs">
+                                    <xsl:with-param name="msCur" select="."/>
+                                 </xsl:call-template>
+                              </xsl:when>
+                              <xsl:otherwise>
+                                 <xsl:value-of select="normalize-space(.)"/>
+                              </xsl:otherwise>
+                           </xsl:choose>
+                        </xsl:for-each>
+                     </xsl:with-param>
+                  </xsl:call-template>
+               </t>
+            </xsl:when>
+            <xsl:otherwise>
+
+          <!--if cndRun lt;= 0, then iNextNonToken = 0, 
+						and iPrecNonToken gt;= 0.  In either case, b/c there 
+						is no next different property or non-Token 
+						(which is implied by the nndBeforeLast being equal to 0) 
+						you can put all the remaining mi, mn, and mo's into one 
+						group.-->
+          <xsl:call-template name="CreateRunProp">
+                  <xsl:with-param name="mathvariant" select="$mathvariant"/>
+                  <xsl:with-param name="fontstyle" select="$fontstyle"/>
+                  <xsl:with-param name="fontweight" select="$fontweight"/>
+                  <xsl:with-param name="mathcolor" select="$mathcolor"/>
+                  <xsl:with-param name="mathsize" select="$mathsize"/>
+                  <xsl:with-param name="color" select="$color"/>
+                  <xsl:with-param name="fontsize" select="$fontsize"/>
+                  <xsl:with-param name="ndCur" select="$ndTokenFirst"/>
+                  <xsl:with-param name="fNor">
+                     <xsl:call-template name="FNor">
+                        <xsl:with-param name="ndCur" select="$ndTokenFirst"/>
+                     </xsl:call-template>
+                  </xsl:with-param>
+                  <xsl:with-param name="fLit">
+                     <xsl:call-template name="FLit">
+                        <xsl:with-param name="ndCur" select="$ndTokenFirst"/>
+                     </xsl:call-template>
+                  </xsl:with-param>
+               </xsl:call-template>
+               <t>
+
+            <!--Create the Run, first output current, then in a 
+							for-each, because all the following siblings are
+							mn, mi, and mo's that conform to the run's properties,
+							group them together-->
+            <xsl:call-template name="OutputText">
+                     <xsl:with-param name="sInput">
+                        <xsl:choose>
+                           <xsl:when test="namespace-uri($ndTokenFirst) = 'http://www.w3.org/1998/Math/MathML' and               local-name($ndTokenFirst) = 'ms'">
+                              <xsl:call-template name="OutputMs">
+                                 <xsl:with-param name="msCur" select="$ndTokenFirst"/>
+                              </xsl:call-template>
+                           </xsl:when>
+                           <xsl:otherwise>
+                              <xsl:value-of select="normalize-space($ndTokenFirst)"/>
+                           </xsl:otherwise>
+                        </xsl:choose>
+                        <xsl:for-each select="$ndTokenFirst/following-sibling::*[self::mml:mi or self::mml:mn or self::mml:mo or self::mml:ms or self::mml:mtext]">
+                           <xsl:choose>
+                              <xsl:when test="namespace-uri(.) = 'http://www.w3.org/1998/Math/MathML' and               local-name(.) = 'ms'">
+                                 <xsl:call-template name="OutputMs">
+                                    <xsl:with-param name="msCur" select="."/>
+                                 </xsl:call-template>
+                              </xsl:when>
+                              <xsl:otherwise>
+                                 <xsl:value-of select="normalize-space(.)"/>
+                              </xsl:otherwise>
+                           </xsl:choose>
+                        </xsl:for-each>
+                     </xsl:with-param>
+                  </xsl:call-template>
+               </t>
+            </xsl:otherwise>
+         </xsl:choose>
+      </r>
+
+      <!--The run was terminated by an mi, mn, mo, ms, or mtext with different properties, 
+				therefore, call-template CreateRunWithSameProp, using cndRun+1 node as new start node-->
+    <xsl:if test="$nndBeforeLim!=0             and ($ndTokenFirst/following-sibling::*[$cndRun]/self::mml:mi or             $ndTokenFirst/following-sibling::*[$cndRun]/self::mml:mn or            $ndTokenFirst/following-sibling::*[$cndRun]/self::mml:mo or            $ndTokenFirst/following-sibling::*[$cndRun]/self::mml:ms or                 $ndTokenFirst/following-sibling::*[$cndRun]/self::mml:mtext)              and (count($ndTokenFirst/following-sibling::*[$cndRun]/mml:mglyph) = 0)">
+         <xsl:call-template name="CreateRunWithSameProp">
+            <xsl:with-param name="mathbackground">
+               <xsl:choose>
+                  <xsl:when test="$ndTokenFirst/following-sibling::*[$cndRun]/@mathbackground">
+                     <xsl:value-of select="$ndTokenFirst/following-sibling::*[$cndRun]/@mathbackground"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:value-of select="$ndTokenFirst/following-sibling::*[$cndRun]/@mml:mathbackground"/>
+                  </xsl:otherwise>
+               </xsl:choose>
+            </xsl:with-param>
+            <xsl:with-param name="mathcolor">
+               <xsl:choose>
+                  <xsl:when test="$ndTokenFirst/following-sibling::*[$cndRun]/@mathcolor">
+                     <xsl:value-of select="$ndTokenFirst/following-sibling::*[$cndRun]/@mathcolor"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:value-of select="$ndTokenFirst/following-sibling::*[$cndRun]/@mml:mathcolor"/>
+                  </xsl:otherwise>
+               </xsl:choose>
+            </xsl:with-param>
+            <xsl:with-param name="mathvariant">
+               <xsl:choose>
+                  <xsl:when test="$ndTokenFirst/following-sibling::*[$cndRun]/@mathvariant">
+                     <xsl:value-of select="$ndTokenFirst/following-sibling::*[$cndRun]/@mathvariant"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:value-of select="$ndTokenFirst/following-sibling::*[$cndRun]/@mml:mathvariant"/>
+                  </xsl:otherwise>
+               </xsl:choose>
+            </xsl:with-param>
+            <xsl:with-param name="color">
+               <xsl:choose>
+                  <xsl:when test="$ndTokenFirst/following-sibling::*[$cndRun]/@color">
+                     <xsl:value-of select="$ndTokenFirst/following-sibling::*[$cndRun]/@color"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:value-of select="$ndTokenFirst/following-sibling::*[$cndRun]/@mml:color"/>
+                  </xsl:otherwise>
+               </xsl:choose>
+            </xsl:with-param>
+            <xsl:with-param name="font-family">
+               <xsl:choose>
+                  <xsl:when test="$ndTokenFirst/following-sibling::*[$cndRun]/@font-family">
+                     <xsl:value-of select="$ndTokenFirst/following-sibling::*[$cndRun]/@font-family"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:value-of select="$ndTokenFirst/following-sibling::*[$cndRun]/@mml:font-family"/>
+                  </xsl:otherwise>
+               </xsl:choose>
+            </xsl:with-param>
+            <xsl:with-param name="fontsize">
+               <xsl:choose>
+                  <xsl:when test="$ndTokenFirst/following-sibling::*[$cndRun]/@fontsize">
+                     <xsl:value-of select="$ndTokenFirst/following-sibling::*[$cndRun]/@fontsize"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:value-of select="$ndTokenFirst/following-sibling::*[$cndRun]/@mml:fontsize"/>
+                  </xsl:otherwise>
+               </xsl:choose>
+            </xsl:with-param>
+            <xsl:with-param name="fontstyle">
+               <xsl:choose>
+                  <xsl:when test="$ndTokenFirst/following-sibling::*[$cndRun]/@fontstyle">
+                     <xsl:value-of select="$ndTokenFirst/following-sibling::*[$cndRun]/@fontstyle"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:value-of select="$ndTokenFirst/following-sibling::*[$cndRun]/@mml:fontstyle"/>
+                  </xsl:otherwise>
+               </xsl:choose>
+            </xsl:with-param>
+            <xsl:with-param name="fontweight">
+               <xsl:choose>
+                  <xsl:when test="$ndTokenFirst/following-sibling::*[$cndRun]/@fontweight">
+                     <xsl:value-of select="$ndTokenFirst/following-sibling::*[$cndRun]/@fontweight"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:value-of select="$ndTokenFirst/following-sibling::*[$cndRun]/@mml:fontweight"/>
+                  </xsl:otherwise>
+               </xsl:choose>
+            </xsl:with-param>
+            <xsl:with-param name="mathsize">
+               <xsl:choose>
+                  <xsl:when test="$ndTokenFirst/following-sibling::*[$cndRun]/@mathsize">
+                     <xsl:value-of select="$ndTokenFirst/following-sibling::*[$cndRun]/@mathsize"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:value-of select="$ndTokenFirst/following-sibling::*[$cndRun]/@mml:mathsize"/>
+                  </xsl:otherwise>
+               </xsl:choose>
+            </xsl:with-param>
+            <xsl:with-param name="ndTokenFirst" select="$ndTokenFirst/following-sibling::*[$cndRun]"/>
+         </xsl:call-template>
+      </xsl:if>
+  </xsl:template>
+
+  <!-- %%Template: FNor
+				 Given the context of ndCur, determine if ndCur should be omml's normal style.
+	-->
+  <xsl:template name="FNor">
+      <xsl:param name="ndCur" select="."/>
+      <xsl:choose>
+      <!-- Is the current node an mml:mtext, or if this is an mglyph whose parent is 
+             an mml:mtext. -->
+      <xsl:when test="$ndCur/self::mml:mtext or ($ndCur/self::mml:mglyph and parent::mml:mtext)">1</xsl:when>
+         <xsl:otherwise>0</xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+  <!-- %%Template: FLit
+				 Given the context of ndCur, determine if ndCur should have the 
+				 run omml property of lit (literal, no build up).
+	-->
+  <xsl:template name="FLit">
+      <xsl:param name="ndCur" select="."/>
+      <xsl:variable name="sLowerActiontype">
+         <xsl:choose>
+            <xsl:when test="$ndCur/ancestor::mml:maction[@actiontype='lit']/@actiontype">
+               <xsl:value-of select="translate($ndCur/ancestor::mml:maction[@actiontype='lit']/@actiontype, $StrUCAlphabet,                                                                                                       $StrLCAlphabet)"/>
+            </xsl:when>
+            <xsl:otherwise>
+               <xsl:value-of select="translate($ndCur/ancestor::mml:maction[@actiontype='lit']/@mml:actiontype, $StrUCAlphabet,                                                                                                       $StrLCAlphabet)"/>
+            </xsl:otherwise>
+         </xsl:choose>
+      </xsl:variable>
+      <xsl:choose>
+         <xsl:when test="$sLowerActiontype='lit'">1</xsl:when>
+         <xsl:otherwise>0</xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+  <!-- %%Template: CreateRunProp
+	-->
+  <xsl:template name="CreateRunProp">
+      <xsl:param name="mathbackground"/>
+      <xsl:param name="mathcolor"/>
+      <xsl:param name="mathvariant"/>
+      <xsl:param name="color"/>
+      <xsl:param name="font-family">Cambria Math</xsl:param>
+      <xsl:param name="fontsize"/>
+      <xsl:param name="fontstyle"/>
+      <xsl:param name="fontweight"/>
+      <xsl:param name="mathsize"/>
+      <xsl:param name="ndCur"/>
+      <xsl:param name="fNor"/>
+      <xsl:param name="fLit"/>
+      <w:rPr>
+	<xsl:call-template name="mathrRpHook"/>
+         <w:rFonts w:ascii="{$font-family}" w:eastAsia="{$font-family}" w:hAnsi="{$font-family}"
+                   w:cs="{$font-family}"/>
+	 <xsl:choose>
+	   <xsl:when test="$fontweight=''"/>
+	   <xsl:when test="$fontweight='bold'">
+	     <w:b/>
+	   </xsl:when>
+	   <xsl:when test="$fontweight='normal'">
+	     <w:b w:val="0"/>
+	   </xsl:when>
+	 </xsl:choose>
+	 <xsl:choose>
+	   <xsl:when test="$fontstyle=''"/>
+	   <xsl:when test="$fontstyle='italic'">
+	     <w:i/>
+	   </xsl:when>
+	   <xsl:when test="$fontstyle='normal'">
+	     <w:i w:val="0"/>
+	   </xsl:when>
+	 </xsl:choose>
+      </w:rPr>
+      <xsl:variable name="mstyleColor">
+         <xsl:if test="not(not($ndCur))">
+            <xsl:choose>
+               <xsl:when test="$ndCur/ancestor::mml:mstyle[@color][1]/@color">
+                  <xsl:value-of select="$ndCur/ancestor::mml:mstyle[@color][1]/@color"/>
+               </xsl:when>
+               <xsl:otherwise>
+                  <xsl:value-of select="$ndCur/ancestor::mml:mstyle[@color][1]/@mml:color"/>
+               </xsl:otherwise>
+            </xsl:choose>
+         </xsl:if>
+      </xsl:variable>
+      <xsl:call-template name="CreateMathRPR">
+         <xsl:with-param name="mathvariant" select="$mathvariant"/>
+         <xsl:with-param name="fontstyle" select="$fontstyle"/>
+         <xsl:with-param name="fontweight" select="$fontweight"/>
+         <xsl:with-param name="ndCur" select="$ndCur"/>
+         <xsl:with-param name="fNor" select="$fNor"/>
+         <xsl:with-param name="fLit" select="$fLit"/>
+      </xsl:call-template>
+  </xsl:template>
+
+  <!-- %%Template: CreateMathRPR
+	-->
+  <xsl:template name="CreateMathRPR">
+      <xsl:param name="mathvariant"/>
+      <xsl:param name="fontstyle"/>
+      <xsl:param name="fontweight"/>
+      <xsl:param name="ndCur"/>
+      <xsl:param name="fNor"/>
+      <xsl:param name="fLit"/>
+      <xsl:variable name="sFontCur">
+         <xsl:call-template name="GetFontCur">
+            <xsl:with-param name="mathvariant" select="$mathvariant"/>
+            <xsl:with-param name="fontstyle" select="$fontstyle"/>
+            <xsl:with-param name="fontweight" select="$fontweight"/>
+            <xsl:with-param name="ndCur" select="$ndCur"/>
+         </xsl:call-template>
+      </xsl:variable>
+      <xsl:if test="$fLit=1 or $fNor=1 or ($sFontCur!='italic' and $sFontCur!='')">
+         <rPr>
+            <xsl:if test="$fNor=1">
+               <nor/>
+            </xsl:if>
+            <xsl:if test="$fLit=1">
+               <lit/>
+            </xsl:if>
+            <xsl:call-template name="CreateMathScrStyProp">
+               <xsl:with-param name="font" select="$sFontCur"/>
+               <xsl:with-param name="fNor" select="$fNor"/>
+            </xsl:call-template>
+         </rPr>
+      </xsl:if>
+  </xsl:template>
+
+  <!-- %%Template: GetFontCur
+	-->
+  <xsl:template name="GetFontCur">
+      <xsl:param name="ndCur"/>
+      <xsl:param name="mathvariant"/>
+      <xsl:param name="fontstyle"/>
+      <xsl:param name="fontweight"/>
+      <xsl:choose>
+         <xsl:when test="$mathvariant!=''">
+            <xsl:value-of select="$mathvariant"/>
+         </xsl:when>
+         <xsl:when test="not($ndCur)">
+            <xsl:value-of select="'italic'"/>
+         </xsl:when>
+         <xsl:when test="$ndCur/self::mml:mi and (string-length(normalize-space($ndCur)) &lt;= 1)               or $ndCur/self::mml:mn and string(number($ndCur/text()))!='NaN'               or $ndCur/self::mml:mo">
+
+	   <!-- The default for the above three cases is fontstyle=italic fontweight=normal.-->
+	   <xsl:choose>
+	     <xsl:when test="$fontstyle='normal' and $fontweight='bold'">
+	       <!-- In omml, a sty of 'b' (which is what bold is translated into)
+		    implies a normal fontstyle -->
+	       <xsl:value-of select="'bold'"/>
+	     </xsl:when>
+	     <xsl:when test="$fontstyle='normal'">
+	       <xsl:value-of select="'normal'"/>
+	     </xsl:when>
+	     <xsl:when test="$fontweight='bold'">
+	       <xsl:value-of select="'bi'"/>
+	     </xsl:when>
+	     <xsl:when test="$fontweight='normal'">
+	       <xsl:value-of select="'i'"/>
+	     </xsl:when>
+	     <xsl:otherwise>
+	       <xsl:value-of select="'italic'"/>
+	     </xsl:otherwise>
+	   </xsl:choose>
+	 </xsl:when>
+	 <xsl:otherwise>
+	   <!--Default is fontweight = 'normal' and fontstyle='normal'-->
+        <xsl:choose>
+	  <xsl:when test="$fontstyle='italic' and $fontweight='bold'">
+	    <xsl:value-of select="'bi'"/>
+	  </xsl:when>
+	  <xsl:when test="$fontstyle='italic'">
+	    <xsl:value-of select="'italic'"/>
+	  </xsl:when>
+	     <xsl:when test="$fontweight='normal'">
+	       <xsl:value-of select="'italic'"/>
+	     </xsl:when>
+	  <xsl:when test="$fontweight='bold'">
+	    <xsl:value-of select="'bold'"/>
+	  </xsl:when>
+	  <xsl:otherwise>
+	    <xsl:value-of select="'normal'"/>
+	  </xsl:otherwise>
+            </xsl:choose>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+
+  <!-- %%Template: CreateMathScrStyProp
+	-->
+  <xsl:template name="CreateMathScrStyProp">
+      <xsl:param name="font"/>
+      <xsl:param name="fNor" select="0"/>
+      <xsl:choose>
+         <xsl:when test="$font='normal' and $fNor=0">
+            <sty>
+               <xsl:attribute name="m:val">p</xsl:attribute>
+            </sty>
+         </xsl:when>
+         <xsl:when test="$font='bold'">
+            <sty>
+               <xsl:attribute name="m:val">b</xsl:attribute>
+            </sty>
+         </xsl:when>
+         <xsl:when test="$font='italic'">
+      </xsl:when>
+         <xsl:when test="$font='script'">
+            <scr>
+               <xsl:attribute name="m:val">script</xsl:attribute>
+            </scr>
+         </xsl:when>
+         <xsl:when test="$font='bold-script'">
+            <scr>
+               <xsl:attribute name="m:val">script</xsl:attribute>
+            </scr>
+            <sty>
+               <xsl:attribute name="m:val">b</xsl:attribute>
+            </sty>
+         </xsl:when>
+         <xsl:when test="$font='double-struck'">
+            <scr>
+               <xsl:attribute name="m:val">double-struck</xsl:attribute>
+            </scr>
+            <sty>
+               <xsl:attribute name="m:val">p</xsl:attribute>
+            </sty>
+         </xsl:when>
+         <xsl:when test="$font='fraktur'">
+            <scr>
+               <xsl:attribute name="m:val">fraktur</xsl:attribute>
+            </scr>
+            <sty>
+               <xsl:attribute name="m:val">p</xsl:attribute>
+            </sty>
+         </xsl:when>
+         <xsl:when test="$font='bold-fraktur'">
+            <scr>
+               <xsl:attribute name="m:val">fraktur</xsl:attribute>
+            </scr>
+            <sty>
+               <xsl:attribute name="m:val">b</xsl:attribute>
+            </sty>
+         </xsl:when>
+         <xsl:when test="$font='sans-serif'">
+            <scr>
+               <xsl:attribute name="m:val">sans-serif</xsl:attribute>
+            </scr>
+            <sty>
+               <xsl:attribute name="m:val">p</xsl:attribute>
+            </sty>
+         </xsl:when>
+         <xsl:when test="$font='bold-sans-serif'">
+            <scr>
+               <xsl:attribute name="m:val">sans-serif</xsl:attribute>
+            </scr>
+            <sty>
+               <xsl:attribute name="m:val">b</xsl:attribute>
+            </sty>
+         </xsl:when>
+         <xsl:when test="$font='sans-serif-italic'">
+            <scr>
+               <xsl:attribute name="m:val">sans-serif</xsl:attribute>
+            </scr>
+         </xsl:when>
+         <xsl:when test="$font='sans-serif-bold-italic'">
+            <scr>
+               <xsl:attribute name="m:val">sans-serif</xsl:attribute>
+            </scr>
+            <sty>
+               <xsl:attribute name="m:val">bi</xsl:attribute>
+            </sty>
+         </xsl:when>
+         <xsl:when test="$font='monospace'"/>
+         <!-- We can't do monospace, so leave empty -->
+      <xsl:when test="$font='bold'">
+            <sty>
+               <xsl:attribute name="m:val">b</xsl:attribute>
+            </sty>
+         </xsl:when>
+         <xsl:when test="$font='bi' or $font='bold-italic'">
+            <sty>
+               <xsl:attribute name="m:val">bi</xsl:attribute>
+            </sty>
+         </xsl:when>
+      </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="FBar">
+      <xsl:param name="sLineThickness"/>
+      <xsl:variable name="sLowerLineThickness"
+                    select="translate($sLineThickness, $StrUCAlphabet, $StrLCAlphabet)"/>
+      <xsl:choose>
+         <xsl:when test="string-length($sLowerLineThickness)=0                       or $sLowerLineThickness='thin'                        or $sLowerLineThickness='medium'                        or $sLowerLineThickness='thick'">1</xsl:when>
+         <xsl:otherwise>
+            <xsl:variable name="fStrContainsNonZeroDigit">
+               <xsl:call-template name="FStrContainsNonZeroDigit">
+                  <xsl:with-param name="s" select="$sLowerLineThickness"/>
+               </xsl:call-template>
+            </xsl:variable>
+            <xsl:choose>
+               <xsl:when test="$fStrContainsNonZeroDigit=1">1</xsl:when>
+               <xsl:otherwise>0</xsl:otherwise>
+            </xsl:choose>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+
+  <!-- %%Template: match mfrac 
+		-->
+  <xsl:template mode="mml" match="mml:mfrac">
+      <xsl:variable name="fBar">
+         <xsl:call-template name="FBar">
+            <xsl:with-param name="sLineThickness">
+               <xsl:choose>
+                  <xsl:when test="@linethickness">
+                     <xsl:value-of select="@linethickness"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:value-of select="@mml:linethickness"/>
+                  </xsl:otherwise>
+               </xsl:choose>
+            </xsl:with-param>
+         </xsl:call-template>
+      </xsl:variable>
+
+      <f>
+         <fPr>
+            <type>
+               <xsl:attribute name="m:val">
+                  <xsl:choose>
+                     <xsl:when test="$fBar=0">noBar</xsl:when>
+                     <xsl:when test="@bevelled='true' or @mml:bevelled='true'">skw</xsl:when>
+                     <xsl:otherwise>bar</xsl:otherwise>
+                  </xsl:choose>
+               </xsl:attribute>
+            </type>
+         </fPr>
+         <num>
+            <xsl:call-template name="CreateArgProp"/>
+            <xsl:apply-templates mode="mml" select="child::*[1]"/>
+         </num>
+         <den>
+            <xsl:call-template name="CreateArgProp"/>
+            <xsl:apply-templates mode="mml" select="child::*[2]"/>
+         </den>
+      </f>
+  </xsl:template>
+
+  <!-- %%Template: match menclose msqrt
+	-->
+  <xsl:template mode="mml" match="mml:menclose | mml:msqrt">
+      <xsl:variable name="sLowerCaseNotation">
+         <xsl:choose>
+            <xsl:when test="@notation">
+               <xsl:value-of select="translate(@notation, $StrUCAlphabet, $StrLCAlphabet)"/>
+            </xsl:when>
+            <xsl:otherwise>
+               <xsl:value-of select="translate(@mml:notation, $StrUCAlphabet, $StrLCAlphabet)"/>
+            </xsl:otherwise>
+         </xsl:choose>
+      </xsl:variable>
+      <xsl:choose>
+      <!-- Take care of default -->
+      <xsl:when test="$sLowerCaseNotation='radical'                        or not($sLowerCaseNotation)                        or $sLowerCaseNotation=''                        or self::mml:msqrt">
+            <rad>
+               <radPr>
+                  <degHide>
+                     <xsl:attribute name="m:val">on</xsl:attribute>
+                  </degHide>
+               </radPr>
+               <deg>
+                  <xsl:call-template name="CreateArgProp"/>
+               </deg>
+               <e>
+                  <xsl:call-template name="CreateArgProp"/>
+                  <xsl:apply-templates mode="mml"/>
+               </e>
+            </rad>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:choose>
+               <xsl:when test="$sLowerCaseNotation='actuarial' or $sLowerCaseNotation='longdiv'"/>
+               <xsl:otherwise>
+                  <borderBox>
+              <!-- Dealing with more complex notation attribute -->
+              <xsl:variable name="fBox">
+                        <xsl:choose>
+                  <!-- Word doesn't have circle and roundedbox concepts, therefore, map both to a 
+                       box. -->
+                  <xsl:when test="contains($sLowerCaseNotation, 'box')                                   or contains($sLowerCaseNotation, 'circle')                                   or contains($sLowerCaseNotation, 'roundedbox')">1</xsl:when>
+                           <xsl:otherwise>0</xsl:otherwise>
+                        </xsl:choose>
+                     </xsl:variable>
+                     <xsl:variable name="fTop">
+                        <xsl:choose>
+                           <xsl:when test="contains($sLowerCaseNotation, 'top')">1</xsl:when>
+                           <xsl:otherwise>0</xsl:otherwise>
+                        </xsl:choose>
+                     </xsl:variable>
+                     <xsl:variable name="fBot">
+                        <xsl:choose>
+                           <xsl:when test="contains($sLowerCaseNotation, 'bottom')">1</xsl:when>
+                           <xsl:otherwise>0</xsl:otherwise>
+                        </xsl:choose>
+                     </xsl:variable>
+                     <xsl:variable name="fLeft">
+                        <xsl:choose>
+                           <xsl:when test="contains($sLowerCaseNotation, 'left')">1</xsl:when>
+                           <xsl:otherwise>0</xsl:otherwise>
+                        </xsl:choose>
+                     </xsl:variable>
+                     <xsl:variable name="fRight">
+                        <xsl:choose>
+                           <xsl:when test="contains($sLowerCaseNotation, 'right')">1</xsl:when>
+                           <xsl:otherwise>0</xsl:otherwise>
+                        </xsl:choose>
+                     </xsl:variable>
+                     <xsl:variable name="fStrikeH">
+                        <xsl:choose>
+                           <xsl:when test="contains($sLowerCaseNotation, 'horizontalstrike')">1</xsl:when>
+                           <xsl:otherwise>0</xsl:otherwise>
+                        </xsl:choose>
+                     </xsl:variable>
+                     <xsl:variable name="fStrikeV">
+                        <xsl:choose>
+                           <xsl:when test="contains($sLowerCaseNotation, 'verticalstrike')">1</xsl:when>
+                           <xsl:otherwise>0</xsl:otherwise>
+                        </xsl:choose>
+                     </xsl:variable>
+                     <xsl:variable name="fStrikeBLTR">
+                        <xsl:choose>
+                           <xsl:when test="contains($sLowerCaseNotation, 'updiagonalstrike')">1</xsl:when>
+                           <xsl:otherwise>0</xsl:otherwise>
+                        </xsl:choose>
+                     </xsl:variable>
+                     <xsl:variable name="fStrikeTLBR">
+                        <xsl:choose>
+                           <xsl:when test="contains($sLowerCaseNotation, 'downdiagonalstrike')">1</xsl:when>
+                           <xsl:otherwise>0</xsl:otherwise>
+                        </xsl:choose>
+                     </xsl:variable>
+
+                     <!-- Should we create borderBoxPr? 
+                   We should if the enclosure isn't Word's default, which is
+                   a plain box -->
+              <xsl:if test="$fStrikeH=1                            or $fStrikeV=1                           or $fStrikeBLTR=1                            or $fStrikeTLBR=1                           or ($fBox=0                               and not($fTop=1                                        and $fBot=1                                       and $fLeft=1                                       and $fRight=1)                               )">
+                        <borderBoxPr>
+                           <xsl:if test="$fBox=0">
+                              <xsl:if test="$fTop=0">
+                                 <hideTop>
+                                    <xsl:attribute name="m:val">on</xsl:attribute>
+                                 </hideTop>
+                              </xsl:if>
+                              <xsl:if test="$fBot=0">
+                                 <hideBot>
+                                    <xsl:attribute name="m:val">on</xsl:attribute>
+                                 </hideBot>
+                              </xsl:if>
+                              <xsl:if test="$fLeft=0">
+                                 <hideLeft>
+                                    <xsl:attribute name="m:val">on</xsl:attribute>
+                                 </hideLeft>
+                              </xsl:if>
+                              <xsl:if test="$fRight=0">
+                                 <hideRight>
+                                    <xsl:attribute name="m:val">on</xsl:attribute>
+                                 </hideRight>
+                              </xsl:if>
+                           </xsl:if>
+                           <xsl:if test="$fStrikeH=1">
+                              <strikeH>
+                                 <xsl:attribute name="m:val">on</xsl:attribute>
+                              </strikeH>
+                           </xsl:if>
+                           <xsl:if test="$fStrikeV=1">
+                              <strikeV>
+                                 <xsl:attribute name="m:val">on</xsl:attribute>
+                              </strikeV>
+                           </xsl:if>
+                           <xsl:if test="$fStrikeBLTR=1">
+                              <strikeBLTR>
+                                 <xsl:attribute name="m:val">on</xsl:attribute>
+                              </strikeBLTR>
+                           </xsl:if>
+                           <xsl:if test="$fStrikeTLBR=1">
+                              <strikeTLBR>
+                                 <xsl:attribute name="m:val">on</xsl:attribute>
+                              </strikeTLBR>
+                           </xsl:if>
+                        </borderBoxPr>
+                     </xsl:if>
+                     <e>
+                        <xsl:call-template name="CreateArgProp"/>
+                        <xsl:apply-templates mode="mml"/>
+                     </e>
+                  </borderBox>
+               </xsl:otherwise>
+            </xsl:choose>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+  <!-- %%Template: CreateArgProp
+	-->
+  <xsl:template name="CreateArgProp">
+      <xsl:if test="not(count(ancestor-or-self::mml:mstyle[@scriptlevel='0' or @scriptlevel='1' or @scriptlevel='2'])=0)                   or not(count(ancestor-or-self::mml:mstyle[@mml:scriptlevel='0' or @mml:scriptlevel='1' or @mml:scriptlevel='2'])=0)">
+         <argPr>
+            <scrLvl>
+               <xsl:attribute name="m:val">
+                  <xsl:choose>
+                     <xsl:when test="ancestor-or-self::mml:mstyle[@scriptlevel][1]/@scriptlevel">
+                        <xsl:value-of select="ancestor-or-self::mml:mstyle[@scriptlevel][1]/@scriptlevel"/>
+                     </xsl:when>
+                     <xsl:otherwise>
+                        <xsl:value-of select="ancestor-or-self::mml:mstyle[@scriptlevel][1]/@mml:scriptlevel"/>
+                     </xsl:otherwise>
+                  </xsl:choose>
+               </xsl:attribute>
+            </scrLvl>
+         </argPr>
+      </xsl:if>
+  </xsl:template>
+
+  <!-- %%Template: match mroot
+	-->
+  <xsl:template mode="mml" match="mml:mroot">
+      <rad>
+         <radPr>
+            <degHide>
+               <xsl:attribute name="m:val">off</xsl:attribute>
+            </degHide>
+         </radPr>
+         <deg>
+            <xsl:call-template name="CreateArgProp"/>
+            <xsl:apply-templates mode="mml" select="child::*[2]"/>
+         </deg>
+         <e>
+            <xsl:call-template name="CreateArgProp"/>
+            <xsl:apply-templates mode="mml" select="child::*[1]"/>
+         </e>
+      </rad>
+  </xsl:template>
+
+  <!-- MathML has no concept of a linear fraction.  When transforming a linear fraction
+       from Omml to MathML, we create the following MathML:
+       
+       <mml:mrow>
+         <mml:mrow>
+            // numerator
+         </mml:mrow>
+         <mml:mo>/</mml:mo>
+         <mml:mrow>
+            // denominator
+         </mml:mrow>
+       </mml:mrow>
+       
+       This template looks for four things:
+          1.  ndCur is an mml:mrow
+          2.  ndCur has three children
+          3.  The second child is an <mml:mo>
+          4.  The second child's text is '/'
+       
+       -->
+  <xsl:template name="FLinearFrac">
+      <xsl:param name="ndCur" select="."/>
+      <xsl:variable name="sNdText">
+         <xsl:value-of select="normalize-space($ndCur/*[2])"/>
+      </xsl:variable>
+
+      <xsl:choose>
+      <!-- I spy a linear fraction -->
+      <xsl:when test="$ndCur/self::mml:mrow                       and count($ndCur/*)=3                       and $ndCur/*[2][self::mml:mo]                       and $sNdText='/'">1</xsl:when>
+         <xsl:otherwise>0</xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+
+  <!-- Though presentation mathml can certainly typeset any generic function with the
+	     appropriate function operator spacing, presentation MathML has no concept of 
+			 a function structure like omml does.  In order to preserve the omml <func> 
+			 element, we must establish how an omml <func> element looks in mml.  This 
+			 is shown below:
+       
+       <mml:mrow>
+         <mml:mrow>
+            // function name
+         </mml:mrow>
+         <mml:mo>&#x02061;</mml:mo>
+         <mml:mrow>
+            // function argument
+         </mml:mrow>
+       </mml:mrow>
+       
+       This template looks for six things to be true:
+					1.  ndCur is an mml:mrow
+					2.  ndCur has three children
+					3.  The first child is an <mml:mrow>
+					4.  The second child is an <mml:mo>
+					5.  The third child is an <mml:mrow>
+					6.  The second child's text is '&#x02061;'
+       -->
+  <xsl:template name="FIsFunc">
+      <xsl:param name="ndCur" select="."/>
+      <xsl:variable name="sNdText">
+         <xsl:value-of select="normalize-space($ndCur/*[2])"/>
+      </xsl:variable>
+
+      <xsl:choose>
+      <!-- Is this an omml function -->
+      <xsl:when test="count($ndCur/*)=3               and $ndCur/self::*[self::mml:mrow]                       and $ndCur/*[2][self::mml:mo]                       and $sNdText='⁡'">1</xsl:when>
+         <xsl:otherwise>0</xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+
+  <!-- Given the node of the linear fraction's parent mrow, 
+       make a linear fraction -->
+  <xsl:template name="MakeLinearFraction">
+      <xsl:param name="ndCur" select="."/>
+      <f>
+         <fPr>
+            <type>
+               <xsl:attribute name="m:val">lin</xsl:attribute>
+            </type>
+         </fPr>
+         <num>
+            <xsl:call-template name="CreateArgProp"/>
+            <xsl:apply-templates mode="mml" select="$ndCur/*[1]"/>
+         </num>
+         <den>
+            <xsl:call-template name="CreateArgProp"/>
+            <xsl:apply-templates mode="mml" select="$ndCur/*[3]"/>
+         </den>
+      </f>
+  </xsl:template>
+
+
+  <!-- Given the node of the function's parent mrow, 
+       make an omml function -->
+  <xsl:template name="WriteFunc">
+      <xsl:param name="ndCur" select="."/>
+
+      <func>
+         <fName>
+            <xsl:apply-templates mode="mml" select="$ndCur/child::*[1]"/>
+         </fName>
+         <e>
+            <xsl:apply-templates mode="mml" select="$ndCur/child::*[3]"/>
+         </e>
+      </func>
+  </xsl:template>
+
+
+  <!-- MathML doesn't have the concept of nAry structures.  The best approximation
+       to these is to have some under/over or sub/sup followed by an mrow or mstyle.
+       
+       In the case that we've come across some under/over or sub/sup that contains an 
+       nAry operator, this function handles the following sibling to the nAry structure.
+       
+       If the following sibling is:
+       
+          mml:mstyle, then apply templates to the children of this mml:mstyle
+          
+          mml:mrow, determine if this mrow is a linear fraction 
+          (see comments for FlinearFrac template).
+              If so, make an Omml linear fraction.
+              If not, apply templates as was done for mml:mstyle.
+       
+       -->
+  <xsl:template name="NaryHandleMrowMstyle">
+      <xsl:param name="ndCur" select="."/>
+      <!-- if the next sibling is an mrow, pull it in by 
+							doing whatever we would have done to its children. 
+							The mrow itself will be skipped, see template above. -->
+    <xsl:choose>
+         <xsl:when test="$ndCur[self::mml:mrow]">
+        <!-- Check for linear fraction -->
+        <xsl:variable name="fLinearFrac">
+               <xsl:call-template name="FLinearFrac">
+                  <xsl:with-param name="ndCur" select="$ndCur"/>
+               </xsl:call-template>
+            </xsl:variable>
+            <xsl:choose>
+               <xsl:when test="$fLinearFrac=1">
+                  <xsl:call-template name="MakeLinearFraction">
+                     <xsl:with-param name="ndCur" select="$ndCur"/>
+                  </xsl:call-template>
+               </xsl:when>
+               <xsl:otherwise>
+                  <xsl:variable name="fFunc">
+                     <xsl:call-template name="FIsFunc">
+                        <xsl:with-param name="ndCur" select="."/>
+                     </xsl:call-template>
+                  </xsl:variable>
+                  <xsl:choose>
+                     <xsl:when test="$fFunc=1">
+                        <xsl:call-template name="WriteFunc">
+                           <xsl:with-param name="ndCur" select="."/>
+                        </xsl:call-template>
+                     </xsl:when>
+                     <xsl:otherwise>
+                        <xsl:apply-templates mode="mml" select="$ndCur/*"/>
+                     </xsl:otherwise>
+                  </xsl:choose>
+               </xsl:otherwise>
+            </xsl:choose>
+         </xsl:when>
+         <xsl:when test="$ndCur[self::mml:mstyle]">
+            <xsl:apply-templates mode="mml" select="$ndCur/*"/>
+         </xsl:when>
+      </xsl:choose>
+  </xsl:template>
+
+
+  <!-- MathML munder/mover can represent several Omml constructs 
+       (m:bar, m:limLow, m:limUpp, m:acc, m:groupChr, etc.).  The following 
+       templates (FIsBar, FIsAcc, and FIsGroupChr) are used to determine 
+			 which of these Omml constructs an munder/mover should be translated into. -->
+
+  <!-- Note:  ndCur should only be an munder/mover MathML element.
+  
+       ndCur should be interpretted as an m:bar if
+          1)  its respective accent attribute is not true
+          2)  its second child is an mml:mo
+          3)  the character of the mml:mo is the correct under/over bar. -->
+  <xsl:template name="FIsBar">
+      <xsl:param name="ndCur"/>
+      <xsl:variable name="fUnder">
+         <xsl:choose>
+            <xsl:when test="$ndCur[self::mml:munder]">1</xsl:when>
+            <xsl:otherwise>0</xsl:otherwise>
+         </xsl:choose>
+      </xsl:variable>
+      <xsl:variable name="sLowerCaseAccent">
+         <xsl:choose>
+            <xsl:when test="$fUnder=1">
+               <xsl:choose>
+                  <xsl:when test="$ndCur/@accentunder">
+                     <xsl:value-of select="translate($ndCur/@accentunder, $StrUCAlphabet, $StrLCAlphabet)"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:value-of select="translate($ndCur/@mml:accentunder, $StrUCAlphabet, $StrLCAlphabet)"/>
+                  </xsl:otherwise>
+               </xsl:choose>
+            </xsl:when>
+            <xsl:otherwise>
+               <xsl:choose>
+                  <xsl:when test="$ndCur/@accent">
+                     <xsl:value-of select="translate($ndCur/@accent, $StrUCAlphabet, $StrLCAlphabet)"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:value-of select="translate($ndCur/@mml:accent, $StrUCAlphabet, $StrLCAlphabet)"/>
+                  </xsl:otherwise>
+               </xsl:choose>
+            </xsl:otherwise>
+         </xsl:choose>
+      </xsl:variable>
+      <xsl:variable name="fAccent">
+         <xsl:choose>
+            <xsl:when test="$sLowerCaseAccent='true'">1</xsl:when>
+            <xsl:otherwise>0</xsl:otherwise>
+         </xsl:choose>
+      </xsl:variable>
+
+      <xsl:choose>
+      <!-- The script is unaccented and the second child is an mo -->
+      <xsl:when test="$fAccent = 0                        and $ndCur/child::*[2]/self::mml:mo">
+            <xsl:variable name="sOperator">
+               <xsl:value-of select="$ndCur/child::*[2]"/>
+            </xsl:variable>
+            <xsl:choose>
+          <!-- Should we write an underbar? -->
+          <xsl:when test="$fUnder = 1">
+                  <xsl:choose>
+                     <xsl:when test="$sOperator = '̲'">1</xsl:when>
+                     <xsl:otherwise>0</xsl:otherwise>
+                  </xsl:choose>
+               </xsl:when>
+               <!-- Should we write an overbar? -->
+          <xsl:otherwise>
+                  <xsl:choose>
+                     <xsl:when test="$sOperator = '¯'">1</xsl:when>
+                     <xsl:otherwise>0</xsl:otherwise>
+                  </xsl:choose>
+               </xsl:otherwise>
+            </xsl:choose>
+         </xsl:when>
+         <xsl:otherwise>0</xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+  <!-- Note:  ndCur should only be an mover MathML element.
+  
+       ndCur should be interpretted as an m:acc if
+          1)  its accent attribute is true
+          2)  its second child is an mml:mo
+          3)  there is only one character in the mml:mo -->
+  <xsl:template name="FIsAcc">
+      <xsl:param name="ndCur" select="."/>
+
+      <xsl:variable name="sLowerCaseAccent">
+         <xsl:choose>
+            <xsl:when test="$ndCur/@accent">
+               <xsl:value-of select="translate($ndCur/@accent, $StrUCAlphabet, $StrLCAlphabet)"/>
+            </xsl:when>
+            <xsl:otherwise>
+               <xsl:value-of select="translate($ndCur/@mml:accent, $StrUCAlphabet, $StrLCAlphabet)"/>
+            </xsl:otherwise>
+         </xsl:choose>
+      </xsl:variable>
+      <xsl:variable name="fAccent">
+         <xsl:choose>
+            <xsl:when test="$sLowerCaseAccent='true'">1</xsl:when>
+            <xsl:otherwise>0</xsl:otherwise>
+         </xsl:choose>
+      </xsl:variable>
+
+      <xsl:choose>
+      <!-- The script is accented and the second child is an mo -->
+      <xsl:when test="$fAccent = 1                        and $ndCur/child::*[2] = mml:mo">
+            <xsl:variable name="sOperator">
+               <xsl:value-of select="$ndCur/child::*[2]"/>
+            </xsl:variable>
+            <xsl:choose>
+          <!-- There is only one operator, this is a valid Omml accent! -->
+          <xsl:when test="string-length($sOperator) = 1">1</xsl:when>
+               <!-- More than one accented operator.  This isn't a valid
+               omml accent -->
+          <xsl:otherwise>0</xsl:otherwise>
+            </xsl:choose>
+         </xsl:when>
+         <!-- Not accented, not an operator, or both, but in any case, this is
+           not an Omml accent. -->
+      <xsl:otherwise>0</xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+
+  <!-- Is ndCur a groupChr? 
+			 ndCur is a groupChr if:
+			 
+				 1.  The accent is false (note:  accent attribute 
+						 for munder is accentunder). 
+				 2.  ndCur is an munder or mover.
+				 3.  ndCur has two children
+				 4.  Of these two children, one is an mml:mo and the other is an mml:mrow
+				 5.  The number of characters in the mml:mo is 1.
+			 
+			 If all of the above are true, then return 1, else return 0.
+	-->
+  <xsl:template name="FIsGroupChr">
+      <xsl:param name="ndCur" select="."/>
+      <xsl:variable name="fUnder">
+         <xsl:choose>
+            <xsl:when test="$ndCur[self::mml:munder]">1</xsl:when>
+            <xsl:otherwise>0</xsl:otherwise>
+         </xsl:choose>
+      </xsl:variable>
+      <xsl:variable name="sLowerCaseAccent">
+         <xsl:choose>
+            <xsl:when test="$fUnder=1">
+               <xsl:choose>
+                  <xsl:when test="$ndCur/@accentunder">
+                     <xsl:value-of select="translate($ndCur/@accentunder, $StrUCAlphabet, $StrLCAlphabet)"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:value-of select="translate($ndCur/@mml:accentunder, $StrUCAlphabet, $StrLCAlphabet)"/>
+                  </xsl:otherwise>
+               </xsl:choose>
+            </xsl:when>
+            <xsl:otherwise>
+               <xsl:choose>
+                  <xsl:when test="$ndCur/@accent">
+                     <xsl:value-of select="translate($ndCur/@accent, $StrUCAlphabet, $StrLCAlphabet)"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:value-of select="translate($ndCur/@mml:accent, $StrUCAlphabet, $StrLCAlphabet)"/>
+                  </xsl:otherwise>
+               </xsl:choose>
+            </xsl:otherwise>
+         </xsl:choose>
+      </xsl:variable>
+
+      <xsl:variable name="fAccentFalse">
+         <xsl:choose>
+            <xsl:when test="$sLowerCaseAccent='false'">1</xsl:when>
+            <xsl:otherwise>0</xsl:otherwise>
+         </xsl:choose>
+      </xsl:variable>
+
+      <xsl:choose>
+         <xsl:when test="$fAccentFalse=1                       and $ndCur[self::mml:munder or self::mml:mover]                        and count($ndCur/child::*)=2                        and (($ndCur/child::*[1][self::mml:mrow] and $ndCur/child::*[2][self::mml:mo])                              or ($ndCur/child::*[1][self::mml:mo] and $ndCur/child::*[2][self::mml:mrow]))">
+            <xsl:variable name="sOperator">
+               <xsl:value-of select="$ndCur/child::mml:mo"/>
+            </xsl:variable>
+            <xsl:choose>
+               <xsl:when test="string-length($sOperator) &lt;= 1">1</xsl:when>
+               <xsl:otherwise>0</xsl:otherwise>
+            </xsl:choose>
+         </xsl:when>
+
+         <xsl:otherwise>0</xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+
+  <!-- %%Template: match munder
+	-->
+  <xsl:template mode="mml" match="mml:munder">
+      <xsl:variable name="fNary">
+         <xsl:call-template name="isNary">
+            <xsl:with-param name="ndCur" select="child::*[1]"/>
+         </xsl:call-template>
+      </xsl:variable>
+      <xsl:choose>
+         <xsl:when test="$fNary='true'">
+            <nary>
+               <xsl:call-template name="CreateNaryProp">
+                  <xsl:with-param name="chr">
+                     <xsl:value-of select="normalize-space(child::*[1])"/>
+                  </xsl:with-param>
+                  <xsl:with-param name="sMathmlType" select="'munder'"/>
+               </xsl:call-template>
+               <sub>
+                  <xsl:call-template name="CreateArgProp"/>
+                  <xsl:apply-templates mode="mml" select="child::*[2]"/>
+               </sub>
+               <sup>
+                  <xsl:call-template name="CreateArgProp"/>
+               </sup>
+               <e>
+                  <xsl:call-template name="CreateArgProp"/>
+                  <xsl:call-template name="NaryHandleMrowMstyle">
+                     <xsl:with-param name="ndCur" select="following-sibling::*[1]"/>
+                  </xsl:call-template>
+               </e>
+            </nary>
+         </xsl:when>
+         <xsl:otherwise>
+        <!-- Should this munder be interpreted as an OMML m:bar? -->
+        <xsl:variable name="fIsBar">
+               <xsl:call-template name="FIsBar">
+                  <xsl:with-param name="ndCur" select="."/>
+               </xsl:call-template>
+            </xsl:variable>
+            <xsl:choose>
+               <xsl:when test="$fIsBar=1">
+                  <bar>
+                     <barPr>
+                        <pos m:val="bot"/>
+                     </barPr>
+                     <e>
+                        <xsl:call-template name="CreateArgProp"/>
+                        <xsl:apply-templates mode="mml" select="child::*[1]"/>
+                     </e>
+                  </bar>
+               </xsl:when>
+               <xsl:otherwise>
+            <!-- It isn't an integral or underbar, is this a groupChr? -->
+            <xsl:variable name="fGroupChr">
+                     <xsl:call-template name="FIsGroupChr">
+                        <xsl:with-param name="ndCur" select="."/>
+                     </xsl:call-template>
+                  </xsl:variable>
+                  <xsl:choose>
+                     <xsl:when test="$fGroupChr=1">
+                        <groupChr>
+                           <xsl:call-template name="CreateGroupChrPr">
+                              <xsl:with-param name="chr">
+                                 <xsl:value-of select="mml:mo"/>
+                              </xsl:with-param>
+                              <xsl:with-param name="pos">
+                                 <xsl:choose>
+                                    <xsl:when test="child::*[1][self::mml:mrow]">bot</xsl:when>
+                                    <xsl:otherwise>top</xsl:otherwise>
+                                 </xsl:choose>
+                              </xsl:with-param>
+                              <xsl:with-param name="vertJc">top</xsl:with-param>
+                           </xsl:call-template>
+                           <e>
+                              <xsl:apply-templates mode="mml" select="mml:mrow"/>
+                           </e>
+                        </groupChr>
+                     </xsl:when>
+                     <xsl:otherwise>
+                <!-- Generic munder -->
+                <limLow>
+                           <e>
+                              <xsl:call-template name="CreateArgProp"/>
+                              <xsl:apply-templates mode="mml" select="child::*[1]"/>
+                           </e>
+                           <lim>
+                              <xsl:call-template name="CreateArgProp"/>
+                              <xsl:apply-templates mode="mml" select="child::*[2]"/>
+                           </lim>
+                        </limLow>
+                     </xsl:otherwise>
+                  </xsl:choose>
+               </xsl:otherwise>
+            </xsl:choose>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+
+  <!-- Given the values for chr, pos, and vertJc, create an omml
+	     groupChr's groupChrPr -->
+  <xsl:template name="CreateGroupChrPr">
+      <xsl:param name="chr">⏟</xsl:param>
+      <xsl:param name="pos" select="bot"/>
+      <xsl:param name="vertJc" select="top"/>
+      <groupChrPr>
+         <chr>
+            <xsl:attribute name="m:val">
+               <xsl:value-of select="$chr"/>
+            </xsl:attribute>
+         </chr>
+         <pos>
+            <xsl:attribute name="m:val">
+               <xsl:value-of select="$pos"/>
+            </xsl:attribute>
+         </pos>
+         <vertJc>
+            <xsl:attribute name="m:val">
+               <xsl:value-of select="$vertJc"/>
+            </xsl:attribute>
+         </vertJc>
+      </groupChrPr>
+  </xsl:template>
+
+
+  <!-- %%Template: match mover
+	-->
+  <xsl:template mode="mml" match="mml:mover">
+      <xsl:variable name="fNary">
+         <xsl:call-template name="isNary">
+            <xsl:with-param name="ndCur" select="child::*[1]"/>
+         </xsl:call-template>
+      </xsl:variable>
+      <xsl:choose>
+         <xsl:when test="$fNary='true'">
+            <nary>
+               <xsl:call-template name="CreateNaryProp">
+                  <xsl:with-param name="chr">
+                     <xsl:value-of select="normalize-space(child::*[1])"/>
+                  </xsl:with-param>
+                  <xsl:with-param name="sMathmlType" select="'mover'"/>
+               </xsl:call-template>
+               <sub>
+                  <xsl:call-template name="CreateArgProp"/>
+               </sub>
+               <sup>
+                  <xsl:call-template name="CreateArgProp"/>
+                  <xsl:apply-templates mode="mml" select="child::*[2]"/>
+               </sup>
+               <e>
+                  <xsl:call-template name="CreateArgProp"/>
+                  <xsl:call-template name="NaryHandleMrowMstyle">
+                     <xsl:with-param name="ndCur" select="following-sibling::*[1]"/>
+                  </xsl:call-template>
+               </e>
+            </nary>
+         </xsl:when>
+         <xsl:otherwise>
+        <!-- Should this munder be interpreted as an OMML m:bar or m:acc? -->
+
+        <!-- Check to see if this is an m:bar -->
+        <xsl:variable name="fIsBar">
+               <xsl:call-template name="FIsBar">
+                  <xsl:with-param name="ndCur" select="."/>
+               </xsl:call-template>
+            </xsl:variable>
+            <xsl:choose>
+               <xsl:when test="$fIsBar = 1">
+                  <bar>
+                     <barPr>
+                        <pos m:val="top"/>
+                     </barPr>
+                     <e>
+                        <xsl:call-template name="CreateArgProp"/>
+                        <xsl:apply-templates mode="mml" select="child::*[1]"/>
+                     </e>
+                  </bar>
+               </xsl:when>
+               <xsl:otherwise>
+            <!-- Not an m:bar, should it be an m:acc? -->
+            <xsl:variable name="fIsAcc">
+                     <xsl:call-template name="FIsAcc">
+                        <xsl:with-param name="ndCur" select="."/>
+                     </xsl:call-template>
+                  </xsl:variable>
+                  <xsl:choose>
+                     <xsl:when test="$fIsAcc=1">
+                        <acc>
+                           <accPr>
+                              <chr>
+                                 <xsl:attribute name="m:val">
+                                    <xsl:value-of select="child::*[2]"/>
+                                 </xsl:attribute>
+                              </chr>
+                           </accPr>
+                           <e>
+                              <xsl:call-template name="CreateArgProp"/>
+                              <xsl:apply-templates mode="mml" select="child::*[1]"/>
+                           </e>
+                        </acc>
+                     </xsl:when>
+                     <xsl:otherwise>
+                <!-- This isn't an integral, overbar or accent, 
+								     could it be a groupChr? -->
+                <xsl:variable name="fGroupChr">
+                           <xsl:call-template name="FIsGroupChr">
+                              <xsl:with-param name="ndCur" select="."/>
+                           </xsl:call-template>
+                        </xsl:variable>
+                        <xsl:choose>
+                           <xsl:when test="$fGroupChr=1">
+                              <groupChr>
+                                 <xsl:call-template name="CreateGroupChrPr">
+                                    <xsl:with-param name="chr">
+                                       <xsl:value-of select="mml:mo"/>
+                                    </xsl:with-param>
+                                    <xsl:with-param name="pos">
+                                       <xsl:choose>
+                                          <xsl:when test="child::*[1][self::mml:mrow]">top</xsl:when>
+                                          <xsl:otherwise>bot</xsl:otherwise>
+                                       </xsl:choose>
+                                    </xsl:with-param>
+                                    <xsl:with-param name="vertJc">bot</xsl:with-param>
+                                 </xsl:call-template>
+                                 <e>
+                                    <xsl:apply-templates mode="mml" select="mml:mrow"/>
+                                 </e>
+                              </groupChr>
+                           </xsl:when>
+                           <xsl:otherwise>
+                    <!-- Generic mover -->
+                    <limUpp>
+                                 <e>
+                                    <xsl:call-template name="CreateArgProp"/>
+                                    <xsl:apply-templates mode="mml" select="child::*[1]"/>
+                                 </e>
+                                 <lim>
+                                    <xsl:call-template name="CreateArgProp"/>
+                                    <xsl:apply-templates mode="mml" select="child::*[2]"/>
+                                 </lim>
+                              </limUpp>
+                           </xsl:otherwise>
+                        </xsl:choose>
+                     </xsl:otherwise>
+                  </xsl:choose>
+               </xsl:otherwise>
+            </xsl:choose>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+
+  <!-- %%Template: match munderover
+	-->
+  <xsl:template mode="mml" match="mml:munderover">
+      <xsl:variable name="fNary">
+         <xsl:call-template name="isNary">
+            <xsl:with-param name="ndCur" select="child::*[1]"/>
+         </xsl:call-template>
+      </xsl:variable>
+      <xsl:choose>
+         <xsl:when test="$fNary='true'">
+            <nary>
+               <xsl:call-template name="CreateNaryProp">
+                  <xsl:with-param name="chr">
+                     <xsl:value-of select="normalize-space(child::*[1])"/>
+                  </xsl:with-param>
+                  <xsl:with-param name="sMathmlType" select="'munderover'"/>
+               </xsl:call-template>
+               <sub>
+                  <xsl:call-template name="CreateArgProp"/>
+                  <xsl:apply-templates mode="mml" select="child::*[2]"/>
+               </sub>
+               <sup>
+                  <xsl:call-template name="CreateArgProp"/>
+                  <xsl:apply-templates mode="mml" select="child::*[3]"/>
+               </sup>
+               <e>
+                  <xsl:call-template name="CreateArgProp"/>
+                  <xsl:call-template name="NaryHandleMrowMstyle">
+                     <xsl:with-param name="ndCur" select="following-sibling::*[1]"/>
+                  </xsl:call-template>
+               </e>
+            </nary>
+         </xsl:when>
+         <xsl:otherwise>
+            <limUpp>
+               <e>
+                  <xsl:call-template name="CreateArgProp"/>
+                  <limLow>
+                     <e>
+                        <xsl:call-template name="CreateArgProp"/>
+                        <xsl:apply-templates mode="mml" select="child::*[1]"/>
+                     </e>
+                     <lim>
+                        <xsl:call-template name="CreateArgProp"/>
+                        <xsl:apply-templates mode="mml" select="child::*[2]"/>
+                     </lim>
+                  </limLow>
+               </e>
+               <lim>
+                  <xsl:call-template name="CreateArgProp"/>
+                  <xsl:apply-templates mode="mml" select="child::*[3]"/>
+               </lim>
+            </limUpp>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+  <!-- %%Template: match mfenced -->
+  <xsl:template mode="mml" match="mml:mfenced">
+      <d>
+         <xsl:call-template name="CreateDelimProp">
+            <xsl:with-param name="fChOpenValid">
+               <xsl:choose>
+                  <xsl:when test="@open">
+                     <xsl:value-of select="1"/>
+                  </xsl:when>
+                  <xsl:when test="@mml:open">
+                     <xsl:value-of select="1"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:value-of select="0"/>
+                  </xsl:otherwise>
+               </xsl:choose>
+            </xsl:with-param>
+            <xsl:with-param name="chOpen">
+               <xsl:choose>
+                  <xsl:when test="@open">
+                     <xsl:value-of select="@open"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:value-of select="@mml:open"/>
+                  </xsl:otherwise>
+               </xsl:choose>
+            </xsl:with-param>
+            <xsl:with-param name="fChSeparatorsValid">
+               <xsl:choose>
+                  <xsl:when test="@separators">
+                     <xsl:value-of select="1"/>
+                  </xsl:when>
+                  <xsl:when test="@mml:separators">
+                     <xsl:value-of select="1"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:value-of select="0"/>
+                  </xsl:otherwise>
+               </xsl:choose>
+            </xsl:with-param>
+            <xsl:with-param name="chSeparators">
+               <xsl:choose>
+                  <xsl:when test="@separators">
+                     <xsl:value-of select="@separators"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:value-of select="@mml:separators"/>
+                  </xsl:otherwise>
+               </xsl:choose>
+            </xsl:with-param>
+            <xsl:with-param name="fChCloseValid">
+               <xsl:choose>
+                  <xsl:when test="@close">
+                     <xsl:value-of select="1"/>
+                  </xsl:when>
+                  <xsl:when test="@mml:close">
+                     <xsl:value-of select="1"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:value-of select="0"/>
+                  </xsl:otherwise>
+               </xsl:choose>
+            </xsl:with-param>
+            <xsl:with-param name="chClose">
+               <xsl:choose>
+                  <xsl:when test="@close">
+                     <xsl:value-of select="@close"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:value-of select="@mml:close"/>
+                  </xsl:otherwise>
+               </xsl:choose>
+            </xsl:with-param>
+         </xsl:call-template>
+         <xsl:for-each select="*">
+            <e>
+               <xsl:call-template name="CreateArgProp"/>
+               <xsl:apply-templates mode="mml" select="."/>
+            </e>
+         </xsl:for-each>
+      </d>
+  </xsl:template>
+
+  <!-- %%Template: CreateDelimProp
+	
+		Given the characters to use as open, close and separators for 
+		the delim object, create the m:dPr (delim properties). 		
+		
+		MathML can have any number of separators in an mfenced object, but 
+		OMML can only represent one separator for each d (delim) object.
+		So, we pick the first separator specified. 		
+	-->
+  <xsl:template name="CreateDelimProp">
+      <xsl:param name="fChOpenValid"/>
+      <xsl:param name="chOpen"/>
+      <xsl:param name="fChSeparatorsValid"/>
+      <xsl:param name="chSeparators"/>
+      <xsl:param name="fChCloseValid"/>
+      <xsl:param name="chClose"/>
+      <xsl:variable name="chSep" select="substring($chSeparators, 1, 1)"/>
+
+      <!-- do we need a dPr at all? If everything's at its default value, then 
+			don't bother at all -->
+    <xsl:if test="($fChOpenValid=1 and not($chOpen = '(')) or         ($fChCloseValid=1 and not($chClose = ')')) or          not($chSep = '|')">
+         <dPr>
+        <!-- the default for MathML and OMML is '('. -->
+        <xsl:if test="$fChOpenValid=1 and not($chOpen = '(')">
+               <begChr>
+                  <xsl:attribute name="m:val">
+                     <xsl:value-of select="$chOpen"/>
+                  </xsl:attribute>
+               </begChr>
+            </xsl:if>
+
+            <!-- the default for MathML is ',' and for OMML is '|' -->
+
+        <xsl:choose>
+          <!-- matches OMML's default, don't bother to write anything out -->
+          <xsl:when test="$chSep = '|'"/>
+
+               <!-- Not specified, use MathML's default. We test against 
+					the existence of the actual attribute, not the substring -->
+          <xsl:when test="$fChSeparatorsValid=0">
+                  <sepChr m:val=","/>
+               </xsl:when>
+
+               <xsl:otherwise>
+                  <sepChr>
+                     <xsl:attribute name="m:val">
+                        <xsl:value-of select="$chSep"/>
+                     </xsl:attribute>
+                  </sepChr>
+               </xsl:otherwise>
+            </xsl:choose>
+
+            <!-- the default for MathML and OMML is ')'. -->
+        <xsl:if test="$fChCloseValid=1 and not($chClose = ')')">
+               <endChr>
+                  <xsl:attribute name="m:val">
+                     <xsl:value-of select="$chClose"/>
+                  </xsl:attribute>
+               </endChr>
+            </xsl:if>
+         </dPr>
+      </xsl:if>
+  </xsl:template>
+
+  <!-- %%Template: OutputMs
+	-->
+  <xsl:template name="OutputMs">
+      <xsl:param name="msCur"/>
+      <xsl:choose>
+         <xsl:when test="(not($msCur/@lquote) or $msCur/@lquote='')                       and (not($msCur/@mml:lquote) or $msCur/@mml:lquote='')">
+            <xsl:text>"</xsl:text>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:choose>
+               <xsl:when test="$msCur/@lquote">
+                  <xsl:value-of select="$msCur/@lquote"/>
+               </xsl:when>
+               <xsl:otherwise>
+                  <xsl:value-of select="$msCur/@mml:lquote"/>
+               </xsl:otherwise>
+            </xsl:choose>
+         </xsl:otherwise>
+      </xsl:choose>
+      <xsl:value-of select="normalize-space($msCur)"/>
+      <xsl:choose>
+         <xsl:when test="(not($msCur/@rquote) or $msCur/@rquote='')                        and (not($msCur/@mml:rquote) or $msCur/@mml:rquote='')">
+            <xsl:text>"</xsl:text>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:choose>
+               <xsl:when test="$msCur/@rquote">
+                  <xsl:value-of select="$msCur/@rquote"/>
+               </xsl:when>
+               <xsl:otherwise>
+                  <xsl:value-of select="$msCur/@mml:rquote"/>
+               </xsl:otherwise>
+            </xsl:choose>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+  <!-- %%Template: match msub
+	-->
+  <xsl:template mode="mml" match="mml:msub">
+      <xsl:variable name="fNary">
+         <xsl:call-template name="isNary">
+            <xsl:with-param name="ndCur" select="child::*[1]"/>
+         </xsl:call-template>
+      </xsl:variable>
+      <xsl:choose>
+         <xsl:when test="$fNary='true'">
+            <nary>
+               <xsl:call-template name="CreateNaryProp">
+                  <xsl:with-param name="chr">
+                     <xsl:value-of select="normalize-space(child::*[1])"/>
+                  </xsl:with-param>
+                  <xsl:with-param name="sMathmlType" select="'msub'"/>
+               </xsl:call-template>
+               <sub>
+                  <xsl:call-template name="CreateArgProp"/>
+                  <xsl:apply-templates mode="mml" select="child::*[2]"/>
+               </sub>
+               <sup>
+                  <xsl:call-template name="CreateArgProp"/>
+               </sup>
+               <e>
+                  <xsl:call-template name="CreateArgProp"/>
+                  <xsl:call-template name="NaryHandleMrowMstyle">
+                     <xsl:with-param name="ndCur" select="following-sibling::*[1]"/>
+                  </xsl:call-template>
+               </e>
+            </nary>
+         </xsl:when>
+         <xsl:otherwise>
+            <sSub>
+               <e>
+                  <xsl:call-template name="CreateArgProp"/>
+                  <xsl:apply-templates mode="mml" select="child::*[1]"/>
+               </e>
+               <sub>
+                  <xsl:call-template name="CreateArgProp"/>
+                  <xsl:apply-templates mode="mml" select="child::*[2]"/>
+               </sub>
+            </sSub>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+  <!-- %%Template: match msup
+	-->
+  <xsl:template mode="mml" match="mml:msup">
+      <xsl:variable name="fNary">
+         <xsl:call-template name="isNary">
+            <xsl:with-param name="ndCur" select="child::*[1]"/>
+         </xsl:call-template>
+      </xsl:variable>
+      <xsl:choose>
+         <xsl:when test="$fNary='true'">
+            <nary>
+               <xsl:call-template name="CreateNaryProp">
+                  <xsl:with-param name="chr">
+                     <xsl:value-of select="normalize-space(child::*[1])"/>
+                  </xsl:with-param>
+                  <xsl:with-param name="sMathmlType" select="'msup'"/>
+               </xsl:call-template>
+               <sub>
+                  <xsl:call-template name="CreateArgProp"/>
+               </sub>
+               <sup>
+                  <xsl:call-template name="CreateArgProp"/>
+                  <xsl:apply-templates mode="mml" select="child::*[2]"/>
+               </sup>
+               <e>
+                  <xsl:call-template name="CreateArgProp"/>
+                  <xsl:call-template name="NaryHandleMrowMstyle">
+                     <xsl:with-param name="ndCur" select="following-sibling::*[1]"/>
+                  </xsl:call-template>
+               </e>
+            </nary>
+         </xsl:when>
+         <xsl:otherwise>
+            <sSup>
+               <e>
+                  <xsl:call-template name="CreateArgProp"/>
+                  <xsl:apply-templates mode="mml" select="child::*[1]"/>
+               </e>
+               <sup>
+                  <xsl:call-template name="CreateArgProp"/>
+                  <xsl:apply-templates mode="mml" select="child::*[2]"/>
+               </sup>
+            </sSup>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+  <!-- %%Template: match msubsup
+	-->
+  <xsl:template mode="mml" match="mml:msubsup">
+      <xsl:variable name="fNary">
+         <xsl:call-template name="isNary">
+            <xsl:with-param name="ndCur" select="child::*[1]"/>
+         </xsl:call-template>
+      </xsl:variable>
+      <xsl:choose>
+         <xsl:when test="$fNary='true'">
+            <nary>
+               <xsl:call-template name="CreateNaryProp">
+                  <xsl:with-param name="chr">
+                     <xsl:value-of select="normalize-space(child::*[1])"/>
+                  </xsl:with-param>
+                  <xsl:with-param name="sMathmlType" select="'msubsup'"/>
+               </xsl:call-template>
+               <sub>
+                  <xsl:call-template name="CreateArgProp"/>
+                  <xsl:apply-templates mode="mml" select="child::*[2]"/>
+               </sub>
+               <sup>
+                  <xsl:call-template name="CreateArgProp"/>
+                  <xsl:apply-templates mode="mml" select="child::*[3]"/>
+               </sup>
+               <e>
+                  <xsl:call-template name="CreateArgProp"/>
+                  <xsl:call-template name="NaryHandleMrowMstyle">
+                     <xsl:with-param name="ndCur" select="following-sibling::*[1]"/>
+                  </xsl:call-template>
+               </e>
+            </nary>
+         </xsl:when>
+         <xsl:otherwise>
+            <sSubSup>
+               <e>
+                  <xsl:call-template name="CreateArgProp"/>
+                  <xsl:apply-templates mode="mml" select="child::*[1]"/>
+               </e>
+               <sub>
+                  <xsl:call-template name="CreateArgProp"/>
+                  <xsl:apply-templates mode="mml" select="child::*[2]"/>
+               </sub>
+               <sup>
+                  <xsl:call-template name="CreateArgProp"/>
+                  <xsl:apply-templates mode="mml" select="child::*[3]"/>
+               </sup>
+            </sSubSup>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+  <!-- %%Template: SplitScripts 
+	
+		Takes an collection of nodes, and splits them
+		odd and even into sup and sub scripts. Used for dealing with
+		mmultiscript.
+		
+		This template assumes you want to output both a sub and sup element.
+		-->
+  <xsl:template name="SplitScripts">
+      <xsl:param name="ndScripts"/>
+      <sub>
+         <xsl:call-template name="CreateArgProp"/>
+         <xsl:apply-templates mode="mml" select="$ndScripts[(position() mod 2) = 1]"/>
+      </sub>
+      <sup>
+         <xsl:call-template name="CreateArgProp"/>
+         <xsl:apply-templates mode="mml" select="$ndScripts[(position() mod 2) = 0]"/>
+      </sup>
+  </xsl:template>
+
+  <!-- %%Template: match mmultiscripts
+	
+		There is some subtlety with the mml:mprescripts element. Everything that comes before 
+		that is considered a script (as opposed to a pre-script), but it need not be present.
+	-->
+  <xsl:template mode="mml" match="mml:mmultiscripts">
+
+    <!-- count the nodes. Everything that comes after a mml:mprescripts is considered a pre-script;
+			Everything that does not have an mml:mprescript as a preceding-sibling (and is not itself 
+			mml:mprescript) is a script, except for the first child which is always the base.
+			The mml:none element is a place holder for a sub/sup element slot.
+			
+			mmultisript pattern:
+			<mmultiscript>
+				(base)
+				(sub sup)* // Where <none/> can replace a sub/sup entry to preserve pattern.
+				<mprescripts />
+				(presub presup)*
+			</mmultiscript>
+			-->
+    <!-- Count of presecript nodes that we'd print (this is essentially anything but the none placeholder. -->
+    <xsl:variable name="cndPrescriptStrict"
+                    select="count(mml:mprescripts[1]/following-sibling::*[not(self::mml:none)])"/>
+      <!-- Count of all super script excluding mml:none -->
+    <xsl:variable name="cndSuperScript"
+                    select="count(*[not(preceding-sibling::mml:mprescripts)                               and not(self::mml:mprescripts)                               and ((position() mod 2) = 1)                                and not(self::mml:none)]) - 1"/>
+      <!-- Count of all sup script excluding mml:none -->
+    <xsl:variable name="cndSubScript"
+                    select="count(*[not(preceding-sibling::mml:mprescripts)                               and not(self::mml:mprescripts)                               and ((position() mod 2) = 0)                                and not(self::mml:none)])"/>
+      <!-- Count of all scripts excluding mml:none -->
+    <xsl:variable name="cndScriptStrict" select="$cndSuperScript + $cndSubScript"/>
+      <!-- Count of all scripts including mml:none.  This is essentially all nodes before the 
+		first mml:mprescripts except the base. -->
+    <xsl:variable name="cndScript"
+                    select="count(*[not(preceding-sibling::mml:mprescripts) and not(self::mml:mprescripts)]) - 1"/>
+
+      <xsl:choose>
+      <!-- The easy case first. No prescripts, and no script ... just a base -->
+      <xsl:when test="$cndPrescriptStrict &lt;= 0 and $cndScriptStrict &lt;= 0">
+            <xsl:apply-templates mode="mml" select="*[1]"/>
+         </xsl:when>
+
+         <!-- Next, if there are no prescripts -->
+      <xsl:when test="$cndPrescriptStrict &lt;= 0">
+        <!-- we know we have some scripts or else we would have taken the earlier
+					  branch. -->
+        <xsl:choose>
+          <!-- We have both sub and super scripts-->
+          <xsl:when test="$cndSuperScript &gt; 0 and $cndSubScript &gt; 0">
+                  <sSubSup>
+                     <e>
+                        <xsl:call-template name="CreateArgProp"/>
+                        <xsl:apply-templates mode="mml" select="child::*[1]"/>
+                     </e>
+
+                     <!-- Every child except the first is a script.  Do the split -->
+              <xsl:call-template name="SplitScripts">
+                        <xsl:with-param name="ndScripts" select="*[position() &gt; 1]"/>
+                     </xsl:call-template>
+                  </sSubSup>
+               </xsl:when>
+               <!-- Just a sub script -->
+          <xsl:when test="$cndSubScript &gt; 0">
+                  <sSub>
+                     <e>
+                        <xsl:call-template name="CreateArgProp"/>
+                        <xsl:apply-templates mode="mml" select="child::*[1]"/>
+                     </e>
+
+                     <!-- No prescripts and no super scripts, therefore, it's a sub. -->
+              <sub>
+                        <xsl:apply-templates mode="mml" select="*[position() &gt; 1]"/>
+                     </sub>
+                  </sSub>
+               </xsl:when>
+               <!-- Just super script -->
+          <xsl:otherwise>
+                  <sSup>
+                     <e>
+                        <xsl:call-template name="CreateArgProp"/>
+                        <xsl:apply-templates mode="mml" select="child::*[1]"/>
+                     </e>
+
+                     <!-- No prescripts and no sub scripts, therefore, it's a sup. -->
+              <sup>
+                        <xsl:apply-templates mode="mml" select="*[position() &gt; 1]"/>
+                     </sup>
+                  </sSup>
+               </xsl:otherwise>
+            </xsl:choose>
+         </xsl:when>
+
+         <!-- Next, if there are no scripts -->
+      <xsl:when test="$cndScriptStrict &lt;= 0">
+        <!-- we know we have some prescripts or else we would have taken the earlier
+					  branch. So, create an sPre and split the elements -->
+        <sPre>
+               <e>
+                  <xsl:call-template name="CreateArgProp"/>
+                  <xsl:apply-templates mode="mml" select="child::*[1]"/>
+               </e>
+
+               <!-- The prescripts come after the mml:mprescript and if we get here
+							we know there exists some elements after the mml:mprescript element. 
+							
+							The prescript element has no sub/subsup variation, therefore, even if
+							we're only writing sub, we need to write out both the sub and sup element.
+							-->
+          <xsl:call-template name="SplitScripts">
+                  <xsl:with-param name="ndScripts" select="mml:mprescripts[1]/following-sibling::*"/>
+               </xsl:call-template>
+            </sPre>
+         </xsl:when>
+
+         <!-- Finally, the case with both prescripts and scripts. Create an sPre 
+				element to house the prescripts, with a sub/sup/subsup element at its base. -->
+      <xsl:otherwise>
+            <sPre>
+               <e>
+                  <xsl:choose>
+              <!-- We have both sub and super scripts-->
+              <xsl:when test="$cndSuperScript &gt; 0 and $cndSubScript &gt; 0">
+                        <sSubSup>
+                           <e>
+                              <xsl:call-template name="CreateArgProp"/>
+                              <xsl:apply-templates mode="mml" select="child::*[1]"/>
+                           </e>
+
+                           <!-- scripts come before the mml:mprescript but after the first child, so their
+								 positions will be 2, 3, ... ($nndScript + 1) -->
+                  <xsl:call-template name="SplitScripts">
+                              <xsl:with-param name="ndScripts"
+                                              select="*[(position() &gt; 1) and (position() &lt;= ($cndScript + 1))]"/>
+                           </xsl:call-template>
+                        </sSubSup>
+                     </xsl:when>
+                     <!-- Just a sub script -->
+              <xsl:when test="$cndSubScript &gt; 0">
+                        <sSub>
+                           <e>
+                              <xsl:call-template name="CreateArgProp"/>
+                              <xsl:apply-templates mode="mml" select="child::*[1]"/>
+                           </e>
+
+                           <!-- We have prescripts but no super scripts, therefore, do a sub 
+									and apply templates to all tokens counted by cndScript. -->
+                  <sub>
+                              <xsl:apply-templates mode="mml" select="*[position() &gt; 1 and (position() &lt;= ($cndScript + 1))]"/>
+                           </sub>
+                        </sSub>
+                     </xsl:when>
+                     <!-- Just super script -->
+              <xsl:otherwise>
+                        <sSup>
+                           <e>
+                              <xsl:call-template name="CreateArgProp"/>
+                              <xsl:apply-templates mode="mml" select="child::*[1]"/>
+                           </e>
+
+                           <!-- We have prescripts but no sub scripts, therefore, do a sub 
+									and apply templates to all tokens counted by cndScript. -->
+                  <sup>
+                              <xsl:apply-templates mode="mml" select="*[position() &gt; 1 and (position() &lt;= ($cndScript + 1))]"/>
+                           </sup>
+                        </sSup>
+                     </xsl:otherwise>
+                  </xsl:choose>
+               </e>
+
+               <!-- The prescripts come after the mml:mprescript and if we get here
+							we know there exists one such element -->
+          <xsl:call-template name="SplitScripts">
+                  <xsl:with-param name="ndScripts" select="mml:mprescripts[1]/following-sibling::*"/>
+               </xsl:call-template>
+            </sPre>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+  <!-- Template that determines if ndCur is an equation array.
+				
+			 ndCur is an equation array if:
+			 
+			 0.  The table has a columnalign other than the default (center) 
+			 1.  There are are no frame lines
+			 2.  There are no column lines
+			 3.  There are no row lines
+			 4.  There is no row with more than 1 column  
+			 5.  There is no row with fewer than 1 column
+			 6.  There are no labeled rows.			 
+			 
+	-->
+  <xsl:template name="FIsEqArray">
+      <xsl:param name="ndCur" select="."/>
+
+      <!-- There should be no frame, columnlines, or rowlines -->
+    <xsl:choose>
+         <xsl:when test="@columnalign!='center'">0</xsl:when>
+         <xsl:when test="(not($ndCur/@frame) or $ndCur/@frame='' or $ndCur/@frame='none')                       
+			 and (not($ndCur/@mml:frame) or $ndCur/@mml:frame='' or $ndCur/@mml:frame='none')
+			 and (not($ndCur/@columnlines) or $ndCur/@columnlines='' or $ndCur/@columnlines='none')                       
+			 and (not($ndCur/@mml:columnlines) or $ndCur/@mml:columnlines='' or $ndCur/@mml:columnlines='none')               
+			 and (not($ndCur/@rowlines) or $ndCur/@rowlines='' or $ndCur/@rowlines='none')                       
+			 and (not($ndCur/@mml:rowlines) or $ndCur/@mml:rowlines='' or $ndCur/@mml:rowlines='none')               
+			 and not($ndCur/mml:mtr[count(mml:mtd) &gt; 1])            
+			 and not($ndCur/mml:mtr[count(mml:mtd) &lt; 1])
+			 and not($ndCur/mml:mlabeledtr)">1</xsl:when>
+         <xsl:otherwise>0</xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+  <!-- Template used to determine if we should ignore a collection when iterating through 
+	     a mathml equation array row.
+	
+			 So far, the only thing that needs to be ignored is the argument of an nary.  We
+			 can ignore this since it is output when we apply-templates to the munder[over]/msub[sup].
+	-->
+  <xsl:template name="FIgnoreCollection">
+      <xsl:param name="ndCur" select="."/>
+
+      <xsl:variable name="fNaryArgument">
+         <xsl:call-template name="FIsNaryArgument">
+            <xsl:with-param name="ndCur" select="$ndCur"/>
+         </xsl:call-template>
+      </xsl:variable>
+
+      <xsl:choose>
+         <xsl:when test="$fNaryArgument=1">1</xsl:when>
+         <xsl:otherwise>0</xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+  <!-- Template used to determine if we've already encountered an maligngroup or malignmark.
+	
+			 This is needed because omml has an implicit spacing alignment (omml spacing alignment = 
+			 mathml's maligngroup element) at the beginning of each equation array row.  Therefore, 
+			 the first maligngroup (implied or explicit) we encounter does not need to be output.  
+			 This template recursively searches up the xml tree and looks at previous siblings to see 
+			 if they have a descendant that is an maligngroup or malignmark.  We look for the malignmark 
+			 to find the implicit maligngroup.
+	-->
+  <xsl:template name="FFirstAlignAlreadyFound">
+      <xsl:param name="ndCur" select="."/>
+
+      <xsl:choose>
+         <xsl:when test="count($ndCur/preceding-sibling::*[descendant-or-self::mml:maligngroup                                                 or descendant-or-self::mml:malignmark]) &gt; 0">1</xsl:when>
+         <xsl:when test="not($ndCur/parent::mml:mtd)">
+            <xsl:call-template name="FFirstAlignAlreadyFound">
+               <xsl:with-param name="ndCur" select="$ndCur/parent::*"/>
+            </xsl:call-template>
+         </xsl:when>
+         <xsl:otherwise>0</xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+  <!-- This template builds a string that is result of concatenating a given string several times. 
+	
+			 Given strToRepeat, create a string that has strToRepeat repeated iRepitions times. 
+	-->
+  <xsl:template name="ConcatStringRepeat">
+      <xsl:param name="strToRepeat" select="''"/>
+      <xsl:param name="iRepetitions" select="0"/>
+      <xsl:param name="strBuilding" select="''"/>
+
+      <xsl:choose>
+         <xsl:when test="$iRepetitions &lt;= 0">
+            <xsl:value-of select="$strBuilding"/>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:call-template name="ConcatStringRepeat">
+               <xsl:with-param name="strToRepeat" select="$strToRepeat"/>
+               <xsl:with-param name="iRepetitions" select="$iRepetitions - 1"/>
+               <xsl:with-param name="strBuilding" select="concat($strBuilding, $strToRepeat)"/>
+            </xsl:call-template>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+  <!-- This template determines if ndCur is a special collection.
+			 By special collection, I mean is ndCur the outer element of some special grouping 
+			 of mathml elements that actually represents some over all omml structure.
+			 
+			 For instance, is ndCur a linear fraction, or an omml function.
+	-->
+  <xsl:template name="FSpecialCollection">
+      <xsl:param name="ndCur" select="."/>
+      <xsl:choose>
+         <xsl:when test="$ndCur/self::mml:mrow">
+            <xsl:variable name="fLinearFraction">
+               <xsl:call-template name="FLinearFrac">
+                  <xsl:with-param name="ndCur" select="$ndCur"/>
+               </xsl:call-template>
+            </xsl:variable>
+            <xsl:variable name="fFunc">
+               <xsl:call-template name="FIsFunc">
+                  <xsl:with-param name="ndCur" select="$ndCur"/>
+               </xsl:call-template>
+            </xsl:variable>
+            <xsl:choose>
+               <xsl:when test="$fLinearFraction=1 or $fFunc=1">1</xsl:when>
+               <xsl:otherwise>0</xsl:otherwise>
+            </xsl:choose>
+         </xsl:when>
+         <xsl:otherwise>0</xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+  <!-- This template iterates through the children of an equation array row (mtr) and outputs
+	     the equation.
+			 
+			 This template does all the work to output ampersands and skip the right elements when needed.
+	-->
+  <xsl:template name="ProcessEqArrayRow">
+      <xsl:param name="ndCur" select="."/>
+
+      <xsl:for-each select="$ndCur/*">
+         <xsl:variable name="fSpecialCollection">
+            <xsl:call-template name="FSpecialCollection">
+               <xsl:with-param name="ndCur" select="."/>
+            </xsl:call-template>
+         </xsl:variable>
+         <xsl:variable name="fIgnoreCollection">
+            <xsl:call-template name="FIgnoreCollection">
+               <xsl:with-param name="ndCur" select="."/>
+            </xsl:call-template>
+         </xsl:variable>
+         <xsl:choose>
+        <!-- If we have an alignment element output the ampersand. -->
+        <xsl:when test="self::mml:maligngroup or self::mml:malignmark">
+          <!-- Omml has an implied spacing alignment at the beginning of each equation.
+					     Therefore, if this is the first ampersand to be output, don't actually output. -->
+          <xsl:variable name="fFirstAlignAlreadyFound">
+                  <xsl:call-template name="FFirstAlignAlreadyFound">
+                     <xsl:with-param name="ndCur" select="."/>
+                  </xsl:call-template>
+               </xsl:variable>
+               <!-- Don't output unless it is an malignmark or we have already previously found an alignment point. -->
+          <xsl:if test="self::mml:malignmark or $fFirstAlignAlreadyFound=1">
+                  <r>
+                     <t>&amp;</t>
+                  </r>
+               </xsl:if>
+            </xsl:when>
+            <!-- If this node is an non-special mrow or mstyle and we aren't supposed to ignore this collection, then
+				     go ahead an apply templates to this node. -->
+        <xsl:when test="$fIgnoreCollection=0 and ((self::mml:mrow and $fSpecialCollection=0) or self::mml:mstyle)">
+               <xsl:call-template name="ProcessEqArrayRow">
+                  <xsl:with-param name="ndCur" select="."/>
+               </xsl:call-template>
+            </xsl:when>
+            <!-- At this point we have some mathml structure (fraction, nary, non-grouping element, etc.) -->
+        <!-- If this mathml structure has alignment groups or marks as children, then extract those since
+				     omml can't handle that. -->
+        <xsl:when test="descendant::mml:maligngroup or descendant::mml:malignmark">
+               <xsl:variable name="cMalignGroups">
+                  <xsl:value-of select="count(descendant::mml:maligngroup)"/>
+               </xsl:variable>
+               <xsl:variable name="cMalignMarks">
+                  <xsl:value-of select="count(descendant::mml:malignmark)"/>
+               </xsl:variable>
+               <!-- Output all maligngroups and malignmarks as '&amp;' -->
+          <xsl:if test="$cMalignGroups + $cMalignMarks &gt; 0">
+                  <xsl:variable name="str">
+                     <xsl:call-template name="ConcatStringRepeat">
+                        <xsl:with-param name="strToRepeat" select="'&amp;'"/>
+                        <xsl:with-param name="iRepetitions" select="$cMalignGroups + $cMalignMarks"/>
+                        <xsl:with-param name="strBuilding" select="''"/>
+                     </xsl:call-template>
+                  </xsl:variable>
+                  <r>
+                     <t>
+                        <xsl:call-template name="OutputText">
+                           <xsl:with-param name="sInput" select="$str"/>
+                        </xsl:call-template>
+                     </t>
+                  </r>
+               </xsl:if>
+               <!-- Now that the '&amp;' have been extracted, just apply-templates to this node.-->
+          <xsl:apply-templates mode="mml" select="."/>
+            </xsl:when>
+            <!-- If there are no alignment points as descendants, then go ahead and output this node. -->
+        <xsl:otherwise>
+               <xsl:apply-templates mode="mml" select="."/>
+            </xsl:otherwise>
+         </xsl:choose>
+      </xsl:for-each>
+  </xsl:template>
+
+  <!-- This template transforms mtable into its appropriate omml type.
+	
+			 There are two possible omml constructs that an mtable can become:  a matrix or 
+			 an equation array.
+			 
+			 Because omml has no generic table construct, the omml matrix is the best approximate
+			 for a mathml table.
+			 
+			 Our equation array transformation is very simple.  The main goal of this transform is to
+			 allow roundtripping omml eq arrays through mathml.  The template ProcessEqArrayRow was never
+			 intended to account for many of the alignment flexibilities that are present in mathml like 
+			 using the alig attribute, using alignmark attribute in token elements, etc.
+			 
+			 The restrictions on this transform require <malignmark> and <maligngroup> elements to be outside of
+			 any non-grouping mathml elements (that is, mrow and mstyle).  Moreover, these elements cannot be the children of
+			 mrows that represent linear fractions or functions.  Also, <malignmark> cannot be a child
+			 of token attributes.
+			 
+			 In the case that the above 
+	
+	-->
+  <xsl:template mode="mml" match="mml:mtable">
+      <xsl:variable name="fEqArray">
+         <xsl:call-template name="FIsEqArray">
+            <xsl:with-param name="ndCur" select="."/>
+         </xsl:call-template>
+      </xsl:variable>
+      <xsl:variable name="alignment">
+	<xsl:value-of select="@columnalign"/>
+      </xsl:variable>
+      <xsl:choose>
+         <xsl:when test="$fEqArray=1">
+            <eqArr>
+	      <xsl:if test="$alignment!=''">
+		<eqArrPr>
+		  <baseJc m:val="{$alignment}"/>
+		</eqArrPr>
+	      </xsl:if>
+               <xsl:for-each select="mml:mtr">
+                  <e>
+                     <xsl:call-template name="ProcessEqArrayRow">
+                        <xsl:with-param name="ndCur" select="mml:mtd"/>
+                     </xsl:call-template>
+                  </e>
+               </xsl:for-each>
+            </eqArr>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:variable name="cMaxElmtsInRow">
+               <xsl:call-template name="CountMaxElmtsInRow">
+                  <xsl:with-param name="ndCur" select="*[1]"/>
+                  <xsl:with-param name="cMaxElmtsInRow" select="0"/>
+               </xsl:call-template>
+            </xsl:variable>
+            <m>
+               <mPr>
+                  <baseJc m:val="center"/>
+                  <plcHide m:val="on"/>
+                  <mcs>
+                     <mc>
+                        <mcPr>
+                           <count>
+                              <xsl:attribute name="m:val">
+                                 <xsl:value-of select="$cMaxElmtsInRow"/>
+                              </xsl:attribute>
+                           </count>
+                           <mcJc m:val="{$alignment}"/>
+                        </mcPr>
+                     </mc>
+                  </mcs>
+               </mPr>
+               <xsl:for-each select="*">
+                  <xsl:choose>
+                     <xsl:when test="self::mml:mtr or self::mml:mlabeledtr">
+                        <mr>
+                           <xsl:choose>
+                              <xsl:when test="self::mml:mtr">
+                                 <xsl:for-each select="*">
+                                    <e>
+                                       <xsl:apply-templates mode="mml" select="."/>
+                                    </e>
+                                 </xsl:for-each>
+                                 <xsl:call-template name="CreateEmptyElmt">
+                                    <xsl:with-param name="cEmptyMtd" select="$cMaxElmtsInRow - count(*)"/>
+                                 </xsl:call-template>
+                              </xsl:when>
+                              <xsl:otherwise>
+                                 <xsl:for-each select="*[position() &gt; 1]">
+                                    <e>
+                                       <xsl:apply-templates mode="mml" select="."/>
+                                    </e>
+                                 </xsl:for-each>
+                                 <xsl:call-template name="CreateEmptyElmt">
+                                    <xsl:with-param name="cEmptyMtd" select="$cMaxElmtsInRow - (count(*) - 1)"/>
+                                 </xsl:call-template>
+                              </xsl:otherwise>
+                           </xsl:choose>
+                        </mr>
+                     </xsl:when>
+                     <xsl:otherwise>
+                        <mr>
+                           <e>
+                              <xsl:apply-templates mode="mml" select="."/>
+                           </e>
+                           <xsl:call-template name="CreateEmptyElmt">
+                              <xsl:with-param name="cEmptyMtd" select="$cMaxElmtsInRow - 1"/>
+                           </xsl:call-template>
+                        </mr>
+                     </xsl:otherwise>
+                  </xsl:choose>
+               </xsl:for-each>
+            </m>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <xsl:template mode="mml" match="m:mtd">
+      <xsl:apply-templates mode="mml"/>
+  </xsl:template>
+  <xsl:template name="CreateEmptyElmt">
+      <xsl:param name="cEmptyMtd"/>
+      <xsl:if test="$cEmptyMtd &gt; 0">
+         <e/>
+         <xsl:call-template name="CreateEmptyElmt">
+            <xsl:with-param name="cEmptyMtd" select="$cEmptyMtd - 1"/>
+         </xsl:call-template>
+      </xsl:if>
+  </xsl:template>
+  <xsl:template name="CountMaxElmtsInRow">
+      <xsl:param name="ndCur"/>
+      <xsl:param name="cMaxElmtsInRow" select="0"/>
+      <xsl:choose>
+         <xsl:when test="not($ndCur)">
+            <xsl:value-of select="$cMaxElmtsInRow"/>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:call-template name="CountMaxElmtsInRow">
+               <xsl:with-param name="ndCur" select="$ndCur/following-sibling::*[1]"/>
+               <xsl:with-param name="cMaxElmtsInRow">
+                  <xsl:choose>
+                     <xsl:when test="local-name($ndCur) = 'mlabeledtr' and                      namespace-uri($ndCur) = 'http://www.w3.org/1998/Math/MathML'">
+                        <xsl:choose>
+                           <xsl:when test="(count($ndCur/*) - 1) &gt; $cMaxElmtsInRow">
+                              <xsl:value-of select="count($ndCur/*) - 1"/>
+                           </xsl:when>
+                           <xsl:otherwise>
+                              <xsl:value-of select="$cMaxElmtsInRow"/>
+                           </xsl:otherwise>
+                        </xsl:choose>
+                     </xsl:when>
+                     <xsl:when test="local-name($ndCur) = 'mtr' and                      namespace-uri($ndCur) = 'http://www.w3.org/1998/Math/MathML'">
+                        <xsl:choose>
+                           <xsl:when test="count($ndCur/*) &gt; $cMaxElmtsInRow">
+                              <xsl:value-of select="count($ndCur/*)"/>
+                           </xsl:when>
+                           <xsl:otherwise>
+                              <xsl:value-of select="$cMaxElmtsInRow"/>
+                           </xsl:otherwise>
+                        </xsl:choose>
+                     </xsl:when>
+                     <xsl:otherwise>
+                        <xsl:choose>
+                           <xsl:when test="1 &gt; $cMaxElmtsInRow">
+                              <xsl:value-of select="1"/>
+                           </xsl:when>
+                           <xsl:otherwise>
+                              <xsl:value-of select="$cMaxElmtsInRow"/>
+                           </xsl:otherwise>
+                        </xsl:choose>
+                     </xsl:otherwise>
+                  </xsl:choose>
+               </xsl:with-param>
+            </xsl:call-template>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <xsl:template mode="mml" match="mml:mglyph">
+      <xsl:call-template name="CreateMglyph"/>
+  </xsl:template>
+  <xsl:template mode="mml"
+                 match="mml:mi[child::mml:mglyph] |                        mml:mn[child::mml:mglyph] |                        mml:mo[child::mml:mglyph] |                        mml:ms[child::mml:mglyph] |                        mml:mtext[child::mml:mglyph]">
+      <xsl:if test="string-length(normalize-space(.)) &gt; 0">
+         <r>
+            <xsl:call-template name="CreateRunProp">
+               <xsl:with-param name="mathvariant">
+                  <xsl:choose>
+                     <xsl:when test="@mathvariant">
+                        <xsl:value-of select="@mathvariant"/>
+                     </xsl:when>
+                     <xsl:otherwise>
+                        <xsl:value-of select="@mml:mathvariant"/>
+                     </xsl:otherwise>
+                  </xsl:choose>
+               </xsl:with-param>
+               <xsl:with-param name="fontstyle">
+                  <xsl:choose>
+                     <xsl:when test="@fontstyle">
+                        <xsl:value-of select="@fontstyle"/>
+                     </xsl:when>
+                     <xsl:otherwise>
+                        <xsl:value-of select="@mml:fontstyle"/>
+                     </xsl:otherwise>
+                  </xsl:choose>
+               </xsl:with-param>
+               <xsl:with-param name="fontweight">
+                  <xsl:choose>
+                     <xsl:when test="@fontweight">
+                        <xsl:value-of select="@fontweight"/>
+                     </xsl:when>
+                     <xsl:otherwise>
+                        <xsl:value-of select="@mml:fontweight"/>
+                     </xsl:otherwise>
+                  </xsl:choose>
+               </xsl:with-param>
+               <xsl:with-param name="mathcolor">
+                  <xsl:choose>
+                     <xsl:when test="@mathcolor">
+                        <xsl:value-of select="@mathcolor"/>
+                     </xsl:when>
+                     <xsl:otherwise>
+                        <xsl:value-of select="@mml:mathcolor"/>
+                     </xsl:otherwise>
+                  </xsl:choose>
+               </xsl:with-param>
+               <xsl:with-param name="mathsize">
+                  <xsl:choose>
+                     <xsl:when test="@mathsize">
+                        <xsl:value-of select="@mathsize"/>
+                     </xsl:when>
+                     <xsl:otherwise>
+                        <xsl:value-of select="@mml:mathsize"/>
+                     </xsl:otherwise>
+                  </xsl:choose>
+               </xsl:with-param>
+               <xsl:with-param name="color">
+                  <xsl:choose>
+                     <xsl:when test="@color">
+                        <xsl:value-of select="@color"/>
+                     </xsl:when>
+                     <xsl:otherwise>
+                        <xsl:value-of select="@mml:color"/>
+                     </xsl:otherwise>
+                  </xsl:choose>
+               </xsl:with-param>
+               <xsl:with-param name="fontsize">
+                  <xsl:choose>
+                     <xsl:when test="@fontsize">
+                        <xsl:value-of select="@fontsize"/>
+                     </xsl:when>
+                     <xsl:otherwise>
+                        <xsl:value-of select="@mml:fontsize"/>
+                     </xsl:otherwise>
+                  </xsl:choose>
+               </xsl:with-param>
+               <xsl:with-param name="fNor">
+                  <xsl:call-template name="FNor">
+                     <xsl:with-param name="ndCur" select="."/>
+                  </xsl:call-template>
+               </xsl:with-param>
+               <xsl:with-param name="fLit">
+                  <xsl:call-template name="FLit">
+                     <xsl:with-param name="ndCur" select="."/>
+                  </xsl:call-template>
+               </xsl:with-param>
+               <xsl:with-param name="ndCur" select="."/>
+            </xsl:call-template>
+            <t>
+               <xsl:call-template name="OutputText">
+                  <xsl:with-param name="sInput">
+                     <xsl:choose>
+                        <xsl:when test="self::mml:ms">
+                           <xsl:call-template name="OutputMs">
+                              <xsl:with-param name="msCur" select="."/>
+                           </xsl:call-template>
+                        </xsl:when>
+                        <xsl:otherwise>
+                           <xsl:value-of select="normalize-space(.)"/>
+                        </xsl:otherwise>
+                     </xsl:choose>
+                  </xsl:with-param>
+               </xsl:call-template>
+            </t>
+         </r>
+      </xsl:if>
+      <xsl:for-each select="child::mml:mglyph">
+         <xsl:call-template name="CreateMglyph">
+            <xsl:with-param name="ndCur" select="."/>
+         </xsl:call-template>
+      </xsl:for-each>
+  </xsl:template>
+  <xsl:template name="FGlyphIndexOk">
+      <xsl:param name="index"/>
+      <xsl:if test="$index != ''">
+         <xsl:choose>
+            <xsl:when test="string(number(string(floor($index)))) = 'NaN'"/>
+            <xsl:when test="number($index) &lt; 32 and not(number($index) = 9 or number($index) = 10 or number($index) = 13)"/>
+            <xsl:when test="number($index) = 65534 or number($index) = 65535"/>
+            <xsl:otherwise>1</xsl:otherwise>
+         </xsl:choose>
+      </xsl:if>
+  </xsl:template>
+  <xsl:template name="CreateMglyph">
+      <xsl:param name="ndCur"/>
+      <r>
+         <xsl:call-template name="CreateRunProp">
+            <xsl:with-param name="mathvariant">
+               <xsl:choose>
+                  <xsl:when test="(not(@mathvariant) or @mathvariant='')                              and (not(@mml:mathvariant) or @mml:mathvariant='')                             and (../@mathvariant!='' or ../@mml:mathvariant!='')">
+                     <xsl:choose>
+                        <xsl:when test="../@mathvariant">
+                           <xsl:value-of select="../@mathvariant"/>
+                        </xsl:when>
+                        <xsl:otherwise>
+                           <xsl:value-of select="../mml:mathvariant"/>
+                        </xsl:otherwise>
+                     </xsl:choose>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:choose>
+                        <xsl:when test="@mathvariant">
+                           <xsl:value-of select="@mathvariant"/>
+                        </xsl:when>
+                        <xsl:otherwise>
+                           <xsl:value-of select="@mml:mathvariant"/>
+                        </xsl:otherwise>
+                     </xsl:choose>
+                  </xsl:otherwise>
+               </xsl:choose>
+            </xsl:with-param>
+            <xsl:with-param name="fontstyle">
+               <xsl:choose>
+                  <xsl:when test="(not(@fontstyle) or @fontstyle='')                              and (not(@mml:fontstyle) or @mml:fontstyle='')                             and (../@fontstyle!='' or ../@mml:fontstyle!='')">
+                     <xsl:choose>
+                        <xsl:when test="../@fontstyle">
+                           <xsl:value-of select="../@fontstyle"/>
+                        </xsl:when>
+                        <xsl:otherwise>
+                           <xsl:value-of select="../@mml:fontstyle"/>
+                        </xsl:otherwise>
+                     </xsl:choose>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:choose>
+                        <xsl:when test="@fontstyle">
+                           <xsl:value-of select="@fontstyle"/>
+                        </xsl:when>
+                        <xsl:otherwise>
+                           <xsl:value-of select="@mml:fontstyle"/>
+                        </xsl:otherwise>
+                     </xsl:choose>
+                  </xsl:otherwise>
+               </xsl:choose>
+            </xsl:with-param>
+            <xsl:with-param name="fontweight">
+               <xsl:choose>
+                  <xsl:when test="(not(@fontweight) or @fontweight='')                              and (not(@mml:fontweight) or @mml:fontweight='')                             and (../@fontweight!='' or ../@mml:fontweight!='')">
+                     <xsl:choose>
+                        <xsl:when test="../@fontweight">
+                           <xsl:value-of select="../@fontweight"/>
+                        </xsl:when>
+                        <xsl:otherwise>
+                           <xsl:value-of select="../@mml:fontweight"/>
+                        </xsl:otherwise>
+                     </xsl:choose>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:choose>
+                        <xsl:when test="@fontweight">
+                           <xsl:value-of select="@fontweight"/>
+                        </xsl:when>
+                        <xsl:otherwise>
+                           <xsl:value-of select="@mml:fontweight"/>
+                        </xsl:otherwise>
+                     </xsl:choose>
+                  </xsl:otherwise>
+               </xsl:choose>
+            </xsl:with-param>
+            <xsl:with-param name="mathcolor">
+               <xsl:choose>
+                  <xsl:when test="(not(@mathcolor) or @mathcolor='')                              and (not(@mml:mathcolor) or @mml:mathcolor='')                             and (../@mathcolor!='' or ../@mml:mathcolor!='')">
+                     <xsl:choose>
+                        <xsl:when test="../@mathcolor">
+                           <xsl:value-of select="../@mathcolor"/>
+                        </xsl:when>
+                        <xsl:otherwise>
+                           <xsl:value-of select="../@mml:mathcolor"/>
+                        </xsl:otherwise>
+                     </xsl:choose>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:choose>
+                        <xsl:when test="@mathcolor">
+                           <xsl:value-of select="@mathcolor"/>
+                        </xsl:when>
+                        <xsl:otherwise>
+                           <xsl:value-of select="@mml:mathcolor"/>
+                        </xsl:otherwise>
+                     </xsl:choose>
+                  </xsl:otherwise>
+               </xsl:choose>
+            </xsl:with-param>
+            <xsl:with-param name="mathsize">
+               <xsl:choose>
+                  <xsl:when test="(not(@mathsize) or @mathsize='')                             and (not(@mml:mathsize) or @mml:mathsize='')                             and (../@mathsize!='' or ../@mml:mathsize!='')">
+                     <xsl:choose>
+                        <xsl:when test="../@mathsize">
+                           <xsl:value-of select="../@mathsize"/>
+                        </xsl:when>
+                        <xsl:otherwise>
+                           <xsl:value-of select="../@mathsize"/>
+                        </xsl:otherwise>
+                     </xsl:choose>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:choose>
+                        <xsl:when test="@mathsize">
+                           <xsl:value-of select="@mathsize"/>
+                        </xsl:when>
+                        <xsl:otherwise>
+                           <xsl:value-of select="@mml:mathsize"/>
+                        </xsl:otherwise>
+                     </xsl:choose>
+                  </xsl:otherwise>
+               </xsl:choose>
+            </xsl:with-param>
+            <xsl:with-param name="color">
+               <xsl:choose>
+                  <xsl:when test="(not(@color) or @color='')                              and (not(@mml:color) or @mml:color='')                             and (../@color!='' or ../@mml:color!='')">
+                     <xsl:choose>
+                        <xsl:when test="../@color">
+                           <xsl:value-of select="../@color"/>
+                        </xsl:when>
+                        <xsl:otherwise>
+                           <xsl:value-of select="../@mml:color"/>
+                        </xsl:otherwise>
+                     </xsl:choose>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:choose>
+                        <xsl:when test="@color">
+                           <xsl:value-of select="@color"/>
+                        </xsl:when>
+                        <xsl:otherwise>
+                           <xsl:value-of select="@mml:color"/>
+                        </xsl:otherwise>
+                     </xsl:choose>
+                  </xsl:otherwise>
+               </xsl:choose>
+            </xsl:with-param>
+            <xsl:with-param name="fontsize">
+               <xsl:choose>
+                  <xsl:when test="(not(@fontsize) or @fontsize='')                             and (not(@mml:fontsize) or @mml:fontsize='')                             and (../@fontsize!='' or ../@mml:fontsize!='')">
+                     <xsl:choose>
+                        <xsl:when test="../@fontsize">
+                           <xsl:value-of select="../@fontsize"/>
+                        </xsl:when>
+                        <xsl:otherwise>
+                           <xsl:value-of select="../@mml:fontsize"/>
+                        </xsl:otherwise>
+                     </xsl:choose>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:choose>
+                        <xsl:when test="@fontsize">
+                           <xsl:value-of select="@fontsize"/>
+                        </xsl:when>
+                        <xsl:otherwise>
+                           <xsl:value-of select="@mml:fontsize"/>
+                        </xsl:otherwise>
+                     </xsl:choose>
+                  </xsl:otherwise>
+               </xsl:choose>
+            </xsl:with-param>
+            <xsl:with-param name="ndCur" select="."/>
+            <xsl:with-param name="font-family">
+               <xsl:choose>
+                  <xsl:when test="@fontfamily">
+                     <xsl:value-of select="@fontfamily"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:value-of select="@mml:fontfamily"/>
+                  </xsl:otherwise>
+               </xsl:choose>
+            </xsl:with-param>
+            <xsl:with-param name="fNor">
+               <xsl:call-template name="FNor">
+                  <xsl:with-param name="ndCur" select="."/>
+               </xsl:call-template>
+            </xsl:with-param>
+            <xsl:with-param name="fLit">
+               <xsl:call-template name="FLit">
+                  <xsl:with-param name="ndCur" select="."/>
+               </xsl:call-template>
+            </xsl:with-param>
+         </xsl:call-template>
+         <xsl:variable name="shouldGlyphUseIndex">
+            <xsl:call-template name="FGlyphIndexOk">
+               <xsl:with-param name="index">
+                  <xsl:choose>
+                     <xsl:when test="@index">
+                        <xsl:value-of select="@index"/>
+                     </xsl:when>
+                     <xsl:otherwise>
+                        <xsl:value-of select="@mml:index"/>
+                     </xsl:otherwise>
+                  </xsl:choose>
+               </xsl:with-param>
+            </xsl:call-template>
+         </xsl:variable>
+         <xsl:choose>
+            <xsl:when test="not($shouldGlyphUseIndex = '1')">
+               <t>
+                  <xsl:choose>
+                     <xsl:when test="@alt">
+                        <xsl:value-of select="@alt"/>
+                     </xsl:when>
+                     <xsl:otherwise>
+                        <xsl:value-of select="@mml:alt"/>
+                     </xsl:otherwise>
+                  </xsl:choose>
+               </t>
+            </xsl:when>
+            <xsl:otherwise>
+               <xsl:variable name="nHexIndex">
+                  <xsl:call-template name="ConvertDecToHex">
+                     <xsl:with-param name="index">
+                        <xsl:choose>
+                           <xsl:when test="@index">
+                              <xsl:value-of select="@index"/>
+                           </xsl:when>
+                           <xsl:otherwise>
+                              <xsl:value-of select="@mml:index"/>
+                           </xsl:otherwise>
+                        </xsl:choose>
+                     </xsl:with-param>
+                  </xsl:call-template>
+               </xsl:variable>
+               <t>
+                  <xsl:text disable-output-escaping="yes">&amp;#x</xsl:text>
+                  <xsl:value-of select="$nHexIndex"/>
+                  <xsl:text>;</xsl:text>
+               </t>
+            </xsl:otherwise>
+         </xsl:choose>
+      </r>
+  </xsl:template>
+  <xsl:template name="ConvertDecToHex">
+      <xsl:param name="index"/>
+      <xsl:if test="$index &gt; 0">
+         <xsl:call-template name="ConvertDecToHex">
+            <xsl:with-param name="index" select="floor($index div 16)"/>
+         </xsl:call-template>
+         <xsl:choose>
+            <xsl:when test="$index mod 16 &lt; 10">
+               <xsl:value-of select="$index mod 16"/>
+            </xsl:when>
+            <xsl:otherwise>
+               <xsl:choose>
+                  <xsl:when test="$index mod 16 = 10">A</xsl:when>
+                  <xsl:when test="$index mod 16 = 11">B</xsl:when>
+                  <xsl:when test="$index mod 16 = 12">C</xsl:when>
+                  <xsl:when test="$index mod 16 = 13">D</xsl:when>
+                  <xsl:when test="$index mod 16 = 14">E</xsl:when>
+                  <xsl:when test="$index mod 16 = 15">F</xsl:when>
+                  <xsl:otherwise>A</xsl:otherwise>
+               </xsl:choose>
+            </xsl:otherwise>
+         </xsl:choose>
+      </xsl:if>
+  </xsl:template>
+
+  <xsl:template name="FStrContainsNonZeroDigit">
+      <xsl:param name="s"/>
+
+      <!-- Translate any nonzero digit into a 9 -->
+    <xsl:variable name="sNonZeroDigitsToNineDigit" select="translate($s, '12345678', '99999999')"/>
+      <xsl:choose>
+      <!-- Search for 9s -->
+      <xsl:when test="contains($sNonZeroDigitsToNineDigit, '9')">1</xsl:when>
+         <xsl:otherwise>0</xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="FStrContainsDigits">
+      <xsl:param name="s"/>
+
+      <!-- Translate any digit into a 0 -->
+    <xsl:variable name="sDigitsToZeroDigit" select="translate($s, '123456789', '000000000')"/>
+      <xsl:choose>
+      <!-- Search for 0s -->
+      <xsl:when test="contains($sDigitsToZeroDigit, '0')">1</xsl:when>
+         <xsl:otherwise>0</xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+
+  <!-- Used to determine if mpadded attribute {width, height, depth } 
+       indicates to show everything. 
+       
+       Unlike mathml, whose mpadded structure has great flexibility in modifying the 
+       bounding box's width, height, and depth, Word can only have zero or full width, height, and depth.
+       Thus, if the width, height, or depth attributes indicate any kind of nonzero width, height, 
+       or depth, we'll translate that into a show full width, height, or depth for OMML.  Only if the attribute
+       indicates a zero width, height, or depth, will we report back FFull as false.
+       
+       Example:  s=0%    ->  FFull returns 0.
+                 s=2%    ->  FFull returns 1.
+                 s=0.1em ->  FFull returns 1.     
+       
+       -->
+  <xsl:template name="FFull">
+      <xsl:param name="s"/>
+
+      <xsl:variable name="fStrContainsNonZeroDigit">
+         <xsl:call-template name="FStrContainsNonZeroDigit">
+            <xsl:with-param name="s" select="$s"/>
+         </xsl:call-template>
+      </xsl:variable>
+
+      <xsl:variable name="fStrContainsDigits">
+         <xsl:call-template name="FStrContainsDigits">
+            <xsl:with-param name="s" select="$s"/>
+         </xsl:call-template>
+      </xsl:variable>
+
+      <xsl:choose>
+      <!-- String contained non-zero digit -->
+      <xsl:when test="$fStrContainsNonZeroDigit=1">1</xsl:when>
+         <!-- String didn't contain a non-zero digit, but it did contain digits.
+           This must mean that all digits in the string were 0s. -->
+      <xsl:when test="$fStrContainsDigits=1">0</xsl:when>
+         <!-- Else, no digits, therefore, return true.
+           We return true in the otherwise condition to take account for the possibility
+           in MathML to say something like width="height". -->
+      <xsl:otherwise>1</xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+
+  <!-- Just outputs phant properties, doesn't do any fancy 
+       thinking of its own, just obeys the defaults of 
+       phants. -->
+  <xsl:template name="CreatePhantPropertiesCore">
+      <xsl:param name="fShow" select="1"/>
+      <xsl:param name="fFullWidth" select="1"/>
+      <xsl:param name="fFullHeight" select="1"/>
+      <xsl:param name="fFullDepth" select="1"/>
+
+      <xsl:if test="$fShow=0                      or $fFullWidth=0                      or $fFullHeight=0                     or $fFullDepth=0">
+         <phantPr>
+            <xsl:if test="$fShow=0">
+               <show>
+                  <xsl:attribute name="m:val">off</xsl:attribute>
+               </show>
+            </xsl:if>
+            <xsl:if test="$fFullWidth=0">
+               <zeroWid>
+                  <xsl:attribute name="m:val">on</xsl:attribute>
+               </zeroWid>
+            </xsl:if>
+            <xsl:if test="$fFullHeight=0">
+               <zeroAsc>
+                  <xsl:attribute name="m:val">on</xsl:attribute>
+               </zeroAsc>
+            </xsl:if>
+            <xsl:if test="$fFullDepth=0">
+               <zeroDesc>
+                  <xsl:attribute name="m:val">on</xsl:attribute>
+               </zeroDesc>
+            </xsl:if>
+         </phantPr>
+      </xsl:if>
+  </xsl:template>
+
+  <!-- Figures out if we should factor in width, height, and depth attributes.  
+  
+       If so, then it 
+       gets these attributes, does some processing to figure out what the attributes indicate, 
+       then passes these indications to CreatePhantPropertiesCore.  
+       
+       If we aren't supposed to factor in width, height, or depth, then we'll just output the show
+       attribute. -->
+  <xsl:template name="CreatePhantProperties">
+      <xsl:param name="ndCur" select="."/>
+      <xsl:param name="fShow" select="1"/>
+
+      <xsl:choose>
+      <!-- In the special case that we have an mphantom with one child which is an mpadded, then we should 
+           subsume the mpadded attributes into the mphantom attributes.  The test statement below imples the 
+           'one child which is an mpadded'.  The first part, that the parent of mpadded is an mphantom, is implied
+           by being in this template, which is only called when we've encountered an mphantom.
+           
+           Word outputs its invisible phantoms with smashing as 
+
+              <mml:mphantom>
+                <mml:mpadded . . . >
+                  
+                </mml:mpadded>
+              </mml:mphantom>
+
+            This test is used to allow roundtripping smashed invisible phantoms. -->
+      <xsl:when test="count($ndCur/child::*)=1 and count($ndCur/mml:mpadded)=1">
+            <xsl:variable name="sLowerCaseWidth">
+               <xsl:choose>
+                  <xsl:when test="$ndCur/mml:mpadded/@width">
+                     <xsl:value-of select="translate($ndCur/mml:mpadded/@width, $StrUCAlphabet, $StrLCAlphabet)"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:value-of select="translate($ndCur/mml:mpadded/@mml:width, $StrUCAlphabet, $StrLCAlphabet)"/>
+                  </xsl:otherwise>
+               </xsl:choose>
+            </xsl:variable>
+            <xsl:variable name="sLowerCaseHeight">
+               <xsl:choose>
+                  <xsl:when test="$ndCur/mml:mpadded/@height">
+                     <xsl:value-of select="translate($ndCur/mml:mpadded/@height, $StrUCAlphabet, $StrLCAlphabet)"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:value-of select="translate($ndCur/mml:mpadded/@mml:height, $StrUCAlphabet, $StrLCAlphabet)"/>
+                  </xsl:otherwise>
+               </xsl:choose>
+            </xsl:variable>
+            <xsl:variable name="sLowerCaseDepth">
+               <xsl:choose>
+                  <xsl:when test="$ndCur/mml:mpadded/@depth">
+                     <xsl:value-of select="translate($ndCur/mml:mpadded/@depth, $StrUCAlphabet, $StrLCAlphabet)"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:value-of select="translate($ndCur/mml:mpadded/@mml:depth, $StrUCAlphabet, $StrLCAlphabet)"/>
+                  </xsl:otherwise>
+               </xsl:choose>
+            </xsl:variable>
+
+            <xsl:variable name="fFullWidth">
+               <xsl:call-template name="FFull">
+                  <xsl:with-param name="s" select="$sLowerCaseWidth"/>
+               </xsl:call-template>
+            </xsl:variable>
+            <xsl:variable name="fFullHeight">
+               <xsl:call-template name="FFull">
+                  <xsl:with-param name="s" select="$sLowerCaseHeight"/>
+               </xsl:call-template>
+            </xsl:variable>
+            <xsl:variable name="fFullDepth">
+               <xsl:call-template name="FFull">
+                  <xsl:with-param name="s" select="$sLowerCaseDepth"/>
+               </xsl:call-template>
+            </xsl:variable>
+
+            <xsl:call-template name="CreatePhantPropertiesCore">
+               <xsl:with-param name="fShow" select="$fShow"/>
+               <xsl:with-param name="fFullWidth" select="$fFullWidth"/>
+               <xsl:with-param name="fFullHeight" select="$fFullHeight"/>
+               <xsl:with-param name="fFullDepth" select="$fFullDepth"/>
+            </xsl:call-template>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:call-template name="CreatePhantPropertiesCore">
+               <xsl:with-param name="fShow" select="$fShow"/>
+            </xsl:call-template>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+  <xsl:template mode="mml" match="mml:mpadded">
+      <xsl:choose>
+         <xsl:when test="count(parent::mml:mphantom)=1 and count(preceding-sibling::*)=0 and count(following-sibling::*)=0">
+        <!-- This mpadded is inside an mphantom that has already setup phantom attributes, therefore, just apply templates -->
+        <xsl:apply-templates mode="mml"/>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:variable name="sLowerCaseWidth">
+               <xsl:choose>
+                  <xsl:when test="@width">
+                     <xsl:value-of select="@width"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:value-of select="@mml:width"/>
+                  </xsl:otherwise>
+               </xsl:choose>
+            </xsl:variable>
+            <xsl:variable name="sLowerCaseHeight">
+               <xsl:choose>
+                  <xsl:when test="@height">
+                     <xsl:value-of select="@height"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:value-of select="@mml:height"/>
+                  </xsl:otherwise>
+               </xsl:choose>
+            </xsl:variable>
+            <xsl:variable name="sLowerCaseDepth">
+               <xsl:choose>
+                  <xsl:when test="@depth">
+                     <xsl:value-of select="@depth"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:value-of select="@mml:depth"/>
+                  </xsl:otherwise>
+               </xsl:choose>
+            </xsl:variable>
+
+            <xsl:variable name="fFullWidth">
+               <xsl:call-template name="FFull">
+                  <xsl:with-param name="s" select="$sLowerCaseWidth"/>
+               </xsl:call-template>
+            </xsl:variable>
+            <xsl:variable name="fFullHeight">
+               <xsl:call-template name="FFull">
+                  <xsl:with-param name="s" select="$sLowerCaseHeight"/>
+               </xsl:call-template>
+            </xsl:variable>
+            <xsl:variable name="fFullDepth">
+               <xsl:call-template name="FFull">
+                  <xsl:with-param name="s" select="$sLowerCaseDepth"/>
+               </xsl:call-template>
+            </xsl:variable>
+
+            <phant>
+               <xsl:call-template name="CreatePhantPropertiesCore">
+                  <xsl:with-param name="fShow" select="1"/>
+                  <xsl:with-param name="fFullWidth" select="$fFullWidth"/>
+                  <xsl:with-param name="fFullHeight" select="$fFullHeight"/>
+                  <xsl:with-param name="fFullDepth" select="$fFullDepth"/>
+               </xsl:call-template>
+               <e>
+                  <xsl:apply-templates mode="mml"/>
+               </e>
+            </phant>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+  <xsl:template mode="mml" match="mml:mphantom">
+      <phant>
+         <xsl:call-template name="CreatePhantProperties">
+            <xsl:with-param name="ndCur" select="."/>
+            <xsl:with-param name="fShow" select="0"/>
+         </xsl:call-template>
+         <e>
+            <xsl:apply-templates mode="mml"/>
+         </e>
+      </phant>
+  </xsl:template>
+
+  <xsl:template name="isNaryOper">
+      <xsl:param name="sNdCur"/>
+      <xsl:value-of select="($sNdCur = '∫' or $sNdCur = '∬' or $sNdCur = '∭' or $sNdCur = '∮' or $sNdCur = '∯' or $sNdCur = '∰' or $sNdCur = '∲' or $sNdCur = '∳' or $sNdCur = '∱' or $sNdCur = '∩' or $sNdCur = '∪' or $sNdCur = '∏' or $sNdCur = '∐' or $sNdCur = '∑')"/>
+  </xsl:template>
+
+
+  <xsl:template name="isNary">
+    <!-- ndCur is the element around the nAry operator -->
+    <xsl:param name="ndCur"/>
+      <xsl:variable name="sNdCur">
+         <xsl:value-of select="normalize-space($ndCur)"/>
+      </xsl:variable>
+
+      <xsl:variable name="fNaryOper">
+         <xsl:call-template name="isNaryOper">
+            <xsl:with-param name="sNdCur" select="$sNdCur"/>
+         </xsl:call-template>
+      </xsl:variable>
+
+      <!-- Narys shouldn't be MathML accents.  -->
+    <xsl:variable name="fUnder">
+         <xsl:choose>
+            <xsl:when test="$ndCur/parent::*[self::mml:munder]">1</xsl:when>
+            <xsl:otherwise>0</xsl:otherwise>
+         </xsl:choose>
+      </xsl:variable>
+
+      <xsl:variable name="sLowerCaseAccent">
+         <xsl:choose>
+            <xsl:when test="$fUnder=1">
+               <xsl:choose>
+                  <xsl:when test="$ndCur/parent::*[self::mml:munder]/@accentunder">
+                     <xsl:value-of select="translate($ndCur/parent::*[self::mml:munder]/@accentunder, $StrUCAlphabet, $StrLCAlphabet)"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:value-of select="translate($ndCur/parent::*[self::mml:munder]/@mml:accentunder, $StrUCAlphabet, $StrLCAlphabet)"/>
+                  </xsl:otherwise>
+               </xsl:choose>
+            </xsl:when>
+            <xsl:otherwise>
+               <xsl:choose>
+                  <xsl:when test="$ndCur/parent::*/@accent">
+                     <xsl:value-of select="translate($ndCur/parent::*/@accent, $StrUCAlphabet, $StrLCAlphabet)"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:value-of select="translate($ndCur/parent::*/@mml:accent, $StrUCAlphabet, $StrLCAlphabet)"/>
+                  </xsl:otherwise>
+               </xsl:choose>
+            </xsl:otherwise>
+         </xsl:choose>
+      </xsl:variable>
+
+      <xsl:variable name="fAccent">
+         <xsl:choose>
+            <xsl:when test="$sLowerCaseAccent='true'">1</xsl:when>
+            <xsl:otherwise>0</xsl:otherwise>
+         </xsl:choose>
+      </xsl:variable>
+
+      <xsl:choose>
+      <!-- This ndCur is in fact part of an nAry if
+      
+           1)  The last descendant of ndCur (which could be ndCur itself) is an operator.
+           2)  Along that chain of descendants we only encounter mml:mo, mml:mstyle, and mml:mrow elements.
+           3)  the operator in mml:mo is a valid nAry operator
+           4)  The nAry is not accented.
+           -->
+      <xsl:when test="$fNaryOper = 'true'                       and $fAccent=0                       and $ndCur/descendant-or-self::*[last()]/self::mml:mo                       and not($ndCur/descendant-or-self::*[not(self::mml:mo or                                                          self::mml:mstyle or                                                          self::mml:mrow)])">
+            <xsl:value-of select="true()"/>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:value-of select="false()"/>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="CreateNaryProp">
+      <xsl:param name="chr"/>
+      <xsl:param name="sMathmlType"/>
+      <naryPr>
+         <chr>
+            <xsl:attribute name="m:val">
+               <xsl:value-of select="$chr"/>
+            </xsl:attribute>
+         </chr>
+         <limLoc>
+            <xsl:attribute name="m:val">
+               <xsl:choose>
+                  <xsl:when test="$sMathmlType='munder' or           $sMathmlType='mover' or           $sMathmlType='munderover'">
+                     <xsl:text>undOvr</xsl:text>
+                  </xsl:when>
+                  <xsl:when test="$sMathmlType='msub' or                      $sMathmlType='msup' or                      $sMathmlType='msubsup'">
+                     <xsl:text>subSup</xsl:text>
+                  </xsl:when>
+               </xsl:choose>
+            </xsl:attribute>
+         </limLoc>
+         <grow>
+            <xsl:attribute name="m:val">
+               <xsl:value-of select="'on'"/>
+            </xsl:attribute>
+         </grow>
+         <subHide>
+            <xsl:attribute name="m:val">
+               <xsl:choose>
+                  <xsl:when test="$sMathmlType='mover' or                       $sMathmlType='msup'">
+                     <xsl:text>on</xsl:text>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:text>off</xsl:text>
+                  </xsl:otherwise>
+               </xsl:choose>
+            </xsl:attribute>
+         </subHide>
+         <supHide>
+            <xsl:attribute name="m:val">
+               <xsl:choose>
+                  <xsl:when test="$sMathmlType='munder' or                       $sMathmlType='msub'">
+                     <xsl:text>on</xsl:text>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:text>off</xsl:text>
+                  </xsl:otherwise>
+               </xsl:choose>
+            </xsl:attribute>
+         </supHide>
+      </naryPr>
+  </xsl:template>
+
+  <xsl:template name="mathrRpHook"/>
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/utils/maths/mml2omml.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/utils/maths/omml2mml.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/utils/maths/omml2mml.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/utils/maths/omml2mml.xsl	(revision 258)
@@ -0,0 +1,1819 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Beta Version 070708 -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+		xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
+		xmlns="http://www.w3.org/1998/Math/MathML"
+		xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"
+		version="2.0"
+                exclude-result-prefixes="m w">
+	<!-- %% Global Definitions -->
+
+	<!-- Every single unicode character that is recognized by OMML as an operator -->
+	<xsl:variable name="sOperators"
+                 select="concat(      '!&#34;#&amp;()+,-./:',           ';&lt;=&gt;?@[\]^_{',           '|}~¡¦¬¯°±²³·¹¿',           '×÷̀́̂̃̄̅̆̇̈̉',           '̊̋̌̍̎̏̐̑̒̓̔̕',           '̡̛̖̗̘̙̜̝̞̟̠̚',           '̢̧̨̣̤̥̦̩̪̫̬̭',           '̴̵̶̷̸̮̯̰̱̲̳̿',           '         ‐‒–',           '—‖†‡•․‥…′″‴‼',           '⁀⁄⁎⁏⁐⁗⁡⁢⁣⁰⁴⁵',           '⁶⁷⁸⁹⁺⁻⁼⁽⁾₀₁₂',           '₃₄₅₆₇₈₉₊₋₌₍₎',           '⃒⃓⃘⃙⃚⃐⃑⃔⃕⃖⃗⃛',           '⃜⃝⃞⃟⃠⃡⃤⃥⃦⃨⃧⃩',           '⃪⅀ࡢ←↑→↓↔↕↖↗↘↙',           '↚↛↜↝↞↟↠↡↢↣↤↥',           '↦↧↨↩↪↫↬↭↮↯↰↱',           '↲↳↶↷↺↻↼↽↾↿⇀⇁',           '⇂⇃⇄⇅⇆⇇⇈⇉⇊⇋⇌⇍',           '⇎⇏⇐⇑⇒⇓⇔⇕⇖⇗⇘⇙',           '⇚⇛⇜⇝⇞⇟⇠⇡⇢⇣⇤⇥',           '⇦⇧⇨⇩⇳⇴⇵⇶⇷⇸⇹⇺',           '⇻⇼⇽⇾⇿∀∁∂∃∄∆∇',           '∈∉∊∋∌∍∏∐∑−∓∔',           '∕∖∗∘∙√∛∜∝∣∤∥',           '∦∧∨∩∪∫∬∭∮∯∰∱',           '∲∳∴∵∶∷∸∹∺∻∼∽',           '∾≀≁≂≃≄≅≆≇≈≉≊',           '≋≌≍≎≏≐≑≒≓≔≕≖',           '≗≘≙≚≛≜≝≞≟≠≡≢',           '≣≤≥≦≧≨≩≪≫≬≭≮',           '≯≰≱≲≳≴≵≶≷≸≹≺',           '≻≼≽≾≿⊀⊁⊂⊃⊄⊅⊆',           '⊇⊈⊉⊊⊋⊌⊍⊎⊏⊐⊑⊒',           '⊓⊔⊕⊖⊗⊘⊙⊚⊛⊜⊝⊞',           '⊟⊠⊡⊢⊣⊥⊦⊧⊨⊩⊪⊫',           '⊬⊭⊮⊯⊰⊱⊲⊳⊴⊵⊶⊷',           '⊸⊹⊺⊻⊼⊽⋀⋁⋂⋃⋄⋅',           '⋆⋇⋈⋉⋊⋋⋌⋍⋎⋏⋐⋑',           '⋒⋓⋔⋕⋖⋗⋘⋙⋚⋛⋜⋝',           '⋞⋟⋠⋡⋢⋣⋤⋥⋦⋧⋨⋩',           '⋪⋫⋬⋭⋮⋯⋰⋱⋲⋳⋴⋵',           '⋶⋷⋸⋹⋺⋻⋼⋽⋾⋿⌅⌆',           '⌈⌉⌊⌋⌜⌝⌞⌟⌢⌣〈〉',           '⌽⌿⎰⎱⏜⏝⏞⏟⏠│├┤',           '┬┴▁█▒■□▭▲△▴▵',           '▶▷▸▹▼▽▾▿◀◁◂◃',           '◄◅◊○◦◫◬◸◹◺◻◼',           '◽◾◿★☆❲❳⟑⟒⟓⟔⟕',           '⟖⟗⟘⟙⟚⟛⟜⟝⟞⟟⟠⟡',           '⟢⟣⟤⟥⟦⟧⟨⟩⟪⟫⟰⟱',           '⟲⟳⟴⟵⟶⟷⟸⟹⟺⟻⟼⟽',           '⟾⟿⤀⤁⤂⤃⤄⤅⤆⤇⤈⤉',           '⤊⤋⤌⤍⤎⤏⤐⤑⤒⤓⤔⤕',           '⤖⤗⤘⤙⤚⤛⤜⤝⤞⤟⤠⤡',           '⤢⤣⤤⤥⤦⤧⤨⤩⤪⤫⤬⤭',           '⤮⤯⤰⤱⤲⤳⤴⤵⤶⤷⤸⤹',           '⤺⤻⤼⤽⤾⤿⥀⥁⥂⥃⥄⥅',           '⥆⥇⥈⥉⥊⥋⥌⥍⥎⥏⥐⥑',           '⥒⥓⥔⥕⥖⥗⥘⥙⥚⥛⥜⥝',           '⥞⥟⥠⥡⥢⥣⥤⥥⥦⥧⥨⥩',           '⥪⥫⥬⥭⥮⥯⥰⥱⥲⥳⥴⥵',           '⥶⥷⥸⥹⥺⥻⥼⥽⥾⥿⦀⦂',           '⦃⦄⦅⦆⦇⦈⦉⦊⦋⦌⦍⦎',           '⦏⦐⦑⦒⦓⦔⦕⦖⦗⦘⦙⦚',           '⦶⦷⦸⦹⧀⧁⧄⧅⧆⧇⧈⧎',           '⧏⧐⧑⧒⧓⧔⧕⧖⧗⧘⧙⧚',           '⧛⧟⧡⧢⧣⧤⧥⧦⧫⧴⧵⧶',           '⧷⧸⧹⧺⧻⧼⧽⧾⧿⨀⨁⨂',           '⨃⨄⨅⨆⨇⨈⨉⨊⨋⨌⨍⨎',           '⨏⨐⨑⨒⨓⨔⨕⨖⨗⨘⨙⨚',           '⨛⨜⨝⨞⨟⨠⨡⨢⨣⨤⨥⨦',           '⨧⨨⨩⨪⨫⨬⨭⨮⨯⨰⨱⨲',           '⨳⨴⨵⨶⨷⨸⨹⨺⨻⨼⨽⨾',           '⨿⩀⩁⩂⩃⩄⩅⩆⩇⩈⩉⩊',           '⩋⩌⩍⩎⩏⩐⩑⩒⩓⩔⩕⩖',           '⩗⩘⩙⩚⩛⩜⩝⩞⩟⩠⩡⩢',           '⩣⩤⩥⩦⩧⩨⩩⩪⩫⩬⩭⩮',           '⩯⩰⩱⩲⩳⩴⩵⩶⩷⩸⩹⩺',           '⩻⩼⩽⩾⩿⪀⪁⪂⪃⪄⪅⪆',           '⪇⪈⪉⪊⪋⪌⪍⪎⪏⪐⪑⪒',           '⪓⪔⪕⪖⪗⪘⪙⪚⪛⪜⪝⪞',           '⪟⪠⪡⪢⪣⪤⪥⪦⪧⪨⪩⪪',           '⪫⪬⪭⪮⪯⪰⪱⪲⪳⪴⪵⪶',           '⪷⪸⪹⪺⪻⪼⪽⪾⪿⫀⫁⫂',           '⫃⫄⫅⫆⫇⫈⫉⫊⫋⫌⫍⫎',           '⫏⫐⫑⫒⫓⫔⫕⫖⫗⫘⫙⫚',           '⫛⫝̸⫝⫞⫟⫠⫢⫣⫤⫥⫦⫧',           '⫨⫩⫪⫫⫬⫭⫮⫯⫰⫲⫳⫴',           '⫵⫶⫷⫸⫹⫺⫻⫼⫽⫾⫿⬄',           '⬆⬇⬌⬍〔〕〖〗〘〙！＆',           '（）＋，－．／：；＜＝＞',           '？＠［＼］＾＿｛｜｝')"/>
+
+	  <!-- A string of '-'s repeated exactly as many times as the operators above -->
+	<xsl:variable name="sMinuses">
+		    <xsl:call-template name="SRepeatChar">
+			      <xsl:with-param name="cchRequired" select="string-length($sOperators)"/>
+			      <xsl:with-param name="ch" select="'-'"/>
+		    </xsl:call-template>
+	  </xsl:variable>
+
+	  <!-- Every single unicode character that is recognized by OMML as a number -->
+	<xsl:variable name="sNumbers" select="'0123456789'"/>
+
+	  <!-- A string of '0's repeated exactly as many times as the list of numbers above -->
+	<xsl:variable name="sZeros">
+		    <xsl:call-template name="SRepeatChar">
+			      <xsl:with-param name="cchRequired" select="string-length($sNumbers)"/>
+			      <xsl:with-param name="ch" select="'0'"/>
+		    </xsl:call-template>
+	  </xsl:variable>
+
+	  <!-- %%Template: SReplace
+
+		Replace all occurences of sOrig in sInput with sReplacement
+		and return the resulting string. -->
+	<xsl:template name="SReplace">
+		    <xsl:param name="sInput"/>
+		    <xsl:param name="sOrig"/>
+		    <xsl:param name="sReplacement"/>
+
+		    <xsl:choose>
+			      <xsl:when test="not(contains($sInput, $sOrig))">
+				        <xsl:value-of select="$sInput"/>
+			      </xsl:when>
+			      <xsl:otherwise>
+				        <xsl:variable name="sBefore" select="substring-before($sInput, $sOrig)"/>
+				        <xsl:variable name="sAfter" select="substring-after($sInput, $sOrig)"/>
+				        <xsl:variable name="sAfterProcessed">
+					          <xsl:call-template name="SReplace">
+						            <xsl:with-param name="sInput" select="$sAfter"/>
+						            <xsl:with-param name="sOrig" select="$sOrig"/>
+						            <xsl:with-param name="sReplacement" select="$sReplacement"/>
+					          </xsl:call-template>
+				        </xsl:variable>
+
+				        <xsl:value-of select="concat($sBefore, concat($sReplacement, $sAfterProcessed))"/>
+			      </xsl:otherwise>
+		    </xsl:choose>
+	  </xsl:template>
+
+	  <!-- Templates -->
+	<!--
+	    <xsl:template match="/">
+	    <math>
+	    <xsl:apply-templates select="*" />
+	    </math>
+	</xsl:template>
+	-->
+	<xsl:template match="m:borderBox">
+
+		<!-- Get Lowercase versions of properties -->
+		<xsl:variable name="sLowerCaseHideTop"
+                    select="translate(m:borderBoxPr[last()]/m:hideTop[last()]/@m:val, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',                                                                 'abcdefghijklmnopqrstuvwxyz')"/>
+		    <xsl:variable name="sLowerCaseHideBot"
+                    select="translate(m:borderBoxPr[last()]/m:hideBot[last()]/@m:val, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',                                                                 'abcdefghijklmnopqrstuvwxyz')"/>
+		    <xsl:variable name="sLowerCaseHideLeft"
+                    select="translate(m:borderBoxPr[last()]/m:hideLeft[last()]/@m:val, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',                                                                 'abcdefghijklmnopqrstuvwxyz')"/>
+		    <xsl:variable name="sLowerCaseHideRight"
+                    select="translate(m:borderBoxPr[last()]/m:hideRight[last()]/@m:val, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',                                                                 'abcdefghijklmnopqrstuvwxyz')"/>
+		    <xsl:variable name="sLowerCaseStrikeH"
+                    select="translate(m:borderBoxPr[last()]/m:strikeH[last()]/@m:val, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',                                                                 'abcdefghijklmnopqrstuvwxyz')"/>
+		    <xsl:variable name="sLowerCaseStrikeV"
+                    select="translate(m:borderBoxPr[last()]/m:strikeV[last()]/@m:val, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',                                                                 'abcdefghijklmnopqrstuvwxyz')"/>
+		    <xsl:variable name="sLowerCaseStrikeBLTR"
+                    select="translate(m:borderBoxPr[last()]/m:strikeBLTR[last()]/@m:val, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',                                                                 'abcdefghijklmnopqrstuvwxyz')"/>
+		    <xsl:variable name="sLowerCaseStrikeTLBR"
+                    select="translate(m:borderBoxPr[last()]/m:strikeTLBR[last()]/@m:val, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',                                                                 'abcdefghijklmnopqrstuvwxyz')"/>
+		    <xsl:variable name="fHideTop">
+			      <xsl:choose>
+				        <xsl:when test="$sLowerCaseHideTop='on'">
+					          <xsl:text>1</xsl:text>
+				        </xsl:when>
+				        <xsl:otherwise>
+					          <xsl:text>0</xsl:text>
+				        </xsl:otherwise>
+			      </xsl:choose>
+		    </xsl:variable>
+		    <xsl:variable name="fHideBot">
+			      <xsl:choose>
+				        <xsl:when test="$sLowerCaseHideBot='on'">
+					          <xsl:text>1</xsl:text>
+				        </xsl:when>
+				        <xsl:otherwise>
+					          <xsl:text>0</xsl:text>
+				        </xsl:otherwise>
+			      </xsl:choose>
+		    </xsl:variable>
+		    <xsl:variable name="fHideLeft">
+			      <xsl:choose>
+				        <xsl:when test="$sLowerCaseHideLeft='on'">
+					          <xsl:text>1</xsl:text>
+				        </xsl:when>
+				        <xsl:otherwise>
+					          <xsl:text>0</xsl:text>
+				        </xsl:otherwise>
+			      </xsl:choose>
+		    </xsl:variable>
+		    <xsl:variable name="fHideRight">
+			      <xsl:choose>
+				        <xsl:when test="$sLowerCaseHideRight='on'">
+					          <xsl:text>1</xsl:text>
+				        </xsl:when>
+				        <xsl:otherwise>
+					          <xsl:text>0</xsl:text>
+				        </xsl:otherwise>
+			      </xsl:choose>
+		    </xsl:variable>
+		    <xsl:variable name="fStrikeH">
+			      <xsl:choose>
+				        <xsl:when test="$sLowerCaseStrikeH='on'">
+					          <xsl:text>1</xsl:text>
+				        </xsl:when>
+				        <xsl:otherwise>
+					          <xsl:text>0</xsl:text>
+				        </xsl:otherwise>
+			      </xsl:choose>
+		    </xsl:variable>
+		    <xsl:variable name="fStrikeV">
+			      <xsl:choose>
+				        <xsl:when test="$sLowerCaseStrikeV='on'">
+					          <xsl:text>1</xsl:text>
+				        </xsl:when>
+				        <xsl:otherwise>
+					          <xsl:text>0</xsl:text>
+				        </xsl:otherwise>
+			      </xsl:choose>
+		    </xsl:variable>
+		    <xsl:variable name="fStrikeBLTR">
+			      <xsl:choose>
+				        <xsl:when test="$sLowerCaseStrikeBLTR='on'">
+					          <xsl:text>1</xsl:text>
+				        </xsl:when>
+				        <xsl:otherwise>
+					          <xsl:text>0</xsl:text>
+				        </xsl:otherwise>
+			      </xsl:choose>
+		    </xsl:variable>
+		    <xsl:variable name="fStrikeTLBR">
+			      <xsl:choose>
+				        <xsl:when test="$sLowerCaseStrikeTLBR='on'">
+					          <xsl:text>1</xsl:text>
+				        </xsl:when>
+				        <xsl:otherwise>
+					          <xsl:text>0</xsl:text>
+				        </xsl:otherwise>
+			      </xsl:choose>
+		    </xsl:variable>
+
+		    <menclose>
+			      <xsl:call-template name="CreateMencloseNotationAttrFromBorderBoxAttr">
+				        <xsl:with-param name="fHideTop" select="$fHideTop"/>
+				        <xsl:with-param name="fHideBot" select="$fHideBot"/>
+				        <xsl:with-param name="fHideLeft" select="$fHideLeft"/>
+				        <xsl:with-param name="fHideRight" select="$fHideRight"/>
+				        <xsl:with-param name="fStrikeH" select="$fStrikeH"/>
+				        <xsl:with-param name="fStrikeV" select="$fStrikeV"/>
+				        <xsl:with-param name="fStrikeBLTR" select="$fStrikeBLTR"/>
+				        <xsl:with-param name="fStrikeTLBR" select="$fStrikeTLBR"/>
+			      </xsl:call-template>
+			      <xsl:apply-templates select="m:e[1]"/>
+		    </menclose>
+	  </xsl:template>
+
+	  <xsl:template match="*">
+		    <xsl:apply-templates select="*"/>
+	  </xsl:template>
+
+	  <xsl:template match="m:acc">
+		    <mover>
+			      <xsl:attribute name="accent">true</xsl:attribute>
+			      <mrow>
+				        <xsl:apply-templates select="m:e[1]"/>
+			      </mrow>
+			      <xsl:variable name="chAcc">
+				        <xsl:choose>
+					          <xsl:when test="not(m:accPr[last()]/m:chr)">
+						            <xsl:value-of select="'̂'"/>
+					          </xsl:when>
+					          <xsl:otherwise>
+						            <xsl:value-of select="substring(m:accPr/m:chr/@m:val,1,1)"/>
+					          </xsl:otherwise>
+				        </xsl:choose>
+			      </xsl:variable>
+			      <xsl:call-template name="ParseMt">
+				        <xsl:with-param name="sToParse" select="$chAcc"/>
+				        <xsl:with-param name="scr" select="m:e[1]/*/m:rPr[last()]/m:scr/@m:val"/>
+				        <xsl:with-param name="sty" select="m:e[1]/*/m:rPr[last()]/m:sty/@m:val"/>
+				        <xsl:with-param name="nor" select="m:e[1]/*/m:rPr[last()]/m:nor/@m:val"/>
+			      </xsl:call-template>
+		    </mover>
+	  </xsl:template>
+
+	  <xsl:template match="m:sPre">
+		    <mmultiscripts>
+			      <mrow>
+				        <xsl:apply-templates select="m:e[1]"/>
+			      </mrow>
+			      <mprescripts/>
+			      <mrow>
+				        <xsl:apply-templates select="m:sub[1]"/>
+			      </mrow>
+			      <mrow>
+				        <xsl:apply-templates select="m:sup[1]"/>
+			      </mrow>
+		    </mmultiscripts>
+	  </xsl:template>
+
+	  <xsl:template match="m:m">
+		    <mtable>
+			      <xsl:call-template name="CreateMathMLMatrixAttr">
+				        <xsl:with-param name="mcJc" select="m:mPr[last()]/m:mcs/m:mc/m:mcPr[last()]/m:mcJc/@m:val"/>
+			      </xsl:call-template>
+			      <xsl:for-each select="m:mr">
+				        <mtr>
+					          <xsl:for-each select="m:e">
+						            <mtd>
+							              <xsl:apply-templates select="."/>
+						            </mtd>
+					          </xsl:for-each>
+				        </mtr>
+			      </xsl:for-each>
+		    </mtable>
+	  </xsl:template>
+
+	  <xsl:template name="CreateMathMLMatrixAttr">
+		    <xsl:param name="mcJc"/>
+		    <xsl:variable name="sLowerCaseMcjc"
+                    select="translate($mcJc, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',                                                                 'abcdefghijklmnopqrstuvwxyz')"/>
+		    <xsl:choose>
+			      <xsl:when test="$sLowerCaseMcjc='left'">
+				        <xsl:attribute name="columnalign">left</xsl:attribute>
+			      </xsl:when>
+			      <xsl:when test="$sLowerCaseMcjc='right'">
+				        <xsl:attribute name="columnalign">right</xsl:attribute>
+			      </xsl:when>
+		    </xsl:choose>
+	  </xsl:template>
+
+	  <xsl:template match="m:phant">
+		    <xsl:variable name="sLowerCaseZeroWidVal"
+                    select="translate(m:phantPr[last()]/m:zeroWid[last()]/@m:val,                                                           'ABCDEFGHIJKLMNOPQRSTUVWXYZ',                                                           'abcdefghijklmnopqrstuvwxyz')"/>
+		    <xsl:variable name="sLowerCaseZeroAscVal"
+                    select="translate(m:phantPr[last()]/m:zeroAsc[last()]/@m:val,                                                         'ABCDEFGHIJKLMNOPQRSTUVWXYZ',                                                         'abcdefghijklmnopqrstuvwxyz')"/>
+		    <xsl:variable name="sLowerCaseZeroDescVal"
+                    select="translate(m:phantPr[last()]/m:zeroDesc[last()]/@m:val,                                                         'ABCDEFGHIJKLMNOPQRSTUVWXYZ',                                                         'abcdefghijklmnopqrstuvwxyz')"/>
+		    <xsl:variable name="sLowerCaseShowVal"
+                    select="translate(m:phantPr[last()]/m:show[last()]/@m:val,                                                         'ABCDEFGHIJKLMNOPQRSTUVWXYZ',                                                         'abcdefghijklmnopqrstuvwxyz')"/>
+
+
+		    <!-- The following properties default to 'yes' unless the last value equals 'no' or there isn't any node for 
+         the property -->
+
+		<xsl:variable name="fZeroWid">
+			      <xsl:choose>
+				        <xsl:when test="count(m:phantPr[last()]/m:zeroWid[last()]) = 0">0</xsl:when>
+				        <xsl:when test="$sLowerCaseZeroWidVal = 'off'">0</xsl:when>
+				        <xsl:otherwise>1</xsl:otherwise>
+			      </xsl:choose>
+		    </xsl:variable>
+		    <xsl:variable name="fZeroAsc">
+			      <xsl:choose>
+				        <xsl:when test="count(m:phantPr[last()]/m:zeroAsc[last()]) = 0">0</xsl:when>
+				        <xsl:when test="$sLowerCaseZeroAscVal = 'off'">0</xsl:when>
+				        <xsl:otherwise>1</xsl:otherwise>
+			      </xsl:choose>
+		    </xsl:variable>
+		    <xsl:variable name="fZeroDesc">
+			      <xsl:choose>
+				        <xsl:when test="count(m:phantPr[last()]/m:zeroDesc[last()]) = 0">0</xsl:when>
+				        <xsl:when test="$sLowerCaseZeroDescVal = 'off'">0</xsl:when>
+				        <xsl:otherwise>1</xsl:otherwise>
+			      </xsl:choose>
+		    </xsl:variable>
+
+		    <!-- The show property defaults to 'on' unless there exists a show property and its value is 'off' -->
+
+		<xsl:variable name="fShow">
+			      <xsl:choose>
+				        <xsl:when test="$sLowerCaseShowVal = 'off'">0</xsl:when>
+				        <xsl:otherwise>1</xsl:otherwise>
+			      </xsl:choose>
+		    </xsl:variable>
+
+		    <xsl:choose>
+			<!-- Show the phantom contents, therefore, just use mpadded. -->
+			<xsl:when test="$fShow = 1">
+				        <xsl:element name="mpadded">
+					          <xsl:call-template name="CreateMpaddedAttributes">
+						            <xsl:with-param name="fZeroWid" select="$fZeroWid"/>
+						            <xsl:with-param name="fZeroAsc" select="$fZeroAsc"/>
+						            <xsl:with-param name="fZeroDesc" select="$fZeroDesc"/>
+					          </xsl:call-template>
+					          <mrow>
+						            <xsl:apply-templates select="m:e"/>
+					          </mrow>
+				        </xsl:element>
+			      </xsl:when>
+			      <!-- Don't show phantom contents, but don't smash anything, therefore, just 
+           use mphantom -->
+			<xsl:when test="$fZeroWid=0 and $fZeroAsc=0 and $fZeroDesc=0">
+				        <xsl:element name="mphantom">
+					          <mrow>
+						            <xsl:apply-templates select="m:e"/>
+					          </mrow>
+				        </xsl:element>
+			      </xsl:when>
+			      <!-- Combination -->
+			<xsl:otherwise>
+				        <xsl:element name="mphantom">
+					          <xsl:element name="mpadded">
+						            <xsl:call-template name="CreateMpaddedAttributes">
+							              <xsl:with-param name="fZeroWid" select="$fZeroWid"/>
+							              <xsl:with-param name="fZeroAsc" select="$fZeroAsc"/>
+							              <xsl:with-param name="fZeroDesc" select="$fZeroDesc"/>
+						            </xsl:call-template>
+						            <mrow>
+							              <xsl:apply-templates select="m:e"/>
+						            </mrow>
+					          </xsl:element>
+				        </xsl:element>
+			      </xsl:otherwise>
+		    </xsl:choose>
+	  </xsl:template>
+
+	  <xsl:template name="CreateMpaddedAttributes">
+		    <xsl:param name="fZeroWid"/>
+		    <xsl:param name="fZeroAsc"/>
+		    <xsl:param name="fZeroDesc"/>
+
+		    <xsl:if test="$fZeroWid=1">
+			      <xsl:attribute name="width">0</xsl:attribute>
+		    </xsl:if>
+		    <xsl:if test="$fZeroAsc=1">
+			      <xsl:attribute name="height">0</xsl:attribute>
+		    </xsl:if>
+		    <xsl:if test="$fZeroDesc=1">
+			      <xsl:attribute name="depth">0</xsl:attribute>
+		    </xsl:if>
+	  </xsl:template>
+
+
+
+	  <xsl:template match="m:rad">
+		    <xsl:variable name="sLowerCaseDegHide"
+                    select="translate(m:radPr[last()]/m:degHide/@m:val,                                                              'ABCDEFGHIJKLMNOPQRSTUVWXYZ',                                                              'abcdefghijklmnopqrstuvwxyz')"/>
+		    <xsl:choose>
+			      <xsl:when test="$sLowerCaseDegHide='on'">
+				        <msqrt>
+					          <xsl:apply-templates select="m:e[1]"/>
+				        </msqrt>
+			      </xsl:when>
+			      <xsl:otherwise>
+				        <mroot>
+					          <mrow>
+						            <xsl:apply-templates select="m:e[1]"/>
+					          </mrow>
+					          <mrow>
+						            <xsl:apply-templates select="m:deg[1]"/>
+					          </mrow>
+				        </mroot>
+			      </xsl:otherwise>
+		    </xsl:choose>
+	  </xsl:template>
+
+	  <!-- %%Template match m:nary 
+		Process an n-ary. 
+		
+		Decides, based on which arguments are supplied, between
+		using an mo, msup, msub, or msubsup for the n-ary operator		
+	-->
+	<xsl:template match="m:nary">
+		    <xsl:variable name="sLowerCaseSubHide">
+			      <xsl:choose>
+				        <xsl:when test="count(m:naryPr[last()]/m:subHide) = 0">
+					          <xsl:text>off</xsl:text>
+				        </xsl:when>
+				        <xsl:otherwise>
+					          <xsl:value-of select="translate(m:naryPr[last()]/m:subHide/@m:val,                                     'ABCDEFGHIJKLMNOPQRSTUVWXYZ',                                     'abcdefghijklmnopqrstuvwxyz')"/>
+				        </xsl:otherwise>
+			      </xsl:choose>
+		    </xsl:variable>
+		    <xsl:variable name="sLowerCaseSupHide">
+			      <xsl:choose>
+				        <xsl:when test="count(m:naryPr[last()]/m:supHide) = 0">
+					          <xsl:text>off</xsl:text>
+				        </xsl:when>
+				        <xsl:otherwise>
+					          <xsl:value-of select="translate(m:naryPr[last()]/m:supHide/@m:val,                                     'ABCDEFGHIJKLMNOPQRSTUVWXYZ',                                     'abcdefghijklmnopqrstuvwxyz')"/>
+				        </xsl:otherwise>
+			      </xsl:choose>
+		    </xsl:variable>
+		    <xsl:variable name="sLowerCaseLimLoc">
+			      <xsl:value-of select="translate(m:naryPr[last()]/m:limLoc/@m:val,                                     'ABCDEFGHIJKLMNOPQRSTUVWXYZ',                                     'abcdefghijklmnopqrstuvwxyz')"/>
+		    </xsl:variable>
+		    <xsl:variable name="fLimLocSubSup">
+			      <xsl:choose>
+				        <xsl:when test="count(m:naryPr[last()]/m:limLoc)=0 or $sLowerCaseLimLoc='subsup'">1</xsl:when>
+				        <xsl:otherwise>0</xsl:otherwise>
+			      </xsl:choose>
+		    </xsl:variable>
+		    <xsl:choose>
+			      <xsl:when test="not($sLowerCaseSupHide='off') and                     not($sLowerCaseSubHide='off')">
+				        <mo>
+					          <xsl:choose>
+						            <xsl:when test="not(m:naryPr[last()]/m:chr/@m:val) or                                m:naryPr[last()]/m:chr/@m:val=''">
+							              <xsl:text>&#x222b;</xsl:text>
+						            </xsl:when>
+						            <xsl:otherwise>
+							              <xsl:value-of select="m:naryPr[last()]/m:chr/@m:val"/>
+						            </xsl:otherwise>
+					          </xsl:choose>
+				        </mo>
+			      </xsl:when>
+			      <xsl:when test="not($sLowerCaseSubHide='off')">
+				        <xsl:choose>
+					          <xsl:when test="$fLimLocSubSup=1">
+						            <msup>
+							              <mo>
+								                <xsl:choose>
+									                  <xsl:when test="not(m:naryPr[last()]/m:chr/@m:val) or                                            m:naryPr[last()]/m:chr/@m:val=''">
+										                    <xsl:text>&#x222b;</xsl:text>
+									                  </xsl:when>
+									                  <xsl:otherwise>
+										                    <xsl:value-of select="m:naryPr[last()]/m:chr/@m:val"/>
+									                  </xsl:otherwise>
+								                </xsl:choose>
+							              </mo>
+							              <mrow>
+								                <xsl:apply-templates select="m:sup[1]"/>
+							              </mrow>
+						            </msup>
+					          </xsl:when>
+					          <xsl:otherwise>
+						            <mover>
+							              <mo>
+								                <xsl:choose>
+									                  <xsl:when test="not(m:naryPr[last()]/m:chr/@m:val) or                                            m:naryPr[last()]/m:chr/@m:val=''">
+										                    <xsl:text>&#x222b;</xsl:text>
+									                  </xsl:when>
+									                  <xsl:otherwise>
+										                    <xsl:value-of select="m:naryPr[last()]/m:chr/@m:val"/>
+									                  </xsl:otherwise>
+								                </xsl:choose>
+							              </mo>
+							              <mrow>
+								                <xsl:apply-templates select="m:sup[1]"/>
+							              </mrow>
+						            </mover>
+					          </xsl:otherwise>
+				        </xsl:choose>
+			      </xsl:when>
+			      <xsl:when test="not($sLowerCaseSupHide='off')">
+				        <xsl:choose>
+					          <xsl:when test="$fLimLocSubSup=1">
+						            <msub>
+							              <mo>
+								                <xsl:choose>
+									                  <xsl:when test="not(m:naryPr[last()]/m:chr/@m:val) or                                            m:naryPr[last()]/m:chr/@m:val=''">
+										                    <xsl:text>&#x222b;</xsl:text>
+									                  </xsl:when>
+									                  <xsl:otherwise>
+										                    <xsl:value-of select="m:naryPr[last()]/m:chr/@m:val"/>
+									                  </xsl:otherwise>
+								                </xsl:choose>
+							              </mo>
+							              <mrow>
+								                <xsl:apply-templates select="m:sub[1]"/>
+							              </mrow>
+						            </msub>
+					          </xsl:when>
+					          <xsl:otherwise>
+						            <munder>
+							              <mo>
+								                <xsl:choose>
+									                  <xsl:when test="not(m:naryPr[last()]/m:chr/@m:val) or                            m:naryPr[last()]/m:chr/@m:val=''">
+										                    <xsl:text>&#x222b;</xsl:text>
+									                  </xsl:when>
+									                  <xsl:otherwise>
+										                    <xsl:value-of select="m:naryPr[last()]/m:chr/@m:val"/>
+									                  </xsl:otherwise>
+								                </xsl:choose>
+							              </mo>
+							              <mrow>
+								                <xsl:apply-templates select="m:sub[1]"/>
+							              </mrow>
+						            </munder>
+					          </xsl:otherwise>
+				        </xsl:choose>
+			      </xsl:when>
+			      <xsl:otherwise>
+				        <xsl:choose>
+					          <xsl:when test="$fLimLocSubSup=1">
+						            <msubsup>
+							              <mo>
+								                <xsl:choose>
+									                  <xsl:when test="not(m:naryPr[last()]/m:chr/@m:val) or                                            m:naryPr[last()]/m:chr/@m:val=''">
+										                    <xsl:text>&#x222b;</xsl:text>
+									                  </xsl:when>
+									                  <xsl:otherwise>
+										                    <xsl:value-of select="m:naryPr[last()]/m:chr/@m:val"/>
+									                  </xsl:otherwise>
+								                </xsl:choose>
+							              </mo>
+							              <mrow>
+								                <xsl:apply-templates select="m:sub[1]"/>
+							              </mrow>
+							              <mrow>
+								                <xsl:apply-templates select="m:sup[1]"/>
+							              </mrow>
+						            </msubsup>
+					          </xsl:when>
+					          <xsl:otherwise>
+						            <munderover>
+							              <mo>
+								                <xsl:choose>
+									                  <xsl:when test="not(m:naryPr[last()]/m:chr/@m:val) or                                            m:naryPr[last()]/m:chr/@m:val=''">
+										                    <xsl:text>&#x222b;</xsl:text>
+									                  </xsl:when>
+									                  <xsl:otherwise>
+										                    <xsl:value-of select="m:naryPr[last()]/m:chr/@m:val"/>
+									                  </xsl:otherwise>
+								                </xsl:choose>
+							              </mo>
+							              <mrow>
+								                <xsl:apply-templates select="m:sub[1]"/>
+							              </mrow>
+							              <mrow>
+								                <xsl:apply-templates select="m:sup[1]"/>
+							              </mrow>
+						            </munderover>
+					          </xsl:otherwise>
+				        </xsl:choose>
+			      </xsl:otherwise>
+		    </xsl:choose>
+		    <mrow>
+			      <xsl:apply-templates select="m:e[1]"/>
+		    </mrow>
+	  </xsl:template>
+
+	  <xsl:template match="m:limLow">
+		    <munder>
+			      <mrow>
+				        <xsl:apply-templates select="m:e[1]"/>
+			      </mrow>
+			      <mrow>
+				        <xsl:apply-templates select="m:lim[1]"/>
+			      </mrow>
+		    </munder>
+	  </xsl:template>
+
+	  <xsl:template match="m:limUpp">
+		    <mover>
+			      <mrow>
+				        <xsl:apply-templates select="m:e[1]"/>
+			      </mrow>
+			      <mrow>
+				        <xsl:apply-templates select="m:lim[1]"/>
+			      </mrow>
+		    </mover>
+	  </xsl:template>
+
+	  <xsl:template match="m:sSub">
+		    <msub>
+			      <mrow>
+				        <xsl:apply-templates select="m:e[1]"/>
+			      </mrow>
+			      <mrow>
+				        <xsl:apply-templates select="m:sub[1]"/>
+			      </mrow>
+		    </msub>
+	  </xsl:template>
+
+	  <xsl:template match="m:sSup">
+		    <msup>
+			      <mrow>
+				        <xsl:apply-templates select="m:e[1]"/>
+			      </mrow>
+			      <mrow>
+				        <xsl:apply-templates select="m:sup[1]"/>
+			      </mrow>
+		    </msup>
+	  </xsl:template>
+
+	  <xsl:template match="m:sSubSup">
+		    <msubsup>
+			      <mrow>
+				        <xsl:apply-templates select="m:e[1]"/>
+			      </mrow>
+			      <mrow>
+				        <xsl:apply-templates select="m:sub[1]"/>
+			      </mrow>
+			      <mrow>
+				        <xsl:apply-templates select="m:sup[1]"/>
+			      </mrow>
+		    </msubsup>
+	  </xsl:template>
+
+	  <xsl:template match="m:groupChr">
+		    <xsl:variable name="ndLastGroupChrPr" select="m:groupChrPr[last()]"/>
+		    <xsl:variable name="sLowerCasePos"
+                    select="translate($ndLastGroupChrPr/m:pos/@m:val,                                                         'ABCDEFGHIJKLMNOPQRSTUVWXYZ',                                                         'abcdefghijklmnopqrstuvwxyz')"/>
+
+		    <xsl:variable name="sLowerCaseVertJc"
+                    select="translate($ndLastGroupChrPr/m:vertJc/@m:val,                                                         'ABCDEFGHIJKLMNOPQRSTUVWXYZ',                                                         'abcdefghijklmnopqrstuvwxyz')"/>
+		    <xsl:variable name="ndLastChr" select="$ndLastGroupChrPr/m:chr"/>
+
+		    <xsl:variable name="chr">
+			      <xsl:choose>
+				        <xsl:when test="$ndLastChr and (not($ndLastChr/@m:val) or string-length($ndLastChr/@m:val) = 0)"/>
+				        <xsl:when test="string-length($ndLastChr/@m:val) &gt;= 1">
+					          <xsl:value-of select="substring($ndLastChr/@m:val,1,1)"/>
+				        </xsl:when>
+				        <xsl:otherwise>
+					          <xsl:text>&amp;#x023DF;</xsl:text>
+				        </xsl:otherwise>
+			      </xsl:choose>
+		    </xsl:variable>
+		    <xsl:choose>
+			      <xsl:when test="$sLowerCasePos = 'top'">
+				        <xsl:choose>
+					          <xsl:when test="$sLowerCaseVertJc = 'bot'">
+						            <mover accent="false">
+							              <mrow>
+								                <xsl:apply-templates select="m:e[1]"/>
+							              </mrow>
+							              <mo>
+								                <xsl:value-of disable-output-escaping="yes" select="$chr"/>
+							              </mo>
+						            </mover>
+					          </xsl:when>
+					          <xsl:otherwise>
+						            <munder accentunder="false">
+							              <mo>
+								                <xsl:value-of disable-output-escaping="yes" select="$chr"/>
+							              </mo>
+							              <mrow>
+								                <xsl:apply-templates select="m:e[1]"/>
+							              </mrow>
+						            </munder>
+					          </xsl:otherwise>
+				        </xsl:choose>
+			      </xsl:when>
+			      <xsl:otherwise>
+				        <xsl:choose>
+					          <xsl:when test="$sLowerCaseVertJc = 'bot'">
+						            <mover accent="false">
+							              <mo>
+								                <xsl:value-of disable-output-escaping="yes" select="$chr"/>
+							              </mo>
+							              <mrow>
+								                <xsl:apply-templates select="m:e[1]"/>
+							              </mrow>
+						            </mover>
+					          </xsl:when>
+					          <xsl:otherwise>
+						            <munder accentunder="false">
+							              <mrow>
+								                <xsl:apply-templates select="m:e[1]"/>
+							              </mrow>
+							              <mo>
+								                <xsl:value-of disable-output-escaping="yes" select="$chr"/>
+							              </mo>
+						            </munder>
+					          </xsl:otherwise>
+				        </xsl:choose>
+			      </xsl:otherwise>
+		    </xsl:choose>
+	  </xsl:template>
+
+	  <xsl:template name="fName">
+		    <xsl:for-each select="m:fName/*">
+			      <xsl:apply-templates select="."/>
+		    </xsl:for-each>
+	  </xsl:template>
+
+	  <xsl:template match="m:func">
+		    <mrow>
+			      <mrow>
+				        <xsl:call-template name="fName"/>
+			      </mrow>
+			      <mo>⁡</mo>
+			      <mrow>
+				        <xsl:apply-templates select="m:e"/>
+			      </mrow>
+		    </mrow>
+	  </xsl:template>
+
+	  <!-- %%Template: match m:f 
+		
+		m:f maps directly to mfrac. 
+	-->
+	<xsl:template match="m:f">
+		    <xsl:variable name="sLowerCaseType"
+                    select="translate(m:fPr[last()]/m:type/@m:val, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')"/>
+		    <xsl:choose>
+			      <xsl:when test="$sLowerCaseType='lin'">
+				        <mrow>
+					          <mrow>
+						            <xsl:apply-templates select="m:num[1]"/>
+					          </mrow>
+					          <mo>/</mo>
+					          <mrow>
+						            <xsl:apply-templates select="m:den[1]"/>
+					          </mrow>
+				        </mrow>
+			      </xsl:when>
+			      <xsl:otherwise>
+				        <mfrac>
+					          <xsl:call-template name="CreateMathMLFracProp">
+						            <xsl:with-param name="type" select="$sLowerCaseType"/>
+					          </xsl:call-template>
+					          <mrow>
+						            <xsl:apply-templates select="m:num[1]"/>
+					          </mrow>
+					          <mrow>
+						            <xsl:apply-templates select="m:den[1]"/>
+					          </mrow>
+				        </mfrac>
+			      </xsl:otherwise>
+		    </xsl:choose>
+
+	  </xsl:template>
+
+
+	  <!-- %%Template: CreateMathMLFracProp 
+		
+			Make fraction properties based on supplied parameters.
+			OMML differentiates between a linear fraction and a skewed
+			one. For MathML, we write both as bevelled.
+	-->
+	<xsl:template name="CreateMathMLFracProp">
+		    <xsl:param name="type"/>
+		    <xsl:variable name="sLowerCaseType"
+                    select="translate($type, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')"/>
+
+		    <xsl:if test="$sLowerCaseType='skw' or $sLowerCaseType='lin'">
+			      <xsl:attribute name="bevelled">true</xsl:attribute>
+		    </xsl:if>
+		    <xsl:if test="$sLowerCaseType='nobar'">
+			      <xsl:attribute name="linethickness">0pt</xsl:attribute>
+		    </xsl:if>
+		    <xsl:choose>
+			      <xsl:when test="sLowerCaseNumJc='right'">
+				        <xsl:attribute name="numalign">right</xsl:attribute>
+			      </xsl:when>
+			      <xsl:when test="sLowerCaseNumJc='left'">
+				        <xsl:attribute name="numalign">left</xsl:attribute>
+			      </xsl:when>
+		    </xsl:choose>
+		    <xsl:choose>
+			      <xsl:when test="sLowerCaseDenJc='right'">
+				        <xsl:attribute name="numalign">right</xsl:attribute>
+			      </xsl:when>
+			      <xsl:when test="sLowerCaseDenJc='left'">
+				        <xsl:attribute name="numalign">left</xsl:attribute>
+			      </xsl:when>
+		    </xsl:choose>
+	  </xsl:template>
+
+	  <!-- %%Template: match m:e | m:den | m:num | m:lim | m:sup | m:sub 
+		
+		These element delinate parts of an expression (like the numerator).  -->
+	<xsl:template match="m:e | m:den | m:num | m:lim | m:sup | m:sub">
+		    <xsl:choose>
+
+			<!-- If there is no scriptLevel specified, just call through -->
+			<xsl:when test="not(m:argPr[last()]/m:scrLvl/@m:val)">
+				        <xsl:apply-templates select="*"/>
+			      </xsl:when>
+
+			      <!-- Otherwise, create an mstyle and set the script level -->
+			<xsl:otherwise>
+				        <mstyle>
+					          <xsl:attribute name="scriptlevel">
+						            <xsl:value-of select="m:argPr[last()]/m:scrLvl/@m:val"/>
+					          </xsl:attribute>
+					          <xsl:apply-templates select="*"/>
+				        </mstyle>
+			      </xsl:otherwise>
+		    </xsl:choose>
+	  </xsl:template>
+
+	  <xsl:template match="m:bar">
+		    <xsl:variable name="sLowerCasePos"
+                    select="translate(m:barPr/m:pos/@m:val, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',                                                                           'abcdefghijklmnopqrstuvwxyz')"/>
+
+		    <xsl:variable name="fTop">
+
+			      <xsl:choose>
+				        <xsl:when test="$sLowerCasePos='top'">1</xsl:when>
+				        <xsl:otherwise>0</xsl:otherwise>
+			      </xsl:choose>
+		    </xsl:variable>
+		    <xsl:choose>
+			      <xsl:when test="$fTop=1">
+				        <mover>
+					          <mrow>
+						            <xsl:apply-templates select="m:e[1]"/>
+					          </mrow>
+					          <mo>
+						            <xsl:text>&#x000AF;</xsl:text>
+					          </mo>
+				        </mover>
+			      </xsl:when>
+			      <xsl:otherwise>
+				        <munder>
+					          <mrow>
+						            <xsl:apply-templates select="m:e[1]"/>
+					          </mrow>
+					          <mo>
+						            <xsl:text>&#x00332;</xsl:text>
+					          </mo>
+				        </munder>
+			      </xsl:otherwise>
+		    </xsl:choose>
+	  </xsl:template>
+
+	  <!-- %%Template match m:d
+
+		Process a delimiter. 
+	-->
+	<xsl:template match="m:d">
+		    <mfenced>
+			<!-- open: default is '(' for both OMML and MathML -->
+			<xsl:if test="m:dPr[1]/m:begChr/@m:val and not(m:dPr[1]/m:begChr/@m:val ='(')">
+				        <xsl:attribute name="open">
+					          <xsl:value-of select="m:dPr[1]/m:begChr/@m:val"/>
+				        </xsl:attribute>
+			      </xsl:if>
+
+			      <!-- close: default is ')' for both OMML and MathML -->
+			<xsl:if test="m:dPr[1]/m:endChr/@m:val and not(m:dPr[1]/m:endChr/@m:val =')')">
+				        <xsl:attribute name="close">
+					          <xsl:value-of select="m:dPr[1]/m:endChr/@m:val"/>
+				        </xsl:attribute>
+			      </xsl:if>
+
+			      <!-- separator: the default is ',' for MathML, and '|' for OMML -->
+			<xsl:choose>
+				<!-- Matches MathML default. Write nothing -->
+				<xsl:when test="m:dPr[1]/m:sepChr/@m:val = ','"/>
+
+				        <!-- OMML default: | -->
+				<xsl:when test="not(m:dPr[1]/m:sepChr/@m:val)">
+					          <xsl:attribute name="separators">
+						            <xsl:value-of select="'|'"/>
+					          </xsl:attribute>
+				        </xsl:when>
+
+				        <xsl:otherwise>
+					          <xsl:attribute name="separators">
+						            <xsl:value-of select="m:dPr[1]/m:sepChr/@m:val"/>
+					          </xsl:attribute>
+				        </xsl:otherwise>
+			      </xsl:choose>
+
+			      <!-- now write all the children. Put each one into an mrow
+			just in case it produces multiple runs, etc -->
+			<xsl:for-each select="m:e">
+				        <mrow>
+					          <xsl:apply-templates select="."/>
+				        </mrow>
+			      </xsl:for-each>
+		    </mfenced>
+	  </xsl:template>
+
+	  <xsl:template match="m:r">
+		    <xsl:variable name="sLowerCaseNor"
+                    select="translate(child::m:rPr[last()]/m:nor/@m:val, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',                                                                           'abcdefghijklmnopqrstuvwxyz')"/>
+		    <xsl:variable name="sLowerCaseLit"
+                    select="translate(child::m:rPr[child::m:lit][last()]/@m:val, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',                                                                           'abcdefghijklmnopqrstuvwxyz')"/>
+
+		    <xsl:variable name="fNor">
+			      <xsl:choose>
+				        <xsl:when test="$sLowerCaseNor='off' or count(child::m:rPr[last()]/m:nor) = 0">0</xsl:when>
+				        <xsl:otherwise>1</xsl:otherwise>
+			      </xsl:choose>
+		    </xsl:variable>
+		    <xsl:variable name="fLit">
+			      <xsl:choose>
+				        <xsl:when test="not(child::m:rPr[child::m:lit][last()]) or $sLowerCaseLit='off'">0</xsl:when>
+				        <xsl:otherwise>1</xsl:otherwise>
+			      </xsl:choose>
+		    </xsl:variable>
+
+		    <xsl:choose>
+			      <xsl:when test="$fNor=1">
+				        <xsl:choose>
+					          <xsl:when test="$fLit=1">
+						            <maction actiontype="lit">
+							              <mtext>
+									<xsl:call-template name="checkDirectFormatting"/>
+								                <xsl:value-of select=".//m:t"/>
+							              </mtext>
+						            </maction>
+					          </xsl:when>
+					          <xsl:otherwise>
+						            <mtext>
+									<xsl:call-template name="checkDirectFormatting"/>
+							              <xsl:value-of select=".//m:t"/>
+						            </mtext>
+					          </xsl:otherwise>
+				        </xsl:choose>
+			      </xsl:when>
+			      <xsl:otherwise>
+				        <xsl:choose>
+					          <xsl:when test="$fLit=1">
+						            <maction actiontype="lit">
+							              <xsl:for-each select=".//m:t">
+								                <xsl:call-template name="ParseMt">
+									                  <xsl:with-param name="sToParse" select="text()"/>
+									                  <xsl:with-param name="scr" select="../m:rPr[last()]/m:scr/@m:val"/>
+									                  <xsl:with-param name="sty" select="../m:rPr[last()]/m:sty/@m:val"/>
+									                  <xsl:with-param name="nor" select="../m:rPr[last()]/m:nor/@m:val"/>
+								                </xsl:call-template>
+							              </xsl:for-each>
+						            </maction>
+					          </xsl:when>
+					          <xsl:otherwise>
+						            <xsl:for-each select=".//m:t">
+							              <xsl:call-template name="ParseMt">
+								                <xsl:with-param name="sToParse" select="text()"/>
+								                <xsl:with-param name="scr" select="../m:rPr[last()]/m:scr/@m:val"/>
+								                <xsl:with-param name="sty" select="../m:rPr[last()]/m:sty/@m:val"/>
+								                <xsl:with-param name="nor" select="../m:rPr[last()]/m:nor/@m:val"/>
+							              </xsl:call-template>
+						            </xsl:for-each>
+					          </xsl:otherwise>
+				        </xsl:choose>
+			      </xsl:otherwise>
+		    </xsl:choose>
+	  </xsl:template>
+
+
+	  <xsl:template name="CreateTokenAttributes">
+		    <xsl:param name="scr"/>
+		    <xsl:param name="sty"/>
+		    <xsl:param name="nor"/>
+		    <xsl:param name="nCharToPrint"/>
+		    <xsl:param name="sTokenType"/>
+		    <xsl:variable name="sLowerCaseNor"
+                    select="translate($nor, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',                                                               'abcdefghijklmnopqrstuvwxyz')"/>
+		    <xsl:choose>
+			      <xsl:when test="$sLowerCaseNor = 'on'">
+				        <xsl:attribute name="mathvariant">normal</xsl:attribute>
+			      </xsl:when>
+			      <xsl:otherwise>
+				        <xsl:variable name="mathvariant">
+					          <xsl:choose>
+						<!-- numbers don't care -->
+						<xsl:when test="$sTokenType='mn'"/>
+
+						            <xsl:when test="$scr='monospace'">monospace</xsl:when>
+						            <xsl:when test="$scr='sans-serif' and $sty='i'">sans-serif-italic</xsl:when>
+						            <xsl:when test="$scr='sans-serif' and $sty='b'">bold-sans-serif</xsl:when>
+						            <xsl:when test="$scr='sans-serif' and $sty='bi'">sans-serif-bold-italic</xsl:when>
+						            <xsl:when test="$scr='sans-serif'">sans-serif</xsl:when>
+						            <xsl:when test="$scr='fraktur' and $sty='b'">bold-fraktur</xsl:when>
+						            <xsl:when test="$scr='fraktur'">fraktur</xsl:when>
+						            <xsl:when test="$scr='double-struck'">double-struck</xsl:when>
+						            <xsl:when test="$scr='script' and $sty='b'">bold-script</xsl:when>
+						            <xsl:when test="$scr='script'">script</xsl:when>
+						            <xsl:when test="($scr='roman' or not($scr) or $scr='') and $sty='b'">bold</xsl:when>
+						            <xsl:when test="($scr='roman' or not($scr) or $scr='') and $sty='i'">italic</xsl:when>
+						            <xsl:when test="($scr='roman' or not($scr) or $scr='') and $sty='p'">normal</xsl:when>
+						            <xsl:when test="($scr='roman' or not($scr) or $scr='') and $sty='bi'">bold-italic</xsl:when>
+						            <xsl:otherwise/>
+					          </xsl:choose>
+				        </xsl:variable>
+				        <xsl:variable name="fontweight">
+					          <xsl:choose>
+						            <xsl:when test="$sty='b' or $sty='bi'">bold</xsl:when>
+						            <xsl:otherwise>normal</xsl:otherwise>
+					          </xsl:choose>
+				        </xsl:variable>
+				        <xsl:variable name="fontstyle">
+					          <xsl:choose>
+						            <xsl:when test="$sty='p' or $sty='b'">normal</xsl:when>
+						            <xsl:otherwise>italic</xsl:otherwise>
+					          </xsl:choose>
+				        </xsl:variable>
+
+				        <!-- Writing of attributes begins here -->
+				<xsl:choose>
+					<!-- Don't write mathvariant for operators unless they want to be normal -->
+					<xsl:when test="$sTokenType='mo' and $mathvariant!='normal'"/>
+
+					          <!-- A single character within an mi is already italics, don't write -->
+					<xsl:when test="$sTokenType='mi' and $nCharToPrint=1 and ($mathvariant='' or $mathvariant='italic')"/>
+
+					          <xsl:when test="$sTokenType='mi' and $nCharToPrint &gt; 1 and ($mathvariant='' or $mathvariant='italic')">
+						            <xsl:attribute name="mathvariant">
+							              <xsl:value-of select="'italic'"/>
+						            </xsl:attribute>
+					          </xsl:when>
+					          <xsl:when test="$mathvariant!='italic' and $mathvariant!=''">
+						            <xsl:attribute name="mathvariant">
+							              <xsl:value-of select="$mathvariant"/>
+						            </xsl:attribute>
+					          </xsl:when>
+					          <xsl:otherwise>
+						            <xsl:if test="not($sTokenType='mi' and $nCharToPrint=1) and $fontstyle='italic'">
+							              <xsl:attribute name="fontstyle">italic</xsl:attribute>
+						            </xsl:if>
+						            <xsl:if test="$fontweight='bold'">
+							              <xsl:attribute name="fontweight">bold</xsl:attribute>
+						            </xsl:if>
+					          </xsl:otherwise>
+				        </xsl:choose>
+			      </xsl:otherwise>
+		    </xsl:choose>
+	  </xsl:template>
+
+	  <xsl:template match="m:eqArr">
+		    <mtable>
+			      <xsl:for-each select="m:e">
+				        <mtr>
+					          <mtd>
+						            <xsl:choose>
+							              <xsl:when test="m:argPr[last()]/m:scrLvl/@m:val!='0' or                   not(m:argPr[last()]/m:scrLvl/@m:val)  or                   m:argPr[last()]/m:scrLvl/@m:val=''">
+								                <mrow>
+									                  <maligngroup/>
+									                  <xsl:call-template name="CreateEqArrRow">
+										                    <xsl:with-param name="align" select="1"/>
+										                    <xsl:with-param name="ndCur" select="*[1]"/>
+									                  </xsl:call-template>
+								                </mrow>
+							              </xsl:when>
+							              <xsl:otherwise>
+								                <mstyle>
+									                  <xsl:attribute name="scriptlevel">
+										                    <xsl:value-of select="m:argPr[last()]/m:scrLvl/@m:val"/>
+									                  </xsl:attribute>
+									                  <maligngroup/>
+									                  <xsl:call-template name="CreateEqArrRow">
+										                    <xsl:with-param name="align" select="1"/>
+										                    <xsl:with-param name="ndCur" select="*[1]"/>
+									                  </xsl:call-template>
+								                </mstyle>
+							              </xsl:otherwise>
+						            </xsl:choose>
+					          </mtd>
+				        </mtr>
+			      </xsl:for-each>
+		    </mtable>
+	  </xsl:template>
+
+	  <xsl:template name="CreateEqArrRow">
+		    <xsl:param name="align"/>
+		    <xsl:param name="ndCur"/>
+		    <xsl:variable name="sAllMt">
+			      <xsl:for-each select="$ndCur/m:t">
+				        <xsl:value-of select="."/>
+			      </xsl:for-each>
+		    </xsl:variable>
+		    <xsl:choose>
+			      <xsl:when test="$ndCur/self::m:r">
+				        <xsl:call-template name="ParseEqArrMr">
+					          <xsl:with-param name="sToParse" select="$sAllMt"/>
+					          <xsl:with-param name="scr" select="../m:rPr[last()]/m:scr/@m:val"/>
+					          <xsl:with-param name="sty" select="../m:rPr[last()]/m:sty/@m:val"/>
+					          <xsl:with-param name="nor" select="../m:rPr[last()]/m:nor/@m:val"/>
+					          <xsl:with-param name="align" select="$align"/>
+				        </xsl:call-template>
+			      </xsl:when>
+			      <xsl:otherwise>
+				        <xsl:apply-templates select="$ndCur"/>
+			      </xsl:otherwise>
+		    </xsl:choose>
+		    <xsl:if test="count($ndCur/following-sibling::*) &gt; 0">
+			      <xsl:variable name="cAmp">
+				        <xsl:call-template name="CountAmp">
+					          <xsl:with-param name="sAllMt" select="$sAllMt"/>
+					          <xsl:with-param name="cAmp" select="0"/>
+				        </xsl:call-template>
+			      </xsl:variable>
+			      <xsl:call-template name="CreateEqArrRow">
+				        <xsl:with-param name="align" select="($align+($cAmp mod 2)) mod 2"/>
+				        <xsl:with-param name="ndCur" select="$ndCur/following-sibling::*[1]"/>
+			      </xsl:call-template>
+		    </xsl:if>
+	  </xsl:template>
+
+	  <xsl:template name="CountAmp">
+		    <xsl:param name="sAllMt"/>
+		    <xsl:param name="cAmp"/>
+		    <xsl:choose>
+			      <xsl:when test="string-length(substring-after($sAllMt, '&amp;')) &gt; 0 or                     substring($sAllMt, string-length($sAllMt))='&amp;'">
+				        <xsl:call-template name="CountAmp">
+					          <xsl:with-param name="sAllMt" select="substring-after($sAllMt, '&amp;')"/>
+					          <xsl:with-param name="cAmp" select="$cAmp+1"/>
+				        </xsl:call-template>
+			      </xsl:when>
+			      <xsl:otherwise>
+				        <xsl:value-of select="$cAmp"/>
+			      </xsl:otherwise>
+		    </xsl:choose>
+	  </xsl:template>
+
+	  <!-- %%Template: ParseEqArrMr
+			
+			Similar to ParseMt, but this one has to do more for an equation array. 
+      In equation arrays &amp; is a special character which denotes alignment.
+      
+      The &amp; in an equation works by alternating between meaning insert alignment spacing
+      and insert alignment mark.  For each equation in the equation array
+      there is an implied align space at the beginning of the equation.  Within each equation,
+      the first &amp; means alignmark, the second, align space, the third, alignmark, etc.
+      
+      For this reason when parsing m:r's in equation arrays it is important to keep track of what
+      the next ampersand will mean.
+      
+      $align=0 => Omml's align space, which is similar to MathML's maligngroup.
+      $align=1 => Omml's alignment mark, which is similar to MathML's malignmark.
+	-->
+	<xsl:template name="ParseEqArrMr">
+		    <xsl:param name="sToParse"/>
+		    <xsl:param name="sty"/>
+		    <xsl:param name="scr"/>
+		    <xsl:param name="nor"/>
+		    <xsl:param name="align"/>
+
+		    <xsl:if test="string-length($sToParse) &gt; 0">
+			      <xsl:choose>
+				        <xsl:when test="substring($sToParse,1,1) = '&amp;'">
+					          <xsl:choose>
+						            <xsl:when test="$align=0">
+							              <maligngroup/>
+						            </xsl:when>
+						            <xsl:when test="$align=1">
+							              <malignmark/>
+						            </xsl:when>
+					          </xsl:choose>
+					          <xsl:call-template name="ParseEqArrMr">
+						            <xsl:with-param name="sToParse" select="substring($sToParse,2)"/>
+						            <xsl:with-param name="scr" select="$scr"/>
+						            <xsl:with-param name="sty" select="$sty"/>
+						            <xsl:with-param name="nor" select="$nor"/>
+						            <xsl:with-param name="align">
+							              <xsl:choose>
+								                <xsl:when test="$align=1">0</xsl:when>
+								                <xsl:otherwise>1</xsl:otherwise>
+							              </xsl:choose>
+						            </xsl:with-param>
+					          </xsl:call-template>
+				        </xsl:when>
+				        <xsl:otherwise>
+					          <xsl:variable name="sRepNumWith0">
+						            <xsl:call-template name="SReplaceNumWithZero">
+							              <xsl:with-param name="sToParse" select="$sToParse"/>
+						            </xsl:call-template>
+					          </xsl:variable>
+					          <xsl:variable name="sRepOperWith-">
+						            <xsl:call-template name="SReplaceOperWithMinus">
+							              <xsl:with-param name="sToParse" select="$sRepNumWith0"/>
+						            </xsl:call-template>
+					          </xsl:variable>
+
+					          <xsl:variable name="iFirstOper"
+                             select="string-length($sRepOperWith-) - string-length(substring-after($sRepOperWith-, '-'))"/>
+					          <xsl:variable name="iFirstNum"
+                             select="string-length($sRepOperWith-) - string-length(substring-after($sRepOperWith-, '0'))"/>
+					          <xsl:variable name="iFirstAmp"
+                             select="string-length($sRepOperWith-) - string-length(substring-after($sRepOperWith-, '&amp;'))"/>
+					          <xsl:variable name="fNumAtPos1">
+						            <xsl:choose>
+							              <xsl:when test="substring($sRepOperWith-,1,1)='0'">1</xsl:when>
+							              <xsl:otherwise>0</xsl:otherwise>
+						            </xsl:choose>
+					          </xsl:variable>
+					          <xsl:variable name="fOperAtPos1">
+						            <xsl:choose>
+							              <xsl:when test="substring($sRepOperWith-,1,1)='-'">1</xsl:when>
+							              <xsl:otherwise>0</xsl:otherwise>
+						            </xsl:choose>
+					          </xsl:variable>
+					          <xsl:choose>
+
+						<!-- Case I: The string begins with neither a number, nor an operator -->
+						<xsl:when test="$fNumAtPos1='0' and $fOperAtPos1='0'">
+							              <mi>
+								                <xsl:call-template name="CreateTokenAttributes">
+									                  <xsl:with-param name="scr" select="$scr"/>
+									                  <xsl:with-param name="sty" select="$sty"/>
+									                  <xsl:with-param name="nor" select="$nor"/>
+									                  <xsl:with-param name="nCharToPrint" select="1"/>
+									                  <xsl:with-param name="sTokenType" select="'mi'"/>
+								                </xsl:call-template>
+								                <xsl:value-of select="substring($sToParse,1,1)"/>
+							              </mi>
+							              <xsl:call-template name="ParseEqArrMr">
+								                <xsl:with-param name="sToParse" select="substring($sToParse, 2)"/>
+								                <xsl:with-param name="scr" select="$scr"/>
+								                <xsl:with-param name="sty" select="$sty"/>
+								                <xsl:with-param name="nor" select="$nor"/>
+								                <xsl:with-param name="align" select="$align"/>
+							              </xsl:call-template>
+						            </xsl:when>
+
+						            <!-- Case II: There is an operator at position 1 -->
+						<xsl:when test="$fOperAtPos1='1'">
+							              <mo>
+								                <xsl:call-template name="CreateTokenAttributes">
+									                  <xsl:with-param name="scr"/>
+									                  <xsl:with-param name="sty"/>
+									                  <xsl:with-param name="nor" select="$nor"/>
+									                  <xsl:with-param name="sTokenType" select="'mo'"/>
+								                </xsl:call-template>
+								                <xsl:value-of select="substring($sToParse,1,1)"/>
+							              </mo>
+							              <xsl:call-template name="ParseEqArrMr">
+								                <xsl:with-param name="sToParse" select="substring($sToParse, 2)"/>
+								                <xsl:with-param name="scr" select="$scr"/>
+								                <xsl:with-param name="sty" select="$sty"/>
+								                <xsl:with-param name="nor" select="$nor"/>
+								                <xsl:with-param name="align" select="$align"/>
+							              </xsl:call-template>
+						            </xsl:when>
+
+						            <!-- Case III: There is a number at position 1 -->
+						<xsl:otherwise>
+							              <xsl:variable name="sConsecNum">
+								                <xsl:call-template name="SNumStart">
+									                  <xsl:with-param name="sToParse" select="$sToParse"/>
+									                  <xsl:with-param name="sPattern" select="$sRepNumWith0"/>
+								                </xsl:call-template>
+							              </xsl:variable>
+							              <mn>
+								                <xsl:call-template name="CreateTokenAttributes">
+									                  <xsl:with-param name="scr"/>
+									                  <xsl:with-param name="sty" select="'p'"/>
+									                  <xsl:with-param name="nor" select="$nor"/>
+									                  <xsl:with-param name="sTokenType" select="'mn'"/>
+								                </xsl:call-template>
+								                <xsl:value-of select="$sConsecNum"/>
+							              </mn>
+							              <xsl:call-template name="ParseEqArrMr">
+								                <xsl:with-param name="sToParse" select="substring-after($sToParse, $sConsecNum)"/>
+								                <xsl:with-param name="scr" select="$scr"/>
+								                <xsl:with-param name="sty" select="$sty"/>
+								                <xsl:with-param name="nor" select="$nor"/>
+								                <xsl:with-param name="align" select="$align"/>
+							              </xsl:call-template>
+						            </xsl:otherwise>
+					          </xsl:choose>
+				        </xsl:otherwise>
+			      </xsl:choose>
+		    </xsl:if>
+	  </xsl:template>
+
+	  <!-- %%Template: ParseMt
+
+			Produce a run of text. Technically, OMML makes no distinction 
+			between numbers, operators, and other characters in a run. For 
+			MathML we need to break these into mi, mn, or mo elements. 
+			
+			See also ParseEqArrMr
+	-->
+	<xsl:template name="ParseMt">
+		    <xsl:param name="sToParse"/>
+		    <xsl:param name="sty"/>
+		    <xsl:param name="scr"/>
+		    <xsl:param name="nor"/>
+		    <xsl:if test="string-length($sToParse) &gt; 0">
+			      <xsl:variable name="sRepNumWith0">
+				        <xsl:call-template name="SReplaceNumWithZero">
+					          <xsl:with-param name="sToParse" select="$sToParse"/>
+				        </xsl:call-template>
+			      </xsl:variable>
+			      <xsl:variable name="sRepOperWith-">
+				        <xsl:call-template name="SReplaceOperWithMinus">
+					          <xsl:with-param name="sToParse" select="$sRepNumWith0"/>
+				        </xsl:call-template>
+			      </xsl:variable>
+
+			      <xsl:variable name="iFirstOper"
+                       select="string-length($sRepOperWith-) - string-length(substring-after($sRepOperWith-, '-'))"/>
+			      <xsl:variable name="iFirstNum"
+                       select="string-length($sRepOperWith-) - string-length(substring-after($sRepOperWith-, '0'))"/>
+			      <xsl:variable name="fNumAtPos1">
+				        <xsl:choose>
+					          <xsl:when test="substring($sRepOperWith-,1,1)='0'">1</xsl:when>
+					          <xsl:otherwise>0</xsl:otherwise>
+				        </xsl:choose>
+			      </xsl:variable>
+			      <xsl:variable name="fOperAtPos1">
+				        <xsl:choose>
+					          <xsl:when test="substring($sRepOperWith-,1,1)='-'">1</xsl:when>
+					          <xsl:otherwise>0</xsl:otherwise>
+				        </xsl:choose>
+			      </xsl:variable>
+
+			      <xsl:choose>
+
+				<!-- Case I: The string begins with neither a number, nor an operator -->
+				<xsl:when test="$fOperAtPos1='0' and $fNumAtPos1='0'">
+					          <xsl:variable name="nCharToPrint">
+						            <xsl:choose>
+							              <xsl:when test="ancestor::m:fName">
+								                <xsl:choose>
+									                  <xsl:when test="($iFirstOper=$iFirstNum) and             ($iFirstOper=string-length($sToParse)) and                        (substring($sRepOperWith-, string-length($sRepOperWith-))!='0') and                         (substring($sRepOperWith-, string-length($sRepOperWith-))!='-')">
+										                    <xsl:value-of select="string-length($sToParse)"/>
+									                  </xsl:when>
+									                  <xsl:when test="$iFirstOper &lt; $iFirstNum">
+										                    <xsl:value-of select="$iFirstOper - 1"/>
+									                  </xsl:when>
+									                  <xsl:otherwise>
+										                    <xsl:value-of select="$iFirstNum - 1"/>
+									                  </xsl:otherwise>
+								                </xsl:choose>
+							              </xsl:when>
+							              <xsl:otherwise>1</xsl:otherwise>
+						            </xsl:choose>
+					          </xsl:variable>
+
+					          <mi>
+						            <xsl:call-template name="CreateTokenAttributes">
+							              <xsl:with-param name="scr" select="$scr"/>
+							              <xsl:with-param name="sty" select="$sty"/>
+							              <xsl:with-param name="nor" select="$nor"/>
+							              <xsl:with-param name="nCharToPrint" select="$nCharToPrint"/>
+							              <xsl:with-param name="sTokenType" select="'mi'"/>
+						            </xsl:call-template>
+						            <xsl:value-of select="substring($sToParse, 1, $nCharToPrint)"/>
+					          </mi>
+					          <xsl:call-template name="ParseMt">
+						            <xsl:with-param name="sToParse" select="substring($sToParse, $nCharToPrint+1)"/>
+						            <xsl:with-param name="scr" select="$scr"/>
+						            <xsl:with-param name="sty" select="$sty"/>
+						            <xsl:with-param name="nor" select="$nor"/>
+					          </xsl:call-template>
+				        </xsl:when>
+
+				        <!-- Case II: There is an operator at position 1 -->
+				<xsl:when test="$fOperAtPos1='1'">
+					          <mo>
+						            <xsl:call-template name="CreateTokenAttributes">
+							              <xsl:with-param name="scr"/>
+							              <xsl:with-param name="sty"/>
+							              <xsl:with-param name="nor" select="$nor"/>
+							              <xsl:with-param name="sTokenType" select="'mo'"/>
+						            </xsl:call-template>
+						            <xsl:value-of select="substring($sToParse,1,1)"/>
+					          </mo>
+					          <xsl:call-template name="ParseMt">
+						            <xsl:with-param name="sToParse" select="substring($sToParse, 2)"/>
+						            <xsl:with-param name="scr" select="$scr"/>
+						            <xsl:with-param name="sty" select="$sty"/>
+						            <xsl:with-param name="nor" select="$nor"/>
+					          </xsl:call-template>
+				        </xsl:when>
+
+				        <!-- Case III: There is a number at position 1 -->
+				<xsl:otherwise>
+					          <xsl:variable name="sConsecNum">
+						            <xsl:call-template name="SNumStart">
+							              <xsl:with-param name="sToParse" select="$sToParse"/>
+							              <xsl:with-param name="sPattern" select="$sRepNumWith0"/>
+						            </xsl:call-template>
+					          </xsl:variable>
+					          <mn>
+						            <xsl:call-template name="CreateTokenAttributes">
+							              <xsl:with-param name="scr" select="$scr"/>
+							              <xsl:with-param name="sty" select="'p'"/>
+							              <xsl:with-param name="nor" select="$nor"/>
+							              <xsl:with-param name="sTokenType" select="'mn'"/>
+						            </xsl:call-template>
+						            <xsl:value-of select="$sConsecNum"/>
+					          </mn>
+					          <xsl:call-template name="ParseMt">
+						            <xsl:with-param name="sToParse" select="substring-after($sToParse, $sConsecNum)"/>
+						            <xsl:with-param name="scr" select="$scr"/>
+						            <xsl:with-param name="sty" select="$sty"/>
+						            <xsl:with-param name="nor" select="$nor"/>
+					          </xsl:call-template>
+				        </xsl:otherwise>
+			      </xsl:choose>
+		    </xsl:if>
+	  </xsl:template>
+
+	  <!-- %%Template: SNumStart 
+	
+		Return the longest substring of sToParse starting from the 
+		start of sToParse that is a number. In addition, it takes the
+		pattern string, which is sToParse with all of its numbers 
+		replaced with a 0. sPattern should be the same length 
+		as sToParse		
+	-->
+	<xsl:template name="SNumStart">
+		    <xsl:param name="sToParse" select="''"/>
+		    <!-- if we don't get anything, take the string itself -->
+		<xsl:param name="sPattern" select="'$sToParse'"/>
+
+
+		    <xsl:choose>
+			<!-- the pattern says this is a number, recurse with the rest -->
+			<xsl:when test="substring($sPattern, 1, 1) = '0'">
+				        <xsl:call-template name="SNumStart">
+					          <xsl:with-param name="sToParse" select="$sToParse"/>
+					          <xsl:with-param name="sPattern" select="substring($sPattern, 2)"/>
+				        </xsl:call-template>
+			      </xsl:when>
+
+			      <!-- the pattern says we've run out of numbers. Take as many
+				characters from sToParse as we shaved off sPattern -->
+			<xsl:otherwise>
+				        <xsl:value-of select="substring($sToParse, 1, string-length($sToParse) - string-length($sPattern))"/>
+			      </xsl:otherwise>
+		    </xsl:choose>
+	  </xsl:template>
+
+	  <!-- %%Template SRepeatCharAcc
+	
+			The core of SRepeatChar with an accumulator. The current
+			string is in param $acc, and we will double and recurse,
+			if we're less than half of the required length or else just 
+			add the right amount of characters to the accumulator and
+			return
+	-->
+	<xsl:template name="SRepeatCharAcc">
+		    <xsl:param name="cchRequired" select="1"/>
+		    <xsl:param name="ch" select="'-'"/>
+		    <xsl:param name="acc" select="$ch"/>
+
+		    <xsl:variable name="cchAcc" select="string-length($acc)"/>
+		    <xsl:choose>
+			      <xsl:when test="(2 * $cchAcc) &lt; $cchRequired">
+				        <xsl:call-template name="SRepeatCharAcc">
+					          <xsl:with-param name="cchRequired" select="$cchRequired"/>
+					          <xsl:with-param name="ch" select="$ch"/>
+					          <xsl:with-param name="acc" select="concat($acc, $acc)"/>
+				        </xsl:call-template>
+			      </xsl:when>
+
+			      <xsl:otherwise>
+				        <xsl:value-of select="concat($acc, substring($acc, 1, $cchRequired - $cchAcc))"/>
+			      </xsl:otherwise>
+		    </xsl:choose>
+	  </xsl:template>
+
+
+	  <!-- %%Template SRepeatChar
+	
+			Generates a string nchRequired long by repeating the given character ch
+	-->
+	<xsl:template name="SRepeatChar">
+		    <xsl:param name="cchRequired" select="1"/>
+		    <xsl:param name="ch" select="'-'"/>
+
+		    <xsl:call-template name="SRepeatCharAcc">
+			      <xsl:with-param name="cchRequired" select="$cchRequired"/>
+			      <xsl:with-param name="ch" select="$ch"/>
+			      <xsl:with-param name="acc" select="$ch"/>
+		    </xsl:call-template>
+	  </xsl:template>
+
+	  <!-- %%Template SReplaceOperWithMinus
+	
+		Go through the given string and replace every instance
+		of an operator with a minus '-'. This helps quickly identify
+		the first instance of an operator.  
+	-->
+	<xsl:template name="SReplaceOperWithMinus">
+		    <xsl:param name="sToParse" select="''"/>
+
+		    <xsl:value-of select="translate($sToParse, $sOperators, $sMinuses)"/>
+	  </xsl:template>
+
+	  <!-- %%Template SReplaceNumWithZero
+	
+		Go through the given string and replace every instance
+		of an number with a zero '0'. This helps quickly identify
+		the first occurence of a number. 
+		
+		Considers the '.' and ',' part of a number iff they are sandwiched 
+		between two other numbers. 0.3 will be recognized as a number,
+		x.3 will not be. Since these characters can also be an operator, this 
+		should be called before SReplaceOperWithMinus.
+	-->
+	<xsl:template name="SReplaceNumWithZero">
+		    <xsl:param name="sToParse" select="''"/>
+
+		    <!-- First do a simple replace. Numbers will all be come 0's.
+			After this point, the pattern involving the . or , that 
+			we are looking for will become 0.0 or 0,0 -->
+		<xsl:variable name="sSimpleReplace" select="translate($sToParse, $sNumbers, $sZeros)"/>
+
+		    <!-- And then, replace 0.0 with just 000. This means that the . will 
+			become part of the number -->
+		<xsl:variable name="sReplacePeriod">
+			      <xsl:call-template name="SReplace">
+				        <xsl:with-param name="sInput" select="$sSimpleReplace"/>
+				        <xsl:with-param name="sOrig" select="'0.0'"/>
+				        <xsl:with-param name="sReplacement" select="'000'"/>
+			      </xsl:call-template>
+		    </xsl:variable>
+
+		    <!-- And then, replace 0,0 with just 000. This means that the , will 
+			become part of the number -->
+		<xsl:call-template name="SReplace">
+			      <xsl:with-param name="sInput" select="$sReplacePeriod"/>
+			      <xsl:with-param name="sOrig" select="'0,0'"/>
+			      <xsl:with-param name="sReplacement" select="'000'"/>
+		    </xsl:call-template>
+	  </xsl:template>
+
+	  <!-- Template to translate Word's borderBox properties into the menclose notation attribute
+       The initial call to this SHOULD NOT pass an sAttribute.  Subsequent calls to 
+       CreateMencloseNotationAttrFromBorderBoxAttr by CreateMencloseNotationAttrFromBorderBoxAttr will
+       update the sAttribute as appropriate.
+       
+       CreateMencloseNotationAttrFromBorderBoxAttr looks at each attribute (fHideTop, fHideBot, etc.) one at a time
+       in the order they are listed and passes a modified sAttribute to CreateMencloseNotationAttrFromBorderBoxAttr.
+       Each successive call to CreateMencloseNotationAttrFromBorderBoxAttr knows which attribute to look at because 
+       the previous call should have omitted passing the attribute it just analyzed.  This is why as you read lower 
+       and lower in the template that each call to CreateMencloseNotationAttrFromBorderBoxAttr has fewer and fewer attributes.
+       -->
+	<xsl:template name="CreateMencloseNotationAttrFromBorderBoxAttr">
+		    <xsl:param name="fHideTop"/>
+		    <xsl:param name="fHideBot"/>
+		    <xsl:param name="fHideLeft"/>
+		    <xsl:param name="fHideRight"/>
+		    <xsl:param name="fStrikeH"/>
+		    <xsl:param name="fStrikeV"/>
+		    <xsl:param name="fStrikeBLTR"/>
+		    <xsl:param name="fStrikeTLBR"/>
+		    <xsl:param name="sAttribute"/>
+
+		    <xsl:choose>
+			      <xsl:when test="string-length($sAttribute) = 0">
+				        <xsl:choose>
+					          <xsl:when test="string-length($fHideTop) &gt; 0                       and string-length($fHideBot) &gt; 0                        and string-length($fHideLeft) &gt; 0                       and string-length($fHideRight) &gt; 0">
+
+						            <xsl:choose>
+							              <xsl:when test="$fHideTop = 0                                and $fHideBot = 0                               and $fHideLeft = 0                                and $fHideRight = 0">
+								<!-- We can use 'box' instead of top, bot, left, and right.  Therefore,
+                  replace sAttribute with 'box' and begin analyzing params fStrikeH
+                  and below. -->
+								<xsl:call-template name="CreateMencloseNotationAttrFromBorderBoxAttr">
+									                  <xsl:with-param name="fStrikeH" select="$fStrikeH"/>
+									                  <xsl:with-param name="fStrikeV" select="$fStrikeV"/>
+									                  <xsl:with-param name="fStrikeBLTR" select="$fStrikeBLTR"/>
+									                  <xsl:with-param name="fStrikeTLBR" select="$fStrikeTLBR"/>
+									                  <xsl:with-param name="sAttribute">
+										                    <xsl:text>box</xsl:text>
+									                  </xsl:with-param>
+								                </xsl:call-template>
+							              </xsl:when>
+							              <xsl:otherwise>
+								<!-- Can't use 'box', theremore, must analyze all attributes -->
+								<xsl:call-template name="CreateMencloseNotationAttrFromBorderBoxAttr">
+									                  <xsl:with-param name="fHideTop" select="$fHideTop"/>
+									                  <xsl:with-param name="fHideBot" select="$fHideBot"/>
+									                  <xsl:with-param name="fHideLeft" select="$fHideLeft"/>
+									                  <xsl:with-param name="fHideRight" select="$fHideRight"/>
+									                  <xsl:with-param name="fStrikeH" select="$fStrikeH"/>
+									                  <xsl:with-param name="fStrikeV" select="$fStrikeV"/>
+									                  <xsl:with-param name="fStrikeBLTR" select="$fStrikeBLTR"/>
+									                  <xsl:with-param name="fStrikeTLBR" select="$fStrikeTLBR"/>
+									                  <xsl:with-param name="sAttribute">
+										<!-- Assume using all four (left right top bottom).  Subsequent calls
+                         will remove the sides which aren't to be includes. -->
+										<xsl:text>left right top bottom</xsl:text>
+									                  </xsl:with-param>
+								                </xsl:call-template>
+							              </xsl:otherwise>
+						            </xsl:choose>
+					          </xsl:when>
+				        </xsl:choose>
+			      </xsl:when>
+			      <xsl:otherwise>
+				        <xsl:choose>
+					          <xsl:when test="string-length($fHideTop) &gt; 0">
+						            <xsl:choose>
+							              <xsl:when test="$fHideTop=1">
+								                <xsl:call-template name="CreateMencloseNotationAttrFromBorderBoxAttr">
+									                  <xsl:with-param name="fHideBot" select="$fHideBot"/>
+									                  <xsl:with-param name="fHideLeft" select="$fHideLeft"/>
+									                  <xsl:with-param name="fHideRight" select="$fHideRight"/>
+									                  <xsl:with-param name="fStrikeH" select="$fStrikeH"/>
+									                  <xsl:with-param name="fStrikeV" select="$fStrikeV"/>
+									                  <xsl:with-param name="fStrikeBLTR" select="$fStrikeBLTR"/>
+									                  <xsl:with-param name="fStrikeTLBR" select="$fStrikeTLBR"/>
+									                  <xsl:with-param name="sAttribute">
+										                    <xsl:call-template name="SReplace">
+											                      <xsl:with-param name="sInput" select="$sAttribute"/>
+											                      <xsl:with-param name="sOrig" select="'top'"/>
+											                      <xsl:with-param name="sReplacement" select="''"/>
+										                    </xsl:call-template>
+									                  </xsl:with-param>
+								                </xsl:call-template>
+							              </xsl:when>
+							              <xsl:otherwise>
+								                <xsl:call-template name="CreateMencloseNotationAttrFromBorderBoxAttr">
+									                  <xsl:with-param name="fHideBot" select="$fHideBot"/>
+									                  <xsl:with-param name="fHideLeft" select="$fHideLeft"/>
+									                  <xsl:with-param name="fHideRight" select="$fHideRight"/>
+									                  <xsl:with-param name="fStrikeH" select="$fStrikeH"/>
+									                  <xsl:with-param name="fStrikeV" select="$fStrikeV"/>
+									                  <xsl:with-param name="fStrikeBLTR" select="$fStrikeBLTR"/>
+									                  <xsl:with-param name="fStrikeTLBR" select="$fStrikeTLBR"/>
+									                  <xsl:with-param name="sAttribute" select="$sAttribute"/>
+								                </xsl:call-template>
+							              </xsl:otherwise>
+						            </xsl:choose>
+					          </xsl:when>
+					          <xsl:when test="string-length($fHideBot) &gt; 0">
+						            <xsl:choose>
+							              <xsl:when test="$fHideBot=1">
+								                <xsl:call-template name="CreateMencloseNotationAttrFromBorderBoxAttr">
+									                  <xsl:with-param name="fHideLeft" select="$fHideLeft"/>
+									                  <xsl:with-param name="fHideRight" select="$fHideRight"/>
+									                  <xsl:with-param name="fStrikeH" select="$fStrikeH"/>
+									                  <xsl:with-param name="fStrikeV" select="$fStrikeV"/>
+									                  <xsl:with-param name="fStrikeBLTR" select="$fStrikeBLTR"/>
+									                  <xsl:with-param name="fStrikeTLBR" select="$fStrikeTLBR"/>
+									                  <xsl:with-param name="sAttribute">
+										                    <xsl:call-template name="SReplace">
+											                      <xsl:with-param name="sInput" select="$sAttribute"/>
+											                      <xsl:with-param name="sOrig" select="'bottom'"/>
+											                      <xsl:with-param name="sReplacement" select="''"/>
+										                    </xsl:call-template>
+									                  </xsl:with-param>
+								                </xsl:call-template>
+							              </xsl:when>
+							              <xsl:otherwise>
+								                <xsl:call-template name="CreateMencloseNotationAttrFromBorderBoxAttr">
+									                  <xsl:with-param name="fHideLeft" select="$fHideLeft"/>
+									                  <xsl:with-param name="fHideRight" select="$fHideRight"/>
+									                  <xsl:with-param name="fStrikeH" select="$fStrikeH"/>
+									                  <xsl:with-param name="fStrikeV" select="$fStrikeV"/>
+									                  <xsl:with-param name="fStrikeBLTR" select="$fStrikeBLTR"/>
+									                  <xsl:with-param name="fStrikeTLBR" select="$fStrikeTLBR"/>
+									                  <xsl:with-param name="sAttribute" select="$sAttribute"/>
+								                </xsl:call-template>
+							              </xsl:otherwise>
+						            </xsl:choose>
+					          </xsl:when>
+					          <xsl:when test="string-length($fHideLeft) &gt; 0">
+						            <xsl:choose>
+							              <xsl:when test="$fHideLeft=1">
+								                <xsl:call-template name="CreateMencloseNotationAttrFromBorderBoxAttr">
+									                  <xsl:with-param name="fHideRight" select="$fHideRight"/>
+									                  <xsl:with-param name="fStrikeH" select="$fStrikeH"/>
+									                  <xsl:with-param name="fStrikeV" select="$fStrikeV"/>
+									                  <xsl:with-param name="fStrikeBLTR" select="$fStrikeBLTR"/>
+									                  <xsl:with-param name="fStrikeTLBR" select="$fStrikeTLBR"/>
+									                  <xsl:with-param name="sAttribute">
+										                    <xsl:call-template name="SReplace">
+											                      <xsl:with-param name="sInput" select="$sAttribute"/>
+											                      <xsl:with-param name="sOrig" select="'left'"/>
+											                      <xsl:with-param name="sReplacement" select="''"/>
+										                    </xsl:call-template>
+									                  </xsl:with-param>
+								                </xsl:call-template>
+							              </xsl:when>
+							              <xsl:otherwise>
+								                <xsl:call-template name="CreateMencloseNotationAttrFromBorderBoxAttr">
+									                  <xsl:with-param name="fHideRight" select="$fHideRight"/>
+									                  <xsl:with-param name="fStrikeH" select="$fStrikeH"/>
+									                  <xsl:with-param name="fStrikeV" select="$fStrikeV"/>
+									                  <xsl:with-param name="fStrikeBLTR" select="$fStrikeBLTR"/>
+									                  <xsl:with-param name="fStrikeTLBR" select="$fStrikeTLBR"/>
+									                  <xsl:with-param name="sAttribute" select="$sAttribute"/>
+								                </xsl:call-template>
+							              </xsl:otherwise>
+						            </xsl:choose>
+					          </xsl:when>
+					          <xsl:when test="string-length($fHideRight) &gt; 0">
+						            <xsl:choose>
+							              <xsl:when test="$fHideRight=1">
+								                <xsl:call-template name="CreateMencloseNotationAttrFromBorderBoxAttr">
+									                  <xsl:with-param name="fStrikeH" select="$fStrikeH"/>
+									                  <xsl:with-param name="fStrikeV" select="$fStrikeV"/>
+									                  <xsl:with-param name="fStrikeBLTR" select="$fStrikeBLTR"/>
+									                  <xsl:with-param name="fStrikeTLBR" select="$fStrikeTLBR"/>
+									                  <xsl:with-param name="sAttribute">
+										                    <xsl:call-template name="SReplace">
+											                      <xsl:with-param name="sInput" select="$sAttribute"/>
+											                      <xsl:with-param name="sOrig" select="'right'"/>
+											                      <xsl:with-param name="sReplacement" select="''"/>
+										                    </xsl:call-template>
+									                  </xsl:with-param>
+								                </xsl:call-template>
+							              </xsl:when>
+							              <xsl:otherwise>
+								                <xsl:call-template name="CreateMencloseNotationAttrFromBorderBoxAttr">
+									                  <xsl:with-param name="fStrikeH" select="$fStrikeH"/>
+									                  <xsl:with-param name="fStrikeV" select="$fStrikeV"/>
+									                  <xsl:with-param name="fStrikeBLTR" select="$fStrikeBLTR"/>
+									                  <xsl:with-param name="fStrikeTLBR" select="$fStrikeTLBR"/>
+									                  <xsl:with-param name="sAttribute" select="$sAttribute"/>
+								                </xsl:call-template>
+							              </xsl:otherwise>
+						            </xsl:choose>
+					          </xsl:when>
+					          <xsl:when test="string-length($fStrikeH) &gt; 0">
+						            <xsl:choose>
+							              <xsl:when test="$fStrikeH=1">
+								                <xsl:call-template name="CreateMencloseNotationAttrFromBorderBoxAttr">
+									                  <xsl:with-param name="fStrikeV" select="$fStrikeV"/>
+									                  <xsl:with-param name="fStrikeBLTR" select="$fStrikeBLTR"/>
+									                  <xsl:with-param name="fStrikeTLBR" select="$fStrikeTLBR"/>
+									                  <xsl:with-param name="sAttribute" select="concat($sAttribute, ' horizontalstrike')"/>
+								                </xsl:call-template>
+							              </xsl:when>
+							              <xsl:otherwise>
+								                <xsl:call-template name="CreateMencloseNotationAttrFromBorderBoxAttr">
+									                  <xsl:with-param name="fStrikeV" select="$fStrikeV"/>
+									                  <xsl:with-param name="fStrikeBLTR" select="$fStrikeBLTR"/>
+									                  <xsl:with-param name="fStrikeTLBR" select="$fStrikeTLBR"/>
+									                  <xsl:with-param name="sAttribute" select="$sAttribute"/>
+								                </xsl:call-template>
+							              </xsl:otherwise>
+						            </xsl:choose>
+					          </xsl:when>
+					          <xsl:when test="string-length($fStrikeV) &gt; 0">
+						            <xsl:choose>
+							              <xsl:when test="$fStrikeV=1">
+								                <xsl:call-template name="CreateMencloseNotationAttrFromBorderBoxAttr">
+									                  <xsl:with-param name="fStrikeBLTR" select="$fStrikeBLTR"/>
+									                  <xsl:with-param name="fStrikeTLBR" select="$fStrikeTLBR"/>
+									                  <xsl:with-param name="sAttribute" select="concat($sAttribute, ' verticalstrike')"/>
+								                </xsl:call-template>
+							              </xsl:when>
+							              <xsl:otherwise>
+								                <xsl:call-template name="CreateMencloseNotationAttrFromBorderBoxAttr">
+									                  <xsl:with-param name="fStrikeBLTR" select="$fStrikeBLTR"/>
+									                  <xsl:with-param name="fStrikeTLBR" select="$fStrikeTLBR"/>
+									                  <xsl:with-param name="sAttribute" select="$sAttribute"/>
+								                </xsl:call-template>
+							              </xsl:otherwise>
+						            </xsl:choose>
+					          </xsl:when>
+					          <xsl:when test="string-length($fStrikeBLTR) &gt; 0">
+						            <xsl:choose>
+							              <xsl:when test="$fStrikeBLTR=1">
+								                <xsl:call-template name="CreateMencloseNotationAttrFromBorderBoxAttr">
+									                  <xsl:with-param name="fStrikeTLBR" select="$fStrikeTLBR"/>
+									                  <xsl:with-param name="sAttribute" select="concat($sAttribute, ' updiagonalstrike')"/>
+								                </xsl:call-template>
+							              </xsl:when>
+							              <xsl:otherwise>
+								                <xsl:call-template name="CreateMencloseNotationAttrFromBorderBoxAttr">
+									                  <xsl:with-param name="fStrikeTLBR" select="$fStrikeTLBR"/>
+									                  <xsl:with-param name="sAttribute" select="$sAttribute"/>
+								                </xsl:call-template>
+							              </xsl:otherwise>
+						            </xsl:choose>
+					          </xsl:when>
+					          <xsl:when test="string-length($fStrikeTLBR) &gt; 0">
+						            <xsl:choose>
+							              <xsl:when test="$fStrikeTLBR=1">
+								                <xsl:call-template name="CreateMencloseNotationAttrFromBorderBoxAttr">
+									                  <xsl:with-param name="sAttribute" select="concat($sAttribute, ' downdiagonalstrike')"/>
+								                </xsl:call-template>
+							              </xsl:when>
+							              <xsl:otherwise>
+								                <xsl:call-template name="CreateMencloseNotationAttrFromBorderBoxAttr">
+									                  <xsl:with-param name="sAttribute" select="$sAttribute"/>
+								                </xsl:call-template>
+							              </xsl:otherwise>
+						            </xsl:choose>
+					          </xsl:when>
+					          <xsl:otherwise>
+						            <xsl:attribute name="notation">
+							              <xsl:value-of select="normalize-space($sAttribute)"/>
+						            </xsl:attribute>
+					          </xsl:otherwise>
+				        </xsl:choose>
+			      </xsl:otherwise>
+		    </xsl:choose>
+	  </xsl:template>
+
+
+	  <xsl:template name="checkDirectFormatting">
+	    <xsl:if test="w:rPr/w:rFonts/@w:ascii and not(w:rPr/w:rFonts/@w:ascii='Cambria Math')">
+	      <xsl:attribute name="fontfamily" select="w:rPr/w:rFonts/@w:ascii"/>
+	    </xsl:if>
+	    <xsl:choose>
+	      <xsl:when test="w:rPr/w:b[not(@w:val='0')]">
+		<xsl:attribute name="fontweight">bold</xsl:attribute>
+	      </xsl:when>
+	      <xsl:when test="w:rPr/w:b[@w:val='0']">
+		<xsl:attribute name="fontweight">normal</xsl:attribute>
+	      </xsl:when>
+	    </xsl:choose>
+	    <xsl:choose>
+	      <xsl:when test="w:rPr/w:i[not(@w:val='0')]">
+		<xsl:attribute name="fontstyle">italic</xsl:attribute>
+	      </xsl:when>
+	      <xsl:when test="w:rPr/w:i[@w:val='0']">
+		<xsl:attribute name="fontstyle">upright</xsl:attribute>
+	      </xsl:when>
+	    </xsl:choose>
+	  </xsl:template>
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/utils/maths/omml2mml.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/utils/functions.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/utils/functions.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/utils/functions.xsl	(revision 258)
@@ -0,0 +1,242 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:cals="http://www.oasis-open.org/specs/tm9901"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:iso="http://www.iso.org/ns/1.0"
+                xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006"
+                xmlns:o="urn:schemas-microsoft-com:office:office"
+                xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
+                xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"
+                xmlns:v="urn:schemas-microsoft-com:vml"
+                xmlns:fn="http://www.w3.org/2005/02/xpath-functions"
+                xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"
+                xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
+                xmlns:w10="urn:schemas-microsoft-com:office:word"
+                xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
+                xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml"
+                xmlns:mml="http://www.w3.org/1998/Math/MathML"
+                xmlns:tbx="http://www.lisa.org/TBX-Specification.33.0.html"
+                xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"
+		xmlns:teidocx="http://www.tei-c.org/ns/teidocx/1.0"
+                version="2.0"
+                exclude-result-prefixes="cals ve o r m v wp w10 w wne mml tbx iso tei a xs pic fn">
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI Utility stylesheet for making Word docx files
+        from TEI XML (see docx-tei.xsl)</p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: functions.xsl 9998 2012-01-02 18:27:15Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc></doc>
+
+    
+      <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Converts a dimension into the 20th of a point.</desc></doc>
+      <xsl:function name="tei:convert-dim-pt20" as="xs:integer">
+        <xsl:param name="dim"/>
+	<xsl:value-of select="tei:convert-dim-pt($dim) * 20"/>
+      </xsl:function>
+    
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Convert a dimension into point.</desc></doc>
+      <xsl:function name="tei:convert-dim-pt" as="xs:integer">
+        <xsl:param name="dim"/>
+        <xsl:choose>
+	  <xsl:when test="ends-with($dim,'%')">
+	    <xsl:value-of select="number($pageWidth * number(substring($dim,0,string-length($dim)))) cast as xs:integer"/>
+	  </xsl:when>
+	  <xsl:when test="ends-with($dim,'cm')">
+	    <xsl:value-of select="number(number(substring($dim,0,string-length($dim)-1))*28.3464567) cast as xs:integer"/>
+	  </xsl:when>
+	  <xsl:when test="ends-with($dim,'in')">
+	    <xsl:value-of select="number(number(substring($dim,0,string-length($dim)-1))*72) cast as xs:integer"/>
+	  </xsl:when>
+	  <xsl:when test="ends-with($dim,'mm')">
+	    <xsl:value-of select="number(number(substring($dim,0,string-length($dim)-1))*2.83464567) cast as xs:integer"/>
+	  </xsl:when>
+	  <xsl:when test="ends-with($dim,'pt')">
+	    <xsl:value-of select="number(substring($dim,0,string-length($dim)-1)) cast as xs:integer"/>
+	  </xsl:when>
+	  <xsl:when test="ends-with($dim,'px')">
+	    <xsl:value-of select="number(number(substring($dim,0,string-length($dim)-1))*0.75) cast as xs:integer"/>
+	  </xsl:when>            
+	  <xsl:otherwise>
+	    -1
+	  </xsl:otherwise>
+        </xsl:choose>
+    </xsl:function>
+    
+        <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Convert a dimension into english metric unit.</desc></doc>
+    <xsl:function name="tei:convert-dim-emu" as="xs:integer">
+        <xsl:param name="dim"/>
+	<xsl:variable name="result">
+	  <xsl:choose>
+            <xsl:when test="ends-with($dim,'cm')">
+	      <xsl:value-of select="number(number(substring($dim,0,string-length($dim)-1))*3600) cast as xs:integer"/>
+            </xsl:when>
+            <xsl:when test="ends-with($dim,'in')">
+	      <xsl:value-of select="number(number(substring($dim,0,string-length($dim)-1))*9144) cast as xs:integer"/>
+            </xsl:when>
+            <xsl:when test="ends-with($dim,'mm')">
+                <xsl:value-of select="number(number(substring($dim,0,string-length($dim)-1))*360) cast as xs:integer"/>
+            </xsl:when>
+            <xsl:when test="ends-with($dim,'pt')">
+                <xsl:value-of select="number(number(number(substring($dim,0,string-length($dim)-1)) div 72) * 9144) cast as xs:integer"/>
+            </xsl:when>
+            <xsl:when test="ends-with($dim,'px')">
+                <xsl:value-of select="number(number(substring($dim,0,string-length($dim)-1))*95.25) cast as xs:integer"/>
+            </xsl:when>            
+            <xsl:otherwise>
+                -1
+            </xsl:otherwise>
+	  </xsl:choose>
+	</xsl:variable>
+	<xsl:value-of select="$result"/>
+    </xsl:function>
+    
+        <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Returns a listtype for a given stylename (return empty string to figure it out dynamically).</desc></doc>
+    <xsl:function name="tei:get-listtype" as="xs:string">
+        <xsl:param name="style"/>
+        <xsl:text/>
+    </xsl:function>
+    
+        <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Returns the correct heading style (return empty string to figure it out dynamically).</desc></doc>
+    <xsl:function name="tei:get-headingstyle" as="xs:string">
+        <xsl:param name="element"/>
+        <xsl:param name="level"/>
+
+        <xsl:text/>
+    </xsl:function>    
+    
+        <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Defines whether or not a word paragraph is a first level heading.</desc></doc>
+    <xsl:function name="tei:is-firstlevel-heading" as="xs:boolean">
+        <xsl:param name="p"/>
+        
+        <xsl:choose>
+            <xsl:when test="$p[w:pPr/w:pStyle/@w:val='heading 1']">true</xsl:when>
+            <xsl:when test="$p[w:pPr/w:pStyle/@w:val='Heading 1']">true</xsl:when>
+            <xsl:otherwise>false</xsl:otherwise>
+        </xsl:choose>
+    </xsl:function>
+    
+        <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Defines whether or not a word paragraph is a  heading.</desc></doc>
+    <xsl:function name="tei:is-heading" as="xs:boolean">
+        <xsl:param name="p"/>
+	<xsl:variable name="s" select="$p/w:pPr/w:pStyle/@w:val"/>
+      
+        <xsl:choose>
+            <xsl:when test="starts-with($s,'Heading')">true</xsl:when>
+            <xsl:when test="starts-with($s,'heading')">true</xsl:when>
+            <xsl:otherwise>false</xsl:otherwise>
+        </xsl:choose>
+    </xsl:function>
+
+        <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Defines whether or not a word paragraph is a list element.</desc></doc>
+    <xsl:function name="tei:is-list" as="xs:boolean">
+        <xsl:param name="p"/>        
+        <xsl:choose>
+            <xsl:when test="$p[contains(w:pPr/w:pStyle/@w:val,'List')]">true</xsl:when>
+            <xsl:when test="$p[w:pPr/w:pStyle/@w:val='dl']">true</xsl:when>
+            <xsl:otherwise>false</xsl:otherwise>
+        </xsl:choose>
+    </xsl:function>
+
+        <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Defines whether or not a word paragraph is a table of contents.</desc></doc>
+    <xsl:function name="tei:is-toc" as="xs:boolean">
+        <xsl:param name="p"/>        
+        <xsl:choose>
+            <xsl:when test="$p[contains(w:pPr/w:pStyle/@w:val,'toc')]">true</xsl:when>
+            <xsl:otherwise>false</xsl:otherwise>
+        </xsl:choose>
+    </xsl:function>
+
+        <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Defines whether or not a word paragraph is a figure element.</desc></doc>
+    <xsl:function name="tei:is-figure" as="xs:boolean">
+        <xsl:param name="p"/>        
+        <xsl:choose>
+            <xsl:when test="$p[contains(w:pPr/w:pStyle/@w:val,'Figure')]">true</xsl:when>
+            <xsl:when test="$p[contains(w:pPr/w:pStyle/@w:val,'Caption')]">true</xsl:when>
+            <xsl:otherwise>false</xsl:otherwise>
+        </xsl:choose>
+    </xsl:function>
+    
+
+        <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Defines whether or not a word paragraph is a line of poetry.</desc></doc>
+    <xsl:function name="tei:is-line" as="xs:boolean">
+        <xsl:param name="p"/>        
+        <xsl:choose>
+            <xsl:when test="$p[w:pPr/w:pStyle/@w:val='tei_l']">true</xsl:when>
+            <xsl:otherwise>false</xsl:otherwise>
+        </xsl:choose>
+    </xsl:function>
+
+        <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Defines whether or not a word paragraph is gloss list.</desc></doc>
+    <xsl:function name="tei:is-glosslist" as="xs:boolean">
+        <xsl:param name="p"/>        
+        <xsl:choose>
+            <xsl:when test="$p[w:pPr/w:pStyle/@w:val='dl']">true</xsl:when>
+            <xsl:otherwise>false</xsl:otherwise>
+        </xsl:choose>
+    </xsl:function>
+    
+        <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Is given a header style and returns the style for the next level header.</desc></doc>
+    <xsl:function name="tei:get-nextlevel-header" as="xs:string">
+        <xsl:param name="current-header"/>
+        <xsl:value-of select="translate($current-header,'12345678','23456789')"/>
+    </xsl:function>
+    
+
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+		Returns the current date.</desc></doc>
+
+	  <xsl:function name="tei:whatsTheDate">
+        <xsl:value-of select="format-dateTime(current-dateTime(),'[Y]-[M02]-[D02]T[H02]:[m02]:[s02]Z')"/>
+    </xsl:function>
+
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/utils/functions.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/utils/variables.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/utils/variables.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/utils/variables.xsl	(revision 258)
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                
+                version="2.0">
+	
+	  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI Utility stylesheet for making Word docx files from TEI XML (see tei-docx.xsl)</p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: variables.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc>
+   </doc>
+	
+	
+	  <xsl:variable name="Heading">heading</xsl:variable>
+	  <xsl:variable name="Heading1">heading 1</xsl:variable>
+	  <xsl:variable name="Heading2">heading 2</xsl:variable>
+	  <xsl:variable name="Heading3">heading 3</xsl:variable>
+	  <xsl:variable name="Heading4">heading 4</xsl:variable>
+	  <xsl:variable name="Heading5">heading 5</xsl:variable>
+	  <xsl:variable name="Heading6">heading 6</xsl:variable>
+	  <xsl:variable name="List">List</xsl:variable>
+	  <xsl:variable name="List2">List 2</xsl:variable>
+	  <xsl:variable name="List3">List 3</xsl:variable>
+	  <xsl:variable name="List4">List 4</xsl:variable>
+	  <xsl:variable name="List5">List 5</xsl:variable>
+	  <xsl:variable name="ListBullet">List Bullet</xsl:variable>
+	  <xsl:variable name="ListBullet2">List Bullet 2</xsl:variable>
+	  <xsl:variable name="ListBullet3">List Bullet 3</xsl:variable>
+	  <xsl:variable name="ListBullet4">List Bullet 4</xsl:variable>
+	  <xsl:variable name="ListBullet5">List Bullet 5</xsl:variable>
+	  <xsl:variable name="ListContinue">List Continue</xsl:variable>
+	  <xsl:variable name="ListContinue2">List Continue 2</xsl:variable>
+	  <xsl:variable name="ListContinue3">List Continue 3</xsl:variable>
+	  <xsl:variable name="ListContinue4">List Continue 4</xsl:variable>
+	  <xsl:variable name="ListContinue5">List Continue 5</xsl:variable>
+	  <xsl:variable name="ListNumber">List Number</xsl:variable>
+	  <xsl:variable name="ListNumber2">List Number 2</xsl:variable>
+	  <xsl:variable name="ListNumber3">List Number 3</xsl:variable>
+	  <xsl:variable name="ListNumber4">List Number 4</xsl:variable>
+	  <xsl:variable name="ListNumber5">List Number 5</xsl:variable>
+	  <xsl:variable name="Note">Note</xsl:variable>
+	  <xsl:variable name="TableText">Tabletext9</xsl:variable>
+	  <xsl:variable name="Tabletitle">Table title</xsl:variable>
+
+
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/utils/variables.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/utils/graphics/listgraphics.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/utils/graphics/listgraphics.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/utils/graphics/listgraphics.xsl	(revision 258)
@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
+                xmlns:o="urn:schemas-microsoft-com:office:office"
+                xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
+                xmlns:v="urn:schemas-microsoft-com:vml"
+		xmlns:teix="http://www.tei-c.org/ns/Examples"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="2.0">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet to make a script to copy graphics files</p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: listgraphics.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc>
+   </doc>
+
+  <xsl:output method="text"/>
+  <xsl:param name="DIR"/>
+  <xsl:param name="ORIG">.</xsl:param>
+
+  <xsl:key match="tei:graphic[not(ancestor::teix:egXML)]" use="1" name="G"/>
+  <xsl:key match="o:OLEObject" use="1" name="BINARY"/>
+  <xsl:key match="v:imagedata" use="1" name="BINARY"/>
+
+  <xsl:template match="/">
+      <xsl:for-each select="key('BINARY',1)">
+	     <xsl:text>cp </xsl:text>
+	     <xsl:value-of select="@r:id"/>
+	     <xsl:text> </xsl:text>
+	     <xsl:value-of select="$DIR"/>
+	     <xsl:text>&#10;</xsl:text>
+      </xsl:for-each>
+      <xsl:for-each select="key('G',1)">
+         <xsl:variable name="F">
+            <xsl:value-of select="@url"/>
+         </xsl:variable>
+	 <xsl:variable name="target">
+	   <xsl:value-of select="$DIR"/>
+	   <xsl:text>/image</xsl:text>
+	   <xsl:number level="any"/>
+	   <xsl:text>.</xsl:text>
+	   <xsl:value-of select="tokenize($F,'\.')[last()]"/>
+	 </xsl:variable>
+         <xsl:choose>
+	   <xsl:when test="starts-with($F,'http')">
+	     <xsl:text>curl -s -o </xsl:text>
+	     <xsl:value-of select="$target"/>
+	     <xsl:text> </xsl:text>
+	     <xsl:value-of select="$F"/> 
+	   </xsl:when>
+	   <xsl:when test="starts-with($F,'/')">
+	     <xsl:text>cp "</xsl:text>
+	     <xsl:value-of select="$F"/> 
+	     <xsl:text>" </xsl:text>
+	     <xsl:value-of select="$target"/>
+	   </xsl:when>
+	   <xsl:otherwise> 
+	     <xsl:text>cp "</xsl:text>
+	     <xsl:value-of select="$ORIG"/>
+	     <xsl:text>/</xsl:text>
+	     <xsl:value-of select="$F"/> 
+	     <xsl:text>" </xsl:text>
+	     <xsl:value-of select="$target"/>
+	   </xsl:otherwise>
+         </xsl:choose>
+         <xsl:text>&#10;</xsl:text>
+      </xsl:for-each>
+
+  </xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/utils/graphics/listgraphics.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/utils/graphics/fixgraphics.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/utils/graphics/fixgraphics.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/utils/graphics/fixgraphics.xsl	(revision 258)
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:tei="http://www.tei-c.org/ns/1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                xmlns:tiff="http://ns.adobe.com/tiff/1.0/"
+                xmlns:teidocx="http://www.tei-c.org/ns/teidocx/1.0"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="2.0">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet dealing with elements from the core module. </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: fixgraphics.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc>
+   </doc>
+
+  <xsl:output method="xml" indent="yes"/>
+  <xsl:param name="DIR"/>
+  <xsl:key name="W" match="tiff:ImageWidth" use="1"/>
+  <xsl:key name="H" match="tiff:ImageLength" use="1"/>
+  <xsl:template match="@*|text()|comment()|processing-instruction()">
+      <xsl:copy-of select="."/>
+  </xsl:template>
+  
+  
+  <xsl:template match="*">
+      <xsl:copy>
+         <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
+      </xsl:copy>
+  </xsl:template>
+  
+  
+  <xsl:template match="tei:graphic">
+      <xsl:copy>
+	        <xsl:variable name="newName">
+	           <xsl:text>media/resource</xsl:text>
+	           <xsl:number level="any"/>
+	           <xsl:text>.</xsl:text>
+	           <xsl:value-of select="tokenize(@url,'\.')[last()]"/>
+	        </xsl:variable>
+	        <xsl:attribute name="url">
+	           <xsl:value-of select="$newName"/>
+	        </xsl:attribute>
+	        <xsl:copy-of select="@n"/>
+	        <xsl:copy-of select="@height"/>
+	        <xsl:copy-of select="@width"/>
+	        <xsl:copy-of select="@scale"/>
+		
+	        <xsl:if test="doc-available(concat($DIR,'/',$newName,'.xmp'))">
+	           <xsl:attribute name="tei:width">
+	              <xsl:for-each select="document(concat($DIR,'/',$newName,'.xmp'),/)">
+	                 <xsl:value-of select="(number(key('W',1)) div 72) * 9144"/>
+	              </xsl:for-each>
+	           </xsl:attribute>
+	  
+	           <xsl:attribute name="tei:height">
+	              <xsl:for-each select="document(concat($DIR,'/',$newName,'.xmp'),/)">
+	                 <xsl:value-of select="(number(key('H',1)) div 72) * 9144"/>
+	              </xsl:for-each>
+	           </xsl:attribute>
+	        </xsl:if>
+      </xsl:copy>
+  </xsl:template>
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/docx/utils/graphics/fixgraphics.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/xsd/build-to.xml
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/xsd/build-to.xml	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/xsd/build-to.xml	(revision 258)
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="utf-8"?>
+<project basedir="." default="dist" name="teitoxsd">
+    <!--
+        This library is free software; you can redistribute it and/or
+        modify it under the terms of the GNU Lesser General Public
+        License as published by the Free Software Foundation; either
+        version 2.1 of the License, or (at your option) any later version.
+        
+        This library 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
+        Lesser General Public License for more details.
+        
+        You should have received a copy of the GNU Lesser General Public
+        License along with this library; if not, write to the Free Software
+        Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+        
+        Id: $Id: build-to.xml 9316 2011-09-13 08:06:05Z rahtz $
+        Copyright: 2011, TEI Consortium<
+    -->
+    <!--
+        Convert TEI documents into XSD schemas.
+    -->
+    <!-- Path to TEI XML file. -->
+    <property name="inputFile" value=""/>
+    <!-- Path where the output schema file will be saved. -->
+    <property name="outputFile" value=""/>
+    <!-- which profile -->
+    <property name="profile" value="default"/>
+    <!-- where does oxygen keep stuff -->
+    <property name="oxygenlib" value=""/>
+    <dirname property="inputFileDir" file="${inputFile}"/>
+    <dirname property="outputDir" file="${outputFile}"/>
+    <property name="outputTempDir" value="${outputDir}/temp-dir-for-ant"/>
+    <!-- The input file for the TRANG transformation. -->
+    <property name="trangInputFile" value="${outputFile}.rng"/>
+    
+    <path id="classpath">
+        <pathelement path="${java.class.path}"/>
+    </path>
+    
+    <!-- Use the Relax NG target to obtain a Relax NG schema and afterward transform it
+    to XSD using TRANG. -->
+    <target name="trangConvert">
+        <!-- Obtain a Relax NG schema.  -->
+        <ant antfile="../relaxng/build-to.xml" dir="../relaxng"/>
+        <!-- The Relax NG was generated inside the output file. -->
+        <copy file="${outputFile}" tofile="${trangInputFile}"/>
+        
+        <echo level="info">TRANG generate XSD from RELAXNG files</echo>
+        <java classname="com.thaiopensource.relaxng.translate.Driver" fork="no">
+            <classpath>
+                <path refid="classpath"/>
+                <pathelement location="${oxygenlib}/trang.jar"/>
+            </classpath>
+            <!-- Even though the output type is inferred from the output file extension,
+                 make sure it's the right one. -->
+            <arg value="-O"/>
+            <arg value="xsd"/>
+            <arg value="${trangInputFile}" />
+            <arg value="${outputFile}" />
+        </java>
+    </target>
+    
+    <target name="cleanup" unless="debug">
+        <!-- Delete the intermediate Relax NG schema. -->
+        <delete file="${trangInputFile}"/>
+    </target>
+    
+    <target name="dist" depends="trangConvert, cleanup"/>
+    
+</project>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/xsd/build-to.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/latex2/corpus.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/latex2/corpus.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/latex2/corpus.xsl	(revision 258)
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
+                xmlns:rng="http://relaxng.org/ns/structure/1.0"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"
+                
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                exclude-result-prefixes="a rng tei teix"
+                version="2.0">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet dealing with elements from the corpus module,
+      making LaTeX output. </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: corpus.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2011, TEI Consortium</p>
+      </desc>
+   </doc>
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/latex2/corpus.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/latex2/linking.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/latex2/linking.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/latex2/linking.xsl	(revision 258)
@@ -0,0 +1,191 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
+                xmlns:rng="http://relaxng.org/ns/structure/1.0"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"
+		xmlns:xs="http://www.w3.org/2001/XMLSchema"                
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                exclude-result-prefixes="a rng tei teix xs"
+                version="2.0">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet dealing with elements from the linking module,
+      making LaTeX output. </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: linking.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2011, TEI Consortium</p>
+      </desc>
+   </doc>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element anchor</desc>
+   </doc>
+  <xsl:template match="tei:anchor">
+      <xsl:text>\hypertarget{</xsl:text>
+      <xsl:value-of select="@xml:id"/>
+      <xsl:text>}{}</xsl:text>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[latex] <param name="where">where</param>
+      </desc>
+   </doc>
+  <xsl:template name="generateEndLink">
+      <xsl:param name="where"/>
+      <xsl:value-of select="$where"/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[latex] <param name="ptr">ptr</param>
+         <param name="dest">dest</param>
+      </desc>
+   </doc>
+  <xsl:template name="makeExternalLink">
+      <xsl:param name="ptr" as="xs:boolean"  select="false()"/>
+      <xsl:param name="dest"/>
+      <xsl:choose>
+         <xsl:when test="$ptr">
+            <xsl:text>\url{</xsl:text>
+            <xsl:value-of select="$dest"/>
+            <xsl:text>}</xsl:text>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:text>\xref{</xsl:text>
+            <xsl:value-of select="$dest"/>
+            <xsl:text>}{</xsl:text>
+            <xsl:apply-templates/>
+            <xsl:text>}</xsl:text>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[latex] <param name="target">target</param>
+         <param name="ptr">ptr</param>
+         <param name="dest">dest</param>
+         <param name="body">body</param>
+      </desc>
+   </doc>
+  <xsl:template name="makeInternalLink">
+      <xsl:param name="target"/>
+      <xsl:param name="class"/>
+      <xsl:param name="ptr" as="xs:boolean"  select="false()"/>
+      <xsl:param name="dest"/>
+      <xsl:param name="body"/>
+      <xsl:choose>
+         <xsl:when test="id($dest)">
+            <xsl:choose>
+               <xsl:when test="not($body='')">
+		 <xsl:text>\hyperlink{</xsl:text>
+		 <xsl:value-of select="$dest"/>
+		 <xsl:text>}{</xsl:text>
+		 <xsl:value-of select="$body"/>
+		 <xsl:text>}</xsl:text>
+               </xsl:when>
+               <xsl:when test="$ptr">
+		 <xsl:for-each select="id($dest)">
+		   <xsl:choose>
+		     <xsl:when test="$class='pageref'">
+		       <xsl:text>\pageref{</xsl:text>
+		       <xsl:value-of select="@xml:id"/>
+		       <xsl:text>}</xsl:text>
+		     </xsl:when>
+		     <xsl:when test="self::tei:note[@xml:id]">
+		       <xsl:text>\ref{</xsl:text>
+		       <xsl:value-of select="@xml:id"/>
+		       <xsl:text>}</xsl:text>
+		     </xsl:when>
+		     <xsl:when test="self::tei:figure[tei:head and @xml:id]">
+		       <xsl:text>\ref{</xsl:text>
+		       <xsl:value-of select="@xml:id"/>
+		       <xsl:text>}</xsl:text>
+		     </xsl:when>
+		     <xsl:when test="self::tei:table[tei:head and @xml:id]">
+		       <xsl:text>\ref{</xsl:text>
+		       <xsl:value-of select="@xml:id"/>
+		       <xsl:text>}</xsl:text>
+		     </xsl:when>
+		     <xsl:when test="starts-with(local-name(.),'div')">
+		       <xsl:text>\textit{\hyperref[</xsl:text>
+		       <xsl:value-of select="$dest"/>
+		       <xsl:text>]{</xsl:text>
+		       <xsl:apply-templates mode="xref" select=".">
+			 <xsl:with-param name="minimal" select="$minimalCrossRef"/>
+		       </xsl:apply-templates>
+		       <xsl:text>}}</xsl:text>
+		     </xsl:when>
+		     <xsl:otherwise>
+		       <xsl:text>\hyperlink{</xsl:text>
+		       <xsl:value-of select="$dest"/>
+		       <xsl:text>}{</xsl:text>
+		       <xsl:value-of select="$body"/>
+		       <xsl:apply-templates mode="xref" select=".">
+			 <xsl:with-param name="minimal" select="$minimalCrossRef"/>
+		       </xsl:apply-templates>
+		       <xsl:text>}</xsl:text>
+		     </xsl:otherwise>
+		   </xsl:choose>
+		 </xsl:for-each>
+               </xsl:when>
+               <xsl:otherwise>
+		 <xsl:text>\hyperlink{</xsl:text>
+		 <xsl:value-of select="$dest"/>
+		 <xsl:text>}{</xsl:text>
+		 <xsl:value-of select="$body"/>
+		 <xsl:apply-templates/>
+		 <xsl:text>}</xsl:text>
+	       </xsl:otherwise>
+            </xsl:choose>
+         </xsl:when>
+         <xsl:otherwise>
+	   <xsl:choose>
+	     <xsl:when test="not($body='')">
+	       <xsl:value-of select="$body"/>
+	     </xsl:when>
+	     <xsl:when test="$ptr">
+	       <xsl:value-of select="$dest"/>
+	     </xsl:when>
+	     <xsl:otherwise>
+	       <xsl:apply-templates/>
+	     </xsl:otherwise>
+	   </xsl:choose>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process cross-ref to note</desc>
+   </doc>
+  <xsl:template match="tei:note" mode="xref">
+    <xsl:number level="any"/>
+  </xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/latex2/linking.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/latex2/transcr.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/latex2/transcr.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/latex2/transcr.xsl	(revision 258)
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet 
+                xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
+                xmlns:rng="http://relaxng.org/ns/structure/1.0"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"
+                xmlns:html="http://www.w3.org/1999/xhtml"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                exclude-result-prefixes="a rng tei teix"
+                version="2.0">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p>
+    TEI stylesheet
+    dealing  with elements from the
+    transcr module, making LaTeX output.
+      </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: transcr.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2011, TEI Consortium</p>
+      </desc>
+   </doc>
+
+  <xsl:template match="tei:facsimile"/>
+
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/latex2/transcr.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/latex2/tei-param.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/latex2/tei-param.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/latex2/tei-param.xsl	(revision 258)
@@ -0,0 +1,638 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:s="http://www.ascc.net/xml/schematron"
+                
+                xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
+                xmlns:rng="http://relaxng.org/ns/structure/1.0"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                exclude-result-prefixes="s a rng tei teix"
+                version="2.0">
+
+   <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p>TEI stylesheet customization module for LaTeX output.</p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: tei-param.xsl 10197 2012-03-28 21:44:10Z rahtz $</p>
+         <p>Copyright: 2011, TEI Consortium</p>
+      </desc>
+   </doc>
+
+
+  <xsl:key name="FOOTNOTES" match="tei:note[not(@place)]" use="1"/>
+  <xsl:key name="FOOTNOTES" match="tei:note[@place='foot']" use="1"/>
+  <xsl:key name="FOOTNOTES" match="tei:note[@place='bottom']" use="1"/>
+  <xsl:key name="ENDNOTES" match="tei:note[@place='end']" use="1"/>
+
+   <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="hook">
+      <desc>[latex] Hook where LaTeX commands can be inserted after 
+the beginning of the document</desc>
+   </doc>
+   <xsl:template name="beginDocumentHook"/>
+
+   <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="hook">
+      <desc>[latex] Hook where LaTeX commands can be at start of setup</desc>
+   </doc>
+   <xsl:template name="latexSetupHook"/>
+   <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="hook">
+      <desc>[latex] Hook where LaTeX commands can be inserted in the
+    preamble before the beginning of the document</desc>
+   </doc>
+   <xsl:template name="latexPreambleHook"/>
+
+   <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="string">
+      <desc>
+Optional parameters for documentclass
+</desc>
+   </doc>
+   <xsl:param name="classParameters">11pt,twoside</xsl:param>
+
+   <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="string">
+      <desc>
+Logo graphics file
+</desc>
+   </doc>
+   <xsl:param name="latexLogo"/>
+
+   <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="output" type="string">
+      <desc>
+URL root where referenced documents are located
+</desc>
+   </doc>
+   <xsl:param name="baseURL"/>
+
+   <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="output" type="boolean">
+      <desc>
+Whether or not to load LaTeX packages which attempt to
+process the UTF-8 characters. Set to "false" if you are
+using XeTeX or similar.
+</desc>
+   </doc>
+   <xsl:param name="reencode">true</xsl:param>
+
+   <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="userpackage" type="string">
+      <desc>
+The name of a LaTeX style package which should be loaded
+</desc>
+   </doc>
+   <xsl:param name="userpackage"/>
+
+   <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="output" type="boolean">
+      <desc>
+Use real name of graphics files rather than pointers
+</desc>
+   </doc>
+   <xsl:param name="realFigures">true</xsl:param>
+
+   <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout">
+      <desc>
+         <p>LaTeX package setup</p>
+         <p>Declaration of the LaTeX packages needed to implement
+    this markup</p>
+      </desc>
+   </doc>
+   <xsl:template name="latexPackages">
+      <xsl:text>
+\usepackage[</xsl:text>
+      <xsl:value-of select="$latexPaperSize"/>
+      <xsl:text>,</xsl:text>
+      <xsl:value-of select="$latexGeometryOptions"/>
+      <xsl:text>]{geometry}
+\usepackage{framed}
+</xsl:text>
+<xsl:text>
+\definecolor{shadecolor}{gray}{0.95}
+\usepackage{longtable}
+\usepackage[normalem]{ulem}
+\usepackage{fancyvrb}
+\usepackage{fancyhdr}
+\usepackage{graphicx}
+</xsl:text>
+<xsl:if test="key('ENDNOTES',1)">
+  \usepackage{endnotes}
+  <xsl:choose>
+    <xsl:when test="key('FOOTNOTES',1)">
+      \def\theendnote{\@alph\c@endnote}
+    </xsl:when>
+    <xsl:otherwise>
+      \def\theendnote{\@arabic\c@endnote}
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:if>
+<xsl:text>
+\def\Gin@extensions{.pdf,.png,.jpg,.mps,.tif}
+</xsl:text>
+<xsl:choose>
+      <xsl:when test="$reencode='true'">
+         <xsl:text>
+\IfFileExists{tipa.sty}{\usepackage{tipa}}{}
+\usepackage{times}
+</xsl:text>
+      </xsl:when>
+</xsl:choose>
+      <xsl:if test="not($userpackage='')">
+  \usepackage{<xsl:value-of select="$userpackage"/>}
+</xsl:if>
+      <xsl:text>
+  \pagestyle{fancy} 
+</xsl:text>
+\usepackage[pdftitle={<xsl:call-template name="generateSimpleTitle"/>},
+ pdfauthor={<xsl:call-template name="generateAuthor"/>}]{hyperref}
+\hyperbaseurl{<xsl:value-of select="$baseURL"/>}
+<xsl:if test="count(key('APP',1))&gt;0">
+\usepackage{ledmac}
+<xsl:call-template name="ledmacOptions"/>
+</xsl:if>
+
+   </xsl:template>
+
+   <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="float">
+      <desc>
+When processing a "pb" element, decide what to generate: "active" generates a page break; "visible" genrates a bracketed number (with scissors), and "bracketsonly" generates a bracketed number (without scissors).
+</desc>
+   </doc>
+   <xsl:param name="pagebreakStyle"/>
+
+   <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="float">
+      <desc>
+When making a table, what width must be constrained to fit,
+as a proportion of the page width.
+</desc>
+   </doc>
+   <xsl:param name="tableMaxWidth">0.85</xsl:param>
+
+   <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="boolean">
+      <desc>
+Whether to number lines of poetry
+</desc>
+   </doc>
+   <xsl:param name="verseNumbering">false</xsl:param>
+
+   <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="integer">
+      <desc>
+When numbering poetry, how often to put in a line number
+</desc>
+   </doc>
+   <xsl:param name="everyHowManyLines">5</xsl:param>
+
+   <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="string">
+      <desc>
+When numbering poetry, when to restart the sequence;
+this must be the name of a TEI element
+</desc>
+   </doc>
+   <xsl:param name="resetVerseLineNumbering">div1</xsl:param>
+
+   <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="userpackage" type="string">
+      <desc>
+Options to pass to the geometry package to set margins etc
+</desc>
+   </doc>
+   <xsl:param name="latexGeometryOptions">twoside,lmargin=1in,rmargin=1in,tmargin=1in,bmargin=1in</xsl:param>
+
+   <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="userpackage" type="string">
+      <desc>
+Depth of nesting of reference documentation when processing ODD
+</desc>
+   </doc>
+   <xsl:param name="specLinkDepth">2</xsl:param>
+
+   <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout">
+      <desc>
+         <p>LaTeX setup</p>
+         <p>The basic LaTeX setup which you should not 
+really tinker with unless you really understand  why and how. Note
+that we need to set up a mapping here for Unicode 8421, 10100 and
+10100 to glyphs for backslash and the two curly brackets, to provide literal
+characters. The normal characters remain active for LaTeX commands.
+Note that if $reencode is set to false, no input or output encoding
+packages are loaded, since it is assumed you are using a TeX variant
+capable of dealing with UTF-8 directly.
+</p>
+      </desc>
+   </doc>
+   <xsl:template name="latexSetup">
+   <xsl:call-template name="latexSetupHook"/>
+\IfFileExists{xcolor.sty}%
+  {\RequirePackage{xcolor}}%
+  {\RequirePackage{color}}
+\usepackage{colortbl}
+      <xsl:choose>
+         <xsl:when test="$reencode='true'">
+\IfFileExists{utf8x.def}%
+ {\usepackage[utf8x]{inputenc}}%
+ {\usepackage[utf8]{inputenc}}
+\PrerenderUnicode{–}
+<xsl:call-template name="latexBabel"/>
+\usepackage[T1]{fontenc}
+\usepackage{float}
+\usepackage[]{ucs}
+\uc@dclc{8421}{default}{\textbackslash }
+\uc@dclc{10100}{default}{\{}
+\uc@dclc{10101}{default}{\}}
+\uc@dclc{8491}{default}{\AA{}}
+\uc@dclc{8239}{default}{\,}
+\uc@dclc{20154}{default}{ }
+\def\textschwa{\rotatebox{-90}{e}}
+\def\textJapanese{}
+\def\textChinese{}
+</xsl:when>
+         <xsl:otherwise>
+\usepackage{fontspec}
+\usepackage{xunicode}
+\catcode`⃥=\active \def⃥{\textbackslash}
+\catcode`❴=\active \def❴{\{}
+\catcode`❵=\active \def❵{\}}
+\def\textJapanese{\fontspec{Kochi Mincho}}
+\def\textChinese{\fontspec{HAN NOM A}\XeTeXlinebreaklocale "zh"\XeTeXlinebreakskip = 0pt plus 1pt }
+\def\textKorean{\fontspec{Baekmuk Gulim} }
+\setmonofont{<xsl:value-of select="$typewriterFont"/>}
+<xsl:if test="not($sansFont='')">
+  \setsansfont{<xsl:value-of select="$sansFont"/>}
+</xsl:if>
+<xsl:if test="not($romanFont='')">
+  \setromanfont{<xsl:value-of select="$romanFont"/>}
+</xsl:if>
+</xsl:otherwise>
+      </xsl:choose>
+\DeclareTextSymbol{\textpi}{OML}{25}
+\usepackage{relsize}
+\def\textsubscript#1{%
+  \@textsubscript{\selectfont#1}}
+\def\@textsubscript#1{%
+  {\m@th\ensuremath{_{\mbox{\fontsize\sf@size\z@#1}}}}}
+\def\textquoted#1{‘#1’}
+\def\textsmall#1{{\small #1}}
+\def\textlarge#1{{\large #1}}
+\def\textoverbar#1{\ensuremath{\overline{#1}}}
+\def\textgothic#1{{\fontspec{<xsl:value-of select="$gothicFont"/>}#1}}
+\def\textcal#1{{\fontspec{<xsl:value-of select="$calligraphicFont"/>}#1}}
+\RequirePackage{array}
+\def\@testpach{\@chclass
+ \ifnum \@lastchclass=6 \@ne \@chnum \@ne \else
+  \ifnum \@lastchclass=7 5 \else
+   \ifnum \@lastchclass=8 \tw@ \else
+    \ifnum \@lastchclass=9 \thr@@
+   \else \z@
+   \ifnum \@lastchclass = 10 \else
+   \edef\@nextchar{\expandafter\string\@nextchar}%
+   \@chnum
+   \if \@nextchar c\z@ \else
+    \if \@nextchar l\@ne \else
+     \if \@nextchar r\tw@ \else
+   \z@ \@chclass
+   \if\@nextchar |\@ne \else
+    \if \@nextchar !6 \else
+     \if \@nextchar @7 \else
+      \if \@nextchar (8 \else
+       \if \@nextchar )9 \else
+  10
+  \@chnum
+  \if \@nextchar m\thr@@\else
+   \if \@nextchar p4 \else
+    \if \@nextchar b5 \else
+   \z@ \@chclass \z@ \@preamerr \z@ \fi \fi \fi \fi
+   \fi \fi  \fi  \fi  \fi  \fi  \fi \fi \fi \fi \fi \fi}
+
+\gdef\arraybackslash{\let\\=\@arraycr}
+\def\textxi{\ensuremath{\xi}}
+\def\Panel#1#2#3#4{\multicolumn{#3}{){\columncolor{#2}}#4}{#1}}
+<xsl:text disable-output-escaping="yes">
+\newcolumntype{L}[1]{){\raggedright\arraybackslash}p{#1}}
+\newcolumntype{C}[1]{){\centering\arraybackslash}p{#1}}
+\newcolumntype{R}[1]{){\raggedleft\arraybackslash}p{#1}}
+\newcolumntype{P}[1]{){\arraybackslash}p{#1}}
+\newcolumntype{B}[1]{){\arraybackslash}b{#1}}
+\newcolumntype{M}[1]{){\arraybackslash}m{#1}}
+\definecolor{label}{gray}{0.75}
+\DeclareRobustCommand*{\xref}{\hyper@normalise\xref@}
+\def\xref@#1#2{\hyper@linkurl{#2}{#1}}
+\def\Div[#1]#2{\section*{#2}}
+\begingroup
+\catcode`\_=\active
+\gdef_#1{\ensuremath{\sb{\mathrm{#1}}}}
+\endgroup
+\mathcode`\_=\string"8000
+\catcode`\_=12\relax
+</xsl:text>
+   </xsl:template>
+
+   <xsl:template name="exampleFontSet">
+      <xsl:choose>
+         <xsl:when test="$reencode='true'">
+            <xsl:text>\ttfamily\small\selectfont </xsl:text>
+         </xsl:when>
+         <xsl:when test="../@xml:lang='zh-TW' or       @xml:lang='zh-TW'">
+            <xsl:text>\fontspec{Arial Unicode MS}\small\selectfont </xsl:text>
+         </xsl:when>
+         <xsl:when test="../@xml:lang='ja' or       @xml:lang='ja'">
+            <xsl:text>\fontspec{Arial Unicode MS}\small\selectfont </xsl:text>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:text>\ttfamily\small\selectfont </xsl:text>
+         </xsl:otherwise>
+      </xsl:choose>
+   </xsl:template>
+
+
+   <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout">
+      <desc>
+         <p>LaTeX babel setup</p>
+         <p>LaTeX loading of babel with options</p>
+      </desc>
+   </doc>
+   <xsl:template name="latexBabel">
+\usepackage[english]{babel}
+</xsl:template>
+
+
+
+<doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout">
+  <desc>
+    <p>LaTeX paper size</p>
+  </desc>
+</doc>
+<xsl:param name="latexPaperSize">a4paper</xsl:param>
+     
+<doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="style" type="string"><desc>Font for literal code</desc>   </doc>
+<xsl:param name="typewriterFont">DejaVu Sans Mono</xsl:param>
+<doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="style" type="string"><desc>Font for sans-serif</desc>   </doc>
+<xsl:param name="sansFont"></xsl:param>
+<doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="style" type="string"><desc>Font for serif</desc>   </doc>
+<xsl:param name="romanFont"></xsl:param>
+<doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="style" type="string"><desc>Font for gothic</desc>   </doc>
+<xsl:param name="gothicFont">Lucida Blackletter</xsl:param>
+<doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="style" type="string"><desc>Font for calligraphic</desc>   </doc>
+<xsl:param name="calligraphicFont">Lucida Calligraphy</xsl:param>
+
+   <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout">
+      <desc>
+         <p>LaTeX layout preamble</p>
+         <p>All the LaTeX setup which affects page layout</p>
+      </desc>
+   </doc>
+   <xsl:template name="latexLayout">
+     <xsl:choose>
+       <xsl:when test="$latexPaperSize='a3paper'">
+	 \paperwidth297mm
+	 \paperheight420mm
+       </xsl:when>
+       <xsl:when test="$latexPaperSize='a5paper'">	
+	 \paperwidth148mm
+	 \paperheight210mm
+       </xsl:when>
+       <xsl:when test="$latexPaperSize='a4paper'">
+	 \paperwidth210mm
+	 \paperheight297mm
+       </xsl:when>
+       <xsl:when test="$latexPaperSize='letterpaper'">
+	 \paperwidth216mm
+	 \paperheight279mm
+       </xsl:when>
+	 <xsl:otherwise>
+	 </xsl:otherwise>
+       </xsl:choose>       
+\def\@pnumwidth{1.55em}
+\def\@tocrmarg {2.55em}
+\def\@dotsep{4.5}
+\setcounter{tocdepth}{3}
+\clubpenalty=8000
+\emergencystretch 3em
+\hbadness=4000
+\hyphenpenalty=400
+\pretolerance=750
+\tolerance=2000
+\vbadness=4000
+\widowpenalty=10000
+<xsl:if test="not($docClass='letter')">
+\renewcommand\section{\@startsection {section}{1}{\z@}%
+     {-1.75ex \@plus -0.5ex \@minus -.2ex}%
+     {0.5ex \@plus .2ex}%
+     {\reset@font\Large\bfseries\sffamily}}
+\renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
+     {-1.75ex\@plus -0.5ex \@minus- .2ex}%
+     {0.5ex \@plus .2ex}%
+     {\reset@font\Large\sffamily}}
+\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
+     {-1.5ex\@plus -0.35ex \@minus -.2ex}%
+     {0.5ex \@plus .2ex}%
+     {\reset@font\large\sffamily}}
+\renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
+     {-1ex \@plus-0.35ex \@minus -0.2ex}%
+     {0.5ex \@plus .2ex}%
+     {\reset@font\normalsize\sffamily}}
+\renewcommand\subparagraph{\@startsection{subparagraph}{5}{\parindent}%
+     {1.5ex \@plus1ex \@minus .2ex}%
+     {-1em}%
+     {\reset@font\normalsize\bfseries}}
+
+</xsl:if>
+\def\l@section#1#2{\addpenalty{\@secpenalty} \addvspace{1.0em plus 1pt}
+ \@tempdima 1.5em \begingroup
+ \parindent \z@ \rightskip \@pnumwidth 
+ \parfillskip -\@pnumwidth 
+ \bfseries \leavevmode #1\hfil \hbox to\@pnumwidth{\hss #2}\par
+ \endgroup}
+\def\l@subsection{\@dottedtocline{2}{1.5em}{2.3em}}
+\def\l@subsubsection{\@dottedtocline{3}{3.8em}{3.2em}}
+\def\l@paragraph{\@dottedtocline{4}{7.0em}{4.1em}}
+\def\l@subparagraph{\@dottedtocline{5}{10em}{5em}}
+\@ifundefined{c@section}{\newcounter{section}}{}
+\@ifundefined{c@chapter}{\newcounter{chapter}}{}
+\newif\if@mainmatter 
+\@mainmattertrue
+\def\chaptername{Chapter}
+\def\frontmatter{%
+  \pagenumbering{roman}
+  \def\thechapter{\@roman\c@chapter}
+  \def\theHchapter{\alph{chapter}}
+  \def\@chapapp{}%
+}
+\def\mainmatter{%
+  \cleardoublepage
+  \def\thechapter{\@arabic\c@chapter}
+  \setcounter{chapter}{0}
+  \setcounter{section}{0}
+  \pagenumbering{arabic}
+  \setcounter{secnumdepth}{6}
+  \def\@chapapp{\chaptername}%
+  \def\theHchapter{\arabic{chapter}}
+}
+\def\backmatter{%
+  \cleardoublepage
+  \setcounter{chapter}{0}
+  \setcounter{section}{0}
+  \setcounter{secnumdepth}{0}
+  \def\@chapapp{\appendixname}%
+  \def\thechapter{\@Alph\c@chapter}
+  \def\theHchapter{\Alph{chapter}}
+  \appendix
+}
+\newenvironment{bibitemlist}[1]{%
+   \list{\@biblabel{\@arabic\c@enumiv}}%
+       {\settowidth\labelwidth{\@biblabel{#1}}%
+        \leftmargin\labelwidth
+        \advance\leftmargin\labelsep
+        \@openbib@code
+        \usecounter{enumiv}%
+        \let\p@enumiv\@empty
+        \renewcommand\theenumiv{\@arabic\c@enumiv}%
+	}%
+  \sloppy
+  \clubpenalty4000
+  \@clubpenalty \clubpenalty
+  \widowpenalty4000%
+  \sfcode`\.\@m}%
+  {\def\@noitemerr
+    {\@latex@warning{Empty `bibitemlist' environment}}%
+    \endlist}
+
+\def\tableofcontents{\section*{\contentsname}\@starttoc{toc}}
+\parskip<xsl:value-of select="$parSkip"/>
+\parindent<xsl:value-of select="$parIndent"/>
+\def\Panel#1#2#3#4{\multicolumn{#3}{){\columncolor{#2}}#4}{#1}}
+\newenvironment{reflist}{%
+  \begin{raggedright}\begin{list}{}
+  {%
+   \setlength{\topsep}{0pt}%
+   \setlength{\rightmargin}{0.25in}%
+   \setlength{\itemsep}{0pt}%
+   \setlength{\itemindent}{0pt}%
+   \setlength{\parskip}{0pt}%
+   \setlength{\parsep}{2pt}%
+   \def\makelabel##1{\itshape ##1}}%
+  }
+  {\end{list}\end{raggedright}}
+\newenvironment{sansreflist}{%
+  \begin{raggedright}\begin{list}{}
+  {%
+   \setlength{\topsep}{0pt}%
+   \setlength{\rightmargin}{0.25in}%
+   \setlength{\itemindent}{0pt}%
+   \setlength{\parskip}{0pt}%
+   \setlength{\itemsep}{0pt}%
+   \setlength{\parsep}{2pt}%
+   \def\makelabel##1{\upshape\sffamily ##1}}%
+  }
+  {\end{list}\end{raggedright}}
+\newenvironment{specHead}[2]%
+ {\vspace{20pt}\hrule\vspace{10pt}%
+  \hypertarget{#1}{}%
+  \markright{#2}%
+<xsl:text>
+  \pdfbookmark[</xsl:text>
+      <xsl:value-of select="$specLinkDepth"/>
+      <xsl:text>]{#2}{#1}%
+  \hspace{-0.75in}{\bfseries\fontsize{16pt}{18pt}\selectfont#2}%
+  }{}
+      </xsl:text>   
+      <xsl:call-template name="latexPreambleHook"/>
+   </xsl:template>
+
+   <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout">
+      <desc>
+         <p>LaTeX setup commands for ledmac package</p>
+      </desc>
+   </doc>
+<xsl:template name="ledmacOptions">
+\renewcommand{\notenumfont}{\bfseries}
+\lineation{page}
+\linenummargin{inner}
+\footthreecol{A}
+\foottwocol{B}
+</xsl:template>
+
+   <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout">
+      <desc>
+         <p>LaTeX setup before start of document</p>
+         <p>All the LaTeX setup which are executed before the start of
+    the document</p>
+      </desc>
+   </doc>
+   <xsl:template name="latexBegin">
+      <xsl:text>
+\makeatletter
+\thispagestyle{empty}
+\markright{\@title}\markboth{\@title}{\@author}
+\renewcommand\small{\@setfontsize\small{9pt}{11pt}\abovedisplayskip 8.5\p@ plus3\p@ minus4\p@
+\belowdisplayskip \abovedisplayskip
+\abovedisplayshortskip \z@ plus2\p@
+\belowdisplayshortskip 4\p@ plus2\p@ minus2\p@
+\def\@listi{\leftmargin\leftmargini
+               \topsep 2\p@ plus1\p@ minus1\p@
+               \parsep 2\p@ plus\p@ minus\p@
+               \itemsep 1pt}
+}
+\makeatother
+\fvset{frame=single,numberblanklines=false,xleftmargin=5mm,xrightmargin=5mm}
+\fancyhf{} 
+\setlength{\headheight}{14pt}
+\fancyhead[LE]{\bfseries\leftmark} 
+\fancyhead[RO]{\bfseries\rightmark} 
+\fancyfoot[RO]{}
+\fancyfoot[CO]{\thepage}
+\fancyfoot[LO]{\TheID}
+\fancyfoot[LE]{}
+\fancyfoot[CE]{\thepage}
+\fancyfoot[RE]{\TheID}
+\hypersetup{linkbordercolor=0.75 0.75 0.75,urlbordercolor=0.75 0.75 0.75,bookmarksnumbered=true}
+\fancypagestyle{plain}{\fancyhead{}\renewcommand{\headrulewidth}{0pt}}</xsl:text>
+   </xsl:template>
+
+   <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout">
+      <desc>
+         <p>LaTeX setup at end of document</p>
+         <p>All the LaTeX setup which are executed at the end of
+    the document</p>
+      </desc>
+   </doc>
+   <xsl:template name="latexEnd">
+</xsl:template>
+
+   <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[latex] Title banner </desc>
+   </doc>
+   <xsl:template name="printTitleAndLogo">
+\makeatletter
+\noindent\parbox[b]{.75\textwidth}{\fontsize{14pt}{16pt}\bfseries\raggedright\sffamily\selectfont \@title}
+\vskip20pt
+\par\noindent{\fontsize{11pt}{13pt}\sffamily\itshape\raggedright\selectfont\@author\hfill\TheDate}
+\vspace{18pt}
+\makeatother
+</xsl:template>
+
+  
+
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/latex2/tei-param.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/latex2/tei.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/latex2/tei.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/latex2/tei.xsl	(revision 258)
@@ -0,0 +1,172 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:s="http://www.ascc.net/xml/schematron"
+		xmlns:xs="http://www.w3.org/2001/XMLSchema"                
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                exclude-result-prefixes="s xs tei"
+                version="2.0">
+  <xsl:import href="../common2/tei.xsl"/>
+  <xsl:import href="tei-param.xsl"/>
+  <xsl:import href="../common2/verbatim.xsl"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p>
+    TEI stylesheet for making LaTeX output.
+      </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: tei.xsl 10197 2012-03-28 21:44:10Z rahtz $</p>
+         <p>Copyright: 2011, TEI Consortium</p>
+      </desc>
+   </doc>
+  <xsl:output method="text" encoding="utf8"/>
+  <xsl:strip-space elements="*"/>
+  <xsl:preserve-space elements="tei:hi tei:emph tei:foreign tei:p"/>
+  <xsl:include href="core.xsl"/>
+  <xsl:include href="corpus.xsl"/>
+  <xsl:include href="drama.xsl"/>
+  <xsl:include href="figures.xsl"/>
+  <xsl:include href="header.xsl"/>
+  <xsl:include href="linking.xsl"/>
+  <xsl:include href="namesdates.xsl"/>
+  <xsl:include href="tagdocs.xsl"/>
+  <xsl:include href="textstructure.xsl"/>
+  <xsl:include href="transcr.xsl"/>
+  <xsl:include href="verse.xsl"/>
+  <xsl:include href="textcrit.xsl"/>
+
+  <xsl:param name="startNamespace">\color{red}</xsl:param>
+  <xsl:param name="startElement">{</xsl:param>
+  <xsl:param name="highlightStartElementName">\textcolor{red}{</xsl:param>
+  <xsl:param name="highlightEndElementName">}</xsl:param>
+  <xsl:param name="startElementName">\textbf{</xsl:param>
+  <xsl:param name="startAttribute">{</xsl:param>
+  <xsl:param name="startAttributeValue">{</xsl:param>
+  <xsl:param name="startComment">\begin{it}</xsl:param>
+  <xsl:param name="endElement">}</xsl:param>
+  <xsl:param name="endElementName">}</xsl:param>
+  <xsl:param name="endComment">\end{it}</xsl:param>
+  <xsl:param name="endAttribute">}</xsl:param>
+  <xsl:param name="endAttributeValue">}</xsl:param>
+  <xsl:param name="endNamespace"/>
+  <xsl:param name="spaceCharacter">\hspace*{6pt}</xsl:param>
+  <xsl:variable name="docClass">
+      <xsl:choose>
+         <xsl:when test="/tei:TEI[@rend='letter']">
+            <xsl:text>letter</xsl:text>
+         </xsl:when>
+         <xsl:when test="/tei:TEI[@rend='book']">
+            <xsl:text>book</xsl:text>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:text>article</xsl:text>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:variable>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process elements  processing-instruction()[name(.)='tex']</desc>
+   </doc>
+  <xsl:template match="processing-instruction()[name(.)='tex']">
+      <xsl:value-of select="."/>
+  </xsl:template>
+
+  <xsl:template name="verbatim-lineBreak">
+      <xsl:param name="id"/>
+      <xsl:text>\mbox{}\newline 
+</xsl:text>
+  </xsl:template>
+
+  <xsl:template name="verbatim-createElement">
+      <xsl:param name="name"/>
+      <xsl:param name="special"/>
+      <xsl:text>\textbf{</xsl:text>
+      <xsl:value-of select="$name"/>
+      <xsl:text>}</xsl:text>
+  </xsl:template>
+
+  <xsl:template name="verbatim-newLine"/>
+
+  <xsl:template name="verbatim-createAttribute">
+      <xsl:param name="name"/>
+      <xsl:value-of select="$name"/>
+  </xsl:template>
+
+  <xsl:template name="verbatim-Text">
+      <xsl:param name="words"/>
+      <xsl:choose>
+         <xsl:when test="parent::*/@xml:lang='zh-TW'">
+	           <xsl:text>{\textChinese </xsl:text>
+		   <xsl:value-of select="tei:escapeCharsVerbatim($words)"/>
+	           <xsl:text>}</xsl:text>
+         </xsl:when>
+         <xsl:when test="parent::*/@xml:lang='ja'">
+	           <xsl:text>{\textJapanese </xsl:text>
+		   <xsl:value-of select="tei:escapeCharsVerbatim($words)"/>
+	           <xsl:text>}</xsl:text>
+         </xsl:when>
+         <xsl:when test="parent::*/@xml:lang='kr'">
+	           <xsl:text>{\textKorean </xsl:text>
+		   <xsl:value-of select="tei:escapeCharsVerbatim($words)"/>
+	           <xsl:text>}</xsl:text>
+         </xsl:when>
+         <xsl:otherwise>
+	   <xsl:value-of select="tei:escapeCharsVerbatim($words)"/>
+         </xsl:otherwise>
+      </xsl:choose>
+
+  </xsl:template>
+
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc><p>We need the backslash and two curly braces to insert LaTeX
+      commands into the output, so these characters need to replaced when they
+      are found in running text. </p></desc>
+  </doc>
+  <xsl:function name="tei:escapeCharsVerbatim" as="xs:string">
+    <xsl:param name="letters"/>
+    <xsl:value-of select="translate($letters, '\{}','⃥❴❵')"/>
+  </xsl:function>
+
+  <xsl:function name="tei:escapeChars" as="xs:string">
+    <xsl:param name="letters"/>
+      <xsl:value-of
+	  select="replace(replace(replace(replace(translate($letters,'&#10;',' '), 
+		  '\\','\\textbackslash '),
+		  '\{','\\{'),
+		  '\}','\\}'),
+		  '~','\\textasciitilde ')"/>
+  </xsl:function>
+
+
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/latex2/tei.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/latex2/drama.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/latex2/drama.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/latex2/drama.xsl	(revision 258)
@@ -0,0 +1,193 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
+                xmlns:rng="http://relaxng.org/ns/structure/1.0"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"
+                
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                exclude-result-prefixes="a rng tei teix"
+                version="2.0">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet dealing with elements from the drama module,
+      making LaTeX output. </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: drama.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2011, TEI Consortium</p>
+      </desc>
+   </doc>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element actor</desc>
+   </doc>
+  <xsl:template match="tei:actor">
+      <xsl:text>\textit{</xsl:text>
+      <xsl:apply-templates/>
+      <xsl:text>}</xsl:text>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element camera</desc>
+   </doc>
+  <xsl:template match="tei:camera">
+      <xsl:text>\textit{</xsl:text>
+      <xsl:apply-templates/>
+      <xsl:text>}</xsl:text>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element caption</desc>
+   </doc>
+  <xsl:template match="tei:caption">
+      <xsl:text>\textit{</xsl:text>
+      <xsl:apply-templates/>
+      <xsl:text>}</xsl:text>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element castGroup</desc>
+   </doc>
+  <xsl:template match="tei:castGroup"> 
+      <xsl:text>\begin{itemize} </xsl:text>
+      <xsl:apply-templates/>
+      <xsl:text>&#10;\end{itemize}</xsl:text>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element castItem</desc>
+   </doc>
+  <xsl:template match="tei:castItem">
+    <xsl:text>&#10;\item </xsl:text>
+    <xsl:apply-templates/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element castList</desc>
+   </doc>
+  <xsl:template match="tei:castList">
+      <xsl:if test="tei:head">
+         <xsl:text> \par\textit{</xsl:text>
+         <xsl:for-each select="tei:head">
+            <xsl:apply-templates/>
+         </xsl:for-each>
+         <xsl:text>}&#10;</xsl:text>
+      </xsl:if> 
+      <xsl:text>\begin{itemize} </xsl:text>
+      <xsl:apply-templates/> 
+      <xsl:text>\end{itemize} </xsl:text>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process elementp/tei:stage</desc>
+   </doc>
+  <xsl:template match="tei:p/tei:stage">
+      <xsl:text>\textit{</xsl:text>
+      <xsl:apply-templates/>
+      <xsl:text>}</xsl:text>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element role</desc>
+   </doc>
+  <xsl:template match="tei:role">
+      <xsl:text>\textbf{</xsl:text>
+      <xsl:apply-templates/>
+      <xsl:text>}</xsl:text>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element roleDesc</desc>
+   </doc>
+  <xsl:template match="tei:roleDesc">
+      <xsl:text>\begin{quote}</xsl:text>
+      <xsl:apply-templates/>
+      <xsl:text>\end{quote}</xsl:text>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element set</desc>
+   </doc>
+  <xsl:template match="tei:set">
+      <xsl:text>\textit{</xsl:text>
+      <xsl:apply-templates/>
+      <xsl:text>}</xsl:text>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element sound</desc>
+   </doc>
+  <xsl:template match="tei:sound">
+      <xsl:text>\textit{</xsl:text>
+      <xsl:apply-templates/>
+      <xsl:text>}</xsl:text>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element sp</desc>
+   </doc>
+  <xsl:template match="tei:sp"> \begin{description} \item[<xsl:apply-templates select="tei:speaker"/>] <xsl:apply-templates select="tei:p | tei:l | tei:lg | tei:seg |      tei:ab | tei:stage"/>
+      <xsl:text>\end{description}
+</xsl:text>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element sp/tei:p</desc>
+   </doc>
+  <xsl:template match="tei:sp/tei:p">
+    <xsl:text>&#10;&#10;</xsl:text>
+      <xsl:apply-templates/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element stage</desc>
+   </doc>
+  <xsl:template match="tei:stage">
+      <xsl:text>&#10;\par&#10;</xsl:text>
+      <xsl:text>\textit{</xsl:text>
+      <xsl:apply-templates/>
+      <xsl:text>}\par </xsl:text>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element sp/tei:stage</desc>
+   </doc>
+  <xsl:template match="tei:sp/tei:stage">
+      <xsl:text/>
+      <xsl:text>\textit{</xsl:text>
+      <xsl:apply-templates/>
+      <xsl:text>} </xsl:text>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element tech</desc>
+   </doc>
+  <xsl:template match="tei:tech">
+      <xsl:text>\textit{</xsl:text>
+      <xsl:apply-templates/>
+      <xsl:text>}</xsl:text>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element view</desc>
+   </doc>
+  <xsl:template match="tei:view">
+      <xsl:text>\textit{</xsl:text>
+      <xsl:apply-templates/>
+      <xsl:text>}</xsl:text>
+  </xsl:template>
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/latex2/drama.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/latex2/figures.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/latex2/figures.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/latex2/figures.xsl	(revision 258)
@@ -0,0 +1,412 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
+                xmlns:rng="http://relaxng.org/ns/structure/1.0"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"
+                xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                exclude-result-prefixes="a rng tei teix"
+                version="2.0">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet dealing with elements from the figures module,
+      making LaTeX output. </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: figures.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2011, TEI Consortium</p>
+      </desc>
+   </doc>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element cell</desc>
+   </doc>
+  <xsl:template match="tei:cell">
+      <xsl:if test="preceding-sibling::tei:cell">\tabcellsep </xsl:if>
+      <xsl:choose>
+         <xsl:when test="@role='label'">
+            <xsl:text>\Panel{</xsl:text>
+            <xsl:if test="starts-with(normalize-space(.),'[')">
+               <xsl:text>{}</xsl:text>
+            </xsl:if>
+            <xsl:apply-templates/>
+            <xsl:text>}{label}{</xsl:text>
+            <xsl:choose>
+               <xsl:when test="@cols">
+                  <xsl:value-of select="@cols"/>
+               </xsl:when>
+               <xsl:otherwise>1</xsl:otherwise>
+            </xsl:choose>
+            <xsl:text>}{</xsl:text>
+            <xsl:choose>
+               <xsl:when test="@align='right'">r</xsl:when>
+               <xsl:when test="@align='centre'">c</xsl:when>
+               <xsl:when test="@align='center'">c</xsl:when>
+               <xsl:when test="@align='left'">l</xsl:when>
+               <xsl:otherwise>l</xsl:otherwise>
+            </xsl:choose>
+            <xsl:text>}</xsl:text>
+         </xsl:when>
+         <xsl:when test="@cols &gt; 1">
+            <xsl:text>\multicolumn{</xsl:text>
+            <xsl:value-of select="@cols"/>
+            <xsl:text>}{</xsl:text>
+	    <xsl:if test="@role='label' or
+			  parent::tei:row/@role='label'">
+	      <xsl:text>){\columncolor{label}}</xsl:text>
+	    </xsl:if>
+            <xsl:choose>
+               <xsl:when test="@align='right'">r</xsl:when>
+               <xsl:when test="@align='centre'">c</xsl:when>
+               <xsl:when test="@align='center'">c</xsl:when>
+               <xsl:when test="@align='left'">l</xsl:when>
+               <xsl:otherwise>l</xsl:otherwise>
+            </xsl:choose>
+	    <xsl:text>}{</xsl:text>
+            <xsl:apply-templates/>
+            <xsl:text>}</xsl:text>
+         </xsl:when>
+	 <xsl:when test="@align">
+            <xsl:text>\multicolumn{1}{</xsl:text>
+	    <xsl:if test="@role='label' or
+			  parent::tei:row/@role='label'">
+	      <xsl:text>){\columncolor{label}}</xsl:text>
+	    </xsl:if>
+            <xsl:choose>
+               <xsl:when test="@align='right'">r</xsl:when>
+               <xsl:when test="@align='centre'">c</xsl:when>
+               <xsl:when test="@align='center'">c</xsl:when>
+               <xsl:when test="@align='left'">l</xsl:when>
+               <xsl:otherwise>l</xsl:otherwise>
+            </xsl:choose>
+	    <xsl:text>}{</xsl:text>
+            <xsl:apply-templates/>
+            <xsl:text>}</xsl:text>
+	 </xsl:when>
+         <xsl:otherwise>
+            <xsl:if test="starts-with(normalize-space(.),'[')">
+               <xsl:text>{}</xsl:text>
+            </xsl:if>
+            <xsl:apply-templates/>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element figDesc</desc>
+   </doc>
+  <xsl:template match="tei:figDesc"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element figure</desc>
+   </doc>
+  <xsl:template match="tei:figure">
+      <xsl:call-template name="makeFigureStart"/>
+      <xsl:apply-templates/>
+      <xsl:call-template name="makeFigureEnd"/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element graphic</desc>
+   </doc>
+  <xsl:template match="tei:graphic">
+      <xsl:call-template name="makePic"/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element row</desc>
+   </doc>
+  <xsl:template match="tei:row">
+      <xsl:if test="@role='label'">\rowcolor{label}</xsl:if>
+      <xsl:apply-templates/>
+      <xsl:if test="following-sibling::tei:row">
+         <xsl:text>\\</xsl:text>
+         <xsl:if test="@role='label' or parent::tei:table/@rend='rules'">\hline </xsl:if>
+         <xsl:text>&#10;</xsl:text>
+      </xsl:if>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element table</desc>
+   </doc>
+  <xsl:template match="tei:table" mode="xref">
+      <xsl:text>the table on p. \pageref{</xsl:text>
+      <xsl:value-of select="@xml:id"/>
+      <xsl:text>}</xsl:text>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element table</desc>
+   </doc>
+  <xsl:template match="tei:table">
+      <xsl:if test="@xml:id">
+         <xsl:text>\label{</xsl:text>
+         <xsl:value-of select="@xml:id"/>
+         <xsl:text>}</xsl:text>
+      </xsl:if>
+      <xsl:text> \par </xsl:text>
+      <xsl:choose>
+         <xsl:when test="ancestor::tei:table"> 
+	           <xsl:text>\begin{tabular}</xsl:text>
+	           <xsl:call-template name="makeTable"/> 
+	           <xsl:text>\end{tabular}</xsl:text>
+         </xsl:when>
+         <xsl:otherwise> 
+	           <xsl:text>&#10;\begin{longtable}</xsl:text>
+	           <xsl:call-template name="makeTable"/>
+	           <xsl:text>\end{longtable} \par&#10; </xsl:text>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element table[@rend='display']</desc>
+   </doc>
+  <xsl:template match="tei:table[@rend='display']" mode="xref">
+      <xsl:text>Table </xsl:text>
+      <xsl:number count="tei:table[@rend='display']" level="any"/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element table[@rend='display']</desc>
+   </doc>
+  <xsl:template match="tei:table[@rend='display']">
+      <xsl:text>\begin{table}</xsl:text>
+      <xsl:text>\begin{center} \begin{small} \begin{tabular}</xsl:text>
+      <xsl:call-template name="makeTable"/> 
+     <xsl:text>\end{tabular} 
+      \caption{</xsl:text>
+      <xsl:if test="@xml:id">\label{<xsl:value-of select="@xml:id"/>}</xsl:if>
+      <xsl:apply-templates mode="ok" select="tei:head"/>
+      <xsl:text>}
+     \end{small} 
+     \end{center}
+     \end{table}</xsl:text>
+     </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[latex] Make figure (start)</desc>
+   </doc>
+  <xsl:template name="makeFigureStart">
+      <xsl:choose>
+	<xsl:when test="@place='inline' and tei:head">
+            <xsl:text>\begin{figure}[H]&#10;</xsl:text>
+	</xsl:when>
+	<xsl:when test="@rend='display' or not(@place='inline') or tei:head or tei:p">
+	  <xsl:text>\begin{figure}[htbp]&#10;</xsl:text>
+	</xsl:when>
+      </xsl:choose>
+      <xsl:choose>
+	<xsl:when test="@rend='center'">
+	  <xsl:text>\begin{center}</xsl:text>
+	</xsl:when>
+	<xsl:otherwise>\noindent</xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[latex] Make figure (end)</desc>
+   </doc>
+  <xsl:template name="makeFigureEnd">
+      <xsl:choose>
+         <xsl:when test="tei:head or tei:p">
+            <xsl:text>&#10;\caption{</xsl:text>
+            <xsl:if test="@xml:id">\label{<xsl:value-of select="@xml:id"/>}</xsl:if>
+            <xsl:for-each select="tei:head">
+	      <xsl:apply-templates/>
+	    </xsl:for-each>
+            <xsl:text>}</xsl:text>
+         </xsl:when>
+      </xsl:choose>
+      <xsl:if test="@rend='center'">
+            <xsl:text>\end{center}</xsl:text>
+      </xsl:if>
+      <xsl:choose>
+	<xsl:when test="@place='inline' and tei:head">
+            <xsl:text>\end{figure}&#10;</xsl:text>
+	</xsl:when>
+         <xsl:when test="@rend='display' or not(@place='inline')">
+	   <xsl:text>\end{figure}&#10;</xsl:text>
+         </xsl:when>
+      </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[latex] Make picture</desc>
+   </doc>
+  <xsl:template name="makePic">
+      <xsl:if test="@xml:id">\hypertarget{<xsl:value-of
+      select="@xml:id"/>}{}</xsl:if>
+      <xsl:choose>
+	<xsl:when test="@rend='noindent'">
+	  <xsl:text>\noindent</xsl:text>
+	</xsl:when>
+	<xsl:when test="not(preceding-sibling::*)">
+	  <xsl:text>\noindent</xsl:text>
+	</xsl:when>
+      </xsl:choose>
+      <xsl:text>\includegraphics[</xsl:text>
+      <xsl:call-template name="graphicsAttributes">
+         <xsl:with-param name="mode">latex</xsl:with-param>
+      </xsl:call-template>
+      <xsl:text>]{</xsl:text>
+      <xsl:choose>
+         <xsl:when test="$realFigures='true'">
+            <xsl:choose>
+               <xsl:when test="@url">
+                  <xsl:value-of select="@url"/>
+               </xsl:when>
+               <xsl:when test="@entity">
+                  <xsl:value-of select="unparsed-entity-uri(@entity)"/>
+               </xsl:when>
+            </xsl:choose>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:variable name="c">
+               <xsl:for-each select="ancestor-or-self::tei:figure[1]">
+                  <xsl:number level="any"/>
+               </xsl:for-each>
+            </xsl:variable>
+            <xsl:text>FIG</xsl:text>
+            <xsl:value-of select="$c+1000"/>
+         </xsl:otherwise>
+      </xsl:choose>
+      <xsl:text>}</xsl:text>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[latex] </desc>
+   </doc>
+  <xsl:template name="makeTable">
+      <xsl:variable name="r">
+         <xsl:value-of select="@rend"/>
+      </xsl:variable>
+      <xsl:text>{</xsl:text>
+      <xsl:if test="contains($r,'rules')">|</xsl:if>
+      <xsl:choose>
+         <xsl:when test="@preamble">
+            <xsl:value-of select="@preamble"/>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:call-template name="makePreamble-complex">
+               <xsl:with-param name="r" select="$r"/>
+            </xsl:call-template>
+         </xsl:otherwise>
+      </xsl:choose>
+      <xsl:text>}&#10;</xsl:text>
+      <xsl:if test="contains($r,'rules') or tei:head">
+	<xsl:call-template name="tableHline"/>
+      </xsl:if>
+      <xsl:choose>
+         <xsl:when test="tei:head and not(@rend='display')">
+            <xsl:if test="not(ancestor::tei:table)">
+               <xsl:text>\endfirsthead </xsl:text>
+               <xsl:text>\multicolumn{</xsl:text>
+               <xsl:value-of select="count(tei:row[1]/tei:cell)"/>
+               <xsl:text>}{c}{</xsl:text>
+               <xsl:apply-templates mode="ok" select="tei:head"/>
+               <xsl:text>(cont.)}\\\hline \endhead </xsl:text>
+            </xsl:if>
+            <xsl:text>\caption{</xsl:text>
+            <xsl:apply-templates mode="ok" select="tei:head"/>
+            <xsl:text>}\\ </xsl:text>
+         </xsl:when>
+         <xsl:otherwise> </xsl:otherwise>
+      </xsl:choose>
+      <xsl:if test="contains($r,'rules') or tei:row[1][@role='label']">\hline </xsl:if>
+      <xsl:apply-templates/>
+      <xsl:if test="contains($r,'rules')">
+         <xsl:text>\\ \hline </xsl:text>
+      </xsl:if>
+  </xsl:template>
+
+   <xsl:template name="tableHline">
+      <xsl:choose>
+         <xsl:when test="ancestor::tei:table or @rend='display'"> \hline </xsl:when>
+         <xsl:otherwise> \hline\endfoot\hline\endlastfoot </xsl:otherwise>
+      </xsl:choose>
+   </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[latex] </desc>
+   </doc>
+  <xsl:template name="makePreamble-complex">
+      <xsl:param name="r"/>
+      <xsl:variable name="valign">
+         <xsl:choose>
+	   <xsl:when test="contains($r,'bottomAlign')">B</xsl:when>
+	   <xsl:when test="contains($r,'midAlign')">M</xsl:when>
+	   <xsl:otherwise>P</xsl:otherwise>
+         </xsl:choose>
+      </xsl:variable>
+      <xsl:variable name="tds">
+	<xsl:for-each select="tei:row">
+	  <xsl:variable name="row">
+	    <xsl:for-each select="tei:cell">
+	      <xsl:variable name="stuff">
+		<xsl:apply-templates/>
+	      </xsl:variable>
+	      <cell>
+		<xsl:value-of select="string-length($stuff)"/>
+	      </cell>
+	      <xsl:if test="@cols">
+		<xsl:variable name="c" select="xs:integer(@cols) - 1 "/>
+		<xsl:for-each select="1 to $c">
+		  <cell>0</cell>
+		</xsl:for-each>
+	      </xsl:if>
+	    </xsl:for-each>
+	  </xsl:variable>
+	  <xsl:for-each select="$row/cell">
+	    <cell col="{position()}">
+	      <xsl:value-of select="."/>
+	    </cell>
+	  </xsl:for-each>
+	</xsl:for-each>
+      </xsl:variable>
+      <xsl:variable name="total">
+	<xsl:value-of select="sum($tds/cell)"/>
+      </xsl:variable>
+      <xsl:for-each select="$tds/cell">
+	<xsl:variable name="c" select="@col"/>
+	<xsl:if test="not(preceding-sibling::cell[$c=@col])">
+	  <xsl:variable name="len">
+	    <xsl:value-of select="sum(following-sibling::cell[$c=@col]) + current()"/>
+	  </xsl:variable>
+	  <xsl:value-of select="$valign"/>
+	  <xsl:text>{</xsl:text>
+	  <xsl:value-of select="($len div $total) * $tableMaxWidth"/>
+	  <xsl:text>\textwidth}</xsl:text>
+	  <xsl:if test="contains($r,'rules')">|</xsl:if>
+	</xsl:if>
+      </xsl:for-each>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[latex] </desc>
+   </doc>
+  <xsl:template name="makePreamble-simple">
+      <xsl:param name="r"/>
+      <xsl:for-each select="tei:row[1]/tei:cell">
+         <xsl:text>l</xsl:text>
+         <xsl:if test="contains($r,'rules')">|</xsl:if>
+      </xsl:for-each>
+  </xsl:template>
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/latex2/figures.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/latex2/namesdates.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/latex2/namesdates.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/latex2/namesdates.xsl	(revision 258)
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
+                xmlns:rng="http://relaxng.org/ns/structure/1.0"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"
+                
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                exclude-result-prefixes="a rng tei teix"
+                version="2.0">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet dealing with elements from the namesdates module,
+      making LaTeX output. </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: namesdates.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2011, TEI Consortium</p>
+      </desc>
+   </doc>
+  <xsl:template match="tei:listPerson">
+    \begin{enumerate}
+      <xsl:apply-templates/>
+      \end{enumerate}
+  </xsl:template>
+
+  <xsl:template match="tei:person">
+    \item <xsl:apply-templates/>
+  </xsl:template>
+
+  <xsl:template match="tei:affiliation">
+      <xsl:text>\mbox{}\\ </xsl:text>
+      <xsl:apply-templates/>
+  </xsl:template>
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/latex2/namesdates.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/latex2/tagdocs.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/latex2/tagdocs.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/latex2/tagdocs.xsl	(revision 258)
@@ -0,0 +1,360 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
+                xmlns:s="http://www.ascc.net/xml/schematron"
+                xmlns:rng="http://relaxng.org/ns/structure/1.0"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"
+                
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                exclude-result-prefixes="s a rng tei teix"
+                version="2.0">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet dealing with elements from the tagdocs module,
+      making LaTeX output. </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: tagdocs.xsl 10197 2012-03-28 21:44:10Z rahtz $</p>
+         <p>Copyright: 2011, TEI Consortium</p>
+      </desc>
+   </doc>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element gi</desc>
+   </doc>
+  <xsl:template match="tei:gi">
+      <xsl:text>\texttt{&lt;</xsl:text>
+      <xsl:apply-templates/>
+      <xsl:text>&gt;}</xsl:text>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element val</desc>
+   </doc>
+  <xsl:template match="tei:val">
+      <xsl:value-of select="$preQuote"/>
+      <xsl:apply-templates/>
+      <xsl:value-of select="$postQuote"/>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element att</desc>
+   </doc>
+  <xsl:template match="tei:att">
+      <xsl:text>\textbf{@</xsl:text>
+      <xsl:apply-templates/>
+      <xsl:text>}</xsl:text>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Example element</desc>
+   </doc>
+
+  <xsl:template match="teix:egXML">
+      <xsl:param name="simple">false</xsl:param>
+      <xsl:param name="highlight"/>
+      <xsl:choose>
+         <xsl:when test="parent::tei:cell">
+	           <xsl:text>\leavevmode\bgroup</xsl:text>
+	           <xsl:call-template name="egXMLStartHook"/>
+	           <xsl:call-template name="exampleFontSet"/>
+	           <xsl:text>\begin{shaded}</xsl:text>
+	           <xsl:apply-templates mode="verbatim">
+	              <xsl:with-param name="highlight">
+	                 <xsl:value-of select="$highlight"/>
+	              </xsl:with-param>
+	           </xsl:apply-templates>
+	           <xsl:text>\end{shaded}</xsl:text>
+	           <xsl:call-template name="egXMLEndHook"/>
+	           <xsl:text>\egroup &#10;&#10;</xsl:text>
+         </xsl:when>
+         <xsl:otherwise>
+	           <xsl:text>\par\bgroup</xsl:text>
+	           <xsl:call-template name="egXMLStartHook"/>
+	           <xsl:call-template name="exampleFontSet"/>
+	           <xsl:text>\begin{shaded}\noindent\mbox{}</xsl:text>
+	           <xsl:apply-templates mode="verbatim">
+	              <xsl:with-param name="highlight">
+	                 <xsl:value-of select="$highlight"/>
+	              </xsl:with-param>
+	           </xsl:apply-templates>
+	           <xsl:text>\end{shaded}</xsl:text>
+	           <xsl:call-template name="egXMLEndHook"/>
+	           <xsl:text>\egroup\par </xsl:text>
+	           <xsl:if test="parent::tei:p and following-sibling::node()">\noindent </xsl:if>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+
+   <xsl:template name="egXMLStartHook"/>
+   <xsl:template name="egXMLEndHook"/>
+
+   <xsl:template match="tei:seg[@rend='specChildren']">
+      <xsl:choose>
+         <xsl:when test=".//tei:seg[@rend='specChildModule']">
+            <xsl:text>\hfil\\[-10pt]\begin{sansreflist}</xsl:text>
+            <xsl:apply-templates/>
+            <xsl:text>\end{sansreflist}</xsl:text>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:apply-templates/>
+         </xsl:otherwise>
+      </xsl:choose>
+   </xsl:template>
+
+   <!--
+<xsl:template match="tei:seg[@rend='specChildren']">
+<xsl:text>\mbox{ }\\ \begin{description}</xsl:text>
+<xsl:apply-templates/>
+<xsl:text>\end{description}</xsl:text>
+</xsl:template>
+-->
+<xsl:template match="tei:term">
+      <xsl:text>\emph{</xsl:text>
+      <xsl:apply-templates/>
+      <xsl:text>}</xsl:text>
+   </xsl:template>
+
+   <xsl:template match="tei:seg[@xml:lang]">
+      <xsl:choose>
+         <xsl:when test="@xml:lang='zh-TW'">
+            <xsl:text>{\textChinese </xsl:text>
+            <xsl:apply-templates/>
+            <xsl:text>}</xsl:text>
+         </xsl:when>
+         <xsl:when test="@xml:lang='ja'">
+            <xsl:text>{\textJapanese </xsl:text>
+            <xsl:apply-templates/>
+            <xsl:text>}</xsl:text>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:apply-templates/>
+         </xsl:otherwise>
+      </xsl:choose>
+   </xsl:template>
+
+   <xsl:template match="tei:seg[@rend='specChild']">
+      <xsl:apply-templates/>
+   </xsl:template>
+
+   <xsl:template match="tei:seg[@rend='specChildModule']">
+    \item[<xsl:apply-templates/>]
+   </xsl:template>
+
+   <xsl:template match="tei:seg[@rend='specChildElements']">
+      <xsl:apply-templates/>
+   </xsl:template>
+
+   <xsl:template match="tei:seg[@rend='parent']">
+      <xsl:choose>
+         <xsl:when test="*">
+            <xsl:apply-templates/>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:text>—</xsl:text>
+         </xsl:otherwise>
+      </xsl:choose>
+   </xsl:template>
+
+   <xsl:template match="tei:hi[@rend='parent']">
+      <xsl:apply-templates/>
+   </xsl:template>
+
+   <xsl:template match="tei:hi[@rend='showmembers1']">
+      <xsl:apply-templates/>
+   </xsl:template>
+
+   <xsl:template match="tei:hi[@rend='showmembers2']">
+      <xsl:apply-templates/>
+   </xsl:template>
+
+   <xsl:template match="tei:hi[@rend='showmembers3']">
+      <xsl:apply-templates/>
+   </xsl:template>
+
+   <xsl:template match="tei:hi[@rend='showmembers4']">
+      <xsl:apply-templates/>
+   </xsl:template>
+
+   <xsl:template match="tei:table[@rend='wovenodd' or @rend='attDef']">
+      <xsl:text>
+\begin{reflist}</xsl:text>
+      <xsl:apply-templates/>
+      <xsl:text>
+\end{reflist}  </xsl:text>
+   </xsl:template>
+
+   <xsl:template match="tei:table[@rend='valList'       or @rend='attList'       or @rend='specDesc']">
+      <xsl:text>\hfil\\[-10pt]\begin{sansreflist}</xsl:text>
+      <xsl:apply-templates/>
+      <xsl:text>
+\end{sansreflist}  </xsl:text>
+   </xsl:template>
+
+   <xsl:template match="tei:table[@rend='wovenodd'      or @rend='attList'      or @rend='valList'      or @rend='attDef'      or @rend='specDesc']/tei:row">
+      <xsl:apply-templates/>
+   </xsl:template>
+
+   <xsl:template match="tei:table[@rend='wovenodd'       or @rend='attList'       or @rend='specDesc'       or @rend='valList'       or @rend='attDef']/tei:row/tei:cell[1]">
+      <xsl:choose>
+         <xsl:when test="parent::tei:row/parent::tei:table[@rend='attList']">
+    \item[@<xsl:apply-templates/>]
+  </xsl:when>
+         <xsl:when test="ancestor::tei:table[@rend='valList']">
+    \item[<xsl:apply-templates/>]
+  </xsl:when>
+         <xsl:when test="ancestor::tei:table[@rend='specDesc']">
+    \item[@<xsl:apply-templates/>]
+  </xsl:when>
+         <xsl:when test="@cols='2' and not(parent::tei:row/preceding-sibling::tei:row)">
+            <xsl:text>
+\item[]\begin{specHead}{</xsl:text>
+            <xsl:value-of select="ancestor::tei:div[1]/@xml:id"/>
+            <xsl:text>}</xsl:text>
+            <xsl:apply-templates/>
+            <xsl:text>\end{specHead} </xsl:text>
+         </xsl:when>
+         <xsl:when test="@cols='2'">
+    \item[]<xsl:apply-templates/>
+         </xsl:when>
+         <xsl:otherwise>
+    \item[<xsl:apply-templates/>]
+  </xsl:otherwise>
+      </xsl:choose>
+   </xsl:template>
+
+   <xsl:template match="tei:div[@type='refdoc']/tei:head"/>
+
+   <xsl:template match="tei:div[@type='refdoc']">
+      <xsl:apply-templates/>
+   </xsl:template>
+
+   <xsl:template match="tei:table[@rend='wovenodd'        or @rend='attList'        or @rend='valList'        or @rend='specDesc'        or @rend='attDef']/tei:row/tei:cell[2]">
+      <xsl:apply-templates/>
+   </xsl:template>
+
+
+   <xsl:template match="tei:list[@rend='specList']">
+\begin{sansreflist}
+  <xsl:apply-templates/>
+\end{sansreflist}
+</xsl:template>
+
+   <xsl:template match="tei:hi[@rend='specList-elementSpec']">
+      <xsl:text>[\textbf{&lt;</xsl:text>
+      <xsl:value-of select="."/>
+      <xsl:text>&gt;}]</xsl:text>
+   </xsl:template>
+
+   <xsl:template match="tei:hi[@rend='specList-macroSpec']">
+      <xsl:text>[\textbf{</xsl:text>
+      <xsl:value-of select="."/>
+      <xsl:text>}]</xsl:text>
+   </xsl:template>
+
+   <xsl:template match="tei:hi[@rend='specList-classSpec']">
+      <xsl:text>[\textbf{</xsl:text>
+      <xsl:value-of select="."/>
+      <xsl:text>}]</xsl:text>
+   </xsl:template>
+
+   <xsl:template match="tei:hi[@rend='label'  or @rend='defaultVal']">
+      <xsl:text>{</xsl:text>
+      <xsl:choose>
+         <xsl:when test="@xml:lang='zh-TW'">
+            <xsl:text>\textChinese </xsl:text>
+            <xsl:apply-templates/>
+         </xsl:when>
+         <xsl:when test="@xml:lang='ja'">
+            <xsl:text>\textJapanese </xsl:text>
+            <xsl:apply-templates/>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:apply-templates/>
+         </xsl:otherwise>
+      </xsl:choose>
+      <xsl:text>}</xsl:text>
+   </xsl:template>
+
+
+   <xsl:template match="tei:hi[@rend='attribute']">
+      <xsl:text>\textit{</xsl:text>
+      <xsl:value-of select="."/>
+      <xsl:text>}</xsl:text>
+   </xsl:template>
+
+   <xsl:template name="specHook">
+      <xsl:param name="name"/>
+   </xsl:template>
+
+
+   <xsl:template match="tei:index[@indexName='ODDS']">
+      <xsl:for-each select="tei:term">
+         <xsl:text>\index{</xsl:text>
+         <xsl:choose>
+            <xsl:when test="@sortKey">
+	              <xsl:value-of select="@sortKey"/>
+	              <xsl:text>=</xsl:text>
+	              <xsl:value-of select="."/>
+            </xsl:when>
+            <xsl:otherwise>
+	              <xsl:value-of select="."/>
+            </xsl:otherwise>
+         </xsl:choose>
+         <xsl:text>|oddindex</xsl:text>
+         <xsl:text>}</xsl:text>
+      </xsl:for-each>
+      <xsl:for-each select="tei:index/tei:term">
+         <xsl:text>\index{</xsl:text>
+         <xsl:choose>
+            <xsl:when test="@sortKey">
+	              <xsl:value-of select="@sortKey"/>
+	              <xsl:text>=</xsl:text>
+	              <xsl:value-of select="."/>
+            </xsl:when>
+            <xsl:otherwise>
+	              <xsl:value-of select="."/>
+            </xsl:otherwise>
+         </xsl:choose>
+         <xsl:text>!</xsl:text>
+         <xsl:value-of select="../../tei:term"/>
+         <xsl:text>|oddindex</xsl:text>
+         <xsl:text>}</xsl:text>
+      </xsl:for-each>
+
+   </xsl:template>
+
+
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/latex2/tagdocs.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/latex2/verse.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/latex2/verse.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/latex2/verse.xsl	(revision 258)
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet 
+                xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
+                xmlns:rng="http://relaxng.org/ns/structure/1.0"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                exclude-result-prefixes="a rng tei teix"
+                version="2.0">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p>
+    TEI stylesheet
+    dealing  with elements from the
+      verse module, making LaTeX output.
+      </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: verse.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2011, TEI Consortium</p>
+      </desc>
+   </doc>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+         <p>Process element caesura</p>
+         <p>Caesurae are rendered as a LaTeX \quad{}.</p>
+      </desc>
+   </doc>
+  <xsl:template match="tei:caesura">
+      <xsl:text>\quad{}</xsl:text>
+  </xsl:template>
+
+
+
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/latex2/verse.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/latex2/textstructure.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/latex2/textstructure.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/latex2/textstructure.xsl	(revision 258)
@@ -0,0 +1,393 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet 
+                xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
+                xmlns:rng="http://relaxng.org/ns/structure/1.0"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                exclude-result-prefixes="a rng tei teix"
+                version="2.0">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p>
+    TEI stylesheet dealing  with elements from the
+    textstructure module, making LaTeX output.
+      </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: textstructure.xsl 10057 2012-01-21 16:57:14Z rahtz $</p>
+         <p>Copyright: 2011, TEI Consortium</p>
+      </desc>
+   </doc>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process elements  * in inner mode</desc>
+   </doc>
+  <xsl:template match="*" mode="innertext">
+      <xsl:apply-templates select="."/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+
+
+  <xsl:template match="tei:TEI">
+      <xsl:call-template name="mainDocument"/>
+  </xsl:template>
+
+  <xsl:template name="mainDocument">
+      <xsl:if test="not($realFigures='true')">
+         <xsl:text>%BEGINFIGMAP</xsl:text>
+         <xsl:if test="not($latexLogo='')">
+	   <xsl:text>&#10;%FIGMAP </xsl:text>
+	   <xsl:value-of select="$latexLogo"/>
+	   <xsl:text> FIG0 </xsl:text>
+         </xsl:if>
+         <xsl:for-each select="//tei:figure">
+	   <xsl:variable name="c">
+	     <xsl:number level="any"/>
+	   </xsl:variable>
+	   <xsl:text>&#10;%FIGMAP </xsl:text>
+	   <xsl:variable name="f">
+	     <xsl:choose>
+	       <xsl:when test="@url">
+		 <xsl:value-of select="@url"/>
+	       </xsl:when>
+	       <xsl:when test="@entity">
+		 <xsl:value-of select="unparsed-entity-uri(@entity)"/>
+	       </xsl:when>
+	       <xsl:when test="tei:graphic">
+		 <xsl:value-of select="tei:graphic/@url"/>
+	       </xsl:when>
+	     </xsl:choose>
+	   </xsl:variable>
+	   <xsl:choose>
+	     <xsl:when test="contains($f,'.')">
+	       <xsl:value-of select="$f"/>
+	     </xsl:when>
+	     <xsl:otherwise>
+	       <xsl:value-of select="concat($f,'.png')"/>
+	     </xsl:otherwise>
+	   </xsl:choose>
+	   <xsl:text> FIG</xsl:text>
+	   <xsl:value-of select="$c + 1000"/>
+	   <xsl:text>&#10;</xsl:text>
+         </xsl:for-each>
+         <xsl:text>&#10;%ENDFIGMAP&#10;</xsl:text>
+      </xsl:if>
+      <xsl:text>\documentclass[</xsl:text>
+      <xsl:value-of select="$classParameters"/>
+      <xsl:text>]{</xsl:text>
+      <xsl:value-of select="$docClass"/>
+      <xsl:text>}</xsl:text>
+      <xsl:text>\makeatletter&#10;</xsl:text>
+      <xsl:call-template name="latexSetup"/>
+      <xsl:call-template name="latexPackages"/>
+      <xsl:call-template name="latexLayout"/>
+      <xsl:text>&#10;\@ifundefined{chapter}{%
+    \def\DivI{\section}
+    \def\DivII{\subsection}
+    \def\DivIII{\subsubsection}
+    \def\DivIV{\paragraph}
+    \def\DivV{\subparagraph}
+    \def\DivIStar[#1]#2{\section*{#2}}
+    \def\DivIIStar[#1]#2{\subsection*{#2}}
+    \def\DivIIIStar[#1]#2{\subsubsection*{#2}}
+    \def\DivIVStar[#1]#2{\paragraph*{#2}}
+    \def\DivVStar[#1]#2{\subparagraph*{#2}}
+}{%
+    \def\DivI{\chapter}
+    \def\DivII{\section}
+    \def\DivIII{\subsection}
+    \def\DivIV{\subsubsection}
+    \def\DivV{\paragraph}
+    \def\DivIStar[#1]#2{\chapter*{#2}}
+    \def\DivIIStar[#1]#2{\section*{#2}}
+    \def\DivIIIStar[#1]#2{\subsection*{#2}}
+    \def\DivIVStar[#1]#2{\subsubsection*{#2}}
+    \def\DivVStar[#1]#2{\paragraph*{#2}}
+}
+\def\TheFullDate{</xsl:text>
+      <xsl:call-template name="generateDate"/>
+      <xsl:variable name="revdate">
+         <xsl:call-template name="generateRevDate"/>
+      </xsl:variable>
+      <xsl:if test="not($revdate='')">
+         <xsl:text> (</xsl:text>
+         <xsl:call-template name="i18n">
+            <xsl:with-param name="word">revisedWord</xsl:with-param>
+         </xsl:call-template>
+	 <xsl:text>: </xsl:text>
+	 <xsl:value-of select="$revdate"/>
+         <xsl:text>)</xsl:text>
+      </xsl:if>
+      <xsl:text>}&#10;\def\TheID{</xsl:text>
+      <xsl:choose>
+         <xsl:when test="not($REQUEST='')">
+            <xsl:value-of select="not($REQUEST='')"/>
+         </xsl:when>
+         <xsl:when test="ancestor-or-self::tei:TEI/tei:teiHeader/tei:fileDesc/tei:publicationStmt/tei:idno">
+            <xsl:value-of select="ancestor-or-self::tei:TEI/tei:teiHeader/tei:fileDesc/tei:publicationStmt/tei:idno[1]"/>
+         </xsl:when>
+      </xsl:choose>
+      <xsl:text>\makeatother </xsl:text>
+      <xsl:text>}&#10;\def\TheDate{</xsl:text>
+      <xsl:call-template name="generateDate"/>
+      <xsl:text>}&#10;\title{</xsl:text>
+      <xsl:call-template name="generateTitle"/>
+      <xsl:text>}&#10;\author{</xsl:text>
+      <xsl:call-template name="generateAuthor"/>
+      <xsl:text>}</xsl:text>
+      <xsl:text disable-output-escaping="yes">\let\tabcellsep&amp;
+      \catcode`\&amp;=12\relax </xsl:text>
+      <xsl:text>\makeatletter </xsl:text>
+      <xsl:call-template name="latexBegin"/>
+      <xsl:text>\makeatother </xsl:text>
+      <xsl:text>&#10;\begin{document}&#10;</xsl:text>
+      <xsl:if test="not(tei:text/tei:front/tei:titlePage)">
+         <xsl:call-template name="printTitleAndLogo"/>
+      </xsl:if>
+      <xsl:call-template name="beginDocumentHook"/>
+      <!-- certainly don't touch the next few lines -->
+      <xsl:text>&#10;\catcode`\$=12\relax&#10;</xsl:text>
+      <xsl:text>\catcode`\^=12\relax&#10;</xsl:text>
+      <xsl:text>\catcode`\#=12\relax&#10;</xsl:text>
+      <xsl:text>\catcode`\%=12\relax&#10;</xsl:text>
+      <xsl:apply-templates/>
+      <xsl:call-template name="latexEnd"/>
+      <xsl:if test="key('ENDNOTES',1)">
+	<xsl:text>&#10;\theendnotes</xsl:text>
+      </xsl:if>
+      <xsl:text>&#10;\end{document}&#10;</xsl:text>
+   </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Processing teiHeader elements</desc>
+   </doc>
+   <xsl:template match="tei:teiHeader"/>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:back">
+      <xsl:if test="not(preceding::tei:back)">
+         <xsl:text>\backmatter </xsl:text>
+      </xsl:if>
+      <xsl:apply-templates/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:body">
+      <xsl:if test="not(ancestor::tei:floatingText) and not(preceding::tei:body) and preceding::tei:front">
+         <xsl:text>\mainmatter </xsl:text>
+      </xsl:if>
+      <xsl:if test="count(key('APP',1))&gt;0">
+\beginnumbering
+</xsl:if>
+      <xsl:apply-templates/>
+      <xsl:if test="count(key('APP',1))&gt;0">
+\endnumbering
+</xsl:if>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:body|tei:back|tei:front" mode="innertext">
+      <xsl:apply-templates/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:closer">
+    <xsl:text>&#10;\begin{quote}</xsl:text>
+    <xsl:apply-templates/>
+    <xsl:text>\end{quote}&#10;</xsl:text>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:dateline">
+    <xsl:text>\rightline{</xsl:text>
+    <xsl:apply-templates/>
+    <xsl:text>}&#10;</xsl:text>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process the tei:div elements</desc>
+   </doc>
+  <xsl:template match="tei:div|tei:div1|tei:div2|tei:div3|tei:div4|tei:div5">
+    <xsl:apply-templates/>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Table of contents</desc>
+   </doc>
+   <xsl:template match="tei:divGen[@type='toc']">
+     \tableofcontents
+   </xsl:template>
+   
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Bibliography</desc>
+  </doc>
+  <xsl:template match="tei:divGen[@type='bibliography']">
+    <xsl:text>&#10;\begin{thebibliography}{1}&#10;</xsl:text>
+    <xsl:call-template name="bibliography"/>
+    <xsl:text>&#10;\end{thebibliography}&#10;</xsl:text>    
+  </xsl:template>
+  
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:front">
+      <xsl:if test="not(preceding::tei:front)">
+         <xsl:text>\frontmatter </xsl:text>
+      </xsl:if>
+      <xsl:apply-templates/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:opener">
+ \begin{quote}<xsl:apply-templates/>\end{quote}
+</xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+    If verseNumbering is requested,
+ counts all the verse lines since the last container (<gi xmlns="">div1</gi> by
+ default) and labels every fifth verse using a LaTeX box 3 ems wide.
+
+  </desc>
+   </doc>
+  <xsl:template match="tei:l">
+      <xsl:choose>
+         <xsl:when test="$verseNumbering='true'">
+            <xsl:variable name="id" select="generate-id()"/>
+            <xsl:variable name="pos">
+               <xsl:for-each select="ancestor::*[name()=$resetVerseLineNumbering]//l">
+                  <xsl:if test="generate-id()=$id">
+                     <xsl:value-of select="position()"/>
+                  </xsl:if>
+               </xsl:for-each>
+            </xsl:variable>
+            <xsl:choose>
+               <xsl:when test="$pos mod $everyHowManyLines = 0">
+                  <xsl:text>\leftline{\makebox[3em][r]{</xsl:text>
+                  <xsl:value-of select="$pos"/>
+                  <xsl:text>}\quad{}</xsl:text>
+                  <xsl:apply-templates/>
+                  <xsl:text>}</xsl:text> 
+               </xsl:when>
+               <xsl:otherwise>
+                  <xsl:text>\leftline{\makebox[3em][r]{}\quad{}</xsl:text>
+                  <xsl:apply-templates/>
+                  <xsl:text>}</xsl:text> 
+               </xsl:otherwise>
+            </xsl:choose>
+         </xsl:when>
+         <xsl:when test="ancestor::tei:quote and following-sibling::tei:l">
+            <xsl:apply-templates/>\\
+	 </xsl:when>
+	 <xsl:when test="parent::tei:sp">
+	   <xsl:apply-templates/>
+	   <xsl:text>\hfill\\</xsl:text>
+	 </xsl:when>
+	 <xsl:otherwise>
+	   <xsl:text>\leftline{</xsl:text>
+	   <xsl:apply-templates/>
+	   <xsl:text>}</xsl:text>
+	 </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:text">
+      <xsl:choose>
+         <xsl:when test="parent::tei:TEI">
+            <xsl:apply-templates/>
+         </xsl:when>
+         <xsl:when test="parent::tei:group">
+            <xsl:apply-templates/>
+         </xsl:when>
+         <xsl:otherwise>
+	\par
+	\hrule
+	\begin{quote}
+	\begin{small}
+	<xsl:apply-templates mode="innertext"/>
+	\end{small}
+	\end{quote}
+	\hrule
+	\par
+      </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+
+  <xsl:template match="tei:titlePage/tei:docTitle">
+      <xsl:text>\title{</xsl:text>
+      <xsl:apply-templates/>
+      <xsl:text>}</xsl:text>
+  </xsl:template>
+
+  <xsl:template match="tei:titlePage">
+  \begin{titlepage}
+  <xsl:apply-templates select="tei:docTitle|tei:docAuthor"/>
+  \maketitle
+  <xsl:apply-templates select="*[not(self::tei:docTitle) and not(self::tei:docAuthor)]"/>
+  \end{titlepage}
+  \cleardoublepage
+</xsl:template>
+
+  <xsl:template match="tei:trailer">
+      <xsl:text>
+
+\begin{raggedleft}</xsl:text>
+      <xsl:apply-templates/>
+      <xsl:text>\end{raggedleft}
+
+</xsl:text>
+   </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[latex] make a bibliography</desc>
+   </doc>
+  <xsl:template name="bibliography">
+      <xsl:apply-templates mode="biblio"
+                           select="//tei:ref[@type='cite'] | //tei:ptr[@type='cite']"/>
+  </xsl:template>
+
+
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/latex2/textstructure.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/latex2/textcrit.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/latex2/textcrit.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/latex2/textcrit.xsl	(revision 258)
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet 
+                xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
+                xmlns:rng="http://relaxng.org/ns/structure/1.0"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                exclude-result-prefixes="a rng tei teix"
+                version="2.0">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p>
+    TEI stylesheet
+    dealing with elements from the
+      textcrit module, making LaTeX output.
+      </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Copyright: 2011, TEI Consortium</p>
+      </desc>
+   </doc>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+         <p>Process element app</p>
+         <p>Process tei:lem and tei:rdg within tei:app; first, first, rudimentary attempt. Sends lots of information
+    to a footnote. If a tei:lem is not found, the first tei:rdg is used as the base text. Witness sigils in attribute
+    wit are assumed all to start with # (this should be parametrized).</p>
+      </desc>
+   </doc>
+   <xsl:template name="appReading">
+     <xsl:param name="lemma"/>
+     <xsl:param name="lemmawitness"/>
+     <xsl:param name="readings"/>
+     <xsl:text>\edtext{</xsl:text>
+     <xsl:value-of select="$lemma"/>
+     <xsl:text>}{\Afootnote{</xsl:text>
+     <xsl:copy-of select="$readings"/>
+     <xsl:text>}}</xsl:text>
+   </xsl:template>
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/latex2/textcrit.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/latex2/core.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/latex2/core.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/latex2/core.xsl	(revision 258)
@@ -0,0 +1,866 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
+                xmlns:rng="http://relaxng.org/ns/structure/1.0"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"
+                
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                exclude-result-prefixes="a rng tei teix"
+                version="2.0">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet dealing with elements from the core module, making
+      LaTeX output. </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: core.xsl 10197 2012-03-28 21:44:10Z rahtz $</p>
+         <p>Copyright: 2011, TEI Consortium</p>
+      </desc>
+   </doc>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element ab</desc>
+   </doc>
+  <xsl:template match="tei:ab">
+      <xsl:apply-templates/>
+      <xsl:if test="following-sibling::tei:ab">\par </xsl:if>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element bibl</desc>
+   </doc>
+  <xsl:template match="tei:bibl" mode="cite">
+      <xsl:apply-templates select="text()[1]"/>
+  </xsl:template>
+
+
+  <xsl:template match="tei:cit">
+    <xsl:choose>
+      <xsl:when test="@rend='display' or tei:q/tei:p or
+		      tei:quote/tei:l or tei:quote/tei:p">
+        <xsl:text>&#10;\begin{quote}&#10;</xsl:text>
+            <xsl:if test="@n">
+              <xsl:text>(</xsl:text>
+              <xsl:value-of select="@n"/>
+              <xsl:text>) </xsl:text>
+            </xsl:if>
+            <xsl:apply-templates select="tei:q|tei:quote"/>
+	    <xsl:text>\par&#10;</xsl:text>
+            <xsl:apply-templates select="tei:bibl"/>
+        <xsl:text>&#10;\end{quote}&#10;</xsl:text>
+      </xsl:when>
+      <xsl:otherwise>
+	<xsl:value-of select="$preQuote"/>
+	<xsl:if test="@n">
+	  <xsl:text>(</xsl:text>
+	  <xsl:value-of select="@n"/>
+	  <xsl:text>) </xsl:text>
+	</xsl:if>
+	<xsl:apply-templates/>
+	<xsl:value-of select="$postQuote"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element code</desc>
+   </doc>
+  <xsl:template match="tei:code">\texttt{<xsl:apply-templates/>}</xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process &lt;corr&gt;</desc></doc>
+  <xsl:template match="tei:corr">
+      <xsl:apply-templates/>
+      <xsl:choose>
+         <xsl:when test="@sic">
+            <xsl:text>\footnote{</xsl:text>
+                <xsl:call-template name="i18n">
+                <xsl:with-param name="word">appearsintheoriginalas</xsl:with-param>
+                </xsl:call-template>
+                <xsl:text> \emph{</xsl:text>
+                <xsl:value-of select="./@sic"/>
+            <xsl:text>}.}</xsl:text>
+         </xsl:when>
+      </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process &lt;supplied&gt;</desc></doc>
+  <xsl:template match="tei:supplied">
+      <xsl:text>[</xsl:text>
+      <xsl:apply-templates/>
+      <xsl:text>]</xsl:text>
+      <xsl:choose>
+         <xsl:when test="@reason">
+            <xsl:text>\footnote{</xsl:text>
+            <xsl:value-of select="./@reason"/>
+            <xsl:text>}</xsl:text>
+         </xsl:when>
+      </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+            <desc>Process &lt;sic&gt;</desc></doc>
+
+  <xsl:template match="tei:sic">
+      <xsl:apply-templates/>
+      <xsl:text> (sic)</xsl:text>
+      <xsl:choose>
+         <xsl:when test="@corr">
+            <xsl:text>\footnote{</xsl:text>
+                <xsl:call-template name="i18n">
+                <xsl:with-param name="word">shouldbereadas</xsl:with-param>
+                </xsl:call-template>
+                <xsl:text> \emph{</xsl:text>
+                <xsl:value-of select="./@corr"/>
+            <xsl:text>}.}</xsl:text>
+         </xsl:when>
+      </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element eg|tei:q[@rend='eg']</desc>
+   </doc>
+  <xsl:template match="tei:seg[@rend='pre']|tei:eg|tei:q[@rend='eg']">
+      <xsl:choose>
+         <xsl:when test="ancestor::tei:cell and count(*)=1 and string-length(.)&lt;60">
+	           <xsl:variable name="stuff">
+	              <xsl:apply-templates mode="eg"/>
+	           </xsl:variable>
+	           <xsl:text>\fbox{\ttfamily </xsl:text>
+	           <xsl:value-of select="tei:escapeCharsVerbatim($stuff)"/>
+	           <xsl:text>} </xsl:text>
+         </xsl:when>
+         <xsl:when test="ancestor::tei:cell and not(*)  and string-length(.)&lt;60">
+	           <xsl:variable name="stuff">
+	              <xsl:apply-templates mode="eg"/>
+	           </xsl:variable>
+	           <xsl:text>\fbox{\ttfamily </xsl:text>
+	           <xsl:value-of select="tei:escapeCharsVerbatim($stuff)"/>
+	           <xsl:text>} </xsl:text>
+         </xsl:when>
+         <xsl:when test="ancestor::tei:cell or @rend='pre'">
+	           <xsl:text>\mbox{}\hfill\\[-10pt]\begin{Verbatim}[fontsize=\small]
+</xsl:text>
+	           <xsl:apply-templates mode="eg"/>
+	           <xsl:text>
+\end{Verbatim}
+</xsl:text>
+         </xsl:when>
+         <xsl:when test="ancestor::tei:list[@type='gloss']">
+	           <xsl:text>\hspace{1em}\hfill\linebreak</xsl:text>
+	           <xsl:text>\bgroup</xsl:text>
+	           <xsl:call-template name="exampleFontSet"/>
+	           <xsl:text>\vskip 10pt\begin{shaded}
+\noindent\obeylines\obeyspaces </xsl:text>
+	           <xsl:apply-templates mode="eg"/>
+	           <xsl:text>\end{shaded}
+\egroup 
+
+</xsl:text>
+         </xsl:when>
+         <xsl:otherwise>
+	           <xsl:text>\par\bgroup</xsl:text>
+	           <xsl:call-template name="exampleFontSet"/>
+	           <xsl:text>\vskip 10pt\begin{shaded}
+\obeylines\obeyspaces </xsl:text>
+	           <xsl:apply-templates mode="eg"/>
+	           <xsl:text>\end{shaded}
+\par\egroup 
+
+</xsl:text>
+         </xsl:otherwise>
+      </xsl:choose>
+      <!--
+    <xsl:choose>
+      <xsl:when test="@n">
+	<xsl:text>&#10;\begin{Verbatim}[fontsize=\scriptsize,numbers=left,label={</xsl:text>
+	<xsl:value-of select="@n"/>
+      <xsl:text>}]&#10;</xsl:text>
+      <xsl:apply-templates mode="eg"/> 
+      <xsl:text>&#10;\end{Verbatim}&#10;</xsl:text>
+      </xsl:when>
+      <xsl:otherwise>
+	<xsl:text>&#10;\begin{Verbatim}[fontsize=\scriptsize,frame=single]&#10;</xsl:text>
+	<xsl:apply-templates mode="eg"/>
+	<xsl:text>&#10;\end{Verbatim}&#10;</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+-->
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element emph</desc>
+   </doc>
+  <xsl:template match="tei:emph">
+      <xsl:text>\textit{</xsl:text>
+      <xsl:apply-templates/>
+      <xsl:text>}</xsl:text>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element foreign</desc>
+   </doc>
+  <xsl:template match="tei:foreign">
+      <xsl:text>\textit{</xsl:text>
+      <xsl:apply-templates/>
+      <xsl:text>}</xsl:text>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element head</desc>
+   </doc>
+  <xsl:template match="tei:head">
+      <xsl:choose>
+         <xsl:when test="parent::tei:castList"/>
+         <xsl:when test="parent::tei:figure"/>
+         <xsl:when test="parent::tei:list"/>
+         <xsl:when test="parent::tei:lg"> \subsection*{<xsl:apply-templates/>} </xsl:when>
+         <xsl:when test="parent::tei:table"/>
+         <xsl:otherwise>
+            <xsl:variable name="depth">
+               <xsl:apply-templates mode="depth" select=".."/>
+            </xsl:variable>
+            <xsl:text>&#10;\Div</xsl:text>
+            <xsl:choose>
+               <xsl:when test="$depth=0">I</xsl:when>
+               <xsl:when test="$depth=1">II</xsl:when>
+               <xsl:when test="$depth=2">III</xsl:when>
+               <xsl:when test="$depth=3">IV</xsl:when>
+               <xsl:when test="$depth=4">V</xsl:when>
+	       <xsl:otherwise>I</xsl:otherwise>
+            </xsl:choose>
+            <xsl:choose>
+               <xsl:when test="ancestor::tei:floatingText">Star</xsl:when>
+               <xsl:when test="parent::tei:div/@rend='nonumber'">Star</xsl:when>
+               <xsl:when test="ancestor::tei:back and not($numberBackHeadings='true')">Star</xsl:when>
+	       <xsl:when test="not($numberHeadings='true') and ancestor::tei:body">Star</xsl:when>
+               <xsl:when test="ancestor::tei:front and not($numberFrontHeadings='true')">Star</xsl:when>
+            </xsl:choose>
+	    <xsl:text>[</xsl:text>
+	    <xsl:value-of select="normalize-space(.)"/>
+	    <xsl:text>]</xsl:text>
+	    <xsl:text>{</xsl:text>
+	    <xsl:apply-templates/>
+	    <xsl:text>}</xsl:text>
+	    <xsl:if test="../@xml:id">
+	      <xsl:text>\label{</xsl:text>
+	      <xsl:value-of select="../@xml:id"/>
+	      <xsl:text>}</xsl:text>
+	    </xsl:if>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element head in heading mode</desc>
+   </doc>
+  <xsl:template match="tei:head" mode="makeheading">
+      <xsl:apply-templates/>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+            <desc>Process &lt;gloss&gt;</desc></doc>
+
+  <xsl:template match="tei:gloss">
+      <xsl:text> \textit{</xsl:text>
+      <xsl:apply-templates/>
+      <xsl:text>}</xsl:text>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element hi</desc>
+   </doc>
+  <xsl:template match="tei:hi">
+      <xsl:call-template name="rendering"/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Rendering rules, turning @rend into LaTeX commands</desc>
+   </doc>
+  <xsl:template name="rendering">
+      <xsl:variable name="cmd">
+         <xsl:choose>
+            <xsl:when test="not(@rend)">\textbf</xsl:when>
+            <xsl:when test="starts-with(@rend,'color')">\textcolor</xsl:when>
+            <xsl:when test="@rend='bold'">\textbf</xsl:when>
+            <xsl:when test="@rend='calligraphic'">\textcal</xsl:when>
+            <xsl:when test="@rend='capsall'">\uppercase</xsl:when>
+            <xsl:when test="@rend='center'">\centerline</xsl:when>
+            <xsl:when test="@rend='code'">\texttt</xsl:when>
+            <xsl:when test="@rend='expanded'">\textsc</xsl:when>
+            <xsl:when test="@rend='gothic'">\textgothic</xsl:when>
+            <xsl:when test="@rend='i'">\textit</xsl:when>
+            <xsl:when test="@rend='important'">\textbf</xsl:when>
+            <xsl:when test="@rend='it'">\textit</xsl:when>
+            <xsl:when test="@rend='ital'">\textit</xsl:when>
+            <xsl:when test="@rend='italic'">\textit</xsl:when>
+            <xsl:when test="@rend='italics'">\textit</xsl:when>
+            <xsl:when test="@rend='large'">\textlarge</xsl:when>
+            <xsl:when test="@rend='larger'">\textlarger</xsl:when>
+            <xsl:when test="@rend='noindex'">\textrm</xsl:when>
+            <xsl:when test="@rend='overbar'">\textoverbar</xsl:when>
+            <xsl:when test="@rend='plain'">\textrm</xsl:when>
+            <xsl:when test="@rend='quoted'">\textquoted</xsl:when>
+            <xsl:when test="@rend='sc'">\textsc</xsl:when>
+            <xsl:when test="@rend='small'">\textsmall</xsl:when>
+            <xsl:when test="@rend='smallcaps'">\textsc</xsl:when>
+            <xsl:when test="@rend='smaller'">\textsmaller</xsl:when>
+            <xsl:when test="@rend='strikethrough'">\sout</xsl:when>
+            <xsl:when test="@rend='sub'">\textsubscript</xsl:when>
+            <xsl:when test="@rend='subscript'">\textsubscript</xsl:when>
+            <xsl:when test="@rend='sup'">\textsuperscript</xsl:when>
+            <xsl:when test="@rend='superscript'">\textsuperscript</xsl:when>
+            <xsl:when test="@rend='typewriter'">\texttt</xsl:when>
+            <xsl:when test="@rend='ul'">\uline</xsl:when>
+            <xsl:when test="@rend='underwavyline'">\uwave</xsl:when>
+            <xsl:when test="@rend='underdoubleline'">\uuline</xsl:when>
+            <xsl:when test="@rend='underline'">\uline</xsl:when>
+         </xsl:choose>
+      </xsl:variable>
+      <xsl:value-of select="$cmd"/>
+      <xsl:choose>
+	<xsl:when test="starts-with(@rend,'color(')">
+	        <xsl:text>{</xsl:text>
+	        <xsl:value-of select="substring-before(substring-after(@rend,'color('),')')"/>
+	        <xsl:text>}</xsl:text>
+	</xsl:when>
+	<xsl:when test="starts-with(@rend,'color')">
+	        <xsl:text>{</xsl:text>
+	        <xsl:value-of select="substring-after(@rend,'color')"/>
+	        <xsl:text>}</xsl:text>
+	</xsl:when>
+      </xsl:choose>
+      <xsl:text>{</xsl:text>
+      <xsl:apply-templates/>
+      <xsl:text>}</xsl:text>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element hr</desc>
+   </doc>
+  <xsl:template match="tei:hr"> \hline </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element ident</desc>
+   </doc>
+  <xsl:template match="tei:ident">
+      <xsl:text>\textsf{</xsl:text>
+      <xsl:apply-templates/>
+      <xsl:text>}</xsl:text>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element item</desc>
+   </doc>
+  <xsl:template match="tei:item"> 
+      <xsl:text>
+\item</xsl:text>
+      <xsl:if test="@n">[<xsl:value-of select="@n"/>]</xsl:if>
+      <xsl:text> </xsl:text>
+      <xsl:apply-templates/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element item</desc>
+   </doc>
+  <xsl:template match="tei:item" mode="gloss"> 
+      <xsl:text>
+\item[</xsl:text>
+      <xsl:apply-templates select="preceding-sibling::tei:label[1]" mode="gloss"/>
+      <xsl:text>]</xsl:text>
+      <xsl:apply-templates/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element label in normal mode</desc>
+   </doc>
+  <xsl:template match="tei:label"/>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element label in normal mode, inside an item</desc>
+   </doc>
+  <xsl:template match="tei:item/tei:label">
+      <xsl:text>\textbf{</xsl:text>
+      <xsl:apply-templates/>
+      <xsl:text>}</xsl:text>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element label in gloss mode</desc>
+   </doc>
+  <xsl:template match="tei:label" mode="gloss">
+      <xsl:apply-templates/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element lb</desc>
+   </doc>
+  <xsl:template match="tei:lb">
+      <xsl:text>{\hskip1pt}\newline </xsl:text>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element list</desc>
+   </doc>
+  <xsl:template match="tei:list">
+      <xsl:if test="tei:head"> 
+	<xsl:text>\leftline{\textbf{</xsl:text>
+	<xsl:for-each select="tei:head">
+            <xsl:apply-templates/>
+         </xsl:for-each>
+	 <xsl:text>}} </xsl:text>
+      </xsl:if>
+      <xsl:if test="@xml:id">
+	        <xsl:text>\label{</xsl:text>
+	        <xsl:value-of select="@xml:id"/>
+	        <xsl:text>}</xsl:text>
+      </xsl:if>
+      <xsl:choose>
+         <xsl:when test="not(tei:item)"/>
+         <xsl:when test="@type='gloss' or tei:label"> 
+	   <xsl:text>\begin{description}&#10;</xsl:text>
+	   <xsl:apply-templates mode="gloss" select="tei:item"/>
+	   <xsl:text>&#10;\end{description} </xsl:text>
+	 </xsl:when>
+         <xsl:when test="@type='unordered'">
+	   <xsl:text>\begin{itemize}&#10;</xsl:text>
+	   <xsl:apply-templates/>
+	   <xsl:text>&#10;\end{itemize} </xsl:text>
+	 </xsl:when>
+         <xsl:when test="@type='ordered'">
+	   <xsl:text>\begin{enumerate}&#10;</xsl:text>
+	   <xsl:apply-templates/>
+	   <xsl:text>&#10;\end{enumerate}</xsl:text>
+	 </xsl:when>
+         <xsl:when test="@type='runin' or @rend='runon'">
+            <xsl:apply-templates mode="runin" select="tei:item"/>
+         </xsl:when>
+         <xsl:otherwise> 
+	   <xsl:text>\begin{itemize}&#10;</xsl:text>
+	   <xsl:apply-templates/> 
+	   <xsl:text>&#10;\end{itemize} </xsl:text>
+      </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element listBibl</desc>
+   </doc>
+   <xsl:template match="tei:listBibl">
+     <xsl:choose>
+       <xsl:when test="tei:biblStruct">
+	 <xsl:text>\begin{bibitemlist}{1}&#10;</xsl:text>
+	 <xsl:for-each select="tei:biblStruct">
+	   <xsl:sort select="lower-case(string(tei:*[1]/tei:author/tei:surname or  tei:*[1]/tei:author/tei:orgName or  tei:*[1]/tei:author/tei:name or  tei:*[1]/tei:editor/tei:surname or  tei:*[1]/tei:editor/tei:name or  tei:*[1]/tei:title))"/>
+	   <xsl:sort select="tei:monogr/tei:imprint/tei:date"/>
+	   <xsl:text>\bibitem[</xsl:text>
+	   <xsl:apply-templates select="." mode="xref"/>
+	   <xsl:text>]{</xsl:text>
+	   <xsl:value-of select="@xml:id"/>
+	   <xsl:text>}\hypertarget{</xsl:text>
+	   <xsl:value-of select="@xml:id"/>
+	   <xsl:text>}{}</xsl:text>
+	   <xsl:apply-templates select="."/>
+	 </xsl:for-each>
+	 <xsl:text>&#10;\end{bibitemlist}&#10;</xsl:text>
+       </xsl:when>
+       <xsl:otherwise>
+	 <xsl:text>\begin{bibitemlist}{1}&#10;</xsl:text>
+	 <xsl:apply-templates/> 
+	 <xsl:text>&#10;\end{bibitemlist}&#10;</xsl:text>
+       </xsl:otherwise>
+     </xsl:choose>
+   </xsl:template>
+
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element tei:bibl</desc>
+   </doc>
+   <xsl:template match="tei:bibl">
+     <xsl:choose>
+       <xsl:when test="parent::tei:div|tei:listBibl">
+	 <xsl:text>\par \bgroup\itshape&#10;</xsl:text>
+	 <xsl:apply-templates/> 
+	 <xsl:text>\egroup\vskip6pt\par&#10;</xsl:text>
+       </xsl:when>
+       <xsl:when test="parent::tei:cit">
+	 <xsl:apply-templates/>
+       </xsl:when>
+       <xsl:otherwise>
+	 <xsl:text>\bgroup\itshape </xsl:text>
+	 <xsl:apply-templates/>
+	 <xsl:text>\egroup </xsl:text>
+       </xsl:otherwise>
+     </xsl:choose>
+   </xsl:template>
+   
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element listBibl/tei:bibl</desc>
+   </doc>
+  <xsl:template match="tei:listBibl/tei:bibl"> \bibitem {<xsl:choose>
+         <xsl:when test="@xml:id">
+	           <xsl:value-of select="@xml:id"/>
+         </xsl:when>
+         <xsl:otherwise>bibitem-<xsl:number level="any"/>
+         </xsl:otherwise>
+      </xsl:choose>
+      <xsl:text>}</xsl:text>
+      <xsl:choose>
+         <xsl:when test="parent::tei:listBibl/@xml:lang='zh-TW' or @xml:lang='zh-TW'">
+	           <xsl:text>{\textChinese </xsl:text>
+	           <xsl:apply-templates/>
+	           <xsl:text>}</xsl:text>
+         </xsl:when>
+         <xsl:when test="parent::tei:listBibl/@xml:lang='ja' or @xml:lang='ja'">
+	           <xsl:text>{\textJapanese </xsl:text>
+	           <xsl:apply-templates/>
+	           <xsl:text>}</xsl:text>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:apply-templates/>
+         </xsl:otherwise>
+      </xsl:choose>
+      <xsl:text>&#10;</xsl:text>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element mentioned</desc>
+   </doc>
+  <xsl:template match="tei:mentioned">
+      <xsl:text>\emph{</xsl:text>
+      <xsl:apply-templates/>
+      <xsl:text>}</xsl:text>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element note</desc>
+   </doc>
+  <xsl:template match="tei:note">
+    <xsl:if test="@xml:id">
+      <xsl:text>\hypertarget{</xsl:text>
+      <xsl:value-of select="@xml:id"/>
+      <xsl:text>}{}</xsl:text>
+    </xsl:if>
+    <xsl:choose>
+	<xsl:when test="@place='inline' or ancestor::tei:bibl or ancestor::tei:biblStruct"> 
+	  <xsl:text>(</xsl:text>
+	  <xsl:apply-templates/>
+	  <xsl:text>) </xsl:text>
+	</xsl:when>
+	<xsl:when test="@place='end'">
+	  <xsl:text>\endnote{</xsl:text>
+	  <xsl:if test="@xml:id">
+	    <xsl:text>\label{</xsl:text>
+	    <xsl:value-of select="@xml:id"/>
+	    <xsl:text>}</xsl:text>
+	  </xsl:if>
+	  <xsl:apply-templates/>
+	  <xsl:text>}</xsl:text>
+	</xsl:when>
+	<xsl:when test="@target">
+	  <xsl:text>\footnotetext{</xsl:text>
+	  <xsl:apply-templates/>
+	  <xsl:text>}</xsl:text>
+	</xsl:when>
+	<xsl:when test="count(key('APP',1))&gt;0">
+	  <xsl:text>\footnote{</xsl:text>
+	  <xsl:apply-templates/>
+	  <xsl:text>}</xsl:text>
+	</xsl:when>
+      <xsl:otherwise>
+	  <xsl:text>\footnote{</xsl:text>
+	  <xsl:if test="@xml:id">
+	    <xsl:text>\label{</xsl:text>
+	    <xsl:value-of select="@xml:id"/>
+	    <xsl:text>}</xsl:text>
+	  </xsl:if>
+	  <xsl:apply-templates/>
+	  <xsl:text>}</xsl:text>
+	</xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element &lt;p&gt;</desc>
+   </doc>
+  <xsl:template match="tei:p">
+    <xsl:choose>
+      <xsl:when test="parent::tei:note and not(preceding-sibling::tei:p)">
+      </xsl:when>
+      <xsl:when test="count(key('APP',1))&gt;0">
+	<xsl:text>\pstart&#10;</xsl:text>
+      </xsl:when>
+      <xsl:otherwise>
+	<xsl:text>\par&#10;</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+    <xsl:if test="$numberParagraphs='true'">
+      <xsl:call-template name="numberParagraph"/>
+    </xsl:if>
+    <xsl:apply-templates/>
+    <xsl:if test="count(key('APP',1))&gt;0">
+	<xsl:text>&#10;\pend&#10;</xsl:text>
+    </xsl:if>
+  </xsl:template>
+  
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>How to number a paragraph</desc>
+   </doc>
+  <xsl:template name="numberParagraph">
+      <xsl:text>\textit{\footnotesize[</xsl:text>
+      <xsl:number/>
+      <xsl:text>]} </xsl:text>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+         <p>Process element pb</p>
+         <p>Indication of a page break. We make it an anchor if it has an
+    ID.</p>
+      </desc>
+   </doc>
+  
+   <xsl:template match="tei:pb">
+   <!-- string " Page " is now managed through the i18n file -->
+    <xsl:choose>
+         <xsl:when test="$pagebreakStyle='active'">
+            <xsl:text>\clearpage </xsl:text>
+         </xsl:when>
+         <xsl:when test="$pagebreakStyle='visible'">
+            <xsl:text>✁[</xsl:text>
+            <xsl:value-of select="@unit"/>
+            <xsl:text> </xsl:text>
+            <xsl:call-template name="i18n">
+               <xsl:with-param name="word">page</xsl:with-param>
+            </xsl:call-template>
+            <xsl:text> </xsl:text>
+            <xsl:value-of select="@n"/>
+            <xsl:text>]✁</xsl:text>
+         </xsl:when>
+         <xsl:when test="$pagebreakStyle='bracketsonly'"> <!-- To avoid trouble with the scisssors character "✁" -->
+        <xsl:text>[</xsl:text>
+            <xsl:value-of select="@unit"/>
+            <xsl:text> </xsl:text>
+            <xsl:call-template name="i18n">
+               <xsl:with-param name="word">page</xsl:with-param>
+            </xsl:call-template>
+            <xsl:text> </xsl:text>
+            <xsl:value-of select="@n"/>
+            <xsl:text>]</xsl:text>
+         </xsl:when>
+         <xsl:otherwise> </xsl:otherwise>
+      </xsl:choose>
+      <xsl:if test="@xml:id">
+         <xsl:text>\hypertarget{</xsl:text>
+         <xsl:value-of select="@xml:id"/>
+         <xsl:text>}{}</xsl:text>
+      </xsl:if>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process elementq</desc>
+   </doc>
+  <xsl:template match="tei:q">
+      <xsl:choose>
+         <xsl:when test="tei:p"> \begin{quote}<xsl:apply-templates/> \end{quote} </xsl:when>
+         <xsl:when test="tei:text">
+            <xsl:apply-templates/>
+         </xsl:when>
+         <xsl:when test="tei:lg"> \begin{quote}<xsl:apply-templates/> \end{quote} </xsl:when>
+         <xsl:otherwise>
+	   <xsl:call-template name="makeQuote"/>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element quote</desc>
+   </doc>
+  <xsl:template match="tei:quote">
+      <xsl:choose>
+	<xsl:when test="parent::tei:cit">
+	  <xsl:apply-templates/>
+	</xsl:when>
+	<xsl:when test="@rend='inline'">
+	  <xsl:value-of select="$preQuote"/>
+	  <xsl:apply-templates/>
+	  <xsl:value-of select="$postQuote"/>
+	</xsl:when>
+	<xsl:when test="@rend='display' or tei:p or tei:l or string-length(.)&gt;150">
+	  <xsl:text>\begin{quote}</xsl:text>
+	  <xsl:apply-templates/>
+	  <xsl:text>\end{quote}</xsl:text>
+	</xsl:when>
+	<xsl:otherwise>
+	  <xsl:value-of select="$preQuote"/>
+	  <xsl:apply-templates/>
+	  <xsl:value-of select="$postQuote"/>
+	</xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element p with @rend='display'</desc>
+   </doc>
+  <xsl:template match="tei:p[@rend='display']"> \begin{quote}
+      <xsl:text>&#10;\begin{quote}&#10;</xsl:text>
+      <xsl:apply-templates/>
+      <xsl:text>\end{quote}&#10;</xsl:text>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element q with @rend='display'</desc>
+   </doc>
+  <xsl:template match="tei:q[@rend='display']"> 
+      <xsl:text>&#10;\begin{quote}&#10;</xsl:text>
+      <xsl:apply-templates/>
+      <xsl:text>\end{quote}&#10;</xsl:text>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element ref[@type='cite']</desc>
+   </doc>
+  <xsl:template match="tei:ref[@type='cite']">
+      <xsl:apply-templates/>
+  </xsl:template>
+
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element signed</desc>
+   </doc>
+  <xsl:template match="tei:signed">
+      <xsl:text>&#10;\begin{quote}&#10;</xsl:text>
+      <xsl:apply-templates/>
+      <xsl:text>\end{quote}&#10;</xsl:text>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element soCalled</desc>
+   </doc>
+  <xsl:template match="tei:soCalled">    
+      <xsl:value-of select="$preQuote"/>
+      <xsl:apply-templates/>
+      <xsl:value-of select="$postQuote"/>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element unclear</desc>
+   </doc>
+  <xsl:template match="tei:unclear">
+    <xsl:text>\textbf{</xsl:text>
+    <xsl:apply-templates/>
+    <xsl:text>}</xsl:text>
+    </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element space</desc>
+   </doc>
+  <xsl:template match="tei:space">
+    <xsl:variable name="unit">
+      <xsl:choose>
+	<xsl:when test="@unit">
+	  <xsl:value-of select="@unit"/>
+	</xsl:when>
+	<xsl:otherwise>em</xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:variable name="quantity">
+      <xsl:choose>
+	<xsl:when test="@quantity">
+	  <xsl:value-of select="@quantity"/>
+	</xsl:when>
+	<xsl:otherwise>1</xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:text>\hspace{</xsl:text>
+    <xsl:value-of select="$quantity"/>
+    <xsl:value-of select="$unit"/>
+    <xsl:text>}</xsl:text>
+    </xsl:template>
+    
+
+   <xsl:template name="emphasize">
+      <xsl:param name="class"/>
+      <xsl:param name="content"/>
+      <xsl:choose>
+         <xsl:when test="$class='titlem'">
+            <xsl:text>\textit{</xsl:text>
+            <xsl:copy-of select="$content"/>
+            <xsl:text>}</xsl:text>
+         </xsl:when>
+         <xsl:when test="$class='titlej'">
+            <xsl:text>\textit{</xsl:text>
+            <xsl:copy-of select="$content"/>
+            <xsl:text>}</xsl:text>
+         </xsl:when>
+         <xsl:when test="$class='titlea'">
+            <xsl:text>‘</xsl:text>
+	           <xsl:copy-of select="$content"/>
+            <xsl:text>’</xsl:text>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:copy-of select="$content"/>
+         </xsl:otherwise>
+      </xsl:choose>
+   </xsl:template>
+
+
+  <xsl:template name="Text">
+      <xsl:param name="words"/>
+      <xsl:value-of select="tei:escapeChars($words)"/>
+  </xsl:template>
+
+  <xsl:template name="applyRendition"/>
+
+  <xsl:template name="makeSpan">
+    <xsl:apply-templates/>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+         <p>Process text(), escaping the LaTeX command characters.</p>
+      </desc>
+   </doc>
+  <xsl:template match="text()"> 
+      <xsl:value-of select="tei:escapeChars(.)"/>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+         <p>Process attributes in text mode, escaping the LaTeX
+    command characters.</p>
+         <p>as with text()</p>
+      </desc>
+   </doc>
+  <xsl:template match="@*" mode="attributetext">
+      <xsl:value-of select="tei:escapeChars(.)"/>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process text (in example mode)</desc>
+   </doc>
+  <xsl:template match="text()" mode="eg">
+      <xsl:choose>
+         <xsl:when test="starts-with(.,'&#xA;')">
+            <xsl:value-of select="substring-after(tei:escapeCharsVerbatim(.),'&#xA;')"/>
+         </xsl:when>
+         <xsl:otherwise>
+	   <xsl:value-of select="tei:escapeCharsVerbatim(.)"/>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/latex2/core.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/latex2/header.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/latex2/header.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/latex2/header.xsl	(revision 258)
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
+                xmlns:rng="http://relaxng.org/ns/structure/1.0"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"
+                
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                exclude-result-prefixes="a rng tei teix"
+                version="2.0">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet dealing with elements from the header module,
+      making LaTeX output. </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: header.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2011, TEI Consortium</p>
+      </desc>
+   </doc>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element docAuthor</desc>
+   </doc>
+  <xsl:template match="tei:docAuthor"> 
+      <xsl:if test="not(preceding-sibling::tei:docAuthor)">
+         <xsl:text>\author{</xsl:text>
+      </xsl:if>
+      <xsl:apply-templates/>
+      <xsl:choose>
+         <xsl:when test="count(following-sibling::tei:docAuthor)=1"> and </xsl:when>
+         <xsl:when test="following-sibling::tei:docAuthor">, </xsl:when>
+      </xsl:choose>
+      <xsl:if test="not(following-sibling::tei:docAuthor)">
+         <xsl:text>}</xsl:text>
+      </xsl:if>
+  </xsl:template>
+
+  <xsl:template match="tei:docAuthor" mode="author">
+      <xsl:apply-templates/>
+      <xsl:choose>
+         <xsl:when test="count(following-sibling::tei:docAuthor)=1"> and </xsl:when>
+         <xsl:when test="following-sibling::tei:docAuthor">, </xsl:when>
+      </xsl:choose>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element docDate</desc>
+   </doc>
+  <xsl:template match="tei:docDate">
+  \date{<xsl:apply-templates/>}</xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element docImprint</desc>
+   </doc>
+  <xsl:template match="tei:docImprint">
+  </xsl:template>
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/latex2/header.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/relaxng/build-to.xml
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/relaxng/build-to.xml	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/relaxng/build-to.xml	(revision 258)
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="utf-8"?>
+<project basedir="." default="dist" name="teitohtml">
+<!--
+	This library is free software; you can redistribute it and/or
+	modify it under the terms of the GNU Lesser General Public
+	License as published by the Free Software Foundation; either
+	version 2.1 of the License, or (at your option) any later version.
+	
+	This library 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
+	Lesser General Public License for more details.
+	
+	You should have received a copy of the GNU Lesser General Public
+	License along with this library; if not, write to the Free Software
+	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+	
+        Id: $Id: build-to.xml 9886 2011-12-04 22:50:41Z rahtz $
+        Copyright: 2011, TEI Consortium<
+-->
+  <!--
+ Convert TEI documents into HTML files.
+ -->
+  <!-- Path to TEI XML file. -->
+  <property name="inputFile" value=""/>
+  <!-- Path where the output schema file will be saved. -->
+  <property name="outputFile" value=""/>
+  <!-- which profile -->
+  <property name="profile" value="default"/>
+  <!-- where does oxygen keep stuff -->
+  <property name="oxygenlib" value=""/>
+  <!-- Stylesheet for transformation -->
+  <property name="odd2relax"
+	    value="../profiles/${profile}/relaxng/to.xsl"/>
+  <property name="odd2oddxsl" value="../odds2/odd2odd.xsl"/>
+  <dirname property="inputFileDir" file="${inputFile}"/>
+  <dirname property="outputDir" file="${outputFile}"/>
+  <property name="outputTempDir" value="${outputDir}/temp-dir-for-ant"/>
+  <path id="classpath">
+    <pathelement path="${java.class.path}"/>
+  </path>
+  <target name="setup">
+    <delete dir="${outputTempDir}"/>
+    <mkdir dir="${outputTempDir}"/>
+  </target>
+  <target name="odd">
+    <echo>Do ODD processing</echo>
+    <xslt force="yes" style="${odd2oddxsl}" in="${inputFile}" out="${outputTempDir}/tmp1.xml" classpath="classpath">
+      <xmlcatalog>
+        <catalogpath>
+          <pathelement location="../../../../catalog.xml"/>
+          <pathelement location="../../../../../xhtml11/dtd/xhtmlcatalog.xml"/>
+        </catalogpath>
+      </xmlcatalog>
+      <factory name="net.sf.saxon.TransformerFactoryImpl"/>
+      <classpath location="${oxygenlib}/saxon9ee.jar"/>
+      <param name="lang" expression="${lang}" if="lang"/>
+      <param name="defaultSource" expression="${defaultSource}" if="defaultSource"/>
+      <param name="verbose" expression="${verbose}" if="verbose"/>
+    </xslt>
+  </target>
+  <target name="dist" depends="setup,odd,convert,cleanup"/>
+
+  <target name="convert">
+    <!-- Recreate temporary output directory -->
+    <!-- The transformation for HTML output. -->
+    <echo level="info">XSLT generate RELAXNG files</echo>
+    <xslt force="yes" style="${odd2relax}" in="${outputTempDir}/tmp1.xml" out="${outputFile}" classpath="classpath">
+      <xmlcatalog>
+        <catalogpath>
+          <pathelement location="../../../../catalog.xml"/>
+          <pathelement location="../../../../../xhtml11/dtd/xhtmlcatalog.xml"/>
+        </catalogpath>
+      </xmlcatalog>
+      <factory name="net.sf.saxon.TransformerFactoryImpl"/>
+      <classpath location="${oxygenlib}/saxon9ee.jar"/>
+      <param name="directory" expression="file:///${outputTempDir}"/>
+      <!-- supply name of language-->
+      <param name="lang" expression="${lang}" if="lang"/>
+      <!-- emit some diagnostics"-->
+      <param name="debug" expression="${debug}" if="debug"/>
+      <!-- be verbose-->
+      <param name="verbose" expression="${verbose}" if="verbose"/>
+    </xslt>
+  </target>
+
+  <target name="cleanup" unless="debug">  
+    <delete dir="${outputTempDir}"/>
+  </target>
+
+</project>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/relaxng/build-to.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tei-print.css
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/tei-print.css	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/tei-print.css	(revision 258)
@@ -0,0 +1,78 @@
+/* 
+** Copyright 2008 TEI Consortium
+
+$Id: tei-print.css 6500 2009-06-05 12:24:45Z rahtz $
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+ This library 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
+Lesser General Public License for more details.
+ You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the 
+Free Software Foundation, Inc., 
+59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+@import url(tei.css);
+
+/* elements */
+
+  /* Use Helvetica by preference for most body text. Style hyperlinks with 
+     color only. Use white-space:pre-wrap or equivalent for code blocks
+     so text doesn't get cut off. */
+
+a {
+   text-decoration: none;
+}
+
+a:visited {
+   color:inherit;
+}
+
+body { 
+   font-family: Helvetica, Arial, sans-serif;
+   font-size: 10pt;
+}
+
+div.pre, div.pre_eg, pre.eg {
+   font-family: courier, "Courier New", fixed, monospace;
+   font-size: 9pt;
+   /* see http://cheeaun.phoenity.com/weblog/2005/06/whitespace-and-generated-content.html
+      for explanation of the white-space property cascade. pre-wrap is needed so long
+      lines won't be cut off in print. When browser support for CSS 2.1 is solid, proprietary
+      properties may be removed. */
+   white-space: pre; /* CSS2 */
+   white-space: -moz-pre-wrap; /* Mozilla */
+   white-space: -o-pre-wrap; /* Opera 7 */
+   white-space: pre-wrap; /* CSS 2.1 */
+   white-space: pre-line; /* CSS 3 (and 2.1 as well, actually) */
+   word-wrap: break-word; /* IE */
+   }
+
+div.pre_eg, pre.eg {
+   page-break-inside:avoid;
+}
+
+
+td {
+   font-size: 10pt;
+}
+
+td.maintext, td.maintext p {
+   font-family: Helvetica, Arial, sans-serif;
+}
+   
+/* classes */
+
+.plain {
+   font-family: Helvetica, Arial, sans-serif;
+}
+
+div.pagebreak {
+    page-break-before: always;
+}
\ No newline at end of file
Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/html/build-to.xml
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/html/build-to.xml	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/html/build-to.xml	(revision 258)
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="utf-8"?>
+<project basedir="." default="dist" name="teitohtml">
+<!--
+	This library is free software; you can redistribute it and/or
+	modify it under the terms of the GNU Lesser General Public
+	License as published by the Free Software Foundation; either
+	version 2.1 of the License, or (at your option) any later version.
+	
+	This library 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
+	Lesser General Public License for more details.
+	
+	You should have received a copy of the GNU Lesser General Public
+	License along with this library; if not, write to the Free Software
+	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+	
+        Id: $Id: build-to.xml 9875 2011-12-04 18:27:43Z rahtz $
+        Copyright: 2011, TEI Consortium<
+-->
+  <!--
+ Convert TEI documents into HTML files.
+ -->
+  <!-- Path to TEI XML file. -->
+  <property name="inputFile" value=""/>
+  <!-- Path where the output ePUB file will be saved. -->
+  <property name="outputFile" value=""/>
+  <!-- which profile -->
+  <property name="profile" value="default"/>
+  <!-- where does oxygen keep stuff -->
+  <property name="oxygenlib" value=""/>
+  <!-- Stylesheet for transformation -->
+  <property name="stylesheetFile"  value="../profiles/${profile}/html/to.xsl"/>
+  <dirname property="inputFileDir" file="${inputFile}"/>
+  <dirname property="outputDir" file="${outputFile}"/>
+  <property name="outputTempDir" value="${outputDir}/temp-dir-for-ant"/>
+  <path id="classpath">
+    <pathelement path="${java.class.path}"/>
+  </path>
+  <import file="../odds2/build-to.xml"/>
+  <target name="setup">
+    <delete dir="${outputTempDir}"/>
+    <mkdir dir="${outputTempDir}"/>
+  </target>
+ 
+  <target name="transform">
+    <echo level="info">XSLT generate HTML files</echo>
+    <xslt force="yes" style="${stylesheetFile}" in="${outputTempDir}/tmp2.xml" out="${outputFile}" classpath="classpath">
+      <xmlcatalog>
+        <catalogpath>
+          <pathelement location="../../../../catalog.xml"/>
+          <pathelement location="../../../../../xhtml11/dtd/xhtmlcatalog.xml"/>
+        </catalogpath>
+      </xmlcatalog>
+      <factory name="net.sf.saxon.TransformerFactoryImpl"/>
+      <classpath location="${oxygenlib}/saxon9ee.jar"/>
+      <param name="directory" expression="file:///${outputTempDir}"/>
+      <param name="inputDir" expression="${inputFileDir}/"/>
+      <param name="cssFile" expression="${cssFile}" if="cssFile"/>
+      <!-- name of media overlay file -->
+      <param name="mediaoverlay" expression="${mediaoverlay}" if="mediaoverlay"/>
+      <!-- file per page -->
+      <param name="filePerPage" expression="${filePerPage}" if="filePerPage"/>
+      <!-- supply name of language-->
+      <param name="lang" expression="${lang}" if="lang"/>
+      <!-- emit some diagnostics"-->
+      <param name="debug" expression="${debug}" if="debug"/>
+      <!-- be verbose-->
+      <param name="verbose" expression="${verbose}" if="verbose"/>
+    </xslt>
+  </target>
+
+ <target name="dist" depends="setup,odd,notodd,transform,cleanup"/>
+
+  <target name="cleanup" unless="debug">  
+    <delete dir="${outputTempDir}"/>
+  </target>
+
+</project>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/html/build-to.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tei.css
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/tei.css	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/tei.css	(revision 258)
@@ -0,0 +1,1294 @@
+/* 
+** Copyright 2011 TEI Consortium
+
+$Id: tei.css 10179 2012-03-25 14:46:46Z rahtz $
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+ This library 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
+Lesser General Public License for more details.
+ You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the 
+Free Software Foundation, Inc., 
+59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+
+/* main layout */
+
+body.simple {
+   color: #000000;
+   background-color: #FFFFFF;
+   margin: 10pt;
+}
+
+body{
+   color: #000000;
+   background-color: #FFFFFF;
+   margin: 10pt;
+   padding:0;
+   font-family: Verdana, Tahoma, Geneva, Arial, Helvetica, sans-serif;
+}
+
+body.pagetable {
+   color: #000000;
+   background-color: #FFFFFF;
+}
+
+/* 3 columns allowed for, or just a right and left */  
+#col1{
+   width: 20%;
+   background: #FFFFFF;
+   margin: 0;
+   margin-top: 10px;
+   color: #000066;
+   padding: 5px;
+   position : absolute;
+   float: left;
+   border-style: solid;
+   border-width: 1px;
+   border-color: red;
+}
+
+#col2{
+   background: #FFFFFF;
+   color: #333333;
+   border-style: solid;
+   border-width: 1px;
+   border-color: #000000;
+   margin: 0;
+   margin-top: 10px;
+   padding: 5px ;
+   left: 22%;
+   width: 51%;
+   position : absolute;
+}
+
+#col3{
+   width: 24%;
+   left: 75%;
+   color: #000066;
+   background: #FFFFFF;
+   border-style: solid;
+   border-width: 1px;
+   border-color: red;
+   margin: 0;
+   margin-top: 10px;
+   padding: 5px;
+   position : absolute;
+   float: right;
+}
+
+#lh-col{
+   width: 16%;
+   color: #000000;
+   margin-top: 2pt;
+   margin-right: 10pt;
+   padding: 5px;
+   background-color: #FFFFFF;
+   float: left;
+   font-weight:normal;
+}
+
+#rh-col{
+   background-color: #FFFFFF;
+   color: #333333;
+   margin: 2pt;
+   padding: 5px ;
+   float: right;
+   width: 75%;
+   font-weight:normal;
+}
+
+
+/* now the layers of the header */
+
+/* the main title */
+div.stdheader {
+      border-bottom: 1pt solid black;
+}
+
+#hdr{
+   width: auto;
+   margin: 0;
+   background-repeat : no-repeat;
+   overflow : inherit;
+}
+
+/* a navigation bar */
+#hdr2{
+   width: auto;
+   color: #000000;
+   font-family: Arial,Helvetica,sans-serif;
+   font-weight: bold;
+   background-color : #99CCFF;
+   padding-left : 5px;
+   padding-bottom : 2px;
+   padding-top : 2px;
+   padding-right : 5px;
+}
+
+/* a breadcrumb trail */
+#hdr3{
+   width: auto;
+   color: #000000;
+   background-color : #AD06BC;
+   padding-left : 5px;
+   padding-bottom : 2px;
+   padding-top : 2px;
+   padding-right : 5px;
+   font-family: Arial,Helvetica,sans-serif;
+   font-weight : bold;
+   font-size: smaller;
+}
+
+.bannerright {
+   position : absolute;
+   right : 5px;
+   color: #FFFFFF;
+   font-family : Arial, Helvetica, sans-serif;
+   font-size : 0.8em;
+   font-weight : bold;
+   text-decoration: none;
+}
+
+/* section headings */
+#hdr h1 { color: red; }
+h1 {
+   font-weight: bold;
+   font-size: 2em;
+   line-height: 34pt;
+}
+
+h2 {
+   font-size: larger;
+   line-height: 20pt;
+   margin-top: 18pt;
+   font-weight: bold;
+}
+
+h3 {
+   font-size: larger;
+   line-height: 18pt;
+   font-weight: bold;
+   font-style: italic;
+}
+
+
+h1.maintitle {
+   margin-left: 100px;
+   font-family: Arial,Helvetica,sans-serif;
+   font-weight: bold;
+   bottom: 5px;
+}
+
+h1.title {
+   margin-left: 100px;
+   font-family: Arial,Helvetica,sans-serif;
+   font-weight: bold;
+   bottom: 5px;
+}
+
+h2.institution {
+   margin-left: 100px;
+   font-family: Arial,Helvetica,sans-serif;
+}
+
+h2.department {
+   margin-left: 100px;
+   font-family: Arial,Helvetica,sans-serif;
+}
+
+h2.subtitle {
+   margin-left: 100px;
+   font-family: Arial,Helvetica,sans-serif;
+   font-weight: bold;
+}
+
+.footer {
+   text-align : center;
+   font-family: Arial,Helvetica,sans-serif; 
+   font-size : 0.8em;
+}
+
+
+
+/* components of the breadcrumb trail */
+a.breadcrumb{
+   color: #FFFFFF;
+   text-decoration: none;
+   padding-right : 5px;
+   font-family: Arial,Helvetica,sans-serif;
+   font-weight : bold;
+   font-size : 0.8em;
+}
+
+ul.breadcrumb
+{
+   display: inline;
+   font-size: 1.1em;
+}
+
+li.breadcrumb
+{
+   padding-left: 12px;
+   padding-right: 5px;
+   display: inline;
+   color: #000000;
+   background: url(/images/rightarrow.gif);
+   background-repeat: no-repeat;
+   background-position: left;
+}
+li.breadcrumb-first
+{
+   padding-left: 12px;
+   padding-right: 5px;
+   display: inline;
+   color: #000000;
+   background: url(/images/rightarrow.gif);
+   background-repeat: no-repeat;
+   background-position: left;
+}
+
+div.breadcrumb {
+   display: inline;
+}
+
+.skiplinks{
+   font-family: arial, sans-serif;
+   color: #FFFFFF;
+   font-weight : bold;
+   font-size : 0.8em;
+   text-decoration: none;
+   padding-right : 15px;
+}
+
+.tocontent{
+   color : #000066;
+   display : none;
+}
+
+.hide{
+   display : none;
+}
+
+.framestdlink {
+   color: red;
+   font-size: smaller;
+   font-weight: bold;
+}
+
+a:hover
+{
+   text-decoration: underline;
+}
+
+a.navbar:link
+{
+   color: #FFFFFF;
+   text-decoration: none;
+}
+
+a.navbar:visited
+{
+   color: #FFFFFF;
+   text-decoration: none;
+}
+
+a.navbar:hover {
+   color: #FFFFFF;
+   text-decoration: underline;
+}
+
+
+/* for use when making pages using a table */
+td.hdr2 {
+   color: #000000;
+   background-color : #99CCFF;
+}
+td.hdr3 {
+   background-color : #AD06BC;
+   border: 1pt solid #000000;
+}
+
+td.sidetext {
+   border-right: 1pt solid #000000;
+}
+td.maintext p {
+   font-family: Arial,Helvetica,sans-serif;
+}
+
+td.maintext {
+   background-color: #FFFFFF;
+   font-family: Arial,Helvetica,sans-serif;
+   color: #000000;
+   padding-left: 6pt;
+   padding-right: 6pt;
+}
+
+table.wovenodd td,p.wovenodd {
+   background-color: #FFFFFF;
+}
+
+/* an inner <text>, eg inside a <q> */
+div.innertext {
+   margin: 6pt;
+   border: 1pt solid red;
+}
+/* literal code */
+
+div.cdata {
+    white-space: pre;
+    clear:both;
+}
+
+pre,div.pre,div.pre_eg,pre.eg,div.eg {
+    clear:both;
+    margin-top: 1em;
+    margin-bottom:1em;
+    border-top-width: 4px;
+    border-bottom-width: 4px;
+    border-left-width: 2px;
+    border-right-width: 2px;
+    border-style: solid;
+    padding-top: 10px;
+    padding-right: 10px;
+    padding-bottom: 10px;
+    padding-left: 10px;
+    color: #000000;
+    line-height: 1.1em;
+    font-family: monospace;
+    font-size: 10pt;
+    white-space: pre;
+}
+
+div.egXML_valid {
+    background-color: #f7f9f6;
+    border-color: #c5d8bb;
+    }
+div.egXML_feasible {
+    background-color: #fff9f3;
+    border-color: #ffe1ad;
+    }
+div.egXML_invalid {
+    border-color: #ffe7e8 ;
+    background-color:  #fdbbac;
+    }
+
+
+/* table of contents */
+ul.toc {list-style: none;}
+li.toc {list-style: none;}
+
+/* table of contents links */
+
+a.inlinetoc:link,a.inlinetoc:visited
+{
+   color: #7A7A7A;
+   font-size: smaller; 
+   text-decoration: none;
+}
+
+a.inlinetoc-this:visited,a.inlinetoc-this:link
+{   
+   font-size: smaller; 
+   color: #000000;
+   font-weight: bold; 
+   text-decoration: underline;
+}
+
+a.inlinetoc-sub:visited,a.inlinetoc-sub:link
+{
+   text-decoration: none;
+   color: #000000;
+   font-weight: normal;
+   font-size: smaller; 
+}
+
+span.toclist{
+   font-size: smaller; 
+   font-family: Arial,Helvetica,sans-serif;
+   font-weight: bold;
+}
+
+p.toclist0 {
+   margin-left: 0.5em; 
+   margin-top: 1pt; 
+   margin-bottom: 3pt; 
+   text-indent: -0.5em;
+   font-size: small;    
+}
+
+p.toclist1 {
+   margin-left: 1em; 
+   margin-top: 1pt; 
+   margin-bottom: 2pt; 
+   text-indent: -0.7em;
+   font-size: small;    
+}
+
+p.toclist2 {
+   margin-left: 1.5em; 
+   text-indent: -1em;
+   font-size: small;    
+}
+
+p.toclist3 {
+   margin-left: 2em; 
+   text-indent: -1.5em;
+   font-size: small;    
+}
+
+span.toclist-this {
+   color: red;
+}
+
+a.toclist:visited,a.toclist:link
+{
+   font-weight: bold; 
+   color: #000000;
+   text-decoration: none;
+}
+
+
+
+/* notes */
+div.noteHeading {
+   margin-top: 9pt;
+   border: 0;
+   border-top: 1pt;
+   border-style: solid;
+   padding-top: 6pt;
+   font-size: larger;
+   font-weight: bold;
+}
+div.noteBody {
+  display:inline;
+}
+
+div.note {
+   margin-left: 1em; 
+   margin-bottom: 4pt; 
+   text-indent: -1em;
+}
+
+span.noteLabel {
+    font-style: italic;
+}
+span.noteNumber:before {
+    content: "[";
+}
+span.noteNumber:after {
+    content: "]. ";
+}
+
+span.note {
+    font-size: smaller;
+}
+/* images */
+img.display {
+   margin-top: 10pt;
+   margin-bottom: 10pt;
+   display: block;
+}
+.caption {
+   font-style: italic;
+}
+span.caption {
+   display: block;
+}
+
+.floatimage {
+   float : left;
+   margin-right : 6px;
+   vertical-align : top;
+}
+/* specialized divs */
+div.letter {
+   margin-left: 2em;
+   margin-right: 2em;
+   margin-top: 6pt;
+   margin-bottom: 6pt;
+   border-top: 1pt solid green;
+   border-bottom: 1pt solid green;
+}
+/* title page */
+div.titlePage,div.titlepage {
+   border-top: 2pt solid #000000;
+   border-bottom: 2pt solid #000000;
+   padding-top: 6pt;
+   padding-bottom: 6pt;
+   font-size: larger;
+   text-align: center;
+}
+.docImprint {
+    display: block;
+   font-style: italic;    
+}
+.docDate {
+   font-style: italic;    
+}
+.docTitle {
+    display: block;
+    margin-top: 6pt;
+    font-weight: bold;
+    margin-bottom: 18pt;
+}
+.docAuthor {
+    font-style: italic;
+}
+
+.byline {
+    display: block;
+}   
+
+div.dateline{
+   text-align: right;
+}
+/* verse */
+div.lg {
+   margin-left: 10px;
+   margin-bottom: 10px;
+}
+
+div.signed {
+    text-align:left;
+}
+div.l {
+    text-align:left;
+    margin-left: 1em;
+}
+div.epigraph {
+    margin: 20pt;
+}
+div.numbering {
+    float:left; 
+    font-size:smaller; 
+    width: 2em;
+}
+
+div.linenumber { }
+
+div.indent1 {
+   margin-left: 1em;
+}
+div.indent2 {
+   margin-left: 2em;
+}
+div.indent3 {
+   margin-left: 3em;
+}
+div.indent4 {
+   margin-left: 4em;
+}
+div.indent5 {
+   margin-left: 5em;
+}
+div.indent6 {
+   margin-left: 6em;
+}
+
+/* general purpose block aligns */
+.centerbold {
+    text-align:center;
+    font-weight: bold;
+}
+.center {
+    text-align:center;
+}
+.right {
+    text-align:right;
+}
+.left {
+    text-align:left;
+}
+
+/* misc inline*/
+
+span.foreign {
+    font-style: italic;
+}
+
+.plain {
+   text-decoration: none;
+}
+
+p.box {
+   border: 1pt solid #000000;
+}
+
+.small {
+   font-size: small;
+}
+
+td.label {
+   font-weight: bold;
+   background-color: #AAAAAA;
+}
+tr.label td {
+   font-weight: bold;
+   background-color: #AAAAAA;
+}
+
+span.label {
+    font-weight: bold;
+}
+
+h5 {    
+   font-size: 100%;
+}
+h6 {    
+   font-size: 100%;
+}
+
+div.tocFront {
+   border-bottom: 1pt solid #000000;
+}
+div.tocBack {
+   border-bottom: 1pt solid #000000;
+}
+div.tocBody {
+   border-bottom: 1pt solid #000000;
+}
+/* a listBibl rend='labels' */
+div.listBibl {
+	     margin-top: 6pt;
+	     margin-bottom: 6pt;
+}
+div.bibl {
+   margin-left: 0.5em; 
+   text-indent: -0.5em;
+}
+div.biblfree {
+   font-size: smaller; 
+   font-style:italic;
+   margin-left: 0.5em; 
+   text-indent: -0.5em;
+   margin-bottom: 6pt;
+}
+
+span.biblLabel {
+    font-weight: bold;
+    margin-right: 1em;
+}
+
+/* a <bibl> inside a <cit> */
+div.citbibl:before {
+    content: "(";
+}
+div.citbibl:after {
+    content: ")";
+}
+div.citbibl {
+   text-align:right;
+   font-size: smaller;
+}
+/* a <quote> inside a <cit> */
+div.citquote {
+   margin-left: 10pt;
+   margin-right: 10pt;
+}
+
+/* gloss lists with bold labels */
+dt {
+   font-weight: bold;
+}
+div.blockquote {
+   margin: 10pt;
+}
+
+/* generic <hi> */
+span.hi {
+   font-weight: bold;
+}
+
+/* from drama */
+/* speeches in drama */
+div.p-in-sp {
+    margin-left: 1em;
+    }
+div.sp {
+    margin-top: 4pt;
+}
+div.spProse {
+    text-indent: -1em;
+    margin-left: 1em;
+}
+div.speaker {
+    font-weight: bold;
+}
+span.speaker {
+    font-style: italic;
+}
+
+span.actor {  
+	   font-style:italic;
+}
+span.camera {
+ font-style: italic;
+}
+span.caption {
+ font-style: italic;
+}
+span.role {
+ font-style: italic;
+}
+span.set {
+ font-style: italic;
+}
+span.sound {
+ font-style: italic;
+}
+span.stage {
+ font-style: italic;
+}
+span.tech {
+ font-style: italic;
+}
+span.view {
+ font-style: italic;
+}
+span.mentioned {
+   font-style: italic;
+}
+span.nextLink {
+   font-style: italic;
+}
+span.previousLink {
+   font-style: italic;
+}
+span.upLink {
+   font-style: italic;
+}
+p, div.p {
+ margin-top: 0.3em;
+}
+/* bibl */
+span.titlem {
+    font-style: italic;
+}
+span.titlej {
+    font-style: italic;
+}
+span.titleu {
+}
+span.titles {
+}
+
+span.margnote,div.margnote {
+             display: block;
+	     font-size: smaller;
+	     clear: right;
+	     padding: 4pt;
+	     font-style: italic;
+	     width: 10%;
+	     float:right; 
+	     border: solid green 1pt; 
+	     margin: 6pt;
+}
+
+div.floatingText_back {
+    border-top: solid black 1pt;
+}
+div.floatingText_front {
+    border-top: solid black 1pt;
+}
+div.floatingText {
+    margin: 6pt;
+    border: solid black 1pt;
+}
+div.pagebreak,span.pagebreak {
+    display: block;
+    color: grey;
+    float: right;
+}
+span.element {
+    font-weight: bold;
+    color: black;
+}
+span.unclear {
+    font-weight: bold;
+}
+span.wordtypeNN, span.wordtypeNNS {
+    color: green;
+    }
+span.wordtypeVVD,span.wordtypeVVN,span.wordtypeVVN,span.wordtypeVVZ,span.wordtypeVVG, span.wordtypeVV {
+    color: red;
+    }
+
+li.headless {
+    display: none;
+}
+span.hi {
+    font-weight: bold;
+}
+
+div.footer {
+    border-top: solid black 1pt;
+}
+
+div.stdfooter {
+    border-top: solid black 1pt;
+    border-bottom: solid black 1pt;
+}
+
+div.altfigure {
+    border-top: solid black 1pt;
+    border-bottom: solid black 1pt;
+}
+
+table.table, table.table tr, table.table td {
+    border: solid black 1pt;
+}
+table.table td {
+    padding: 1ex 1ex 1ex 1ex;
+}
+p.mainAuthor {
+    display: block;
+    margin: 1ex 0ex 1ex 0ex;
+}
+p.mainEditor {
+    display: block;
+    margin: 1ex 0ex 1ex 0ex;
+}
+
+/* ODD-specific styles */
+/* tables for reference display */
+table.wovenodd {
+    width: 100%;
+    clear: both;
+}
+td.wovenodd-col1 {
+    width:15%;
+    vertical-align: top;
+}
+td.wovenodd-col2 {
+    width:85%;
+}
+table.wovenodd tr td {
+    border: 1px solid #555;
+    padding:1%;
+}
+table.wovenodd {
+    border-spacing:0px;
+    border-collapse:collapse;
+}
+table.wovenodd tr td {
+    border-spacing:0px;
+}
+table.wovenodd tr {
+    border-spacing:0px;
+    border-collapse:collapse;
+}
+table.wovenodd tr td table.attList {
+    border-spacing:0px;
+    border:none;
+}
+table.wovenodd tr td table.attList tr {
+    border-spacing:0px;
+    border:none;
+}
+table.wovenodd tr td table.attList tr td {
+    border-spacing:0px;
+    border:none;
+}
+table.attList {
+    table-layout: fixed;
+    width: 100%;
+    margin: 0pt;
+    padding: 0pt;
+}
+td.odd_label {
+    vertical-align: top;
+    width: 10%;
+    font-weight: bold;
+}
+td.odd_value {
+    vertical-align: top;
+    width: 90%;
+}
+table.attDef {
+    table-layout: fixed;
+    width: 100%;
+}
+table.attDef td.odd_label {
+    width: 10%;
+    vertical-align: top;
+    font-weight: normal;
+}
+table.attDef td.odd_value {
+    vertical-align: top;
+    width: 90%;
+}
+table.attList  td.odd_label:before {
+    content: "@";
+}
+table.attDef  td.odd_label:before {
+    content: "";
+}
+table.valList  td.odd_label:before {
+    content: "";
+}
+table.valList {
+    table-layout: fixed;
+    width: 100%;
+}
+table.valList td.odd_label {
+    width: 10%;
+    vertical-align: top;
+    font-style: normal;
+    font-weight: normal;
+}
+table.valList td.odd_value {
+    vertical-align: top;
+    width: 90%;
+}
+table.specDesc td.Attribute {
+    font-weight: bold;
+    vertical-align: top;
+}
+table.specDesc {
+    margin-left: 1em;
+}
+td p {
+    margin-top: 0pt;
+    margin-bottom: 2pt;
+}
+
+div.cdata {
+    white-space: pre;
+    clear:both;
+}
+
+span.tag:before {
+     
+}
+span.tag:after {
+     
+}
+span.gi,span.tag {
+}
+span.att {
+     
+}
+span.att:before {
+    content: "@";
+}
+span.ident, 
+span.ident-class, span.ident-datatype, span.ident-frag,
+span.ident-ge,    span.ident-macro,    span.ident-module,
+span.ident-pe,    span.ident-rng,      span.ident-schema  {
+    font-weight: bold;
+}
+
+span.ident-file, span.ident-ns {
+    font-style: italic;
+}
+
+button.displayRelaxButton {
+    margin-right: 2px;
+    margin-top: 2px;
+    font-size: 70%;
+    float: right;
+    cursor: pointer;
+}
+pre.RNG_XML {
+	    display: none;
+	    }
+
+span.RNG_XML {
+	    display: none;
+	    }
+
+/* pretty printing of XML */
+td.classSpec, td.macroSpec {
+    font-weight: bold;
+}
+a.link_odd_element:link,a.link_odd_element:visited {		   
+    /*     color: #006400; */
+}
+a.link_odd_macro:link,a.link_odd_macro:visited {
+
+}
+a.link_odd_class:link,a.link_odd_class:visited {
+
+}
+span.element {
+    font-weight: bold;
+    color: black;
+}
+td.elementSpec,span.elementname {
+    font-weight: bold;
+    color: #222288;
+}
+span.highlightelementname {
+    color: red;
+}
+
+span.attribute {
+    color: #222288;
+}
+span.attributevalue {
+    color: black;
+}
+span.comment {
+    color: black;
+    font-style:italic;
+}
+span.namespace {
+    color: #222288;
+}
+/* pretty print rnc */
+span.rnc_nc {
+    color: #006400;
+}
+span.rnc_decl {
+    color: green;
+}
+span.rnc_prefix {
+    color: blue;
+}
+span.rnc_param {
+    color: gray;
+}
+span.rnc_atom {
+    color: yellow;
+}
+span.rnc_annot {
+    color: #FF8040;
+}
+span.rnc_comment {
+    color: #FF00FF;
+}
+span.rnc_annot {
+    color: #00FFFF;
+}
+span.rnc_type {
+    color: purple;
+}
+span.rnc_keyword {
+    color: teal;
+}
+span.defaultVal {
+    font-weight: bold;
+}
+span.required {
+    font-weight: bold;
+}
+div.moduleSpec {
+    padding: 1px;
+    margin: 1px;
+    background-color: #C0C0C0;
+    color:inherit;
+    clear:right;
+}
+span.moduleSpecHead {
+    font-style: italic;
+}
+ul.specList li {
+    list-style: none;
+}
+span.specList-macroSpec {
+    font-weight: bold;
+}
+span.specList-elementSpec {
+    font-weight: bold;
+}
+span.specList-elementSpec:before {
+    content: "<";
+     
+}
+span.specList-elementSpec:after {
+    content: ">";
+     
+}
+span.specList-classSpec {
+    font-weight: bold;
+}
+span.specName {
+    color: #223377;
+    font-weight: bold;
+}
+/* A -Z Styles From http://www.smileycat.com/miaow/archives/000211.php -styling the a to z */
+#azindex {
+    background-color: #ddd;
+    color:inherit;
+    display: block;
+    margin: 0px;
+    float: left;
+    padding: 5px;
+    width: 75%;
+    border: 1px solid #999;
+}
+#azindex p {
+    color: #fff;
+    background-color: #000060;
+    padding: 4px;
+    display: block;
+    margin: 0;
+    border-bottom: 1px solid #333;
+    font-size: 0.95em;
+}
+.index {
+    font: bold 100% Verdana, Helvetica, sans-serif;
+    margin: 0;
+    padding: 0;
+}
+.index li {
+    float: left;
+    height: 1.5em;
+    list-style-type: none;
+    margin: 0.35em 0.15em;
+    padding: 0;
+    width: 1.5em;
+}
+.index a:link, .index a:visited {
+    background: #fff;
+    color: navy;
+    display: block;
+    height: 1.5em;
+    padding: 0.37em 0 0 0;
+    text-align: center;
+    text-decoration: none;
+    width: 1.5em;
+    border: 1px solid #999;
+}
+li.showall, li.showall a:visited,li.showall a:link {
+    width: 10em;
+}
+* html .index li {
+    margin: 0.2em 0.2em;
+}
+ul.index li a:hover {
+    background-color: #93D1E4;
+    color: #fff;
+    text-decoration: underline;
+}
+div.atozwrapper {
+   float: left;
+   width: 70%;
+}
+div.atoz {    
+   clear: left;
+   float: left;
+}    
+#byMod {
+   margin-top: 12px;
+   clear: left;
+}
+ul.atoz {
+    list-style: none;
+    text-align:left;
+    margin: 2px;
+    padding: 2px;
+    background-color: #eef;
+    color:inherit;
+}
+.atoz li {
+    padding: 0px;
+    display: inline;
+}
+span.listhead {
+    margin-top: 0em;
+    margin-right: 1em;
+    padding-left: 3px;
+    padding-right: 3px;
+    color: #000066;
+    font-weight: bold;
+    font-size: large;
+}
+/* End of A - Z styles */
+div.specChildren {
+    margin: 0em;
+    padding: 0em;
+}
+span.specChildModule {
+    font-weight: bold;
+}
+div.specChild {
+    margin-bottom: 4pt;
+    margin-left: 25px;
+    text-indent: -30px;
+}
+span.emptySlash:after {
+    content: "/";
+}
+/* status notation */
+.status_deprecated:after {
+    content: " (deprecated)";
+    color: red;
+}
+.status_changed:after {
+    content: " (changed)";
+    color: blue;
+}
+.status_unstable:after {
+    content: " (unstable)";
+    color: orange;
+}
+.status_deprecated {
+    border: solid red 1pt;
+}
+.status_changed {
+    border: solid blue 1pt;
+}
+.status_unstable {
+    border: solid orange 1pt;
+}
+/* <hi> rend values */
+span.typewriter{
+    font-family: monospace;
+}
+span.normalweight{
+}
+span.smallcaps{
+    font-variant: small-caps;
+}
+span.bold{
+    font-weight: bold;
+}
+span.italic{
+    font-style:italic;
+}
+span.capsall{
+    text-transform: uppercase;
+}
+span.strikethrough{
+    text-decoration: line-through;
+}
+span.strikedoublethrough{
+    text-decoration: line-through;
+}
+span.underline{
+    text-decoration: underline;
+}
+span.underwavyline{
+    text-decoration-line: underline;
+    text-decoration-style: wavy;
+}
+span.underdoubleline{
+    text-decoration: underline;
+}
+span.superscript {
+    vertical-align: top;
+    font-size: 70%;
+}
+span.subscript {
+    vertical-align: bottom;
+    font-size: 70%;
+}
+span.numberParagraph:before {
+    content:"[";
+}
+span.numberParagraph:after {
+    content:"] ";
+}
+span.numberParagraph {
+    font-size: smaller;
+    color: grey;
+}
Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/common2/msdescription.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/common2/msdescription.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/common2/msdescription.xsl	(revision 258)
@@ -0,0 +1,465 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:tei="http://www.tei-c.org/ns/1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="tei" version="2.0">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+    <desc>
+      <p> TEI stylesheet dealing with elements from the msdescription module. </p>
+      <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+      <p>Author: See AUTHORS</p>
+      <p>Id: $Id: msdescription.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+      <p>Copyright: 2011, TEI Consortium</p>
+    </desc>
+  </doc>
+
+
+  <xsl:template name="msSection">
+    <xsl:param name="heading"/>
+    <xsl:param name="level"/>
+    <xsl:param name="implicitBlock"/>
+    <xsl:apply-templates/>
+  </xsl:template>
+  <xsl:template name="msBlock">
+    <xsl:param name="style"/>
+    <xsl:apply-templates/>
+  </xsl:template>
+  <xsl:template name="msInline">
+    <xsl:param name="before"/>
+    <xsl:param name="after"/>
+    <xsl:param name="style"/>
+    <xsl:value-of select="$before"/>
+    <xsl:apply-templates/>
+    <xsl:value-of select="$after"/>
+  </xsl:template>
+  <xsl:template name="msLabelled">
+    <xsl:param name="before"/>
+    <xsl:value-of select="$before"/>
+    <xsl:text>: </xsl:text>
+    <xsl:apply-templates/>
+  </xsl:template>
+  <xsl:template name="msLiteral">
+    <xsl:param name="text"/>
+    <xsl:value-of select="$text"/>
+  </xsl:template>
+  <!-- headings -->
+  <xsl:template match="tei:accMat">
+    <xsl:call-template name="msSection">
+      <xsl:with-param name="level">2</xsl:with-param>
+      <xsl:with-param name="heading">
+        <xsl:text>Accompanying material</xsl:text>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <xsl:template match="tei:additional">
+    <xsl:call-template name="msSection">
+      <xsl:with-param name="level">2</xsl:with-param>
+      <xsl:with-param name="heading">
+        <xsl:text>Additional</xsl:text>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <xsl:template match="tei:bindingDesc">
+    <xsl:call-template name="msSection">
+      <xsl:with-param name="level">2</xsl:with-param>
+      <xsl:with-param name="heading">
+        <xsl:text>Binding</xsl:text>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <xsl:template match="tei:msContents">
+    <xsl:call-template name="msSection">
+      <xsl:with-param name="level">1</xsl:with-param>
+      <xsl:with-param name="heading">
+        <xsl:text>Contents</xsl:text>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <xsl:template match="tei:msDesc/tei:head">
+    <xsl:call-template name="msBlock">
+      <xsl:with-param name="style">msHead</xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <xsl:template match="tei:history">
+    <xsl:call-template name="msSection">
+      <xsl:with-param name="level">1</xsl:with-param>
+      <xsl:with-param name="heading">
+        <xsl:text>History</xsl:text>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <xsl:template match="tei:provenance">
+    <xsl:call-template name="msSection">
+      <xsl:with-param name="level">2</xsl:with-param>
+      <xsl:with-param name="heading">
+        <xsl:text>Provenance</xsl:text>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <xsl:template match="tei:acquisition">
+    <xsl:call-template name="msSection">
+      <xsl:with-param name="level">2</xsl:with-param>
+      <xsl:with-param name="heading">
+        <xsl:text>Acquisition</xsl:text>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <xsl:template match="tei:origin">
+    <xsl:call-template name="msSection">
+      <xsl:with-param name="level">2</xsl:with-param>
+      <xsl:with-param name="heading">
+        <xsl:text>Origin</xsl:text>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <xsl:template match="tei:msIdentifier">
+    <xsl:call-template name="msSection">
+      <xsl:with-param name="level">1</xsl:with-param>
+      <xsl:with-param name="heading">
+        <xsl:text>Identification</xsl:text>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <xsl:template match="tei:layoutDesc">
+    <xsl:call-template name="msSection">
+      <xsl:with-param name="level">3</xsl:with-param>
+      <xsl:with-param name="heading">
+        <xsl:text>Layout</xsl:text>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <xsl:template match="tei:decoDesc">
+    <xsl:call-template name="msSection">
+      <xsl:with-param name="level">3</xsl:with-param>
+      <xsl:with-param name="heading">
+        <xsl:text>Decoration</xsl:text>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <xsl:template match="tei:msWriting">
+    <xsl:call-template name="msSection">
+      <xsl:with-param name="level">2</xsl:with-param>
+      <xsl:with-param name="heading">
+        <xsl:text>Writing</xsl:text>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <xsl:template match="tei:musicNotation">
+    <xsl:call-template name="msSection">
+      <xsl:with-param name="level">2</xsl:with-param>
+      <xsl:with-param name="heading">
+        <xsl:text>Music notation</xsl:text>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <xsl:template match="tei:objectDesc">
+    <xsl:call-template name="msSection">
+      <xsl:with-param name="level">2</xsl:with-param>
+      <xsl:with-param name="heading">
+        <xsl:text>Object</xsl:text>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <xsl:template match="tei:physDesc">
+    <xsl:call-template name="msSection">
+      <xsl:with-param name="level">1</xsl:with-param>
+      <xsl:with-param name="heading">
+        <xsl:text>Physical description</xsl:text>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <xsl:template match="tei:seal">
+    <xsl:call-template name="msSection">
+      <xsl:with-param name="level">4</xsl:with-param>
+      <xsl:with-param name="heading">
+        <xsl:text>Seal</xsl:text>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <xsl:template match="tei:sealDesc">
+    <xsl:call-template name="msSection">
+      <xsl:with-param name="level">3</xsl:with-param>
+      <xsl:with-param name="heading">
+        <xsl:text>Seal description</xsl:text>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <xsl:template match="tei:supportDesc">
+    <xsl:call-template name="msSection">
+      <xsl:with-param name="level">3</xsl:with-param>
+      <xsl:with-param name="heading">
+        <xsl:text>Support description</xsl:text>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <xsl:template match="tei:support">
+    <xsl:call-template name="msSection">
+      <xsl:with-param name="level">4</xsl:with-param>
+      <xsl:with-param name="heading">
+        <xsl:text>Support</xsl:text>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <xsl:template match="tei:collation">
+    <xsl:call-template name="msSection">
+      <xsl:with-param name="level">4</xsl:with-param>
+      <xsl:with-param name="heading">
+        <xsl:text>Collation</xsl:text>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <xsl:template match="tei:extent">
+    <xsl:call-template name="msSection">
+      <xsl:with-param name="level">4</xsl:with-param>
+      <xsl:with-param name="implicitBlock">true</xsl:with-param>
+      <xsl:with-param name="heading">
+        <xsl:text>Extent</xsl:text>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <xsl:template match="tei:incipit">
+    <xsl:call-template name="msSection">
+      <xsl:with-param name="level">2</xsl:with-param>
+      <xsl:with-param name="heading">
+        <xsl:text>Incipit</xsl:text>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <xsl:template match="tei:explicit">
+    <xsl:call-template name="msSection">
+      <xsl:with-param name="level">2</xsl:with-param>
+      <xsl:with-param name="heading">
+        <xsl:text>Explicit</xsl:text>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <xsl:template match="tei:msItem/tei:listBibl">
+    <xsl:call-template name="msSection">
+      <xsl:with-param name="level">2</xsl:with-param>
+      <xsl:with-param name="heading">
+        <xsl:text>Text editions</xsl:text>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <!-- inline -->
+  <xsl:template match="tei:abbr">
+    <xsl:choose>
+      <xsl:when test="parent::tei:choice">
+	</xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="msInline"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <xsl:template match="tei:orig">
+    <xsl:choose>
+      <xsl:when test="parent::tei:choice">
+	</xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="msInline"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <xsl:template match="tei:textLang">
+    <xsl:choose>
+      <xsl:when test="preceding-sibling::tei:summary"/>
+      <xsl:when test="preceding-sibling::tei:*">
+        <xsl:call-template name="msLiteral">
+          <xsl:with-param name="text">
+            <xsl:text>, </xsl:text>
+          </xsl:with-param>
+        </xsl:call-template>
+      </xsl:when>
+    </xsl:choose>
+    <xsl:call-template name="msLabelled">
+      <xsl:with-param name="before">Language of text</xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <xsl:template match="tei:summary">
+    <xsl:choose>
+      <xsl:when test="preceding-sibling::tei:*">
+        <xsl:call-template name="msLiteral">
+          <xsl:with-param name="text">
+            <xsl:text>, </xsl:text>
+          </xsl:with-param>
+        </xsl:call-template>
+      </xsl:when>
+    </xsl:choose>
+    <xsl:call-template name="msLabelled">
+      <xsl:with-param name="before">Summary</xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <xsl:template match="tei:rubric">
+    <xsl:if test="preceding-sibling::tei:*">
+      <xsl:call-template name="msLiteral">
+        <xsl:with-param name="text">
+          <xsl:text> </xsl:text>
+        </xsl:with-param>
+      </xsl:call-template>
+    </xsl:if>
+    <xsl:call-template name="msInline"/>
+  </xsl:template>
+  <xsl:template match="tei:msItem/tei:author">
+    <xsl:if test="preceding-sibling::tei:*">
+      <xsl:call-template name="msLiteral">
+        <xsl:with-param name="text">
+          <xsl:text> </xsl:text>
+        </xsl:with-param>
+      </xsl:call-template>
+    </xsl:if>
+    <xsl:call-template name="msInline"/>
+  </xsl:template>
+  <xsl:template match="tei:msItem/tei:title">
+    <xsl:if test="preceding-sibling::tei:*">
+      <xsl:call-template name="msLiteral">
+        <xsl:with-param name="text">
+          <xsl:text> </xsl:text>
+        </xsl:with-param>
+      </xsl:call-template>
+    </xsl:if>
+    <xsl:call-template name="msInline">
+      <xsl:with-param name="style">italic</xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <xsl:template match="tei:expan/tei:ex">
+    <xsl:call-template name="msInline">
+      <xsl:with-param name="before">(</xsl:with-param>
+      <xsl:with-param name="after">)</xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <xsl:template match="tei:locus">
+    <xsl:call-template name="msInline">
+      <xsl:with-param name="style">bold</xsl:with-param>
+      <xsl:with-param name="before"/>
+      <xsl:with-param name="after">: </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <xsl:template match="tei:supplied[@reason='damage']">
+    <xsl:call-template name="msInline">
+      <xsl:with-param name="before">&lt;</xsl:with-param>
+      <xsl:with-param name="after">&gt;</xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <xsl:template match="tei:supplied[@reason='illegible']">
+    <xsl:call-template name="msInline">
+      <xsl:with-param name="before">[</xsl:with-param>
+      <xsl:with-param name="after">]</xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <xsl:template match="tei:supplied[@reason='omitted']">
+    <xsl:call-template name="msInline">
+      <xsl:with-param name="before">⟨</xsl:with-param>
+      <xsl:with-param name="after">⟩</xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <xsl:template match="tei:gap" priority="10">
+    <xsl:call-template name="msInline">
+      <xsl:with-param name="before">[...]</xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <xsl:template match="tei:unclear" priority="10">
+    <xsl:call-template name="msInline">
+      <xsl:with-param name="after">[?]</xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <xsl:template match="tei:placeName|tei:genName|tei:geogName|tei:roleName|tei:name|tei:persName">
+    <xsl:choose>
+      <xsl:when test="*">
+        <xsl:apply-templates/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="msInline"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <xsl:template match="tei:dimensions">
+    <xsl:for-each select="*">
+      <xsl:apply-templates select="."/>
+      <xsl:call-template name="msLiteral">
+        <xsl:with-param name="text">
+          <xsl:choose>
+            <xsl:when test="string-length(.)=0 and @extent">
+              <xsl:value-of select="@extent"/>
+            </xsl:when>
+            <xsl:when test="@unit">
+              <xsl:value-of select="@unit"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:text>mm</xsl:text>
+            </xsl:otherwise>
+          </xsl:choose>
+          <xsl:if test="following-sibling::*">
+            <xsl:text> x </xsl:text>
+          </xsl:if>
+        </xsl:with-param>
+      </xsl:call-template>
+    </xsl:for-each>
+  </xsl:template>
+  <xsl:template match="tei:origDate">
+    <xsl:apply-imports/>
+    <xsl:if test="following-sibling::tei:origPlace">
+      <xsl:call-template name="msLiteral">
+        <xsl:with-param name="text">
+          <xsl:text>, </xsl:text>
+        </xsl:with-param>
+      </xsl:call-template>
+    </xsl:if>
+  </xsl:template>
+  <xsl:template match="tei:msIdentifier/tei:*">
+    <xsl:apply-imports/>
+    <xsl:if test="following-sibling::tei:*/text()">
+      <xsl:call-template name="msLiteral">
+        <xsl:with-param name="text">
+          <xsl:text>, </xsl:text>
+        </xsl:with-param>
+      </xsl:call-template>
+    </xsl:if>
+  </xsl:template>
+  <!--
+    <handNote scribe="AM_544_4to_1"
+    script="carolingian-insular minuscule"
+    medium="ink" scope="sole"> 
+-->
+  <xsl:template match="tei:handNote">
+    <xsl:if test="not(preceding-sibling::tei:handNote)">
+      <xsl:variable name="Notes">
+        <tei:list type="ordered">
+          <xsl:for-each select="../tei:handNote">
+            <item>
+              <xsl:copy-of select="*|text()"/>
+            </item>
+          </xsl:for-each>
+        </tei:list>
+      </xsl:variable>
+      <xsl:apply-templates select="$Notes"/>
+    </xsl:if>
+  </xsl:template>
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/common2/msdescription.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/common2/figures.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/common2/figures.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/common2/figures.xsl	(revision 258)
@@ -0,0 +1,279 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:tei="http://www.tei-c.org/ns/1.0"
+                
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                exclude-result-prefixes="tei"
+                version="2.0">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet dealing with elements from the figures module. </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: figures.xsl 10042 2012-01-13 15:23:16Z rahtz $</p>
+         <p>Copyright: 2011, TEI Consortium</p>
+      </desc>
+   </doc>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element figure</desc>
+   </doc>
+  <xsl:template match="tei:figure" mode="xref">
+      <xsl:choose>
+	<xsl:when test="tei:head">
+	  <xsl:call-template name="calculateFigureNumber"/>
+	  <xsl:text>, </xsl:text>
+	  <xsl:apply-templates mode="plain" select="tei:head"/>
+	</xsl:when>
+	<xsl:otherwise>
+            <xsl:text>this figure</xsl:text>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element table</desc>
+   </doc>
+  <xsl:template match="tei:table" mode="xref">
+      <xsl:choose>
+         <xsl:when test="$numberTables='true'">
+	   <xsl:call-template name="calculateTableNumber"/>
+            <xsl:if test="tei:head">
+               <xsl:text>. </xsl:text>
+               <xsl:apply-templates mode="plain" select="tei:head"/>
+            </xsl:if>
+         </xsl:when>
+         <xsl:otherwise>
+	   <xsl:choose>
+            <xsl:when test="tei:head">
+               <xsl:apply-templates mode="plain" select="tei:head"/>
+	    </xsl:when>
+	    <xsl:otherwise>
+	      <xsl:text>table</xsl:text>
+	    </xsl:otherwise>
+	   </xsl:choose>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[latex] Analyze attributes of graphics inclusion<param name="mode">Type of output (fo, html, latex) being
+    created</param>
+      </desc>
+   </doc>
+  <xsl:template name="graphicsAttributes">
+      <xsl:param name="mode">fo</xsl:param>
+      <xsl:if test="@width">
+         <xsl:choose>
+            <xsl:when test="ends-with(@width,'%')">
+               <xsl:choose>
+                  <xsl:when test="$mode='fo'">
+                     <xsl:attribute name="content-width">
+                        <xsl:value-of select="@width"/>
+                     </xsl:attribute>
+                  </xsl:when>
+                  <xsl:when test="$mode='latex'">
+                     <xsl:text>width=</xsl:text>
+                     <xsl:value-of select="number(substring-before(@width,'%')) div 100"/>
+                     <xsl:text>\textwidth,</xsl:text>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:attribute name="width">
+                        <xsl:value-of select="@width"/>
+                     </xsl:attribute>
+                  </xsl:otherwise>
+               </xsl:choose>
+            </xsl:when>
+            <xsl:otherwise>
+               <xsl:variable name="w">
+                  <xsl:choose>
+                     <xsl:when test="ends-with(@width,'pt')">
+                        <xsl:value-of select="@width"/>
+                     </xsl:when>
+                     <xsl:when test="ends-with(@width,'px') and $mode='latex'">
+                        <xsl:value-of select="substring-before(@width,'px')"/>
+                        <xsl:text>pt</xsl:text>
+                     </xsl:when>
+                     <xsl:when test="ends-with(@width,'in')">
+                        <xsl:value-of select="@width"/>
+                     </xsl:when>
+                     <xsl:when test="ends-with(@width,'px')">
+                        <xsl:value-of select="@width"/>
+                     </xsl:when>
+                     <xsl:when test="ends-with(@width,'cm')">
+                        <xsl:value-of select="@width"/>
+                     </xsl:when>
+                     <xsl:otherwise>
+                        <xsl:value-of select="@width"/>
+                        <xsl:text>pt</xsl:text>
+                     </xsl:otherwise>
+                  </xsl:choose>
+               </xsl:variable>
+               <xsl:choose>
+                  <xsl:when test="$mode='fo'">
+                     <xsl:attribute name="content-width">
+                        <xsl:value-of select="$w"/>
+                     </xsl:attribute>
+                  </xsl:when>
+                  <xsl:when test="$mode='latex'">
+                     <xsl:text>width=</xsl:text>
+                     <xsl:value-of select="$w"/>
+                     <xsl:text>,</xsl:text>
+                  </xsl:when>
+               </xsl:choose>
+            </xsl:otherwise>
+         </xsl:choose>
+      </xsl:if>
+      <xsl:if test="@height">
+         <xsl:choose>
+            <xsl:when test="ends-with(@height,'%')">
+               <xsl:choose>
+                  <xsl:when test="$mode='fo'">
+                     <xsl:attribute name="content-height">
+                        <xsl:value-of select="@height"/>
+                     </xsl:attribute>
+                  </xsl:when>
+                  <xsl:when test="$mode='latex'">
+                     <xsl:text>height=</xsl:text>
+                     <xsl:value-of select="number(substring-before(@height,'%')) div 100"/>
+                     <xsl:text>\textheight,</xsl:text>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:attribute name="height">
+                        <xsl:value-of select="@height"/>
+                     </xsl:attribute>
+                  </xsl:otherwise>
+               </xsl:choose>
+            </xsl:when>
+            <xsl:otherwise>
+               <xsl:variable name="h">
+                  <xsl:choose>
+                     <xsl:when test="ends-with(@height,'pt')">
+                        <xsl:value-of select="@height"/>
+                     </xsl:when>
+                     <xsl:when test="ends-with(@height,'px') and $mode='latex'">
+                        <xsl:value-of select="substring-before(@height,'px')"/>
+                        <xsl:text>pt</xsl:text>
+                     </xsl:when>
+                     <xsl:when test="ends-with(@height,'in')">
+                        <xsl:value-of select="@height"/>
+                     </xsl:when>
+                     <xsl:when test="ends-with(@height,'px')">
+                        <xsl:value-of select="@height"/>
+                     </xsl:when>
+                     <xsl:when test="ends-with(@height,'cm')">
+                        <xsl:value-of select="@height"/>
+                     </xsl:when>
+                     <xsl:otherwise>
+                        <xsl:value-of select="@height"/>
+                        <xsl:text>pt</xsl:text>
+                     </xsl:otherwise>
+                  </xsl:choose>
+               </xsl:variable>
+               <xsl:choose>
+                  <xsl:when test="$mode='fo'">
+                     <xsl:attribute name="content-height">
+                        <xsl:value-of select="$h"/>
+                     </xsl:attribute>
+                  </xsl:when>
+                  <xsl:when test="$mode='latex'">
+                     <xsl:text>height=</xsl:text>
+                     <xsl:value-of select="$h"/>
+                     <xsl:text>,</xsl:text>
+                  </xsl:when>
+               </xsl:choose>
+            </xsl:otherwise>
+         </xsl:choose>
+      </xsl:if>
+      <xsl:variable name="s">
+         <xsl:choose>
+            <xsl:when test="@scale and ends-with(@scale,'%')">
+               <xsl:value-of select="number(substring-before(@scale,'%')) div 100"/>
+            </xsl:when>
+            <xsl:when test="@scale">
+               <xsl:value-of select="@scale"/>
+            </xsl:when>
+            <xsl:when test="not(@width) and not(@height) and not($standardScale=1)">
+               <xsl:value-of select="$standardScale"/>
+            </xsl:when>
+         </xsl:choose>
+      </xsl:variable>
+      <xsl:if test="not($s='')">
+         <xsl:choose>
+            <xsl:when test="$mode='fo'">
+               <xsl:attribute name="scale">
+                  <xsl:value-of select="$s"/>
+               </xsl:attribute>
+            </xsl:when>
+            <xsl:when test="$mode='latex'">
+               <xsl:text>scale=</xsl:text>
+               <xsl:value-of select="$s"/>
+               <xsl:text>,</xsl:text>
+            </xsl:when>
+         </xsl:choose>
+      </xsl:if>
+  </xsl:template>
+
+  <xsl:template name="calculateFigureNumber">
+    <xsl:choose>
+      <xsl:when test="ancestor::tei:front and  $numberFrontFigures='true'">
+	<xsl:call-template name="i18n">
+	  <xsl:with-param name="word">figureWord</xsl:with-param>
+	</xsl:call-template>
+	<xsl:text> </xsl:text>
+	<xsl:number count="tei:figure[tei:head]" from="tei:front" level="any"/>
+      </xsl:when>
+      <xsl:when test="ancestor::tei:back and $numberBackFigures='true'">
+	<xsl:call-template name="i18n">
+	  <xsl:with-param name="word">figureWord</xsl:with-param>
+	</xsl:call-template>
+	<xsl:text> </xsl:text>
+	<xsl:number count="tei:figure[tei:head]" from="tei:back" level="any"/>
+      </xsl:when>
+      <xsl:when test="ancestor::tei:body and $numberFigures='true'">
+	<xsl:call-template name="i18n">
+	  <xsl:with-param name="word">figureWord</xsl:with-param>
+	</xsl:call-template>
+	<xsl:text> </xsl:text>
+	<xsl:number count="tei:figure[tei:head]" from="tei:body" level="any"/>
+      </xsl:when>
+    </xsl:choose>    
+  </xsl:template>
+
+
+  <xsl:template name="calculateTableNumber">
+    <xsl:call-template name="i18n">
+      <xsl:with-param name="word">tableWord</xsl:with-param>
+    </xsl:call-template>
+    <xsl:text> </xsl:text>
+    <xsl:number level="any"/>
+  </xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/common2/figures.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/common2/tagdocs.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/common2/tagdocs.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/common2/tagdocs.xsl	(revision 258)
@@ -0,0 +1,2704 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:s="http://www.ascc.net/xml/schematron" xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:rng="http://relaxng.org/ns/structure/1.0" xmlns:tei="http://www.tei-c.org/ns/1.0" xmlns:teix="http://www.tei-c.org/ns/Examples" xmlns:sch="http://purl.oclc.org/dsdl/schematron" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="fo s a tei html rng teix xs sch" version="2.0">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+    <desc>
+      <p> TEI stylesheet for weaving TEI ODD documents</p>
+      <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+      <p>Author: See AUTHORS</p>
+      <p>Id: $Id: tagdocs.xsl 10197 2012-03-28 21:44:10Z rahtz $</p>
+      <p>Copyright: 2011, TEI Consortium</p>
+    </desc>
+  </doc>
+  <xsl:key name="CHILDMOD" match="Element" use="@module"/>
+
+
+  <xsl:template match="tei:ptr|tei:ref" mode="weave">
+    <xsl:choose>
+      <xsl:when test="ancestor::tei:remarks or ancestor::tei:listRef or ancestor::tei:valDesc">
+        <xsl:choose>
+          <xsl:when test="starts-with(@target,'#') and id(substring(@target,2))">
+            <xsl:call-template name="makeInternalLink">
+              <xsl:with-param name="target" select="substring(@target,2)"/>
+              <xsl:with-param name="ptr" select="if (self::tei:ptr)
+						 then true() else false()"/>
+              <xsl:with-param name="dest">
+                <xsl:call-template name="generateEndLink">
+                  <xsl:with-param name="where">
+                    <xsl:value-of select="substring(@target,2)"/>
+                  </xsl:with-param>
+                </xsl:call-template>
+              </xsl:with-param>
+            </xsl:call-template>
+          </xsl:when>
+          <xsl:when test="starts-with(@target,'#')">
+            <xsl:variable name="Chapter">
+              <xsl:value-of select="substring(@target,2,2)"/>
+            </xsl:variable>
+            <xsl:choose>
+              <xsl:when test="$Chapter='AB' or        $Chapter='AI' or        $Chapter='CC' or        $Chapter='CE' or        $Chapter='CH' or        $Chapter='CO' or        $Chapter='DI' or        $Chapter='DR' or        $Chapter='DS' or        $Chapter='FS' or        $Chapter='FT' or        $Chapter='GD' or        $Chapter='HD' or        $Chapter='MS' or        $Chapter='ND' or        $Chapter='NH' or        $Chapter='PH' or        $Chapter='SA' or        $Chapter='SG' or        $Chapter='ST' or        $Chapter='TC' or        $Chapter='TD' or        $Chapter='TS' or        $Chapter='USE' or        $Chapter='VE' or        $Chapter='WD'">
+                <xsl:call-template name="makeExternalLink">
+		  <xsl:with-param name="ptr" select="if (self::tei:ptr)
+						 then true() else false()"/>
+                  <xsl:with-param name="dest">
+                    <xsl:text>http://www.tei-c.org/release/doc/tei-p5-doc/</xsl:text>
+                    <xsl:value-of select="$documentationLanguage"/>
+                    <xsl:text>/html/</xsl:text>
+                    <xsl:value-of select="$Chapter"/>
+                    <xsl:text>.html</xsl:text>
+                    <xsl:value-of select="@target"/>
+                  </xsl:with-param>
+                </xsl:call-template>
+              </xsl:when>
+              <xsl:otherwise>
+                <xsl:text>«</xsl:text>
+                <xsl:value-of select="@target"/>
+                <xsl:text>»</xsl:text>
+              </xsl:otherwise>
+            </xsl:choose>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:apply-imports/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:apply-imports/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="tei:attDef" mode="summary">
+    <xsl:variable name="name">
+      <xsl:choose>
+        <xsl:when test="tei:altIdent">
+          <xsl:value-of select="tei:altIdent"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="@ident"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:element namespace="{$outputNS}" name="{$rowName}">
+      <xsl:element namespace="{$outputNS}" name="{$cellName}">
+        <xsl:attribute name="{$rendName}">
+          <xsl:text>odd_label</xsl:text>
+          <xsl:if test="@status">
+            <xsl:text> status_</xsl:text>
+            <xsl:value-of select="@status"/>
+          </xsl:if>
+        </xsl:attribute>
+        <xsl:element namespace="{$outputNS}" name="{$codeName}">
+          <xsl:attribute name="{$rendName}">
+            <xsl:text>att</xsl:text>
+          </xsl:attribute>
+          <xsl:value-of select="$name"/>
+        </xsl:element>
+      </xsl:element>
+      <xsl:element namespace="{$outputNS}" name="{$cellName}">
+        <xsl:attribute name="{$rendName}">
+          <xsl:text>odd_value</xsl:text>
+        </xsl:attribute>
+        <xsl:call-template name="makeDescription"/>
+        <xsl:apply-templates select="valList"/>
+      </xsl:element>
+    </xsl:element>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element attDef</desc>
+  </doc>
+  <xsl:template match="tei:attDef">
+    <xsl:variable name="name">
+      <xsl:choose>
+        <xsl:when test="tei:altIdent">
+          <xsl:value-of select="tei:altIdent"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="@ident"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:element namespace="{$outputNS}" name="{$rowName}">
+      <xsl:element namespace="{$outputNS}" name="{$cellName}">
+        <xsl:attribute name="{$rendName}">
+          <xsl:text>odd_label</xsl:text>
+          <xsl:if test="@status">
+            <xsl:text> status_</xsl:text>
+            <xsl:value-of select="@status"/>
+          </xsl:if>
+        </xsl:attribute>
+        <xsl:value-of select="$name"/>
+      </xsl:element>
+      <xsl:element namespace="{$outputNS}" name="{$cellName}">
+        <xsl:attribute name="{$rendName}">
+          <xsl:text>odd_value</xsl:text>
+        </xsl:attribute>
+        <xsl:call-template name="makeDescription"/>
+        <xsl:element namespace="{$outputNS}" name="{$tableName}">
+          <xsl:attribute name="{$rendName}">
+            <xsl:text>attDef</xsl:text>
+          </xsl:attribute>
+          <xsl:element namespace="{$outputNS}" name="{$rowName}">
+            <xsl:element namespace="{$outputNS}" name="{$cellName}">
+              <xsl:attribute name="{$rendName}">
+                <xsl:text>odd_label</xsl:text>
+              </xsl:attribute>
+              <xsl:element namespace="{$outputNS}" name="{$hiName}">
+                <xsl:attribute name="{$rendName}">
+                  <xsl:text>label</xsl:text>
+                </xsl:attribute>
+                <xsl:attribute name="xml:lang">
+                  <xsl:value-of select="$documentationLanguage"/>
+                </xsl:attribute>
+                <xsl:call-template name="i18n">
+                  <xsl:with-param name="word">Status</xsl:with-param>
+                </xsl:call-template>
+              </xsl:element>
+              <xsl:text> </xsl:text>
+            </xsl:element>
+            <xsl:element namespace="{$outputNS}" name="{$cellName}">
+              <xsl:attribute name="{$rendName}">
+                <xsl:text>odd_value</xsl:text>
+              </xsl:attribute>
+              <xsl:element namespace="{$outputNS}" name="{$segName}">
+                <xsl:attribute name="xml:lang">
+                  <xsl:value-of select="$documentationLanguage"/>
+                </xsl:attribute>
+                <xsl:choose>
+                  <xsl:when test="@usage='mwa'">
+                    <xsl:call-template name="i18n">
+                      <xsl:with-param name="word">Mandatory when applicable</xsl:with-param>
+                    </xsl:call-template>
+                  </xsl:when>
+                  <xsl:when test="@usage='opt'">
+                    <xsl:call-template name="i18n">
+                      <xsl:with-param name="word">Optional</xsl:with-param>
+                    </xsl:call-template>
+                  </xsl:when>
+                  <xsl:when test="@usage='rec'">
+                    <xsl:call-template name="i18n">
+                      <xsl:with-param name="word">Recommended</xsl:with-param>
+                    </xsl:call-template>
+                  </xsl:when>
+                  <xsl:when test="@usage='req'">
+                    <xsl:element namespace="{$outputNS}" name="{$hiName}">
+                      <xsl:attribute name="{$rendName}">
+                        <xsl:text>required</xsl:text>
+                      </xsl:attribute>
+                      <xsl:call-template name="i18n">
+                        <xsl:with-param name="word">Required</xsl:with-param>
+                      </xsl:call-template>
+                    </xsl:element>
+                  </xsl:when>
+                  <xsl:when test="@usage='rwa'">
+                    <xsl:call-template name="i18n">
+                      <xsl:with-param name="word">Recommended when applicable</xsl:with-param>
+                    </xsl:call-template>
+                  </xsl:when>
+                  <xsl:otherwise>
+                    <xsl:call-template name="i18n">
+                      <xsl:with-param name="word">Optional</xsl:with-param>
+                    </xsl:call-template>
+                  </xsl:otherwise>
+                </xsl:choose>
+              </xsl:element>
+            </xsl:element>
+          </xsl:element>
+          <xsl:apply-templates mode="weave"/>
+        </xsl:element>
+      </xsl:element>
+    </xsl:element>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element attDef/tei:datatype</desc>
+  </doc>
+  <xsl:template match="tei:attDef/tei:datatype" mode="weave">
+    <xsl:element namespace="{$outputNS}" name="{$rowName}">
+      <xsl:element namespace="{$outputNS}" name="{$cellName}">
+        <xsl:attribute name="{$rendName}">
+          <xsl:text>odd_label</xsl:text>
+        </xsl:attribute>
+        <xsl:element namespace="{$outputNS}" name="{$hiName}">
+          <xsl:attribute name="xml:lang">
+            <xsl:value-of select="$documentationLanguage"/>
+          </xsl:attribute>
+          <xsl:attribute name="{$rendName}">
+            <xsl:text>label</xsl:text>
+          </xsl:attribute>
+          <xsl:call-template name="i18n">
+            <xsl:with-param name="word">Datatype</xsl:with-param>
+          </xsl:call-template>
+        </xsl:element>
+        <xsl:text> </xsl:text>
+      </xsl:element>
+      <xsl:element namespace="{$outputNS}" name="{$cellName}">
+        <xsl:attribute name="{$rendName}">
+          <xsl:text>odd_value</xsl:text>
+        </xsl:attribute>
+        <xsl:variable name="minOccurs">
+          <xsl:choose>
+            <xsl:when test="@minOccurs">
+              <xsl:value-of select="@minOccurs"/>
+            </xsl:when>
+            <xsl:otherwise>1</xsl:otherwise>
+          </xsl:choose>
+        </xsl:variable>
+        <xsl:variable name="maxOccurs">
+          <xsl:choose>
+            <xsl:when test="@maxOccurs='unbounded'">
+              <xsl:text>∞</xsl:text>
+            </xsl:when>
+            <xsl:when test="@maxOccurs">
+              <xsl:value-of select="@maxOccurs"/>
+            </xsl:when>
+            <xsl:otherwise>1</xsl:otherwise>
+          </xsl:choose>
+        </xsl:variable>
+        <xsl:if test="$minOccurs != '1'  or  $maxOccurs != '1'">
+          <xsl:text> </xsl:text>
+          <xsl:value-of select="$minOccurs"/>
+          <xsl:text>–</xsl:text>
+          <xsl:value-of select="$maxOccurs"/>
+          <xsl:text> </xsl:text>
+          <xsl:element namespace="{$outputNS}" name="{$segName}">
+            <xsl:attribute name="xml:lang">
+              <xsl:value-of select="$documentationLanguage"/>
+            </xsl:attribute>
+            <xsl:call-template name="i18n">
+              <xsl:with-param name="word">occurrences of</xsl:with-param>
+            </xsl:call-template>
+          </xsl:element>
+          <xsl:value-of select="$spaceCharacter"/>
+        </xsl:if>
+        <xsl:call-template name="bitOut">
+          <xsl:with-param name="grammar"/>
+          <xsl:with-param name="element">code</xsl:with-param>
+          <xsl:with-param name="content">
+            <Wrapper>
+              <xsl:copy-of select="rng:*"/>
+            </Wrapper>
+          </xsl:with-param>
+        </xsl:call-template>
+        <xsl:if test="$minOccurs != '1'  or  $maxOccurs != '1'">
+          <xsl:element namespace="{$outputNS}" name="{$segName}">
+            <xsl:attribute name="xml:lang">
+              <xsl:value-of select="$documentationLanguage"/>
+            </xsl:attribute>
+            <xsl:call-template name="i18n">
+              <xsl:with-param name="word">separated by whitespace</xsl:with-param>
+            </xsl:call-template>
+          </xsl:element>
+        </xsl:if>
+      </xsl:element>
+    </xsl:element>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element attList</desc>
+  </doc>
+  <xsl:template match="tei:attList" mode="show">
+    <xsl:call-template name="displayAttList">
+      <xsl:with-param name="mode">summary</xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element classSpec</desc>
+  </doc>
+  <xsl:template match="tei:classSpec">
+    <xsl:if test="parent::tei:specGrp">
+      <xsl:element namespace="{$outputNS}" name="{$dtName}"><xsl:element namespace="{$outputNS}" name="{$hiName}"><xsl:attribute name="{$rendName}"><xsl:text>label</xsl:text></xsl:attribute><xsl:attribute name="xml:lang"><xsl:value-of select="$documentationLanguage"/></xsl:attribute><xsl:call-template name="i18n"><xsl:with-param name="word">Class</xsl:with-param></xsl:call-template></xsl:element>: <xsl:value-of select="@ident"/></xsl:element>
+      <xsl:element namespace="{$outputNS}" name="{$ddName}">
+        <xsl:apply-templates mode="tangle" select="."/>
+        <xsl:text>(</xsl:text>
+        <xsl:element namespace="{$outputNS}" name="{$segName}">
+          <xsl:attribute name="xml:lang">
+            <xsl:value-of select="$documentationLanguage"/>
+          </xsl:attribute>
+          <xsl:call-template name="i18n">
+            <xsl:with-param name="word">Members</xsl:with-param>
+          </xsl:call-template>
+        </xsl:element>
+        <xsl:text>: </xsl:text>
+        <xsl:call-template name="generateMembers"/>
+        <xsl:text>)</xsl:text>
+      </xsl:element>
+    </xsl:if>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element classSpec</desc>
+  </doc>
+  <xsl:template match="tei:classSpec" mode="weavebody">
+    <xsl:variable name="name">
+      <xsl:choose>
+        <xsl:when test="tei:altIdent">
+          <xsl:value-of select="tei:altIdent"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="@ident"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:element namespace="{$outputNS}" name="{$sectionName}">
+      <xsl:call-template name="makeSectionHead">
+        <xsl:with-param name="id">
+          <xsl:value-of select="@ident"/>
+        </xsl:with-param>
+        <xsl:with-param name="name">
+          <xsl:value-of select="$name"/>
+        </xsl:with-param>
+      </xsl:call-template>
+      <xsl:element namespace="{$outputNS}" name="{$tableName}">
+        <xsl:attribute name="{$rendName}">
+          <xsl:text>wovenodd</xsl:text>
+        </xsl:attribute>
+        <xsl:element namespace="{$outputNS}" name="{$rowName}">
+          <xsl:element namespace="{$outputNS}" name="{$cellName}">
+            <xsl:attribute name="{$colspan}">2</xsl:attribute>
+            <xsl:attribute name="{$rendName}">
+              <xsl:text>wovenodd-col2</xsl:text>
+            </xsl:attribute>
+            <xsl:element namespace="{$outputNS}" name="{$hiName}">
+              <xsl:attribute name="{$rendName}">
+                <xsl:text>label</xsl:text>
+              </xsl:attribute>
+              <xsl:value-of select="$name"/>
+            </xsl:element>
+            <xsl:call-template name="specHook">
+              <xsl:with-param name="name">
+                <xsl:value-of select="$name"/>
+              </xsl:with-param>
+            </xsl:call-template>
+            <xsl:text>&#160;</xsl:text>
+            <xsl:call-template name="makeDescription"/>
+          </xsl:element>
+        </xsl:element>
+        <xsl:if test="@generate">
+          <xsl:element namespace="{$outputNS}" name="{$rowName}">
+            <xsl:element namespace="{$outputNS}" name="{$cellName}">
+              <xsl:attribute name="{$rendName}">
+                <xsl:text>wovenodd-col1</xsl:text>
+              </xsl:attribute>
+              <xsl:element namespace="{$outputNS}" name="{$segName}">
+                <xsl:attribute name="xml:lang">
+                  <xsl:value-of select="$documentationLanguage"/>
+                </xsl:attribute>
+                <xsl:call-template name="i18n">
+                  <xsl:with-param name="word">
+                    <xsl:text>Classes defined</xsl:text>
+                  </xsl:with-param>
+                </xsl:call-template>
+              </xsl:element>
+            </xsl:element>
+            <xsl:element namespace="{$outputNS}" name="{$cellName}">
+              <xsl:attribute name="{$rendName}">
+                <xsl:text>wovenodd-col2</xsl:text>
+              </xsl:attribute>
+              <xsl:value-of select="@generate"/>
+            </xsl:element>
+          </xsl:element>
+        </xsl:if>
+        <xsl:if test="@module">
+          <xsl:call-template name="moduleInfo"/>
+        </xsl:if>
+        <xsl:if test="@type='model'">
+          <xsl:element namespace="{$outputNS}" name="{$rowName}">
+            <xsl:element namespace="{$outputNS}" name="{$cellName}">
+              <xsl:attribute name="{$rendName}">
+                <xsl:text>wovenodd-col1</xsl:text>
+              </xsl:attribute>
+              <xsl:element namespace="{$outputNS}" name="{$hiName}">
+                <xsl:attribute name="{$rendName}">
+                  <xsl:text>label</xsl:text>
+                </xsl:attribute>
+                <xsl:attribute name="xml:lang">
+                  <xsl:value-of select="$documentationLanguage"/>
+                </xsl:attribute>
+                <xsl:call-template name="i18n">
+                  <xsl:with-param name="word">Used by</xsl:with-param>
+                </xsl:call-template>
+              </xsl:element>
+            </xsl:element>
+            <xsl:element namespace="{$outputNS}" name="{$cellName}">
+              <xsl:attribute name="{$rendName}">
+                <xsl:text>wovenodd-col2</xsl:text>
+              </xsl:attribute>
+              <xsl:call-template name="generateModelParents">
+                <xsl:with-param name="showElements">true</xsl:with-param>
+              </xsl:call-template>
+            </xsl:element>
+          </xsl:element>
+        </xsl:if>
+        <xsl:element namespace="{$outputNS}" name="{$rowName}">
+          <xsl:element namespace="{$outputNS}" name="{$cellName}">
+            <xsl:attribute name="{$rendName}">
+              <xsl:text>wovenodd-col1</xsl:text>
+            </xsl:attribute>
+            <xsl:element namespace="{$outputNS}" name="{$hiName}">
+              <xsl:attribute name="{$rendName}">
+                <xsl:text>label</xsl:text>
+              </xsl:attribute>
+              <xsl:attribute name="xml:lang">
+                <xsl:value-of select="$documentationLanguage"/>
+              </xsl:attribute>
+              <xsl:call-template name="i18n">
+                <xsl:with-param name="word">Members</xsl:with-param>
+              </xsl:call-template>
+            </xsl:element>
+          </xsl:element>
+          <xsl:element namespace="{$outputNS}" name="{$cellName}">
+            <xsl:attribute name="{$rendName}">
+              <xsl:text>wovenodd-col2</xsl:text>
+            </xsl:attribute>
+            <xsl:call-template name="generateMembers"/>
+          </xsl:element>
+        </xsl:element>
+        <xsl:if test="@type='atts'">
+          <xsl:element namespace="{$outputNS}" name="{$rowName}">
+            <xsl:element namespace="{$outputNS}" name="{$cellName}">
+              <xsl:attribute name="{$rendName}">
+                <xsl:text>wovenodd-col1</xsl:text>
+              </xsl:attribute>
+              <xsl:element namespace="{$outputNS}" name="{$hiName}">
+                <xsl:attribute name="{$rendName}">
+                  <xsl:text>label</xsl:text>
+                </xsl:attribute>
+                <xsl:attribute name="xml:lang">
+                  <xsl:value-of select="$documentationLanguage"/>
+                </xsl:attribute>
+                <xsl:call-template name="i18n">
+                  <xsl:with-param name="word">Attributes</xsl:with-param>
+                </xsl:call-template>
+              </xsl:element>
+            </xsl:element>
+            <xsl:element namespace="{$outputNS}" name="{$cellName}">
+              <xsl:attribute name="{$rendName}">
+                <xsl:text>wovenodd-col2</xsl:text>
+              </xsl:attribute>
+              <xsl:choose>
+                <xsl:when test="not(tei:attList)">
+                  <xsl:call-template name="showAttClasses"/>
+                </xsl:when>
+                <xsl:otherwise>
+                  <xsl:for-each select="tei:attList">
+                    <xsl:call-template name="displayAttList">
+                      <xsl:with-param name="mode">all</xsl:with-param>
+                    </xsl:call-template>
+                  </xsl:for-each>
+                </xsl:otherwise>
+              </xsl:choose>
+            </xsl:element>
+          </xsl:element>
+        </xsl:if>
+        <xsl:apply-templates mode="weave"/>
+      </xsl:element>
+    </xsl:element>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element classes</desc>
+  </doc>
+  <xsl:template match="tei:classes" mode="weave"> </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element elementSpec</desc>
+  </doc>
+  <xsl:template match="tei:elementSpec">
+    <xsl:if test="parent::tei:specGrp">
+      <xsl:element namespace="{$outputNS}" name="{$dtName}">
+        <xsl:element namespace="{$outputNS}" name="{$segName}">
+          <xsl:attribute name="xml:lang">
+            <xsl:value-of select="$documentationLanguage"/>
+          </xsl:attribute>
+          <xsl:call-template name="i18n">
+            <xsl:with-param name="word">Element</xsl:with-param>
+          </xsl:call-template>
+          <xsl:value-of select="$spaceCharacter"/>
+          <xsl:value-of select="@ident"/>
+        </xsl:element>
+      </xsl:element>
+      <xsl:element namespace="{$outputNS}" name="{$ddName}">
+        <xsl:apply-templates mode="tangle" select="."/>
+      </xsl:element>
+    </xsl:if>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element elementSpec</desc>
+  </doc>
+  <xsl:template match="tei:elementSpec" mode="weavebody">
+    <xsl:variable name="name">
+      <xsl:choose>
+        <xsl:when test="tei:altIdent">
+          <xsl:value-of select="tei:altIdent"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="@ident"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:element namespace="{$outputNS}" name="{$sectionName}">
+      <xsl:call-template name="makeSectionHead">
+        <xsl:with-param name="id">
+          <xsl:value-of select="@ident"/>
+        </xsl:with-param>
+        <xsl:with-param name="name">
+          <xsl:text>&lt;</xsl:text>
+          <xsl:choose>
+            <xsl:when test="tei:content/rng:empty">
+              <xsl:call-template name="emptySlash">
+                <xsl:with-param name="name">
+                  <xsl:value-of select="$name"/>
+                </xsl:with-param>
+              </xsl:call-template>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:value-of select="$name"/>
+            </xsl:otherwise>
+          </xsl:choose>
+          <xsl:text>&gt;</xsl:text>
+        </xsl:with-param>
+      </xsl:call-template>
+      <xsl:call-template name="specHook">
+        <xsl:with-param name="name">
+          <xsl:value-of select="$name"/>
+        </xsl:with-param>
+      </xsl:call-template>
+      <xsl:element namespace="{$outputNS}" name="{$tableName}">
+        <xsl:attribute name="{$rendName}">
+          <xsl:text>wovenodd</xsl:text>
+        </xsl:attribute>
+        <xsl:element namespace="{$outputNS}" name="{$rowName}">
+          <xsl:element namespace="{$outputNS}" name="{$cellName}">
+            <xsl:attribute name="{$colspan}">2</xsl:attribute>
+            <xsl:attribute name="{$rendName}">
+              <xsl:text>wovenodd-col2</xsl:text>
+            </xsl:attribute>
+            <xsl:element namespace="{$outputNS}" name="{$hiName}">
+              <xsl:attribute name="{$rendName}">
+                <xsl:text>label</xsl:text>
+              </xsl:attribute>
+              <xsl:text>&lt;</xsl:text>
+              <xsl:choose>
+                <xsl:when test="tei:content/rng:empty">
+                  <xsl:call-template name="emptySlash">
+                    <xsl:with-param name="name">
+                      <xsl:value-of select="$name"/>
+                    </xsl:with-param>
+                  </xsl:call-template>
+                </xsl:when>
+                <xsl:otherwise>
+                  <xsl:value-of select="$name"/>
+                </xsl:otherwise>
+              </xsl:choose>
+              <xsl:text>&gt; </xsl:text>
+            </xsl:element>
+            <xsl:call-template name="makeDescription"/>
+          </xsl:element>
+        </xsl:element>
+        <xsl:if test="@module">
+          <xsl:call-template name="moduleInfo"/>
+        </xsl:if>
+        <xsl:variable name="myatts">
+          <a>
+            <xsl:choose>
+              <xsl:when test="not(tei:attList)">
+                <xsl:call-template name="showAttClasses"/>
+              </xsl:when>
+              <xsl:otherwise>
+                <xsl:for-each select="tei:attList">
+                  <xsl:call-template name="displayAttList">
+                    <xsl:with-param name="mode">all</xsl:with-param>
+                  </xsl:call-template>
+                </xsl:for-each>
+              </xsl:otherwise>
+            </xsl:choose>
+          </a>
+        </xsl:variable>
+        <xsl:if test="count($myatts/a/*)&gt;0">
+          <xsl:element namespace="{$outputNS}" name="{$rowName}">
+            <xsl:element namespace="{$outputNS}" name="{$cellName}">
+              <xsl:attribute name="{$rendName}">
+                <xsl:text>wovenodd-col1</xsl:text>
+              </xsl:attribute>
+              <xsl:element namespace="{$outputNS}" name="{$hiName}">
+                <xsl:attribute name="{$rendName}">
+                  <xsl:text>label</xsl:text>
+                </xsl:attribute>
+                <xsl:attribute name="xml:lang">
+                  <xsl:value-of select="$documentationLanguage"/>
+                </xsl:attribute>
+                <xsl:call-template name="i18n">
+                  <xsl:with-param name="word">Attributes</xsl:with-param>
+                </xsl:call-template>
+              </xsl:element>
+            </xsl:element>
+            <xsl:element namespace="{$outputNS}" name="{$cellName}">
+              <xsl:attribute name="{$rendName}">
+                <xsl:text>wovenodd-col2</xsl:text>
+              </xsl:attribute>
+              <xsl:choose>
+                <xsl:when test="not(tei:attList)">
+                  <xsl:call-template name="showAttClasses"/>
+                </xsl:when>
+                <xsl:otherwise>
+                  <xsl:for-each select="tei:attList">
+                    <xsl:call-template name="displayAttList">
+                      <xsl:with-param name="mode">all</xsl:with-param>
+                    </xsl:call-template>
+                  </xsl:for-each>
+                </xsl:otherwise>
+              </xsl:choose>
+              <!--
+	      <xsl:for-each select="$myatts/a">
+		<xsl:copy-of select="*|text()"/>
+	      </xsl:for-each>
+-->
+            </xsl:element>
+          </xsl:element>
+        </xsl:if>
+        <xsl:element namespace="{$outputNS}" name="{$rowName}">
+          <xsl:element namespace="{$outputNS}" name="{$cellName}">
+            <xsl:attribute name="{$rendName}">
+              <xsl:text>wovenodd-col1</xsl:text>
+            </xsl:attribute>
+            <xsl:element namespace="{$outputNS}" name="{$hiName}">
+              <xsl:attribute name="{$rendName}">
+                <xsl:text>label</xsl:text>
+              </xsl:attribute>
+              <xsl:attribute name="xml:lang">
+                <xsl:value-of select="$documentationLanguage"/>
+              </xsl:attribute>
+              <xsl:call-template name="i18n">
+                <xsl:with-param name="word">Used by</xsl:with-param>
+              </xsl:call-template>
+            </xsl:element>
+          </xsl:element>
+          <xsl:element namespace="{$outputNS}" name="{$cellName}">
+            <xsl:attribute name="{$rendName}">
+              <xsl:text>wovenodd-col2</xsl:text>
+            </xsl:attribute>
+            <xsl:call-template name="generateModelParents">
+              <xsl:with-param name="showElements">false</xsl:with-param>
+            </xsl:call-template>
+          </xsl:element>
+        </xsl:element>
+        <xsl:element namespace="{$outputNS}" name="{$rowName}">
+          <xsl:element namespace="{$outputNS}" name="{$cellName}">
+            <xsl:attribute name="{$rendName}">
+              <xsl:text>wovenodd-col1</xsl:text>
+            </xsl:attribute>
+            <xsl:element namespace="{$outputNS}" name="{$hiName}">
+              <xsl:attribute name="{$rendName}">
+                <xsl:text>label</xsl:text>
+              </xsl:attribute>
+              <xsl:attribute name="xml:lang">
+                <xsl:value-of select="$documentationLanguage"/>
+              </xsl:attribute>
+              <xsl:call-template name="i18n">
+                <xsl:with-param name="word">Contained by</xsl:with-param>
+              </xsl:call-template>
+            </xsl:element>
+          </xsl:element>
+          <xsl:element namespace="{$outputNS}" name="{$cellName}">
+            <xsl:attribute name="{$rendName}">
+              <xsl:text>wovenodd-col2</xsl:text>
+            </xsl:attribute>
+            <xsl:call-template name="generateIndirectParents"/>
+          </xsl:element>
+        </xsl:element>
+        <xsl:element namespace="{$outputNS}" name="{$rowName}">
+          <xsl:element namespace="{$outputNS}" name="{$cellName}">
+            <xsl:attribute name="{$rendName}">
+              <xsl:text>wovenodd-col1</xsl:text>
+            </xsl:attribute>
+            <xsl:element namespace="{$outputNS}" name="{$hiName}">
+              <xsl:attribute name="{$rendName}">
+                <xsl:text>label</xsl:text>
+              </xsl:attribute>
+              <xsl:attribute name="xml:lang">
+                <xsl:value-of select="$documentationLanguage"/>
+              </xsl:attribute>
+              <xsl:call-template name="i18n">
+                <xsl:with-param name="word">
+                  <xsl:text>May contain</xsl:text>
+                </xsl:with-param>
+              </xsl:call-template>
+            </xsl:element>
+          </xsl:element>
+          <xsl:element namespace="{$outputNS}" name="{$cellName}">
+            <xsl:attribute name="{$rendName}">
+              <xsl:text>wovenodd-col2</xsl:text>
+            </xsl:attribute>
+            <xsl:call-template name="generateChildren"/>
+          </xsl:element>
+        </xsl:element>
+        <xsl:apply-templates mode="weave"/>
+      </xsl:element>
+    </xsl:element>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element elementSpec/tei:content</desc>
+  </doc>
+  <xsl:template match="tei:elementSpec/tei:content" mode="weave">
+    <xsl:variable name="name">
+      <xsl:choose>
+        <xsl:when test="../tei:altIdent">
+          <xsl:value-of select="../tei:altIdent"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="../@ident"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:element namespace="{$outputNS}" name="{$rowName}">
+      <xsl:element namespace="{$outputNS}" name="{$cellName}">
+        <xsl:attribute name="{$rendName}">
+          <xsl:text>wovenodd-col1</xsl:text>
+        </xsl:attribute>
+        <xsl:element namespace="{$outputNS}" name="{$hiName}">
+          <xsl:attribute name="{$rendName}">
+            <xsl:text>label</xsl:text>
+          </xsl:attribute>
+          <xsl:attribute name="xml:lang">
+            <xsl:value-of select="$documentationLanguage"/>
+          </xsl:attribute>
+          <xsl:call-template name="i18n">
+            <xsl:with-param name="word">Declaration</xsl:with-param>
+          </xsl:call-template>
+        </xsl:element>
+      </xsl:element>
+      <xsl:element namespace="{$outputNS}" name="{$cellName}">
+        <xsl:attribute name="{$rendName}">
+          <xsl:text>wovenodd-col2</xsl:text>
+        </xsl:attribute>
+        <xsl:call-template name="bitOut">
+          <xsl:with-param name="grammar"/>
+          <xsl:with-param name="content">
+            <Wrapper>
+              <rng:element name="{$name}">
+                <xsl:if test="not(key('SCHEMASPECS',1))">
+                  <xsl:if test="$autoGlobal='true'">
+                    <rng:ref name="att.global.attributes"/>
+                  </xsl:if>
+                  <xsl:for-each select="..">
+                    <xsl:call-template name="showClassAtts"/>
+                  </xsl:for-each>
+                </xsl:if>
+                <xsl:apply-templates mode="tangle" select="../tei:attList"/>
+                <xsl:copy-of select="rng:*"/>
+              </rng:element>
+            </Wrapper>
+          </xsl:with-param>
+        </xsl:call-template>
+        <xsl:for-each select="tei:valList[@type='closed']">
+          <xsl:call-template name="i18n">
+            <xsl:with-param name="word">Legal values are</xsl:with-param>
+          </xsl:call-template>
+          <xsl:text>:</xsl:text>
+          <xsl:call-template name="valListChildren"/>
+        </xsl:for-each>
+        <xsl:if test="s:*">
+          <xsl:element namespace="{$outputNS}" name="{$divName}">
+            <xsl:attribute name="{$rendName}">
+              <xsl:text>pre</xsl:text>
+            </xsl:attribute>
+            <xsl:apply-templates select="s:*" mode="verbatim"/>
+          </xsl:element>
+        </xsl:if>
+      </xsl:element>
+    </xsl:element>
+  </xsl:template>
+  <xsl:template match="tei:constraintSpec[parent::tei:elementSpec or parent::tei:attDef]" mode="weave">
+    <xsl:element namespace="{$outputNS}" name="{$rowName}">
+      <xsl:element namespace="{$outputNS}" name="{$cellName}">
+        <xsl:attribute name="{$rendName}">
+          <xsl:text>wovenodd-col1</xsl:text>
+        </xsl:attribute>
+        <xsl:element namespace="{$outputNS}" name="{$hiName}">
+          <xsl:attribute name="{$rendName}">
+            <xsl:text>label</xsl:text>
+          </xsl:attribute>
+          <xsl:attribute name="xml:lang">
+            <xsl:value-of select="$documentationLanguage"/>
+          </xsl:attribute>
+          <xsl:text>Schematron</xsl:text>
+        </xsl:element>
+      </xsl:element>
+      <xsl:element namespace="{$outputNS}" name="{$cellName}">
+        <xsl:attribute name="{$rendName}">
+          <xsl:text>wovenodd-col2</xsl:text>
+        </xsl:attribute>
+        <xsl:call-template name="makeDescription"/>
+        <xsl:for-each select="tei:constraint">
+          <xsl:element namespace="{$outputNS}" name="{$divName}">
+            <xsl:attribute name="{$rendName}">
+              <xsl:text>pre</xsl:text>
+            </xsl:attribute>
+            <xsl:apply-templates mode="verbatim"/>
+          </xsl:element>
+        </xsl:for-each>
+      </xsl:element>
+    </xsl:element>
+  </xsl:template>
+  <xsl:template name="showClassAtts">
+    <xsl:for-each select="tei:classes/tei:memberOf">
+      <xsl:for-each select="key('IDENTS',@key)">
+        <xsl:if test="tei:attList">
+          <rng:ref name="{@ident}.attributes"/>
+        </xsl:if>
+        <xsl:call-template name="showClassAtts"/>
+      </xsl:for-each>
+    </xsl:for-each>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process the specification elements elements, classes and macros<param name="atts">attributes we have been asked to display</param>
+      </desc>
+  </doc>
+  <xsl:template match="tei:elementSpec|tei:classSpec|tei:macroSpec" mode="show">
+    <xsl:param name="atts"/>
+    <xsl:variable name="name">
+      <xsl:choose>
+        <xsl:when test="tei:altIdent">
+          <xsl:value-of select="tei:altIdent"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="@ident"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:element namespace="{$outputNS}" name="{$hiName}">
+      <xsl:attribute name="{$rendName}">
+        <xsl:text>specList-</xsl:text>
+        <xsl:value-of select="local-name(.)"/>
+      </xsl:attribute>
+      <xsl:element namespace="{$outputNS}" name="{$xrefName}">
+        <xsl:attribute name="{$urlName}">
+          <xsl:choose>
+            <xsl:when test="number($splitLevel)=-1">
+              <xsl:text>#</xsl:text>
+              <xsl:value-of select="$idPrefix"/>
+              <xsl:value-of select="$name"/>
+            </xsl:when>
+            <xsl:when test="$STDOUT='true'">
+              <xsl:for-each select="key('IDENTS',$name)">
+                <xsl:call-template name="getSpecURL">
+                  <xsl:with-param name="name">
+                    <xsl:value-of select="$name"/>
+                  </xsl:with-param>
+                  <xsl:with-param name="type">
+                    <xsl:value-of select="substring-before(local-name(),'Spec')"/>
+                  </xsl:with-param>
+                </xsl:call-template>
+              </xsl:for-each>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:text>ref-</xsl:text>
+              <xsl:value-of select="$name"/>
+              <xsl:text>.html</xsl:text>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:attribute>
+        <xsl:value-of select="$name"/>
+        <xsl:for-each select="key('IDENTS',$name)">
+          <xsl:if test="tei:content/rng:empty">
+            <xsl:text>/</xsl:text>
+          </xsl:if>
+        </xsl:for-each>
+      </xsl:element>
+    </xsl:element>
+    <xsl:call-template name="showSpace"/>
+    <xsl:call-template name="makeDescription">
+      <xsl:with-param name="showListRef">false</xsl:with-param>
+    </xsl:call-template>
+    <xsl:choose>
+      <xsl:when test="$atts='-'"/>
+      <xsl:when test="$atts='+'">
+        <xsl:call-template name="showAttClasses">
+          <xsl:with-param name="minimal">true</xsl:with-param>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:when test="$atts=''"/>
+      <xsl:when test="string-length($atts)&gt;0">
+        <xsl:element namespace="{$outputNS}" name="{$tableName}">
+          <xsl:attribute name="{$rendName}">
+            <xsl:text>specDesc</xsl:text>
+          </xsl:attribute>
+          <xsl:variable name="HERE" select="."/>
+          <xsl:for-each select="tokenize($atts,' ')">
+            <xsl:call-template name="doAnAttToken">
+              <xsl:with-param name="HERE" select="$HERE"/>
+              <xsl:with-param name="TOKEN" select="."/>
+            </xsl:call-template>
+          </xsl:for-each>
+        </xsl:element>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:if test="tei:attList//tei:attDef">
+          <xsl:element namespace="{$outputNS}" name="{$tableName}">
+            <xsl:attribute name="{$rendName}">
+              <xsl:text>attList</xsl:text>
+            </xsl:attribute>
+            <xsl:apply-templates mode="summary" select="tei:attList//tei:attDef"/>
+          </xsl:element>
+        </xsl:if>
+        <xsl:call-template name="showAttClasses">
+          <xsl:with-param name="minimal">true</xsl:with-param>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Show a selected attribute<param name="HERE">the starting node </param>
+         <param name="TOKEN">attribute we have been asked to display</param>
+      </desc>
+  </doc>
+  <xsl:template name="doAnAttToken">
+    <xsl:param name="HERE"/>
+    <xsl:param name="TOKEN"/>
+    <xsl:choose>
+      <xsl:when test="$HERE/tei:attList//tei:attDef[@ident=$TOKEN]">
+        <xsl:for-each select="$HERE/tei:attList//tei:attDef[@ident=$TOKEN]">
+          <xsl:call-template name="showAnAttribute"/>
+        </xsl:for-each>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:for-each select="$HERE/tei:classes/tei:memberOf">
+          <xsl:for-each select="key('IDENTS',@key)/tei:attList//tei:attDef[@ident=$TOKEN]">
+            <xsl:call-template name="showAnAttribute"/>
+          </xsl:for-each>
+        </xsl:for-each>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Display of an attribute</desc>
+  </doc>
+  <xsl:template name="showAnAttribute">
+    <xsl:element namespace="{$outputNS}" name="{$rowName}">
+      <xsl:element namespace="{$outputNS}" name="{$cellName}">
+        <xsl:attribute name="{$rendName}">
+          <xsl:text>Attribute</xsl:text>
+        </xsl:attribute>
+        <xsl:element namespace="{$outputNS}" name="{$hiName}">
+          <xsl:attribute name="{$rendName}">
+            <xsl:text>att</xsl:text>
+          </xsl:attribute>
+          <xsl:choose>
+            <xsl:when test="tei:altIdent">
+              <xsl:value-of select="tei:altIdent"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:value-of select="@ident"/>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:element>
+      </xsl:element>
+      <xsl:element namespace="{$outputNS}" name="{$cellName}">
+        <xsl:call-template name="makeDescription"/>
+      </xsl:element>
+    </xsl:element>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element exemplum</desc>
+  </doc>
+  <xsl:template match="tei:exemplum" mode="doc">
+    <xsl:variable name="documentationLanguage">
+      <xsl:call-template name="generateDoc"/>
+    </xsl:variable>
+    <xsl:choose>
+      <xsl:when test="parent::tei:exemplum">
+        <xsl:call-template name="showExample"/>
+      </xsl:when>
+      <xsl:when test="not(@xml:lang)">
+        <xsl:call-template name="showExample"/>
+      </xsl:when>
+      <xsl:when test="@xml:lang='und'">
+        <xsl:call-template name="showExample"/>
+      </xsl:when>
+      <xsl:when test="@xml:lang='mul' and not($documentationLanguage='zh-TW')">
+        <!-- will need to generalize this if other langs come along like
+		chinese -->
+        <xsl:call-template name="showExample"/>
+      </xsl:when>
+      <xsl:when test="@xml:lang=$documentationLanguage">
+        <xsl:call-template name="showExample"/>
+      </xsl:when>
+      <xsl:when test="not(../tei:exemplum[@xml:lang=$documentationLanguage])                    and (@xml:lang='en'      or @xml:lang='und'      or @xml:lang='mul')">
+        <xsl:call-template name="showExample"/>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process an example</desc>
+  </doc>
+  <xsl:template name="showExample">
+    <xsl:choose>
+      <xsl:when test="parent::tei:attDef">
+        <xsl:element namespace="{$outputNS}" name="{$rowName}">
+          <xsl:element namespace="{$outputNS}" name="{$cellName}">
+            <xsl:attribute name="{$colspan}">
+              <xsl:text>2</xsl:text>
+            </xsl:attribute>
+            <xsl:apply-templates/>
+          </xsl:element>
+        </xsl:element>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:element namespace="{$outputNS}" name="{$rowName}">
+          <xsl:element namespace="{$outputNS}" name="{$cellName}">
+            <xsl:attribute name="{$rendName}">
+              <xsl:text>wovenodd-col1</xsl:text>
+            </xsl:attribute>
+            <xsl:element namespace="{$outputNS}" name="{$hiName}">
+              <xsl:attribute name="{$rendName}">
+                <xsl:text>label</xsl:text>
+              </xsl:attribute>
+              <xsl:attribute name="xml:lang">
+                <xsl:value-of select="$documentationLanguage"/>
+              </xsl:attribute>
+              <xsl:call-template name="i18n">
+                <xsl:with-param name="word">Example</xsl:with-param>
+              </xsl:call-template>
+            </xsl:element>
+          </xsl:element>
+          <xsl:element namespace="{$outputNS}" name="{$cellName}">
+            <xsl:attribute name="{$rendName}">
+              <xsl:text>wovenodd-col2</xsl:text>
+            </xsl:attribute>
+            <xsl:apply-templates/>
+          </xsl:element>
+        </xsl:element>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element item</desc>
+  </doc>
+  <xsl:template match="tei:item">
+    <xsl:choose>
+      <xsl:when test="parent::tei:list[@type='gloss'] or preceding-sibling::tei:label">
+        <xsl:element namespace="{$outputNS}" name="{$ddName}">
+          <xsl:apply-templates/>
+        </xsl:element>
+      </xsl:when>
+      <xsl:when test="parent::tei:list[@type='elementlist']">
+        <xsl:apply-templates/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:element namespace="{$outputNS}" name="{$itemName}">
+          <xsl:apply-templates/>
+        </xsl:element>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element macroSpec</desc>
+  </doc>
+  <xsl:template match="tei:macroSpec">
+    <xsl:if test="parent::tei:specGrp">
+      <xsl:element namespace="{$outputNS}" name="{$dtName}">
+        <xsl:value-of select="@ident"/>
+      </xsl:element>
+      <xsl:element namespace="{$outputNS}" name="{$ddName}">
+        <xsl:apply-templates mode="tangle" select="."/>
+      </xsl:element>
+    </xsl:if>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element macroSpec in weavebody mode</desc>
+  </doc>
+  <xsl:template match="tei:macroSpec" mode="weavebody">
+    <xsl:variable name="name">
+      <xsl:choose>
+        <xsl:when test="tei:altIdent">
+          <xsl:value-of select="tei:altIdent"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="@ident"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:element namespace="{$outputNS}" name="{$sectionName}">
+      <xsl:call-template name="makeSectionHead">
+        <xsl:with-param name="id">
+          <xsl:value-of select="@ident"/>
+        </xsl:with-param>
+        <xsl:with-param name="name">
+          <xsl:value-of select="$name"/>
+        </xsl:with-param>
+      </xsl:call-template>
+      <xsl:call-template name="specHook">
+        <xsl:with-param name="name">
+          <xsl:value-of select="$name"/>
+        </xsl:with-param>
+      </xsl:call-template>
+      <xsl:element namespace="{$outputNS}" name="{$tableName}">
+        <xsl:attribute name="{$rendName}">
+          <xsl:text>wovenodd</xsl:text>
+        </xsl:attribute>
+        <xsl:element namespace="{$outputNS}" name="{$rowName}">
+          <xsl:element namespace="{$outputNS}" name="{$cellName}">
+            <xsl:attribute name="{$colspan}">2</xsl:attribute>
+            <xsl:element namespace="{$outputNS}" name="{$hiName}">
+              <xsl:attribute name="{$rendName}">
+                <xsl:text>label</xsl:text>
+              </xsl:attribute>
+              <xsl:value-of select="$name"/>
+            </xsl:element>
+            <xsl:text>&#160;</xsl:text>
+            <xsl:call-template name="makeDescription"/>
+          </xsl:element>
+        </xsl:element>
+        <xsl:if test="@module">
+          <xsl:call-template name="moduleInfo"/>
+        </xsl:if>
+        <xsl:choose>
+          <xsl:when test="@type='pe' or @type='dt'">
+            <xsl:element namespace="{$outputNS}" name="{$rowName}">
+              <xsl:element namespace="{$outputNS}" name="{$cellName}">
+                <xsl:attribute name="{$rendName}">
+                  <xsl:text>wovenodd-col1</xsl:text>
+                </xsl:attribute>
+                <xsl:element namespace="{$outputNS}" name="{$hiName}">
+                  <xsl:attribute name="{$rendName}">
+                    <xsl:text>label</xsl:text>
+                  </xsl:attribute>
+                  <xsl:attribute name="xml:lang">
+                    <xsl:value-of select="$documentationLanguage"/>
+                  </xsl:attribute>
+                  <xsl:call-template name="i18n">
+                    <xsl:with-param name="word">Used by</xsl:with-param>
+                  </xsl:call-template>
+                </xsl:element>
+              </xsl:element>
+              <xsl:element namespace="{$outputNS}" name="{$cellName}">
+                <xsl:attribute name="{$rendName}">
+                  <xsl:text>wovenodd-col2</xsl:text>
+                </xsl:attribute>
+                <xsl:call-template name="generateModelParents">
+                  <xsl:with-param name="showElements">true</xsl:with-param>
+                </xsl:call-template>
+              </xsl:element>
+            </xsl:element>
+          </xsl:when>
+        </xsl:choose>
+        <xsl:apply-templates mode="weave"/>
+      </xsl:element>
+    </xsl:element>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element macroSpec/tei:content</desc>
+  </doc>
+  <xsl:template match="tei:macroSpec/tei:content" mode="weave">
+    <xsl:element namespace="{$outputNS}" name="{$rowName}">
+      <xsl:element namespace="{$outputNS}" name="{$cellName}">
+        <xsl:attribute name="{$rendName}">
+          <xsl:text>wovenodd-col1</xsl:text>
+        </xsl:attribute>
+        <xsl:element namespace="{$outputNS}" name="{$hiName}">
+          <xsl:attribute name="{$rendName}">
+            <xsl:text>label</xsl:text>
+          </xsl:attribute>
+          <xsl:attribute name="xml:lang">
+            <xsl:value-of select="$documentationLanguage"/>
+          </xsl:attribute>
+          <xsl:call-template name="i18n">
+            <xsl:with-param name="word">Declaration</xsl:with-param>
+          </xsl:call-template>
+        </xsl:element>
+      </xsl:element>
+      <xsl:element namespace="{$outputNS}" name="{$cellName}">
+        <xsl:attribute name="{$rendName}">
+          <xsl:text>wovenodd-col2</xsl:text>
+        </xsl:attribute>
+        <xsl:call-template name="bitOut">
+          <xsl:with-param name="grammar">true</xsl:with-param>
+          <xsl:with-param name="content">
+            <Wrapper>
+              <xsl:variable name="entCont">
+                <Stuff>
+                  <xsl:apply-templates select="rng:*"/>
+                </Stuff>
+              </xsl:variable>
+              <xsl:variable name="entCount">
+                <xsl:for-each select="$entCont/html:Stuff">
+                  <xsl:value-of select="count(*)"/>
+                </xsl:for-each>
+              </xsl:variable>
+              <xsl:choose>
+                <xsl:when test=".=&quot;TEI.singleBase&quot;"/>
+                <xsl:otherwise>
+                  <rng:define name="{../@ident}">
+                    <xsl:if test="starts-with(.,'component')">
+                      <xsl:attribute name="combine">choice</xsl:attribute>
+                    </xsl:if>
+                    <xsl:copy-of select="rng:*"/>
+                  </rng:define>
+                </xsl:otherwise>
+              </xsl:choose>
+            </Wrapper>
+          </xsl:with-param>
+        </xsl:call-template>
+      </xsl:element>
+    </xsl:element>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element moduleSpec</desc>
+  </doc>
+  <xsl:template match="tei:moduleSpec">
+    <xsl:element namespace="{$outputNS}" name="{$dlName}">
+      <xsl:attribute name="{$rendName}">
+        <xsl:text>moduleSpec</xsl:text>
+      </xsl:attribute>
+      <xsl:element namespace="{$outputNS}" name="{$labelName}">
+        <xsl:attribute name="{$rendName}">
+          <xsl:text>moduleSpecHead</xsl:text>
+        </xsl:attribute>
+        <xsl:element namespace="{$outputNS}" name="{$segName}">
+          <xsl:attribute name="xml:lang">
+            <xsl:value-of select="$documentationLanguage"/>
+          </xsl:attribute>
+          <xsl:call-template name="i18n">
+            <xsl:with-param name="word">Module</xsl:with-param>
+          </xsl:call-template>
+        </xsl:element>
+        <xsl:value-of select="$spaceCharacter"/>
+        <xsl:value-of select="@ident"/>
+        <xsl:text>: </xsl:text>
+        <xsl:call-template name="makeDescription"/>
+      </xsl:element>
+      <xsl:element namespace="{$outputNS}" name="{$ddName}">
+        <xsl:element namespace="{$outputNS}" name="{$ulName}">
+          <xsl:if test="key('ElementModule',@ident)">
+            <xsl:element namespace="{$outputNS}" name="{$itemName}">
+              <xsl:element namespace="{$outputNS}" name="{$hiName}">
+                <xsl:attribute name="xml:lang">
+                  <xsl:value-of select="$documentationLanguage"/>
+                </xsl:attribute>
+                <xsl:call-template name="i18n">
+                  <xsl:with-param name="word">Elements defined</xsl:with-param>
+                </xsl:call-template>
+              </xsl:element>
+              <xsl:text>: </xsl:text>
+              <xsl:variable name="list">
+                <List>
+                  <xsl:for-each select="key('ElementModule',@ident)">
+                    <xsl:sort select="@ident"/>
+                    <Item>
+                      <xsl:call-template name="linkTogether">
+                        <xsl:with-param name="name" select="@ident"/>
+			<xsl:with-param name="reftext">
+			  <xsl:choose>
+			    <xsl:when test="tei:altIdent">
+			      <xsl:value-of select="tei:altIdent"/>
+			    </xsl:when>
+			    <xsl:otherwise>
+			      <xsl:value-of select="@ident"/>
+			    </xsl:otherwise>
+			  </xsl:choose>
+			</xsl:with-param>
+                      </xsl:call-template>
+                    </Item>
+                  </xsl:for-each>
+                </List>
+              </xsl:variable>
+              <xsl:for-each select="$list/List/Item">
+                <xsl:copy-of select="*|text()"/>
+                <xsl:if test="following-sibling::Item">
+                  <xsl:call-template name="showSpaceBetweenItems"/>
+                </xsl:if>
+              </xsl:for-each>
+            </xsl:element>
+          </xsl:if>
+          <xsl:if test="key('ClassModule',@ident)">
+            <xsl:element namespace="{$outputNS}" name="{$itemName}">
+              <xsl:element namespace="{$outputNS}" name="{$hiName}">
+                <xsl:attribute name="xml:lang">
+                  <xsl:value-of select="$documentationLanguage"/>
+                </xsl:attribute>
+                <xsl:call-template name="i18n">
+                  <xsl:with-param name="word">Classes defined</xsl:with-param>
+                </xsl:call-template>
+              </xsl:element>
+              <xsl:text>: </xsl:text>
+              <xsl:variable name="list">
+                <List>
+                  <xsl:for-each select="key('ClassModule',@ident)">
+                    <xsl:sort select="@ident"/>
+                    <Item>
+                      <xsl:call-template name="linkTogether">
+                        <xsl:with-param name="name" select="@ident"/>
+			<xsl:with-param name="reftext">
+			  <xsl:choose>
+			    <xsl:when test="tei:altIdent">
+			      <xsl:value-of select="tei:altIdent"/>
+			    </xsl:when>
+			    <xsl:otherwise>
+			      <xsl:value-of select="@ident"/>
+			    </xsl:otherwise>
+			  </xsl:choose>
+			</xsl:with-param>
+                      </xsl:call-template>
+                    </Item>
+                  </xsl:for-each>
+                </List>
+              </xsl:variable>
+              <xsl:for-each select="$list/List/Item">
+                <xsl:copy-of select="*|text()"/>
+                <xsl:if test="following-sibling::Item">
+                  <xsl:call-template name="showSpaceBetweenItems"/>
+                </xsl:if>
+              </xsl:for-each>
+            </xsl:element>
+          </xsl:if>
+          <xsl:if test="key('MacroModule',@ident)">
+            <xsl:element namespace="{$outputNS}" name="{$itemName}">
+              <xsl:element namespace="{$outputNS}" name="{$segName}">
+                <xsl:attribute name="xml:lang">
+                  <xsl:value-of select="$documentationLanguage"/>
+                </xsl:attribute>
+                <xsl:call-template name="i18n">
+                  <xsl:with-param name="word">Macros defined</xsl:with-param>
+                </xsl:call-template>
+              </xsl:element>
+              <xsl:text>: </xsl:text>
+              <xsl:variable name="list">
+                <List>
+                  <xsl:for-each select="key('MacroModule',@ident)">
+                    <xsl:sort select="@ident"/>
+                    <Item>
+                      <xsl:call-template name="linkTogether">
+                        <xsl:with-param name="name" select="@ident"/>
+			<xsl:with-param name="reftext">
+			  <xsl:choose>
+			    <xsl:when test="tei:altIdent">
+			      <xsl:value-of select="tei:altIdent"/>
+			    </xsl:when>
+			    <xsl:otherwise>
+			      <xsl:value-of select="@ident"/>
+			    </xsl:otherwise>
+			  </xsl:choose>
+			</xsl:with-param>
+                      </xsl:call-template>
+                    </Item>
+                  </xsl:for-each>
+                </List>
+              </xsl:variable>
+              <xsl:for-each select="$list/List/Item">
+                <xsl:copy-of select="*|text()"/>
+                <xsl:if test="following-sibling::Item">
+                  <xsl:call-template name="showSpaceBetweenItems"/>
+                </xsl:if>
+              </xsl:for-each>
+            </xsl:element>
+          </xsl:if>
+        </xsl:element>
+      </xsl:element>
+    </xsl:element>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process tei:remarks</desc>
+  </doc>
+  <xsl:template match="tei:remarks" mode="doc">
+    <xsl:if test="string-length(.)&gt;0">
+      <xsl:element namespace="{$outputNS}" name="{$rowName}">
+        <xsl:element namespace="{$outputNS}" name="{$cellName}">
+          <xsl:attribute name="{$rendName}">
+            <xsl:text>wovenodd-col1</xsl:text>
+          </xsl:attribute>
+          <xsl:element namespace="{$outputNS}" name="{$hiName}">
+            <xsl:attribute name="{$rendName}">
+              <xsl:text>label</xsl:text>
+            </xsl:attribute>
+            <xsl:attribute name="xml:lang">
+              <xsl:value-of select="$documentationLanguage"/>
+            </xsl:attribute>
+            <xsl:call-template name="i18n">
+              <xsl:with-param name="word">Note</xsl:with-param>
+            </xsl:call-template>
+          </xsl:element>
+        </xsl:element>
+        <xsl:element namespace="{$outputNS}" name="{$cellName}">
+          <xsl:attribute name="{$rendName}">
+            <xsl:text>wovenodd-col2</xsl:text>
+          </xsl:attribute>
+          <xsl:comment>&#160;</xsl:comment>
+          <xsl:apply-templates/>
+        </xsl:element>
+      </xsl:element>
+    </xsl:if>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process a specDesc</desc>
+  </doc>
+  <xsl:template match="tei:specDesc">
+    <xsl:element namespace="{$outputNS}" name="{$itemName}">
+      <xsl:call-template name="processSpecDesc"/>
+    </xsl:element>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process a specGrp</desc>
+  </doc>
+  <xsl:template match="tei:specGrp"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process  a specGrpRef</desc>
+  </doc>
+  <xsl:template match="tei:specGrpRef"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process a specList</desc>
+  </doc>
+  <xsl:template match="tei:specList">
+    <xsl:element namespace="{$outputNS}" name="{$ulName}">
+      <xsl:attribute name="{$rendName}">specList</xsl:attribute>
+      <xsl:apply-templates/>
+    </xsl:element>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process a valDesc</desc>
+  </doc>
+  <xsl:template match="tei:valDesc" mode="weave">
+    <xsl:variable name="documentationLanguage">
+      <xsl:call-template name="generateDoc"/>
+    </xsl:variable>
+    <xsl:choose>
+      <xsl:when test="@xml:lang and         not(@xml:lang=$documentationLanguage)">
+      </xsl:when>
+      <xsl:when test="not(@xml:lang) and         not($documentationLanguage='en')          and         ../tei:valDesc[@xml:lang=$documentationLanguage]">
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:element namespace="{$outputNS}" name="{$rowName}">
+          <xsl:element namespace="{$outputNS}" name="{$cellName}">
+            <xsl:attribute name="{$rendName}">
+              <xsl:text>odd_label</xsl:text>
+            </xsl:attribute>
+            <xsl:element namespace="{$outputNS}" name="{$hiName}">
+              <xsl:attribute name="{$rendName}">
+                <xsl:text>label</xsl:text>
+              </xsl:attribute>
+              <xsl:attribute name="xml:lang">
+                <xsl:value-of select="$documentationLanguage"/>
+              </xsl:attribute>
+              <xsl:call-template name="i18n">
+                <xsl:with-param name="word">Values</xsl:with-param>
+              </xsl:call-template>
+            </xsl:element>
+            <xsl:text> </xsl:text>
+          </xsl:element>
+          <xsl:element namespace="{$outputNS}" name="{$cellName}">
+            <xsl:attribute name="{$rendName}">
+              <xsl:text>attribute</xsl:text>
+            </xsl:attribute>
+            <xsl:apply-templates/>
+          </xsl:element>
+        </xsl:element>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element val</desc>
+  </doc>
+  <xsl:template match="tei:val">
+    <xsl:element namespace="{$outputNS}" name="{$hiName}">
+      <xsl:attribute name="{$rendName}">
+        <xsl:text>val</xsl:text>
+      </xsl:attribute>
+      <xsl:apply-templates/>
+    </xsl:element>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element att</desc>
+  </doc>
+  <xsl:template match="tei:att">
+    <xsl:element namespace="{$outputNS}" name="{$hiName}">
+      <xsl:attribute name="{$rendName}">
+        <xsl:text>att</xsl:text>
+      </xsl:attribute>
+      <xsl:apply-templates/>
+    </xsl:element>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element tag</desc>
+  </doc>
+  <xsl:template match="tei:tag">
+    <xsl:element namespace="{$outputNS}" name="{$hiName}">
+      <xsl:attribute name="{$rendName}">
+        <xsl:text>tag</xsl:text>
+      </xsl:attribute>
+      <xsl:text>&lt;</xsl:text>
+      <xsl:apply-templates/>
+      <xsl:text>&gt;</xsl:text>
+    </xsl:element>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element valList</desc>
+  </doc>
+  <xsl:template match="tei:valList" mode="contents">
+    <xsl:element namespace="{$outputNS}" name="{$rowName}">
+      <xsl:element namespace="{$outputNS}" name="{$cellName}">
+        <xsl:attribute name="{$rendName}">
+          <xsl:text>odd_label</xsl:text>
+        </xsl:attribute>
+        <xsl:element namespace="{$outputNS}" name="{$hiName}">
+          <xsl:attribute name="{$rendName}">
+            <xsl:text>label</xsl:text>
+          </xsl:attribute>
+          <xsl:attribute name="xml:lang">
+            <xsl:value-of select="$documentationLanguage"/>
+          </xsl:attribute>
+          <xsl:choose>
+            <xsl:when test="@type='semi'">
+              <xsl:call-template name="i18n">
+                <xsl:with-param name="word">Suggested values include</xsl:with-param>
+              </xsl:call-template>
+              <xsl:text>:</xsl:text>
+            </xsl:when>
+            <xsl:when test="@type='open'">
+              <xsl:call-template name="i18n">
+                <xsl:with-param name="word">Sample values include</xsl:with-param>
+              </xsl:call-template>
+              <xsl:text>:</xsl:text>
+            </xsl:when>
+            <xsl:when test="@type='closed'">
+              <xsl:call-template name="i18n">
+                <xsl:with-param name="word">Legal values are</xsl:with-param>
+              </xsl:call-template>
+              <xsl:text>:</xsl:text>
+            </xsl:when>
+            <xsl:otherwise>Sample values include</xsl:otherwise>
+          </xsl:choose>
+        </xsl:element>
+      </xsl:element>
+      <xsl:element namespace="{$outputNS}" name="{$cellName}">
+        <xsl:attribute name="{$rendName}">
+          <xsl:text>odd_value</xsl:text>
+        </xsl:attribute>
+        <xsl:call-template name="valListChildren"/>
+      </xsl:element>
+    </xsl:element>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>[odds] all the values in a valList</desc>
+  </doc>
+  <xsl:template name="valListChildren">
+    <xsl:element namespace="{$outputNS}" name="{$dlName}">
+      <xsl:attribute name="{$rendName}">
+        <xsl:text>valList</xsl:text>
+      </xsl:attribute>
+      <xsl:for-each select="tei:valItem">
+        <xsl:variable name="name">
+          <xsl:choose>
+            <xsl:when test="tei:altIdent">
+              <xsl:value-of select="tei:altIdent"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:value-of select="@ident"/>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:variable>
+        <xsl:element namespace="{$outputNS}" name="{$dtName}">
+          <xsl:attribute name="{$rendName}">
+            <xsl:text>odd_label</xsl:text>
+          </xsl:attribute>
+          <xsl:value-of select="$name"/>
+        </xsl:element>
+        <xsl:element namespace="{$outputNS}" name="{$ddName}">
+          <xsl:attribute name="{$rendName}">
+            <xsl:text>odd_value</xsl:text>
+          </xsl:attribute>
+          <xsl:call-template name="makeDescription"/>
+          <xsl:if test="@ident=../../tei:defaultVal">
+            <xsl:element namespace="{$outputNS}" name="{$hiName}">
+              <xsl:attribute name="{$rendName}">
+                <xsl:text>defaultVal</xsl:text>
+              </xsl:attribute>
+              <xsl:attribute name="xml:lang">
+                <xsl:value-of select="$documentationLanguage"/>
+              </xsl:attribute>
+              <xsl:text> [</xsl:text>
+              <xsl:call-template name="i18n">
+                <xsl:with-param name="word">Default</xsl:with-param>
+              </xsl:call-template>
+              <xsl:text>]</xsl:text>
+            </xsl:element>
+          </xsl:if>
+        </xsl:element>
+      </xsl:for-each>
+    </xsl:element>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>[odds] </desc>
+  </doc>
+  <xsl:template name="moduleInfo">
+    <xsl:if test="not($oddWeaveLite='true')">
+      <xsl:element namespace="{$outputNS}" name="{$rowName}">
+        <xsl:element namespace="{$outputNS}" name="{$cellName}">
+          <xsl:attribute name="{$rendName}">
+            <xsl:text>wovenodd-col1</xsl:text>
+          </xsl:attribute>
+          <xsl:element namespace="{$outputNS}" name="{$hiName}">
+            <xsl:attribute name="{$rendName}">
+              <xsl:text>label</xsl:text>
+            </xsl:attribute>
+            <xsl:attribute name="xml:lang">
+              <xsl:value-of select="$documentationLanguage"/>
+            </xsl:attribute>
+            <xsl:call-template name="i18n">
+              <xsl:with-param name="word">Module</xsl:with-param>
+            </xsl:call-template>
+          </xsl:element>
+        </xsl:element>
+        <xsl:element namespace="{$outputNS}" name="{$cellName}">
+          <xsl:attribute name="{$rendName}">
+            <xsl:text>wovenodd-col2</xsl:text>
+          </xsl:attribute>
+          <xsl:call-template name="makeTagsetInfo"/>
+        </xsl:element>
+      </xsl:element>
+    </xsl:if>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>[odds] display attribute list  </desc>
+  </doc>
+  <xsl:template name="displayAttList">
+    <xsl:param name="mode"/>
+    <xsl:call-template name="showAttClasses"/>
+    <xsl:if test=".//tei:attDef">
+      <xsl:element namespace="{$outputNS}" name="{$tableName}">
+        <xsl:attribute name="{$rendName}">
+          <xsl:text>attList</xsl:text>
+        </xsl:attribute>
+        <xsl:choose>
+          <xsl:when test="$mode='all'">
+            <xsl:apply-templates/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:apply-templates mode="summary"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:element>
+    </xsl:if>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>[odds] display list of model parents </desc>
+  </doc>
+  <xsl:template name="generateModelParents">
+    <xsl:param name="showElements">true</xsl:param>
+    <xsl:variable name="here" select="."/>
+    <xsl:element namespace="{$outputNS}" name="{$divName}">
+      <xsl:attribute name="{$rendName}">parent</xsl:attribute>
+      <xsl:variable name="Parents">
+        <xsl:for-each select="key('REFS',@ident)/ancestor::tei:content/parent::*">
+          <Element type="{local-name()}" module="{@module}" name="{@ident}">
+            <xsl:attribute name="altName">
+              <xsl:choose>
+                <xsl:when test="tei:altIdent">
+                  <xsl:value-of select="tei:altIdent"/>
+                </xsl:when>
+                <xsl:otherwise>
+                  <xsl:value-of select="@ident"/>
+                </xsl:otherwise>
+              </xsl:choose>
+            </xsl:attribute>
+          </Element>
+        </xsl:for-each>
+        <xsl:for-each select="tei:classes/tei:memberOf">
+          <xsl:for-each select="key('CLASSES',@key)">
+            <xsl:if test="@type='model'">
+              <Element type="classSpec" module="{@module}" name="{@ident}">
+                <xsl:attribute name="altName">
+                  <xsl:choose>
+                    <xsl:when test="tei:altIdent">
+                      <xsl:value-of select="tei:altIdent"/>
+                    </xsl:when>
+                    <xsl:otherwise>
+                      <xsl:value-of select="@ident"/>
+                    </xsl:otherwise>
+                  </xsl:choose>
+                </xsl:attribute>
+              </Element>
+            </xsl:if>
+          </xsl:for-each>
+        </xsl:for-each>
+      </xsl:variable>
+      <xsl:if test="count($Parents/*)&gt;0">
+        <xsl:for-each-group select="$Parents/*" group-by="@name">
+          <xsl:sort select="@altName"/>
+          <xsl:variable name="name" select="@name"/>
+          <xsl:variable name="alt" select="@altName"/>
+          <xsl:variable name="type" select="@type"/>
+          <xsl:if test="not(@type='elementSpec' and $showElements='false')">
+            <xsl:for-each select="$here">
+              <xsl:call-template name="linkTogether">
+                <xsl:with-param name="name" select="$name"/>
+                <xsl:with-param name="reftext" select="$alt"/>
+                <xsl:with-param name="class">link_odd_<xsl:value-of select="$type"/></xsl:with-param>
+              </xsl:call-template>
+            </xsl:for-each>
+            <xsl:if test="not(position() = last())">
+              <xsl:call-template name="showSpaceBetweenItems"/>
+            </xsl:if>
+          </xsl:if>
+        </xsl:for-each-group>
+      </xsl:if>
+      <xsl:call-template name="generateParentsByAttribute"/>
+    </xsl:element>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>[odds] display list of generated parents (via models)   </desc>
+  </doc>
+  <xsl:template name="generateIndirectParents">
+    <xsl:element namespace="{$outputNS}" name="{$divName}">
+      <xsl:attribute name="{$rendName}">parent</xsl:attribute>
+      <xsl:variable name="here" select="."/>
+      <xsl:variable name="name" select="@ident"/>
+      <xsl:variable name="Parents">
+        <xsl:call-template name="ProcessDirectRefs"/>
+        <!-- now look at class membership -->
+        <xsl:for-each select="tei:classes/tei:memberOf">
+          <xsl:for-each select="key('CLASSES',@key)">
+            <xsl:if test="@type='model'">
+              <xsl:call-template name="ProcessClass">
+                <xsl:with-param name="name" select="$name"/>
+              </xsl:call-template>
+            </xsl:if>
+          </xsl:for-each>
+        </xsl:for-each>
+      </xsl:variable>
+      <xsl:call-template name="displayElementsByModule">
+        <xsl:with-param name="List">
+          <xsl:copy-of select="$Parents"/>
+        </xsl:with-param>
+      </xsl:call-template>
+    </xsl:element>
+  </xsl:template>
+  <xsl:template name="ProcessDirectRefs">
+    <!-- direct parents -->
+    <xsl:for-each select="key('REFS',@ident)/ancestor::tei:content/parent::tei:*">
+      <xsl:choose>
+        <xsl:when test="self::tei:elementSpec">
+          <Element type="{local-name()}" module="{@module}" name="{@ident}">
+            <xsl:attribute name="altName">
+              <xsl:choose>
+                <xsl:when test="tei:altIdent">
+                  <xsl:value-of select="tei:altIdent"/>
+                </xsl:when>
+                <xsl:otherwise>
+                  <xsl:value-of select="@ident"/>
+                </xsl:otherwise>
+              </xsl:choose>
+            </xsl:attribute>
+          </Element>
+        </xsl:when>
+        <xsl:when test="self::tei:macroSpec">
+          <xsl:call-template name="ProcessDirectRefs"/>
+        </xsl:when>
+      </xsl:choose>
+    </xsl:for-each>
+  </xsl:template>
+  <xsl:template name="ProcessClass">
+    <xsl:param name="name"/>
+    <xsl:for-each select="key('REFS',@ident)/ancestor::tei:content/parent::tei:*">
+      <xsl:choose>
+        <xsl:when test="self::tei:elementSpec">
+          <Element type="{local-name()}" module="{@module}" name="{@ident}">
+            <xsl:attribute name="altName">
+              <xsl:choose>
+                <xsl:when test="tei:altIdent">
+                  <xsl:value-of select="tei:altIdent"/>
+                </xsl:when>
+                <xsl:otherwise>
+                  <xsl:value-of select="@ident"/>
+                </xsl:otherwise>
+              </xsl:choose>
+            </xsl:attribute>
+          </Element>
+        </xsl:when>
+        <xsl:when test="self::tei:macroSpec">
+          <xsl:call-template name="ProcessDirectRefs"/>
+        </xsl:when>
+      </xsl:choose>
+    </xsl:for-each>
+    <xsl:for-each select="tei:classes/tei:memberOf">
+      <xsl:for-each select="key('CLASSES',@key)">
+        <xsl:if test="@type='model'">
+          <xsl:call-template name="ProcessClass">
+            <xsl:with-param name="name" select="$name"/>
+          </xsl:call-template>
+        </xsl:if>
+      </xsl:for-each>
+    </xsl:for-each>
+  </xsl:template>
+  <xsl:template name="generateMembers">
+    <xsl:param name="depth">1</xsl:param>
+    <xsl:param name="me"/>
+    <xsl:variable name="here" select="."/>
+    <xsl:variable name="this" select="@ident"/>
+    <xsl:if test="not($this=$me) and key('CLASSMEMBERS',$this)">
+      <xsl:element namespace="{$outputNS}" name="{$hiName}">
+        <xsl:attribute name="{$rendName}">
+          <xsl:text>showmembers</xsl:text>
+          <xsl:value-of select="$depth"/>
+        </xsl:attribute>
+        <xsl:if test="$depth &gt; 1"> [</xsl:if>
+        <xsl:variable name="list">
+          <ClassList>
+            <xsl:for-each select="key('CLASSMEMBERS',$this)">
+              <Item type="local-name()" ident="@ident">
+                <xsl:call-template name="linkTogether">
+                  <xsl:with-param name="name" select="@ident"/>
+                  <xsl:with-param name="reftext">
+                    <xsl:choose>
+                      <xsl:when test="tei:altIdent">
+                        <xsl:value-of select="tei:altIdent"/>
+                      </xsl:when>
+                      <xsl:otherwise>
+                        <xsl:value-of select="@ident"/>
+                      </xsl:otherwise>
+                    </xsl:choose>
+                  </xsl:with-param>
+                  <xsl:with-param name="class">
+                    <xsl:text>link_odd_</xsl:text>
+                    <xsl:value-of select="local-name()"/>
+                  </xsl:with-param>
+                </xsl:call-template>
+                <xsl:call-template name="generateMembers">
+                  <xsl:with-param name="depth">
+                    <xsl:value-of select="$depth + 1"/>
+                  </xsl:with-param>
+                </xsl:call-template>
+              </Item>
+            </xsl:for-each>
+          </ClassList>
+        </xsl:variable>
+        <xsl:for-each select="$list/ClassList/Item">
+          <xsl:sort select="@type"/>
+          <xsl:sort select="@ident"/>
+          <xsl:copy-of select="*|text()"/>
+          <xsl:if test="following-sibling::Item">
+            <xsl:call-template name="showSpaceBetweenItems"/>
+          </xsl:if>
+        </xsl:for-each>
+        <xsl:if test="$depth &gt; 1">] </xsl:if>
+      </xsl:element>
+    </xsl:if>
+  </xsl:template>
+  <xsl:template name="generateParentsByAttribute">
+    <xsl:variable name="this" select="@ident"/>
+    <xsl:variable name="list">
+      <PattList>
+	<xsl:for-each select="key('ATTREFS-CLASS',$this)">
+	  <xsl:sort select="ancestor::tei:classSpec/@ident"/>
+	  <xsl:sort select="@ident"/>
+	  <xsl:element namespace="{$outputNS}" name="{$itemName}">
+	    <xsl:for-each select="ancestor::tei:classSpec">
+	      <Item>
+		<xsl:call-template name="linkTogether">
+		  <xsl:with-param name="name">
+		    <xsl:value-of select="@ident"/>
+		  </xsl:with-param>
+		  <xsl:with-param name="class">
+		    <xsl:text>link_odd_classSpec</xsl:text>
+		  </xsl:with-param>
+		</xsl:call-template>
+	      </Item>
+	    </xsl:for-each>
+	    <xsl:text>/@</xsl:text>
+	    <xsl:value-of select="ancestor::tei:attDef/@ident"/>
+	  </xsl:element>
+	</xsl:for-each>
+      </PattList>
+    </xsl:variable>
+    <xsl:if test="count($list/PattList/Item)&gt;0">
+      <xsl:element namespace="{$outputNS}" name="{$segName}">
+        <xsl:attribute name="xml:lang">
+          <xsl:value-of select="$documentationLanguage"/>
+        </xsl:attribute>
+        <xsl:call-template name="i18n">
+          <xsl:with-param name="word">
+            <xsl:text> Class</xsl:text>
+          </xsl:with-param>
+        </xsl:call-template>
+      </xsl:element>
+      <xsl:text>: </xsl:text>
+      <xsl:element namespace="{$outputNS}" name="{$ulName}">
+        <xsl:for-each select="$list/PattList/Item">
+          <xsl:copy-of select="*|text()"/>
+        </xsl:for-each>
+      </xsl:element>
+    </xsl:if>
+    <xsl:variable name="list2">
+      <PattList>
+	<xsl:for-each select="key('ATTREFS-ELEMENT',$this)">
+	  <xsl:sort select="ancestor::tei:elementSpec/@ident"/>
+	  <xsl:sort select="@ident"/>
+	  <Item>
+	    <xsl:element namespace="{$outputNS}" name="{$itemName}">
+	      <xsl:for-each select="ancestor::tei:elementSpec">
+		<xsl:call-template name="linkTogether">
+		  <xsl:with-param name="name">
+		    <xsl:value-of select="@ident"/>
+		  </xsl:with-param>
+		  <xsl:with-param name="reftext">
+		    <xsl:choose>
+		      <xsl:when test="tei:altIdent">
+			<xsl:value-of select="tei:altIdent"/>
+		      </xsl:when>
+		      <xsl:otherwise>
+			<xsl:value-of select="@ident"/>
+		      </xsl:otherwise>
+		    </xsl:choose>
+		  </xsl:with-param>
+		  <xsl:with-param name="class">
+		    <xsl:text>link_odd_elementSpec</xsl:text>
+		  </xsl:with-param>
+		</xsl:call-template>
+	      </xsl:for-each>
+	      <xsl:text>/@</xsl:text>
+	      <xsl:for-each select="ancestor::tei:attDef">
+		<xsl:value-of select="(tei:altIdent|@ident)[last()]"/>
+	      </xsl:for-each>
+	    </xsl:element>
+	  </Item>
+	</xsl:for-each>
+      </PattList>
+    </xsl:variable>
+    <xsl:if test="count($list2/PattList/Item)&gt;0">
+      <xsl:element namespace="{$outputNS}" name="{$segName}">
+	<xsl:attribute name="xml:lang">
+	  <xsl:value-of select="$documentationLanguage"/>
+	</xsl:attribute>
+	<xsl:call-template name="i18n">
+	  <xsl:with-param name="word">
+	    <xsl:text>Element</xsl:text>
+	  </xsl:with-param>
+	</xsl:call-template>
+	<xsl:text>: </xsl:text>
+      </xsl:element>
+      <xsl:element namespace="{$outputNS}" name="{$ulName}">
+	<xsl:for-each select="$list2/PattList/Item">
+	  <xsl:copy-of select="*|text()"/>
+	</xsl:for-each>
+      </xsl:element>
+    </xsl:if>
+  </xsl:template>
+  <xsl:template match="tei:classSpec|tei:elementSpec|tei:macroSpec" mode="weave">
+    <xsl:call-template name="refdoc"/>
+  </xsl:template>
+  <xsl:template match="tei:divGen[@type='modelclasscat']">
+    <xsl:apply-templates mode="weave" select="key('MODELCLASSDOCS',1)">
+      <xsl:sort select="@ident"/>
+    </xsl:apply-templates>
+  </xsl:template>
+  <xsl:template match="tei:divGen[@type='attclasscat']">
+    <xsl:apply-templates mode="weave" select="key('ATTCLASSDOCS',1)">
+      <xsl:sort select="@ident"/>
+    </xsl:apply-templates>
+  </xsl:template>
+  <xsl:template match="tei:divGen[@type='macrocat']">
+    <xsl:apply-templates mode="weave" select="key('MACRODOCS',1)">
+      <xsl:sort select="@ident"/>
+    </xsl:apply-templates>
+  </xsl:template>
+  <xsl:template match="tei:divGen[@type='elementcat']">
+    <xsl:apply-templates mode="weave" select="key('ELEMENTDOCS',1)">
+      <xsl:sort select="@ident"/>
+    </xsl:apply-templates>
+  </xsl:template>
+  <xsl:template match="tei:divGen[@type='attcat']">
+    <xsl:element namespace="{$outputNS}" name="{$tableName}">
+      <xsl:attribute name="{$rendName}">
+        <xsl:text>attcat</xsl:text>
+      </xsl:attribute>
+      <xsl:for-each select="key('ATTDOCS',1)">
+        <xsl:sort select="@ident"/>
+        <xsl:variable name="this" select="@ident"/>
+        <xsl:if test="generate-id()=generate-id(key('ATTRIBUTES',$this)[1])">
+          <xsl:element namespace="{$outputNS}" name="{$rowName}">
+            <xsl:call-template name="identifyElement">
+              <xsl:with-param name="id">
+                <xsl:value-of select="translate($this,':','_')"/>
+              </xsl:with-param>
+            </xsl:call-template>
+            <xsl:element namespace="{$outputNS}" name="{$cellName}">
+              <xsl:attribute name="{$rendName}">
+                <xsl:text>attcat-col1</xsl:text>
+              </xsl:attribute>
+              <xsl:value-of select="$this"/>
+            </xsl:element>
+            <xsl:element namespace="{$outputNS}" name="{$cellName}">
+              <xsl:attribute name="{$rendName}">
+                <xsl:text>attcat-col2</xsl:text>
+              </xsl:attribute>
+              <xsl:for-each select="key('ATTRIBUTES-CLASS',$this)">
+                <xsl:sort select="ancestor::tei:classSpec/@ident"/>
+                <xsl:for-each select="ancestor::tei:classSpec|ancestor::elementSpec">
+                  <xsl:call-template name="linkTogether">
+                    <xsl:with-param name="name">
+                      <xsl:value-of select="@ident"/>
+                    </xsl:with-param>
+		    <xsl:with-param name="reftext">
+		      <xsl:choose>
+			<xsl:when test="tei:altIdent">
+			  <xsl:value-of select="tei:altIdent"/>
+			</xsl:when>
+			<xsl:otherwise>
+			  <xsl:value-of select="@ident"/>
+			</xsl:otherwise>
+		      </xsl:choose>
+		    </xsl:with-param>
+                    <xsl:with-param name="class">
+                      <xsl:text>link_odd</xsl:text>
+                    </xsl:with-param>
+                  </xsl:call-template>
+                </xsl:for-each>
+                <xsl:text> </xsl:text>
+              </xsl:for-each>
+              <xsl:for-each select="key('ATTRIBUTES-ELEMENT',$this)">
+                <xsl:sort select="ancestor::tei:elementSpec/@ident"/>
+                <xsl:for-each select="ancestor::tei:elementSpec">
+                  <xsl:call-template name="linkTogether">
+                    <xsl:with-param name="name">
+                      <xsl:value-of select="@ident"/>
+                    </xsl:with-param>
+                    <xsl:with-param name="reftext">
+                      <xsl:choose>
+                        <xsl:when test="tei:altIdent">
+                          <xsl:value-of select="tei:altIdent"/>
+                        </xsl:when>
+                        <xsl:otherwise>
+                          <xsl:value-of select="@ident"/>
+                        </xsl:otherwise>
+                      </xsl:choose>
+                    </xsl:with-param>
+                    <xsl:with-param name="class">
+                      <xsl:text>link_odd</xsl:text>
+                    </xsl:with-param>
+                  </xsl:call-template>
+                </xsl:for-each>
+                <xsl:value-of select="$spaceCharacter"/>
+                <xsl:text> </xsl:text>
+              </xsl:for-each>
+            </xsl:element>
+          </xsl:element>
+        </xsl:if>
+      </xsl:for-each>
+    </xsl:element>
+  </xsl:template>
+  <xsl:template match="tei:exemplum" mode="weave">
+    <xsl:if test="teix:egXML/* or teix:egXML/text() or text()">
+      <xsl:apply-templates select="." mode="doc"/>
+    </xsl:if>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>No-op processing of elements tei:gloss and tei:desc in
+    normal modes, as they will always be called explicitly if
+    needed.</desc>
+  </doc>
+  <xsl:template match="tei:desc|tei:gloss" mode="weave"/>
+  <xsl:template match="tei:remarks" mode="weave">
+    <xsl:variable name="documentationLanguage">
+      <xsl:call-template name="generateDoc"/>
+    </xsl:variable>
+    <xsl:variable name="langs">
+      <xsl:value-of select="concat(normalize-space($documentationLanguage),' ')"/>
+    </xsl:variable>
+    <xsl:variable name="firstLang">
+      <xsl:value-of select="substring-before($langs,' ')"/>
+    </xsl:variable>
+    <xsl:choose>
+      <xsl:when test="@xml:lang=$firstLang">
+        <xsl:apply-templates select="." mode="doc"/>
+      </xsl:when>
+      <xsl:when test="not(@xml:lang) and $documentationLanguage='en'">
+        <xsl:apply-templates select="." mode="doc"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:variable name="currentLang">
+          <xsl:call-template name="findLanguage"/>
+        </xsl:variable>
+        <xsl:if test="contains($langs,concat($currentLang,' '))">
+          <xsl:apply-templates select="." mode="doc"/>
+        </xsl:if>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element valList</desc>
+  </doc>
+  <xsl:template match="tei:valList" mode="weave">
+    <xsl:apply-templates mode="contents" select="."/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element attList</desc>
+  </doc>
+  <xsl:template match="tei:attList" mode="weave"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element defaultVal</desc>
+  </doc>
+  <xsl:template match="tei:defaultVal" mode="weave"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element desc</desc>
+  </doc>
+  <xsl:template match="tei:desc">
+    <xsl:apply-templates/>
+  </xsl:template>
+  <!-- pretty printing of RNC -->
+  <xsl:template match="nc" mode="keep">
+    <xsl:call-template name="showRNC">
+      <xsl:with-param name="style">
+        <xsl:text>rnc_nc</xsl:text>
+      </xsl:with-param>
+      <xsl:with-param name="contents">
+        <xsl:value-of select="."/>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <xsl:template match="declaration" mode="keep">
+    <xsl:call-template name="showRNC">
+      <xsl:with-param name="style">
+        <xsl:text>rnc_decl</xsl:text>
+      </xsl:with-param>
+      <xsl:with-param name="contents">
+        <xsl:value-of select="."/>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <xsl:template match="prefix" mode="keep">
+    <xsl:call-template name="showRNC">
+      <xsl:with-param name="style">
+        <xsl:text>rnc_prefix</xsl:text>
+      </xsl:with-param>
+      <xsl:with-param name="contents">
+        <xsl:value-of select="."/>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <xsl:template match="param" mode="keep">
+    <xsl:call-template name="showRNC">
+      <xsl:with-param name="style">
+        <xsl:text>rnc_param</xsl:text>
+      </xsl:with-param>
+      <xsl:with-param name="contents">
+        <xsl:value-of select="."/>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <xsl:template match="op" mode="keep">
+    <xsl:value-of select="translate (., ' ', '&#160;')"/>
+  </xsl:template>
+  <xsl:template match="atom" mode="keep">
+    <xsl:call-template name="showRNC">
+      <xsl:with-param name="style">
+        <xsl:text>rnc_atom</xsl:text>
+      </xsl:with-param>
+      <xsl:with-param name="contents">
+        <xsl:value-of select="."/>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <xsl:template match="t" mode="keep">
+    <xsl:choose>
+      <xsl:when test=". = '[' or . = ']'">
+        <xsl:call-template name="showRNC">
+          <xsl:with-param name="style">
+            <xsl:text>rnc_annot</xsl:text>
+          </xsl:with-param>
+          <xsl:with-param name="contents">
+            <xsl:value-of select="."/>
+          </xsl:with-param>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="."/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <xsl:template match="doc" mode="keep">
+    <xsl:call-template name="showRNC">
+      <xsl:with-param name="style">
+        <xsl:text>rnc_comment</xsl:text>
+      </xsl:with-param>
+      <xsl:with-param name="contents">
+        <xsl:value-of select="."/>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <xsl:template match="annot" mode="keep">
+    <xsl:call-template name="showRNC">
+      <xsl:with-param name="style">
+        <xsl:text>rnc_annot</xsl:text>
+      </xsl:with-param>
+      <xsl:with-param name="contents">
+        <xsl:value-of select="."/>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <xsl:template match="type" mode="keep">
+    <xsl:call-template name="showRNC">
+      <xsl:with-param name="style">
+        <xsl:text>rnc_type</xsl:text>
+      </xsl:with-param>
+      <xsl:with-param name="contents">
+        <xsl:value-of select="."/>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <xsl:template match="keyword" mode="keep">
+    <xsl:call-template name="showRNC">
+      <xsl:with-param name="style">
+        <xsl:text>rnc_keyword</xsl:text>
+      </xsl:with-param>
+      <xsl:with-param name="contents">
+        <xsl:value-of select="."/>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <xsl:template match="tei:attList[@org='choice']">
+    <xsl:apply-templates/>
+  </xsl:template>
+  <xsl:template name="showAttClasses">
+    <xsl:param name="minimal">false</xsl:param>
+    <xsl:variable name="clatts">
+      <xsl:for-each select="ancestor-or-self::tei:elementSpec|ancestor-or-self::tei:classSpec">
+        <xsl:call-template name="attClassDetails"/>
+      </xsl:for-each>
+    </xsl:variable>
+    <xsl:if test="$minimal='true'">
+      <xsl:text> — </xsl:text>
+    </xsl:if>
+    <xsl:choose>
+      <xsl:when test="$minimal='true' and not($clatts='')">
+        <xsl:text> [+ </xsl:text>
+        <xsl:copy-of select="$clatts"/>
+        <xsl:text>]</xsl:text>
+      </xsl:when>
+      <xsl:when test="not($clatts='')">
+        <xsl:if test="ancestor::tei:schemaSpec and key('CLASSES','att.global')">
+          <xsl:element namespace="{$outputNS}" name="{$segName}">
+            <xsl:attribute name="xml:lang">
+              <xsl:value-of select="$documentationLanguage"/>
+            </xsl:attribute>
+            <xsl:call-template name="i18n">
+              <xsl:with-param name="word">
+                <xsl:choose>
+                  <xsl:when test="not($autoGlobal='true')">Attributes</xsl:when>
+                  <xsl:when test=".//tei:attDef">In addition to global attributes and those inherited from</xsl:when>
+                  <xsl:otherwise>Global attributes and those inherited from</xsl:otherwise>
+                </xsl:choose>
+              </xsl:with-param>
+            </xsl:call-template>
+            <xsl:value-of select="$spaceCharacter"/>
+          </xsl:element>
+        </xsl:if>
+        <xsl:copy-of select="$clatts"/>
+      </xsl:when>
+      <xsl:when test="ancestor::tei:schemaSpec and not(key('CLASSES','att.global'))">
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="i18n">
+          <xsl:with-param name="word">
+            <xsl:choose>
+              <xsl:when test="not($autoGlobal='true')">Attributes</xsl:when>
+              <xsl:when test=".//tei:attDef">In addition to global attributes</xsl:when>
+              <xsl:otherwise>Global attributes only</xsl:otherwise>
+            </xsl:choose>
+          </xsl:with-param>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <xsl:template name="attClassDetails">
+    <xsl:param name="depth">1</xsl:param>
+    <xsl:for-each select="tei:classes/tei:memberOf">
+      <xsl:choose>
+        <xsl:when test="key('CLASSES',@key)">
+          <xsl:for-each select="key('CLASSES',@key)">
+            <xsl:if test="@type='atts'">
+              <xsl:if test="$depth &gt; 1"> (</xsl:if>
+              <xsl:call-template name="linkTogether">
+                <xsl:with-param name="name" select="@ident"/>
+              </xsl:call-template>
+              <xsl:if test=".//tei:attDef">
+                <xsl:text> (</xsl:text>
+                <xsl:for-each select=".//tei:attDef">
+                  <xsl:call-template name="emphasize">
+                    <xsl:with-param name="class">attribute</xsl:with-param>
+                    <xsl:with-param name="content">
+                      <xsl:text>@</xsl:text>
+                      <xsl:choose>
+                        <xsl:when test="tei:altIdent">
+                          <xsl:value-of select="tei:altIdent"/>
+                        </xsl:when>
+                        <xsl:otherwise>
+                          <xsl:value-of select="@ident"/>
+                        </xsl:otherwise>
+                      </xsl:choose>
+                    </xsl:with-param>
+                  </xsl:call-template>
+                  <xsl:if test="following-sibling::tei:attDef">
+                    <xsl:text>, </xsl:text>
+                  </xsl:if>
+                </xsl:for-each>
+                <xsl:text>)</xsl:text>
+                <xsl:if test="$depth=1">
+                  <xsl:call-template name="showSpace"/>
+                </xsl:if>
+              </xsl:if>
+              <xsl:call-template name="attClassDetails">
+                <xsl:with-param name="depth">
+                  <xsl:value-of select="$depth + 1"/>
+                </xsl:with-param>
+              </xsl:call-template>
+              <xsl:if test="$depth &gt; 1">) </xsl:if>
+            </xsl:if>
+          </xsl:for-each>
+        </xsl:when>
+        <xsl:when test="ancestor::tei:schemaSpec">
+	  </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="@key"/>
+          <xsl:call-template name="showSpace"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:for-each>
+  </xsl:template>
+  <xsl:template name="showElement">
+    <xsl:param name="name"/>
+    <xsl:variable name="documentationLanguage">
+      <xsl:call-template name="generateDoc"/>
+    </xsl:variable>
+    <xsl:choose>
+      <xsl:when test="$oddmode='tei'">
+        <tei:ref target="#{$name}">
+          <xsl:value-of select="$name"/>
+        </tei:ref>
+      </xsl:when>
+      <xsl:when test="$oddmode='html'">
+        <xsl:choose>
+          <xsl:when test="key('IDENTS',$name) and number($splitLevel)=-1">
+            <a xmlns="http://www.w3.org/1999/xhtml" class="link_element" href="#{$name}">
+              <xsl:value-of select="$name"/>
+            </a>
+          </xsl:when>
+          <xsl:when test="key('IDENTS',$name) and $STDOUT='true'">
+            <a xmlns="http://www.w3.org/1999/xhtml" class="link_element">
+              <xsl:attribute name="href">
+                <xsl:call-template name="getSpecURL">
+                  <xsl:with-param name="name">
+                    <xsl:value-of select="$name"/>
+                  </xsl:with-param>
+                  <xsl:with-param name="type">
+                    <xsl:value-of select="substring-before(local-name(),'Spec')"/>
+                  </xsl:with-param>
+                </xsl:call-template>
+              </xsl:attribute>
+              <xsl:value-of select="$name"/>
+            </a>
+          </xsl:when>
+          <xsl:when test="key('IDENTS',$name)">
+            <a xmlns="http://www.w3.org/1999/xhtml" class="link_element" href="ref-{$name}{$outputSuffix}">
+              <xsl:value-of select="$name"/>
+            </a>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:value-of select="$name"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+      <xsl:when test="$oddmode='pdf'">
+        <fo:inline font-style="italic">
+          <xsl:value-of select="$name"/>
+        </fo:inline>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$name"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <xsl:template name="processSpecDesc">
+    <xsl:variable name="name">
+      <xsl:value-of select="@key"/>
+    </xsl:variable>
+    <xsl:variable name="atts">
+      <xsl:choose>
+        <xsl:when test="@rend='noatts'">-</xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="normalize-space(@atts)"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:choose>
+      <xsl:when test="$name=''">
+        <xsl:message>ERROR: no key attribute on specDesc</xsl:message>
+      </xsl:when>
+      <xsl:when test="key('IDENTS',$name)">
+        <xsl:apply-templates mode="show" select="key('IDENTS',$name)">
+          <xsl:with-param name="atts" select="$atts"/>
+        </xsl:apply-templates>
+      </xsl:when>
+      <xsl:when test="not($localsource='')">
+        <xsl:for-each select="document($localsource)/tei:TEI">
+          <xsl:apply-templates mode="show" select="tei:*[@ident=$name]">
+            <xsl:with-param name="atts" select="$atts"/>
+          </xsl:apply-templates>
+        </xsl:for-each>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:text>UNKNOWN ELEMENT </xsl:text>
+        <xsl:value-of select="$name"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <xsl:template name="processatts">
+    <xsl:param name="values"/>
+    <xsl:variable name="here" select="."/>
+    <xsl:for-each select="tokenize($values, ' ')">
+      <xsl:variable name="v" select="."/>
+      <xsl:for-each select="$here">
+        <xsl:apply-templates select="key('IDENTS',.)"/>
+      </xsl:for-each>
+    </xsl:for-each>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element attList</desc>
+  </doc>
+  <xsl:template match="tei:attList" mode="show">
+    <xsl:call-template name="displayAttList">
+      <xsl:with-param name="mode">summary</xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <xsl:template name="makeTagsetInfo">
+    <xsl:value-of select="@module"/>
+    <xsl:for-each select="key('MODULES',@module)/ancestor::tei:div[last()]">
+      <xsl:text> — </xsl:text>
+      <xsl:call-template name="makeInternalLink">
+        <xsl:with-param name="target" select="@xml:id"/>
+        <xsl:with-param name="ptr" select="true()"/>
+        <xsl:with-param name="dest">
+          <xsl:value-of select="tei:head"/>
+        </xsl:with-param>
+      </xsl:call-template>
+    </xsl:for-each>
+  </xsl:template>
+  <xsl:template name="generateChildren">
+    <xsl:variable name="name" select="@ident"/>
+    <xsl:variable name="Original" select="/"/>
+    <xsl:choose>
+      <xsl:when test="tei:content//rng:ref[@name='macro.anyXML']">
+        <xsl:element namespace="{$outputNS}" name="{$segName}">
+          <xsl:attribute name="xml:lang">
+            <xsl:value-of select="$documentationLanguage"/>
+          </xsl:attribute>
+          <xsl:text>ANY</xsl:text>
+        </xsl:element>
+      </xsl:when>
+      <xsl:when test="tei:content/rng:empty">
+        <xsl:element namespace="{$outputNS}" name="{$segName}">
+          <xsl:attribute name="xml:lang">
+            <xsl:value-of select="$documentationLanguage"/>
+          </xsl:attribute>
+          <xsl:call-template name="i18n">
+            <xsl:with-param name="word">Empty element</xsl:with-param>
+          </xsl:call-template>
+        </xsl:element>
+      </xsl:when>
+      <xsl:when test="tei:content/rng:text and    count(tei:content/rng:*)=1">
+        <xsl:element namespace="{$outputNS}" name="{$segName}">
+          <xsl:attribute name="xml:lang">
+            <xsl:value-of select="$documentationLanguage"/>
+          </xsl:attribute>
+          <xsl:call-template name="i18n">
+            <xsl:with-param name="word">Character data only</xsl:with-param>
+          </xsl:call-template>
+        </xsl:element>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:variable name="Children">
+          <xsl:for-each select="tei:content">
+            <xsl:call-template name="followRef"/>
+          </xsl:for-each>
+        </xsl:variable>
+        <xsl:call-template name="displayElementsByModule">
+          <xsl:with-param name="List">
+            <xsl:copy-of select="$Children"/>
+          </xsl:with-param>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <xsl:template name="displayElementsByModule">
+    <xsl:param name="List"/>
+    <xsl:variable name="here" select="."/>
+    <xsl:for-each select="$List">
+      <xsl:choose>
+        <xsl:when test="Element[@type='Text'] and count(Element)=1">
+          <xsl:element namespace="{$outputNS}" name="{$segName}">
+            <xsl:attribute name="xml:lang">
+              <xsl:value-of select="$documentationLanguage"/>
+            </xsl:attribute>
+            <xsl:call-template name="i18n">
+              <xsl:with-param name="word">Character data only</xsl:with-param>
+            </xsl:call-template>
+          </xsl:element>
+        </xsl:when>
+        <xsl:when test="count(Element)=0">
+          <xsl:element namespace="{$outputNS}" name="{$segName}">
+            <xsl:attribute name="xml:lang">
+              <xsl:value-of select="$documentationLanguage"/>
+            </xsl:attribute>
+            <xsl:call-template name="i18n">
+              <xsl:with-param name="word">Empty element</xsl:with-param>
+            </xsl:call-template>
+          </xsl:element>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:element namespace="{$outputNS}" name="{$divName}">
+            <xsl:attribute name="{$rendName}">
+              <xsl:text>specChildren</xsl:text>
+            </xsl:attribute>
+            <xsl:for-each-group select="*" group-by="@module">
+              <xsl:sort select="@module"/>
+              <xsl:element namespace="{$outputNS}" name="{$divName}">
+                <xsl:attribute name="{$rendName}">
+                  <xsl:text>specChild</xsl:text>
+                </xsl:attribute>
+                <xsl:if test="string-length(current-grouping-key())&gt;0">
+                  <xsl:element namespace="{$outputNS}" name="{$segName}">
+                    <xsl:attribute name="{$rendName}">
+                      <xsl:text>specChildModule</xsl:text>
+                    </xsl:attribute>
+                    <xsl:value-of select="current-grouping-key()"/>
+                    <xsl:text>: </xsl:text>
+                  </xsl:element>
+                </xsl:if>
+                <xsl:element namespace="{$outputNS}" name="{$segName}">
+                  <xsl:attribute name="{$rendName}">
+                    <xsl:text>specChildElements</xsl:text>
+                  </xsl:attribute>
+                  <xsl:for-each-group select="current-group()" group-by="@altName">
+                    <xsl:sort select="@altName"/>
+                    <xsl:variable name="me" select="@name"/>
+                    <xsl:variable name="alt" select="@altName"/>
+                    <xsl:variable name="type" select="@type"/>
+                    <xsl:for-each select="$here">
+                      <xsl:call-template name="linkTogether">
+                        <xsl:with-param name="name" select="$me"/>
+                        <xsl:with-param name="reftext" select="$alt"/>
+                        <xsl:with-param name="class">link_odd_<xsl:value-of select="$type"/></xsl:with-param>
+                      </xsl:call-template>
+                    </xsl:for-each>
+                    <xsl:if test="not(position() = last())">
+                      <xsl:call-template name="showSpaceBetweenItems"/>
+                    </xsl:if>
+                  </xsl:for-each-group>
+                </xsl:element>
+              </xsl:element>
+            </xsl:for-each-group>
+          </xsl:element>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:for-each>
+  </xsl:template>
+  <xsl:template name="followRef">
+    <xsl:for-each select=".//rng:ref">
+      <xsl:if test="not(starts-with(@name,'any')        or starts-with(@name,'macro.any')       or @name='AnyThing')">
+        <xsl:variable name="Name">
+          <xsl:choose>
+            <xsl:when test="contains(@name,'_sequence')">
+              <xsl:value-of select="substring-before(@name,'_')"/>
+            </xsl:when>
+            <xsl:when test="contains(@name,'_alternat')">
+              <xsl:value-of select="substring-before(@name,'_')"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:value-of select="@name"/>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:variable>
+        <xsl:for-each select="key('IDENTS',$Name)">
+          <xsl:choose>
+            <xsl:when test="self::tei:elementSpec">
+              <Element name="{@ident}" module="{@module}" type="{local-name()}">
+                <xsl:attribute name="altName">
+                  <xsl:choose>
+                    <xsl:when test="tei:altIdent">
+                      <xsl:value-of select="tei:altIdent"/>
+                    </xsl:when>
+                    <xsl:otherwise>
+                      <xsl:value-of select="@ident"/>
+                    </xsl:otherwise>
+                  </xsl:choose>
+                </xsl:attribute>
+              </Element>
+            </xsl:when>
+            <xsl:when test="self::tei:macroSpec">
+              <xsl:for-each select="tei:content">
+                <xsl:choose>
+                  <xsl:when test="rng:text and count(rng:*)=1">
+                    <Element type="TEXT"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                    <xsl:call-template name="followRef"/>
+                  </xsl:otherwise>
+                </xsl:choose>
+              </xsl:for-each>
+            </xsl:when>
+            <xsl:when test="self::tei:classSpec">
+              <xsl:call-template name="followMembers"/>
+            </xsl:when>
+          </xsl:choose>
+        </xsl:for-each>
+      </xsl:if>
+    </xsl:for-each>
+  </xsl:template>
+  <xsl:template name="followMembers">
+    <xsl:for-each select="key('CLASSMEMBERS',@ident)">
+      <xsl:choose>
+        <xsl:when test="self::tei:elementSpec">
+          <Element name="{@ident}" module="{@module}"
+		   type="{local-name()}">
+	    <xsl:attribute name="altName">
+	      <xsl:choose>
+		<xsl:when test="tei:altIdent">
+		  <xsl:value-of select="tei:altIdent"/>
+		</xsl:when>
+		<xsl:otherwise>
+		  <xsl:value-of select="@ident"/>
+		</xsl:otherwise>
+	      </xsl:choose>
+	    </xsl:attribute>
+	  </Element>
+        </xsl:when>
+        <xsl:when test="self::tei:classSpec">
+          <xsl:call-template name="followMembers"/>
+        </xsl:when>
+      </xsl:choose>
+    </xsl:for-each>
+  </xsl:template>
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/common2/tagdocs.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/common2/textstructure.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/common2/textstructure.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/common2/textstructure.xsl	(revision 258)
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:tei="http://www.tei-c.org/ns/1.0"
+                
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                exclude-result-prefixes="tei"
+                version="2.0">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet dealing with elements from the textstructure
+      module. </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: textstructure.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2011, TEI Consortium</p>
+      </desc>
+   </doc>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Establish nesting depth of sections</desc>
+   </doc>
+  <xsl:template match="tei:text" mode="depth">
+    <xsl:value-of select="count(ancestor::tei:text)-1"/>
+  </xsl:template>
+  <xsl:template match="tei:div|tei:div1|tei:div2|tei:div3|tei:div4|tei:div5|tei:div6"
+                 mode="depth">
+      <xsl:choose>
+	<xsl:when test="ancestor::tei:text/parent::tei:group and
+			self::tei:div">
+	   <xsl:value-of select="count(ancestor::tei:div) + 1"/>
+	</xsl:when>
+         <xsl:when test="local-name(.) = 'div'">
+            <xsl:value-of select="count(ancestor::tei:div)"/>
+         </xsl:when>
+	<xsl:when test="ancestor::tei:text/parent::tei:group">
+	   <xsl:value-of select="number(substring-after(local-name(.),'div')) "/>
+	</xsl:when>
+	<xsl:when test="ancestor::tei:text/parent::tei:group">
+	  <xsl:value-of select="number(substring-after(local-name(.),'div'))"/>
+	</xsl:when>
+	<xsl:otherwise>
+	  <xsl:value-of select="number(substring-after(local-name(.),'div')) - 1"/>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Generate revision description</desc>
+  </doc>
+  <xsl:template match="tei:divGen[@type='revHist']">
+    <xsl:variable name="r">
+      <div xmlns="http://www.tei-c.org/ns/1.0" rend='nonumber'>
+	<head>Revision history</head>
+	<table rend="rules" >
+	  <xsl:for-each
+	      select="ancestor-or-self::tei:TEI/tei:teiHeader/tei:revisionDesc/tei:change">
+	    <row>
+	      <cell><xsl:value-of select="@when"/></cell>
+	      <cell><xsl:value-of select="@who"/></cell>
+	      <cell><xsl:value-of select="."/></cell>
+	    </row>
+	  </xsl:for-each>
+	</table>
+      </div>
+    </xsl:variable>
+    <xsl:for-each select="$r">
+      <xsl:apply-templates/>
+    </xsl:for-each>
+  </xsl:template>
+
+
+
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/common2/textstructure.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/common2/textcrit.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/common2/textcrit.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/common2/textcrit.xsl	(revision 258)
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet 
+                xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
+                xmlns:rng="http://relaxng.org/ns/structure/1.0"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                exclude-result-prefixes="a rng tei teix"
+                version="2.0">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p>
+    TEI stylesheet
+    dealing with elements from the
+      textcrit module.
+      </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Copyright: 2011, TEI Consortium</p>
+      </desc>
+   </doc>
+
+   <xsl:key name="APP" match="tei:app" use="1"/>
+   
+   <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+         <p>Process element app</p>
+         <p>Process lem and rdg within app. Sends lots of information
+	 to a footnote. If a lem is not found, the first rdg is
+	 used as the base text. 
+	 </p>
+      </desc>
+   </doc>
+  <xsl:template match="tei:app">
+    <xsl:call-template name="appReading">
+      <xsl:with-param name="lemma">
+	<xsl:choose>
+	  <xsl:when test="tei:lem">
+	    <xsl:value-of select="tei:lem"/>
+	</xsl:when>
+	<xsl:otherwise>
+	  <xsl:value-of select="tei:rdg[1]"/>
+	</xsl:otherwise>
+      </xsl:choose>
+      </xsl:with-param>
+      <xsl:with-param name="lemmawitness">
+      <xsl:value-of select="@wit"/>
+      </xsl:with-param>
+      <xsl:with-param name="readings">
+	<xsl:for-each select="tei:rdg">
+	  <xsl:choose>
+	    <xsl:when test="not(../tei:lem) and position()=1"/>
+	    <xsl:otherwise>
+	      <xsl:value-of select="."/>
+	      <xsl:text>(</xsl:text>
+	      <xsl:value-of select="translate(substring(@wit,2),' #',', ')"/>
+	      <xsl:text>)</xsl:text>
+	  </xsl:otherwise>
+	  </xsl:choose>
+	  <xsl:if test="following-sibling::tei:rdg">; </xsl:if>
+	</xsl:for-each>
+      </xsl:with-param>
+    </xsl:call-template>
+    </xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/common2/textcrit.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/common2/core.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/common2/core.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/common2/core.xsl	(revision 258)
@@ -0,0 +1,879 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:tei="http://www.tei-c.org/ns/1.0"
+                
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                exclude-result-prefixes="tei"
+                version="2.0">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet dealing with elements from the core module. </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: core.xsl 10010 2012-01-03 19:35:49Z rahtz $</p>
+         <p>Copyright: 2011, TEI Consortium</p>
+      </desc>
+   </doc>
+  <xsl:output indent="no"/>
+    <xsl:strip-space elements="tei:author tei:forename tei:surname tei:editor"/>
+
+  <xsl:key name="MNAMES"
+            match="tei:monogr/tei:author[tei:surname]|tei:monogr/tei:editor[tei:surname]"
+            use="ancestor::tei:biblStruct/@xml:id"/>
+  <xsl:key name="ANAMES"
+            match="tei:analytic/tei:author[tei:surname]|tei:analytic/tei:editor[tei:surname]"
+            use="ancestor::tei:biblStruct/@xml:id"/>
+  
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process all elements to find out their nesting depth</desc>
+   </doc>
+  <xsl:template match="tei:*" mode="depth">99</xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process all elements in plain mode</desc>
+   </doc>
+  <xsl:template match="tei:*" mode="plain">
+      <xsl:apply-templates mode="plain"/>
+  </xsl:template>
+  <xsl:template match="tei:note" mode="plain"/>
+  <xsl:template match="tei:app" mode="plain"/>
+  <xsl:template match="tei:pb" mode="plain"/>
+  <xsl:template match="tei:lb" mode="plain"/>
+  <xsl:template match="tei:figure" mode="plain"/>
+  <xsl:template match="tei:figDesc" mode="plain"/>
+  <xsl:template match="tei:ptr" mode="plain"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process tei:sic</desc>
+   </doc>
+  <xsl:template match="tei:sic">
+      <xsl:apply-templates/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process tei:corr</desc>
+   </doc>
+  <xsl:template match="tei:corr"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process tei:item in runin mode</desc>
+   </doc>
+  <xsl:template match="tei:item" mode="runin">
+      <xsl:text> • </xsl:text>
+      <xsl:apply-templates/>
+      <xsl:text>&#160;</xsl:text>
+  </xsl:template>
+
+
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element edition</desc>
+   </doc>
+  <xsl:template match="tei:edition">
+      <xsl:apply-templates/>
+      <xsl:if test="ancestor::tei:biblStruct or ancestor::tei:biblFull">
+         <xsl:call-template name="tei:makeText">
+	   <xsl:with-param name="letters">. </xsl:with-param>
+	 </xsl:call-template>
+      </xsl:if>
+  </xsl:template>
+
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element imprint</desc>
+   </doc>
+  <xsl:template match="tei:imprint">
+      <xsl:choose>
+         <xsl:when test="ancestor::tei:biblStruct or ancestor::tei:biblFull">
+	           <xsl:apply-templates select="tei:date"/>
+	           <xsl:apply-templates select="tei:pubPlace"/>
+	           <xsl:apply-templates select="tei:publisher"/>
+	           <xsl:apply-templates select="tei:biblScope"/>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:apply-templates/>
+         </xsl:otherwise>
+      </xsl:choose>
+
+  </xsl:template>
+
+
+   <!-- biblStruct -->
+<xsl:template match="tei:biblStruct" mode="xref">
+      <xsl:choose>
+         <xsl:when test="count(key('ANAMES',@xml:id))=1">
+	           <xsl:value-of select="key('ANAMES',@xml:id)/tei:surname"/>
+         </xsl:when>
+         <xsl:when test="count(key('ANAMES',@xml:id))=2">
+	           <xsl:value-of select="key('ANAMES',@xml:id)[1]/tei:surname"/>
+	           <xsl:call-template name="tei:makeText">
+		     <xsl:with-param name="letters"> and </xsl:with-param>
+		   </xsl:call-template>
+	           <xsl:value-of select="key('ANAMES',@xml:id)[2]/tei:surname"/>
+         </xsl:when>
+         <xsl:when test="count(key('ANAMES',@xml:id))&gt;2">
+	           <xsl:value-of select="key('ANAMES',@xml:id)[1]/tei:surname"/>
+	           <xsl:call-template name="tei:makeText">
+		     <xsl:with-param name="letters"> et al.</xsl:with-param>
+		   </xsl:call-template>
+         </xsl:when>
+         <xsl:when test="count(key('MNAMES',@xml:id))=1">
+	           <xsl:value-of select="key('MNAMES',@xml:id)/tei:surname"/>
+         </xsl:when>
+         <xsl:when test="count(key('MNAMES',@xml:id))=2">
+	           <xsl:value-of select="key('MNAMES',@xml:id)[1]/tei:surname"/>
+	           <xsl:call-template name="tei:makeText">
+		     <xsl:with-param name="letters"> and </xsl:with-param>
+		   </xsl:call-template>
+	           <xsl:value-of select="key('MNAMES',@xml:id)[2]/tei:surname"/>
+         </xsl:when>
+         <xsl:when test="count(key('MNAMES',@xml:id))&gt;2">
+	           <xsl:value-of select="key('MNAMES',@xml:id)[1]/tei:surname"/>
+	           <xsl:call-template name="tei:makeText">
+		     <xsl:with-param name="letters"> et al.</xsl:with-param>
+		   </xsl:call-template>
+         </xsl:when>
+         <xsl:when test=".//tei:author[tei:surname]">
+	           <xsl:value-of select=".//tei:author/tei:surname[1]"/>
+         </xsl:when>
+         <xsl:when test=".//tei:author[tei:orgName]">
+	           <xsl:value-of select=".//tei:author/tei:orgName[1]"/>
+         </xsl:when>
+         <xsl:when test=".//tei:author">
+	           <xsl:value-of select=".//tei:author[1]"/>
+         </xsl:when>
+         <xsl:when test=".//tei:editor[tei:surname]">
+	           <xsl:value-of select=".//tei:editor/tei:surname[1]"/>
+         </xsl:when>
+         <xsl:when test=".//tei:editor">
+	           <xsl:value-of select=".//tei:editor[1]"/>
+         </xsl:when>
+         <xsl:otherwise>
+	           <xsl:value-of select=".//tei:title[1]"/>
+         </xsl:otherwise>
+      </xsl:choose>
+      <xsl:choose>
+         <xsl:when test="count(tei:*[1]/tei:editor)=1">
+	           <xsl:call-template name="tei:makeText">
+		     <xsl:with-param name="letters"> (ed.)</xsl:with-param>
+		   </xsl:call-template>
+         </xsl:when>
+         <xsl:when test="count(tei:*[1]/tei:editor)&gt;1">
+	           <xsl:call-template name="tei:makeText">
+		     <xsl:with-param name="letters"> (eds.)</xsl:with-param>
+		   </xsl:call-template>
+         </xsl:when>
+      </xsl:choose>
+      <xsl:choose>
+         <xsl:when test="tei:monogr/tei:imprint/tei:date/@when">
+	           <xsl:call-template name="tei:makeText">
+		     <xsl:with-param name="letters"> (</xsl:with-param>
+		   </xsl:call-template>
+	           <xsl:value-of select="substring-before(tei:monogr/tei:imprint/tei:date/@when,'-')"/>
+	           <xsl:call-template name="tei:makeText">
+		     <xsl:with-param name="letters">)</xsl:with-param>
+		   </xsl:call-template>
+         </xsl:when>
+         <xsl:when test="tei:monogr/tei:imprint/tei:date">
+	           <xsl:call-template name="tei:makeText">
+		     <xsl:with-param name="letters"> (</xsl:with-param>
+		   </xsl:call-template>
+	           <xsl:value-of select="tei:monogr/tei:imprint/tei:date"/>
+	           <xsl:call-template name="tei:makeText">
+		     <xsl:with-param name="letters">)</xsl:with-param>
+		   </xsl:call-template>
+         </xsl:when>
+      </xsl:choose>
+   </xsl:template>
+
+   <!-- authors and editors -->
+   <xsl:template match="tei:editor|tei:author">
+     <xsl:choose>
+       <xsl:when test="ancestor::tei:bibl">
+	 <xsl:apply-templates/>
+       </xsl:when>
+       <xsl:when test="self::tei:author and not(following-sibling::tei:author)">
+	 <xsl:apply-templates/>
+	 <xsl:call-template name="tei:makeText">
+	   <xsl:with-param name="letters">. </xsl:with-param>
+	 </xsl:call-template>
+       </xsl:when>
+       <xsl:when test="self::tei:editor and not(following-sibling::tei:editor)">
+	 <xsl:apply-templates/>
+	 <xsl:call-template name="tei:makeText">
+	   <xsl:with-param name="letters"> (ed</xsl:with-param>
+	 </xsl:call-template>
+	 <xsl:if test="preceding-sibling::tei:editor">s</xsl:if>
+	 <xsl:call-template name="tei:makeText">
+	   <xsl:with-param name="letters">.) </xsl:with-param>
+	 </xsl:call-template>
+       </xsl:when>
+       <xsl:otherwise>
+	 <xsl:apply-templates/>
+	 <xsl:call-template name="tei:makeText">
+	   <xsl:with-param name="letters">, </xsl:with-param>
+	 </xsl:call-template>
+       </xsl:otherwise>
+     </xsl:choose>
+   </xsl:template>
+
+   <xsl:template match="tei:author|tei:editor" mode="mla">
+     <!-- <xsl:variable name="totalNbr">
+	  <xsl:number select="ancestor::tei:listBibl"/>
+        </xsl:variable>
+        <xsl:value-of select="$totalNbr"/>. 
+        <xsl:choose>
+        <xsl:when test="self::tei:author[1] = parent::tei:analytic/parent::tei:biblStruct/preceding-sibling::tei:biblStruct/*/tei:author[1] or self::tei:author[1] =
+        parent::tei:analytic/parent::tei:biblStruct/preceding-sibling::tei:biblStruct/tei:monogr/tei:editor[1]">
+        <xsl:text>[three hyphens]</xsl:text>
+        <xsl:choose>
+        <xsl:when test="self::tei:author and following-sibling::tei:author"><xsl:text>, </xsl:text></xsl:when>
+        <xsl:otherwise><xsl:text>. </xsl:text></xsl:otherwise>
+        </xsl:choose>
+        </xsl:when>
+        <xsl:when test="self::tei:author[1] = parent::tei:monogr/parent::tei:biblStruct/preceding-sibling::tei:biblStruct/*/tei:author[1] and not(preceding-sibling::tei:analytic) or self::tei:author[1] =
+        parent::tei:monogr/parent::tei:biblStruct/preceding-sibling::tei:biblStruct/tei:monogr/tei:editor[1] and not(preceding-sibling::tei:analytic)">
+        <xsl:text>[three hyphens]</xsl:text>
+        <xsl:choose>
+        <xsl:when test="self::tei:author and following-sibling::tei:author"><xsl:text>, </xsl:text></xsl:when>
+        <xsl:otherwise><xsl:text>. </xsl:text></xsl:otherwise>
+        </xsl:choose>
+        </xsl:when>
+        <xsl:when test="self::tei:editor[1] = parent::tei:*/parent::tei:biblStruct/preceding-sibling::tei:biblStruct/*/tei:author[1] and
+        not(preceding-sibling::tei:analytic) or self::tei:editor[1]
+        = parent::tei:*/parent::tei:biblStruct/preceding-sibling::tei:biblStruct/tei:monogr/tei:editor[1] and not(preceding-sibling::tei:analytic)">
+        <xsl:text>[three hyphens]</xsl:text>
+        <xsl:text>, </xsl:text>
+        </xsl:when> 
+        TAKE OUT THE EXTRA OPEN CHOOSE BEFORE YOU ADD THIS BACK IN-->
+     <xsl:choose>
+       <xsl:when test="self::tei:author and not(following-sibling::tei:author)">
+	 <xsl:choose>
+	   <xsl:when test="ancestor::tei:biblStruct and not(preceding-sibling::tei:author)">
+	     <xsl:apply-templates/>
+	     <xsl:if test="not(ends-with(.,'.'))">
+	       <xsl:text>. </xsl:text>
+	     </xsl:if>
+	   </xsl:when>
+	   <xsl:otherwise>
+	     <xsl:if test="not(self::tei:author[3])">
+	       <xsl:text> and </xsl:text>
+	     </xsl:if>
+	     <xsl:choose>
+	       <xsl:when test="contains(self::tei:author, ',')">
+		 <xsl:value-of select="substring-after(., ',')"/>
+		 <xsl:text> </xsl:text>
+		 <xsl:value-of select="substring-before(., ',')"/>
+	       </xsl:when>
+	       <xsl:otherwise>
+		 <xsl:apply-templates/>
+	       </xsl:otherwise>
+	     </xsl:choose>
+	     <xsl:if test="not(ends-with(.,'.'))">
+	       <xsl:text>. </xsl:text>
+	     </xsl:if>
+	   </xsl:otherwise>
+	 </xsl:choose>
+	 <xsl:text> </xsl:text>
+       </xsl:when>
+       <xsl:when test="self::tei:author and following-sibling::tei:author">
+	 <xsl:choose>
+	   <xsl:when test="ancestor::tei:biblStruct and not(preceding-sibling::tei:author)">
+	     <xsl:apply-templates/>
+	     <xsl:text>, </xsl:text>
+	   </xsl:when>
+	   <xsl:otherwise>
+	     <xsl:choose>
+	       <xsl:when test="contains(self::tei:author, ',')">
+		 <xsl:value-of select="substring-after(., ',')"/>
+		 <xsl:text> </xsl:text>
+		 <xsl:value-of select="substring-before(., ',')"/>
+		 <xsl:text>, and </xsl:text>
+	       </xsl:when>
+	       <xsl:otherwise>
+		 <xsl:apply-templates/>
+		 <xsl:text>, and </xsl:text>
+	       </xsl:otherwise>
+	     </xsl:choose>
+	   </xsl:otherwise>
+	 </xsl:choose>
+       </xsl:when>
+       <xsl:when test="self::tei:editor[@role='translator'] and ancestor::tei:biblStruct">
+	 <xsl:choose>
+	   <xsl:when test="preceding-sibling::tei:editor[@role='editor']/text() = self::tei:editor[@role='translator']/text()">
+	     <xsl:text>Ed. and Trans. </xsl:text>
+	   </xsl:when>
+	   <xsl:when test="not(preceding-sibling::tei:editor[@role='translator'])">				
+	     <xsl:text>Trans. </xsl:text>
+	   </xsl:when>
+	   <xsl:when test="preceding-sibling::tei:editor[@role='translator'] and following-sibling::tei:editor[@role='translator']">
+	     <xsl:text>, </xsl:text>
+	   </xsl:when>
+	   <xsl:otherwise><xsl:text> and </xsl:text></xsl:otherwise>
+	 </xsl:choose>
+	 <xsl:choose>
+	   <xsl:when test="contains(self::tei:editor[@role='translator'], ',')">
+	     <xsl:value-of select="substring-after(., ',')"/>
+	     <xsl:text> </xsl:text>
+	     <xsl:value-of select="substring-before(., ',')"/>
+	   </xsl:when>
+	   <xsl:otherwise>
+	     <xsl:apply-templates/>
+	   </xsl:otherwise>
+	 </xsl:choose>
+	 <xsl:if test="not(following-sibling::tei:editor[@role='translator'])">
+	   <xsl:text>. </xsl:text>
+	 </xsl:if>
+       </xsl:when>
+       <xsl:when test="self::tei:editor[@role='editor'] and not(parent::tei:monogr/parent::tei:biblStruct/tei:analytic) and not(preceding-sibling::tei:author)">
+	 <xsl:choose>
+	   <xsl:when test="ancestor::tei:biblStruct and not(following-sibling::tei:editor[@role='editor']) and not(preceding-sibling::tei:editor[@role='editor'])">
+	     <xsl:apply-templates/>
+	     <xsl:text>, ed. </xsl:text>
+	   </xsl:when>
+	   <xsl:when test="ancestor::tei:biblStruct and following-sibling::tei:editor[@role='editor'] and not(preceding-sibling::tei:editor[@role='editor'])">
+	     <xsl:apply-templates/>
+	     <xsl:choose>
+	       <xsl:when test="position() + 1 = last()">
+		 <xsl:text> </xsl:text>
+	       </xsl:when>
+	       <xsl:otherwise>
+		 <xsl:text>, </xsl:text>
+	       </xsl:otherwise>
+	     </xsl:choose>
+	   </xsl:when>
+	   <xsl:when test="ancestor::tei:biblStruct and following-sibling::tei:editor[@role='editor']">
+	     <xsl:choose>
+	       <xsl:when test="contains(self::tei:editor[@role='editor'], ',')">						
+		 <xsl:value-of select="substring-after(., ',')"/>
+		 <xsl:text> </xsl:text>
+		 <xsl:value-of select="substring-before(., ',')"/>
+	       </xsl:when>
+	       <xsl:otherwise>
+		 <xsl:apply-templates/>
+	       </xsl:otherwise>
+	     </xsl:choose>
+	     <xsl:choose>
+	       <xsl:when test="position() + 1 = last()">
+		 <xsl:text> </xsl:text>
+	       </xsl:when>
+	       <xsl:otherwise>
+		 <xsl:text>, </xsl:text>
+	       </xsl:otherwise>
+	     </xsl:choose>
+	   </xsl:when>
+	   <xsl:when test="ancestor::tei:biblStruct and not(following-sibling::tei:editor[@role='editor'])">
+	     <xsl:choose>
+	       <xsl:when test="preceding-sibling::tei:editor[@role='editor']">
+		 <xsl:text>and </xsl:text>
+		 <xsl:choose>
+		   <xsl:when test="contains(self::tei:editor[@role='editor'], ',')">						
+		     <xsl:value-of select="substring-after(., ',')"/>
+		     <xsl:text> </xsl:text>
+		     <xsl:value-of select="substring-before(., ',')"/>
+		   </xsl:when>
+		   <xsl:otherwise>
+		     <xsl:apply-templates/>
+		   </xsl:otherwise>
+		 </xsl:choose>
+	       </xsl:when>
+	       <xsl:otherwise>
+		 <xsl:apply-templates/>
+	       </xsl:otherwise>
+	     </xsl:choose>
+	     <xsl:choose>
+	       <xsl:when test="../tei:editor[@role='editor'][2]">
+		 <xsl:text>, eds. </xsl:text>
+	       </xsl:when>
+	       <xsl:otherwise>
+		 <xsl:text>, ed. </xsl:text>
+	       </xsl:otherwise>
+	     </xsl:choose>
+	   </xsl:when>
+	 </xsl:choose>
+       </xsl:when>
+       <xsl:when test="self::tei:editor[@role='editor'] and not(following-sibling::tei:editor[@role='editor'])">
+	 <xsl:choose>
+	   <xsl:when test="ancestor::tei:biblStruct and not(preceding-sibling::tei:editor[@role='editor'])">
+	     <xsl:text>Ed. </xsl:text>
+	     <xsl:choose>
+	       <xsl:when test="contains(self::tei:editor[@role='editor'], ',')">						
+		 <xsl:value-of select="substring-after(., ',')"/>
+		 <xsl:text> </xsl:text>
+		 <xsl:value-of select="substring-before(., ',')"/>
+	       </xsl:when>
+	       <xsl:otherwise>
+		 <xsl:apply-templates/>
+	       </xsl:otherwise>
+	     </xsl:choose>
+	     <xsl:text>. </xsl:text>
+	   </xsl:when>
+	   <xsl:when test="ancestor::tei:biblStruct and preceding-sibling::tei:editor[@role='editor']">
+	     <xsl:text>and </xsl:text>
+	     <xsl:choose>
+	       <xsl:when test="contains(self::tei:editor[@role='editor'], ',')">						
+		 <xsl:value-of select="substring-after(., ',')"/>
+		 <xsl:text> </xsl:text>
+		 <xsl:value-of select="substring-before(., ',')"/>
+	       </xsl:when>
+	       <xsl:otherwise>
+		 <xsl:apply-templates/>
+	       </xsl:otherwise>
+	     </xsl:choose>
+	     <xsl:text>. </xsl:text>
+	   </xsl:when>
+	   <xsl:otherwise>
+	     <xsl:apply-templates/>
+	     <xsl:text> (</xsl:text>
+	     <xsl:text>ed</xsl:text>
+	     <xsl:if test="preceding-sibling::tei:editor[@role='editor']">s</xsl:if>
+	     <xsl:text>.</xsl:text>
+	     <xsl:text>) </xsl:text>
+	   </xsl:otherwise>
+	 </xsl:choose>
+       </xsl:when>
+       <xsl:when test="self::tei:editor[@role='editor'] and following-sibling::tei:editor[@role='editor']">
+	 <xsl:choose>
+	   <xsl:when test="ancestor::tei:biblStruct and not(preceding-sibling::tei:editor[@role='editor'])">
+	     <xsl:text>Ed. </xsl:text>
+	     <xsl:choose>
+	       <xsl:when test="contains(self::tei:editor[@role='editor'], ',')">						
+		 <xsl:value-of select="substring-after(., ',')"/>
+		 <xsl:text> </xsl:text>
+		 <xsl:value-of select="substring-before(., ',')"/>
+	       </xsl:when>
+	       <xsl:otherwise>
+		 <xsl:apply-templates/>
+	       </xsl:otherwise>
+	     </xsl:choose>
+	     <xsl:choose>
+	       <xsl:when test="position() + 1 = last()">
+		 <xsl:text> </xsl:text>
+	       </xsl:when>
+	       <xsl:otherwise>
+		 <xsl:text>, </xsl:text>
+	       </xsl:otherwise>
+	     </xsl:choose>
+	   </xsl:when>
+	   <xsl:when test="ancestor::tei:biblStruct and preceding-sibling::tei:editor[@role='editor']">
+	     <xsl:choose>
+	       <xsl:when test="contains(self::tei:editor[@role='editor'], ',')">						
+		 <xsl:value-of select="substring-after(., ',')"/>
+		 <xsl:text> </xsl:text>
+		 <xsl:value-of select="substring-before(., ',')"/>
+	       </xsl:when>
+	       <xsl:otherwise>
+		 <xsl:apply-templates/>
+	       </xsl:otherwise>
+	     </xsl:choose>
+	     <xsl:text>, </xsl:text>
+	   </xsl:when>
+	   <xsl:otherwise>
+	     <xsl:choose>
+	       <xsl:when test="contains(self::tei:editor[@role='editor'], ',')">						
+		 <xsl:value-of select="substring-after(., ',')"/>
+		 <xsl:text> </xsl:text>
+		 <xsl:value-of select="substring-before(., ',')"/>
+	       </xsl:when>
+	       <xsl:otherwise>
+		 <xsl:apply-templates/>
+	       </xsl:otherwise>
+	     </xsl:choose>
+	     <xsl:choose>
+	       <xsl:when test="position() + 1 = last()">
+		 <xsl:text> </xsl:text>
+	       </xsl:when>
+	       <xsl:otherwise>
+		 <xsl:text>, </xsl:text>
+	       </xsl:otherwise>
+	     </xsl:choose>
+	   </xsl:otherwise>
+	 </xsl:choose>
+       </xsl:when>
+     </xsl:choose>
+   </xsl:template>
+   
+   <xsl:template match="tei:surname">
+      <xsl:if test="../tei:forename">
+         <xsl:apply-templates select="../tei:forename" mode="use"/>
+         <xsl:call-template name="tei:makeText">
+	   <xsl:with-param name="letters"><xsl:text> </xsl:text></xsl:with-param>
+	 </xsl:call-template>
+      </xsl:if>
+      <xsl:if test="../tei:nameLink">
+         <xsl:apply-templates select="../tei:nameLink" mode="use"/>
+         <xsl:call-template name="tei:makeText">
+	   <xsl:with-param name="letters"><xsl:text> </xsl:text></xsl:with-param>
+	 </xsl:call-template>
+      </xsl:if>
+      <xsl:apply-templates/>
+   </xsl:template>
+
+   <xsl:template match="tei:forename">
+   </xsl:template>
+
+   <xsl:template match="tei:nameLink">
+</xsl:template>
+
+   <xsl:template match="tei:forename" mode="use">
+      <xsl:if test="preceding-sibling::tei:forename">
+         <xsl:call-template name="tei:makeText">
+	   <xsl:with-param name="letters"><xsl:text> </xsl:text></xsl:with-param>
+	 </xsl:call-template>
+      </xsl:if>
+      <xsl:apply-templates/>
+   </xsl:template>
+
+   <xsl:template match="tei:nameLink" mode="use">
+      <xsl:apply-templates/>
+   </xsl:template>
+
+   <!-- title  -->
+   <xsl:template match="tei:titlePart" mode="simple">
+      <xsl:if test="preceding-sibling::tei:titlePart">
+         <xsl:call-template name="tei:makeText">
+	   <xsl:with-param name="letters"> — </xsl:with-param>
+	 </xsl:call-template>
+      </xsl:if>
+      <xsl:value-of select="."/>
+   </xsl:template>
+
+   <xsl:template match="tei:title" mode="simple">
+      <xsl:value-of select="."/>
+   </xsl:template>
+
+   <xsl:template match="tei:titlePart">
+      <xsl:if test="preceding-sibling::tei:titlePart">
+         <xsl:call-template name="tei:makeText">
+	   <xsl:with-param name="letters"> — </xsl:with-param>
+	 </xsl:call-template>
+      </xsl:if>
+      <xsl:apply-templates/>
+   </xsl:template>
+
+   <xsl:template match="tei:title">
+      <xsl:choose>
+         <xsl:when test="parent::tei:titleStmt/parent::tei:fileDesc">
+            <xsl:if test="preceding-sibling::tei:title">
+	      <xsl:call-template name="tei:makeText">
+		<xsl:with-param name="letters"> — </xsl:with-param>
+	      </xsl:call-template>
+            </xsl:if>
+            <xsl:apply-templates/>
+         </xsl:when>
+         <xsl:when test="@level='m' or not(@level)">
+	   <xsl:call-template name="emphasize">
+	     <xsl:with-param name="class">
+	       <xsl:text>titlem</xsl:text>
+	     </xsl:with-param>
+	     <xsl:with-param name="content">
+	       <xsl:apply-templates/>
+	     </xsl:with-param>
+	   </xsl:call-template>
+	   <xsl:if test="ancestor::tei:biblStruct or ancestor::tei:biblFull">
+	     <xsl:call-template name="tei:makeText">
+	       <xsl:with-param name="letters">, </xsl:with-param>
+	     </xsl:call-template>
+	   </xsl:if>
+         </xsl:when>
+         <xsl:when test="@level='s'">
+	   <xsl:call-template name="emphasize">
+	     <xsl:with-param name="class">
+	       <xsl:text>titles</xsl:text>
+	     </xsl:with-param>
+	     <xsl:with-param name="content">
+	       <xsl:apply-templates/>
+	     </xsl:with-param>
+	   </xsl:call-template>
+	   <xsl:if test="following-sibling::* and
+			 (ancestor::tei:biblStruct  or ancestor::tei:biblFull)">
+	     <xsl:call-template name="tei:makeText">
+	       <xsl:with-param name="letters">
+	       </xsl:with-param>
+	     </xsl:call-template>
+	   </xsl:if>
+         </xsl:when>
+         <xsl:when test="@level='j'">
+	   <xsl:call-template name="emphasize">
+	     <xsl:with-param name="class">
+	       <xsl:text>titlej</xsl:text>
+	     </xsl:with-param>
+	     <xsl:with-param name="content">
+	       <xsl:apply-templates/>
+	     </xsl:with-param>
+	   </xsl:call-template>
+	   <xsl:call-template name="tei:makeText">
+	     <xsl:with-param name="letters"><xsl:text> </xsl:text></xsl:with-param>
+	   </xsl:call-template>
+         </xsl:when>
+         <xsl:when test="@level='a'">
+	   <xsl:call-template name="emphasize">
+	     <xsl:with-param name="class">
+	       <xsl:text>titlea</xsl:text>
+	     </xsl:with-param>
+	     <xsl:with-param name="content">
+	       <xsl:apply-templates/>
+	     </xsl:with-param>
+	   </xsl:call-template>
+	   <xsl:if test="ancestor::tei:biblStruct or ancestor::tei:biblFull">
+	     <xsl:call-template name="tei:makeText">
+	       <xsl:with-param
+		   name="letters">. </xsl:with-param>
+	     </xsl:call-template>
+	   </xsl:if>
+         </xsl:when>
+         <xsl:when test="@level='u'">
+	   <xsl:call-template name="emphasize">
+	     <xsl:with-param name="class">
+	       <xsl:text>titleu</xsl:text>
+	     </xsl:with-param>
+	     <xsl:with-param name="content">
+	       <xsl:apply-templates/>
+	     </xsl:with-param>
+	   </xsl:call-template>
+	   <xsl:if test="ancestor::tei:biblStruct  or ancestor::tei:biblFull">
+	     <xsl:call-template name="tei:makeText">
+	       <xsl:with-param
+		   name="letters">. </xsl:with-param>
+	     </xsl:call-template>
+	   </xsl:if>
+         </xsl:when>
+         <xsl:when test="ancestor::tei:bibl">
+	   <xsl:apply-templates/>
+         </xsl:when>
+         <xsl:otherwise>
+	   <xsl:call-template name="emphasize">
+	     <xsl:with-param name="class">
+	       <xsl:text>titlem</xsl:text>
+	     </xsl:with-param>
+	     <xsl:with-param name="content">
+	       <xsl:apply-templates/>
+	     </xsl:with-param>
+	   </xsl:call-template>
+         </xsl:otherwise>
+      </xsl:choose>
+   </xsl:template>
+   
+
+   <xsl:template match="tei:meeting">
+      <xsl:call-template name="tei:makeText">
+	<xsl:with-param name="letters"> (</xsl:with-param>
+      </xsl:call-template>
+      <xsl:apply-templates/>
+      <xsl:call-template name="tei:makeText">
+	<xsl:with-param name="letters">)</xsl:with-param>
+      </xsl:call-template>
+      <xsl:if test="following-sibling::* and (ancestor::tei:biblStruct  or ancestor::tei:biblFull)">
+         <xsl:call-template name="tei:makeText">
+	   <xsl:with-param name="letters"><xsl:text> </xsl:text></xsl:with-param>
+	 </xsl:call-template>
+      </xsl:if>
+   </xsl:template>
+
+   <xsl:template match="tei:series">
+      <xsl:apply-templates/>
+   </xsl:template>
+
+   <xsl:template match="tei:biblStruct//tei:date|tei:biblFull//tei:date">
+     <!--
+	 <xsl:choose>
+	 <xsl:when test="starts-with(.,'$Date:')">
+	 <xsl:value-of select="substring-before(substring-after(.,'$Date:'),'$')"/>
+	 </xsl:when>
+	 <xsl:otherwise>
+	 <xsl:apply-templates/>
+	 </xsl:otherwise>
+	 </xsl:choose>
+     -->
+      <xsl:apply-templates/>
+     <xsl:call-template name="tei:makeText">
+       <xsl:with-param name="letters">. </xsl:with-param>
+     </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="tei:byline">
+     <xsl:call-template name="makeSpan"/>
+   </xsl:template>
+
+   <xsl:template match="tei:pubPlace">
+     <xsl:call-template name="makeSpan"/>
+     <xsl:choose>
+         <xsl:when test="ancestor::tei:bibl"/>
+         <xsl:when test="following-sibling::tei:pubPlace">
+            <xsl:call-template name="tei:makeText">
+	      <xsl:with-param name="letters">, </xsl:with-param>
+	    </xsl:call-template>
+         </xsl:when>
+         <xsl:when test="../tei:publisher">
+            <xsl:call-template name="tei:makeText">
+	      <xsl:with-param name="letters">: </xsl:with-param>
+	    </xsl:call-template>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:call-template name="tei:makeText">
+	      <xsl:with-param name="letters">. </xsl:with-param>
+	    </xsl:call-template>
+         </xsl:otherwise>
+      </xsl:choose>
+   </xsl:template>
+
+   <xsl:template match="tei:publisher">
+     <xsl:call-template name="makeSpan"/>
+      <xsl:if test="ancestor::tei:biblStruct or ancestor::tei:biblFull">
+         <xsl:call-template name="tei:makeText">
+	   <xsl:with-param name="letters">. </xsl:with-param>
+	 </xsl:call-template>
+      </xsl:if>
+   </xsl:template>
+
+   <!-- details and notes -->
+   <xsl:template match="tei:biblScope">
+      <xsl:choose>
+         <xsl:when test="ancestor::tei:bibl">
+            <xsl:apply-templates/>
+         </xsl:when>
+         <xsl:when test="@type='vol' or @type='volume'">
+            <xsl:call-template name="emphasize">
+               <xsl:with-param name="class">
+	                 <xsl:text>vol</xsl:text>
+               </xsl:with-param>
+               <xsl:with-param name="content">
+	                 <xsl:apply-templates/>
+               </xsl:with-param>
+            </xsl:call-template>
+         </xsl:when>
+         <xsl:when test="@type='chap'">
+            <xsl:call-template name="tei:makeText">
+	      <xsl:with-param name="letters">chapter </xsl:with-param>
+	    </xsl:call-template>
+            <xsl:apply-templates/>
+         </xsl:when>
+         <xsl:when test="@type='issue' or @type='nr'">
+            <xsl:call-template name="tei:makeText">
+	      <xsl:with-param name="letters"> (</xsl:with-param>
+	    </xsl:call-template>
+            <xsl:apply-templates/>
+            <xsl:call-template name="tei:makeText">
+	      <xsl:with-param name="letters">) </xsl:with-param>
+	    </xsl:call-template>
+         </xsl:when>
+         <xsl:when test="@type='page_from'">
+	   <xsl:text>pp. </xsl:text>
+	   <xsl:apply-templates/>
+	 </xsl:when>
+         <xsl:when test="@type='page_to'">
+	   <xsl:text>-</xsl:text>
+	   <xsl:apply-templates/>
+	 </xsl:when>
+         <xsl:when test="@type='pp' or @type='pages'">
+            <xsl:choose>
+               <xsl:when test="contains(.,'-')">
+	                 <xsl:call-template name="tei:makeText">
+			   <xsl:with-param
+			       name="letters">pp. </xsl:with-param>
+			 </xsl:call-template>
+               </xsl:when>
+               <xsl:when test="contains(.,'ff')">
+	                 <xsl:call-template name="tei:makeText">
+			   <xsl:with-param
+			       name="letters">pp. </xsl:with-param>
+			 </xsl:call-template>
+               </xsl:when>
+               <xsl:when test="contains(.,' ')">
+	                 <xsl:call-template name="tei:makeText">
+			   <xsl:with-param
+			       name="letters">pp. </xsl:with-param>
+			 </xsl:call-template>
+               </xsl:when>
+               <xsl:otherwise>
+	                 <xsl:call-template name="tei:makeText">
+			   <xsl:with-param
+			       name="letters">p. </xsl:with-param>
+			 </xsl:call-template>
+               </xsl:otherwise>
+            </xsl:choose>
+            <xsl:apply-templates/>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:apply-templates/>
+         </xsl:otherwise>
+      </xsl:choose>
+ 
+      <xsl:choose>
+         <xsl:when test="@type='vol' and      following-sibling::tei:biblScope[@type='issue']">
+            <xsl:call-template name="tei:makeText">
+	      <xsl:with-param name="letters"><xsl:text> </xsl:text></xsl:with-param>
+	    </xsl:call-template>
+         </xsl:when>
+         <xsl:when test="@type='vol' and following-sibling::tei:biblScope">
+            <xsl:call-template name="tei:makeText">
+	      <xsl:with-param name="letters"><xsl:text> </xsl:text></xsl:with-param>
+	    </xsl:call-template>
+         </xsl:when>
+         <xsl:when test="following-sibling::tei:biblScope">
+            <xsl:call-template name="tei:makeText">
+	      <xsl:with-param name="letters"><xsl:text> </xsl:text></xsl:with-param>
+	    </xsl:call-template>
+         </xsl:when>
+         <xsl:when test="ancestor::tei:biblStruct or ancestor::tei:biblFull">
+            <xsl:call-template name="tei:makeText">
+	      <xsl:with-param name="letters">. </xsl:with-param>
+	    </xsl:call-template>
+         </xsl:when>
+      </xsl:choose>
+
+   </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element name and tei:persName</desc>
+   </doc>
+  <xsl:template match="tei:name|tei:persName">
+      <xsl:apply-templates/>
+      <xsl:choose>
+         <xsl:when test="not(ancestor::tei:person|ancestor::tei:biblStruct)"/>
+         <xsl:when test="following-sibling::tei:name|following-sibling::tei:persName">
+	   <xsl:call-template name="tei:makeText">
+	     <xsl:with-param name="letters">, </xsl:with-param>
+	   </xsl:call-template>
+         </xsl:when>
+      </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="tei:bibl/tei:note|tei:biblStruct/tei:note">
+    <xsl:call-template name="tei:makeText">
+      <xsl:with-param name="letters"> (</xsl:with-param>
+    </xsl:call-template>
+      <xsl:apply-templates/>
+    <xsl:call-template name="tei:makeText">
+      <xsl:with-param name="letters">)</xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/common2/core.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/common2/functions.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/common2/functions.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/common2/functions.xsl	(revision 258)
@@ -0,0 +1,305 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:cals="http://www.oasis-open.org/specs/tm9901" xmlns:tei="http://www.tei-c.org/ns/1.0" xmlns:iso="http://www.iso.org/ns/1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:fn="http://www.w3.org/2005/02/xpath-functions" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:tbx="http://www.lisa.org/TBX-Specification.33.0.html" xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture" xmlns:teidocx="http://www.tei-c.org/ns/teidocx/1.0" version="2.0" exclude-result-prefixes="cals ve o r m v wp w10 w wne mml tbx iso tei a xs pic fn">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+    <desc>
+      <p> TEI Utility stylesheet defining functions for use in all
+	 output formats.</p>
+      <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+      <p>Author: See AUTHORS</p>
+      <p>Id: $Id: functions.xsl 10018 2012-01-10 14:51:47Z rahtz $</p>
+      <p>Copyright: 2008, TEI Consortium</p>
+    </desc>
+  </doc>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Whether a section is "identifiable"</desc>
+  </doc>
+  <xsl:function name="tei:is-identifiable" as="xs:boolean">
+    <xsl:param name="element"/>
+    <xsl:for-each select="$element">
+      <xsl:choose>
+        <xsl:when test="self::tei:div">true</xsl:when>
+        <xsl:when test="self::tei:div1">true</xsl:when>
+        <xsl:when test="self::tei:div2">true</xsl:when>
+        <xsl:when test="self::tei:div3">true</xsl:when>
+        <xsl:when test="self::tei:div4">true</xsl:when>
+        <xsl:when test="self::tei:div5">true</xsl:when>
+        <xsl:when test="self::tei:div6">true</xsl:when>
+        <xsl:when test="self::tei:p[@xml:id]">true</xsl:when>
+        <xsl:when test="self::tei:index[@xml:id]">true</xsl:when>
+        <xsl:otherwise>false</xsl:otherwise>
+      </xsl:choose>
+    </xsl:for-each>
+  </xsl:function>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Whether a section is "transcribable"</desc>
+  </doc>
+  <xsl:function name="tei:is-transcribable" as="xs:boolean">
+    <xsl:param name="element"/>
+    <xsl:for-each select="$element">
+      <xsl:choose>
+	<xsl:when test="self::tei:p and parent::tei:sp">true</xsl:when>
+        <xsl:when test="self::tei:l">true</xsl:when>
+        <xsl:otherwise>false</xsl:otherwise>
+      </xsl:choose>
+    </xsl:for-each>
+  </xsl:function>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Whether to render text in small caps.</desc>
+  </doc>
+  <xsl:function name="tei:render-smallcaps" as="xs:boolean">
+    <xsl:param name="element"/>
+    <xsl:for-each select="$element">
+      <xsl:choose>
+        <xsl:when test="contains(@rend,'smallcaps')">true</xsl:when>
+        <xsl:when test="@rend='sc'">true</xsl:when>
+        <xsl:otherwise>false</xsl:otherwise>
+      </xsl:choose>
+    </xsl:for-each>
+  </xsl:function>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Whether to render text in smart quotes.</desc>
+  </doc>
+  <xsl:function name="tei:render-quotes" as="xs:boolean">
+    <xsl:param name="element"/>
+    <xsl:for-each select="$element">
+      <xsl:choose>
+        <xsl:when test="self::tei:soCalled">true</xsl:when>
+        <xsl:when test="contains(@rend,'quotes')">true</xsl:when>
+        <xsl:otherwise>false</xsl:otherwise>
+      </xsl:choose>
+    </xsl:for-each>
+  </xsl:function>
+
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Whether to render text in bold.</desc>
+  </doc>
+  <xsl:function name="tei:render-bold" as="xs:boolean">
+    <xsl:param name="element"/>
+    <xsl:for-each select="$element">
+      <xsl:choose>
+        <xsl:when test="parent::tei:hi[starts-with(@rend,'specList-')]">true</xsl:when>
+        <xsl:when test="parent::tei:hi[@rend='bold']">true</xsl:when>
+        <xsl:when test="contains(@rend,'bold')">true</xsl:when>
+        <xsl:when test="@rend='label'">true</xsl:when>
+        <xsl:when test="ancestor-or-self::tei:cell[@role='label']">true</xsl:when>
+        <xsl:when test="ancestor-or-self::tei:cell[@rend='wovenodd-col1']">true</xsl:when>
+        <xsl:when test="self::tei:cell and parent::tei:row[@role='label']">true</xsl:when>
+        <xsl:when test="self::tei:label[following-sibling::tei:item]">true</xsl:when>
+        <xsl:when test="self::tei:term">true</xsl:when>
+        <xsl:when test="self::tei:unclear">true</xsl:when>
+        <xsl:otherwise>false</xsl:otherwise>
+      </xsl:choose>
+    </xsl:for-each>
+  </xsl:function>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Whether to render something in italic.</desc>
+  </doc>
+  <xsl:function name="tei:render-italic" as="xs:boolean">
+    <xsl:param name="element"/>
+    <xsl:for-each select="$element">
+      <xsl:choose>
+        <xsl:when test="self::tei:ref and tei:render-italic(..)">true</xsl:when>
+        <xsl:when test="contains(@rend,'italic')">true</xsl:when>
+        <xsl:when test="self::tei:emph">true</xsl:when>
+        <xsl:when test="self::tei:hi[not(@rend)]">true</xsl:when>
+        <xsl:when test="self::tbx:hi[@style='italics']">true</xsl:when>
+        <xsl:when test="@rend='ital'">true</xsl:when>
+        <xsl:when test="@rend='it'">true</xsl:when>
+        <xsl:when test="@rend='i'">true</xsl:when>
+        <xsl:when test="@rend='att'">true</xsl:when>
+        <xsl:when test="self::tei:att">true</xsl:when>
+        <xsl:when test="self::tei:speaker">true</xsl:when>
+        <xsl:when test="self::tei:gloss">true</xsl:when>
+        <xsl:when test="self::tei:title">true</xsl:when>
+        <xsl:when test="self::tei:name">true</xsl:when>
+        <xsl:otherwise>false</xsl:otherwise>
+      </xsl:choose>
+    </xsl:for-each>
+  </xsl:function>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Whether to render something in typewriter-like code.</desc>
+  </doc>
+  <xsl:function name="tei:render-typewriter" as="xs:boolean">
+    <xsl:param name="element"/>
+    <xsl:for-each select="$element">
+      <xsl:choose>
+        <xsl:when test="self::tei:gi">true</xsl:when>
+        <xsl:when test="self::tei:val">true</xsl:when>
+        <xsl:when test="self::tei:code">true</xsl:when>
+        <xsl:when test="self::tei:ident">true</xsl:when>
+        <xsl:otherwise>false</xsl:otherwise>
+      </xsl:choose>
+    </xsl:for-each>
+  </xsl:function>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Is given an element and defines whether or not this element is to be rendered inline.</desc>
+  </doc>
+  <xsl:function name="tei:is-inline" as="xs:boolean">
+    <xsl:param name="element"/>
+    <xsl:for-each select="$element">
+      <xsl:choose>
+        <xsl:when test="self::mml:math">true</xsl:when>
+        <xsl:when test="self::tei:abbr">true</xsl:when>
+        <xsl:when test="self::tei:affiliation">true</xsl:when>
+        <xsl:when test="self::tei:altIdentifier">true</xsl:when>
+        <xsl:when test="self::tei:analytic">true</xsl:when>
+        <xsl:when test="self::tei:add">true</xsl:when>
+        <xsl:when test="self::tei:am">true</xsl:when>
+        <xsl:when test="self::tei:att">true</xsl:when>
+        <xsl:when test="self::tei:author">true</xsl:when>
+        <xsl:when test="self::tei:bibl and tei:is-inline($element/..)">true</xsl:when>
+        <xsl:when test="self::tei:biblScope">true</xsl:when>
+        <xsl:when test="self::tei:br">true</xsl:when>
+        <xsl:when test="self::tei:byline">true</xsl:when>
+        <xsl:when test="self::tei:c">true</xsl:when>
+        <xsl:when test="self::tei:caesura">true</xsl:when>
+        <xsl:when test="self::tei:choice">true</xsl:when>
+        <xsl:when test="self::tei:code">true</xsl:when>
+        <xsl:when test="self::tei:collection">true</xsl:when>
+        <xsl:when test="self::tei:country">true</xsl:when>
+        <xsl:when test="self::tei:damage">true</xsl:when>
+        <xsl:when test="self::tei:date">true</xsl:when>
+        <xsl:when test="self::tei:del">true</xsl:when>
+        <xsl:when test="self::tei:depth">true</xsl:when>
+        <xsl:when test="self::tei:dim">true</xsl:when>
+        <xsl:when test="self::tei:dimensions">true</xsl:when>
+        <xsl:when test="self::tei:editor">true</xsl:when>
+        <xsl:when test="self::tei:editionStmt">true</xsl:when>
+        <xsl:when test="self::tei:emph">true</xsl:when>
+        <xsl:when test="self::tei:ex">true</xsl:when>
+        <xsl:when test="self::tei:expan">true</xsl:when>
+        <xsl:when test="self::tei:figure[@place='inline']">true</xsl:when>
+        <xsl:when test="self::tei:foreign">true</xsl:when>
+        <xsl:when test="self::tei:forename">true</xsl:when>
+        <xsl:when test="self::tei:gap">true</xsl:when>
+        <xsl:when test="self::tei:genName">true</xsl:when>
+        <xsl:when test="self::tei:geogName">true</xsl:when>
+        <xsl:when test="self::tei:gi">true</xsl:when>
+        <xsl:when test="self::tei:gloss">true</xsl:when>
+        <xsl:when test="self::tei:graphic">true</xsl:when>
+        <xsl:when test="self::tei:height">true</xsl:when>
+        <xsl:when test="self::tei:hi[not(w:*)]">true</xsl:when>
+        <xsl:when test="self::tei:ident">true</xsl:when>
+        <xsl:when test="self::tei:idno">true</xsl:when>
+        <xsl:when test="self::tei:imprint">true</xsl:when>
+        <xsl:when test="self::tei:institution">true</xsl:when>
+        <xsl:when test="self::tei:lb">true</xsl:when>
+        <xsl:when test="self::tei:locus">true</xsl:when>
+        <xsl:when test="self::tei:mentioned">true</xsl:when>
+        <xsl:when test="self::tei:monogr">true</xsl:when>
+        <xsl:when test="self::tei:series">true</xsl:when>
+        <xsl:when test="self::tei:msName">true</xsl:when>
+        <xsl:when test="self::tei:name">true</xsl:when>
+        <xsl:when test="self::tei:note[@place='margin']">false</xsl:when>
+        <xsl:when test="self::tei:note[@place='bottom']">true</xsl:when>
+        <xsl:when test="self::tei:note[@place='comment']">true</xsl:when>
+        <xsl:when test="self::tei:note[@place='end']">true</xsl:when>
+        <xsl:when test="self::tei:note[@place='foot']">true</xsl:when>
+        <xsl:when test="self::tei:note[@place='inline']">true</xsl:when>
+        <xsl:when test="self::tei:note[parent::tei:biblStruct]">true</xsl:when>
+        <xsl:when test="self::tei:note[parent::tei:bibl]">true</xsl:when>
+        <xsl:when test="self::tei:num">true</xsl:when>
+        <xsl:when test="self::tei:orgName">true</xsl:when>
+        <xsl:when test="self::tei:orig">true</xsl:when>
+        <xsl:when test="self::tei:origDate">true</xsl:when>
+        <xsl:when test="self::tei:origPlace">true</xsl:when>
+        <xsl:when test="self::tei:origPlace">true</xsl:when>
+        <xsl:when test="self::tei:pb">true</xsl:when>
+        <xsl:when test="self::tei:persName">true</xsl:when>
+        <xsl:when test="self::tei:placeName">true</xsl:when>
+        <xsl:when test="self::tei:ptr">true</xsl:when>
+        <xsl:when test="self::tei:publisher">true</xsl:when>
+        <xsl:when test="self::tei:pubPlace">true</xsl:when>
+        <xsl:when test="self::tei:q[tei:l]">false</xsl:when>
+        <xsl:when test="self::tei:q[tei:figure or tei:p or tei:note or
+			tei:bibl or tei:sp or tei:floatingText]">false</xsl:when>
+        <xsl:when test="self::tei:q">true</xsl:when>
+        <xsl:when test="self::tei:said">true</xsl:when>
+        <xsl:when test="self::tei:ref">true</xsl:when>
+        <xsl:when test="self::tei:region">true</xsl:when>
+        <xsl:when test="self::tei:repository">true</xsl:when>
+        <xsl:when test="self::tei:roleName">true</xsl:when>
+        <xsl:when test="self::tei:rubric">true</xsl:when>
+        <xsl:when test="self::tei:seg">true</xsl:when>
+        <xsl:when test="self::tei:sic">true</xsl:when>
+        <xsl:when test="self::tei:settlement">true</xsl:when>
+        <xsl:when test="self::tei:soCalled">true</xsl:when>
+        <xsl:when test="self::tei:summary">true</xsl:when>
+        <xsl:when test="self::tei:supplied">true</xsl:when>
+        <xsl:when test="self::tei:surname">true</xsl:when>
+        <xsl:when test="self::tei:term">true</xsl:when>
+        <xsl:when test="self::tei:textLang">true</xsl:when>
+        <xsl:when test="self::tei:title">true</xsl:when>
+        <xsl:when test="self::tei:unclear">true</xsl:when>
+        <xsl:when test="self::tei:val">true</xsl:when>
+        <xsl:when test="self::tei:width">true</xsl:when>
+        <xsl:when test="self::tei:dynamicContent">true</xsl:when>
+        <xsl:when test="self::w:drawing">true</xsl:when>
+        <xsl:when test="self::m:oMath">true</xsl:when>
+        <xsl:otherwise>
+          <xsl:choose>
+            <xsl:when test="empty($element/..)">false</xsl:when>
+            <xsl:when test="tei:is-inline($element/..)">true</xsl:when>
+            <xsl:otherwise>false</xsl:otherwise>
+          </xsl:choose>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:for-each>
+  </xsl:function>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Is given an element and says whether the context is at the
+    level of a block</desc>
+  </doc>
+  <xsl:function name="tei:blockContext" as="xs:boolean">
+    <xsl:param name="element"/>
+    <xsl:for-each select="$element">
+      <xsl:choose>
+	<xsl:when test="parent::tei:note[@place='foot'] and self::tei:gap">false</xsl:when>
+	<xsl:when test="parent::tei:note[@place='foot' or @place='bottom']">true</xsl:when>
+	<xsl:when test="parent::tei:body">true</xsl:when>
+	<xsl:when test="tei:floatingText">true</xsl:when>
+	<xsl:when test="parent::tei:div">true</xsl:when>
+	<xsl:when test="parent::tei:titlePage">true</xsl:when>
+	<xsl:otherwise>false</xsl:otherwise>
+      </xsl:choose>
+    </xsl:for-each>
+  </xsl:function>
+
+
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/common2/functions.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/common2/header.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/common2/header.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/common2/header.xsl	(revision 258)
@@ -0,0 +1,407 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:tei="http://www.tei-c.org/ns/1.0"
+                
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                exclude-result-prefixes="tei"
+                version="2.0">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet dealing with elements from the header module. </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: header.xsl 10056 2012-01-20 23:22:33Z rahtz $</p>
+         <p>Copyright: 2011, TEI Consortium</p>
+      </desc>
+   </doc>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[common] Find a plausible editor name</desc>
+   </doc>
+  <xsl:template name="generateEditor">
+    <xsl:choose>
+      <xsl:when test="ancestor-or-self::tei:TEI/tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:editor">
+        <xsl:for-each
+          select="ancestor-or-self::tei:TEI/tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:editor">
+          <xsl:apply-templates/>
+          <xsl:choose>
+            <xsl:when test="count(following-sibling::tei:editor)=1">
+              <xsl:if test="count(preceding-sibling::tei:editor)>=1">
+                <xsl:text>,</xsl:text>
+              </xsl:if>
+              <xsl:call-template name="i18n">
+                <xsl:with-param name="word">and</xsl:with-param>
+              </xsl:call-template>
+            </xsl:when>
+            <xsl:when test="following-sibling::tei:editor">, </xsl:when>
+          </xsl:choose>
+        </xsl:for-each>
+      </xsl:when>
+      <xsl:when
+        test="ancestor-or-self::tei:TEI/tei:teiHeader/tei:revisionDesc/tei:change/tei:respStmt[tei:resp='editor']">
+        <xsl:apply-templates
+          select="ancestor-or-self::tei:TEI/tei:teiHeader/tei:revisionDesc/tei:change/tei:respStmt[tei:resp='editor'][1]/tei:name"
+        />
+      </xsl:when>
+    </xsl:choose>
+  </xsl:template>
+  
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[common] Find a plausible main author name</desc>
+   </doc>
+  <xsl:template name="generateAuthor">
+      <xsl:choose>
+         <xsl:when test="$useHeaderFrontMatter='true' and ancestor-or-self::tei:TEI/tei:text/tei:front//tei:docAuthor">
+            <xsl:apply-templates mode="author"
+                                 select="ancestor-or-self::tei:TEI/tei:text/tei:front//tei:docAuthor"/>
+         </xsl:when>
+         <xsl:when test="ancestor-or-self::tei:TEI/tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:author">
+            <xsl:for-each select="ancestor-or-self::tei:TEI/tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:author">
+               <xsl:apply-templates/>
+               <xsl:choose>
+            <xsl:when test="count(following-sibling::tei:author)=1">
+              <xsl:if test="count(preceding-sibling::tei:author)>1">
+                <xsl:text>,</xsl:text>
+              </xsl:if>
+              <xsl:call-template name="i18n">
+                <xsl:with-param name="word">and</xsl:with-param>
+              </xsl:call-template>
+            </xsl:when>
+                  <xsl:when test="following-sibling::tei:author">, </xsl:when>
+               </xsl:choose>
+            </xsl:for-each>
+         </xsl:when>
+         <xsl:when test="ancestor-or-self::tei:TEI/tei:teiHeader/tei:revisionDesc/tei:change/tei:respStmt[tei:resp='author']">
+            <xsl:apply-templates select="ancestor-or-self::tei:TEI/tei:teiHeader/tei:revisionDesc/tei:change/tei:respStmt[tei:resp='author'][1]/tei:name"/>
+         </xsl:when>
+         <xsl:when test="ancestor-or-self::tei:TEI/tei:text/tei:front//tei:docAuthor">
+            <xsl:apply-templates mode="author"
+                                 select="ancestor-or-self::tei:TEI/tei:text/tei:front//tei:docAuthor"/>
+         </xsl:when>
+      </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[common] Find a plausible name of person responsible for current revision</desc>
+   </doc>
+  <xsl:template name="generateRevAuthor">
+      <xsl:variable name="who">
+         <xsl:choose>
+            <xsl:when test="ancestor-or-self::tei:TEI/tei:teiHeader/tei:revisionDesc/@vcwho">
+               <xsl:apply-templates select="ancestor-or-self::tei:TEI/tei:teiHeader/tei:revisionDesc/@vcwho"/>
+            </xsl:when>
+            <xsl:when test="ancestor-or-self::tei:TEI/tei:teiHeader/tei:revisionDesc/tei:change[1]/tei:respStmt/tei:name">
+               <xsl:value-of select="ancestor-or-self::tei:TEI/tei:teiHeader/tei:revisionDesc/tei:change[1]/tei:respStmt/tei:name/text()"/>
+            </xsl:when>
+         </xsl:choose>
+      </xsl:variable>
+      <xsl:choose>
+         <xsl:when test="normalize-space($who)=concat('$Author', '$')"/>
+         <xsl:when test="starts-with($who,'$Author')">
+        <!-- it's RCS -->
+        <xsl:value-of select="normalize-space(substring-before(substring-after($who,'Author'),'$'))"/>
+         </xsl:when>
+         <xsl:when test="starts-with($who,'$LastChangedBy')">
+        <!-- it's Subversion -->
+        <xsl:value-of select="normalize-space(substring-before(substring-after($who,'LastChangedBy:'),'$'))"/>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:value-of select="$who"/>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[common] </desc>
+   </doc>
+  <xsl:template name="generateAuthorList">
+      <xsl:variable name="realauthor">
+         <xsl:call-template name="generateAuthor"/>
+      </xsl:variable>
+      <xsl:variable name="revauthor">
+         <xsl:call-template name="generateRevAuthor"/>
+      </xsl:variable>
+      <xsl:variable name="editor">
+        <xsl:call-template name="generateEditor"/>
+      </xsl:variable>
+      <xsl:if test="not($realauthor = '')">
+        <p xmlns="http://www.w3.org/1999/xhtml" class="mainAuthor">
+         <xsl:text> </xsl:text>
+         <xsl:call-template name="i18n">
+            <xsl:with-param name="word">authorWord</xsl:with-param>
+         </xsl:call-template>
+          <xsl:text>: </xsl:text>
+         <xsl:copy-of select="$realauthor"/>
+        </p>
+      </xsl:if>
+      <xsl:if test="not($revauthor = '')">
+      <p class="mainRevAuthor" xmlns="http://www.w3.org/1999/xhtml">
+         <xsl:text> (</xsl:text>
+         <xsl:call-template name="i18n">
+            <xsl:with-param name="word">revisedWord</xsl:with-param>
+         </xsl:call-template>
+         <xsl:text> </xsl:text>
+         <xsl:copy-of select="$revauthor"/>
+         <xsl:text>)</xsl:text>
+      </p>
+    </xsl:if>
+    <xsl:if test="not($editor = '')">
+      <p class="mainEditor" xmlns="http://www.w3.org/1999/xhtml">
+         <xsl:call-template name="i18n">
+            <xsl:with-param name="word">editorWord</xsl:with-param>
+         </xsl:call-template>
+        <xsl:text>: </xsl:text>
+        <xsl:copy-of select="$editor"/>
+      </p>
+      </xsl:if>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[common] Work out the last revision date of the document </desc>
+   </doc>
+  <xsl:template name="generateRevDate">
+      <xsl:variable name="when">
+         <xsl:choose>
+            <xsl:when test="ancestor-or-self::tei:TEI/tei:teiHeader/tei:revisionDesc/@vcdate">
+               <xsl:apply-templates select="ancestor-or-self::tei:TEI/tei:teiHeader/tei:revisionDesc/@vcdate"/>
+            </xsl:when>
+            <xsl:when test="ancestor-or-self::tei:TEI/tei:teiHeader/tei:revisionDesc/descendant::tei:date">
+               <xsl:value-of select="ancestor-or-self::tei:TEI/tei:teiHeader/tei:revisionDesc/descendant::tei:date[1]"/>
+            </xsl:when>
+            <xsl:when
+		test="ancestor-or-self::tei:TEI/tei:teiHeader/tei:fileDesc/descendant::tei:date">
+	      <xsl:value-of select="ancestor-or-self::tei:TEI/tei:teiHeader/tei:fileDesc/descendant::tei:date"/>
+	    </xsl:when>	    
+         </xsl:choose>
+      </xsl:variable>
+      <xsl:choose>
+         <xsl:when test="starts-with($when,'$Date')">
+	   <!-- it's RCS -->
+	   <xsl:value-of select="substring($when,16,2)"/>
+	   <xsl:text>/</xsl:text>
+	   <xsl:value-of select="substring($when,13,2)"/>
+	   <xsl:text>/</xsl:text>
+	   <xsl:value-of select="substring($when,8,4)"/>
+         </xsl:when>
+         <xsl:when test="starts-with($when,'$LastChangedDate')">
+	   <!-- it's Subversion-->
+	   <xsl:value-of select="substring-before(substring-after($when,'('),')')"/>
+         </xsl:when>
+         <xsl:when test="not($when='')">
+	   <xsl:value-of select="$when"/>
+	 </xsl:when>
+	 <xsl:otherwise>
+	   <xsl:value-of select="format-dateTime(current-dateTime(),'[Y]-[M02]-[D02]T[H02]:[m02]:[s02]Z')"/>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[common] Work out the publish date of the document </desc>
+   </doc>
+  <xsl:template name="generateDate">
+      <xsl:choose>
+	 <xsl:when test="$useFixedDate='true'">1970-01-01</xsl:when>
+         <xsl:when test="$useHeaderFrontMatter='true' and ancestor-or-self::tei:TEI/tei:text/tei:front//tei:docDate">
+            <xsl:apply-templates mode="date" select="ancestor-or-self::tei:TEI/tei:text/tei:front//tei:docDate"/>
+         </xsl:when>
+         <xsl:when
+	     test="ancestor-or-self::tei:TEI/tei:teiHeader/tei:fileDesc/tei:editionStmt/descendant::tei:date[@when]">
+            <xsl:value-of select="ancestor-or-self::tei:TEI/tei:teiHeader/tei:fileDesc/tei:editionStmt/descendant::tei:date[@when][1]/@when"/>
+         </xsl:when>
+         <xsl:when test="ancestor-or-self::tei:TEI/tei:teiHeader/tei:fileDesc/tei:editionStmt/descendant::tei:date">
+            <xsl:value-of select="ancestor-or-self::tei:TEI/tei:teiHeader/tei:fileDesc/tei:editionStmt/descendant::tei:date[1]"/>
+         </xsl:when>
+         <xsl:when test="ancestor-or-self::tei:TEI/tei:teiHeader/tei:fileDesc/tei:publicationStmt/tei:date">
+            <xsl:value-of select="ancestor-or-self::tei:TEI/tei:teiHeader/tei:fileDesc/tei:publicationStmt/tei:date"/>
+         </xsl:when>
+         <xsl:when test="ancestor-or-self::tei:TEI/tei:teiHeader/tei:fileDesc/tei:editionStmt/tei:edition">
+            <xsl:apply-templates select="ancestor-or-self::tei:TEI/tei:teiHeader/tei:fileDesc/tei:editionStmt/tei:edition"/>
+         </xsl:when>
+	 <xsl:when
+	     test="ancestor-or-self::tei:TEI/tei:teiHeader/tei:revisionDesc/tei:change[@when
+		   or tei:date]">
+            <xsl:for-each
+		select="ancestor-or-self::tei:TEI/tei:teiHeader/tei:revisionDesc/tei:change[1]">
+	      <xsl:choose>
+		<xsl:when test="@when">
+		  <xsl:value-of select="@when"/>
+		</xsl:when>
+		<xsl:when test="tei:date/@when">
+		  <xsl:value-of select="tei:date/@when"/>
+		</xsl:when>
+		<xsl:when test="tei:date">
+		  <xsl:value-of select="tei:date"/>
+		</xsl:when>
+		<xsl:otherwise>
+		  <xsl:value-of select="format-dateTime(current-dateTime(),'[Y]-[M02]-[D02]')"/>
+		</xsl:otherwise>
+	      </xsl:choose>
+	    </xsl:for-each>
+	 </xsl:when>
+	 <xsl:otherwise>
+	   <xsl:value-of select="format-dateTime(current-dateTime(),'[Y]-[M02]-[D02]')"/>
+	 </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[common] Generate a title</desc>
+   </doc>
+  <xsl:template name="generateTitle">
+      <xsl:choose>
+         <xsl:when test="$useHeaderFrontMatter='true' and ancestor-or-self::tei:TEI/tei:text/tei:front//tei:docTitle">
+            <xsl:apply-templates select="ancestor-or-self::tei:TEI/tei:text/tei:front//tei:docTitle/tei:titlePart"/>
+         </xsl:when>
+
+         <xsl:when test="$useHeaderFrontMatter='true' and ancestor-or-self::tei:teiCorpus/tei:text/tei:front//tei:docTitle">
+            <xsl:apply-templates select="ancestor-or-self::tei:teiCorpus/tei:text/tei:front//tei:docTitle/tei:titlePart"/>
+         </xsl:when>
+
+         <xsl:when test="self::tei:teiCorpus">	
+            <xsl:apply-templates select="tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:title[not(@type='subordinate')]"/>
+         </xsl:when>
+
+         <xsl:otherwise>
+            <xsl:for-each
+		select="ancestor-or-self::tei:TEI/tei:teiHeader/tei:fileDesc/tei:titleStmt">
+	      <xsl:choose>
+		<xsl:when test="tei:title[@type='main']">
+		  <xsl:apply-templates select="tei:title[@type='main']"/>
+		</xsl:when>
+		<xsl:otherwise>
+		  <xsl:apply-templates select="tei:title"/>
+		</xsl:otherwise>
+	      </xsl:choose>
+	    </xsl:for-each>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+         <p>[common] </p>
+         <p>Generate simple title with no markup</p>
+      </desc>
+   </doc>
+  <xsl:template name="generateSimpleTitle">
+      <xsl:choose>
+         <xsl:when test="$useHeaderFrontMatter='true' and ancestor-or-self::tei:TEI/tei:text/tei:front//tei:docTitle">
+            <xsl:apply-templates select="ancestor-or-self::tei:TEI/tei:text/tei:front//tei:docTitle"
+                                 mode="simple"/>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:for-each
+		select="ancestor-or-self::tei:TEI/tei:teiHeader/tei:fileDesc/tei:titleStmt">
+	      <xsl:choose>
+		<xsl:when test="tei:title[@type='main']">
+		  <xsl:apply-templates
+		      select="tei:title[@type='main']" mode="simple"/>
+		</xsl:when>
+		<xsl:otherwise>
+		  <xsl:apply-templates select="tei:title[1]" mode="simple"/>
+		</xsl:otherwise>
+	      </xsl:choose>
+	    </xsl:for-each>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[common] Generate sub title </desc>
+   </doc>
+  <xsl:template name="generateSubTitle">
+      <xsl:choose>
+         <xsl:when test="$useHeaderFrontMatter='true' and ancestor-or-self::tei:TEI/tei:text/tei:front//tei:docTitle">
+            <xsl:apply-templates select="ancestor-or-self::tei:TEI/tei:text/tei:front//tei:docTitle"/>
+         </xsl:when>
+         <xsl:when test="$useHeaderFrontMatter='true' and ancestor-or-self::tei:teiCorpus/tei:text/tei:front//tei:docTitle">
+            <xsl:apply-templates select="ancestor-or-self::tei:teiCorpus/tei:text/tei:front//tei:docTitle"/>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:for-each select="ancestor-or-self::tei:TEI|ancestor-or-self::tei:teiCorpus">
+               <xsl:apply-templates select="tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:title[@type='subordinate']"/>
+            </xsl:for-each>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc/>
+   </doc>
+  <xsl:template match="tei:div/tei:docAuthor"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc> Omit docAuthor found outside front matter</desc>
+   </doc>
+  <xsl:template match="tei:div/tei:docDate"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc> Omit docDate if found outside front matter</desc>
+   </doc>
+  <xsl:template match="tei:div/tei:docTitle"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Ignore docTitle in a div</desc>
+   </doc>
+  <xsl:template match="tei:docAuthor" mode="heading">
+      <xsl:if test="preceding-sibling::tei:docAuthor">
+         <xsl:choose>
+            <xsl:when test="not(following-sibling::tei:docAuthor)">
+               <xsl:text> and </xsl:text>
+            </xsl:when>
+            <xsl:otherwise>
+               <xsl:text>, </xsl:text>
+            </xsl:otherwise>
+         </xsl:choose>
+      </xsl:if>
+      <xsl:apply-templates/>
+  </xsl:template>
+
+   <xsl:template match="tei:idno[@type='url']">
+      <xsl:text> &lt;</xsl:text>
+      <xsl:call-template name="makeExternalLink">
+         <xsl:with-param name="ptr" select="true()"/>
+         <xsl:with-param name="dest">
+            <xsl:value-of select="normalize-space(.)"/>
+         </xsl:with-param>
+      </xsl:call-template>
+      <xsl:text>&gt;.</xsl:text>
+   </xsl:template>
+
+
+   <xsl:template match="tei:idno">
+      <xsl:text> </xsl:text>
+      <xsl:apply-templates/>
+   </xsl:template>
+
+   <xsl:template match="tei:idno[@type='doi']"/>
+
+  <xsl:template name="generateEdition">
+    <p xmlns="http://www.w3.org/1999/xhtml" class="editionStmt">
+      <xsl:apply-templates select="/(tei:teiCorpus|tei:TEI)/tei:teiHeader/tei:fileDesc/tei:editionStmt"/>
+    </p>
+  </xsl:template>
+
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/common2/header.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/common2/odds.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/common2/odds.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/common2/odds.xsl	(revision 258)
@@ -0,0 +1,255 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:cals="http://www.oasis-open.org/specs/tm9901" xmlns:tei="http://www.tei-c.org/ns/1.0" xmlns:iso="http://www.iso.org/ns/1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:fn="http://www.w3.org/2005/02/xpath-functions" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:tbx="http://www.lisa.org/TBX-Specification.33.0.html" xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture" xmlns:teidocx="http://www.tei-c.org/ns/teidocx/1.0" version="2.0" exclude-result-prefixes="cals ve o r m v wp w10 w wne mml tbx iso tei a xs pic fn">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+    <desc>
+      <p> TEI Utility stylesheet defining templates for use in
+      processing ODD</p>
+
+      <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+      <p>Author: See AUTHORS</p>
+      <p>Id: $Id: functions.xsl 9464 2011-10-06 08:27:01Z rahtz $</p>
+      <p>Copyright: 2008, TEI Consortium</p>
+    </desc>
+  </doc>
+  <xsl:template name="makeDescription">
+    <xsl:param name="includeValList">false</xsl:param>
+    <xsl:param name="coded">true</xsl:param>
+    <xsl:param name="showListRef">true</xsl:param>
+    <xsl:variable name="documentationLanguage">
+      <xsl:call-template name="generateDoc"/>
+    </xsl:variable>
+    <xsl:variable name="langs">
+      <xsl:value-of select="concat(normalize-space($documentationLanguage),' ')"/>
+    </xsl:variable>
+    <xsl:variable name="firstLang">
+      <xsl:value-of select="substring-before($langs,' ')"/>
+    </xsl:variable>
+    <!-- first the gloss -->
+    <xsl:call-template name="makeGloss">
+      <xsl:with-param name="langs" select="$langs"/>
+    </xsl:call-template>
+    <!-- now the description -->
+    <xsl:choose>
+      <xsl:when test="not(tei:desc)"> </xsl:when>
+      <xsl:when test="count(tei:desc)=1">
+        <xsl:for-each select="tei:desc">
+          <xsl:apply-templates select="." mode="inLanguage"/>
+        </xsl:for-each>
+      </xsl:when>
+      <xsl:when test="tei:desc[@xml:lang=$firstLang]">
+        <xsl:for-each select="tei:desc[@xml:lang=$firstLang]">
+          <xsl:apply-templates select="." mode="inLanguage"/>
+        </xsl:for-each>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:variable name="D">
+          <xsl:for-each select="tei:desc">
+            <xsl:variable name="currentLang">
+              <xsl:call-template name="findLanguage"/>
+            </xsl:variable>
+            <xsl:if test="contains($langs,concat($currentLang,' '))">
+              <xsl:apply-templates select="." mode="inLanguage"/>
+            </xsl:if>
+          </xsl:for-each>
+        </xsl:variable>
+        <xsl:choose>
+          <xsl:when test="$D='' and tei:desc[not(@xml:lang)]">
+            <xsl:for-each select="tei:desc[not(@xml:lang)]">
+              <xsl:apply-templates select="." mode="inLanguage"/>
+            </xsl:for-each>
+          </xsl:when>
+          <xsl:when test="$coded='false'">
+            <xsl:value-of select="$D"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:copy-of select="$D"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:otherwise>
+    </xsl:choose>
+    <xsl:choose>
+      <xsl:when test="$includeValList='false'"/>
+      <xsl:when test="tei:valList[@type='open']">
+        <xsl:text>&#10;</xsl:text>
+        <xsl:call-template name="i18n">
+          <xsl:with-param name="word">
+            <xsl:text>Sample values include</xsl:text>
+          </xsl:with-param>
+        </xsl:call-template>
+        <xsl:text>: </xsl:text>
+        <xsl:for-each select="tei:valList/tei:valItem">
+          <xsl:number/>
+          <xsl:text>] </xsl:text>
+          <xsl:choose>
+            <xsl:when test="tei:altIdent=@ident">
+              <xsl:value-of select="@ident"/>
+            </xsl:when>
+            <xsl:when test="tei:altIdent">
+              <xsl:value-of select="normalize-space(tei:altIdent)"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:value-of select="@ident"/>
+            </xsl:otherwise>
+          </xsl:choose>
+          <xsl:variable name="documentationLanguage">
+            <xsl:call-template name="generateDoc"/>
+          </xsl:variable>
+          <xsl:variable name="langs">
+            <xsl:value-of select="concat(normalize-space($documentationLanguage),' ')"/>
+          </xsl:variable>
+          <xsl:variable name="firstLang">
+            <xsl:value-of select="substring-before($langs,' ')"/>
+          </xsl:variable>
+          <xsl:call-template name="makeGloss">
+            <xsl:with-param name="langs" select="$langs"/>
+          </xsl:call-template>
+          <xsl:if test="following-sibling::tei:valItem">
+            <xsl:text>; </xsl:text>
+          </xsl:if>
+        </xsl:for-each>
+      </xsl:when>
+      <xsl:when test="tei:valList[@type='semi']">
+        <xsl:text>&#10;</xsl:text>
+        <xsl:call-template name="i18n">
+          <xsl:with-param name="word">
+            <xsl:text>Suggested values include</xsl:text>
+          </xsl:with-param>
+        </xsl:call-template>
+        <xsl:text>: </xsl:text>
+        <xsl:for-each select="tei:valList/tei:valItem">
+          <xsl:number/>
+          <xsl:text>] </xsl:text>
+          <xsl:choose>
+            <xsl:when test="tei:altIdent=@ident">
+              <xsl:value-of select="@ident"/>
+            </xsl:when>
+            <xsl:when test="tei:altIdent">
+              <xsl:value-of select="normalize-space(tei:altIdent)"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:value-of select="@ident"/>
+            </xsl:otherwise>
+          </xsl:choose>
+          <xsl:variable name="documentationLanguage">
+            <xsl:call-template name="generateDoc"/>
+          </xsl:variable>
+          <xsl:variable name="langs">
+            <xsl:value-of select="concat(normalize-space($documentationLanguage),' ')"/>
+          </xsl:variable>
+          <xsl:variable name="firstLang">
+            <xsl:value-of select="substring-before($langs,' ')"/>
+          </xsl:variable>
+          <xsl:call-template name="makeGloss">
+            <xsl:with-param name="langs" select="$langs"/>
+          </xsl:call-template>
+          <xsl:if test="following-sibling::tei:valItem">
+            <xsl:text>; </xsl:text>
+          </xsl:if>
+        </xsl:for-each>
+      </xsl:when>
+    </xsl:choose>
+    <xsl:if test="tei:listRef and $showListRef='true'">
+	<xsl:text> [</xsl:text>
+	<xsl:for-each select="tei:listRef/tei:*">
+	  <xsl:apply-templates select="." mode="weave"/>
+	  <xsl:if test="following-sibling::tei:*"> 
+	    <xsl:text> </xsl:text>
+	  </xsl:if>
+	</xsl:for-each>
+	<xsl:text>]</xsl:text>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template name="makeGloss">
+    <xsl:param name="langs"/>
+    <xsl:variable name="firstLang">
+      <xsl:value-of select="substring-before($langs,' ')"/>
+    </xsl:variable>
+    <xsl:choose>
+      <xsl:when test="not(tei:gloss)"/>
+      <xsl:when test="string-length(tei:gloss[1])=0"/>
+      <xsl:when test="count(tei:gloss)=1 and not(tei:gloss[@xml:lang])">
+        <xsl:text> (</xsl:text>
+        <xsl:apply-templates select="tei:gloss" mode="inLanguage"/>
+        <xsl:text>) </xsl:text>
+      </xsl:when>
+      <xsl:when test="tei:gloss[@xml:lang=$firstLang]">
+        <xsl:if test="not(tei:gloss[@xml:lang=$firstLang]='')">
+          <xsl:text> (</xsl:text>
+          <xsl:apply-templates select="tei:gloss[@xml:lang=$firstLang]" mode="inLanguage"/>
+          <xsl:text>) </xsl:text>
+        </xsl:if>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:variable name="G">
+          <xsl:for-each select="tei:gloss">
+            <xsl:variable name="currentLang">
+              <xsl:call-template name="findLanguage"/>
+            </xsl:variable>
+            <xsl:if test="contains($langs,concat($currentLang,' '))">
+              <xsl:text>(</xsl:text>
+              <xsl:apply-templates select="." mode="inLanguage"/>
+              <xsl:text>) </xsl:text>
+            </xsl:if>
+          </xsl:for-each>
+        </xsl:variable>
+        <xsl:choose>
+          <xsl:when test="$G='' and tei:gloss[not(@xml:lang)]">
+            <xsl:text> (</xsl:text>
+            <xsl:apply-templates select="tei:gloss[not(@xml:lang)]" mode="inLanguage"/>
+            <xsl:text>) </xsl:text>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:copy-of select="$G"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="findLanguage">
+    <xsl:choose>
+      <xsl:when test="@xml:lang">
+        <xsl:value-of select="@xml:lang"/>
+      </xsl:when>
+      <xsl:when test="ancestor::tei:*[@xml:lang]">
+        <xsl:value-of select="(ancestor::tei:*[@xml:lang])[1]/@xml:lang"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:text>en</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/common2/odds.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/common2/verbatim.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/common2/verbatim.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/common2/verbatim.xsl	(revision 258)
@@ -0,0 +1,711 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:i="http://www.iso.org/ns/1.0" xmlns:rng="http://relaxng.org/ns/structure/1.0" xmlns:s="http://www.ascc.net/xml/schematron" xmlns:sch="http://purl.oclc.org/dsdl/schematron" xmlns:tei="http://www.tei-c.org/ns/1.0" xmlns:teix="http://www.tei-c.org/ns/Examples" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:dbk="http://docbook.org/ns/docbook" exclude-result-prefixes="a fo html i rng s sch tei teix xi xs xsl         m atom xlink xhtml dbk" version="2.0">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+    <desc>
+      <p> TEI stylesheet dealing with elements from the core module. </p>
+      <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+      <p>Author: See AUTHORS</p>
+      <p>Id: $Id: verbatim.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+      <p>Copyright: 2011, TEI Consortium</p>
+    </desc>
+  </doc>
+  <xsl:strip-space elements="teix:* rng:* xsl:* xhtml:* atom:* m:*"/>
+  <xsl:param name="useNSPrefixes">true</xsl:param>
+  <xsl:param name="startComment">&lt;span class="comment"&gt;</xsl:param>
+  <xsl:param name="endComment">&lt;/span&gt;</xsl:param>
+  <xsl:param name="startElement">&lt;span class="element"&gt;</xsl:param>
+  <xsl:param name="endElement">&lt;/span&gt;</xsl:param>
+  <xsl:param name="startElementName">&lt;span class="elementname"&gt;</xsl:param>
+  <xsl:param name="endElementName">&lt;/span&gt;</xsl:param>
+  <xsl:param name="highlightStartElementName">&lt;span class="highlightelementname"&gt;</xsl:param>
+  <xsl:param name="highlightEndElementName">&lt;/span&gt;</xsl:param>
+  <xsl:param name="startAttribute">&lt;span class="attribute"&gt;</xsl:param>
+  <xsl:param name="endAttribute">&lt;/span&gt;</xsl:param>
+  <xsl:param name="startAttributeValue">&lt;span class="attributevalue"&gt;</xsl:param>
+  <xsl:param name="endAttributeValue">&lt;/span&gt;</xsl:param>
+  <xsl:param name="startNamespace">&lt;span class="namespace"&gt;</xsl:param>
+  <xsl:param name="endNamespace">&lt;/span&gt;</xsl:param>
+  <xsl:param name="spaceCharacter">&#160;</xsl:param>
+  <xsl:param name="showNamespaceDecls">true</xsl:param>
+  <xsl:param name="forceWrap">false</xsl:param>
+  <xsl:param name="wrapLength">65</xsl:param>
+  <xsl:param name="attLength">40</xsl:param>
+  <xsl:param name="attsOnSameLine">3</xsl:param>
+  <xsl:param name="omitNSDecls">http://www.tei-c.org/ns/1.0</xsl:param>
+  <xsl:key name="NSUsed" match="*" use="namespace-uri()"/>
+  <xsl:key name="NSUsed" match="@*" use="namespace-uri()"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>
+      <p>Work out a namespace prefix for verbatim elements</p>
+      <p>[common] </p>
+    </desc>
+  </doc>
+  <xsl:template name="verbatim-getNamespacePrefix">
+    <xsl:variable name="ns" select="namespace-uri()"/>
+    <xsl:variable name="prefix" select="tei:getPrefix($ns,ancestor-or-self::*[1])[1]"/>
+    <xsl:choose>
+      <xsl:when test="$prefix !=''">
+        <xsl:value-of select="$prefix"/>
+      </xsl:when>
+      <xsl:when test="$ns='http://docbook.org/ns/docbook'">dbk</xsl:when>
+      <xsl:when test="$ns='http://earth.google.com/kml/2.1'">kml</xsl:when>
+      <xsl:when test="$ns='http://purl.oclc.org/dsdl/nvdl/ns/structure/1.0'">nvdl</xsl:when>
+      <xsl:when test="$ns='http://purl.org/rss/1.0/modules/event/'">ev</xsl:when>
+      <xsl:when test="$ns='http://purl.oclc.org/dsdl/schematron'">s</xsl:when>
+      <xsl:when test="$ns='http://relaxng.org/ns/compatibility/annotations/1.0'">a</xsl:when>
+      <xsl:when test="$ns='http://relaxng.org/ns/structure/1.0'">rng</xsl:when>
+      <xsl:when test="$ns='http://www.ascc.net/xml/schematron'">sch</xsl:when>
+      <xsl:when test="$ns='http://www.w3.org/1998/Math/MathML'">m</xsl:when>
+      <xsl:when test="$ns='http://www.w3.org/1999/XSL/Transform'">xsl</xsl:when>
+      <xsl:when test="$ns='http://www.w3.org/1999/xhtml'">xhtml</xsl:when>
+      <xsl:when test="$ns='http://www.w3.org/1999/xlink'">xlink</xsl:when>
+      <xsl:when test="$ns='http://www.w3.org/2001/XMLSchema'">xsd</xsl:when>
+      <xsl:when test="$ns='http://www.w3.org/2005/11/its'">its</xsl:when>
+      <xsl:when test="$ns='http://www.w3.org/2005/Atom'">atom</xsl:when>
+      <xsl:when test="$ns='http://www.w3.org/XML/1998/namespace'">xml</xsl:when>
+      <xsl:when test="$ns='http://www.tei-c.org/ns/geneticEditions'">ge</xsl:when>
+    </xsl:choose>
+  </xsl:template>
+  <xsl:template name="verbatim-newLine"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>
+      <p>Make newline</p>
+      <p>[common] </p>
+      <param name="id">identifier for debugging only</param>
+    </desc>
+  </doc>
+  <xsl:template name="verbatim-lineBreak">
+    <xsl:param name="id"/>
+    <xsl:text>&#10;</xsl:text>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>
+      <p>Process comments in verbatim mode</p>
+      <p>[common] </p>
+    </desc>
+  </doc>
+  <xsl:template match="comment()" mode="verbatim">
+    <xsl:choose>
+      <xsl:when test="ancestor::Wrapper"/>
+      <xsl:when test="ancestor::xhtml:Wrapper"/>
+      <xsl:otherwise>
+        <xsl:call-template name="verbatim-lineBreak">
+          <xsl:with-param name="id">21</xsl:with-param>
+        </xsl:call-template>
+        <xsl:value-of disable-output-escaping="yes" select="$startComment"/>
+        <xsl:text>&lt;!--</xsl:text>
+        <xsl:choose>
+          <xsl:when test="$forceWrap='true'">
+            <xsl:call-template name="verbatim-reformatText">
+              <xsl:with-param name="sofar">0</xsl:with-param>
+              <xsl:with-param name="indent">
+                <xsl:text> </xsl:text>
+              </xsl:with-param>
+              <xsl:with-param name="text">
+                <xsl:value-of select="normalize-space(.)"/>
+              </xsl:with-param>
+            </xsl:call-template>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:value-of select="."/>
+          </xsl:otherwise>
+        </xsl:choose>
+        <xsl:text>--&gt;</xsl:text>
+        <xsl:value-of disable-output-escaping="yes" select="$endComment"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>
+      <p>Process text nodes in verbatim mode</p>
+      <p>[common] </p>
+    </desc>
+  </doc>
+  <xsl:template match="text()" mode="verbatim">
+    <xsl:choose>
+      <xsl:when test="$forceWrap='true'">
+        <xsl:variable name="indent">
+          <xsl:for-each select="parent::*">
+            <xsl:call-template name="verbatim-makeIndent"/>
+          </xsl:for-each>
+        </xsl:variable>
+        <xsl:if test="string-length(.)&gt;$wrapLength or parent::sch:assert">
+          <xsl:text>&#10;</xsl:text>
+          <xsl:value-of select="$indent"/>
+        </xsl:if>
+        <xsl:call-template name="verbatim-reformatText">
+          <xsl:with-param name="sofar">0</xsl:with-param>
+          <xsl:with-param name="indent">
+            <xsl:value-of select="$indent"/>
+          </xsl:with-param>
+          <xsl:with-param name="text">
+            <xsl:value-of select="normalize-space(.)"/>
+          </xsl:with-param>
+        </xsl:call-template>
+        <xsl:if test="string-length(.)&gt;$wrapLength or parent::sch:assert">
+          <xsl:text>&#10;</xsl:text>
+          <xsl:value-of select="$indent"/>
+        </xsl:if>
+      </xsl:when>
+      <xsl:when test="not(preceding-sibling::node() or         contains(.,'&#10;'))">
+        <xsl:if test="starts-with(.,' ')">
+          <xsl:text> </xsl:text>
+        </xsl:if>
+        <xsl:call-template name="verbatim-Text">
+          <xsl:with-param name="words">
+            <xsl:value-of select="normalize-space(.)"/>
+          </xsl:with-param>
+        </xsl:call-template>
+        <xsl:if test="substring(.,string-length(.),1)=' '">
+          <xsl:text> </xsl:text>
+        </xsl:if>
+      </xsl:when>
+      <xsl:when test="normalize-space(.)=''">
+        <xsl:for-each select="following-sibling::*[1]">
+          <xsl:call-template name="verbatim-lineBreak">
+            <xsl:with-param name="id">7</xsl:with-param>
+          </xsl:call-template>
+          <xsl:call-template name="verbatim-makeIndent"/>
+        </xsl:for-each>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="verbatim-wraptext">
+          <xsl:with-param name="count">0</xsl:with-param>
+          <xsl:with-param name="indent">
+            <xsl:for-each select="parent::*">
+              <xsl:call-template name="verbatim-makeIndent"/>
+            </xsl:for-each>
+          </xsl:with-param>
+          <xsl:with-param name="text">
+            <xsl:choose>
+              <xsl:when test="starts-with(.,'&#10;') and not          (preceding-sibling::node())">
+                <xsl:value-of select="translate(substring(.,2),'&#10;','⌤')"/>
+              </xsl:when>
+              <xsl:otherwise>
+                <xsl:value-of select="translate(.,'&#10;','⌤')"/>
+              </xsl:otherwise>
+            </xsl:choose>
+          </xsl:with-param>
+        </xsl:call-template>
+        <!--
+	<xsl:if test="substring(.,string-length(.))=' '">
+	  <xsl:text> </xsl:text>
+	</xsl:if>
+	-->
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <xsl:template name="verbatim-reformatText">
+    <xsl:param name="indent"/>
+    <xsl:param name="text"/>
+    <xsl:param name="sofar"/>
+    <xsl:choose>
+      <xsl:when test="number($sofar) &gt; $wrapLength">
+        <xsl:text>&#10;</xsl:text>
+        <xsl:value-of select="$indent"/>
+        <xsl:call-template name="verbatim-reformatText">
+          <xsl:with-param name="text">
+            <xsl:value-of select="$text"/>
+          </xsl:with-param>
+          <xsl:with-param name="sofar">
+            <xsl:text>0</xsl:text>
+          </xsl:with-param>
+          <xsl:with-param name="indent">
+            <xsl:value-of select="$indent"/>
+          </xsl:with-param>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:when test="not(contains($text,' '))">
+        <xsl:call-template name="verbatim-Text">
+          <xsl:with-param name="words">
+            <xsl:value-of select="$text"/>
+          </xsl:with-param>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:variable name="chunk">
+          <xsl:value-of select="substring-before($text,' ')"/>
+        </xsl:variable>
+        <xsl:call-template name="verbatim-Text">
+          <xsl:with-param name="words">
+            <xsl:value-of select="$chunk"/>
+            <xsl:text> </xsl:text>
+          </xsl:with-param>
+        </xsl:call-template>
+        <xsl:call-template name="verbatim-reformatText">
+          <xsl:with-param name="text">
+            <xsl:value-of select="substring-after($text,' ')"/>
+          </xsl:with-param>
+          <xsl:with-param name="sofar">
+            <xsl:value-of select="$sofar + string-length($chunk) + 1"/>
+          </xsl:with-param>
+          <xsl:with-param name="indent">
+            <xsl:value-of select="$indent"/>
+          </xsl:with-param>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <xsl:template name="verbatim-wraptext">
+    <xsl:param name="indent"/>
+    <xsl:param name="text"/>
+    <xsl:param name="count">0</xsl:param>
+    <xsl:variable name="finalSpace">
+      <xsl:choose>
+        <xsl:when test="substring($text,string-length($text),1)=' '">
+          <xsl:text> </xsl:text>
+        </xsl:when>
+        <xsl:when test="substring($text,string-length($text),1)='⌤'">
+          <xsl:text> </xsl:text>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:text/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <!--
+<xsl:message>my text is [<xsl:value-of select="$text"/>]</xsl:message>
+<xsl:message>my space is [<xsl:value-of select="$finalSpace"/>]</xsl:message>
+-->
+    <xsl:choose>
+      <xsl:when test="normalize-space($text)=''"/>
+      <xsl:when test="contains($text,'⌤')">
+        <xsl:if test="$count &gt; 0">
+          <xsl:value-of select="$indent"/>
+          <xsl:text> </xsl:text>
+        </xsl:if>
+        <xsl:if test="starts-with($text,' ')">
+          <xsl:text> </xsl:text>
+        </xsl:if>
+        <xsl:call-template name="verbatim-Text">
+          <xsl:with-param name="words">
+            <xsl:value-of select="normalize-space(substring-before($text,'⌤'))"/>
+          </xsl:with-param>
+        </xsl:call-template>
+        <!--	<xsl:if test="not(substring-after($text,'&#10;')='')">-->
+        <xsl:call-template name="verbatim-lineBreak">
+          <xsl:with-param name="id">6</xsl:with-param>
+        </xsl:call-template>
+        <xsl:value-of select="$indent"/>
+        <xsl:call-template name="verbatim-wraptext">
+          <xsl:with-param name="indent">
+            <xsl:value-of select="$indent"/>
+          </xsl:with-param>
+          <xsl:with-param name="text">
+            <xsl:value-of select="normalize-space(substring-after($text,'⌤'))"/>
+            <xsl:value-of select="$finalSpace"/>
+          </xsl:with-param>
+          <xsl:with-param name="count">
+            <xsl:value-of select="$count + 1"/>
+          </xsl:with-param>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:if test="starts-with($text,' ')">
+          <xsl:text> </xsl:text>
+        </xsl:if>
+        <xsl:if test="$count &gt; 0 and parent::*">
+          <xsl:value-of select="$indent"/>
+          <xsl:text> </xsl:text>
+        </xsl:if>
+        <xsl:call-template name="verbatim-Text">
+          <xsl:with-param name="words">
+            <xsl:value-of select="normalize-space($text)"/>
+            <xsl:value-of select="$finalSpace"/>
+          </xsl:with-param>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>
+      <p>Process text and process ampersands</p>
+      <p>[common] </p>
+    </desc>
+  </doc>
+  <xsl:template name="verbatim-Text">
+    <xsl:param name="words"/>
+    <xsl:analyze-string select="$words" regex="(&amp;)(.)">
+      <xsl:matching-substring>
+        <xsl:choose>
+          <xsl:when test="starts-with(regex-group(2),'#')">
+            <xsl:text>&amp;</xsl:text>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:text>&amp;amp;</xsl:text>
+          </xsl:otherwise>
+        </xsl:choose>
+        <xsl:value-of select="regex-group(2)"/>
+      </xsl:matching-substring>
+      <xsl:non-matching-substring>
+        <xsl:value-of select="."/>
+      </xsl:non-matching-substring>
+    </xsl:analyze-string>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>
+      <p>Process default elements in verbatim mode</p>
+      <p>[common] </p>
+    </desc>
+  </doc>
+  <xsl:template match="*" mode="verbatim">
+    <xsl:param name="highlight"/>
+    <xsl:choose>
+      <xsl:when test="parent::xhtml:Wrapper"/>
+      <!--      <xsl:when test="child::node()[last()]/self::text()[not(.='')] and child::node()[1]/self::text()[not(.='')]"/>-->
+      <xsl:when test="not(parent::*)  or parent::teix:egXML">
+        <xsl:choose>
+          <xsl:when test="preceding-sibling::node()[1][self::text()]      and following-sibling::node()[1][self::text()]"/>
+          <xsl:when test="preceding-sibling::*">
+            <xsl:call-template name="verbatim-lineBreak">
+              <xsl:with-param name="id">-1</xsl:with-param>
+            </xsl:call-template>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:call-template name="verbatim-newLine"/>
+            <!-- <xsl:call-template name="makeIndent"/>-->
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+      <xsl:when test="not(preceding-sibling::node())">
+        <xsl:call-template name="verbatim-lineBreak">
+          <xsl:with-param name="id">-2</xsl:with-param>
+        </xsl:call-template>
+        <xsl:call-template name="verbatim-makeIndent"/>
+      </xsl:when>
+      <xsl:when test="preceding-sibling::node()[1]/self::*">
+        <xsl:call-template name="verbatim-lineBreak">
+          <xsl:with-param name="id">1</xsl:with-param>
+        </xsl:call-template>
+        <xsl:call-template name="verbatim-makeIndent"/>
+      </xsl:when>
+      <xsl:when test="preceding-sibling::node()[1]/self::text()"> </xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="verbatim-lineBreak">
+          <xsl:with-param name="id">9</xsl:with-param>
+        </xsl:call-template>
+        <xsl:call-template name="verbatim-makeIndent"/>
+      </xsl:otherwise>
+    </xsl:choose>
+    <xsl:value-of disable-output-escaping="yes" select="$startElement"/>
+    <xsl:text>&lt;</xsl:text>
+    <xsl:call-template name="verbatim-makeElementName">
+      <xsl:with-param name="start">true</xsl:with-param>
+      <xsl:with-param name="highlight">
+        <xsl:value-of select="$highlight"/>
+      </xsl:with-param>
+    </xsl:call-template>
+    <xsl:apply-templates select="@*" mode="verbatim"/>
+    <xsl:if test="$showNamespaceDecls='true' or parent::teix:egXML[@rend='full']">
+      <xsl:choose>
+        <xsl:when test="not(parent::*)">
+          <xsl:call-template name="nsList"/>
+        </xsl:when>
+        <xsl:when test="parent::teix:egXML and not(preceding-sibling::*)">
+          <xsl:call-template name="nsList"/>
+        </xsl:when>
+      </xsl:choose>
+    </xsl:if>
+    <xsl:choose>
+      <xsl:when test="child::node()">
+        <xsl:text>&gt;</xsl:text>
+        <xsl:value-of disable-output-escaping="yes" select="$endElement"/>
+        <xsl:apply-templates mode="verbatim">
+          <xsl:with-param name="highlight">
+            <xsl:value-of select="$highlight"/>
+          </xsl:with-param>
+        </xsl:apply-templates>
+        <xsl:choose>
+          <xsl:when test="child::node()[last()]/self::text() and child::node()[1]/self::text()"/>
+          <xsl:when test="not(parent::*)  or parent::teix:egXML">
+            <xsl:call-template name="verbatim-lineBreak">
+              <xsl:with-param name="id">23</xsl:with-param>
+            </xsl:call-template>
+          </xsl:when>
+          <xsl:when test="child::node()[last()]/self::text()[normalize-space(.)='']">
+            <xsl:call-template name="verbatim-lineBreak">
+              <xsl:with-param name="id">3</xsl:with-param>
+            </xsl:call-template>
+            <xsl:call-template name="verbatim-makeIndent"/>
+          </xsl:when>
+          <xsl:when test="child::node()[last()]/self::comment()">
+            <xsl:call-template name="verbatim-lineBreak">
+              <xsl:with-param name="id">4</xsl:with-param>
+            </xsl:call-template>
+            <xsl:call-template name="verbatim-makeIndent"/>
+          </xsl:when>
+          <xsl:when test="child::node()[last()]/self::*">
+            <xsl:call-template name="verbatim-lineBreak">
+              <xsl:with-param name="id">5</xsl:with-param>
+            </xsl:call-template>
+            <xsl:call-template name="verbatim-makeIndent"/>
+          </xsl:when>
+        </xsl:choose>
+        <xsl:value-of disable-output-escaping="yes" select="$startElement"/>
+        <xsl:text>&lt;/</xsl:text>
+        <xsl:call-template name="verbatim-makeElementName">
+          <xsl:with-param name="start">false</xsl:with-param>
+          <xsl:with-param name="highlight">
+            <xsl:value-of select="$highlight"/>
+          </xsl:with-param>
+        </xsl:call-template>
+        <xsl:text>&gt;</xsl:text>
+        <xsl:value-of disable-output-escaping="yes" select="$endElement"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:text>/&gt;</xsl:text>
+        <xsl:value-of disable-output-escaping="yes" select="$endElement"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <xsl:template name="verbatim-createElement">
+    <xsl:param name="name"/>
+    <xsl:param name="special"/>
+    <xsl:choose>
+      <xsl:when test="$special='true'">
+        <xsl:value-of disable-output-escaping="yes" select="$highlightStartElementName"/>
+        <xsl:value-of select="$name"/>
+        <xsl:value-of disable-output-escaping="yes" select="$highlightEndElementName"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$name"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <xsl:template name="verbatim-createAttribute">
+    <xsl:param name="name"/>
+    <xsl:value-of select="$name"/>
+  </xsl:template>
+  <xsl:template name="verbatim-makeElementName">
+    <xsl:param name="start"/>
+    <xsl:param name="highlight"/>
+    <!-- get namespace prefix -->
+    <xsl:variable name="ns-prefix">
+      <xsl:call-template name="verbatim-getNamespacePrefix"/>
+    </xsl:variable>
+    <xsl:variable name="highlightMe">
+      <xsl:choose>
+        <xsl:when test="$highlight=local-name()">true</xsl:when>
+        <xsl:otherwise>false</xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:choose>
+      <xsl:when test="namespace-uri()='http://www.tei-c.org/ns/Examples'">
+        <xsl:call-template name="verbatim-createElement">
+          <xsl:with-param name="name" select="local-name(.)"/>
+          <xsl:with-param name="special">
+            <xsl:value-of select="$highlightMe"/>
+          </xsl:with-param>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:when test="contains($omitNSDecls,namespace-uri())">
+        <xsl:call-template name="verbatim-createElement">
+          <xsl:with-param name="name" select="local-name(.)"/>
+          <xsl:with-param name="special">
+            <xsl:value-of select="$highlightMe"/>
+          </xsl:with-param>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:when test="$useNSPrefixes='true' and string-length($ns-prefix) &gt; 0">
+        <xsl:call-template name="verbatim-createElement">
+          <xsl:with-param name="name" select="concat($ns-prefix,':',local-name(.))"/>
+          <xsl:with-param name="special">
+            <xsl:value-of select="$highlightMe"/>
+          </xsl:with-param>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:when test="not(namespace-uri()='')">
+        <xsl:call-template name="verbatim-createElement">
+          <xsl:with-param name="name" select="local-name(.)"/>
+          <xsl:with-param name="special">
+            <xsl:value-of select="$highlightMe"/>
+          </xsl:with-param>
+        </xsl:call-template>
+        <xsl:if test="$start='true' and not(namespace-uri()=namespace-uri(..))">
+          <xsl:text> xmlns="</xsl:text>
+          <xsl:value-of select="namespace-uri()"/>
+          <xsl:text>"</xsl:text>
+          <!-- 
+	       <xsl:call-template name="verbatim-lineBreak">
+	       <xsl:with-param name="id">5</xsl:with-param>
+	       </xsl:call-template>
+	       <xsl:call-template name="verbatim-makeIndent"/>
+	  -->
+        </xsl:if>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of disable-output-escaping="yes" select="$startElementName"/>
+        <xsl:call-template name="verbatim-createElement">
+          <xsl:with-param name="name" select="local-name(.)"/>
+          <xsl:with-param name="special">
+            <xsl:value-of select="$highlightMe"/>
+          </xsl:with-param>
+        </xsl:call-template>
+        <xsl:value-of disable-output-escaping="yes" select="$endElementName"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <xsl:template name="verbatim-makeIndent">
+    <xsl:variable name="depth" select="count(ancestor::*[not(namespace-uri()='http://www.tei-c.org/ns/1.0')])"/>
+    <xsl:call-template name="verbatim-makeSpace">
+      <xsl:with-param name="d">
+        <xsl:value-of select="$depth"/>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <xsl:template name="verbatim-makeSpace">
+    <xsl:param name="d"/>
+    <xsl:if test="number($d)&gt;1">
+      <xsl:value-of select="$spaceCharacter"/>
+      <xsl:call-template name="verbatim-makeSpace">
+        <xsl:with-param name="d">
+          <xsl:value-of select="$d -1"/>
+        </xsl:with-param>
+      </xsl:call-template>
+    </xsl:if>
+  </xsl:template>
+  <xsl:template match="@*" mode="verbatim">
+    <xsl:variable name="L">
+      <xsl:for-each select="../@*">
+        <xsl:value-of select="."/>
+      </xsl:for-each>
+    </xsl:variable>
+    <xsl:if test="count(../@*)&gt;$attsOnSameLine or      string-length($L)&gt;$attLength or     ancestor::tei:cell[not(@rend='wovenodd-col2')] or     namespace-uri()='http://www.w3.org/2005/11/its' or     string-length(.)+string-length(name(.)) &gt;     $attLength">
+      <xsl:call-template name="verbatim-lineBreak">
+        <xsl:with-param name="id">5</xsl:with-param>
+      </xsl:call-template>
+      <xsl:call-template name="verbatim-makeIndent"/>
+    </xsl:if>
+    <xsl:value-of select="$spaceCharacter"/>
+    <xsl:variable name="ns-prefix">
+      <xsl:call-template name="verbatim-getNamespacePrefix"/>
+    </xsl:variable>
+    <xsl:variable name="name">
+      <xsl:choose>
+        <xsl:when test="string-length($ns-prefix) &gt; 0">
+          <xsl:value-of select="$ns-prefix"/>
+          <xsl:text>:</xsl:text>
+          <xsl:value-of select="local-name(.)"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="local-name(.)"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:call-template name="verbatim-createAttribute">
+      <xsl:with-param name="name" select="$name"/>
+    </xsl:call-template>
+    <xsl:text>="</xsl:text>
+    <xsl:value-of disable-output-escaping="yes" select="$startAttributeValue"/>
+    <xsl:apply-templates select="." mode="attributetext"/>
+    <xsl:value-of disable-output-escaping="yes" select="$endAttributeValue"/>
+    <xsl:text>"</xsl:text>
+  </xsl:template>
+  <xsl:template match="@*" mode="attributetext">
+    <xsl:choose>
+      <xsl:when test="string-length(.)&gt;$attLength and contains(.,' ')">
+        <xsl:call-template name="verbatim-reformatText">
+          <xsl:with-param name="sofar">0</xsl:with-param>
+          <xsl:with-param name="indent">
+            <xsl:text> </xsl:text>
+          </xsl:with-param>
+          <xsl:with-param name="text">
+            <xsl:value-of select="normalize-space(.)"/>
+          </xsl:with-param>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="."/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <xsl:template match="text()|comment()|processing-instruction()" mode="ns"/>
+  <xsl:template match="*" mode="ns">
+    <xsl:for-each select="namespace::*">
+      <xsl:variable name="ns" select="."/>
+      <xsl:choose>
+        <xsl:when test=".='http://relaxng.org/ns/structure/1.0'"/>
+        <xsl:when test=".='http://www.w3.org/2001/XInclude'"/>
+        <xsl:when test=".='http://www.tei-c.org/ns/Examples'"/>
+        <xsl:when test=".='http://www.ascc.net/xml/schematron'"/>
+        <xsl:when test=".='http://relaxng.org/ns/compatibility/annotations/1.0'"/>
+        <xsl:when test="name(.)=''"/>
+        <xsl:when test=".='http://www.w3.org/XML/1998/namespace'"/>
+        <xsl:otherwise>
+          <ns name="{name(.)}" value="{.}"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:for-each>
+    <xsl:apply-templates mode="ns"/>
+  </xsl:template>
+  <xsl:template name="nsList">
+    <xsl:variable name="ns">
+      <all>
+        <names>
+          <xsl:apply-templates select="." mode="ns"/>
+        </names>
+        <text>
+          <xsl:copy-of select="."/>
+        </text>
+      </all>
+    </xsl:variable>
+    <xsl:for-each select="$ns/all/names">
+      <xsl:for-each-group select="ns" group-by="@name">
+        <xsl:if test="key('NSUsed',@value)">
+          <xsl:call-template name="verbatim-lineBreak">
+            <xsl:with-param name="id">22</xsl:with-param>
+          </xsl:call-template>
+          <xsl:text>&#160;&#160;&#160;</xsl:text>
+          <xsl:text>xmlns:</xsl:text>
+          <xsl:value-of select="@name"/>
+          <xsl:text>="</xsl:text>
+          <xsl:value-of select="@value"/>
+          <xsl:text>"</xsl:text>
+        </xsl:if>
+      </xsl:for-each-group>
+    </xsl:for-each>
+  </xsl:template>
+  <xsl:function name="tei:getPrefix" as="xs:string*">
+    <xsl:param name="ns"/>
+    <xsl:param name="here"/>
+    <xsl:for-each select="in-scope-prefixes($here)">
+      <xsl:choose>
+        <xsl:when test=".=''"/>
+        <xsl:when test="$ns=namespace-uri-for-prefix(.,$here)">
+          <xsl:value-of select="."/>
+        </xsl:when>
+      </xsl:choose>
+    </xsl:for-each>
+  </xsl:function>
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/common2/verbatim.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/common2/linking.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/common2/linking.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/common2/linking.xsl	(revision 258)
@@ -0,0 +1,396 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:tei="http://www.tei-c.org/ns/1.0"
+		xmlns:xs="http://www.w3.org/2001/XMLSchema"                
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                exclude-result-prefixes="tei xs"
+                version="2.0">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet dealing with elements from the linking module. </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: linking.xsl 10057 2012-01-21 16:57:14Z rahtz $</p>
+         <p>Copyright: 2011, TEI Consortium</p>
+      </desc>
+   </doc>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element  in xref mode</desc>
+   </doc>
+  <xsl:template match="tei:TEI" mode="xref">
+      <xsl:apply-templates select="tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:title[1]"/>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process elements text in xref mode</desc>
+   </doc>
+  <xsl:template match="tei:text" mode="xref">
+   <xsl:choose>
+     <xsl:when test="tei:head">
+       <xsl:apply-templates select="tei:head" mode="plain"/>
+     </xsl:when>
+     <xsl:when test="tei:body/tei:head">
+       <xsl:apply-templates select="tei:body/tei:head" mode="plain"/>
+     </xsl:when>
+     <xsl:when test="tei:front//tei:titlePart/tei:title">
+       <xsl:apply-templates select="tei:front//tei:titlePart/tei:titl" mode="plain"/>
+     </xsl:when>
+     <xsl:otherwise>
+       <xsl:text>Text </xsl:text>
+       <xsl:number/>
+     </xsl:otherwise>
+   </xsl:choose>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element anchor|tei:p in xref mode</desc>
+   </doc>
+  <xsl:template match="tei:anchor|tei:p" mode="xref">
+      <xsl:text>here</xsl:text>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element bibl</desc>
+   </doc>
+  <xsl:template match="tei:bibl" mode="xref">
+      <xsl:text>[</xsl:text>
+      <xsl:number/>
+      <xsl:text>]</xsl:text>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element s
+      tei:div|tei:div1|tei:div2|tei:div3|tei:div4|tei:div5|tei:div6 in
+      xref mode<param name="minimal">whether to make a link with just numbers or with
+      text too</param>
+      </desc>
+   </doc>
+  <xsl:template match="tei:div|tei:div1|tei:div2|tei:div3|tei:div4|tei:div5|tei:div6"
+                 mode="xref">
+      <xsl:param name="minimal">false</xsl:param>
+      <xsl:call-template name="header">
+         <xsl:with-param name="minimal" select="$minimal"/>
+         <xsl:with-param name="display">plain</xsl:with-param>
+      </xsl:call-template>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element ptr in xref mode</desc>
+   </doc>
+  <xsl:template match="tei:ptr">
+      <xsl:call-template name="makeTEILink">
+         <xsl:with-param name="ptr" select="true()"/>
+      </xsl:call-template>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element ref</desc>
+   </doc>
+  <xsl:template match="tei:ref">
+      <xsl:call-template name="makeTEILink">
+         <xsl:with-param name="ptr" select="false()"/>
+      </xsl:call-template>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[common] Making a heading for something
+         <param name="minimal">whether to display headings</param>
+         <param name="toc">whether this is making a TOC entry</param>
+         <param name="display">detail of display (full, simple, plain), ie
+    whether markup is followed</param>
+      </desc>
+   </doc>
+  <xsl:template name="header">
+      <xsl:param name="minimal">false</xsl:param>
+      <xsl:param name="toc"/>
+      <xsl:param name="display">full</xsl:param>
+      <xsl:variable name="depth">
+         <xsl:apply-templates mode="depth" select="."/>
+      </xsl:variable>
+      <xsl:call-template name="formatHeadingNumber">
+         <xsl:with-param name="toc">
+	   <xsl:value-of select="$toc"/>
+         </xsl:with-param>
+         <xsl:with-param name="text">
+            <xsl:choose>
+               <xsl:when test="local-name(.) = 'TEI'"/>
+               <xsl:when test="$depth &gt; $numberHeadingsDepth"> </xsl:when>
+               <xsl:when test="self::tei:text">
+		 <xsl:number/>
+		 <xsl:call-template name="headingNumberSuffix"/>
+	       </xsl:when>
+               <xsl:when test="ancestor::tei:back">
+                  <xsl:if test="$numberBackHeadings='true'">
+                     <xsl:call-template name="i18n">
+                        <xsl:with-param name="word">appendixWords</xsl:with-param>
+                     </xsl:call-template>
+                     <xsl:text> </xsl:text>
+                     <xsl:call-template name="numberBackDiv"/>
+                     <xsl:if test="$minimal='false'">
+                        <xsl:value-of select="$numberSpacer"/>
+                     </xsl:if>
+                  </xsl:if>
+               </xsl:when>
+               <xsl:when test="ancestor::tei:front">
+                  <xsl:if test="$numberFrontHeadings='true'">
+                     <xsl:call-template name="numberFrontDiv">
+		       <xsl:with-param name="minimal">
+			 <xsl:value-of select="$minimal"/>
+		       </xsl:with-param>
+		     </xsl:call-template>
+                  </xsl:if>
+               </xsl:when>
+               <xsl:when test="$numberHeadings ='true'">
+                  <xsl:choose>
+                     <xsl:when test="$prenumberedHeadings='true'">
+                        <xsl:value-of select="@n"/>
+                     </xsl:when>
+                     <xsl:otherwise>
+                        <xsl:call-template name="numberBodyDiv"/>
+                     </xsl:otherwise>
+                  </xsl:choose>
+                  <xsl:if test="$minimal='false'">
+                     <xsl:call-template name="headingNumberSuffix"/>
+                  </xsl:if>
+               </xsl:when>
+            </xsl:choose>
+         </xsl:with-param>
+      </xsl:call-template>
+      <xsl:if test="$minimal='false'">
+         <xsl:choose>
+            <xsl:when test="local-name(.) = 'TEI'">
+               <xsl:apply-templates select="tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:title[1]"/>
+            </xsl:when>
+            <xsl:when test="not($toc='')">
+	      <xsl:call-template name="makeInternalLink">
+		<xsl:with-param name="dest">
+		  <xsl:value-of select="$toc"/>
+		</xsl:with-param>
+		<xsl:with-param name="class">
+		  <xsl:value-of select="$class_toc"/>
+		  <xsl:text> </xsl:text>
+		  <xsl:value-of select="concat($class_toc,'_',$depth)"/>
+		</xsl:with-param>
+		<xsl:with-param name="body">
+		  <xsl:choose>
+		    <xsl:when test="not(tei:head) and tei:body/tei:head">
+			<xsl:apply-templates mode="plain" select="tei:body/tei:head"/>
+		    </xsl:when>	
+		    <xsl:when test="not(tei:head) and tei:front//tei:titlePart/tei:title">
+			<xsl:apply-templates mode="plain" select="tei:front//tei:titlePart/tei:title"/>
+		    </xsl:when>	
+		    <xsl:when test="tei:head">
+			<xsl:apply-templates mode="plain" select="tei:head"/>
+		    </xsl:when>
+		    <xsl:when test="$autoHead='true'">
+		      <xsl:call-template name="autoMakeHead">
+			<xsl:with-param name="display" select="$display"/>
+		      </xsl:call-template>
+		    </xsl:when>
+		    <xsl:otherwise>
+		      <xsl:number/>
+		    </xsl:otherwise>
+		  </xsl:choose>
+		</xsl:with-param>
+	      </xsl:call-template>
+            </xsl:when>
+            <xsl:when test="$autoHead='true'">
+	      <xsl:choose>
+		<xsl:when test="($outputTarget='epub' or $outputTarget='epub3') and
+				not(tei:head)"/>
+		<xsl:otherwise>
+		  <xsl:call-template name="autoMakeHead">
+		    <xsl:with-param name="display" select="$display"/>
+		  </xsl:call-template>
+		</xsl:otherwise>
+	      </xsl:choose>
+            </xsl:when>
+            <xsl:when test="$display='plain'">
+               <xsl:for-each select="tei:head">
+		 <xsl:apply-templates mode="plain"/>
+	       </xsl:for-each>
+            </xsl:when>
+            <xsl:when test="$display='simple'">
+               <xsl:for-each select="tei:head">
+		 <xsl:apply-templates mode="plain"/>
+	       </xsl:for-each>
+            </xsl:when>
+	    <xsl:when test="self::tei:index">
+	      <xsl:value-of select="substring(tei:term,1,10)"/>
+	      <xsl:text>…</xsl:text>
+	    </xsl:when>
+	    <xsl:when test="not(tei:head)">
+	      <xsl:value-of select="substring(normalize-space(.),1,10)"/>
+	      <xsl:text>…</xsl:text>
+	    </xsl:when>
+            <xsl:otherwise>
+               <xsl:apply-templates select="tei:head" mode="makeheading"/>
+            </xsl:otherwise>
+         </xsl:choose>
+      </xsl:if>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+         <p>[common] processing the number portion of a heading</p>
+         <p>By default, the text is printed as is. You may
+    wish to colour it, align it, etc</p>
+         <param name="text"/>
+      </desc>
+   </doc>
+  <xsl:template name="formatHeadingNumber">
+      <xsl:param name="text"/>
+      <xsl:param name="toc"/>
+      <xsl:copy-of select="$text"/>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+         <p>[common] Making a heading for something, and making sure it has
+      contents</p>
+         <p>This is a wrapper around the "header" template which ensures that
+      some text is returned; if all else fails, the element name is
+    used.</p>
+         <param name="minimal">false</param>
+      </desc>
+   </doc>
+  <xsl:template name="headerLink">
+      <xsl:param name="minimal">false</xsl:param>
+      <xsl:variable name="Text">
+         <xsl:call-template name="header">
+            <xsl:with-param name="minimal" select="$minimalCrossRef"/>
+	           <xsl:with-param name="display">plain</xsl:with-param>
+         </xsl:call-template>
+      </xsl:variable>
+      <xsl:choose>
+         <xsl:when test="$Text=''">
+	   <!--
+	       <xsl:text>&lt;</xsl:text>
+	       <xsl:value-of select="local-name(.)"/>
+	       <xsl:text>&gt;</xsl:text>
+	   -->
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:copy-of select="$Text"/>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+         <p>[common] Make a hypertext link</p>
+         <p>cross-referencing </p>
+         <param name="ptr">ptr</param>
+      </desc>
+   </doc>
+  <xsl:template name="makeTEILink">
+      <xsl:param name="ptr" as="xs:boolean" select="false()"/>
+      <!-- is this a ptr or a ref? -->
+
+    <xsl:choose>
+      <!-- If there is a target attribute starting with #, it is always a local reference -->
+      <xsl:when test="@target and starts-with(@target,'#')">
+            <xsl:call-template name="makeInternalLink">
+               <xsl:with-param name="target" select="substring(@target,2)"/>
+               <xsl:with-param name="ptr" select="$ptr"/>
+               <xsl:with-param name="dest">
+                  <xsl:call-template name="generateEndLink">
+                     <xsl:with-param name="where">
+                        <xsl:value-of select="substring(@target,2)"/>
+                     </xsl:with-param>
+                  </xsl:call-template>
+               </xsl:with-param>
+            </xsl:call-template>
+         </xsl:when>
+         <!-- if we are doing TEI P4, all targets are local -->
+      <xsl:when test="@target and $teiP4Compat='true'">
+            <xsl:call-template name="makeInternalLink">
+               <xsl:with-param name="target" select="@target"/>
+               <xsl:with-param name="ptr" select="$ptr"/>
+               <xsl:with-param name="dest">
+                  <xsl:call-template name="generateEndLink">
+                     <xsl:with-param name="where">
+                        <xsl:value-of select="@target"/>
+                     </xsl:with-param>
+                  </xsl:call-template>
+               </xsl:with-param>
+            </xsl:call-template>
+         </xsl:when>
+         <!-- other uses of target means it is external -->
+      <xsl:when test="@target">
+            <xsl:call-template name="makeExternalLink">
+               <xsl:with-param name="ptr" select="$ptr"/>
+               <xsl:with-param name="dest">
+                  <xsl:value-of select="@target"/>
+               </xsl:with-param>
+            </xsl:call-template>
+         </xsl:when>
+         <!-- If there is a url attribute starting with #, it is a local
+       reference -->
+      <xsl:when test="@url and starts-with(@url,'#')">
+            <xsl:call-template name="makeInternalLink">
+               <xsl:with-param name="target" select="substring(@url,2)"/>
+               <xsl:with-param name="ptr" select="$ptr"/>
+               <xsl:with-param name="dest">
+                  <xsl:call-template name="generateEndLink">
+                     <xsl:with-param name="where">
+                        <xsl:value-of select="substring(@url,2)"/>
+                     </xsl:with-param>
+                  </xsl:call-template>
+               </xsl:with-param>
+            </xsl:call-template>
+         </xsl:when>
+         <!-- otherwise it is an external URL -->
+      <xsl:when test="@url">
+            <xsl:call-template name="makeExternalLink">
+               <xsl:with-param name="ptr" select="$ptr"/>
+               <xsl:with-param name="dest">
+                  <xsl:value-of select="@url"/>
+               </xsl:with-param>
+            </xsl:call-template>
+         </xsl:when>
+         <!-- A doc attribute means an external reference -->
+      <xsl:when test="@doc">
+            <xsl:call-template name="makeExternalLink">
+               <xsl:with-param name="ptr" select="$ptr"/>
+               <xsl:with-param name="dest">
+                  <xsl:value-of select="unparsed-entity-uri(@doc)"/>
+               </xsl:with-param>
+            </xsl:call-template>
+         </xsl:when>
+         <xsl:otherwise>
+        <!--
+      <xsl:for-each select="@*">
+	[[markup error: <xsl:value-of select="name(.)"/>=<xsl:value-of select="."/>]]
+      </xsl:for-each>
+-->
+        <xsl:apply-templates/>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/common2/linking.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/common2/i18n.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/common2/i18n.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/common2/i18n.xsl	(revision 258)
@@ -0,0 +1,163 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet 
+    xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
+    xmlns:fo="http://www.w3.org/1999/XSL/Format" 
+    xmlns:html="http://www.w3.org/1999/xhtml" 
+    xmlns:i="http://www.iso.org/ns/1.0"
+    xmlns:rng="http://relaxng.org/ns/structure/1.0"
+    xmlns:s="http://www.ascc.net/xml/schematron" 
+    xmlns:sch="http://purl.oclc.org/dsdl/schematron" 
+    xmlns:tei="http://www.tei-c.org/ns/1.0"
+    xmlns:teix="http://www.tei-c.org/ns/Examples" 
+    xmlns:xi="http://www.w3.org/2001/XInclude"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    exclude-result-prefixes="a fo html i rng s sch tei teix xi xs xsl" 
+    version="2.0">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet definitions common for all of HTML, FO and LaTeX
+      outputs </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: i18n.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2011, TEI Consortium</p>
+      </desc>
+   </doc>
+  <xsl:key match="entry" name="KEYS" use="key"/>
+  <xsl:param name="documentationLanguage">en</xsl:param>
+
+  <xsl:variable name="i18n"
+		select="document('../i18n.xml',document(''))"/>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[common] give language-specific version of a word or phrase<param name="word">the word(s) to translate</param>
+      </desc>
+   </doc>
+  <xsl:template name="i18n">
+      <xsl:param name="word"/>
+      <xsl:variable name="Word">
+         <xsl:value-of select="normalize-space($word)"/>
+      </xsl:variable>
+      <xsl:variable name="local">
+         <xsl:call-template name="myi18n">
+	           <xsl:with-param name="word">
+	              <xsl:value-of select="$word"/>
+	           </xsl:with-param>
+         </xsl:call-template>
+      </xsl:variable>
+      <xsl:choose>
+         <xsl:when test="string-length($local)&gt;0">
+            <xsl:value-of select="$local"/>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:for-each select="$i18n">
+	      <xsl:choose>
+		<xsl:when test="key('KEYS',$Word)/text[@xml:lang=$documentationLanguage]">
+		  <xsl:value-of select="key('KEYS',$Word)/text[@xml:lang=$documentationLanguage]"/>
+		</xsl:when>
+		<xsl:when test="key('KEYS',$Word)/text[@lang3=$documentationLanguage]">
+		  <xsl:value-of select="key('KEYS',$Word)/text[lang3=$documentationLanguage]"/>
+		</xsl:when>
+		<xsl:otherwise>
+		  <!--
+		      <xsl:if test="$verbose='true'">
+		      <xsl:message>NO TRANSLATION for <xsl:value-of 
+		      select="$word"/> in <xsl:value-of select="$documentationLanguage"/></xsl:message>
+		      </xsl:if>
+		  -->
+		  <xsl:value-of select="key('KEYS',$Word)/text[@xml:lang='en']"/>
+		</xsl:otherwise>
+	      </xsl:choose>
+            </xsl:for-each>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[localisation] dummy template for overriding in a local system<param name="word">the word(s) to translate</param>
+      </desc>
+   </doc>
+  <xsl:template name="myi18n">
+	     <xsl:param name="word"/>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="localisation" type="string">
+      <desc> The language to use when
+    generating text (use ISO 2-letter codes)</desc>
+   </doc>
+  <xsl:param name="lang">en</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="localisation">
+      <desc>[common] Prefix text before an auto-generated table of contents </desc>
+   </doc>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="localisation" type="string">
+      <desc> The language the text is in
+    (use ISO 2-letter codes)</desc>
+   </doc>
+  <xsl:param name="doclang">en</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="localisation">
+      <desc>[common] Prefix text before an auto-generated table of contents </desc>
+   </doc>
+  <xsl:template name="contentsHeading">
+      <xsl:call-template name="i18n">
+         <xsl:with-param name="word">contentsHeading</xsl:with-param>
+      </xsl:call-template>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="localisation">
+      <desc>[common] Title for "Contents"; by default uses language-specific
+      lookup table.</desc>
+   </doc>
+  <xsl:template name="contentsWord">
+      <xsl:call-template name="i18n">
+         <xsl:with-param name="word">contentsWord</xsl:with-param>
+      </xsl:call-template>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="localisation">
+      <desc>[common] Title for "Feedback"</desc>
+   </doc>
+  <xsl:template name="feedbackWords">
+      <xsl:call-template name="i18n">
+         <xsl:with-param name="word">feedbackWords</xsl:with-param>
+      </xsl:call-template>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="localisation">
+      <desc>[common] Title for "Search"; by default uses language-specific
+      lookup table. </desc>
+   </doc>
+  <xsl:template name="searchWords">
+      <xsl:call-template name="i18n">
+         <xsl:with-param name="word">searchWords</xsl:with-param>
+      </xsl:call-template>
+  </xsl:template>
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/common2/i18n.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/common2/tei-param.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/common2/tei-param.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/common2/tei-param.xsl	(revision 258)
@@ -0,0 +1,332 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:sch="http://purl.oclc.org/dsdl/schematron" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:tei="http://www.tei-c.org/ns/1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="m tei xsi sch" version="2.0">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+    <desc>
+      <p>TEI stylesheet customization module, common for all output
+      formats.</p>
+      <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+      <p>Author: See AUTHORS</p>
+      <p>Id: $Id: tei-param.xsl 10010 2012-01-03 19:35:49Z rahtz $</p>
+      <p>Copyright: 2011, TEI Consortium</p>
+    </desc>
+  </doc>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="output" type="string">
+      <desc>Type of output being generated</desc>
+   </doc>
+  <xsl:param name="outputTarget">html</xsl:param>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="CSS" type="string">
+    <desc>CSS class for TOC entries</desc>
+  </doc>
+  <xsl:param name="class_toc">toc</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="figures" type="string">
+    <desc>Directory specification to put before names of graphics files,
+      unless they start with "./"</desc>
+  </doc>
+  <xsl:param name="graphicsPrefix"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="figures" type="string">
+    <desc> Default file suffix for graphics files,
+    if not directly specified</desc>
+  </doc>
+  <xsl:param name="graphicsSuffix">.png</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="figures" type="decimal">
+    <desc> Scaling of imported graphics</desc>
+  </doc>
+  <xsl:param name="standardScale">1</xsl:param>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="headings" type="boolean">
+    <desc> Construct a heading 
+    for &lt;div&gt; elements with no &lt;head&gt;</desc>
+  </doc>
+  <xsl:param name="autoHead"/>
+
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="headings">
+    <desc>[common] How to make a heading for section if there is no
+      &lt;head&gt;</desc>
+  </doc>
+  <xsl:template name="autoMakeHead">
+    <xsl:param name="display"/>
+    <xsl:choose>
+      <xsl:when test="tei:head and $display='full'">
+        <xsl:apply-templates select="tei:head" mode="makeheading"/>
+      </xsl:when>
+      <xsl:when test="tei:head">
+        <xsl:apply-templates select="tei:head" mode="plain"/>
+      </xsl:when>
+      <xsl:when test="tei:front/tei:head">
+        <xsl:apply-templates select="tei:front/tei:head" mode="plain"/>
+      </xsl:when>
+      <xsl:when test="@n">
+	<xsl:value-of select="@n"/>
+      </xsl:when>
+      <xsl:when test="@type">
+	<xsl:text>[</xsl:text>
+        <xsl:value-of select="@type"/>
+	<xsl:text>]</xsl:text>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:text>➤</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="headings" type="string">
+    <desc> Punctuation to insert after a section
+    number</desc>
+  </doc>
+  <xsl:template name="headingNumberSuffix">
+    <xsl:text>.</xsl:text>
+    <xsl:value-of select="$numberSpacer"/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="headings" type="string">
+    <desc> Character to put after number of
+    section header</desc>
+  </doc>
+  <xsl:param name="numberSpacer">
+    <xsl:text> </xsl:text>
+  </xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="links" type="string">
+    <desc> Name of department within institution</desc>
+  </doc>
+  <xsl:param name="department"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="links" type="string">
+    <desc> Name of link to home page of application</desc>
+  </doc>
+  <xsl:param name="homeLabel">Home</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="links" type="anyURI">
+    <desc>Project Home</desc>
+  </doc>
+  <xsl:param name="homeURL">http://www.tei-c.org/</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="links" type="string">
+    <desc>Project</desc>
+  </doc>
+  <xsl:param name="homeWords">TEI</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="links" type="string">
+    <desc> Institution</desc>
+  </doc>
+  <xsl:param name="institution">A TEI Project</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="links" type="anyURI">
+    <desc> Institution link</desc>
+  </doc>
+  <xsl:param name="parentURL">http://www.tei-c.org/</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="links" type="string">
+    <desc> Name of overall institution</desc>
+  </doc>
+  <xsl:param name="parentWords">Parent Institution</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="links" type="anyURI">
+    <desc> Link to search application</desc>
+  </doc>
+  <xsl:param name="searchURL">http://www.google.com</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="misc" type="anyURI">
+    <desc> The home page for these stylesheets</desc>
+  </doc>
+  <xsl:param name="teixslHome">http://www.tei-c.org/Stylesheets/</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="misc" type="boolean">
+    <desc> Process elements according to assumptions
+    of TEI P4</desc>
+  </doc>
+  <xsl:param name="teiP4Compat">false</xsl:param>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="misc" type="boolean">
+    <desc> Title, author and date is taken from the
+    &lt;teiHeader&gt; rather than looked for in the front matter</desc>
+  </doc>
+  <xsl:param name="useHeaderFrontMatter">false</xsl:param>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="misc" type="boolean">
+    <desc>Whether to attempt to work out a current date (set to true
+    for test results which won't differ</desc>
+  </doc>
+  <xsl:param name="useFixedDate">false</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="numbering">
+    <desc>[common] How to number sections in back matter</desc>
+  </doc>
+  <xsl:template name="numberBackDiv">
+    <xsl:if test="not($numberBackHeadings='')">
+      <xsl:number count="tei:div|tei:div1|tei:div2|tei:div3|tei:div4|tei:div5|tei:div6" format="A.1.1.1.1.1" level="multiple"/>
+    </xsl:if>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="numbering" type="boolean">
+    <desc> Automatically number figures in back
+    matter</desc>
+  </doc>
+  <xsl:param name="numberBackFigures">false</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="numbering" type="string">
+    <desc> How to construct heading numbering in
+    back matter</desc>
+  </doc>
+  <xsl:param name="numberBackHeadings">A.1</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="numbering" type="boolean">
+    <desc> Automatically number tables in back
+    matter</desc>
+  </doc>
+  <xsl:param name="numberBackTables">true</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="numbering">
+    <desc>[common] How to number sections in main matter</desc>
+  </doc>
+  <xsl:template name="numberBodyDiv">
+    <xsl:if test="$numberHeadings='true'">
+      <xsl:number count="tei:div|tei:div1|tei:div2|tei:div3|tei:div4|tei:div5|tei:div6" level="multiple"/>
+    </xsl:if>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="numbering" type="string">
+    <desc> How to construct heading numbering in
+    main matter</desc>
+  </doc>
+  <xsl:param name="numberBodyHeadings">1.1.1.1</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="numbering" type="boolean">
+    <desc> Automatically number figures</desc>
+  </doc>
+  <xsl:param name="numberFigures">true</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="numbering">
+    <desc>[common] How to number sections in front matter</desc>
+  </doc>
+  <xsl:template name="numberFrontDiv">
+    <xsl:param name="minimal"/>
+    <xsl:number count="tei:div|tei:div1|tei:div2|tei:div3|tei:div4|tei:div5|tei:div6" level="multiple"/>
+    <xsl:if test="$minimal='false'">
+      <xsl:value-of select="$numberSpacer"/>
+    </xsl:if>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="numbering" type="boolean">
+    <desc> Automatically number figures in
+    front matter</desc>
+  </doc>
+  <xsl:param name="numberFrontFigures">false</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="numbering" type="string">
+    <desc> How to construct heading numbering in
+    front matter</desc>
+  </doc>
+  <xsl:param name="numberFrontHeadings"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="numbering" type="boolean">
+    <desc> Automatically number tables in front
+    matter</desc>
+  </doc>
+  <xsl:param name="numberFrontTables">true</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="numbering" type="boolean">
+    <desc> Automatically number sections</desc>
+  </doc>
+  <xsl:param name="numberHeadings">true</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="numbering" type="integer">
+    <desc> Depth to which sections should be
+    numbered</desc>
+  </doc>
+  <xsl:param name="numberHeadingsDepth">9</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="numbering" type="boolean">
+    <desc> Automatically number tables</desc>
+  </doc>
+  <xsl:param name="numberTables">true</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="numbering" type="boolean">
+    <desc> Use value of "n" attribute to number
+    sections</desc>
+  </doc>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="numbering" type="boolean">
+    <desc>
+    Automatically number paragraphs.
+  </desc>
+  </doc>
+  <xsl:param name="numberParagraphs">false</xsl:param>
+  <xsl:param name="prenumberedHeadings">false</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="output" type="string">
+    <desc> The complete URL when the document is
+    being delivered from a web server (normally set by Apache or Cocoon)</desc>
+  </doc>
+  <xsl:param name="REQUEST"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="output" type="boolean">
+    <desc> Write to standard output channel</desc>
+  </doc>
+  <xsl:param name="STDOUT">true</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="style" type="string">
+    <desc> Display of &lt;pb&gt; element.
+    Choices are "visible", "active" and "none".</desc>
+  </doc>
+  <xsl:param name="pagebreakStyle">visible</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="style" type="string">
+    <desc> How to display Relax NG schema fragments
+    (rnc or rng)</desc>
+  </doc>
+  <xsl:param name="displayMode">rnc</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="style" type="boolean">
+    <desc> Provide minimal context for a link</desc>
+  </doc>
+  <xsl:param name="minimalCrossRef">false</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="style" type="string">
+    <desc> Character to insert at end of quote.</desc>
+  </doc>
+  <xsl:param name="postQuote">’</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="style" type="string">
+    <desc> Character to insert at start of quote</desc>
+  </doc>
+  <xsl:param name="preQuote">‘</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="tables" type="string">
+    <desc> Default alignment of table cells</desc>
+  </doc>
+  <xsl:param name="cellAlign">left</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="tables" type="string">
+    <desc> Default alignment of tables</desc>
+  </doc>
+  <xsl:param name="tableAlign">left</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="boolean">
+    <desc>
+Whether to make simplified display of ODD
+</desc>
+  </doc>
+  <xsl:param name="oddWeaveLite">false</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="string">
+    <desc>
+Paragraph indentation
+</desc>
+  </doc>
+  <xsl:param name="parIndent">1em</xsl:param>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="string">
+    <desc>
+      Style for formatted bibliography
+    </desc>
+  </doc>
+  <xsl:param name="biblioStyle"></xsl:param>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="string">
+    <desc>
+Default spacing between paragraphs
+</desc>
+  </doc>
+  <xsl:param name="parSkip">0pt</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="hook">
+    <desc>[common] Hook where actions can be inserted when making
+     a heading</desc>
+  </doc>
+  <xsl:template name="sectionHeadHook"/>
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/common2/tei-param.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/common2/tei.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/common2/tei.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/common2/tei.xsl	(revision 258)
@@ -0,0 +1,149 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:fo="http://www.w3.org/1999/XSL/Format"
+                xmlns:s="http://www.ascc.net/xml/schematron"
+                xmlns:fotex="http://www.tug.org/fotex"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                
+                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                xmlns:sch="http://purl.oclc.org/dsdl/schematron"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                exclude-result-prefixes="s tei fotex xsi sch fo"
+                version="2.0">
+  <xsl:import href="tei-param.xsl"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet definitions common for all of HTML, FO and LaTeX
+      outputs </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: tei.xsl 10010 2012-01-03 19:35:49Z rahtz $</p>
+         <p>Copyright: 2011, TEI Consortium</p>
+      </desc>
+   </doc>
+  <xsl:include href="core.xsl"/>
+  <xsl:include href="textstructure.xsl"/>
+  <xsl:include href="header.xsl"/>
+  <xsl:include href="linking.xsl"/>
+  <xsl:include href="figures.xsl"/>
+  <xsl:include href="textcrit.xsl"/>
+  <xsl:include href="i18n.xsl"/>
+  <xsl:include href="functions.xsl"/>
+
+  <xsl:key name="APP" match="tei:app" use="1"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" type="string">
+      <desc> Name of XSLT processor.</desc>
+   </doc>
+  <xsl:variable name="processor">
+      <xsl:value-of select="system-property('xsl:vendor')"/>
+  </xsl:variable>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[common] turn names into quote characters<param name="quote">quote</param>
+      </desc>
+   </doc>
+  <xsl:template name="getQuote">
+      <xsl:param name="quote"/>
+      <xsl:choose>
+         <xsl:when test="$quote='laquo'">«</xsl:when>
+         <xsl:when test="$quote='ldquo'">“</xsl:when>
+         <xsl:when test="$quote='ldquor'">„</xsl:when>
+         <xsl:when test="$quote='lsaquo'">‹</xsl:when>
+         <xsl:when test="$quote='lsquo'">‘</xsl:when>
+         <xsl:when test="$quote='lsquor'">‚</xsl:when>
+         <xsl:when test="$quote='mdash'">—</xsl:when>
+         <xsl:when test="$quote='raquo'">»</xsl:when>
+         <xsl:when test="$quote='rdquo'">”</xsl:when>
+         <xsl:when test="$quote='rdquor'">‟</xsl:when>
+         <xsl:when test="$quote='rsaquo'">›</xsl:when>
+         <xsl:when test="$quote='rsquo'">’</xsl:when>
+         <xsl:when test="$quote='rsquor'">‛</xsl:when>
+         <xsl:otherwise>?</xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  
+  <xsl:template name="whatsTheDate">
+    <xsl:choose>
+      	<xsl:when test="$useFixedDate='true'">1970-01-01</xsl:when>
+	<xsl:otherwise>
+	  <xsl:value-of
+	      select="format-dateTime(current-dateTime(),'[Y]-[M02]-[D02]T[H02]:[m02]:[s02]Z')"/>
+	</xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  
+
+   <xsl:template name="makeQuote">
+      <xsl:variable name="pre">
+         <xsl:choose>
+            <xsl:when test="contains(@rend,'PRE')">
+	              <xsl:choose>
+	                 <xsl:when test="contains(@rend,'POST')">
+	                    <xsl:call-template name="getQuote">
+	                       <xsl:with-param name="quote"
+                                        select="normalize-space(substring-before(substring-after(@rend,'PRE'),'POST'))"/>
+	                    </xsl:call-template>
+	                 </xsl:when>
+	                 <xsl:otherwise>
+	                    <xsl:call-template name="getQuote">
+	                       <xsl:with-param name="quote" select="normalize-space(substring-after(@rend,'PRE'))"/>
+	                    </xsl:call-template>
+	                 </xsl:otherwise>
+	              </xsl:choose>
+            </xsl:when>
+            <xsl:otherwise>
+	              <xsl:value-of select="$preQuote"/>
+            </xsl:otherwise>
+         </xsl:choose>
+      </xsl:variable>
+      <xsl:variable name="post">
+         <xsl:choose>
+            <xsl:when test="contains(@rend,'POST')">
+	              <xsl:call-template name="getQuote">
+	                 <xsl:with-param name="quote" select="normalize-space(substring-after(@rend,'POST'))"/>
+	              </xsl:call-template>
+            </xsl:when>
+            <xsl:otherwise>
+	              <xsl:value-of select="$postQuote"/>
+            </xsl:otherwise>
+         </xsl:choose>
+      </xsl:variable>
+      <xsl:value-of select="$pre"/>
+      <xsl:apply-templates/>
+      <xsl:value-of select="$post"/>
+   </xsl:template>
+
+  <xsl:template name="tei:makeText">
+    <xsl:param name="letters"/>
+    <xsl:value-of select="$letters"/>
+  </xsl:template>
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/common2/tei.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/msdescription.css
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/msdescription.css	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/msdescription.css	(revision 258)
@@ -0,0 +1,638 @@
+/* original from Matthew Driscoll for editing
+   
+   edited by Sebastian Rahtz March 2009
+   for general HTML display
+*/
+msDesc {
+    display: block;
+    font-family: "Junicode";
+    margin-left: 25pt;
+    margin-right: 15pt;
+    margin-top: 15pt;
+    margin-bottom: 15pt;
+    font-size: 12pt;
+    line-height: 14pt;
+    text-align: left
+}
+msDesc>msIdentifier {
+    display: block;
+    font-size: 26pt;
+    line-height: 28pt;
+    color: #ad1010
+}
+msIdentifier country {
+    display: none
+}
+msIdentifier settlement {
+    display: none
+}
+msIdentifier repository {
+    display: none
+}
+msIdentifier altIdentifier {
+    display: none
+}
+msName[type="nickname"]:before {
+    content: "(\201C"
+}
+msName[type="nickname"]:after {
+    content: "\201D)"
+}
+head, msContents, history, additional, seal {
+    padding-top: 3pt;
+    padding-bottom: 2pt;
+    display: block
+}
+physDesc, supportDesc, objectDesc, layoutDesc, decoDesc, sealDesc {
+    display: block;
+    margin-bottom: 4pt;
+}
+physDesc:before {
+    content: "Physical description:";
+    font-weight: 600;
+    font-variant: small-caps;
+    font-size: 120%;
+}
+history:before {
+    content: "History:";
+    display: block;
+    font-weight: 600;
+    font-variant: small-caps;
+    font-size: 120%
+}
+
+head {
+    font-size: 16pt;
+    line-height: 19pt
+}
+title {
+    display: inline;
+}
+head title {
+    font-style: italic
+}
+head>title:after {
+    content: ". "
+}
+head>origPlace:after {
+    content: ", "
+}
+head>origDate:after {
+    content: "."
+}
+head>textLang:after {
+    content: "."
+}
+head note {
+    display: block;
+    padding-top: 10pt;
+    font-size: 13pt
+}
+msItem[n]:before {
+    font-weight: 600;
+    content: attr(n) ". "
+}
+msContents:before {
+    content: "Contents:";
+    font-weight: 600;
+    font-variant: small-caps;
+    font-size: 120%
+}
+msItem {
+    display: block;
+    margin-left: 10pt
+}
+msItem>msItem {
+    display: block;
+    margin-left: 15pt
+}
+msItem[n]>locus:before {
+    content: "("
+}
+msItem[n]>locus:after {
+    content: ")"
+}
+msItem>title {
+    font-weight: 600;
+    font-size: 100%;
+    letter-spacing: 1px
+}
+msItem>title:after {
+    content: ". "
+}
+rubric {
+    display: block
+}
+rubric:before {
+    content: "Rubric: \201C"
+}
+rubric:after {
+    content: "\201D "
+}
+incipit {
+    display: block
+}
+incipit:before {
+    content: "Incipit: \201C"
+}
+incipit:after {
+    content: "\201D "
+}
+explicit {
+    display: block
+}
+explicit:before {
+    content: "Explicit: \201C"
+}
+explicit:after {
+    content: "\201D "
+}
+incipit[defective="yes"]:before {
+    content: "Begins: \201C"
+}
+explicit[defective="yes"]:before {
+    content: "Ends: \201C"
+}
+rubric[type="final"]:before {
+    content: "Final rubric: \201C"
+}
+rubric[type="final"]:after {
+    content: "\201D "
+}
+colophon {
+    display: block
+}
+colophon:before {
+    content: "Colophon: \201C"
+}
+colophon:after {
+    content: "\201D "
+}
+msItem>textLang {
+    display: block
+}
+msItem>textLang:before {
+    content: "Language of text: "
+}
+msItem>textLang:after {
+    content: "."
+}
+history origin {
+    display: block
+}
+history origin:before {
+    content: "Origin:";
+    font-weight: bold
+}
+history provenance:before {
+    content: "Provenance: ";
+    font-weight: bold
+}
+history provenance {
+    display: block
+}
+history acquisition:before {
+    content: "Acquisition: ";
+    font-weight: bold
+}
+history acquisition {
+    display: block
+}
+msItem>listBibl {
+    display: block;
+    list-style-type: none;
+    margin-left: 20pt
+}
+msItem>listBibl>bibl {
+    display: list-item;
+    margin-left: 30pt
+}
+msItem>listBibl:before {
+    content: "Text editions:";
+    display: block;
+    font-weight: 600
+}
+msItem>bibl {
+    display: block;
+    margin-left: 20pt
+}
+msItem>bibl:before {
+    content: "Text edition: ";
+    font-weight: 600
+}
+msItem>listBibl>bibl:after {
+    content: "."
+}
+author:after {
+    content: ", "
+}
+bibl>editor:after {
+    content: ", ";
+    text-align: left
+}
+bibl title[level="m"] {
+    font-style: italic;
+    font-weight: normal;
+    font-size: 100%
+}
+bibl title[level="j"] {
+    font-style: italic;
+    font-weight: normal;
+    font-size: 100%
+}
+bibl title[level="s"] {
+    font-style: normal;
+    font-weight: normal;
+    font-size: 100%
+}
+bibl title[level="a"] {
+    font-style: normal;
+    font-weight: normal;
+    font-size: 100%
+}
+bibl title[level="a"]:before {
+    content: " \201C"
+}
+bibl title[level="a"]:after {
+    content: "\201D, "
+}
+bibl title[level="s"]:before {
+    content: ", "
+}
+msItem bibl title {
+    font-style: italic
+}
+biblScope[type="pages"]:before {
+    content: ", pp. "
+}
+imprint:before {
+    content: "("
+}
+imprint:after {
+    content: ")"
+}
+pubPlace:after {
+    content: ","
+}
+bibl>note:before {
+    content: " ("
+}
+bibl>note:after {
+    content: ")"
+}
+additional>listBibl>bibl:after {
+    content: "."
+}
+q:before {
+    content: "\201C"
+}
+q:after {
+    content: "\201D"
+}
+q q:before {
+    content: "�"
+}
+q q:after {
+    content: "�"
+}
+q[type="block"] {
+    display: block;
+    margin-left: 15pt;
+    font-size: 12pt;
+    line-height: 14pt
+}
+q[type="block"]:before {
+    content: ""
+}
+q[type="block"]:after {
+    content: ""
+}
+msItem note:before {
+    content: " ("
+}
+msItem note:after {
+    content: ")"
+}
+form {
+    display: block
+}
+form:before {
+    content: "Form: ";
+    font-weight: bold
+}
+support {
+    display: block
+}
+support:before {
+    content: "Support: ";
+    font-weight: bold
+}
+extent {
+    display: block
+}
+extent:before {
+    content: "No. of leaves: ";
+    font-weight: bold;
+    display: block
+}
+collation {
+    display: block
+}
+collation:before {
+    content: "Collation: ";
+    font-weight: bold
+}
+layout {
+    display: block
+}
+layout:before {
+    content: "Layout: ";
+    font-weight: bold
+}
+msWriting {
+    display: block
+}
+msWriting:before {
+    content: "Script: ";
+    font-weight: bold
+}
+musicNotation {
+    display: block
+}
+musicNotation:before {
+    content: "Musical notation: ";
+    font-weight: bold
+}
+decoDesc:before {
+    content: "Decoration: ";
+    font-weight: bold
+}
+decoNote {
+    display: list-item;
+    margin-left: 16pt;
+}
+bindingDesc {
+    display: block
+}
+bindingDesc:before {
+    content: "Binding: ";
+    font-weight: bold
+}
+foliation {
+    display: block
+}
+foliation:before {
+    content: "Foliation: ";
+    font-weight: bold
+}
+additions {
+    display: block
+}
+additions:before {
+    content: "Additions: ";
+    font-weight: bold
+}
+condition {
+    display: block
+}
+condition:before {
+    content: "Condition: ";
+    font-weight: bold
+}
+dimensions[type="leaf"] {
+    display: block
+}
+dimensions[type="leaf"]:before {
+    content: "Size of leaves: ";
+    font-weight: bold;
+    display: block
+}
+dimensions height:after {
+    content: " x "
+}
+dimensions:after {
+    content: " mm."
+}
+dimensions depth:before {
+    content: " x "
+}
+recordHist {
+    display: block
+}
+recordHist:before {
+    content: "Record history: ";
+    font-weight: bold
+}
+availability {
+    display: block
+}
+availability:before {
+    content: "Availability: ";
+    font-weight: bold
+}
+custodialHist {
+    display: block
+}
+custodialHist:before {
+    content: "Custodial history: ";
+    font-weight: bold
+}
+custEvent {
+    display: list-item;
+    list-style-type: none;
+    margin-left: 30pt
+}
+surrogates {
+    display: block
+}
+surrogates:before {
+    content: "Surrogates: ";
+    font-weight: bold
+}
+surrogates>p>listBibl {
+    display: block;
+}
+surrogates>p>listBibl>bibl {
+    display: list-item;
+    margin-left: 30pt
+}
+title[type="gmd"]:before {
+    content: "Format: "
+}
+title[type="gmd"]:after {
+    content: ". "
+}
+surrogates idno:before {
+    content: "ID no.: "
+}
+surrogates idno:after {
+    content: ". "
+}
+surrogates bibl date:before {
+    content: "Date created: "
+}
+accMat {
+    display: block
+}
+accMat:before {
+    content: "Accompanying material: ";
+    font-weight: bold
+}
+additional:before {
+    content: "Additional:";
+    display: block;
+    font-weight: 600;
+    font-variant: small-caps;
+    font-size: 120%
+}
+additional>listBibl {
+    display: block;
+    list-style-type: none;
+    margin-top: 10pt
+}
+additional>listBibl:before {
+    content: "Bibliography:";
+    display: block;
+    font-weight: 600;
+    font-variant: small-caps;
+    font-size: 120%
+}
+additional>listBibl>bibl {
+    text-align: left;
+    display: list-item;
+    margin-left: 30pt
+}
+list {
+    display: block;
+}
+list item {
+    display: list-item;
+    margin-left: 30pt
+}
+q item {
+    list-style-type: none
+}
+item locus:after {
+    content: ": "
+}
+pb:before {
+    font-weight: 600;
+    content: "|" attr(n) "|"
+}
+lb[n] {
+    display: list-item;
+    list-style-type: none;
+    margin-left: 30pt;
+}
+lb[type="hyphenated"]:before {
+    content: "-|"
+}
+lb[n]:after {
+    content: attr(n);
+}
+supplied[reason="damage"]:before {
+    content: "<"
+}
+supplied[reason="damage"]:after {
+    content: ">"
+}
+supplied[reason="illegible"]:before {
+    content: "["
+}
+supplied[reason="illegible"]:after {
+    content: "]"
+}
+supplied[reason="omitted"]:before {
+    content: "\27E8"
+}
+supplied[reason="omitted"]:after {
+    content: "\27E9"
+}
+gap:before {
+    content: " [...]"
+}
+expan {
+    font-style: italic
+}
+foreign {
+    font-style: italic
+}
+ref {
+    font-style: italic
+}
+hi[rend="sup"] {
+    font-size: .83em;
+    vertical-align: super
+}
+hi[rend="underline"] {
+    text-decoration: underline
+}
+hi[rend="bold"] {
+    font-weight: bold
+}
+hi[rend="italic"] {
+    font-style: italic
+}
+del[rend="overstrike"] {
+    text-decoration: line-through
+}
+note>title {
+    font-style: italic
+}
+p {
+    display: block
+}
+p>p {
+    display: block;
+    margin-left: 15pt;
+    margin-right: 15pt;
+    margin-top: 2pt;
+    margin-bottom: 2pt;
+    font-style: normal;
+    font-size: 12pt;
+    line-height: 13pt
+}
+lg {
+    display: block;
+    margin-bottom: 10pt
+}
+l {
+    display: block
+}
+msPart {
+    display: block;
+    margin-top: 15pt;
+    margin-bottom: 15pt
+}
+msPart idno {
+    display: block;
+    font-size: 16pt
+}
+hi[rend="scap"] {
+    font-size: 65%
+}
+hi[rend="lig"] {
+    letter-spacing: -4px
+}
+publisher {
+    display: inline;
+}
+choice > abbr {
+    display: none;
+}
+choice > orig {
+    display: none;
+}
+choice > expan {
+    font-style: normal
+}
+expan > ex:before {
+    content: "(";
+}
+expan > ex:after {
+    content: ")";
+}
+
+placeName, persName, name, genName, geogName, roleName {
+        display: inline;
+}
\ No newline at end of file
Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/rdf/rdf.odd
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/rdf/rdf.odd	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/rdf/rdf.odd	(revision 258)
@@ -0,0 +1,30 @@
+<TEI xml:lang="en" xmlns="http://www.tei-c.org/ns/1.0" >
+   <teiHeader>
+      <fileDesc>
+         <titleStmt>
+            <title>Mapping TEI to RDF</title>
+	    <author>Sebastian Rahtz</author>
+         </titleStmt>
+         <publicationStmt>
+	   <p> </p>
+	 </publicationStmt>
+         <sourceDesc>
+            <p>authored from scratch</p>
+         </sourceDesc>
+      </fileDesc>
+   </teiHeader>
+   <text>
+     <body>
+       <schemaSpec ident="rdf" start="TEI"> 
+	 <moduleRef key="header"/> 
+	 <moduleRef key="core"/> 
+	 <moduleRef key="tei"/> 
+	 <moduleRef key="textstructure"/> 
+	 <moduleRef key="namesdates"/> 
+	 <moduleRef key="linking"/> 
+	 <specGrpRef target="crm.odd#crm"/>
+	 <specGrpRef target="crm.odd#properties"/>
+       </schemaSpec> 
+     </body>
+   </text>
+</TEI>
Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/rdf/rdf.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/rdf/rdf.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/rdf/rdf.xsl	(revision 258)
@@ -0,0 +1,409 @@
+<?xml version="1.0"?>
+<xsl:stylesheet 
+    xmlns:xs="http://www.w3.org/2001/XMLSchema" 
+    xmlns:oo="http://purl.org/openorg/"
+    xmlns="http://purl.org/NET/crm-owl#" 
+    xmlns:tei="http://www.tei-c.org/ns/1.0" 
+    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
+    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" 
+    xmlns:owl="http://www.w3.org/2002/07/owl#" 
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema#" 
+    xmlns:crm="http://purl.org/NET/crm-owl#" 
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:html="http://www.w3.org/1999/xhtml"
+    version="1.0" 
+    xmlns:foaf="http://xmlns.com/foaf/0.1/"
+    xmlns:service="http://purl.org/service/"
+    xmlns:ox-service="http://vocab.ox.ac.uk/service/"
+    exclude-result-prefixes="tei rdf rdfs owl xsd crm xsl xs oo foaf
+    service ox-service">
+
+  <xsl:param name="REQUEST">/</xsl:param>
+  <xsl:param name="SERVER">http://www.oucs.ox.ac.uk</xsl:param>
+
+  <xsl:output encoding="utf-8" method="xml" indent="yes"/>
+
+  <xsl:key name="persons" match="persName" use="@ref"/>
+
+  <xsl:template match="/">
+    <rdf:RDF>
+      <xsl:apply-templates/>
+    </rdf:RDF>
+  </xsl:template>
+
+  <xsl:template match="html:link[@rev|@rel]">
+    <service:Service
+	rdf:about="{@href}">
+      <xsl:if test="@rev='ox-service:serviceLevelDescription'">
+	<rdfs:label>
+	  <xsl:value-of
+	      select="ancestor::tei:TEI/tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:title|ancestor::TEI.2/teiHeader/fileDesc/titleStmt/title"/>
+	</rdfs:label>
+	<service:maintainedBy>
+	  <foaf:Group>
+	    <xsl:attribute name="rdf:about">
+	      <xsl:value-of select="substring-before(@href,'service')"/>
+	      <xsl:text>group</xsl:text>
+	      <xsl:value-of select="substring-after(@href,'service')"/>
+	    </xsl:attribute>
+	    <foaf:mbox rdf:resource="mailto:{ancestor::tei:TEI/tei:teiHeader/tei:fileDesc/tei:publicationStmt/tei:authority|ancestor::TEI.2/teiHeader/fileDesc/publicationStmt/authority}"/>
+	  </foaf:Group>
+	</service:maintainedBy>
+	<oo:contact>
+	    <xsl:attribute name="rdf:resource">
+	      <xsl:value-of select="substring-before(@href,'service')"/>
+	      <xsl:text>group</xsl:text>
+	      <xsl:value-of select="substring-after(@href,'service')"/>
+	    </xsl:attribute>
+	</oo:contact>
+
+      </xsl:if>
+      <xsl:element name="{@rev|@rel}">
+	<xsl:attribute name="rdf:resource">
+	  <xsl:value-of select="$SERVER"/>
+	  <xsl:value-of select="$REQUEST"/>
+	</xsl:attribute>
+      </xsl:element>
+
+
+    </service:Service>
+  </xsl:template>
+<!--  
+  <rdf:RDF
+    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
+    xmlns:foaf="http://xmlns.com/foaf/0.1/"
+    xmlns:oo="http://purl.org/openorg/"
+    xmlns:service="http://purl.org/service/"
+    xmlns:ox-service="http://vocab.ox.ac.uk/service/">
+  <service:Service rdf:about="http://data.ox.ac.uk/id/service/oucs/nexus">
+    <rdfs:label>Nexus</rdfs:label>
+    <service:provider rdf:resource="http://oxpoints.oucs.ox.ac.uk/id/23232373"/>
+    <service:maintainedBy>
+      <foaf:Group rdf:about="http://data.ox.ac.uk/id/group/nexus-team">
+        <rdfs:label>Nexus Team</rdfs:label>
+        <org:subOrganizationOf rdf:resource="http://oxpoints.oucs.ox.ac.uk/id/23232373"/>
+        <foaf:mbox rdf:resource="mailto:nexus@oucs.ox.ac.uk"/>
+      </foaf:Group>
+    </service:maintainedBy>
+    <oo:contact rdf:resource="http://data.ox.ac.uk/id/group/nexus-team"/>
+
+    <service:subService>
+      <service:Service rdf:about="http://data.ox.ac.uk/id/service/oucs/nexus/exchange">
+        <rdfs:label>Nexus Exchange</rdfs:label>
+        <foaf:homepage rdf:resource="http://www.oucs.ox.ac.uk/nexus/email/"/>
+        <service:software rdf:resource="http://dbpedia.org/resource/Microsoft_Exchange_Server"/>
+        <service:provides rdf:resource="http://dbpedia.org/resource/Email"/>
+
+        <ox-service:serviceLevelDescription rdf:resource="http://www.oucs.ox.ac.uk/internal/sld/nexus-exchange.xml"/>
+        <service:interface>
+          <service:Interface rdf:about="http://data.ox.ac.uk/id/service-interface/oucs/nexus/exchange/http">
+            <service:protocol rdf:resource="http://dbpedia.org/resource/HTTP_Secure"/>
+            <service:endpoint rdf:resource="https://nexus.ox.ac.uk/"/>
+          </service:Interface>
+        </service:interface>
+        <service:interface>
+          <service:Interface rdf:about="http://data.ox.ac.uk/id/service-interface/oucs/nexus/exchange/imaps">
+            <service:protocol rdf:resource="http://dbpedia.org/resource/Internet_Message_Access_Protocol"/>
+            <service:endpoint rdf:resource="imaps://imap.nexus.ox.ac.uk/"/>
+          </service:Interface>
+        </service:interface>
+      </service:Service>
+    </service:subService>
+
+    <service:subService>
+      <service:Service rdf:about="http://data.ox.ac.uk/id/service/oucs/nexus/sharepoint">
+        <rdfs:label>Nexus Sharepoint</rdfs:label>
+        <foaf:homepage rdf:resource="http://www.oucs.ox.ac.uk/nexus/sharepoint/"/>
+        <service:software rdf:resource="http://dbpedia.org/resource/Microsoft_SharePoint_Server"/>
+        <service:provides rdf:resource="http://dbpedia.org/resource/Collaborative_software"/>
+        <ox-service:serviceLevelDescription rdf:resource="http://www.oucs.ox.ac.uk/internal/sld/nexus-sharepoint.xml"/>
+        <service:interface>
+          <service:Interface rdf:about="http://data.ox.ac.uk/id/service-interface/oucs/nexus/sharepoint/http">
+            <service:protocol rdf:resource="http://dbpedia.org/resource/HTTP_Secure"/>
+            <service:endpoint rdf:resource="https://sharepoint.nexus.ox.ac.uk/"/>
+          </service:Interface>
+        </service:interface>
+      </service:Service>
+    </service:subService>
+  </service:Service>
+</rdf:RDF>
+
+
+
+<link rel="alternate" type="application/rdf+xml" href="nexus.rdf"/>
+<link rel="foaf:primaryTopic" href="http://data.ox.ac.uk/id/service/oucs/nexus"/>
+
+
+<link rev="foaf:homepage" href="http://data.ox.ac.uk/id/service/oucs/nexus"/>
+
+<http://data.ox.ac.uk/id/service/oucs/nexus> <http://www.xmlns.com/foaf/0.1/homepage> <http://nexus.ox.ac.uk/>
+
+<rdf:RDF>
+  <rdf:Description rdf:about="http://www.oucs.ox.ac.uk/internal/sld/nexus.xml">
+    <foaf:primaryTopic rdf:resource="http://data.ox.ac.uk/id/service/oucs/nexus"/>
+  </rdf:Description>
+  <rdf:Description rdf:about="http://data.ox.ac.uk/id/service/oucs/nexus">
+    <foaf:homepage rdf:resource="http://www.oucs.ox.ac.uk/nexus/"/>
+    <ox-service:serviceLevelDescription rdf:resource="http://www.oucs.ox.ac.uk/internal/sld/nexus.xml"/>
+  </rdf:Description>
+</rdf:RDF>
+
+-->
+
+  <xsl:template name="teiname">
+    <xsl:choose>
+      <xsl:when test="@type='place'">
+        <xsl:call-template name="E53"/>
+      </xsl:when>
+      <xsl:when test="@type='person'">
+        <xsl:call-template name="E21"/>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="E53">
+    <E53_Place>
+      <xsl:call-template name="makeID"/>
+      <xsl:apply-templates/>
+    </E53_Place>
+  </xsl:template>
+
+  <xsl:template name="E21">
+    <E21_Person>
+      <xsl:call-template name="makeID"/>
+      <xsl:apply-templates/>
+    </E21_Person>
+  </xsl:template>
+
+  <xsl:template name="E74">
+    <E74_Place>
+      <xsl:apply-templates/>
+    </E74_Place>
+  </xsl:template>
+
+  <xsl:template name="E5">
+    <P11i_participated_in>
+      <E5_Event>
+      </E5_Event>
+    </P11i_participated_in>
+  </xsl:template>
+
+  <xsl:template name="E47">
+    <P87_is_identified_by>
+      <E47_Place_Spatial_Coordinates>
+	<rdf:value>
+	  <xsl:value-of select="."/>
+	</rdf:value>
+      </E47_Place_Spatial_Coordinates>
+    </P87_is_identified_by>
+  </xsl:template>
+
+  <xsl:template name="E69">
+    <P100i_died_in>
+      <E69_Death>
+	<P4_has_time-span>
+	  <E52_Time-Span>
+	    <P82_at_some_time_within>
+	      <E61_Time_Primitive>
+		<xsl:call-template name="calc-date-value"/>
+	      </E61_Time_Primitive>
+	    </P82_at_some_time_within>
+	  </E52_Time-Span>
+	</P4_has_time-span>
+      </E69_Death>
+    </P100i_died_in>
+  </xsl:template>
+
+  <xsl:template name="E67">
+    <P98i_was_born>
+      <E67_Birth>
+	<P4_has_time-span>
+	  <E52_Time-Span>
+	    <P82_at_some_time_within>
+	      <E61_Time_Primitive>
+		<xsl:call-template name="calc-date-value"/>
+	      </E61_Time_Primitive>
+	    </P82_at_some_time_within>
+	  </E52_Time-Span>
+	</P4_has_time-span>
+	<P7_took_place_at rdf:resource="{tei:makeID(.)}/{placeName/@key}"/>
+      </E67_Birth>
+    </P98i_was_born>
+  </xsl:template>
+
+  <xsl:template name="E82">
+    <xsl:choose>
+      <xsl:when test="parent::person">
+	<P131_is_identified_by>
+	  <xsl:copy-of select="@xml:lang"/>
+	  <E82_Actor_Appellation>
+	    <rdf:value>
+	      <xsl:value-of select="normalize-space(.)"/>
+	    </rdf:value>
+	  </E82_Actor_Appellation>
+	</P131_is_identified_by>
+      </xsl:when>
+      <xsl:when test="not(@ref)">
+	<E21_Person><xsl:call-template name="makeID"/>
+	  <P131_is_identified_by>
+	    <xsl:copy-of select="@xml:lang"/>
+	    <E82_Actor_Appellation>
+	      <rdf:value>
+		<xsl:value-of select="normalize-space(.)"/>
+	      </rdf:value>
+	    </E82_Actor_Appellation>
+	  </P131_is_identified_by>
+	</E21_Person>
+      </xsl:when>
+      <xsl:when test="generate-id(.) = generate-id(key('persons',@ref)[1])">
+	<E21_Person><xsl:call-template name="makeID"/>
+	  <P131_is_identified_by>
+	    <xsl:copy-of select="@xml:lang"/>
+	    <E82_Actor_Appellation>
+	      <rdf:value>
+		<xsl:value-of select="normalize-space(.)"/>
+	      </rdf:value>
+	    </E82_Actor_Appellation>
+	  </P131_is_identified_by>
+	</E21_Person>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="E48">
+    <xsl:choose>
+      <xsl:when test="parent::place">
+	<P87_is_identified_by>
+	  <xsl:copy-of select="@xml:lang"/>
+	  <E48_Place_Name>
+	    <rdf:value>
+	      <xsl:value-of select="normalize-space(.)"/>
+	    </rdf:value>
+	  </E48_Place_Name>
+	</P87_is_identified_by>
+      </xsl:when>
+      <xsl:when test=".=''"/>
+      <xsl:otherwise>
+	<E53_Place><xsl:call-template name="makeID"/>
+	  <P87_is_identified_by>
+	    <xsl:copy-of select="@xml:lang"/>
+	    <E48_Place_Name>
+	      <rdf:value>
+		<xsl:value-of select="normalize-space(.)"/>
+	      </rdf:value>
+	    </E48_Place_Name>
+	  </P87_is_identified_by>
+	</E53_Place>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="P74">
+    <P74_has_current_or_former_residence>
+      <xsl:choose>
+	<xsl:when test="placeName">
+	  <xsl:apply-templates/>
+	</xsl:when>
+	<xsl:otherwise>
+	  <E53_Place><xsl:call-template name="makeID"/>
+	    <P87_is_identified_by>
+	      <xsl:copy-of select="@xml:lang"/>
+	      <E53_Place_Name>
+		<rdf:value>
+		  <xsl:value-of select="normalize-space(.)"/>
+		</rdf:value>
+	      </E53_Place_Name>
+	    </P87_is_identified_by>
+	  </E53_Place>
+	</xsl:otherwise>
+      </xsl:choose>
+    </P74_has_current_or_former_residence>
+  </xsl:template>
+
+  <xsl:template name="makeID">
+    <xsl:variable name="id">
+      <xsl:choose>
+	<xsl:when test="ancestor-or-self::*/@xml:base">
+	  <xsl:value-of select="ancestor-or-self::*[@xml:base][1]/@xml:base"/>
+	</xsl:when>
+	<xsl:otherwise>
+	  <xsl:text>http://www.example.com/id</xsl:text>
+	</xsl:otherwise>
+      </xsl:choose>
+      <xsl:choose>
+	<xsl:when test="@ref">
+	  <xsl:value-of select="@ref"/>
+	</xsl:when>
+	<xsl:when test="@xml:id">
+	  <xsl:value-of select="@xml:id"/>
+	</xsl:when>
+	<xsl:otherwise>
+	  <xsl:text>/</xsl:text>
+	  <xsl:number level="any"/>
+	</xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:attribute name="rdf:about">
+      <xsl:value-of select="$id"/>
+    </xsl:attribute>
+  </xsl:template>
+
+  <xsl:template name="calc-date-value">
+    <rdf:value>
+      <xsl:choose>
+        <xsl:when test="@when">
+          <xsl:value-of select="@when"/>
+        </xsl:when>
+        <xsl:when test="@notBefore and @notAfter">
+          <xsl:value-of select="@notBefore"/>
+          <xsl:text> to  </xsl:text>
+          <xsl:value-of select="@notAfter"/>
+        </xsl:when>
+        <xsl:when test="@notBefore">
+          <xsl:value-of select="@notBefore"/>
+          <xsl:text> to </xsl:text>
+        </xsl:when>
+        <xsl:when test="@notAfter">
+          <xsl:text> to </xsl:text>
+          <xsl:value-of select="@notAfter"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="normalize-space(.)"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </rdf:value>
+  </xsl:template>
+
+
+  <xsl:function name="tei:makeID" as="xs:string*">
+    <xsl:param name="here"/>
+      <xsl:for-each select="$here">
+	<xsl:variable name="id">
+        <xsl:choose>
+          <xsl:when test="ancestor-or-self::*/@xml:base">
+            <xsl:value-of select="ancestor-or-self::*[@xml:base][1]/@xml:base"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:text>http://www.example.com/id</xsl:text>
+          </xsl:otherwise>
+        </xsl:choose>
+        <xsl:choose>
+	  <xsl:when test="@ref">
+	    <xsl:value-of select="@ref"/>
+	  </xsl:when>
+          <xsl:when test="@xml:id">
+            <xsl:value-of select="@xml:id"/>
+          </xsl:when>
+          <xsl:otherwise>
+	    <xsl:text>/</xsl:text>
+            <xsl:number level="any"/>
+          </xsl:otherwise>
+        </xsl:choose>
+    </xsl:variable>
+      <xsl:value-of select="$id"/>
+      </xsl:for-each>
+  </xsl:function>
+
+
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/rdf/rdf.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/rdf/tei2rdf.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/rdf/tei2rdf.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/rdf/tei2rdf.xsl	(revision 258)
@@ -0,0 +1,114 @@
+<?xml version="1.0" encoding="utf-8"?>
+<XSL:stylesheet xmlns:XSL="http://www.w3.org/1999/XSL/Transform" version="2.0"
+                xpath-default-namespace="http://www.tei-c.org/ns/1.0">
+   <XSL:import href="../tools/getfiles.xsl"/>
+   <XSL:import href="crm.xsl"/>
+   <XSL:param name="corpus">./</XSL:param>
+   <XSL:template match="*">
+      <XSL:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
+   </XSL:template>
+   <XSL:template match="text()|comment()|@*|processing-instruction()"/>
+   <XSL:template match="name">
+      <XSL:call-template name="teiname"/>
+   </XSL:template>
+   <XSL:template match="date">
+      <XSL:call-template name="E52"/>
+   </XSL:template>
+   <XSL:template match="author">
+      <XSL:call-template name="E65"/>
+   </XSL:template>
+   <XSL:template match="title">
+      <XSL:call-template name="E35"/>
+   </XSL:template>
+   <XSL:template match="teiHeader">
+      <XSL:call-template name="E31"/>
+   </XSL:template>
+   <XSL:template match="TEI">
+      <XSL:call-template name="TEI"/>
+   </XSL:template>
+   <XSL:template match="persName">
+      <XSL:call-template name="E82"/>
+   </XSL:template>
+   <XSL:template match="placeName">
+      <XSL:call-template name="E48"/>
+   </XSL:template>
+   <XSL:template match="birth">
+      <XSL:call-template name="E67"/>
+   </XSL:template>
+   <XSL:template match="death">
+      <XSL:call-template name="E69"/>
+   </XSL:template>
+   <XSL:template match="event">
+      <XSL:call-template name="E5"/>
+   </XSL:template>
+   <XSL:template match="geo">
+      <XSL:call-template name="E47"/>
+   </XSL:template>
+   <XSL:template match="org">
+      <XSL:call-template name="E74"/>
+   </XSL:template>
+   <XSL:template match="person">
+      <XSL:call-template name="E21"/>
+   </XSL:template>
+   <XSL:template match="place">
+      <XSL:call-template name="E53"/>
+   </XSL:template>
+   <XSL:template match="residence">
+      <XSL:call-template name="P74"/>
+   </XSL:template>
+   <XSL:template match="ab">
+      <XSL:call-template name="anonblock"/>
+   </XSL:template>
+   <XSL:template name="typology">
+      <E55_Type xmlns="http://purl.org/NET/crm-owl#"
+                xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+                rdf:about="http://www.tei-c.org/type/place">
+         <label xmlns="http://www.w3.org/2000/01/rdf-schema#">place</label>
+      </E55_Type>
+      <E55_Type xmlns="http://purl.org/NET/crm-owl#"
+                xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+                rdf:about="http://www.tei-c.org/type/place/placeName">
+         <label xmlns="http://www.w3.org/2000/01/rdf-schema#">contains an absolute or relative place name. </label>
+         <P127_has_broader_term rdf:resource="http://www.tei-c.org/type/place"/>
+      </E55_Type>
+      <E55_Type xmlns="http://purl.org/NET/crm-owl#"
+                xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+                rdf:about="http://www.tei-c.org/type/place/bloc">
+         <label xmlns="http://www.w3.org/2000/01/rdf-schema#">(bloc) contains the name of a geo-political unit consisting of two or more nation states or
+    countries.</label>
+         <P127_has_broader_term rdf:resource="http://www.tei-c.org/type/place"/>
+      </E55_Type>
+      <E55_Type xmlns="http://purl.org/NET/crm-owl#"
+                xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+                rdf:about="http://www.tei-c.org/type/place/country">
+         <label xmlns="http://www.w3.org/2000/01/rdf-schema#">(country) contains the name of a geo-political unit, such as a nation, country, colony, or
+    commonwealth, larger than or administratively superior to a region and smaller than a bloc.</label>
+         <P127_has_broader_term rdf:resource="http://www.tei-c.org/type/place"/>
+      </E55_Type>
+      <E55_Type xmlns="http://purl.org/NET/crm-owl#"
+                xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+                rdf:about="http://www.tei-c.org/type/place/region">
+         <label xmlns="http://www.w3.org/2000/01/rdf-schema#">contains the name of an administrative unit such as a state, province, or county, larger
+    than a settlement, but smaller than a country.</label>
+         <P127_has_broader_term rdf:resource="http://www.tei-c.org/type/place"/>
+      </E55_Type>
+      <E55_Type xmlns="http://purl.org/NET/crm-owl#"
+                xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+                rdf:about="http://www.tei-c.org/type/place/district">
+         <label xmlns="http://www.w3.org/2000/01/rdf-schema#">contains the name of any kind of subdivision of a settlement, such as a parish, ward, or other administrative or geographic unit.</label>
+         <P127_has_broader_term rdf:resource="http://www.tei-c.org/type/place"/>
+      </E55_Type>
+      <E55_Type xmlns="http://purl.org/NET/crm-owl#"
+                xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+                rdf:about="http://www.tei-c.org/type/place/settlement">
+         <label xmlns="http://www.w3.org/2000/01/rdf-schema#">contains the name of a settlement such as a city, town, or village identified as a single geo-political or administrative unit.</label>
+         <P127_has_broader_term rdf:resource="http://www.tei-c.org/type/place"/>
+      </E55_Type>
+      <E55_Type xmlns="http://purl.org/NET/crm-owl#"
+                xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+                rdf:about="http://www.tei-c.org/type/place/geogName">
+         <label xmlns="http://www.w3.org/2000/01/rdf-schema#">(geographical name) a name associated with some geographical feature such as Windrush Valley or Mount Sinai.</label>
+         <P127_has_broader_term rdf:resource="http://www.tei-c.org/type/place"/>
+      </E55_Type>
+   </XSL:template>
+</XSL:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/rdf/tei2rdf.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/rdf/crm.odd
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/rdf/crm.odd	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/rdf/crm.odd	(revision 258)
@@ -0,0 +1,102 @@
+<?oxygen RNGSchema="tei_odds.rnc" type="compact"?>
+<TEI xml:lang="en" xmlns="http://www.tei-c.org/ns/1.0" >
+   <teiHeader>
+      <fileDesc>
+         <titleStmt>
+            <title>Mapping TEI to CIDOC CRM</title>
+	    <author>Sebastian Rahtz</author>
+         </titleStmt>
+         <publicationStmt>
+	   <p> </p>
+	 </publicationStmt>
+         <sourceDesc>
+            <p>authored from scratch</p>
+         </sourceDesc>
+      </fileDesc>
+   </teiHeader>
+   <text>
+     <body>
+       <specGrp xml:id="crm">
+<!--
+msDesc
+div[@type='inscription']
+-->
+
+	 <elementSpec ident="TEI" mode="change">
+	   <equiv filter="crm.xsl" mimeType="text/xsl" name="TEI"/>
+	 </elementSpec>
+
+	 <elementSpec ident="title" mode="change">
+	   <equiv filter="crm.xsl" mimeType="text/xsl" name="E35"
+		  uri="http://erlangen-crm.org/current/E35_Title"/>
+	 </elementSpec>
+
+	 <elementSpec ident="author" mode="change">
+	   <equiv filter="crm.xsl" mimeType="text/xsl" name="E65"
+		  uri="http://erlangen-crm.org/current/E65_creation"/>
+	 </elementSpec>
+
+	 <elementSpec ident="teiHeader" mode="change">
+	   <equiv filter="crm.xsl" mimeType="text/xsl" name="E31" uri="http://erlangen-crm.org/current/E31_Document"/>
+	 </elementSpec>
+
+	 <elementSpec ident="person" mode="change">
+	   <equiv filter="crm.xsl" mimeType="text/xsl" name="E21" uri="http://erlangen-crm.org/current/E21_Person"/>
+	 </elementSpec>
+	 <elementSpec ident="place" mode="change">
+	   <equiv filter="crm.xsl" mimeType="text/xsl" name="E53" uri="http://erlangen-crm.org/current/E53_Place"/>
+	 </elementSpec>
+	 <elementSpec ident="persName" mode="change">
+	   <equiv filter="crm.xsl" mimeType="text/xsl" name="E82" uri="http://erlangen-crm.org/current/E82_Actor_Appellation"/>
+	 </elementSpec>
+
+	 <elementSpec ident="placeName" mode="change">
+	   <equiv filter="crm.xsl" mimeType="text/xsl" name="E48"
+		 uri="http://erlangen-crm.org/current/E48_Place_Name"/>
+	 </elementSpec>
+
+	 <elementSpec ident="ab" mode="change">
+	   <equiv filter="crm.xsl" mimeType="text/xsl" name="anonblock"/>
+	 </elementSpec>
+       </specGrp>
+
+       <specGrp xml:id="properties">
+	 <elementSpec ident="date" mode="change">
+	   <equiv filter="crm.xsl" mimeType="text/xsl" name="E52" uri="http://erlangen-crm.org/current/E52_Time-Span"/>
+	 </elementSpec>
+	 <elementSpec ident="event" mode="change">
+	   <equiv filter="crm.xsl" mimeType="text/xsl" name="E5" uri="http://erlangen-crm.org/current/E5_Event"/>
+	 </elementSpec>
+	 <elementSpec ident="org" mode="change">
+	   <equiv filter="crm.xsl" mimeType="text/xsl" name="E74" uri="http://erlangen-crm.org/current/E74_Group"/>
+	 </elementSpec>
+	 <elementSpec ident="residence" mode="change">
+	   <equiv filter="crm.xsl" mimeType="text/xsl" name="P74" uri="http://erlangen-crm.org/current/P74_has_current_or_former_residence"/>
+	 </elementSpec>
+	 <elementSpec ident="birth" mode="change">
+	   <equiv filter="crm.xsl" mimeType="text/xsl" name="E67" uri="http://erlangen-crm.org/current/E67_Birth"/>
+	 </elementSpec>
+	 <elementSpec ident="death" mode="change">
+	   <equiv filter="crm.xsl" mimeType="text/xsl" name="E69" uri="http://erlangen-crm.org/current/E69_Death"/>
+	 </elementSpec>
+	 <elementSpec ident="geo" mode="change">
+	   <equiv filter="crm.xsl" mimeType="text/xsl" name="E47"
+		  uri="http://erlangen-crm.org/current/E47_Place_Spatial_Coordinates"/>
+	 </elementSpec>
+	 <elementSpec ident="name" mode="change">
+	   <equiv filter="crm.xsl" mimeType="text/xsl"
+		  name="teiname"/>
+	   <attList>
+	     <attDef ident="ref" mode="change" usage="req"/>
+	   </attList>
+	 </elementSpec>
+	 <classSpec ident="att.global" mode="change">
+	   <attList>
+	     <attDef ident="xml:id" mode="change" usage="req"/>
+	   </attList>
+	 </classSpec>
+       </specGrp>
+
+     </body>
+   </text>
+</TEI>
Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/rdf/crm.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/rdf/crm.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/rdf/crm.xsl	(revision 258)
@@ -0,0 +1,661 @@
+<?xml version="1.0"?>
+<xsl:stylesheet 
+    xmlns:xs="http://www.w3.org/2001/XMLSchema" 
+        xmlns="http://purl.org/NET/crm-owl#" 
+    xmlns:crm="http://purl.org/NET/crm-owl#" 
+    xmlns:tei="http://www.tei-c.org/ns/1.0" 
+    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
+    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" 
+    xmlns:owl="http://www.w3.org/2002/07/owl#" 
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema#" 
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    version="2.0" 
+    xpath-default-namespace="http://www.tei-c.org/ns/1.0" 
+    exclude-result-prefixes="tei rdf rdfs owl xsd crm xsl xs">
+  
+  <xsl:output encoding="utf-8" method="xml" indent="yes"/>
+
+  <xsl:key name="persons" match="persName" use="@ref"/>
+  <xsl:key name="Places" match="place[placeName]" use="placeName"/>
+  <xsl:key name="Idents" 
+	   match="crm:P131_is_identified_by"
+	   use="crm:E82_Actor_Appellation/@rdf:about"/>
+
+  <xsl:key name="Idents" 
+	   match="crm:P87_is_identified_by"
+	   use="crm:E48_Place_Name/@rdf:about"/>
+
+  <xsl:template name="TEI">
+    <xsl:choose>
+      <xsl:when test="parent::*">
+	<xsl:apply-templates/>
+      </xsl:when>
+      <xsl:otherwise>
+	<xsl:call-template name="doit"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="processAll">
+    <xsl:call-template name="doit"/>
+  </xsl:template>
+
+  <xsl:template name="doit">
+      <xsl:variable name="rdf1">
+	<rdf:RDF
+	    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
+	    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" 
+	    >
+	  <xsl:call-template name="typology"/>
+	  <xsl:apply-templates/>
+	</rdf:RDF>
+      </xsl:variable>
+      <xsl:apply-templates select="$rdf1" mode="rdf2"/>
+  </xsl:template>
+
+  <!-- clean up pass -->
+
+  <xsl:template match="crm:*[crm:E53_Place]" mode="rdf2">
+    <xsl:copy>
+      <xsl:attribute name="rdf:resource"
+			 select="crm:E53_Place/@rdf:about"/>
+    </xsl:copy>
+  </xsl:template>
+
+  <xsl:template match="crm:E53_Place" mode="rdf2"/>
+
+  <xsl:template match="crm:E53_Place" mode="rdf3">
+     <xsl:copy>
+      <xsl:apply-templates  select="*|@*|processing-instruction()|comment()|text()"
+	  mode="rdf2"/>
+     </xsl:copy>    
+  </xsl:template>
+
+  <xsl:template match="rdf:RDF" mode="rdf2">
+     <xsl:copy>
+      <xsl:apply-templates  select="*|@*|processing-instruction()|comment()|text()"
+	  mode="rdf2"/>
+     <xsl:apply-templates select=".//crm:E53_Place" mode="rdf3"/>
+     </xsl:copy>
+  </xsl:template>
+
+  <xsl:template match="*" mode="rdf2">
+     <xsl:copy>
+      <xsl:apply-templates
+	  select="*|@*|processing-instruction()|comment()|text()"
+	  mode="rdf2"/>
+     </xsl:copy>
+   </xsl:template>
+   
+   <xsl:template match="text()|comment()|@*|processing-instruction()"
+		 mode="rdf2">
+     <xsl:copy-of select="."/>
+   </xsl:template>
+
+   <!-- normal pass -->
+  <xsl:template name="E31">
+    <E31_Document xmlns="http://purl.org/NET/crm-owl#" 
+	rdf:about="{tei:makeID(.,'id')}">
+      <xsl:apply-templates select="fileDesc"/>
+    </E31_Document>
+    <xsl:apply-templates select="*[not(self::fileDesc)]"/>
+  </xsl:template>
+
+  <xsl:template name="anonblock">
+    <xsl:choose>
+      <xsl:when test="@type='dDay'">
+	<E5_Event rdf:about="{tei:makeID(.,'event')}">
+	  <rdf:value>
+	    <xsl:value-of select="."/>
+	  </rdf:value>
+	  <xsl:apply-templates/>
+	</E5_Event>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:template>
+  
+
+  <xsl:template name="teiname">
+    <xsl:choose>
+      <xsl:when test="@type='place'">
+        <xsl:call-template name="E53"/>
+      </xsl:when>
+      <xsl:when test="@type='person'">
+        <xsl:call-template name="E21"/>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="E53">
+      <xsl:choose>
+	<xsl:when test="ancestor::state"/>	
+	<xsl:when test="ancestor::trait"/>
+	<xsl:when test="parent::p"/>
+	<xsl:otherwise>
+	  <E53_Place  xmlns="http://purl.org/NET/crm-owl#" >
+	    <xsl:attribute name="rdf:about" select="tei:makeID(.,'place')"/>
+	    <xsl:apply-templates select="*[not(self::place or self::listPlace)]"/>
+	    <xsl:for-each select="parent::place[1]">
+	      <P89_falls_within rdf:resource="{tei:makeID(.,'place')}"/>
+	    </xsl:for-each>
+	  </E53_Place>
+	</xsl:otherwise>
+      </xsl:choose>
+      <xsl:apply-templates select="place|listPlace"/>
+  </xsl:template>
+
+  <xsl:template name="E21">
+    <xsl:choose>
+      <xsl:when test="self::name">
+	<P131_is_identified_by  xmlns="http://purl.org/NET/crm-owl#"
+	      rdf:resource="{tei:makeID(.,'persname')}"/>
+      </xsl:when>
+      <xsl:otherwise>
+	<E21_Person rdf:about="{tei:makeID(.,'person')}">
+	  <xsl:apply-templates/>
+	</E21_Person>
+      </xsl:otherwise>
+    </xsl:choose>
+
+  </xsl:template>
+
+  <xsl:template name="E74">
+    <E74_Group xmlns="http://purl.org/NET/crm-owl#" rdf:about="{tei:makeID(.,'org')}">
+      <xsl:apply-templates/>
+    </E74_Group>
+  </xsl:template>
+
+  <xsl:template name="E5">
+    <P11i_participated_in  xmlns="http://purl.org/NET/crm-owl#" >
+      <E5_Event rdf:about="{tei:makeID(.,'event')}">
+	<rdf:value>
+	  <xsl:value-of select="."/>
+	</rdf:value>
+	<xsl:apply-templates/>
+      </E5_Event>
+    </P11i_participated_in>
+  </xsl:template>
+
+  <xsl:template name="E47">
+    <P87_is_identified_by  xmlns="http://purl.org/NET/crm-owl#" >
+      <E47_Place_Spatial_Coordinates rdf:about="{tei:makeID(.,'placecoords')}">
+	<rdf:value>
+	  <xsl:value-of select="."/>
+	</rdf:value>
+      </E47_Place_Spatial_Coordinates>
+    </P87_is_identified_by>
+  </xsl:template>
+
+  <xsl:template name="E69">
+    <P100i_died_in  xmlns="http://purl.org/NET/crm-owl#" >
+      <E69_Death>
+	<P4_has_time-span>
+	  <E52_Time-Span>
+	    <P82_at_some_time_within>
+	      <E61_Time_Primitive>
+		<xsl:call-template name="calc-date-value"/>
+	      </E61_Time_Primitive>
+	    </P82_at_some_time_within>
+	  </E52_Time-Span>
+	</P4_has_time-span>
+      </E69_Death>
+    </P100i_died_in>
+  </xsl:template>
+
+  <xsl:template name="E52">
+    <xsl:choose>
+      <xsl:when test="parent::residence"/>
+
+      <xsl:when test="parent::creation"/>
+
+      <xsl:when test="parent::p"/>
+
+      <xsl:otherwise>
+	<P4_has_time-span  xmlns="http://purl.org/NET/crm-owl#" >
+	  <E52_Time-Span>
+	    <P82_at_some_time_within>
+	      <E61_Time_Primitive>
+		<xsl:call-template name="calc-date-value"/>
+	      </E61_Time_Primitive>
+	    </P82_at_some_time_within>
+	  </E52_Time-Span>
+	</P4_has_time-span>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="E67">
+    <P98i_was_born  xmlns="http://purl.org/NET/crm-owl#" >
+      <E67_Birth>
+	<P4_has_time-span>
+	  <E52_Time-Span>
+	    <P82_at_some_time_within>
+	      <E61_Time_Primitive>
+		<xsl:call-template name="calc-date-value"/>
+	      </E61_Time_Primitive>
+	    </P82_at_some_time_within>
+	  </E52_Time-Span>
+	</P4_has_time-span>
+	<xsl:choose>
+	  <xsl:when test="placeName">
+	    <P7_took_place_at>
+	      <E53_Place rdf:about="{tei:makeID(.,'place')}">
+		<P87_is_identified_by>
+		  <xsl:copy-of select="@xml:lang"/>
+		  <E48_Place_Name rdf:about="{tei:makeID(.,'placename')}">
+		    <rdf:value>
+		      <xsl:value-of select="normalize-space(.)"/>
+		    </rdf:value>
+		  </E48_Place_Name>
+		</P87_is_identified_by>
+	      </E53_Place>
+	    </P7_took_place_at>
+	  </xsl:when>
+	</xsl:choose>
+      </E67_Birth>
+    </P98i_was_born>
+  </xsl:template>
+
+  <xsl:template name="E82">
+    <xsl:choose>
+      <xsl:when test="parent::change"/>
+      <xsl:when test="parent::person">
+	<P131_is_identified_by  xmlns="http://purl.org/NET/crm-owl#" >
+	  <xsl:copy-of select="@xml:lang"/>
+	  <E82_Actor_Appellation  rdf:about="{tei:makeID(.,'persname')}">
+	    <rdf:value>
+	      <xsl:value-of select="normalize-space(.)"/>
+	    </rdf:value>
+	  </E82_Actor_Appellation>
+	</P131_is_identified_by>
+      </xsl:when>
+      <xsl:when test="self::name or ancestor::event or ancestor::ab[@type='dDay']">
+	<P11_had_participant>
+	  <xsl:choose>
+	    <xsl:when test="@ref">
+	      <xsl:attribute name="rdf:resource" select="resolve-uri(@ref,base-uri(ancestor::tei:TEI))"/>
+	    </xsl:when>
+	    <xsl:otherwise>
+	      <E21_Person rdf:about="{tei:makeID(.,'person')}">
+		<P131_is_identified_by>
+		  <E82_Actor_Appellation rdf:about="{tei:makeID(.,'persname')}">
+		    <rdf:value>
+		      <xsl:value-of select="normalize-space(.)"/>
+		    </rdf:value>
+		  </E82_Actor_Appellation>
+		</P131_is_identified_by>
+	      </E21_Person>
+	    </xsl:otherwise>
+	  </xsl:choose>
+	</P11_had_participant>
+      </xsl:when>
+
+      <xsl:when test="parent::label"/>
+      <xsl:when test="parent::desc"/>
+      <xsl:when test="not(@ref)">
+	<E21_Person rdf:about="{tei:makeID(.,'person')}">
+	  <P131_is_identified_by>
+	    <xsl:copy-of select="@xml:lang"/>
+	    <E82_Actor_Appellation  rdf:about="{tei:makeID(.,'persname')}">
+	      <rdf:value>
+		<xsl:value-of select="normalize-space(.)"/>
+	      </rdf:value>
+	    </E82_Actor_Appellation>
+	  </P131_is_identified_by>
+	</E21_Person>
+      </xsl:when>
+      <xsl:when test="generate-id(.) = generate-id(key('persons',@ref)[1])">
+	<E21_Person rdf:about="{tei:makeID(.,'person')}">
+	  <P131_is_identified_by>
+	    <xsl:copy-of select="@xml:lang"/>
+	    <E82_Actor_Appellation  rdf:about="{tei:makeID(.,'persname')}">
+	      <rdf:value>
+		<xsl:value-of select="normalize-space(.)"/>
+	      </rdf:value>
+	    </E82_Actor_Appellation>
+	  </P131_is_identified_by>
+	</E21_Person>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="E48">
+    <xsl:choose>
+      <xsl:when test=".=''"/>
+      <xsl:when test="parent::label"/>
+      <xsl:when test="parent::desc"/>
+      <xsl:when test="parent::tei:location"/>
+      <xsl:when test="parent::place">
+	<P87_is_identified_by  xmlns="http://purl.org/NET/crm-owl#" >
+	  <xsl:copy-of select="@xml:lang"/>
+	  <E48_Place_Name rdf:about="{tei:makeID(.,'placename')}">
+	    <rdf:value>
+	      <xsl:value-of select="normalize-space(.)"/>
+	    </rdf:value>
+	  </E48_Place_Name>
+	</P87_is_identified_by>
+      </xsl:when>
+      <xsl:when test="district|settlement|region|country|bloc">
+	<xsl:call-template name="placeHierarchy">
+	  <xsl:with-param name="next">district</xsl:with-param>
+	</xsl:call-template>
+      </xsl:when>
+      <xsl:when test="self::name or ancestor::event  or ancestor::ab[@type='dDay']">
+	<P7_took_place_at  xmlns="http://purl.org/NET/crm-owl#" >
+	  <xsl:choose>
+	    <xsl:when test="@ref">
+	      <xsl:attribute name="rdf:resource" select="resolve-uri(@ref,base-uri(ancestor::tei:TEI))"/>
+	    </xsl:when>
+	    <xsl:otherwise>
+	      <E53_Place rdf:about="{tei:makeID(.,'place')}"  xmlns="http://purl.org/NET/crm-owl#" >
+		<P87_is_identified_by>
+		  <xsl:copy-of select="@xml:lang"/>
+		  <E48_Place_Name rdf:about="{tei:makeID(.,'placename')}">
+		    <rdf:value>
+		      <xsl:value-of select="normalize-space(.)"/>
+		    </rdf:value>
+		  </E48_Place_Name>
+		</P87_is_identified_by>
+	      </E53_Place>
+	    </xsl:otherwise>
+	  </xsl:choose>
+	</P7_took_place_at>
+      </xsl:when>
+      <xsl:otherwise>
+	<E53_Place rdf:about="{tei:makeID(.,'place')}"  xmlns="http://purl.org/NET/crm-owl#" >
+	  <P87_is_identified_by>
+	    <xsl:copy-of select="@xml:lang"/>
+	    <E48_Place_Name rdf:about="{tei:makeID(.,'placename')}">
+	      <rdf:value>
+		<xsl:value-of select="normalize-space(.)"/>
+	      </rdf:value>
+	    </E48_Place_Name>
+	  </P87_is_identified_by>
+	</E53_Place>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="placeHierarchy">
+    <xsl:param name="next"/>
+    <xsl:if test="*[local-name()=$next]">
+      <xsl:for-each select="*[local-name()=$next][1]">
+	<E53_Place rdf:about="{tei:makeID(.,'place')}"  xmlns="http://purl.org/NET/crm-owl#" >
+	  <P2_has_type rdf:resource="http://www.tei-c.org/type/place/{$next}"/>
+	  <P87_is_identified_by>
+	    <xsl:copy-of select="@xml:lang"/>
+	    <E48_Place_Name rdf:about="{tei:makeID(.,'placename')}">
+	      <rdf:value>
+		<xsl:value-of select="normalize-space(.)"/>
+	      </rdf:value>
+	    </E48_Place_Name>
+	  </P87_is_identified_by>
+	  <xsl:choose>
+	    <xsl:when test="$next='district'">
+	      <xsl:call-template name="placeParent">
+		<xsl:with-param name="next">settlement</xsl:with-param>
+	      </xsl:call-template>
+	    </xsl:when>
+	    <xsl:when test="$next='settlement'">
+	      <xsl:call-template name="placeParent">
+		<xsl:with-param name="next">region</xsl:with-param>
+	      </xsl:call-template>
+	    </xsl:when>
+	    <xsl:when test="$next='region'">
+	      <xsl:call-template name="placeParent">
+		<xsl:with-param name="next">country</xsl:with-param>
+	      </xsl:call-template>
+	    </xsl:when>
+	    <xsl:when test="$next='country'">
+	      <xsl:call-template name="placeParent">
+		<xsl:with-param name="next">bloc</xsl:with-param>
+	      </xsl:call-template>
+	    </xsl:when>
+	  </xsl:choose>
+	</E53_Place>
+      </xsl:for-each>
+    </xsl:if>
+    <xsl:choose>
+      <xsl:when test="$next='district'">
+	<xsl:call-template name="placeHierarchy">
+	  <xsl:with-param name="next">settlement</xsl:with-param>
+	</xsl:call-template>
+      </xsl:when>
+      <xsl:when test="$next='settlement'">
+	<xsl:call-template name="placeHierarchy">
+	  <xsl:with-param name="next">region</xsl:with-param>
+	</xsl:call-template>
+      </xsl:when>
+      <xsl:when test="$next='region'">
+	<xsl:call-template name="placeHierarchy">
+	  <xsl:with-param name="next">country</xsl:with-param>
+	</xsl:call-template>
+      </xsl:when>
+      <xsl:when test="$next='country'">
+	<xsl:call-template name="placeHierarchy">
+	  <xsl:with-param name="next">bloc</xsl:with-param>
+	</xsl:call-template>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="placeParent">
+    <xsl:param name="next"/>
+    <xsl:if test="parent::*/*[local-name()=$next]">
+      <P89_falls_within
+	  rdf:resource="{tei:makeID(parent::*/*[local-name()=$next],'place')}"  xmlns="http://purl.org/NET/crm-owl#" />
+    </xsl:if>
+</xsl:template>
+	      
+  <xsl:template name="P74">
+    <P74_has_current_or_former_residence  xmlns="http://purl.org/NET/crm-owl#" >
+      <xsl:choose>
+	<xsl:when test="placeName">
+	  <xsl:apply-templates/>
+	</xsl:when>
+	<xsl:otherwise>
+	  <E53_Place rdf:about="{tei:makeID(.,'place')}">
+	    <P87_is_identified_by>
+	      <xsl:copy-of select="@xml:lang"/>
+	      <E48_Place_Name rdf:about="{tei:makeID(.,'placename')}">
+		<rdf:value>
+		  <xsl:value-of select="normalize-space(.)"/>
+		</rdf:value>
+	      </E48_Place_Name>
+	    </P87_is_identified_by>
+	  </E53_Place>
+	</xsl:otherwise>
+      </xsl:choose>
+    </P74_has_current_or_former_residence>
+  </xsl:template>
+
+  <xsl:template name="E35">
+    <xsl:choose>
+      <xsl:when test="ancestor::biblFull or ancestor::bibl"/>
+      <xsl:when test="parent::p"/>
+      <xsl:otherwise>
+	<P102_has_title  xmlns="http://purl.org/NET/crm-owl#" >
+	  <E35_Title>
+	    <rdf:value>
+	      <xsl:value-of select="normalize-space(.)"/>
+	    </rdf:value>
+	  </E35_Title>
+	</P102_has_title>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="E65">
+    <xsl:if test="not(ancestor::biblFull or ancestor::bibl)">
+    <P94i_was_created_by  xmlns="http://purl.org/NET/crm-owl#" >
+      <E65_Creation>
+	<P11_had_participant>
+	  <E21_Person rdf:about="{tei:makeID(.,'person')}">
+	    <P131_is_identified_by>
+	      <E82_Actor_Appellation rdf:about="{tei:makeID(.,'persname')}">
+		<rdf:value>
+		  <xsl:value-of select="normalize-space(.)"/>
+		</rdf:value>
+	      </E82_Actor_Appellation>
+	    </P131_is_identified_by>
+	  </E21_Person>
+	</P11_had_participant>
+      </E65_Creation>
+    </P94i_was_created_by>
+    </xsl:if>
+  </xsl:template>
+  
+  <!-- general templates -->
+
+  <xsl:template name="calc-date-value">
+    <rdf:value>
+      <xsl:choose>
+        <xsl:when test="@when">
+          <xsl:value-of select="@when"/>
+        </xsl:when>
+        <xsl:when test="@notBefore and @notAfter">
+          <xsl:value-of select="@notBefore"/>
+          <xsl:text> to  </xsl:text>
+          <xsl:value-of select="@notAfter"/>
+        </xsl:when>
+        <xsl:when test="@notBefore">
+          <xsl:value-of select="@notBefore"/>
+          <xsl:text> to </xsl:text>
+        </xsl:when>
+        <xsl:when test="@notAfter">
+          <xsl:text> to </xsl:text>
+          <xsl:value-of select="@notAfter"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="normalize-space(.)"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </rdf:value>
+  </xsl:template>
+
+  <xsl:function name="tei:makeID" as="xs:string*">
+    <xsl:param name="here"/>
+    <xsl:param name="type"/>
+    <xsl:for-each select="$here">
+      <xsl:variable name="baseid">
+	<xsl:choose>
+	  <xsl:when
+	      test="ancestor::TEI/teiHeader/fileDesc/publicationStmt/idno[starts-with(.,'http')]">
+	    <xsl:value-of 
+		select="ancestor::TEI/teiHeader/fileDesc/publicationStmt/idno[starts-with(.,'http')][1]"/>
+	  </xsl:when>
+	  <xsl:otherwise>
+	    <xsl:choose>
+	      <xsl:when test="ancestor-or-self::*/@xml:base">
+		<xsl:value-of select="ancestor-or-self::*[@xml:base][1]/@xml:base"/>
+	      </xsl:when>
+	      <xsl:otherwise>
+		<xsl:text>http://www.example.com</xsl:text>
+	      </xsl:otherwise>
+	    </xsl:choose>
+	    <xsl:choose>
+	      <xsl:when test="@xml:id">
+		<xsl:value-of select="@xml:id"/>
+	      </xsl:when>
+	      <xsl:when
+		  test="ancestor::TEI/teiHeader/fileDesc/publicationStmt/idno">
+		<xsl:value-of select="ancestor::TEI/teiHeader/fileDesc/publicationStmt/idno[1]"/>
+	      </xsl:when>
+	      <xsl:otherwise>
+		<xsl:number level="any"/>
+	      </xsl:otherwise>
+	    </xsl:choose>
+	  </xsl:otherwise>
+	</xsl:choose>
+      </xsl:variable>
+      <xsl:variable name="baseurl">
+	<xsl:choose>
+	  <xsl:when
+	      test="ancestor::TEI/teiHeader/fileDesc/publicationStmt/idno[contains(.,'/id/')]">
+	    <xsl:analyze-string
+		select="ancestor::TEI/teiHeader/fileDesc/publicationStmt/idno[contains(.,'/id/')][1]"
+		regex="(.*)/id/[^/]+">
+	      <xsl:matching-substring>
+		<xsl:value-of select="regex-group(1)"/>
+	      </xsl:matching-substring>
+	      <xsl:non-matching-substring>
+		<xsl:value-of select="regex-group(0)"/>
+	      </xsl:non-matching-substring>
+	    </xsl:analyze-string>
+	  </xsl:when>
+	  <xsl:otherwise>
+	    <xsl:choose>
+	      <xsl:when test="ancestor-or-self::*/@xml:base">
+		<xsl:value-of select="ancestor-or-self::*[@xml:base][1]/@xml:base"/>
+	      </xsl:when>
+	      <xsl:otherwise>
+		<xsl:text>http://www.example.com</xsl:text>
+	      </xsl:otherwise>
+	    </xsl:choose>
+	  </xsl:otherwise>
+	</xsl:choose>
+      </xsl:variable>
+      <xsl:choose>
+	<xsl:when test="$type='id'">
+	  <xsl:value-of select="$baseid"/>
+	</xsl:when>	
+	<xsl:when test="$type='place' and @ref">
+	  <xsl:value-of select="resolve-uri(@ref,base-uri(ancestor::tei:TEI))"/>
+	</xsl:when>
+	<xsl:when test="$type='person' and @ref">
+	  <xsl:value-of select="resolve-uri(@ref,base-uri(ancestor::tei:TEI))"/>
+	</xsl:when>
+	<xsl:when test="$type='place' and placeName[@ref]">
+	  <xsl:value-of select="placeName/resolve-uri(@ref,base-uri(ancestor::tei:TEI))"/>
+	</xsl:when>
+	<xsl:when test="$type='place' and key('Places',.)">
+	  <xsl:value-of select="tei:makeID(key('Places',.)[1],'place')"/>
+	</xsl:when>
+	<xsl:when test="$type='placename' and key('Places',.)">
+	  <xsl:value-of select="tei:makeID(key('Places',.)[1],'placename')"/>
+	</xsl:when>
+	<xsl:otherwise>
+	  <xsl:variable name="composite">
+	    <xsl:value-of select="$baseurl"/>
+	    <xsl:text>/</xsl:text>
+	    <xsl:value-of select="$type"/>
+	    <xsl:text>/</xsl:text>
+	    <xsl:choose>
+	      <xsl:when test="@xml:id">
+		<xsl:value-of select="@xml:id"/>
+	      </xsl:when>
+	      <xsl:when test="placeName[@key]">
+		<xsl:value-of select="placeName/@key"/>
+	      </xsl:when>
+	      <xsl:when test="self::placeName and
+			      parent::place[@xml:id]">
+		<xsl:value-of select="parent::place/@xml:id"/>
+	      </xsl:when>
+	      <xsl:when test="self::persName and
+			      parent::person[@xml:id]">
+		<xsl:value-of select="parent::person/@xml:id"/>
+	      </xsl:when>
+	      <xsl:when test="self::placeName|self::persName|self::district|self::settlement|self::region|self::country|self::bloc">
+		<xsl:value-of select="replace(lower-case(normalize-space(.)),'[^A-z]','')"/>
+	      </xsl:when>
+	      <xsl:when test="self::author">
+		<xsl:value-of select="replace(lower-case(normalize-space(.)),'[^A-z]','')"/>
+	      </xsl:when>
+	      <xsl:when test="persName|placeName">
+		<xsl:value-of select="replace(lower-case(normalize-space((persName|placeName)[1])),'[^A-z]','')"/>
+	      </xsl:when>
+	      <xsl:otherwise>
+		<xsl:value-of select="generate-id()"/>
+	      </xsl:otherwise>
+	    </xsl:choose>
+	  </xsl:variable>
+	  <xsl:value-of select="$composite"/>
+	</xsl:otherwise>
+      </xsl:choose>
+    </xsl:for-each>
+  </xsl:function>
+
+
+  
+
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/rdf/crm.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/rdf/make-acdc.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/rdf/make-acdc.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/rdf/make-acdc.xsl	(revision 258)
@@ -0,0 +1,86 @@
+<XSL:stylesheet
+    xpath-default-namespace="http://www.tei-c.org/ns/1.0"
+    xmlns:xsl="http://www.w3.org/1999/XSL/TransformAlias" 
+    xmlns:XSL="http://www.w3.org/1999/XSL/Transform" 
+    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
+    exclude-result-prefixes="rdf"
+    version="2.0"
+>
+
+  <XSL:import href="../common2/odds.xsl"/>
+  <XSL:import href="../common2/i18n.xsl"/>
+
+  <XSL:key name="EQUIVFILES" match="equiv" use="@filter"/>
+  <XSL:key name="MEMBERS" match="elementSpec" use="classes/memberOf/@key"/>
+  <XSL:output method="xml" indent="yes" encoding="utf-8"/>
+  <XSL:key name="NS" match="elementSpec|attDef" use="@ns"/>
+  <XSL:param name="useFixedDate">false</XSL:param>
+  
+  <XSL:namespace-alias stylesheet-prefix="xsl" result-prefix="XSL"/>
+
+  <XSL:template name="generateDoc">
+    <XSL:choose>
+      <XSL:when test="string-length($doclang)&gt;0">
+        <XSL:value-of select="$doclang"/>
+      </XSL:when>
+      <XSL:otherwise>
+        <XSL:text>en</XSL:text>
+      </XSL:otherwise>
+    </XSL:choose>
+  </XSL:template>
+  <XSL:template name="bitOut">
+    <XSL:param name="grammar">true</XSL:param>
+    <XSL:param name="content"/>
+    <XSL:copy-of select="$content"/>
+  </XSL:template>
+  
+  <XSL:template match="/">
+  
+
+  <xsl:stylesheet version="2.0"
+		  xpath-default-namespace="http://www.tei-c.org/ns/1.0"
+		  xmlns:XSL="http://www.w3.org/1999/XSL/Transform">
+
+    <xsl:import href="../tools/getfiles.xsl"/>
+
+    <XSL:for-each select="distinct-values(//equiv/@filter)">
+	<xsl:import href="{.}"/>  
+    </XSL:for-each>
+    
+    <xsl:param name="corpus">./</xsl:param>
+ 
+    <xsl:template match="*">
+      <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
+    </xsl:template>
+   
+    <xsl:template match="text()|comment()|@*|processing-instruction()"/>
+
+    <XSL:for-each select="//equiv[@filter]">
+      <xsl:template>
+	<XSL:variable name="f" select="@filter"/>
+	<XSL:attribute name="match">
+	  <XSL:value-of select="ancestor::elementSpec/@ident"/>
+	</XSL:attribute>
+	<xsl:call-template name="{@name}"/>
+      </xsl:template>
+    </XSL:for-each>
+
+    <xsl:template name="typology">
+      <E55_Type rdf:about="http://www.tei-c.org/type/place" xmlns="http://purl.org/NET/crm-owl#" >
+	<label xmlns="http://www.w3.org/2000/01/rdf-schema#" >place</label>
+      </E55_Type>
+      <XSL:for-each select="key('MEMBERS','model.placeNamePart')">
+	<E55_Type rdf:about="http://www.tei-c.org/type/place/{@ident}" xmlns="http://purl.org/NET/crm-owl#" >
+	<label xmlns="http://www.w3.org/2000/01/rdf-schema#" >
+	  <XSL:call-template name="makeDescription"/>
+	</label>
+	<P127_has_broader_term rdf:resource="http://www.tei-c.org/type/place"/>
+      </E55_Type>
+      </XSL:for-each>
+    </xsl:template>
+    
+  </xsl:stylesheet>
+
+</XSL:template>
+
+</XSL:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/rdf/make-acdc.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/rdf/dc.odd
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/rdf/dc.odd	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/rdf/dc.odd	(revision 258)
@@ -0,0 +1,29 @@
+<?oxygen RNGSchema="tei_odds.rnc" type="compact"?>
+<TEI xml:lang="en" xmlns="http://www.tei-c.org/ns/1.0" >
+   <teiHeader>
+      <fileDesc>
+         <titleStmt>
+            <title>Mapping TEI to Dublin Core</title>
+	    <author>Sebastian Rahtz</author>
+         </titleStmt>
+         <publicationStmt>
+	   <p> </p>
+	 </publicationStmt>
+         <sourceDesc>
+            <p>authored from scratch</p>
+         </sourceDesc>
+      </fileDesc>
+   </teiHeader>
+   <text>
+     <body>
+       <specGrp xml:id="dc">
+	 <elementSpec ident="publicationStmt" mode="change">
+	   <equiv filter="dc.xsl" mimeType="text/xsl" name="dc_publisher"/>
+	 </elementSpec>
+	 <elementSpec ident="keyword" mode="change">
+	   <equiv filter="dc.xsl" mimeType="text/xsl" name="dc_subject"/>
+	 </elementSpec>
+       </specGrp>
+     </body>
+   </text>
+</TEI>
Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/rdf/dc.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/rdf/dc.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/rdf/dc.xsl	(revision 258)
@@ -0,0 +1,76 @@
+<?xml version="1.0"?>
+<xsl:stylesheet 
+    xmlns:dc="http://purl.org/dc/elements/1.1/"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema" 
+    xmlns="http://purl.org/NET/crm-owl#" 
+    xmlns:tei="http://www.tei-c.org/ns/1.0" 
+    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
+    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" 
+    xmlns:owl="http://www.w3.org/2002/07/owl#" 
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema#" 
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    version="2.0" 
+    xpath-default-namespace="http://www.tei-c.org/ns/1.0" 
+    exclude-result-prefixes="dc tei rdf rdfs owl xsd xsl xs">
+  
+  <xsl:output encoding="utf-8" method="xml" indent="yes"/>
+
+  <xsl:template name="dc_header">
+    <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/"
+	rdf:about="{.//idno[1]}">
+      <xsl:apply-templates/>
+    </rdf:Description>
+  </xsl:template>
+
+  <xsl:template name="dc_title">
+    <dc:title>
+      <xsl:value-of select="."/>
+    </dc:title>
+  </xsl:template>
+  
+  <xsl:template name="dc_creator">
+    <dc:creator>
+      <xsl:value-of select="."/>
+    </dc:creator>
+  </xsl:template>
+  
+  <xsl:template name="dc_publisher">
+    <xsl:if test="publisher">
+      <dc:publisher>
+	<xsl:value-of select="publisher"/>
+	<xsl:if test="pubPlace">
+	  <xsl:text>, </xsl:text>
+	  <xsl:value-of select="pubPlace"/>
+	</xsl:if>
+	<xsl:if test="date">
+	  <xsl:text>, </xsl:text>
+		<xsl:value-of select="date"/>
+	</xsl:if>
+      </dc:publisher>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template name="dc_date">
+    <dc:date>
+      <xsl:value-of select="."/>
+    </dc:date>
+  </xsl:template>
+  
+  <xsl:template name="dc_rights">
+    <dc:rights>
+      <xsl:value-of select="."/>
+    </dc:rights>
+  </xsl:template>
+
+  <xsl:template name="dc_subject">
+      <dc:subject>
+	<xsl:value-of select="."/>
+      </dc:subject>
+  </xsl:template>
+  
+  <xsl:template name="dc_contributor">
+    <dc:contributor>
+      <xsl:value-of select="."/>
+    </dc:contributor>
+  </xsl:template>
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/rdf/dc.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/rdf/Makefile
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/rdf/Makefile	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/rdf/Makefile	(revision 258)
@@ -0,0 +1,10 @@
+default: build compile 
+
+build:
+	saxon -o:rdf.expanded -s:rdf.odd -xsl:/usr/share/xml/tei/stylesheet/odds/odd2odd.xsl
+
+compile:
+	saxon rdf.expanded  make-acdc.xsl > tei2rdf.xsl 
+
+clean:
+	-rm rdf.expanded *.rdf
Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/rdf/build-to.xml
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/rdf/build-to.xml	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/rdf/build-to.xml	(revision 258)
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="utf-8"?>
+<project basedir="." default="dist" name="teitordf">
+<!--
+	This library is free software; you can redistribute it and/or
+	modify it under the terms of the GNU Lesser General Public
+	License as published by the Free Software Foundation; either
+	version 2.1 of the License, or (at your option) any later version.
+	
+	This library 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
+	Lesser General Public License for more details.
+	
+	You should have received a copy of the GNU Lesser General Public
+	License along with this library; if not, write to the Free Software
+	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+	
+        Id: $Id: build-to.xml 9319 2011-09-14 15:25:52Z rahtz $
+        Copyright: 2011, TEI Consortium<
+-->
+  <!--
+ Convert TEI documents into RDF files.
+ -->
+  <!-- Path to TEI XML file. -->
+  <property name="inputFile" value=""/>
+  <!-- Path where the output schema file will be saved. -->
+  <property name="outputFile" value=""/>
+  <!-- which profile -->
+  <property name="profile" value="default"/>
+  <!-- where does oxygen keep stuff -->
+  <property name="oxygenlib" value=""/>
+  <!-- Stylesheet for transformation -->
+  <property name="odd2rdf"
+	    value="../profiles/${profile}/rdf/to.xsl"/>
+  <dirname property="inputFileDir" file="${inputFile}"/>
+  <dirname property="outputDir" file="${outputFile}"/>
+  <property name="outputTempDir" value="${outputDir}/temp-dir-for-ant"/>
+  <path id="classpath">
+    <pathelement path="${java.class.path}"/>
+  </path>
+  <target name="setup">
+    <delete dir="${outputTempDir}"/>
+    <mkdir dir="${outputTempDir}"/>
+  </target>
+  <target name="dist" depends="setup,convert,cleanup"/>
+
+  <target name="convert">
+    <!-- Recreate temporary output directory -->
+    <!-- The transformation for RDF output. -->
+    <echo level="info">XSLT generate RDF file</echo>
+    <xslt force="yes" style="${odd2rdf}" in="${inputFile}" out="${outputFile}" classpath="classpath">
+      <xmlcatalog>
+        <catalogpath>
+          <pathelement location="../../../../catalog.xml"/>
+          <pathelement location="../../../../../xrdf11/dtd/xhtmlcatalog.xml"/>
+        </catalogpath>
+      </xmlcatalog>
+      <factory name="net.sf.saxon.TransformerFactoryImpl"/>
+      <classpath location="${oxygenlib}/saxon9ee.jar"/>
+      <param name="directory" expression="file:///${outputTempDir}"/>
+      <!-- supply name of language-->
+      <param name="lang" expression="${lang}" if="lang"/>
+      <!-- emit some diagnostics"-->
+      <param name="debug" expression="${debug}" if="debug"/>
+      <!-- be verbose-->
+      <param name="verbose" expression="${verbose}" if="verbose"/>
+    </xslt>
+  </target>
+
+  <target name="cleanup" unless="debug">  
+    <delete dir="${outputTempDir}"/>
+  </target>
+
+</project>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/rdf/build-to.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/odds2/translate-odd.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/odds2/translate-odd.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/odds2/translate-odd.xsl	(revision 258)
@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 
+Text Encoding Initiative Consortium XSLT stylesheet family
+$Date: 2011-09-20 10:47:43 +0100 (Tue, 20 Sep 2011) $, $Revision: 9329 $, $Author: rahtz $
+
+XSL stylesheet to process TEI documents using ODD markup
+
+ 
+##LICENSE
+--><xsl:stylesheet xmlns:rng="http://relaxng.org/ns/structure/1.0"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                exclude-result-prefixes="tei"
+                version="2.0">
+  <xsl:output method="xml" indent="yes" encoding="utf-8"/>
+  <xsl:param name="verbose"/>
+  <xsl:param name="lang">es</xsl:param>
+  <xsl:key name="ELEMENTS" match="element" use="@ident"/>
+  <xsl:key name="ATTRIBUTES" match="attribute" use="@ident"/>
+  <xsl:param name="TEISERVER">http://localhost/Query/</xsl:param>
+  <xsl:param name="I18N">../i18n.xml</xsl:param>
+  <xsl:variable name="i18n">
+      <xsl:choose>
+         <xsl:when test="$I18N=''">
+            <xsl:value-of select="$TEISERVER"/>
+            <xsl:text>i18n.xql</xsl:text>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:value-of select="$I18N"/>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:variable>
+  <xsl:template match="/">
+      <xsl:if test="$verbose='true'">
+         <xsl:message>Translate database: <xsl:value-of select="$i18n"/>
+         </xsl:message>
+      </xsl:if>
+      <xsl:apply-templates/>
+  </xsl:template>
+  <xsl:template match="*">
+      <xsl:copy>
+         <xsl:apply-templates select="@*|*|text()|comment()|processing-instruction()"/>
+      </xsl:copy>
+  </xsl:template>
+  <xsl:template match="@*|comment()|text()|processing-instruction()">
+      <xsl:copy/>
+  </xsl:template>
+  <xsl:template match="tei:elementSpec">
+      <xsl:copy>
+         <xsl:copy-of select="@*"/>
+         <xsl:variable name="me" select="@ident"/>
+         <xsl:if test="not(tei:altIdent)">
+            <xsl:for-each select="document($i18n)">
+               <xsl:for-each select="key('ELEMENTS',$me)/equiv[@xml:lang=$lang][not(@value='')]">
+                  <xsl:if test="$verbose='true'">
+                     <xsl:message>
+                        <xsl:value-of select="$me"/> ... <xsl:value-of select="@value"/>
+                     </xsl:message>
+                  </xsl:if>
+                  <altIdent xmlns="http://www.tei-c.org/ns/1.0" type="lang">
+                     <xsl:value-of select="@value"/>
+                  </altIdent>
+               </xsl:for-each>
+            </xsl:for-each>
+         </xsl:if>
+         <xsl:apply-templates select="*|text()|comment()|processing-instruction()"/>
+      </xsl:copy>
+  </xsl:template>
+   <!--
+  <xsl:template match="tei:elementSpec/tei:desc">
+    <xsl:variable name="me" select="../@ident"/>
+    <xsl:variable name="trans">
+      <xsl:for-each select="document($i18n)">
+        <xsl:for-each select="key('ELEMENTS',$me)/desc[@xml:lang=$lang]">
+          <xsl:if test="not(.='.')">
+            <xsl:if test="$verbose='true'">
+              <xsl:message><xsl:value-of select="$me"/> ... <xsl:value-of select="."/></xsl:message>
+            </xsl:if>
+            <desc xmlns="http://www.tei-c.org/ns/1.0">
+              <xsl:value-of select="."/>
+            </desc>
+          </xsl:if>
+        </xsl:for-each>
+      </xsl:for-each>
+    </xsl:variable>
+    <xsl:choose>
+      <xsl:when test="$trans=''">
+        <xsl:copy-of select="."/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:copy-of select="$trans"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+-->
+  <xsl:template match="tei:attDef">
+      <xsl:copy>
+         <xsl:copy-of select="@*"/>
+         <xsl:variable name="me" select="@ident"/>
+         <xsl:if test="not(tei:altIdent)">
+            <xsl:for-each select="document($i18n)">
+               <xsl:for-each select="key('ATTRIBUTES',$me)/equiv[@xml:lang=$lang][not(@value='')]">
+                  <xsl:if test="$verbose='true'">
+                     <xsl:message>
+                        <xsl:value-of select="$me"/> ... <xsl:value-of select="@value"/>
+                     </xsl:message>
+                  </xsl:if>
+                  <altIdent xmlns="http://www.tei-c.org/ns/1.0" type="lang">
+                     <xsl:value-of select="@value"/>
+                  </altIdent>
+               </xsl:for-each>
+            </xsl:for-each>
+         </xsl:if>
+         <xsl:apply-templates select="*|text()|comment()|processing-instruction()"/>
+      </xsl:copy>
+  </xsl:template>
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/odds2/translate-odd.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/odds2/odd2json.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/odds2/odd2json.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/odds2/odd2json.xsl	(revision 258)
@@ -0,0 +1,270 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet 
+    xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
+    xmlns:fo="http://www.w3.org/1999/XSL/Format" 
+    xmlns:html="http://www.w3.org/1999/xhtml" 
+    xmlns:i="http://www.iso.org/ns/1.0"
+    xmlns:rng="http://relaxng.org/ns/structure/1.0"
+    xmlns:s="http://www.ascc.net/xml/schematron" 
+    xmlns:sch="http://purl.oclc.org/dsdl/schematron" 
+    xmlns="http://www.tei-c.org/ns/1.0"
+    xmlns:tei="http://www.tei-c.org/ns/1.0"
+    xmlns:teix="http://www.tei-c.org/ns/Examples" 
+    xmlns:xi="http://www.w3.org/2001/XInclude"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    exclude-result-prefixes="a fo html i rng s sch tei teix xi xs xsl" 
+    version="2.0">
+  <xsl:import href="teiodds.xsl"/>
+  <xsl:import href="../common2/i18n.xsl"/>
+  <xsl:import href="../common2/tei-param.xsl"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet for making JSON from ODD </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: odd2json.xsl 9669 2011-11-07 19:17:54Z rahtz $</p>
+         <p>Copyright: 2011, TEI Consortium</p>
+      </desc>
+   </doc>
+  <xsl:output encoding="utf-8" indent="yes" method="text"/>
+  <xsl:strip-space elements="*"/>
+  <xsl:param name="TEIC">false</xsl:param>
+  <xsl:param name="verbose"/>
+  <xsl:param name="outputDir"/>
+  <xsl:param name="appendixWords"/>
+  <xsl:template name="makeAnchor">
+      <xsl:param name="name"/>
+  </xsl:template>
+  <xsl:param name="splitLevel">-1</xsl:param>
+  <xsl:variable name="oddmode">dtd</xsl:variable>
+  <xsl:variable name="filesuffix"/>
+   <!-- get list of output files -->
+  <xsl:variable name="linkColor"/>
+  <xsl:template match="tei:moduleSpec[@type='decls']"/>
+
+  <xsl:variable name="dq">"</xsl:variable>
+  <xsl:variable name="escdq">\\"</xsl:variable>
+  <xsl:template match="/">
+    <xsl:text>{"title": "</xsl:text>
+    <xsl:call-template name="generateTitle"/>
+    <xsl:text>","edition": "</xsl:text>
+    <xsl:call-template name="generateEdition"/>
+    <xsl:text>","generator": "oddj2son",
+    "date":"</xsl:text>
+    <xsl:call-template name="showDate"/>
+    <xsl:text>","modules": [</xsl:text>
+    <xsl:for-each select="key('Modules',1)">
+      <xsl:sort select="@ident"/>
+      <xsl:text>{"ident":"</xsl:text>
+      <xsl:value-of select="@ident"/>
+      <xsl:text>",</xsl:text>
+      <xsl:call-template name="desc"/>
+      <xsl:text>}</xsl:text>
+      <xsl:if test="not(position() = last())">,</xsl:if>
+      <xsl:text>&#10;</xsl:text>
+    </xsl:for-each>
+    <xsl:text>],</xsl:text>
+
+    <xsl:text>"elements": [</xsl:text>
+    <xsl:for-each select="key('ELEMENTDOCS',1)">
+      <xsl:sort select="@ident"/>
+      <xsl:text>{"ident":"</xsl:text>
+      <xsl:value-of select="@ident"/>
+      <xsl:text>",</xsl:text>
+      <xsl:text>"module":"</xsl:text>
+      <xsl:value-of select="@module"/>
+      <xsl:text>",</xsl:text>
+      <xsl:call-template name="desc"/>
+      <xsl:if test="tei:classes">
+	<xsl:text>,"classes":[</xsl:text>
+	<xsl:for-each select="tei:classes/tei:memberOf">
+	  <xsl:text>{"</xsl:text>
+	  <xsl:value-of select="@key"/>
+	  <xsl:text>":"</xsl:text>
+	  <xsl:for-each select="key('IDENTS',@key)">
+	    <xsl:value-of select="@type"/>
+	  </xsl:for-each>
+	  <xsl:text>"}</xsl:text>
+	  <xsl:if test="following-sibling::tei:memberOf">,</xsl:if>
+	</xsl:for-each>
+	<xsl:text>]</xsl:text>
+      </xsl:if>
+      <xsl:text>,"attributes":[</xsl:text>
+      <xsl:variable name="a">
+	<xsl:call-template name="atts"/>
+      </xsl:variable>
+      <xsl:for-each select="$a/tei:attDef">
+	<xsl:text>{"ident":"</xsl:text>
+	<xsl:value-of select="@ident"/>
+	<xsl:text>",</xsl:text>
+	<xsl:value-of select="tei:desc"/>
+	<xsl:text>}</xsl:text>
+	<xsl:if test="following-sibling::tei:attDef">,</xsl:if>
+      </xsl:for-each>
+      <xsl:text>]</xsl:text>
+      <xsl:text>}</xsl:text>
+      <xsl:if test="not(position() = last())">,</xsl:if>
+      <xsl:text>&#10;</xsl:text>
+    </xsl:for-each>
+    <xsl:text>],</xsl:text>
+
+    <xsl:text>"attclasses": [</xsl:text>
+    <xsl:for-each select="key('ATTCLASSDOCS',1)">
+      <xsl:sort select="@ident"/>
+      <xsl:text>{"ident":"</xsl:text>
+      <xsl:value-of  select="@ident"/>
+      <xsl:text>",</xsl:text>
+      <xsl:text>"type":"</xsl:text>
+      <xsl:value-of  select="@type"/>
+      <xsl:text>",</xsl:text>
+      <xsl:call-template name="desc"/>
+      <xsl:text>}</xsl:text>
+      <xsl:if test="not(position() = last())">,</xsl:if>
+      <xsl:text>&#10;</xsl:text>
+    </xsl:for-each>
+    <xsl:text>],</xsl:text>
+
+    <xsl:text>"modelclasses": [</xsl:text>
+    <xsl:for-each select="key('MODELCLASSDOCS',1)">
+      <xsl:sort select="@ident"/>
+      <xsl:text>{"ident":"</xsl:text>
+      <xsl:value-of  select="@ident"/>
+      <xsl:text>",</xsl:text>
+      <xsl:text>"type":"</xsl:text>
+      <xsl:value-of  select="@type"/>
+      <xsl:text>",</xsl:text>
+      <xsl:call-template name="desc"/>
+      <xsl:text>}</xsl:text>
+      <xsl:if test="not(position() = last())">,</xsl:if>
+      <xsl:text>&#10;</xsl:text>
+    </xsl:for-each>
+    <xsl:text>],</xsl:text>
+
+    <xsl:text>"macros": [</xsl:text>
+    <xsl:for-each select="key('MACRODOCS',1)">
+      <xsl:sort select="@ident"/>
+      <xsl:text>{"ident":"</xsl:text>
+      <xsl:value-of select="@ident"/>
+      <xsl:text>",</xsl:text>
+      <xsl:text>"type":"</xsl:text>
+      <xsl:value-of select="@type"/>
+      <xsl:text>",</xsl:text>
+      <xsl:call-template name="desc"/>
+      <xsl:text>}</xsl:text>
+      <xsl:if test="not(position() = last())">,</xsl:if>
+      <xsl:text>&#10;</xsl:text>
+    </xsl:for-each>
+    <xsl:text>]</xsl:text>
+    <xsl:text>}</xsl:text>
+  </xsl:template>
+
+  <xsl:template name="bitOut">
+      <xsl:param name="grammar"/>
+      <xsl:param name="element"/>
+      <xsl:param name="content"/>
+      <xsl:value-of select="normalize-space($content)"/>
+  </xsl:template>
+
+  <xsl:template name="typewriter">
+    <xsl:param name="text"/>
+    <xsl:value-of select="$text"/>
+  </xsl:template>
+
+  <xsl:template name="desc">
+    <xsl:variable name="d">      
+      <xsl:call-template name="makeDescription"/>
+    </xsl:variable>
+    <xsl:text>"desc":"</xsl:text>
+    <xsl:value-of select="replace(normalize-space($d),$dq,$escdq)"/>
+    <xsl:text>"</xsl:text>
+  </xsl:template>
+
+  <xsl:template name="atts">
+    <xsl:call-template name="listAtts"/>
+    <xsl:if test="$TEIC='true'">
+      <xsl:call-template name="classA">
+	<xsl:with-param name="i">att.global</xsl:with-param>
+      </xsl:call-template>
+    </xsl:if>
+    <xsl:for-each select="tei:classes/tei:memberOf">
+      <xsl:call-template name="classA">
+	<xsl:with-param name="i" select="@key"/>
+      </xsl:call-template>
+    </xsl:for-each>
+  </xsl:template>
+
+  <xsl:template name="listAtts">
+    <xsl:for-each select=".//tei:attDef">
+      <tei:attDef ident="{@ident}">
+	<desc>
+	  <xsl:call-template name="desc"/>
+	</desc>
+      </tei:attDef>
+    </xsl:for-each>
+  </xsl:template>
+
+  <xsl:template name="classA">
+    <xsl:param name="i"/>
+    <xsl:for-each select="key('CLASSES',$i)">
+      <xsl:call-template name="listAtts"/>
+      <xsl:for-each select="tei:classes/tei:memberOf">
+	<xsl:call-template name="classA">
+	  <xsl:with-param name="i" select="@key"/>
+	</xsl:call-template>
+      </xsl:for-each>
+    </xsl:for-each>
+  </xsl:template>
+
+
+    <xsl:template name="generateEdition">
+      <xsl:value-of
+	  select="tei:TEI/tei:teiHeader/tei:fileDesc/tei:editionStmt/tei:edition"/>
+    </xsl:template>
+
+    <xsl:template name="generateTitle">
+      <xsl:for-each
+	  select="tei:TEI/tei:teiHeader/tei:fileDesc/tei:titleStmt">
+	<xsl:choose>
+	  <xsl:when test="tei:title[@type='main']">
+	    <xsl:apply-templates select="tei:title"/>
+	  </xsl:when>
+	  <xsl:otherwise>
+	    <xsl:apply-templates select="tei:title"/>
+	  </xsl:otherwise>
+	</xsl:choose>
+      </xsl:for-each>
+    </xsl:template>
+
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/odds2/odd2json.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/odds2/extract-schemaSpec-ident.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/odds2/extract-schemaSpec-ident.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/odds2/extract-schemaSpec-ident.xsl	(revision 258)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- ********************************************************************** -->
+<!--                                                                        -->
+<!-- Routine to return the value of the ident= attributes of any            -->
+<!-- <schemaSpec> elements in a TEI document.                               -->
+<!--                                                                        -->
+<!-- Input: an XML file, presumably an ODD file, i.e., one that's in the    -->
+<!--        tei namespace and that uses the tagset for tagset documentation -->
+<!--                                                                        -->
+<!-- Output: a newline-separated list of the values of the ident=           -->
+<!--         attribute of each <schemaSpec> element found.                  -->
+<!--                                                                        -->
+<!-- Used by the Roma shell script to ascertain the schema name             -->
+<!--                                                                        -->
+<!-- Written 2005-01-18 by Syd Bauman                                       -->
+<!--                                                                        -->
+<!-- ********************************************************************** -->
+<xsl:stylesheet xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="2.0">
+
+  <xsl:output encoding="utf8" method="text"/>
+  <xsl:template match="/">
+      <xsl:for-each select=".//tei:schemaSpec">
+         <xsl:value-of select="@ident"/>
+         <xsl:text>&#x0A;</xsl:text>
+      </xsl:for-each>
+  </xsl:template>
+
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/odds2/extract-schemaSpec-ident.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/odds2/odd2dtd.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/odds2/odd2dtd.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/odds2/odd2dtd.xsl	(revision 258)
@@ -0,0 +1,1644 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
+                xmlns:fo="http://www.w3.org/1999/XSL/Format"
+                xmlns:rng="http://relaxng.org/ns/structure/1.0"
+                xmlns:t="http://www.thaiopensource.com/ns/annotations"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                
+                xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                exclude-result-prefixes="a t tei fo rng xs"
+                version="2.0">
+  <xsl:import href="teiodds.xsl"/>
+  <xsl:import href="../common2/i18n.xsl"/>
+  <xsl:import href="../common2/tei-param.xsl"/>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet for making DTD from ODD </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: odd2dtd.xsl 9669 2011-11-07 19:17:54Z rahtz $</p>
+         <p>Copyright: 2011, TEI Consortium</p>
+      </desc>
+   </doc>
+  <xsl:output method="text"/>
+  <xsl:param name="autoGlobal">false</xsl:param>
+  <xsl:param name="verbose"/>
+  <xsl:param name="outputDir"/>
+  <xsl:param name="appendixWords"> </xsl:param>
+  <xsl:param name="filesuffix"/>
+  <xsl:template name="headingNumberSuffix">
+      <xsl:text> </xsl:text>
+  </xsl:template>
+  <xsl:param name="numberBackHeadings"> </xsl:param>
+  <xsl:param name="numberFrontHeadings"> </xsl:param>
+  <xsl:param name="numberHeadings"> </xsl:param>
+  <xsl:param name="numberHeadingsDepth"> </xsl:param>
+  <xsl:param name="oddmode">dtd</xsl:param>
+  <xsl:param name="prenumberedHeadings">false</xsl:param>
+  <xsl:param name="splitLevel">-1</xsl:param>
+  <xsl:param name="generateNamespacePrefix">false</xsl:param>
+  <xsl:param name="namespacePrefix"/>
+  <xsl:key match="tei:moduleSpec" name="Modules" use="1"/>
+  <xsl:variable name="nsPrefix">
+      <xsl:choose>
+         <xsl:when test="generateNamespacePrefix='false'"/>
+         <xsl:when test="not($namespacePrefix='')">
+            <xsl:value-of select="$namespacePrefix"/>
+         </xsl:when>
+         <xsl:when test="key('LISTSCHEMASPECS',$whichSchemaSpec)/@ns">
+            <xsl:variable name="n" select="key('LISTSCHEMASPECS',whichSchemaSpec)/@ns"/>
+            <xsl:choose>
+               <xsl:when test="$n='http://www.w3.org/2005/11/its'">its:</xsl:when>
+               <xsl:when test="$n='http://www.tei-c.org/ns/1.0'">tei:</xsl:when>
+            </xsl:choose>
+         </xsl:when>
+      </xsl:choose>
+  </xsl:variable>
+  <xsl:key name="NSELEMENTS" match="tei:elementSpec[@ns]|tei:attDef[@ns]" use="1"/>
+  <xsl:key match="tei:moduleSpec[@ident]" name="FILES" use="@ident"/>
+  <xsl:template match="/">
+      <xsl:choose>
+         <xsl:when test="key('SCHEMASPECS',1)">
+            <xsl:apply-templates select="key('LISTSCHEMASPECS',$whichSchemaSpec)"/>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:call-template name="byModule"/>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <xsl:template name="byModule">
+      <xsl:for-each select="key('Modules',1)">
+         <xsl:sort order="descending" select="@ident"/>
+         <xsl:if test="$verbose='true'">
+            <xsl:message> File [<xsl:value-of select="@ident"/>] </xsl:message>
+         </xsl:if>
+         <xsl:call-template name="generateOutput">
+            <xsl:with-param name="suffix">.dtd</xsl:with-param>
+            <xsl:with-param name="method">text</xsl:with-param>
+            <xsl:with-param name="body">
+               <xsl:call-template name="dtdComment">
+                  <xsl:with-param name="text"> 
+	                    <xsl:text>DTD module </xsl:text>
+	                    <xsl:value-of select="@ident"/>
+	                    <xsl:text>. Generated </xsl:text>
+	                    <xsl:call-template name="showDate"/>
+	                    <xsl:text>. </xsl:text>
+			    <xsl:call-template name="copyright"/>
+	                    <xsl:call-template name="makeTEIVersion"/>
+	                    <xsl:call-template name="makeDescription"/>
+	                 </xsl:with-param>
+               </xsl:call-template>
+               <xsl:choose>
+                  <xsl:when test="@type='core'">
+		    <xsl:text>&lt;!ENTITY % TEI.extensions.ent '' &gt;&#10;</xsl:text>
+		    <xsl:text>%TEI.extensions.ent;&#10;</xsl:text>
+		    <xsl:call-template name="dtdComment">
+		      <xsl:with-param name="text">
+			<xsl:text>list of element names</xsl:text>
+                        </xsl:with-param>
+		    </xsl:call-template>
+		    <xsl:if test="$parameterize='true' and count(key('NSELEMENTS',1))&gt;0">
+		      <xsl:text>&lt;!ENTITY % NS '</xsl:text>
+		      <xsl:value-of select="$nsPrefix"/>
+		      <xsl:text>' &gt;&#10;</xsl:text>
+		    </xsl:if>
+		    <xsl:if test="$parameterize='true'">
+		      <xsl:call-template name="NameList"/>
+		    </xsl:if>
+		    <xsl:call-template name="datatypeMacros"/>
+		    <xsl:call-template name="omissability"/>
+		    <xsl:call-template name="entityModules"/>
+		    <xsl:call-template name="predeclaredClasses"/>
+		    <xsl:call-template name="predeclaredMacros"/>
+		    <xsl:call-template name="normalClasses"/>
+		    <xsl:call-template name="normalMacros"/>
+		    <xsl:text>&#10;&lt;!ENTITY % TEI.extensions.dtd '' &gt;&#10;</xsl:text>
+		    <xsl:text>%TEI.extensions.dtd;&#10;</xsl:text>
+		    <xsl:apply-templates mode="tangle" select="key('ElementModule',@ident)">
+		      <xsl:sort select="@ident"/>
+		    </xsl:apply-templates>
+		    <xsl:call-template name="elementModules"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:apply-templates mode="tangle" select="key('ElementModule',@ident)">
+                        <xsl:sort select="@ident"/>
+                     </xsl:apply-templates>
+                  </xsl:otherwise>
+               </xsl:choose>
+            </xsl:with-param>
+         </xsl:call-template>
+         <xsl:if test="not(@type='core')">
+            <xsl:call-template name="generateOutput">
+               <xsl:with-param name="suffix">-decl.dtd</xsl:with-param>
+               <xsl:with-param name="method">text</xsl:with-param>
+               <xsl:with-param name="body">
+                  <xsl:call-template name="dtdComment">
+                     <xsl:with-param name="text">
+		                      <xsl:text>TEI P5 entity declaration module for </xsl:text>
+		                      <xsl:value-of select="@ident"/>
+		                      <xsl:text>. Generated </xsl:text>
+		                      <xsl:call-template name="showDate"/>
+		                      <xsl:text>.&#10;</xsl:text>
+				      <xsl:call-template name="copyright"/>
+		                      <xsl:call-template name="makeTEIVersion"/>
+		                      <xsl:call-template name="makeDescription"/>
+	                    </xsl:with-param>
+                  </xsl:call-template>
+                  <xsl:call-template name="datatypeMacros"/>
+                  <xsl:call-template name="normalClasses"/>
+                  <xsl:call-template name="normalMacros"/>
+                  <xsl:call-template name="predeclaredMacros"/>
+               </xsl:with-param>
+            </xsl:call-template>
+         </xsl:if>
+      </xsl:for-each>
+  </xsl:template>
+  <xsl:template name="elementModules">
+      <xsl:for-each select="key('Modules',1)">
+         <xsl:sort order="descending" select="@ident"/>
+         <xsl:if test="not(@type='core')">
+            <xsl:text>&#10;&lt;![%TEI.</xsl:text>
+            <xsl:value-of select="@ident"/>
+            <xsl:text>;[
+	&lt;!ENTITY % file.</xsl:text>
+            <xsl:value-of select="@ident"/>
+            <xsl:text> PUBLIC '-//TEI P5//ELEMENTS </xsl:text>
+            <xsl:value-of select="tei:altIdent[@type='FPI']"/>
+            <xsl:text>//EN' '</xsl:text>
+            <xsl:value-of select="@ident"/>
+            <xsl:text>.dtd' &gt;
+	%file.</xsl:text>
+            <xsl:value-of select="@ident"/>
+            <xsl:text>;
+	]]&gt;&#10;</xsl:text>
+         </xsl:if>
+      </xsl:for-each>
+  </xsl:template>
+  <xsl:template name="entityModules">
+      <xsl:call-template name="dtdComment">
+         <xsl:with-param name="text">
+            <xsl:text>Module declarations</xsl:text>
+         </xsl:with-param>
+      </xsl:call-template>
+      <xsl:for-each select="key('Modules',1)">
+         <xsl:sort order="descending" select="@ident"/>
+         <xsl:if test="not(@type='core')">
+            <xsl:text>&lt;!ENTITY % TEI.</xsl:text>
+            <xsl:value-of select="@ident"/>
+            <xsl:text> 'IGNORE' &gt;&#10;</xsl:text>
+            <xsl:text>&lt;![%TEI.</xsl:text>
+            <xsl:value-of select="@ident"/>
+            <xsl:text>;[
+	&lt;!ENTITY % file.</xsl:text>
+            <xsl:value-of select="@ident"/>
+            <xsl:text>-decl PUBLIC '-//TEI P5//ENTITIES </xsl:text>
+            <xsl:value-of select="tei:altIdent[@type='FPI']"/>
+            <xsl:text>//EN' '</xsl:text>
+            <xsl:value-of select="@ident"/>
+            <xsl:text>-decl.dtd' &gt;
+	%file.</xsl:text>
+            <xsl:value-of select="@ident"/>
+            <xsl:text>-decl;
+	]]&gt;&#10;</xsl:text>
+         </xsl:if>
+      </xsl:for-each>
+  </xsl:template>
+  <xsl:template name="omissability">
+      <xsl:call-template name="dtdComment">
+         <xsl:with-param name="text">
+            <xsl:text>legacy declaration of omissability indicators</xsl:text>
+         </xsl:with-param>
+      </xsl:call-template>
+      <xsl:text>&lt;!ENTITY % TEI.XML 'INCLUDE' &gt;&#10;</xsl:text>
+      <xsl:text>&lt;![%TEI.XML;[&#10;</xsl:text>
+      <xsl:text>&lt;!ENTITY % om.RO '' &gt;&#10;</xsl:text>
+      <xsl:text>&lt;!ENTITY % om.RR '' &gt;&#10;</xsl:text>
+      <xsl:text>]]&gt;&#10;</xsl:text>
+      <xsl:text>&lt;!ENTITY % om.RO '- o' &gt;&#10;</xsl:text>
+      <xsl:text>&lt;!ENTITY % om.RR '- -' &gt;&#10;</xsl:text>
+  </xsl:template>
+  <xsl:template name="datatypeMacros">
+      <xsl:call-template name="dtdComment">
+         <xsl:with-param name="text">
+            <xsl:text>Start datatype macro declarations</xsl:text>
+         </xsl:with-param>
+      </xsl:call-template>
+      <xsl:for-each select="key('MacroModule',@ident)">
+         <xsl:if test="@type='dt'">
+            <xsl:apply-templates mode="tangle" select="."/>
+         </xsl:if>
+      </xsl:for-each>
+      <xsl:call-template name="dtdComment">
+         <xsl:with-param name="text">
+            <xsl:text>End of datatype macro declarations</xsl:text>
+         </xsl:with-param>
+      </xsl:call-template>
+  </xsl:template>
+  <xsl:template name="predeclaredMacros">
+      <xsl:call-template name="dtdComment">
+         <xsl:with-param name="text">
+            <xsl:text>Start of pre-declared macros</xsl:text>
+         </xsl:with-param>
+      </xsl:call-template>
+      <xsl:for-each select="key('PredeclareMacrosModule',@ident)">
+         <xsl:apply-templates mode="tangle" select="."/>
+      </xsl:for-each>
+      <xsl:call-template name="dtdComment">
+         <xsl:with-param name="text">
+            <xsl:text>End of pre-declared macros</xsl:text>
+         </xsl:with-param>
+      </xsl:call-template>
+  </xsl:template>
+  <xsl:template name="normalClasses">
+      <xsl:call-template name="dtdComment">
+         <xsl:with-param name="text">
+            <xsl:text>Start of classes</xsl:text>
+         </xsl:with-param>
+      </xsl:call-template>
+      <xsl:apply-templates mode="tangle" select="key('ClassModule',@ident)"/>
+      <xsl:call-template name="dtdComment">
+         <xsl:with-param name="text">
+            <xsl:text>End of classes</xsl:text>
+         </xsl:with-param>
+      </xsl:call-template>
+  </xsl:template>
+  <xsl:template name="predeclaredClasses">
+      <xsl:call-template name="dtdComment">
+         <xsl:with-param name="text">
+            <xsl:text>Start of pre-declared classes</xsl:text>
+         </xsl:with-param>
+      </xsl:call-template>
+      <xsl:for-each select="key('predeclaredClasses',1)">
+         <xsl:choose>
+            <xsl:when test="@type='atts'">
+               <xsl:call-template name="classAtt">
+                  <xsl:with-param name="declare">false</xsl:with-param>
+               </xsl:call-template>
+            </xsl:when>
+            <xsl:when test="@type='model'">
+               <xsl:call-template name="classModel"/>
+            </xsl:when>
+         </xsl:choose>
+      </xsl:for-each>
+      <xsl:call-template name="dtdComment">
+         <xsl:with-param name="text">
+            <xsl:text>End of pre-declared classes</xsl:text>
+         </xsl:with-param>
+      </xsl:call-template>
+  </xsl:template>
+  <xsl:template name="normalMacros">
+      <xsl:if test="@type='core'">
+         <xsl:call-template name="dtdComment">
+            <xsl:with-param name="text">
+               <xsl:text>Global pre-declared macros</xsl:text>
+            </xsl:with-param>
+         </xsl:call-template>
+         <xsl:for-each select="key('PredeclareAllMacros',1)">
+            <xsl:text>&#10;&lt;!ENTITY % </xsl:text>
+            <xsl:value-of select="@ident"/>
+            <xsl:text> ''</xsl:text>
+            <xsl:text>&gt;&#10;</xsl:text>
+         </xsl:for-each>
+      </xsl:if>
+      <xsl:call-template name="dtdComment">
+         <xsl:with-param name="text">
+            <xsl:text>Start rest of  macro declarations</xsl:text>
+         </xsl:with-param>
+      </xsl:call-template>
+      <xsl:for-each select="key('MacroModule',@ident)">
+         <xsl:if test="not(@type='dt')">
+            <xsl:choose>
+               <xsl:when test="@predeclare='true'"/>
+               <!--	    <xsl:when test="key('PredeclareMacros',@ident)"/>-->
+	       <xsl:otherwise>
+		 <xsl:apply-templates mode="tangle" select="."/>
+               </xsl:otherwise>
+            </xsl:choose>
+         </xsl:if>
+      </xsl:for-each>
+      <xsl:call-template name="dtdComment">
+         <xsl:with-param name="text">
+            <xsl:text>End macros</xsl:text>
+         </xsl:with-param>
+      </xsl:call-template>
+  </xsl:template>
+  <xsl:template match="tei:schemaSpec">
+      <xsl:if test="$verbose='true'">
+         <xsl:message>schemaSpec <xsl:value-of select="@ident"/>
+			      </xsl:message>
+      </xsl:if>
+      <xsl:choose>
+         <xsl:when test="$outputDir='' or $outputDir='-'">
+            <xsl:call-template name="schemaOut"/>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:call-template name="generateOutput">
+               <xsl:with-param name="suffix">.dtd</xsl:with-param>
+               <xsl:with-param name="method">text</xsl:with-param>
+               <xsl:with-param name="body">
+                  <xsl:call-template name="schemaOut"/>
+               </xsl:with-param>
+            </xsl:call-template>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <xsl:template name="schemaOut">
+      <xsl:call-template name="dtdComment">
+         <xsl:with-param name="text">
+            <xsl:text>DTD Generated </xsl:text>
+            <xsl:call-template name="showDate"/>
+            <xsl:text>. </xsl:text>
+	    <xsl:call-template name="copyright"/>
+            <xsl:call-template name="makeTEIVersion"/>
+            <xsl:call-template name="makeDescription"/>
+         </xsl:with-param>
+      </xsl:call-template>
+      <xsl:choose>
+         <xsl:when test="tei:specGrpRef">
+            <xsl:variable name="SPECS">
+               <tei:schemaSpec>
+                  <xsl:copy-of select="@*"/>
+                  <xsl:apply-templates mode="expandSpecs"/>
+               </tei:schemaSpec>
+            </xsl:variable>
+            <xsl:for-each select="$SPECS/tei:schemaSpec">
+               <xsl:call-template name="schemaSpecBody"/>
+            </xsl:for-each>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:call-template name="schemaSpecBody"/>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <xsl:template name="schemaSpecBody">
+      <xsl:if test="$parameterize='true' and      count(key('NSELEMENTS',1))&gt;0">
+         <xsl:text>&lt;!ENTITY % NS '</xsl:text>
+         <xsl:value-of select="$nsPrefix"/>
+         <xsl:text>' &gt;&#10;</xsl:text>
+      </xsl:if>
+      <xsl:if test="$parameterize='true'">
+         <xsl:call-template name="NameList"/>
+      </xsl:if>
+      <xsl:text>&#10;&lt;!-- start datatypes --&gt;&#10;</xsl:text>
+      <xsl:apply-templates mode="tangle" select="tei:macroSpec[@type='dt']"/>
+      <xsl:text>&#10;&lt;!-- end datatypes --&gt;&#10;</xsl:text>
+      <xsl:if test="tei:classSpec[@predeclare='true']">
+         <xsl:text>&#10;&lt;!--predeclared classes --&gt;&#10;</xsl:text>
+         <xsl:for-each select="tei:classSpec[@predeclare='true']">
+	   <xsl:choose>
+	     <xsl:when test="@type='atts'">
+	       <xsl:call-template name="classAtt">
+		 <xsl:with-param name="declare">true</xsl:with-param>
+	       </xsl:call-template>
+	     </xsl:when>
+	     <xsl:when test="@type='model' and $parameterize='false'">
+	       <xsl:call-template name="classModel">
+		 <xsl:with-param name="declare">true</xsl:with-param>
+	       </xsl:call-template>
+	     </xsl:when>
+	   </xsl:choose>
+         </xsl:for-each>
+         <xsl:text>&#10;&lt;!--end of predeclared classes --&gt;&#10;</xsl:text>
+         <xsl:apply-templates mode="tangle" select="tei:classSpec"/>
+      </xsl:if>
+      <xsl:text>&#10;&lt;!-- start predeclared patterns --&gt;&#10;</xsl:text>
+      <xsl:for-each select="tei:macroSpec">
+	<xsl:if test="@predeclare='true'">
+	  <xsl:apply-templates mode="tangle" select="."/>
+	</xsl:if>
+      </xsl:for-each>
+      <xsl:text>&#10;&lt;!-- end predeclared patterns --&gt;&#10;</xsl:text>
+      <xsl:text>&#10;&lt;!-- start rest of patterns --&gt;&#10;</xsl:text>
+      <xsl:for-each select="tei:macroSpec">
+	<xsl:choose>
+	  <xsl:when test="@predeclare='true'"/>
+	  <xsl:when test="@type='dt'"/>
+	  <xsl:otherwise>
+	    <xsl:apply-templates mode="tangle" select="."/>
+	  </xsl:otherwise>
+	</xsl:choose>
+      </xsl:for-each>
+      <xsl:text>&#10;&lt;!-- end patterns --&gt;&#10;</xsl:text>
+      <xsl:if test="not(tei:classSpec[@predeclare='true'])">
+         <xsl:text>&#10;&lt;!-- start classes --&gt;&#10;</xsl:text>
+         <xsl:apply-templates mode="tangle" select="tei:classSpec[@type='atts']"/>
+         <xsl:apply-templates mode="tangle" select="tei:classSpec[@type='model']"/>
+         <xsl:text>&#10;&lt;!-- stop classes --&gt;&#10;</xsl:text>
+      </xsl:if>
+      <xsl:text>&#10;&lt;!-- start elements --&gt;&#10;</xsl:text>
+      <xsl:apply-templates mode="tangle" select="tei:elementSpec">
+         <xsl:sort select="@ident"/>
+      </xsl:apply-templates>
+      <xsl:text>&#10;&lt;!-- end elements --&gt;&#10;</xsl:text>
+  </xsl:template>
+  <xsl:template match="tei:macroSpec[@xml:id='TEIGIS']" mode="tangle"/>
+  <xsl:template name="NameList">
+      <xsl:choose>
+         <xsl:when test="self::tei:schemaSpec">
+            <xsl:for-each select="tei:elementSpec">
+               <xsl:sort select="@ident"/>
+               <xsl:call-template name="declareAnElement"/>
+            </xsl:for-each>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:for-each select="key('ELEMENTDOCS',1)">
+               <xsl:sort select="@ident"/>
+               <xsl:call-template name="declareAnElement"/>
+            </xsl:for-each>
+         </xsl:otherwise>
+      </xsl:choose>
+      <!-- walk over all the elementSpec elements and make list of 
+	 elements -->
+  </xsl:template>
+  <xsl:template name="declareAnElement">
+      <xsl:if test="not(starts-with(@ident,'%'))">
+         <xsl:text>&lt;!ENTITY % n.</xsl:text>
+         <xsl:value-of select="@ident"/>
+         <xsl:text> "</xsl:text>
+         <xsl:if test="$parameterize='true' and (@ns)">
+            <xsl:text>%NS;</xsl:text>
+         </xsl:if>
+         <xsl:choose>
+            <xsl:when test="tei:altIdent=@ident">
+               <xsl:value-of select="@ident"/>
+            </xsl:when>
+            <xsl:when test="tei:altIdent">
+               <xsl:value-of select="tei:altIdent"/>
+            </xsl:when>
+            <xsl:otherwise>
+               <xsl:value-of select="@ident"/>
+            </xsl:otherwise>
+         </xsl:choose>
+         <xsl:text>"&gt;&#10;</xsl:text>
+      </xsl:if>
+  </xsl:template>
+  <xsl:template name="linkStyle"/>
+  <xsl:template name="makeAnchor">
+      <xsl:param name="name"/>
+  </xsl:template>
+  <xsl:template match="rng:element[rng:anyName]">
+      <xsl:text>#PCDATA</xsl:text>
+  </xsl:template>
+  <xsl:template match="rng:zeroOrMore">
+      <xsl:variable name="body">
+         <xsl:call-template name="content">
+            <xsl:with-param name="sep" select="','"/>
+         </xsl:call-template>
+      </xsl:variable>
+      <xsl:if test="not($body='')">
+         <xsl:call-template name="checkStart"/>
+         <xsl:value-of select="$body"/>
+         <xsl:text>*</xsl:text>
+         <xsl:call-template name="checkEnd"/>
+      </xsl:if>
+  </xsl:template>
+  <xsl:template match="rng:oneOrMore">
+      <xsl:variable name="body">
+         <xsl:call-template name="content">
+            <xsl:with-param name="sep" select="','"/>
+         </xsl:call-template>
+      </xsl:variable>
+      <xsl:if test="not($body='')">
+         <xsl:call-template name="checkStart"/>
+         <xsl:value-of select="$body"/>
+         <xsl:text>+</xsl:text>
+         <xsl:call-template name="checkEnd"/>
+      </xsl:if>
+  </xsl:template>
+  <xsl:template match="rng:optional">
+      <xsl:variable name="body">
+         <xsl:call-template name="content">
+            <xsl:with-param name="sep" select="','"/>
+         </xsl:call-template>
+      </xsl:variable>
+      <xsl:choose>
+         <xsl:when test="$body=''"> </xsl:when>
+         <xsl:otherwise>
+            <xsl:call-template name="checkStart"/>
+            <xsl:value-of select="$body"/>
+            <xsl:text>?</xsl:text>
+            <xsl:call-template name="checkEnd"/>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <xsl:template match="rng:choice">
+      <xsl:call-template name="checkStart"/>
+      <xsl:choose>
+         <xsl:when test="rng:value and ancestor::tei:elementSpec">
+            <xsl:text>(#PCDATA)</xsl:text>
+         </xsl:when>
+         <xsl:when test="rng:value">
+            <xsl:text> (</xsl:text>
+            <xsl:for-each select="rng:value">
+               <xsl:value-of select="."/>
+               <xsl:if test="following-sibling::rng:value">
+                  <xsl:text>|&#10;</xsl:text>
+               </xsl:if>
+            </xsl:for-each>) </xsl:when>
+         <xsl:otherwise>
+            <xsl:call-template name="content">
+               <xsl:with-param name="sep" select="' |&#xA; '"/>
+            </xsl:call-template>
+         </xsl:otherwise>
+      </xsl:choose>
+      <xsl:call-template name="checkEnd"/>
+  </xsl:template>
+  <xsl:template match="rng:group|rng:mixed">
+      <xsl:call-template name="content">
+         <xsl:with-param name="sep" select="','"/>
+      </xsl:call-template>
+  </xsl:template>
+  <xsl:template match="rng:interleave">
+      <xsl:call-template name="content">
+         <xsl:with-param name="sep" select="','"/>
+      </xsl:call-template>
+  </xsl:template>
+  <xsl:template name="content">
+      <xsl:param name="sep"/>
+        <xsl:variable name="parent" select="local-name(..)"/>
+        <xsl:variable name="contentbody">
+          <xsl:variable name="members">
+            <M>
+              <xsl:for-each select="rng:*|processing-instruction()">
+                  <xsl:variable name="F">
+                     <xsl:choose>
+                        <xsl:when test="self::processing-instruction()">
+                           <xsl:apply-templates select="."/>
+                        </xsl:when>
+                        <xsl:when test="self::rng:ref and $parameterize='false'">
+                           <xsl:choose>
+                              <xsl:when test="key('CLASSES',@name)">
+                                 <xsl:variable name="exists">
+                                    <xsl:call-template name="checkClass">
+                                       <xsl:with-param name="id" select="@name"/>
+                                    </xsl:call-template>
+                                 </xsl:variable>
+                                 <xsl:choose>
+                                    <xsl:when test="$exists=''">
+                                       <xsl:text>_DUMMY_</xsl:text>
+                                       <xsl:value-of select="@name"/>
+                                    </xsl:when>
+                                    <xsl:otherwise>
+                                       <xsl:apply-templates select="."/>
+                                    </xsl:otherwise>
+                                 </xsl:choose>
+                              </xsl:when>
+                              <xsl:when test="key('CLASSES',substring-before(@name,'_'))">
+                                 <xsl:variable name="exists">
+                                    <xsl:call-template name="checkClass">
+                                       <xsl:with-param name="id" select="substring-before(@name,'_')"/>
+                                    </xsl:call-template>
+                                 </xsl:variable>
+                                 <xsl:choose>
+                                    <xsl:when test="$exists=''">
+                                       <xsl:text>_DUMMY_</xsl:text>
+                                       <xsl:value-of select="@name"/>
+                                    </xsl:when>
+                                    <xsl:otherwise>
+                                       <xsl:apply-templates select="."/>
+                                    </xsl:otherwise>
+                                 </xsl:choose>
+                              </xsl:when>
+                              <xsl:when test="key('MACROS',@name)">
+                                 <xsl:apply-templates select="."/>
+                              </xsl:when>
+                              <xsl:when test="key('ELEMENTS',@name)">
+                                 <xsl:apply-templates select="."/>
+                              </xsl:when>
+                           </xsl:choose>
+                        </xsl:when>
+                        <xsl:otherwise>
+                           <xsl:apply-templates select="."/>
+                        </xsl:otherwise>
+                     </xsl:choose>
+                  </xsl:variable>
+                  <xsl:if test="not($F='')">
+                     <N>
+                        <xsl:value-of select="$F"/>
+                     </N>
+                  </xsl:if>
+              </xsl:for-each>
+            </M>
+          </xsl:variable>
+          <xsl:for-each select="$members/M">
+            <xsl:choose>
+              <xsl:when test="starts-with(N[1],'(') and count(N)=1"/>
+              <xsl:when test="$parent='content' and count(N)=1 and starts-with(N[1],'%macro.')"/>
+              <xsl:when test="$parent='content' and count(N)=1">
+                  <xsl:text>(</xsl:text>
+              </xsl:when>
+              <xsl:when test="count(N)=1 and starts-with(N,'%')">
+                  <xsl:text>(</xsl:text>
+              </xsl:when>
+              <xsl:when test="count(N)&gt;1">
+                  <xsl:text>(</xsl:text>
+              </xsl:when>
+            </xsl:choose>
+            <xsl:for-each select="N">
+              <xsl:choose>
+                  <xsl:when test="starts-with(.,'_DUMMY_') and .=preceding-sibling::N[1]"/>
+                  <xsl:otherwise>
+                     <xsl:value-of select="."/>
+                     <xsl:choose>
+                        <xsl:when test="self::N[1]='|&#xA;'"/>
+                        <xsl:when test="self::N[1]='('"/>
+                        <xsl:when test="self::N[1]=')' and position() &lt; last()">
+                           <xsl:value-of select="$sep"/>
+                        </xsl:when>
+                        <xsl:when test="following-sibling::N[1]='('"/>
+                        <xsl:when test="following-sibling::N[1]=')'"/>
+                        <xsl:when test="following-sibling::N[1]='|&#xA;'"/>
+                        <xsl:when test="position() &lt; last()">
+                           <xsl:value-of select="$sep"/>
+                        </xsl:when>
+                     </xsl:choose>
+                  </xsl:otherwise>
+              </xsl:choose>
+            </xsl:for-each>
+            <xsl:choose>
+              <xsl:when test="starts-with(N[1],'(') and count(N)=1"/>
+              <xsl:when test="$parent='content' and count(N)=1 and starts-with(N[1],'%macro.')"/>
+              <xsl:when test="$parent='content' and count(N)=1">
+                  <xsl:text>)</xsl:text>
+              </xsl:when>
+              <xsl:when test="count(N)=1 and starts-with(N,'%')">
+                  <xsl:text>)</xsl:text>
+              </xsl:when>
+              <xsl:when test="count(N)&gt;1">
+                  <xsl:text>)</xsl:text>
+              </xsl:when>
+            </xsl:choose>
+          </xsl:for-each>
+        </xsl:variable>
+        <xsl:choose>
+          <xsl:when test="$contentbody=''"/>
+          <xsl:when test="$contentbody='()'"/>
+	        <!-- some special cases of known evil -->
+          <xsl:when test="$contentbody='(#PCDATA |  #PCDATA)'">
+            <xsl:text>(#PCDATA)</xsl:text>
+          </xsl:when>
+          <xsl:when test="contains($contentbody,'#PCDATA') and contains($contentbody,'%macro.anyXML;')">
+            <xsl:text>(#PCDATA)</xsl:text>
+          </xsl:when>
+          <xsl:when test="contains($contentbody, '| ()')">
+            <xsl:value-of select="substring-before($contentbody,'| ()')"/>
+            <xsl:value-of select="substring-after($contentbody,'| ()')"/>
+          </xsl:when>
+          <xsl:when test="contains($contentbody, ',)')">
+            <xsl:value-of select="substring-before($contentbody,',)')"/>
+	           <xsl:text>)</xsl:text>
+            <xsl:value-of select="substring-after($contentbody,',)')"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:value-of select="$contentbody"/>
+          </xsl:otherwise>
+        </xsl:choose>
+  </xsl:template>
+  <xsl:template match="tei:datatype">
+      <xsl:choose>
+         <xsl:when test="rng:data/@type='ID'">
+            <xsl:text> ID</xsl:text>
+         </xsl:when>
+         <xsl:when test="rng:data/@type='IDREF'">
+            <xsl:text> IDREF</xsl:text>
+         </xsl:when>
+         <xsl:when test="rng:data/@type='IDREFS'">
+            <xsl:text> IDREFS</xsl:text>
+         </xsl:when>
+         <xsl:when test="rng:data/@type='NMTOKEN'">
+            <xsl:text> NMTOKEN</xsl:text>
+         </xsl:when>
+         <xsl:when test="rng:data/@type='NMTOKENS'">
+            <xsl:text> NMTOKENS</xsl:text>
+         </xsl:when>
+         <xsl:when test="rng:data/@type='boolean'">
+            <xsl:text> (true | false) </xsl:text>
+         </xsl:when>
+         <xsl:when test="rng:ref">
+            <xsl:text> %</xsl:text>
+            <xsl:value-of select="rng:ref/@name"/>
+            <xsl:text>; </xsl:text>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:text> CDATA</xsl:text>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <xsl:template match="rng:element">
+      <xsl:choose>
+         <xsl:when test="parent::tei:content/parent::tei:macroSpec">
+            <xsl:call-template name="topLevel"/>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:value-of select="@name"/>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+   <!--  
+       <xsl:template match="tei:text()"/>-->
+  <xsl:template match="rng:empty">
+      <xsl:text>EMPTY</xsl:text>
+  </xsl:template>
+  <xsl:template match="rng:data">
+      <xsl:choose>
+         <xsl:when test="parent::tei:content/parent::tei:macroSpec[@type='dt']">
+            <xsl:text> CDATA </xsl:text>
+         </xsl:when>
+         <xsl:when test="parent::tei:content">
+            <xsl:text> (#PCDATA)</xsl:text>
+         </xsl:when>
+         <xsl:when test="@type='ID'"> ID </xsl:when>
+         <xsl:when test="@type='IDREF'"> IDREF </xsl:when>
+         <xsl:when test="@type='IDREFS'"> IDREFS </xsl:when>
+         <xsl:otherwise> CDATA </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <xsl:template match="rng:text">
+      <xsl:choose>
+         <xsl:when test="parent::tei:content/parent::tei:macroSpec">
+            <xsl:call-template name="topLevel"/>
+         </xsl:when>
+         <xsl:when test="parent::tei:content">
+            <xsl:text> (#PCDATA)</xsl:text>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:text> #PCDATA</xsl:text>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <xsl:template match="tei:macroSpec[@type='dt']/tei:content/rng:text">
+      <xsl:text> CDATA</xsl:text>
+  </xsl:template>
+  <xsl:template match="tei:macroSpec[@type='dt']/tei:content/rng:data">
+      <xsl:text> CDATA</xsl:text>
+  </xsl:template>
+  <xsl:template match="tei:macroSpec[@type='epe']/tei:content/rng:text">
+      <xsl:text>CDATA</xsl:text>
+  </xsl:template>
+  <xsl:template match="tei:macroSpec[@type='dt']/tei:content/rng:list">
+      <xsl:text> CDATA</xsl:text>
+  </xsl:template>
+  <xsl:template match="tei:macroSpec[@type='dt']/tei:content/rng:choice">
+      <xsl:choose>
+         <xsl:when test="rng:value">
+            <xsl:text>(</xsl:text>
+            <xsl:for-each select="rng:value">
+               <xsl:value-of select="."/>
+               <xsl:if test="following-sibling::rng:value">|
+</xsl:if>
+            </xsl:for-each>
+            <xsl:if test="rng:data/@type='boolean'">
+               <xsl:text> | true | false</xsl:text>
+            </xsl:if>
+            <xsl:text>)</xsl:text>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:text> CDATA</xsl:text>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <xsl:template match="rng:text" mode="simple">
+      <xsl:choose>
+         <xsl:when test="parent::tei:content/parent::tei:macroSpec[@type='dt']">
+            <xsl:text> CDATA</xsl:text>
+         </xsl:when>
+         <xsl:when test="parent::tei:content/parent::tei:macroSpec[@type='pe']">
+            <xsl:text>#PCDATA</xsl:text>
+         </xsl:when>
+         <xsl:when test="parent::tei:content and not(following-sibling::rng:*) and not (preceding-sibling::rng:*)">
+            <xsl:text>(#PCDATA)</xsl:text>
+         </xsl:when>
+         <xsl:when test="parent::tei:content and not(following-sibling::rng:*) and not (preceding-sibling::rng:*)">
+            <xsl:text>(#PCDATA)</xsl:text>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:text>#PCDATA</xsl:text>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <xsl:template match="processing-instruction()[name(.)='teidtd']">
+      <xsl:value-of select="."/>
+  </xsl:template>
+  <xsl:template match="processing-instruction()[name(.)='teidtd']" mode="tangle">
+      <xsl:value-of select="."/>
+  </xsl:template>
+  <xsl:template match="rng:ref">
+      <xsl:choose>
+         <xsl:when test="parent::tei:content/parent::tei:macroSpec">
+            <xsl:call-template name="topLevel"/>
+         </xsl:when>
+         <xsl:when test="count(parent::tei:content/rng:*)&gt;1">
+            <xsl:choose>
+               <xsl:when test="not(preceding-sibling::rng:*)">
+                  <xsl:text>(</xsl:text>
+               </xsl:when>
+               <xsl:otherwise>
+                  <xsl:text>,</xsl:text>
+               </xsl:otherwise>
+            </xsl:choose>
+            <xsl:call-template name="refbody"/>
+            <xsl:if test="not(following-sibling::rng:*)">
+               <xsl:text>)</xsl:text>
+            </xsl:if>
+         </xsl:when>
+         <xsl:when test="key('MACROS',@name)">
+            <xsl:call-template name="refbody"/>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:if test="parent::tei:content">(</xsl:if>
+            <xsl:call-template name="refbody"/>
+            <xsl:if test="parent::tei:content">)</xsl:if>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <xsl:template match="rng:ref" mode="simple">
+      <xsl:call-template name="refbody"/>
+  </xsl:template>
+  <xsl:template name="refbody">
+      <xsl:variable name="R">
+         <xsl:choose>
+            <xsl:when test="$parameterize='false'">
+               <xsl:choose>
+                  <xsl:when test="key('CLASSES',@name)">
+                     <xsl:variable name="exists">
+                        <xsl:call-template name="checkClass">
+                           <xsl:with-param name="id" select="@name"/>
+                        </xsl:call-template>
+                     </xsl:variable>
+                     <xsl:choose>
+                        <xsl:when test="$exists=''">
+                           <xsl:text>_DUMMY_</xsl:text>
+                           <xsl:value-of select="@name"/>
+                        </xsl:when>
+                        <xsl:otherwise>
+                           <xsl:text>%</xsl:text>
+                           <xsl:value-of select="@name"/>
+                           <xsl:text>;</xsl:text>
+                        </xsl:otherwise>
+                     </xsl:choose>
+                  </xsl:when>
+                  <xsl:when test="key('CLASSES',substring-before(@name,'_'))">
+                     <xsl:variable name="exists">
+                        <xsl:call-template name="checkClass">
+                           <xsl:with-param name="id" select="substring-before(@name,'_')"/>
+                        </xsl:call-template>
+                     </xsl:variable>
+                     <xsl:choose>
+                        <xsl:when test="$exists=''">
+                           <xsl:text>_DUMMY_</xsl:text>
+                           <xsl:value-of select="@name"/>
+                        </xsl:when>
+                        <xsl:otherwise>
+                           <xsl:text>%</xsl:text>
+                           <xsl:value-of select="@name"/>
+                           <xsl:text>;</xsl:text>
+                        </xsl:otherwise>
+                     </xsl:choose>
+                  </xsl:when>
+                  <xsl:when test="key('MACROS',@name)">
+                     <xsl:text>%</xsl:text>
+                     <xsl:value-of select="@name"/>
+                     <xsl:text>;</xsl:text>
+                  </xsl:when>
+                  <xsl:when test="key('ELEMENTS',@name)">
+                     <xsl:for-each select="key('ELEMENTS',@name)">
+                        <xsl:choose>
+                           <xsl:when test="tei:altIdent=@ident">
+                              <xsl:value-of select="@ident"/>
+                           </xsl:when>
+                           <xsl:when test="tei:altIdent">
+                              <xsl:value-of select="normalize-space(tei:altIdent)"/>
+                           </xsl:when>
+                           <xsl:otherwise>
+                              <xsl:value-of select="@ident"/>
+                           </xsl:otherwise>
+                        </xsl:choose>
+                     </xsl:for-each>
+                  </xsl:when>
+               </xsl:choose>
+            </xsl:when>
+            <xsl:when test="@name='IGNORE' or @name='INCLUDE'">
+               <xsl:value-of select="@name"/>
+            </xsl:when>
+            <xsl:when test="contains(@name, '.')">
+               <xsl:text>%</xsl:text>
+               <xsl:value-of select="@name"/>
+               <xsl:text>;</xsl:text>
+            </xsl:when>
+            <xsl:otherwise>
+               <xsl:text>%n.</xsl:text>
+               <xsl:value-of select="@name"/>
+               <xsl:text>;</xsl:text>
+            </xsl:otherwise>
+         </xsl:choose>
+      </xsl:variable>
+      <xsl:value-of select="$R"/>
+  </xsl:template>
+  <xsl:template name="topLevel">
+      <xsl:variable name="unit">
+         <xsl:apply-templates mode="simple" select="."/>
+      </xsl:variable>
+      <xsl:if test="not($unit='')">
+         <xsl:if test="preceding-sibling::rng:*">
+            <xsl:choose>
+               <xsl:when test="preceding-sibling::processing-instruction()"/>
+               <xsl:otherwise>
+                  <xsl:text>|&#10;</xsl:text>
+               </xsl:otherwise>
+            </xsl:choose>
+         </xsl:if>
+         <xsl:value-of select="$unit"/>
+      </xsl:if>
+  </xsl:template>
+  <xsl:template match="rng:element" mode="simple">
+      <xsl:choose>
+         <xsl:when test="@name">
+            <xsl:value-of select="@name"/>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:text>ANY</xsl:text>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <xsl:template match="tei:macroSpec" mode="tangle">
+      <xsl:choose>
+         <xsl:when test="@depend and $parameterize='true'">
+            <xsl:if test="$verbose='true'">
+               <xsl:message>Dependency on <xsl:value-of select="@depend"/> for <xsl:value-of select="@ident"/>
+               </xsl:message>
+            </xsl:if>
+            <xsl:text>&#10; &lt;![%TEI.</xsl:text>
+            <xsl:value-of select="@depend"/>;[ <xsl:call-template name="macroBody"/>
+            <xsl:text>&#10;]]&gt;</xsl:text>
+         </xsl:when>
+         <xsl:when test="@depend and count(key('ElementModule',@depend))=0">
+            <xsl:if test="$verbose='true'">
+               <xsl:message>Dependency on <xsl:value-of select="@depend"/>, but not used in
+						this schema </xsl:message>
+            </xsl:if>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:call-template name="macroBody"/>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <xsl:template name="macroBody">
+      <xsl:text>&#10;&lt;!ENTITY </xsl:text>
+      <xsl:if test="not(@type) or @type='defaultpe' or @type='pe' or @type='epe' or @type='dt'">
+         <xsl:text>%</xsl:text>
+      </xsl:if>
+      <xsl:text> </xsl:text>
+      <xsl:value-of select="@ident"/>
+      <xsl:text> '</xsl:text>
+      <xsl:for-each select="tei:content">
+	<xsl:choose>
+	  <xsl:when test=".//rng:anyName">
+	    <xsl:text> ANY</xsl:text>
+	  </xsl:when>
+	  <xsl:otherwise>
+	    <xsl:apply-templates
+		select="tei:*|rng:*|processing-instruction()"/>
+	  </xsl:otherwise>
+	</xsl:choose>
+      </xsl:for-each>
+      <xsl:text>' &gt;&#10;</xsl:text>
+  </xsl:template>
+  <xsl:template match="tei:elementSpec" mode="tangle">
+      <xsl:if test="$verbose='true'">
+         <xsl:message> .... elementSpec <xsl:value-of select="@ident"/>
+         </xsl:message>
+      </xsl:if>
+      <xsl:choose>
+         <xsl:when test="starts-with(@ident,'%')">
+            <xsl:call-template name="elementBody"/>
+         </xsl:when>
+         <xsl:when test="$parameterize='false'">
+            <xsl:call-template name="elementBody"/>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:text>&#10;&lt;!ENTITY % </xsl:text>
+            <xsl:value-of select="@ident"/>
+            <xsl:text> 'INCLUDE' &gt;&#10;&lt;![ %</xsl:text>
+            <xsl:value-of select="@ident"/>
+            <xsl:text>; [&#10;</xsl:text>
+            <xsl:call-template name="elementBody"/>
+            <xsl:text>&#10;]]&gt;&#10;</xsl:text>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <xsl:template name="elementBody">
+      <xsl:variable name="ename">
+         <xsl:choose>
+            <xsl:when test="$parameterize='false'">
+               <xsl:choose>
+                  <xsl:when test="@ns='http://www.w3.org/1999/xhtml'">
+                     <xsl:text>html:</xsl:text>
+                     <xsl:value-of select="@ident"/>
+                  </xsl:when>
+                  <xsl:when test="tei:altIdent=@ident">
+                     <xsl:value-of select="@ident"/>
+                  </xsl:when>
+                  <xsl:when test="tei:altIdent">
+                     <xsl:value-of select="normalize-space(tei:altIdent)"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:value-of select="@ident"/>
+                  </xsl:otherwise>
+               </xsl:choose>
+            </xsl:when>
+            <xsl:when test="starts-with(@ident,'%')">
+               <xsl:value-of select="@ident"/>
+            </xsl:when>
+            <xsl:otherwise>
+               <xsl:text>%n.</xsl:text>
+               <xsl:value-of select="@ident"/>
+               <xsl:text>;</xsl:text>
+            </xsl:otherwise>
+         </xsl:choose>
+      </xsl:variable>
+      <xsl:text>&#10;&lt;!--doc:</xsl:text>
+      <xsl:call-template name="makeDescription">
+         <xsl:with-param name="includeValList">true</xsl:with-param>
+         <xsl:with-param name="coded">false</xsl:with-param>
+      </xsl:call-template>
+      <xsl:text> --&gt;&#10;</xsl:text>
+      <xsl:text>&lt;!ELEMENT </xsl:text>
+      <xsl:value-of select="$ename"/>
+      <xsl:if test="$parameterize='true'">
+         <xsl:text> %om.RR;</xsl:text>
+      </xsl:if>
+      <xsl:text> </xsl:text>
+      <xsl:variable name="Contents">
+         <BLAH>
+            <xsl:choose>
+	      <xsl:when test="tei:content/rng:element[rng:anyName]">
+		<xsl:text> (#PCDATA)</xsl:text>
+	      </xsl:when>
+	      <xsl:when test="tei:content/rng:element">
+                  <xsl:text> ANY</xsl:text>
+	      </xsl:when>
+	      <xsl:when test="tei:valList[@type='closed']">
+		<xsl:text> (#PCDATA)</xsl:text>
+	      </xsl:when>
+	      <xsl:when test="tei:content">
+		<xsl:apply-templates select="tei:content/*"/>
+	      </xsl:when>
+	      <xsl:otherwise>
+		<xsl:text/>
+	      </xsl:otherwise>
+            </xsl:choose>
+         </BLAH>
+      </xsl:variable>
+      <xsl:choose>
+         <xsl:when test="$Contents=''">
+            <xsl:text> EMPTY</xsl:text>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:value-of select="$Contents"/>
+         </xsl:otherwise>
+      </xsl:choose>
+      <xsl:text>&gt;</xsl:text>
+      <xsl:choose>
+         <xsl:when test="@ns and @ns=''"> </xsl:when>
+         <xsl:when test="key('LISTSCHEMASPECS',$whichSchemaSpec)/@ns=''"> </xsl:when>
+         <xsl:when test="@ns">
+            <xsl:text>&#10;&lt;!ATTLIST </xsl:text>
+            <xsl:value-of select="$ename"/>
+            <xsl:text> xmlns CDATA "</xsl:text>
+            <xsl:value-of select="@ns"/>
+            <xsl:text>"</xsl:text>
+            <xsl:text>&gt;</xsl:text>
+         </xsl:when>
+         <xsl:when test="key('LISTSCHEMASPECS',$whichSchemaSpec)/@ns">
+            <xsl:text>&#10;&lt;!ATTLIST </xsl:text>
+            <xsl:value-of select="$ename"/>
+            <xsl:text> xmlns CDATA "</xsl:text>
+            <xsl:value-of select="ancestor::tei:schemaSpec/@ns"/>
+            <xsl:text>"</xsl:text>
+            <xsl:text>&gt;</xsl:text>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:text>&#10;&lt;!ATTLIST </xsl:text>
+            <xsl:value-of select="$ename"/>
+            <xsl:text> xmlns CDATA "http://www.tei-c.org/ns/1.0"</xsl:text>
+            <xsl:text>&gt;</xsl:text>
+         </xsl:otherwise>
+      </xsl:choose>
+      <xsl:variable name="maybeatts">
+         <xsl:if test="$parameterize='true' and $autoGlobal='true'">
+            <xsl:text>&#10; %att.global.attributes;</xsl:text>
+         </xsl:if>
+         <xsl:if test="$parameterize='true'">
+            <xsl:apply-templates mode="tangleAtts" select="tei:classes/tei:memberOf"/>
+         </xsl:if>
+         <xsl:call-template name="attributeList"/>
+    </xsl:variable>
+      <xsl:if test="string-length($maybeatts) &gt;0">
+         <xsl:text>&#10;&lt;!ATTLIST </xsl:text>
+         <xsl:value-of select="$ename"/>
+         <xsl:value-of select="$maybeatts"/>
+         <xsl:text> &gt;</xsl:text>
+      </xsl:if>
+      <xsl:if test="@ident='TEI' or @ident='teiCorpus'">
+         <xsl:text>&#10;&lt;!ATTLIST </xsl:text>
+         <xsl:value-of select="$ename"/>
+         <xsl:text> xsi:schemaLocation CDATA #IMPLIED&#10;</xsl:text>
+         <xsl:text> xmlns:xsi CDATA #FIXED 'http://www.w3.org/2001/XMLSchema-instance'&#10;</xsl:text>
+         <xsl:text> &gt;</xsl:text>
+      </xsl:if>
+  </xsl:template>
+  <xsl:template name="attclasses">
+      <xsl:for-each select="tei:classes/tei:memberOf">
+         <xsl:for-each select="key('IDENTS',@key)[1]">
+            <xsl:if test="@type='atts'"> %<xsl:value-of select="@ident"/>
+					          <xsl:text>.attributes;</xsl:text>
+				        </xsl:if>
+         </xsl:for-each>
+      </xsl:for-each>
+  </xsl:template>
+  <xsl:template name="classAtt">
+      <xsl:param name="declare">true</xsl:param>
+      <xsl:if test="$verbose='true'">
+         <xsl:message> .... <xsl:value-of select="@ident"/>.attributes</xsl:message>
+      </xsl:if>
+      <xsl:variable name="thisclass">
+         <xsl:value-of select="@ident"/>
+      </xsl:variable>
+      <xsl:choose>
+         <xsl:when test="$declare='false'">
+            <xsl:text>&#10;&lt;!ENTITY % </xsl:text>
+            <xsl:value-of select="$thisclass"/>
+            <xsl:text>.attributes</xsl:text>
+            <xsl:text> ''&gt;</xsl:text>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:choose>
+               <xsl:when test="$parameterize='true'">
+                  <xsl:text>&#10;&lt;!ENTITY % </xsl:text>
+                  <xsl:value-of select="$thisclass"/>
+                  <xsl:text>.attributes '</xsl:text>
+                  <xsl:call-template name="attclasses"/>
+                  <xsl:call-template name="attributeList"/>
+                  <xsl:text>'&gt; </xsl:text>
+               </xsl:when>
+               <xsl:otherwise>
+                  <xsl:text>&lt;!ENTITY % </xsl:text>
+                  <xsl:value-of select="$thisclass"/>
+                  <xsl:text>.attributes '</xsl:text>
+                  <xsl:call-template name="attclasses"/>
+                  <xsl:call-template name="attributeList"/>
+                  <xsl:text>'&gt; </xsl:text>
+                  <xsl:for-each select="tei:attList/tei:attDef">
+                     <xsl:text>&#10;&lt;!ENTITY % </xsl:text>
+                     <xsl:value-of select="$thisclass"/>
+                     <xsl:text>.attribute.</xsl:text>
+                     <xsl:value-of select="translate(@ident,':','')"/>
+                     <xsl:text> '</xsl:text>
+                     <xsl:apply-templates mode="tangle" select="."/>
+                     <xsl:text>'&gt;&#10;</xsl:text>
+                  </xsl:for-each>
+               </xsl:otherwise>
+            </xsl:choose>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <xsl:template match="tei:classSpec" mode="tagatts">
+      <xsl:if test="@type='atts'">
+         <xsl:if test="$verbose='true'">
+            <xsl:message> .... added contents of [%<xsl:value-of select="@ident"/>.attributes;]</xsl:message>
+         </xsl:if>
+         <xsl:text>&#10; %</xsl:text>
+         <xsl:value-of select="@ident"/>
+         <xsl:text>.attributes;</xsl:text>
+      </xsl:if>
+  </xsl:template>
+  <xsl:template match="tei:moduleRef[@key]" mode="tangle">
+      <xsl:if test="$verbose='true'">
+         <xsl:message> moduleRef to <xsl:value-of select="@key"/>
+			      </xsl:message>
+      </xsl:if>
+      <xsl:text>&#10;&lt;!ENTITY %</xsl:text>
+      <xsl:text> file.</xsl:text>
+      <xsl:value-of select="@key"/>
+      <xsl:text> </xsl:text>
+      <xsl:text>PUBLIC</xsl:text>
+      <xsl:text> '-//TEI P5//</xsl:text>
+      <xsl:value-of select="key('FILES',@key)/tei:altIdent[@type='FPI']"/>
+      <xsl:text>//EN' '</xsl:text>
+      <xsl:value-of select="@key"/>
+      <xsl:text>.dtd'</xsl:text>
+      <xsl:text> &gt;&#10;</xsl:text>
+      <xsl:text>%file.</xsl:text>
+      <xsl:value-of select="@key"/>
+      <xsl:text>;&#10;</xsl:text>
+  </xsl:template>
+  <xsl:template match="tei:classSpec" mode="tangle">
+      <xsl:if test="$verbose='true'">
+         <xsl:message> .. classSpec <xsl:value-of select="@ident"/>,<xsl:value-of select="@type"/></xsl:message>
+      </xsl:if>
+      <xsl:choose>
+         <xsl:when test="@type='atts'">
+            <xsl:call-template name="classAtt"/>
+         </xsl:when>
+         <xsl:when test="@type='model'">
+            <xsl:call-template name="classModel"/>
+         </xsl:when>
+      </xsl:choose>
+  </xsl:template>
+  <xsl:template match="tei:classSpec" mode="process">
+      <xsl:choose>
+         <xsl:when test="@type='atts'">
+            <xsl:call-template name="classAtt"/>
+         </xsl:when>
+         <xsl:when test="@type='model'">
+            <xsl:call-template name="classModel"/>
+         </xsl:when>
+      </xsl:choose>
+  </xsl:template>
+  <xsl:template name="classModel">
+      <xsl:param name="declare">false</xsl:param>
+      <xsl:call-template name="processClassDefinition">
+         <xsl:with-param name="type">
+            <xsl:choose>
+               <xsl:when test="@generate">
+                  <xsl:value-of select="@generate"/>
+               </xsl:when>
+               <xsl:otherwise>
+                  <xsl:text>alternation
+	    sequence
+	    sequenceOptional
+	    sequenceOptionalRepeatable
+	    sequenceRepeatable</xsl:text>
+               </xsl:otherwise>
+            </xsl:choose>
+         </xsl:with-param>
+         <xsl:with-param name="declare" select="$declare"/>
+      </xsl:call-template>
+  </xsl:template>
+  <xsl:template name="makeClassDefinition">
+      <xsl:param name="type">alternation</xsl:param>
+      <xsl:param name="declare"/>
+      <xsl:variable name="IDENT">
+         <xsl:value-of select="@ident"/>
+         <xsl:choose>
+            <xsl:when test="$type='alternation'"/>
+            <xsl:otherwise>
+               <xsl:text>_</xsl:text>
+               <xsl:value-of select="$type"/>
+            </xsl:otherwise>
+         </xsl:choose>
+      </xsl:variable>
+      <xsl:if test="$verbose='true'">
+         <xsl:message> .... ... generate model <xsl:value-of select="$type"/> for <xsl:value-of select="@ident"/>
+			      </xsl:message>
+      </xsl:if>
+      <xsl:if test="$parameterize='true'">
+         <xsl:text>&#10;&lt;!ENTITY % x.</xsl:text>
+         <xsl:value-of select="$IDENT"/>
+         <xsl:text> "" &gt;</xsl:text>
+      </xsl:if>
+      <xsl:text>&#10;&lt;!ENTITY % </xsl:text>
+      <xsl:value-of select="$IDENT"/>
+      <xsl:text> "</xsl:text>
+      <xsl:if test="$parameterize='true'">
+         <xsl:text>%x.</xsl:text>
+         <xsl:value-of select="$IDENT"/>
+         <xsl:text>; </xsl:text>
+      </xsl:if>
+      <xsl:variable name="generate" select="@generate"/>
+      <xsl:variable name="members">
+         <M>
+            <xsl:for-each select="key('CLASSMEMBERS',@ident)">
+               <xsl:variable name="N">
+                  <xsl:choose>
+                     <xsl:when test="$parameterize='false'">
+                        <xsl:choose>
+                           <xsl:when test="key('CLASSES',@ident)">
+                              <xsl:variable name="exists">
+                                 <xsl:call-template name="checkClass">
+                                    <xsl:with-param name="id" select="@ident"/>
+                                 </xsl:call-template>
+                              </xsl:variable>
+                              <xsl:if test="not($exists='')">
+                                 <xsl:text>%</xsl:text>
+                                 <xsl:value-of select="@ident"/>
+                                 <xsl:text>;</xsl:text>
+                              </xsl:if>
+                           </xsl:when>
+                           <xsl:when test="key('MACROS',@ident)">
+                              <xsl:text>%</xsl:text>
+                              <xsl:value-of select="@ident"/>
+                              <xsl:text>;</xsl:text>
+                           </xsl:when>
+                           <xsl:when test="key('ELEMENTS',@ident)">
+                              <xsl:choose>
+                                 <xsl:when test="tei:altIdent=@ident">
+                                    <xsl:value-of select="@ident"/>
+                                 </xsl:when>
+                                 <xsl:when test="tei:altIdent">
+                                    <xsl:value-of select="normalize-space(tei:altIdent)"/>
+                                 </xsl:when>
+                                 <xsl:otherwise>
+                                    <xsl:value-of select="@ident"/>
+                                 </xsl:otherwise>
+                              </xsl:choose>
+                           </xsl:when>
+                        </xsl:choose>
+                     </xsl:when>
+                     <xsl:when test="self::tei:elementSpec">
+                        <xsl:if test="$parameterize='true'">
+                           <xsl:text>%n.</xsl:text>
+                        </xsl:if>
+                        <xsl:value-of select="@ident"/>
+                        <xsl:if test="$parameterize='true'">
+                           <xsl:text>;</xsl:text>
+                        </xsl:if>
+                     </xsl:when>
+                     <xsl:when test="self::tei:classSpec">
+                        <xsl:text>%</xsl:text>
+                        <xsl:value-of select="@ident"/>
+                        <xsl:text>;</xsl:text>
+                     </xsl:when>
+                     <xsl:otherwise>
+                        <xsl:value-of select="@ident"/>
+                     </xsl:otherwise>
+                  </xsl:choose>
+               </xsl:variable>
+               <xsl:if test="not($N='')">
+                  <N>
+                     <xsl:if test="starts-with($N,'%tei.')">
+                        <xsl:attribute name="type">class</xsl:attribute>
+                     </xsl:if>
+                     <xsl:if test="starts-with($N,'%model.')">
+                        <xsl:attribute name="type">class</xsl:attribute>
+                     </xsl:if>
+                     <xsl:value-of select="$N"/>
+                  </N>
+               </xsl:if>
+            </xsl:for-each>
+         </M>
+      </xsl:variable>
+      <xsl:for-each select="$members/M">
+         <xsl:call-template name="memberOfClassDefinition">
+            <xsl:with-param name="type" select="$type"/>
+         </xsl:call-template>
+      </xsl:for-each>
+      <xsl:text>"&gt; </xsl:text>
+  </xsl:template>
+  <xsl:template name="memberOfClassDefinition">
+      <xsl:param name="type"/>
+      <!-- does a class model need bracketing if all its members are also classes?
+	 <xsl:if test="count(N[@type='class'])=count(N) and count(N) &gt; 2">
+	 <xsl:text>(</xsl:text>
+	 </xsl:if>
+    -->
+    <xsl:for-each select="N">
+         <xsl:value-of select="."/>
+         <xsl:choose>
+            <xsl:when test="$type='sequence'">
+               <xsl:if test="position() &lt; last()">, </xsl:if>
+            </xsl:when>
+            <xsl:when test="$type='sequenceOptional'">
+               <xsl:text>?</xsl:text>
+               <xsl:if test="position() &lt; last()">, </xsl:if>
+            </xsl:when>
+            <xsl:when test="$type='sequenceRepeatable'">
+               <xsl:text>+</xsl:text>
+               <xsl:if test="position() &lt; last()">, </xsl:if>
+            </xsl:when>
+            <xsl:when test="$type='sequenceOptionalRepeatable'">
+               <xsl:text>*</xsl:text>
+               <xsl:if test="position() &lt; last()">, </xsl:if>
+            </xsl:when>
+            <xsl:otherwise>
+               <xsl:if test="position() &lt; last()"> |
+ </xsl:if>
+            </xsl:otherwise>
+         </xsl:choose>
+      </xsl:for-each>
+      <!-- see above
+	 <xsl:if test="count(N[@type='class'])=count(N) and count(N) &gt; 2">
+	 <xsl:text>)</xsl:text>
+	 </xsl:if>
+    -->
+  </xsl:template>
+  <xsl:template match="tei:commDecl" mode="tangle">
+      <xsl:text>&#10;  &lt;!--</xsl:text>
+      <xsl:apply-templates/>
+      <xsl:text>--&gt;</xsl:text>
+  </xsl:template>
+  <xsl:template name="attributeList">
+      <xsl:apply-templates mode="tangle" select="tei:attList/tei:*"/>
+  </xsl:template>
+  <xsl:template match="tei:attDef" mode="tangle">
+      <xsl:text>&#10;</xsl:text>
+      <xsl:choose>
+         <xsl:when test="@ns='http://www.w3.org/XML/1998/namespace'">
+            <xsl:text>xml:</xsl:text>
+         </xsl:when>
+         <xsl:when test="@ns='http://www.w3.org/1999/xlink'">
+            <xsl:text>xlink:</xsl:text>
+         </xsl:when>
+         <xsl:when test="$parameterize='true' and (@ns) and not($nsPrefix='') and not(starts-with(@ident,'xmlns'))">
+            <xsl:text>%NS;</xsl:text>
+         </xsl:when>
+      </xsl:choose>
+      <xsl:choose>
+         <xsl:when test="tei:altIdent=@ident">
+            <xsl:value-of select="@ident"/>
+         </xsl:when>
+         <xsl:when test="tei:altIdent">
+            <xsl:value-of select="normalize-space(tei:altIdent)"/>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:value-of select="@ident"/>
+         </xsl:otherwise>
+      </xsl:choose>
+      <xsl:choose>
+         <xsl:when test="(number(tei:datatype/@maxOccurs) &gt; 1 or tei:datatype/@maxOccurs='unbounded') and tei:datatype/rng:ref[@name='data.enumerated']">
+            <xsl:text> NMTOKENS </xsl:text>
+         </xsl:when>
+         <xsl:when test="(number(tei:datatype/@maxOccurs) &gt; 1 or  tei:datatype/@maxOccurs='unbounded') and tei:datatype/rng:ref[@name='data.name']">
+            <xsl:text> NMTOKENS </xsl:text>
+         </xsl:when>
+         <xsl:when test="(number(tei:datatype/@maxOccurs) &gt; 1 or  tei:datatype/@maxOccurs='unbounded') and tei:datatype/rng:data[@type='Name']">
+            <xsl:text> NMTOKENS </xsl:text>
+         </xsl:when>
+         <xsl:when test="tei:valList[@type='closed']">
+            <xsl:text> (</xsl:text>
+            <xsl:for-each select="tei:valList/tei:valItem">
+               <xsl:value-of select="@ident"/>
+               <xsl:if test="following-sibling::tei:valItem">
+		 <xsl:text>|</xsl:text>
+	       </xsl:if>
+            </xsl:for-each>
+            <xsl:text>)</xsl:text>
+         </xsl:when>
+         <xsl:when test="tei:datatype/rng:data[@type='Name']">
+            <xsl:text> NMTOKEN </xsl:text>
+         </xsl:when>
+         <xsl:when test="tei:datatype/@minOccurs or tei:datatype/@maxOccurs">
+            <xsl:text> CDATA </xsl:text>
+         </xsl:when>
+         <xsl:when test="tei:datatype/rng:*">
+            <xsl:apply-templates select="tei:datatype"/>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:text> CDATA </xsl:text>
+         </xsl:otherwise>
+      </xsl:choose>
+      <xsl:choose>
+         <xsl:when test="string-length(tei:defaultVal) &gt;0">
+            <xsl:text> "</xsl:text>
+            <xsl:value-of select="tei:defaultVal"/>
+            <xsl:text>" </xsl:text>
+         </xsl:when>
+         <xsl:when test="parent::tei:attList[@org='choice']">
+            <xsl:text> #IMPLIED</xsl:text>
+         </xsl:when>
+         <xsl:when test="@usage='req'">
+            <xsl:text> #REQUIRED</xsl:text>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:text> #IMPLIED</xsl:text>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <xsl:template name="bitOut">
+      <xsl:param name="grammar"/>
+      <xsl:param name="element"/>
+      <xsl:param name="content"/>
+      <xsl:copy-of select="$content"/>
+  </xsl:template>
+  <xsl:template name="CR">
+      <xsl:text>&#10;</xsl:text>
+  </xsl:template>
+  <xsl:template match="tei:memberOf" mode="tangleAtts">
+      <xsl:variable name="ident">
+         <xsl:value-of select="ancestor::tei:elementSpec/@ident|ancestor::tei:classSpec/@ident"/>
+      </xsl:variable>
+      <xsl:variable name="K" select="@key"/>
+      <xsl:choose>
+         <xsl:when test="key('IDENTS',$K)">
+            <xsl:for-each select="key('IDENTS',@key)[1]">
+               <xsl:apply-templates mode="tagatts" select="."/>
+            </xsl:for-each>
+         </xsl:when>
+         <xsl:otherwise>
+	   <xsl:for-each select="document($localsource)/tei:TEI">
+	     <xsl:apply-templates mode="tagatts" select="key('LOCALIDENTS',$K)"/>
+	   </xsl:for-each>
+	 </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <xsl:template match="tei:attRef" mode="tangle">
+      <xsl:text>&#10; %</xsl:text>
+      <xsl:value-of select="@name"/>
+      <xsl:text>;</xsl:text>
+  </xsl:template>
+  <xsl:template name="checkClass">
+      <xsl:param name="id"/>
+      <!-- should a class be included?
+	 * it must exist in the ODD spec
+	 * it must have other classes which point to it
+	 * whatever it points to must have members which are in the ODD
+    -->
+    <xsl:for-each select="key('CLASSMEMBERS',$id)">
+         <xsl:choose>
+            <xsl:when test="self::tei:elementSpec and key('ELEMENTS',@ident)">
+               <xsl:text>true</xsl:text>
+            </xsl:when>
+            <xsl:when test="self::tei:macroSpec and key('MACROS',@ident)">
+               <xsl:text>true</xsl:text>
+            </xsl:when>
+            <xsl:when test="self::tei:classSpec and key('CLASSES',@ident)">
+               <xsl:call-template name="checkClass">
+                  <xsl:with-param name="id" select="@ident"/>
+               </xsl:call-template>
+            </xsl:when>
+         </xsl:choose>
+      </xsl:for-each>
+  </xsl:template>
+  <xsl:template name="dtdComment">
+      <xsl:param name="text"/>
+      <xsl:text>&#10;&lt;!--&#10;</xsl:text>
+      <xsl:value-of select="$text"/>
+      <xsl:text>&#10;--&gt;&#10;</xsl:text>
+  </xsl:template>
+  <xsl:template name="checkEnd">
+      <xsl:if test="count(parent::tei:content[parent::tei:elementSpec]/rng:*)&gt;1 and     not(following-sibling::rng:*)">
+         <xsl:text>)</xsl:text>
+      </xsl:if>
+  </xsl:template>
+  <xsl:template name="checkStart">
+      <xsl:if test="count(parent::tei:content[parent::tei:elementSpec]/rng:*)&gt;1">
+         <xsl:choose>
+            <xsl:when test="preceding-sibling::rng:*">
+               <xsl:text>,</xsl:text>
+            </xsl:when>
+            <xsl:otherwise>
+               <xsl:text>(</xsl:text>
+            </xsl:otherwise>
+         </xsl:choose>
+      </xsl:if>
+  </xsl:template>
+
+
+  <xsl:template name="copyright">
+    <xsl:for-each
+	select="/tei:TEI/tei:teiHeader/tei:fileDesc/tei:publicationStmt/tei:availability">
+      <xsl:if test="count(tei:licence)&gt;1">
+	<xsl:text>This material is dual-licensed.&#10;</xsl:text>
+      </xsl:if>
+      <xsl:apply-templates/>
+    </xsl:for-each>
+  </xsl:template>
+
+  <xsl:template match="tei:licence">
+    <xsl:if test="@target">
+      <xsl:text>[</xsl:text>
+      <xsl:value-of select="@target"/>
+      <xsl:text>] </xsl:text>
+    </xsl:if>
+    <xsl:apply-templates/>
+  </xsl:template>
+
+  <xsl:template name="typewriter">
+    <xsl:param name="text"/>
+  </xsl:template>
+
+
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/odds2/odd2dtd.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/odds2/odd2relax.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/odds2/odd2relax.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/odds2/odd2relax.xsl	(revision 258)
@@ -0,0 +1,583 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet 
+    xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
+    xmlns:fo="http://www.w3.org/1999/XSL/Format" 
+    xmlns:html="http://www.w3.org/1999/xhtml" 
+    xmlns:i="http://www.iso.org/ns/1.0"
+    xmlns:rng="http://relaxng.org/ns/structure/1.0"
+    xmlns:s="http://www.ascc.net/xml/schematron" 
+    xmlns:sch="http://purl.oclc.org/dsdl/schematron" 
+    xmlns:tei="http://www.tei-c.org/ns/1.0"
+    xmlns:teix="http://www.tei-c.org/ns/Examples" 
+    xmlns:xi="http://www.w3.org/2001/XInclude"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    exclude-result-prefixes="a fo html i rng s sch tei teix xi xs xsl" 
+    version="2.0">
+  <xsl:import href="teiodds.xsl"/>
+  <xsl:import href="../common2/i18n.xsl"/>
+  <xsl:import href="../common2/tei-param.xsl"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet for making Relax NG schema from ODD </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: odd2relax.xsl 9669 2011-11-07 19:17:54Z rahtz $</p>
+         <p>Copyright: 2011, TEI Consortium</p>
+      </desc>
+   </doc>
+  <xsl:output encoding="utf-8" indent="yes" method="xml"/>
+  <xsl:key name="PATTERNS" match="rng:define[rng:element/@name]" use="'true'"/>
+  <xsl:key name="REFED" match="rng:ref" use="@name"/>
+  <xsl:key name="DEFED" match="rng:define" use="@name"/>
+  <xsl:key name="EDEF" match="rng:define[rng:element]" use="1"/>
+  <xsl:param name="verbose"/>
+  <xsl:param name="outputDir"/>
+  <xsl:param name="appendixWords"/>
+  <xsl:template name="makeAnchor">
+      <xsl:param name="name"/>
+  </xsl:template>
+  <xsl:param name="splitLevel">-1</xsl:param>
+  <xsl:variable name="oddmode">dtd</xsl:variable>
+  <xsl:variable name="filesuffix"/>
+   <!-- get list of output files -->
+  <xsl:variable name="linkColor"/>
+  <xsl:template match="tei:moduleSpec[@type='decls']"/>
+  <xsl:template match="/">
+      <xsl:choose>
+         <xsl:when test="key('SCHEMASPECS',1)">
+            <xsl:apply-templates select="key('LISTSCHEMASPECS',$whichSchemaSpec)"/>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:apply-templates select="key('Modules',1)"/>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <xsl:template match="tei:schemaSpec">
+      <xsl:variable name="documentationLanguage">
+         <xsl:call-template name="generateDoc"/>
+      </xsl:variable>
+      <xsl:if test="$verbose='true'">
+         <xsl:message> 
+	           <xsl:text>I18N setup: Pattern prefix: </xsl:text>
+	           <xsl:value-of select="$generalPrefix"/> 
+	           <xsl:text>. Target  language: </xsl:text>
+	           <xsl:value-of select="$targetLanguage"/>
+	           <xsl:text>. Documentation language: </xsl:text>
+	           <xsl:value-of select="$documentationLanguage"/>
+         </xsl:message>
+      </xsl:if>
+      <xsl:variable name="filename" select="@ident"/>
+      <xsl:if test="$verbose='true'">
+         <xsl:message> process schemaSpec [<xsl:value-of select="@ident"/>] </xsl:message>
+      </xsl:if>
+      <xsl:call-template name="generateOutput">
+         <xsl:with-param name="method">xml</xsl:with-param>
+         <xsl:with-param name="suffix">.rng</xsl:with-param>
+         <xsl:with-param name="body">
+            <grammar xmlns="http://relaxng.org/ns/structure/1.0"
+		     xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
+		     xmlns:xlink="http://www.w3.org/1999/xlink"
+                     datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
+               <xsl:attribute name="ns">
+                  <xsl:choose>
+                     <xsl:when test="@ns">
+                        <xsl:value-of select="@ns"/>
+                     </xsl:when>
+                     <xsl:otherwise>
+                        <xsl:text>http://www.tei-c.org/ns/1.0</xsl:text>
+		     </xsl:otherwise>
+                  </xsl:choose>
+               </xsl:attribute>
+               <xsl:comment>
+                  <xsl:text>&#10;Schema generated from ODD source </xsl:text>
+                  <xsl:call-template name="showDate"/>
+                  <xsl:text>. </xsl:text>
+                  <xsl:call-template name="makeTEIVersion"/>
+                  <xsl:call-template name="makeDescription"/>
+                  <xsl:text>&#10;</xsl:text>
+               </xsl:comment>
+	       <xsl:comment>
+		 <xsl:call-template name="copyright"/>
+	       </xsl:comment>
+               <xsl:choose>
+                  <xsl:when test="tei:specGrpRef">
+                     <xsl:variable name="SPECS">
+                        <tei:schemaSpec>
+                           <xsl:copy-of select="@*"/>
+                           <xsl:apply-templates mode="expandSpecs"/>
+                        </tei:schemaSpec>
+                     </xsl:variable>
+                     <xsl:for-each select="$SPECS/tei:schemaSpec">
+                        <xsl:call-template name="schemaSpecBody"/>
+                     </xsl:for-each>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:call-template name="schemaSpecBody"/>
+                  </xsl:otherwise>
+               </xsl:choose>
+	              <xsl:apply-templates select="tei:constraintSpec"/>
+            </grammar>
+         </xsl:with-param>
+      </xsl:call-template>
+  </xsl:template>
+
+  <xsl:template name="schemaSpecBody">
+      <xsl:variable name="pass1">
+         <root>
+	   <xsl:if test="$verbose='true'">
+	     <xsl:message>start importing moduleRef components</xsl:message>
+	   </xsl:if>
+	   <xsl:apply-templates mode="tangle" select="tei:moduleRef"/>
+	   <xsl:for-each select="tei:macroSpec">
+	     <xsl:apply-templates mode="tangle" select="."/>
+	   </xsl:for-each>
+	   <xsl:apply-templates mode="tangle" select="tei:elementSpec|tei:classSpec"/>
+	   <xsl:choose>
+	     <xsl:when test="@start and @start=''"/>
+	     <xsl:when test="@start and contains(@start,' ')">
+	       <start xmlns="http://relaxng.org/ns/structure/1.0">
+		 <choice>
+		   <xsl:call-template name="startNames">
+		     <xsl:with-param name="toks" select="@start"/>
+		   </xsl:call-template>
+		 </choice>
+	       </start>
+	     </xsl:when>
+	     <xsl:when test="@start">
+	       <start xmlns="http://relaxng.org/ns/structure/1.0">
+		 <ref name="{$generalPrefix}{@start}"/>
+	       </start>
+	     </xsl:when>
+	     <xsl:when test="key('IDENTS','teiCorpus')">
+	       <start xmlns="http://relaxng.org/ns/structure/1.0">
+		 <choice>
+		   <ref name="{$generalPrefix}TEI"/>
+		   <ref name="{$generalPrefix}teiCorpus"/>
+		 </choice>
+	       </start>
+	     </xsl:when>
+	     <xsl:otherwise>
+	       <start xmlns="http://relaxng.org/ns/structure/1.0">
+		 <ref name="{$generalPrefix}TEI"/>
+	       </start>
+	     </xsl:otherwise>
+	   </xsl:choose>
+         </root>
+      </xsl:variable>
+
+      <!-- in 2nd and 3rd  passes, throw away any RNG <define> elements
+    which do not have a <ref>, any <ref> which has no <define>
+    to point to, and any empty <choice> -->
+      <xsl:variable name="pass2">
+	<xsl:for-each select="$pass1/root">
+	  <root>
+	    <xsl:apply-templates mode="pass2"/>
+	  </root>
+	</xsl:for-each>
+      </xsl:variable>
+      <xsl:for-each select="$pass2/root">
+	<xsl:apply-templates mode="pass3"/>
+      </xsl:for-each>
+  </xsl:template>
+
+  <xsl:template name="startNames">
+      <xsl:param name="toks"/>
+      <xsl:if test="not($toks='')">
+         <xsl:choose>
+            <xsl:when test="contains($toks,' ')">
+               <ref xmlns="http://relaxng.org/ns/structure/1.0"
+                    name="{$generalPrefix}{substring-before($toks, ' ')}"/>
+               <xsl:call-template name="startNames">
+                  <xsl:with-param name="toks" select="substring-after($toks, ' ')"/>
+               </xsl:call-template>
+            </xsl:when>
+            <xsl:otherwise>
+               <ref xmlns="http://relaxng.org/ns/structure/1.0" name="{$generalPrefix}{$toks}"/>
+            </xsl:otherwise>
+         </xsl:choose>
+      </xsl:if>
+  </xsl:template>
+  <xsl:template match="tei:moduleSpec">
+      <xsl:if test="@ident and not(@mode='change' or @mode='replace' or   @mode='delete')">
+         <xsl:choose>
+            <xsl:when test="parent::tei:schemaSpec">
+               <xsl:call-template name="moduleSpec-body"/>
+            </xsl:when>
+            <xsl:otherwise>
+               <xsl:call-template name="generateOutput">
+                  <xsl:with-param name="method">xml</xsl:with-param>
+                  <xsl:with-param name="suffix">.rng</xsl:with-param>
+                  <xsl:with-param name="body">
+                     <grammar xmlns="http://relaxng.org/ns/structure/1.0"
+                              datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
+                        <xsl:comment>
+                           <xsl:text>Schema generated </xsl:text>
+                           <xsl:call-template name="showDate"/>
+                           <xsl:call-template name="makeTEIVersion"/>
+			   <xsl:call-template name="copyright"/>
+                           <xsl:call-template name="makeDescription"/>
+                        </xsl:comment>
+                        <xsl:call-template name="moduleSpec-body"/>
+                     </grammar>
+                  </xsl:with-param>
+               </xsl:call-template>
+            </xsl:otherwise>
+         </xsl:choose>
+      </xsl:if>
+  </xsl:template>
+  <xsl:template name="moduleSpec-body">
+      <xsl:variable name="filename" select="@ident"/>
+      <xsl:comment>Definitions from module <xsl:value-of select="@ident"/>
+      </xsl:comment>
+      <xsl:comment>Set global predeclared macros</xsl:comment>
+      <xsl:if test="@type='core'">
+         <xsl:call-template name="NameList"/>
+         <xsl:for-each select="key('PredeclareAllMacros',1)">
+            <define xmlns="http://relaxng.org/ns/structure/1.0" name="{@ident}">
+               <choice>
+                  <notAllowed/>
+               </choice>
+            </define>
+         </xsl:for-each>
+      </xsl:if>
+      <xsl:comment>Set predeclared macros</xsl:comment>
+      <xsl:for-each select="key('PredeclareMacrosModule',@ident)">
+         <xsl:apply-templates mode="tangle" select="."/>
+      </xsl:for-each>
+      <xsl:if test="@type='core'">
+         <xsl:call-template name="predeclare-classes"/>
+      </xsl:if>
+      <xsl:comment>0. predeclared macros</xsl:comment>
+      <xsl:for-each select="key('PredeclareMacrosModule',@ident)">
+         <xsl:apply-templates mode="tangle" select="."/>
+      </xsl:for-each>
+      <xsl:comment>1. classes</xsl:comment>
+      <xsl:for-each select="key('ClassModule',@ident)">
+         <xsl:choose>
+            <xsl:when test="@module='core' and @predeclare='true'"> </xsl:when>
+            <xsl:otherwise>
+               <xsl:apply-templates mode="tangle" select="."/>
+            </xsl:otherwise>
+         </xsl:choose>
+      </xsl:for-each>
+      <xsl:comment>2. elements</xsl:comment>
+      <xsl:apply-templates mode="tangle" select="key('ElementModule',@ident)">
+         <xsl:sort select="@ident"/>
+      </xsl:apply-templates>
+      <xsl:comment>3. macros</xsl:comment>
+      <xsl:for-each select="key('MacroModule',@ident)">
+         <xsl:choose>
+            <xsl:when test="@predeclare='true'"/>
+            <!--	<xsl:when test="key('PredeclareMacros',@ident)"/>-->
+        <xsl:otherwise>
+               <xsl:apply-templates mode="tangle" select="."/>
+            </xsl:otherwise>
+         </xsl:choose>
+      </xsl:for-each>
+  </xsl:template>
+  <xsl:template name="NameList">
+<!-- walk over all the elementSpec elements and make list of 
+       elements -->
+    <xsl:for-each select="key('ELEMENTDOCS',1)">
+         <xsl:sort select="@ident"/>
+         <define xmlns="http://relaxng.org/ns/structure/1.0" combine="choice" name="{@ident}">
+            <notAllowed/>
+         </define>
+      </xsl:for-each>
+  </xsl:template>
+  <xsl:template name="predeclare-classes">
+      <xsl:comment>0. predeclared classes</xsl:comment>
+      <xsl:for-each select="key('predeclaredClasses',1)">
+         <xsl:choose>
+            <xsl:when test="@type='model'">
+               <xsl:apply-templates mode="processModel" select=".">
+                  <xsl:with-param name="declare">true</xsl:with-param>
+               </xsl:apply-templates>
+            </xsl:when>
+            <xsl:when test="@type='atts'">
+               <xsl:apply-templates mode="processDefaultAtts" select="."/>
+            </xsl:when>
+         </xsl:choose>
+      </xsl:for-each>
+  </xsl:template>
+  <xsl:template match="tei:specGrpRef" mode="tangle">
+      <xsl:param name="filename"/>
+      <xsl:if test="$verbose='true'">
+         <xsl:message> specGrpRef to <xsl:value-of select="@target"/>
+         </xsl:message>
+      </xsl:if>
+      <xsl:choose>
+         <xsl:when test="starts-with(@target,'#')">
+            <xsl:for-each select="id(substring(@target,2))">
+               <xsl:apply-templates mode="ok" select=".">
+                  <xsl:with-param name="filename" select="$filename"/>
+               </xsl:apply-templates>
+            </xsl:for-each>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:for-each select="document(@target)/tei:specGrp">
+               <xsl:apply-templates mode="ok" select=".">
+                  <xsl:with-param name="filename" select="$filename"/>
+               </xsl:apply-templates>
+            </xsl:for-each>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <xsl:template name="bitOut">
+      <xsl:param name="grammar"/>
+      <xsl:param name="element"/>
+      <xsl:param name="content"/>
+      <xsl:for-each select="$content/Wrapper">
+         <xsl:apply-templates mode="justcopy" select="*"/>
+      </xsl:for-each>
+  </xsl:template>
+  <xsl:template name="refdoc"/>
+  <xsl:template name="typewriter">
+      <xsl:param name="text"/>
+  </xsl:template>
+
+  <xsl:template match="processing-instruction()" mode="tangle">
+    <xsl:copy-of select="."/>
+  </xsl:template>
+
+  <xsl:template match="tei:constraintSpec[@scheme='schematron']">
+      <xsl:apply-templates/>
+  </xsl:template>
+
+  <xsl:template match="tei:constraintSpec[@scheme='isoschematron']">
+      <xsl:apply-templates/>
+  </xsl:template>
+
+  <xsl:template match="s:*">
+      <xsl:call-template name="processSchematron"/>
+  </xsl:template>
+
+  <xsl:template match="sch:*">
+      <xsl:call-template name="processSchematron"/>
+  </xsl:template>
+
+
+<!-- pass 2, clean up unused elements -->
+  <xsl:template
+      match="rng:anyName[parent::rng:define]"
+      mode='pass2'>
+    <zeroOrMore xmlns="http://relaxng.org/ns/structure/1.0">
+      <choice>
+	<xsl:for-each select="key('EDEF',1)">	  
+	  <ref name="{@name}"/>
+	</xsl:for-each>
+      </choice>
+    </zeroOrMore>
+  </xsl:template>
+
+  <xsl:template match="processing-instruction()" mode="pass2">
+    <xsl:copy-of select="."/>
+  </xsl:template>
+
+  <xsl:template match="@*|text()|comment()" mode="pass2">
+      <xsl:copy-of select="."/>
+  </xsl:template>
+    
+  <xsl:template match="*" mode="pass2">
+      <xsl:copy>
+         <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()" mode="pass2"/>
+      </xsl:copy>
+  </xsl:template>
+
+  <xsl:template match="rng:define" mode="pass2">
+      <xsl:choose>
+         <xsl:when test="key('REFED',@name)">
+	   <define xmlns="http://relaxng.org/ns/structure/1.0" >
+	     <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()" mode="pass2"/>
+	   </define>
+	 </xsl:when>
+	 <xsl:otherwise>
+	   <xsl:if test="$verbose='true'">
+	     <xsl:message>ZAP definition of unused pattern <xsl:value-of select="@name"/></xsl:message>
+	   </xsl:if>
+	 </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  
+  <xsl:template match="rng:ref" mode="pass2">
+      <xsl:choose>
+	<!--
+	<xsl:when test="(ancestor::rng:element[@name='egXML' or
+			 @name='constraint']         or
+			 ancestor::rng:define[contains(@name,'macro.schemaPattern')])
+			 and         starts-with(@name, 'macro.any')">
+	           <xsl:for-each select="key('DEFED', @name)">
+	              <xsl:apply-templates mode="justcopy"
+					   select="*"/>
+	           </xsl:for-each>
+         </xsl:when>
+	 -->
+         <xsl:when test="key('DEFED',@name)">
+	   <ref xmlns="http://relaxng.org/ns/structure/1.0" name="{@name}"/>
+         </xsl:when>
+	 <xsl:when test="ancestor::tei:content[@autoPrefix='false']">
+	   <ref xmlns="http://relaxng.org/ns/structure/1.0" name="{@name}"/>
+         </xsl:when>
+         <xsl:when test="count(parent::*/*)=1">
+	   <xsl:if test="$verbose='true'">
+	     <xsl:message>ZAP reference to undefined [<xsl:value-of select="@name"/>] and leave empty behind</xsl:message>
+	   </xsl:if>
+	   <empty xmlns="http://relaxng.org/ns/structure/1.0"/>
+         </xsl:when>
+         <xsl:otherwise>
+	   <xsl:if test="$verbose='true'">
+	     <xsl:message>ZAP reference to undefined [<xsl:value-of select="@name"/>]</xsl:message>
+	   </xsl:if>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+<!-- and again -->
+
+  <xsl:template match="processing-instruction()" mode="pass3">
+    <xsl:choose>
+      <xsl:when test="name()='NameList'">
+	<xsl:if test="$verbose='true'">
+	  <xsl:message>Expand 'NameList' processing-instruction</xsl:message>
+	</xsl:if>
+	<choice xmlns="http://relaxng.org/ns/structure/1.0">
+	  <xsl:for-each select="key('PATTERNS','true')">
+	    <ref name="{@name}" />
+	  </xsl:for-each>
+	</choice>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="rng:choice" mode="pass3">
+      <xsl:choose>
+	<xsl:when test="rng:value|rng:name|.//rng:ref|.//rng:text|.//rng:data">
+	   <choice xmlns="http://relaxng.org/ns/structure/1.0">
+	     <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()" mode="pass3"/>
+	   </choice>
+	</xsl:when>
+	<xsl:otherwise>
+      <xsl:if test="$verbose='true'">
+        <xsl:message>KILLED <xsl:copy-of select="."/></xsl:message>
+      </xsl:if>
+	  <empty xmlns="http://relaxng.org/ns/structure/1.0"/>
+	</xsl:otherwise>
+      </xsl:choose>			   
+  </xsl:template>
+
+  <xsl:template match="rng:optional" mode="pass3">
+      <xsl:choose>
+	<xsl:when test="rng:zeroOrMore and count(*)=1">
+	     <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()" mode="pass3"/>
+	</xsl:when>
+	<xsl:when test="count(*)=1 and rng:group[count(*)=1 and	rng:zeroOrMore]">
+	     <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()" mode="pass3"/>
+	</xsl:when>
+	<xsl:otherwise>
+	  <optional xmlns="http://relaxng.org/ns/structure/1.0">
+	     <xsl:apply-templates
+		 select="*|@*|processing-instruction()|comment()|text()"
+		 mode="pass3"/>
+	  </optional>
+	</xsl:otherwise>
+      </xsl:choose>			   
+  </xsl:template>
+
+  <xsl:template match="rng:oneOrMore" mode="pass3">
+      <xsl:choose>
+	<xsl:when test="rng:zeroOrMore and count(*)=1">
+	     <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()" mode="pass3"/>
+	</xsl:when>
+	<xsl:when test="count(*)=1 and rng:group[count(*)=1 and	rng:zeroOrMore]">
+	     <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()" mode="pass3"/>
+	</xsl:when>
+	<xsl:otherwise>
+	  <oneOrMore xmlns="http://relaxng.org/ns/structure/1.0">
+	     <xsl:apply-templates
+		 select="*|@*|processing-instruction()|comment()|text()"
+		 mode="pass3"/>
+	  </oneOrMore>
+	</xsl:otherwise>
+      </xsl:choose>			   
+  </xsl:template>
+
+  <xsl:template match="rng:zeroOrMore" mode="pass3">
+      <xsl:choose>
+	<xsl:when test="rng:zeroOrMore and count(*)=1">
+	     <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()" mode="pass3"/>
+	</xsl:when>
+	<xsl:when test="count(*)=1 and rng:group[count(*)=1 and	rng:zeroOrMore]">
+	     <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()" mode="pass3"/>
+	</xsl:when>
+	<xsl:otherwise>
+	  <zeroOrMore xmlns="http://relaxng.org/ns/structure/1.0">
+	     <xsl:apply-templates
+		 select="*|@*|processing-instruction()|comment()|text()"
+		 mode="pass3"/>
+	  </zeroOrMore>
+	</xsl:otherwise>
+      </xsl:choose>			   
+  </xsl:template>
+
+  <xsl:template match="@*|text()|comment()" mode="pass3">
+      <xsl:copy-of select="."/>
+  </xsl:template>
+    
+  <xsl:template match="*" mode="pass3">
+      <xsl:copy>
+         <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()" mode="pass3"/>
+      </xsl:copy>
+  </xsl:template>
+
+  <xsl:template name="copyright">
+    <xsl:for-each
+	select="/tei:TEI/tei:teiHeader/tei:fileDesc/tei:publicationStmt/tei:availability">
+      <xsl:if test="count(tei:licence)&gt;1">
+	<xsl:text>This material is dual-licensed.&#10;</xsl:text>
+      </xsl:if>
+      <xsl:apply-templates/>
+    </xsl:for-each>
+  </xsl:template>
+
+  <xsl:template match="tei:licence">
+    <xsl:if test="@target">
+      <xsl:text>[</xsl:text>
+      <xsl:value-of select="@target"/>
+      <xsl:text>] </xsl:text>
+    </xsl:if>
+    <xsl:apply-templates/>
+  </xsl:template>
+
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/odds2/odd2relax.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/odds2/extract-sch.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/odds2/extract-sch.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/odds2/extract-sch.xsl	(revision 258)
@@ -0,0 +1,161 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:teix="http://www.tei-c.org/ns/Examples"
+                xmlns:xi="http://www.w3.org/2001/XInclude"
+                xmlns:rng="http://relaxng.org/ns/structure/1.0"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+		xmlns:sch="http://www.ascc.net/xml/schematron"
+		xmlns="http://www.ascc.net/xml/schematron"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="2.0"
+                exclude-result-prefixes="tei rng teix sch xi #default">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+    <desc>
+      <p> TEI stylesheet for simplifying TEI ODD markup </p>
+      <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+      <p>Author: See AUTHORS</p>
+      <p>Id: $Id: extract-sch.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+      <p>Copyright: 2011, TEI Consortium</p>
+    </desc>
+  </doc>
+  <xsl:output encoding="utf-8" indent="yes" method="xml"/>
+  <xsl:param name="lang"></xsl:param>
+
+  <xsl:key name="NS" 
+	   match="sch:ns"
+	   use="1"/>
+
+  <xsl:key name="PATTERNS"
+	   match="sch:pattern"
+	   use="1"/>
+
+  <xsl:key name="CONSTRAINTS"
+	   match="tei:constraint"
+	   use="1"/>
+
+
+  <xsl:template match="/">
+      <schema>
+         <title>Schematron 1.5 rules</title>
+         <xsl:for-each select="key('NS',1)">
+            <xsl:choose>
+               <xsl:when test="ancestor::teix:egXML"/>
+	       <xsl:when test="ancestor::tei:constraintSpec/@xml:lang
+		 and not(ancestor::tei:constraintSpec/@xml:lang = $lang)"/>
+               <xsl:otherwise>
+                  <xsl:apply-templates select="."/>
+               </xsl:otherwise>
+            </xsl:choose>
+         </xsl:for-each>
+
+         <xsl:for-each select="key('PATTERNS',1)">
+            <xsl:choose>
+               <xsl:when test="ancestor::teix:egXML"/>
+	       <xsl:when test="ancestor::tei:constraintSpec/@xml:lang
+		 and not(ancestor::tei:constraintSpec/@xml:lang = $lang)"/>
+               <xsl:otherwise>
+                  <xsl:apply-templates select="."/>
+               </xsl:otherwise>
+            </xsl:choose>
+         </xsl:for-each>
+
+         <xsl:for-each select="key('CONSTRAINTS',1)">
+            <xsl:choose>
+               <xsl:when test="ancestor::teix:egXML"/>
+	       <xsl:when test="ancestor::tei:constraintSpec/@xml:lang
+		 and not(ancestor::tei:constraintSpec/@xml:lang = $lang)"/>
+               <xsl:otherwise>
+		 <xsl:variable name="patID">
+		   <xsl:choose>
+		     <xsl:when test="ancestor::tei:elementSpec">
+		       <xsl:value-of select="concat(ancestor::tei:elementSpec/@ident,'-constraint-',ancestor::tei:constraintSpec/@ident)"/>
+		     </xsl:when>
+		     <xsl:when test="ancestor::tei:classSpec">
+		       <xsl:value-of select="concat(ancestor::tei:classSpec/@ident,'-constraint-',ancestor::tei:constraintSpec/@ident)"/>
+		     </xsl:when>
+		     <xsl:when test="ancestor::tei:macroSpec">
+		       <xsl:value-of select="concat(ancestor::tei:macroSpec/@ident,'-constraint-',ancestor::tei:constraintSpec/@ident)"/>
+		     </xsl:when>
+                     </xsl:choose>
+                  </xsl:variable>
+		 <xsl:if test="sch:rule">
+		   <pattern id="{$patID}">
+		     <xsl:apply-templates select="sch:rule"/>
+		   </pattern>
+		 </xsl:if>
+		 <xsl:if test="sch:assert|sch:report">
+		   <pattern id="{$patID}">
+		     <rule>
+		       <xsl:attribute name="context">
+			 <xsl:text>tei:</xsl:text>
+			 <xsl:choose>
+			   <xsl:when test="ancestor::tei:elementSpec">
+			     <xsl:value-of
+				 select="ancestor::tei:elementSpec/@ident"/>
+			   </xsl:when>
+			   <xsl:otherwise>*</xsl:otherwise>
+			 </xsl:choose>
+		       </xsl:attribute>
+		       <xsl:apply-templates select="sch:assert|sch:report"/>
+		     </rule>
+		   </pattern>
+		 </xsl:if>
+               </xsl:otherwise>
+            </xsl:choose>
+         </xsl:for-each>
+      </schema>
+  </xsl:template>
+  
+  <xsl:template match="sch:rule[not(@context)]">
+    <rule>
+      <xsl:attribute name="context">
+	<xsl:text>tei:</xsl:text>
+	<xsl:value-of select="ancestor::tei:elementSpec/@ident"/>
+      </xsl:attribute>
+      <xsl:apply-templates/>
+    </rule>
+  </xsl:template>
+  
+  
+  <xsl:template match="@*|text()|comment()|processing-instruction()">
+      <xsl:copy-of select="."/>
+  </xsl:template>
+  
+  
+  <xsl:template match="sch:*">
+    <xsl:element name="{local-name()}">
+      <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
+    </xsl:element>
+  </xsl:template>
+  
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/odds2/extract-sch.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/odds2/table2list.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/odds2/table2list.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/odds2/table2list.xsl	(revision 258)
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
+                xmlns:fo="http://www.w3.org/1999/XSL/Format"
+                xmlns:rng="http://relaxng.org/ns/structure/1.0"
+                xmlns:t="http://www.thaiopensource.com/ns/annotations"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns="http://www.tei-c.org/ns/1.0"
+                
+                xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                exclude-result-prefixes="a t tei fo rng xs"
+                version="2.0">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet dealing with elements from the core module. </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: table2list.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2011, TEI Consortium</p>
+      </desc>
+   </doc>
+
+  <xsl:template match="tei:table[@rend='valList'         or @rend='attDef'        or @rend='attList'         or @rend='specDesc']">
+      <list type="termlist">
+         <xsl:apply-templates/>
+      </list>
+  </xsl:template>
+  <xsl:template match="tei:table[@rend='attList'      or @rend='valList'      or @rend='attDef'      or @rend='specDesc']/tei:row">
+      <item>
+         <xsl:apply-templates/>
+      </item>
+  </xsl:template>
+  <xsl:template match="tei:table[@rend='attList'       or @rend='specDesc'       or @rend='valList'       or @rend='attDef']/tei:row/tei:cell[1]">
+      <xsl:choose>
+         <xsl:when test="parent::tei:row/parent::tei:table[@rend='attList']">
+            <hi rend="bold">@<xsl:apply-templates/>
+            </hi>
+         </xsl:when>
+         <xsl:when test="ancestor::tei:table[@rend='valList']">
+            <hi rend="bold">
+               <xsl:apply-templates/>
+            </hi>
+         </xsl:when>
+         <xsl:when test="ancestor::tei:table[@rend='specDesc']">
+            <hi rend="bold">@<xsl:apply-templates/>
+            </hi>
+         </xsl:when>
+         <xsl:otherwise>
+            <hi rend="bold">
+               <xsl:apply-templates/>
+            </hi>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <xsl:template match="tei:table[@rend='attList'        or @rend='valList'        or @rend='specDesc'        or @rend='attDef']/tei:row/tei:cell[2]">
+      <c rend="tab">
+         <xsl:text>	</xsl:text>
+      </c>
+      <xsl:apply-templates/>
+  </xsl:template>
+  <xsl:template match="tei:index"/>
+  <xsl:template match="processing-instruction()[name()='tex' and .='\ ']">
+      <c xml:space="preserve"> </c>
+  </xsl:template>
+   <!-- identity transform -->
+  <xsl:output method="xml" indent="yes"/>
+  <xsl:template match="@*|text()|comment()|processing-instruction()">
+      <xsl:copy-of select="."/>
+  </xsl:template>
+  <xsl:template match="*">
+      <xsl:copy>
+         <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
+      </xsl:copy>
+  </xsl:template>
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/odds2/table2list.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/odds2/odd2lite.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/odds2/odd2lite.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/odds2/odd2lite.xsl	(revision 258)
@@ -0,0 +1,518 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns="http://www.tei-c.org/ns/1.0"
+                xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
+                xmlns:fo="http://www.w3.org/1999/XSL/Format"
+                xmlns:html="http://www.w3.org/1999/xhtml"
+		xmlns:s="http://www.ascc.net/xml/schematron" 
+                xmlns:rng="http://relaxng.org/ns/structure/1.0"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"
+                xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                xmlns:sch="http://purl.oclc.org/dsdl/schematron"
+                exclude-result-prefixes="fo a tei html s rng sch xsi teix xs"
+                version="2.0">
+  <xsl:import href="../common2/verbatim.xsl"/>
+  <xsl:import href="teiodds.xsl"/>
+  <xsl:import href="../common2/tei.xsl"/>
+  <xsl:include href="../common2/tagdocs.xsl"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet for making TEI Lite XML from ODD </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: odd2lite.xsl 9669 2011-11-07 19:17:54Z rahtz $</p>
+         <p>Copyright: 2011, TEI Consortium</p>
+      </desc>
+   </doc>
+  <xsl:param name="summaryDoc">false</xsl:param>
+
+  <xsl:param name="cellName">cell</xsl:param>
+  <xsl:param name="xrefName">ref</xsl:param>
+  <xsl:param name="urlName">target</xsl:param>
+  <xsl:param name="ulName">list</xsl:param>
+  <xsl:param name="dlName">list</xsl:param>
+  <xsl:param name="codeName">code</xsl:param>
+  <xsl:param name="colspan">cols</xsl:param>
+  <xsl:param name="ddName">item</xsl:param>
+  <xsl:param name="dtName">label</xsl:param>
+  <xsl:param name="hiName">hi</xsl:param>
+  <xsl:param name="itemName">item</xsl:param>
+  <xsl:param name="labelName">label</xsl:param>
+  <xsl:param name="rendName">rend</xsl:param>
+  <xsl:param name="rowName">row</xsl:param>
+  <xsl:param name="tableName">table</xsl:param>
+  <xsl:param name="sectionName">div</xsl:param>
+  <xsl:param name="divName">ab</xsl:param>
+  <xsl:param name="segName">seg</xsl:param>
+  <xsl:param name="outputNS">http://www.tei-c.org/ns/1.0</xsl:param>
+  <xsl:param name="startAttribute"/>
+  <xsl:param name="endAttribute"/>
+  <xsl:param name="startAttributeValue"/>
+  <xsl:param name="endAttributeValue"/>
+  <xsl:param name="startComment"/>
+  <xsl:param name="endComment"/>
+  <xsl:param name="startElement"/>
+  <xsl:param name="endElement"/>
+  <xsl:param name="startElementName"/>
+  <xsl:param name="endElementName"/>
+  <xsl:param name="startNamespace"/>
+  <xsl:param name="endNamespace"/>
+  <xsl:param name="spaceCharacter">&#160;</xsl:param>
+  <xsl:param name="oddmode">tei</xsl:param>
+  <xsl:param name="displayMode">rnc</xsl:param>
+  <xsl:param name="splitLevel">-1</xsl:param>
+  <xsl:param name="idPrefix">TEI.</xsl:param>
+  <xsl:template name="identifyElement">
+      <xsl:param name="id"/>
+      <xsl:attribute name="xml:id">
+         <xsl:value-of select="$id"/>
+      </xsl:attribute>
+  </xsl:template>
+  <xsl:template name="verbatim-lineBreak">
+      <xsl:param name="id"/>
+      <xsl:text>&#10;</xsl:text>
+  </xsl:template>
+  <xsl:key match="tei:moduleSpec[@ident]" name="FILES" use="@ident"/>
+  <xsl:variable name="top" select="/"/>
+  <xsl:template match="@*|comment()|processing-instruction()">
+      <xsl:copy-of select="."/>
+  </xsl:template>
+
+  <xsl:template match="teix:egXML">
+      <xsl:param name="simple">false</xsl:param>
+      <xsl:param name="highlight"/>
+      <xsl:copy>
+         <xsl:if test="not(@xml:lang)">
+	           <xsl:copy-of select="parent::tei:*/@xml:lang"/>
+         </xsl:if>
+         <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
+      </xsl:copy>
+  </xsl:template>
+
+
+  <xsl:template match="*|tei:author|tei:title">
+      <xsl:copy>
+         <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
+      </xsl:copy>
+  </xsl:template>
+  <xsl:template name="showSpace">
+      <c xml:space="preserve"> </c>
+  </xsl:template>
+
+  <xsl:template name="showSpaceBetweenItems">
+      <c xml:space="preserve"> </c>
+  </xsl:template>
+
+  <xsl:template name="makeInternalLink">
+      <xsl:param name="ptr" as="xs:boolean"  select="false()"/>
+      <xsl:param name="target"/>
+      <xsl:param name="dest"/>
+      <xsl:param name="class"/>
+      <xsl:param name="body"/>
+      <xsl:variable name="W">
+         <xsl:choose>
+            <xsl:when test="$target">
+               <xsl:value-of select="$target"/>
+            </xsl:when>
+            <xsl:otherwise>
+               <xsl:value-of select="$dest"/>
+            </xsl:otherwise>
+         </xsl:choose>
+      </xsl:variable>
+      <xsl:choose>
+         <xsl:when test="not($body='')">
+            <tei:ref target="#{$W}">
+	      <xsl:if test="$class">
+		<xsl:attribute name="rend" select="$class"/>
+	      </xsl:if>
+               <xsl:value-of select="$body"/>
+            </tei:ref>
+         </xsl:when>
+         <xsl:when test="$ptr">
+            <tei:ptr target="#{$W}"/>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:apply-templates/>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <xsl:template name="makeExternalLink">
+      <xsl:param name="ptr" as="xs:boolean" select="false()"/>
+      <xsl:param name="dest"/>
+      <xsl:choose>
+         <xsl:when test="$ptr">
+            <tei:ptr target="{$dest}"/>
+         </xsl:when>
+         <xsl:otherwise>
+            <tei:ref target="{$dest}">
+               <xsl:apply-templates/>
+            </tei:ref>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <xsl:template name="generateEndLink">
+      <xsl:param name="where"/>
+      <xsl:value-of select="$where"/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[odds] Document an element, macro, or class</desc>
+   </doc>
+  <xsl:template name="refdoc">
+      <xsl:if test="$verbose='true'">
+         <xsl:message> refdoc for <xsl:value-of select="name(.)"/> - <xsl:value-of select="@ident"/>
+         </xsl:message>
+      </xsl:if>
+      <xsl:choose>
+         <xsl:when test="self::tei:classSpec and  count(key('CLASSMEMBERS',@ident))=0">
+            <xsl:if test="$verbose='true'">
+               <xsl:message> class <xsl:value-of select="@ident"/> omitted as it has no members
+          </xsl:message>
+            </xsl:if>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:apply-templates mode="weavebody" select="."/>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="makeAnchor">
+      <xsl:param name="name"/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[odds] <param name="text">text</param>
+      </desc>
+   </doc>
+  <xsl:template name="typewriter">
+      <xsl:param name="text"/>
+      <code>
+         <xsl:copy-of select="$text"/>
+      </code>
+  </xsl:template>
+
+  <xsl:template name="makeSectionHead">
+      <xsl:param name="name"/>
+      <xsl:param name="id"/>
+      <xsl:attribute name="type">
+         <xsl:text>refdoc</xsl:text>
+      </xsl:attribute>
+      <xsl:attribute name="xml:id">
+         <xsl:value-of select="$idPrefix"/>
+         <xsl:value-of select="$id"/>
+      </xsl:attribute>
+      <head>
+         <xsl:value-of select="$name"/>
+      </head>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[odds] <param name="grammar">grammar</param>
+         <param name="content">content</param>
+         <param name="element">element</param>
+      </desc>
+   </doc>
+  <xsl:template name="bitOut">
+      <xsl:param name="grammar"/>
+      <xsl:param name="content"/>
+      <xsl:param name="element">pre</xsl:param>
+      <eg rend="eg_rnc">
+         <xsl:call-template name="make-body-from-r-t-f">
+            <xsl:with-param name="schema">
+               <xsl:for-each select="$content/*">
+                  <xsl:call-template name="make-compact-schema"/>
+               </xsl:for-each>
+            </xsl:with-param>
+         </xsl:call-template>
+      </eg>
+  </xsl:template>
+  <xsl:template match="tei:remarks/tei:p">
+      <xsl:apply-templates/>
+  </xsl:template>
+  <xsl:template match="tei:exemplum/tei:p">
+      <xsl:apply-templates/>
+  </xsl:template>
+  <xsl:template name="linkTogether">
+      <xsl:param name="name"/>
+      <xsl:param name="reftext"/>
+      <xsl:param name="class"/>
+      <xsl:variable name="partialname">
+         <xsl:value-of select="$idPrefix"/>
+         <xsl:choose>
+            <xsl:when test="contains($name,'_')">
+               <xsl:value-of select="substring-before($name,'_')"/>
+            </xsl:when>
+            <xsl:otherwise>
+               <xsl:value-of select="$name"/>
+            </xsl:otherwise>
+         </xsl:choose>
+      </xsl:variable>
+      <ref target="#{$partialname}">
+	<xsl:if test="$class">
+	  <xsl:attribute name="rend" select="$class"/>
+	</xsl:if>
+         <xsl:choose>
+            <xsl:when test="$reftext=''">
+               <xsl:value-of select="$name"/>
+            </xsl:when>
+            <xsl:otherwise>
+               <xsl:value-of select="$reftext"/>
+            </xsl:otherwise>
+         </xsl:choose>
+      </ref>
+  </xsl:template>
+  <xsl:template name="showRNC">
+      <xsl:param name="style"/>
+      <xsl:param name="contents"/>
+      <xsl:value-of select="$contents"/>
+  </xsl:template>
+  <xsl:template name="emptySlash">
+      <xsl:param name="name"/>
+      <xsl:value-of select="$name"/>
+      <xsl:text>/</xsl:text>
+  </xsl:template>
+  <xsl:template match="tei:gi">
+      <xsl:choose>
+         <xsl:when test="not(@scheme='') or parent::tei:ref or parent::tei:head">
+            <xsl:text>&lt;</xsl:text>
+            <xsl:apply-templates/>
+            <xsl:text>&gt;</xsl:text>
+         </xsl:when>
+         <xsl:when test="key('ELEMENTS',.)[last()]">
+            <xsl:for-each select="key('ELEMENTS',.)">
+               <ref target="#{@ident}">
+                  <xsl:text>&lt;</xsl:text>
+                  <xsl:choose>
+                     <xsl:when test="tei:content/rng:empty">
+                        <xsl:call-template name="emptySlash">
+                           <xsl:with-param name="name">
+                              <xsl:value-of select="(tei:altIdent|@ident)[last()]"/>
+                           </xsl:with-param>
+                        </xsl:call-template>
+                     </xsl:when>
+                     <xsl:otherwise>
+                        <xsl:value-of select="(tei:altIdent|@ident)[last()]"/>
+                     </xsl:otherwise>
+                  </xsl:choose>
+                  <xsl:text>&gt;</xsl:text>
+               </ref>
+            </xsl:for-each>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:text>&lt;</xsl:text>
+            <xsl:apply-templates/>
+            <xsl:text>&gt;</xsl:text>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+   <!-- debugging
+<xsl:template name="SHOW">
+ &lt;<xsl:value-of select="name()"/>
+<xsl:for-each select="@*">
+  <xsl:text> </xsl:text>
+  <xsl:value-of select="name()"/>="<xsl:value-of select="."/>"
+</xsl:for-each>
+&gt;
+   <xsl:for-each select="*">
+     <xsl:call-template name="SHOW"/>
+   </xsl:for-each>
+ &lt;/<xsl:value-of select="name()"/>&gt;
+</xsl:template>
+
+-->
+  <xsl:template name="emphasize">
+      <xsl:param name="class"/>
+      <xsl:param name="content"/>
+      <hi rend="{$class}">
+         <xsl:copy-of select="$content"/>
+      </hi>
+  </xsl:template>
+  <xsl:template name="specHook">
+      <xsl:param name="name"/>
+      <index indexName="ODDS">
+         <xsl:choose>
+            <xsl:when test="local-name()='macroSpec'">
+               <term>
+                  <xsl:value-of select="$name"/>
+                  <xsl:text> (macro)</xsl:text>
+               </term>
+            </xsl:when>
+            <xsl:when test="local-name()='classSpec' and        @type='model'">
+               <term>
+                  <xsl:value-of select="$name"/>
+                  <xsl:text> (model class)</xsl:text>
+               </term>
+            </xsl:when>
+            <xsl:when test="local-name()='classSpec' and        @type='atts'">
+               <term>
+                  <xsl:value-of select="$name"/>
+                  <xsl:text> (attribute class)</xsl:text>
+               </term>
+               <xsl:for-each select=".//tei:attDef">
+                  <index indexName="ODDS">
+                     <term sortKey="{@ident}">
+                        <xsl:text>@</xsl:text>
+                        <xsl:value-of select="@ident"/>
+                     </term>
+                  </index>
+               </xsl:for-each>
+            </xsl:when>
+            <xsl:when test="local-name()='elementSpec'">
+               <term sortKey="{$name}">
+                  <xsl:text>&lt;</xsl:text>
+                  <xsl:value-of select="$name"/>
+                  <xsl:text>&gt;</xsl:text>
+               </term>
+               <xsl:for-each select=".//tei:attDef">
+                  <index indexName="ODDS">
+                     <term sortKey="{@ident}">
+                        <xsl:text>@</xsl:text>
+                        <xsl:value-of select="@ident"/>
+                     </term>
+                  </index>
+               </xsl:for-each>
+            </xsl:when>
+         </xsl:choose>
+      </index>
+  </xsl:template>
+
+  <xsl:template match="tei:schemaSpec">
+      <xsl:if test="$verbose='true'">
+         <xsl:message>Processing schemaSpec <xsl:value-of select="@ident"/>, summaryDoc=<xsl:value-of select="$summaryDoc"/>
+         </xsl:message>
+      </xsl:if>
+      <xsl:choose>
+         <xsl:when test="$summaryDoc='true'">
+	   <div>
+	     <head>Schema <xsl:value-of select="@ident"/>: changed components</head>
+	     <xsl:for-each select="tei:classSpec[@mode or @rend='change']  
+				   | tei:macroSpec[(@mode or @rend='change')]  
+				   | tei:elementSpec[(@mode or @rend='change')]">
+	       <xsl:sort select="@ident"/>
+	       <xsl:apply-templates mode="weave" select="."/>
+	     </xsl:for-each>
+	   </div>
+	   <div>
+	   <head>Schema <xsl:value-of select="@ident"/>:  unchanged components</head>
+	   <table>
+	     <xsl:for-each select="tei:classSpec[not(@mode or @rend)]  
+				   | tei:macroSpec[not(@mode or  @rend)]  
+				   | tei:elementSpec[not(@mode or @rend)]">
+	       <xsl:sort select="@ident"/>
+	       <row>
+		 <cell>
+		   <xsl:attribute name="xml:id">
+		     <xsl:value-of select="@ident"/>
+		   </xsl:attribute>
+		   <hi>
+		     <ref target="http://www.tei-c.org/release/doc/tei-p5-doc/{$documentationLanguage}/html/ref-{@ident}.html">
+		       <xsl:value-of select="@ident"/>
+		     </ref>
+		     </hi>:
+		   <xsl:call-template name="makeDescription"/>
+		 </cell>
+	       </row>
+	     </xsl:for-each>
+	   </table>
+	   </div>
+	 </xsl:when>
+         <xsl:otherwise>
+	   <div>
+	     <head>Elements</head>
+	     <xsl:apply-templates mode="weave" select="tei:elementSpec">
+	       <xsl:sort select="@ident"/>
+	     </xsl:apply-templates>
+	   </div>
+	   <xsl:if test="tei:classSpec[@type='model']">
+	     <div>
+	       <head>Model classes</head>
+	       <xsl:apply-templates mode="weave" select="tei:classSpec[@type='model']">
+		 <xsl:sort select="@ident"/>
+	       </xsl:apply-templates>
+	     </div>
+	   </xsl:if>
+	   <xsl:if test="tei:classSpec[@type='atts']">
+	     <div>
+	       <head>Attribute classes</head>
+	       <xsl:apply-templates mode="weave" select="tei:classSpec[@type='atts']">
+		 <xsl:sort select="@ident"/>
+	       </xsl:apply-templates>
+	     </div>
+	   </xsl:if>
+	   <xsl:if test="tei:macroSpec">
+	     <div>
+	       <head>Macros</head>
+	       <xsl:apply-templates mode="weave" select="tei:macroSpec">
+		 <xsl:sort select="@ident"/>
+	       </xsl:apply-templates>
+	     </div>
+	   </xsl:if>
+	 </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="applyRendition"/>
+
+
+  <xsl:template match="tei:gloss" mode="inLanguage">
+      <seg>
+         <xsl:copy-of select="@xml:lang"/>
+         <xsl:value-of select="."/>
+      </seg>
+  </xsl:template>
+
+  <xsl:template match="tei:desc" mode="inLanguage">
+      <seg>
+         <xsl:copy-of select="@xml:lang"/>
+         <xsl:apply-templates/>
+      </seg>
+  </xsl:template>
+
+  <xsl:template name="appReading">
+     <xsl:param name="lemma"/>
+     <xsl:param name="lemmawitness"/>
+     <xsl:param name="readings"/>
+     <xsl:value-of select="$lemma"/>
+  </xsl:template>
+
+  <xsl:template name="makeSpan">
+    <xsl:apply-templates/>
+  </xsl:template>
+
+  <xsl:template match="tei:listRef" mode="weave"/>
+
+  <xsl:template match="tei:ref" mode="weave" priority="9">
+    <xsl:copy-of select="."/>
+  </xsl:template>
+
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/odds2/odd2lite.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/odds2/guidelines.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/odds2/guidelines.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/odds2/guidelines.xsl	(revision 258)
@@ -0,0 +1,1264 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml" xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:rng="http://relaxng.org/ns/structure/1.0" xmlns:tei="http://www.tei-c.org/ns/1.0" xmlns:teix="http://www.tei-c.org/ns/Examples" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="xlink rng tei teix xhtml a html xs xsl" version="2.0">
+  <xsl:param name="outputDir"><xsl:value-of select="$directory"/>/OPS</xsl:param>
+  <xsl:key name="EXAMPLES" match="teix:*[ancestor::teix:egXML]" use="concat(ancestor::tei:div[last()]/@xml:id,local-name())"/>
+  <xsl:key name="HEADS" match="tei:head" use="concat(@xml:lang,@corresp)"/>
+  <xsl:key name="BACKLINKS" match="teix:egXML[@corresp]" use="substring(@corresp,2)"/>
+  <xsl:key name="BACKLINKS" match="tei:ptr[@type='cit']" use="substring(@target,2)"/>
+  <heads xmlns="http://www.tei-c.org/ns/1.0">
+    <head xml:lang="fr" corresp="AB">À propos des Principes directeurs</head>
+    <head xml:lang="fr" corresp="AI">Mécanismes analytiques simples</head>
+    <head xml:lang="fr" corresp="BIB">Bibliographie</head>
+    <head xml:lang="fr" corresp="CC">Corpus linguistiques</head>
+    <head xml:lang="fr" corresp="CE">Degré de certitude et responsabilité</head>
+    <head xml:lang="fr" corresp="CH">Langues et jeux de caractères </head>
+    <head xml:lang="fr" corresp="CO">Éléments disponibles pour tous les documents TEI</head>
+    <head xml:lang="fr" corresp="COL">Colophon</head>
+    <head xml:lang="fr" corresp="dedication">Dédicace</head>
+    <head xml:lang="fr" corresp="DI">Dictionnaires</head>
+    <head xml:lang="fr" corresp="DR">Théâtre</head>
+    <head xml:lang="fr" corresp="DS">Structure textuelle par défaut</head>
+    <head xml:lang="fr" corresp="FS">Structures de traits</head>
+    <head xml:lang="fr" corresp="FT">Tableaux, formules et graphiques</head>
+    <head xml:lang="fr" corresp="GD">Graphes, réseaux et arbres</head>
+    <head xml:lang="fr" corresp="HD">En-tête TEI</head>
+    <head xml:lang="fr" corresp="MS">Description de manuscrits</head>
+    <head xml:lang="fr" corresp="ND">Noms, dates, personnes et lieux</head>
+    <head xml:lang="fr" corresp="NH">Structures non hiérarchiques</head>
+    <head xml:lang="fr" corresp="PH">Représentation de sources primaires</head>
+    <head xml:lang="fr" corresp="PREF">Préface et remerciements</head>
+    <head xml:lang="fr" corresp="PREFS">Notes préliminaires </head>
+    <head xml:lang="fr" corresp="REF-CLASSES-ATTS">Classes attributives</head>
+    <head xml:lang="fr" corresp="REF-CLASSES-MODEL">Classes structurales</head>
+    <head xml:lang="fr" corresp="REF-ELEMENTS">Éléments</head>
+    <head xml:lang="fr" corresp="REF-MACROS">Types de données et autres macros </head>
+    <head xml:lang="fr" corresp="SA">Liens, segmentation et alignement</head>
+    <head xml:lang="fr" corresp="SG">Petite introduction à XML</head>
+    <head xml:lang="fr" corresp="ST">Infrastructure de la TEI</head>
+    <head xml:lang="fr" corresp="TC">Apparat critique</head>
+    <head xml:lang="fr" corresp="TD">Éléments de déclaration d’un modèle</head>
+    <head xml:lang="fr" corresp="TitlePageVerso">Versions des Principes directeurs</head>
+    <head xml:lang="fr" corresp="TS">Transcriptions de la parole</head>
+    <head xml:lang="fr" corresp="USE">Utiliser la TEI</head>
+    <head xml:lang="fr" corresp="VE">Poésie</head>
+    <head xml:lang="fr" corresp="WD">Représentation des caractères et des
+glyphes non standard</head>
+    <head xml:lang="zh-TW" corresp="AI">簡易分析機制</head>
+    <head xml:lang="zh-TW" corresp="CE">確定程度與不確定程度</head>
+    <head xml:lang="zh-TW" corresp="CO">所有TEI文件所通用的元素</head>
+    <head xml:lang="zh-TW" corresp="CC">文集文本</head>
+    <head xml:lang="zh-TW" corresp="DI">紙本字典</head>
+    <head xml:lang="zh-TW" corresp="DR">劇本</head>
+    <head xml:lang="zh-TW" corresp="FT">表格、方程式與圖表</head>
+    <head xml:lang="zh-TW" corresp="WD">文字與字體說明</head>
+    <head xml:lang="zh-TW" corresp="HD">TEI標頭</head>
+    <head xml:lang="zh-TW" corresp="FS">功能結構 (Feature Structures)</head>
+    <head xml:lang="zh-TW" corresp="SA">Linking, segmentation and alignment連結、分割與隊列</head>
+    <head xml:lang="zh-TW" corresp="MS">寫本描述</head>
+    <head xml:lang="zh-TW" corresp="ND">名稱與日期</head>
+    <head xml:lang="zh-TW" corresp="GD">圖形、網絡與樹狀結構</head>
+    <head xml:lang="zh-TW" corresp="TS">轉錄的言詞</head>
+    <head xml:lang="zh-TW" corresp="TD">TEI模組說明</head>
+    <head xml:lang="zh-TW" corresp="ST">所有TEI模組可用的元素集、資料類型、巨集指令之宣告</head>
+    <head xml:lang="zh-TW" corresp="TC">學術編輯註解</head>
+    <head xml:lang="zh-TW" corresp="DS">預設文件結構</head>
+    <head xml:lang="zh-TW" corresp="PH">原文轉錄</head>
+    <head xml:lang="zh-TW" corresp="VE">韻文結構</head>
+    <head xml:lang="zh-TW" corresp="dedication">獻辭</head>
+    <head xml:lang="zh-TW" corresp="PREF">序言與致謝</head>
+    <head xml:lang="zh-TW" corresp="PREFS">序文的言辭</head>
+    <head xml:lang="zh-TW" corresp="REF-CLASSES-ATTS">屬性集</head>
+    <head xml:lang="zh-TW" corresp="REF-CLASSES-MODEL">元素集</head>
+    <head xml:lang="zh-TW" corresp="REF-ELEMENTS">元素</head>
+    <head xml:lang="zh-TW" corresp="REF-MACROS">資料類型與其他巨集指令</head>
+    <head xml:lang="zh-TW" corresp="USE">使用TEI</head>
+    <head xml:lang="zh-TW" corresp="SG">XML入門</head>
+    <head xml:lang="zh-TW" corresp="AB">關於</head>
+    <head xml:lang="it" corresp="USE">Come usare TEI</head>
+    <head xml:lang="it" corresp="SG">Una graduale introduzione a XML</head>
+    <head xml:lang="it" corresp="AB">Le presenti Linee Guida</head>
+    <head xml:lang="it" corresp="AI">Semplici meccanismi di analisi</head>
+    <head xml:lang="it" corresp="CE">Certezza e incertezza</head>
+    <head xml:lang="it" corresp="CO">Elementi comuni a tutti i documenti TEI</head>
+    <head xml:lang="it" corresp="CC">Corpus di testi</head>
+    <head xml:lang="it" corresp="DI">Dizionari a stampa</head>
+    <head xml:lang="it" corresp="DR">Testi per performance</head>
+    <head xml:lang="it" corresp="FT">Tabelle, formule e figure</head>
+    <head xml:lang="it" corresp="WD">Documentazione di caratteri non standard e glifi</head>
+    <head xml:lang="it" corresp="HD">L'intestazione TEI (TEI Header)</head>
+    <head xml:lang="it" corresp="FS">Strutture di configurazione (feature structures)</head>
+    <head xml:lang="it" corresp="SA">Collegamento, segmentazione e allineamento</head>
+    <head xml:lang="it" corresp="MS">Descrizione di manoscritti</head>
+    <head xml:lang="it" corresp="ND">Nomi e date</head>
+    <head xml:lang="it" corresp="GD">Grafici, reti e alberi</head>
+    <head xml:lang="it" corresp="TS">Trascrizione del parlato</head>
+    <head xml:lang="it" corresp="TD">Documentazione dei moduli TEI</head>
+    <head xml:lang="it" corresp="ST">Dichiarazione di classi, tipi di dati e macro
+</head>
+    <head xml:lang="it" corresp="TC">Apparato critico</head>
+    <head xml:lang="it" corresp="DS">Struttura standard del testo</head>
+    <head xml:lang="it" corresp="PH">Trascrizione di fonti primarie</head>
+    <head xml:lang="it" corresp="VE">Strutture poetiche</head>
+    <head xml:lang="it" corresp="COL">Colofone</head>
+    <head xml:lang="it" corresp="dedication">Dedica</head>
+    <head xml:lang="it" corresp="PREF">Prefazione e ringraziamenti</head>
+    <head xml:lang="it" corresp="PREFS">Note introduttive</head>
+    <head xml:lang="it" corresp="REF-CLASSES-ATTS">Classi di attributi</head>
+    <head xml:lang="it" corresp="REF-CLASSES-MODEL">Classi di modelli</head>
+    <head xml:lang="it" corresp="REF-ELEMENTS">Elementi</head>
+    <head xml:lang="it" corresp="REF-MACROS">Datatype e altre macro</head>
+    <head xml:lang="pt" corresp="AI">Mecanismos simples de análise</head>
+    <head xml:lang="pt" corresp="CE">Certeza e incerteza</head>
+    <head xml:lang="pt" corresp="CO">Elementos comuns a todos os documentos TEI</head>
+    <head xml:lang="pt" corresp="CC">Textos do corpora</head>
+    <head xml:lang="pt" corresp="DI">Dicionários impressos</head>
+    <head xml:lang="pt" corresp="DR">Textos de actuação</head>
+    <head xml:lang="pt" corresp="FT">Tabelas, fórmulas, e figuras</head>
+    <head xml:lang="pt" corresp="WD">Documentação dos carateres</head>
+    <head xml:lang="pt" corresp="HD">O cabeçalho TEI</head>
+    <head xml:lang="pt" corresp="FS">Estrutura das características</head>
+    <head xml:lang="pt" corresp="SA">Ligação, segmentação e alinhamento</head>
+    <head xml:lang="pt" corresp="MS">Descrição do manuscrito</head>
+    <head xml:lang="pt" corresp="ND">Nomes e datas</head>
+    <head xml:lang="pt" corresp="GD">Grafos, redes, e árvores</head>
+    <head xml:lang="pt" corresp="TS">Transcrição do discurso</head>
+    <head xml:lang="pt" corresp="TD">Documentação dos módulos TEI</head>
+    <head xml:lang="pt" corresp="ST">Declaraçoes de classes, tipos de dados, e macros disponíveis em todos os módulos  TEI </head>
+    <head xml:lang="pt" corresp="TC">Critical Apparatus</head>
+    <head xml:lang="pt" corresp="DS">Estrutura do texto por defeito</head>
+    <head xml:lang="pt" corresp="PH">Transcrição de fontes primárias</head>
+    <head xml:lang="pt" corresp="VE">Estrutura dos versos</head>
+    <head xml:lang="pt" corresp="COL">Colophon</head>
+    <head xml:lang="pt" corresp="dedication">Dedicação</head>
+    <head xml:lang="pt" corresp="PREF">Prefácio e agradecimentos</head>
+    <head xml:lang="pt" corresp="PREFS">Notas de prefácio</head>
+    <head xml:lang="pt" corresp="REF-CLASSES-ATTS">Classes dos atributos</head>
+    <head xml:lang="pt" corresp="REF-CLASSES-MODEL">Classes do modelo</head>
+    <head xml:lang="pt" corresp="REF-ELEMENTS">Elementos</head>
+    <head xml:lang="pt" corresp="REF-MACROS">Tipos de dados e outras macros</head>
+    <!-- keywords on the interface for Module -->
+    <head xml:lang="ja" corresp="AI">分析モジュール</head>
+    <head xml:lang="ja" corresp="CE">確信度モジュール</head>
+    <head xml:lang="ja" corresp="CO">コアモジュール</head>
+    <head xml:lang="ja" corresp="CC">コーパスモジュール</head>
+    <head xml:lang="ja" corresp="DI">辞書モジュール</head>
+    <head xml:lang="ja" corresp="DR">舞台芸術モジュール</head>
+    <head xml:lang="ja" corresp="FT">図表式モジュール</head>
+    <head xml:lang="ja" corresp="WD">外字モジュール</head>
+    <head xml:lang="ja" corresp="HD">ヘダーモジュール</head>
+    <head xml:lang="ja" corresp="FS">素性構造モジュール</head>
+    <head xml:lang="ja" corresp="SA">リンクモジュール</head>
+    <head xml:lang="ja" corresp="MS">手書きモジュール</head>
+    <head xml:lang="ja" corresp="ND">名前モジュール</head>
+    <head xml:lang="ja" corresp="GD">グラフモジュール</head>
+    <head xml:lang="ja" corresp="TS">発話モジュール</head>
+    <head xml:lang="ja" corresp="TD">タグ定義モジュール</head>
+    <head xml:lang="ja" corresp="TC">校勘モジュール</head>
+    <head xml:lang="ja" corresp="DS">テキスト構造モジュール</head>
+    <head xml:lang="ja" corresp="PH">転記モジュール</head>
+    <head xml:lang="ja" corresp="VE">韻文モジュール</head>
+    <!-- keywords on the interface for toc -->
+    <head xml:lang="ja" corresp="COL">コロフォン</head>
+    <head xml:lang="ja" corresp="dedication">献辞</head>
+    <head xml:lang="ja" corresp="PREF">序文と謝辞</head>
+    <head xml:lang="ja" corresp="PREFS">序文集</head>
+    <head xml:lang="ja" corresp="REF-CLASSES-ATTS">属性クラス</head>
+    <head xml:lang="ja" corresp="REF-CLASSES-MODEL">モデルクラス</head>
+    <head xml:lang="ja" corresp="REF-ELEMENTS">要素</head>
+    <!-- keywords on the interface for app.D -->
+    <head xml:lang="ja" corresp="REF-MACROS">データ型とマクロ</head>
+    <head xml:lang="ja" corresp="ST">TEIの基礎構造</head>
+    <head xml:lang="ja" corresp="AB">本ガイドラインについて</head>
+    <head xml:lang="ja" corresp="SG">XML入門</head>
+    <head xml:lang="ja" corresp="USE">TEIの使い方</head>
+    <head xml:lang="es" corresp="AI">Mecanismos analíticos simples</head>
+    <head xml:lang="es" corresp="CE">Certeza e incertidumbre</head>
+    <head xml:lang="es" corresp="CO">Elementos comunes a todos los documentos TEI</head>
+    <head xml:lang="es" corresp="CC">Textos de corpus</head>
+    <head xml:lang="es" corresp="DI">Diccionarios impresos</head>
+    <head xml:lang="es" corresp="DR">Textos teatrales</head>
+    <head xml:lang="es" corresp="FT">Tablas, fórmulas y figuras</head>
+    <head xml:lang="es" corresp="WD">Documentación de caracteres y glifos</head>
+    <head xml:lang="es" corresp="HD">La cabecera TEI</head>
+    <head xml:lang="es" corresp="FS">Estructuras de rasgos</head>
+    <head xml:lang="es" corresp="SA">Enlace, segmentación y alineación</head>
+    <head xml:lang="es" corresp="MS">Descripción de manuscritos</head>
+    <head xml:lang="es" corresp="ND">Nombres y fechas</head>
+    <head xml:lang="es" corresp="GD">Grafos, redes y árboles</head>
+    <head xml:lang="es" corresp="TS">Habla transcrita</head>
+    <head xml:lang="es" corresp="TD">Documentación de los módulos de TEI</head>
+    <head xml:lang="es" corresp="ST">Declaraciones de clases, tipos de datos y macros disponibles para todos los módulos TEI</head>
+    <head xml:lang="es" corresp="TC">Aparato crítico</head>
+    <head xml:lang="es" corresp="DS">Estructura textual por defecto</head>
+    <head xml:lang="es" corresp="PH">Transcripción de fuentes primarias</head>
+    <head xml:lang="es" corresp="VE">Estructuras de versos</head>
+    <head xml:lang="es" corresp="AB">Sobre estas directrices</head>
+    <head xml:lang="es" corresp="REF-CLASSES-ATTS">Clases de atributos</head>
+    <head xml:lang="es" corresp="REF-CLASSES-MODEL">Clases de modelos</head>
+    <head xml:lang="es" corresp="REF-ELEMENTS">Elementos</head>
+    <head xml:lang="es" corresp="SG">Una introducción suave a XML</head>
+    <head xml:lang="es" corresp="USE">Cómo usar TEI</head>
+    <!-- Catalan -->
+    <head xml:lang="ca" corresp="AI">Mecanismes analítics simples</head>
+    <head xml:lang="ca" corresp="CE">Certitud i incertitud</head>
+    <head xml:lang="ca" corresp="CO">Elements comuns a tots els documents TEI</head>
+    <head xml:lang="ca" corresp="CC">Textos de corpus</head>
+    <head xml:lang="ca" corresp="DI">Diccionaris impresos</head>
+    <head xml:lang="ca" corresp="DR">Textos teatrals</head>
+    <head xml:lang="ca" corresp="FT">Taules, fórmules i figures</head>
+    <head xml:lang="ca" corresp="WD">Documentació de caràcters i glifs</head>
+    <head xml:lang="ca" corresp="HD">L'encapçalament TEI</head>
+    <head xml:lang="ca" corresp="FS">Estructures de trets</head>
+    <head xml:lang="ca" corresp="SA">Enllaç, segmentació i alineació</head>
+    <head xml:lang="ca" corresp="MS">Descripció de manuscrits</head>
+    <head xml:lang="ca" corresp="ND">Noms i dates</head>
+    <head xml:lang="ca" corresp="GD">Grafs, xarxes i arbres</head>
+    <head xml:lang="ca" corresp="TS">Parla transcrita</head>
+    <head xml:lang="ca" corresp="TD">Documentació dels mòduls de TEI</head>
+    <head xml:lang="ca" corresp="ST">Declaracions de classes, tipus de dades i macros disponibles per a tots els mòduls TEI</head>
+    <head xml:lang="ca" corresp="TC">Aparat crític</head>
+    <head xml:lang="ca" corresp="DS">Estructura textual per defecte</head>
+    <head xml:lang="ca" corresp="PH">Transcripció de fonts primàries</head>
+    <head xml:lang="ca" corresp="VE">Estructures de versos</head>
+    <head xml:lang="ca" corresp="AB">Sobre aquestes directrius</head>
+    <head xml:lang="ca" corresp="REF-CLASSES-ATTS">Classes d'atributs</head>
+    <head xml:lang="ca" corresp="REF-CLASSES-MODEL">Classes de models</head>
+    <head xml:lang="ca" corresp="REF-ELEMENTS">Elements</head>
+    <head xml:lang="ca" corresp="SG">Una introducció suau a XML</head>
+    <head xml:lang="ca" corresp="USE">Com usar TEI</head>
+    <!-- German -->
+    <head xml:lang="de" corresp="AI">Einfache Analyse-Mechanismen</head>
+    <head xml:lang="de" corresp="CE">Zuverlässigkeit und Unsicherheit</head>
+    <head xml:lang="de" corresp="CO">Elemente, verfügbar in allen TEI-Dokumenten</head>
+    <head xml:lang="de" corresp="CC">Korpustexte</head>
+    <head xml:lang="de" corresp="DI">Gedruckte Wörterbücher</head>
+    <head xml:lang="de" corresp="DR">Zur Aufführung bestimmte Texte</head>
+    <head xml:lang="de" corresp="FT">Tabellen, Formeln und Abbildungen</head>
+    <head xml:lang="de" corresp="WD">Dokumentation von Zeichen und Glyphen</head>
+    <head xml:lang="de" corresp="HD">Der TEI-Header</head>
+    <head xml:lang="de" corresp="FS">Merkmalsstrukturen</head>
+    <head xml:lang="de" corresp="SA">Verlinken, Segmentieren und Parallelisieren</head>
+    <head xml:lang="de" corresp="MS">Handschriftenbeschreibung</head>
+    <head xml:lang="de" corresp="ND">Namen und Datumsangaben</head>
+    <head xml:lang="de" corresp="GD">Graphen, Netze und Bäume</head>
+    <head xml:lang="de" corresp="TS">Transkription gesprochener Sprache</head>
+    <head xml:lang="de" corresp="TD">Dokumentation zu den TEI-Modulen</head>
+    <head xml:lang="de" corresp="ST">Deklaration zu Klassen, Datentypen und Makros, verfügbar in allen TEI-Modulen</head>
+    <head xml:lang="de" corresp="TC">Kritische Apparate</head>
+    <head xml:lang="de" corresp="DS">Standard-Textstruktur</head>
+    <head xml:lang="de" corresp="PH">Transkription von Primärquellen</head>
+    <head xml:lang="de" corresp="VE">Vers-Strukturen</head>
+    <head xml:lang="kr" corresp="AI">단순 분석 기제</head>
+    <head xml:lang="kr" corresp="CE">확실성과 불확실성</head>
+    <head xml:lang="kr" corresp="CO">모든 TEI 문서에 공통된 요소들</head>
+    <head xml:lang="kr" corresp="CC">코퍼스 텍스트</head>
+    <head xml:lang="kr" corresp="DI">인쇄 사전</head>
+    <head xml:lang="kr" corresp="DR">공연 텍스트</head>
+    <head xml:lang="kr" corresp="FT">표, 식, 그림</head>
+    <head xml:lang="kr" corresp="WD">문자와 그림문자 문서</head>
+    <head xml:lang="kr" corresp="HD">TEI 헤더</head>
+    <head xml:lang="kr" corresp="FS">자질 구조</head>
+    <head xml:lang="kr" corresp="SA">연결, 분할, 정렬</head>
+    <head xml:lang="kr" corresp="MS">필사본 기술</head>
+    <head xml:lang="kr" corresp="ND">이름과 날짜</head>
+    <head xml:lang="kr" corresp="GD">그래프, 망, 수형도</head>
+    <head xml:lang="kr" corresp="TS">전사된 대화(말)</head>
+    <head xml:lang="kr" corresp="TD">TEI 모듈 문서</head>
+    <head xml:lang="kr" corresp="ST">모든 TEI 모듈에 사용되는 부류, 자료유형, 마크로를 위한 선언</head>
+    <head xml:lang="kr" corresp="TC">비평적 주석</head>
+    <head xml:lang="kr" corresp="DS">기본값 텍스트 구조</head>
+    <head xml:lang="kr" corresp="PH">일차 원전 전사</head>
+    <head xml:lang="kr" corresp="VE">운문 구조</head>
+    <head xml:lang="kr" corresp="COL">판권 면</head>
+    <head xml:lang="kr" corresp="dedication">헌정</head>
+    <head xml:lang="kr" corresp="PREF">서문과 사사 </head>
+    <head xml:lang="kr" corresp="PREFS">서문</head>
+    <head xml:lang="kr" corresp="REF-CLASSES-ATTS">속성 부류</head>
+    <head xml:lang="kr" corresp="REF-CLASSES-MODEL">모형 부류</head>
+    <head xml:lang="kr" corresp="REF-ELEMENTS">요소</head>
+    <head xml:lang="kr" corresp="REF-MACROS">자료유형과 다른 마크로</head>
+  </heads>
+  <xsl:template name="processTEIHook">
+    <xsl:for-each select="key('ELEMENTDOCS',1)">
+      <xsl:variable name="me" select="@ident"/>
+      <xsl:variable name="documentationLanguage">
+        <xsl:call-template name="generateDoc"/>
+      </xsl:variable>
+      <xsl:variable name="langs">
+        <xsl:value-of select="concat(normalize-space($documentationLanguage),' ')"/>
+      </xsl:variable>
+      <xsl:result-document doctype-public="{$doctypePublic}" doctype-system="{$doctypeSystem}" encoding="{$outputEncoding}" href="{$outputDir}/examples-{$me}.html" method="{$outputMethod}">
+        <html>
+          <xsl:comment>THIS IS A GENERATED FILE. DO NOT EDIT (10) </xsl:comment>
+          <head>
+            <title>
+              <xsl:call-template name="i18n">
+                <xsl:with-param name="word">Example</xsl:with-param>
+              </xsl:call-template>
+              <xsl:text>: &lt;</xsl:text>
+              <xsl:value-of select="$me"/>
+              <xsl:text>&gt; </xsl:text>
+              <xsl:call-template name="makeGloss">
+                <xsl:with-param name="langs" select="$langs"/>
+              </xsl:call-template>
+            </title>
+            <xsl:call-template name="includeCSS"/>
+            <meta content="Text Encoding Initiative Consortium XSLT stylesheets" name="generator"/>
+            <meta name="DC.Title">
+              <xsl:attribute name="content">
+                <xsl:call-template name="i18n">
+                  <xsl:with-param name="word">Example</xsl:with-param>
+                </xsl:call-template>
+                <xsl:text>: </xsl:text>
+                <xsl:value-of select="$me"/>
+                <xsl:text> </xsl:text>
+                <xsl:call-template name="makeGloss">
+                  <xsl:with-param name="langs" select="$langs"/>
+                </xsl:call-template>
+              </xsl:attribute>
+            </meta>
+            <meta content="application/xhtml+xml; charset=utf-8" http-equiv="Content-Type"/>
+            <xsl:call-template name="includeJavascript"/>
+            <xsl:call-template name="javascriptHook"/>
+          </head>
+          <body id="TOP">
+            <xsl:call-template name="guidelinesTop">
+              <xsl:with-param name="name">
+                <xsl:call-template name="i18n">
+                  <xsl:with-param name="word">Example</xsl:with-param>
+                </xsl:call-template>
+                <xsl:text>: &lt;</xsl:text>
+                <xsl:value-of select="$me"/>
+                <xsl:text>&gt; </xsl:text>
+                <xsl:call-template name="makeGloss">
+                  <xsl:with-param name="langs" select="$langs"/>
+                </xsl:call-template>
+              </xsl:with-param>
+            </xsl:call-template>
+            <div class="main-content">
+              <xsl:call-template name="startDivHook"/>
+              <h3>
+                <xsl:call-template name="i18n">
+                  <xsl:with-param name="word">Example</xsl:with-param>
+                </xsl:call-template>
+                <xsl:text>: &lt;</xsl:text>
+                <xsl:value-of select="$me"/>
+                <xsl:text>&gt; </xsl:text>
+                <xsl:call-template name="makeGloss">
+                  <xsl:with-param name="langs" select="$langs"/>
+                </xsl:call-template>
+              </h3>
+              <p>These search results reproduce every example of the
+	      use of <xsl:text>&lt;</xsl:text>
+	      <xsl:value-of select="$me"/>
+	      <xsl:text>&gt;</xsl:text> in the Guidelines, including all localised
+	      and translated versions. In some cases, the examples have been drawn
+	      from discussion of other elements in the Guidelines and illustrating
+	      the use of <xsl:text>&lt;</xsl:text>
+	      <xsl:value-of select="$me"/>
+	      <xsl:text>&gt;</xsl:text>
+	      is not the main 
+	      focus of the passage in question. In other cases, examples may be direct 
+	      translations of each other, and hence identical from the perspective of 
+	      their encoding.</p>
+              <xsl:variable name="items">
+                <xsl:for-each select="/tei:TEI/tei:text/tei:body/tei:div">
+                  <xsl:if test="count(key('EXAMPLES',concat(@xml:id,$me)))&gt;0">
+                    <li>
+                      <a href="#{@xml:id}">
+                        <xsl:call-template name="header"/>
+                      </a>
+                    </li>
+                  </xsl:if>
+                </xsl:for-each>
+              </xsl:variable>
+              <xsl:if test="count($items/html:li)&gt;0">
+                <ul>
+                  <xsl:copy-of select="$items/html:li"/>
+                </ul>
+              </xsl:if>
+              <xsl:for-each select="/tei:TEI/tei:text/tei:body/tei:div">
+                <xsl:if test="count(key('EXAMPLES',concat(@xml:id,$me)))&gt;0">
+                  <h4 id="{@xml:id}">
+                    <xsl:call-template name="header"/>
+                  </h4>
+                  <xsl:for-each select="key('EXAMPLES',concat(@xml:id,$me))">
+                    <xsl:variable name="pos">
+                      <xsl:number level="any" from="teix:egXML"/>
+                    </xsl:variable>
+                    <xsl:if test="number($pos)=1 or ($me='egXML' and         number($pos)=2)">
+                      <hr/>
+                      <p>
+                        <xsl:choose>
+                          <xsl:when test="ancestor::tei:elementSpec">
+                            <a href="ref-{ancestor::tei:elementSpec/@ident}.html">
+                              <xsl:text>&lt;</xsl:text>
+                              <xsl:value-of select="ancestor::tei:elementSpec/@ident"/>
+                              <xsl:text>&gt;</xsl:text>
+                            </a>
+                          </xsl:when>
+                          <xsl:when test="ancestor::tei:classSpec">
+                            <a href="ref-{ancestor::tei:classSpec/@ident}.html">
+                              <xsl:value-of select="ancestor::tei:classSpec/@ident"/>
+                            </a>
+                          </xsl:when>
+                          <xsl:otherwise>
+                            <xsl:for-each select="ancestor::tei:div[@xml:id and tei:head][1]">
+                              <a>
+                                <xsl:attribute name="href">
+                                  <xsl:apply-templates select="." mode="generateLink"/>
+                                </xsl:attribute>
+                                <xsl:call-template name="header"/>
+                              </a>
+                            </xsl:for-each>
+                          </xsl:otherwise>
+                        </xsl:choose>
+                      </p>
+                      <xsl:apply-templates select="ancestor::teix:egXML">
+                        <xsl:with-param name="simple">true</xsl:with-param>
+                        <xsl:with-param name="highlight">
+                          <xsl:value-of select="$me"/>
+                        </xsl:with-param>
+                      </xsl:apply-templates>
+                    </xsl:if>
+                  </xsl:for-each>
+                </xsl:if>
+              </xsl:for-each>
+            </div>
+            <xsl:call-template name="stdfooter">
+              <xsl:with-param name="file">
+                <xsl:text>examples-</xsl:text>
+                <xsl:value-of select="$me"/>
+              </xsl:with-param>
+            </xsl:call-template>
+          </body>
+        </html>
+      </xsl:result-document>
+    </xsl:for-each>
+  </xsl:template>
+  <xsl:template name="metaHTML">
+    <xsl:param name="title"/>
+    <meta name="Language" content="{$documentationLanguage}"/>
+    <meta name="DC.Title" content="{$title}"/>
+    <meta name="DC.Language" content="(SCHEME=iso639) {$documentationLanguage}"/>
+    <meta name="DC.Creator" content="TEI, Oxford University Computing Services, 13 Banbury Road, Oxford OX2 6NN, United Kingdom"/>
+    <meta name="DC.Creator.Address" content="tei@oucs.ox.ac.uk"/>
+    <meta content="application/xhtml+xml; charset=utf-8" http-equiv="Content-Type"/>
+  </xsl:template>
+  <xsl:template name="startDivHook">
+      <xsl:if test="($outputTarget='epub' or $outputTarget='epub3') and not(parent::tei:div)">
+        <h2>
+          <xsl:call-template name="header"/>
+        </h2>
+      </xsl:if>
+    <xsl:if test="not(parent::tei:div) or not(local-name(preceding::*[1])='head')">
+      <div>
+        <xsl:if test="$outputTarget='epub' or $outputTarget='epub3'">
+          <xsl:attribute name="style">
+            <xsl:text>margin-top: 0em;</xsl:text>
+          </xsl:attribute>
+        </xsl:if>
+        <xsl:choose>
+          <xsl:when test="not(parent::tei:div) and child::tei:div">
+            <xsl:attribute name="class">
+              <xsl:text>miniTOC miniTOC_left</xsl:text>
+            </xsl:attribute>
+            <xsl:call-template name="subtoc"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:attribute name="class">
+              <xsl:text>miniTOC miniTOC_right</xsl:text>
+            </xsl:attribute>
+          </xsl:otherwise>
+        </xsl:choose>
+        <ul class="subtoc">
+          <li class="subtoc">
+            <xsl:call-template name="previousLink"/>
+          </li>
+          <li class="subtoc">
+            <xsl:call-template name="nextLink"/>
+          </li>
+          <li class="subtoc">
+            <a class="navigation" href="index.html">
+              <xsl:call-template name="i18n">
+                <xsl:with-param name="word">homeWord</xsl:with-param>
+              </xsl:call-template>
+            </a>
+            <xsl:text> | </xsl:text>
+            <a class="navigation" href="index-toc.html">
+              <xsl:call-template name="i18n">
+                <xsl:with-param name="word">tocWords</xsl:with-param>
+              </xsl:call-template>
+            </a>
+          </li>
+          <li class="subtoc">
+            <xsl:choose>
+              <xsl:when test="self::tei:elementSpec">
+                <a class="navigation" href="REF-ELEMENTS.html">
+                  <xsl:call-template name="showHead">
+                    <xsl:with-param name="ID">
+                      <xsl:text>REF-ELEMENTS</xsl:text>
+                    </xsl:with-param>
+                  </xsl:call-template>
+                </a>
+              </xsl:when>
+              <xsl:when test="self::tei:classSpec[@type='model']">
+                <a class="navigation" href="REF-CLASSES-MODEL.html">
+                  <xsl:call-template name="showHead">
+                    <xsl:with-param name="ID">
+                      <xsl:text>REF-CLASSES-MODEL</xsl:text>
+                    </xsl:with-param>
+                  </xsl:call-template>
+                </a>
+              </xsl:when>
+              <xsl:when test="self::tei:classSpec[@type='atts']">
+                <a class="navigation" href="REF-CLASSES-ATTS.html">
+                  <xsl:call-template name="showHead">
+                    <xsl:with-param name="ID">
+                      <xsl:text>REF-CLASSES-ATTS</xsl:text>
+                    </xsl:with-param>
+                  </xsl:call-template>
+                </a>
+              </xsl:when>
+              <xsl:when test="self::tei:macroSpec">
+                <a class="navigation" href="REF-MACROS.html">
+                  <xsl:call-template name="showHead">
+                    <xsl:with-param name="ID">
+                      <xsl:text>REF-MACROS</xsl:text>
+                    </xsl:with-param>
+                  </xsl:call-template>
+                </a>
+              </xsl:when>
+            </xsl:choose>
+          </li>
+        </ul>
+      </div>
+    </xsl:if>
+  </xsl:template>
+  <xsl:template name="mainPage">
+    <xsl:param name="currentID"/>
+    <xsl:call-template name="guidelinesTop"/>
+    <div id="onecol" class="main-content">
+      <xsl:call-template name="mainFrame">
+        <xsl:with-param name="currentID" select="$currentID"/>
+        <xsl:with-param name="minimal">true</xsl:with-param>
+      </xsl:call-template>
+      <xsl:if test="$currentID=''">
+        <div style="float:left; margin:4%;">
+          <h3>
+            <xsl:call-template name="i18n">
+              <xsl:with-param name="word">Versions of the Guidelines</xsl:with-param>
+            </xsl:call-template>
+          </h3>
+          <ul>
+            <li>
+              <a href="index-toc.html">
+                <xsl:call-template name="i18n">
+                  <xsl:with-param name="word">tocWords</xsl:with-param>
+                </xsl:call-template>
+              </a>
+            </li>
+            <xsl:if test="$outputTarget='html'">
+              <li>
+                <a href="../../en/Guidelines.pdf">PDF</a>
+              </li>
+            </xsl:if>
+            <li>
+              <a href="http://www.tei-c.org/Council/tcw06.xml">
+                <xsl:call-template name="i18n">
+                  <xsl:with-param name="word">Getting the most recent version</xsl:with-param>
+                </xsl:call-template>
+              </a>
+            </li>
+            <li>
+              <a href="http://tei.svn.sourceforge.net/viewvc/tei/">
+                <xsl:call-template name="i18n">
+                  <xsl:with-param name="word">Sourceforge Subversion Repository</xsl:with-param>
+                </xsl:call-template>
+              </a>
+            </li>
+            <li>
+              <a href="http://sourceforge.net/tracker/?group_id=106328&amp;func=browse">
+                <xsl:call-template name="i18n">
+                  <xsl:with-param name="word">BugsFeatures</xsl:with-param>
+                </xsl:call-template>
+              </a>
+            </li>
+          </ul>
+        </div>
+        <div style="float:left; margin:4%;">
+          <h3>
+            <xsl:call-template name="i18n">
+              <xsl:with-param name="word">Some Popular Sections</xsl:with-param>
+            </xsl:call-template>
+          </h3>
+          <ul>
+            <li>
+              <a href="AB.html">
+                <xsl:call-template name="showHead">
+                  <xsl:with-param name="ID">
+                    <xsl:text>AB</xsl:text>
+                  </xsl:with-param>
+                </xsl:call-template>
+              </a>
+            </li>
+            <li>
+              <a href="SG.html">
+                <xsl:call-template name="showHead">
+                  <xsl:with-param name="ID">
+                    <xsl:text>SG</xsl:text>
+                  </xsl:with-param>
+                </xsl:call-template>
+              </a>
+            </li>
+            <li>
+              <a href="ST.html">
+                <xsl:call-template name="showHead">
+                  <xsl:with-param name="ID">
+                    <xsl:text>ST</xsl:text>
+                  </xsl:with-param>
+                </xsl:call-template>
+              </a>
+            </li>
+            <li>
+              <a href="HD.html">
+                <xsl:call-template name="showHead">
+                  <xsl:with-param name="ID">
+                    <xsl:text>HD</xsl:text>
+                  </xsl:with-param>
+                </xsl:call-template>
+              </a>
+            </li>
+            <li>
+              <a href="CO.html">
+                <xsl:call-template name="showHead">
+                  <xsl:with-param name="ID">
+                    <xsl:text>CO</xsl:text>
+                  </xsl:with-param>
+                </xsl:call-template>
+              </a>
+            </li>
+            <li>
+              <a href="USE.html">
+                <xsl:call-template name="showHead">
+                  <xsl:with-param name="ID">
+                    <xsl:text>USE</xsl:text>
+                  </xsl:with-param>
+                </xsl:call-template>
+              </a>
+            </li>
+            <li>
+              <a href="REF-CLASSES-MODEL.html">
+                <xsl:call-template name="showHead">
+                  <xsl:with-param name="ID">
+                    <xsl:text>REF-CLASSES-MODEL</xsl:text>
+                  </xsl:with-param>
+                </xsl:call-template>
+              </a>
+            </li>
+            <li>
+              <a href="REF-CLASSES-ATTS.html">
+                <xsl:call-template name="showHead">
+                  <xsl:with-param name="ID">
+                    <xsl:text>REF-CLASSES-ATTS</xsl:text>
+                  </xsl:with-param>
+                </xsl:call-template>
+              </a>
+            </li>
+            <li>
+              <a href="REF-ELEMENTS.html">
+                <xsl:call-template name="showHead">
+                  <xsl:with-param name="ID">
+                    <xsl:text>REF-ELEMENTS</xsl:text>
+                  </xsl:with-param>
+                </xsl:call-template>
+              </a>
+            </li>
+          </ul>
+        </div>
+        <xsl:variable name="name">TEI Guidelines TOC </xsl:variable>
+        <xsl:variable name="outName">
+          <xsl:call-template name="outputChunkName">
+            <xsl:with-param name="ident">
+              <xsl:text>index-toc</xsl:text>
+            </xsl:with-param>
+          </xsl:call-template>
+        </xsl:variable>
+        <xsl:if test="$verbose='true'">
+          <xsl:message>Opening file <xsl:value-of select="$outName"/></xsl:message>
+        </xsl:if>
+        <xsl:result-document 
+	    doctype-public="{$doctypePublic}"
+	    omit-xml-declaration="yes"
+	    doctype-system="{$doctypeSystem}" 
+	    encoding="{$outputEncoding}" 
+	    href="{$outName}" 
+	    method="{$outputMethod}">
+          <html>
+            <xsl:comment>THIS IS A GENERATED FILE. DO NOT EDIT (8) </xsl:comment>
+            <head>
+              <title>
+                <xsl:value-of select="$name"/>
+              </title>
+              <xsl:call-template name="includeCSS"/>
+              <meta content="Text Encoding Initiative Consortium XSLT stylesheets" name="generator"/>
+              <meta content="{$name}" name="DC.Title"/>
+              <meta content="application/xhtml+xml; charset=utf-8" http-equiv="Content-Type"/>
+              <xsl:call-template name="includeJavascript"/>
+              <xsl:call-template name="javascriptHook"/>
+            </head>
+            <body id="TOP">
+              <xsl:call-template name="bodyHook"/>
+              <xsl:call-template name="guidelinesTop"/>
+              <div id="onecol" class="main-content">
+                <xsl:call-template name="mainTOC"/>
+              </div>
+              <xsl:call-template name="stdfooter"/>
+            </body>
+          </html>
+        </xsl:result-document>
+        <xsl:if test="$verbose='true'">
+          <xsl:message>Closing file <xsl:value-of select="$outName"/></xsl:message>
+        </xsl:if>
+      </xsl:if>
+    </div>
+  </xsl:template>
+  <xsl:template name="showHead">
+    <xsl:param name="ID"/>
+    <xsl:variable name="Here" select="/"/>
+    <xsl:for-each select="id($ID)">
+      <xsl:choose>
+        <xsl:when test="ancestor::tei:front">
+          <xsl:number format="i"/>
+        </xsl:when>
+        <xsl:when test="ancestor::tei:back">
+          <xsl:number format="A"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:number/>
+        </xsl:otherwise>
+      </xsl:choose>
+      <xsl:text> </xsl:text>
+    </xsl:for-each>
+    <xsl:for-each select="document('')">
+      <xsl:choose>
+        <xsl:when test="key('HEADS',concat($documentationLanguage,$ID))">
+          <xsl:for-each select="key('HEADS',concat($documentationLanguage,$ID))">
+            <xsl:value-of select="."/>
+          </xsl:for-each>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:for-each select="$Here">
+            <xsl:for-each select="id($ID)">
+              <xsl:value-of select="tei:head"/>
+            </xsl:for-each>
+          </xsl:for-each>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:for-each>
+  </xsl:template>
+  <xsl:template name="numberFrontDiv">
+    <xsl:param name="minimal"/>
+    <xsl:if test="count(ancestor::tei:div)&lt;2">
+      <xsl:number count="tei:div" format="i.1.1." level="multiple"/>
+      <xsl:if test="$minimal='false'">
+        <xsl:value-of select="$numberSpacer"/>
+      </xsl:if>
+    </xsl:if>
+  </xsl:template>
+  <xsl:template name="pageHeader">
+    <xsl:param name="mode"/>
+    <xsl:call-template name="makeHTMLHeading">
+      <xsl:with-param name="class">title</xsl:with-param>
+      <xsl:with-param name="text">
+        <xsl:call-template name="generateTitle"/>
+      </xsl:with-param>
+      <xsl:with-param name="level">1</xsl:with-param>
+    </xsl:call-template>
+    <xsl:call-template name="makeHTMLHeading">
+      <xsl:with-param name="class">subtitle</xsl:with-param>
+      <xsl:with-param name="text">
+        <xsl:call-template name="generateSubTitle"/>
+      </xsl:with-param>
+      <xsl:with-param name="level">2</xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <xsl:template name="stdheader">
+    <xsl:param name="title" select="'(no title)'"/>
+    <xsl:call-template name="pageHeader"/>
+  </xsl:template>
+  <xsl:template match="tei:titlePage">
+    <!--
+	<div class="titlePage">
+	<h1>
+	<xsl:apply-templates
+	select="tei:docTitle/tei:titlePart/tei:title"/>
+	</h1>
+	<h2>
+	<xsl:value-of select="tei:docAuthor"/>
+	</h2>
+	</div>
+    -->
+  </xsl:template>
+  <xsl:template name="continuedToc">
+    <xsl:if test="tei:div">
+      <ul class="continuedtoc">
+        <xsl:apply-templates mode="maketoc" select="tei:div"/>
+      </ul>
+    </xsl:if>
+  </xsl:template>
+  <xsl:template match="tei:div" mode="maketoc">
+    <xsl:param name="forcedepth"/>
+    <xsl:variable name="myName">
+      <xsl:value-of select="local-name(.)"/>
+    </xsl:variable>
+    <xsl:if test="tei:head or $autoHead='true'">
+      <xsl:variable name="Depth">
+        <xsl:choose>
+          <xsl:when test="not($forcedepth='')">
+            <xsl:value-of select="$forcedepth"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:value-of select="$tocDepth"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:variable>
+      <xsl:variable name="thislevel">
+        <xsl:value-of select="count(ancestor::tei:div)"/>
+      </xsl:variable>
+      <xsl:variable name="pointer">
+        <xsl:apply-templates mode="generateLink" select="."/>
+      </xsl:variable>
+      <li>
+        <xsl:choose>
+	  <xsl:when test="$outputTarget='epub' or $outputTarget='epub3'"/>
+          <xsl:when test="not(ancestor::tei:div) and tei:div">
+            <xsl:attribute name="class">
+              <xsl:text>tocTree</xsl:text>
+            </xsl:attribute>
+            <span class="showhide">
+              <span class="tocShow">
+                <img alt="+" src="Images/plus.gif"/>
+              </span>
+              <span class="tocHide">
+                <img alt="-" src="Images/minus.gif"/>
+              </span>
+            </span>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:attribute name="class">
+              <xsl:text>toc</xsl:text>
+            </xsl:attribute>
+            <span class="notshowhide">
+              <xsl:text>&#160;&#160;</xsl:text>
+            </span>
+          </xsl:otherwise>
+        </xsl:choose>
+        <xsl:call-template name="header">
+          <xsl:with-param name="toc" select="$pointer"/>
+          <xsl:with-param name="minimal">false</xsl:with-param>
+          <xsl:with-param name="display">plain</xsl:with-param>
+        </xsl:call-template>
+        <xsl:if test="$thislevel &lt; $Depth">
+          <xsl:call-template name="continuedToc"/>
+        </xsl:if>
+      </li>
+    </xsl:if>
+  </xsl:template>
+  <!--
+  <xsl:template name="mainTOC">
+    <xsl:param name="force"/>
+
+    <div class="toc_back">
+      <h3>
+      	  <xsl:call-template name="i18n">
+	    <xsl:with-param name="word">Back Matter</xsl:with-param>
+	  </xsl:call-template>
+      </h3>
+      <xsl:for-each
+	  select="ancestor-or-self::tei:TEI/tei:text/tei:back">
+	<xsl:if test="tei:div">
+	  <ul class="toc{$force} toc_back">
+	    <xsl:apply-templates mode="maketoc"
+				 select="tei:div">
+	      <xsl:with-param name="forcedepth" select="$force"/>
+              </xsl:apply-templates>
+	  </ul>
+	</xsl:if>
+      </xsl:for-each>
+    </div>
+
+    <div class="toc_front">
+      <h3>
+      	  <xsl:call-template name="i18n">
+	    <xsl:with-param name="word">Front Matter</xsl:with-param>
+	  </xsl:call-template>
+      </h3>
+      <xsl:for-each
+	  select="ancestor-or-self::tei:TEI/tei:text/tei:front">
+	<xsl:if	    test="tei:div">
+	  <ul class="toc{$force} toc_front">
+	    <xsl:apply-templates mode="maketoc" select="tei:div">
+	      <xsl:with-param name="forcedepth" select="$force"/>
+	    </xsl:apply-templates>
+            </ul>
+	</xsl:if>
+      </xsl:for-each>
+    </div>
+
+    <div class="toc_body">
+      <h3>
+      	  <xsl:call-template name="i18n">
+	    <xsl:with-param name="word">Text body</xsl:with-param>
+	  </xsl:call-template>
+      </h3>
+      <xsl:for-each
+        select="ancestor-or-self::tei:TEI/tei:text/tei:body">
+        <xsl:if          test="tei:div">
+          <ul class="toc{$force}  toc_body">
+            <xsl:apply-templates mode="maketoc"
+              select="tei:div">
+              <xsl:with-param name="forcedepth" select="$force"/>
+            </xsl:apply-templates>
+          </ul>
+        </xsl:if>
+      </xsl:for-each>
+    </div>
+
+  </xsl:template>
+
+-->
+  <xsl:template match="tei:divGen[@type='toc']">
+    <xsl:call-template name="mainPage"/>
+  </xsl:template>
+  <xsl:template name="javascriptHook">
+    <script type="text/javascript" src="jquery-1.2.6.min.js">
+      <xsl:comment>JQuery</xsl:comment>
+    </script>
+    <!--
+    <script type="text/javascript" src="jquery.treeview.js">	
+       <xsl:comment>JQuery treeview</xsl:comment>
+    </script>
+-->
+    <script type="text/javascript" src="columnlist.js">
+      <xsl:comment>JQuery columnlist</xsl:comment>
+    </script>
+    <script type="text/javascript">
+        $(function() {
+         $('ul.attrefs-class').columnizeList({cols:3,width:30,unit:'%'});
+         $('ul.attrefs-element').columnizeList({cols:3,width:30,unit:'%'});
+         $(".displayRelaxButton").click(function() {
+           $(this).parent().find('.RNG_XML').toggle();
+           $(this).parent().find('.RNG_Compact').toggle();
+         });
+         $(".tocTree .showhide").click(function() {
+          $(this).find(".tocShow,.tocHide").toggle();
+          $(this).parent().find("ul.continuedtoc").toggle();
+	  });
+        })
+    </script>
+    <xsl:if test="not($googleAnalytics='')">
+      <script type="text/javascript" src="udm-all.js">
+        <xsl:comment>UDM</xsl:comment>
+      </script>
+      <link rel="stylesheet" href="udm.css"/>
+    </xsl:if>
+    <xsl:call-template name="jsForOdds"/>
+  </xsl:template>
+  <xsl:template name="sectionHeadHook">
+    <xsl:variable name="ident">
+      <xsl:apply-templates mode="ident" select="."/>
+    </xsl:variable>
+    <xsl:variable name="d">
+      <xsl:apply-templates mode="depth" select="."/>
+    </xsl:variable>
+    <xsl:if test="$d &gt; 0">
+      <span class="bookmarklink">
+        <a class="bookmarklink" href="#{$ident}">
+          <xsl:attribute name="title">
+            <xsl:text>link to this section </xsl:text>
+          </xsl:attribute>
+          <span class="invisible">
+            <xsl:text>TEI: </xsl:text>
+            <xsl:value-of select="tei:head[1]"/>
+          </span>
+          <span class="pilcrow">
+            <xsl:text>¶</xsl:text>
+          </span>
+        </a>
+      </span>
+    </xsl:if>
+  </xsl:template>
+  <xsl:template match="/div"> </xsl:template>
+  <xsl:template name="myi18n">
+    <xsl:param name="word"/>
+    <xsl:choose>
+      <xsl:when test="$word='previousWord'">
+        <span class="icon">
+          <xsl:text>« </xsl:text>
+        </span>
+      </xsl:when>
+      <xsl:when test="$word='upWord'">
+        <span class="icon">
+          <xsl:text>↑ </xsl:text>
+        </span>
+      </xsl:when>
+      <xsl:when test="$word='nextWord'">
+        <span class="icon">
+          <xsl:text>» </xsl:text>
+        </span>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:template>
+
+  <!-- only use listBibl if its in right language-->
+  <xsl:template match="tei:listBibl[@xml:lang and not($documentationLanguage=@xml:lang)]"/>
+
+  <!-- link from bibl back to egXML -->
+  <xsl:template
+      match="tei:listBibl/tei:biblStruct|tei:listBibl/tei:bibl">
+    <xsl:apply-templates/>
+    <xsl:for-each select="key('BACKLINKS',@xml:id)">
+      <xsl:if test="self::teix:egXML">
+        <xsl:text> </xsl:text>
+        <a class="link_return" title="Go back to text">
+          <xsl:attribute name="href">
+            <xsl:apply-templates select="." mode="generateLink"/>
+          </xsl:attribute>
+          <xsl:text>↵</xsl:text>
+        </a>
+      </xsl:if>
+    </xsl:for-each>
+  </xsl:template>
+
+  <xsl:template name="egXMLEndHook">
+    <xsl:if test="@corresp and id(substring(@corresp,2))">
+      <div style="float: right;">
+        <a>
+          <xsl:attribute name="href">
+            <xsl:apply-templates mode="generateLink" select="id(substring(@corresp,2))"/>
+          </xsl:attribute>
+          <xsl:text>bibliography</xsl:text>
+          <!--	  <span class="citLink">&#x270d;</span>-->
+        </a>
+	<xsl:text>&#160;</xsl:text>
+      </div>
+    </xsl:if>
+    <xsl:for-each select="ancestor::tei:elementSpec">
+      <div style="float: right;">
+        <a href="examples-{@ident}.html">
+          <xsl:call-template name="i18n">
+            <xsl:with-param name="word">Show all</xsl:with-param>
+          </xsl:call-template>
+        </a>
+	<xsl:text>&#160;</xsl:text>
+      </div>
+    </xsl:for-each>
+  </xsl:template>
+  <xsl:template name="figureHook">
+    <xsl:if test="@corresp and id(substring(@corresp,2))">
+      <div style="float: right;">
+        <a>
+          <xsl:attribute name="href">
+            <xsl:apply-templates mode="generateLink" select="id(substring(@corresp,2))"/>
+          </xsl:attribute>
+          <xsl:text>bibliography</xsl:text>
+        </a>
+      </div>
+    </xsl:if>
+  </xsl:template>
+  <xsl:template name="stdfooter">
+    <xsl:param name="style" select="'plain'"/>
+    <xsl:param name="file">index</xsl:param>
+    <xsl:variable name="date">
+      <xsl:call-template name="generateDate"/>
+    </xsl:variable>
+    <xsl:variable name="author">
+      <xsl:call-template name="generateAuthor"/>
+    </xsl:variable>
+    <div class="stdfooter">
+      <xsl:if test="$outputTarget='html'">
+        <p>
+	  [<a href="../../en/html/{$file}.html">English</a>]
+	  [<a href="../../de/html/{$file}.html">Deutsch</a>]
+	  [<a href="../../es/html/{$file}.html">Español</a>]
+	  [<a href="../../it/html/{$file}.html">Italiano</a>]
+	  [<a href="../../fr/html/{$file}.html">Français</a>]
+	  [<a href="../../ja/html/{$file}.html">日本語</a>]
+	  [<a href="../../kr/html/{$file}.html">한국어</a>]
+	  [<a href="../../zh-TW/html/{$file}.html">中文</a>]
+	</p>
+      </xsl:if>
+      <hr/>
+      <xsl:if test="$linkPanel='true'">
+        <div class="footer">
+          <xsl:if test="not($parentURL='')">
+            <a class="{$style}" href="{$parentURL}">
+              <xsl:value-of select="$parentWords"/>
+            </a>
+          </xsl:if>
+          <xsl:if test="$searchURL"> | <a class="{$style}" href="{$searchURL}" target="_top"><xsl:call-template name="searchWords"/></a>
+          </xsl:if>
+          <xsl:if test="$feedbackURL"> | <a class="{$style}" href="{$feedbackURL}"><xsl:call-template name="feedbackWords"/></a>
+          </xsl:if>
+        </div>
+        <hr/>
+      </xsl:if>
+      <xsl:for-each
+	  select="ancestor-or-self::tei:TEI/tei:teiHeader/tei:fileDesc/tei:publicationStmt/tei:availability">
+	<div class="availability">
+	  <xsl:apply-templates/>
+	  <xsl:choose>
+	    <xsl:when test="count(tei:licence)&gt;1">
+	      <ol>
+		<xsl:for-each select="tei:licence">
+		  <li>
+		    <xsl:choose>
+		      <xsl:when test="@target">
+			<a href="{@target}"><xsl:value-of select="@target"/></a>
+		      </xsl:when>
+		      <xsl:otherwise>			
+			<xsl:apply-templates/>
+		      </xsl:otherwise>
+		    </xsl:choose>
+		  </li>
+		</xsl:for-each>
+	      </ol>
+	    </xsl:when>
+	    <xsl:otherwise>
+	      <div class="licence">
+		<xsl:for-each select="tei:licence">
+		  <a href="{@target}">
+		    <xsl:apply-templates/>
+		  </a>
+		</xsl:for-each>
+	      </div>
+	    </xsl:otherwise>
+	  </xsl:choose>
+	</div>
+      </xsl:for-each>
+
+      <address>
+	<br/>
+        <xsl:text>Version </xsl:text>
+        <xsl:value-of 
+	    select="ancestor-or-self::tei:TEI/tei:teiHeader/tei:fileDesc/tei:editionStmt/tei:edition"/>
+        <xsl:text>This page generated on </xsl:text> 
+	<xsl:call-template name="whatsTheDate"/>
+      </address>
+    </div>
+    <xsl:if test="not($googleAnalytics='')">
+      <script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
+        <!-- load google analytics -->
+      </script>
+      <script type="text/javascript">
+        <xsl:text>_uacct = "</xsl:text>
+        <xsl:value-of select="$googleAnalytics"/>
+        <xsl:text>";
+	urchinTracker();
+	</xsl:text>
+      </script>
+    </xsl:if>
+  </xsl:template>
+  <xsl:template name="guidelinesTop">
+    <xsl:param name="name"/>
+    <xsl:if test="$outputTarget='html'">
+      <xsl:if test="not($googleAnalytics='')">
+        <script type="text/javascript" src="udm-dom.js">
+          <xsl:comment>&#160;</xsl:comment>
+        </script>
+        <script type="text/javascript" src="udm-mod-keyboard.js">
+          <xsl:comment>&#160;</xsl:comment>
+        </script>
+      </xsl:if>
+      <div id="container">
+        <a href="#contentstart" title="Skip to content" class="skip">skip to content</a>
+        <div id="banner">
+          <img src="Images/banner.jpg" alt="Text Encoding Initiative logo and banner"/>
+        </div>
+        <xsl:if test="not($googleAnalytics='')">
+          <xsl:copy-of select="document('staticnav.xml')/html:ul"/>
+        </xsl:if>
+      </div>
+      <div id="searchbox" style="float:left;">
+        <form action="http://www.google.com/search" method="get">
+          <fieldset><input style="color:#225588;" value="" maxlength="255" size="20" name="q" type="text"/>&#160;<select name="sitesearch"><option value="http://www.tei-c.org/">Entire site</option><option value="http://www.tei-c.org/release/doc/tei-p5-doc/{$documentationLanguage}/html/" selected="selected">P5 Guidelines
+	    <xsl:choose><xsl:when test="$documentationLanguage='en'"> — English</xsl:when><xsl:when test="$documentationLanguage='de'"> — Deutsch</xsl:when><xsl:when test="$documentationLanguage='es'"> — Español</xsl:when><xsl:when test="$documentationLanguage='it'"> — Italiano</xsl:when><xsl:when test="$documentationLanguage='fr'"> — Français</xsl:when><xsl:when test="$documentationLanguage='ja'"> — 日本語</xsl:when><xsl:when test="$documentationLanguage='kr'"> — 한국어</xsl:when><xsl:when test="$documentationLanguage='zh-TW'"> — 中文</xsl:when></xsl:choose>
+	    </option><option value="http://www.tei-c.org/Guidelines/P4/html/">P4 Guidelines</option></select>&#160;<input style="font-size:100%; font-weight:bold;      color:#FFFFFF; background-color:#225588; height: 2em;" value="Search" type="submit"/></fieldset>
+        </form>
+      </div>
+    </xsl:if>
+    <div class="mainhead">
+      <h1>P5: 
+    <xsl:call-template name="i18n"><xsl:with-param name="word">GuidelinesTEI</xsl:with-param></xsl:call-template>
+    </h1>
+    </div>
+  </xsl:template>
+  <xsl:template name="generateParentsByAttribute">
+    <xsl:variable name="this" select="@ident"/>
+    <xsl:if test="count(key('ATTREFS-CLASS',$this))&gt;0">
+      <div>
+        <xsl:call-template name="i18n">
+          <xsl:with-param name="word">
+            <xsl:text>Class</xsl:text>
+          </xsl:with-param>
+        </xsl:call-template>
+        <xsl:text>: </xsl:text>
+        <ul class="attrefs-class">
+          <xsl:for-each select="key('ATTREFS-CLASS',$this)">
+            <xsl:sort select="ancestor::tei:classSpec/@ident"/>
+            <xsl:sort select="@ident"/>
+            <li>
+              <xsl:for-each select="ancestor::tei:classSpec">
+                <xsl:call-template name="linkTogether">
+                  <xsl:with-param name="name">
+                    <xsl:value-of select="@ident"/>
+                  </xsl:with-param>
+                  <xsl:with-param name="class">
+                    <xsl:text>link_odd_class</xsl:text>
+                  </xsl:with-param>
+                </xsl:call-template>
+              </xsl:for-each>
+              <xsl:text>/@</xsl:text>
+              <xsl:value-of select="ancestor::tei:attDef/@ident"/>
+              <xsl:call-template name="showSpace"/>
+            </li>
+          </xsl:for-each>
+        </ul>
+      </div>
+    </xsl:if>
+    <xsl:if test="count(key('ATTREFS-ELEMENT',$this))&gt;0">
+      <div>
+        <xsl:call-template name="i18n">
+          <xsl:with-param name="word">
+            <xsl:text>Element</xsl:text>
+          </xsl:with-param>
+        </xsl:call-template>
+        <xsl:text>: </xsl:text>
+        <ul class="attrefs-element">
+          <xsl:for-each select="key('ATTREFS-ELEMENT',$this)">
+            <xsl:sort select="ancestor::tei:elementSpec/@ident"/>
+            <xsl:sort select="@ident"/>
+            <li>
+              <xsl:for-each select="ancestor::tei:elementSpec">
+                <xsl:call-template name="linkTogether">
+                  <xsl:with-param name="name">
+                    <xsl:value-of select="@ident"/>
+                  </xsl:with-param>
+                  <xsl:with-param name="class">
+                    <xsl:text>link_odd_element</xsl:text>
+                  </xsl:with-param>
+                </xsl:call-template>
+              </xsl:for-each>
+              <xsl:text>/@</xsl:text>
+	      <xsl:for-each select="ancestor::tei:attDef">
+		<xsl:value-of select="(tei:altIdent|@ident)[last()]"/>
+	      </xsl:for-each>
+              <xsl:call-template name="showSpace"/>
+            </li>
+          </xsl:for-each>
+        </ul>
+      </div>
+    </xsl:if>
+  </xsl:template>
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/odds2/guidelines.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/odds2/build-to.xml
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/odds2/build-to.xml	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/odds2/build-to.xml	(revision 258)
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="utf-8"?>
+<project basedir="." default="dist" name="antodd">
+<!--
+	This library is free software; you can redistribute it and/or
+	modify it under the terms of the GNU Lesser General Public
+	License as published by the Free Software Foundation; either
+	version 2.1 of the License, or (at your option) any later version.
+	
+	This library 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
+	Lesser General Public License for more details.
+	
+	You should have received a copy of the GNU Lesser General Public
+	License along with this library; if not, write to the Free Software
+	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+	
+        Id: $Id: build-to.xml 9755 2011-11-15 09:07:52Z rahtz $
+        Copyright: 2011, TEI Consortium<
+-->
+  <!--
+    performs ODD processing.
+ -->
+  <!-- whether to make summary odd doc  -->
+  <property name="summaryDoc" value="false"/>
+
+  <property name="odd2oddxsl"      value="../odds2/odd2odd.xsl"/>
+  <property name="odd2litexsl"     value="../odds2/odd2lite.xsl"/>
+
+   <condition property="processODD">
+    <equals arg1="${odd}" arg2="true"/>
+  </condition>
+
+  <target name="notodd" unless="processODD">
+    <copy file="${inputFile}" tofile="${outputTempDir}/tmp2.xml" overwrite="true"/>
+  </target>
+
+  <target name="odd" if="processODD">
+    <echo>Do ODD processing </echo>
+    <xslt force="yes" style="${odd2oddxsl}" in="${inputFile}" out="${outputTempDir}/tmp1.xml" classpath="classpath">
+      <xmlcatalog>
+        <catalogpath>
+          <pathelement location="../../../../catalog.xml"/>
+          <pathelement location="../../../../../xhtml11/dtd/xhtmlcatalog.xml"/>
+        </catalogpath>
+      </xmlcatalog>
+      <factory name="net.sf.saxon.TransformerFactoryImpl"/>
+      <classpath location="${oxygenlib}/saxon9ee.jar"/>
+      <param name="lang" expression="${lang}" if="lang"/>
+      <param name="defaultSource" expression="${defaultSource}" if="defaultSource"/>
+      <param name="verbose" expression="${verbose}" if="verbose"/>
+    </xslt>
+    <xslt force="yes" style="${odd2litexsl}" in="${outputTempDir}/tmp1.xml" out="${outputTempDir}/tmp2.xml" classpath="classpath">
+      <factory name="net.sf.saxon.TransformerFactoryImpl"/>
+      <classpath location="${oxygenlib}/saxon9ee.jar"/>
+      <xmlcatalog>
+        <catalogpath>
+          <pathelement location="../../../../catalog.xml"/>
+          <pathelement location="../../../../../xhtml11/dtd/xhtmlcatalog.xml"/>
+        </catalogpath>
+      </xmlcatalog>
+      <param name="summaryDoc" expression="${summaryDoc}" if="summaryDoc"/>
+      <param name="displayMode" expression="rnc"/>
+    </xslt>
+  </target>
+
+</project>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/odds2/build-to.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/odds2/teiodds.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/odds2/teiodds.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/odds2/teiodds.xsl	(revision 258)
@@ -0,0 +1,2047 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet 
+    xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
+    xmlns:fo="http://www.w3.org/1999/XSL/Format" 
+    xmlns:html="http://www.w3.org/1999/xhtml" 
+    xmlns:i="http://www.iso.org/ns/1.0"
+    xmlns:rng="http://relaxng.org/ns/structure/1.0"
+    xmlns:s="http://www.ascc.net/xml/schematron" 
+    xmlns:sch="http://purl.oclc.org/dsdl/schematron" 
+    xmlns:tei="http://www.tei-c.org/ns/1.0"
+    xmlns:teix="http://www.tei-c.org/ns/Examples" 
+    xmlns:xi="http://www.w3.org/2001/XInclude"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    exclude-result-prefixes="a fo html i rng s sch tei teix xi xs xsl" 
+  version="2.0">
+  <xsl:import href="../common2/odds.xsl"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+    <desc>
+      <p> TEI stylesheet for processing TEI ODD markup </p>
+      <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+      <p>Author: See AUTHORS</p>
+      <p>Id: $Id: teiodds.xsl 9861 2011-12-02 00:05:30Z rahtz $</p>
+      <p>Copyright: 2011, TEI Consortium</p>
+    </desc>
+  </doc>
+
+  <xsl:include href="RngToRnc.xsl"/>
+  <xsl:param name="idPrefix"/>
+  <xsl:param name="oddmode">tei</xsl:param>
+  <xsl:param name="STDOUT">true</xsl:param>
+  <xsl:param name="outputSuffix">.html</xsl:param>
+  <xsl:param name="selectedSchema"/>
+  <xsl:param name="outputDir"/>
+  <xsl:param name="splitLevel">-1</xsl:param>
+  <xsl:param name="localsource"/>
+  <xsl:param name="lang"/>
+  <xsl:param name="doclang"/>
+  <xsl:param name="patternPrefix"/>
+  <xsl:param name="TEIC">false</xsl:param>
+  <xsl:param name="autoGlobal">false</xsl:param>
+  <xsl:param name="lookupDatabase">false</xsl:param>
+  <xsl:param name="verbose">false</xsl:param>
+  <xsl:param name="schemaBaseURL">http://localhost/schema/relaxng/</xsl:param>
+  <xsl:key match="tei:*" name="LOCALIDENTS" use="@ident"/>
+  <xsl:key match="tei:macroSpec" name="MACROS" use="@ident"/>
+  <xsl:key match="tei:elementSpec" name="ELEMENTS" use="@ident"/>
+  <xsl:key match="tei:elementSpec" name="ELEMENTS" use="tei:altIdent"/>
+  <xsl:key match="tei:classSpec" name="CLASSES" use="@ident"/>
+  <xsl:key match="rng:ref" name="REFS"  use="@name"/>
+  <xsl:key match="rng:ref[contains(@name,'_')]" name="REFS" use="substring-before(@name,'_')"/>
+
+  <xsl:key match="tei:elementSpec/tei:attList/tei:attDef/tei:datatype/rng:ref"
+    name="ATTREFS-ELEMENT" use="@name"/>
+  <xsl:key match="tei:classSpec/tei:attList/tei:attDef/tei:datatype/rng:ref" name="ATTREFS-CLASS"
+    use="@name"/>
+  <xsl:key match="tei:elementSpec/tei:attList/tei:attList/tei:attDef/tei:datatype/rng:ref"
+    name="ATTREFS-ELEMENT" use="@name"/>
+  <xsl:key match="tei:classSpec/tei:attList/tei:attList/tei:attDef/tei:datatype/rng:ref"
+    name="ATTREFS-CLASS" use="@name"/>
+  <xsl:key match="tei:macroSpec/tei:content//rng:ref" name="MACROREFS"  use="@name"/>
+
+  <xsl:key match="tei:elementSpec|tei:classSpec" name="CLASSMEMBERS"
+    use="tei:classes/tei:memberOf/@key"/>
+  <xsl:key match="tei:elementSpec|tei:classSpec|tei:macroSpec" name="IDENTS" use="@ident"/>
+
+  <xsl:key match="tei:macroSpec[@type='dt']" name="DATATYPES" use="1"/>
+  <xsl:key match="tei:macroSpec" name="MACRODOCS" use="1"/>
+  <xsl:key match="tei:attDef" name="ATTDOCS" use="1"/>
+  <xsl:key match="tei:attDef" name="ATTRIBUTES" use="@ident"/>
+  <xsl:key match="tei:classSpec//tei:attDef" name="ATTRIBUTES-CLASS" use="@ident"/>
+  <xsl:key match="tei:elementSpec//tei:attDef" name="ATTRIBUTES-ELEMENT" use="@ident"/>
+  <xsl:key match="tei:schemaSpec" name="SCHEMASPECS" use="1"/>
+  <xsl:key match="tei:schemaSpec" name="LISTSCHEMASPECS" use="@ident"/>
+  <xsl:key match="tei:classSpec[@type='atts']" name="ATTCLASSDOCS" use="1"/>
+  <xsl:key match="tei:classSpec[@type='model']" name="MODELCLASSDOCS" use="1"/>
+  <xsl:key match="tei:elementSpec" name="ELEMENTDOCS" use="1"/>
+  <xsl:key match="tei:*" name="NameToID" use="@ident"/>
+  <xsl:key match="tei:elementSpec" name="ElementModule" use="@module"/>
+  <xsl:key match="tei:classSpec" name="ClassModule" use="@module"/>
+  <xsl:key match="tei:macroSpec" name="MacroModule" use="@module"/>
+  <xsl:key match="tei:moduleSpec" name="Modules" use="1"/>
+  <xsl:key match="tei:moduleSpec" name="MODULES" use="@ident"/>
+  <xsl:key match="tei:classSpec[@predeclare='true']" name="predeclaredClasses" use="1"/>
+  <xsl:key match="tei:macroSpec[@predeclare='true']" name="PredeclareMacros" use="@ident"/>
+  <xsl:key match="tei:macroSpec[@predeclare='true']" name="PredeclareMacrosModule" use="@module"/>
+  <xsl:key match="tei:macroSpec[@predeclare='true']" name="PredeclareAllMacros" use="1"/>
+  <xsl:variable name="parameterize">
+    <xsl:choose>
+      <xsl:when test="key('SCHEMASPECS',1)">false</xsl:when>
+      <xsl:otherwise>true</xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+  <xsl:variable name="whichSchemaSpec">
+    <xsl:choose>
+      <xsl:when test="$selectedSchema">
+        <xsl:value-of select="$selectedSchema"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="key('SCHEMASPECS',1)[1]/@ident"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <!-- lookup table of element contents, and templates to access the result -->
+  <xsl:key match="Contains" name="ELEMENTPARENTS" use="."/>
+
+  <xsl:variable name="generalPrefix">
+    <xsl:choose>
+      <xsl:when test="string-length($patternPrefix)&gt;0">
+        <xsl:value-of select="$patternPrefix"/>
+      </xsl:when>
+      <xsl:when test="key('LISTSCHEMASPECS',$whichSchemaSpec)[@prefix]">
+        <xsl:value-of select="key('LISTSCHEMASPECS',$whichSchemaSpec)/@prefix"/>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:variable name="targetLanguage">
+    <xsl:choose>
+      <xsl:when test="string-length($lang)&gt;0">
+        <xsl:value-of select="$lang"/>
+      </xsl:when>
+      <xsl:when test="key('LISTSCHEMASPECS',$whichSchemaSpec)[@targetLang]">
+        <xsl:value-of select="key('LISTSCHEMASPECS',$whichSchemaSpec)/@targetLang"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:text>en</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+
+  <xsl:template name="generateDoc">
+    <xsl:choose>
+      <xsl:when test="string-length($doclang)&gt;0">
+        <xsl:value-of select="$doclang"/>
+      </xsl:when>
+      <xsl:when test="key('LISTSCHEMASPECS',$whichSchemaSpec)/@docLang">
+        <xsl:value-of select="key('LISTSCHEMASPECS',$whichSchemaSpec)/@docLang"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:text>en</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+
+  <xsl:template match="processing-instruction()">
+    <xsl:choose>
+      <xsl:when test="name(.) = 'odds'">
+	<xsl:choose>
+	  <xsl:when test=".='date'"> This formatted version of the Guidelines was created on
+	  <xsl:call-template name="showDate"/>. </xsl:when>
+	</xsl:choose>
+      </xsl:when>
+      <xsl:otherwise>
+	<xsl:copy-of select="."/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="*" mode="literal">
+    <xsl:text>&#10;</xsl:text>
+    <xsl:for-each select="ancestor::rng:*">
+      <xsl:text> </xsl:text>
+    </xsl:for-each>
+    <xsl:text>&lt;</xsl:text>
+    <xsl:value-of select="local-name(.)"/>
+    <xsl:for-each select="@*">
+      <xsl:text> </xsl:text>
+      <xsl:value-of select="local-name(.)"/>="<xsl:value-of select="."/>"</xsl:for-each>
+    <xsl:choose>
+      <xsl:when test="child::node()">
+        <xsl:text>&gt;</xsl:text>
+        <xsl:apply-templates mode="literal"/>
+        <xsl:if test="node()[last()]/self::rng:*">
+          <xsl:text>&#10;</xsl:text>
+        </xsl:if>
+        <xsl:for-each select="ancestor::rng:*">
+          <xsl:text> </xsl:text>
+        </xsl:for-each>
+        <xsl:text>&lt;/</xsl:text>
+        <xsl:value-of select="local-name(.)"/>
+        <xsl:text>&gt;</xsl:text>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:text>/&gt;</xsl:text>
+        <xsl:if test="node()[last()]/self::rng:*">
+          <xsl:text>&#10;	  </xsl:text>
+        </xsl:if>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="rng:ref">
+    <xsl:call-template name="makeRef">
+      <xsl:with-param name="lookup" select="replace(@name,'_(alternation|sequenceOptionalRepeatable|sequenceOptional|sequenceRepeatable|sequence)','')"/>
+    </xsl:call-template>
+  </xsl:template>
+
+    <xsl:template name="makeRef">
+      <xsl:param name="lookup"/>
+      <xsl:variable name="fullname" select="@name"/>
+      <xsl:variable name="myprefix"
+		    select="ancestor::*[@prefix][1]/@prefix"/>
+      <xsl:choose>
+	<xsl:when test="ancestor::tei:content[@autoPrefix='false']">
+	  <ref xmlns="http://relaxng.org/ns/structure/1.0" name="{$fullname}"/>
+	</xsl:when>
+	<xsl:when test="count(key('IDENTS',$lookup))&gt;1">
+	  <ref xmlns="http://relaxng.org/ns/structure/1.0" name="{$myprefix}{$fullname}"/>
+	</xsl:when>
+	<xsl:when test="key('IDENTS',$lookup)">
+	  <xsl:for-each select="key('IDENTS',$lookup)">
+	    <xsl:variable name="localprefix">
+	      <xsl:choose>
+		<xsl:when test="@prefix">
+		<xsl:value-of select="@prefix"/>
+	      </xsl:when>
+	      <xsl:otherwise>
+		<xsl:value-of select="$generalPrefix"/>
+	      </xsl:otherwise>
+	      </xsl:choose>
+	    </xsl:variable>
+	    <ref xmlns="http://relaxng.org/ns/structure/1.0" name="{$localprefix}{$fullname}"/>
+	  </xsl:for-each>
+	</xsl:when>
+	<xsl:otherwise>
+	  <ref xmlns="http://relaxng.org/ns/structure/1.0" name="{@name}"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+
+  <xsl:template match="rng:*">
+    <xsl:element name="{local-name()}" xmlns="http://relaxng.org/ns/structure/1.0" >
+      <xsl:copy-of select="@*"/>
+      <xsl:apply-templates select="rng:*|tei:*|text()|comment()"/>
+    </xsl:element>
+  </xsl:template>
+
+
+  <xsl:template match="rng:zeroOrMore">
+    <xsl:choose>
+      <xsl:when
+        test="rng:ref/@name='model.global'   and preceding-sibling::rng:*[1][self::rng:zeroOrMore/rng:ref/@name='model.global']"/>
+      <xsl:when test="count(rng:*)=1 and rng:zeroOrMore">
+        <xsl:apply-templates select="rng:*|tei:*|text()|comment()"/>
+      </xsl:when>
+      <xsl:otherwise>
+	<zeroOrMore xmlns="http://relaxng.org/ns/structure/1.0" >
+          <xsl:copy-of select="@*"/>
+          <xsl:apply-templates select="rng:*|tei:*|text()|comment()"/>
+	</zeroOrMore>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+
+  <xsl:template match="rng:choice">
+    <xsl:choose>
+      <xsl:when test="count(rng:*)=1">
+        <xsl:apply-templates select="a:*|rng:*|tei:*|text()|comment()"/>
+      </xsl:when>
+      <xsl:otherwise>
+	<choice xmlns="http://relaxng.org/ns/structure/1.0">
+          <xsl:copy-of select="@*"/>
+          <xsl:apply-templates select="a:*|rng:*|tei:*|text()|comment()"/>
+	</choice>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+
+  <xsl:template match="rng:group">
+    <!-- check if this group is identical to the last -->
+    <xsl:choose>
+      <xsl:when
+        test="count(rng:*)=1 and local-name(preceding-sibling::rng:*[1])='group' and rng:zeroOrMore">
+        <xsl:variable name="that">
+          <xsl:for-each select="preceding-sibling::rng:*[1]">
+            <xsl:apply-templates mode="decomposed"/>
+          </xsl:for-each>
+        </xsl:variable>
+        <xsl:variable name="this">
+          <xsl:apply-templates mode="decomposed"/>
+        </xsl:variable>
+        <xsl:choose>
+          <xsl:when test="$that=$this"/>
+	  <xsl:otherwise>
+	    <group xmlns="http://relaxng.org/ns/structure/1.0">
+              <xsl:copy-of select="@*"/>
+              <xsl:apply-templates select="rng:*|tei:*|text()|comment()"/>
+	    </group>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+      <xsl:otherwise>
+	<xsl:element name="{local-name()}" xmlns="http://relaxng.org/ns/structure/1.0" >
+          <xsl:copy-of select="@*"/>
+          <xsl:apply-templates select="rng:*|tei:*|text()|comment()"/>
+	</xsl:element>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+
+  <xsl:template match="rng:*" mode="decomposed">
+    <xsl:value-of select="local-name(.)"/>
+    <xsl:for-each select="@*">
+      <xsl:text>@</xsl:text>
+      <xsl:value-of select="."/>
+    </xsl:for-each>
+    <xsl:apply-templates mode="decomposed"/>
+  </xsl:template>
+
+
+  <xsl:template match="tei:*" mode="tangle"/>
+
+  <xsl:template match="tei:attRef" mode="tangle">
+    <xsl:call-template name="makeRef">
+      <xsl:with-param name="lookup" select="substring-before(@name,'.attribute')"/>
+    </xsl:call-template>
+  </xsl:template>
+
+  <xsl:template match="tei:attDef" mode="tangle">
+    <xsl:param name="element"/>
+    <xsl:variable name="I">
+      <xsl:value-of select="translate(@ident,':','')"/>
+    </xsl:variable>
+    <xsl:if test="not(starts-with(@ident,'xmlns'))">
+      <xsl:choose>
+        <xsl:when test="ancestor::tei:elementSpec">
+          <xsl:call-template name="makeAnAttribute"/>
+        </xsl:when>
+        <xsl:when test="ancestor::tei:classSpec">
+          <define xmlns="http://relaxng.org/ns/structure/1.0"
+            name="{$element}.attribute.{translate(@ident,':','')}">
+            <xsl:call-template name="makeAnAttribute"/>
+          </define>
+        </xsl:when>
+      </xsl:choose>
+    </xsl:if>
+    <xsl:apply-templates select="tei:constraintSpec"/>
+
+  </xsl:template>
+
+  <xsl:template match="tei:attList" mode="tangle">
+    <xsl:param name="element"/>
+    <xsl:choose>
+      <xsl:when test="count(*)=0"/>
+      <xsl:when test="@org='group' and         parent::tei:attList[@org='choice']">
+        <group xmlns="http://relaxng.org/ns/structure/1.0">
+          <xsl:apply-templates mode="tangle" select="tei:*">
+            <xsl:with-param name="element" select="$element"/>
+          </xsl:apply-templates>
+        </group>
+      </xsl:when>
+
+      <xsl:when test="@org='choice'">
+        <choice xmlns="http://relaxng.org/ns/structure/1.0">
+          <xsl:apply-templates mode="tangle" select="tei:*">
+            <xsl:with-param name="element" select="$element"/>
+          </xsl:apply-templates>
+        </choice>
+      </xsl:when>
+
+      <xsl:otherwise>
+        <xsl:apply-templates mode="tangle" select="tei:*">
+          <xsl:with-param name="element" select="$element"/>
+        </xsl:apply-templates>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+
+  <xsl:template match="tei:classSpec" mode="tangle">
+    <xsl:variable name="c">
+      <xsl:choose>
+	<xsl:when test="@prefix">
+	  <xsl:value-of select="@prefix"/>
+	</xsl:when>
+	<xsl:otherwise>
+	  <xsl:value-of select="$generalPrefix"/>
+	</xsl:otherwise>
+      </xsl:choose>
+      <xsl:value-of select="@ident"/>
+    </xsl:variable>
+
+    <xsl:if test="$verbose='true'">
+      <xsl:message> classSpec <xsl:value-of select="@ident"/> (type <xsl:value-of select="@type"
+        />)</xsl:message>
+    </xsl:if>
+    <xsl:choose>
+      <xsl:when test="@type='model'">
+        <xsl:apply-templates mode="processModel" select=".">
+          <xsl:with-param name="declare">false</xsl:with-param>
+          <!--	    <xsl:choose>
+	      <xsl:when test="@module='tei'">true</xsl:when>
+	      <xsl:otherwise>false</xsl:otherwise>
+	    </xsl:choose>
+	  </xsl:with-param>
+-->
+        </xsl:apply-templates>
+      </xsl:when>
+      <xsl:when test="@type='atts'">
+        <xsl:call-template name="bitOut">
+          <xsl:with-param name="grammar">true</xsl:with-param>
+          <xsl:with-param name="content">
+            <Wrapper>
+              <xsl:variable name="contents">
+                <ROOT>
+                  <xsl:for-each select="tei:classes/tei:memberOf">
+                    <xsl:for-each select="key('IDENTS',@key)[1]">
+                      <xsl:if test="@type='atts'">
+                        <ref  xmlns="http://relaxng.org/ns/structure/1.0">
+			  <xsl:attribute name="name">
+			    <xsl:choose>
+			      <xsl:when test="@prefix">
+				<xsl:value-of select="@prefix"/>
+			      </xsl:when>
+			      <xsl:otherwise>
+				<xsl:value-of select="$generalPrefix"/>
+			      </xsl:otherwise>
+			    </xsl:choose>
+			    <xsl:value-of select="@ident"/>
+			    <xsl:text>.attributes</xsl:text>
+			  </xsl:attribute>
+			</ref>
+                      </xsl:if>
+                    </xsl:for-each>
+                  </xsl:for-each>
+                  <xsl:for-each select="tei:attList//tei:attDef">
+                    <xsl:if test="not(starts-with(@ident,'xmlns'))">
+                      <ref xmlns="http://relaxng.org/ns/structure/1.0"
+                        name="{$c}.attribute.{translate(@ident,':','')}"/>
+                    </xsl:if>
+                  </xsl:for-each>
+                  <xsl:for-each select="tei:attList//tei:attRef">
+		    <xsl:call-template name="makeRef">
+		      <xsl:with-param name="lookup" select="substring-before(@name,'.attribute')"/>
+		    </xsl:call-template>
+                  </xsl:for-each>
+                </ROOT>
+              </xsl:variable>
+              <define xmlns="http://relaxng.org/ns/structure/1.0"
+		      name="{$c}.attributes">
+		<xsl:for-each select="$contents/ROOT">
+		  <xsl:apply-templates mode="justcopy"/>
+		  <xsl:if test="not($contents/ROOT/*)">
+		    <empty/>
+		  </xsl:if>
+		</xsl:for-each>
+              </define>
+              <xsl:apply-templates mode="tangle" select="tei:attList//tei:attDef">
+                <xsl:with-param name="element" select="$c"/>
+              </xsl:apply-templates>
+            </Wrapper>
+          </xsl:with-param>
+        </xsl:call-template>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="tei:classSpec" mode="processModel">
+    <xsl:param name="declare">false</xsl:param>
+    <xsl:if test="$verbose='true'">
+      <xsl:message> .... model class <xsl:value-of select="@ident"/>
+      </xsl:message>
+    </xsl:if>
+    <xsl:call-template name="bitOut">
+      <xsl:with-param name="grammar">true</xsl:with-param>
+      <xsl:with-param name="content">
+        <Wrapper>
+          <xsl:call-template name="processClassDefinition">
+            <xsl:with-param name="type">
+              <xsl:choose>
+                <xsl:when test="@generate">
+                  <xsl:value-of select="@generate"/>
+                </xsl:when>
+                <xsl:otherwise>
+                  <xsl:text>&#10;			     NULL
+			     alternation
+			     sequence
+			     sequenceOptional
+			     sequenceOptionalRepeatable
+			   sequenceRepeatable</xsl:text>
+                </xsl:otherwise>
+              </xsl:choose>
+            </xsl:with-param>
+            <xsl:with-param name="declare" select="$declare"/>
+          </xsl:call-template>
+        </Wrapper>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+
+
+  <xsl:template name="processClassDefinition">
+    <xsl:param name="type"/>
+    <xsl:param name="declare"/>
+    <xsl:variable name="Type">
+      <xsl:value-of select="normalize-space($type)"/>
+    </xsl:variable>
+    <xsl:choose>
+      <xsl:when test="string-length($Type)=0">
+        <xsl:call-template name="makeClassDefinition">
+          <xsl:with-param name="type">NULL</xsl:with-param>
+          <xsl:with-param name="declare" select="$declare"/>
+        </xsl:call-template>
+      </xsl:when>
+
+      <xsl:when test="contains($Type,' ')">
+        <xsl:call-template name="makeClassDefinition">
+          <xsl:with-param name="type" select="substring-before($Type,' ')"/>
+          <xsl:with-param name="declare" select="$declare"/>
+        </xsl:call-template>
+        <xsl:call-template name="processClassDefinition">
+          <xsl:with-param name="type" select="substring-after($Type,' ')"/>
+          <xsl:with-param name="declare" select="$declare"/>
+        </xsl:call-template>
+      </xsl:when>
+
+      <xsl:otherwise>
+        <xsl:call-template name="makeClassDefinition">
+          <xsl:with-param name="type" select="$Type"/>
+          <xsl:with-param name="declare" select="$declare"/>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+
+  <xsl:template name="makeClassDefinition">
+    <xsl:param name="type"/>
+    <xsl:param name="declare"/>
+    <!--
+      alternation
+      sequence
+      sequenceOptional
+      sequenceOptionalRepeatable
+      sequenceRepeatable
+  -->
+
+    <xsl:variable name="thisClass">
+      <xsl:value-of select="@ident"/>
+    </xsl:variable>
+    <xsl:variable name="localprefix">
+      <xsl:choose>
+	<xsl:when test="@prefix">
+	  <xsl:value-of select="@prefix"/>
+	</xsl:when>
+	<xsl:otherwise>
+	  <xsl:value-of select="$generalPrefix"/>
+	</xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+
+    <xsl:variable name="suffix">
+      <xsl:choose>
+        <xsl:when test="$type='NULL'"> </xsl:when>
+        <xsl:otherwise>
+          <xsl:text>_</xsl:text>
+          <xsl:value-of select="$type"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+
+    <xsl:choose>
+      <xsl:when test="$declare='true'">
+        <xsl:apply-templates mode="tangleModel" select="tei:classes/tei:memberOf"/>
+        <define xmlns="http://relaxng.org/ns/structure/1.0"
+          name="{$localprefix}{$thisClass}{$suffix}">
+          <xsl:if test="@predeclare='true'">
+            <xsl:attribute name="combine">choice</xsl:attribute>
+          </xsl:if>
+          <notAllowed/>
+        </define>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:variable name="makeDecls">
+          <xsl:call-template name="findUses">
+            <xsl:with-param name="pattern" select="$type"/>
+            <xsl:with-param name="class" select="$thisClass"/>
+          </xsl:call-template>
+        </xsl:variable>
+
+        <!--<xsl:message>
+
+DEBUG <xsl:value-of select="$thisClass"/><xsl:value-of
+select="$suffix"/> generated <xsl:value-of
+select="$makeDecls"/></xsl:message>
+-->
+        <xsl:choose>
+          <!--
+               <xsl:when test="$makeDecls=''">
+                  <xsl:if test="$verbose='true'">
+                     <xsl:message>Do NOT generate <xsl:value-of select="$thisClass"/>
+                        <xsl:value-of select="$suffix"/> (<xsl:value-of select="$type"/>)                     </xsl:message>
+                  </xsl:if>
+               </xsl:when>
+-->
+          <xsl:when test="count(key('CLASSMEMBERS',$thisClass))&gt;0">
+            <xsl:if test="$verbose='true'">
+              <xsl:message> .... ... generate model <xsl:value-of select="$thisClass"/>
+                <xsl:value-of select="$suffix"/> (<xsl:value-of select="$type"/>) </xsl:message>
+            </xsl:if>
+            <define xmlns="http://relaxng.org/ns/structure/1.0"
+              name="{$localprefix}{$thisClass}{$suffix}">
+              <xsl:choose>
+                <xsl:when test="$type='sequence'">
+                  <xsl:for-each select="key('CLASSMEMBERS',$thisClass)">
+                    <xsl:apply-templates select="."
+					 mode="classmember">
+                      <xsl:with-param name="theClass" select="$thisClass"/>
+                      <xsl:with-param name="suffix" select="$type"/>
+                    </xsl:apply-templates>
+                  </xsl:for-each>
+                </xsl:when>
+                <xsl:when test="$type='sequenceOptional'">
+                  <xsl:for-each select="key('CLASSMEMBERS',$thisClass)">
+                    <optional>
+                      <xsl:apply-templates select="."  mode="classmember">
+			<xsl:with-param name="theClass" select="$thisClass"/>
+                        <xsl:with-param name="suffix" select="$type"/>
+                      </xsl:apply-templates>
+                    </optional>
+                  </xsl:for-each>
+                </xsl:when>
+
+                <xsl:when test="$type='sequenceRepeatable'">
+                  <xsl:for-each select="key('CLASSMEMBERS',$thisClass)">
+                    <oneOrMore>
+                      <xsl:apply-templates select="."  mode="classmember">
+			<xsl:with-param name="theClass" select="$thisClass"/>		   
+                        <xsl:with-param name="suffix" select="$type"/>
+                      </xsl:apply-templates>
+                    </oneOrMore>
+                  </xsl:for-each>
+                </xsl:when>
+
+                <xsl:when test="$type='sequenceOptionalRepeatable'">
+                  <xsl:for-each select="key('CLASSMEMBERS',$thisClass)">
+                    <zeroOrMore>
+                      <xsl:apply-templates select="." mode="classmember">
+                        <xsl:with-param name="suffix" select="$type"/>
+			<xsl:with-param name="theClass" select="$thisClass"/>
+                      </xsl:apply-templates>
+                    </zeroOrMore>
+                  </xsl:for-each>
+                </xsl:when>
+
+                <xsl:otherwise>
+                  <choice>
+                    <xsl:for-each select="key('CLASSMEMBERS',$thisClass)">
+                      <xsl:apply-templates select="." mode="classmember">
+                        <xsl:with-param name="suffix" select="$type"/>
+			<xsl:with-param name="theClass" select="$thisClass"/>
+                      </xsl:apply-templates>
+                    </xsl:for-each>
+                  </choice>
+                </xsl:otherwise>
+              </xsl:choose>
+            </define>
+          </xsl:when>
+          <xsl:otherwise>
+            <define xmlns="http://relaxng.org/ns/structure/1.0"
+              name="{$localprefix}{$thisClass}{$suffix}">
+              <xsl:choose>
+                <xsl:when
+                  test="$type='sequence' or     $type='sequenceOptional' or      $type='sequenceOptionalRepeatable'">
+                  <empty/>
+                </xsl:when>
+                <xsl:otherwise>
+                  <notAllowed/>
+                </xsl:otherwise>
+              </xsl:choose>
+            </define>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+
+
+  <xsl:template name="findUses">
+    <xsl:param name="pattern"/>
+    <xsl:param name="class"/>
+    <xsl:variable name="suffix">
+      <xsl:choose>
+        <xsl:when test="$pattern='NULL'"/>
+        <xsl:otherwise>
+          <xsl:text>_</xsl:text>
+          <xsl:value-of select="$pattern"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+
+    <xsl:choose>
+      <xsl:when test="not(ancestor::tei:schemaSpec)">x</xsl:when>
+      <xsl:when test="key('REFS',concat($class,$suffix))">x</xsl:when>
+      <xsl:when test="key('REFS',$class)">x</xsl:when>
+      <xsl:when test="not($suffix='')"/>
+      <xsl:when test="tei:classes/tei:memberOf">
+        <xsl:for-each select="tei:classes/tei:memberOf">
+          <xsl:for-each select="key('CLASSES',@key)">
+            <xsl:call-template name="findUses">
+              <xsl:with-param name="pattern"/>
+              <xsl:with-param name="class" select="@ident"/>
+            </xsl:call-template>
+          </xsl:for-each>
+        </xsl:for-each>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:template>
+
+
+  <xsl:template match="tei:classSpec" mode="tangleadd">
+    <xsl:apply-templates mode="tangleadd"/>
+  </xsl:template>
+
+
+  <xsl:template match="tei:classSpec/@ident"/>
+
+
+  <xsl:template match="tei:code">
+    <xsl:call-template name="typewriter">
+      <xsl:with-param name="text">
+        <xsl:apply-templates/>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+
+  <xsl:template match="text()" mode="doc">
+    <xsl:value-of select="."/>
+  </xsl:template>
+
+  <xsl:template match="tei:desc" mode="tangle"/>
+
+  <xsl:template match="tei:classSpec" mode="classmember">
+    <xsl:param name="suffix"/>
+    <xsl:variable name="localprefix">
+      <xsl:choose>
+	<xsl:when test="@prefix">
+	  <xsl:value-of select="@prefix"/>
+	</xsl:when>
+	<xsl:otherwise>
+	  <xsl:value-of select="$generalPrefix"/>
+	</xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+
+    <xsl:choose>
+      <xsl:when test="$suffix='' or $suffix='NULL'">
+        <ref xmlns="http://relaxng.org/ns/structure/1.0" name="{$localprefix}{@ident}"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <ref xmlns="http://relaxng.org/ns/structure/1.0"
+	     name="{$localprefix}{@ident}_{$suffix}"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="tei:elementSpec" mode="classmember">
+    <xsl:param name="theClass"/>
+
+    <xsl:variable name="min" select="tei:classes/tei:memberOf[@key=$theClass]/@min"/>
+    <xsl:variable name="max" select="tei:classes/tei:memberOf[@key=$theClass]/@max"/>
+
+    <xsl:variable name="mini" as="xs:integer">
+      <xsl:choose>
+        <xsl:when test="not($min castable as xs:integer)">1</xsl:when>
+        <xsl:otherwise><xsl:value-of select="$min"/></xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:variable name="elementPrefix">
+      <xsl:choose>
+        <xsl:when test="@prefix">
+          <xsl:value-of select="@prefix"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="$generalPrefix"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:variable name="ident" select="@ident"/>
+    
+    <xsl:for-each select="for $i in 1 to $mini return $i">
+      <ref xmlns="http://relaxng.org/ns/structure/1.0" name="{$elementPrefix}{$ident}"/>
+    </xsl:for-each> 
+    <xsl:choose>
+      <xsl:when test="$max='unbounded'">
+        <zeroOrMore xmlns="http://relaxng.org/ns/structure/1.0">
+          <ref xmlns="http://relaxng.org/ns/structure/1.0" name="{$elementPrefix}{$ident}"/>
+        </zeroOrMore>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:variable name="maxi" as="xs:integer">
+          <xsl:choose>
+            <xsl:when test="not($max castable as xs:integer)">1</xsl:when>
+            <xsl:otherwise><xsl:value-of select="$max"/></xsl:otherwise>
+          </xsl:choose>
+        </xsl:variable>
+        <xsl:for-each select="for $i in ($mini+1) to $maxi return $i">
+          <optional xmlns="http://relaxng.org/ns/structure/1.0">
+            <ref xmlns="http://relaxng.org/ns/structure/1.0" name="{$elementPrefix}{$ident}"/>
+          </optional>
+        </xsl:for-each>
+      </xsl:otherwise>
+    </xsl:choose> 
+  </xsl:template>
+
+  <xsl:template match="tei:elementSpec" mode="tangle">
+    <xsl:variable name="elementPrefix">
+      <xsl:choose>
+        <xsl:when test="@prefix">
+          <xsl:value-of select="@prefix"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="$generalPrefix"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:if test="$verbose='true'">
+      <xsl:message> elementSpec [<xsl:value-of select="$elementPrefix"/>]<xsl:value-of select="@ident"/>
+        <xsl:if test="@xml:id">: <xsl:value-of select="@xml:id"/>
+        </xsl:if>
+      </xsl:message>
+    </xsl:if>
+    <xsl:call-template name="bitOut">
+      <xsl:with-param name="grammar"/>
+      <xsl:with-param name="content">
+        <Wrapper>
+          <xsl:variable name="name">
+            <xsl:choose>
+              <xsl:when test="tei:altIdent=@ident">
+                <xsl:value-of select="@ident"/>
+              </xsl:when>
+              <xsl:when test="tei:altIdent">
+                <xsl:value-of select="normalize-space(tei:altIdent)"/>
+              </xsl:when>
+              <xsl:otherwise>
+                <xsl:value-of select="@ident"/>
+              </xsl:otherwise>
+            </xsl:choose>
+          </xsl:variable>
+          <xsl:choose>
+            <xsl:when test="tei:content/rng:notAllowed">
+              <define xmlns="http://relaxng.org/ns/structure/1.0" name="{$elementPrefix}{@ident}">
+                <notAllowed/>
+              </define>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:variable name="Attributes">
+                <xsl:call-template name="summarizeAttributes"/>
+              </xsl:variable>
+              <define xmlns="http://relaxng.org/ns/structure/1.0" name="{$elementPrefix}{@ident}">
+                <element name="{$name}">
+                  <xsl:if test="@ns">
+                    <xsl:attribute name="ns">
+                      <xsl:value-of select="@ns"/>
+                    </xsl:attribute>
+                  </xsl:if>
+                  <xsl:if test="not($oddmode='tei')">
+                    <a:documentation>
+                      <xsl:call-template name="makeDescription">
+                        <xsl:with-param name="includeValList">true</xsl:with-param>
+                        <xsl:with-param name="coded">false</xsl:with-param>
+                      </xsl:call-template>
+                    </a:documentation>
+                  </xsl:if>
+                  <xsl:choose>
+                    <xsl:when test="$parameterize='true'">
+                      <ref name="{$elementPrefix}{@ident}.content"/>
+                      <xsl:if test="not($Attributes='')">
+			<xsl:if test="$verbose='true'">
+			  <xsl:message>   refer to attributes: </xsl:message>
+			</xsl:if>
+                        <ref name="{$elementPrefix}{@ident}.localattributes"/>
+                      </xsl:if>
+		    </xsl:when>
+		    <xsl:otherwise>
+                      <xsl:call-template name="defineContent"/>
+                      <xsl:if test="not($Attributes='')">
+			<xsl:call-template name="defineAttributes"/>
+                      </xsl:if>
+                    </xsl:otherwise>
+                  </xsl:choose>
+                  <!--
+		  <xsl:if test="@ident='TEI' or @ident='teiCorpus'">
+		    <optional>
+		      <attribute name="schemaLocation"
+				     ns="http://www.w3.org/2001/XMLSchema-instance">
+			<text/>
+		      </attribute>
+		    </optional>
+		  </xsl:if>
+-->
+                </element>
+              </define>
+              <xsl:if test="$parameterize='true'">
+                <define xmlns="http://relaxng.org/ns/structure/1.0"
+                  name="{$elementPrefix}{@ident}.content">
+                  <xsl:call-template name="defineContent"/>
+                </define>
+                <xsl:if test="not($Attributes='')">
+                  <define xmlns="http://relaxng.org/ns/structure/1.0"
+                    name="{$elementPrefix}{@ident}.localattributes">
+                    <xsl:call-template name="defineAttributes"/>
+                  </define>
+                </xsl:if>
+                <xsl:apply-templates mode="tangleModel" select="tei:classes/tei:memberOf"/>
+              </xsl:if>
+            </xsl:otherwise>
+          </xsl:choose>
+        </Wrapper>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+
+  <xsl:template name="summarizeAttributes">
+    <xsl:for-each select=".//tei:attDef">x</xsl:for-each>
+    <xsl:for-each select="tei:classes/tei:memberOf">
+      <xsl:for-each select="key('CLASSES',@key)">
+        <xsl:if test="@type='atts'">x</xsl:if>
+      </xsl:for-each>
+    </xsl:for-each>
+  </xsl:template>
+
+  <xsl:template name="defineAttributes">
+    <xsl:variable name="name">
+      <xsl:choose>
+	<xsl:when test="@prefix">
+	  <xsl:value-of select="@prefix"/>
+	</xsl:when>
+	<xsl:otherwise>
+	  <xsl:value-of select="$generalPrefix"/>
+	</xsl:otherwise>
+      </xsl:choose>
+      <xsl:value-of select="@ident"/>
+    </xsl:variable>
+    <xsl:if test="$verbose='true'">
+      <xsl:message>   now define attributes for <xsl:value-of
+      select="@ident"/> (parameterize=<xsl:value-of select="$parameterize"/>)</xsl:message>
+    </xsl:if>
+    <xsl:if test="$parameterize='true'">
+      <xsl:if test="$autoGlobal='true'">
+        <ref xmlns="http://relaxng.org/ns/structure/1.0" name="att.global.attributes"/>
+      </xsl:if>
+      <xsl:for-each select="tei:classes/tei:memberOf">
+        <xsl:for-each select="key('CLASSES',@key)">
+          <xsl:if test="@type='atts'">
+            <ref xmlns="http://relaxng.org/ns/structure/1.0">
+	      <xsl:attribute name="name">
+		<xsl:choose>
+		  <xsl:when test="@prefix">
+		    <xsl:value-of select="@prefix"/>
+		  </xsl:when>
+		  <xsl:otherwise>
+		    <xsl:value-of select="$generalPrefix"/>
+		  </xsl:otherwise>
+		</xsl:choose>
+		<xsl:value-of select="@ident"/>
+		<xsl:text>.attributes</xsl:text>
+	      </xsl:attribute>
+	    </ref>
+          </xsl:if>
+        </xsl:for-each>
+      </xsl:for-each>
+    </xsl:if>
+    <xsl:apply-templates mode="tangle" select="tei:attList">
+      <xsl:with-param name="element">
+	<xsl:value-of select="$name"/>
+      </xsl:with-param>
+    </xsl:apply-templates>
+    <!-- place holder to make sure something gets into the
+	 pattern -->
+    <empty xmlns="http://relaxng.org/ns/structure/1.0"/>
+  </xsl:template>
+
+  <xsl:template name="defineContent">
+    <xsl:variable name="Contents">
+      <TEMPTREE>
+        <xsl:choose>
+          <xsl:when test="tei:valList[@type='closed' and @repeatable='true']">
+            <list xmlns="http://relaxng.org/ns/structure/1.0">
+              <oneOrMore>
+                <choice>
+                  <xsl:call-template name="valListChildren"/>
+                </choice>
+              </oneOrMore>
+            </list>
+          </xsl:when>
+          <xsl:when test="tei:valList[@type='closed']">
+            <xsl:call-template name="valListChildren"/>
+          </xsl:when>
+          <xsl:when test="tei:content">
+            <xsl:apply-templates select="tei:content/*|tei:content/processing-instruction()"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <empty xmlns="http://relaxng.org/ns/structure/1.0"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </TEMPTREE>
+    </xsl:variable>
+    <xsl:choose>
+      <xsl:when test="count($Contents/TEMPTREE/*)=0">
+        <empty xmlns="http://relaxng.org/ns/structure/1.0"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:for-each select="$Contents/TEMPTREE">
+          <xsl:apply-templates mode="justcopy"/>
+        </xsl:for-each>
+      </xsl:otherwise>
+    </xsl:choose>
+    <xsl:apply-templates select="tei:constraintSpec"/>
+
+  </xsl:template>
+
+
+  <xsl:template name="valListChildren">
+    <choice xmlns="http://relaxng.org/ns/structure/1.0">
+      <xsl:for-each select="tei:valList/tei:valItem">
+        <value>
+          <xsl:choose>
+            <xsl:when test="tei:altIdent=@ident">
+              <xsl:value-of select="@ident"/>
+            </xsl:when>
+            <xsl:when test="tei:altIdent">
+              <xsl:value-of select="normalize-space(tei:altIdent)"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:value-of select="@ident"/>
+            </xsl:otherwise>
+          </xsl:choose>
+        </value>
+        <xsl:if test="not($oddmode='tei')">
+          <a:documentation>
+            <xsl:call-template name="makeDescription">
+              <xsl:with-param name="includeValList">true</xsl:with-param>
+              <xsl:with-param name="coded">false</xsl:with-param>
+            </xsl:call-template>
+          </a:documentation>
+        </xsl:if>
+      </xsl:for-each>
+    </choice>
+  </xsl:template>
+
+
+  <xsl:template match="tei:elementSpec/@ident"/>
+
+  <xsl:template match="tei:elementSpec/tei:desc"/>
+
+  <xsl:template match="tei:classSpec/tei:desc"/>
+
+  <xsl:template match="tei:macroSpec/tei:desc"/>
+
+  <xsl:template match="tei:elementSpec/tei:gloss"/>
+
+  <xsl:template match="tei:classSpec/tei:gloss"/>
+
+  <xsl:template match="tei:macroSpec/tei:gloss"/>
+
+
+  <xsl:template match="tei:index">
+      <xsl:call-template name="makeAnchor">
+	<xsl:with-param name="name">IDX-<xsl:number level="any"/>
+	</xsl:with-param>
+      </xsl:call-template>
+  </xsl:template>
+
+
+  <xsl:template match="tei:macroSpec" mode="tangle">
+    <xsl:param name="filename"/>
+    <xsl:variable name="macroPrefix">
+      <xsl:choose>
+        <xsl:when test="@prefix">
+          <xsl:value-of select="@prefix"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="$generalPrefix"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+
+    <xsl:variable name="entityContent">
+      <TEMPTREE>
+        <xsl:choose>
+	  <xsl:when test="tei:valList[@type='closed']">
+            <xsl:call-template name="valListChildren"/>
+	  </xsl:when>
+          <xsl:when test="tei:content/rng:group/rng:ref">
+	    <xsl:apply-templates select="tei:content/*|tei:content/processing-instruction()"/>	    
+	  </xsl:when>
+          <xsl:when test="tei:content/rng:group">
+            <choice xmlns="http://relaxng.org/ns/structure/1.0">
+              <xsl:apply-templates select="tei:content/rng:group/*"/>
+            </choice>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:apply-templates select="tei:content/*|tei:content/processing-instruction()"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </TEMPTREE>
+    </xsl:variable>
+    <xsl:variable name="entityCount">
+      <xsl:for-each select="$entityContent/TEMPTREE">
+        <xsl:value-of select="count(rng:*|processing-instruction())"/>
+      </xsl:for-each>
+    </xsl:variable>
+    <xsl:choose>
+      <xsl:when test="@ident=&#34;TEI.singleBase&#34;"/>
+      <xsl:when test="starts-with($entityContent,&#34;'&#34;)">
+        <xsl:if test="$verbose='true'">
+          <xsl:message>Omit <xsl:value-of select="$entityContent"/> for <xsl:value-of select="@ident"/>
+          </xsl:message>
+        </xsl:if>
+      </xsl:when>
+      <xsl:when test="starts-with($entityContent,&#34;-&#34;)">
+        <xsl:if test="$verbose='true'">
+          <xsl:message>Omit <xsl:value-of select="$entityContent"/> for <xsl:value-of select="@ident"/>
+          </xsl:message>
+        </xsl:if>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:if test="$verbose='true'">
+          <xsl:message> macroSpec <xsl:value-of select="@ident"/>
+          </xsl:message>
+        </xsl:if>
+        <xsl:call-template name="bitOut">
+          <xsl:with-param name="grammar">true</xsl:with-param>
+          <xsl:with-param name="content">
+            <Wrapper>
+              <define xmlns="http://relaxng.org/ns/structure/1.0" name="{$macroPrefix}{@ident}">
+                <xsl:if test="$parameterize='true'">
+                  <xsl:if test="starts-with(@ident,'macro.component')     or @predeclare='true'">
+                    <xsl:attribute name="combine">choice</xsl:attribute>
+                  </xsl:if>
+                </xsl:if>
+                <xsl:choose>
+                  <xsl:when test="starts-with(@ident,'type')">
+                    <xsl:apply-templates mode="justcopy" select="$entityContent/TEMPTREE/node()"/>
+                  </xsl:when>
+                  <xsl:when test="$entityCount=0">
+                    <choice>
+                      <empty/>
+                    </choice>
+                  </xsl:when>
+                  <xsl:when test="$entityCount=1">
+                    <xsl:apply-templates mode="justcopy" select="$entityContent/TEMPTREE/node()"/>
+                  </xsl:when>
+                  <xsl:when test="tei:content/rng:text|tei:content/rng:ref">
+                    <choice>
+                      <xsl:apply-templates mode="justcopy" select="$entityContent/TEMPTREE/node()"/>
+                    </choice>
+                  </xsl:when>
+                  <xsl:otherwise>
+                    <xsl:apply-templates mode="justcopy"  select="$entityContent/TEMPTREE/node()"/>
+                  </xsl:otherwise>
+                </xsl:choose>
+              </define>
+            </Wrapper>
+          </xsl:with-param>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+
+  <xsl:template match="tei:macroSpec/@ident"/>
+
+  <xsl:template match="tei:macroSpec/content/rng:*"/>
+
+  <xsl:template match="tei:memberOf" mode="tangleModel">
+    <!--
+    <xsl:variable name="owner">
+      <xsl:value-of
+        select="ancestor::tei:elementSpec/@ident|ancestor::tei:classSpec/@ident"
+      />
+    </xsl:variable>
+    <xsl:for-each select="key('IDENTS',@key)">
+      <xsl:if test="@type='model'">
+        <define combine="choice" name="{@ident}"
+          xmlns="http://relaxng.org/ns/structure/1.0">
+          <ref name="{$generalPrefix}{$owner}"
+            xmlns="http://relaxng.org/ns/structure/1.0"/>
+        </define>
+      </xsl:if>
+    </xsl:for-each>
+-->
+  </xsl:template>
+
+
+  <xsl:template match="tei:moduleRef" mode="tangle">
+    <!-- save a reference to myself so I can access my attrs and -->
+    <!-- generated node ID later -->
+    <xsl:variable name="me-the-moduleRef" select="."/>
+    <xsl:variable name="This" select="@key"/>
+    <xsl:if test="$verbose='true'">
+      <xsl:message> .... import module [<xsl:value-of select="$This"/> <xsl:value-of select="@url"/>] </xsl:message>
+    </xsl:if>
+    <xsl:call-template name="bitOut">
+      <xsl:with-param name="grammar">true</xsl:with-param>
+      <xsl:with-param name="content">
+        <Wrapper>
+          <xsl:choose>
+            <xsl:when test="@url and $parameterize='true'">
+              <include xmlns="http://relaxng.org/ns/structure/1.0" href="{@url}">
+                <xsl:apply-templates mode="justcopy"  select="tei:content/*"/>
+              </include>
+            </xsl:when>
+            <xsl:when test="@url and $parameterize='false'">
+              <xsl:comment>Start of import of <xsl:value-of select="@url"/>
+              </xsl:comment>
+              <div xmlns="http://relaxng.org/ns/structure/1.0">
+                <xsl:for-each select="document(@url)/rng:grammar">
+                  <!-- the "expandRNG" processing changed 2011-08-25 by Syd Bauman: -->
+                  <!-- added a 'prefix' parameter which value is prefixed to pattern -->
+                  <!-- names in the included schema. This prevents collisions in the -->
+                  <!-- output RNG. -->
+                  <xsl:apply-templates mode="expandRNG" select="@*|node()">
+                    <xsl:with-param name="prefix">
+		      <xsl:if test="$me-the-moduleRef/@prefix">
+			<xsl:value-of select="$me-the-moduleRef/@prefix"/>
+		      </xsl:if>
+                    </xsl:with-param>
+                  </xsl:apply-templates>
+                </xsl:for-each>
+                <xsl:apply-templates mode="justcopy"  select="tei:content/*"/>
+              </div>
+              <xsl:comment>End of import of <xsl:value-of select="@url"/>
+              </xsl:comment>
+            </xsl:when>
+            <xsl:otherwise>
+              <include xmlns="http://relaxng.org/ns/structure/1.0"
+                href="{$schemaBaseURL}{$This}.rng">
+                <xsl:attribute name="ns">
+                  <xsl:choose>
+                    <xsl:when test="ancestor::tei:schemaSpec/@ns">
+                      <xsl:value-of select="ancestor::tei:schemaSpec/@ns"/>
+                    </xsl:when>
+                    <xsl:otherwise>http://www.tei-c.org/ns/1.0</xsl:otherwise>
+                  </xsl:choose>
+                </xsl:attribute>
+                <xsl:for-each select="../tei:*[@module=$This and not(@mode='add')]">
+                  <xsl:apply-templates mode="tangle" select="."/>
+                </xsl:for-each>
+              </include>
+            </xsl:otherwise>
+          </xsl:choose>
+        </Wrapper>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+
+  <!-- begin expand RELAX NG section -->
+
+  <xsl:template match="@*|text()|comment()|processing-instruction" mode="expandRNG">
+    <xsl:copy-of select="."/>
+  </xsl:template>
+  
+  <xsl:template match="rng:start" mode="expandRNG"/>
+  
+  <xsl:template match="rng:include" mode="expandRNG">
+    <xsl:param name="prefix"/>
+    <xsl:if test="$verbose='true'">
+      <xsl:message> .... import <xsl:value-of select="@href"/></xsl:message>
+    </xsl:if>
+    <xsl:comment>Start of import of <xsl:value-of select="@href"/></xsl:comment>
+    <div xmlns="http://relaxng.org/ns/structure/1.0">
+      <xsl:for-each select="document(@href)/rng:grammar">
+        <xsl:apply-templates mode="expandRNG" select="@*|node()">
+          <xsl:with-param name="prefix" select="$prefix"/>
+        </xsl:apply-templates>
+      </xsl:for-each>
+    </div>
+    <xsl:comment>End of import of <xsl:value-of select="@href"/>
+    </xsl:comment>
+  </xsl:template>
+  
+  <xsl:template match="rng:define | rng:ref" mode="expandRNG">
+    <xsl:param name="prefix"/>
+    <xsl:if test="$verbose='true'">
+      <xsl:message>expanding rng:<xsl:value-of select="local-name(.)"/> name=<xsl:value-of select="@name"/>, giving it a prefix of '<xsl:value-of select="$prefix"/>'.</xsl:message>
+    </xsl:if>
+    <!-- generate a copy of this <define> or <ref> -->
+    <xsl:copy>
+      <!-- copy over all attributes (including @name) -->
+      <xsl:apply-templates select="@*" mode="expandRNG"/>
+      <xsl:if test="@name">
+        <!-- then replace the copied @name with our own that is the same -->
+        <!-- except has our prefix in the value -->
+        <xsl:attribute name="name" select="concat( $prefix, @name )"/>
+      </xsl:if>
+      <!-- then copy over any content -->
+      <xsl:apply-templates select="node()" mode="expandRNG">
+        <xsl:with-param name="prefix" select="$prefix"/>
+      </xsl:apply-templates>
+    </xsl:copy>
+  </xsl:template>
+  
+  <xsl:template match="*" mode="expandRNG">
+    <xsl:param name="prefix">erng_</xsl:param>
+    <xsl:copy>
+      <xsl:apply-templates mode="expandRNG" select="@*|node()">
+        <xsl:with-param name="prefix" select="$prefix"/>
+      </xsl:apply-templates>
+    </xsl:copy>
+  </xsl:template>
+
+  <!-- end expand RELAX NG section -->
+
+  <xsl:template match="tei:remarks" mode="tangle"/>
+
+
+  <xsl:template match="tei:specGrp" mode="ok">
+    <xsl:param name="filename"/>
+    <xsl:if test="$verbose='true'">
+      <xsl:message> processing specGrp <xsl:value-of select="@xml:id"/>
+      </xsl:message>
+    </xsl:if>
+    <xsl:call-template name="processSchemaFragment">
+      <xsl:with-param name="filename" select="$filename"/>
+    </xsl:call-template>
+  </xsl:template>
+
+  <xsl:template match="tei:tag">
+    <xsl:call-template name="typewriter">
+      <xsl:with-param name="text">
+        <xsl:text>&lt;</xsl:text>
+        <xsl:apply-templates/>
+        <xsl:text>&gt;</xsl:text>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+
+  <xsl:template name="compositeNumber">
+    <xsl:choose>
+      <xsl:when test="ancestor::tei:div1">
+        <xsl:for-each select="ancestor::tei:div1">
+          <xsl:number/>
+        </xsl:for-each>
+        <xsl:text>.</xsl:text>
+        <xsl:number from="tei:div1" level="any"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:for-each select="ancestor::tei:div[1]">
+          <xsl:number count="tei:div" from="tei:text" level="multiple"/>
+        </xsl:for-each>
+        <xsl:text>.</xsl:text>
+        <xsl:number from="tei:div"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="tei:p" mode="copyrighttext">
+    <xsl:text>&#10;</xsl:text>
+    <xsl:apply-templates/>
+  </xsl:template>
+
+  <xsl:template match="tei:list" mode="copyrighttext">
+    <xsl:text>&#10;</xsl:text>
+    <xsl:apply-templates/>
+  </xsl:template>
+
+  <xsl:template match="tei:item" mode="copyrighttext">
+    <xsl:text>&#10; *</xsl:text>
+    <xsl:apply-templates/>
+  </xsl:template>
+
+
+
+  <xsl:template name="attributeData">
+    <xsl:choose>
+      <xsl:when test="tei:valList[@type='closed']">
+        <choice xmlns="http://relaxng.org/ns/structure/1.0">
+          <xsl:for-each select="tei:valList/tei:valItem">
+            <value>
+              <xsl:choose>
+                <xsl:when test="tei:altIdent=@ident">
+                  <xsl:value-of select="@ident"/>
+                </xsl:when>
+                <xsl:when test="tei:altIdent">
+                  <xsl:value-of select="normalize-space(tei:altIdent)"/>
+                </xsl:when>
+                <xsl:otherwise>
+                  <xsl:value-of select="@ident"/>
+                </xsl:otherwise>
+              </xsl:choose>
+            </value>
+            <xsl:if test="not($oddmode='tei')">
+              <a:documentation>
+                <xsl:call-template name="makeDescription">
+                  <xsl:with-param name="includeValList">true</xsl:with-param>
+                  <xsl:with-param name="coded">false</xsl:with-param>
+                </xsl:call-template>
+              </a:documentation>
+            </xsl:if>
+          </xsl:for-each>
+        </choice>
+      </xsl:when>
+      <xsl:when test="tei:valList[@type='semi']">
+        <choice xmlns="http://relaxng.org/ns/structure/1.0">
+          <xsl:for-each select="tei:valList/tei:valItem">
+            <value>
+              <xsl:choose>
+                <xsl:when test="tei:altIdent=@ident">
+                  <xsl:value-of select="@ident"/>
+                </xsl:when>
+                <xsl:when test="tei:altIdent">
+                  <xsl:value-of select="normalize-space(tei:altIdent)"/>
+                </xsl:when>
+                <xsl:otherwise>
+                  <xsl:value-of select="@ident"/>
+                </xsl:otherwise>
+              </xsl:choose>
+            </value>
+            <xsl:if test="not($oddmode='tei')">
+              <a:documentation>
+                <xsl:call-template name="makeDescription">
+                  <xsl:with-param name="includeValList">true</xsl:with-param>
+                  <xsl:with-param name="coded">false</xsl:with-param>
+                </xsl:call-template>
+              </a:documentation>
+            </xsl:if>
+          </xsl:for-each>
+          <xsl:choose>
+            <xsl:when test="tei:datatype/rng:ref[@name='data.enumerated']">
+              <data type="Name"/>
+            </xsl:when>
+	    <xsl:when test="not(tei:datatype)">
+              <data type="Name"/>
+	    </xsl:when>
+            <xsl:otherwise>
+              <xsl:apply-templates select="tei:datatype/rng:*"/>
+            </xsl:otherwise>
+          </xsl:choose>
+        </choice>
+      </xsl:when>
+      <xsl:when test="tei:datatype/rng:*">
+        <xsl:apply-templates select="tei:datatype/rng:*"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <text xmlns="http://relaxng.org/ns/structure/1.0"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="makeSimpleAttribute">
+    <xsl:variable name="name">
+      <xsl:choose>
+        <xsl:when test="tei:altIdent=@ident">
+          <xsl:value-of select="@ident"/>
+        </xsl:when>
+        <xsl:when test="tei:altIdent">
+          <xsl:value-of select="normalize-space(tei:altIdent)"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:if test="@ns='http://www.w3.org/XML/1998/namespace'">xml:</xsl:if>
+          <xsl:value-of select="@ident"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <attribute xmlns="http://relaxng.org/ns/structure/1.0" name="{$name}">
+      <xsl:if test="@ns">
+        <xsl:copy-of select="@ns"/>
+      </xsl:if>
+      <xsl:if test="tei:defaultVal and not(tei:defaultVal='')">
+        <xsl:attribute name="a:defaultValue">
+          <xsl:value-of select="normalize-space(tei:defaultVal)"/>
+        </xsl:attribute>
+      </xsl:if>
+      <xsl:if test="not($oddmode='tei')">
+        <a:documentation>
+          <xsl:call-template name="makeDescription">
+            <xsl:with-param name="includeValList">true</xsl:with-param>
+            <xsl:with-param name="coded">false</xsl:with-param>
+          </xsl:call-template>
+        </a:documentation>
+      </xsl:if>
+      <!-- ************************************ -->
+      <!-- Ascertain minOccurs= and maxOccurs=. -->
+      <!-- ************************************ -->
+      <!-- get the value of minOccurs=, defaulting to "1" -->
+      <xsl:variable name="minOccurs">
+        <xsl:choose>
+          <xsl:when test="tei:datatype/@minOccurs">
+            <xsl:value-of select="tei:datatype/@minOccurs"/>
+          </xsl:when>
+          <xsl:otherwise>1</xsl:otherwise>
+        </xsl:choose>
+      </xsl:variable>
+      <!-- get the value of maxOccurs=, defaulting to "1" -->
+      <xsl:variable name="maxOccurs">
+        <xsl:choose>
+          <xsl:when test="tei:datatype/@maxOccurs">
+            <xsl:value-of select="tei:datatype/@maxOccurs"/>
+          </xsl:when>
+          <xsl:otherwise>1</xsl:otherwise>
+        </xsl:choose>
+      </xsl:variable>
+      <!-- We now have two _string_ representations of the attrs, but -->
+      <!-- we need integers. So cast them, converting "unbounded" to  -->
+      <!-- a special flag value (-1): -->
+      <xsl:variable name="min" select="xs:integer( $minOccurs )"/>
+      <xsl:variable name="max">
+        <xsl:choose>
+          <xsl:when test="$maxOccurs='unbounded'">
+            <xsl:value-of select="xs:integer( -1 )"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:value-of select="xs:integer( $maxOccurs )"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:variable>
+      <xsl:choose>
+        <xsl:when test="tei:datatype/rng:text  or  not( tei:datatype )  or  $max=1">
+          <!-- If there is only going to be one output RELAX NG node   --> 
+          <!-- in the attribute definition, then we don't need to      -->
+          <!-- bother with the complex min & max code below (in the    -->
+          <!-- <xsl:otherwise>). Although it would generate the right  -->
+          <!-- number of RELAX NG constructs, it wraps them in a       -->
+          <!-- <list>, which makes no sense in some cases, and will    -->
+          <!-- cause an error if the RELAX NG node inside the list is  -->
+          <!-- <text>.                                                 -->
+          <!-- Cases we handle here:                                   -->
+          <!-- * my <datatype> child has an <rng:text> child: only 1   -->
+          <!--   output node (<rng:text>), which can't be wrapped in   -->
+          <!--   a <list>                                              -->
+          <!-- * I don't have a <datatype> child: the 'attributeData'  -->
+          <!--   template will spit out a single <rng:text> node (see  -->
+          <!--   the outermost <xsl:otherwise> of that template)       -->
+          <!-- * @maxOccurs=1: whatever ends up being generated, there -->
+          <!--   will only be 1 of them, so no need for a <list>       -->
+          <xsl:call-template name="attributeData"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <!-- Note that in the (erroneous) event   -->
+          <!-- that minOccurs= is greater than      -->
+          <!-- maxOccurs=, the latter is simply     -->
+          <!-- ignored.                             -->
+          <!-- Hack(?): -->
+          <!-- The 'attributeData' template needs to operate from this node; -->
+          <!-- However, once we've used for-each to "loop", we've lost the -->
+          <!-- current node (it has become one of the integers in the select= -->
+          <!-- range). So here we remember the current node, and re-set it -->
+          <!-- before calling 'attributeData'. Perhaps it would be better to -->
+          <!-- send it as a parameter to 'attributeData' and have it set the -->
+          <!-- current node, but since I didn't write 'attributeData', I've -->
+          <!-- chosen this method so I don't have to muck with it. -Syd -->
+          <xsl:variable name="thisNode" select="."/>
+          <list>
+            <xsl:if test="$min > 0">
+              <xsl:for-each select="1 to $min">
+                <xsl:for-each select="$thisNode">
+                  <xsl:call-template name="attributeData"/>
+                </xsl:for-each>
+              </xsl:for-each>
+            </xsl:if>
+            <xsl:choose>
+              <xsl:when test="$max= -1"><!-- i.e., unbounded -->
+                <zeroOrMore>
+                  <xsl:for-each select="$thisNode">
+                    <xsl:call-template name="attributeData"/>
+                  </xsl:for-each>
+                </zeroOrMore>
+              </xsl:when>
+              <xsl:otherwise>
+                <xsl:for-each select="xs:integer( $min + 1 ) to $max">
+                  <optional>
+                    <xsl:for-each select="$thisNode">
+                      <xsl:call-template name="attributeData"/>
+                    </xsl:for-each>
+                  </optional>
+                </xsl:for-each>
+              </xsl:otherwise>
+            </xsl:choose>
+          </list>
+        </xsl:otherwise>
+      </xsl:choose>
+    </attribute>
+  </xsl:template>
+
+  <xsl:template name="makeAnAttribute">
+    <xsl:choose>
+      <xsl:when test="@usage='req'">
+        <xsl:call-template name="makeSimpleAttribute"/>
+      </xsl:when>
+      <!--
+      <xsl:when test="parent::tei:attList[@org='choice']">
+        <xsl:call-template name="makeSimpleAttribute"/>
+      </xsl:when>
+-->
+      <xsl:otherwise>
+        <optional xmlns="http://relaxng.org/ns/structure/1.0">
+          <xsl:call-template name="makeSimpleAttribute"/>
+        </optional>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="generateClassParents">
+    <xsl:choose>
+      <xsl:when test="not(tei:classes)"> (none) </xsl:when>
+      <xsl:otherwise>
+        <xsl:for-each select="tei:classes/tei:memberOf">
+          <xsl:if test="preceding-sibling::tei:memberOf">
+            <xsl:text>: </xsl:text>
+          </xsl:if>
+          <xsl:choose>
+            <xsl:when test="key('CLASSES',@key)">
+              <xsl:for-each select="key('CLASSES',@key)">
+                <xsl:call-template name="linkTogether">
+                  <xsl:with-param name="name" select="@ident"/>
+                </xsl:call-template>
+              </xsl:for-each>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:value-of select="@key"/>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:for-each>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+
+  <xsl:template name="linkStyle"/>
+
+
+  <xsl:template name="getSpecURL">
+    <xsl:param name="name"/>
+    <xsl:param name="type"/>
+    <xsl:choose>
+      <xsl:when test="$type='macro'">
+        <xsl:for-each select="id('REFENT')">
+          <xsl:apply-templates mode="generateLink" select="."/>
+        </xsl:for-each>
+      </xsl:when>
+      <xsl:when test="$type='element'">
+        <xsl:for-each select="id('REFTAG')">
+          <xsl:apply-templates mode="generateLink" select="."/>
+        </xsl:for-each>
+      </xsl:when>
+      <xsl:when test="$type='class'">
+        <xsl:for-each select="id('REFCLA')">
+          <xsl:apply-templates mode="generateLink" select="."/>
+        </xsl:for-each>
+      </xsl:when>
+    </xsl:choose>
+    <xsl:text>#</xsl:text>
+    <xsl:value-of select="$name"/>
+  </xsl:template>
+
+
+  <xsl:template name="linkTogether">
+    <xsl:param name="name"/>
+    <xsl:param name="reftext"/>
+    <xsl:param name="class">link_odd</xsl:param>
+
+    <xsl:variable name="documentationLanguage">
+      <xsl:call-template name="generateDoc"/>
+    </xsl:variable>
+    <xsl:variable name="partialname">
+      <xsl:choose>
+        <xsl:when test="contains($name,'_')">
+          <xsl:value-of select="substring-before($name,'_')"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="$name"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:variable name="link">
+      <xsl:choose>
+        <xsl:when test="$reftext=''">
+          <xsl:value-of select="$name"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="$reftext"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+
+    <xsl:choose>
+      <xsl:when test="not(key('IDENTS',$partialname))">
+        <xsl:value-of select="$link"/>
+      </xsl:when>
+      <xsl:when test="$oddmode='html' and number($splitLevel)=-1">
+        <a xmlns="http://www.w3.org/1999/xhtml" class="{$class}" href="#{$partialname}">
+          <xsl:value-of select="$link"/>
+        </a>
+      </xsl:when>
+      <xsl:when test="$oddmode='html' and $STDOUT='true'">
+        <a xmlns="http://www.w3.org/1999/xhtml" class="{$class}">
+          <xsl:attribute name="href">
+            <xsl:for-each select="key('IDENTS',$partialname)">
+              <xsl:call-template name="getSpecURL">
+                <xsl:with-param name="name">
+                  <xsl:value-of select="$partialname"/>
+                </xsl:with-param>
+                <xsl:with-param name="type">
+                  <xsl:value-of select="substring-before(local-name(),'Spec')"/>
+                </xsl:with-param>
+              </xsl:call-template>
+            </xsl:for-each>
+          </xsl:attribute>
+          <xsl:value-of select="$link"/>
+        </a>
+      </xsl:when>
+
+
+      <xsl:when test="$oddmode='html'">
+        <a xmlns="http://www.w3.org/1999/xhtml" class="{$class}"
+          href="{concat('ref-',$partialname,'.html')}">
+          <xsl:value-of select="$link"/>
+        </a>
+      </xsl:when>
+
+      <xsl:when test="$oddmode='pdf'">
+        <fo:inline>
+          <xsl:value-of select="$link"/>
+        </fo:inline>
+      </xsl:when>
+
+      <xsl:when test="$oddmode='tei'">
+        <tei:ref target="#{$partialname}">
+          <xsl:value-of select="$link"/>
+        </tei:ref>
+      </xsl:when>
+
+      <xsl:otherwise>
+        <xsl:value-of select="$link"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+
+  <xsl:template name="processSchemaFragment">
+    <xsl:param name="filename"/>
+    <xsl:variable name="secnum">
+      <xsl:call-template name="sectionNumber"/>
+    </xsl:variable>
+    <xsl:apply-templates mode="tangle"/>
+  </xsl:template>
+
+
+  <xsl:template name="make-ns-declaration">
+    <xsl:param name="is-default"/>
+    <xsl:param name="prefix"/>
+    <xsl:param name="uri"/>
+  </xsl:template>
+
+  <xsl:template name="inhnamespace"/>
+
+  <xsl:template match="tei:constraintSpec/tei:desc"/>
+  <xsl:template match="tei:constraintSpec/tei:gloss"/>
+  <xsl:template match="tei:constraintSpec/tei:equiv"/>
+
+
+  <xsl:template match="tei:constraintSpec"/>
+
+  <xsl:template match="tei:altIdent"/>
+
+  <xsl:template match="a:*">
+    <xsl:apply-templates mode="justcopy" select="."/>
+  </xsl:template>
+
+  <xsl:template match="tei:classSpec" mode="processDefaultAtts">
+    <xsl:if test="$verbose='true'">
+      <xsl:message> .. default attribute settings for <xsl:value-of select="@ident"/>
+      </xsl:message>
+    </xsl:if>
+    <xsl:call-template name="bitOut">
+      <xsl:with-param name="grammar">true</xsl:with-param>
+      <xsl:with-param name="content">
+        <Wrapper>
+	  <xsl:variable name="c">
+	    <xsl:choose>
+	      <xsl:when test="@prefix">
+		<xsl:value-of select="@prefix"/>
+	      </xsl:when>
+	      <xsl:otherwise>
+		<xsl:value-of select="$generalPrefix"/>
+	      </xsl:otherwise>
+	    </xsl:choose>
+	    <xsl:value-of select="@ident"/>
+	  </xsl:variable>
+          <define xmlns="http://relaxng.org/ns/structure/1.0" combine="choice"
+            name="{$c}.attributes">
+            <empty/>
+          </define>
+        </Wrapper>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element schemaSpec</desc>
+  </doc>
+
+  <xsl:template match="tei:schemaSpec">
+    <xsl:call-template name="processSchemaFragment"/>
+  </xsl:template>
+
+  <xsl:template name="generateOutput">
+    <xsl:param name="body"/>
+    <xsl:param name="suffix"/>
+    <xsl:param name="method">xml</xsl:param>
+    <xsl:variable name="processor">
+      <xsl:value-of select="system-property('xsl:vendor')"/>
+    </xsl:variable>
+    <xsl:choose>
+      <xsl:when test="$outputDir='' or $outputDir='-'">
+        <xsl:copy-of select="$body"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:result-document href="{$outputDir}/{@ident}{$suffix}" method="{$method}">
+          <xsl:copy-of select="$body"/>
+        </xsl:result-document>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+
+  <xsl:template name="showDate">
+    <xsl:choose>
+      	<xsl:when test="$useFixedDate='true'">1970-01-01</xsl:when>
+	<xsl:otherwise>
+    <xsl:value-of
+	select="format-dateTime(current-dateTime(),'[Y]-[M02]-[D02]T[H02]:[m02]:[s02]Z')"/>
+	</xsl:otherwise>
+    </xsl:choose>
+</xsl:template>
+
+  <xsl:template name="sectionNumber">
+    <xsl:for-each
+      select="(ancestor::tei:div1|ancestor::tei:div2|ancestor::tei:div3|ancestor::tei:div4)[last()]">
+      <xsl:for-each select="ancestor-or-self::tei:div1">
+        <xsl:number from="tei:body" level="any"/>
+        <xsl:text>.</xsl:text>
+      </xsl:for-each>
+      <xsl:number count="tei:div2|tei:div3|tei:div4" from="tei:div1" level="multiple"/>
+    </xsl:for-each>
+  </xsl:template>
+
+
+  <xsl:template match="*" mode="expandSpecs">
+    <xsl:apply-templates mode="justcopy" select="."/>
+  </xsl:template>
+
+  <xsl:template match="tei:specGrpRef" mode="expandSpecs">
+    <xsl:choose>
+      <xsl:when test="starts-with(@target,'#')">
+        <xsl:for-each select="id(substring(@target,2))">
+          <xsl:apply-templates mode="expandSpecs"/>
+        </xsl:for-each>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:for-each select="document(@target)">
+          <xsl:apply-templates mode="expandSpecs"/>
+        </xsl:for-each>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <!-- list inside <desc> -->
+  <xsl:template match="tei:desc/tei:list/tei:item">
+    <xsl:text> * </xsl:text>
+    <xsl:apply-templates/>
+  </xsl:template>
+
+  <xsl:template name="makeTEIVersion">
+    <xsl:choose>
+      <xsl:when test="ancestor-or-self::tei:TEI/processing-instruction()[name()='TEIVERSION']">
+        <!-- JC Additions to form proper URL from version number -->
+        <xsl:variable name="TEIVersion"
+          select="ancestor-or-self::tei:TEI/processing-instruction()[name()='TEIVERSION'][1]"/>
+        <xsl:variable name="TEIVersion-edition"
+          select="substring-before($TEIVersion, ' Last')"/>
+        <xsl:variable name="TEIVersion-datestring"
+          select="concat(' Last',substring-after($TEIVersion, ' Last'))"/>
+        <xsl:variable name="TEIVersionWithoutFullStop">
+          <xsl:choose>
+            <xsl:when
+              test="substring($TEIVersion-edition,
+              string-length($TEIVersion-edition)) =
+              '.' and matches($TEIVersion-edition, '\d\d*\.\d\d*\.\d\d*\.')">
+              <xsl:value-of
+                select="substring($TEIVersion-edition,0,string-length($TEIVersion-edition))"
+              />
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:value-of select="$TEIVersion-edition"/>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:variable>
+        <xsl:variable name="versionURL"
+          select="concat('http://www.tei-c.org/Vault/P5/', $TEIVersionWithoutFullStop, '/')"/>
+        <xsl:text>&#10;Edition: </xsl:text>
+        <xsl:value-of select="$TEIVersion"/>
+        <xsl:text>&#10;Edition Location: </xsl:text>
+        <xsl:value-of select="$versionURL"/>
+        <xsl:text>&#10;</xsl:text>
+        </xsl:when>
+      <xsl:when
+        test="ancestor-or-self::tei:TEI/tei:teiHeader/tei:fileDesc/tei:editionStmt/tei:edition">
+        <xsl:text>&#10;Edition: </xsl:text>
+        <xsl:value-of
+          select="ancestor-or-self::tei:TEI/tei:teiHeader/tei:fileDesc/tei:editionStmt/tei:edition"/>
+        <xsl:text>&#10;</xsl:text>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="tei:gloss" mode="inLanguage">
+    <xsl:value-of select="."/>
+  </xsl:template>
+  <xsl:template match="tei:desc" mode="inLanguage">
+    <xsl:apply-templates/>
+  </xsl:template>
+
+  <xsl:template name="processSchematron">
+    <xsl:choose>
+      <xsl:when test="ancestor::teix:egXML"/>
+      <xsl:when test="self::s:ns">
+        <ns prefix="{@prefix}" uri="{@uri}" xmlns="http://www.ascc.net/xml/schematron"/>
+      </xsl:when>
+      <xsl:when test="(self::s:report or self::s:assert) and ancestor::tei:elementSpec">
+        <pattern xmlns="http://www.ascc.net/xml/schematron">
+          <xsl:attribute name="name">
+            <xsl:value-of select="ancestor::tei:elementSpec/@ident"/>
+            <xsl:text>-constraint-</xsl:text>
+            <xsl:value-of select="ancestor::tei:constraintSpec/@ident"/>
+            <xsl:if test="count(../s:report|s:assert) &gt;1">
+              <xsl:number/>
+            </xsl:if>
+          </xsl:attribute>
+          <rule>
+            <xsl:attribute name="context">
+              <xsl:text>tei:</xsl:text>
+              <xsl:value-of select="ancestor::tei:elementSpec/@ident"/>
+            </xsl:attribute>
+            <xsl:apply-templates mode="justcopy" select="."/>
+          </rule>
+        </pattern>
+      </xsl:when>
+      <xsl:when test="self::s:pattern">
+        <xsl:apply-templates mode="justcopy" select="."/>
+      </xsl:when>
+      <xsl:when test="self::s:rule">
+        <pattern name="{ancestor::tei:constraintSpec/parent::*/@ident}-constraint-{ancestor::tei:constraintSpec/@ident}"
+          xmlns="http://www.ascc.net/xml/schematron">
+          <xsl:apply-templates mode="justcopy" select="."/>
+        </pattern>
+      </xsl:when>
+      <xsl:when test="self::sch:ns">
+        <ns prefix="{@prefix}" uri="{@uri}" xmlns="http://purl.oclc.org/dsdl/schematron"/>
+      </xsl:when>
+      <xsl:when test="self::sch:pattern">
+        <xsl:apply-templates mode="justcopy" select="."/>
+      </xsl:when>
+      <xsl:when test="self::sch:rule">
+        <pattern xmlns="http://purl.oclc.org/dsdl/schematron"
+          id="{ancestor::tei:constraintSpec/parent::*/@ident}-constraint-{ancestor::tei:constraintSpec/@ident}">
+          <xsl:apply-templates mode="justcopy" select="."/>
+        </pattern>
+      </xsl:when>
+      <xsl:when test="(self::sch:report or self::sch:assert) and ancestor::tei:elementSpec">
+        <pattern xmlns="http://purl.oclc.org/dsdl/schematron">
+          <xsl:attribute name="id">
+            <xsl:value-of select="ancestor::tei:elementSpec/@ident"/>
+            <xsl:text>-constraint-</xsl:text>
+            <xsl:value-of select="../../@ident"/>
+            <xsl:if test="count(../sch:report|../sch:assert) &gt;1">
+              <xsl:number/>
+            </xsl:if>
+          </xsl:attribute>
+          <rule>
+            <xsl:attribute name="context">
+              <xsl:text>tei:</xsl:text>
+              <xsl:value-of select="ancestor::tei:elementSpec/@ident"/>
+            </xsl:attribute>
+            <xsl:apply-templates mode="justcopy" select="."/>
+          </rule>
+        </pattern>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:template>
+
+
+   <xsl:template match="@*|text()" mode="justcopy">
+      <xsl:copy-of select="."/>
+   </xsl:template>
+
+   <xsl:template match="processing-instruction()" mode="justcopy">
+      <xsl:copy-of select="."/>
+   </xsl:template>
+
+   <xsl:template match="*" mode="justcopy">
+     <xsl:copy>
+         <xsl:apply-templates
+	     select="*|@*|processing-instruction()|text()" mode="justcopy"/>
+     </xsl:copy>
+   </xsl:template>
+
+   <xsl:template match="a:*" mode="justcopy">
+      <xsl:element name="{name()}">
+         <xsl:apply-templates
+	     select="*|@*|processing-instruction()|text()" mode="justcopy"/>
+      </xsl:element>
+   </xsl:template>
+
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/odds2/teiodds.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/odds2/RngToRnc.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/odds2/RngToRnc.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/odds2/RngToRnc.xsl	(revision 258)
@@ -0,0 +1,1502 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--*- XML -*-->
+<!-- adapted by Sebastian Rahtz from: -->
+<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
+<!-- $Id: RngToRnc.xsl 9513 2011-10-17 08:55:51Z rahtz $ -->
+<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
+<!-- 
+  modified 2010-08-14 by Syd Bauman:
+     bug-fix: modified expressions defining 'pfx' variables
+     so that only 1 namespace is handed to name().
+-->
+<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+     Copyright (c) 2002, Pantor Engineering AB
+     All rights reserved.
+     
+     Redistribution and use in source and binary forms, with or
+     without modification, are permitted provided that the following
+     conditions are met:
+     
+     * Redistributions of source code must retain the above copyright
+       notice, this list of conditions and the following disclaimer. 
+
+     * Redistributions in binary form must reproduce the above
+       copyright notice, this list of conditions and the following
+       disclaimer in the documentation and/or other materials provided
+       with the distribution.
+
+     * Neither the name of Pantor Engineering AB nor the names of its
+       contributors may be used to endorse or promote products derived
+       from this software without specific prior written permission.
+     
+     THIS   SOFTWARE   IS PROVIDED BY    THE   COPYRIGHT  HOLDERS  AND
+     CONTRIBUTORS "AS IS"   AND ANY  EXPRESS OR  IMPLIED   WARRANTIES,
+     INCLUDING,  BUT  NOT LIMITED  TO,   THE  IMPLIED  WARRANTIES   OF
+     MERCHANTABILITY    AND  FITNESS  FOR   A  PARTICULAR  PURPOSE ARE
+     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+     BE  LIABLE   FOR ANY    DIRECT, INDIRECT,   INCIDENTAL,  SPECIAL,
+     EXEMPLARY, OR CONSEQUENTIAL DAMAGES  (INCLUDING, BUT NOT  LIMITED
+     TO, PROCUREMENT  OF  SUBSTITUTE GOODS OR  SERVICES;  LOSS OF USE,
+     DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+     ANY THEORY OF  LIABILITY, WHETHER IN CONTRACT,  STRICT LIABILITY,
+     OR  TORT (INCLUDING NEGLIGENCE OR  OTHERWISE) ARISING  IN ANY WAY
+     OUT OF  THE  USE OF   THIS  SOFTWARE,  EVEN IF ADVISED   OF   THE
+     POSSIBILITY OF SUCH DAMAGE.
+
+     +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
+<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+     Created by David.Rosenborg@pantor.com
+     +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
+<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+     RngToRncText.xsl converts a RELAX NG schema in XML syntax to the
+     compact syntax.
+
+     If the source document is a RELAX NG schema, an extension
+     function converting result tree fragments to node sets is
+     required. If the processor supports the exslt:node-set function,
+     no configuration should be needed. See RngToRncProcessorConfig.xsl
+     for further information.
+
+     This stylesheet can also be applied to the intermediate XML
+     representation of a compact schema as output by the
+     RngToRncXml.xsl stylesheet. In this case, no extension function
+     is required.
+
+     For a description of the underlying XML to compact syntax
+     transformation, see RngToRncXml.xsl.
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
+<xsl:transform xmlns:rng="http://relaxng.org/ns/structure/1.0"
+               xmlns:sch="http://purl.oclc.org/dsdl/schematron"
+               xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+               xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
+               version="2.0"
+               exclude-result-prefixes="rng sch a">
+  <xsl:param name="top"/>
+<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
+<!-- Parameters -->
+<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
+<!-- collapse-lines:
+     If true, output constructs spanning multiple lines will be
+     groupd into a single line unless it exceeds $line-width chars. -->
+  <xsl:param name="collapse-lines" select="true ()"/>
+   <!-- indent-width:
+     The number of characters to indent at each indentation level -->
+  <xsl:param name="indent-width" select="3"/>
+   <!-- line-width:
+     see the group-lines parameter. -->
+  <xsl:param name="line-width" select="80"/>
+   <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
+<!-- $Id: RngToRnc.xsl 9513 2011-10-17 08:55:51Z rahtz $ -->
+<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
+<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+     Copyright (c) 2002, Pantor Engineering AB
+     All rights reserved.
+     
+     Redistribution and use in source and binary forms, with or
+     without modification, are permitted provided that the following
+     conditions are met:
+     
+     * Redistributions of source code must retain the above copyright
+       notice, this list of conditions and the following disclaimer. 
+
+     * Redistributions in binary form must reproduce the above
+       copyright notice, this list of conditions and the following
+       disclaimer in the documentation and/or other materials provided
+       with the distribution.
+
+     * Neither the name of Pantor Engineering AB nor the names of its
+       contributors may be used to endorse or promote products derived
+       from this software without specific prior written permission.
+     
+     THIS   SOFTWARE   IS PROVIDED BY    THE   COPYRIGHT  HOLDERS  AND
+     CONTRIBUTORS "AS IS"   AND ANY  EXPRESS OR  IMPLIED   WARRANTIES,
+     INCLUDING,  BUT  NOT LIMITED  TO,   THE  IMPLIED  WARRANTIES   OF
+     MERCHANTABILITY    AND  FITNESS  FOR   A  PARTICULAR  PURPOSE ARE
+     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+     BE  LIABLE   FOR ANY    DIRECT, INDIRECT,   INCIDENTAL,  SPECIAL,
+     EXEMPLARY, OR CONSEQUENTIAL DAMAGES  (INCLUDING, BUT NOT  LIMITED
+     TO, PROCUREMENT  OF  SUBSTITUTE GOODS OR  SERVICES;  LOSS OF USE,
+     DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+     ANY THEORY OF  LIABILITY, WHETHER IN CONTRACT,  STRICT LIABILITY,
+     OR  TORT (INCLUDING NEGLIGENCE OR  OTHERWISE) ARISING  IN ANY WAY
+     OUT OF  THE  USE OF   THIS  SOFTWARE,  EVEN IF ADVISED   OF   THE
+     POSSIBILITY OF SUCH DAMAGE.
+
+     +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
+<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+     Created by David.Rosenborg@pantor.com
+     +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
+<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+     RngToRncXml.xsl converts a RELAX NG schema in XML syntax to an
+     XML representation of the compact syntax.
+
+     The output is an intermediate format suitable for further
+     transformation into, for example, plain text or HTML.
+
+     The default namespace declaration is chosen from the first
+     (in document order) occurrence of an ns attribute, unless
+     supplied as the parameter default-ns.
+
+     If the value of an href attribute ends with '.rng', the suffix
+     will be replace by the string '.rnc'. This feature can be
+     disabled by setting the stylesheet parameter rewrite-suffix to
+     false.
+
+     Current limitations/known deficiencies:
+
+     * Annotations are not handled in name classes
+
+     * Uses of namespace prefixes must be consistent throughout the
+       source schema. That is, a namespace prefix used in two QNames
+       must be declared to the same namespace URI for both
+       occurrences.
+
+     +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
+<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
+<!-- Parameters -->
+<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
+<!-- rewrite-suffix:
+     If true and the value of an href attribute ends with '.rng', the
+     suffix will be replace by the string '.rnc'. -->
+  <xsl:param name="rewrite-suffix" select="true ()"/>
+   <!-- retain-prefixes:
+     If true, namespace declarations will use prefixes from the source
+     document if possible. (Doesn't work with MSXML 4.0 or Xalan-J 2.4.0) -->
+  <xsl:param name="retain-prefixes"
+              select="system-property ('xsl:vendor') != 'Microsoft' and     not (starts-with (system-property ('xsl:vendor'), 'Apache'))"/>
+   <!-- default-ns:
+     The uri of the default namespace. There must be at least one
+     ns attribute in the schema containing this uri. -->
+  <xsl:param name="default-ns" select="string (/descendant::rng:*[@ns][1]/@ns)"/>
+   <!-- prefixes:
+    A space separated list of prefix mappings: prefix '=' namespace-uri.
+    Note: Since space is used as a delimiter, no space is allowed 
+    immediately before or after the equal sign. Example: 
+
+    "foo=http://example.org/ns/foo bar=http://example.org/ns/bar"
+
+    The prefixes will be used whenever a prefix is needed for the
+    corresponding namespace URI. Prefixes declared in this
+    parameter has higher precedence than the prefixes declared
+    in the prefix-map parameter and those found in the schema.
+  -->
+  <xsl:param name="prefixes"/>
+   <!-- prefix-map:
+     A node set containing element nodes like:
+
+     <ns prefix="x">http://example.org/x</ns>
+
+     The name of the element is not significant. Prefixes from this
+     map will be used in favor of generated and the ones found in the
+     source schema. A prefix must not be the empty string. Also, it
+     must not conflict with any other prefixes in the map or in the
+     schema. -->
+  <xsl:param name="prefix-map" select="/.."/>
+   <!-- recursive:
+     If true, recursively process includes and external
+     references. Note: no include logic is applied. The external
+     schemas are simply structurally included, wrapped in an <external>
+     element. -->
+  <xsl:param name="recursive" select="false ()"/>
+  <xsl:template name="str">
+      <xsl:param name="text"/>
+      <xsl:param name="quote" select="'&#34;'"/>
+      <xsl:param name="is-multiline" select="false ()"/>
+      <xsl:variable name="lit" select="concat ($quote, $text, $quote)"/>
+      <str size="{string-length ($lit)}">
+         <xsl:if test="$is-multiline">
+            <xsl:attribute name="multiline">yes</xsl:attribute>
+         </xsl:if>
+         <xsl:value-of select="$lit"/>
+      </str>
+  </xsl:template>
+  <xsl:template name="text">
+      <xsl:param name="text"/>
+      <xsl:attribute name="size">
+         <xsl:value-of select="string-length ($text)"/>
+      </xsl:attribute>
+      <xsl:value-of select="$text"/>
+  </xsl:template>
+   <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
+  <xsl:key name="prefix"
+            match="rng:element/@name [contains (., ':')] | rng:attribute/@name [contains (., ':')]"
+            use="substring-before (., ':')"/>
+  <xsl:key name="ns" match="*" use="namespace::*"/>
+  <xsl:key name="annot-ns" match="*[not (self::rng:*)]" use="namespace-uri (.)"/>
+  <xsl:key name="annot-ns" match="@*[namespace-uri (.) != '']" use="namespace-uri (.)"/>
+  <xsl:output method="xml" indent="yes"/>
+  <xsl:strip-space elements="rng:*"/>
+  <xsl:preserve-space elements="rng:value rng:param"/>
+  <xsl:variable name="xsd" select="'http://www.w3.org/2001/XMLSchema-datatypes'"/>
+  <xsl:variable name="default-ns-nd" select="/descendant::rng:*[@ns = $default-ns][1]/@ns"/>
+  <xsl:variable name="default-ns-id-rtf">
+      <xsl:call-template name="get-prefix">
+         <xsl:with-param name="nd" select="$default-ns-nd"/>
+      </xsl:call-template>
+  </xsl:variable>
+  <xsl:variable name="default-ns-id" select="string ($default-ns-id-rtf)"/>
+  <xsl:variable name="has-default-ns" select="boolean ($default-ns-nd)"/>
+  <xsl:variable name="has-local" select="not (key ('prefix', 'local'))"/>
+  <xsl:template name="make-compact-schema">
+      <compact-schema>
+<!-- Declarations -->
+      <xsl:if test="$has-default-ns">
+            <xsl:call-template name="make-ns-declaration">
+               <xsl:with-param name="is-default" select="true ()"/>
+               <xsl:with-param name="prefix" select="$default-ns-id"/>
+               <xsl:with-param name="uri" select="$default-ns"/>
+            </xsl:call-template>
+         </xsl:if>
+         <xsl:if test="$has-local">
+            <xsl:call-template name="make-ns-declaration">
+               <xsl:with-param name="prefix" select="'local'"/>
+               <xsl:with-param name="uri" select="''"/>
+            </xsl:call-template>
+         </xsl:if>
+         <xsl:call-template name="inhnamespace"/>
+         <!--
+      <xsl:choose>
+	<xsl:when test="$retain-prefixes">
+	  <xsl:for-each select="//*">
+	    <xsl:variable name="elm" select="self::*"/>
+	    <xsl:for-each select="namespace::*">
+	      <xsl:variable name="ns" select="string (.)"/>
+	      <xsl:if test="(not ($has-default-ns) or $ns != $default-ns) and
+		count (key ('ns', $ns)[1] | $elm) = 1 and
+		name (.) != 'xml' and 
+		((not ($ns = 'http://relaxng.org/ns/structure/1.0') and 
+		//*[namespace-uri (.) = $ns or @ns = $ns or 
+		@*[namespace-uri (.) = $ns]]) or 
+		//*[namespace-uri (.) != 
+		'http://relaxng.org/ns/structure/1.0']//
+		*[namespace-uri (.) = $ns or @*[namespace-uri (.) = $ns]] or
+		key ('prefix', name (.)))">
+		<xsl:call-template name="make-ns-declaration">
+		  <xsl:with-param name="prefix">
+		    <xsl:variable name="mapped">
+		      <xsl:call-template name="mapped-prefix">
+			<xsl:with-param name="ns" select="string (.)"/>
+		      </xsl:call-template>
+		    </xsl:variable>
+		    <xsl:choose>
+		      <xsl:when test="string ($mapped)">
+			<xsl:value-of select="$mapped"/>
+		      </xsl:when>
+		      <xsl:when test="name (.)">
+			<xsl:value-of select="name (.)"/>
+		      </xsl:when>
+		      <xsl:otherwise>
+			<xsl:value-of select="generate-id ($elm)"/>
+		      </xsl:otherwise>
+		    </xsl:choose>
+		  </xsl:with-param>
+		  <xsl:with-param name="uri" select="."/>
+		</xsl:call-template>
+	      </xsl:if>
+	    </xsl:for-each>
+	  </xsl:for-each>
+	</xsl:when>
+
+	<xsl:otherwise>
+	  <xsl:for-each select=".//rng:element | .//rng:attribute">
+	    <xsl:if test="@name [contains (., ':')]">
+	      <xsl:variable name="pfx" select="substring-before (@name, ':')"/>
+	      <xsl:if test="count (key ('prefix', $pfx)[1] | @name) = 1">
+		<xsl:variable name="ns"
+		  select="string (namespace::*[name () = $pfx])"/>
+		<xsl:call-template name="make-ns-declaration">
+		  <xsl:with-param name="prefix">
+		    <xsl:variable name="mapped">
+		      <xsl:call-template name="mapped-prefix">
+			<xsl:with-param name="ns" select="$ns"/>
+		      </xsl:call-template>
+		    </xsl:variable>
+		    <xsl:choose>
+		      <xsl:when test="string ($mapped)">
+			<xsl:value-of select="$mapped"/>
+		      </xsl:when>
+		      <xsl:otherwise>
+			<xsl:value-of select="$pfx"/>
+		      </xsl:otherwise>
+		    </xsl:choose>
+		  </xsl:with-param>
+		  <xsl:with-param name="uri" select="$ns"/>
+		</xsl:call-template>
+	      </xsl:if>
+	    </xsl:if>
+	  </xsl:for-each>
+
+	  <xsl:for-each select="//*[not (self::rng:*)] | 
+	                        //*/@*[namespace-uri (.) != '']">
+	    <xsl:variable name="ns" select="namespace-uri (.)"/>
+	    <xsl:if test="count (key ('annot-ns', $ns)[1] | .) = 1">
+	      <xsl:call-template name="make-ns-declaration">
+		<xsl:with-param name="prefix">
+		  <xsl:variable name="mapped">
+		    <xsl:call-template name="mapped-prefix">
+		      <xsl:with-param name="ns" select="$ns"/>
+		    </xsl:call-template>
+		  </xsl:variable>
+		  <xsl:choose>
+		    <xsl:when test="string ($mapped)">
+		      <xsl:value-of select="$mapped"/>
+		    </xsl:when>
+		    <xsl:otherwise>
+		      <xsl:value-of select="generate-id (.)"/>
+		    </xsl:otherwise>
+		  </xsl:choose>
+		</xsl:with-param>
+		<xsl:with-param name="uri" select="$ns"/>
+	      </xsl:call-template>
+	    </xsl:if>
+	  </xsl:for-each>
+	</xsl:otherwise>
+      </xsl:choose>
+      
+      <xsl:for-each select="//@datatypeLibrary">
+	<xsl:if test=". != $xsd and . != ''">
+	  <declaration size="9">datatypes</declaration>
+	  <sp size="1"/>
+	  <prefix>
+	    <xsl:call-template name="text">
+	      <xsl:with-param name="text" select="generate-id (.)"/>
+	    </xsl:call-template>
+	  </prefix>
+	  <t size="3"> = </t>
+	  <xsl:call-template name="str">
+	    <xsl:with-param name="text" select="."/>
+	  </xsl:call-template>
+	  <nl size="1"/>
+	</xsl:if>
+      </xsl:for-each>
+-->
+      <nl size="1"/>
+         <!-- Pattern -->
+      <xsl:apply-templates mode="RNC"/>
+      </compact-schema>
+  </xsl:template>
+  <xsl:template match="/rng:grammar">
+      <grammar>
+         <xsl:apply-templates mode="RNC"/>
+      </grammar>
+  </xsl:template>
+  <xsl:template name="make-block">
+      <xsl:param name="head"/>
+      <xsl:param name="body"/>
+      <xsl:param name="collapse" select="true ()"/>
+      <group>
+         <xsl:if test="not ($collapse)">
+            <xsl:attribute name="collapse">no</xsl:attribute>
+         </xsl:if>
+         <xsl:copy-of select="$head"/>
+         <nl size="1"/>
+         <t size="1">{</t>
+         <indent>
+            <nl size="1"/>
+            <xsl:copy-of select="$body"/>
+         </indent>
+         <nl size="1"/>
+         <t size="1">}</t>
+      </group>
+  </xsl:template>
+  <xsl:template name="make-parenthesis">
+      <xsl:param name="body"/>
+      <t size="1">(</t>
+      <indent>
+         <nl size="1"/>
+         <xsl:copy-of select="$body"/>
+      </indent>
+      <nl size="1"/>
+      <t size="1">)</t>
+  </xsl:template>
+  <xsl:template match="rng:grammar" mode="RNC">
+      <grammar>
+         <group>
+            <xsl:call-template name="annotations"/>
+            <xsl:call-template name="make-block">
+               <xsl:with-param name="collapse" select="false ()"/>
+               <xsl:with-param name="head">
+                  <keyword size="7">grammar</keyword>
+               </xsl:with-param>
+               <xsl:with-param name="body">
+                  <xsl:apply-templates mode="RNC"/>
+               </xsl:with-param>
+            </xsl:call-template>
+         </group>
+      </grammar>
+  </xsl:template>
+  <xsl:template match="rng:list | rng:mixed" mode="RNC">
+      <group>
+         <xsl:call-template name="annotations"/>
+         <xsl:call-template name="make-block">
+            <xsl:with-param name="head">
+               <keyword>
+                  <xsl:call-template name="text">
+                     <xsl:with-param name="text" select="local-name (.)"/>
+                  </xsl:call-template>
+               </keyword>
+            </xsl:with-param>
+            <xsl:with-param name="body">
+               <xsl:call-template name="group-body"/>
+            </xsl:with-param>
+         </xsl:call-template>
+      </group>
+  </xsl:template>
+  <xsl:template match="rng:start" mode="RNC">
+      <xsl:call-template name="annotations"/>
+      <group>
+         <define size="5">
+            <xsl:copy-of select="@combine"/>
+            <xsl:text>start</xsl:text>
+         </define>
+         <xsl:call-template name="assignment-op"/>
+         <indent>
+            <nl size="1"/>
+            <xsl:call-template name="group-body"/>
+         </indent>
+      </group>
+      <xsl:call-template name="spacer"/>
+  </xsl:template>
+  <xsl:template name="assignment-op">
+      <xsl:choose>
+         <xsl:when test="@combine = 'choice'">
+            <t size="3"> |=</t>
+         </xsl:when>
+         <xsl:when test="@combine = 'interleave'">
+            <t size="3"> &amp;=</t>
+         </xsl:when>
+         <xsl:otherwise>
+            <t size="2"> =</t>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <xsl:template match="rng:define" mode="RNC">
+      <xsl:variable name="grammar" select="ancestor::rng:grammar [1]"/>
+      <xsl:call-template name="annotations"/>
+      <group>
+         <define name="{@name}">
+            <xsl:copy-of select="@combine"/>
+            <xsl:call-template name="text">
+               <xsl:with-param name="text">
+                  <xsl:call-template name="quote-keyword">
+                     <xsl:with-param name="name" select="@name"/>
+                  </xsl:call-template>
+               </xsl:with-param>
+            </xsl:call-template>
+         </define>
+         <xsl:call-template name="assignment-op"/>
+         <indent>
+            <nl size="1"/>
+            <xsl:call-template name="group-body"/>
+         </indent>
+      </group>
+      <xsl:call-template name="spacer"/>
+  </xsl:template>
+  <xsl:template match="rng:div" mode="RNC">
+      <xsl:call-template name="annotations"/>
+      <xsl:call-template name="make-block">
+         <xsl:with-param name="collapse" select="false ()"/>
+         <xsl:with-param name="head">
+            <keyword size="3">div</keyword>
+         </xsl:with-param>
+         <xsl:with-param name="body">
+            <xsl:apply-templates mode="RNC"/>
+         </xsl:with-param>
+      </xsl:call-template>
+      <xsl:call-template name="spacer"/>
+  </xsl:template>
+  <xsl:template match="rng:include" mode="RNC">
+      <xsl:call-template name="annotations"/>
+      <group collapse="no">
+         <keyword size="7">include</keyword>
+         <sp size="1"/>
+         <include-href ref="{generate-id ()}">
+            <xsl:call-template name="external"/>
+         </include-href>
+         <xsl:if test="*">
+            <nl size="1"/>
+            <t size="1">{</t>
+            <indent>
+               <nl size="1"/>
+               <xsl:apply-templates mode="RNC"/>
+            </indent>
+            <nl size="1"/>
+            <t size="1">}</t>
+         </xsl:if>
+      </group>
+      <xsl:call-template name="spacer"/>
+      <xsl:if test="$recursive">
+         <include href="{@href}" id="{generate-id ()}">
+            <xsl:for-each select="document (@href)/rng:grammar">
+               <xsl:call-template name="make-compact-schema"/>
+            </xsl:for-each>
+         </include>
+      </xsl:if>
+  </xsl:template>
+  <xsl:template match="rng:externalRef" mode="RNC">
+      <group>
+         <xsl:call-template name="annotations"/>
+         <keyword size="8">external</keyword>
+         <sp size="1"/>
+         <external-href ref="{generate-id ()}">
+            <xsl:call-template name="external"/>
+         </external-href>
+      </group>
+      <xsl:if test="$recursive">
+         <external href="{@href}" id="{generate-id ()}">
+            <xsl:for-each select="document (@href)">
+               <xsl:call-template name="make-compact-schema"/>
+            </xsl:for-each>
+         </external>
+      </xsl:if>
+  </xsl:template>
+  <xsl:template name="make-inherit">
+      <xsl:param name="prefix"/>
+      <sp size="1"/>
+      <keyword size="7">inherit</keyword>
+      <t size="3"> = </t>
+      <prefix>
+         <xsl:call-template name="text">
+            <xsl:with-param name="text" select="$prefix"/>
+         </xsl:call-template>
+      </prefix>
+  </xsl:template>
+  <xsl:template name="rewrite-suffix">
+      <xsl:param name="href" select="@href"/>
+      <xsl:variable name="suffix" select="substring ($href, (string-length ($href) - 4) + 1, 4)"/>
+      <xsl:choose>
+         <xsl:when test="$rewrite-suffix and $suffix = '.rng'">
+            <xsl:value-of select="substring ($href, 1, string-length ($href) - 4)"/>
+            <xsl:text>.rnc</xsl:text>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:value-of select="$href"/>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <xsl:template name="external">
+      <xsl:call-template name="str">
+         <xsl:with-param name="text">
+            <xsl:call-template name="rewrite-suffix"/>
+         </xsl:with-param>
+      </xsl:call-template>
+      <xsl:variable name="ns" select="ancestor-or-self::*[@ns][1]/@ns"/>
+      <xsl:choose>
+         <xsl:when test="$has-default-ns and $ns = $default-ns"/>
+         <xsl:when test="$has-local and $ns = ''">
+            <xsl:call-template name="make-inherit">
+               <xsl:with-param name="prefix">local</xsl:with-param>
+            </xsl:call-template>
+         </xsl:when>
+         <xsl:when test="not($ns='')">
+            <xsl:call-template name="make-inherit">
+               <xsl:with-param name="prefix">
+                  <xsl:call-template name="get-prefix">
+                     <xsl:with-param name="nd" select="$ns"/>
+                  </xsl:call-template>
+               </xsl:with-param>
+            </xsl:call-template>
+         </xsl:when>
+         <xsl:when test="$has-default-ns">
+            <xsl:call-template name="make-inherit">
+               <xsl:with-param name="prefix">inh</xsl:with-param>
+            </xsl:call-template>
+         </xsl:when>
+      </xsl:choose>
+  </xsl:template>
+  <xsl:template match="rng:ref" mode="RNC">
+      <group>
+         <xsl:call-template name="annotations"/>
+         <ref name="{@name}">
+            <xsl:call-template name="text">
+               <xsl:with-param name="text">
+                  <xsl:call-template name="quote-keyword">
+                     <xsl:with-param name="name" select="@name"/>
+                  </xsl:call-template>
+               </xsl:with-param>
+            </xsl:call-template>
+         </ref>
+      </group>
+  </xsl:template>
+  <xsl:template match="rng:parentRef" mode="RNC">
+      <group>
+         <xsl:call-template name="annotations"/>
+         <keyword size="6">parent</keyword>
+         <sp size="1"/>
+         <parent-ref name="{@name}">
+            <xsl:call-template name="text">
+               <xsl:with-param name="text">
+                  <xsl:call-template name="quote-keyword">
+                     <xsl:with-param name="name" select="@name"/>
+                  </xsl:call-template>
+               </xsl:with-param>
+            </xsl:call-template>
+         </parent-ref>
+      </group>
+  </xsl:template>
+  <xsl:template match="rng:element | rng:attribute" mode="RNC">
+      <group>
+         <xsl:call-template name="annotations"/>
+         <group>
+            <xsl:variable name="head">
+               <keyword>
+                  <xsl:call-template name="text">
+                     <xsl:with-param name="text" select="local-name (.)"/>
+                  </xsl:call-template>
+               </keyword>
+               <sp size="1"/>
+               <xsl:call-template name="name-class">
+                  <xsl:with-param name="is-attr" select="boolean (self::rng:attribute)"/>
+               </xsl:call-template>
+            </xsl:variable>
+            <xsl:choose>
+               <xsl:when test="not (rng:*) or (count (rng:*) = 1 and not (@name))">
+                  <xsl:copy-of select="$head"/>
+                  <t size="3"> { </t>
+                  <atom size="4">text</atom>
+                  <t size="2"> }</t>
+               </xsl:when>
+               <xsl:otherwise>
+                  <xsl:call-template name="make-block">
+                     <xsl:with-param name="head">
+                        <xsl:copy-of select="$head"/>
+                     </xsl:with-param>
+                     <xsl:with-param name="body">
+                        <xsl:choose>
+                           <xsl:when test="@name">
+                              <xsl:call-template name="group-body"/>
+                           </xsl:when>
+                           <xsl:otherwise>
+                              <xsl:call-template name="group-body">
+                                 <xsl:with-param name="patterns" select="rng:*[1]/following-sibling::rng:*"/>
+                              </xsl:call-template>
+                           </xsl:otherwise>
+                        </xsl:choose>
+                     </xsl:with-param>
+                  </xsl:call-template>
+               </xsl:otherwise>
+            </xsl:choose>
+         </group>
+      </group>
+  </xsl:template>
+  <xsl:template name="expression">
+      <xsl:param name="operator"/>
+      <xsl:param name="is-prefix-operator" select="false ()"/>
+      <group>
+         <xsl:call-template name="annotations"/>
+         <group>
+            <xsl:variable name="need-paren-rtf">
+               <xsl:call-template name="need-paren"/>
+            </xsl:variable>
+            <xsl:variable name="need-paren" select="boolean (string ($need-paren-rtf))"/>
+            <xsl:choose>
+               <xsl:when test="$need-paren">
+                  <xsl:call-template name="make-parenthesis">
+                     <xsl:with-param name="body">
+                        <xsl:call-template name="expression-body">
+                           <xsl:with-param name="operator" select="$operator"/>
+                           <xsl:with-param name="is-prefix-operator" select="$is-prefix-operator"/>
+                        </xsl:call-template>
+                     </xsl:with-param>
+                  </xsl:call-template>
+               </xsl:when>
+               <xsl:otherwise>
+                  <xsl:call-template name="expression-body">
+                     <xsl:with-param name="operator" select="$operator"/>
+                     <xsl:with-param name="is-prefix-operator" select="$is-prefix-operator"/>
+                  </xsl:call-template>
+               </xsl:otherwise>
+            </xsl:choose>
+         </group>
+      </group>
+  </xsl:template>
+  <xsl:template match="rng:group" mode="RNC">
+      <xsl:call-template name="expression">
+         <xsl:with-param name="operator" select="','"/>
+      </xsl:call-template>
+  </xsl:template>
+  <xsl:template match="rng:choice" mode="RNC" name="make-choice">
+      <xsl:call-template name="expression">
+         <xsl:with-param name="operator" select="'| '"/>
+         <xsl:with-param name="is-prefix-operator" select="true ()"/>
+      </xsl:call-template>
+  </xsl:template>
+  <xsl:template match="rng:interleave" mode="RNC">
+      <xsl:call-template name="expression">
+         <xsl:with-param name="operator" select="'&amp; '"/>
+         <xsl:with-param name="is-prefix-operator" select="true ()"/>
+      </xsl:call-template>
+  </xsl:template>
+  <xsl:template match="rng:optional" mode="RNC">
+      <xsl:call-template name="expression">
+         <xsl:with-param name="operator" select="','"/>
+      </xsl:call-template>
+      <t size="1">?</t>
+  </xsl:template>
+  <xsl:template match="rng:zeroOrMore" mode="RNC">
+      <xsl:call-template name="expression">
+         <xsl:with-param name="operator" select="','"/>
+      </xsl:call-template>
+      <t size="1">*</t>
+  </xsl:template>
+  <xsl:template match="rng:oneOrMore" mode="RNC">
+      <xsl:call-template name="expression">
+         <xsl:with-param name="operator" select="','"/>
+      </xsl:call-template>
+      <t size="1">+</t>
+  </xsl:template>
+  <xsl:template match="rng:text" mode="RNC">
+      <group>
+         <xsl:call-template name="annotations"/>
+         <atom size="4">text</atom>
+      </group>
+  </xsl:template>
+  <xsl:template match="rng:empty" mode="RNC">
+      <group>
+         <xsl:call-template name="annotations"/>
+         <atom size="5">empty</atom>
+      </group>
+  </xsl:template>
+  <xsl:template match="rng:notAllowed" mode="RNC">
+      <group>
+         <xsl:call-template name="annotations"/>
+         <atom size="10">notAllowed</atom>
+      </group>
+  </xsl:template>
+  <xsl:template match="rng:data" mode="RNC">
+      <group>
+         <xsl:call-template name="annotations"/>
+         <group>
+            <xsl:call-template name="type-name"/>
+            <xsl:if test="rng:param">
+               <nl size="1"/>
+               <t size="1">{</t>
+               <indent>
+                  <xsl:for-each select="rng:param">
+                     <nl size="1"/>
+                     <group>
+                        <xsl:call-template name="annotations"/>
+                        <param>
+                           <xsl:call-template name="text">
+                              <xsl:with-param name="text" select="@name"/>
+                           </xsl:call-template>
+                        </param>
+                        <t size="3"> = </t>
+                        <xsl:call-template name="make-string-literal"/>
+                     </group>
+                  </xsl:for-each>
+               </indent>
+               <nl size="1"/>
+               <t size="1">}</t>
+            </xsl:if>
+            <xsl:for-each select="rng:except">
+               <nl size="1"/>
+               <t size="1">-</t>
+               <nl size="1"/>
+               <xsl:choose>
+                  <xsl:when test="count (rng:*) &gt; 1">
+                     <xsl:call-template name="make-choice"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:apply-templates select="*" mode="RNC"/>
+                  </xsl:otherwise>
+               </xsl:choose>
+            </xsl:for-each>
+         </group>
+      </group>
+  </xsl:template>
+  <xsl:template match="rng:value" mode="RNC">
+      <group>
+         <xsl:call-template name="annotations"/>
+         <xsl:variable name="type">
+            <xsl:call-template name="type-name"/>
+         </xsl:variable>
+         <xsl:if test="$type != 'token'">
+            <xsl:copy-of select="$type"/>
+            <sp size="1"/>
+         </xsl:if>
+         <xsl:call-template name="make-string-literal"/>
+      </group>
+  </xsl:template>
+  <xsl:template name="quote-quotes">
+      <xsl:param name="str"/>
+      <xsl:param name="pos" select="1"/>
+      <xsl:variable name="c" select="substring ($str, $pos, 1)"/>
+      <xsl:if test="$c">
+         <xsl:choose>
+            <xsl:when test="$c = '&#34;'">" '"' "</xsl:when>
+            <xsl:when test="$c = '&#xA;'">\x{A}</xsl:when>
+            <xsl:when test="$c = '&#xD;'">\x{D}</xsl:when>
+            <xsl:otherwise>
+               <xsl:value-of select="$c"/>
+            </xsl:otherwise>
+         </xsl:choose>
+         <xsl:call-template name="quote-quotes">
+            <xsl:with-param name="str" select="$str"/>
+            <xsl:with-param name="pos" select="$pos + 1"/>
+         </xsl:call-template>
+      </xsl:if>
+  </xsl:template>
+  <xsl:template name="make-string-literal">
+      <xsl:choose>
+         <xsl:when test="not (contains (., '&#34;') or   contains (., &#34;'&#34;) or   contains (., '&#xA;') or contains (., '&#xD;'))">
+            <xsl:call-template name="str">
+               <xsl:with-param name="text" select="."/>
+            </xsl:call-template>
+         </xsl:when>
+         <xsl:when test="not (contains (., '&#34;&#34;&#34;'))">
+            <xsl:call-template name="str">
+               <xsl:with-param name="quote" select="'&#34;&#34;&#34;'"/>
+               <xsl:with-param name="text" select="."/>
+               <xsl:with-param name="is-multiline" select="true ()"/>
+            </xsl:call-template>
+         </xsl:when>
+         <xsl:when test="not (contains (., &#34;'''&#34;))">
+            <xsl:call-template name="str">
+               <xsl:with-param name="quote">'''</xsl:with-param>
+               <xsl:with-param name="text" select="."/>
+               <xsl:with-param name="is-multiline" select="true ()"/>
+            </xsl:call-template>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:call-template name="str">
+               <xsl:with-param name="text">
+                  <xsl:call-template name="quote-quotes">
+                     <xsl:with-param name="str" select="."/>
+                  </xsl:call-template>
+               </xsl:with-param>
+            </xsl:call-template>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <xsl:template name="type-name">
+      <xsl:variable name="dt"
+                    select="ancestor-or-self::rng:*[@datatypeLibrary][1]/@datatypeLibrary"/>
+      <xsl:variable name="dts" select="string ($dt)"/>
+      <type>
+         <xsl:call-template name="text">
+            <xsl:with-param name="text">
+               <xsl:choose>
+                  <xsl:when test="self::rng:value and not (@type)">token</xsl:when>
+                  <xsl:when test="$dts = '' and @type= 'string'">string</xsl:when>
+                  <xsl:when test="$dts = '' and @type= 'token'">token</xsl:when>
+                  <xsl:when test="$dts = ''">
+                     <xsl:text>xsd:</xsl:text>
+                     <xsl:value-of select="@type"/>
+                  </xsl:when>
+                  <xsl:when test="$dts = $xsd">
+                     <xsl:text>xsd:</xsl:text>
+                     <xsl:value-of select="@type"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:value-of select="generate-id ($dt)"/>
+                     <xsl:text>:</xsl:text>
+                     <xsl:value-of select="@type"/>
+                  </xsl:otherwise>
+               </xsl:choose>
+            </xsl:with-param>
+         </xsl:call-template>
+      </type>
+  </xsl:template>
+  <xsl:template name="need-paren">
+      <xsl:choose>
+         <xsl:when test="self::rng:optional or  self::rng:zeroOrMore or  self::rng:oneOrMore">
+            <xsl:if test="count (rng:*) &gt; 1">true</xsl:if>
+         </xsl:when>
+         <xsl:when test="parent::rng:element[not (@name)] or   parent::rng:attribute [not (@name)]">
+            <xsl:if test="count (../rng:*) &gt; 2">true</xsl:if>
+         </xsl:when>
+         <xsl:when test="count (../rng:*) &gt; 1">true</xsl:when>
+         <xsl:when test="count (rng:*) &gt; 1 and (parent::rng:optional or   parent::rng:zeroOrMore or parent::rng:oneOrMore)">true</xsl:when>
+      </xsl:choose>
+  </xsl:template>
+  <xsl:template name="expression-body">
+      <xsl:param name="patterns" select="rng:*"/>
+      <xsl:param name="operator"/>
+      <xsl:param name="is-prefix-operator" select="false ()"/>
+      <xsl:choose>
+         <xsl:when test="$is-prefix-operator">
+            <xsl:for-each select="$patterns">
+               <xsl:if test="position () != 1">
+                  <nl size="1"/>
+                  <op size="{string-length ($operator)}">
+                     <xsl:value-of select="$operator"/>
+                  </op>
+               </xsl:if>
+               <xsl:apply-templates select="." mode="RNC"/>
+               <xsl:call-template name="follow-annotations"/>
+            </xsl:for-each>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:for-each select="$patterns">
+               <xsl:if test="position () != 1">
+                  <op size="{string-length ($operator)}">
+                     <xsl:value-of select="$operator"/>
+                  </op>
+                  <nl size="1"/>
+               </xsl:if>
+               <xsl:apply-templates select="." mode="RNC"/>
+               <xsl:call-template name="follow-annotations"/>
+            </xsl:for-each>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <xsl:template name="group-body">
+      <xsl:param name="patterns" select="rng:*"/>
+      <xsl:call-template name="expression-body">
+         <xsl:with-param name="patterns" select="$patterns"/>
+         <xsl:with-param name="operator" select="','"/>
+      </xsl:call-template>
+  </xsl:template>
+   <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
+<!-- Name class -->
+<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
+  <xsl:template name="name-class">
+      <xsl:param name="is-attr" select="false ()"/>
+      <nc>
+         <xsl:call-template name="text">
+            <xsl:with-param name="text">
+               <xsl:choose>
+                  <xsl:when test="@name">
+                     <xsl:choose>
+                        <xsl:when test="not ($is-attr) and not (contains (@name, ':'))">
+                           <xsl:call-template name="make-name-nc">
+                              <xsl:with-param name="name" select="@name"/>
+                              <xsl:with-param name="is-attr" select="false ()"/>
+                           </xsl:call-template>
+                        </xsl:when>
+                        <xsl:when test="@ns">
+                           <xsl:text>[</xsl:text>
+                           <xsl:value-of select="@ns"/>
+                           <xsl:text>]</xsl:text>
+                           <xsl:value-of select="@name"/>
+                        </xsl:when>
+                        <xsl:otherwise>
+                           <xsl:value-of select="@name"/>
+                        </xsl:otherwise>
+                     </xsl:choose>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:apply-templates select="rng:*[1]" mode="name-class">
+                        <xsl:with-param name="is-attr" select="$is-attr"/>
+                     </xsl:apply-templates>
+                  </xsl:otherwise>
+               </xsl:choose>
+            </xsl:with-param>
+         </xsl:call-template>
+      </nc>
+  </xsl:template>
+  <xsl:template match="rng:name" mode="name-class">
+      <xsl:param name="is-attr"/>
+      <xsl:call-template name="make-name-nc">
+         <xsl:with-param name="name" select="."/>
+         <xsl:with-param name="is-attr" select="$is-attr"/>
+      </xsl:call-template>
+  </xsl:template>
+  <xsl:template match="rng:nsName" mode="name-class">
+      <xsl:param name="is-attr"/>
+      <xsl:variable name="ns" select="ancestor-or-self::rng:*[@ns][1]/@ns"/>
+      <xsl:choose>
+         <xsl:when test="$has-default-ns and $ns = $default-ns">
+            <xsl:value-of select="$default-ns-id"/>
+         </xsl:when>
+         <xsl:when test="$has-local and $ns = ''">local</xsl:when>
+         <xsl:when test="not($ns='')">
+            <xsl:call-template name="get-prefix">
+               <xsl:with-param name="nd" select="$ns"/>
+            </xsl:call-template>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:text>inh</xsl:text>
+         </xsl:otherwise>
+      </xsl:choose>
+      <xsl:text>:*</xsl:text>
+      <xsl:call-template name="nc-except">
+         <xsl:with-param name="is-attr" select="$is-attr"/>
+      </xsl:call-template>
+  </xsl:template>
+  <xsl:template match="rng:anyName" mode="name-class">
+      <xsl:param name="is-attr"/>
+      <xsl:text>*</xsl:text>
+      <xsl:call-template name="nc-except">
+         <xsl:with-param name="is-attr" select="$is-attr"/>
+      </xsl:call-template>
+  </xsl:template>
+  <xsl:template name="nc-except">
+      <xsl:param name="is-attr"/>
+      <xsl:for-each select="rng:except">
+         <xsl:text> - </xsl:text>
+         <xsl:choose>
+            <xsl:when test="count (rng:*) &gt; 1">
+               <xsl:text>(</xsl:text>
+               <xsl:call-template name="make-nc-choice">
+                  <xsl:with-param name="is-attr" select="$is-attr"/>
+               </xsl:call-template>
+               <xsl:text>)</xsl:text>
+            </xsl:when>
+            <xsl:otherwise>
+               <xsl:apply-templates select="rng:*" mode="name-class">
+                  <xsl:with-param name="is-attr" select="$is-attr"/>
+               </xsl:apply-templates>
+            </xsl:otherwise>
+         </xsl:choose>
+      </xsl:for-each>
+  </xsl:template>
+  <xsl:template match="rng:attribute/rng:choice | rng:element/rng:choice" mode="name-class"
+                 name="make-nc-choice">
+      <xsl:param name="is-attr"/>
+      <xsl:for-each select="rng:*">
+         <xsl:if test="position () != 1">
+            <xsl:text> | </xsl:text>
+         </xsl:if>
+         <xsl:apply-templates select="." mode="name-class">
+            <xsl:with-param name="is-attr" select="$is-attr"/>
+         </xsl:apply-templates>
+      </xsl:for-each>
+  </xsl:template>
+  <xsl:template match="rng:choice" mode="name-class">
+      <xsl:param name="is-attr"/>
+      <xsl:text>(</xsl:text>
+      <xsl:call-template name="make-nc-choice">
+         <xsl:with-param name="is-attr" select="$is-attr"/>
+      </xsl:call-template>
+      <xsl:text>)</xsl:text>
+  </xsl:template>
+  <xsl:template name="make-name-nc">
+      <xsl:param name="is-attr"/>
+      <xsl:param name="name"/>
+      <xsl:variable name="ns" select="ancestor-or-self::rng:*[@ns][1]/@ns"/>
+      <xsl:choose>
+         <xsl:when test="not ($is-attr) and $has-default-ns and  $ns = $default-ns"/>
+         <xsl:when test="$is-attr and $ns = ''"/>
+         <xsl:when test="$is-attr and not($default-ns-id='') and $has-default-ns and $ns = $default-ns">
+            <xsl:value-of select="$default-ns-id"/>
+            <xsl:text>:</xsl:text>
+         </xsl:when>
+         <xsl:when test="string-length($ns)&gt;0">
+            <xsl:call-template name="get-prefix">
+               <xsl:with-param name="nd" select="$ns"/>
+            </xsl:call-template>
+            <xsl:text>:</xsl:text>
+         </xsl:when>
+         <!--
+      <xsl:when test="$is-attr or $has-default-ns">
+        <xsl:text>inh:</xsl:text>
+      </xsl:when>
+-->
+    </xsl:choose>
+      <xsl:value-of select="$name"/>
+  </xsl:template>
+   <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
+<!-- Util -->
+<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
+  <xsl:template name="last-token">
+      <xsl:param name="str"/>
+      <xsl:param name="pos" select="string-length ($str)"/>
+      <xsl:choose>
+         <xsl:when test="$pos = 0">
+            <xsl:value-of select="$str"/>
+         </xsl:when>
+         <xsl:when test="substring ($str, $pos, 1) = ' '">
+            <xsl:value-of select="substring ($str, $pos + 1)"/>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:call-template name="last-token">
+               <xsl:with-param name="str" select="$str"/>
+               <xsl:with-param name="pos" select="$pos - 1"/>
+            </xsl:call-template>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <xsl:variable name="simple-prefix-map" select="concat (' ', $prefixes, ' ')"/>
+  <xsl:template name="mapped-prefix">
+      <xsl:param name="ns"/>
+      <xsl:variable name="simple-mapped"
+                    select="substring-before ($simple-prefix-map, concat ('=', $ns, ' '))"/>
+      <xsl:choose>
+         <xsl:when test="$simple-mapped">
+            <xsl:call-template name="last-token">
+               <xsl:with-param name="str" select="$simple-mapped"/>
+            </xsl:call-template>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:variable name="mapped" select="$prefix-map [string (.) = $ns][1]"/>
+            <xsl:if test="$mapped">
+               <xsl:value-of select="$mapped/@prefix"/>
+            </xsl:if>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <xsl:template name="get-prefix">
+      <xsl:param name="nd" select="."/>
+      <xsl:variable name="ns" select="string ($nd)"/>
+      <xsl:variable name="mapped">
+         <xsl:call-template name="mapped-prefix">
+            <xsl:with-param name="ns" select="$ns"/>
+         </xsl:call-template>
+      </xsl:variable>
+      <xsl:choose>
+         <xsl:when test="string ($mapped)">
+            <xsl:value-of select="$mapped"/>
+         </xsl:when>
+         <xsl:when test="not ($retain-prefixes)">
+            <xsl:value-of select="generate-id ($nd)"/>
+         </xsl:when>
+         <xsl:when test="key ('ns', $ns)">
+           <xsl:variable name="pfx" select="name ( (key ('ns', $ns)/namespace::*[. = $ns])[1] )"/>
+           <xsl:choose>
+               <xsl:when test="$pfx">
+                  <xsl:value-of select="$pfx"/>
+               </xsl:when>
+               <xsl:otherwise>
+                  <xsl:value-of select="generate-id (key ('ns', $ns)[1])"/>
+               </xsl:otherwise>
+            </xsl:choose>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:value-of select="generate-id ($nd)"/>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <xsl:template name="spacer">
+      <xsl:if test="following-sibling::*">
+         <nl size="1"/>
+         <xsl:if test="not (parent::rng:include) and  not (parent::rng:grammar/../..) and   not (self::rng:include and   following-sibling::*[1][self::rng:include])">
+            <nl size="1"/>
+         </xsl:if>
+      </xsl:if>
+  </xsl:template>
+  <keywords xmlns="http://www.example.com">
+      <kw>attribute</kw>
+      <kw>default</kw>
+      <kw>datatypes</kw>
+      <kw>div</kw>
+      <kw>element</kw>
+      <kw>empty</kw>
+      <kw>external</kw>
+      <kw>grammar</kw>
+      <kw>include</kw>
+      <kw>inherit</kw>
+      <kw>list</kw>
+      <kw>mixed</kw>
+      <kw>namespace</kw>
+      <kw>notAllowed</kw>
+      <kw>parent</kw>
+      <kw>start</kw>
+      <kw>string</kw>
+      <kw>text</kw>
+      <kw>token</kw>
+  </keywords>
+  <xsl:variable xmlns:foo="http://www.example.com" name="keywords"  select="document ('')/*/foo:keywords/*"/>
+  <xsl:template name="quote-keyword">
+      <xsl:param name="name"/>
+      <xsl:if test="$name = $keywords">\</xsl:if>
+      <xsl:value-of select="$name"/>
+  </xsl:template>
+   <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
+<!-- Annotations -->
+<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
+  <xsl:template name="leading-documentation">
+      <xsl:param name="nd"/>
+      <!--
+    <xsl:choose>
+      <xsl:when test="not ($nd) or $nd/self::rng:*"/>
+
+      <xsl:when test="$nd/self::a:documentation">
+	<xsl:call-template name="doc-comment">
+	  <xsl:with-param name="comment" select="string ($nd)"/>
+	</xsl:call-template>
+	<nl size="1"/>
+	<xsl:call-template name="leading-documentation">
+	  <xsl:with-param name="nd" select="$nd/following-sibling::*[1]"/>
+	</xsl:call-template>
+      </xsl:when>
+
+      <xsl:otherwise>
+	<group>
+	  <t size="1">[</t>
+	  <indent>
+	    <xsl:call-template name="annotation-attributes"/>
+
+	    <xsl:call-template name="leading-annotations">
+	      <xsl:with-param name="nd" select="$nd"/>
+	    </xsl:call-template>
+	  </indent>
+	  <nl size="1"/>
+	  <t size="1">]</t>
+	</group>
+	<nl size="1"/>
+      </xsl:otherwise>
+    </xsl:choose>
+-->
+  </xsl:template>
+  <xsl:template name="leading-annotations">
+      <xsl:param name="nd"/>
+      <xsl:if test="$nd and not ($nd/self::rng:*)">
+         <xsl:for-each select="$nd">
+            <xsl:call-template name="annotation-element"/>
+         </xsl:for-each>
+         <xsl:call-template name="leading-annotations">
+            <xsl:with-param name="nd" select="$nd/following-sibling::*[1]"/>
+         </xsl:call-template>
+      </xsl:if>
+  </xsl:template>
+  <xsl:template name="annotations">
+<!--
+    <xsl:choose>
+      <xsl:when test="(self::rng:value or self::rng:param) and
+	following-sibling::*[1][not (self::rng:*)]">
+	<xsl:call-template name="leading-documentation">
+	  <xsl:with-param name="nd" select="following-sibling::*[1]"/>
+	</xsl:call-template>
+      </xsl:when>
+      <xsl:when test="*[1][not (self::rng:*)]">
+	<xsl:call-template name="leading-documentation">
+	  <xsl:with-param name="nd" select="*[1]"/>
+	</xsl:call-template>
+      </xsl:when>
+      <xsl:when test="@*[namespace-uri () != '']">
+	<group>
+	  <t size="1">[</t>
+	  <indent>
+	    <xsl:call-template name="annotation-attributes"/>
+	  </indent>
+	  <nl size="1"/>
+	  <t size="1">]</t>
+	</group>
+	<nl size="1"/>
+      </xsl:when>
+    </xsl:choose>
+-->
+  </xsl:template>
+  <xsl:template name="doc-comment">
+      <xsl:param name="comment"/>
+      <!--
+    <xsl:if test="$comment">
+      <xsl:variable name="head" select="substring-before ($comment, '&#10;')"/>
+      <xsl:variable name="line">
+	<xsl:text>## </xsl:text>
+	<xsl:choose>
+	  <xsl:when test="$head">
+	    <xsl:value-of select="$head"/>
+	  </xsl:when>
+	  <xsl:otherwise>
+	    <xsl:value-of select="$comment"/>
+	  </xsl:otherwise>
+	</xsl:choose>
+      </xsl:variable>
+      
+      <doc>
+	<xsl:call-template name="text">
+	  <xsl:with-param name="text" select="$line"/>
+	</xsl:call-template>
+      </doc>
+      <nl size="1"/>
+      <xsl:call-template name="doc-comment">
+	<xsl:with-param name="comment"
+	  select="substring-after ($comment, '&#10;')"/>
+      </xsl:call-template>
+    </xsl:if>
+-->
+  </xsl:template>
+  <xsl:template match="rng:grammar/a:documentation | rng:div/a:documentation |     rng:include/a:documentation"
+                 priority="-15">
+      <xsl:if test="not (../../..) or        preceding-sibling::*[not (self::a:documentation)]">
+         <xsl:call-template name="annotation-element"/>
+      </xsl:if>
+  </xsl:template>
+  <xsl:template match="rng:grammar/* | rng:div/* | rng:include/*" priority="-20">
+      <xsl:call-template name="annotation-element"/>
+  </xsl:template>
+  <xsl:template name="follow-annotations">
+      <xsl:param name="nd"
+                 select="self::*[not (self::rng:value or self::rng:param)]       /following-sibling::*[1][not (self::rng:*)]"/>
+      <xsl:if test="$nd">
+         <xsl:for-each select="$nd">
+            <nl size="1"/>
+            <xsl:call-template name="follow-annotation"/>
+            <xsl:call-template name="follow-annotations"/>
+         </xsl:for-each>
+      </xsl:if>
+  </xsl:template>
+  <xsl:template match="rng:*" priority="-100" name="follow-annotation">
+      <xsl:if test="preceding-sibling::rng:*">
+         <t size="2">&gt;&gt;</t>
+         <xsl:call-template name="annotation-element"/>
+      </xsl:if>
+  </xsl:template>
+  <xsl:template name="annotation-name">
+      <annot>
+         <xsl:call-template name="text">
+            <xsl:with-param name="text">
+               <xsl:variable name="ns" select="namespace-uri (.)"/>
+               <xsl:if test="not($ns='')">
+                  <xsl:variable name="mapped">
+                     <xsl:call-template name="mapped-prefix">
+                        <xsl:with-param name="ns" select="$ns"/>
+                     </xsl:call-template>
+                  </xsl:variable>
+                  <xsl:choose>
+                     <xsl:when test="string ($mapped)">
+                        <xsl:value-of select="$mapped"/>
+                     </xsl:when>
+                     <xsl:when test="$retain-prefixes">
+                       <xsl:variable name="pfx" select="name ( (key ('ns', $ns)/namespace::*[. = $ns])[1] )"/>
+                       <xsl:choose>
+                           <xsl:when test="$pfx">
+                              <xsl:value-of select="$pfx"/>
+                           </xsl:when>
+                           <xsl:otherwise>
+                              <xsl:value-of select="generate-id (key ('ns', $ns)[1])"/>
+                           </xsl:otherwise>
+                        </xsl:choose>
+                     </xsl:when>
+                     <xsl:otherwise>
+                        <xsl:value-of select="generate-id (key ('annot-ns', $ns)[1])"/>
+                     </xsl:otherwise>
+                  </xsl:choose>
+                  <xsl:text>:</xsl:text>
+               </xsl:if>
+               <xsl:value-of select="local-name (.)"/>
+            </xsl:with-param>
+         </xsl:call-template>
+      </annot>
+  </xsl:template>
+  <xsl:template name="annotation-attributes">
+      <xsl:for-each select="@*[namespace-uri () != '']">
+         <nl size="1"/>
+         <xsl:call-template name="annotation-name"/>
+         <t size="3"> = </t>
+         <xsl:call-template name="make-string-literal"/>
+      </xsl:for-each>
+  </xsl:template>
+  <xsl:template match="rng:*" name="annotation-element" mode="annot">
+      <nl size="1"/>
+      <group>
+         <xsl:call-template name="annotation-name"/>
+         <nl size="1"/>
+         <t size="1">[</t>
+         <indent>
+            <xsl:for-each select="@*">
+               <nl size="1"/>
+               <xsl:call-template name="annotation-name"/>
+               <t size="3"> = </t>
+               <xsl:call-template name="make-string-literal"/>
+            </xsl:for-each>
+            <xsl:apply-templates mode="annot"/>
+         </indent>
+         <nl size="1"/>
+         <t size="1">]</t>
+      </group>
+      <xsl:if test="following-sibling::*">
+         <xsl:if test="parent::rng:grammar or parent::rng:div or   parent::rng:include">
+            <nl size="1"/>
+            <xsl:if test="following-sibling::*[1][self::rng:*]">
+               <nl size="1"/>
+            </xsl:if>
+         </xsl:if>
+      </xsl:if>
+  </xsl:template>
+  <xsl:template match="text ()" mode="annot">
+      <nl size="1"/>
+      <xsl:call-template name="make-string-literal"/>
+  </xsl:template>
+  <xsl:template name="make-body-from-r-t-f">
+      <xsl:param name="schema"/>
+      <xsl:for-each select="$schema">
+         <xsl:call-template name="make-body"/>
+      </xsl:for-each>
+  </xsl:template>
+  <xsl:template name="make-body">
+      <xsl:apply-templates mode="keep"/>
+  </xsl:template>
+  <xsl:template match="group" mode="keep">
+      <xsl:choose>
+         <xsl:when test="  not ($collapse-lines) or   @collapse = 'no' or  .//doc or   .//group [@collapse = 'no']">
+            <xsl:apply-templates mode="keep"/>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:variable name="size" select="sum (.//*/@size)"/>
+            <xsl:variable name="level" select="count (ancestor::indent)"/>
+            <xsl:choose>
+               <xsl:when test="$line-width &gt; ($size + ($level * $indent-width))">
+                  <xsl:apply-templates mode="flatten"/>
+               </xsl:when>
+               <xsl:otherwise>
+                  <xsl:apply-templates mode="keep"/>
+               </xsl:otherwise>
+            </xsl:choose>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <xsl:template match="sp" mode="keep">
+      <xsl:text> </xsl:text>
+  </xsl:template>
+  <xsl:variable name="spaces"
+                 select="concat (     '                                        ',     '                                        '     )"/>
+  <xsl:template match="nl" mode="keep">
+      <xsl:text>&#10;</xsl:text>
+      <xsl:variable name="level" select="count (ancestor::indent)"/>
+      <xsl:variable name="following-op" select="following-sibling::*[1][self::op]"/>
+      <xsl:choose>
+         <xsl:when test="$following-op">
+            <xsl:value-of select="substring ($spaces, 1,     $level * $indent-width - $following-op/@size)"/>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:value-of select="substring ($spaces, 1, $level * $indent-width)"/>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <xsl:template match="sp | nl" mode="flatten">
+      <xsl:text> </xsl:text>
+  </xsl:template>
+  <xsl:template match="ref" mode="flatten">
+      <xsl:variable name="me">
+         <xsl:choose>
+            <xsl:when test="contains(@name,'.attributes')">
+               <xsl:value-of select="substring-before(@name,'.attributes')"/>
+            </xsl:when>
+            <xsl:when test="contains(@name,'.content')">
+               <xsl:value-of select="substring-before(.,'.content')"/>
+            </xsl:when>
+            <xsl:when test="contains(@name,'.attribute.')">
+               <xsl:value-of select="substring-before(@name,'.attribute.')"/>
+            </xsl:when>
+            <xsl:otherwise>
+               <xsl:value-of select="@name"/>
+            </xsl:otherwise>
+         </xsl:choose>
+      </xsl:variable>
+      <!--
+<xsl:message>FROM <xsl:value-of select="@name"/> to <xsl:value-of
+    select="$me"/>, <xsl:for-each select="$top"><xsl:value-of 
+select="count(key('IDENTS',$me))"/></xsl:for-each></xsl:message>
+-->
+    <xsl:variable name="n" select="@name"/>
+      <xsl:choose>
+         <xsl:when test="contains(.,'.localattributes')">
+            <xsl:value-of select="$n"/>
+         </xsl:when>
+         <xsl:when test="contains(@name,'.content')">
+            <xsl:value-of select="$n"/>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:for-each select="$top">
+               <xsl:call-template name="linkTogether">
+                  <xsl:with-param name="name">
+                     <xsl:value-of select="$me"/>
+                  </xsl:with-param>
+                  <xsl:with-param name="reftext">
+                     <xsl:value-of select="$n"/>
+                  </xsl:with-param>
+               </xsl:call-template>
+            </xsl:for-each>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+</xsl:transform>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/odds2/RngToRnc.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/odds2/odd2html.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/odds2/odd2html.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/odds2/odd2html.xsl	(revision 258)
@@ -0,0 +1,217 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:s="http://www.ascc.net/xml/schematron" xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dbk="http://docbook.org/ns/docbook" xmlns:rng="http://relaxng.org/ns/structure/1.0" xmlns:tei="http://www.tei-c.org/ns/1.0" xmlns:teix="http://www.tei-c.org/ns/Examples" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:sch="http://purl.oclc.org/dsdl/schematron" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" exclude-result-prefixes="xlink dbk rng tei teix s xhtml sch a html xs xsl">
+  <xsl:import href="teiodds.xsl"/>
+  <xsl:import href="../xhtml2/tei.xsl"/>
+  <xsl:import href="../xhtml2/oddprocessing.xsl"/>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+    <desc>
+      <p> TEI stylesheet for making HTML from ODD </p>
+      <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+      <p>Author: See AUTHORS</p>
+      <p>Id: $Id: odd2html.xsl 9669 2011-11-07 19:17:54Z rahtz $</p>
+      <p>Copyright: 2011, TEI Consortium</p>
+    </desc>
+  </doc>
+  <xsl:output method="xml" encoding="utf-8"/>
+  <xsl:param name="BITS">Bits</xsl:param>
+  <xsl:param name="STDOUT">true</xsl:param>
+  <xsl:param name="TAG"/>
+  <xsl:param name="alignNavigationPanel">left</xsl:param>
+  <xsl:param name="authorWord"/>
+  <xsl:param name="autoToc">true</xsl:param>
+  <xsl:param name="bottomNavigationPanel">true</xsl:param>
+  <xsl:param
+      name="cssFile">http://www.tei-c.org/release/xml/tei/stylesheet/tei.css</xsl:param>
+  <xsl:param name="dateWord"/>
+  <xsl:param name="displayMode">rnc</xsl:param>
+  <xsl:param name="feedbackWords">Contact</xsl:param>
+  <xsl:param name="footnoteBackLink">true</xsl:param>
+  <xsl:param name="footnoteFile">false</xsl:param>
+  <xsl:param name="homeURL">index.html</xsl:param>
+  <xsl:param name="indent-width" select="3"/>
+  <xsl:param name="line-width" select="80"/>
+  <xsl:param name="numberBackHeadings">A.1</xsl:param>
+  <xsl:param name="numberFrontHeadings"/>
+  <xsl:param name="pageLayout">Simple</xsl:param>
+  <xsl:param name="prenumberedHeadings">false</xsl:param>
+  <xsl:param name="searchURL"/>
+  <xsl:param name="searchWords"/>
+  <xsl:param name="showNamespaceDecls">false</xsl:param>
+  <xsl:param name="showTitleAuthor">1</xsl:param>
+  <xsl:param name="splitBackmatter">yes</xsl:param>
+  <xsl:param name="splitFrontmatter">yes</xsl:param>
+  <xsl:param name="splitLevel">-1</xsl:param>
+  <xsl:param name="subTocDepth">-1</xsl:param>
+  <xsl:param name="tocDepth">3</xsl:param>
+  <xsl:param name="tocElement">div</xsl:param>
+  <xsl:param name="topNavigationPanel"/>
+  <xsl:param name="useHeaderFrontMatter">true</xsl:param>
+  <xsl:param name="verbose">false</xsl:param>
+  <xsl:param name="doctypePublic">-//W3C//DTD XHTML 1.1//EN</xsl:param>
+  <xsl:param name="doctypeSystem">http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd</xsl:param>
+
+  <!-- these are ones to override -->
+  <xsl:param name="feedbackURL">#</xsl:param>
+  <xsl:param name="homeLabel">Home</xsl:param>
+  <xsl:param name="homeWords">Home</xsl:param>
+  <xsl:param name="institution"/>
+  <xsl:param name="outputDir"/>
+  <xsl:param name="parentURL">http://www.example.com/</xsl:param>
+  <xsl:param name="parentWords"/>
+
+  <xsl:template name="copyrightStatement"/>
+
+  <xsl:template match="processing-instruction()"/>
+
+  <xsl:template name="headingNumberSuffix">
+    <xsl:text> </xsl:text>
+  </xsl:template>
+
+  <xsl:template match="tei:divGen[@type='toc']">
+    <xsl:call-template name="mainTOC"/>
+  </xsl:template>
+
+  <xsl:template name="oddTocEntry">
+    <xsl:variable name="loc">
+      <xsl:choose>
+        <xsl:when test="number($splitLevel)=-1 or $STDOUT='true'">
+          <xsl:text>#</xsl:text>
+          <xsl:value-of select="@ident"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:text>ref-</xsl:text>
+          <xsl:value-of select="@ident"/>
+          <xsl:value-of select="$outputSuffix"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <div class="oddTocEntry">
+      <a href="{$loc}">
+        <xsl:value-of select="@ident"/>
+      </a>
+    </div>
+  </xsl:template>
+
+  <xsl:template match="tei:divGen[@type='index']"/>
+
+  <xsl:template name="logoPicture">
+    <img src="jaco001d.gif" alt="" width="180"/>
+  </xsl:template>
+
+  <xsl:template name="hdr2">
+    <xsl:comment>no nav </xsl:comment>
+  </xsl:template>
+
+  <xsl:template match="tei:hi[@rend='math']">
+    <span class="math">
+      <xsl:apply-templates/>
+    </span>
+  </xsl:template>
+
+  <xsl:template name="makeHTMLHeading">
+    <xsl:param name="text"/>
+    <xsl:param name="class">title</xsl:param>
+    <xsl:param name="level">1</xsl:param>
+    <xsl:if test="not($text='')">
+      <xsl:choose>
+        <xsl:when test="$level='1'">
+          <xsl:element name="h1">
+            <xsl:attribute name="class">
+              <xsl:value-of select="$class"/>
+            </xsl:attribute>
+            <a href="index.html">
+              <xsl:value-of select="$text"/>
+            </a>
+          </xsl:element>
+        </xsl:when>
+
+        <xsl:otherwise>
+          <xsl:element name="h{$level}">
+            <xsl:attribute name="class">
+              <xsl:value-of select="$class"/>
+            </xsl:attribute>
+            <xsl:value-of select="$text"/>
+          </xsl:element>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template name="formatHeadingNumber">
+    <xsl:param name="text"/>
+    <xsl:param name="toc"/>
+    <span class="headingNumber">
+      <xsl:choose>
+        <xsl:when test="$toc =''">
+          <xsl:copy-of select="$text"/>
+        </xsl:when>
+        <xsl:when test="number(normalize-space($text))&lt;10">
+          <xsl:text> </xsl:text>
+          <xsl:copy-of select="$text"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:copy-of select="$text"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </span>
+  </xsl:template>
+
+  <xsl:template name="navInterSep"> </xsl:template>
+
+  <xsl:template name="generateSubTitle">
+    <xsl:value-of select="tei:head"/>
+  </xsl:template>
+
+  <xsl:template name="printLink"/>
+
+  <xsl:template match="tei:titlePage" mode="paging">
+    <xsl:apply-templates select="."/>
+  </xsl:template>
+
+  <xsl:template name="generateEndLink">
+      <xsl:param name="where"/>
+      <xsl:choose>
+	<xsl:when test="id($where)">
+	  <xsl:apply-templates mode="generateLink" select="id($where)"/>
+	</xsl:when>
+	<xsl:otherwise>
+	  <xsl:text>[ID </xsl:text>
+	  <xsl:value-of select="$where"/>
+	  <xsl:text> in TEI Guidelines]</xsl:text>
+	</xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/odds2/odd2html.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/odds2/odd2odd.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/odds2/odd2odd.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/odds2/odd2odd.xsl	(revision 258)
@@ -0,0 +1,2351 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet 
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+    xmlns:sch="http://purl.oclc.org/dsdl/schematron" 
+    xmlns:s="http://www.ascc.net/xml/schematron" 
+    xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
+    xmlns:rng="http://relaxng.org/ns/structure/1.0"
+    xmlns:tei="http://www.tei-c.org/ns/1.0" 
+    xmlns:teix="http://www.tei-c.org/ns/Examples" 
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+    version="2.0" 
+    exclude-result-prefixes="teix a s tei xs rng sch xsi">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+    <desc>
+      <p> TEI stylesheet for simplifying TEI ODD markup </p>
+      <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+      <p>Author: See AUTHORS</p>
+      <p>Id: $Id: odd2odd.xsl 10148 2012-03-06 23:51:20Z rahtz $</p>
+      <p>Copyright: 2011, TEI Consortium</p>
+    </desc>
+  </doc>
+  <xsl:output encoding="utf-8" indent="no"/>
+  <xsl:param name="autoGlobal">false</xsl:param>
+  <xsl:param name="selectedSchema"/>
+  <xsl:param name="verbose"/>
+  <xsl:param name="useVersionFromTEI">true</xsl:param>
+  <xsl:param name="stripped">false</xsl:param>
+  <xsl:param name="configDirectory"/>
+  <xsl:param name="currentDirectory"/>
+  <xsl:param name="defaultSource"></xsl:param>
+  <xsl:param name="defaultTEIVersion">current</xsl:param>
+  <xsl:param name="defaultTEIServer">http://www.tei-c.org/Vault/P5/</xsl:param>
+  <xsl:key name="odd2odd-CLASSREFS" match="tei:classRef" use="@key"/>
+  <xsl:key name="odd2odd-ATTCLASSES" match="tei:classSpec[(tei:attList or @type='atts') and not(@ident='tei.TEIform')]" use="@ident"/>
+  <xsl:key name="odd2odd-CHANGEATT" match="tei:attDef[@mode='change']" use="concat(../../@ident,'_',@ident)"/>
+  <xsl:key name="odd2odd-CHANGECONSTRAINT" match="tei:constraintSpec[@mode='change']" use="concat(../@ident,'_',@ident)"/>
+  <xsl:key name="odd2odd-CLASS_MEMBERED" use="tei:classes/tei:memberOf/@key" match="tei:classSpec"/>
+  <xsl:key name="odd2odd-ATTREFS" match="tei:attRef" use="concat(@name,'_',../../@ident)"/>
+  <xsl:key name="odd2odd-DELETEATT" match="tei:attDef[@mode='delete']" use="concat(ancestor::tei:elementSpec/@ident,'_',@ident)"/>
+  <xsl:key name="odd2odd-DELETEATT" match="tei:attDef[@mode='delete']" use="concat(ancestor::tei:classSpec/@ident,'_',@ident)"/>
+  <xsl:key name="odd2odd-DELETECONSTRAINT" match="tei:constraintSpec[@mode='delete']" use="concat(../@ident,'_',@ident)"/>
+
+  <xsl:key name="odd2odd-ELEMENT_MEMBERED" use="tei:classes/tei:memberOf/@key" match="tei:elementSpec"/>
+  <xsl:key name="odd2odd-IDS" match="tei:*[@xml:id]" use="@xml:id"/>
+  <xsl:key name="odd2odd-MACROS" use="@ident" match="tei:macroSpec"/>
+  <xsl:key name="odd2odd-MEMBEROFADD" match="tei:memberOf[not(@mode='delete')]" use="concat(../../@ident,@key)"/>
+  <xsl:key name="odd2odd-MEMBEROFDELETE" match="tei:memberOf[@mode='delete']" use="concat(../../@ident,@key)"/>
+  <xsl:key name="odd2odd-MODULES" match="tei:moduleRef" use="@key"/>
+  <xsl:key name="odd2odd-NEWATTCLASSES" match="tei:classSpec[@type='atts' and @mode='add']" use="@ident"/>
+  <xsl:key name="odd2odd-REFED" use="@name" match="rng:ref[parent::tei:datatype]"/>
+  <xsl:key name="odd2odd-REFED" use="@name" match="rng:ref[ancestor::tei:elementSpec]"/>
+  <xsl:key name="odd2odd-REFED" use="@name" match="rng:ref[ancestor::tei:macroSpec and not(@name=ancestor::tei:macroSpec/@ident)]"/>
+  <xsl:key name="odd2odd-REFED" use="substring-before(@name,'.attribute')" match="tei:attRef"/>
+  <xsl:key name="odd2odd-REFED" use="substring-before(@name,'_')" match="rng:ref[contains(@name,'_')]"/>
+  <xsl:key name="odd2odd-REPLACEATT" match="tei:attDef[@mode='replace']" use="concat(../../@ident,'_',@ident)"/>
+  <xsl:key name="odd2odd-REPLACECONSTRAINT" match="tei:constraintSpec[@mode='replace']" use="concat(../@ident,'_',@ident)"/>
+
+  <xsl:key name="odd2odd-MODULE_MEMBERS" match="tei:macroSpec"  use="@module"/>
+  <xsl:key name="odd2odd-MODULE_MEMBERS" match="tei:classSpec"  use="@module"/>
+  <xsl:key name="odd2odd-MODULE_MEMBERS" match="tei:elementSpec" use="@module"/>
+
+  <xsl:key name="odd2odd-MODULE_MEMBERS_MODEL" match="tei:classSpec" use="@module"/>
+
+  <xsl:key name="odd2odd-SCHEMASPECS" match="tei:schemaSpec" use="@ident"/>
+
+  <xsl:key name="odd2odd-IDENTS" match="tei:macroSpec" use="@ident"/>
+  <xsl:key name="odd2odd-IDENTS" match="tei:classSpec" use="@ident"/>
+  <xsl:key name="odd2odd-IDENTS" match="tei:elementSpec" use="@ident"/>
+
+   <!-- all of these use a combination of @ident _and_ @ns (where
+   present), in case of duplication of names across schemes -->
+
+  <xsl:key name="odd2odd-CHANGE" match="tei:classSpec[@mode='change']" use="concat(@ns,@ident)"/>
+  <xsl:key name="odd2odd-CHANGE" match="tei:elementSpec[@mode='change']" use="concat(@ns,@ident)"/>
+  <xsl:key name="odd2odd-CHANGE" match="tei:macroSpec[@mode='change']" use="concat(@ns,@ident)"/>
+  <xsl:key name="odd2odd-DELETE" match="tei:classSpec[@mode='delete']" use="concat(@ns,@ident)"/>
+  <xsl:key name="odd2odd-DELETE" match="tei:elementSpec[@mode='delete']" use="concat(@ns,@ident)"/>
+  <xsl:key name="odd2odd-DELETE" match="tei:macroSpec[@mode='delete']" use="concat(@ns,@ident)"/>
+  <xsl:key name="odd2odd-REPLACE" match="tei:classSpec[@mode='replace']" use="concat(@ns,@ident)"/>
+  <xsl:key name="odd2odd-REPLACE" match="tei:elementSpec[@mode='replace']" use="concat(@ns,@ident)"/>
+  <xsl:key name="odd2odd-REPLACE" match="tei:macroSpec[@mode='replace']" use="concat(@ns,@ident)"/>
+
+  <xsl:variable name="DEFAULTSOURCE">
+    <xsl:choose>
+      <xsl:when test="$defaultSource != ''">
+        <xsl:value-of select="$defaultSource"/>
+      </xsl:when>
+      <xsl:when test="$configDirectory != ''">
+        <xsl:value-of select="$configDirectory"/>
+        <xsl:text>odd/p5subset.xml</xsl:text>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$defaultTEIServer"/>
+        <xsl:value-of select="$defaultTEIVersion"/>
+	<xsl:text>/xml/tei/odd/p5subset.xml</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+  
+  <xsl:variable name="ODD">
+    <xsl:for-each select="/tei:TEI">
+      <xsl:copy>
+	<xsl:attribute name="xml:base" select="document-uri(/)"/>
+        <xsl:copy-of select="@*"/>
+        <xsl:if test="$useVersionFromTEI='true'">
+          <xsl:processing-instruction name="TEIVERSION">
+            <xsl:call-template name="odd2odd-getversion"/>
+          </xsl:processing-instruction>
+        </xsl:if>
+        <xsl:apply-templates mode="odd2odd-pass0"/>
+      </xsl:copy>
+    </xsl:for-each>
+  </xsl:variable>
+
+  <xsl:variable name="top" select="/"/>
+
+
+  <xsl:template match="/">
+    <xsl:if test="$autoGlobal='true'">
+      <xsl:message>NOTE: all TEI elements will have global attributes added automatically</xsl:message>
+    </xsl:if>
+    <!--
+    <xsl:result-document href="/tmp/foo.xml">
+      <xsl:copy-of select="$ODD"/>
+    </xsl:result-document>
+    -->
+    <xsl:for-each select="$ODD">
+      <xsl:apply-templates mode="odd2odd-pass1"/>
+    </xsl:for-each>
+  </xsl:template>
+
+  <!-- ******************* Pass 0, follow and expand specGrp ********************************* -->
+  <xsl:template match="tei:specGrp" mode="odd2odd-pass0">
+    <xsl:if test="$verbose='true'">
+      <xsl:message>Phase 0: summarize specGrp <xsl:value-of select="@xml:id"/>
+      </xsl:message>
+    </xsl:if>
+    <table xmlns="http://www.tei-c.org/ns/1.0">
+      <xsl:for-each select="*">
+        <row>
+          <xsl:choose>
+            <xsl:when test="self::tei:specGrpRef">
+              <cell>
+                <ref target="#{@target}">reference <xsl:value-of select="@target"/></ref>
+              </cell>
+              <cell/>
+            </xsl:when>
+            <xsl:when test="self::tei:elementSpec">
+              <cell>
+		Element <gi><xsl:value-of select="@ident"/></gi>
+	      </cell>
+              <cell>
+                <xsl:value-of select="@mode"/>
+              </cell>
+            </xsl:when>
+            <xsl:when test="self::tei:classSpec">
+              <cell>
+		Class <ident type="class"><xsl:value-of select="@ident"/></ident>
+	      </cell>
+              <cell>
+                <xsl:value-of select="@mode"/>
+              </cell>
+            </xsl:when>
+            <xsl:when test="self::tei:macroSpec">
+              <cell>
+		Macro <ident type="macro"><xsl:value-of select="@ident"/></ident>
+	      </cell>
+              <cell>
+                <xsl:value-of select="@mode"/>
+              </cell>
+            </xsl:when>
+            <xsl:when test="self::tei:moduleRef">
+              <cell>
+		Module <xsl:value-of select="@key"/>
+	      </cell>
+              <cell/>
+	    </xsl:when>
+          </xsl:choose>
+        </row>
+      </xsl:for-each>
+    </table>
+  </xsl:template>
+
+  <xsl:template match="tei:schemaSpec" mode="odd2odd-pass0">
+    <xsl:if test="@ident=$selectedSchema or ($selectedSchema='' and not(preceding-sibling::tei:schemaSpec))">
+      <xsl:copy>
+	<xsl:copy-of select="@*"/>
+	<xsl:choose>
+	<xsl:when test="@source">
+	<xsl:if test="$verbose='true'">
+	  <xsl:message>Source for TEI is <xsl:value-of select="@source"/></xsl:message>
+	</xsl:if>
+	</xsl:when>
+	<xsl:otherwise>
+	  <xsl:if test="$verbose='true'">
+	    <xsl:message>Source for TEI will be set to <xsl:value-of select="$DEFAULTSOURCE"/> </xsl:message>
+	  </xsl:if>
+	  <xsl:attribute name="source">
+	    <xsl:value-of select="$DEFAULTSOURCE"/>
+	  </xsl:attribute>
+	</xsl:otherwise>
+	</xsl:choose>
+	<xsl:apply-templates select="*|text()|processing-instruction()" mode="odd2odd-pass0"/>
+      </xsl:copy>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template match="tei:specGrpRef" mode="odd2odd-pass0">
+    <xsl:if test="$verbose='true'">
+      <xsl:message>Phase 0: expand specGrpRef <xsl:value-of
+      select="@target"/> </xsl:message>
+    </xsl:if>
+    <xsl:choose>
+      <xsl:when test="starts-with(@target,'#')">
+	<xsl:apply-templates  mode="odd2odd-pass0"
+			      select="id(substring(@target,2))/*"/>
+      </xsl:when>
+      <xsl:otherwise>
+    <xsl:if test="$verbose='true'">
+      <xsl:message> ... read from <xsl:value-of select="resolve-uri(@target,base-uri(/tei:TEI))"/></xsl:message>
+    </xsl:if>
+
+	<xsl:for-each 
+	    select="doc(resolve-uri(@target,base-uri(/tei:TEI)))">
+	  <xsl:choose>
+	    <xsl:when test="tei:specGrp">
+	      <xsl:apply-templates select="tei:specGrp/*" mode="odd2odd-pass0"/>
+	    </xsl:when>
+	    <xsl:otherwise>
+	      <xsl:apply-templates  mode="odd2odd-pass0"/>
+	    </xsl:otherwise>
+	  </xsl:choose>
+	</xsl:for-each>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  
+  <xsl:template match="text()|@*" mode="odd2odd-pass0">
+      <xsl:copy-of select="."/>
+  </xsl:template>
+  
+  <xsl:template match="processing-instruction()" mode="odd2odd-pass0">
+      <xsl:copy-of select="."/>
+  </xsl:template>
+
+  <xsl:template match="*" mode="odd2odd-pass0">
+    <xsl:copy>
+      <xsl:copy-of select="@*"/>
+      <xsl:apply-templates select="*|text()|processing-instruction()" mode="odd2odd-pass0"/>
+    </xsl:copy>
+  </xsl:template>
+
+
+  <!-- ******************* Pass 1, follow schemaSpec ********************************* -->
+  <xsl:template match="@*|processing-instruction()|text()" mode="odd2odd-pass1">
+    <xsl:copy-of select="."/>
+  </xsl:template>
+
+  <xsl:template match="*" mode="odd2odd-pass1">
+    <xsl:copy>
+      <xsl:apply-templates mode="odd2odd-pass1" select="*|@*|processing-instruction()|text()"/>
+    </xsl:copy>
+  </xsl:template>
+
+  <xsl:template match="tei:schemaSpec" mode="odd2odd-pass1">
+    <xsl:variable name="sourceDoc" select="tei:workOutSource(.)"/>
+
+    <xsl:variable name="oddsource">
+      <xsl:copy>
+        <xsl:copy-of select="@*"/>
+        <xsl:if test="$verbose='true'">
+          <xsl:message>Schema <xsl:value-of select="@ident"/></xsl:message>
+        </xsl:if>
+        <!-- 
+	     it is important to process "tei" and "core" first 
+	     because of the order of declarations
+	-->
+	<xsl:for-each select="tei:moduleRef[@key='tei']">
+	  <xsl:call-template name="odd2odd-expandModule">
+	    <xsl:with-param name="Source" select="$sourceDoc" tunnel="yes"/>
+	  </xsl:call-template>
+	</xsl:for-each>
+	
+	<xsl:for-each select="tei:moduleRef[@key='core']">
+	  <xsl:call-template name="odd2odd-expandModule">
+	    <xsl:with-param name="Source" select="$sourceDoc"
+			tunnel="yes"/>
+	  </xsl:call-template>
+	</xsl:for-each>
+	
+	<xsl:for-each select="tei:moduleRef[@key]">
+	  <xsl:if test="not(@key='tei' or @key='core')">
+	    <xsl:call-template name="odd2odd-expandModule">
+	    <xsl:with-param name="Source" select="$sourceDoc"
+			tunnel="yes"/>
+	  </xsl:call-template>
+	  </xsl:if>
+	</xsl:for-each>
+	
+	<xsl:for-each select="tei:macroRef|tei:classRef|tei:elementRef">
+	    <xsl:call-template name="odd2odd-followRef">
+	  </xsl:call-template>
+	</xsl:for-each>
+
+	<xsl:for-each select="tei:classSpec[@mode='add' or not(@mode)]">
+	  <xsl:call-template name="odd2odd-createCopy">
+	    <xsl:with-param name="Source" select="$sourceDoc"
+			tunnel="yes"/>
+	  </xsl:call-template>
+	</xsl:for-each>
+
+	<xsl:for-each select="tei:macroSpec[@mode='add' or not(@mode)]">
+	  <xsl:call-template name="odd2odd-createCopy">
+	    <xsl:with-param name="Source" select="$sourceDoc"
+			tunnel="yes"/>
+	  </xsl:call-template>
+	</xsl:for-each>
+
+	<xsl:for-each select="tei:elementSpec[@mode='add' or not(@mode)]">
+	  <xsl:call-template name="odd2odd-createCopy">
+	    <xsl:with-param name="Source" select="$sourceDoc"
+			tunnel="yes"/>
+	  </xsl:call-template>
+	</xsl:for-each>
+
+	<xsl:apply-templates mode="odd2odd-justcopy" select="tei:moduleRef[@url]"/>
+
+      </xsl:copy>
+
+    </xsl:variable>
+    <xsl:for-each select="$oddsource">
+      <xsl:apply-templates mode="odd2odd-pass2"/>
+    </xsl:for-each>
+    <!-- constraints -->
+    <xsl:apply-templates mode="odd2odd-copy" select="tei:constraintSpec"/>
+  </xsl:template>
+
+
+  <xsl:template name="odd2odd-expandModule">
+    <xsl:variable name="sourceDoc" select="tei:workOutSource(.)"/>
+    <xsl:variable name="name" select="@key"/>
+    <xsl:variable name="exc"
+		  select="concat(' ',normalize-space(@except),' ')"/>
+    <xsl:variable name="inc"  
+		  select="concat('/',translate(normalize-space(@include),' ','/'),'/')"/>
+      <xsl:choose>
+	<xsl:when test="not(@except) and not(@include)">
+	  <xsl:for-each select="document($sourceDoc,$top)">
+	    <xsl:for-each select="key('odd2odd-MODULE_MEMBERS',$name)">
+	      <xsl:call-template name="odd2odd-checkObject">
+		<xsl:with-param name="Source" select="$sourceDoc" tunnel="yes"/>
+		<xsl:with-param name="why"> module <xsl:value-of select="$name"/></xsl:with-param>
+	      </xsl:call-template>
+	    </xsl:for-each>
+	  </xsl:for-each>
+	</xsl:when>
+	<xsl:when test="@include">
+	  <xsl:if test="$verbose='true'">
+	    <xsl:message>Process module reference to [<xsl:value-of
+	    select="@key"/>] with inclusion of [<xsl:value-of
+	    select="@include"/>]</xsl:message>
+	  </xsl:if>
+	  <!-- get model and attribute classes regardless -->
+	  <xsl:for-each select="document($sourceDoc,$top)">
+	    <xsl:for-each
+		select="key('odd2odd-MODULE_MEMBERS_MODEL',$name)">
+	      <xsl:call-template name="odd2odd-checkObject">
+		<xsl:with-param name="Source" select="$sourceDoc" tunnel="yes"/>
+		<xsl:with-param name="why">module (auto from include) <xsl:value-of select="$name"/></xsl:with-param>
+	      </xsl:call-template>
+	    </xsl:for-each>
+	    <xsl:for-each
+		select="key('odd2odd-MODULE_MEMBERS',$name)">
+	      <xsl:choose>
+		<xsl:when test="self::tei:classSpec"/>
+		<xsl:when test="contains($inc,concat('/',@ident,'/'))">
+		  <xsl:call-template name="odd2odd-checkObject">
+		    <xsl:with-param name="Source" select="$sourceDoc" tunnel="yes"/>
+		    <xsl:with-param name="why">(inclusion) module <xsl:value-of select="$name"/></xsl:with-param>
+		  </xsl:call-template>
+		</xsl:when>
+	      </xsl:choose>
+	    </xsl:for-each>
+	  </xsl:for-each>
+	</xsl:when>
+	<xsl:otherwise>
+	  <xsl:if test="$verbose='true'">
+	    <xsl:message>Process module reference to [<xsl:value-of
+	    select="@key"/>] with exclusion of [<xsl:value-of select="@except"/>]</xsl:message>
+	  </xsl:if>
+	  <xsl:for-each select="document($sourceDoc,$top)">
+	    <xsl:for-each select="key('odd2odd-MODULE_MEMBERS',$name)">
+	      <xsl:if test="not(contains($exc,concat(' ',@ident,' ')))">
+		<xsl:call-template name="odd2odd-checkObject">
+		  <xsl:with-param name="Source" select="$sourceDoc" tunnel="yes"/>
+		  <xsl:with-param name="why">(exclusion) module <xsl:value-of select="$name"/></xsl:with-param>
+		</xsl:call-template>
+	      </xsl:if>
+	    </xsl:for-each>
+	    </xsl:for-each>
+	</xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="odd2odd-followRef">
+    <xsl:variable name="sourceDoc" select="tei:workOutSource(.)"/>
+    <xsl:variable name="name" select="@key"/>
+    <xsl:for-each select="document($sourceDoc,$top)">
+      <xsl:choose>
+	<xsl:when test="key('odd2odd-IDENTS',$name)">
+	  <xsl:for-each select="key('odd2odd-IDENTS',$name)">
+	    <xsl:call-template name="odd2odd-checkObject">
+		<xsl:with-param name="Source" select="$sourceDoc" tunnel="yes"/>
+		<xsl:with-param name="why">direct reference</xsl:with-param>
+	    </xsl:call-template>
+	  </xsl:for-each>
+	</xsl:when>
+	<xsl:otherwise>
+	<xsl:call-template name="die">
+	  <xsl:with-param name="message">
+	    <xsl:text>Reference to </xsl:text>
+	    <xsl:value-of select="$name"/>
+	    <xsl:text>: not found in source</xsl:text>
+	  </xsl:with-param>
+	</xsl:call-template>
+	</xsl:otherwise>
+      </xsl:choose>
+    </xsl:for-each>
+  </xsl:template>
+
+<!-- pass2 -->      
+  <xsl:template match="rng:ref" mode="odd2odd-pass2">
+    <xsl:variable name="N">
+      <xsl:value-of select="@name"/>
+    </xsl:variable>
+    <xsl:choose>
+      <xsl:when test="starts-with($N,'macro.') and $stripped='true'">
+        <xsl:for-each select="key('odd2odd-MACROS',$N)/tei:content/*">
+          <xsl:call-template name="odd2odd-simplifyRelax"/>
+        </xsl:for-each>
+      </xsl:when>
+      <xsl:otherwise>
+	<ref xmlns="http://relaxng.org/ns/structure/1.0">
+	  <xsl:apply-templates select="@*|*|text()|processing-instruction()" mode="odd2odd-pass2"/>
+	</ref>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="tei:valDesc|tei:equiv|tei:gloss|tei:desc|tei:remarks|tei:exemplum|tei:listRef" mode="odd2odd-pass2">
+    <xsl:choose>
+      <xsl:when test="$stripped='true'"> </xsl:when>
+      <xsl:otherwise>
+        <xsl:copy>
+	  <xsl:apply-templates select="@*|*|text()|processing-instruction()" mode="odd2odd-pass2"/>
+	</xsl:copy>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="tei:ptr" mode="odd2odd-pass2">
+    <xsl:choose>
+      <xsl:when test="starts-with(@target,'#') and 
+		      (ancestor::tei:remarks or ancestor::tei:listRef or ancestor::tei:valDesc) and
+		      not(id(substring(@target,2)))">
+	<xsl:variable name="target" select="substring(@target,2)"/>
+	<xsl:variable name="sourceDoc" select="tei:workOutSource(.)"/>
+
+	<xsl:choose>
+	  <xsl:when test="document($sourceDoc)/id($target)">
+	    <ref  xmlns="http://www.tei-c.org/ns/1.0"
+		  target="http://www.tei-c.org/release/doc/tei-p5-doc/en/html/{substring($target,1,2)}.html#{$target}">
+	      <xsl:for-each select="document($DEFAULTSOURCE)/id($target)">
+		<xsl:number count="tei:div" format="1.1.1."
+			    level="multiple"/>	  
+		<xsl:text> </xsl:text>
+		<xsl:value-of select="tei:head"/>
+	      </xsl:for-each>
+	    </ref>
+	  </xsl:when>
+	  <xsl:otherwise>
+	    <xsl:copy>
+	      <xsl:apply-templates select="@*|*|text()|processing-instruction()" mode="odd2odd-pass2"/>
+	    </xsl:copy>
+	  </xsl:otherwise>
+	</xsl:choose>
+      </xsl:when>
+      <xsl:otherwise>
+	<xsl:copy>
+	  <xsl:apply-templates select="@*|*|text()|processing-instruction()" mode="odd2odd-pass2"/>
+	</xsl:copy>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="@*|text()|comment()" mode="odd2odd-pass2">
+    <xsl:copy-of select="."/>
+  </xsl:template>
+
+  <xsl:template match="*" mode="odd2odd-pass2">
+    <xsl:copy>
+      <xsl:copy-of select="@*"/>
+      <xsl:apply-templates mode="odd2odd-pass2"/>
+    </xsl:copy>
+  </xsl:template>
+
+  <xsl:template match="tei:content" mode="odd2odd-pass2">
+    <xsl:variable name="content">
+      <xsl:copy>
+        <xsl:copy-of select="@*"/>
+        <xsl:apply-templates mode="odd2odd-pass2"/>
+      </xsl:copy>
+    </xsl:variable>
+    <xsl:apply-templates select="$content" mode="odd2odd-pass3"/>
+  </xsl:template>
+
+
+  <xsl:template match="tei:classSpec" mode="odd2odd-pass2">
+    <xsl:variable name="used">
+      <xsl:call-template name="odd2odd-amINeeded"/>
+    </xsl:variable>
+    <xsl:choose>
+      <xsl:when test="$used=''">
+        <xsl:if test="$verbose='true'">
+          <xsl:message>Reject unused class <xsl:value-of select="@ident"/>
+               </xsl:message>
+        </xsl:if>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:copy>
+          <xsl:copy-of select="@*"/>
+          <xsl:apply-templates mode="odd2odd-pass2"/>
+        </xsl:copy>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <xsl:template name="odd2odd-amINeeded">
+    <!--
+How can a class be ok?
+  a) if an element is a member of it
+  b) if its referred to in a content model
+  c) if some other class is a member of it, and that class is OK
+-->
+    <xsl:variable name="k" select="@ident"/>
+    <xsl:choose>
+      <xsl:when test="$autoGlobal='true' and starts-with(@ident,'att.global')">y</xsl:when>
+      <xsl:when test="self::tei:classSpec and $stripped='true'">y</xsl:when>
+      <xsl:when test="key('odd2odd-ELEMENT_MEMBERED',$k)">y</xsl:when>
+      <xsl:when test="key('odd2odd-REFED',$k)">y</xsl:when>
+      <xsl:when test="key('odd2odd-CLASS_MEMBERED',$k)">
+        <xsl:for-each select="key('odd2odd-CLASS_MEMBERED',$k)">
+          <xsl:call-template name="odd2odd-amINeeded"/>
+        </xsl:for-each>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:template>
+  <xsl:template match="tei:macroSpec" mode="odd2odd-pass2">
+    <xsl:variable name="k">
+      <xsl:value-of select="@prefix"/>
+      <xsl:value-of select="@ident"/>
+    </xsl:variable>
+    <xsl:choose>
+      <xsl:when test="$stripped='true' and starts-with($k,'macro.')"/>
+      <xsl:when test="key('odd2odd-REFED',$k)">
+	<macroSpec xmlns="http://www.tei-c.org/ns/1.0" >
+          <xsl:copy-of select="@*"/>
+          <xsl:apply-templates mode="odd2odd-pass2"/>
+	</macroSpec>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:if test="$verbose='true'">
+          <xsl:message>Reject unused macro <xsl:value-of select="$k"/></xsl:message>
+        </xsl:if>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="odd2odd-checkObject">
+    <xsl:param name="why"/>
+    <xsl:param name="Source" tunnel="yes"/>
+    <!--
+        for every object
+         - if its in DELETE list, ignore
+         - if its in REPLACE list, use that
+         - if its in CHANGE list
+           (do the hard merge bit)
+         - otherwise copy 
+        done
+  -->
+      <xsl:variable name="Current" select="."/>
+      <xsl:variable name="specName">
+	<xsl:choose>
+	  <xsl:when test="@ns">
+	    <xsl:value-of select="@ns"/>
+	  </xsl:when>
+	  <xsl:when test="ancestor::tei:schemaSpec/@ns">
+	    <xsl:value-of select="ancestor::tei:schemaSpec/@ns"/>
+	  </xsl:when>
+	</xsl:choose>
+	<xsl:value-of select="@ident"/>
+      </xsl:variable>
+      <xsl:variable name="N" select="local-name(.)"/>
+      <xsl:for-each select="$ODD">
+        <xsl:choose>
+          <xsl:when test="key('odd2odd-DELETE',$specName)">
+            <xsl:if test="$verbose='true'">
+              <xsl:message>Phase 1: remove <xsl:value-of select="$specName"/></xsl:message>
+            </xsl:if>
+          </xsl:when>
+	  <xsl:when test="key('odd2odd-REPLACE',$specName)">
+            <xsl:if test="$verbose='true'">
+              <xsl:message>Phase 1: replace <xsl:value-of select="$specName"/></xsl:message>
+            </xsl:if>
+            <xsl:apply-templates mode="odd2odd-copy" select="key('odd2odd-REPLACE',$specName)"/>
+          </xsl:when>
+          <xsl:when test="key('odd2odd-CHANGE',$specName)">
+            <xsl:if test="$verbose='true'">
+              <xsl:message>Phase 1: change <xsl:value-of select="$specName"/></xsl:message>
+            </xsl:if>
+            <xsl:apply-templates mode="odd2odd-change" select="$Current"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:if test="$verbose='true'">
+	      <xsl:message>Phase 1: include <xsl:value-of
+	      select="$specName"/> from <xsl:value-of
+	      select="$Source"/> (<xsl:value-of select="$why"/>)</xsl:message>
+            </xsl:if>
+            <xsl:apply-templates mode="odd2odd-copy" select="$Current"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:for-each>
+  </xsl:template>
+
+  <xsl:template match="@*|processing-instruction()|text()" mode="odd2odd-change">
+    <xsl:copy-of select="."/>
+  </xsl:template>
+
+  <xsl:template match="*" mode="odd2odd-change">
+    <xsl:copy>
+      <xsl:apply-templates mode="odd2odd-change" select="*|@*|processing-instruction()|text()"/>
+    </xsl:copy>
+  </xsl:template>
+
+  <xsl:template match="@*|processing-instruction()|text()" mode="odd2odd-copy">
+    <xsl:copy-of select="."/>
+  </xsl:template>
+
+  <xsl:template match="tei:memberOf" mode="odd2odd-copy">
+    <xsl:variable name="k" select="@key"/>
+    <xsl:choose>
+      <xsl:when test="$ODD/key('odd2odd-DELETE',$k)"/>      
+      <xsl:otherwise>
+	<memberOf xmlns="http://www.tei-c.org/ns/1.0" key="{$k}">
+	  <xsl:copy-of select="@min|@max"/>
+	</memberOf>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="*" mode="odd2odd-copy">
+    <xsl:copy>
+      <xsl:apply-templates mode="odd2odd-copy" select="*|@*|processing-instruction()|text()"/>
+    </xsl:copy>
+  </xsl:template>
+
+  <xsl:template match="tei:elementSpec/@mode" mode="odd2odd-change">
+    <xsl:copy/>
+  </xsl:template>
+
+  <xsl:template match="tei:listRef" mode="odd2odd-copy"/>
+
+  <xsl:template match="tei:elementSpec" mode="odd2odd-copy">
+    <xsl:copy>
+      <xsl:choose>
+	<xsl:when test="@module"/>
+	<xsl:when test="ancestor::tei:schemaSpec/@module">
+	  <xsl:copy-of select="ancestor::tei:schemaSpec/@module"/>
+	</xsl:when>
+	<xsl:otherwise>
+	  <xsl:attribute name="module">
+	    <xsl:text>derived-module-</xsl:text>
+	    <xsl:value-of select="ancestor::tei:schemaSpec/@ident"/>
+	  </xsl:attribute>
+	</xsl:otherwise>
+      </xsl:choose>
+      <xsl:call-template name="odd2odd-copyElementSpec">
+	<xsl:with-param name="n" select="'1'"/>
+      </xsl:call-template>
+    </xsl:copy>
+  </xsl:template>
+
+  <xsl:template name="odd2odd-copyElementSpec">
+    <xsl:param name="n"/>
+    <xsl:param name="Source" tunnel="yes"/>
+      <xsl:variable name="orig" select="."/>
+      <xsl:apply-templates mode="odd2odd-copy" select="@*"/>
+      <xsl:apply-templates mode="odd2odd-justcopy" select="tei:altIdent"/>
+      <xsl:if test="$stripped='false'">
+        <xsl:apply-templates mode="odd2odd-copy" select="tei:equiv"/>
+        <xsl:apply-templates mode="odd2odd-justcopy" select="tei:gloss"/>
+        <xsl:apply-templates mode="odd2odd-justcopy" select="tei:desc"/>
+      </xsl:if>
+      <xsl:apply-templates mode="odd2odd-justcopy" select="tei:classes"/>
+      <xsl:apply-templates mode="odd2odd-copy" select="tei:content"/>
+      <xsl:apply-templates mode="odd2odd-copy" select="tei:constraintSpec"/>
+      <attList xmlns="http://www.tei-c.org/ns/1.0">
+        <xsl:call-template name="odd2odd-addClassAttsToCopy"/>
+        <xsl:choose>
+          <xsl:when test="tei:attList[@org='choice']">
+            <xsl:for-each select="tei:attList">
+              <xsl:copy>
+                <xsl:copy-of select="@*"/>
+                <xsl:apply-templates mode="odd2odd-justcopy" select="tei:attDef[@mode='add' or not(@mode)]"/>
+                <xsl:apply-templates mode="odd2odd-justcopy" select="tei:attRef"/>
+                <xsl:apply-templates mode="odd2odd-justcopy" select="tei:attList"/>
+              </xsl:copy>
+            </xsl:for-each>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:apply-templates mode="odd2odd-justcopy" select="tei:attList/tei:attDef[@mode='add' or not(@mode)]"/>
+            <xsl:apply-templates mode="odd2odd-justcopy" select="tei:attList/tei:attRef"/>
+            <xsl:apply-templates mode="odd2odd-justcopy" select="tei:attList/tei:attList"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </attList>
+      <xsl:if test="$stripped='false'">
+        <xsl:apply-templates mode="odd2odd-justcopy" select="tei:exemplum"/>
+        <xsl:apply-templates mode="odd2odd-justcopy" select="tei:remarks"/>
+        <xsl:apply-templates mode="odd2odd-justcopy" select="tei:listRef"/>
+      </xsl:if>
+  </xsl:template>
+
+  <xsl:template name="odd2odd-addClassAttsToCopy">
+    <xsl:if test="$autoGlobal='true' and (not(@ns) or @ns='http://www.tei-c.org/ns/1.0' or @ns='http://www.tei-c.org/ns/Examples')">
+      <xsl:call-template name="odd2odd-classAttributes">
+        <xsl:with-param name="whence">1</xsl:with-param>
+        <xsl:with-param name="elementName" select="@ident"/>
+        <xsl:with-param name="className" select="'att.global'"/>
+      </xsl:call-template>
+    </xsl:if>
+    <xsl:for-each select="tei:classes/tei:memberOf">
+      <xsl:call-template name="odd2odd-classAttributes">
+        <xsl:with-param name="whence">2</xsl:with-param>
+        <xsl:with-param name="elementName" select="../../@ident"/>
+        <xsl:with-param name="className" select="@key"/>
+      </xsl:call-template>
+    </xsl:for-each>
+  </xsl:template>
+  <xsl:template match="tei:elementSpec" mode="odd2odd-change">
+    <xsl:variable name="elementName">
+      <xsl:value-of select="concat(@ns,@ident)"/>
+    </xsl:variable>
+
+    <xsl:variable name="ORIGINAL" select="."/>
+    <xsl:copy>
+      <xsl:attribute name="rend">change</xsl:attribute>
+      <xsl:apply-templates mode="odd2odd-change" select="@*"/>
+      <!-- 
+For each element, go through most of the sections one by one
+and see if they are present in the change mode version.
+If so, use them as is. The constraints and attributes are identifiable
+for change individually.
+ -->
+      <xsl:for-each select="$ODD">
+        <xsl:for-each select="key('odd2odd-CHANGE',$elementName)">
+	  <xsl:if test="$verbose='true'">
+	    <xsl:message>Change <xsl:value-of select="$elementName"/></xsl:message>
+	  </xsl:if>
+          <xsl:copy-of select="@ns"/>
+          <!-- if there is an altIdent, use it -->
+          <xsl:apply-templates mode="odd2odd-justcopy" select="tei:altIdent"/>
+          <!-- equiv, gloss, desc trio -->
+          <xsl:choose>
+            <xsl:when test="tei:equiv">
+              <xsl:apply-templates mode="odd2odd-copy" select="tei:equiv"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:for-each select="$ORIGINAL">
+                <xsl:apply-templates mode="odd2odd-copy" select="tei:equiv"/>
+              </xsl:for-each>
+            </xsl:otherwise>
+          </xsl:choose>
+          <xsl:choose>
+            <xsl:when test="tei:gloss">
+              <xsl:apply-templates mode="odd2odd-justcopy" select="tei:gloss"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:for-each select="$ORIGINAL">
+                <xsl:apply-templates mode="odd2odd-justcopy" select="tei:gloss"/>
+              </xsl:for-each>
+            </xsl:otherwise>
+          </xsl:choose>
+          <xsl:choose>
+            <xsl:when test="$stripped='true'"/>
+            <xsl:when test="tei:desc">
+              <xsl:apply-templates mode="odd2odd-justcopy" select="tei:desc"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:for-each select="$ORIGINAL">
+                <xsl:apply-templates mode="odd2odd-justcopy" select="tei:desc"/>
+              </xsl:for-each>
+            </xsl:otherwise>
+          </xsl:choose>
+          <!-- classes -->
+          <classes xmlns="http://www.tei-c.org/ns/1.0">
+            <xsl:choose>
+              <xsl:when test="tei:classes[@mode='change']">
+                <xsl:for-each select="tei:classes/tei:memberOf">
+                  <xsl:choose>
+                    <xsl:when test="@mode='delete'"/>
+                    <xsl:when test="@mode='add' or not (@mode)">
+                      <memberOf key="{@key}">
+			<xsl:copy-of select="@min|@max"/>
+		      </memberOf>
+                    </xsl:when>
+                  </xsl:choose>
+                </xsl:for-each>
+                <xsl:for-each select="$ORIGINAL">
+                  <xsl:for-each select="tei:classes/tei:memberOf">
+                    <xsl:variable name="me">
+                      <xsl:value-of select="@key"/>
+                    </xsl:variable>
+                    <xsl:variable name="metoo">
+                      <xsl:value-of select="concat(../../@ident,@key)"/>
+                    </xsl:variable>
+                    <xsl:for-each select="$ODD">
+                      <xsl:choose>
+                        <xsl:when test="key('odd2odd-DELETE',$me)"> </xsl:when>
+                        <xsl:when test="key('odd2odd-MEMBEROFDELETE',$metoo)"> </xsl:when>
+                        <xsl:when test="key('odd2odd-MEMBEROFADD',$metoo)"> </xsl:when>
+                        <xsl:otherwise>
+                          <memberOf key="{$me}"/>
+                        </xsl:otherwise>
+                      </xsl:choose>
+                    </xsl:for-each>
+                  </xsl:for-each>
+                </xsl:for-each>
+              </xsl:when>
+              <xsl:when test="tei:classes">
+                <xsl:for-each select="tei:classes/tei:memberOf">
+                  <xsl:copy-of select="."/>
+                </xsl:for-each>
+              </xsl:when>
+              <xsl:otherwise>
+                <xsl:for-each select="$ORIGINAL">
+                  <xsl:for-each select="tei:classes/tei:memberOf">
+                    <xsl:variable name="me">
+                      <xsl:value-of select="@key"/>
+                    </xsl:variable>
+                    <xsl:for-each select="$ODD">
+                      <xsl:if test="not(key('odd2odd-DELETE',$me))">
+                        <memberOf key="{$me}"/>
+                      </xsl:if>
+                    </xsl:for-each>
+                  </xsl:for-each>
+                </xsl:for-each>
+              </xsl:otherwise>
+            </xsl:choose>
+          </classes>
+          <!-- valList -->
+          <xsl:choose>
+            <xsl:when test="tei:valList[@mode='delete']"/>
+            <xsl:when test="tei:valList">
+              <xsl:apply-templates mode="odd2odd-copy" select="tei:valList[1]"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:for-each select="$ORIGINAL">
+                <xsl:apply-templates mode="odd2odd-copy" select="tei:valList"/>
+              </xsl:for-each>
+            </xsl:otherwise>
+          </xsl:choose>
+          <!-- element content -->
+          <content xmlns="http://www.tei-c.org/ns/1.0">
+            <xsl:choose>
+              <xsl:when test="tei:content/rng:*">
+                <xsl:apply-templates mode="odd2odd-copy" select="tei:content/*"/>
+              </xsl:when>
+              <xsl:when test="tei:content/tei:*">
+                <xsl:apply-templates mode="odd2odd-copy" select="tei:content/*"/>
+              </xsl:when>
+              <xsl:otherwise>
+                <xsl:for-each select="$ORIGINAL">
+                  <xsl:apply-templates mode="odd2odd-copy" select="tei:content/*"/>
+                </xsl:for-each>
+              </xsl:otherwise>
+            </xsl:choose>
+          </content>
+          <!-- element constraints -->
+          <xsl:call-template name="odd2odd-processConstraints">
+            <xsl:with-param name="ORIGINAL" select="$ORIGINAL"/>
+            <xsl:with-param name="elementName" select="$elementName"/>
+          </xsl:call-template>
+          <!-- attList -->
+          <attList xmlns="http://www.tei-c.org/ns/1.0">
+            <xsl:apply-templates mode="odd2odd-justcopy" select="tei:attList/@org"/>
+            <xsl:call-template name="odd2odd-processAttributes">
+              <xsl:with-param name="ORIGINAL" select="$ORIGINAL"/>
+              <xsl:with-param name="elementName" select="$elementName"/>
+            </xsl:call-template>
+          </attList>
+          <!-- exemplum, remarks and listRef are either replacements or not -->
+          <xsl:choose>
+            <xsl:when test="$stripped='true'"/>
+            <xsl:when test="tei:exemplum">
+              <xsl:apply-templates mode="odd2odd-justcopy" select="tei:exemplum"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:for-each select="$ORIGINAL">
+                <xsl:apply-templates mode="odd2odd-justcopy" select="tei:exemplum"/>
+              </xsl:for-each>
+            </xsl:otherwise>
+          </xsl:choose>
+          <xsl:choose>
+            <xsl:when test="$stripped='true'"/>
+            <xsl:when test="tei:remarks">
+              <xsl:apply-templates mode="odd2odd-justcopy" select="tei:remarks"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:for-each select="$ORIGINAL">
+                <xsl:apply-templates mode="odd2odd-justcopy" select="tei:remarks"/>
+              </xsl:for-each>
+            </xsl:otherwise>
+          </xsl:choose>
+          <xsl:choose>
+            <xsl:when test="tei:listRef">
+              <xsl:apply-templates mode="odd2odd-justcopy" select="tei:listRef"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:for-each select="$ORIGINAL">
+                <xsl:apply-templates mode="odd2odd-justcopy" select="tei:listRef"/>
+              </xsl:for-each>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:for-each>
+      </xsl:for-each>
+    </xsl:copy>
+  </xsl:template>
+  <xsl:template match="tei:macroSpec" mode="odd2odd-change">
+    <xsl:variable name="elementName">
+      <xsl:value-of select="concat(@ns,@ident)"/>
+    </xsl:variable>
+    <xsl:variable name="ORIGINAL" select="."/>
+    <xsl:copy>
+      <xsl:attribute name="rend">change</xsl:attribute>
+      <xsl:apply-templates mode="odd2odd-change" select="@*"/>
+      <!-- 
+	   For each macro, go through most of the sections one by one
+	   and see if they are present in the change mode version.
+	   If so, use them as is. 
+      -->
+      <xsl:for-each select="$ODD">
+        <xsl:for-each select="key('odd2odd-CHANGE',$elementName)">
+          <!-- if there is an altIdent, use it -->
+          <xsl:apply-templates mode="odd2odd-justcopy" select="tei:altIdent"/>
+          <!-- equiv, gloss, desc trio -->
+          <xsl:choose>
+            <xsl:when test="$stripped='true'"/>
+            <xsl:when test="tei:equiv">
+              <xsl:apply-templates mode="odd2odd-copy" select="tei:equiv"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:for-each select="$ORIGINAL">
+                <xsl:apply-templates mode="odd2odd-copy" select="tei:equiv"/>
+              </xsl:for-each>
+            </xsl:otherwise>
+          </xsl:choose>
+          <xsl:choose>
+            <xsl:when test="tei:gloss">
+              <xsl:apply-templates mode="odd2odd-justcopy" select="tei:gloss"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:for-each select="$ORIGINAL">
+                <xsl:apply-templates mode="odd2odd-justcopy" select="tei:gloss"/>
+              </xsl:for-each>
+            </xsl:otherwise>
+          </xsl:choose>
+          <xsl:choose>
+            <xsl:when test="$stripped='true'"/>
+            <xsl:when test="tei:desc">
+              <xsl:apply-templates mode="odd2odd-justcopy" select="tei:desc"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:for-each select="$ORIGINAL">
+                <xsl:apply-templates mode="odd2odd-justcopy" select="tei:desc"/>
+              </xsl:for-each>
+            </xsl:otherwise>
+          </xsl:choose>
+          <!-- content -->
+          <xsl:choose>
+            <xsl:when test="tei:content">
+              <xsl:apply-templates mode="odd2odd-justcopy" select="tei:content"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:for-each select="$ORIGINAL">
+                <xsl:apply-templates mode="odd2odd-copy" select="tei:content"/>
+              </xsl:for-each>
+            </xsl:otherwise>
+          </xsl:choose>
+          <xsl:choose>
+            <xsl:when test="tei:valList">
+              <xsl:apply-templates mode="odd2odd-justcopy" select="tei:valList[1]"/>
+            </xsl:when>
+            <xsl:when test="tei:stringVal">
+              <xsl:apply-templates mode="odd2odd-justcopy" select="tei:stringVal"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:for-each select="$ORIGINAL">
+                <xsl:apply-templates mode="odd2odd-copy" select="tei:stringVal"/>
+              </xsl:for-each>
+            </xsl:otherwise>
+          </xsl:choose>
+          <!-- exemplum, remarks and listRef are either replacements or not -->
+          <xsl:choose>
+            <xsl:when test="$stripped='true'"/>
+            <xsl:when test="tei:exemplum">
+              <xsl:apply-templates mode="odd2odd-justcopy" select="tei:exemplum"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:for-each select="$ORIGINAL">
+                <xsl:apply-templates mode="odd2odd-justcopy" select="tei:exemplum"/>
+              </xsl:for-each>
+            </xsl:otherwise>
+          </xsl:choose>
+          <xsl:choose>
+            <xsl:when test="tei:remarks">
+              <xsl:apply-templates mode="odd2odd-justcopy" select="tei:remarks"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:for-each select="$ORIGINAL">
+                <xsl:apply-templates mode="odd2odd-justcopy" select="tei:remarks"/>
+              </xsl:for-each>
+            </xsl:otherwise>
+          </xsl:choose>
+          <xsl:choose>
+            <xsl:when test="$stripped='true'"/>
+            <xsl:when test="tei:listRef">
+              <xsl:apply-templates mode="odd2odd-justcopy" select="tei:listRef"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:for-each select="$ORIGINAL">
+                <xsl:apply-templates mode="odd2odd-justcopy" select="tei:listRef"/>
+              </xsl:for-each>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:for-each>
+      </xsl:for-each>
+    </xsl:copy>
+  </xsl:template>
+  <xsl:template match="tei:classSpec" mode="odd2odd-change">
+    <xsl:variable name="className">
+	<xsl:value-of select="concat(@ns,@ident)"/>
+    </xsl:variable>
+    <xsl:variable name="ORIGINAL" select="."/>
+    <xsl:copy>
+      <xsl:attribute name="rend">change</xsl:attribute>
+      <xsl:apply-templates mode="odd2odd-change" select="@*"/>
+      <!-- for each section of the class spec, 
+     go through the sections one by one
+     and see if they are present in the change mode version -->
+      <xsl:for-each select="$ODD">
+        <xsl:for-each select="key('odd2odd-CHANGE',$className)">
+          <!-- context is now a classSpec in change mode in the ODD spec -->
+          <!-- description -->
+          <xsl:choose>
+            <xsl:when test="$stripped='true'"/>
+            <xsl:when test="tei:desc">
+              <xsl:apply-templates mode="odd2odd-justcopy" select="tei:desc"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:for-each select="$ORIGINAL">
+                <xsl:apply-templates mode="odd2odd-justcopy" select="tei:desc"/>
+              </xsl:for-each>
+            </xsl:otherwise>
+          </xsl:choose>
+          <!-- classes -->
+          <classes xmlns="http://www.tei-c.org/ns/1.0">
+            <xsl:choose>
+              <xsl:when test="tei:classes[@mode='change']">
+                <xsl:for-each select="tei:classes/tei:memberOf">
+                  <xsl:choose>
+                    <xsl:when test="@mode='delete'"/>
+                    <xsl:when test="@mode='add' or not (@mode)">
+                      <memberOf key="{@key}"/>
+                    </xsl:when>
+                  </xsl:choose>
+                </xsl:for-each>
+                <xsl:for-each select="$ORIGINAL">
+                  <xsl:for-each select="tei:classes/tei:memberOf">
+                    <xsl:variable name="me">
+                      <xsl:value-of select="@key"/>
+                    </xsl:variable>
+                    <xsl:variable name="metoo">
+                      <xsl:value-of select="concat(../../@ident,@key)"/>
+                    </xsl:variable>
+                    <xsl:for-each select="$ODD">
+                      <xsl:choose>
+                        <xsl:when test="key('odd2odd-DELETE',$me)"> </xsl:when>
+                        <xsl:when test="key('odd2odd-MEMBEROFDELETE',$metoo)"> </xsl:when>
+                        <xsl:when test="key('odd2odd-MEMBEROFADD',$metoo)"> </xsl:when>
+                        <xsl:otherwise>
+                          <memberOf key="{$me}"/>
+                        </xsl:otherwise>
+                      </xsl:choose>
+                    </xsl:for-each>
+                  </xsl:for-each>
+                </xsl:for-each>
+              </xsl:when>
+              <xsl:when test="tei:classes">
+                <xsl:for-each select="tei:classes/tei:memberOf">
+                  <xsl:copy-of select="."/>
+                </xsl:for-each>
+              </xsl:when>
+              <xsl:otherwise>
+                <xsl:for-each select="$ORIGINAL">
+                  <xsl:for-each select="tei:classes/tei:memberOf">
+                    <xsl:variable name="me">
+                      <xsl:value-of select="@key"/>
+                    </xsl:variable>
+                    <xsl:for-each select="$ODD">
+                      <xsl:if test="not(key('odd2odd-DELETE',$me))">
+                        <memberOf key="{$me}"/>
+                      </xsl:if>
+                    </xsl:for-each>
+                  </xsl:for-each>
+                </xsl:for-each>
+              </xsl:otherwise>
+            </xsl:choose>
+          </classes>
+          <!-- attList -->
+          <attList xmlns="http://www.tei-c.org/ns/1.0">
+            <xsl:call-template name="odd2odd-processAttributes">
+              <xsl:with-param name="ORIGINAL" select="$ORIGINAL"/>
+              <xsl:with-param name="elementName" select="''"/>
+            </xsl:call-template>
+            <xsl:apply-templates mode="odd2odd-justcopy" select="tei:attList/tei:attRef"/>
+          </attList>
+        </xsl:for-each>
+      </xsl:for-each>
+    </xsl:copy>
+  </xsl:template>
+  <xsl:template match="rng:choice|rng:list|rng:group|rng:optional|rng:oneOrMore|rng:zeroOrMore" mode="odd2odd-copy">
+    <xsl:call-template name="odd2odd-simplifyRelax"/>
+  </xsl:template>
+  <xsl:template name="odd2odd-simplifyRelax">
+    <xsl:variable name="element">
+      <xsl:value-of select="local-name(.)"/>
+    </xsl:variable>
+    <!-- 
+for each RELAX NG content model,
+remove reference to any elements which have been
+deleted, or to classes which are empty.
+This may make the container empty,
+so that is only put back in if there is some content
+-->
+    <xsl:variable name="contents">
+      <WHAT>
+        <xsl:for-each select="a:*|rng:*|processing-instruction()">
+          <xsl:choose>
+            <xsl:when test="self::a:*">
+              <xsl:copy-of select="."/>
+            </xsl:when>
+            <xsl:when test="self::processing-instruction()">
+              <xsl:copy-of select="."/>
+            </xsl:when>
+            <xsl:when test="self::rng:element">
+              <element xmlns="http://relaxng.org/ns/structure/1.0">
+                <xsl:copy-of select="@*"/>
+                <xsl:apply-templates mode="odd2odd-copy"/>
+              </element>
+            </xsl:when>
+            <xsl:when test="self::rng:name">
+              <name xmlns="http://relaxng.org/ns/structure/1.0">
+                <xsl:copy-of select="@*"/>
+                <xsl:apply-templates mode="odd2odd-copy"/>
+              </name>
+            </xsl:when>
+            <xsl:when test="self::rng:attribute">
+              <attribute xmlns="http://relaxng.org/ns/structure/1.0">
+                <xsl:copy-of select="@*"/>
+                <xsl:apply-templates mode="odd2odd-copy"/>
+              </attribute>
+            </xsl:when>
+            <xsl:when test="self::rng:data">
+              <data xmlns="http://relaxng.org/ns/structure/1.0">
+                <xsl:copy-of select="@*"/>
+                <xsl:apply-templates mode="odd2odd-copy"/>
+              </data>
+            </xsl:when>
+            <xsl:when test="self::rng:text">
+              <text xmlns="http://relaxng.org/ns/structure/1.0"/>
+            </xsl:when>
+            <xsl:when test="self::rng:value">
+              <value xmlns="http://relaxng.org/ns/structure/1.0">
+                <xsl:apply-templates/>
+              </value>
+            </xsl:when>
+            <xsl:when test="self::rng:ref">
+              <xsl:variable name="N" select="@name"/>
+              <xsl:for-each select="$ODD">
+                <xsl:choose>
+                  <xsl:when test="$stripped='true'">
+                    <ref xmlns="http://relaxng.org/ns/structure/1.0" name="{$N}"/>
+                  </xsl:when>
+                  <xsl:when test="key('odd2odd-DELETE',$N)"/>
+                  <xsl:otherwise>
+                    <ref xmlns="http://relaxng.org/ns/structure/1.0" name="{$N}"/>
+                  </xsl:otherwise>
+                </xsl:choose>
+              </xsl:for-each>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:call-template name="odd2odd-simplifyRelax"/>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:for-each>
+      </WHAT>
+    </xsl:variable>
+    <xsl:variable name="entCount">
+      <xsl:for-each select="$contents/WHAT">
+        <xsl:value-of select="count(*)"/>
+      </xsl:for-each>
+    </xsl:variable>
+    <xsl:for-each select="$contents/WHAT">
+      <xsl:choose>
+        <xsl:when test="$entCount=1     and local-name(*)=$element">
+          <xsl:copy-of select="*|@*|text()|processing-instruction()"/>
+        </xsl:when>
+        <xsl:when test="$element='optional'     and $entCount=1     and rng:zeroOrMore">
+          <xsl:copy-of select="*|@*|text()|processing-instruction()"/>
+        </xsl:when>
+        <xsl:when test="$element='optional'     and $entCount=1     and rng:oneOrMore">
+          <xsl:copy-of select="*|@*|text()|processing-instruction()"/>
+        </xsl:when>
+        <xsl:when test="$element='oneOrMore'     and $entCount=1     and rng:zeroOrMore">
+          <oneOrMore xmlns="http://relaxng.org/ns/structure/1.0">
+            <xsl:copy-of select="rng:zeroOrMore/*"/>
+          </oneOrMore>
+        </xsl:when>
+        <xsl:when test="self::rng:zeroOrMore/rng:ref/@name='model.global'        and preceding-sibling::rng:*[1][self::rng:zeroOrMore/rng:ref/@name='model.global']"/>
+        <xsl:when test="$entCount&gt;0 or $stripped='true'">
+          <xsl:element xmlns="http://relaxng.org/ns/structure/1.0" name="{$element}">
+            <xsl:copy-of select="*|@*|text()|processing-instruction()"/>
+          </xsl:element>
+        </xsl:when>
+      </xsl:choose>
+    </xsl:for-each>
+  </xsl:template>
+
+  <xsl:template name="odd2odd-classAttributes">
+    <xsl:param name="elementName"/>
+    <xsl:param name="className"/>
+    <xsl:param name="whence"/>
+    <xsl:param name="Source" tunnel="yes"/>
+
+    <!-- 
+    On entry, we are sitting on an <elementSpec> or <classSpec> 
+    and seeing if we can pick up some attributes for 
+    $elementName. We travel to the ODD first
+    to see if it has some overrides
+    -->
+    <xsl:for-each select="$ODD">
+      <xsl:choose>
+        <xsl:when test="key('odd2odd-MEMBEROFDELETE',concat($elementName,$className))"> </xsl:when>
+        <!-- the class is referenced in the ODD and has redefined <classes>-->
+        <xsl:when test="key('odd2odd-ATTCLASSES',$className)/tei:classes">
+          <xsl:for-each select="key('odd2odd-ATTCLASSES',$className)">
+            <xsl:call-template name="odd2odd-processClassAttributes">
+              <xsl:with-param name="elementName" select="$elementName"/>
+              <xsl:with-param name="className" select="$className"/>
+              <xsl:with-param name="whence" select="$whence"/>
+              <xsl:with-param name="fromODD">true</xsl:with-param>
+            </xsl:call-template>
+          </xsl:for-each>
+        </xsl:when>
+        <!-- the class is referenced in the ODD and has redefined <attList>-->
+        <xsl:when test="key('odd2odd-ATTCLASSES',$className)/tei:attList">
+          <xsl:for-each select="key('odd2odd-ATTCLASSES',$className)">
+            <xsl:call-template name="odd2odd-processClassAttributes">
+              <xsl:with-param name="elementName" select="$elementName"/>
+              <xsl:with-param name="className" select="$className"/>
+              <xsl:with-param name="whence" select="$whence"/>
+              <xsl:with-param name="fromODD">true</xsl:with-param>
+            </xsl:call-template>
+          </xsl:for-each>
+        </xsl:when>
+        <!-- otherwise, we'll revert to source
+	     (assuming the class is of type 'atts')
+	-->
+        <xsl:otherwise>
+          <xsl:for-each select="document($Source)/tei:TEI">
+            <xsl:for-each select="key('odd2odd-ATTCLASSES',$className)">
+              <xsl:call-template name="odd2odd-processClassAttributes">
+                <xsl:with-param name="elementName" select="$elementName"/>
+                <xsl:with-param name="className" select="$className"/>
+                <xsl:with-param name="whence" select="$whence"/>
+                <xsl:with-param name="fromODD">false</xsl:with-param>
+              </xsl:call-template>
+            </xsl:for-each>
+          </xsl:for-each>
+	</xsl:otherwise>
+      </xsl:choose>
+    </xsl:for-each>
+  </xsl:template>
+
+  <xsl:template name="odd2odd-processClassAttributes">
+    <xsl:param name="elementName"/>
+    <xsl:param name="className"/>
+    <xsl:param name="fromODD">false</xsl:param>
+    <xsl:param name="whence"/>
+    <xsl:param name="Source" tunnel="yes"/>
+
+    <!-- we are sitting on a attribute classSpec, could be in the ODD
+	 or could be in the source -->
+    <xsl:variable name="M" select="@module"/>
+    <!-- decide whether to proceed with this class at all. if we don't
+    include this class specifically, don't have this module, or we
+    have deleted the class, 
+    we can bypass it now.-->
+    <xsl:variable name="use">
+      <xsl:choose>
+        <xsl:when test="$fromODD='true' and (not(@mode) or @mode='add')">
+          <xsl:text>true</xsl:text>
+        </xsl:when>
+        <xsl:when test="not(@module)">
+          <xsl:text>true</xsl:text>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:for-each select="$ODD">
+            <xsl:choose>
+              <xsl:when test="key('odd2odd-DELETE',$className)">false</xsl:when>
+              <xsl:when test="key('odd2odd-CLASSREFS',$className)">true</xsl:when>
+              <xsl:when test="key('odd2odd-MODULES',$M)">
+                <xsl:text>true</xsl:text>
+              </xsl:when>
+	      <xsl:otherwise>false</xsl:otherwise>
+            </xsl:choose>
+          </xsl:for-each>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <!-- DEBUG-->
+    <!--
+    <xsl:message>START <xsl:value-of select="$whence"/>: <xsl:value-of select="$elementName"/> + <xsl:value-of
+    select="$className"/> [<xsl:value-of select="$M"/>] + <xsl:value-of
+    select="$fromODD"/>, so use=<xsl:value-of select="$use"/></xsl:message>
+    -->
+    <xsl:if test="$use='true'">
+      <!-- 
+	   We need to put in the class attributes. We'll 
+	   use the value of $fromODD to see whether this is in the
+	   current ODD or the source.
+	   
+	   a) the class is new in this customization, add all attributes regardless
+	   b) the class is marked for deletion. do nothing
+	   c) the class is marked for replacement. reference attributes from the replacement
+	   d) the class is marked for change. compare attributes (tedious)
+	   e) the class has no replacement; reference its attributes
+	   
+	   In each case, once we have a potential attribute, we have to check
+	   back to see if it is changed in the element (mergeClassAttribute)
+	   
+	   First, establish whether any attributes in the class,
+	   inherited or otherwise, are changed in the ODD. We will
+	   use this information later
+      -->
+      <xsl:variable name="anyChanged">
+        <xsl:choose>
+          <xsl:when test="$fromODD='false'">
+            <xsl:call-template name="odd2odd-checkClassAttribute">
+              <xsl:with-param name="element" select="$elementName"/>
+            </xsl:call-template>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:for-each select="document($Source)/tei:TEI">
+              <xsl:for-each select="key('odd2odd-ATTCLASSES',$className)">
+                <xsl:call-template name="odd2odd-checkClassAttribute">
+                  <xsl:with-param name="element" select="$elementName"/>
+                </xsl:call-template>
+              </xsl:for-each>
+            </xsl:for-each>
+	  </xsl:otherwise>
+        </xsl:choose>
+      </xsl:variable>
+      <!--
+	  <xsl:message>Class <xsl:value-of select="$className"/>, element
+	  <xsl:value-of select="$elementName"/>: has changes: <xsl:value-of
+	  select="$anyChanged"/></xsl:message>
+      -->
+      <xsl:choose>
+        <!-- a) new class in ODD -->
+        <xsl:when test="$fromODD='true' and (not(@mode) or @mode='add')">
+          <attRef xmlns="http://www.tei-c.org/ns/1.0" n="1" name="{$className}.attributes"/>
+        </xsl:when>
+        <!-- b) its deleted -->
+        <xsl:when test="@mode='delete'"/>
+        <!-- c) its a replacement -->
+        <xsl:when test="@mode='replace'">
+          <xsl:for-each select="tei:attList/tei:attDef">
+            <xsl:call-template name="odd2odd-mergeClassAttribute">
+              <xsl:with-param name="source">1</xsl:with-param>
+              <xsl:with-param name="element" select="$elementName"/>
+              <xsl:with-param name="class" select="$className"/>
+              <xsl:with-param name="fromODD">
+                <xsl:value-of select="$fromODD"/>
+              </xsl:with-param>
+            </xsl:call-template>
+          </xsl:for-each>
+          <xsl:for-each select="tei:attList/tei:attList">
+            <attList xmlns="http://www.tei-c.org/ns/1.0">
+              <xsl:copy-of select="@org"/>
+              <xsl:for-each select="tei:attDef">
+                <xsl:call-template name="odd2odd-mergeClassAttribute">
+                  <xsl:with-param name="source">2</xsl:with-param>
+                  <xsl:with-param name="element" select="$elementName"/>
+                  <xsl:with-param name="class" select="$className"/>
+                  <xsl:with-param name="fromODD">
+                    <xsl:value-of select="$fromODD"/>
+                  </xsl:with-param>
+                </xsl:call-template>
+              </xsl:for-each>
+            </attList>
+          </xsl:for-each>
+        </xsl:when>
+        <!-- d) there are changes to attributes in the class spec itself,
+	but the element makes no override -->
+        <xsl:when test="@mode='change' and tei:attList and not (contains($anyChanged,':element-'))">
+          <xsl:if test="$verbose='true'">
+            <xsl:message>Phase 1 check d) Class <xsl:value-of select="$className"/> for <xsl:value-of select="$elementName"/> has no changes in element, refer by name</xsl:message>
+          </xsl:if>
+          <attRef xmlns="http://www.tei-c.org/ns/1.0" n="5" name="{$className}.attributes"/>
+        </xsl:when>
+        <!-- e) there are changes to attributes in the class spec itself -->
+        <xsl:when test="@mode='change' and tei:attList">
+          <!-- always references attributes in add mode -->
+          <xsl:for-each select="tei:attList/tei:attDef[@mode='add']">
+            <attRef xmlns="http://www.tei-c.org/ns/1.0" n="2" name="{$className}.attribute.{translate(@ident,':','')}"/>
+          </xsl:for-each>
+          <!-- go back to original and proceed from there -->
+	  <xsl:for-each select="document($Source)/tei:TEI">
+	    <xsl:for-each select="key('odd2odd-ATTCLASSES',$className)">
+	      <xsl:call-template name="odd2odd-tryAttributes">
+		<xsl:with-param name="elementName" select="$elementName"/>
+		<xsl:with-param name="className" select="$className"/>
+		<xsl:with-param name="fromODD">
+		  <xsl:value-of select="$fromODD"/>
+		</xsl:with-param>
+	      </xsl:call-template>
+	    </xsl:for-each>
+	  </xsl:for-each>
+          <xsl:for-each select="tei:attList/tei:attRef">
+            <xsl:copy-of select="."/>
+          </xsl:for-each>
+        </xsl:when>
+        <!-- there are no changes to the attributes in the odd-->
+        <xsl:when test="$anyChanged=''">
+          <xsl:if test="$verbose='true'">
+            <xsl:message>Phase 1 check f) Class <xsl:value-of select="$className"/> for <xsl:value-of select="$elementName"/> has no changes, refer by name</xsl:message>
+          </xsl:if>
+          <attRef xmlns="http://www.tei-c.org/ns/1.0" n="4" name="{$className}.attributes"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:if test="$verbose='true'">
+            <xsl:message>Phase 1 check g) Class <xsl:value-of select="$className"/> for <xsl:value-of select="$elementName"/> has changes in odd, refer by values</xsl:message>
+          </xsl:if>
+          <!-- attributes here -->
+          <xsl:for-each select="tei:attList/tei:attDef">
+            <xsl:call-template name="odd2odd-mergeClassAttribute">
+              <xsl:with-param name="source">7</xsl:with-param>
+              <xsl:with-param name="element" select="$elementName"/>
+              <xsl:with-param name="class" select="$className"/>
+              <xsl:with-param name="fromODD">
+                <xsl:value-of select="$fromODD"/>
+              </xsl:with-param>
+            </xsl:call-template>
+          </xsl:for-each>
+          <!-- embedded attribute lists  -->
+          <xsl:for-each select="tei:attList/tei:attList">
+            <attList xmlns="http://www.tei-c.org/ns/1.0">
+              <xsl:copy-of select="@org"/>
+              <xsl:for-each select="tei:attDef">
+                <xsl:call-template name="odd2odd-mergeClassAttribute">
+                  <xsl:with-param name="source">8</xsl:with-param>
+                  <xsl:with-param name="element" select="$elementName"/>
+                  <xsl:with-param name="class" select="$className"/>
+                  <xsl:with-param name="fromODD">
+                    <xsl:value-of select="$fromODD"/>
+                  </xsl:with-param>
+                </xsl:call-template>
+              </xsl:for-each>
+            </attList>
+          </xsl:for-each>
+        </xsl:otherwise>
+      </xsl:choose>
+      <!-- Now attributes referenced from classes we are a member
+     of. Again, check whether we are in ODD or not. If
+     we have not tinkered with the superclass, this is not
+     needed, obviously.
+      -->
+      <!-- DEBUG
+      <xsl:message>Now time to look at subclasses of <xsl:value-of
+      select="@ident"/> whose changes status was <xsl:value-of
+      select="$anyChanged"/>; we are in fromOdd <xsl:value-of
+      select="$fromODD"/></xsl:message>
+-->
+      <xsl:choose>
+        <xsl:when test="@mode='change' and tei:attList and not (contains($anyChanged,':element-'))"/>
+        <xsl:when test="$fromODD='false' and $anyChanged =''"/>
+        <xsl:when test="$fromODD='true' and not(.//tei:attDef)"/>
+        <xsl:when test="$fromODD='true' and tei:classes[@mode='replace']">
+          <xsl:for-each select="tei:classes/tei:memberOf">
+            <xsl:call-template name="odd2odd-classAttributes">
+              <xsl:with-param name="whence">3</xsl:with-param>
+              <xsl:with-param name="elementName" select="$elementName"/>
+              <xsl:with-param name="className" select="@key"/>
+            </xsl:call-template>
+          </xsl:for-each>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:if test="$fromODD='true' and tei:classes[@mode='change']">
+            <xsl:for-each select="tei:classes/tei:memberOf[@mode='add']">
+              <xsl:call-template name="odd2odd-classAttributes">
+                <xsl:with-param name="whence">4</xsl:with-param>
+                <xsl:with-param name="elementName" select="$elementName"/>
+                <xsl:with-param name="className" select="@key"/>
+              </xsl:call-template>
+            </xsl:for-each>
+          </xsl:if>
+	  <xsl:for-each select="document($Source)/tei:TEI">
+	    <xsl:for-each select="key('odd2odd-ATTCLASSES',$className)">
+	      <xsl:for-each select="tei:classes/tei:memberOf">
+		<xsl:call-template name="odd2odd-classAttributes">
+		  <xsl:with-param name="whence">5</xsl:with-param>
+		  <xsl:with-param name="elementName" select="$elementName"/>
+		  <xsl:with-param name="className" select="@key"/>
+		</xsl:call-template>
+	      </xsl:for-each>
+	    </xsl:for-each>
+	  </xsl:for-each>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:if>
+  </xsl:template>
+  <xsl:template name="odd2odd-tryAttributes">
+    <xsl:param name="elementName"/>
+    <xsl:param name="className"/>
+    <xsl:param name="fromODD"/>
+    <xsl:for-each select="tei:attList/tei:attDef">
+      <xsl:call-template name="odd2odd-mergeClassAttribute">
+        <xsl:with-param name="source">3</xsl:with-param>
+        <xsl:with-param name="element" select="$elementName"/>
+        <xsl:with-param name="class" select="$className"/>
+        <xsl:with-param name="fromODD">
+          <xsl:value-of select="$fromODD"/>
+        </xsl:with-param>
+      </xsl:call-template>
+    </xsl:for-each>
+    <xsl:for-each select="tei:attList/tei:attList">
+      <attList xmlns="http://www.tei-c.org/ns/1.0">
+        <xsl:copy-of select="@org"/>
+        <xsl:for-each select="tei:attDef">
+          <xsl:call-template name="odd2odd-mergeClassAttribute">
+            <xsl:with-param name="source">4</xsl:with-param>
+            <xsl:with-param name="element" select="$elementName"/>
+            <xsl:with-param name="class" select="$className"/>
+            <xsl:with-param name="fromODD">
+              <xsl:value-of select="$fromODD"/>
+            </xsl:with-param>
+          </xsl:call-template>
+        </xsl:for-each>
+      </attList>
+    </xsl:for-each>
+  </xsl:template>
+  <xsl:template name="odd2odd-mergeClassAttribute">
+    <!-- 
+	 sitting on a source class. look at the 
+	 attribute and see whether it has changed
+	 in the customization
+    -->
+    <xsl:param name="source"/>
+    <xsl:param name="element"/>
+    <xsl:param name="class"/>
+    <xsl:param name="fromODD"/>
+    <xsl:variable name="att" select="@ident"/>
+    <xsl:variable name="wherefrom" select="."/>
+    <xsl:variable name="attRef">
+      <xsl:value-of select="concat($class,'.attribute.' ,translate($att,':',''),'_',$element)"/>
+    </xsl:variable>
+    <xsl:variable name="lookingAt">
+      <xsl:value-of select="concat($element,'_',@ident)"/>
+    </xsl:variable>
+    <xsl:for-each select="$ODD">
+      <xsl:choose>
+        <!-- deleted in the customization at the class level -->
+        <xsl:when test="key('odd2odd-DELETEATT',concat($class,'_',$att))"/>
+        <!-- deleted in the customization at the element level -->
+        <xsl:when test="key('odd2odd-DELETEATT',$lookingAt)"/>
+        <!-- replaced in the customization at the element level -->
+        <xsl:when test="key('odd2odd-REPLACEATT',$lookingAt)"/>
+        <!-- changed in the customization by the element -->
+        <xsl:when test="key('odd2odd-CHANGEATT',$lookingAt)">
+          <xsl:call-template name="odd2odd-mergeAttribute">
+            <xsl:with-param name="New" select="key('odd2odd-CHANGEATT',$lookingAt)"/>
+            <xsl:with-param name="Old" select="$wherefrom"/>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:choose>
+            <xsl:when test="$fromODD='false'">
+              <xsl:for-each select="$wherefrom">
+                <xsl:call-template name="odd2odd-unChangedAtt">
+                  <xsl:with-param name="debug">1</xsl:with-param>
+                  <xsl:with-param name="lookingAt">
+                    <xsl:value-of select="$lookingAt"/>
+                  </xsl:with-param>
+                  <xsl:with-param name="att">
+                    <xsl:value-of select="$att"/>
+                  </xsl:with-param>
+                  <xsl:with-param name="attRef">
+                    <xsl:value-of select="$attRef"/>
+                  </xsl:with-param>
+                  <xsl:with-param name="class">
+                    <xsl:value-of select="$class"/>
+                  </xsl:with-param>
+                  <xsl:with-param name="orig">
+                    <xsl:value-of select="$wherefrom"/>
+                  </xsl:with-param>
+                </xsl:call-template>
+              </xsl:for-each>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:call-template name="odd2odd-unChangedAtt">
+                <xsl:with-param name="debug">2</xsl:with-param>
+                <xsl:with-param name="lookingAt">
+                  <xsl:value-of select="$lookingAt"/>
+                </xsl:with-param>
+                <xsl:with-param name="att">
+                  <xsl:value-of select="$att"/>
+                </xsl:with-param>
+                <xsl:with-param name="attRef">
+                  <xsl:value-of select="$attRef"/>
+                </xsl:with-param>
+                <xsl:with-param name="class">
+                  <xsl:value-of select="$class"/>
+                </xsl:with-param>
+                <xsl:with-param name="orig">
+                  <xsl:value-of select="$wherefrom"/>
+                </xsl:with-param>
+              </xsl:call-template>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:for-each>
+  </xsl:template>
+  <xsl:template name="odd2odd-unChangedAtt">
+    <xsl:param name="lookingAt"/>
+    <xsl:param name="att"/>
+    <xsl:param name="class"/>
+    <xsl:param name="orig"/>
+    <xsl:param name="attRef"/>
+    <xsl:param name="debug"/>
+    <xsl:choose>
+      <!-- don't make another reference to a class attribute 
+	 if we already have an attRef -->
+      <xsl:when test="key('odd2odd-ATTREFS',$attRef)"/>
+      <xsl:otherwise>
+        <attRef xmlns="http://www.tei-c.org/ns/1.0" n="3-{$debug}" name="{$class}.attribute.{translate($att,':','')}"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <xsl:template name="odd2odd-checkClassAttribute">
+    <xsl:param name="element"/>
+    <!-- look at each attribute in turn, and then repeat for any
+	 inherited classes -->
+    <xsl:variable name="class" select="@ident"/>
+    <xsl:variable name="mode" select="@mode"/>
+    <xsl:for-each select="tei:attList//tei:attDef">
+      <xsl:variable name="att" select="@ident"/>
+      <xsl:for-each select="$ODD">
+        <xsl:choose>
+          <!-- deleted in the customization at the class level -->
+          <xsl:when test="key('odd2odd-DELETEATT',concat($class,'_',$att))">
+            <xsl:text>:class-del-</xsl:text>
+            <xsl:value-of select="$att"/>
+          </xsl:when>
+          <!-- deleted in the customization at the element level -->
+          <xsl:when test="key('odd2odd-DELETEATT',concat($element,'_',$att))">
+            <xsl:text>:element-del-</xsl:text>
+            <xsl:value-of select="$att"/>
+          </xsl:when>
+          <!-- replaced in the customization at the element level -->
+          <xsl:when test="key('odd2odd-REPLACEATT',concat($element,'_',$att))">
+            <xsl:text>:element-replace-</xsl:text>
+            <xsl:value-of select="$att"/>
+          </xsl:when>
+          <!-- changed in the customization by the element -->
+          <xsl:when test="key('odd2odd-CHANGEATT',concat($element,'_',$att))">
+            <xsl:text>:element-change-</xsl:text>
+            <xsl:value-of select="$att"/>
+          </xsl:when>
+        </xsl:choose>
+      </xsl:for-each>
+    </xsl:for-each>
+    <xsl:for-each select="tei:classes/tei:memberOf">
+      <xsl:for-each select="key('odd2odd-ATTCLASSES',@key)">
+        <xsl:call-template name="odd2odd-checkClassAttribute">
+          <xsl:with-param name="element" select="$element"/>
+        </xsl:call-template>
+      </xsl:for-each>
+    </xsl:for-each>
+  </xsl:template>
+  <xsl:template name="odd2odd-processAttributes">
+    <xsl:param name="ORIGINAL"/>
+    <xsl:param name="elementName"/>
+    <!-- first put in the ones we know take precedence -->
+    <xsl:apply-templates mode="odd2odd-justcopy" select="tei:attList/tei:attDef[@mode='add' or not(@mode)]"/>
+    <xsl:apply-templates mode="odd2odd-justcopy" select="tei:attList/tei:attDef[@mode='replace']"/>
+    <xsl:for-each select="$ORIGINAL/tei:attList">
+      <!-- original source  context -->
+      <xsl:for-each select="tei:attList">
+        <attList xmlns="http://www.tei-c.org/ns/1.0">
+          <xsl:copy-of select="@org"/>
+          <xsl:for-each select="tei:attDef">
+            <xsl:variable name="ATT" select="."/>
+            <xsl:variable name="lookingAt">
+              <xsl:value-of select="concat(../../../@ident,'_',@ident)"/>
+            </xsl:variable>
+            <xsl:for-each select="$ODD">
+              <xsl:choose>
+                <xsl:when test="key('odd2odd-DELETEATT',$lookingAt)"/>
+                <xsl:when test="key('odd2odd-REPLACEATT',$lookingAt)"/>
+                <xsl:when test="key('odd2odd-CHANGEATT',$lookingAt)">
+                  <xsl:call-template name="odd2odd-mergeAttribute">
+                    <xsl:with-param name="New" select="key('odd2odd-CHANGEATT',$lookingAt)"/>
+                    <xsl:with-param name="Old" select="$ATT"/>
+                  </xsl:call-template>
+                </xsl:when>
+                <xsl:otherwise>
+                  <xsl:copy-of select="$ATT"/>
+                </xsl:otherwise>
+              </xsl:choose>
+            </xsl:for-each>
+          </xsl:for-each>
+        </attList>
+      </xsl:for-each>
+      <xsl:variable name="atts">
+        <xsl:for-each select="tei:attDef">
+          <xsl:variable name="ATT" select="."/>
+          <xsl:variable name="lookingAt">
+            <xsl:value-of select="concat(../../@ident,'_',@ident)"/>
+          </xsl:variable>
+          <xsl:for-each select="$ODD">
+            <xsl:choose>
+              <xsl:when test="key('odd2odd-DELETEATT',$lookingAt)"/>
+              <xsl:when test="key('odd2odd-REPLACEATT',$lookingAt)"/>
+              <xsl:when test="key('odd2odd-CHANGEATT',$lookingAt)">
+                <xsl:call-template name="odd2odd-mergeAttribute">
+                  <xsl:with-param name="New" select="key('odd2odd-CHANGEATT',$lookingAt)"/>
+                  <xsl:with-param name="Old" select="$ATT"/>
+                </xsl:call-template>
+              </xsl:when>
+              <xsl:otherwise>
+                <xsl:copy-of select="$ATT"/>
+              </xsl:otherwise>
+            </xsl:choose>
+          </xsl:for-each>
+        </xsl:for-each>
+      </xsl:variable>
+      <xsl:choose>
+        <xsl:when test="@org">
+          <attList xmlns="http://www.tei-c.org/ns/1.0">
+            <xsl:copy-of select="@org"/>
+            <xsl:copy-of select="$atts"/>
+          </attList>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:copy-of select="$atts"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:for-each>
+    <!-- now we need to go back to the classes of which this 
+       element is a member and reference their untouched attributes -->
+    <xsl:choose>
+      <xsl:when test="$elementName=''"/>
+      <xsl:otherwise>
+	<xsl:if test="$autoGlobal='true'">
+	  <xsl:call-template name="odd2odd-classAttributes">
+	    <xsl:with-param name="whence">7</xsl:with-param>
+	    <xsl:with-param name="elementName" select="$elementName"/>
+	    <xsl:with-param name="className" select="'att.global'"/>
+	  </xsl:call-template>
+	</xsl:if>
+        <xsl:variable name="classMembership">
+          <x>
+            <xsl:choose>
+              <xsl:when test="tei:classes[@mode='change']">
+                <xsl:for-each select="tei:classes/tei:memberOf[not(@mode='delete')]">
+                  <xsl:copy-of select="."/>
+                </xsl:for-each>
+                <xsl:for-each select="$ORIGINAL">
+                  <xsl:for-each select="tei:classes/tei:memberOf">
+                    <xsl:copy-of select="."/>
+                  </xsl:for-each>
+                </xsl:for-each>
+              </xsl:when>
+              <xsl:when test="tei:classes">
+                <xsl:for-each select="tei:classes/tei:memberOf">
+                  <xsl:copy-of select="."/>
+                </xsl:for-each>
+              </xsl:when>
+              <xsl:otherwise>
+                <xsl:for-each select="$ORIGINAL">
+                  <xsl:for-each select="tei:classes/tei:memberOf">
+                    <xsl:copy-of select="."/>
+                  </xsl:for-each>
+                </xsl:for-each>
+              </xsl:otherwise>
+            </xsl:choose>
+          </x>
+        </xsl:variable>
+        <xsl:for-each select="$classMembership/x/tei:memberOf">
+          <xsl:if test="not(preceding-sibling::tei:memberOf[@key=current()/@key])">
+            <xsl:call-template name="odd2odd-classAttributes">
+              <xsl:with-param name="whence">8</xsl:with-param>
+              <xsl:with-param name="elementName" select="$elementName"/>
+              <xsl:with-param name="className" select="@key"/>
+            </xsl:call-template>
+          </xsl:if>
+        </xsl:for-each>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <xsl:template name="odd2odd-mergeAttribute">
+    <xsl:param name="New"/>
+    <xsl:param name="Old"/>
+    <attDef xmlns="http://www.tei-c.org/ns/1.0">
+      <xsl:attribute name="ident" select="$Old/@ident"/>
+       <xsl:attribute name="usage">
+          <xsl:choose>
+            <xsl:when test="$New/@usage">
+              <xsl:value-of select="$New/@usage"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:value-of select="$Old/@usage"/>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:attribute>
+        <xsl:if test="$New/tei:altIdent">
+          <xsl:apply-templates mode="odd2odd-justcopy" select="$New/tei:altIdent"/>
+        </xsl:if>
+        <!-- equiv, gloss, desc trio -->
+        <xsl:choose>
+          <xsl:when test="$stripped='true'"/>
+          <xsl:when test="$New/tei:equiv">
+            <xsl:apply-templates mode="odd2odd-copy" select="$New/tei:equiv"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:apply-templates mode="odd2odd-copy" select="$Old/tei:equiv"/>
+          </xsl:otherwise>
+        </xsl:choose>
+        <xsl:choose>
+          <xsl:when test="$New/tei:gloss">
+            <xsl:apply-templates mode="odd2odd-justcopy" select="$New/tei:gloss"/>
+          </xsl:when>
+          <xsl:otherwise>
+              <xsl:apply-templates mode="odd2odd-justcopy" select="$Old/tei:gloss"/>
+          </xsl:otherwise>
+        </xsl:choose>
+        <xsl:choose>
+          <xsl:when test="$stripped='true'"/>
+          <xsl:when test="$New/tei:desc">
+            <xsl:apply-templates mode="odd2odd-justcopy" select="$New/tei:desc"/>
+          </xsl:when>
+          <xsl:otherwise>
+              <xsl:apply-templates mode="odd2odd-justcopy" select="$Old/tei:desc"/>
+          </xsl:otherwise>
+        </xsl:choose>
+        <xsl:choose>
+          <xsl:when test="$New/tei:constraintSpec">
+            <xsl:apply-templates mode="odd2odd-justcopy" select="$New/tei:constraintSpec"/>
+          </xsl:when>
+          <xsl:when test="$Old/tei:constraintSpec">
+            <xsl:copy-of select="$Old/tei:constraintSpec"/>
+          </xsl:when>
+        </xsl:choose>
+        <xsl:choose>
+          <xsl:when test="$New/tei:datatype">
+            <xsl:apply-templates mode="odd2odd-justcopy" select="$New/tei:datatype"/>
+          </xsl:when>
+          <xsl:when test="$Old/tei:datatype">
+            <xsl:copy-of select="$Old/tei:datatype"/>
+          </xsl:when>
+        </xsl:choose>
+        <xsl:choose>
+          <xsl:when test="$New/tei:defaultVal">
+            <xsl:apply-templates mode="odd2odd-justcopy" select="$New/tei:defaultVal"/>
+          </xsl:when>
+          <xsl:when test="$Old/tei:defaultVal">
+            <xsl:copy-of select="$Old/tei:defaultVal"/>
+          </xsl:when>
+        </xsl:choose>
+        <xsl:choose>
+          <xsl:when test="$New/tei:valDesc">
+            <xsl:apply-templates mode="odd2odd-justcopy" select="$New/tei:valDesc"/>
+          </xsl:when>
+          <xsl:when test="$Old/tei:valDesc">
+            <xsl:copy-of select="$Old/tei:valDesc"/>
+          </xsl:when>
+        </xsl:choose>
+        <xsl:choose>
+	  <xsl:when test="$New/tei:valList[@mode='delete']"/>
+          <xsl:when test="$New/tei:valList[@mode='add' or @mode='replace']">
+            <xsl:for-each select="$New/tei:valList[1]">
+              <xsl:copy>
+                <xsl:copy-of select="@type"/>
+                <xsl:copy-of select="@repeatable"/>
+                <xsl:copy-of select="*"/>
+              </xsl:copy>
+            </xsl:for-each>
+          </xsl:when>
+          <xsl:when test="$New/tei:valList[@mode='change']">
+            <xsl:for-each select="$New/tei:valList[1]">
+              <xsl:copy>
+                <xsl:copy-of select="@*"/>
+                <xsl:for-each select="$Old/tei:valList/tei:valItem">
+                  <xsl:variable name="thisme" select="@ident"/>
+                  <xsl:if test="not($New/tei:valList[1]/tei:valItem[@ident=$thisme and (@mode='delete' or @mode='replace')])">
+                    <xsl:copy>
+                      <xsl:copy-of select="@*"/>
+                      <xsl:for-each select="$New/tei:valList[1]/tei:valItem[@ident=$thisme]">
+                        <xsl:choose>
+                          <xsl:when test="tei:equiv">
+                            <xsl:apply-templates mode="odd2odd-copy" select="tei:equiv"/>
+                          </xsl:when>
+                          <xsl:otherwise>
+                            <xsl:for-each select="$Old/tei:valList/tei:valItem[@ident=$thisme]">
+                              <xsl:apply-templates mode="odd2odd-copy" select="tei:equiv"/>
+                            </xsl:for-each>
+                          </xsl:otherwise>
+                        </xsl:choose>
+                        <xsl:choose>
+                          <xsl:when test="tei:gloss">
+                            <xsl:apply-templates mode="odd2odd-justcopy" select="tei:gloss"/>
+                          </xsl:when>
+                          <xsl:otherwise>
+                            <xsl:for-each select="$Old/tei:valList/tei:valItem[@ident=$thisme]">
+                              <xsl:apply-templates mode="odd2odd-justcopy" select="tei:gloss"/>
+                            </xsl:for-each>
+                          </xsl:otherwise>
+                        </xsl:choose>
+                        <xsl:choose>
+                          <xsl:when test="$stripped='true'"/>
+                          <xsl:when test="tei:desc">
+                            <xsl:apply-templates mode="odd2odd-justcopy" select="tei:desc"/>
+                          </xsl:when>
+                          <xsl:otherwise>
+                            <xsl:for-each select="$Old/tei:valList/tei:valItem[@ident=$thisme]">
+                              <xsl:apply-templates mode="odd2odd-justcopy" select="tei:desc"/>
+                            </xsl:for-each>
+                          </xsl:otherwise>
+                        </xsl:choose>
+                      </xsl:for-each>
+                    </xsl:copy>
+                  </xsl:if>
+                </xsl:for-each>
+                <xsl:apply-templates mode="odd2odd-justcopy" select="tei:valItem[@mode='add']"/>
+                <xsl:apply-templates mode="odd2odd-justcopy" select="tei:valItem[@mode='replace']"/>
+              </xsl:copy>
+            </xsl:for-each>
+          </xsl:when>
+          <xsl:when test="$Old/tei:valList">
+            <xsl:copy-of select="$Old/tei:valList"/>
+          </xsl:when>
+        </xsl:choose>
+        <xsl:choose>
+          <xsl:when test="$stripped='true'"/>
+          <xsl:when test="$New/tei:exemplum">
+            <xsl:apply-templates mode="odd2odd-justcopy" select="$New/tei:exemplum"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:for-each select="$Old">
+              <xsl:apply-templates mode="odd2odd-justcopy" select="tei:exemplum"/>
+            </xsl:for-each>
+          </xsl:otherwise>
+        </xsl:choose>
+        <xsl:choose>
+          <xsl:when test="$stripped='true'"/>
+          <xsl:when test="$New/tei:remarks">
+            <xsl:apply-templates mode="odd2odd-justcopy" select="$New/tei:remarks"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:for-each select="$Old">
+              <xsl:apply-templates mode="odd2odd-justcopy" select="tei:remarks"/>
+            </xsl:for-each>
+          </xsl:otherwise>
+        </xsl:choose>
+    </attDef>
+  </xsl:template>
+  <xsl:template match="tei:specGrp">
+    <xsl:choose>
+      <xsl:when test="ancestor::tei:schemaSpec"> </xsl:when>
+      <xsl:otherwise>
+        <xsl:copy>
+          <xsl:apply-templates/>
+        </xsl:copy>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <xsl:template match="tei:specGrpRef"/>
+  <xsl:template match="tei:macroSpec|tei:classSpec">
+    <xsl:if test="not(ancestor::tei:schemaSpec)">
+      <xsl:copy-of select="."/>
+    </xsl:if>
+  </xsl:template>
+  <xsl:template match="tei:attDef[@mode]"/>
+  <xsl:template match="tei:elementSpec">
+    <xsl:if test="not(//tei:schemaSpec)">
+      <xsl:variable name="elementName">
+        <xsl:value-of select="@ident"/>
+      </xsl:variable>
+      <xsl:copy>
+        <xsl:apply-templates mode="odd2odd-copy" select="@*"/>
+        <xsl:apply-templates mode="odd2odd-justcopy" select="tei:altIdent"/>
+        <xsl:if test="$stripped='false'">
+          <xsl:apply-templates mode="odd2odd-copy" select="tei:equiv"/>
+          <xsl:apply-templates mode="odd2odd-justcopy" select="tei:gloss"/>
+          <xsl:apply-templates mode="odd2odd-justcopy" select="tei:desc"/>
+        </xsl:if>
+        <xsl:apply-templates mode="odd2odd-justcopy" select="tei:classes"/>
+        <xsl:apply-templates mode="odd2odd-copy" select="tei:content"/>
+        <xsl:apply-templates mode="odd2odd-copy" select="tei:constraintSpec"/>
+        <attList xmlns="http://www.tei-c.org/ns/1.0">
+	  <xsl:if test="$autoGlobal='true' and not(tei:classes/tei:memberOf[@key='att.global'])">
+	    <xsl:comment>1.</xsl:comment>
+	    <xsl:call-template name="odd2odd-classAttributesSimple">
+	      <xsl:with-param name="whence">9</xsl:with-param>
+	      <xsl:with-param name="elementName" select="$elementName"/>
+	      <xsl:with-param name="className" select="'att.global'"/>
+	    </xsl:call-template>
+	  </xsl:if>
+          <xsl:comment>2.</xsl:comment>
+          <xsl:for-each select="tei:classes/tei:memberOf">
+            <xsl:comment>3: <xsl:value-of select="@key"/>
+                  </xsl:comment>
+            <xsl:call-template name="odd2odd-classAttributesSimple">
+              <xsl:with-param name="whence">10</xsl:with-param>
+              <xsl:with-param name="elementName" select="$elementName"/>
+              <xsl:with-param name="className" select="@key"/>
+            </xsl:call-template>
+          </xsl:for-each>
+          <xsl:comment>4.</xsl:comment>
+          <xsl:apply-templates select="tei:attList"/>
+          <xsl:comment>5.</xsl:comment>
+        </attList>
+        <xsl:if test="$stripped='false'">
+          <xsl:apply-templates mode="odd2odd-justcopy" select="tei:exemplum"/>
+          <xsl:apply-templates mode="odd2odd-justcopy" select="tei:remarks"/>
+          <xsl:apply-templates mode="odd2odd-justcopy" select="tei:listRef"/>
+        </xsl:if>
+      </xsl:copy>
+    </xsl:if>
+  </xsl:template>
+  <xsl:template match="tei:moduleRef[@url]">
+    <p>Include external module <xsl:value-of select="@url"/>.</p>
+  </xsl:template>
+  <xsl:template match="tei:moduleRef[@key]">
+    <p>Internal module <xsl:value-of select="@key"/> was located and expanded.</p>
+  </xsl:template>
+  <xsl:template match="@*|processing-instruction()|text()">
+    <xsl:copy-of select="."/>
+  </xsl:template>
+  <xsl:template match="*">
+    <xsl:copy>
+      <xsl:apply-templates select="*|@*|processing-instruction()|text()"/>
+    </xsl:copy>
+  </xsl:template>
+  <xsl:template name="odd2odd-classAttributesSimple">
+    <xsl:param name="elementName"/>
+    <xsl:param name="className"/>
+    <xsl:param name="whence"/>
+    <xsl:comment>START on <xsl:value-of select="$className"/>
+      </xsl:comment>
+    <xsl:for-each select="key('odd2odd-ATTCLASSES',$className)">
+      <xsl:variable name="CURRENTCLASS" select="."/>
+      <xsl:for-each select="tei:attList/tei:attDef">
+        <xsl:call-template name="odd2odd-mergeClassAttribute">
+          <xsl:with-param name="source">9</xsl:with-param>
+          <xsl:with-param name="element" select="$elementName"/>
+          <xsl:with-param name="class" select="$className"/>
+        </xsl:call-template>
+      </xsl:for-each>
+      <xsl:if test="tei:classes/tei:memberOf">
+        <xsl:for-each select="tei:classes/tei:memberOf">
+          <xsl:variable name="cName" select="@key"/>
+          <xsl:call-template name="odd2odd-classAttributesSimple">
+            <xsl:with-param name="whence">11</xsl:with-param>
+            <xsl:with-param name="elementName" select="$elementName"/>
+            <xsl:with-param name="className" select="$cName"/>
+          </xsl:call-template>
+        </xsl:for-each>
+      </xsl:if>
+    </xsl:for-each>
+    <xsl:comment>FINISH <xsl:value-of select="$className"/>
+      </xsl:comment>
+  </xsl:template>
+
+  <xsl:template name="odd2odd-createCopy">
+    <xsl:param name="Source"  tunnel="yes"/>
+    <xsl:if test="$verbose='true'">
+      <xsl:message>Create <xsl:value-of select="local-name()"/> named <xsl:value-of select="@ident"/>            </xsl:message>
+    </xsl:if>
+    <xsl:element xmlns="http://www.tei-c.org/ns/1.0" name="{local-name()}">
+      <xsl:choose>
+	<xsl:when test="@module"/>
+	<xsl:when test="ancestor::tei:schemaSpec/@module">
+	  <xsl:copy-of select="ancestor::tei:schemaSpec/@module"/>
+	</xsl:when>
+	<xsl:otherwise>
+	  <xsl:attribute name="module">
+	    <xsl:text>derived-module-</xsl:text>
+	    <xsl:value-of select="ancestor::tei:schemaSpec/@ident"/>
+	  </xsl:attribute>
+	</xsl:otherwise>
+      </xsl:choose>
+      <xsl:choose>
+	<xsl:when test="local-name()='classSpec'">
+	  <xsl:if test="@type='model' and not(@predeclare)">
+	    <xsl:attribute name="predeclare">true</xsl:attribute>
+	  </xsl:if>
+	  <xsl:apply-templates mode="odd2odd-copy" select="@*|*|processing-instruction()|text()"/>
+	</xsl:when>
+	<xsl:when test="local-name()='macroSpec'">
+	  <xsl:apply-templates mode="odd2odd-copy" select="@*|*|processing-instruction()|text()"/>
+	</xsl:when>
+	<xsl:otherwise>
+	  <xsl:call-template name="odd2odd-copyElementSpec">
+	    <xsl:with-param name="n" select="'2'"/>
+	  </xsl:call-template>
+	</xsl:otherwise>
+      </xsl:choose>
+    </xsl:element>
+  </xsl:template>
+
+  <xsl:template name="odd2odd-getversion">
+    <xsl:choose>
+      <xsl:when test="key('odd2odd-SCHEMASPECS',$selectedSchema)">
+	<xsl:for-each
+	    select="key('odd2odd-SCHEMASPECS',$selectedSchema)">
+	  <xsl:variable name="source" select="tei:workOutSource(.)"/>
+	  <xsl:for-each select="document($source)/tei:TEI/tei:teiHeader/tei:fileDesc/tei:editionStmt/tei:edition">
+	    <xsl:value-of select="."/>
+	  </xsl:for-each>
+	</xsl:for-each>
+      </xsl:when>
+      <xsl:otherwise>
+	<xsl:for-each select="document($DEFAULTSOURCE)/tei:TEI/tei:teiHeader/tei:fileDesc/tei:editionStmt/tei:edition">
+	  <xsl:value-of select="."/>
+	</xsl:for-each>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="odd2odd-processConstraints">
+    <xsl:param name="ORIGINAL"/>
+    <xsl:param name="elementName"/>
+    <!-- first put in the ones we know take precedence -->
+    <xsl:apply-templates mode="odd2odd-justcopy" select="tei:constraintSpec[@mode='add' or not(@mode)]"/>
+    <xsl:apply-templates mode="odd2odd-justcopy" select="tei:constraintSpec[@mode='replace']"/>
+    <xsl:apply-templates mode="odd2odd-justcopy" select="tei:constraintSpec[@mode='change']"/>
+    <xsl:for-each select="$ORIGINAL">
+      <!-- original source  context -->
+      <xsl:for-each select="tei:constraintSpec">
+        <xsl:variable name="CONSTRAINT" select="."/>
+        <xsl:variable name="lookingAt">
+          <xsl:value-of select="concat(../@ident,'_',@ident)"/>
+        </xsl:variable>
+        <xsl:for-each select="$ODD">
+          <xsl:choose>
+            <xsl:when test="key('odd2odd-DELETECONSTRAINT',$lookingAt)"/>
+            <xsl:when test="key('odd2odd-REPLACECONSTRAINT',$lookingAt)"/>
+            <xsl:when test="key('odd2odd-CHANGECONSTRAINT',$lookingAt)"/>
+            <xsl:otherwise>
+              <xsl:copy-of select="$CONSTRAINT"/>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:for-each>
+      </xsl:for-each>
+    </xsl:for-each>
+  </xsl:template>
+
+
+   <xsl:template match="@*|text()|processing-instruction()" mode="odd2odd-justcopy">
+      <xsl:copy-of select="."/>
+   </xsl:template>
+
+   <xsl:template match="*" mode="odd2odd-justcopy">
+      <xsl:copy>
+         <xsl:apply-templates
+	     select="*|@*|processing-instruction()|text()" mode="odd2odd-justcopy"/>
+      </xsl:copy>
+   </xsl:template>
+
+
+  <xsl:template match="processing-instruction()" mode="odd2odd-pass2">
+    <xsl:copy-of select="."/>
+  </xsl:template>
+
+
+  <xsl:template match="processing-instruction()" mode="odd2odd-pass3">
+    <xsl:copy-of select="."/>
+  </xsl:template>
+
+  <xsl:template match="@*|text()" mode="odd2odd-pass3">
+    <xsl:copy-of select="."/>
+  </xsl:template>
+
+  <xsl:template match="*" mode="odd2odd-pass3">
+    <xsl:choose>
+      <xsl:when test="self::rng:optional     and count(rng:zeroOrMore)=2    and count(*)=2">
+        <xsl:apply-templates select="*|@*|text()|processing-instruction()" mode="odd2odd-pass3"/>
+      </xsl:when>
+      <xsl:when test="count(*)=1">
+        <xsl:variable name="element" select="local-name()"/>
+        <xsl:choose>
+          <xsl:when test="*[local-name()=$element]">
+            <xsl:apply-templates select="*|@*|text()|processing-instruction()" mode="odd2odd-pass3"/>
+          </xsl:when>
+          <xsl:when test="$element='optional'         and rng:zeroOrMore">
+            <xsl:apply-templates select="*|@*|text()|processing-instruction()" mode="odd2odd-pass3"/>
+          </xsl:when>
+          <xsl:when test="$element='optional'         and rng:oneOrMore">
+            <xsl:apply-templates select="*|@*|text()|processing-instruction()" mode="odd2odd-pass3"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:copy>
+              <xsl:apply-templates select="*|@*|text()|processing-instruction()" mode="odd2odd-pass3"/>
+            </xsl:copy>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:copy>
+          <xsl:apply-templates select="*|@*|text()|processing-instruction()" mode="odd2odd-pass3"/>
+        </xsl:copy>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:function name="tei:workOutSource" as="xs:string">
+    <xsl:param name="e"/>
+    <xsl:variable name="loc">
+      <xsl:choose>
+	<xsl:when test="$e/@source">
+	  <xsl:value-of select="$e/@source"/>
+	</xsl:when>
+	<xsl:when test="$e/ancestor::tei:schemaSpec/@source">
+	  <xsl:value-of select="$e/ancestor::tei:schemaSpec/@source"/>
+	</xsl:when>
+	<xsl:otherwise>
+	  <xsl:value-of select="$DEFAULTSOURCE"/>
+	</xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:variable name="source">
+      <xsl:choose>
+	<xsl:when test="starts-with($loc,'/')">
+	  <xsl:value-of select="$loc"/>
+	</xsl:when>
+	<xsl:when test="starts-with($loc,'file:')">
+	  <xsl:value-of select="$loc"/>
+	</xsl:when>
+	<xsl:when test="starts-with($loc,'http:')">
+	  <xsl:value-of select="$loc"/>
+	</xsl:when>
+	<xsl:when test="starts-with($loc,'https:')">
+	  <xsl:value-of select="$loc"/>
+	</xsl:when>
+	<xsl:when test="starts-with($loc,'tei:')">
+	  <xsl:value-of
+	      select="replace($loc,'tei:',$defaultTEIServer)"/>
+	  <xsl:text>/xml/tei/odd/p5subset.xml</xsl:text>
+	</xsl:when>
+	<xsl:otherwise>
+	  <xsl:value-of select="$currentDirectory"/>
+	  <xsl:value-of select="$loc"/>
+	</xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:choose>
+      <xsl:when test="not(doc-available($source))">
+	<xsl:call-template name="die">
+	  <xsl:with-param name="message">
+	    <xsl:text>Source </xsl:text>
+	   <xsl:value-of select='$source'/>
+	   <xsl:text> not readable</xsl:text>
+	  </xsl:with-param>
+	</xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+	<xsl:if test="$verbose='true'">
+	  <xsl:message>
+	    <xsl:text>Setting source document to </xsl:text>
+	    <xsl:value-of  select="$source"/>
+	  </xsl:message>
+	</xsl:if>
+	<xsl:value-of select="$source"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:function>
+
+  <xsl:template name="die">
+    <xsl:param name="message"/>
+    <xsl:message terminate="yes">
+      <xsl:text>Error: odd2odd.xsl: </xsl:text> 
+      <xsl:value-of select="$message"/>
+    </xsl:message>
+  </xsl:template>
+
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/odds2/odd2odd.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/odds2/extract-isosch.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/odds2/extract-isosch.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/odds2/extract-isosch.xsl	(revision 258)
@@ -0,0 +1,173 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:teix="http://www.tei-c.org/ns/Examples"
+                xmlns:xi="http://www.w3.org/2001/XInclude"
+                xmlns:rng="http://relaxng.org/ns/structure/1.0"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:sch="http://purl.oclc.org/dsdl/schematron"
+                xmlns="http://purl.oclc.org/dsdl/schematron"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="2.0"
+                exclude-result-prefixes="tei rng teix sch xi
+					 #default">
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+    <desc>
+      <p> TEI stylesheet for simplifying TEI ODD markup </p>
+      <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+      <p>Author: See AUTHORS</p>
+      <p>Id: $Id: extract-isosch.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+      <p>Copyright: 2011, TEI Consortium</p>
+    </desc>
+  </doc>
+
+  <xsl:output encoding="utf-8" indent="yes" method="xml"/>
+  <xsl:param name="lang"></xsl:param>
+  <xsl:key name="NS" 
+	   match="sch:ns"
+	   use="1"/>
+
+  <xsl:key name="PATTERNS"
+	   match="sch:pattern"
+	   use="1"/>
+
+  <xsl:key name="CONSTRAINTS"
+	   match="tei:constraint"
+	   use="1"/>
+
+
+  <xsl:template match="/">
+      <schema queryBinding="xslt2">
+         <title>ISO Schematron rules</title>
+         <xsl:for-each select="key('NS',1)">
+            <xsl:choose>
+               <xsl:when test="ancestor::teix:egXML"/>
+	       <xsl:when test="ancestor::tei:constraintSpec/@xml:lang
+		 and not(ancestor::tei:constraintSpec/@xml:lang = $lang)"/>
+               <xsl:otherwise>
+                  <xsl:apply-templates select="."/>
+               </xsl:otherwise>
+            </xsl:choose>
+         </xsl:for-each>
+
+         <xsl:for-each select="key('PATTERNS',1)">
+            <xsl:choose>
+               <xsl:when test="ancestor::teix:egXML"/>
+	       <xsl:when test="ancestor::tei:constraintSpec/@xml:lang
+		 and not(ancestor::tei:constraintSpec/@xml:lang = $lang)"/>
+               <xsl:otherwise>
+                  <xsl:apply-templates select="."/>
+               </xsl:otherwise>
+            </xsl:choose>
+         </xsl:for-each>
+
+         <xsl:for-each select="key('CONSTRAINTS',1)">
+            <xsl:choose>
+               <xsl:when test="ancestor::teix:egXML"/>
+	       <xsl:when test="ancestor::tei:constraintSpec/@xml:lang
+		 and not(ancestor::tei:constraintSpec/@xml:lang = $lang)"/>
+               <xsl:otherwise>
+		 <xsl:variable name="patID">
+		   <xsl:choose>
+		     <xsl:when test="ancestor::tei:elementSpec">
+		       <xsl:value-of select="concat(ancestor::tei:elementSpec/@ident,'-constraint-',ancestor::tei:constraintSpec/@ident)"/>
+		     </xsl:when>
+		     <xsl:when test="ancestor::tei:classSpec">
+		       <xsl:value-of select="concat(ancestor::tei:classSpec/@ident,'-constraint-',ancestor::tei:constraintSpec/@ident)"/>
+		     </xsl:when>
+		     <xsl:when test="ancestor::tei:macroSpec">
+		       <xsl:value-of select="concat(ancestor::tei:macroSpec/@ident,'-constraint-',ancestor::tei:constraintSpec/@ident)"/>
+		     </xsl:when>
+                        <xsl:otherwise>
+                          <!-- Added 2010-07-03 by Syd Bauman to handle the case in which <constraintSpec> -->
+                          <!-- is a direct child of <schemaSpec>. -->
+                          <xsl:text>constraint-</xsl:text>
+                          <xsl:value-of select="ancestor::tei:constraintSpec/@ident"/>
+                          <xsl:if test="count( ../sch:rule ) > 1">
+                            <xsl:text>-</xsl:text>
+                            <xsl:number/>
+                          </xsl:if>
+                        </xsl:otherwise>
+                     </xsl:choose>
+                  </xsl:variable>
+		 <xsl:if test="sch:rule">
+		   <pattern id="{$patID}">
+		     <xsl:apply-templates select="sch:rule"/>
+		   </pattern>
+		 </xsl:if>
+		 <xsl:if test="sch:assert|sch:report">
+		   <pattern id="{$patID}">
+		     <rule>
+		       <xsl:attribute name="context">
+			 <xsl:text>tei:</xsl:text>
+			 <xsl:choose>
+			   <xsl:when test="ancestor::tei:elementSpec">
+			     <xsl:value-of
+				 select="ancestor::tei:elementSpec/@ident"/>
+			   </xsl:when>
+			   <xsl:otherwise>*</xsl:otherwise>
+			 </xsl:choose>
+		       </xsl:attribute>
+		       <xsl:apply-templates select="sch:assert|sch:report"/>
+		     </rule>
+		   </pattern>
+		 </xsl:if>
+               </xsl:otherwise>
+            </xsl:choose>
+         </xsl:for-each>
+      </schema>
+  </xsl:template>
+  
+  <xsl:template match="sch:rule[not(@context)]">
+    <rule>
+      <xsl:attribute name="context">
+	<xsl:text>tei:</xsl:text>
+	<xsl:value-of select="ancestor::tei:elementSpec/@ident"/>
+      </xsl:attribute>
+      <xsl:apply-templates/>
+    </rule>
+  </xsl:template>
+  
+  
+  <xsl:template match="@*|text()|comment()|processing-instruction()">
+      <xsl:copy-of select="."/>
+  </xsl:template>
+  
+  
+  <xsl:template match="sch:*">
+    <xsl:element name="{local-name()}">
+      <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
+    </xsl:element>
+  </xsl:template>
+  
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/odds2/extract-isosch.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/dtd/build-to.xml
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/dtd/build-to.xml	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/dtd/build-to.xml	(revision 258)
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="utf-8"?>
+<project basedir="." default="dist" name="teitodtd">
+<!--
+	This library is free software; you can redistribute it and/or
+	modify it under the terms of the GNU Lesser General Public
+	License as published by the Free Software Foundation; either
+	version 2.1 of the License, or (at your option) any later version.
+	
+	This library 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
+	Lesser General Public License for more details.
+	
+	You should have received a copy of the GNU Lesser General Public
+	License along with this library; if not, write to the Free Software
+	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+	
+        Id: $Id: build-to.xml 9887 2011-12-04 22:52:05Z rahtz $
+        Copyright: 2011, TEI Consortium<
+-->
+  <!--
+ Convert TEI documents into HTML files.
+ -->
+  <!-- Path to TEI XML file. -->
+  <property name="inputFile" value=""/>
+  <!-- Path where the output schema file will be saved. -->
+  <property name="outputFile" value=""/>
+  <!-- which profile -->
+  <property name="profile" value="default"/>
+  <!-- where does oxygen keep stuff -->
+  <property name="oxygenlib" value=""/>
+  <!-- Stylesheet for transformation -->
+  <property name="odd2dtd"
+	    value="../profiles/${profile}/dtd/to.xsl"/>
+  <property name="odd2oddxsl" value="../odds2/odd2odd.xsl"/>
+  <dirname property="inputFileDir" file="${inputFile}"/>
+  <dirname property="outputDir" file="${outputFile}"/>
+  <property name="outputTempDir" value="${outputDir}/temp-dir-for-ant"/>
+  <path id="classpath">
+    <pathelement path="${java.class.path}"/>
+  </path>
+  <target name="setup">
+    <delete dir="${outputTempDir}"/>
+    <mkdir dir="${outputTempDir}"/>
+  </target>
+  <target name="odd">
+    <echo>Do ODD processing</echo>
+    <xslt force="yes" style="${odd2oddxsl}" in="${inputFile}" out="${outputTempDir}/tmp1.xml" classpath="classpath">
+      <xmlcatalog>
+        <catalogpath>
+          <pathelement location="../../../../catalog.xml"/>
+          <pathelement location="../../../../../xhtml11/dtd/xhtmlcatalog.xml"/>
+        </catalogpath>
+      </xmlcatalog>
+      <factory name="net.sf.saxon.TransformerFactoryImpl"/>
+      <classpath location="${oxygenlib}/saxon9ee.jar"/>
+      <param name="lang" expression="${lang}" if="lang"/>
+      <param name="defaultSource" expression="${defaultSource}" if="defaultSource"/>
+      <param name="verbose" expression="${verbose}" if="verbose"/>
+    </xslt>
+  </target>
+  <target name="dist" depends="setup,odd,convert,cleanup"/>
+
+  <target name="convert">
+    <!-- Recreate temporary output directory -->
+    <!-- The transformation for HTML output. -->
+    <echo level="info">XSLT generate DTD files</echo>
+    <xslt force="yes" style="${odd2dtd}" in="${outputTempDir}/tmp1.xml" out="${outputFile}" classpath="classpath">
+      <xmlcatalog>
+        <catalogpath>
+          <pathelement location="../../../../catalog.xml"/>
+          <pathelement location="../../../../../xhtml11/dtd/xhtmlcatalog.xml"/>
+        </catalogpath>
+      </xmlcatalog>
+      <factory name="net.sf.saxon.TransformerFactoryImpl"/>
+      <classpath location="${oxygenlib}/saxon9ee.jar"/>
+      <param name="directory" expression="file:///${outputTempDir}"/>
+      <!-- supply name of language-->
+      <param name="lang" expression="${lang}" if="lang"/>
+      <!-- emit some diagnostics"-->
+      <param name="debug" expression="${debug}" if="debug"/>
+      <!-- be verbose-->
+      <param name="verbose" expression="${verbose}" if="verbose"/>
+    </xslt>
+  </target>
+
+  <target name="cleanup" unless="debug">  
+    <delete dir="${outputTempDir}"/>
+  </target>
+
+</project>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/dtd/build-to.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/bibtex/teitobib.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/bibtex/teitobib.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/bibtex/teitobib.xsl	(revision 258)
@@ -0,0 +1,176 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xpath-default-namespace="http://www.tei-c.org/ns/1.0"
+                version="2.0">
+  <xsl:output method="text"/>
+
+  <xsl:key name="B" match="biblStruct" use="1"/>
+    <xsl:strip-space elements="*"/>
+
+  <xsl:template match="/">
+
+    <xsl:for-each select="key('B',1)">
+      <xsl:variable name="type">
+	<xsl:choose>
+	  <xsl:when test="idno[@type='url']">
+	    <xsl:text>techreport</xsl:text>
+	  </xsl:when>
+	  <xsl:when test="not(analytic)">
+	    <xsl:text>book</xsl:text>
+	  </xsl:when>
+	  <xsl:when test="monogr/imprint/biblScope[@type='volume']">
+	    <xsl:text>article</xsl:text>	    
+	  </xsl:when>
+	  <xsl:otherwise>
+	    <xsl:text>incollection</xsl:text>	    
+	  </xsl:otherwise>
+	</xsl:choose>
+      </xsl:variable>
+      <xsl:text>@</xsl:text>
+      <xsl:value-of select="$type"/>
+      <xsl:text>{</xsl:text>
+      <xsl:value-of select="@xml:id"/>
+      <xsl:text>,&#10;</xsl:text>
+      <xsl:variable name="all">
+	<xsl:apply-templates/>
+      </xsl:variable>
+      <xsl:for-each select="tokenize($all,'@')">
+	<xsl:if test="not(.='')">
+	  <xsl:text>	</xsl:text>
+	  <xsl:value-of select="."/>
+	  <xsl:if test="not(position()=last())">,</xsl:if>
+	  <xsl:text>&#10;</xsl:text>
+	</xsl:if>
+	</xsl:for-each>
+      <xsl:text>}&#10;&#10;</xsl:text>
+    </xsl:for-each>
+  </xsl:template>
+
+<xsl:template match="publisher">
+  <xsl:text>@publisher={</xsl:text>
+  <xsl:value-of select="."/>
+  <xsl:text>}</xsl:text>
+</xsl:template>
+
+<xsl:template match="note">
+  <xsl:text>@note={</xsl:text>
+  <xsl:value-of select="."/>
+  <xsl:text>}</xsl:text>
+</xsl:template>
+
+<xsl:template match="idno[@type='url']">
+  <xsl:text>@url={</xsl:text>
+  <xsl:value-of select="."/>
+  <xsl:text>}</xsl:text>
+</xsl:template>
+
+<xsl:template match="pubPlace">
+  <xsl:text>@address={</xsl:text>
+  <xsl:value-of select="."/>
+  <xsl:text>}</xsl:text>
+</xsl:template>
+
+<xsl:template match="date">
+  <xsl:text>@year={</xsl:text>
+  <xsl:value-of select="."/>
+  <xsl:text>}</xsl:text>
+</xsl:template>
+
+<xsl:template match="series/title">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="title">
+  <xsl:variable name="name">
+    <xsl:choose>
+      <xsl:when test="@level='a' or not(ancestor::biblStruct/analytic)">title</xsl:when>
+      <xsl:when test="@level='j' or parent::monogr/imprint/biblScope[@type='volume']">journal</xsl:when>
+      <xsl:when test="@level='m' or parent::monogr">booktitle</xsl:when>
+      <xsl:when test="@level='s'">series</xsl:when>
+      <xsl:otherwise>title</xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+  <xsl:text>@</xsl:text>
+  <xsl:value-of select="$name"/>
+  <xsl:text>={{</xsl:text>
+  <xsl:apply-templates/>
+  <xsl:text>}}</xsl:text>
+</xsl:template>
+
+<xsl:template match="q">
+  <xsl:text>``</xsl:text>
+  <xsl:apply-templates/>
+  <xsl:text>''</xsl:text>
+</xsl:template>
+
+<xsl:template match="series">
+  <xsl:text>@type={</xsl:text>
+  <xsl:apply-templates/>
+  <xsl:text>}</xsl:text>
+</xsl:template>
+
+<xsl:template match="biblScope[@type='pages']">
+  <xsl:text>@pages={</xsl:text>
+  <xsl:apply-templates/>
+  <xsl:text>}</xsl:text>
+</xsl:template>
+
+<xsl:template match="biblScope[@type='volume']">
+  <xsl:text>@volume={</xsl:text>
+  <xsl:apply-templates/>
+  <xsl:text>}</xsl:text>
+</xsl:template>
+
+<xsl:template match="biblScope[@type='issue']">
+  <xsl:text>@issue={</xsl:text>
+  <xsl:apply-templates/>
+  <xsl:text>}</xsl:text>
+</xsl:template>
+
+<xsl:template match="edition">
+  <xsl:text>@edition={</xsl:text>
+  <xsl:apply-templates/>
+  <xsl:text>}</xsl:text>
+</xsl:template>
+
+<xsl:template match="editor">
+  <xsl:if test="not(preceding-sibling::editor)">
+    <xsl:text>@editor={</xsl:text>
+    <xsl:for-each select="../editor">
+      <xsl:choose>
+	<xsl:when test="forename and surname">
+	  <xsl:value-of select="forename"/>
+	  <xsl:text> </xsl:text>
+	  <xsl:value-of select="surname"/>
+	</xsl:when>
+	<xsl:otherwise>
+	  <xsl:apply-templates/>
+	</xsl:otherwise>
+      </xsl:choose>
+      <xsl:if test="following-sibling::editor"> and </xsl:if>
+    </xsl:for-each>
+    <xsl:text>}</xsl:text>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="author">
+  <xsl:if test="not(preceding-sibling::author)">
+    <xsl:text>@author={</xsl:text>
+    <xsl:for-each select="../author">
+      <xsl:choose>
+	<xsl:when test="forename and surname">
+	  <xsl:value-of select="forename"/>
+	  <xsl:text> </xsl:text>
+	  <xsl:value-of select="surname"/>
+	</xsl:when>
+	<xsl:otherwise>
+	  <xsl:apply-templates/>
+	</xsl:otherwise>
+      </xsl:choose>
+      <xsl:if test="following-sibling::author"> and </xsl:if>
+    </xsl:for-each>
+    <xsl:text>}</xsl:text>
+  </xsl:if>
+</xsl:template>
+
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/bibtex/teitobib.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/figures.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/figures.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/figures.xsl	(revision 258)
@@ -0,0 +1,537 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml" 
+                xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
+                xmlns:fo="http://www.w3.org/1999/XSL/Format"
+                xmlns:svg="http://www.w3.org/2000/svg"
+                xmlns:html="http://www.w3.org/1999/xhtml"
+                xmlns:teidocx="http://www.tei-c.org/ns/teidocx/1.0"
+                xmlns:m="http://www.w3.org/1998/Math/MathML"
+                xmlns:rng="http://relaxng.org/ns/structure/1.0"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/"                
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                exclude-result-prefixes="svg a fo html rng tei teidocx teix m"
+                version="2.0">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet dealing with elements from the figures module,
+      making HTML output. </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: figures.xsl 10057 2012-01-21 16:57:14Z rahtz $</p>
+         <p>Copyright: 2011, TEI Consortium</p>
+      </desc>
+   </doc>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process elements m:*|@*|comment()|processing-instruction()|text()</desc>
+   </doc>
+  <xsl:template match="m:*|@*|comment()|processing-instruction()|text()" mode="math">
+      <xsl:copy>
+         <xsl:apply-templates mode="math" select="*|@*|processing-instruction()|text()"/>
+      </xsl:copy>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process elements m:math</desc>
+   </doc>
+  <xsl:template match="m:math">
+      <m:math>
+         <xsl:copy-of select="@*"/>
+         <xsl:apply-templates mode="math"/>
+      </m:math>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element cell</desc>
+   </doc>
+  <xsl:template match="tei:cell">
+    <xsl:variable name="cellname">
+      <xsl:choose>
+	<xsl:when test="parent::tei:row[@rend='thead']">th</xsl:when>
+	<xsl:otherwise>td</xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:element name="{$cellname}">
+      <xsl:for-each select="@*">
+	<xsl:choose>
+	  <xsl:when test="name(.) = 'width' or name(.) =
+			  'border' or name(.) = 'cellspacing'
+			  or name(.) = 'cellpadding'">
+	    <xsl:copy-of select="."/>
+	  </xsl:when>
+	  <xsl:when test="name(.)='rend' and starts-with(.,'width:')">
+	    <xsl:attribute name="width">
+	      <xsl:value-of select="substring-after(.,'width:')"/>
+	    </xsl:attribute>
+	  </xsl:when>
+	  <xsl:when test="name(.)='rend' and starts-with(.,'class:')">
+	    <xsl:attribute name="class">
+	      <xsl:value-of select="substring-after(.,'class:')"/>
+	    </xsl:attribute>
+	  </xsl:when>
+	  <xsl:when test="name(.)='rend' and starts-with(.,'style=')">
+	    <xsl:attribute name="style">
+	      <xsl:value-of select="substring-after(.,'style=')"/>
+	    </xsl:attribute>
+	  </xsl:when>
+	  <xsl:when test="name(.)='rend'">
+	    <xsl:attribute name="class">
+	      <xsl:value-of select="."/>
+	    </xsl:attribute>
+	  </xsl:when>
+	  <xsl:when test="name(.)='cols'">
+	    <xsl:attribute name="colspan">
+	      <xsl:value-of select="."/>
+	    </xsl:attribute>
+	  </xsl:when>
+	  <xsl:when test="name(.)='rows'">
+	    <xsl:attribute name="rowspan">
+	      <xsl:value-of select="."/>
+	    </xsl:attribute>
+	  </xsl:when>
+	  <xsl:when test="name(.)='align'">
+	    <xsl:attribute name="align">
+	      <xsl:value-of select="."/>
+	    </xsl:attribute>
+	  </xsl:when>
+	</xsl:choose>
+      </xsl:for-each>
+      <xsl:choose>
+	<xsl:when test="@teidocx:align">
+	  <xsl:attribute name="align">
+	    <xsl:value-of select="@teidocx:align"/>
+	  </xsl:attribute>
+	</xsl:when>
+	<xsl:when test="@align"/>
+	<xsl:when test="not($cellAlign='left')">
+	  <xsl:attribute name="align">
+	    <xsl:value-of select="$cellAlign"/>
+	  </xsl:attribute>
+	</xsl:when>
+      </xsl:choose>
+      <xsl:if test="@role and not (@rend)">
+	<xsl:attribute name="class">
+	  <xsl:value-of select="@role"/>
+	</xsl:attribute>
+      </xsl:if>
+      <xsl:if test="@xml:id">	   
+	<xsl:call-template name="makeAnchor"/>
+      </xsl:if>
+      <xsl:apply-templates/>
+    </xsl:element>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element figDesc</desc>
+   </doc>
+  <xsl:template match="tei:figDesc"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element figure</desc>
+   </doc>
+  <xsl:template match="tei:figure">
+    <xsl:variable name="container">
+      <xsl:choose>
+	<xsl:when test="$outputTarget='html5'">figure</xsl:when>
+	<xsl:otherwise>div</xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:choose>
+      <xsl:when test="parent::tei:head or @rend='inline' or @place='inline'">
+	<xsl:apply-templates/>
+      </xsl:when>
+      <xsl:when test="parent::tei:ref">
+	<xsl:apply-templates/>
+      </xsl:when>
+      <xsl:otherwise>
+	<xsl:element name="{$container}">
+	  <xsl:choose>
+	    <xsl:when test="@rend">
+	      <xsl:attribute name="class">
+		<xsl:text>figure </xsl:text>
+		<xsl:value-of select="@rend"/>
+	      </xsl:attribute>
+	    </xsl:when>
+	    <xsl:when test="@rendition">
+	      <xsl:call-template name="applyRendition"/>
+	    </xsl:when>
+	    <xsl:otherwise>
+	      <xsl:attribute name="class">
+		<xsl:text>figure</xsl:text>
+	      </xsl:attribute>
+	    </xsl:otherwise>
+	  </xsl:choose>
+	  <xsl:if test="@xml:id">
+	    <xsl:attribute name="id">
+	      <xsl:value-of select="@xml:id"/>
+	    </xsl:attribute>
+	  </xsl:if>
+	  <xsl:call-template name="figureHook"/>
+	  <xsl:apply-templates/>
+	</xsl:element>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element figure/tei:head</desc>
+  </doc>
+  <xsl:template match="tei:figure/tei:head">
+    <xsl:variable name="captionlabel">
+      <xsl:for-each select="..">
+	<xsl:call-template name="calculateFigureNumber"/>
+      </xsl:for-each>
+    </xsl:variable>
+    <xsl:choose>
+      <xsl:when test="$outputTarget='html5'">
+	<figcaption>
+	  <xsl:if test="@rend">
+	    <xsl:attribute name="class" select="@rend"/>
+	  </xsl:if>
+	  <xsl:call-template name="rendering"/>
+	  <xsl:text>. </xsl:text>
+	  <xsl:copy-of select="$captionlabel"/>
+	  <xsl:apply-templates/>
+	</figcaption>
+      </xsl:when>
+      <xsl:otherwise>
+	<span class="caption {@rend}">
+	  <xsl:copy-of select="$captionlabel"/>
+	  <xsl:text>. </xsl:text>
+	  <xsl:apply-templates/>
+	</span>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element formula</desc>
+  </doc>
+  <xsl:template match="tei:formula" mode="xref">
+    <xsl:number/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element graphic</desc>
+   </doc>
+  <xsl:template match="tei:graphic">
+      <xsl:call-template name="showGraphic"/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element row</desc>
+   </doc>
+  <xsl:template match="tei:row">
+      <tr>
+         <xsl:call-template name="rendToClass">
+	           <xsl:with-param name="default"/>
+         </xsl:call-template>
+         <xsl:if test="@role">
+            <xsl:attribute name="class">
+               <xsl:value-of select="@role"/>
+            </xsl:attribute>
+         </xsl:if>
+         <xsl:apply-templates/>
+      </tr>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element table</desc>
+   </doc>
+  <xsl:template match="tei:table">
+      <div>
+         <xsl:attribute name="class">
+	   <xsl:text>table</xsl:text>
+	   <xsl:if test="@align">
+	     <xsl:text> </xsl:text>
+	     <xsl:value-of select="@align"/>
+	   </xsl:if>
+	 </xsl:attribute>
+	 <xsl:if test="@xml:id">	   
+	   <xsl:call-template name="makeAnchor"/>
+	 </xsl:if>
+	 <table>
+	   <xsl:call-template name="rendToClass">
+	     <xsl:with-param name="id">false</xsl:with-param>
+	   </xsl:call-template>
+	   <xsl:if test="@rend='frame' or @rend='rules'">
+	     <xsl:attribute name="rules">all</xsl:attribute>
+	     <xsl:attribute name="border">1</xsl:attribute>
+	   </xsl:if>
+	   <xsl:for-each select="@*">
+	     <xsl:if test="name(.)='summary' or name(.) = 'width' or name(.) = 'border' or name(.) = 'frame' or name(.) = 'rules' or name(.) = 'cellspacing' or name(.) = 'cellpadding'">
+	       <xsl:copy-of select="."/>
+	     </xsl:if>
+	   </xsl:for-each>
+	   <xsl:if test="tei:head">
+	     <caption>
+	       <xsl:apply-templates select="tei:head"/>
+	     </caption>
+	   </xsl:if>
+	   <xsl:choose>
+	     <xsl:when test="tei:row[@rend='thead']">
+	       <thead>
+		 <xsl:apply-templates
+		     select="tei:row[@rend='thead']"/>
+	       </thead>
+	       <tbody>
+		 <xsl:apply-templates select="tei:row[not(@rend='thead')]"/>
+	       </tbody>
+	     </xsl:when>
+	     <xsl:otherwise>
+	       <xsl:apply-templates select="tei:row"/>
+	     </xsl:otherwise>
+	   </xsl:choose>
+	 </table>
+	 <xsl:apply-templates select="tei:note"/>
+      </div>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element table[@rend='simple']</desc>
+   </doc>
+  <xsl:template match="tei:table[@rend='simple']">
+      <table>
+         <xsl:choose>
+	           <xsl:when test="@rend">
+	              <xsl:attribute name="class">
+	                 <xsl:value-of select="@rend"/>
+               </xsl:attribute>
+	           </xsl:when>
+	           <xsl:when test="@rendition">
+	              <xsl:call-template name="applyRendition"/>
+	           </xsl:when>
+         </xsl:choose>
+         <xsl:for-each select="@*">
+            <xsl:if test="name(.)='summary'    or name(.) = 'width'    or name(.) = 'border'    or name(.) = 'frame'    or name(.) = 'rules'    or name(.) = 'cellspacing'    or name(.) = 'cellpadding'">
+               <xsl:copy-of select="."/>
+            </xsl:if>
+         </xsl:for-each>
+	 <xsl:if test="@xml:id">
+	   <xsl:call-template name="makeAnchor"/>
+	 </xsl:if>
+         <xsl:apply-templates/>
+      </table>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[html] <param name="name">name</param>
+         <param name="value">value</param>
+      </desc>
+   </doc>
+  <xsl:template name="setDimension">
+      <xsl:param name="name"/>
+      <xsl:param name="value"/>
+
+      <xsl:variable name="calcvalue">
+         <xsl:choose>
+            <xsl:when test="contains($value,'in')">
+               <xsl:value-of select="round($dpi * number(substring-before($value,'in')))"/>
+            </xsl:when>
+            <xsl:when test="contains($value,'pt')">
+               <xsl:value-of select="round($dpi * (number(substring-before($value,'pt')) div 72))"/>
+            </xsl:when>
+            <xsl:when test="contains($value,'cm')">
+               <xsl:value-of select="round($dpi * (number(substring-before($value,'cm')) div 2.54 ))"/>
+            </xsl:when>
+            <xsl:when test="contains($value,'px')">
+               <xsl:value-of select="substring-before($value,'px')"/>
+            </xsl:when>
+            <xsl:otherwise>
+               <xsl:value-of select="$value"/>
+            </xsl:otherwise>
+         </xsl:choose>
+      </xsl:variable>
+      <xsl:attribute name="{$name}">
+         <xsl:value-of select="$calcvalue"/>
+      </xsl:attribute>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[html] </desc>
+   </doc>
+  <xsl:template name="showGraphic">
+      <xsl:variable name="File">
+         <xsl:choose>
+            <xsl:when test="@url">
+               <xsl:value-of select="@url"/>
+               <xsl:if test="not(contains(@url,'.'))">
+                  <xsl:value-of select="$graphicsSuffix"/>
+               </xsl:if>
+            </xsl:when>
+            <xsl:otherwise>
+               <xsl:message terminate="yes">Cannot work out how to do a graphic
+          </xsl:message>
+            </xsl:otherwise>
+         </xsl:choose>
+      </xsl:variable>
+      <xsl:variable name="Alt">
+         <xsl:choose>
+            <xsl:when test="tei:desc">
+               <xsl:for-each select="tei:desc">
+		 <xsl:apply-templates mode="plain"/>
+	       </xsl:for-each>
+            </xsl:when>
+            <xsl:when test="tei:figDesc">
+               <xsl:for-each select="tei:figDesc">
+	                 <xsl:apply-templates mode="plain"/>
+	              </xsl:for-each>
+            </xsl:when>
+            <xsl:when test="tei:head">
+               <xsl:value-of select="tei:head/text()"/>
+            </xsl:when>
+            <xsl:when test="parent::tei:figure/tei:figDesc">
+               <xsl:for-each select="parent::tei:figure/tei:figDesc">
+	                 <xsl:apply-templates mode="plain"/>
+	              </xsl:for-each>
+            </xsl:when>
+            <xsl:when test="parent::tei:figure/tei:head">
+               <xsl:value-of select="parent::tei:figure/tei:head/text()"/>
+            </xsl:when>
+         </xsl:choose>
+      </xsl:variable>
+      <xsl:choose>
+	<xsl:when test="$showFigures='true'">
+	  <xsl:choose>
+	    <xsl:when test="@type='thumbnail'"/>
+	    <xsl:when test="starts-with(@mimeType, 'video')">
+	      <video src="{$graphicsPrefix}{$File}"
+		     controls="controls">
+		<xsl:if test="../tei:graphic[@type='thumbnail']">
+		  <xsl:attribute name="poster">
+		    <xsl:value-of select="../tei:graphic[@type='thumbnail']/@url"/>
+		  </xsl:attribute>
+		</xsl:if>
+	      </video>
+	    </xsl:when>
+	    <xsl:otherwise>
+	      <img src="{$graphicsPrefix}{$File}">
+		<xsl:attribute name="alt">
+		  <xsl:value-of select="$Alt"/>
+		</xsl:attribute>
+		<xsl:call-template name="imgHook"/>
+		<xsl:if test="@xml:id">
+		  <xsl:attribute name="id">
+		    <xsl:value-of select="@xml:id"/>
+		  </xsl:attribute>
+		</xsl:if>
+		<xsl:call-template name="rendToClass"/>
+		<xsl:if test="@width">
+		  <xsl:call-template name="setDimension">
+		    <xsl:with-param name="value">
+		      <xsl:value-of select="@width"/>
+		    </xsl:with-param>
+		    <xsl:with-param name="name">width</xsl:with-param>
+		  </xsl:call-template>
+		</xsl:if>
+		<xsl:if test="@height">
+		  <xsl:call-template name="setDimension">
+		    <xsl:with-param name="value">
+		      <xsl:value-of select="@height"/>
+		    </xsl:with-param>
+		    <xsl:with-param name="name">height</xsl:with-param>
+		  </xsl:call-template>
+		</xsl:if>
+	      </img>
+	    </xsl:otherwise>
+	  </xsl:choose>	  
+         </xsl:when>
+         <xsl:otherwise>
+            <div class="altfigure">
+	      <xsl:call-template name="i18n">
+		<xsl:with-param name="word">figureWord</xsl:with-param>
+	      </xsl:call-template>
+	      <xsl:text> </xsl:text>
+	      <xsl:for-each select="self::tei:figure|parent::tei:figure">
+		<xsl:number count="tei:figure[tei:head]" level="any"/>
+	      </xsl:for-each>
+	      <xsl:text> </xsl:text>
+	      <xsl:value-of select="$File"/>
+	      <xsl:text> [</xsl:text>
+	      <xsl:value-of select="$Alt"/>
+	      <xsl:text>] </xsl:text>
+	    </div>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <xsl:template match="tei:binaryObject">
+      <img>
+         <xsl:attribute name="src">
+            <xsl:text>data:</xsl:text>
+            <xsl:value-of select="@mimetype"/>
+            <xsl:text>;base64,</xsl:text>
+            <xsl:copy-of select="text()"/>
+         </xsl:attribute>
+         <xsl:if test="@width">
+            <xsl:call-template name="setDimension">
+               <xsl:with-param name="value">
+                  <xsl:value-of select="@width"/>
+               </xsl:with-param>
+               <xsl:with-param name="name">width</xsl:with-param>
+            </xsl:call-template>
+         </xsl:if>
+         <xsl:if test="@height">
+            <xsl:call-template name="setDimension">
+               <xsl:with-param name="value">
+                  <xsl:value-of select="@height"/>
+               </xsl:with-param>
+               <xsl:with-param name="name">height</xsl:with-param>
+            </xsl:call-template>
+         </xsl:if>
+      </img>
+      <!-- also alt -->
+    <!-- this is what we'll need for IE:
+<style type="text/css">
+   img {behavior: expression(fixBase64(this));}
+  </style>
+  <script type="text/javascript">
+  	// a regular expression to test for Base64 data
+	var BASE64_DATA = /^data:.*;base64/i;
+	// path to the PHP module that will decode the encoded data
+	var base64Path = "/my/base64.php";
+	function fixBase64(img) {
+		// stop the CSS expression from being endlessly evaluated
+		img.runtimeStyle.behavior = "none";
+		// check the image src
+		if (BASE64_DATA.test(img.src)) {
+		// pass the data to the PHP routine
+		img.src = base64Path + "?" + img.src.slice(5);
+		}
+	};
+  </script>
+  Dean Edwards http://dean.edwards.name/weblog/2005/06/base64-sexy/
+<?php
+$data = split(";", $_SERVER["REDIRECT_QUERY_STRING"]);
+$type = $data[0];
+$data = split(",", $data[1]);
+header("Content-type: ".$type);
+echo base64_decode($data[1]);
+?>
+-->
+  </xsl:template>
+
+  <xsl:template match="svg:*">
+      <xsl:copy-of select="."/>
+  </xsl:template>
+
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/figures.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/textstructure.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/textstructure.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/textstructure.xsl	(revision 258)
@@ -0,0 +1,2935 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml"  xmlns:xlink="http://www.w3.org/1999/xlink"
+		xmlns:teidocx="http://www.tei-c.org/ns/teidocx/1.0"
+		xmlns:its="http://www.w3.org/2005/11/its"
+                xmlns:html="http://www.w3.org/1999/xhtml"
+                xmlns:dbk="http://docbook.org/ns/docbook"
+                xmlns:rng="http://relaxng.org/ns/structure/1.0"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"
+                xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
+                xmlns:fo="http://www.w3.org/1999/XSL/Format"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                exclude-result-prefixes="a fo dbk xlink rng tei html
+					 teix its teidocx"
+                version="2.0">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet dealing with elements from the textstructure
+      module, making HTML output. </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: textstructure.xsl 10109 2012-02-22 12:18:38Z rahtz $</p>
+         <p>Copyright: 2011, TEI Consortium</p>
+      </desc>
+   </doc>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process elements * in inner mode</desc>
+   </doc>
+  <xsl:template match="*" mode="innertext">
+      <xsl:apply-templates select="."/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process elements * in paging mode</desc>
+   </doc>
+  <xsl:template match="*" mode="paging">
+      <xsl:choose>
+         <xsl:when test="self::tei:divGen[@type='summary']">
+            <xsl:call-template name="summaryToc"/>
+         </xsl:when>
+         <xsl:when test="self::tei:divGen">
+            <xsl:apply-templates select="."/>
+         </xsl:when>
+         <xsl:when test="starts-with(local-name(),'div')">
+            <xsl:if test="not(preceding-sibling::tei:*) or preceding-sibling::tei:titlePage">
+               <xsl:call-template name="doDivBody">
+		 <xsl:with-param name="Depth">2</xsl:with-param>
+		 <xsl:with-param name="nav">true</xsl:with-param>
+	       </xsl:call-template>
+            </xsl:if>
+         </xsl:when>
+         <xsl:when test="local-name(..)='front'">
+            <xsl:apply-templates select="."/>
+            <xsl:apply-templates mode="paging" select="following-sibling::*[1]"/>
+            <xsl:apply-templates mode="paging" select="../../tei:body/*[1]"/>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:apply-templates select="."/>
+            <xsl:apply-templates mode="paging" select="following-sibling::*[1]"/>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+         <p>Process root /</p>
+	 <p xmlns="http://www.w3.org/1999/xhtml"> processors must support `key' </p>
+      </desc>
+   </doc>
+  <xsl:template match="/">
+    <xsl:call-template name="processTEI"/>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+         <p>Process top-level elements /</p>
+      </desc>
+   </doc>
+   <xsl:template name="processTEI">
+     <xsl:choose>
+       <!-- there are various choices of how to proceed, driven by
+	    
+	    $pageLayout: Simple, CSS, Table
+	    
+	    $STDOUT: true or false
+	    
+	    $splitLevel: -1 to 3
+	    
+	    $requestedID: requests a particular page
+       -->
+       <!-- we are making a composite layout and there is a TEI or teiCorpus element -->
+       <xsl:when test="($pageLayout = 'CSS' or $pageLayout = 'Table') and (tei:TEI or tei:teiCorpus)">
+	 <xsl:if test="$verbose='true'">
+	   <xsl:message>case 1: pageLayout <xsl:value-of select="$pageLayout"/>
+	   </xsl:message>
+	 </xsl:if>
+	 <xsl:for-each select="tei:TEI|tei:teiCorpus">
+	   <xsl:call-template name="doPageTable">
+	     <xsl:with-param name="currentID" select="$requestedID"/>
+	   </xsl:call-template>
+	 </xsl:for-each>
+	 <xsl:if test="$STDOUT='false'">
+	   <xsl:call-template name="doDivs"/>
+	 </xsl:if>
+       </xsl:when>
+       <!-- we have been asked for a particular section of the document -->
+       <xsl:when test="not($requestedID='')">
+	 <xsl:if test="$verbose='true'">
+	   <xsl:message>case 3: ID <xsl:value-of select="$requestedID"/>, pageLayout
+	   <xsl:value-of select="$pageLayout"/>
+	   </xsl:message>
+	 </xsl:if>
+	 <xsl:choose>
+	   <xsl:when test="$requestedID='prelim___'">
+	     <xsl:apply-templates/>
+	   </xsl:when>
+	   <xsl:when test="count(id($requestedID))&gt;0">
+	     <xsl:for-each select="id($requestedID)">
+	       <xsl:call-template name="writeDiv"/>
+	     </xsl:for-each>
+	   </xsl:when>
+	   <xsl:otherwise>
+	     <!-- the passed ID is a pseudo-XPath expression
+		  which starts below TEI/text.
+		  The real XPath syntax is changed to avoid problems
+	     -->
+	     <xsl:apply-templates mode="xpath" select="tei:TEI/tei:text">
+	       <xsl:with-param name="xpath" select="$requestedID"/>
+	     </xsl:apply-templates>
+	   </xsl:otherwise>
+	 </xsl:choose>
+       </xsl:when>
+       <!-- we want HTML to just splurge out-->
+       <xsl:when test="$STDOUT='true'">
+	 <xsl:if test="$verbose='true'">
+	   <xsl:message>case 4: write to stdout, pageLayout <xsl:value-of select="$pageLayout"/>
+	   </xsl:message>
+	 </xsl:if>
+	 <xsl:apply-templates/>
+       </xsl:when>
+       <!-- we want the document split up into separate files -->
+       <xsl:when test="tei:TEI or tei:teiCorpus and number($splitLevel)&gt;-1">
+	 <xsl:if test="$verbose='true'">
+	   <xsl:message>case 5: split output, <xsl:value-of select="$splitLevel"/> pageLayout <xsl:value-of select="$pageLayout"/>
+	   </xsl:message>
+	 </xsl:if>
+	 <xsl:apply-templates mode="split"/>
+       </xsl:when>
+       <!-- we want the whole document, in an output file -->
+       <xsl:otherwise>
+	 <xsl:if test="$verbose='true'">
+	   <xsl:message>case 6: one document, pageLayout <xsl:value-of select="$pageLayout"/>
+	   </xsl:message>
+	 </xsl:if>
+	 <xsl:choose>
+	   <xsl:when test="$masterFile='' or $STDOUT='true'">
+	     <xsl:apply-templates/>
+	   </xsl:when>
+	   <xsl:otherwise>
+	     
+	     <xsl:variable name="outName">
+	       <xsl:call-template name="outputChunkName">
+		 <xsl:with-param name="ident">
+		   <xsl:value-of select="$masterFile"/>
+		 </xsl:with-param>
+	       </xsl:call-template>
+	     </xsl:variable>
+	     
+	     <xsl:if test="$verbose='true'">
+	       <xsl:message>Opening file <xsl:value-of select="$outName"/>
+	       </xsl:message>
+	     </xsl:if>
+	     <xsl:result-document doctype-public="{$doctypePublic}" doctype-system="{$doctypeSystem}"
+				  encoding="{$outputEncoding}"
+				  href="{$outName}"
+				  method="{$outputMethod}">
+	       <xsl:apply-templates/>
+	     </xsl:result-document>
+	     
+	     <xsl:if test="$verbose='true'">
+	       <xsl:message>Closing file <xsl:value-of select="$outName"/>
+	       </xsl:message>
+	     </xsl:if>
+	     
+	   </xsl:otherwise>
+	 </xsl:choose>
+       </xsl:otherwise>
+     </xsl:choose>
+   </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process elements processing-instruction()[name()='xmltex']</desc>
+   </doc>
+  <xsl:template match="processing-instruction()[name()='xmltex']">
+      <xsl:value-of select="."/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element *</desc>
+   </doc>
+  <xsl:template match="tei:*" mode="generateNextLink">
+      <span class="nextLink">
+         <xsl:text> </xsl:text>
+         <xsl:call-template name="i18n">
+	           <xsl:with-param name="word">nextWord</xsl:with-param>
+         </xsl:call-template>
+         <xsl:call-template name="navInterSep"/>
+      </span>
+      <a class="navigation">
+         <xsl:attribute name="href">
+	           <xsl:apply-templates mode="generateLink" select="."/>
+         </xsl:attribute>
+         <xsl:call-template name="headerLink">
+	           <xsl:with-param name="minimal" select="$minimalCrossRef"/>
+         </xsl:call-template>
+      </a>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process elements looking for something to link to backwards</desc>
+   </doc>
+  <xsl:template match="tei:*" mode="generatePreviousLink">
+      <span class="previousLink">
+         <xsl:text> </xsl:text>
+         <xsl:call-template name="i18n">
+            <xsl:with-param name="word">previousWord</xsl:with-param>
+         </xsl:call-template>
+         <xsl:call-template name="navInterSep"/>
+      </span>
+      <a class="navigation">
+         <xsl:attribute name="href">
+            <xsl:apply-templates mode="generateLink" select="."/>
+         </xsl:attribute>
+         <xsl:call-template name="headerLink">
+            <xsl:with-param name="minimal" select="$minimalCrossRef"/>
+         </xsl:call-template>
+      </a>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+         <p>Process any element in xpath mode</p>
+         <p>
+            <p xmlns="http://www.w3.org/1999/xhtml"> This nice bit of code is from Jeni Tennison </p>
+         </p>
+         <param name="xpath">xpath</param>
+         <param name="action">action</param>
+      </desc>
+   </doc>
+  <xsl:template match="tei:*" mode="xpath">
+      <xsl:param name="xpath"/>
+      <xsl:param name="action"/>
+      <xsl:choose>
+      <!-- if there is a path -->
+      <xsl:when test="$xpath">
+        <!-- step is the part before the '_' (if there is one) -->
+        <xsl:variable name="step">
+               <xsl:choose>
+                  <xsl:when test="contains($xpath, '_')">
+                     <xsl:value-of select="substring-before($xpath, '_')"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:value-of select="$xpath"/>
+                  </xsl:otherwise>
+               </xsl:choose>
+            </xsl:variable>
+            <!-- the child's name is the part before the '.' -->
+        <xsl:variable name="childName" select="substring-before($step, '.')"/>
+            <!-- and its index is the part after '.' -->
+        <xsl:variable name="childIndex" select="substring-after($step, '.')"/>
+            <!-- so apply templates to that child, passing in the $xpath
+	     left after the first step -->
+        <xsl:apply-templates mode="xpath" select="*[name() = $childName]          [number($childIndex)]">
+               <xsl:with-param name="xpath" select="substring-after($xpath, '_')"/>
+               <xsl:with-param name="action" select="$action"/>
+            </xsl:apply-templates>
+         </xsl:when>
+         <!-- if there's no path left, then this is the element we want -->
+      <xsl:otherwise>
+            <xsl:choose>
+               <xsl:when test="$action='header'">
+                  <xsl:apply-templates mode="xref" select="."/>
+               </xsl:when>
+               <xsl:when test="$action='notes'">
+                  <xsl:call-template name="printNotes"/>
+               </xsl:when>
+               <xsl:when test="$action='toclist'">
+                  <xsl:call-template name="linkListContents">
+                     <xsl:with-param name="style" select="'toclist'"/>
+                  </xsl:call-template>
+               </xsl:when>
+               <xsl:when test="starts-with(local-name(),'div') and      $pageLayout='Table'      or      $pageLayout='CSS'">
+                  <xsl:call-template name="doDivBody">
+		    <xsl:with-param name="Depth">2</xsl:with-param>
+		    <xsl:with-param name="nav">true</xsl:with-param>
+		  </xsl:call-template>
+               </xsl:when>
+               <xsl:when test="self::tei:divGen[@type='summary']">
+                  <xsl:call-template name="summaryToc"/>
+               </xsl:when>
+               <xsl:otherwise>
+                  <html>
+                     <xsl:call-template name="addLangAtt"/>
+                     <xsl:call-template name="htmlFileTop"/>
+		     <body id="TOP">
+                        <xsl:call-template name="bodyMicroData"/>
+                        <xsl:call-template name="bodyJavascriptHook"/>
+			<xsl:call-template name="bodyHook"/>
+			<div class="stdheader">
+			  <xsl:call-template name="stdheader">
+			    <xsl:with-param name="title">
+			      <xsl:call-template name="generateTitle"/>
+                              </xsl:with-param>
+			  </xsl:call-template>
+			</div>
+                        <h2>
+                           <xsl:apply-templates mode="xref" select="."/>
+			   <xsl:call-template name="sectionHeadHook"/>
+                        </h2>
+                        <xsl:apply-templates/>
+                        <xsl:call-template name="printNotes"/>
+                        <xsl:call-template name="htmlFileBottom"/>
+			<xsl:call-template name="bodyEndHook"/>
+		     </body>
+		  </html>
+               </xsl:otherwise>
+            </xsl:choose>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+         <p>Process root element TEI</p>
+      </desc>
+   </doc>
+  <xsl:template match="tei:TEI">
+      <xsl:call-template name="teiStartHook"/>
+      <xsl:if test="$verbose='true'">
+         <xsl:message>TEI HTML in single document mode </xsl:message>
+      </xsl:if>
+      <html>
+         <xsl:call-template name="addLangAtt"/>
+         <head>
+            <xsl:variable name="pagetitle">
+               <xsl:call-template name="generateTitle"/>
+            </xsl:variable>
+            <title>
+               <xsl:value-of select="$pagetitle"/>
+            </title>
+            <xsl:call-template name="headHook"/>
+            <xsl:call-template name="metaHTML">
+               <xsl:with-param name="title" select="$pagetitle"/>
+            </xsl:call-template>
+            <xsl:call-template name="includeCSS"/>
+            <xsl:call-template name="cssHook"/>
+            <xsl:call-template name="includeJavascript"/>
+            <xsl:call-template name="javascriptHook"/>
+         </head>
+         <body class="simple" id="TOP">
+            <xsl:call-template name="bodyMicroData"/>
+            <xsl:call-template name="bodyJavascriptHook"/>
+	    <xsl:call-template name="bodyHook"/>
+            <xsl:if test="not(tei:text/tei:front/tei:titlePage)">
+	      <div class="stdheader">
+		<xsl:call-template name="stdheader">
+		  <xsl:with-param name="title">
+		    <xsl:call-template name="generateTitle"/>
+		  </xsl:with-param>
+		</xsl:call-template>
+	      </div>
+            </xsl:if>
+            <xsl:call-template name="startHook"/>
+            <xsl:call-template name="simpleBody"/>
+            <xsl:call-template name="stdfooter"/>
+            <xsl:call-template name="bodyEndHook"/>
+         </body>
+      </html>
+      <xsl:if test="$verbose='true'">
+         <xsl:message>TEI HTML: run end hook template teiEndHook</xsl:message>
+      </xsl:if>
+      <xsl:call-template name="teiEndHook"/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+         <p>Process root element TEI in splitting mode</p>
+      </desc>
+   </doc>
+  <xsl:template match="tei:TEI" mode="split">
+      <xsl:variable name="BaseFile">
+         <xsl:value-of select="$masterFile"/>
+         <xsl:call-template name="addCorpusID"/>
+      </xsl:variable>
+      <xsl:if test="$verbose='true'">
+         <xsl:message>TEI HTML: run start hook template teiStartHook</xsl:message>
+      </xsl:if>
+      <xsl:call-template name="teiStartHook"/>
+      <xsl:if test="$verbose='true'">
+         <xsl:message>TEI HTML in splitting mode, base file is <xsl:value-of select="$BaseFile"/>
+         </xsl:message>
+      </xsl:if>
+
+      <xsl:variable name="outName">
+         <xsl:call-template name="outputChunkName">
+	           <xsl:with-param name="ident">
+	              <xsl:choose>
+	                 <xsl:when test="parent::tei:teiCorpus">
+	                    <xsl:apply-templates select="." mode="ident"/>
+	                 </xsl:when>
+	                 <xsl:otherwise>
+	                    <xsl:value-of select="$BaseFile"/>
+	                 </xsl:otherwise>
+	              </xsl:choose>
+	           </xsl:with-param>
+         </xsl:call-template>
+      </xsl:variable>
+    
+      <xsl:if test="$verbose='true'">
+         <xsl:message>Opening file <xsl:value-of select="$outName"/>
+         </xsl:message>
+      </xsl:if>
+      <xsl:result-document doctype-public="{$doctypePublic}" doctype-system="{$doctypeSystem}"
+                           encoding="{$outputEncoding}"
+                           href="{$outName}"
+                           method="{$outputMethod}">
+    
+        <xsl:call-template name="pageLayoutSimple"/>
+      </xsl:result-document>
+    
+      <xsl:if test="$verbose='true'">
+         <xsl:message>Closing file <xsl:value-of select="$outName"/>
+         </xsl:message>
+      </xsl:if>
+
+      <xsl:if test="$verbose='true'">
+         <xsl:message>TEI HTML: run end hook template teiEndHook</xsl:message>
+      </xsl:if>
+      <xsl:call-template name="teiEndHook"/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process elements front, body or back in splitting mode</desc>
+   </doc>
+  <xsl:template match="tei:front|tei:body|tei:back" mode="split">
+      <xsl:for-each select="*">
+         <xsl:choose>
+            <xsl:when test="starts-with(local-name(.),'div')">
+               <xsl:apply-templates mode="split" select="."/>
+            </xsl:when>
+            <xsl:otherwise>
+               <xsl:apply-templates select="."/>
+            </xsl:otherwise>
+         </xsl:choose>
+      </xsl:for-each>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element body in inner mode</desc>
+   </doc>
+  <xsl:template match="tei:body" mode="inner">
+      <xsl:apply-templates/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element closer</desc>
+   </doc>
+  <xsl:template match="tei:closer">
+	<xsl:choose>
+	  <xsl:when test="tei:signed">
+	    <div class="closer">
+	      <xsl:apply-templates/>
+	    </div>
+	  </xsl:when>
+	  <xsl:when test="tei:postscript">
+	    <div class="closer">
+	      <xsl:apply-templates/>
+	    </div>
+	  </xsl:when>
+	  <xsl:when test="tei:p">
+	    <blockquote class="closer">
+	      <xsl:apply-templates/>
+	    </blockquote>
+	  </xsl:when>
+	  <xsl:otherwise>
+	    <blockquote class="closer">
+	      <p>
+		<xsl:apply-templates/>
+	      </p>
+	    </blockquote>
+	  </xsl:otherwise>
+	</xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element dateline</desc>
+   </doc>
+  <xsl:template match="tei:dateline">
+      <span class="dateline">
+         <xsl:apply-templates/>
+      </span>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element divGen[@type='actions']</desc>
+   </doc>
+  <xsl:template match="tei:divGen[@type='actions']">
+      <h3>Actions arising</h3>
+      <dl>
+         <xsl:for-each select="/tei:TEI/tei:text//tei:note[@type='action']">
+            <dt>
+               <b>
+                  <xsl:number count="tei:note[@type='action']" level="any"/>
+               </b>
+            </dt>
+            <dd>
+               <xsl:apply-templates/>
+            </dd>
+         </xsl:for-each>
+      </dl>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+         <p>Process element divGen[@type='toc']</p>
+         <p>
+            <p xmlns="http://www.w3.org/1999/xhtml"> table of contents </p>
+         </p>
+      </desc>
+   </doc>
+  <xsl:template match="tei:divGen[@type='toc']">
+    <div class="tei_toc">
+      <h2>
+         <xsl:call-template name="i18n">
+            <xsl:with-param name="word">tocWords</xsl:with-param>
+         </xsl:call-template>
+      </h2>
+      <xsl:call-template name="mainTOC"/>
+    </div>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+         <p>index element, by default does nothing, unless it has an xml:id</p>
+      </desc>
+   </doc>
+  <xsl:template match="tei:index">
+    <xsl:if test="@xml:id">
+      <span>
+	<xsl:attribute name="id" select="@xml:id"/>
+	<span style="display:none">
+	  <xsl:value-of select="normalize-space(tei:term)"/>
+	</span>
+      </span>
+    </xsl:if>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+         <p>Simplistic processing of element divGen[@type='index']</p>
+         <p>
+            <p xmlns="http://www.w3.org/1999/xhtml">make an index;
+	    does not take indexName or nested index into account </p>
+         </p>
+      </desc>
+   </doc>
+  <xsl:template match="tei:divGen[@type='index']">
+    <div class="tei_index">
+      <h2>Index</h2>
+      <xsl:variable name="index">
+	<xsl:for-each select="key('INDEX',1)">
+	  <tei:REF>
+	    <tei:SORT>
+	      <xsl:value-of select="lower-case(normalize-unicode(tei:term,'NFD'))"/>
+	    </tei:SORT>	    
+	    <tei:TERM>
+	      <xsl:value-of select="tei:term"/>
+	    </tei:TERM>	    
+	    <xsl:for-each select="ancestor-or-self::*[tei:is-identifiable(.)][1]">
+	      <tei:LINK>
+		  <xsl:apply-templates mode="generateLink"
+				       select="."/>
+	      </tei:LINK>
+	      <tei:TARGET>
+		<xsl:call-template name="header"/>
+	      </tei:TARGET>
+	    </xsl:for-each>
+	  </tei:REF>
+	</xsl:for-each>
+      </xsl:variable>
+      <dl>
+	<xsl:for-each-group select="$index/tei:REF" group-by="tei:TERM">
+	  <xsl:sort select="tei:SORT" lang="{$doclang}"/>
+	  <dt><xsl:value-of select="current-grouping-key()"/></dt>
+	  <dd>
+	    <xsl:for-each-group select="current-group()" group-by="tei:LINK">
+	      <xsl:for-each select="current-group()[1]">
+		<a href="{tei:LINK}">
+		  <xsl:value-of select="tei:TARGET"/>
+		</a>
+	      </xsl:for-each>
+	      <xsl:value-of select="$spaceCharacter"/>
+	    </xsl:for-each-group>
+	  </dd>
+	</xsl:for-each-group>
+      </dl>
+    </div>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process elements
+      tei:div|tei:div1|tei:div2|tei:div3|tei:div4|tei:div5|tei:div6</desc>
+   </doc>
+  <xsl:template match="tei:div|tei:div1|tei:div2|tei:div3|tei:div4|tei:div5|tei:div6">
+      <xsl:variable name="depth">
+         <xsl:apply-templates mode="depth" select="."/>
+      </xsl:variable>
+      <!-- depending on depth and splitting level, 
+	 we may do one of two things: -->
+    <xsl:choose>
+      <!-- -1. Override at top level -->
+      <xsl:when test="ancestor::tei:floatingText">
+	  <xsl:call-template name="doDivBody">
+	    <xsl:with-param name="Depth" select="$depth"/>
+	  </xsl:call-template>
+      </xsl:when>
+      <xsl:when test="ancestor::tei:TEI/@rend='all'">
+	  <xsl:call-template name="doDivBody">
+	    <xsl:with-param name="Depth" select="$depth"/>
+	  </xsl:call-template>
+      </xsl:when>
+      <xsl:when test="ancestor::tei:TEI/@rend='frontpage'">
+	  <xsl:call-template name="doDivBody">
+	    <xsl:with-param name="Depth" select="$depth"/>
+	  </xsl:call-template>
+      </xsl:when>
+      <!-- 0. We have gone far enough -->
+      <xsl:when test="$depth = $splitLevel and $STDOUT='true'">
+      </xsl:when>
+      <!-- 1. our section depth is below the splitting level -->
+      <xsl:when test="number($depth) &gt; number($splitLevel) or         @rend='nosplit' or ancestor::tei:TEI/@rend='all' or         ancestor::tei:TEI/@rend='frontpage' or         ancestor::tei:TEI/@rend='nosplit'">
+	  <xsl:call-template name="doDivBody">
+	    <xsl:with-param name="Depth" select="$depth"/>
+	  </xsl:call-template>
+      </xsl:when>
+      <!-- 2. we are at or above splitting level, 
+	   so start a new page  -->
+      <xsl:when test="number($depth) &lt;= number($splitLevel) and ancestor::tei:front and $splitFrontmatter='true'">
+	<xsl:call-template name="makeDivPage">
+	  <xsl:with-param name="depth" select="$depth"/>
+	</xsl:call-template>
+      </xsl:when>
+      <xsl:when test="number($depth) &lt;= number($splitLevel) and ancestor::tei:back and $splitBackmatter='true'">
+	<xsl:call-template name="makeDivPage">
+	  <xsl:with-param name="depth" select="$depth"/>
+	</xsl:call-template>
+      </xsl:when>
+      <xsl:when test="number($depth) &lt;= number($splitLevel) and ancestor::tei:body">
+	<xsl:call-template name="makeDivPage">
+	  <xsl:with-param name="depth" select="$depth"/>
+	</xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+	  <xsl:call-template name="doDivBody">
+	    <xsl:with-param name="Depth" select="$depth"/>
+	  </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Create a new output page for a section
+      <param name="depth">depth of section (1, 2 3, 4 etc)</param>
+      </desc>
+   </doc>
+  <xsl:template name="makeDivPage">
+      <xsl:param name="depth"/>
+      <xsl:variable name="outName">
+	<xsl:call-template name="outputChunkName">
+	  <xsl:with-param name="ident">
+	    <xsl:apply-templates mode="ident" select="."/>
+	  </xsl:with-param>
+	</xsl:call-template>
+      </xsl:variable>
+      
+      <xsl:if test="$verbose='true'">
+	<xsl:message>Opening file <xsl:value-of select="$outName"/>
+	</xsl:message>
+      </xsl:if>
+      <xsl:result-document doctype-public="{$doctypePublic}" doctype-system="{$doctypeSystem}"
+			   encoding="{$outputEncoding}"
+			   href="{$outName}"
+			   method="{$outputMethod}">	     
+	<xsl:choose>
+	  <xsl:when test="$pageLayout='CSS'">
+	    <xsl:call-template name="pageLayoutCSS">
+	      <xsl:with-param name="currentID">
+		<xsl:apply-templates mode="ident" select="."/>
+	      </xsl:with-param>
+	    </xsl:call-template>
+	  </xsl:when>
+	  <xsl:when test="$pageLayout='Table'">
+	    <xsl:call-template name="pageLayoutTable">
+	      <xsl:with-param name="currentID">
+		<xsl:apply-templates mode="ident" select="."/>
+	      </xsl:with-param>
+	    </xsl:call-template>
+	  </xsl:when>
+	  <xsl:otherwise>
+	    <xsl:call-template name="writeDiv"/>
+	  </xsl:otherwise>
+	</xsl:choose>
+	
+      </xsl:result-document>
+      
+      <xsl:if test="$verbose='true'">
+	<xsl:message>Closing file <xsl:value-of select="$outName"/>
+	</xsl:message>
+      </xsl:if>
+  </xsl:template>
+  
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element docAuthor in "author" mode"</desc>
+   </doc>
+  <xsl:template match="tei:docAuthor" mode="author">
+      <xsl:if test="preceding-sibling::tei:docAuthor">
+         <xsl:text>, </xsl:text>
+      </xsl:if>
+      <xsl:apply-templates/>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+         <p>Process element docTitle, docAuthor, docImprint and
+	 tei:docDate</p>
+         <p>
+            <p xmlns="http://www.w3.org/1999/xhtml"> Translate these to a corresponding HTML div </p>
+         </p>
+      </desc>
+   </doc>
+  <xsl:template match="tei:docTitle|tei:docAuthor|tei:docImprint|tei:titlePage/tei:titlePart|tei:docDate">
+    <xsl:variable name="container">
+      <xsl:choose>
+	<xsl:when test="parent::tei:titlePage">
+	 <xsl:text>div</xsl:text>
+	</xsl:when>
+	<xsl:otherwise>
+	 <xsl:text>span</xsl:text>
+	</xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:element name="{$container}">
+      <xsl:call-template name="microdata"/>
+      <xsl:choose>
+	<xsl:when test="@rendition">
+	  <xsl:call-template name="applyRendition"/>
+	</xsl:when>
+	<xsl:otherwise>
+	  <xsl:call-template name="rendToClass">
+	    <xsl:with-param name="default">
+	      <xsl:value-of select="local-name()"/>
+	    </xsl:with-param>
+	  </xsl:call-template>
+	</xsl:otherwise>
+      </xsl:choose>
+      <xsl:apply-templates/>
+    </xsl:element>
+  </xsl:template>
+
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element opener</desc>
+   </doc>
+
+  <xsl:template match="tei:opener">
+    <xsl:choose>
+      <xsl:when test="tei:signed|tei:salute">
+	<div class="opener">
+	  <xsl:apply-templates/>
+	</div>
+      </xsl:when>
+      <xsl:when test="tei:p">
+	<blockquote class="opener">
+	  <xsl:apply-templates/>
+	</blockquote>
+      </xsl:when>
+      <xsl:otherwise>
+	<blockquote class="opener">
+	  <p>
+	    <xsl:apply-templates/>
+	  </p>
+	</blockquote>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element text</desc>
+   </doc>
+  <xsl:template match="tei:text">
+      <xsl:choose>
+         <xsl:when test="parent::tei:TEI">
+            <xsl:apply-templates/>
+         </xsl:when>
+         <xsl:when test="ancestor::tei:group and $splitLevel=0">
+	   <xsl:call-template name="makeDivPage">
+	     <xsl:with-param name="depth">-1</xsl:with-param>
+	   </xsl:call-template>
+         </xsl:when>
+	 <xsl:otherwise>
+	   <xsl:call-template name="doDivBody"/>
+	 </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element titlePage</desc>
+   </doc>
+  <xsl:template match="tei:titlePage">
+      <div class="titlePage">
+         <xsl:apply-templates/>
+      </div>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[html] <param name="crumbBody">crumbBody</param>
+      </desc>
+   </doc>
+  <xsl:template name="aCrumb">
+      <xsl:param name="crumbBody"/>
+      <li class="breadcrumb">
+         <xsl:copy-of select="$crumbBody"/>
+      </li>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[html] </desc>
+   </doc>
+  <xsl:template name="addCorpusID">
+      <xsl:if test="ancestor-or-self::tei:teiCorpus">
+         <xsl:for-each select="ancestor-or-self::tei:TEI">
+            <xsl:text>-</xsl:text>
+            <xsl:choose>
+               <xsl:when test="@xml:id">
+                  <xsl:value-of select="@xml:id"/>
+               </xsl:when>
+               <xsl:otherwise>
+                  <xsl:number/>
+               </xsl:otherwise>
+            </xsl:choose>
+         </xsl:for-each>
+      </xsl:if>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[html] </desc>
+   </doc>
+  <xsl:template name="addLangAtt">
+      <xsl:variable name="documentationLanguage">
+         <xsl:choose>
+            <xsl:when test="string-length($doclang)&gt;0">
+	      <xsl:value-of select="$doclang"/>
+            </xsl:when>
+            <xsl:when test="ancestor-or-self::tei:schemaSpec/@docLang">
+	      <xsl:value-of select="//tei:schemaSpec[1]/@docLang"/>
+            </xsl:when>
+            <xsl:otherwise>
+	      <xsl:text>en</xsl:text>
+            </xsl:otherwise>
+         </xsl:choose>
+      </xsl:variable>
+
+      <xsl:variable name="supplied">
+	<xsl:choose>
+	  <xsl:when test="ancestor-or-self::tei:*[@xml:lang]">
+	    <xsl:value-of select="ancestor-or-self::tei:*[@xml:lang][1]/@xml:lang"/>
+	  </xsl:when>
+	  <xsl:when test="ancestor-or-self::tei:*[@lang]">
+	    <xsl:value-of select="ancestor-or-self::tei:*[@lang][1]/@lang"/>
+	  </xsl:when>
+	  <xsl:otherwise>
+	    <xsl:value-of select="$documentationLanguage"/>
+	  </xsl:otherwise>
+	</xsl:choose>
+      </xsl:variable>
+      <xsl:choose>
+	<xsl:when test="$outputTarget='html'">
+	  <xsl:attribute name="xml:lang">
+	    <xsl:value-of select="$supplied"/>
+	  </xsl:attribute>
+	</xsl:when>
+	<xsl:when test="$outputTarget='html5'">
+	  <xsl:attribute name="lang">
+	    <xsl:value-of select="$supplied"/>
+	  </xsl:attribute>
+	</xsl:when>
+      </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+         <p>[html] </p>
+         <p>where to start the path from</p>
+         <param name="crumbRoot">/</param>
+      </desc>
+   </doc>
+  <xsl:template name="crumbPath">
+      <xsl:param name="crumbRoot">/</xsl:param>
+      <div class="breadcrumb">
+         <xsl:call-template name="preBreadCrumbPath"/>
+         <ul class="breadcrumb">
+            <li class="breadcrumb-first">
+               <a class="breadcrumb" href="{$homeURL}">
+                  <xsl:value-of select="$homeLabel"/>
+               </a>
+            </li>
+            <xsl:call-template name="walkTree">
+               <xsl:with-param name="path">
+                  <xsl:value-of select="substring-after($REQUEST,$crumbRoot)"/>
+               </xsl:with-param>
+               <xsl:with-param name="whole">
+                  <xsl:value-of select="$crumbRoot"/>
+               </xsl:with-param>
+               <xsl:with-param name="class">breadcrumb</xsl:with-param>
+            </xsl:call-template>
+         </ul>
+      </div>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[html] Make a section heading
+      <param name="Depth">which head level to make</param>
+      </desc>
+   </doc>
+  <xsl:template name="doDivBody">
+      <xsl:param name="Depth"/>
+      <xsl:param name="nav">false</xsl:param>
+      <xsl:variable name="container">
+	<xsl:choose>
+	  <xsl:when test="$outputTarget='html5'">section</xsl:when>
+	  <xsl:otherwise>div</xsl:otherwise>
+	</xsl:choose>
+      </xsl:variable>
+      <xsl:choose>
+	<xsl:when test="$filePerPage='true'">
+	    <xsl:call-template name="startDivHook"/>
+	    <xsl:call-template name="divContents">
+	      <xsl:with-param name="Depth" select="$Depth"/>
+	      <xsl:with-param name="nav" select="$nav"/>
+	    </xsl:call-template>
+	</xsl:when>
+	<xsl:otherwise>
+	  <xsl:element name="{$container}">
+	    <xsl:call-template name="microdata"/>
+	    <xsl:call-template name="divClassAttribute">
+	      <xsl:with-param name="depth" select="$Depth"/>
+	    </xsl:call-template>	
+	    <xsl:call-template name="startDivHook"/>
+	    <xsl:call-template name="divContents">
+	      <xsl:with-param name="Depth" select="$Depth"/>
+	      <xsl:with-param name="nav" select="$nav"/>
+	    </xsl:call-template>
+	  </xsl:element>
+	</xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[html] doing the contents of a div</desc>
+   </doc>
+
+  <xsl:template name="divContents">
+      <xsl:param name="Depth"/>
+      <xsl:param name="nav">false</xsl:param>
+      <xsl:variable name="ident">
+	<xsl:apply-templates mode="ident" select="."/>
+      </xsl:variable>
+      
+	<xsl:choose>
+	  <xsl:when test="parent::tei:*/@rend='multicol'">
+	    <td style="vertical-align:top;">
+	      <xsl:if test="not($Depth = '')">
+		<xsl:element name="h{$Depth + $divOffset}">
+		  <xsl:for-each select="tei:head[1]">		
+		    <xsl:call-template name="rendToClass">
+		      <xsl:with-param name="default"/>
+		    </xsl:call-template>
+		 </xsl:for-each>
+		 <xsl:call-template name="header">
+		   <xsl:with-param name="display">full</xsl:with-param>
+		 </xsl:call-template>
+		 <xsl:call-template name="sectionHeadHook"/>
+	       </xsl:element>
+	     </xsl:if>
+	     <xsl:apply-templates/>
+	   </td>
+         </xsl:when>
+         <xsl:when test="@rend='multicol'">
+            <xsl:apply-templates select="*[not(local-name(.)='div')]"/>
+            <table>
+               <tr>
+                  <xsl:apply-templates select="tei:div"/>
+               </tr>
+            </table>
+         </xsl:when>
+	 <xsl:when test="@rend='nohead'">
+	   <xsl:apply-templates/>
+	 </xsl:when>
+         <xsl:otherwise>
+	   <xsl:if test="not($Depth = '')">
+	     <xsl:variable name="Heading">
+	       <xsl:element name="{if (number($Depth)+$divOffset &gt;6) then 'div'
+				  else concat('h',number($Depth) + $divOffset)}">
+		 <xsl:choose>
+		   <xsl:when test="@rend">
+		     <xsl:call-template name="rendToClass">
+		       <xsl:with-param
+			   name="id">false</xsl:with-param>
+		     </xsl:call-template>
+		   </xsl:when>
+		   <xsl:otherwise>
+		     <xsl:for-each select="tei:head[1]">
+		       <xsl:call-template name="rendToClass">
+			 <xsl:with-param name="default">
+			   <xsl:if test="number($Depth)&gt;5">
+			     <xsl:text>div</xsl:text>
+			     <xsl:value-of select="$Depth"/>
+			   </xsl:if>
+			 </xsl:with-param>
+		       </xsl:call-template>
+		     </xsl:for-each>
+		   </xsl:otherwise>
+		 </xsl:choose>
+		 <xsl:call-template name="header">
+		   <xsl:with-param name="display">full</xsl:with-param>
+		 </xsl:call-template>
+		 <xsl:call-template name="sectionHeadHook"/>
+	       </xsl:element>
+	     </xsl:variable>
+	     <xsl:choose>
+	       <xsl:when test="$outputTarget='html5'">
+		 <header>
+		   <xsl:copy-of select="$Heading"/>
+		 </header>
+	       </xsl:when>
+	       <xsl:otherwise>
+		 <xsl:copy-of select="$Heading"/>
+	       </xsl:otherwise>
+	     </xsl:choose>
+
+	     <xsl:if test="$topNavigationPanel='true' and
+			   $nav='true'">
+	       <xsl:element name="{if ($outputTarget='html5') then 'nav'
+				  else 'div'}">
+		 <xsl:call-template name="xrefpanel">
+		   <xsl:with-param name="homepage" select="concat($masterFile,$standardSuffix)"/>
+		   <xsl:with-param name="mode" select="local-name(.)"/>
+		 </xsl:call-template>
+	       </xsl:element>
+	     </xsl:if>
+	   </xsl:if>
+	   <xsl:apply-templates/>
+	   <xsl:if test="$bottomNavigationPanel='true' and
+			 $nav='true'">
+	     <xsl:element name="{if ($outputTarget='html5') then 'nav' else
+				'div'}">	       
+	       <xsl:call-template name="xrefpanel">
+		 <xsl:with-param name="homepage" select="concat($masterFile,$standardSuffix)"/>
+		 <xsl:with-param name="mode" select="local-name(.)"/>
+	       </xsl:call-template>
+	     </xsl:element>
+	   </xsl:if>
+         </xsl:otherwise>
+	</xsl:choose>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[html] process divisions</desc>
+   </doc>
+  <xsl:template name="doDivs">
+      <xsl:for-each select="tei:TEI/tei:text">
+         <xsl:for-each select="tei:front|tei:body|tei:back">
+            <xsl:for-each select="tei:div|tei:div1">
+               <xsl:variable name="currentID">
+                  <xsl:apply-templates mode="ident" select="."/>
+               </xsl:variable>
+               <xsl:call-template name="doPageTable">
+                  <xsl:with-param name="currentID" select="$currentID"/>
+               </xsl:call-template>
+            </xsl:for-each>
+         </xsl:for-each>
+      </xsl:for-each>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[html] <param name="currentID">currentID</param>
+      </desc>
+   </doc>
+  <xsl:template name="doPageTable">
+      <xsl:param name="currentID"/>
+      <xsl:variable name="BaseFile">
+         <xsl:value-of select="$masterFile"/>
+         <xsl:call-template name="addCorpusID"/>
+      </xsl:variable>
+      <xsl:choose>
+         <xsl:when test="$STDOUT='true'">
+	           <xsl:choose>
+	              <xsl:when test="$pageLayout='CSS'">
+                  <xsl:call-template name="pageLayoutCSS">
+                     <xsl:with-param name="currentID" select="$currentID"/>
+                  </xsl:call-template>
+               </xsl:when>
+               <xsl:when test="$pageLayout='Table'">
+                  <xsl:call-template name="pageLayoutTable">
+                     <xsl:with-param name="currentID" select="$currentID"/>
+                  </xsl:call-template>
+               </xsl:when>
+            </xsl:choose>
+         </xsl:when>
+         <xsl:otherwise>
+
+
+	           <xsl:variable name="outName">
+	              <xsl:call-template name="outputChunkName">
+	                 <xsl:with-param name="ident">
+	                    <xsl:choose>
+		                      <xsl:when test="not($currentID='')">
+		                         <xsl:value-of select="$currentID"/>
+		                      </xsl:when>
+		                      <xsl:otherwise>
+		                         <xsl:value-of select="$BaseFile"/>
+	                       </xsl:otherwise>
+	                    </xsl:choose>
+	                 </xsl:with-param>
+	              </xsl:call-template>
+	           </xsl:variable>
+	
+	           <xsl:if test="$verbose='true'">
+	              <xsl:message>Opening file <xsl:value-of select="$outName"/>
+               </xsl:message>
+	           </xsl:if>
+	           <xsl:result-document doctype-public="{$doctypePublic}" doctype-system="{$doctypeSystem}"
+                                 encoding="{$outputEncoding}"
+                                 href="{$outName}"
+                                 method="{$outputMethod}">
+	              <xsl:choose>
+	                 <xsl:when test="$pageLayout='CSS'">
+		                   <xsl:call-template name="pageLayoutCSS">
+		                      <xsl:with-param name="currentID" select="$currentID"/>
+		                   </xsl:call-template>
+	                 </xsl:when>
+	                 <xsl:when test="$pageLayout='Table'">
+		                   <xsl:call-template name="pageLayoutTable">
+		                      <xsl:with-param name="currentID" select="$currentID"/>
+		                   </xsl:call-template>
+	                 </xsl:when>
+	              </xsl:choose>
+	           </xsl:result-document>
+	
+	           <xsl:if test="$verbose='true'">
+	              <xsl:message>Closing file <xsl:value-of select="$outName"/>
+               </xsl:message>
+	           </xsl:if>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>plain text version of title for div [html] </desc>
+   </doc>
+  <xsl:template name="generateDivtitle">
+      <xsl:apply-templates select="tei:head" mode="plain"/>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>link to level above[html] </desc>
+   </doc>
+  <xsl:template name="generateUpLink">
+      <xsl:variable name="myName">
+         <xsl:value-of select="local-name(.)"/>
+      </xsl:variable>
+      <xsl:variable name="BaseFile">
+         <xsl:value-of select="$masterFile"/>
+         <xsl:value-of select="$standardSuffix"/>
+         <xsl:call-template name="addCorpusID"/>
+      </xsl:variable>
+      <xsl:choose>
+         <xsl:when test="$myName = 'div' and not(ancestor::tei:div)">
+            <xsl:call-template name="upLink">
+	              <xsl:with-param name="up" select="$BaseFile"/>
+	              <xsl:with-param name="title" select="$homeLabel"/>
+            </xsl:call-template>
+         </xsl:when>
+         <xsl:when test="$myName = 'div'">
+            <xsl:call-template name="upLink">
+               <xsl:with-param name="up" select="ancestor::tei:div[1]"/>
+            </xsl:call-template>
+         </xsl:when>
+         <xsl:when test="$myName='div1'">
+	           <xsl:call-template name="upLink">
+	              <xsl:with-param name="up" select="$BaseFile"/>
+	              <xsl:with-param name="title" select="$homeLabel"/>
+	           </xsl:call-template>
+         </xsl:when>
+         <xsl:when test="$myName='div2'">
+	           <xsl:call-template name="upLink">
+	              <xsl:with-param name="up" select="ancestor::tei:div1"/>
+	           </xsl:call-template>
+         </xsl:when>
+         <xsl:when test="$myName='div3'">
+	           <xsl:call-template name="upLink">
+	              <xsl:with-param name="up" select="ancestor::tei:div2"/>
+	           </xsl:call-template>
+         </xsl:when>
+         <xsl:when test="$myName='div4'">
+	           <xsl:call-template name="upLink">
+	              <xsl:with-param name="up" select="ancestor::tei:div3"/>
+	           </xsl:call-template>
+         </xsl:when>
+         <xsl:when test="$myName='div5'">
+	           <xsl:call-template name="upLink">
+	              <xsl:with-param name="up" select="ancestor::tei:div4"/>
+	           </xsl:call-template>
+         </xsl:when>
+         <xsl:otherwise>
+	           <xsl:call-template name="upLink">
+	              <xsl:with-param name="up" select="(ancestor::tei:div1|ancestor::tei:div)[1]"/>
+	           </xsl:call-template>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+         <p>What happens at the end of an HTML file [html] </p>
+      </desc>
+   </doc>
+  <xsl:template name="htmlFileBottom">
+      <xsl:call-template name="topNavigation"/>
+      <xsl:call-template name="stdfooter"/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[html] </desc>
+   </doc>
+  <xsl:template name="htmlFileTop">
+      <xsl:comment>THIS FILE IS GENERATED FROM AN XML MASTER. DO NOT EDIT (6)</xsl:comment>
+      <xsl:variable name="pagetitle">
+         <xsl:call-template name="generateTitle"/>
+      </xsl:variable>
+      <head>
+         <title>
+            <xsl:value-of select="$pagetitle"/>
+         </title>
+         <xsl:call-template name="headHook"/>
+         <xsl:call-template name="metaHTML">
+            <xsl:with-param name="title" select="$pagetitle"/>
+         </xsl:call-template>
+         <xsl:call-template name="includeCSS"/>
+         <xsl:call-template name="cssHook"/>
+         <xsl:call-template name="includeJavascript"/>
+         <xsl:call-template name="javascriptHook"/>
+      </head>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[html] </desc>
+   </doc>
+  <xsl:template name="includeCSS">
+
+      <xsl:if test="string-length($cssFile)&gt;0">
+	<link href="{$cssFile}" rel="stylesheet" type="text/css"/>
+      </xsl:if>
+
+      <xsl:if test="string-length($cssSecondaryFile)&gt;0">
+	<link href="{$cssSecondaryFile}" rel="stylesheet" type="text/css"/>
+      </xsl:if>
+      
+      <xsl:if test="string-length($cssPrintFile)&gt;0">
+	<link rel="stylesheet" media="print" type="text/css">
+	  <xsl:attribute name="href" select="$cssPrintFile"/>
+	</link>
+      </xsl:if>
+      
+      <xsl:if test="$cssInlineFile">
+	<style type="text/css" title="inline_css">
+	  <xsl:for-each select="tokenize(unparsed-text($cssInlineFile),
+				'\r?\n')">
+	    <xsl:value-of select="normalize-space(.)"/>
+	    <xsl:text>&#10;</xsl:text>
+	  </xsl:for-each>
+	</style>
+      </xsl:if>
+
+      <xsl:call-template name="generateLocalCSS"/>
+      
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[html] Javascript functions to be declared in HTML header</desc>
+   </doc>
+   <xsl:template name="includeJavascript">
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+         <p>[html] Write out some Javascript into the HTML</p>
+         <p>Note that it does not have to commented if the output is
+    XHTML</p>
+         <param name="content">The code</param>
+      </desc>
+   </doc>
+  <xsl:template name="writeJavascript">
+      <xsl:param name="content"/>
+      <script type="text/javascript">
+	<xsl:value-of select="$content"/>
+      </script>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[html] Make contents of left-hand column<param name="currentID">currentID</param>
+      </desc>
+   </doc>
+  <xsl:template name="leftHandFrame">
+      <xsl:param name="currentID"/>
+      <xsl:call-template name="makeSidebar"/>
+      <xsl:choose>
+         <xsl:when test="$currentID=''">
+            <xsl:call-template name="linkListContents">
+               <xsl:with-param name="style" select="'toclist'"/>
+            </xsl:call-template>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:choose>
+               <xsl:when test="count(id($currentID))&gt;0">
+                  <xsl:for-each select="id($currentID)">
+                     <xsl:call-template name="linkListContents">
+                        <xsl:with-param name="style" select="'toclist'"/>
+                     </xsl:call-template>
+                  </xsl:for-each>
+               </xsl:when>
+               <xsl:otherwise>
+                  <xsl:apply-templates mode="xpath" select="ancestor-or-self::tei:TEI/tei:text">
+                     <xsl:with-param name="xpath" select="$currentID"/>
+                     <xsl:with-param name="action" select="'toclist'"/>
+                  </xsl:apply-templates>
+               </xsl:otherwise>
+            </xsl:choose>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[html] bypass sidebar lists in normal mode</desc>
+   </doc>
+  <xsl:template match="tei:list[@type='sidebar']"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[html] Summary links in left-hand column</desc>
+   </doc>
+  <xsl:template name="makeSidebar">
+      <xsl:for-each select="ancestor-or-self::tei:TEI/tei:text/tei:body/tei:list[@type='sidebar']">
+         <xsl:for-each select=".//tei:ref">
+            <p class="sidebar">
+               <a class="toclist" href="{@url}">
+                  <xsl:apply-templates/>
+               </a>
+            </p>
+         </xsl:for-each>
+      </xsl:for-each>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[html] Summary table of contents in left-hand column<param name="style">style</param>
+      </desc>
+   </doc>
+  <xsl:template name="linkListContents">
+      <xsl:param name="style" select="'toc'"/>
+      <xsl:variable name="BaseFile">
+         <xsl:value-of select="$masterFile"/>
+         <xsl:call-template name="addCorpusID"/>
+      </xsl:variable>
+      <xsl:variable name="thisOne">
+         <xsl:value-of select="generate-id()"/>
+      </xsl:variable>
+      <xsl:for-each select="ancestor-or-self::tei:TEI/tei:text">
+      <!-- front matter -->
+      <xsl:for-each select="tei:front">
+	           <xsl:if test="tei:div1|tei:div">
+	              <div class="tocFront">
+	                 <xsl:element name="{$tocContainerElement}">
+	                    <xsl:attribute name="class">
+		                      <xsl:text>tocContainer</xsl:text>
+	                    </xsl:attribute>
+	                    <xsl:call-template name="tocSection">
+		                      <xsl:with-param name="id" select="$thisOne"/>
+		                      <xsl:with-param name="style" select="$style"/>
+	                    </xsl:call-template>
+	                 </xsl:element>
+	              </div>
+	           </xsl:if>
+         </xsl:for-each>
+         <!-- body matter -->
+      <xsl:for-each select="tei:body">
+	           <xsl:if test="tei:div1|tei:div">
+	              <div class="tocBody">
+	                 <xsl:comment>start TOC</xsl:comment>
+	                 <xsl:element name="{$tocContainerElement}">
+	                    <xsl:attribute name="class">
+		                      <xsl:text>tocContainer</xsl:text>
+	                    </xsl:attribute>
+	                    <xsl:comment>TOC components</xsl:comment>
+	                    <xsl:call-template name="tocSection">
+		                      <xsl:with-param name="id" select="$thisOne"/>
+		                      <xsl:with-param name="style" select="$style"/>
+	                    </xsl:call-template>
+	                 </xsl:element>
+	              </div>
+	           </xsl:if>
+         </xsl:for-each>
+         <!-- back matter -->
+      <xsl:for-each select="tei:back">
+	           <xsl:if test="tei:div1|tei:div">
+	              <div class="tocBack">
+	                 <xsl:element name="{$tocContainerElement}">
+	                    <xsl:attribute name="class">
+		                      <xsl:text>tocContainer</xsl:text>
+	                    </xsl:attribute>
+	                    <xsl:call-template name="tocSection">
+		                      <xsl:with-param name="id" select="$thisOne"/>
+		                      <xsl:with-param name="style" select="$style"/>
+	                    </xsl:call-template>
+	                 </xsl:element>
+	              </div>
+	           </xsl:if>
+         </xsl:for-each>
+      </xsl:for-each>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[html] Main page in right-hand column<param name="currentID">currentID</param>
+      </desc>
+   </doc>
+  <xsl:template name="mainFrame">
+      <xsl:param name="currentID"/>
+      <xsl:param name="minimal">false</xsl:param>
+      <xsl:choose>
+         <xsl:when test="$currentID='current'">
+            <xsl:apply-templates/>
+         </xsl:when>
+         <xsl:when test="$currentID='' and number($splitLevel)=-1">
+            <xsl:apply-templates/>
+         </xsl:when>
+         <xsl:when test="self::teiCorpus.2">
+            <xsl:call-template name="corpusBody"/>
+         </xsl:when>
+         <xsl:when test="$currentID=''">
+        <!-- we need to locate the first interesting object in the file, ie
+	     the first grandchild of <text > -->
+        <xsl:for-each select=" descendant-or-self::tei:TEI/tei:text/tei:*[1]/*[1]">
+               <xsl:apply-templates mode="paging" select="."/>
+               <xsl:if test="$autoToc='true'">
+                  <xsl:if test="following-sibling::tei:div/tei:head">
+                     <xsl:call-template name="contentsHeading"/>
+                     <ul class="toc">
+                        <xsl:apply-templates mode="maketoc" select="following-sibling::tei:div">
+                           <xsl:with-param name="forcedepth" select="'0'"/>
+                        </xsl:apply-templates>
+                     </ul>
+                  </xsl:if>
+               </xsl:if>
+            </xsl:for-each>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:choose>
+               <xsl:when test="count(id($currentID))&gt;0">
+                  <xsl:for-each select="id($currentID)">
+                     <h2>
+                        <xsl:apply-templates mode="xref" select="."/>
+			<xsl:call-template name="sectionHeadHook"/>
+                     </h2>
+		     <xsl:if test="$topNavigationPanel='true'">
+		       <xsl:element name="{if ($outputTarget='html5') then 'nav' else 'div'}">
+			 <xsl:call-template name="xrefpanel">
+			   <xsl:with-param name="homepage" select="concat($masterFile,$standardSuffix)"/>
+			   <xsl:with-param name="mode" select="local-name(.)"/>
+			 </xsl:call-template>
+		       </xsl:element>
+		     </xsl:if>
+                     <xsl:call-template name="doDivBody"/>
+                     <xsl:if test="$bottomNavigationPanel='true'">
+		       <xsl:element name="{if ($outputTarget='html5') then 'nav' else 'div'}">
+			 <xsl:call-template name="xrefpanel">
+			   <xsl:with-param name="homepage" select="concat($masterFile,$standardSuffix)"/>
+			   <xsl:with-param name="mode" select="local-name(.)"/>
+                        </xsl:call-template>
+		       </xsl:element>
+                     </xsl:if>
+                  </xsl:for-each>
+               </xsl:when>
+               <xsl:otherwise>
+            <!-- the passed ID is a pseudo-XPath expression
+		 which starts below TEI/tei:text.
+		 The real XPath syntax is changed to avoid problems
+	    -->
+            <xsl:choose>
+                     <xsl:when test="ancestor-or-self::tei:TEI/tei:group/tei:text">
+                        <xsl:apply-templates mode="xpath" select="ancestor-or-self::tei:TEI/tei:group/tei:text">
+                           <xsl:with-param name="xpath" select="$currentID"/>
+                        </xsl:apply-templates>
+                     </xsl:when>
+                     <xsl:otherwise>
+                        <xsl:apply-templates mode="xpath" select="ancestor-or-self::tei:TEI/tei:text">
+                           <xsl:with-param name="xpath" select="$currentID"/>
+                        </xsl:apply-templates>
+                     </xsl:otherwise>
+                  </xsl:choose>
+               </xsl:otherwise>
+            </xsl:choose>
+         </xsl:otherwise>
+      </xsl:choose>
+
+      <xsl:if test="$minimal='false'">
+	<xsl:call-template name="partialFootNotes">
+	  <xsl:with-param name="currentID" select="$currentID"/>
+	</xsl:call-template>
+	<xsl:call-template name="stdfooter"/>
+      </xsl:if>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[html] Table of contents       </desc>
+   </doc>
+  <xsl:template name="mainTOC">
+      <xsl:choose>
+	<xsl:when test="self::tei:teiCorpus">
+	  <ul class="toc toc_corpus">
+	    <xsl:for-each select="tei:TEI">
+	      <li>
+		<a>
+                  <xsl:attribute name="href">
+		    <xsl:apply-templates mode="generateLink" select="."/>
+                  </xsl:attribute>
+                  <xsl:call-template name="header">
+		    <xsl:with-param name="minimal">false</xsl:with-param>
+		    <xsl:with-param name="display">plain</xsl:with-param>
+                  </xsl:call-template>
+		</a>
+	      </li>
+	    </xsl:for-each>
+	  </ul>
+	</xsl:when>
+	<xsl:when
+	    test="ancestor-or-self::tei:TEI/tei:text/tei:group and
+		  $splitLevel=0">
+	  <xsl:for-each
+	      select="ancestor-or-self::tei:TEI/tei:text/tei:front">
+	       <xsl:call-template name="partTOC">
+		 <xsl:with-param name="part">front</xsl:with-param>
+	       </xsl:call-template>
+	  </xsl:for-each>
+	  
+	  <xsl:for-each
+	      select="ancestor-or-self::tei:TEI/tei:text/tei:group">
+	    <xsl:call-template name="groupTOC"/>
+	  </xsl:for-each>
+
+	  <xsl:for-each
+	      select="ancestor-or-self::tei:TEI/tei:text/tei:back">
+	    <xsl:call-template name="partTOC">
+	      <xsl:with-param name="part">back</xsl:with-param>
+	    </xsl:call-template>
+	  </xsl:for-each>
+	</xsl:when>
+	
+	<xsl:when
+	    test="ancestor-or-self::tei:TEI/tei:text/tei:group">	  
+	  <xsl:for-each
+	      select="ancestor-or-self::tei:TEI/tei:text/tei:group/tei:text">
+	    <h3>
+	      <xsl:number/>
+	      <xsl:choose>
+		<xsl:when test="tei:body/tei:head">
+		  <xsl:text>. </xsl:text>
+		  <xsl:apply-templates select="tei:body/tei:head" mode="plain"/>
+		</xsl:when>
+		<xsl:when
+		    test="tei:front/tei:titlePage//tei:title">
+		  <xsl:apply-templates select="tei:front/tei:titlePage//tei:title[1]" mode="plain"/>
+		</xsl:when>
+	      </xsl:choose>
+	    </h3>
+	    <xsl:for-each select="tei:front">
+	      <xsl:call-template name="partTOC">
+		<xsl:with-param name="part">front</xsl:with-param>
+	      </xsl:call-template>
+	    </xsl:for-each>
+	    
+	    <xsl:for-each select="tei:body">
+	      <xsl:call-template name="partTOC">
+		<xsl:with-param name="part">body</xsl:with-param>
+	      </xsl:call-template>
+	    </xsl:for-each>
+	    
+	    <xsl:for-each select="tei:back">
+	      <xsl:call-template name="partTOC">
+		<xsl:with-param name="part">back</xsl:with-param>
+	      </xsl:call-template>
+	    </xsl:for-each>
+	    
+	  </xsl:for-each>
+	  
+	</xsl:when>
+	<xsl:otherwise>
+	  <xsl:if test="$tocFront">
+	    <xsl:for-each select="ancestor-or-self::tei:TEI/tei:text/tei:front">
+	      <xsl:call-template name="partTOC">
+		<xsl:with-param name="part">front</xsl:with-param>
+	      </xsl:call-template>
+	    </xsl:for-each>
+	  </xsl:if>
+	  
+	  <xsl:for-each select="ancestor-or-self::tei:TEI/tei:text/tei:body">
+	    <xsl:call-template name="partTOC">
+	      <xsl:with-param name="part">body</xsl:with-param>
+	    </xsl:call-template>
+	  </xsl:for-each>
+	  
+	  <xsl:if test="$tocBack">
+	    <xsl:for-each select="ancestor-or-self::tei:TEI/tei:text/tei:back">
+	      <xsl:call-template name="partTOC">
+		<xsl:with-param name="part">back</xsl:with-param>
+	      </xsl:call-template>
+	    </xsl:for-each>
+	  </xsl:if>
+	</xsl:otherwise>
+      </xsl:choose>
+    </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+         <p>[html] </p>
+	 <p xmlns="http://www.w3.org/1999/xhtml"> make table of
+	 contents for nested texts/groups</p>
+      </desc>
+   </doc>
+    <xsl:template name="groupTOC">
+      <xsl:variable name="gDepth"
+		    select="count(ancestor::tei:group)"/>
+      <ul class="toc toc_group{$gDepth}">	    	   
+	<li>
+	  <xsl:if test="not($autoHead='true') and not(tei:head or tei:body/tei:head or @n)">
+	    <xsl:attribute
+		name="class">headless</xsl:attribute>
+	  </xsl:if>
+	  <ul>
+	    <xsl:for-each select="tei:text">
+	      <li>
+		
+		<xsl:call-template name="header">
+		  <xsl:with-param name="toc">
+		    <xsl:apply-templates mode="generateLink" select="."/>
+		  </xsl:with-param>
+		  <xsl:with-param name="minimal">false</xsl:with-param>
+		  <xsl:with-param name="display">plain</xsl:with-param>
+		</xsl:call-template>
+		
+		<xsl:for-each select="tei:front">
+		  <xsl:if
+		      test="tei:titlePage/tei:docTitle/tei:titlePart">
+		    <span>
+		      <xsl:apply-templates
+			  select="tei:titlePage/tei:docTitle/tei:titlePart"
+			  mode="plain"/>
+		    </span>
+		  </xsl:if>
+		  <xsl:call-template name="partTOC">
+		    <xsl:with-param name="part">front</xsl:with-param>
+		  </xsl:call-template>
+		</xsl:for-each>
+		
+		<xsl:for-each select="tei:group">
+		  <xsl:call-template name="groupTOC"/>
+		</xsl:for-each>
+		
+		<xsl:for-each select="tei:body">
+		  <xsl:call-template name="partTOC">
+		    <xsl:with-param name="part">body</xsl:with-param>
+		  </xsl:call-template>
+		</xsl:for-each>
+		
+		<xsl:for-each select="tei:back">
+		  <xsl:call-template name="partTOC">
+		    <xsl:with-param name="part">back</xsl:with-param>
+		  </xsl:call-template>
+		</xsl:for-each>
+	      </li>
+	    </xsl:for-each>
+	    <xsl:for-each select="tei:group">
+	      <li>
+		<xsl:call-template name="groupTOC"/>
+	      </li>
+	    </xsl:for-each>
+	</ul>
+      </li>
+      </ul>
+    </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+         <p>[html] </p>
+	 <p xmlns="http://www.w3.org/1999/xhtml"> make partial
+	    table of contents         </p>
+      </desc>
+   </doc>
+  <xsl:template name="partTOC">
+      <xsl:param name="part"/>
+      <xsl:param name="force"/>
+      <xsl:if test="tei:div|tei:div1|tei:div2|tei:div3|tei:div4|tei:div5|tei:div6">
+         <ul class="toc{$force} toc_{$part}">
+	   <xsl:apply-templates mode="maketoc"
+				select="tei:div|tei:div1|tei:div2|tei:div3|tei:div4|tei:div5|tei:div6">
+	              <xsl:with-param name="forcedepth" select="$force"/>
+	   </xsl:apply-templates>
+         </ul>
+      </xsl:if>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+         <p>[html] </p>
+         <p>
+            <p xmlns="http://www.w3.org/1999/xhtml"> xref to previous and last sections </p>
+         </p>
+      </desc>
+   </doc>
+  <xsl:template name="nextLink">
+      <xsl:variable name="myName">
+         <xsl:value-of select="local-name(.)"/>
+      </xsl:variable>
+      <xsl:choose>
+         <xsl:when test="following-sibling::tei:TEI">
+            <xsl:apply-templates mode="generateNextLink" select="following-sibling::tei:TEI[1]"/>
+         </xsl:when>
+         <xsl:when test="following-sibling::tei:div[tei:head or $autoHead='true']">
+            <xsl:apply-templates mode="generateNextLink" select="following-sibling::tei:div[1]"/>
+         </xsl:when>
+         <xsl:when test="parent::tei:body/following-sibling::tei:back/tei:div[tei:head or $autoHead='true']">
+            <xsl:apply-templates mode="generateNextLink"
+                                 select="parent::tei:body/following-sibling::tei:back/tei:div[1]"/>
+         </xsl:when>
+         <xsl:when test="parent::tei:front/following-sibling::tei:body/tei:div[tei:head or $autoHead='true']">
+            <xsl:apply-templates mode="generateNextLink"
+                                 select="parent::tei:front/following-sibling::tei:body/tei:div[1]"/>
+         </xsl:when>
+         <xsl:when test="$myName='div1' and following-sibling::tei:div1[tei:head or $autoHead='true']">
+            <xsl:apply-templates mode="generateNextLink" select="following-sibling::tei:div1[1]"/>
+         </xsl:when>
+         <xsl:when test="$myName='div2' and following-sibling::tei:div2[tei:head or $autoHead='true']">
+            <xsl:apply-templates mode="generateNextLink" select="following-sibling::tei:div2[1]"/>
+         </xsl:when>
+         <xsl:when test="$myName='div3' and following-sibling::tei:div3[tei:head or $autoHead='true']">
+            <xsl:apply-templates mode="generateNextLink" select="following-sibling::tei:div3[1]"/>
+         </xsl:when>
+         <xsl:when test="$myName='div4' and following-sibling::tei:div4[tei:head or $autoHead='true']">
+            <xsl:apply-templates mode="generateNextLink" select="following-sibling::tei:div4[1]"/>
+         </xsl:when>
+         <xsl:when test="$myName='div5' and following-sibling::tei:div5[tei:head or $autoHead='true']">
+            <xsl:apply-templates mode="generateNextLink" select="following-sibling::tei:div5[1]"/>
+         </xsl:when>
+         <xsl:when test="$myName='div6' and following-sibling::tei:div6[tei:head or $autoHead='true']">
+            <xsl:apply-templates mode="generateNextLink" select="following-sibling::tei:div6[1]"/>
+         </xsl:when>
+      </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[html] Generate name for a chunk of output<param name="ident">ident</param>
+      </desc>
+   </doc>
+  <xsl:template name="outputChunkName">
+      <xsl:param name="ident"/>
+      <xsl:choose>
+        <xsl:when test="not($outputDir ='')">
+            <xsl:value-of select="$outputDir"/>
+            <xsl:if test="not(substring($outputDir,string-length($outputDir),string-length($outputDir))='/')">
+               <xsl:text>/</xsl:text>
+            </xsl:if>
+        </xsl:when>
+      </xsl:choose>
+      <xsl:value-of select="$ident"/>
+      <xsl:value-of select="$outputSuffix"/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[html] Make a new page using CSS layout <param name="currentID">current ID</param>
+      </desc>
+   </doc>
+  <xsl:template name="pageLayoutCSS">
+      <xsl:param name="currentID"/>
+      <html>
+         <xsl:call-template name="addLangAtt"/>
+         <xsl:comment>THIS FILE IS GENERATED FROM AN XML MASTER. DO NOT EDIT (4)</xsl:comment>
+         <xsl:text>&#10;</xsl:text>
+         <head>
+	   <xsl:variable name="pagetitle">
+	     <xsl:choose>
+	       <xsl:when test="$currentID=''">
+		 <xsl:call-template name="generateTitle"/>
+	       </xsl:when>
+	       <xsl:otherwise>
+		 <xsl:choose>
+		   <xsl:when test="$currentID='current'">
+		     <xsl:apply-templates mode="xref" select="."/>
+		   </xsl:when>
+		   <xsl:when test="count(id($currentID))&gt;0">
+		     <xsl:for-each select="id($currentID)">
+		       <xsl:apply-templates mode="xref" select="."/>
+		     </xsl:for-each>
+		   </xsl:when>
+		   <xsl:otherwise>
+		     <xsl:apply-templates mode="xpath" select="descendant::text">
+		       <xsl:with-param name="xpath" select="$currentID"/>
+		       <xsl:with-param name="action" select="'header'"/>
+		     </xsl:apply-templates>
+		   </xsl:otherwise>
+		 </xsl:choose>
+		 <xsl:text> - </xsl:text>
+		 <xsl:call-template name="generateTitle"/>
+	       </xsl:otherwise>
+	     </xsl:choose>
+	   </xsl:variable>
+	   <title>
+	     <xsl:value-of select="$htmlTitlePrefix"/>
+	     <xsl:text> </xsl:text>
+	     <xsl:value-of select="$pagetitle"/>
+	   </title>
+	   <link href="/favicon.ico" rel="icon" type="image/x-icon"/>
+	   <link href="/favicon.ico" rel="shortcut icon" type="image/x-icon"/>
+	   <xsl:call-template name="headHook"/>
+	   <xsl:call-template name="metaHTML">
+	     <xsl:with-param name="title" select="$pagetitle"/>
+	   </xsl:call-template>
+	   <xsl:call-template name="includeCSS"/>
+	   <xsl:call-template name="cssHook"/>
+	   <xsl:call-template name="includeJavascript"/>
+	   <xsl:call-template name="javascriptHook"/>
+         </head>
+         <body>
+	   <xsl:copy-of select="tei:text/tei:body/@unload"/>
+	   <xsl:copy-of select="tei:text/tei:body/@onunload"/>
+	   <xsl:call-template name="bodyMicroData"/>
+	   <xsl:call-template name="bodyJavascriptHook"/>
+	   <xsl:call-template name="bodyHook"/>
+	   <xsl:call-template name="mainPage">
+	     <xsl:with-param name="currentID">
+	       <xsl:value-of select="$currentID"/>
+	     </xsl:with-param>
+	   </xsl:call-template>
+	   <xsl:call-template name="bodyEndHook"/>
+         </body>
+      </html>
+  </xsl:template>
+  
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[html] the main page structure</desc>
+   </doc>
+  <xsl:template name="mainPage">
+      <xsl:param name="currentID"/>
+      <!-- header -->
+    <div id="hdr">
+         <xsl:call-template name="hdr"/>
+      </div>
+      <div id="accessibility">
+         <span class="tocontent">
+            <a href="{$REQUEST}?style=text">Text only</a>
+      | <a class="skiplinks" href="#rh-col" title="Go to main page content">Skip links</a>
+         </span>
+      </div>
+      <div id="hdr2">
+         <xsl:call-template name="hdr2"/>
+      </div>
+      <xsl:if test="not($contentStructure='all' or @rend='all')">
+         <div id="hdr3">
+	           <xsl:call-template name="hdr3"/>
+         </div>
+      </xsl:if>
+      <xsl:choose>
+         <xsl:when test="$contentStructure='all' or @rend='all'">
+	           <div class="column-wrapper">
+	              <xsl:call-template name="col1"/>
+	              <xsl:call-template name="col2"/>
+	              <xsl:call-template name="col3"/>
+	           </div>
+         </xsl:when>
+         <xsl:when test="@rend='frontpage'">
+	           <div class="column-wrapper">
+	              <div id="rh-col">
+	                 <xsl:for-each select="descendant-or-self::tei:TEI/tei:text/tei:body">
+	                    <xsl:apply-templates/>
+	                 </xsl:for-each>
+	              </div>
+	              <div id="lh-col">
+	                 <xsl:for-each select="descendant-or-self::tei:TEI/tei:text/tei:front">
+	                    <xsl:apply-templates/>
+	                 </xsl:for-each>
+	              </div>
+	           </div>
+         </xsl:when>
+         <xsl:when test="$contentStructure='body'">
+	           <xsl:call-template name="bodyLayout">
+	              <xsl:with-param name="currentID" select="$currentID"/>
+	           </xsl:call-template>
+         </xsl:when>
+      </xsl:choose>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[html] what to do in column 1 of 3 column arrangement </desc>
+   </doc>
+  <xsl:template name="col1">
+      <div id="col1">
+         <xsl:for-each select="descendant-or-self::tei:TEI/tei:text/tei:front">
+            <xsl:apply-templates/>
+         </xsl:for-each>
+      </div>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[html] what to do in column 2 of 3 column arrangement </desc>
+   </doc>
+  <xsl:template name="col2">
+      <div id="col2">
+         <xsl:for-each select="descendant-or-self::tei:TEI/tei:text/tei:body">
+            <xsl:apply-templates/>
+         </xsl:for-each>
+      </div>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[html] what to do in column 3 of 3 column arrangement </desc>
+   </doc>
+  <xsl:template name="col3">
+      <div id="col3">
+         <xsl:for-each select="descendant-or-self::tei:TEI/tei:text/tei:back">
+            <xsl:apply-templates/>
+         </xsl:for-each>
+      </div>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[html] arrangment of page as HTML divs <param name="currentID">currentID</param>
+      </desc>
+   </doc>
+  <xsl:template name="bodyLayout">
+      <xsl:param name="currentID"/>
+      <div class="column-wrapper">
+         <div id="lh-col">
+            <div id="lh-col-top">
+               <xsl:comment>top of left-hand column</xsl:comment>
+               <xsl:call-template name="lh-col-top"/>
+            </div>
+            <div id="lh-col-bottom">
+               <xsl:comment>bottom of left-hand column</xsl:comment>
+               <xsl:call-template name="lh-col-bottom">
+                  <xsl:with-param name="currentID" select="$currentID"/>
+               </xsl:call-template>
+            </div>
+         </div>
+         <div id="rh-col">
+	   <div id="rh-col-top">
+	     <xsl:comment>top of right-hand column</xsl:comment>
+	     <xsl:call-template name="rh-col-top"/>
+            </div>
+            <div id="rh-col-bottom">
+               <xsl:comment>bottom of right-hand column</xsl:comment>
+               <xsl:call-template name="rh-col-bottom">
+                  <xsl:with-param name="currentID" select="$currentID"/>
+               </xsl:call-template>
+            </div>
+         </div>
+      </div>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[html] Generate a page using simple layout </desc>
+   </doc>
+  <xsl:template name="pageLayoutSimple">
+      <html>
+         <xsl:call-template name="addLangAtt"/>
+         <xsl:call-template name="htmlFileTop"/>
+         <body class="simple" id="TOP">
+	   <xsl:copy-of select="tei:text/tei:body/@unload"/>
+	   <xsl:copy-of select="tei:text/tei:body/@onunload"/>
+	   <xsl:call-template name="bodyMicroData"/>
+	   <xsl:call-template name="bodyJavascriptHook"/>
+	   <xsl:call-template name="bodyHook"/>
+	   <xsl:if test="not(tei:text/tei:front/tei:titlePage)">
+	     <div class="stdheader">
+	       <xsl:call-template name="stdheader">
+		 <xsl:with-param name="title">
+		   <xsl:call-template name="generateTitle"/>
+		 </xsl:with-param>
+	       </xsl:call-template>
+	     </div>
+	   </xsl:if>
+	    <xsl:comment> front matter </xsl:comment>
+	    <xsl:apply-templates select="tei:text/tei:front"/>
+	    <xsl:if test="$autoToc='true' and (descendant::tei:div or descendant::tei:div1) and not(descendant::tei:divGen[@type='toc'])">
+	      <h2>
+		<xsl:call-template name="i18n">
+		  <xsl:with-param name="word">tocWords</xsl:with-param>
+		</xsl:call-template>
+	      </h2>
+	      <xsl:call-template name="mainTOC"/>
+	    </xsl:if>
+	    <xsl:choose>
+	      <xsl:when test="tei:text/tei:group">
+		<xsl:apply-templates select="tei:text/tei:group"/>
+	      </xsl:when>
+	      <xsl:when test="@rend='multicol'">
+		<table>
+		  <tr>
+		    <xsl:apply-templates select="tei:text/tei:body"/>
+		  </tr>
+		</table>
+	      </xsl:when>
+	      <xsl:otherwise>
+		<xsl:comment>body matter </xsl:comment>
+		<xsl:call-template name="startHook"/>
+		<xsl:variable name="ident">
+		  <xsl:apply-templates mode="ident" select="."/>
+		</xsl:variable>
+		<xsl:apply-templates select="tei:text/tei:body"/>
+	      </xsl:otherwise>
+	    </xsl:choose>
+	    <xsl:comment>back matter </xsl:comment>
+	    <xsl:apply-templates select="tei:text/tei:back"/>
+            <xsl:call-template name="printNotes"/>
+            <xsl:call-template name="htmlFileBottom"/>
+            <xsl:call-template name="bodyEndHook"/>
+         </body>
+      </html>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[html] Generate a page using table layout<param name="currentID">currentID</param>
+      </desc>
+   </doc>
+  <xsl:template name="pageLayoutTable">
+      <xsl:param name="currentID"/>
+      <html>
+         <xsl:call-template name="addLangAtt"/>
+         <xsl:comment>THIS FILE IS GENERATED FROM AN XML MASTER. DO NOT EDIT (1)</xsl:comment>
+         <xsl:text>&#10;</xsl:text>
+         <head>
+            <xsl:variable name="pagetitle">
+               <xsl:choose>
+                  <xsl:when test="$currentID=''">
+                     <xsl:call-template name="generateTitle"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:call-template name="generateTitle"/>: <xsl:choose>
+                        <xsl:when test="count(id($currentID))&gt;0">
+                           <xsl:for-each select="id($currentID)">
+                              <xsl:apply-templates mode="xref" select="."/>
+                           </xsl:for-each>
+                        </xsl:when>
+                        <xsl:otherwise>
+                           <xsl:apply-templates mode="xpath" select="descendant-or-self::tei:TEI/tei:text">
+                              <xsl:with-param name="xpath" select="$currentID"/>
+                              <xsl:with-param name="action" select="'header'"/>
+                           </xsl:apply-templates>
+                        </xsl:otherwise>
+                     </xsl:choose>
+                  </xsl:otherwise>
+               </xsl:choose>
+            </xsl:variable>
+            <title>
+               <xsl:value-of select="$htmlTitlePrefix"/>
+               <xsl:value-of select="$pagetitle"/>
+            </title>
+            <link href="/favicon.ico" rel="icon" type="image/x-icon"/>
+            <link href="/favicon.ico" rel="shortcut icon" type="image/x-icon"/>
+            <xsl:call-template name="headHook"/>
+            <xsl:call-template name="metaHTML">
+               <xsl:with-param name="title" select="$pagetitle"/>
+            </xsl:call-template>
+            <xsl:call-template name="includeCSS"/>
+            <xsl:call-template name="cssHook"/>
+            <xsl:call-template name="includeJavascript"/>
+            <xsl:call-template name="javascriptHook"/>
+         </head>
+         <body class="pagetable">
+            <xsl:call-template name="bodyMicroData"/>
+            <xsl:call-template name="bodyJavascriptHook"/>
+	    <xsl:call-template name="bodyHook"/>
+            <xsl:call-template name="pageHeader">
+               <xsl:with-param name="mode">table</xsl:with-param>
+            </xsl:call-template>
+            <xsl:call-template name="pageLayoutTableBody">
+               <xsl:with-param name="currentID" select="$currentID"/>
+            </xsl:call-template>
+            <xsl:call-template name="bodyEndHook"/>
+         </body>
+      </html>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[html] The page body, when using table layout<param name="currentID">currentID</param>
+      </desc>
+   </doc>
+  <xsl:template name="pageLayoutTableBody">
+      <xsl:param name="currentID"/>
+      <table>
+         <tr>
+            <td class="hdr" colspan="2">
+               <xsl:call-template name="hdr"/>
+            </td>
+         </tr>
+         <tr>
+            <td class="hdr2" colspan="2">
+               <xsl:call-template name="hdr2"/>
+            </td>
+         </tr>
+         <tr>
+            <td class="hdr3" colspan="2">
+               <xsl:call-template name="hdr3"/>
+            </td>
+         </tr>
+         <tr>
+            <td align="left" class="sidetext" rowspan="2" style="vertical-align:top;" width="{$linksWidth}">
+               <xsl:call-template name="searchbox"/>
+               <xsl:call-template name="leftHandFrame">
+                  <xsl:with-param name="currentID" select="$requestedID"/>
+               </xsl:call-template>
+            </td>
+         </tr>
+         <tr>
+            <td class="maintext" colspan="2" style="vertical-align:top;">
+               <xsl:call-template name="mainFrame">
+                  <xsl:with-param name="currentID" select="$currentID"/>
+               </xsl:call-template>
+            </td>
+         </tr>
+      </table>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[html] </desc>
+   </doc>
+  <xsl:template name="previousLink">
+      <xsl:variable name="myName">
+         <xsl:value-of select="local-name(.)"/>
+      </xsl:variable>
+      <xsl:choose>
+         <xsl:when test="preceding-sibling::tei:TEI">
+            <xsl:apply-templates mode="generatePreviousLink" select="preceding-sibling::tei:TEI[1]"/>
+         </xsl:when>
+         <xsl:when test="preceding-sibling::tei:div[tei:head or $autoHead='true']">
+            <xsl:apply-templates mode="generatePreviousLink" select="preceding-sibling::tei:div[1]"/>
+         </xsl:when>
+         <xsl:when test="parent::tei:body/preceding-sibling::tei:front/tei:div[tei:head or $autoHead='true']">
+            <xsl:apply-templates mode="generatePreviousLink"
+                                 select="parent::tei:body/preceding-sibling::tei:front/tei:div[last()]"/>
+         </xsl:when>
+         <xsl:when test="parent::tei:back/preceding-sibling::tei:body/tei:div[tei:head or $autoHead='true']">
+            <xsl:apply-templates mode="generatePreviousLink"
+                                 select="parent::tei:body/preceding-sibling::tei:body/tei:div[last()]"/>
+         </xsl:when>
+         <xsl:when test="$myName='div1' and preceding-sibling::tei:div1[tei:head or $autoHead='true']">
+            <xsl:apply-templates mode="generatePreviousLink" select="preceding-sibling::tei:div1[1]"/>
+         </xsl:when>
+         <xsl:when test="$myName='div2' and preceding-sibling::tei:div2[tei:head or $autoHead='true']">
+            <xsl:apply-templates mode="generatePreviousLink" select="preceding-sibling::tei:div2[1]"/>
+         </xsl:when>
+         <xsl:when test="$myName='div3' and preceding-sibling::tei:div3[tei:head or $autoHead='true']">
+            <xsl:apply-templates mode="generatePreviousLink" select="preceding-sibling::tei:div3[1]"/>
+         </xsl:when>
+         <xsl:when test="$myName='div4' and preceding-sibling::tei:div4[tei:head or $autoHead='true']">
+            <xsl:apply-templates mode="generatePreviousLink" select="preceding-sibling::tei:div4[1]"/>
+         </xsl:when>
+         <xsl:when test="$myName='div5' and preceding-sibling::tei:div5[tei:head or $autoHead='true']">
+            <xsl:apply-templates mode="generatePreviousLink" select="preceding-sibling::tei:div5[1]"/>
+         </xsl:when>
+         <xsl:when test="$myName='div6' and preceding-sibling::tei:div6[tei:head or $autoHead='true']">
+            <xsl:apply-templates mode="generatePreviousLink" select="preceding-sibling::tei:div6[1]"/>
+         </xsl:when>
+      </xsl:choose>
+  </xsl:template>
+  <xsl:template name="simpleBody">
+    <xsl:choose>
+      <xsl:when test="tei:text/tei:group">
+	<xsl:apply-templates select="tei:text/tei:group"/>
+      </xsl:when>
+       <xsl:when test="$filePerPage='true'">
+	 <xsl:variable name="pass1">	 
+	   <xsl:apply-templates select="tei:text/*"/>
+	 </xsl:variable>
+	 <xsl:choose>
+	   <xsl:when test="not($pass1/html:PAGEBREAK)">
+	     <xsl:for-each-group select="$pass1/*"
+				 group-ending-with="*[(position() mod 40) = 0]">
+	       <xsl:call-template name="pageperfile">
+		 <xsl:with-param name="page">
+		   <xsl:text>page</xsl:text>
+		   <xsl:value-of select="position()"/>
+		 </xsl:with-param>
+	       </xsl:call-template>
+	     </xsl:for-each-group>
+	   </xsl:when>
+	   <xsl:otherwise>
+	     <xsl:for-each-group select="$pass1/*"
+				 group-starting-with="html:PAGEBREAK">
+	       <xsl:choose>
+		 <xsl:when test="self::html:PAGEBREAK">
+		   <xsl:call-template name="pageperfile">
+		     <xsl:with-param name="page" select="self::html:PAGEBREAK/@name"/>
+		   </xsl:call-template>
+		 </xsl:when>
+		 <xsl:otherwise>
+		   <xsl:copy-of select="current-group()"/>
+		 </xsl:otherwise>
+	       </xsl:choose>
+	     </xsl:for-each-group>
+	   </xsl:otherwise>
+	 </xsl:choose>
+       </xsl:when>
+      <xsl:otherwise>
+    <!-- front matter -->
+    <xsl:apply-templates select="tei:text/tei:front"/>
+      <xsl:if test="$autoToc='true' and (descendant::tei:div or descendant::tei:div1) and not(descendant::tei:divGen[@type='toc'])">
+         <h2>
+            <xsl:call-template name="i18n">
+               <xsl:with-param name="word">tocWords</xsl:with-param>
+            </xsl:call-template>
+         </h2>
+         <xsl:call-template name="mainTOC"/>
+      </xsl:if>
+      <!-- main text -->
+	<xsl:apply-templates select="tei:text/tei:body"/>
+      </xsl:otherwise>
+    </xsl:choose>
+    <!-- back matter -->
+    <xsl:apply-templates select="tei:text/tei:back"/>
+      <xsl:call-template name="printNotes"/>
+  </xsl:template>
+
+  <xsl:template name="pageperfile">
+    <xsl:param name="page"/>
+    <xsl:variable name="outName">
+      <xsl:call-template name="outputChunkName">
+	<xsl:with-param name="ident">
+	  <xsl:value-of select="$page"/>
+	</xsl:with-param>
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:if test="$verbose='true'">
+      <xsl:message>Opening file <xsl:value-of select="$outName"/></xsl:message>
+    </xsl:if>
+    
+    <xsl:result-document href="{$outName}">
+      <html>
+	<xsl:call-template name="addLangAtt"/>
+	<head>
+	  <xsl:variable name="pagetitle">
+	    <xsl:call-template name="generateTitle"/>
+	    <xsl:text> page </xsl:text>
+	    <xsl:value-of select="$page"/>
+	  </xsl:variable>
+	  <title>
+	    <xsl:value-of select="$pagetitle"/>
+	  </title>
+	  <xsl:call-template name="headHook"/>
+	  <xsl:call-template name="metaHTML">
+	    <xsl:with-param name="title" select="$pagetitle"/>
+	  </xsl:call-template>
+	  <xsl:call-template name="includeCSS"/>
+	  <xsl:call-template name="cssHook"/>
+	  <xsl:call-template name="includeJavascript"/>
+	  <xsl:call-template name="javascriptHook"/>
+	</head>
+	<body>
+	  <xsl:apply-templates select="current-group()" mode="copy"/>
+	</body>
+      </html>
+    </xsl:result-document>
+    <xsl:if test="@facs">
+      <xsl:variable name="outNameFacs">
+	<xsl:call-template name="outputChunkName">
+	  <xsl:with-param name="ident">
+	    <xsl:value-of select="$page"/>
+	    <xsl:text>-facs</xsl:text>
+	  </xsl:with-param>
+	</xsl:call-template>
+      </xsl:variable>
+      <xsl:result-document href="{$outNameFacs}">
+	<html>
+	  <xsl:call-template name="addLangAtt"/>
+	  <head>
+	    <xsl:variable name="pagetitle">
+	      <xsl:call-template name="generateTitle"/>
+	      <xsl:text> page </xsl:text>
+	      <xsl:value-of select="$page"/>
+	      <xsl:text> (facsimile) </xsl:text>
+	    </xsl:variable>
+	    <title>
+	      <xsl:value-of select="$pagetitle"/>
+	    </title>
+	    <xsl:call-template name="headHook"/>
+	    <xsl:call-template name="metaHTML">
+	      <xsl:with-param name="title" select="$pagetitle"/>
+	    </xsl:call-template>
+	    <xsl:call-template name="includeCSS"/>
+	    <xsl:call-template name="cssHook"/>
+	    <xsl:call-template name="includeJavascript"/>
+	    <xsl:call-template name="javascriptHook"/>
+	  </head>
+	  <body style="margin:0;padding:0">
+	    <p><img src="{@facs}" class="fullpage" alt="page facsimile"/></p>
+	  </body>
+	</html>
+      </xsl:result-document>      
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template match="html:PAGEBREAK" mode="copy"/>
+  <xsl:template match="html:*" mode="copy">
+    <xsl:copy-of select="."/>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[html] </desc>
+   </doc>
+  <xsl:template name="stdfooter">
+      <xsl:param name="style" select="'plain'"/>
+      <xsl:param name="file"/>
+      <xsl:variable name="date">
+         <xsl:call-template name="generateDate"/>
+      </xsl:variable>
+      <xsl:variable name="author">
+         <xsl:call-template name="generateAuthor"/>
+      </xsl:variable>
+      <div class="stdfooter">
+         <xsl:if test="$linkPanel='true'">
+            <div class="footer">
+               <xsl:if test="not($parentURL='')">
+                  <a class="{$style}" href="{$parentURL}">
+                     <xsl:value-of select="$parentWords"/>
+                  </a> | </xsl:if>
+               <a class="{$style}" href="{$homeURL}">
+                  <xsl:value-of select="$homeWords"/>
+               </a>
+               <xsl:if test="$searchURL">
+		 <xsl:text>| </xsl:text>
+		 <a class="{$style}" href="{$searchURL}">
+		   <xsl:call-template name="i18n">
+		     <xsl:with-param name="word">searchWords</xsl:with-param>
+		   </xsl:call-template>            
+		 </a>
+               </xsl:if>
+               <xsl:if test="$feedbackURL"> | <a class="{$style}" href="{$feedbackURL}">
+	       <xsl:call-template name="i18n">
+		 <xsl:with-param name="word">feedbackWords</xsl:with-param>
+	       </xsl:call-template>
+	     </a>
+               </xsl:if>
+            </div>
+         </xsl:if>
+         <xsl:call-template name="preAddressHook"/>
+         <address>
+            <xsl:if test="not($author='')">
+               <xsl:text> </xsl:text>
+               <xsl:value-of select="$author"/>.
+      </xsl:if>
+            <xsl:call-template name="i18n">
+               <xsl:with-param name="word">dateWord</xsl:with-param>
+            </xsl:call-template>
+            <xsl:text>: </xsl:text>
+            <xsl:value-of select="$date"/>
+            <br/>
+            <xsl:call-template name="copyrightStatement"/>
+            <xsl:comment>
+               <xsl:text>
+	  Generated </xsl:text>
+               <xsl:if test="not($masterFile='index')">
+                  <xsl:text>from </xsl:text>
+                  <xsl:value-of select="$masterFile"/>
+               </xsl:if>
+               <xsl:text> using an XSLT version </xsl:text>
+               <xsl:value-of select="system-property('xsl:version')"/> stylesheet
+	  based on <xsl:value-of select="$teixslHome"/>
+	  processed using <xsl:value-of select="system-property('xsl:vendor')"/>
+	  on <xsl:call-template name="whatsTheDate"/>
+            </xsl:comment>
+         </address>
+      </div>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[html] <param name="title">title</param>
+      </desc>
+   </doc>
+  <xsl:template name="stdheader">
+      <xsl:param name="title">(no title)</xsl:param>
+      <xsl:choose>
+         <xsl:when test="$pageLayout='Simple'">
+	   <xsl:if test="not($institution='')">
+            <h2 class="institution">
+               <xsl:value-of select="$institution"/>
+            </h2>
+	   </xsl:if>
+	   <xsl:if test="not($department='')">
+            <h2 class="department">
+               <xsl:value-of select="$department"/>
+            </h2>
+	   </xsl:if>
+	   
+	   <xsl:call-template name="makeHTMLHeading">
+	     <xsl:with-param name="class">maintitle</xsl:with-param>
+	     <xsl:with-param name="text">
+	       <xsl:copy-of select="$title"/>
+	     </xsl:with-param>
+	     <xsl:with-param name="level">1</xsl:with-param>
+	   </xsl:call-template>
+	   
+	   <xsl:call-template name="makeHTMLHeading">
+	     <xsl:with-param name="class">subtitle</xsl:with-param>
+	     <xsl:with-param name="text">
+	       <xsl:call-template name="generateSubTitle"/>
+	     </xsl:with-param>
+	     <xsl:with-param name="level">2</xsl:with-param>
+	   </xsl:call-template>
+	   
+
+	   <xsl:if test="$showTitleAuthor='true'">
+	     <xsl:if test="$verbose='true'">
+	       <xsl:message>displaying author and date</xsl:message>
+	     </xsl:if>
+	     <xsl:call-template name="generateAuthorList"/>
+	     <xsl:call-template name="generateDate"/>
+	     <xsl:call-template name="generateEdition"/>
+	   </xsl:if>
+	 </xsl:when>
+	 <xsl:otherwise>
+	   <xsl:call-template name="makeHTMLHeading">
+	     <xsl:with-param name="class">maintitle</xsl:with-param>
+	     <xsl:with-param name="text">
+	       <xsl:value-of select="$title"/>
+	     </xsl:with-param>
+	     <xsl:with-param name="level">1</xsl:with-param>
+	   </xsl:call-template>
+	   
+	   <xsl:call-template name="makeHTMLHeading">
+	     <xsl:with-param name="class">subtitle</xsl:with-param>
+	     <xsl:with-param name="text">
+	       <xsl:call-template name="generateTitle"/>
+	     </xsl:with-param>
+	     <xsl:with-param name="level">2</xsl:with-param>
+	   </xsl:call-template>
+	   
+	   <xsl:if test="$showTitleAuthor='true'">
+	     <xsl:if test="$verbose='true'">
+	       <xsl:message>displaying author and date</xsl:message>
+	     </xsl:if>
+	     <xsl:call-template name="generateAuthorList"/>
+	     <xsl:call-template name="generateDate"/>
+	     <xsl:call-template name="generateEdition"/>
+	   </xsl:if>
+	 </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[html] </desc>
+   </doc>
+  <xsl:template name="subtoc">
+      <xsl:if test="child::tei:div|tei:div1|tei:div2|tei:div3|tei:div4|tei:div5|tei:div6">
+         <xsl:variable name="parent">
+            <xsl:choose>
+               <xsl:when test="ancestor::tei:div">
+                  <xsl:apply-templates mode="ident" select="ancestor::tei:div[last()]"/>
+               </xsl:when>
+               <xsl:otherwise>
+                  <xsl:apply-templates mode="ident" select="."/>
+               </xsl:otherwise>
+            </xsl:choose>
+         </xsl:variable>
+         <xsl:variable name="depth">
+            <xsl:apply-templates mode="depth" select="."/>
+         </xsl:variable>
+         <p>
+            <span class="subtochead">
+               <xsl:call-template name="i18n">
+                  <xsl:with-param name="word">tocWords</xsl:with-param>
+               </xsl:call-template>
+            </span>
+         </p>
+         <div class="subtoc">
+            <ul class="subtoc">
+               <xsl:for-each select="tei:div|tei:div1|tei:div2|tei:div3|tei:div4|tei:div5|tei:div6">
+                  <xsl:variable name="innerdent">
+                     <xsl:apply-templates mode="generateLink" select="."/>
+                  </xsl:variable>
+                  <li class="subtoc">
+                     <xsl:call-template name="makeInternalLink">
+                        <xsl:with-param name="dest">
+                           <xsl:value-of select="$innerdent"/>
+                        </xsl:with-param>
+                        <xsl:with-param name="class">
+                           <xsl:value-of select="$class_subtoc"/>
+                        </xsl:with-param>
+                        <xsl:with-param name="body">
+                           <xsl:call-template name="header">
+		                            <xsl:with-param name="display">simple</xsl:with-param>
+		                         </xsl:call-template>
+                        </xsl:with-param>
+                     </xsl:call-template>
+                  </li>
+               </xsl:for-each>
+            </ul>
+         </div>
+      </xsl:if>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[html] </desc>
+   </doc>
+  <xsl:template name="summaryToc">
+      <div class="teidiv">
+         <p>Select headings on the left-hand side to see more explanation of the
+        links on the right.</p>
+         <table cellspacing="7">
+            <thead>
+               <tr>
+                  <th nowrap="nowrap"/>
+                  <th/>
+               </tr>
+            </thead>
+	    <tbody>
+            <xsl:for-each select="//tei:body/tei:div">
+               <xsl:text>&#10;</xsl:text>
+               <tr class="summaryline">
+                  <td align="right" class="summarycell" style="vertical-align:top;">
+                     <b>
+                        <a class="nolink">
+                           <xsl:attribute name="href">
+                              <xsl:apply-templates mode="generateLink" select="."/>
+                           </xsl:attribute>
+                           <xsl:value-of select="tei:head"/>
+                        </a>
+                     </b>
+                  </td>
+                  <td class="link" style="vertical-align:top;">
+                     <xsl:for-each select=".//xref|.//xptr">
+                        <xsl:if test="position() &gt; 1">
+                           <xsl:text>&#160;</xsl:text>
+                           <img alt="*" src="/images/dbluball.gif"/>
+                           <xsl:text> </xsl:text>
+                        </xsl:if>
+                        <span class="nowrap">
+                           <xsl:apply-templates select="."/>
+                        </span>
+                     </xsl:for-each>
+                  </td>
+               </tr>
+            </xsl:for-each>
+	    </tbody>
+         </table>
+      </div>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[html] Make a TOC section <param name="style">CSS style to use</param>
+         <param name="id">ID to link to</param>
+         <param name="force">whether to force a TOC entry even if other rules
+      would normally prevent it</param>
+      </desc>
+   </doc>
+  <xsl:template name="tocSection">
+      <xsl:param name="style"/>
+      <xsl:param name="id"/>
+      <xsl:param name="force">false</xsl:param>
+      <xsl:choose>
+         <xsl:when test="tei:div1">
+            <xsl:for-each select="tei:div1[tei:head or $autoHead='true']">
+               <xsl:call-template name="tocEntry">
+                  <xsl:with-param name="style" select="$style"/>
+                  <xsl:with-param name="id" select="$id"/>
+               </xsl:call-template>
+            </xsl:for-each>
+         </xsl:when>
+         <xsl:when test="tei:div2 and (number($splitLevel) &gt;=1 or $force='true')">
+            <xsl:for-each select="tei:div2[tei:head or $autoHead='true']">
+               <xsl:call-template name="tocEntry">
+                  <xsl:with-param name="style" select="$style"/>
+                  <xsl:with-param name="id" select="$id"/>
+               </xsl:call-template>
+            </xsl:for-each>
+         </xsl:when>
+         <xsl:when test="tei:div3 and (number($splitLevel) &gt;=2 or $force='true')">
+            <xsl:for-each select="tei:div3[tei:head or $autoHead='true']">
+               <xsl:call-template name="tocEntry">
+                  <xsl:with-param name="style" select="$style"/>
+                  <xsl:with-param name="id" select="$id"/>
+               </xsl:call-template>
+            </xsl:for-each>
+         </xsl:when>
+         <xsl:when test="self::tei:div">
+            <xsl:variable name="depth">
+               <xsl:apply-templates mode="depth" select="."/>
+            </xsl:variable>
+            <xsl:if test="(number($splitLevel)&gt;number($depth)  or $force='true' or ancestor::tei:TEI/@rend='nosplit')">
+               <xsl:for-each select="tei:div[tei:head or $autoHead='true']">
+                  <xsl:call-template name="tocEntry">
+                     <xsl:with-param name="style" select="$style"/>
+                     <xsl:with-param name="id" select="$id"/>
+                  </xsl:call-template>
+               </xsl:for-each>
+            </xsl:if>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:for-each select="tei:div[tei:head or $autoHead='true']">
+               <xsl:call-template name="tocEntry">
+                  <xsl:with-param name="style" select="$style"/>
+                  <xsl:with-param name="id" select="$id"/>
+               </xsl:call-template>
+            </xsl:for-each>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[html] Make a TOC entry <param name="style">style</param>
+         <param name="id">id</param>
+      </desc>
+   </doc>
+  <xsl:template name="tocEntry">
+      <xsl:param name="style"/>
+      <xsl:param name="id"/>
+      <xsl:element name="{$tocElement}">
+         <xsl:attribute name="class">
+            <xsl:value-of select="$style"/>
+            <xsl:apply-templates mode="depth" select="."/>
+         </xsl:attribute>
+         <xsl:choose>
+            <xsl:when test="generate-id(.)=$id">
+               <span class="toclist-this">
+                  <xsl:call-template name="header">
+	                    <xsl:with-param name="display">simple</xsl:with-param>
+	                 </xsl:call-template>
+               </span>
+            </xsl:when>
+            <xsl:otherwise>
+               <a>
+                  <xsl:attribute name="class">
+                     <xsl:value-of select="$style"/>
+                  </xsl:attribute>
+                  <xsl:attribute name="href">
+                     <xsl:apply-templates mode="generateLink" select="."/>
+                  </xsl:attribute>
+                  <xsl:call-template name="header">
+		    <xsl:with-param name="display">simple</xsl:with-param>
+		  </xsl:call-template>
+               </a>
+            </xsl:otherwise>
+         </xsl:choose>
+         <xsl:text>&#10;</xsl:text>
+         <xsl:call-template name="tocSection">
+            <xsl:with-param name="style" select="$style"/>
+            <xsl:with-param name="id" select="$id"/>
+            <xsl:with-param name="force">
+               <xsl:if test="generate-id(.)=$id">true</xsl:if>
+            </xsl:with-param>
+         </xsl:call-template>
+      </xsl:element>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[html] </desc>
+   </doc>
+  <xsl:template name="topNavigation">
+      <xsl:if test="ancestor::teiCorpus">
+	<xsl:element name="{if ($outputTarget='html5') then 'nav' else 'div'}">	  
+	  <xsl:attribute name="class" select="$alignNavigationPanel"/>
+	    <xsl:call-template name="nextLink"/>
+	    <xsl:call-template name="previousLink"/>
+	    <xsl:call-template name="upLink">
+	      <xsl:with-param name="up" select="concat($masterFile,$standardSuffix)"/>
+	      <xsl:with-param name="title">
+		<xsl:call-template name="contentsWord"/>
+	      </xsl:with-param>
+	    </xsl:call-template>
+	</xsl:element>
+      </xsl:if>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[html] <param name="up">the link to which "Up" goes</param>
+         <param name="title">the text of the link</param>
+      </desc>
+   </doc>
+  <xsl:template name="upLink">
+      <xsl:param name="up"/>
+      <xsl:param name="title"/>
+      <xsl:if test="$up">
+         <span class="upLink">
+	           <xsl:text> </xsl:text>
+	           <xsl:call-template name="i18n">
+               <xsl:with-param name="word">upWord</xsl:with-param>
+            </xsl:call-template>
+	           <xsl:call-template name="navInterSep"/>
+         </span>
+         <a class="navigation">
+	           <xsl:choose>
+	              <xsl:when test="$title">
+	                 <xsl:attribute name="href">
+	                    <xsl:value-of select="$up"/>
+	                 </xsl:attribute>
+	                 <xsl:value-of select="$title"/>
+	              </xsl:when>
+	              <xsl:otherwise>
+	                 <xsl:attribute name="href">
+	                    <xsl:apply-templates mode="generateLink" select="$up"/>
+	                 </xsl:attribute>
+	                 <xsl:for-each select="$up">
+	                    <xsl:call-template name="headerLink">
+		                      <xsl:with-param name="minimal" select="$minimalCrossRef"/>
+	                    </xsl:call-template>
+	                 </xsl:for-each>
+	              </xsl:otherwise>
+	           </xsl:choose>
+         </a>
+      </xsl:if>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[html] <param name="path">path</param>
+         <param name="class">class</param>
+         <param name="whole">whole</param>
+      </desc>
+   </doc>
+  <xsl:template name="walkTree">
+      <xsl:param name="path"/>
+      <xsl:param name="class"/>
+      <xsl:param name="whole"/>
+      <xsl:choose>
+         <xsl:when test="contains($path,'/')">
+            <xsl:variable name="current">
+               <xsl:value-of select="substring-before($path,'/')"/>
+            </xsl:variable>
+            <xsl:variable name="rest">
+               <xsl:value-of select="substring-after($path,'/')"/>
+            </xsl:variable>
+            <xsl:call-template name="aCrumb">
+               <xsl:with-param name="crumbBody">
+                  <xsl:choose>
+                     <xsl:when test="$rest='index.xsp' and $requestedID=''">
+                        <xsl:value-of select="$current"/>
+                     </xsl:when>
+                     <xsl:when test="$rest='index.xml' and $requestedID=''">
+                        <xsl:value-of select="$current"/>
+                     </xsl:when>
+                     <xsl:otherwise>
+                        <a class="{$class}">
+			  <xsl:attribute name="href">
+			    <xsl:value-of select="$whole"/>
+			    <xsl:value-of select="$current"/>
+			    <xsl:text>/</xsl:text>
+			  </xsl:attribute>
+			  <xsl:value-of select="$current"/>
+                        </a>
+                     </xsl:otherwise>
+                  </xsl:choose>
+               </xsl:with-param>
+            </xsl:call-template>
+            <xsl:call-template name="walkTree">
+               <xsl:with-param name="class">
+                  <xsl:value-of select="$class"/>
+               </xsl:with-param>
+               <xsl:with-param name="path" select="$rest"/>
+               <xsl:with-param name="whole">
+	                 <xsl:value-of select="$whole"/>
+	                 <xsl:value-of select="$current"/>
+	                 <xsl:text>/</xsl:text>
+	              </xsl:with-param>
+            </xsl:call-template>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:if test="not($path='index.xsp' or $path='index.xml')">
+               <xsl:call-template name="aCrumb">
+                  <xsl:with-param name="crumbBody">
+                     <a class="{$class}">
+		       <xsl:attribute name="href">
+			 <xsl:value-of select="$whole"/>
+			 <xsl:value-of select="$path"/>
+		       </xsl:attribute>
+		       <xsl:value-of select="$path"/>
+                     </a>
+                  </xsl:with-param>
+               </xsl:call-template>
+            </xsl:if>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[html] </desc>
+   </doc>
+  <xsl:template name="writeDiv">
+      <xsl:variable name="BaseFile">
+         <xsl:value-of select="$masterFile"/>
+         <xsl:call-template name="addCorpusID"/>
+      </xsl:variable>
+      <html>
+         <xsl:call-template name="addLangAtt"/>
+         <xsl:comment>THIS IS A GENERATED FILE. DO NOT EDIT (2)</xsl:comment>
+         <head>
+            <xsl:variable name="pagetitle">
+               <xsl:call-template name="generateDivtitle"/>
+            </xsl:variable>
+            <title>
+               <xsl:value-of select="$pagetitle"/>
+            </title>
+            <xsl:call-template name="headHook"/>
+            <xsl:call-template name="metaHTML">
+               <xsl:with-param name="title" select="$pagetitle"/>
+            </xsl:call-template>
+            <xsl:call-template name="includeCSS"/>
+            <xsl:call-template name="cssHook"/>
+            <xsl:call-template name="includeJavascript"/>
+            <xsl:call-template name="javascriptHook"/>
+         </head>
+         <body id="TOP">
+            <xsl:call-template name="bodyMicroData"/>
+            <xsl:call-template name="bodyJavascriptHook"/>
+	    <xsl:call-template name="bodyHook"/>
+            <div class="teidiv">
+               <xsl:call-template name="stdheader">
+                  <xsl:with-param name="title">
+		    <xsl:call-template name="header"/>
+                  </xsl:with-param>
+               </xsl:call-template>
+               <xsl:if test="$topNavigationPanel='true'">
+		 <xsl:element name="{if ($outputTarget='html5') then 'nav' else 'div'}">
+		   <xsl:call-template name="xrefpanel">
+		     <xsl:with-param name="homepage" select="concat($BaseFile,$standardSuffix)"/>
+                     <xsl:with-param name="mode" select="local-name(.)"/>
+                  </xsl:call-template>
+		 </xsl:element>
+               </xsl:if>
+               <xsl:if test="$subTocDepth &gt;= 0">
+                  <xsl:call-template name="subtoc"/>
+               </xsl:if>
+               <xsl:call-template name="startHook"/>
+               <xsl:call-template name="doDivBody"/>
+               <xsl:call-template name="printNotes"/>
+               <xsl:if test="$bottomNavigationPanel='true'">
+		 <xsl:element name="{if ($outputTarget='html5') then 'nav' else 'div'}">
+                  <xsl:call-template name="xrefpanel">
+                     <xsl:with-param name="homepage" select="concat($BaseFile,$standardSuffix)"/>
+                     <xsl:with-param name="mode" select="local-name(.)"/>
+                  </xsl:call-template>
+		 </xsl:element>
+               </xsl:if>
+               <xsl:call-template name="stdfooter"/>
+	              <xsl:call-template name="bodyEndHook"/>
+            </div>
+         </body>
+      </html>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[html]provide a class attribute and/or ID for each div <param name="depth">depth of section (1, 2 3, 4 etc)</param>
+      </desc>
+   </doc>
+  <xsl:template name="divClassAttribute">
+      <xsl:param name="depth"/>
+      <xsl:if test="@its:dir">
+	<xsl:attribute name="dir" select="@its:dir"/>
+      </xsl:if>
+      <xsl:attribute name="class">
+         <xsl:choose>
+	   <xsl:when test="@type">
+	     <xsl:value-of select="@type"/>
+	   </xsl:when>
+	   <xsl:otherwise>
+	     <xsl:text>teidiv</xsl:text>
+	     <xsl:value-of select="$depth"/>
+	   </xsl:otherwise>
+         </xsl:choose>
+         <xsl:if test="@rend">
+	   <xsl:text> </xsl:text>
+	   <xsl:value-of select="@rend"/>
+         </xsl:if>
+      </xsl:attribute>
+      <xsl:variable name="ident">
+         <xsl:apply-templates mode="ident" select="."/>
+      </xsl:variable>
+      <xsl:attribute name="id">
+         <xsl:value-of select="$ident"/>
+      </xsl:attribute>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[html] <param name="homepage">homepage</param>
+         <param name="mode">mode</param>
+      </desc>
+   </doc>
+  <xsl:template name="xrefpanel">
+      <xsl:param name="homepage"/>
+      <xsl:param name="mode"/>
+      <xsl:attribute name="class" select="$alignNavigationPanel"/>
+      <xsl:call-template name="generateUpLink"/>
+      <xsl:if test="not(ancestor-or-self::tei:TEI[@rend='nomenu'])">
+	<xsl:call-template name="previousLink"/>
+	<xsl:call-template name="nextLink"/>
+      </xsl:if>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[html] </desc>
+   </doc>
+  <xsl:template match="tei:floatingText">
+      <div class="floatingText">
+	        <xsl:for-each select="tei:front">
+	           <div class="floatingText_front">
+	              <xsl:apply-templates/>
+	           </div>
+	        </xsl:for-each>
+	        <xsl:for-each select="tei:body">
+	           <div class="floatingText_body">
+	              <xsl:apply-templates/>
+	           </div>
+	        </xsl:for-each>
+	        <xsl:for-each select="tei:back">
+	           <div class="floatingText_back">
+	              <xsl:apply-templates/>
+	           </div>
+	        </xsl:for-each>
+      </div>
+  </xsl:template>
+
+  <xsl:template match="tei:trailer">
+      <div class="trailer">
+	<xsl:apply-templates/>
+      </div>
+  </xsl:template>
+
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/textstructure.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/textcrit.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/textcrit.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/textcrit.xsl	(revision 258)
@@ -0,0 +1,139 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml"  xmlns:xlink="http://www.w3.org/1999/xlink"
+                xmlns:dbk="http://docbook.org/ns/docbook"
+                xmlns:rng="http://relaxng.org/ns/structure/1.0"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"
+                xmlns:xhtml="http://www.w3.org/1999/xhtml"
+                xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
+                xmlns:fo="http://www.w3.org/1999/XSL/Format"
+                xmlns:html="http://www.w3.org/1999/xhtml"
+
+                
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                exclude-result-prefixes="a fo dbk xlink xhtml rng tei teix"
+                version="2.0">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet dealing with elements from the textcrit
+      module, making HTML output. </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: textcrit.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2011, TEI Consortium</p>
+      </desc>
+   </doc>
+
+   <xsl:template name="appReading">
+     <xsl:param name="lemma"/>
+     <xsl:param name="lemmawitness"/>
+     <xsl:param name="readings"/>
+     <xsl:value-of select="$lemma"/>
+      <xsl:variable name="identifier">
+         <xsl:text>App</xsl:text>
+         <xsl:choose>
+	   <xsl:when test="@xml:id">
+	     <xsl:value-of select="@xml:id"/>
+	   </xsl:when>
+	   <xsl:when test="@n">
+	     <xsl:value-of select="@n"/>
+	   </xsl:when>
+	   <xsl:otherwise>
+	     <xsl:number count="tei:app" level="any"/>
+	   </xsl:otherwise>
+         </xsl:choose>
+      </xsl:variable>
+
+      <xsl:choose>
+       <xsl:when test="$footnoteFile='true'">
+	 <a class="notelink" href="{$masterFile}-notes.html#{$identifier}">
+	   <sup>
+	     <xsl:call-template name="appN"/>
+	   </sup>
+	 </a>
+       </xsl:when>
+       <xsl:otherwise>
+	 <a class="notelink" href="#{$identifier}">
+	   <sup>
+	     <xsl:call-template name="appN"/>
+	   </sup>
+	 </a>
+       </xsl:otherwise>
+      </xsl:choose>
+
+  </xsl:template>
+
+
+   <xsl:template name="appN">
+      <xsl:choose>
+         <xsl:when test="@n">
+            <xsl:value-of select="@n"/>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:number from="tei:text" level="any"/>
+         </xsl:otherwise>
+      </xsl:choose>
+   </xsl:template>
+
+   <xsl:template match="tei:app" mode="printnotes">
+      <xsl:variable name="identifier">
+         <xsl:text>App</xsl:text>
+         <xsl:choose>
+            <xsl:when test="@xml:id">
+	              <xsl:value-of select="@xml:id"/>
+            </xsl:when>
+            <xsl:when test="@n">
+	              <xsl:value-of select="@n"/>
+            </xsl:when>
+            <xsl:otherwise>
+	              <xsl:number count="tei:app" level="any"/>
+            </xsl:otherwise>
+         </xsl:choose>
+      </xsl:variable>
+      <div class="note">
+         <xsl:call-template name="makeAnchor">
+            <xsl:with-param name="name" select="$identifier"/>
+         </xsl:call-template>
+         <span class="noteLabel">
+            <xsl:call-template name="appN"/>
+            <xsl:text>. </xsl:text>
+         </span>
+         <span class="noteBody">
+            <xsl:apply-templates/>
+         </span>
+      </div>
+  
+   </xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/textcrit.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/build-to.xml
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/build-to.xml	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/build-to.xml	(revision 258)
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="utf-8"?>
+<project basedir="." default="dist" name="teitohtml">
+<!--
+	This library is free software; you can redistribute it and/or
+	modify it under the terms of the GNU Lesser General Public
+	License as published by the Free Software Foundation; either
+	version 2.1 of the License, or (at your option) any later version.
+	
+	This library 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
+	Lesser General Public License for more details.
+	
+	You should have received a copy of the GNU Lesser General Public
+	License along with this library; if not, write to the Free Software
+	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+	
+        Id: $Id: build-to.xml 9875 2011-12-04 18:27:43Z rahtz $
+        Copyright: 2011, TEI Consortium<
+-->
+  <!--
+ Convert TEI documents into HTML files.
+ -->
+  <!-- Path to TEI XML file. -->
+  <property name="inputFile" value=""/>
+  <!-- Path where the output ePUB file will be saved. -->
+  <property name="outputFile" value=""/>
+  <!-- which profile -->
+  <property name="profile" value="default"/>
+  <!-- where does oxygen keep stuff -->
+  <property name="oxygenlib" value=""/>
+  <!-- Stylesheet for transformation -->
+  <property name="stylesheetFile"  value="../profiles/${profile}/html/to.xsl"/>
+  <dirname property="inputFileDir" file="${inputFile}"/>
+  <dirname property="outputDir" file="${outputFile}"/>
+  <property name="outputTempDir" value="${outputDir}/temp-dir-for-ant"/>
+  <path id="classpath">
+    <pathelement path="${java.class.path}"/>
+  </path>
+  <import file="../odds2/build-to.xml"/>
+  <target name="setup">
+    <delete dir="${outputTempDir}"/>
+    <mkdir dir="${outputTempDir}"/>
+  </target>
+ 
+  <target name="transform">
+    <echo level="info">XSLT generate HTML files</echo>
+    <xslt force="yes" style="${stylesheetFile}" in="${outputTempDir}/tmp2.xml" out="${outputFile}" classpath="classpath">
+      <xmlcatalog>
+        <catalogpath>
+          <pathelement location="../../../../catalog.xml"/>
+          <pathelement location="../../../../../xhtml11/dtd/xhtmlcatalog.xml"/>
+        </catalogpath>
+      </xmlcatalog>
+      <factory name="net.sf.saxon.TransformerFactoryImpl"/>
+      <classpath location="${oxygenlib}/saxon9ee.jar"/>
+      <param name="directory" expression="file:///${outputTempDir}"/>
+      <param name="inputDir" expression="${inputFileDir}/"/>
+      <param name="cssFile" expression="${cssFile}" if="cssFile"/>
+      <!-- name of media overlay file -->
+      <param name="mediaoverlay" expression="${mediaoverlay}" if="mediaoverlay"/>
+      <!-- file per page -->
+      <param name="filePerPage" expression="${filePerPage}" if="filePerPage"/>
+      <!-- supply name of language-->
+      <param name="lang" expression="${lang}" if="lang"/>
+      <!-- emit some diagnostics"-->
+      <param name="debug" expression="${debug}" if="debug"/>
+      <!-- be verbose-->
+      <param name="verbose" expression="${verbose}" if="verbose"/>
+    </xslt>
+  </target>
+
+ <target name="dist" depends="setup,odd,notodd,transform,cleanup"/>
+
+  <target name="cleanup" unless="debug">  
+    <delete dir="${outputTempDir}"/>
+  </target>
+
+</project>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/build-to.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/corpus.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/corpus.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/corpus.xsl	(revision 258)
@@ -0,0 +1,180 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml" 
+                xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
+                xmlns:fo="http://www.w3.org/1999/XSL/Format"
+                xmlns:html="http://www.w3.org/1999/xhtml"
+
+                xmlns:rng="http://relaxng.org/ns/structure/1.0"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"
+                
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                exclude-result-prefixes="a fo rng tei teix"
+                version="2.0">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet dealing with elements from the corpus module,
+      making HTML output. </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: corpus.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2011, TEI Consortium</p>
+      </desc>
+   </doc>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element catRef</desc>
+   </doc>
+  <xsl:template match="tei:catRef">
+      <xsl:variable name="W">
+         <xsl:choose>
+            <xsl:when test="starts-with(@target,'#')">
+               <xsl:value-of select="substring(@target,2)"/>
+            </xsl:when>
+            <xsl:otherwise>
+               <xsl:value-of select="@target"/>
+            </xsl:otherwise>
+         </xsl:choose>
+      </xsl:variable>
+      <xsl:if test="preceding-sibling::tei:catRef">
+         <xsl:text> 
+    </xsl:text>
+      </xsl:if>
+      <em>
+         <xsl:value-of select="@scheme"/>
+      </em>: <xsl:apply-templates select="id($W)/catDesc"/>
+   </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element teiCorpus</desc>
+   </doc>
+  <xsl:template match="tei:teiCorpus">
+      <xsl:element name="html" namespace="{$outputNamespace}">
+         <xsl:call-template name="addLangAtt"/>
+         <head>
+            <title>
+               <xsl:apply-templates select="tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:title/text()"/>
+            </title>
+            <xsl:call-template name="includeCSS"/>
+            <xsl:call-template name="cssHook"/>
+         </head>
+         <body class="simple">
+	   <xsl:call-template name="bodyMicroData"/>
+	   <xsl:call-template name="bodyHook"/>
+	   <xsl:call-template name="bodyJavascriptHook"/>
+	   <div class="stdheader">
+	     <xsl:call-template name="stdheader">
+		<xsl:with-param name="title">
+		  <xsl:apply-templates select="tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:title"/>
+		</xsl:with-param>
+	     </xsl:call-template>
+	    </div>
+	    <xsl:call-template name="corpusBody"/>
+            <xsl:call-template name="stdfooter"/>
+            <xsl:call-template name="bodyEndHook"/>
+         </body>
+      </xsl:element>
+  </xsl:template>
+  <xsl:template match="tei:teiCorpus" mode="split">
+      <xsl:variable name="BaseFile">
+         <xsl:value-of select="$masterFile"/>
+         <xsl:call-template name="addCorpusID"/>
+      </xsl:variable>
+      <xsl:if test="$verbose='true'">
+         <xsl:message>TEI HTML: run start hook template teiStartHook</xsl:message>
+      </xsl:if>
+      <xsl:call-template name="teiStartHook"/>
+      <xsl:if test="$verbose='true'">
+         <xsl:message>TEI HTML in corpus splitting mode, base file is <xsl:value-of select="$BaseFile"/>
+         </xsl:message>
+      </xsl:if>
+      <xsl:variable name="outName">
+         <xsl:call-template name="outputChunkName">
+	           <xsl:with-param name="ident">
+	              <xsl:value-of select="$BaseFile"/>
+	           </xsl:with-param>
+         </xsl:call-template>
+      </xsl:variable>
+    
+      <xsl:if test="$verbose='true'">
+         <xsl:message>Opening file <xsl:value-of select="$outName"/>
+         </xsl:message>
+      </xsl:if>
+      <xsl:result-document doctype-public="{$doctypePublic}" 
+			   doctype-system="{$doctypeSystem}"
+                           encoding="{$outputEncoding}"
+                           href="{$outName}"
+                           method="{$outputMethod}">
+      
+         <xsl:element name="html" namespace="{$outputNamespace}">
+	   <xsl:call-template name="addLangAtt"/>
+	   <head>
+	     <title>
+	       <xsl:apply-templates select="tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:title/text()"/>
+	     </title>
+	     <xsl:call-template name="includeCSS"/>
+	     <xsl:call-template name="cssHook"/>
+	   </head>
+	   <body class="simple">
+	     <xsl:call-template name="bodyMicroData"/>
+	     <xsl:call-template name="bodyJavascriptHook"/>
+	     <xsl:call-template name="bodyHook"/>
+	     <div class="stdheader">
+	       <xsl:call-template name="stdheader">
+		 <xsl:with-param name="title">
+		   <xsl:apply-templates select="tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:title[1]"/>
+		 </xsl:with-param>
+	       </xsl:call-template>
+	     </div>
+	     <xsl:call-template name="corpusBody"/>
+	     <xsl:call-template name="stdfooter"/>
+	     <xsl:call-template name="bodyEndHook"/>
+	   </body>
+         </xsl:element>
+      </xsl:result-document>
+      <xsl:if test="$verbose='true'">
+         <xsl:message>Closing file <xsl:value-of select="$outName"/>
+         </xsl:message>
+      </xsl:if>
+      <xsl:if test="$verbose='true'">
+         <xsl:message>TEI HTML: run end hook template teiEndHook</xsl:message>
+      </xsl:if>
+      <xsl:call-template name="teiEndHook"/>
+      <xsl:apply-templates select="tei:TEI" mode="split"/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[html] </desc>
+   </doc>
+  <xsl:template name="corpusBody">
+    <xsl:call-template name="mainTOC"/>
+  </xsl:template>
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/corpus.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/transcr.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/transcr.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/transcr.xsl	(revision 258)
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml" 
+                
+                xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
+                xmlns:fo="http://www.w3.org/1999/XSL/Format"
+
+                xmlns:rng="http://relaxng.org/ns/structure/1.0"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"
+                xmlns:html="http://www.w3.org/1999/xhtml"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                exclude-result-prefixes="a fo rng tei teix"
+                version="2.0">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p>
+    TEI stylesheet
+    dealing  with elements from the
+    transcr module, making HTML output.
+      </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: transcr.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2011, TEI Consortium</p>
+      </desc>
+   </doc>
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/transcr.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/dictionaries.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/dictionaries.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/dictionaries.xsl	(revision 258)
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml" 
+                xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
+                xmlns:fo="http://www.w3.org/1999/XSL/Format"
+                xmlns:html="http://www.w3.org/1999/xhtml"
+
+                xmlns:m="http://www.w3.org/1998/Math/MathML"
+                xmlns:rng="http://relaxng.org/ns/structure/1.0"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"
+                
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                exclude-result-prefixes="a fo rng tei teix m"
+                version="2.0">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet dealing with elements from the dictionaries
+      module, making HTML output. </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: dictionaries.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2011, TEI Consortium</p>
+      </desc>
+   </doc>
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/dictionaries.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/tei-param.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/tei-param.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/tei-param.xsl	(revision 258)
@@ -0,0 +1,786 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml"                 
+    xmlns:html="http://www.w3.org/1999/xhtml"                
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"                
+    xmlns:tei="http://www.tei-c.org/ns/1.0"
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    exclude-result-prefixes="tei html xs"
+    version="2.0">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>     <p>
+    TEI stylesheet customization module for HTML output.</p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: tei-param.xsl 10057 2012-01-21 16:57:14Z rahtz $</p>
+         <p>Copyright: 2011, TEI Consortium</p>
+      </desc>
+   </doc>
+  <xsl:key name="INDEX" use="1" match="tei:index"/>
+  <xsl:key name="PB" match="tei:pb" use="1"/>
+  <xsl:key name="NOTES" use="1"
+	   match="tei:note[@place='foot' or @place='bottom' or @place='end'
+		  and not(parent::tei:bibl or ancestor::tei:teiHeader)]"/>
+  <xsl:key name="ALLNOTES" use="1"
+	   match="tei:note[not(@place='margin' or @place='inline' or @place='display')
+		  and not(parent::tei:bibl or  ancestor::tei:teiHeader)]"/>
+
+  <xsl:key name="TAGREND" match="tei:tagUsage[@render]" use="@gi"/>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="CSS" type="string">
+    <desc>  CSS class for links derived from &lt;ptr&gt;    </desc>
+  </doc>
+  <xsl:param name="class_ptr">ptr</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="CSS" type="string">
+      <desc>CSS class for links derived from &lt;ref&gt;</desc>
+
+   </doc>
+  <xsl:param name="class_ref">ref</xsl:param>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="boolean">
+      <desc>Whether we should construct a separate file for each page
+      (based on page breaks)</desc>
+   </doc>
+  <xsl:param name="filePerPage">false</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="number">
+      <desc>When making fixed format epub, width of viewport</desc>
+  </doc>
+  <xsl:param name="viewPortWidth">1200</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="number">
+      <desc>When making fixed format epub, height of viewport</desc>
+  </doc>
+  <xsl:param name="viewPortHeight">1700</xsl:param>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="boolean">
+      <desc>Number footnotes consecutively</desc>
+   </doc>
+  <xsl:param name="consecutiveFNs">false</xsl:param>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="boolean">
+      <desc>Link back from footnotes to reference</desc>
+
+   </doc>
+  <xsl:param name="footnoteBackLink">false</xsl:param>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="cssFileInclude"
+        type="boolean">
+      <desc>Whether to include CSS by reference or by XInclusion</desc>
+
+   </doc>
+  <xsl:param name="cssFileInclude">false</xsl:param>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="CSS" type="anyURI">
+      <desc>CSS style file to be associated with output file(s)</desc>
+
+   </doc>
+  <xsl:param name="cssFile" as="xs:string">http://www.tei-c.org/release/xml/tei/stylesheet/tei.css</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="CSS" type="anyURI">
+      <desc>CSS style file for print; this will be given a media=print attribute.
+    </desc>
+   </doc>
+  <xsl:param name="cssPrintFile" as="xs:string">http://www.tei-c.org/release/xml/tei/stylesheet/tei-print.css</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="CSS" type="anyURI">
+      <desc>Secondary CSS style file; this will be given a media=screen attribute,
+so that it does not affect printing. It should be used for screen layout.
+  </desc>
+   </doc>
+    <xsl:param name="cssSecondaryFile"  as="xs:string" select="''"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="CSS" type="anyURI">
+      <desc>CSS file to include in the output file directly</desc>
+   </doc>
+    <xsl:param name="cssInlineFile"  as="xs:string" select="''"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="figures" type="integer">
+      <desc>Resolution of images. This is needed to calculate
+HTML width and height (in pixels) from supplied dimensions.</desc>
+
+   </doc>
+  <xsl:param name="dpi">96</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="figures" type="boolean">
+      <desc>Display figures.</desc>
+
+   </doc>
+  <xsl:param name="showFigures">true</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="hook">
+      <desc>[html] Hook where HTML can be inserted just after &lt;body&gt;</desc>
+   </doc>
+  <xsl:template name="bodyHook"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="hook">
+      <desc>     <p>[html] Hook where HTML can be inserted just before the
+    &lt;body&gt; ends.</p>
+         <p>This can be used to add a page-wide footer block.</p>
+      </desc>
+   </doc>
+  <xsl:template name="bodyEndHook"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="hook">
+      <desc>[html] Hook where Javascript calls can be inserted  just after &lt;body&gt;</desc>
+   </doc>
+  <xsl:template name="bodyJavascriptHook"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="hook">
+      <desc>     <p>[html] Hook where extra CSS can be inserted</p>
+         <p>&#160; </p>
+      </desc>
+   </doc>
+  <xsl:template name="cssHook"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="hook">
+      <desc>     <p>[html] Hook where code can be added to the HTML &lt;head&gt;.</p>
+         <p>This would be used to insert &lt;meta&gt; tags.</p>
+      </desc>
+   </doc>
+  <xsl:template name="headHook"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="hook">
+      <desc>[html] Hook where HTML can be inserted when creating an &lt;img&gt;</desc>
+   </doc>
+  <xsl:template name="imgHook"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="hook">
+      <desc>[html] Hook where HTML can be inserted when processing a
+    figure</desc>
+   </doc>
+  <xsl:template name="figureHook"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="hook">
+      <desc>[html] Hook where extra Javascript functions can be defined</desc>
+   </doc>
+  <xsl:template name="javascriptHook"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="hook">
+      <desc>[html] Hook where HTML can be inserted just before the &lt;address&gt;</desc>
+   </doc>
+  <xsl:template name="preAddressHook"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="hook">
+      <desc>[html] Hook where HTML can be inserted at the start of
+    processing each section</desc>
+   </doc>
+  <xsl:template name="startDivHook"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="hook">
+      <desc>[html] Hook where HTML can be inserted at the beginning
+    of the main text, after the header</desc>
+   </doc>
+  <xsl:template name="startHook"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="hook">
+      <desc>[html] Hook where HTML can be inserted after processing &lt;TEI&gt;</desc>
+   </doc>
+  <xsl:template name="teiEndHook"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="hook">
+      <desc>[html] Hook where HTML can be inserted before processing &lt;TEI&gt;</desc>
+   </doc>
+  <xsl:template name="teiStartHook"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="hook">
+      <desc>[html] Hook where HTML can be inserted when creating an
+    &lt;a&gt; element</desc>
+   </doc>
+  <xsl:template name="xrefHook"/>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="i18n">
+      <desc>[html] Make a copyright claim</desc>
+   </doc>
+  <xsl:template name="copyrightStatement">This page is copyrighted</xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout">
+      <desc>[html] Banner for top of column</desc>
+   </doc>
+  <xsl:template name="columnHeader">
+</xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="string">
+      <desc>     <p>How to use the front/body/back matter in creating
+columns.</p>
+         <p>
+	   The choice is between
+	   <ul xmlns="http://www.w3.org/1999/xhtml">
+	     <li>
+	       <b>all</b>: use &lt;front&gt; for left-hand column,
+	       use &lt;body&gt; for centre column, and use &lt;back&gt; for
+	     right-hand column</li>
+	     <li>
+	       <b>body</b>: use &lt;body&gt; for right-hand column,
+	     generate left-hand with a TOC or whatever</li>
+	   </ul>
+         </p>
+      </desc>
+  </doc>
+  <xsl:param name="contentStructure">body</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="integer">
+      <desc>     <p>The difference between TEI div levels and HTML.
+headings.</p>
+         <p>TEI &lt;div&gt;s are implicitly or explicitly numbered from 0
+upwards; this offset is added to that number to produce an HTML
+&lt;Hn&gt; element. So a value of 2 here means that a &lt;div1&gt;
+will generate an &lt;h2&gt;</p>
+      </desc>
+   </doc>
+  <xsl:param name="divOffset">2</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="boolean">
+      <desc>Make a separate file for footnotes</desc>
+
+   </doc>
+  <xsl:param name="footnoteFile">false</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout">
+      <desc>[html] Header section across top of page </desc>
+   </doc>
+  <xsl:template name="hdr">
+      <xsl:call-template name="pageHeader">
+         <xsl:with-param name="mode"/>
+      </xsl:call-template>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout">
+      <desc>[html] Navigation bar </desc>
+   </doc>
+  <xsl:template name="hdr2">
+      <xsl:call-template name="navbar"/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout">
+      <desc>[html] Text or action to take at the start of the
+    breadcrumb trail </desc>
+   </doc>
+  <xsl:template name="preBreadCrumbPath"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout">
+      <desc>[html] Breadcrumb trail </desc>
+   </doc>
+  <xsl:template name="hdr3">
+      <a href="#rh-col" title="Go to main page content" class="skiplinks">Skip links</a>
+      <a class="hide">|</a>
+      <xsl:call-template name="crumbPath"/>
+      <a class="hide">|</a>
+      <a class="bannerright" href="{$parentURL}" title="Go to home page">
+         <xsl:value-of select="$parentWords"/>
+      </a>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout">
+      <desc>[html]Bottom of left-hand column<param name="currentID">ID of selected section</param>
+      </desc>
+   </doc>
+  <xsl:template name="lh-col-bottom">
+      <xsl:param name="currentID"/>
+      <xsl:call-template name="leftHandFrame">
+         <xsl:with-param name="currentID" select="$currentID"/>
+      </xsl:call-template>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout">
+      <desc>[html]Top of left-hand column </desc>
+   </doc>
+  <xsl:template name="lh-col-top">
+      <xsl:call-template name="searchbox"/>
+      <xsl:call-template name="printLink"/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="string">
+      <desc>Width of left-hand column when $pageLayout is "Table"</desc>
+
+   </doc>
+  <xsl:param name="linksWidth">15%</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout">
+      <desc>[html] Logo</desc>
+   </doc>
+  <xsl:template name="logoPicture">
+      <a class="framelogo" href="http://www.tei-c.org/Stylesheets/">
+         <img src="http://www.tei-c.org/release/common2/doc/tei-xsl-common/teixsl.png" vspace="5" width="124"
+              height="161"
+              border="0"
+              alt="created by TEI XSL Stylesheets"/>
+      </a>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout">
+      <desc>[html] Making elements in HTML &lt;head&gt;<param name="title">The text used to create the DC.Title field
+    in the HTML header</param>
+      </desc>
+   </doc>
+  <xsl:template name="metaHTML">
+      <xsl:param name="title"/>
+      <meta name="author">
+         <xsl:attribute name="content">
+            <xsl:call-template name="generateAuthor"/>
+         </xsl:attribute>
+      </meta>
+      <xsl:if test="$filePerPage='true'">
+	<meta name="viewport" content="width={$viewPortWidth}, height={$viewPortHeight}"/>
+      </xsl:if>
+      <meta name="generator" content="Text Encoding Initiative Consortium XSLT stylesheets"/>
+      <xsl:choose>
+	<xsl:when test="$outputTarget='html5' or $outputTarget='epub3'">
+	  <meta charset="utf-8" />
+	</xsl:when>
+	<xsl:otherwise>
+	  <meta http-equiv="Content-Type" content="text/html; charset={$outputEncoding}"/>
+	  <meta name="DC.Title">
+	    <xsl:attribute name="content">
+	      <xsl:value-of select="normalize-space(translate($title,'&lt;&gt;','&#x2329;&#x3009;'))"/>
+	    </xsl:attribute>
+	  </meta>
+	  <meta name="DC.Type" content="Text"/>
+	  <meta name="DC.Format" content="text/html"/>
+	</xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+	<doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout">
+      <desc>     <p>[html] Construction of navigation bar </p>
+         <p>A file is looked for relative to the <i xmlns="http://www.w3.org/1999/xhtml">stylesheet</i> (the
+    second parameter of the document function), which is expected to
+    contain a TEI &lt;list&gt; where each &lt;item&gt; has an embedded
+    &lt;xref&gt;</p>
+      </desc>
+   </doc>
+  <xsl:template name="navbar">
+    <xsl:choose>
+      <xsl:when test="$navbarFile=''">
+	<xsl:comment>no nav bar</xsl:comment>
+      </xsl:when>
+      <xsl:otherwise>
+	<xsl:element name="{if ($outputTarget='html5') then 'nav' else 'div'}">
+	  <xsl:for-each select="document($navbarFile,document(''))">
+	    <xsl:for-each select="tei:list/tei:item">
+	      <span class="navbar">
+		<a href="{$URLPREFIX}{tei:xref/@url}" class="navbar">
+		  <xsl:apply-templates select="tei:xref/text()"/>
+		</a>
+	      </span>
+	      <xsl:if test="following-sibling::tei:item"> | </xsl:if>
+	    </xsl:for-each>
+	  </xsl:for-each>
+	</xsl:element>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="anyURI">
+      <desc>     <p>XML resource defining a navigation bar.</p>
+         <p>The XML should provide a &lt;list&gt; containing a series
+of &lt;item&gt; elements, each containing an &lt;xref&gt; link.</p>
+      </desc>
+   </doc>
+  <xsl:param name="navbarFile"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout">
+      <desc>[html] Banner for top of page<param name="mode">layout mode</param>
+      </desc>
+   </doc>
+  <xsl:template name="pageHeader">
+      <xsl:param name="mode"/>
+      <xsl:choose>
+         <xsl:when test="$mode='table'">
+            <table width="100%" border="0">
+               <tr>
+                  <td height="98" class="bgimage" onclick="window.location='{$homeURL}'"
+                      cellpadding="0">
+
+	                    <xsl:call-template name="makeHTMLHeading">
+		                      <xsl:with-param name="class">subtitle</xsl:with-param>
+		                      <xsl:with-param name="text">
+		                         <xsl:call-template name="generateSubTitle"/>
+		                      </xsl:with-param>
+		                      <xsl:with-param name="level">2</xsl:with-param>
+	                    </xsl:call-template>
+
+	                    <xsl:call-template name="makeHTMLHeading">
+		                      <xsl:with-param name="class">title</xsl:with-param>
+		                      <xsl:with-param name="text">
+		                         <xsl:call-template name="generateTitle"/>
+		                      </xsl:with-param>
+		                      <xsl:with-param name="level">1</xsl:with-param>
+	                    </xsl:call-template>
+
+                  </td>
+                  <td style="vertical-align:top;"/>
+               </tr>
+            </table>
+         </xsl:when>
+         <xsl:otherwise>
+	           <xsl:call-template name="makeHTMLHeading">
+	              <xsl:with-param name="class">subtitle</xsl:with-param>
+	              <xsl:with-param name="text">
+	                 <xsl:call-template name="generateSubTitle"/>
+	              </xsl:with-param>
+	              <xsl:with-param name="level">2</xsl:with-param>
+	           </xsl:call-template>
+	
+	           <xsl:call-template name="makeHTMLHeading">
+	              <xsl:with-param name="class">title</xsl:with-param>
+	              <xsl:with-param name="text">
+	                 <xsl:call-template name="generateTitle"/>
+	              </xsl:with-param>
+	              <xsl:with-param name="level">1</xsl:with-param>
+	           </xsl:call-template>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[html] Make a heading, if there some text to display<param name="text">Heading title</param>
+         <param name="class">CSS class</param>
+         <param name="level">Heading level</param>
+      </desc>
+   </doc>
+  <xsl:template name="makeHTMLHeading">
+      <xsl:param name="text"/>
+      <xsl:param name="class">title</xsl:param>
+      <xsl:param name="level">1</xsl:param>
+      <xsl:if test="not($text='')">
+	<xsl:choose>
+	<xsl:when test="$level &gt; 6">
+	  <div class="h{$level}">
+            <xsl:copy-of select="$text"/>
+	  </div>
+	</xsl:when>
+	<xsl:otherwise>
+         <xsl:element name="h{$level}">
+	   <xsl:attribute name="class">
+	     <xsl:value-of select="$class"/>
+	   </xsl:attribute>
+	   <xsl:copy-of select="$text"/>
+         </xsl:element>
+	</xsl:otherwise>
+	</xsl:choose>
+      </xsl:if>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[html] Make a link saying how to get printable version
+    of file</desc>
+   </doc>
+  <xsl:template name="printLink"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout">
+      <desc>[html] Bottom of right-hand column<param name="currentID">ID of selected section</param>
+      </desc>
+   </doc>
+  <xsl:template name="rh-col-bottom">
+      <xsl:param name="currentID"/>
+      <xsl:call-template name="mainFrame">
+         <xsl:with-param name="currentID" select="$currentID"/>
+      </xsl:call-template>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout">
+      <desc>[html] Top of right-hand column</desc>
+   </doc>
+  <xsl:template name="rh-col-top">
+      <xsl:call-template name="columnHeader"/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout">
+      <desc>[html] Make a search box</desc>
+   </doc>
+  <xsl:template name="searchbox"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout">
+      <desc>[html] Construct a label for the link which makes a
+    printable version of the document.</desc>
+   </doc>
+  <xsl:template name="singleFileLabel">For Printing</xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="links" type="string">
+      <desc>How to align the navigation panel at the bottom of the page</desc>
+
+   </doc>
+  <xsl:param name="alignNavigationPanel">right</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="links" type="boolean">
+      <desc>Display navigation panel at bottom of pages</desc>
+
+   </doc>
+  <xsl:param name="bottomNavigationPanel">true</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="links" type="anyURI">
+      <desc>Link for feedback</desc>
+
+   </doc>
+  <xsl:param name="feedbackURL">mailto:feedback</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="links" type="string">
+      <desc>Fixed string to insert before normal page title in HTML meta
+&lt;title&gt; element</desc>
+
+   </doc>
+  <xsl:param name="htmlTitlePrefix"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="links" type="boolean">
+      <desc>Make a panel with next page/previous page links.</desc>
+
+   </doc>
+  <xsl:param name="linkPanel">true</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="misc" type="boolean">
+      <desc>Generate a unique ID for all paragraphs</desc>
+
+   </doc>
+  <xsl:param name="generateParagraphIDs">false</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="misc" type="string">
+      <desc>     <p>Character separating values in a rend attribute.</p>
+         <p>Some projects use multiple values in <tt
+         xmlns="http://www.w3.org/1999/xhtml">rend</tt>
+         attributes. These are handled, but the separator character(s)
+         must be specified.</p>
+      </desc>
+   </doc>
+  <xsl:param name="rendSeparator">; </xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="misc" type="boolean">
+      <desc>Show a title and author at start of document</desc>
+
+   </doc>
+  <xsl:param name="showTitleAuthor">false</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="misc" type="boolean">
+      <desc>Be talkative while working.</desc>
+
+   </doc>
+
+  <xsl:param name="verbose">false</xsl:param>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="layout" type="boolean">
+      <desc>Make all notes into endnotes
+  </desc>
+   </doc>
+  <xsl:param name="autoEndNotes">false</xsl:param>
+
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="output" type="string">
+      <desc>An ID passed to the stylesheet to indicate which section to display</desc>
+
+   </doc>
+  <xsl:param name="ID"/>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="output" type="string">
+      <desc>A wrapper around the ID, to allow for other ways of getting it</desc>
+
+   </doc>
+  <xsl:param name="requestedID">
+      <xsl:value-of select="$ID"/>
+  </xsl:param>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="output" type="string">
+      <desc>A path fragment to put before all internal URLs </desc>
+
+   </doc>
+  <xsl:param name="URLPREFIX"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="output" type="string">
+      <desc>The name of the output file</desc>
+
+   </doc>
+  <xsl:param name="outputName"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="output" type="string">
+      <desc>Directory in which to place generated files.</desc>
+
+   </doc>
+  <xsl:param name="outputDir"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="output" type="string">
+      <desc>Encoding of output file(s).</desc>
+
+   </doc>
+  <xsl:param name="outputEncoding">utf-8</xsl:param>
+
+  <xsl:param name="outputNamespace">http://www.w3.org/1999/xhtml</xsl:param>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="output" type="string">
+      <desc>Output method for output file(s).</desc>
+   </doc>
+  <xsl:param name="outputMethod">xhtml</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="output" type="string">
+      <desc>Suffix of output file(s).</desc>
+
+   </doc>
+  <xsl:param name="outputSuffix">.html</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="output" type="string">
+      <desc>Public Doctype of output file(s).</desc>
+
+   </doc>
+
+  <xsl:param name="doctypePublic">-//W3C//DTD XHTML 1.0 Transitional//EN</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="output" type="string">
+      <desc>System Doctype of output file(s).</desc>
+
+   </doc>
+  <xsl:param name="doctypeSystem">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="output" type="string">
+      <desc>     <p>The style of HTML (Simple, CSS or Table) which creates the layout for generated pages.</p>
+         <p>The choice is between
+<ul xmlns="http://www.w3.org/1999/xhtml">
+               <li>
+                  <b>Simple</b>: A linear presentation is created</li>
+               <li>
+                  <b>CSS</b>: The page is created as a series of nested
+ &lt;div&gt;s which can be arranged using CSS into a multicolumn
+layout</li>
+               <li>
+                  <b>Table</b>: The page is created as an HTML table</li>
+            </ul>
+         </p>
+      </desc>
+   </doc>
+  <xsl:param name="pageLayout">Simple</xsl:param>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="output" type="boolean">
+      <desc>Break back matter into separate HTML pages (if splitting enabled).</desc>
+
+   </doc>
+  <xsl:param name="splitBackmatter">true</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="output" type="boolean">
+      <desc>Break front matter into separate HTML pages (if splitting enabled).</desc>
+
+   </doc>
+  <xsl:param name="splitFrontmatter">true</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="output" type="integer">
+      <desc>     <p>Level at which to split sections.</p>
+         <p>When processing a &lt;div&gt; or &lt;div[0-5]&gt;, compare
+the nesting depth and see whether to start a new HTML page. Since the
+TEI starts with &lt;div1&gt;, setting this parameter to 0 will cause
+top-level sections to be split apart. The default is not to split at
+all.
+</p>
+      </desc>
+   </doc>
+  <xsl:param name="splitLevel">-1</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="output" type="string">
+      <desc>Suffix for generated output files.</desc>
+
+   </doc>
+  <xsl:param name="standardSuffix">
+      <xsl:choose>
+         <xsl:when test="tei:teiCorpus">.html</xsl:when>
+         <xsl:when test="$STDOUT='true'"/>
+         <xsl:otherwise>
+	           <xsl:value-of select="$outputSuffix"/>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="output" type="boolean">
+      <desc>Display navigation panel at top of pages.</desc>
+
+   </doc>
+  <xsl:param name="topNavigationPanel">true</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="output" type="string">
+      <desc>How to specify infra-document links. When a document is split,
+links need to be constructed between parts of the document. 
+The default is to use a query parameter on the URL.</desc>
+
+   </doc>
+  <xsl:param name="urlChunkPrefix">?ID=</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="output" type="boolean">
+      <desc>     <p>Construct links using existing ID values.</p>
+         <p>It is often nice if, when making separate files, their names
+correspond to the ID attribute of the &gt;div&lt;. Alternatively, you
+	  can let the system choose names.</p>
+      </desc>
+   </doc>
+  <xsl:param name="useIDs">true</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="style" type="string">
+      <desc>HTML element to put around visible text of display URLs</desc>
+
+   </doc>
+  <xsl:param name="urlMarkup">span</xsl:param>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="toc" type="boolean">
+      <desc>Make an automatic table of contents</desc>
+
+   </doc>
+  <xsl:param name="autoToc">true</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="toc" type="string">
+      <desc>CSS class for second-level TOC entries</desc>
+
+   </doc>
+  <xsl:param name="class_subtoc">subtoc</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="toc" type="integer">
+      <desc>
+	<p>Depth at which to stop doing a recursive table of contents.</p>
+         <p>You can have a mini table of contents at the start of each
+         section. The default is only to construct a TOC at the top
+         level; a value of -1 here means no subtoc at all. </p>
+      </desc>
+   </doc>
+  <xsl:param name="subTocDepth">-1</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="toc" type="boolean">
+      <desc>Include the back matter in the table of contents.</desc>
+
+   </doc>
+  <xsl:param name="tocBack">true</xsl:param>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="toc" type="string">
+      <desc>Depth to which table of contents is constructed.</desc>
+
+   </doc>
+  <xsl:param name="tocDepth">5</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="toc" type="boolean">
+      <desc>Include the front matter in the table of contents.</desc>
+
+   </doc>
+  <xsl:param name="tocFront">true</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="toc" type="string">
+      <desc>Which HTML element to wrap each TOCs entry in.</desc>
+
+   </doc>
+  <xsl:param name="tocElement">p</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="toc" type="string">
+      <desc>Which HTML element to wrap each TOC sections in.</desc>
+
+   </doc>
+  <xsl:param name="tocContainerElement">div</xsl:param>
+
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="toc" type="string">
+      <desc>Text to link back to from foot of ODD reference pages
+  </desc>
+   </doc>
+   <xsl:param name="refDocFooterText">TEI Guidelines</xsl:param>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="toc" type="anyURI">
+      <desc>URL to link back to from foot of ODD reference pages
+  </desc>
+   </doc>
+   <xsl:param name="refDocFooterURL">index.html</xsl:param>
+
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="toc" type="anyURI">
+      <desc>Gap between elements in navigation list
+  </desc></doc>
+   <xsl:template name="navInterSep">
+      <xsl:text>: </xsl:text>
+   </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="output" type="boolean">
+      <desc>Whether it should be attempted to make quotes into block
+      quotes if they are over a certain length</desc></doc>
+  <xsl:param name="autoBlockQuote">false</xsl:param>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="output" type="integer">
+      <desc>Length beyond which a quote is a block quote</desc></doc>
+  <xsl:param name="autoBlockQuoteLength">150</xsl:param>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" class="hook">
+      <desc>[html] Hooks where HTML can be inserted when processing
+    &lt;egXML&gt; element</desc>
+   </doc>
+   <xsl:template name="egXMLStartHook"/>
+   <xsl:template name="egXMLEndHook"/>
+
+   <xsl:template name="emphasize">
+      <xsl:param name="class"/>
+      <xsl:param name="content"/>
+      <xsl:choose>
+         <xsl:when test="$class='titlea'">
+            <q class="titlea">
+	              <xsl:copy-of select="$content"/>
+            </q>
+         </xsl:when>
+         <xsl:otherwise>
+            <span class="{$class}">
+	              <xsl:copy-of select="$content"/>
+            </span>
+         </xsl:otherwise>
+      </xsl:choose>
+   </xsl:template>
+
+  <xsl:param name="mediaoverlay">false</xsl:param>
+
+
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/tei-param.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/tei.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/tei.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/tei.xsl	(revision 258)
@@ -0,0 +1,147 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml"                  
+                xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
+		xmlns:teidocx="http://www.tei-c.org/ns/teidocx/1.0"
+                xmlns:fo="http://www.w3.org/1999/XSL/Format"
+                xmlns:rng="http://relaxng.org/ns/structure/1.0"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"
+                xmlns:html="http://www.w3.org/1999/xhtml"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                exclude-result-prefixes="html a fo rng tei teix teidocx"
+                version="2.0">
+  <xsl:import href="../common2/tei.xsl"/>
+  <xsl:import href="tei-param.xsl"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p>
+    TEI stylesheet for making HTML output.
+      </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: tei.xsl 9669 2011-11-07 19:17:54Z rahtz $</p>
+         <p>Copyright: 2011, TEI Consortium</p>
+      </desc>
+   </doc>
+  <xsl:include href="core.xsl"/>
+  <xsl:include href="corpus.xsl"/>
+  <xsl:include href="dictionaries.xsl"/>
+  <xsl:include href="drama.xsl"/>
+  <xsl:include href="figures.xsl"/>
+  <xsl:include href="header.xsl"/>
+  <xsl:include href="linking.xsl"/>
+  <xsl:include href="namesdates.xsl"/>
+  <xsl:include href="tagdocs.xsl"/>
+  <xsl:include href="textstructure.xsl"/>
+  <xsl:include href="textcrit.xsl"/>
+  <xsl:include href="transcr.xsl"/>
+  <xsl:include href="verse.xsl"/>
+  <xsl:include href="../common2/verbatim.xsl"/>
+
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" type="string">
+      <desc>
+Stylesheet constant setting the name of the main output file.
+</desc>
+   </doc>
+  <xsl:variable name="top" select="/"/>
+  <xsl:variable name="masterFile">
+      <xsl:choose>
+         <xsl:when test="not($outputName ='')">
+            <xsl:choose>
+               <xsl:when test="$STDOUT='true'">
+                  <xsl:value-of select="$outputName"/>
+               </xsl:when>
+               <xsl:when test="contains($outputName,'.xml')">
+                  <xsl:value-of select="substring-before($outputName,'.xml')"/>
+               </xsl:when>
+               <xsl:otherwise>
+                  <xsl:value-of select="$outputName"/>
+               </xsl:otherwise>
+            </xsl:choose>
+         </xsl:when>
+         <xsl:when test="contains($REQUEST,'.ID=')">
+            <xsl:call-template name="get-basename">
+               <xsl:with-param name="file">
+                  <xsl:value-of select="substring-before($REQUEST,'.ID=')"/>
+               </xsl:with-param>
+            </xsl:call-template>
+         </xsl:when>
+         <xsl:when test="not($REQUEST='')">
+            <xsl:call-template name="get-basename">
+               <xsl:with-param name="file">
+                  <xsl:value-of select="$REQUEST"/>
+               </xsl:with-param>
+            </xsl:call-template>
+         </xsl:when>
+         <xsl:when test="$STDOUT='true'">
+            <xsl:text>index.xml</xsl:text>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:text>index</xsl:text>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:variable>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[html] How to work out the filename component of a path<param name="file">filename</param>
+      </desc>
+   </doc>
+  <xsl:template name="get-basename">
+      <xsl:param name="file"/>
+      <xsl:choose>
+         <xsl:when test="contains($file,'/')">
+            <xsl:call-template name="get-basename">
+               <xsl:with-param name="file">
+                  <xsl:value-of select="substring-after($file,'/')"/>
+               </xsl:with-param>
+            </xsl:call-template>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:choose>
+               <xsl:when test="$STDOUT='true'">
+                  <xsl:value-of select="$file"/>
+               </xsl:when>
+               <xsl:when test="contains($file,'.xml')">
+                  <xsl:value-of select="substring-before($file,'.xml')"/>
+               </xsl:when>
+               <xsl:otherwise>
+                  <xsl:value-of select="$file"/>
+               </xsl:otherwise>
+            </xsl:choose>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="bodyMicroData"/>
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/tei.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/verse.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/verse.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/verse.xsl	(revision 258)
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml" 
+                
+                xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
+                xmlns:fo="http://www.w3.org/1999/XSL/Format"
+
+                xmlns:rng="http://relaxng.org/ns/structure/1.0"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"
+                xmlns:html="http://www.w3.org/1999/xhtml"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                exclude-result-prefixes="a fo rng tei teix"
+                version="2.0">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p>
+    TEI stylesheet
+    dealing  with elements from the
+      verse module, making HTML output.
+      </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: verse.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2011, TEI Consortium</p>
+      </desc>
+   </doc>
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/verse.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/drama.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/drama.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/drama.xsl	(revision 258)
@@ -0,0 +1,275 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml" 
+                xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
+                xmlns:fo="http://www.w3.org/1999/XSL/Format"
+                xmlns:html="http://www.w3.org/1999/xhtml"
+                xmlns:rng="http://relaxng.org/ns/structure/1.0"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"                
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                exclude-result-prefixes=" a fo rng tei teix html"
+                version="2.0">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet dealing with elements from the drama module,
+      making HTML output. </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: drama.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2011, TEI Consortium</p>
+      </desc>
+   </doc>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element actor</desc>
+   </doc>
+  <xsl:template match="tei:actor">
+      <span class="actor">
+         <xsl:apply-templates/>
+      </span>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element camera</desc>
+   </doc>
+  <xsl:template match="tei:camera">
+      <span class="camera">
+         <xsl:apply-templates/>
+      </span>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element caption</desc>
+   </doc>
+  <xsl:template match="tei:caption">
+      <span class="caption">
+         <xsl:apply-templates/>
+      </span>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element castGroup</desc>
+   </doc>
+  <xsl:template match="tei:castGroup">
+      <ul>
+         <xsl:apply-templates/>
+      </ul>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element castItem</desc>
+   </doc>
+  <xsl:template match="tei:castItem">
+      <li>
+         <xsl:apply-templates/>
+      </li>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element castList</desc>
+   </doc>
+  <xsl:template match="tei:castList">
+      <xsl:if test="tei:head">
+         <p>
+            <em>
+               <xsl:for-each select="tei:head">
+                  <xsl:apply-templates/>
+               </xsl:for-each>
+            </em>
+         </p>
+      </xsl:if>
+      <ul>
+         <xsl:apply-templates/>
+      </ul>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element castList/tei:head</desc>
+   </doc>
+  <xsl:template match="tei:castList/tei:head"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element role</desc>
+   </doc>
+  <xsl:template match="tei:role">
+      <span class="role">
+         <xsl:apply-templates/>
+      </span>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element roleDesc</desc>
+   </doc>
+  <xsl:template match="tei:roleDesc">
+      <blockquote>
+	        <xsl:choose>
+	           <xsl:when test="@rend">
+	              <xsl:attribute name="class">
+		                <xsl:value-of select="@rend"/>
+	              </xsl:attribute>
+	           </xsl:when>
+	           <xsl:when test="@rendition">
+		             <xsl:call-template name="applyRendition"/>
+	           </xsl:when>
+	           <xsl:otherwise>
+	              <xsl:attribute name="class">
+		                <xsl:text>roleDesc</xsl:text>
+	              </xsl:attribute>
+	           </xsl:otherwise>
+	        </xsl:choose>
+         <xsl:choose>
+            <xsl:when test="tei:p">
+               <xsl:apply-templates/>
+            </xsl:when>
+            <xsl:otherwise>
+               <p>
+                  <xsl:apply-templates/>
+               </p>
+            </xsl:otherwise>
+         </xsl:choose>
+      </blockquote>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element set</desc>
+   </doc>
+  <xsl:template match="tei:set">
+      <span class="set">
+         <xsl:apply-templates/>
+      </span>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element sound</desc>
+   </doc>
+  <xsl:template match="tei:sound">
+      <span class="sound">
+         <xsl:apply-templates/>
+      </span>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+         <p>Process element sp</p>
+         <p>
+            <p xmlns="http://www.w3.org/1999/xhtml"> elaborated by Nick Nicholas &lt;nicholas@uci.edu&gt;, March
+        2001 </p>
+         </p>
+      </desc>
+   </doc>
+  <xsl:template match="tei:sp">
+    <div class="speaker">
+      <xsl:call-template name="makeAnchor"/>
+      <xsl:apply-templates select="tei:speaker"/>
+    </div>
+    <xsl:apply-templates select="tei:*[not(self::tei:speaker)]"/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element sp/tei:p</desc>
+   </doc>
+  <xsl:template match="tei:sp/tei:p">
+    <xsl:choose>
+      <xsl:when test="$filePerPage='true'">
+	<xsl:for-each-group select="node()" group-starting-with="tei:pb">
+	  <xsl:choose>
+	    <xsl:when test="self::tei:pb">
+	      <xsl:apply-templates select="."/>
+	      <div>
+		<xsl:for-each select="..">
+		  <xsl:call-template name="rendToClass">      
+		    <xsl:with-param name="default">p-in-sp</xsl:with-param>
+		    <xsl:with-param name="id">
+		      <xsl:choose>
+			<xsl:when test="@xml:id">
+			  <xsl:value-of select="@xml:id"/>
+			  <xsl:text>continued</xsl:text>
+			</xsl:when>
+			<xsl:otherwise>
+			  <xsl:text>false</xsl:text>
+			</xsl:otherwise>
+		      </xsl:choose>
+		    </xsl:with-param>
+		  </xsl:call-template>
+		</xsl:for-each>
+		<xsl:apply-templates select="current-group() except ."/>
+	      </div>
+	    </xsl:when>
+	    <xsl:otherwise>
+	      <div>
+		<xsl:for-each select="..">
+		  <xsl:call-template name="rendToClass">      
+		    <xsl:with-param name="default">p-in-sp</xsl:with-param>
+		  </xsl:call-template>
+		</xsl:for-each>
+		<xsl:apply-templates select="current-group()"/>
+	      </div>
+	    </xsl:otherwise>
+	  </xsl:choose>
+	</xsl:for-each-group>
+      </xsl:when>
+      <xsl:otherwise>
+	<div>
+	  <xsl:call-template name="rendToClass">      
+	    <xsl:with-param name="default">p-in-sp</xsl:with-param>
+	  </xsl:call-template>
+	  <xsl:apply-templates/>
+	</div>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element stage</desc>
+   </doc>
+  <xsl:template match="tei:stage">
+    <xsl:element name="{if (tei:blockContext(.) or *[not(tei:is-inline(.))]) then 'div' else 'span' }">
+      <xsl:call-template name="rendToClass">
+	<xsl:with-param name="default">
+	  <xsl:choose>
+	    <xsl:when
+		test="ancestor::tei:text/@rend='firstfolio'">stage</xsl:when>
+	    <xsl:otherwise>stage it</xsl:otherwise>
+	  </xsl:choose>
+	</xsl:with-param>
+      </xsl:call-template>
+      <xsl:apply-templates/>
+    </xsl:element>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element tech</desc>
+   </doc>
+  <xsl:template match="tei:tech">
+      <span class="tech">
+         <xsl:apply-templates/>
+      </span>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element view</desc>
+   </doc>
+  <xsl:template match="tei:view">
+      <span class="view">
+         <xsl:apply-templates/>
+      </span>
+  </xsl:template>
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/drama.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/namesdates.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/namesdates.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/namesdates.xsl	(revision 258)
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml" 
+                xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
+                xmlns:fo="http://www.w3.org/1999/XSL/Format"
+                xmlns:html="http://www.w3.org/1999/xhtml"
+
+                xmlns:rng="http://relaxng.org/ns/structure/1.0"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"
+                
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                exclude-result-prefixes="a fo rng tei teix"
+                version="2.0">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet dealing with elements from the namesdates module,
+      making HTML output. </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: namesdates.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2011, TEI Consortium</p>
+      </desc>
+   </doc>
+
+  <xsl:template match="tei:listPerson">
+      <ul>
+         <xsl:apply-templates/>
+      </ul>
+  </xsl:template>
+
+  <xsl:template match="tei:person">
+      <li>
+         <xsl:apply-templates/>
+      </li>
+  </xsl:template>
+
+  <xsl:template match="tei:affiliation">
+      <br/>
+      <xsl:apply-templates/>
+  </xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/namesdates.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/tagdocs.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/tagdocs.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/tagdocs.xsl	(revision 258)
@@ -0,0 +1,122 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet  xmlns:s="http://www.ascc.net/xml/schematron" xmlns="http://www.w3.org/1999/xhtml" xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:rng="http://relaxng.org/ns/structure/1.0" xmlns:tei="http://www.tei-c.org/ns/1.0" xmlns:teix="http://www.tei-c.org/ns/Examples" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="s html a fo rng tei teix" version="2.0">
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+    <desc>
+      <p> TEI stylesheet dealing with elements from the tagdocs module,
+      making HTML output. </p>
+      <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+      <p>Author: See AUTHORS</p>
+      <p>Id: $Id: tagdocs.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+      <p>Copyright: 2011, TEI Consortium</p>
+    </desc>
+  </doc>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process elements teix:egXML</desc>
+  </doc>
+  <xsl:template match="teix:egXML">
+    <xsl:param name="simple">false</xsl:param>
+    <xsl:param name="highlight"/>
+    <div>
+      <xsl:attribute name="id">
+        <xsl:apply-templates mode="ident" select="."/>
+      </xsl:attribute>
+      <xsl:attribute name="class">
+	<xsl:text>pre</xsl:text>
+	<xsl:if test="not(*)">
+	  <xsl:text> cdata</xsl:text>
+	</xsl:if>
+	<xsl:choose>
+	  <xsl:when test="@valid='feasible'">
+	    <xsl:text> egXML_feasible</xsl:text>
+	  </xsl:when>
+	  <xsl:when test="@valid='false'">
+	    <xsl:text> egXML_invalid</xsl:text>
+	  </xsl:when>
+	  <xsl:otherwise>
+	    <xsl:text> egXML_valid</xsl:text>
+	  </xsl:otherwise>
+	</xsl:choose>
+      </xsl:attribute>
+      <xsl:choose>
+        <xsl:when test="$simple='true'">
+          <xsl:apply-templates mode="verbatim">
+            <xsl:with-param name="highlight">
+              <xsl:value-of select="$highlight"/>
+            </xsl:with-param>
+          </xsl:apply-templates>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:call-template name="egXMLStartHook"/>
+          <xsl:apply-templates mode="verbatim">
+            <xsl:with-param name="highlight">
+              <xsl:value-of select="$highlight"/>
+            </xsl:with-param>
+          </xsl:apply-templates>
+          <xsl:call-template name="egXMLEndHook"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </div>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element ident</desc>
+  </doc>
+  <xsl:template match="tei:ident">
+    <xsl:choose>
+      <xsl:when test="@type">
+        <span class="ident-{@type}">
+          <xsl:apply-templates/>
+        </span>
+      </xsl:when>
+      <xsl:otherwise>
+        <span class="ident">
+          <xsl:apply-templates/>
+        </span>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element gi</desc>
+  </doc>
+  <xsl:template match="tei:gi">
+    <span class="gi">
+      <xsl:text>&lt;</xsl:text>
+      <xsl:apply-templates/>
+      <xsl:text>&gt;</xsl:text>
+    </span>
+  </xsl:template>
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/tagdocs.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/header.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/header.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/header.xsl	(revision 258)
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml" 
+                xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
+                xmlns:fo="http://www.w3.org/1999/XSL/Format"
+                xmlns:html="http://www.w3.org/1999/xhtml"
+
+                xmlns:rng="http://relaxng.org/ns/structure/1.0"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"
+                
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="2.0"
+                exclude-result-prefixes="a fo rng tei teix">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet dealing with elements from the header module,
+      making HTML output. </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: header.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2011, TEI Consortium</p>
+      </desc>
+   </doc>
+
+  <xsl:key name="ALL-EXTRENDITION" match="@rendition[not(starts-with(.,'#'))]" use="1"/>
+  <xsl:key name="EXTRENDITION"     match="@rendition[not(starts-with(.,'#'))]" use="."/>
+  <xsl:key name="ALL-LOCALRENDITION" match="tei:rendition" use='1'/>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element teiHeader</desc>
+   </doc>
+  <xsl:template match="tei:teiHeader"/>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>make a style section from rendition elements in the header</desc>
+   </doc>
+  
+  <xsl:template name="generateLocalCSS">
+      <xsl:if test="key('ALL-LOCALRENDITION',1)">
+         <style type="text/css">
+	   <xsl:for-each select="key('ALL-LOCALRENDITION',1)">
+	     <xsl:text>&#10;.</xsl:text>
+	     <xsl:value-of select="@xml:id"/>
+	     <xsl:text> {&#10;	</xsl:text>
+	     <xsl:value-of select="."/>
+	     <xsl:text>;&#10;}</xsl:text>
+	   </xsl:for-each>
+	   <xsl:text>&#10;</xsl:text>
+         </style>
+      </xsl:if>
+      <xsl:if test="key('ALL-EXTRENDITION',1)">
+         <style type="text/css">
+	   <xsl:for-each select="key('ALL-EXTRENDITION',1)">
+	     <xsl:variable name="pointer">
+	       <xsl:value-of select="."/>
+	     </xsl:variable>
+	     <xsl:for-each select="key('RENDITION',$pointer)[1]">
+	       <xsl:for-each select="document($pointer)">
+		 <xsl:text>&#10;.</xsl:text>
+		 <xsl:value-of select="@xml:id"/>
+		 <xsl:text> {&#10;</xsl:text>
+		 <xsl:value-of select="."/>
+		 <xsl:text>;&#10;}</xsl:text>
+	       </xsl:for-each>
+	     </xsl:for-each>
+	   </xsl:for-each>
+         </style>
+      </xsl:if>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>[html] processing licence</desc>
+  </doc>
+  <xsl:template match="tei:availability"  mode="copyrighttext">
+    <xsl:apply-templates mode="copyrighttext"/>
+  </xsl:template>
+
+  <xsl:template match="tei:licence"  mode="copyrighttext">
+    <xsl:if test="@target">
+      <xsl:text>[</xsl:text>
+      <xsl:value-of select="@target"/>
+      <xsl:text>] </xsl:text>
+    </xsl:if>
+    <xsl:apply-templates/>
+  </xsl:template>
+  
+
+
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/header.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/core.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/core.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/core.xsl	(revision 258)
@@ -0,0 +1,2649 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml" xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:rng="http://relaxng.org/ns/structure/1.0" xmlns:tei="http://www.tei-c.org/ns/1.0" xmlns:teix="http://www.tei-c.org/ns/Examples" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:teidocx="http://www.tei-c.org/ns/teidocx/1.0" exclude-result-prefixes="a fo html rng tei teix teidocx" version="2.0">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+    <desc>
+      <p> TEI stylesheet dealing with elements from the core module, making
+      HTML output. </p>
+      <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+      <p>Author: See AUTHORS</p>
+      <p>Id: $Id: core.xsl 10058 2012-01-22 12:51:37Z rahtz $</p>
+      <p>Copyright: 2011, TEI Consortium</p>
+    </desc>
+  </doc>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>
+      <p>Process elements tei:*</p>
+      <p>
+        <p xmlns="http://www.w3.org/1999/xhtml"> anything with a head can go in the TOC </p>
+      </p>
+      <param name="forcedepth">forcedepth</param>
+    </desc>
+  </doc>
+  <xsl:template match="tei:*" mode="maketoc">
+    <xsl:param name="forcedepth"/>
+    <xsl:variable name="myName">
+      <xsl:value-of select="local-name(.)"/>
+    </xsl:variable>
+    <xsl:if test="tei:head or $autoHead='true'">
+      <xsl:variable name="Depth">
+        <xsl:choose>
+          <xsl:when test="not($forcedepth='')">
+            <xsl:value-of select="$forcedepth"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:value-of select="$tocDepth"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:variable>
+      <xsl:variable name="thislevel">
+        <xsl:choose>
+          <xsl:when test="$myName = 'div'">
+            <xsl:value-of select="count(ancestor::tei:div)"/>
+          </xsl:when>
+          <xsl:when test="starts-with($myName,'div')">
+            <xsl:value-of select="number(substring-after($myName,'div')) - 1"/>
+          </xsl:when>
+          <xsl:otherwise>99</xsl:otherwise>
+        </xsl:choose>
+      </xsl:variable>
+      <xsl:variable name="pointer">
+        <xsl:apply-templates mode="generateLink" select="."/>
+      </xsl:variable>
+      <li>
+        <xsl:attribute name="class">
+          <xsl:text>toc</xsl:text>
+          <xsl:if test="not($autoHead='true') and not(tei:head or @n)"> headless</xsl:if>
+        </xsl:attribute>
+        <xsl:call-template name="header">
+          <xsl:with-param name="toc" select="$pointer"/>
+          <xsl:with-param name="minimal">false</xsl:with-param>
+          <xsl:with-param name="display">plain</xsl:with-param>
+        </xsl:call-template>
+        <xsl:if test="$thislevel &lt; $Depth">
+          <xsl:call-template name="continuedToc"/>
+        </xsl:if>
+      </li>
+    </xsl:if>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element ab</desc>
+  </doc>
+  <xsl:template match="tei:ab">
+    <xsl:choose>
+      <xsl:when test="ancestor::tei:head or parent::tei:title or parent::tei:stage">
+        <xsl:apply-templates/>
+        <xsl:if test="following-sibling::tei:ab">
+          <br/>
+        </xsl:if>
+      </xsl:when>
+      <xsl:when test="parent::tei:sp">
+        <div>
+          <xsl:call-template name="rendToClass">
+            <xsl:with-param name="default">spProse</xsl:with-param>
+          </xsl:call-template>
+          <xsl:apply-templates/>
+        </div>
+      </xsl:when>
+      <xsl:otherwise>
+        <div>
+          <xsl:call-template name="rendToClass"/>
+          <xsl:apply-templates/>
+        </div>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element addrLine</desc>
+  </doc>
+  <xsl:template match="tei:addrLine">
+    <xsl:apply-templates/>
+    <br/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element address</desc>
+  </doc>
+  <xsl:template match="tei:address">
+    <address>
+      <xsl:call-template name="rendToClass"/>
+      <xsl:apply-templates/>
+    </address>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element argument</desc>
+  </doc>
+  <xsl:template match="tei:argument">
+    <div class="argument">
+      <xsl:apply-templates/>
+    </div>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element author</desc>
+  </doc>
+  <xsl:template match="tei:author">
+    <span>
+      <xsl:call-template name="rendToClass"/>
+      <xsl:apply-imports/>
+    </span>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element bibl</desc>
+  </doc>
+  <xsl:template match="tei:bibl">
+    <xsl:choose>
+      <xsl:when test="parent::tei:q/parent::tei:head or parent::tei:q[@rend='inline']">
+        <span class="citbibl">
+          <xsl:apply-templates/>
+        </span>
+      </xsl:when>
+      <xsl:when test="parent::tei:cit | parent::tei:q">
+        <div class="citbibl">
+          <xsl:apply-templates/>
+        </div>
+      </xsl:when>
+      <xsl:when test="tei:blockContext(.)">
+        <div class="biblfree">
+          <xsl:apply-templates/>
+        </div>
+      </xsl:when>
+      <xsl:otherwise>
+        <span>
+          <xsl:attribute name="class">
+            <xsl:text>bibl</xsl:text>
+            <xsl:if test="@type">
+              <xsl:text> bibl-</xsl:text>
+              <xsl:value-of select="@type"/>
+            </xsl:if>
+          </xsl:attribute>
+          <xsl:apply-templates/>
+        </span>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element change</desc>
+  </doc>
+  <xsl:template match="tei:change">
+    <tr>
+      <td style="vertical-align:top;" width="15%">
+        <xsl:value-of select="tei:date"/>
+      </td>
+      <td width="85%">
+        <xsl:value-of select="tei:item"/>
+      </td>
+    </tr>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element choice</desc>
+  </doc>
+  <xsl:template match="tei:choice">
+    <xsl:choose>
+      <xsl:when test="tei:abbr and tei:expan">
+        <xsl:apply-templates select="tei:expan"/>
+        <xsl:text> (</xsl:text>
+        <xsl:apply-templates select="tei:abbr"/>
+        <xsl:text>)</xsl:text>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:apply-templates/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element choice in plain mode - selects "critical" reading.</desc>
+  </doc>
+  <xsl:template match="tei:choice" mode="plain">
+    <xsl:value-of select="tei:reg"/>
+    <xsl:value-of select="tei:expan"/>
+    <xsl:value-of select="tei:corr"/>
+    <xsl:apply-templates select="tei:choice"/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element choice</desc>
+  </doc>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>
+      <p>Process element cit</p>
+      <p>
+        <p xmlns="http://www.w3.org/1999/xhtml"> quoting </p>
+      </p>
+    </desc>
+  </doc>
+  <xsl:template match="tei:cit">
+    <xsl:choose>
+      <xsl:when test="@rend='display' and tei:quote">
+        <div>
+          <xsl:call-template name="rendToClass"/>
+          <xsl:if test="@n">
+            <xsl:text>(</xsl:text>
+            <xsl:value-of select="@n"/>
+            <xsl:text>) </xsl:text>
+          </xsl:if>
+          <xsl:apply-templates select="tei:q|tei:quote"/>
+          <xsl:apply-templates select="tei:*[not(self::tei:q or self::tei:quote)]"/>
+        </div>
+      </xsl:when>
+      <xsl:when test="@rend='display'">
+        <blockquote>
+          <xsl:call-template name="rendToClass"/>
+          <xsl:variable name="contents">
+            <xsl:if test="@n">
+              <xsl:text>(</xsl:text>
+              <xsl:value-of select="@n"/>
+              <xsl:text>) </xsl:text>
+            </xsl:if>
+            <xsl:apply-templates select="tei:q|tei:quote"/>
+            <xsl:apply-templates select="tei:*[not(self::tei:q or self::tei:quote)]"/>
+          </xsl:variable>
+          <xsl:choose>
+            <xsl:when test="$outputTarget='html5'">
+              <xsl:copy-of select="$contents"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <p>
+                <xsl:copy-of select="$contents"/>
+              </p>
+            </xsl:otherwise>
+          </xsl:choose>
+        </blockquote>
+      </xsl:when>
+      <xsl:when test="tei:bibl">
+        <div>
+          <xsl:call-template name="rendToClass"/>
+          <xsl:if test="@n">
+            <xsl:text>(</xsl:text>
+            <xsl:value-of select="@n"/>
+            <xsl:text>) </xsl:text>
+          </xsl:if>
+          <xsl:apply-templates/>
+        </div>
+      </xsl:when>
+      <xsl:otherwise>
+        <span>
+          <xsl:call-template name="rendToClass"/>
+          <xsl:if test="@n">
+            <xsl:text>(</xsl:text>
+            <xsl:value-of select="@n"/>
+            <xsl:text>) </xsl:text>
+          </xsl:if>
+          <xsl:apply-templates/>
+        </span>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element code</desc>
+  </doc>
+  <xsl:template match="tei:code">
+    <code>
+      <xsl:call-template name="rendToClass"/>
+      <xsl:apply-templates/>
+    </code>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>
+    Does not do anything yet.
+  </desc>
+  </doc>
+  <xsl:template match="tei:corr">
+    <xsl:apply-templates/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Decorate date</desc>
+  </doc>
+  <xsl:template match="tei:date">
+    <span>
+      <xsl:call-template name="rendToClass"/>
+      <xsl:apply-imports/>
+    </span>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>The del element</desc>
+  </doc>
+  <xsl:template match="tei:del">
+    <del>
+      <xsl:apply-templates/>
+    </del>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element eg</desc>
+  </doc>
+  <xsl:template match="tei:eg">
+    <div>
+      <xsl:if test="$cssFile">
+        <xsl:attribute name="class">
+          <xsl:text>pre_eg</xsl:text>
+          <xsl:if test="not(*)">
+            <xsl:text> cdata</xsl:text>
+          </xsl:if>
+        </xsl:attribute>
+      </xsl:if>
+      <xsl:apply-templates/>
+    </div>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element emph</desc>
+  </doc>
+  <xsl:template match="tei:emph">
+    <xsl:choose>
+      <xsl:when test="@rend">
+        <xsl:call-template name="rendering"/>
+      </xsl:when>
+      <xsl:when test="@rendition">
+        <span>
+	  <xsl:call-template name="applyRendition"/>
+        </span>
+      </xsl:when>
+      <xsl:otherwise>
+        <em>
+          <xsl:apply-templates/>
+        </em>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element epigraph</desc>
+  </doc>
+  <xsl:template match="tei:epigraph">
+    <div>
+      <xsl:call-template name="rendToClass"/>
+      <xsl:apply-templates/>
+    </div>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element epigraph/lg</desc>
+  </doc>
+  <xsl:template match="tei:epigraph/tei:lg">
+    <xsl:apply-templates/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element foreign and unclear</desc>
+  </doc>
+  <xsl:template match="tei:foreign|tei:unclear">
+    <span>
+      <xsl:call-template name="rendToClass"/>
+      <xsl:apply-templates/>
+    </span>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element caesura</desc>
+  </doc>
+  <xsl:template match="tei:caesura">
+    <span class="caesura">    </span>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element gap</desc>
+  </doc>
+  <xsl:template match="tei:gap">
+    <xsl:element name="{if (tei:blockContext(.)) then 'div' else 'span'}">
+      <xsl:attribute name="class">gap</xsl:attribute>
+      <xsl:if test="tei:desc">
+        <xsl:attribute name="title">
+          <xsl:value-of select="tei:desc"/>
+        </xsl:attribute>
+      </xsl:if>
+      <xsl:choose>
+        <xsl:when test="starts-with(@rend,'content:')">
+          <xsl:value-of select="substring-after(@rend,'content:')"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:text> [...]</xsl:text>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:element>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>
+      <p>Process element att</p>
+      <p>
+        <p xmlns="http://www.w3.org/1999/xhtml"> special purpose </p>
+      </p>
+    </desc>
+  </doc>
+  <xsl:template match="tei:att">
+    <span class="gi">
+      <b>@<xsl:apply-templates/>
+         </b>
+    </span>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process gloss element</desc>
+  </doc>
+  <xsl:template match="tei:gloss">
+    <span class="gloss">
+      <xsl:apply-templates/>
+    </span>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>
+      <p>Process element head</p>
+      <p xmlns="http://www.w3.org/1999/xhtml"> headings etc </p>
+    </desc>
+  </doc>
+  <xsl:template match="tei:head">
+    <xsl:variable name="parent" select="local-name(..)"/>
+    <xsl:choose>
+      <xsl:when test="parent::tei:group or parent::tei:body or parent::tei:front or parent::tei:back">
+        <h1>
+          <xsl:apply-templates/>
+        </h1>
+      </xsl:when>
+      <xsl:when test="parent::tei:argument">
+        <div>
+          <xsl:call-template name="rendToClass"/>
+          <xsl:apply-templates/>
+        </div>
+      </xsl:when>
+      <xsl:when test="not(starts-with($parent,'div'))">
+        <xsl:apply-templates/>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element head in plain mode</desc>
+  </doc>
+  <xsl:template match="tei:head" mode="plain">
+    <xsl:if test="preceding-sibling::tei:head">
+      <xsl:text> </xsl:text>
+    </xsl:if>
+    <xsl:apply-templates mode="plain"/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element head in heading mode</desc>
+  </doc>
+  <xsl:template match="tei:head" mode="makeheading">
+    <xsl:if test="preceding-sibling::tei:head">
+      <br/>
+    </xsl:if>
+    <span>
+      <xsl:call-template name="rendToClass">
+        <xsl:with-param name="id">false</xsl:with-param>
+      </xsl:call-template>
+      <xsl:apply-templates/>
+    </span>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element hi</desc>
+  </doc>
+  <xsl:template match="tei:hi">
+    <xsl:choose>
+      <xsl:when test="@rend">
+        <xsl:call-template name="rendering"/>
+      </xsl:when>
+      <xsl:when test="@rendition">
+        <span>
+          <xsl:call-template name="applyRendition"/>
+          <xsl:apply-templates/>
+        </span>
+      </xsl:when>
+      <xsl:when test="key('TAGREND','hi')">
+        <span>
+          <xsl:attribute name="class">
+            <xsl:for-each select="key('TAGREND',local-name())">
+              <xsl:call-template name="findRendition">
+                <xsl:with-param name="value">
+                  <xsl:value-of select="@render"/>
+                </xsl:with-param>
+              </xsl:call-template>
+            </xsl:for-each>
+          </xsl:attribute>
+          <xsl:apply-templates/>
+        </span>
+      </xsl:when>
+      <xsl:otherwise>
+        <span class="hi">
+          <xsl:apply-templates/>
+        </span>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element item</desc>
+  </doc>
+  <xsl:template match="tei:item" mode="bibl">
+    <p>
+      <xsl:call-template name="makeAnchor"/>
+      <xsl:apply-templates/>
+    </p>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element item</desc>
+  </doc>
+  <xsl:template match="tei:item" mode="glosstable">
+    <tr>
+      <td style="vertical-align:top;">
+        <strong>
+          <xsl:apply-templates mode="print" select="preceding-sibling::tei:*[1]"/>
+        </strong>
+      </td>
+      <td>
+        <xsl:call-template name="makeAnchor"/>
+        <xsl:apply-templates/>
+      </td>
+    </tr>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element item</desc>
+  </doc>
+  <xsl:template match="tei:item" mode="gloss">
+    <dt>
+      <xsl:call-template name="makeAnchor"/>
+      <xsl:apply-templates mode="print" select="preceding-sibling::tei:label[1]"/>
+    </dt>
+    <dd>
+      <xsl:apply-templates/>
+    </dd>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element item</desc>
+  </doc>
+  <xsl:template match="tei:item">
+    <li>
+      <xsl:call-template name="rendToClass"/>
+      <xsl:choose>
+        <xsl:when test="@xml:id">
+          <xsl:call-template name="makeAnchor">
+            <xsl:with-param name="name">
+              <xsl:value-of select="@xml:id"/>
+            </xsl:with-param>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:when test="$generateParagraphIDs='true'">
+          <xsl:call-template name="makeAnchor">
+            <xsl:with-param name="name">
+              <xsl:value-of select="generate-id()"/>
+            </xsl:with-param>
+          </xsl:call-template>
+        </xsl:when>
+      </xsl:choose>
+      <xsl:apply-templates/>
+    </li>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element item</desc>
+  </doc>
+  <xsl:template match="tei:item" mode="inline">
+    <xsl:if test="preceding-sibling::tei:item">, </xsl:if>
+    <xsl:if test="not(following-sibling::tei:item) and preceding-sibling::tei:item">
+      and </xsl:if>
+    <xsl:text>• </xsl:text>
+    <xsl:apply-templates/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element item/tei:label</desc>
+  </doc>
+  <xsl:template match="tei:item/tei:label">
+    <xsl:choose>
+      <xsl:when test="@rend">
+        <xsl:call-template name="rendering"/>
+      </xsl:when>
+      <xsl:when test="@rendition">
+        <span>
+          <xsl:call-template name="applyRendition"/>
+          <xsl:apply-templates/>
+        </span>
+      </xsl:when>
+      <xsl:otherwise>
+        <strong>
+          <xsl:apply-templates/>
+        </strong>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element label</desc>
+  </doc>
+  <xsl:template match="tei:label">
+    <span>
+      <xsl:call-template name="makeAnchor"/>
+      <xsl:apply-templates/>
+    </span>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element label</desc>
+  </doc>
+  <xsl:template match="tei:label" mode="print">
+    <span>
+      <xsl:call-template name="makeAnchor"/>
+      <xsl:choose>
+        <xsl:when test="@rend">
+          <xsl:call-template name="rendering"/>
+        </xsl:when>
+        <xsl:when test="@rendition">
+          <span>
+            <xsl:call-template name="applyRendition"/>
+            <xsl:apply-templates/>
+          </span>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:apply-templates/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </span>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element lb in plain mode</desc>
+  </doc>
+  <xsl:template match="tei:lb" mode="plain">
+    <xsl:text> </xsl:text>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element lb</desc>
+  </doc>
+  <xsl:template match="tei:lb">
+    <xsl:choose>
+      <xsl:when test="parent::tei:body"/>
+      <xsl:when test="parent::tei:back"/>
+      <xsl:when test="parent::tei:front"/>
+      <xsl:when test="@type='hyphenInWord' and @rend='hidden'"/>
+      <xsl:when test="@rend='hidden'">
+        <xsl:text> </xsl:text>
+      </xsl:when>
+      <xsl:when test="@rend='-' or @type='hyphenInWord'">
+        <xsl:text>-</xsl:text>
+        <br/>
+      </xsl:when>
+      <xsl:when test="@rend='above'">
+        <xsl:text>⌜</xsl:text>
+      </xsl:when>
+      <xsl:when test="@rend='below'">
+        <xsl:text>⌞</xsl:text>
+      </xsl:when>
+      <xsl:when test="@rend">
+        <br class="{@rend}"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <br/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element l</desc>
+  </doc>
+  <xsl:template match="tei:l">
+    <xsl:element name="{if (ancestor::tei:head or ancestor::tei:hi) then 'span' else 'div'}">
+      <xsl:call-template name="rendToClass">
+        <xsl:with-param name="default">l</xsl:with-param>
+      </xsl:call-template>
+      <xsl:choose>
+        <xsl:when test="ancestor::tei:div[contains(@rend,'linenumber')]">
+          <xsl:variable name="n">
+            <xsl:number/>
+          </xsl:variable>
+          <div class="numbering">
+            <xsl:choose>
+              <xsl:when test="$n mod 5 = 0">
+                <xsl:value-of select="$n"/>
+              </xsl:when>
+              <xsl:otherwise> </xsl:otherwise>
+            </xsl:choose>
+          </div>
+          <xsl:apply-templates/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:apply-templates/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:element>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element lg</desc>
+  </doc>
+  <xsl:template match="tei:lg">
+    <xsl:choose>
+      <xsl:when test="$filePerPage='true'">
+        <xsl:for-each-group select="node()" group-starting-with="tei:pb">
+          <xsl:choose>
+            <xsl:when test="self::tei:pb">
+              <xsl:apply-templates select="."/>
+              <div>
+                <xsl:for-each select="..">
+                  <xsl:call-template name="rendToClass">
+                    <xsl:with-param name="id">
+                      <xsl:choose>
+                        <xsl:when test="@xml:id">
+                          <xsl:value-of select="@xml:id"/>
+                          <xsl:text>continued</xsl:text>
+                        </xsl:when>
+                        <xsl:otherwise>
+                          <xsl:text>false</xsl:text>
+                        </xsl:otherwise>
+                      </xsl:choose>
+                    </xsl:with-param>
+                  </xsl:call-template>
+                </xsl:for-each>
+                <xsl:apply-templates select="current-group() except ."/>
+              </div>
+            </xsl:when>
+            <xsl:otherwise>
+              <div>
+                <xsl:for-each select="..">
+                  <xsl:call-template name="rendToClass"/>
+                </xsl:for-each>
+                <xsl:apply-templates select="current-group()"/>
+              </div>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:for-each-group>
+      </xsl:when>
+      <xsl:otherwise>
+        <div>
+          <xsl:call-template name="rendToClass"/>
+          <xsl:apply-templates/>
+        </div>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element lg/tei:l</desc>
+  </doc>
+  <xsl:template match="tei:lg/tei:l">
+    <div>
+      <xsl:choose>
+        <xsl:when test="@rend">
+          <xsl:attribute name="class">
+            <xsl:choose>
+              <xsl:when test="@rend='Alignr'">
+                <xsl:text>right</xsl:text>
+              </xsl:when>
+              <xsl:when test="@rend='Alignc'">
+                <xsl:text>center</xsl:text>
+              </xsl:when>
+              <xsl:when test="starts-with(@rend,'indent(')">
+                <xsl:text>indent</xsl:text>
+                <xsl:value-of select="concat(substring-before(substring-after(@rend,'('),')'),'em')"/>
+              </xsl:when>
+              <xsl:when test="@rend='indent'">
+                <xsl:text>indent1</xsl:text>
+              </xsl:when>
+              <xsl:when test="@rend">
+                <xsl:value-of select="@rend"/>
+              </xsl:when>
+            </xsl:choose>
+          </xsl:attribute>
+        </xsl:when>
+        <xsl:when test="@rendition">
+          <xsl:call-template name="applyRendition"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:attribute name="class">
+            <xsl:value-of select="local-name()"/>
+          </xsl:attribute>
+        </xsl:otherwise>
+      </xsl:choose>
+      <xsl:apply-templates/>
+    </div>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>
+      <p>Process element list</p>
+      <p>
+        <p xmlns="http://www.w3.org/1999/xhtml">Lists. Depending on the value of the 'type' attribute, various HTML
+        lists are generated: <dl><dt>bibl</dt><dd>Items are processed in mode 'bibl'</dd><dt>catalogue</dt><dd>A gloss list is created, inside a paragraph</dd><dt>gloss</dt><dd>A gloss list is created, expecting alternate label and item
+            elements</dd><dt>glosstable</dt><dd>Label and item pairs are laid out in a two-column table</dd><dt>inline</dt><dd>A comma-separate inline list</dd><dt>runin</dt><dd>An inline list with bullets between items</dd><dt>unordered</dt><dd>A simple unordered list</dd><dt>ordered</dt><dd>A simple ordered list</dd><dt>valList</dt><dd>(Identical to glosstable)</dd></dl>
+            </p>
+      </p>
+    </desc>
+  </doc>
+  <xsl:template match="tei:list">
+    <xsl:if test="tei:head">
+      <xsl:element name="{if (tei:blockContext(.)) then 'div' else 'span' }">
+        <xsl:attribute name="class">listhead</xsl:attribute>
+        <xsl:apply-templates select="tei:head"/>
+      </xsl:element>
+    </xsl:if>
+    <xsl:choose>
+      <xsl:when test="@type='catalogue'">
+        <p>
+          <dl>
+            <xsl:call-template name="rendToClass">
+              <xsl:with-param name="default"/>
+            </xsl:call-template>
+            <xsl:for-each select="tei:item">
+              <p/>
+              <xsl:apply-templates mode="gloss" select="."/>
+            </xsl:for-each>
+          </dl>
+        </p>
+      </xsl:when>
+      <xsl:when test="@type='gloss' and @rend='multicol'">
+        <xsl:variable name="nitems">
+          <xsl:value-of select="count(tei:item)div 2"/>
+        </xsl:variable>
+        <p>
+          <table>
+            <xsl:call-template name="rendToClass">
+              <xsl:with-param name="default"/>
+            </xsl:call-template>
+            <tr>
+              <td style="vertical-align:top;">
+                <dl>
+                  <xsl:apply-templates mode="gloss" select="tei:item[position()&lt;=$nitems ]"/>
+                </dl>
+              </td>
+              <td style="vertical-align:top;">
+                <dl>
+                  <xsl:apply-templates mode="gloss" select="tei:item[position() &gt;$nitems]"/>
+                </dl>
+              </td>
+            </tr>
+          </table>
+        </p>
+      </xsl:when>
+      <xsl:when test="@type='gloss' or  tei:label">
+        <dl>
+          <xsl:call-template name="rendToClass">
+            <xsl:with-param name="default"/>
+          </xsl:call-template>
+          <xsl:apply-templates mode="gloss" select="tei:item"/>
+        </dl>
+      </xsl:when>
+      <xsl:when test="@type='glosstable' or @type='valList'">
+        <table>
+          <xsl:call-template name="rendToClass">
+            <xsl:with-param name="default"/>
+          </xsl:call-template>
+          <xsl:apply-templates mode="glosstable" select="tei:item"/>
+        </table>
+      </xsl:when>
+      <xsl:when test="@type='inline' or ancestor::tei:head or parent::tei:label">
+        <!--<xsl:if test="not(tei:item)">None</xsl:if>-->
+        <xsl:apply-templates mode="inline" select="tei:item"/>
+      </xsl:when>
+      <xsl:when test="@type='runin'">
+        <p>
+          <xsl:apply-templates mode="runin" select="tei:item"/>
+        </p>
+      </xsl:when>
+      <xsl:when test="@type='unordered' or @type='simple'">
+        <ul>
+          <xsl:call-template name="rendToClass">
+            <xsl:with-param name="default"/>
+          </xsl:call-template>
+          <xsl:apply-templates select="tei:item"/>
+        </ul>
+      </xsl:when>
+      <xsl:when test="@type='bibl'">
+        <xsl:apply-templates mode="bibl" select="tei:item"/>
+      </xsl:when>
+      <xsl:when test="starts-with(@type,'ordered')">
+        <ol>
+          <xsl:call-template name="rendToClass">
+            <xsl:with-param name="default"/>
+          </xsl:call-template>
+          <xsl:if test="starts-with(@type,'ordered:')">
+            <xsl:attribute name="start">
+              <xsl:value-of select="substring-after(@type,':')"/>
+            </xsl:attribute>
+          </xsl:if>
+          <xsl:apply-templates select="tei:item"/>
+        </ol>
+      </xsl:when>
+      <xsl:otherwise>
+        <ul>
+          <xsl:call-template name="rendToClass">
+            <xsl:with-param name="default"/>
+          </xsl:call-template>
+          <xsl:apply-templates select="tei:item"/>
+        </ul>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element list/tei:label</desc>
+  </doc>
+  <xsl:template match="tei:list/tei:label"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element listBibl</desc>
+  </doc>
+  <xsl:template match="tei:listBibl">
+    <xsl:choose>
+      <xsl:when test="tei:biblStruct and $biblioStyle='mla'">
+	<div type="listBibl" xmlns="http://www.w3.org/1999/xhtml">	  
+	<xsl:for-each select="tei:biblStruct">
+	  <p class="hang" xmlns="http://www.w3.org/1999/xhtml">
+	    <xsl:apply-templates select="tei:analytic" mode="mla"/>
+	    <xsl:apply-templates select="tei:monogr" mode="mla"/>
+	    <xsl:apply-templates select="tei:relatedItem" mode="mla"/>
+	    <xsl:choose>
+	      <xsl:when test="tei:note">
+		<xsl:apply-templates select="tei:note"/>
+	      </xsl:when>
+	      <xsl:when test="*//tei:ref/@target and not(contains(*//tei:ref/@target, '#'))">
+		<xsl:text>Web.&#10;</xsl:text>
+		<xsl:if test="*//tei:imprint/tei:date/@type='access'">
+		  <xsl:value-of select="*//tei:imprint/tei:date[@type='access']"/>
+		  <xsl:text>.</xsl:text>
+		</xsl:if>
+	      </xsl:when>
+	      <xsl:when test="tei:analytic/tei:title[@level='u'] or tei:monogr/tei:title[@level='u']"/>
+	      <xsl:otherwise>Print.&#10;</xsl:otherwise>
+	    </xsl:choose>
+	    <xsl:if test="tei:monogr/tei:imprint/tei:extent"><xsl:value-of select="tei:monogr/tei:imprint/tei:extent"/>. </xsl:if>
+	    <xsl:if test="tei:series/tei:title[@level='s']">
+	      <xsl:apply-templates select="tei:series/tei:title[@level='s']"/>
+	      <xsl:text>. </xsl:text>
+	    </xsl:if>
+	  </p>
+	</xsl:for-each>
+	</div>
+      </xsl:when>
+      <xsl:when test="tei:biblStruct">
+        <ol class="listBibl">
+          <xsl:for-each select="tei:biblStruct">
+            <xsl:sort select="lower-case((tei:*/tei:author/tei:surname|tei:*[1]/tei:author/tei:orgName|tei:*[1]/tei:author/tei:name|tei:*[1]/tei:author|tei:*[1]/tei:editor/tei:surname|tei:*[1]/tei:editor/tei:name|tei:*[1]/tei:editor|tei:*[1]/tei:title[1])[1])"/>
+            <xsl:sort select="tei:monogr/tei:imprint/tei:date"/>
+            <li>
+              <xsl:call-template name="makeAnchor"/>
+              <xsl:apply-templates select="."/>
+            </li>
+          </xsl:for-each>
+        </ol>
+      </xsl:when>
+      <xsl:otherwise>
+        <ol class="listBibl">
+          <xsl:for-each select="tei:bibl|tei:biblItem">
+            <li>
+              <xsl:call-template name="makeAnchor">
+                <xsl:with-param name="name">
+                  <xsl:apply-templates mode="ident" select="."/>
+                </xsl:with-param>
+              </xsl:call-template>
+              <xsl:apply-templates select="."/>
+            </li>
+          </xsl:for-each>
+        </ol>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element mentioned</desc>
+  </doc>
+  <xsl:template match="tei:mentioned">
+    <span>
+      <xsl:call-template name="rendToClass"/>
+      <xsl:apply-templates/>
+    </span>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element name in mode "plain"</desc>
+  </doc>
+  <xsl:template match="tei:name" mode="plain">
+    <xsl:variable name="ident">
+      <xsl:apply-templates mode="ident" select="."/>
+    </xsl:variable>
+    <span>
+      <xsl:call-template name="makeAnchor">
+        <xsl:with-param name="name">
+          <xsl:value-of select="$ident"/>
+        </xsl:with-param>
+      </xsl:call-template>
+      <xsl:apply-templates/>
+    </span>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element note</desc>
+  </doc>
+  <xsl:template match="tei:note">
+    <xsl:variable name="identifier">
+      <xsl:call-template name="noteID"/>
+    </xsl:variable>
+    <xsl:choose>
+      <xsl:when test="@place='none'"/>
+      <xsl:when test="ancestor::tei:listBibl or ancestor::tei:biblFull         or ancestor::tei:biblStruct">
+        <xsl:text> [</xsl:text>
+        <xsl:apply-templates/>
+        <xsl:text>]</xsl:text>
+      </xsl:when>
+      <xsl:when test="@place='foot' or @place='bottom' or @place='end' or $autoEndNotes='true'">
+        <xsl:element name="{if (parent::tei:head or parent::tei:hi)  then 'span'           else if (parent::tei:l) then 'span'           else if (parent::tei:bibl/parent::tei:head) then 'span'           else if (parent::tei:stage/parent::tei:q) then 'span'           else if  (parent::tei:body or *[not(tei:is-inline(.))]) then 'div' else 'span' }">
+          <xsl:call-template name="makeAnchor">
+            <xsl:with-param name="name" select="concat($identifier,'_return')"/>
+          </xsl:call-template>
+          <xsl:variable name="note-title">
+            <xsl:variable name="note-text">
+              <xsl:apply-templates mode="plain"/>
+            </xsl:variable>
+            <xsl:value-of select="substring($note-text,1,500)"/>
+            <xsl:if test="string-length($note-text) &gt; 500">
+              <xsl:text>…</xsl:text>
+            </xsl:if>
+          </xsl:variable>
+          <xsl:choose>
+            <xsl:when test="$footnoteFile='true'">
+              <a class="notelink" title="{normalize-space($note-title)}" href="{$masterFile}-notes.html#{$identifier}">
+		<xsl:element name="{if (@rend='nosup') then 'span' else 'sup'}">
+                  <xsl:call-template name="noteN"/>
+		</xsl:element>
+              </a>
+              <xsl:if test="following-sibling::node()[1][self::tei:note]">
+		<xsl:element name="{if (@rend='nosup') then 'span' else 'sup'}">
+                  <xsl:text>,</xsl:text>
+                </xsl:element>
+              </xsl:if>
+            </xsl:when>
+            <xsl:otherwise>
+              <a class="notelink" title="{normalize-space($note-title)}" href="#{$identifier}">
+		<xsl:element name="{if (@rend='nosup') then 'span' else 'sup'}">				  
+                  <xsl:call-template name="noteN"/>
+                </xsl:element>
+              </a>
+              <xsl:if test="following-sibling::node()[1][self::tei:note]">
+		<xsl:element name="{if (@rend='nosup') then 'span' else 'sup'}">
+                  <xsl:text>,</xsl:text>
+                </xsl:element>
+              </xsl:if>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:element>
+      </xsl:when>
+      <xsl:when test="parent::tei:head and @place='margin'">
+        <span class="margnote">
+          <xsl:apply-templates/>
+        </span>
+      </xsl:when>
+      <xsl:when test="parent::tei:head">
+        <xsl:text> [</xsl:text>
+        <xsl:apply-templates/>
+        <xsl:text>]</xsl:text>
+      </xsl:when>
+      <xsl:when test="@type='footnote'">
+        <div class="note">
+          <xsl:call-template name="makeAnchor">
+            <xsl:with-param name="name" select="$identifier"/>
+          </xsl:call-template>
+          <span class="noteNumber">
+            <xsl:number/>
+          </span>
+          <xsl:apply-templates/>
+        </div>
+      </xsl:when>
+      <xsl:when test="(@place='display' or tei:q)          and (parent::tei:div or parent::tei:p or parent::tei:body)">
+        <div class="note">
+          <xsl:call-template name="makeAnchor">
+            <xsl:with-param name="name" select="$identifier"/>
+          </xsl:call-template>
+          <span class="noteLabel">
+            <xsl:choose>
+              <xsl:when test="@n">
+                <xsl:value-of select="@n"/>
+              </xsl:when>
+              <xsl:otherwise>
+                <xsl:call-template name="i18n">
+                  <xsl:with-param name="word">Note</xsl:with-param>
+                </xsl:call-template>
+                <xsl:text>: </xsl:text>
+              </xsl:otherwise>
+            </xsl:choose>
+          </span>
+          <xsl:apply-templates/>
+        </div>
+      </xsl:when>
+      <xsl:when test="@place='display'">
+        <blockquote>
+          <xsl:call-template name="makeAnchor">
+            <xsl:with-param name="name" select="$identifier"/>
+          </xsl:call-template>
+          <xsl:call-template name="rendToClass"/>
+          <xsl:choose>
+            <xsl:when test="$outputTarget='html5'">
+              <xsl:apply-templates/>
+            </xsl:when>
+            <xsl:when test="tei:q">
+              <xsl:apply-templates/>
+            </xsl:when>
+            <xsl:otherwise>
+              <p>
+                <xsl:apply-templates/>
+              </p>
+            </xsl:otherwise>
+          </xsl:choose>
+        </blockquote>
+      </xsl:when>
+      <xsl:when test="@place='margin' and parent::tei:hi and not(*)">
+        <span class="margnote">
+          <xsl:call-template name="makeAnchor">
+            <xsl:with-param name="name" select="$identifier"/>
+          </xsl:call-template>
+          <xsl:apply-templates/>
+        </span>
+      </xsl:when>
+      <xsl:when test="@place='margin' and *[not(tei:is-inline(.))]">
+        <div class="margnote">
+          <xsl:call-template name="makeAnchor">
+            <xsl:with-param name="name" select="$identifier"/>
+          </xsl:call-template>
+          <xsl:apply-templates/>
+        </div>
+      </xsl:when>
+      <xsl:when test="@place='margin'">
+        <span class="margnote">
+          <xsl:call-template name="makeAnchor">
+            <xsl:with-param name="name" select="$identifier"/>
+          </xsl:call-template>
+          <xsl:apply-templates/>
+        </span>
+      </xsl:when>
+      <xsl:when test="@place='inline' or (parent::tei:p or parent::tei:hi or parent::tei:head)">
+        <span class="note">
+          <xsl:call-template name="makeAnchor">
+            <xsl:with-param name="name" select="$identifier"/>
+          </xsl:call-template>
+          <xsl:text> [</xsl:text>
+          <xsl:apply-templates/>
+          <xsl:text>]</xsl:text>
+        </span>
+      </xsl:when>
+      <xsl:otherwise>
+        <div>
+          <xsl:call-template name="makeAnchor">
+            <xsl:with-param name="name" select="$identifier"/>
+          </xsl:call-template>
+          <xsl:attribute name="class">
+            <xsl:text>note </xsl:text>
+            <xsl:value-of select="@type"/>
+          </xsl:attribute>
+          <span class="noteLabel">
+            <xsl:choose>
+              <xsl:when test="@n">
+                <xsl:value-of select="@n"/>
+              </xsl:when>
+              <xsl:otherwise>
+                <xsl:call-template name="i18n">
+                  <xsl:with-param name="word">Note</xsl:with-param>
+                </xsl:call-template>
+                <xsl:text>: </xsl:text>
+              </xsl:otherwise>
+            </xsl:choose>
+          </span>
+          <xsl:apply-templates/>
+        </div>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Check whether a note should be processed if we are at the top</desc>
+  </doc>
+  <xsl:template match="tei:note" mode="printallnotes">
+    <xsl:choose>
+      <xsl:when test="number($splitLevel)=-1">
+        <xsl:call-template name="makeaNote"/>
+      </xsl:when>
+      <xsl:when test="ancestor::tei:group"/>
+      <xsl:when test="not(ancestor::tei:div or ancestor::tei:div1)">
+        <xsl:call-template name="makeaNote"/>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Check whether a note should be processed. If we are
+    splitting, check that we are in the correct file</desc>
+  </doc>
+  <xsl:template match="tei:note" mode="printnotes">
+    <xsl:param name="whence" select="."/>
+    <xsl:choose>
+      <xsl:when test="ancestor::tei:listBibl"/>
+      <xsl:when test="number($splitLevel)=-1"/>
+      <xsl:when test="@place='foot' or @place='bottom' or @place='end'         or $autoEndNotes='true'">
+        <xsl:variable name="parent">
+	  <xsl:for-each select="ancestor::tei:*[local-name()='div'
+	    or local-name()='div1'
+	    or local-name()='div2'
+	    or local-name()='div3'
+	    or local-name()='div4'
+	    or local-name()='div5'
+	    or local-name()='div6'][1]">
+	    <xsl:call-template name="locateParentDiv"/>
+	  </xsl:for-each>
+        </xsl:variable>
+
+        <xsl:if test="$whence = $parent">
+          <xsl:call-template name="makeaNote"/>
+        </xsl:if>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element note</desc>
+  </doc>
+  <xsl:template name="makeaNote">
+    <xsl:variable name="identifier">
+      <xsl:call-template name="noteID"/>
+    </xsl:variable>
+    <xsl:if test="$verbose='true'">
+      <xsl:message>Make note <xsl:value-of select="$identifier"/></xsl:message>
+    </xsl:if>
+    <div class="note">
+      <xsl:call-template name="makeAnchor">
+        <xsl:with-param name="name" select="$identifier"/>
+      </xsl:call-template>
+      <span class="noteLabel">
+        <xsl:call-template name="noteN"/>
+        <xsl:if test="matches(@n,'[0-9]')">
+          <xsl:text>.</xsl:text>
+        </xsl:if>
+        <xsl:text> </xsl:text>
+      </span>
+      <div class="noteBody">
+        <xsl:apply-templates/>
+      </div>
+      <xsl:if test="$footnoteBackLink= 'true'">
+        <xsl:text> </xsl:text>
+        <a class="link_return" title="Go back to text" href="#{concat($identifier,'_return')}">↵</a>
+      </xsl:if>
+    </div>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element note[@type='action']</desc>
+  </doc>
+  <xsl:template match="tei:note[@type='action']">
+    <div class="right"><b>Action <xsl:number count="tei:note[@type='action']" level="any"/>
+         </b>: <i><xsl:apply-templates/></i></div>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>
+      <p>Process element pb</p>
+      <p>Indication of a page break. For the purposes of HTML, we simply
+      make it an anchor if it has an ID.</p>
+    </desc>
+  </doc>
+  <xsl:template match="tei:pb" mode="ident">
+    <xsl:choose>
+      <xsl:when test="@xml:id">
+        <xsl:value-of select="@xml:id"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:text>page</xsl:text>
+        <!--
+	<xsl:for-each select="ancestor::tei:div[1]">
+	  <xsl:number level="multiple" format="1.1.1.1.1"/>
+	  <xsl:text>-</xsl:text>
+	</xsl:for-each>
+-->
+        <xsl:number level="any"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <xsl:template match="tei:pb">
+    <xsl:choose>
+      <xsl:when test="$filePerPage='true'">
+        <PAGEBREAK>
+          <xsl:attribute name="name">
+            <xsl:apply-templates select="." mode="ident"/>
+          </xsl:attribute>
+          <xsl:copy-of select="@facs"/>
+        </PAGEBREAK>
+      </xsl:when>
+      <xsl:when test="@facs and not(@rend='none')">
+        <xsl:variable name="IMG">
+          <xsl:choose>
+            <xsl:when test="starts-with(@facs,'#')">
+              <xsl:for-each select="id(substring(@facs,2))">
+                <xsl:value-of select="tei:graphic[1]/@url"/>
+              </xsl:for-each>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:value-of select="@facs"/>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:variable>
+        <xsl:element name="{if (tei:is-inline(..)) then 'span' else 'div'}">
+          <xsl:call-template name="rendToClass"/>
+          <img src="{$IMG}" alt="page image"/>
+        </xsl:element>
+      </xsl:when>
+      <xsl:when test="$pagebreakStyle='active'">
+        <div class="pagebreak">
+          <xsl:call-template name="rendToClass"/>
+        </div>
+      </xsl:when>
+      <xsl:when test="$pagebreakStyle='visible' and (parent::tei:body         or parent::tei:front or parent::tei:back or parent::tei:group)">
+        <div class="pagebreak">
+          <xsl:call-template name="makeAnchor"/>
+          <xsl:text> [</xsl:text>
+          <xsl:call-template name="i18n">
+            <xsl:with-param name="word">page</xsl:with-param>
+          </xsl:call-template>
+          <xsl:if test="@n">
+            <xsl:text> </xsl:text>
+            <xsl:value-of select="@n"/>
+          </xsl:if>
+          <xsl:text>] </xsl:text>
+        </div>
+      </xsl:when>
+      <xsl:when test="$pagebreakStyle='visible'">
+        <span class="pagebreak">
+          <xsl:call-template name="makeAnchor"/>
+          <xsl:text> [</xsl:text>
+          <xsl:call-template name="i18n">
+            <xsl:with-param name="word">page</xsl:with-param>
+          </xsl:call-template>
+          <xsl:if test="@n">
+            <xsl:text> </xsl:text>
+            <xsl:value-of select="@n"/>
+          </xsl:if>
+          <xsl:text>] </xsl:text>
+        </span>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element p</desc>
+  </doc>
+  <xsl:template match="tei:p">
+    <xsl:variable name="wrapperElement">
+      <xsl:choose>
+        <xsl:when test="$outputTarget='html5'">p</xsl:when>
+        <xsl:when test="parent::tei:figure and (tei:q/tei:l or tei:figure or parent::tei:figure/parent::tei:div)">div</xsl:when>
+        <xsl:when test="parent::tei:figure">span</xsl:when>
+        <xsl:when test="parent::tei:head or    parent::tei:q/parent::tei:head or    parent::tei:note[@place='margin']/parent::tei:head">span</xsl:when>
+        <xsl:when test="ancestor::tei:notesStmt">div</xsl:when>
+        <xsl:when test="tei:table">div</xsl:when>
+        <xsl:when test="parent::tei:note[not(@place or @rend)]">span</xsl:when>
+        <xsl:when test="$outputTarget='epub' or $outputTarget='epub3'">div</xsl:when>
+        <xsl:when test="tei:eg">div</xsl:when>
+        <xsl:when test="tei:figure">div</xsl:when>
+        <xsl:when test="tei:floatingText">div</xsl:when>
+        <xsl:when test="tei:l">div</xsl:when>
+        <xsl:when test="tei:list">div</xsl:when>
+        <xsl:when test="tei:moduleSpec">div</xsl:when>
+        <xsl:when test="tei:note[@place='display']">div</xsl:when>
+        <xsl:when test="tei:note[@place='margin']">div</xsl:when>
+        <xsl:when test="tei:note[tei:q]">div</xsl:when>
+        <xsl:when test="tei:q/tei:figure">div</xsl:when>
+        <xsl:when test="tei:q/tei:list">div</xsl:when>
+        <xsl:when test="tei:q[@rend='display']">div</xsl:when>
+        <xsl:when test="tei:q[@rend='inline' and tei:note/@place]">div</xsl:when>
+        <xsl:when test="tei:q[tei:l]">div</xsl:when>
+        <xsl:when test="tei:q[tei:lg]">div</xsl:when>
+        <xsl:when test="tei:q[tei:p]">div</xsl:when>
+        <xsl:when test="tei:q[tei:sp]">div</xsl:when>
+        <xsl:when test="tei:q[tei:floatingText]">div</xsl:when>
+        <xsl:when test="tei:quote">div</xsl:when>
+        <xsl:when test="tei:specGrp">div</xsl:when>
+        <xsl:when test="tei:specGrpRef">div</xsl:when>
+        <xsl:when test="tei:specList">div</xsl:when>
+        <xsl:when test="tei:table">div</xsl:when>
+        <xsl:when test="teix:egXML">div</xsl:when>
+        <xsl:when test="ancestor::tei:floatingText">div</xsl:when>
+        <xsl:when test="ancestor::tei:closer">div</xsl:when>
+        <xsl:when test="parent::tei:p">div</xsl:when>
+        <xsl:when test="parent::tei:q">div</xsl:when>
+        <xsl:when test="parent::tei:note">div</xsl:when>
+        <xsl:when test="parent::tei:remarks">div</xsl:when>
+        <xsl:otherwise>
+          <xsl:text>p</xsl:text>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:choose>
+      <xsl:when test="$filePerPage='true'">
+        <xsl:for-each-group select="node()" group-starting-with="tei:pb">
+          <xsl:choose>
+            <xsl:when test="self::tei:pb">
+              <xsl:apply-templates select="."/>
+              <xsl:element name="{$wrapperElement}">
+                <xsl:for-each select="..">
+                  <xsl:call-template name="rendToClass">
+                    <xsl:with-param name="id">
+                      <xsl:choose>
+                        <xsl:when test="@xml:id">
+                          <xsl:value-of select="@xml:id"/>
+                          <xsl:text>continued</xsl:text>
+                        </xsl:when>
+                        <xsl:otherwise>
+                          <xsl:text>false</xsl:text>
+                        </xsl:otherwise>
+                      </xsl:choose>
+                    </xsl:with-param>
+                  </xsl:call-template>
+                </xsl:for-each>
+                <xsl:apply-templates select="current-group() except ."/>
+              </xsl:element>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:element name="{$wrapperElement}">
+                <xsl:for-each select="..">
+                  <xsl:call-template name="rendToClass"/>
+                </xsl:for-each>
+                <xsl:apply-templates select="current-group()"/>
+              </xsl:element>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:for-each-group>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:element name="{$wrapperElement}">
+          <xsl:call-template name="rendToClass">
+            <xsl:with-param name="default">
+              <xsl:if test="not($wrapperElement ='p')">
+                <xsl:text>p</xsl:text>
+              </xsl:if>
+            </xsl:with-param>
+          </xsl:call-template>
+          <xsl:if test="$numberParagraphs='true'">
+	    <xsl:call-template name="numberParagraph"/>
+          </xsl:if>
+          <xsl:apply-templates/>
+        </xsl:element>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>How to number paragraphs</desc>
+  </doc>
+  <xsl:template name="numberParagraph">
+    <span class="numberParagraph">
+      <xsl:number/>
+    </span>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element p[@rend='box']</desc>
+  </doc>
+  <xsl:template match="tei:p[@rend='box']">
+    <p class="box">
+      <xsl:apply-templates/>
+    </p>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element q and tei:said</desc>
+  </doc>
+  <xsl:template match="tei:q[@rend='inline margQuotes' or
+		       @rend='inline margSglQuotes']" priority="99">
+    <xsl:apply-templates/>
+  </xsl:template>
+  <xsl:template match="tei:q[not(@place) and tei:l]">
+    <xsl:choose>
+      <xsl:when test="tei:blockContext(.)">
+        <div class="blockquote">
+          <xsl:apply-templates/>
+        </div>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:apply-templates/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <xsl:template match="tei:q|tei:said">
+    <xsl:choose>
+      <xsl:when test="parent::tei:q/tei:note[@place='bottom']">
+        <span class="inlineq">
+          <xsl:call-template name="makeQuote"/>
+        </span>
+      </xsl:when>
+      <xsl:when test="parent::tei:note[@place='bottom'] and not(*)">
+        <span class="inlineq">
+          <xsl:call-template name="makeQuote"/>
+        </span>
+      </xsl:when>
+      <xsl:when test="tei:blockContext(.)">
+        <div class="blockquote {@rend}">
+          <xsl:apply-templates/>
+        </div>
+      </xsl:when>
+      <xsl:when test="parent::tei:q[@rend=current()/@rend] or parent::tei:hi or ancestor::tei:head">
+        <span class="inlineq {@rend}">
+          <xsl:call-template name="makeQuote"/>
+        </span>
+      </xsl:when>
+      <xsl:when test="not(tei:is-inline(.)) or *[not(tei:is-inline(.))]">
+        <div class="blockquote {@rend}">
+          <xsl:apply-templates/>
+        </div>
+      </xsl:when>
+      <xsl:when test="@rend='display'">
+        <p class="blockquote {@rend}">
+          <xsl:apply-templates/>
+        </p>
+      </xsl:when>
+      <xsl:when test="tei:lg">
+        <xsl:apply-templates/>
+      </xsl:when>
+      <xsl:when test="@rendition">
+        <span>
+          <xsl:call-template name="applyRendition"/>
+        </span>
+      </xsl:when>
+      <xsl:when test="contains(@rend,'PRE')">
+        <xsl:call-template name="makeQuote"/>
+      </xsl:when>
+      <xsl:when test="@rend">
+        <span class="q {@rend}">
+          <xsl:apply-templates/>
+        </span>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="makeQuote"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element q[@rend='display']</desc>
+  </doc>
+  <xsl:template match="tei:q[@rend='display']">
+    <blockquote>
+      <xsl:call-template name="rendToClass"/>
+      <xsl:choose>
+        <xsl:when test="tei:p">
+          <xsl:apply-templates/>
+        </xsl:when>
+        <xsl:when test="$outputTarget='html5'">
+          <xsl:apply-templates/>
+        </xsl:when>
+        <xsl:otherwise>
+          <p>
+            <xsl:apply-templates/>
+          </p>
+        </xsl:otherwise>
+      </xsl:choose>
+    </blockquote>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element q[@rend='eg']</desc>
+  </doc>
+  <xsl:template match="tei:q[@rend='eg']">
+    <div>
+      <xsl:if test="$cssFile">
+        <xsl:attribute name="class">eg</xsl:attribute>
+      </xsl:if>
+      <xsl:apply-templates/>
+    </div>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element quote</desc>
+  </doc>
+  <xsl:template match="tei:quote">
+    <xsl:choose>
+      <xsl:when test="parent::tei:cit">
+        <div class="citquote">
+          <xsl:apply-templates/>
+        </div>
+      </xsl:when>
+      <xsl:when test="@rend='quoted'">
+        <span class="quote_inline">
+          <xsl:value-of select="$preQuote"/>
+          <xsl:apply-templates/>
+          <xsl:value-of select="$postQuote"/>
+        </span>
+      </xsl:when>
+      <xsl:when test="@rend='display' or @rend='block' or tei:lg or tei:lb or tei:p or tei:l or
+		      ($autoBlockQuote='true' and string-length(.)&gt;$autoBlockQuoteLength)">
+        <blockquote>
+          <xsl:call-template name="rendToClass"/>
+          <xsl:choose>
+            <xsl:when test="$outputTarget='html5'">
+              <xsl:apply-templates/>
+            </xsl:when>
+            <xsl:when test="tei:p|tei:l|tei:lg">
+              <xsl:apply-templates/>
+            </xsl:when>
+            <xsl:otherwise>
+              <p>
+                <xsl:apply-templates/>
+              </p>
+            </xsl:otherwise>
+          </xsl:choose>
+        </blockquote>
+      </xsl:when>
+      <xsl:otherwise>
+        <span class="quote_inline">
+          <xsl:apply-templates/>
+        </span>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element resp</desc>
+  </doc>
+  <xsl:template match="tei:resp">
+    <xsl:apply-templates/>
+    <xsl:text> </xsl:text>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element respStmt</desc>
+  </doc>
+  <xsl:template match="tei:respStmt">
+    <xsl:apply-templates/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element salute</desc>
+  </doc>
+  <xsl:template match="tei:salute">
+    <xsl:choose>
+      <xsl:when test="parent::tei:closer">
+        <xsl:apply-templates/>
+      </xsl:when>
+      <xsl:otherwise>
+        <div class="left">
+          <xsl:apply-templates/>
+        </div>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element seg, pass through @type and @rend as @class</desc>
+  </doc>
+  <xsl:template match="tei:seg">
+    <span>
+      <xsl:choose>
+        <xsl:when test="@type">
+          <xsl:attribute name="class">
+            <xsl:value-of select="@type"/>
+          </xsl:attribute>
+        </xsl:when>
+        <xsl:when test="@rend">
+          <xsl:attribute name="class">
+            <xsl:value-of select="@rend"/>
+          </xsl:attribute>
+        </xsl:when>
+      </xsl:choose>
+      <xsl:apply-templates/>
+    </span>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>
+    put (sic) after text
+  </desc>
+  </doc>
+  <xsl:template match="tei:sic">
+    <xsl:apply-templates/>
+    <xsl:text> (sic)</xsl:text>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element signed</desc>
+  </doc>
+  <xsl:template match="tei:signed">
+    <div class="signed">
+      <xsl:apply-templates/>
+    </div>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element space</desc>
+  </doc>
+  <xsl:template match="tei:space">
+    <span style="display:inline-block">
+      <xsl:if test="@extent">
+        <xsl:variable name="unit">
+          <xsl:choose>
+            <xsl:when test="@unit='chars'">
+              <xsl:text>em</xsl:text>
+            </xsl:when>
+            <xsl:when test="@unit">
+              <xsl:value-of select="@unit"/>
+            </xsl:when>
+            <xsl:otherwise>em</xsl:otherwise>
+          </xsl:choose>
+        </xsl:variable>
+        <xsl:attribute name="width">
+          <xsl:value-of select="@extent"/>
+          <xsl:value-of select="$unit"/>
+        </xsl:attribute>
+      </xsl:if>
+      <xsl:text> </xsl:text>
+    </span>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element term</desc>
+  </doc>
+  <xsl:template match="tei:term">
+    <xsl:choose>
+      <xsl:when test="@rend">
+        <xsl:call-template name="rendering"/>
+      </xsl:when>
+      <xsl:when test="@rendition">
+        <span>
+          <xsl:call-template name="applyRendition"/>
+          <xsl:apply-templates/>
+        </span>
+      </xsl:when>
+      <xsl:otherwise>
+        <span class="term">
+          <xsl:apply-templates/>
+        </span>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element title in "withbr" mode</desc>
+  </doc>
+  <xsl:template match="tei:title" mode="withbr">
+    <xsl:value-of select="."/>
+    <br/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element title when it is a child of body</desc>
+  </doc>
+  <xsl:template match="tei:body/tei:title">
+    <div class="title">
+      <xsl:apply-templates/>
+    </div>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element witList</desc>
+  </doc>
+  <xsl:template match="tei:witList">
+    <xsl:apply-templates select="./witness"/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element witness</desc>
+  </doc>
+  <xsl:template match="tei:witness">
+    <p id="{@sigil}">
+      <b>Sigle: <xsl:value-of select="@sigil"/>
+         </b>
+      <br/>
+      <xsl:value-of select="text()"/>
+      <br/>
+      <xsl:apply-templates select="tei:biblStruct"/>
+      <xsl:if test="child::tei:note"><br/>See: <xsl:apply-templates select="child::tei:note"/></xsl:if>
+    </p>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>[html] Activate a value for @rendition<param name="value">value</param>
+      </desc>
+  </doc>
+  <xsl:template name="applyRendition">
+    <xsl:attribute name="class">
+      <xsl:for-each select="tokenize(normalize-space(@rendition),' ')">
+        <xsl:call-template name="findRendition">
+          <xsl:with-param name="value">
+            <xsl:value-of select="."/>
+          </xsl:with-param>
+        </xsl:call-template>
+      </xsl:for-each>
+    </xsl:attribute>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>[html] Look up rendition value <param name="value">value</param>
+      </desc>
+  </doc>
+  <xsl:template name="findRendition">
+    <xsl:param name="value"/>
+    <xsl:choose>
+      <xsl:when test="starts-with($value,'#')">
+        <xsl:value-of select="substring-after($value,'#')"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:for-each select="document($value)">
+          <xsl:apply-templates select="@xml:id"/>
+        </xsl:for-each>
+      </xsl:otherwise>
+    </xsl:choose>
+    <xsl:text> </xsl:text>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>[html] Active a value for @rend<param name="value">value</param>
+      </desc>
+  </doc>
+  <xsl:template name="applyRend">
+    <xsl:param name="value"/>
+    <xsl:choose>
+      <xsl:when test="not($value='')">
+        <xsl:variable name="thisparm" select="substring-before($value,$rendSeparator)"/>
+        <xsl:call-template name="renderingInner">
+          <xsl:with-param name="value" select="$thisparm"/>
+          <xsl:with-param name="rest" select="substring-after($value,$rendSeparator)"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:apply-templates/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>[html] sections in mode for table of contents</desc>
+  </doc>
+  <xsl:template name="continuedToc">
+    <xsl:if test="tei:div|tei:div1|tei:div2|tei:div3|tei:div4|tei:div5|tei:div6">
+      <ul class="toc">
+        <xsl:apply-templates mode="maketoc" select="tei:div|tei:div1|tei:div2|tei:div3|tei:div4|tei:div5|tei:div6"/>
+      </ul>
+    </xsl:if>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>[html] How to identify a note</desc>
+  </doc>
+  <xsl:template name="noteID">
+    <xsl:choose>
+      <xsl:when test="@xml:id">
+        <xsl:value-of select="@xml:id"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:text>Note</xsl:text>
+        <xsl:number count="tei:note" level="any"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>[html] How to label a note</desc>
+  </doc>
+  <xsl:template name="noteN">
+    <xsl:choose>
+      <xsl:when test="@n">
+        <xsl:value-of select="@n"/>
+      </xsl:when>
+      <xsl:when test="not(@place) and $consecutiveFNs='true'">
+        <xsl:number count="tei:note[not(@place)]" level="any"/>
+      </xsl:when>
+      <xsl:when test="not(@place)">
+        <xsl:choose>
+          <xsl:when test="ancestor::tei:front">
+            <xsl:number count="tei:note[not(@place)]" from="tei:front" level="any"/>
+          </xsl:when>
+          <xsl:when test="ancestor::tei:back">
+            <xsl:number count="tei:note[not(@place)]" from="tei:back" level="any"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:number count="tei:note[not(@place)]" from="tei:body" level="any"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+      <xsl:when test="@place='end'">
+        <xsl:choose>
+          <xsl:when test="$consecutiveFNs = 'true'">
+            <xsl:number count="tei:note[./@place='end']" level="any"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:choose>
+              <xsl:when test="ancestor::tei:front">
+                <xsl:number count="tei:note[./@place='end' ]" from="tei:front" level="any"/>
+              </xsl:when>
+              <xsl:when test="ancestor::tei:back">
+                <xsl:number count="tei:note[./@place='end' ]" from="tei:back" level="any"/>
+              </xsl:when>
+              <xsl:otherwise>
+                <xsl:number count="tei:note[./@place='end' ]" from="tei:body" level="any"/>
+              </xsl:otherwise>
+            </xsl:choose>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:choose>
+          <xsl:when test="$consecutiveFNs = 'true'">
+            <xsl:number count="tei:note[@place='foot' or @place='bottom']" level="any"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:choose>
+              <xsl:when test="ancestor::tei:front">
+                <xsl:number count="tei:note[@place='foot' or @place='bottom']" from="tei:front" level="any"/>
+              </xsl:when>
+              <xsl:when test="ancestor::tei:back">
+                <xsl:number count="tei:note[@place='foot' or @place='bottom']" from="tei:back" level="any"/>
+              </xsl:when>
+              <xsl:otherwise>
+                <xsl:number count="tei:note[@place='foot' or @place='bottom']" from="tei:body" level="any"/>
+              </xsl:otherwise>
+            </xsl:choose>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>[html] Show relevant footnotes <param name="currentID">currentID</param>
+      </desc>
+  </doc>
+  <xsl:template name="partialFootNotes">
+    <xsl:param name="currentID"/>
+    <xsl:choose>
+      <xsl:when test="$currentID='current'"/>
+      <xsl:when test="$currentID='' and number($splitLevel)=-1">
+        <xsl:call-template name="printNotes"/>
+      </xsl:when>
+      <xsl:when test="$currentID=''">
+        <xsl:for-each select="descendant::tei:text">
+          <xsl:call-template name="printNotes"/>
+        </xsl:for-each>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:choose>
+          <xsl:when test="count(id($currentID))&gt;0">
+            <xsl:for-each select="id($currentID)">
+              <xsl:call-template name="printNotes"/>
+            </xsl:for-each>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:apply-templates mode="xpath" select="ancestor-or-self::tei:TEI/descendant::tei:text">
+              <xsl:with-param name="xpath" select="$currentID"/>
+              <xsl:with-param name="action">notes</xsl:with-param>
+            </xsl:apply-templates>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>[html] </desc>
+  </doc>
+  <xsl:template name="printNotes">
+    <xsl:if test="count(key('NOTES',1)) or ($autoEndNotes='true' and count(key('ALLNOTES',1)))">
+      <xsl:choose>
+        <xsl:when test="$footnoteFile='true'">
+          <xsl:variable name="BaseFile">
+            <xsl:value-of select="$masterFile"/>
+            <xsl:call-template name="addCorpusID"/>
+          </xsl:variable>
+          <xsl:variable name="outName">
+            <xsl:call-template name="outputChunkName">
+              <xsl:with-param name="ident">
+                <xsl:value-of select="concat($BaseFile,'-notes')"/>
+              </xsl:with-param>
+            </xsl:call-template>
+          </xsl:variable>
+          <xsl:if test="$verbose='true'">
+            <xsl:message>Opening file <xsl:value-of select="$outName"/>
+               </xsl:message>
+          </xsl:if>
+          <xsl:result-document doctype-public="{$doctypePublic}" doctype-system="{$doctypeSystem}" encoding="{$outputEncoding}" href="{$outName}" method="{$outputMethod}">
+            <html>
+              <xsl:comment>THIS FILE IS GENERATED FROM AN XML MASTER. DO NOT EDIT (11)</xsl:comment>
+              <xsl:call-template name="addLangAtt"/>
+              <head>
+                <title>
+                  <xsl:apply-templates select="descendant-or-self::tei:text/tei:front//tei:docTitle//text()"/>
+                  <xsl:text>: </xsl:text>
+                  <xsl:call-template name="i18n">
+                    <xsl:with-param name="word">noteHeading</xsl:with-param>
+                  </xsl:call-template>
+                </title>
+                <xsl:call-template name="includeCSS"/>
+                <xsl:call-template name="cssHook"/>
+              </head>
+              <body>
+                <xsl:call-template name="bodyMicroData"/>
+                <xsl:call-template name="bodyJavascriptHook"/>
+                <xsl:call-template name="bodyHook"/>
+                <div class="stdheader">
+                  <xsl:call-template name="stdheader">
+                    <xsl:with-param name="title">
+                      <xsl:apply-templates select="descendant-or-self::tei:text/tei:front//tei:docTitle//text()"/>
+                      <xsl:text>: </xsl:text>
+                      <xsl:call-template name="i18n">
+                        <xsl:with-param name="word">noteHeading</xsl:with-param>
+                      </xsl:call-template>
+                    </xsl:with-param>
+                  </xsl:call-template>
+                </div>
+                <div class="notes">
+                  <div class="noteHeading">
+                    <xsl:call-template name="i18n">
+                      <xsl:with-param name="word">noteHeading</xsl:with-param>
+                    </xsl:call-template>
+                  </div>
+                  <xsl:choose>
+                    <xsl:when test="$autoEndNotes='true'">
+                      <xsl:apply-templates mode="printnotes" select="key('ALLNOTES',1)"/>
+                    </xsl:when>
+                    <xsl:otherwise>
+                      <xsl:apply-templates mode="printnotes" select="key('NOTES',1)"/>
+                    </xsl:otherwise>
+                  </xsl:choose>
+                </div>
+                <xsl:call-template name="stdfooter"/>
+                <xsl:call-template name="bodyEndHook"/>
+              </body>
+            </html>
+          </xsl:result-document>
+          <xsl:if test="$verbose='true'">
+            <xsl:message>Closing file <xsl:value-of select="$outName"/>
+               </xsl:message>
+          </xsl:if>
+        </xsl:when>
+        <xsl:otherwise>
+	  
+          <xsl:variable name="me">
+            <xsl:apply-templates select="." mode="ident"/>
+          </xsl:variable>
+          <xsl:variable name="NOTES">
+            <xsl:choose>
+              <xsl:when test="self::tei:TEI">
+                <xsl:choose>
+                  <xsl:when test="$autoEndNotes='true'">
+                    <xsl:apply-templates mode="printallnotes" select="key('ALLNOTES',1)"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                    <xsl:apply-templates mode="printallnotes" select="key('NOTES',1)"/>
+                  </xsl:otherwise>
+                </xsl:choose>
+              </xsl:when>
+              <xsl:when test="parent::tei:group and tei:group">
+	      </xsl:when>
+              <xsl:otherwise>
+                <xsl:apply-templates mode="printnotes" select=".//tei:note">
+                  <xsl:with-param name="whence" select="$me"/>
+                </xsl:apply-templates>
+              </xsl:otherwise>
+            </xsl:choose>
+          </xsl:variable>
+          <xsl:for-each select="$NOTES">
+            <xsl:if test="html:div">
+              <div class="notes">
+                <div class="noteHeading">
+                  <xsl:call-template name="i18n">
+                    <xsl:with-param name="word">noteHeading</xsl:with-param>
+                  </xsl:call-template>
+                </div>
+                <xsl:copy-of select="*"/>
+              </div>
+            </xsl:if>
+          </xsl:for-each>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:if>
+    <xsl:if test="ancestor-or-self::tei:TEI/tei:text/descendant::tei:app">
+      <div class="notes">
+        <div class="noteHeading">
+          <xsl:call-template name="i18n">
+            <xsl:with-param name="word">noteHeading</xsl:with-param>
+          </xsl:call-template>
+        </div>
+        <xsl:apply-templates mode="printnotes" select="descendant::tei:app"/>
+      </div>
+    </xsl:if>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>
+      <p>[html] </p>
+      <p>
+        <p xmlns="http://www.w3.org/1999/xhtml"> rendering. support for multiple rendition elements added by Nick
+        Nicholas </p>
+      </p>
+    </desc>
+  </doc>
+  <xsl:template name="rendering">
+    <xsl:call-template name="applyRend">
+      <xsl:with-param name="value" select="concat(@rend,$rendSeparator)"/>
+    </xsl:call-template>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>[html] <param name="value">the current segment of the value of the rend
+      attribute</param>
+         <param name="rest">the remainder of the attribute</param>
+      </desc>
+  </doc>
+  <xsl:template name="renderingInner">
+    <xsl:param name="value"/>
+    <xsl:param name="rest"/>
+    <xsl:choose>
+      <xsl:when test="$value='bold' or $value='bo'">
+        <b>
+          <xsl:call-template name="applyRend">
+            <xsl:with-param name="value" select="$rest"/>
+          </xsl:call-template>
+        </b>
+      </xsl:when>
+      <xsl:when test="$value='center'">
+        <span style="text-align:center">
+          <xsl:call-template name="applyRend">
+            <xsl:with-param name="value" select="$rest"/>
+          </xsl:call-template>
+	</span>
+      </xsl:when>
+      <xsl:when test="$value='code'">
+        <b>
+          <code>
+            <xsl:call-template name="applyRend">
+              <xsl:with-param name="value" select="$rest"/>
+            </xsl:call-template>
+          </code>
+        </b>
+      </xsl:when>
+      <xsl:when test="$value='italics' or $value='italic' or $value='cursive' or         $value='it' or $value='ital'">
+        <i>
+          <xsl:call-template name="applyRend">
+            <xsl:with-param name="value" select="$rest"/>
+          </xsl:call-template>
+        </i>
+      </xsl:when>
+      <xsl:when test="$value='ro' or $value='roman'">
+        <span style="font-style: normal">
+          <xsl:call-template name="applyRend">
+            <xsl:with-param name="value" select="$rest"/>
+          </xsl:call-template>
+        </span>
+      </xsl:when>
+      <xsl:when test="$value='sc' or $value='smcap'">
+        <span style="font-variant: small-caps">
+          <xsl:call-template name="applyRend">
+            <xsl:with-param name="value" select="$rest"/>
+          </xsl:call-template>
+        </span>
+      </xsl:when>
+      <xsl:when test="$value='plain'">
+        <xsl:call-template name="applyRend">
+          <xsl:with-param name="value" select="$rest"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:when test="$value='quoted'">
+        <xsl:text>‘</xsl:text>
+        <xsl:call-template name="applyRend">
+          <xsl:with-param name="value" select="$rest"/>
+        </xsl:call-template>
+        <xsl:text>’</xsl:text>
+      </xsl:when>
+      <xsl:when test="$value='sub'">
+        <sub>
+          <xsl:call-template name="applyRend">
+            <xsl:with-param name="value" select="$rest"/>
+          </xsl:call-template>
+        </sub>
+      </xsl:when>
+      <xsl:when test="$value='sup'">
+        <sup>
+          <xsl:call-template name="applyRend">
+            <xsl:with-param name="value" select="$rest"/>
+          </xsl:call-template>
+        </sup>
+      </xsl:when>
+      <xsl:when test="$value='important'">
+        <span class="important">
+          <xsl:call-template name="applyRend">
+            <xsl:with-param name="value" select="$rest"/>
+          </xsl:call-template>
+        </span>
+      </xsl:when>
+      <xsl:when test="$value='ul'">
+        <span style="text-decoration:underline">
+          <xsl:call-template name="applyRend">
+            <xsl:with-param name="value" select="$rest"/>
+          </xsl:call-template>
+        </span>
+      </xsl:when>
+      <xsl:when test="$value='interlinMarks'">
+        <xsl:text>`</xsl:text>
+        <xsl:call-template name="applyRend">
+          <xsl:with-param name="value" select="$rest"/>
+        </xsl:call-template>
+        <xsl:text>´</xsl:text>
+      </xsl:when>
+      <xsl:when test="$value='overbar'">
+        <span style="text-decoration:overline">
+          <xsl:call-template name="applyRend">
+            <xsl:with-param name="value" select="$rest"/>
+          </xsl:call-template>
+        </span>
+      </xsl:when>
+      <xsl:when test="$value='expanded'">
+        <span style="letter-spacing: 0.15em">
+          <xsl:call-template name="applyRend">
+            <xsl:with-param name="value" select="$rest"/>
+          </xsl:call-template>
+        </span>
+      </xsl:when>
+      <xsl:when test="$value='strike'">
+        <span style="text-decoration: line-through">
+          <xsl:call-template name="applyRend">
+            <xsl:with-param name="value" select="$rest"/>
+          </xsl:call-template>
+        </span>
+      </xsl:when>
+      <xsl:when test="$value='small'">
+        <span style="font-size: 75%">
+          <xsl:call-template name="applyRend">
+            <xsl:with-param name="value" select="$rest"/>
+          </xsl:call-template>
+        </span>
+      </xsl:when>
+      <xsl:when test="$value='large'">
+        <span style="font-size: 150%">
+          <xsl:call-template name="applyRend">
+            <xsl:with-param name="value" select="$rest"/>
+          </xsl:call-template>
+        </span>
+      </xsl:when>
+      <xsl:when test="$value='smaller'">
+        <span style="font-size: 50%">
+          <xsl:call-template name="applyRend">
+            <xsl:with-param name="value" select="$rest"/>
+          </xsl:call-template>
+        </span>
+      </xsl:when>
+      <xsl:when test="$value='larger'">
+        <span style="font-size: 200%">
+          <xsl:call-template name="applyRend">
+            <xsl:with-param name="value" select="$rest"/>
+          </xsl:call-template>
+        </span>
+      </xsl:when>
+      <xsl:when test="$value='calligraphic' or $value='cursive'">
+        <span style="font-family: cursive">
+          <xsl:call-template name="applyRend">
+            <xsl:with-param name="value" select="$rest"/>
+          </xsl:call-template>
+        </span>
+      </xsl:when>
+      <xsl:when test="$value='gothic'">
+        <span style="font-family: Papyrus, fantasy">
+          <xsl:call-template name="applyRend">
+            <xsl:with-param name="value" select="$rest"/>
+          </xsl:call-template>
+        </span>
+      </xsl:when>
+      <xsl:when test="$value='noindex'">
+        <xsl:call-template name="applyRend">
+          <xsl:with-param name="value" select="$rest"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:choose>
+          <xsl:when test="local-name(.)='p'">
+            <xsl:call-template name="unknownRendBlock">
+              <xsl:with-param name="rest" select="$rest"/>
+              <xsl:with-param name="value" select="$value"/>
+            </xsl:call-template>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:call-template name="unknownRendInline">
+              <xsl:with-param name="rest" select="$rest"/>
+              <xsl:with-param name="value" select="$value"/>
+            </xsl:call-template>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>[html] Process unknown rend attribute by turning it into
+    an HTML class<param name="value">current value</param>
+         <param name="rest">remaining values</param>
+      </desc>
+  </doc>
+  <xsl:template name="unknownRendBlock">
+    <xsl:param name="value"/>
+    <xsl:param name="rest"/>
+    <xsl:if test="not($value='')">
+      <xsl:attribute name="class">
+        <xsl:value-of select="$value"/>
+      </xsl:attribute>
+      <xsl:call-template name="applyRend">
+        <xsl:with-param name="value" select="$rest"/>
+      </xsl:call-template>
+    </xsl:if>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>[html]  Process unknown rend attribute by turning it into
+    an HTML class<param name="value">value</param>
+         <param name="rest">rest</param>
+      </desc>
+  </doc>
+  <xsl:template name="unknownRendInline">
+    <xsl:param name="value"/>
+    <xsl:param name="rest"/>
+    <xsl:if test="not($value='')">
+      <span class="{$value}">
+        <xsl:call-template name="applyRend">
+          <xsl:with-param name="value" select="$rest"/>
+        </xsl:call-template>
+      </span>
+    </xsl:if>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>[html] Create a point to which we can link in the HTML<param name="name">value for identifier</param>
+      </desc>
+  </doc>
+  <xsl:template name="makeAnchor">
+    <xsl:param name="name"/>
+    <xsl:choose>
+      <xsl:when test="self::tei:anchor and $name">
+        <a id="{$name}">
+          <xsl:comment>anchor</xsl:comment>
+        </a>
+      </xsl:when>
+      <xsl:when test="self::tei:anchor">
+        <a id="{@xml:id}">
+          <xsl:comment>anchor</xsl:comment>
+        </a>
+      </xsl:when>
+      <xsl:when test="self::tei:index and $name">
+        <a id="{$name}">
+          <xsl:comment>index</xsl:comment>
+        </a>
+      </xsl:when>
+      <xsl:when test="self::tei:index">
+        <a id="{@xml:id}">
+          <xsl:comment>index</xsl:comment>
+        </a>
+      </xsl:when>
+      <xsl:when test="$name">
+        <xsl:attribute name="id" select="$name"/>
+      </xsl:when>
+      <xsl:when test="@xml:id">
+        <xsl:attribute name="id" select="@xml:id"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:variable name="me"><xsl:value-of select="$masterFile"/>-<xsl:value-of select="local-name(.)"/>-<xsl:value-of select="generate-id()"/></xsl:variable>
+        <xsl:attribute name="id" select="$me"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process element soCalled</desc>
+  </doc>
+  <xsl:template match="tei:soCalled">
+    <xsl:choose>
+      <xsl:when test="@rend">
+        <xsl:call-template name="rendering"/>
+      </xsl:when>
+      <xsl:when test="@rendition">
+        <span>
+          <xsl:call-template name="applyRendition"/>
+          <xsl:apply-templates/>
+        </span>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$preQuote"/>
+        <xsl:apply-templates/>
+        <xsl:value-of select="$postQuote"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Copy all attributes in HTML namespace</desc>
+  </doc>
+  <xsl:template name="htmlAttributes">
+    <xsl:for-each select="@*">
+      <xsl:if test="namespace-uri(.)='http://www.w3.org/1999/xhtml'">
+        <xsl:attribute name="{local-name(.)}">
+          <xsl:value-of select="."/>
+        </xsl:attribute>
+      </xsl:if>
+    </xsl:for-each>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>[html] convert rend attribute to HTML class</desc>
+  </doc>
+  <xsl:template name="rendToClass">
+    <xsl:param name="id">true</xsl:param>
+    <xsl:param name="default">.</xsl:param>
+    <xsl:choose>
+      <xsl:when test="$id='false'"/>
+      <xsl:when test="$id=''"/>
+      <xsl:when test="$id='true' and @xml:id">
+        <xsl:attribute name="id">
+          <xsl:value-of select="@xml:id"/>
+        </xsl:attribute>
+      </xsl:when>
+      <xsl:when test="$id='true' and self::tei:p and $generateParagraphIDs='true'">
+        <xsl:attribute name="id">
+          <xsl:value-of select="generate-id()"/>
+        </xsl:attribute>
+      </xsl:when>
+      <xsl:when test="$id='true'"/>
+      <xsl:otherwise>
+        <xsl:attribute name="id" select="$id"/>
+      </xsl:otherwise>
+    </xsl:choose>
+    <xsl:if test="$outputTarget='html5'">
+      <xsl:call-template name="microdata"/>
+    </xsl:if>
+    <xsl:variable name="class1">
+      <xsl:choose>
+        <xsl:when test="$default=''"/>
+        <xsl:when test="not($default='.')">
+          <xsl:value-of select="$default"/>
+        </xsl:when>
+        <xsl:when test="@type">
+          <xsl:value-of select="@type"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="local-name()"/>
+        </xsl:otherwise>
+      </xsl:choose>
+      <xsl:call-template name="rendToClassHook"/>
+      <xsl:if test="tei:is-transcribable(.) and $mediaoverlay='true'">
+        <xsl:text> transcribable</xsl:text>
+      </xsl:if>
+    </xsl:variable>
+    <xsl:variable name="class2">
+      <xsl:choose>
+        <xsl:when test="@rend">
+          <xsl:value-of select="translate(@rend,'/','-')"/>
+        </xsl:when>
+        <xsl:when test="@rendition">
+          <xsl:call-template name="findRendition">
+            <xsl:with-param name="value">
+              <xsl:value-of select="@rendition"/>
+            </xsl:with-param>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:when test="key('TAGREND',local-name())">
+          <xsl:for-each select="key('TAGREND',local-name())">
+            <xsl:call-template name="findRendition">
+              <xsl:with-param name="value">
+                <xsl:value-of select="@render"/>
+              </xsl:with-param>
+            </xsl:call-template>
+          </xsl:for-each>
+        </xsl:when>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:choose>
+      <xsl:when test="$class1='' and $class2=''"/>
+      <xsl:when test="$class2=''">
+        <xsl:attribute name="class">
+          <xsl:value-of select="normalize-space($class1)"/>
+        </xsl:attribute>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:attribute name="class">
+          <xsl:if test="not($class1='')">
+            <xsl:value-of select="$class1"/>
+            <xsl:text> </xsl:text>
+          </xsl:if>
+          <xsl:value-of select="$class2"/>
+        </xsl:attribute>
+      </xsl:otherwise>
+    </xsl:choose>
+    <xsl:choose>
+      <xsl:when test="@rendition">
+        <xsl:call-template name="applyRendition"/>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>[html] allow for local extensions to rendToClass</desc>
+  </doc>
+  <xsl:template name="rendToClassHook"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>[html] standard case of TEI element which produces a span</desc>
+  </doc>
+  <xsl:template name="makeSpan">
+    <xsl:element name="{if (tei:blockContext(.)) then 'div' else 'span'}">
+      <xsl:choose>
+        <xsl:when test="@rendition">
+          <xsl:call-template name="applyRendition"/>
+          <xsl:apply-templates/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:call-template name="rendToClass">
+            <xsl:with-param name="default">
+              <xsl:value-of select="local-name()"/>
+            </xsl:with-param>
+          </xsl:call-template>
+          <xsl:apply-templates/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:element>
+  </xsl:template>
+  <xsl:template name="microdata"/>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>[html] processing analytic element as needed for MLA style (from Laura Mandell> </desc>
+  </doc>
+  <xsl:template match="tei:analytic" mode="mla">
+    <xsl:variable name="refIdwHash">
+      <xsl:value-of select="following-sibling::tei:monogr/tei:ref/@target"/>
+    </xsl:variable>
+    <xsl:variable name="refId">
+      <xsl:value-of select="substring-after($refIdwHash, '#')"/>
+    </xsl:variable>
+    <xsl:apply-templates/>
+    <xsl:if test="not(following-sibling::tei:monogr/tei:title[@level='m']) and $refId!=''">
+      <xsl:text> </xsl:text>
+      <xsl:if test="following-sibling::tei:monogr/tei:imprint/tei:date">
+	<xsl:value-of select="following-sibling::tei:monogr/tei:imprint/tei:date"/>
+	<xsl:text>. </xsl:text>
+      </xsl:if>
+      <xsl:choose>
+	<xsl:when test="ancestor::tei:listBibl/tei:biblStruct[@xml:id=$refId]/tei:monogr/tei:author[1]">
+	  <xsl:value-of select="substring-before(ancestor::tei:listBibl/tei:biblStruct[@xml:id=$refId]/tei:monogr/tei:author[1], ',')"/>
+	</xsl:when>
+	<xsl:when test="ancestor::tei:listBibl/tei:biblStruct[@xml:id=$refId]/tei:monogr/tei:editor[@role='editor'][1]">
+	  <xsl:value-of select="substring-before(ancestor::tei:listBibl/tei:biblStruct[@xml:id=$refId]/tei:monogr/tei:editor[@role='editor'][1], ',')"/>
+	</xsl:when>
+      </xsl:choose>
+      <xsl:choose>
+	<xsl:when test="ancestor::tei:listBibl/tei:biblStruct[@xml:id=$refId]/tei:monogr/tei:author[3]">
+	  <xsl:text>, </xsl:text>
+	  <xsl:value-of select="substring-before(ancestor::tei:listBibl/tei:biblStruct[@xml:id=$refId]/tei:monogr/tei:author[2], ',')"/>
+	  <xsl:text>, and </xsl:text>
+	</xsl:when>
+	<xsl:when test="ancestor::tei:listBibl/tei:biblStruct[@xml:id=$refId]/tei:monogr/tei:editor[@role='editor'][3]">
+	  <xsl:text>, </xsl:text>
+	  <xsl:value-of select="substring-before(ancestor::tei:listBibl/tei:biblStruct[@xml:id=$refId]/tei:monogr/tei:editor[@role='editor'][2], ',')"/>
+	  <xsl:text>, and </xsl:text>
+	</xsl:when>
+	<xsl:when test="ancestor::tei:listBibl/tei:biblStruct[@xml:id=$refId]/tei:monogr/tei:author[2]">
+	  <xsl:text> and </xsl:text>
+	  <xsl:value-of select="substring-before(ancestor::tei:listBibl/tei:biblStruct[@xml:id=$refId]/tei:monogr/tei:author[2], ',')"/>
+	</xsl:when>
+	<xsl:when test="ancestor::tei:listBibl/tei:biblStruct[@xml:id=$refId]/tei:monogr/tei:editor[@role='editor'][2]">
+	  <xsl:text> and </xsl:text>
+	  <xsl:value-of select="substring-before(ancestor::tei:listBibl/tei:biblStruct[@xml:id=$refId]/tei:monogr/tei:editor[@role='editor'][2], ',')"/>
+	</xsl:when>
+      </xsl:choose>
+      <xsl:if test="ancestor::tei:listBibl/tei:biblStruct[@xml:id=$refId]/tei:monogr/tei:author[3]">
+	<xsl:value-of select="substring-before(ancestor::tei:listBibl/tei:biblStruct[@xml:id=$refId]/tei:monogr/tei:author[3], ',')"/>
+      </xsl:if>
+      <xsl:if test="ancestor::tei:listBibl/tei:biblStruct[@xml:id=$refId]/tei:monogr/tei:editor[@role='editor'][3]">
+	<xsl:value-of select="substring-before(ancestor::tei:listBibl/tei:biblStruct[@xml:id=$refId]/tei:monogr/tei:editor[@role='editor'][3], ',')"/>
+      </xsl:if>
+      <xsl:text> </xsl:text>
+      <xsl:value-of select="following-sibling::tei:monogr/tei:imprint/tei:biblScope[@type='pp']"/>
+      <xsl:text>. </xsl:text>
+    </xsl:if>
+  </xsl:template>
+  
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>[html] processing monogr element as needed for MLA style (from Laura Mandell> </desc>
+  </doc>
+  <xsl:template match="tei:monogr" mode="mla">
+    <xsl:choose>
+      <xsl:when test="preceding-sibling::tei:analytic">
+	<xsl:choose>
+	  <xsl:when test="tei:author = parent::tei:biblStruct/tei:analytic/tei:author">
+	    <xsl:if test="tei:author[2]">
+	      <xsl:apply-templates select="tei:author"/>
+	    </xsl:if>
+	    <xsl:apply-templates select="tei:title"/>
+	    <xsl:if test="tei:edition"><xsl:apply-templates select="tei:edition"/></xsl:if>
+	    <xsl:apply-templates select="tei:editor[@role='editor']"/>
+	    <xsl:if test="tei:editor[@role='translator']">
+	      <xsl:apply-templates select="tei:editor[@role='translator']"/>
+	    </xsl:if>
+	  </xsl:when>
+	  <xsl:otherwise>
+	    <xsl:apply-templates select="tei:author"/>
+	    <xsl:apply-templates select="tei:title"/>
+	    <xsl:if test="tei:edition"><xsl:apply-templates select="tei:edition"/></xsl:if>
+	    <xsl:apply-templates select="tei:editor[@role='editor']"/>
+	    <xsl:if test="tei:editor[@role='translator']">
+	      <xsl:apply-templates select="tei:editor[@role='translator']"/>
+	    </xsl:if>
+	  </xsl:otherwise>
+	</xsl:choose>
+      </xsl:when>
+      <xsl:when test="tei:editor[@role='editor'] and not(preceding-sibling::tei:analytic) and not(tei:author)">
+	<xsl:apply-templates select="tei:editor[@role='editor']"/>
+	<xsl:apply-templates select="tei:title"/>
+	<xsl:if test="tei:edition"><xsl:apply-templates select="tei:edition"/></xsl:if>
+	<xsl:if test="tei:editor[@role='translator']">
+	  <xsl:apply-templates select="tei:editor[@role='translator']"/>
+	</xsl:if>
+      </xsl:when>
+      <xsl:otherwise>
+	<xsl:apply-templates select="tei:author"/>
+	<xsl:apply-templates select="tei:title"/>
+	<xsl:if test="tei:edition"><xsl:apply-templates select="tei:edition"/></xsl:if>
+	<xsl:apply-templates select="tei:editor[@role='editor']"/>
+	<xsl:if test="tei:editor[@role='translator']">
+	  <xsl:apply-templates select="tei:editor[@role='translator']"/>
+	</xsl:if>
+      </xsl:otherwise>
+    </xsl:choose>
+    <xsl:choose>
+      <xsl:when test="*//tei:ref/@target and not(contains(*//tei:ref/@target, '#'))">
+	<xsl:if test="tei:imprint/tei:date[@type='update']"><xsl:value-of select="tei:imprint/tei:date[@type='update']"/></xsl:if>
+      </xsl:when>
+      <xsl:when test="ancestor-or-self::tei:biblStruct/*/tei:title/@level='u'">
+	<xsl:value-of select="tei:imprint"/>
+      </xsl:when>
+      <xsl:when test="tei:title/@level='m'">
+	<xsl:if test="tei:imprint/tei:biblScope/@type='vol'">
+	<xsl:value-of select="tei:imprint/tei:biblScope[@type='vol']"/>. </xsl:if>
+	<xsl:choose>
+	  <xsl:when test="tei:imprint/tei:pubPlace"><xsl:value-of select="tei:imprint/tei:pubPlace"/>: </xsl:when>
+	  <xsl:otherwise>[n.p.]: </xsl:otherwise>
+	</xsl:choose>
+	<xsl:choose>
+	  <xsl:when test="tei:imprint/tei:publisher"><xsl:value-of select="tei:imprint/tei:publisher"/>, </xsl:when>
+	  <xsl:otherwise>[n.p.], </xsl:otherwise>
+	</xsl:choose>
+	<xsl:choose>
+	  <xsl:when test="tei:imprint/tei:date"><xsl:value-of select="tei:imprint/tei:date"/>. </xsl:when>
+	  <xsl:otherwise>[n.d.]  </xsl:otherwise>
+	</xsl:choose>
+      </xsl:when>
+      <xsl:when test="tei:title/@level='j'">
+	<xsl:if test="tei:imprint/tei:biblScope/@type='vol'"><xsl:value-of select="tei:imprint/tei:biblScope[@type='vol']"/></xsl:if>
+	<xsl:if test="tei:imprint/tei:biblScope/@type='no'"><xsl:text>.</xsl:text><xsl:value-of select="tei:imprint/tei:biblScope[@type='no']"/></xsl:if>
+	<xsl:if test="tei:imprint/tei:date"><xsl:text>&#10;</xsl:text>(<xsl:value-of select="tei:imprint/tei:date"/>)</xsl:if>
+	<xsl:if test="tei:imprint/tei:biblScope/@type='pp'">: <xsl:value-of select="tei:imprint/tei:biblScope[@type='pp']"/></xsl:if>
+	<xsl:text>. </xsl:text>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:template>
+  
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>[html] processing relatedItem element as needed for MLA style (from Laura Mandell> </desc>
+  </doc>
+  
+  <xsl:template match="tei:relatedItem" mode="mla">
+    <xsl:if test="@type='otherEdition'"><xsl:text>Rpt. </xsl:text></xsl:if>
+    <xsl:if test="tei:biblStruct/tei:analytic"><xsl:apply-templates select="tei:biblStruct/tei:analytic" mode="mla"/></xsl:if>
+    <xsl:if test="tei:biblStruct/tei:monogr"><xsl:apply-templates select="tei:biblStruct/tei:monogr" mode="mla"/></xsl:if>
+  </xsl:template>
+  
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/core.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/linking.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/linking.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/linking.xsl	(revision 258)
@@ -0,0 +1,560 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml" 
+                xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
+                xmlns:fo="http://www.w3.org/1999/XSL/Format"
+                xmlns:html="http://www.w3.org/1999/xhtml"
+		xmlns:xs="http://www.w3.org/2001/XMLSchema"                
+                xmlns:rng="http://relaxng.org/ns/structure/1.0"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"                
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="2.0"
+                exclude-result-prefixes="a fo rng tei html teix xs">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet dealing with elements from the linking module,
+      making HTML output. </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: linking.xsl 10055 2012-01-20 18:46:11Z rahtz $</p>
+         <p>Copyright: 2011, TEI Consortium</p>
+      </desc>
+   </doc>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process any element and work out a unique identififying string</desc>
+   </doc>
+  <xsl:template match="*" mode="ident">
+      <xsl:variable name="BaseFile">
+         <xsl:value-of select="$masterFile"/>
+         <xsl:call-template name="addCorpusID"/>
+      </xsl:variable>
+
+      <xsl:choose>
+         <xsl:when test="@xml:id and $useIDs='true'">
+            <xsl:value-of select="@xml:id"/>
+         </xsl:when>
+         <xsl:when test="starts-with(local-name(.),'div') or
+			 self::tei:text">
+            <xsl:variable name="xpath">
+               <xsl:for-each select="ancestor-or-self::tei:*">
+	                 <xsl:value-of select="local-name()"/>
+	                 <xsl:text>.</xsl:text>
+	                 <xsl:number/>
+	                 <xsl:if test="not(position() = last())">
+	                    <xsl:text>_</xsl:text>
+	                 </xsl:if>
+	              </xsl:for-each>
+	           </xsl:variable>
+	           <xsl:value-of select="$BaseFile"/>
+	           <xsl:text>-</xsl:text>
+            <xsl:value-of select="substring-after(substring-after($xpath,'_text.'),'_')"/>
+         </xsl:when>
+         <xsl:when test="self::tei:TEI and parent::tei:teiCorpus">
+	   <xsl:value-of select="$masterFile"/>
+	   <xsl:call-template name="addCorpusID"/>
+	 </xsl:when>
+         <xsl:otherwise>
+	   <xsl:value-of select="$BaseFile"/>
+	   <xsl:text>-</xsl:text>
+	   <xsl:value-of select="local-name(.)"/>
+	   <xsl:text>-</xsl:text>
+	   <xsl:value-of select="generate-id()"/>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process elements *</desc>
+   </doc>
+  <xsl:template match="*" mode="generateLink">
+      <xsl:variable name="ident">
+         <xsl:apply-templates mode="ident" select="."/>
+      </xsl:variable>
+      <xsl:variable name="depth">
+         <xsl:apply-templates mode="depth" select="."/>
+      </xsl:variable>
+      <xsl:variable name="Hash">
+         <xsl:text>#</xsl:text>
+      </xsl:variable>
+      <xsl:variable name="result">
+      <xsl:choose>
+	<xsl:when test="$filePerPage='true'">
+	  <xsl:choose>
+	    <xsl:when test="preceding::tei:pb">
+	      <xsl:apply-templates select="preceding::tei:pb[1]"
+				   mode="ident"/>
+	    </xsl:when>
+	    <xsl:otherwise>
+	      <xsl:text>index</xsl:text>
+	    </xsl:otherwise>
+	  </xsl:choose>
+	  <xsl:value-of select="$standardSuffix"/>
+	</xsl:when>
+         <xsl:when test="$STDOUT='true' and number($depth) &lt;= number($splitLevel)">
+            <xsl:value-of select="$masterFile"/>
+            <xsl:value-of select="$standardSuffix"/>
+            <xsl:value-of select="$urlChunkPrefix"/>
+            <xsl:value-of select="$ident"/>
+         </xsl:when>
+         <xsl:when test="ancestor::tei:elementSpec and not($STDOUT='true')">
+	           <xsl:text>ref-</xsl:text>
+	           <xsl:value-of select="ancestor::tei:elementSpec/@ident"/>
+            <xsl:value-of select="$standardSuffix"/>
+	           <xsl:value-of select="concat($Hash,$ident)"/>
+         </xsl:when>
+         <xsl:when test="ancestor::tei:classSpec and not($STDOUT='true')">
+	           <xsl:text>ref-</xsl:text>
+	           <xsl:value-of select="ancestor::tei:classSpec/@ident"/>
+            <xsl:value-of select="$standardSuffix"/>
+	           <xsl:value-of select="concat($Hash,$ident)"/>
+         </xsl:when>
+         <xsl:when test="ancestor::tei:back and not($splitBackmatter)">
+            <xsl:value-of select="concat($Hash,$ident)"/>
+         </xsl:when>
+         <xsl:when test="ancestor::tei:front and not($splitFrontmatter)">
+            <xsl:value-of select="concat($Hash,$ident)"/>
+         </xsl:when>
+	 <xsl:when test="self::tei:text and $splitLevel=0">
+	   <xsl:value-of select="$ident"/>
+	   <xsl:value-of select="$standardSuffix"/>
+	 </xsl:when>
+         <xsl:when test="number($splitLevel)= -1 and
+			 ancestor::tei:teiCorpus">
+            <xsl:value-of select="$masterFile"/>
+            <xsl:call-template name="addCorpusID"/>
+            <xsl:value-of select="$standardSuffix"/>
+            <xsl:value-of select="concat($Hash,$ident)"/>
+         </xsl:when>
+         <xsl:when test="number($splitLevel)= -1">
+            <xsl:value-of select="concat($Hash,$ident)"/>
+         </xsl:when>
+         <xsl:when test="number($depth) &lt;= number($splitLevel)">
+            <xsl:value-of select="concat($ident,$standardSuffix)"/>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:variable name="parent">
+               <xsl:call-template name="locateParentDiv"/>
+            </xsl:variable>
+            <xsl:choose>
+               <xsl:when test="$STDOUT='true'">
+                  <xsl:value-of select="$masterFile"/>
+                  <xsl:value-of select="$urlChunkPrefix"/>
+                  <xsl:value-of select="$parent"/>
+                  <xsl:text>#</xsl:text>
+                  <xsl:value-of select="$ident"/>
+               </xsl:when>
+               <xsl:otherwise>
+                  <xsl:value-of select="$parent"/>
+                  <xsl:value-of select="concat($standardSuffix,'#')"/>
+                  <xsl:value-of select="$ident"/>
+               </xsl:otherwise>
+            </xsl:choose>
+         </xsl:otherwise>
+      </xsl:choose>
+</xsl:variable>
+<!--
+<xsl:message><xsl:value-of select="$ident"/>: <xsl:value-of
+select="$depth"/>: <xsl:value-of select="$splitLevel"/>: <xsl:value-of
+select="$result"/></xsl:message>
+-->
+<xsl:value-of select="$result"/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>
+         <p>Process element TEI in generateLink mode</p>
+         <p>
+            <p xmlns="http://www.w3.org/1999/xhtml"> when a &lt;div&gt; is referenced, see whether its plain
+        anchor, or needs a parent HTML name prepended </p>
+         </p>
+      </desc>
+   </doc>
+  <xsl:template match="tei:TEI" mode="generateLink">
+      <xsl:variable name="BaseFile">
+	<xsl:apply-templates select="." mode="ident"/>
+      </xsl:variable>
+      <xsl:value-of select="concat($BaseFile,$standardSuffix)"/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element anchor</desc>
+   </doc>
+  <xsl:template match="tei:anchor">
+      <xsl:call-template name="makeAnchor"/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process extra elements in generateLink mode</desc>
+   </doc>
+  <xsl:template match="tei:label|tei:figure|tei:table|tei:item|tei:p|tei:bibl|tei:anchor|tei:cell|tei:lg|tei:list|tei:sp"
+                 mode="generateLink">
+      <xsl:variable name="ident">
+         <xsl:apply-templates mode="ident" select="."/>
+      </xsl:variable>
+      <xsl:variable name="file">
+         <xsl:apply-templates mode="generateLink"
+                              select="ancestor::tei:*[starts-with(local-name(),'div')][1]"/>
+      </xsl:variable>
+      <xsl:choose>
+         <xsl:when test="starts-with($file,'#')">
+            <xsl:text>#</xsl:text>
+            <xsl:value-of select="$ident"/>
+         </xsl:when>
+         <xsl:when test="contains($file,'#')">
+            <xsl:value-of select="substring-before($file,'#')"/>
+            <xsl:text>#</xsl:text>
+            <xsl:value-of select="$ident"/>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:value-of select="$file"/>
+            <xsl:text>#</xsl:text>
+            <xsl:value-of select="$ident"/>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process element note</desc>
+   </doc>
+  <xsl:template match="tei:note" mode="generateLink">
+    <xsl:variable name="file">
+      <xsl:apply-templates mode="generateLink"
+			   select="ancestor::tei:*[starts-with(local-name(),'div')][1]"/>
+    </xsl:variable>
+    <xsl:choose>
+      <xsl:when test="starts-with($file,'#')"/>
+      <xsl:when test="contains($file,'#')">
+            <xsl:value-of select="substring-before($file,'#')"/>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:value-of select="$file"/>
+         </xsl:otherwise>
+      </xsl:choose>
+      <xsl:text>#</xsl:text>
+      <xsl:call-template name="noteID"/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[html] <param name="where">where</param>
+      </desc>
+   </doc>
+  <xsl:template name="generateEndLink">
+      <xsl:param name="where"/>
+      <xsl:choose>
+	<xsl:when test="id($where)">
+	  <xsl:apply-templates mode="generateLink" select="id($where)"/>
+	</xsl:when>
+	<xsl:otherwise>
+	  <xsl:text>[[undefined </xsl:text>
+	  <xsl:value-of select="$where"/>
+	  <xsl:text>]]</xsl:text>
+	</xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[html] Find the name of the outermost container for the
+      current object which would create an output file</desc>
+   </doc>
+  <xsl:template name="locateParentDiv">
+
+      <xsl:choose>
+
+	<xsl:when
+	     test="ancestor-or-self::tei:body/parent::tei:text/ancestor::tei:group">
+            <xsl:apply-templates mode="ident" select="ancestor::tei:text[1]"/>
+         </xsl:when>
+
+	 <xsl:when test="ancestor-or-self::tei:front/parent::tei:text/ancestor::tei:group">
+            <xsl:apply-templates mode="ident" select="ancestor::tei:text[1]"/>
+         </xsl:when>
+
+	 <xsl:when test="ancestor-or-self::tei:back/parent::tei:text/ancestor::tei:group">
+            <xsl:apply-templates mode="ident" select="ancestor::tei:text[1]"/>
+         </xsl:when>
+
+         <xsl:when test="ancestor-or-self::tei:div and number($splitLevel) &lt; 0">
+            <xsl:apply-templates mode="ident" select="ancestor::tei:div[last()]"/>
+         </xsl:when>
+
+         <xsl:when test="ancestor-or-self::tei:div">
+	   <xsl:variable name="ancestors" select="count(ancestor-or-self::tei:div)"/>
+	   <xsl:variable name="diff" select="$ancestors - number($splitLevel)"/>
+	   <xsl:variable name="what" select="if ($diff &lt;= 1) then 1
+					     else $diff "/>
+	   <xsl:apply-templates mode="ident" select="ancestor-or-self::tei:div[$what]"/>
+         </xsl:when>
+
+         <xsl:otherwise>
+	   <xsl:variable name="ancestors" select="count(ancestor::tei:*[local-name()='div1'
+				 or local-name()='div2'
+				 or local-name()='div3'
+				 or local-name()='div4'
+				 or local-name()='div5'
+				 or local-name()='div6'])"/>
+	   <xsl:variable name="what"
+			 select="if
+				 ($ancestors &lt; number($splitLevel)) then 1 else
+				 $ancestors - number($splitLevel) +1"/>
+            <xsl:apply-templates mode="ident"
+				 select="ancestor-or-self::tei:*[local-name()='div1'
+				 or local-name()='div2'
+				 or local-name()='div3'
+				 or local-name()='div4'
+				 or local-name()='div5'
+				 or local-name()='div6'][$what]"/>
+         </xsl:otherwise>
+      </xsl:choose>
+
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[html] create external link<param name="ptr">ptr</param>
+         <param name="dest">dest</param>
+         <param name="class">class</param>
+      </desc>
+   </doc>
+  <xsl:template name="makeExternalLink">
+      <xsl:param name="ptr" as="xs:boolean"  select="false()"/>
+      <xsl:param name="dest"/>
+      <xsl:param name="class">link_<xsl:value-of select="local-name(.)"/>
+      </xsl:param>
+      <a>
+        <xsl:choose>
+            <xsl:when test="@rend">
+	              <xsl:attribute name="class">
+	                 <xsl:value-of select="@rend"/>
+	              </xsl:attribute>
+            </xsl:when>
+	           <xsl:when test="@rendition">
+	              <xsl:call-template name="applyRendition"/>
+	           </xsl:when>
+            <xsl:when test="parent::tei:item/parent::tei:list[@rend]">
+	              <xsl:attribute name="class">
+	                 <xsl:value-of select="parent::tei:item/parent::tei:list/@rend"/>
+	              </xsl:attribute>
+            </xsl:when>
+	           <xsl:when test="parent::tei:item[@rend]">
+	              <xsl:attribute name="class">
+	                 <xsl:value-of select="parent::tei:item/@rend"/>
+	              </xsl:attribute>
+            </xsl:when>
+            <xsl:otherwise>
+	              <xsl:attribute name="class">
+	                 <xsl:value-of select="$class"/>
+	              </xsl:attribute>
+            </xsl:otherwise>
+        </xsl:choose>
+
+         <xsl:if test="@type">
+            <xsl:attribute name="type">
+               <xsl:value-of select="@type"/>
+            </xsl:attribute>
+         </xsl:if>
+         <xsl:attribute name="href">
+            <xsl:value-of select="$dest"/>
+            <xsl:if test="contains(@from,'id (')">
+               <xsl:text>#</xsl:text>
+               <xsl:value-of select="substring(@from,5,string-length(normalize-space(@from))-1)"/>
+            </xsl:if>
+         </xsl:attribute>
+	 <xsl:choose>
+	   <xsl:when test="@n">
+	     <xsl:attribute name="title">
+	       <xsl:value-of select="@n"/>
+	     </xsl:attribute>
+	   </xsl:when>
+	 </xsl:choose>
+         <xsl:call-template name="xrefHook"/>
+         <xsl:choose>
+	   <xsl:when test="$dest=''">??</xsl:when>
+            <xsl:when test="$ptr">
+               <xsl:element name="{$urlMarkup}">
+                  <xsl:choose>
+                     <xsl:when test="starts-with($dest,'mailto:')">
+                        <xsl:value-of select="substring-after($dest,'mailto:')"/>
+                     </xsl:when>
+                     <xsl:when test="starts-with($dest,'file:')">
+                        <xsl:value-of select="substring-after($dest,'file:')"/>
+                     </xsl:when>
+                     <xsl:otherwise>
+                        <xsl:value-of select="$dest"/>
+                     </xsl:otherwise>
+                  </xsl:choose>
+               </xsl:element>
+            </xsl:when>
+            <xsl:otherwise>
+               <xsl:apply-templates/>
+            </xsl:otherwise>
+         </xsl:choose>
+      </a>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>[html] create an internal link<param name="target">target</param>
+         <param name="ptr">ptr</param>
+         <param name="dest">dest</param>
+         <param name="body">body</param>
+         <param name="class">class</param>
+      </desc>
+   </doc>
+  <xsl:template name="makeInternalLink">
+      <xsl:param name="target"/>
+      <xsl:param name="ptr" as="xs:boolean" select="false()"/>
+      <xsl:param name="dest"/>
+      <xsl:param name="body"/>
+      <xsl:param name="class">
+         <xsl:text>link_</xsl:text>
+         <xsl:value-of select="local-name(.)"/>
+      </xsl:param>
+      <xsl:variable name="W">
+         <xsl:choose>
+            <xsl:when test="$target">
+               <xsl:value-of select="$target"/>
+            </xsl:when>
+            <xsl:when test="contains($dest,'#')">
+               <xsl:value-of select="substring-after($dest,'#')"/>
+            </xsl:when>
+            <xsl:otherwise>
+               <xsl:value-of select="$dest"/>
+            </xsl:otherwise>
+         </xsl:choose>
+      </xsl:variable>
+
+      <xsl:choose>
+         <xsl:when test="$dest=''">
+            <xsl:choose>
+               <xsl:when test="not($body='')">
+                  <xsl:value-of select="$body"/>
+               </xsl:when>
+               <xsl:when test="$ptr">
+                  <xsl:apply-templates mode="xref" select="id($W)">
+                     <xsl:with-param name="minimal" select="$minimalCrossRef"/>
+                  </xsl:apply-templates>
+               </xsl:when>
+               <xsl:otherwise>
+                  <xsl:apply-templates/>
+               </xsl:otherwise>
+            </xsl:choose>
+         </xsl:when>
+         <xsl:otherwise>
+	   <xsl:variable name="eventualtarget">
+	     <xsl:choose>
+	       <xsl:when test="starts-with($dest,'#') or  contains($dest,$outputSuffix) or contains($dest,'ID=')">
+		 <xsl:value-of select="$dest"/>
+	       </xsl:when>
+	       <xsl:when test="id($W)"/>
+	       <xsl:otherwise>
+		 <xsl:apply-templates mode="generateLink" select="id($W)"/>
+	       </xsl:otherwise>
+	     </xsl:choose>
+	   </xsl:variable>
+	   <xsl:variable name="linktext">
+	     <xsl:choose>
+	       <xsl:when test="not($body='')">
+		 <xsl:value-of select="$body"/>
+	       </xsl:when>
+               <xsl:when test="$ptr and @type='footnote'">
+		 <xsl:text>[</xsl:text>
+		 <xsl:number level="any"/>
+		 <xsl:text>]</xsl:text>
+	       </xsl:when>
+	       <xsl:when test="$ptr and id($W)">
+		 <xsl:apply-templates mode="xref" select="id($W)">
+		   <xsl:with-param name="minimal" select="$minimalCrossRef"/>
+		 </xsl:apply-templates>
+	       </xsl:when>
+	       <xsl:when test="$ptr">
+		 <xsl:value-of select="$dest"/>
+	       </xsl:when>
+	       <xsl:otherwise>
+		 <xsl:apply-templates/>
+	       </xsl:otherwise>
+	     </xsl:choose>
+	   </xsl:variable>
+	   <xsl:choose>
+	     <xsl:when test="$eventualtarget=''">
+	       <xsl:copy-of select="$linktext"/>
+	     </xsl:when>
+	     <xsl:otherwise>
+	       <a href="{$eventualtarget}">
+		 <xsl:call-template name="htmlAttributes"/>
+		 <xsl:choose>
+		   <xsl:when test="@rend">
+		     <xsl:attribute name="class">
+		       <xsl:value-of select="@rend"/>
+		     </xsl:attribute>
+		   </xsl:when>
+		   <xsl:when test="@rendition">
+		     <xsl:call-template name="applyRendition"/>
+		   </xsl:when>
+		   <xsl:when test="string-length($class)=0"/>
+		   <xsl:otherwise>
+		     <xsl:attribute name="class">
+		       <xsl:value-of select="$class"/>
+		     </xsl:attribute>
+		   </xsl:otherwise>
+		 </xsl:choose>
+		 
+		 <xsl:for-each select="id($W)">
+		     <xsl:choose>
+		       <xsl:when test="starts-with(local-name(.),'div')">
+			 <xsl:attribute name="title">
+			   <xsl:value-of
+			       select="translate(normalize-space(tei:head[1]),'&gt;&lt;','')"/>
+			 </xsl:attribute>
+		       </xsl:when>
+		     </xsl:choose>
+		 </xsl:for-each>
+	       <xsl:copy-of select="$linktext"/>
+	       </a>
+	     </xsl:otherwise>
+	   </xsl:choose>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>Process cross-ref to note</desc>
+   </doc>
+  <xsl:template match="tei:note" mode="xref">
+      <xsl:number level="any"/>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+      <desc>formatting of the number part of a header</desc>
+   </doc>
+  <xsl:template name="formatHeadingNumber">
+      <xsl:param name="text"/>
+      <xsl:param name="toc"/>
+      <xsl:if test="not($text='')">
+	<span class="headingNumber">
+	  <xsl:copy-of select="$text"/>
+	</span>
+      </xsl:if>
+  </xsl:template>
+
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/linking.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/oddprocessing.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/oddprocessing.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/oddprocessing.xsl	(revision 258)
@@ -0,0 +1,1189 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet version="2.0"
+  exclude-result-prefixes="#default s html a fo rng tei teix"
+  xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
+  xmlns:fo="http://www.w3.org/1999/XSL/Format"
+  xmlns:html="http://www.w3.org/1999/xhtml"
+  xmlns:rng="http://relaxng.org/ns/structure/1.0"
+  xmlns:s="http://www.ascc.net/xml/schematron"
+  xmlns:tei="http://www.tei-c.org/ns/1.0"
+  xmlns:teix="http://www.tei-c.org/ns/Examples"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns="http://www.w3.org/1999/xhtml" >
+
+  <xsl:param name="cssFile"/>
+  <xsl:param name="cssSecondaryFile"/>
+  <xsl:param name="summaryDoc">false</xsl:param>
+  <xsl:include href="../common2/tagdocs.xsl"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+    <desc>
+      <p> TEI stylesheet dealing with elements from the tagdocs module,
+      making HTML output. </p>
+      <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+      <p>Author: See AUTHORS</p>
+      <p>Id: $Id: oddprocessing.xsl 10030 2012-01-12 17:06:23Z rahtz $</p>
+      <p>Copyright: 2011, TEI Consortium</p>
+    </desc>
+  </doc>
+  <xsl:param name="oddmode">html</xsl:param>
+  <xsl:param name="xrefName">a</xsl:param>
+  <xsl:param name="urlName">href</xsl:param>
+  <xsl:param name="ulName">ul</xsl:param>
+  <xsl:param name="dlName">dl</xsl:param>
+  <xsl:param name="codeName">span</xsl:param>
+  <xsl:param name="colspan">colspan</xsl:param>
+  <xsl:param name="ddName">dd</xsl:param>
+  <xsl:param name="dtName">dt</xsl:param>
+  <xsl:param name="hiName">span</xsl:param>
+  <xsl:param name="itemName">li</xsl:param>
+  <xsl:param name="labelName">dt</xsl:param>
+  <xsl:param name="rendName">class</xsl:param>
+  <xsl:param name="rowName">tr</xsl:param>
+  <xsl:param name="tableName">table</xsl:param>
+  <xsl:param name="cellName">td</xsl:param>
+  <xsl:param name="divName">div</xsl:param>
+  <xsl:param name="sectionName">div</xsl:param>
+  <xsl:param name="segName">span</xsl:param>
+  <xsl:param name="outputNS">http://www.w3.org/1999/xhtml</xsl:param>
+  <xsl:key match="tei:*" name="NameToID" use="@ident"/>
+  <xsl:key name="MODEL-CLASS-MODULE" match="tei:classSpec[@type='model']" use="@module"/>
+  <xsl:key name="ATT-CLASS-MODULE" match="tei:classSpec[@type='atts']" use="@module"/>
+  <xsl:key name="ELEMENT-MODULE" match="tei:elementSpec" use="@module"/>
+  <xsl:key name="MACRO-MODULE" match="tei:macroSpec" use="@module"/>
+  <xsl:key name="ELEMENT-ALPHA" match="tei:elementSpec" use="substring(translate(@ident,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz'),1,1)"/>
+  <xsl:key name="MODEL-CLASS-ALPHA" match="tei:classSpec[@type='model']" use="substring(translate(@ident,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz'),7,1)"/>
+  <xsl:key name="ATT-CLASS-ALPHA" match="tei:classSpec[@type='atts']" use="substring(translate(@ident,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz'),5,1)"/>
+  <xsl:key match="tei:moduleSpec[@ident]" name="FILES" use="@ident"/>
+  <xsl:variable name="top" select="/"/>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>[odds] Document an element, macro, or class</desc>
+  </doc>
+  <xsl:template name="refdoc">
+    <xsl:if test="$verbose='true'">
+      <xsl:message> refdoc for <xsl:value-of select="name(.)"/> - <xsl:value-of select="@ident"/>
+         </xsl:message>
+    </xsl:if>
+    <xsl:variable name="objectname">
+      <xsl:choose>
+        <xsl:when test="tei:altIdent">
+          <xsl:value-of select="tei:altIdent"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="@ident"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:variable name="name">
+      <xsl:value-of select="$objectname"/>
+    </xsl:variable>
+    <xsl:choose>
+      <xsl:when test="self::tei:classSpec and not(@ident='att.global') and         count(key('CLASSMEMBERS',@ident))=0">
+        <xsl:if test="$verbose='true'">
+          <xsl:message> class <xsl:value-of select="@ident"/> omitted as it has no members
+      </xsl:message>
+        </xsl:if>
+      </xsl:when>
+      <xsl:when test="number($splitLevel)=-1 or $STDOUT='true'">
+        <xsl:apply-templates mode="weavebody" select="."/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:variable name="BaseFile">
+          <xsl:value-of select="$masterFile"/>
+          <xsl:if test="ancestor::tei:teiCorpus">
+            <xsl:text>-</xsl:text>
+            <xsl:choose>
+              <xsl:when test="@xml:id">
+                <xsl:value-of select="@xml:id"/>
+              </xsl:when>
+              <xsl:otherwise>
+                <xsl:number/>
+              </xsl:otherwise>
+            </xsl:choose>
+          </xsl:if>
+        </xsl:variable>
+        <xsl:variable name="outName">
+          <xsl:call-template name="outputChunkName">
+            <xsl:with-param name="ident">
+              <xsl:text>ref-</xsl:text>
+              <xsl:value-of select="@ident"/>
+            </xsl:with-param>
+          </xsl:call-template>
+        </xsl:variable>
+        <xsl:if test="$verbose='true'">
+          <xsl:message>Opening file <xsl:value-of select="$outName"/>
+               </xsl:message>
+        </xsl:if>
+        <xsl:variable name="documentationLanguage">
+          <xsl:call-template name="generateDoc"/>
+        </xsl:variable>
+        <xsl:variable name="langs">
+          <xsl:value-of select="concat(normalize-space($documentationLanguage),' ')"/>
+        </xsl:variable>
+        <xsl:result-document doctype-public="{$doctypePublic}" doctype-system="{$doctypeSystem}" encoding="{$outputEncoding}" href="{$outName}" method="{$outputMethod}">
+          <xsl:element name="html" namespace="{$outputNamespace}">
+            <xsl:call-template name="addLangAtt"/>
+            <xsl:comment>THIS IS A GENERATED FILE. DO NOT EDIT (7) </xsl:comment>
+            <head>
+              <title>
+                <xsl:text>TEI </xsl:text>
+                <xsl:value-of select="substring-before(local-name(),'Spec')"/>
+                <xsl:text> </xsl:text>
+                <xsl:value-of select="$name"/>
+                <xsl:text> </xsl:text>
+                <xsl:call-template name="makeGloss">
+                  <xsl:with-param name="langs" select="$langs"/>
+                </xsl:call-template>
+              </title>
+              <xsl:call-template name="metaHTML">
+                <xsl:with-param name="title">
+                  <xsl:value-of select="substring-before(local-name(),'Spec')"/>
+                  <xsl:text> </xsl:text>
+                  <xsl:value-of select="@ident"/>
+                  <xsl:text> </xsl:text>
+                  <xsl:call-template name="makeGloss">
+                    <xsl:with-param name="langs" select="$langs"/>
+                  </xsl:call-template>
+                  <xsl:text> - </xsl:text>
+                  <xsl:call-template name="generateTitle"/>
+                </xsl:with-param>
+              </xsl:call-template>
+              <xsl:call-template name="includeCSS"/>
+              <xsl:call-template name="generateLocalCSS"/>
+              <xsl:call-template name="includeJavascript"/>
+              <xsl:call-template name="javascriptHook"/>
+            </head>
+            <body id="TOP">
+              <xsl:call-template name="bodyMicroData"/>
+              <xsl:call-template name="bodyHook"/>
+              <xsl:call-template name="guidelinesTop">
+                <xsl:with-param name="name">
+                  <xsl:value-of select="$name"/>
+                </xsl:with-param>
+              </xsl:call-template>
+              <div class="main-content">
+                <xsl:call-template name="startDivHook"/>
+                <xsl:apply-templates mode="weavebody" select="."/>
+              </div>
+              <xsl:call-template name="stdfooter">
+                <xsl:with-param name="file">
+                  <xsl:text>ref-</xsl:text>
+                  <xsl:value-of select="@ident"/>
+                </xsl:with-param>
+              </xsl:call-template>
+              <xsl:call-template name="bodyEndHook"/>
+            </body>
+          </xsl:element>
+        </xsl:result-document>
+        <xsl:if test="$verbose='true'">
+          <xsl:message>Closing file <xsl:value-of select="$outName"/>
+               </xsl:message>
+        </xsl:if>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>[html] Provide a footer for each reference document</desc>
+  </doc>
+  <xsl:template name="refdocFooter">
+    <xsl:call-template name="preAddressHook"/>
+    <div style="margin: 20pt; font-weight: bold;">
+      <a href="{$refDocFooterURL}">
+        <xsl:value-of select="$refDocFooterText"/>
+      </a>
+    </div>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>[html] <param name="text">text</param>
+      </desc>
+  </doc>
+  <xsl:template name="typewriter">
+    <xsl:param name="text"/>
+    <code>
+      <xsl:copy-of select="$text"/>
+    </code>
+  </xsl:template>
+  <xsl:template name="showRNC">
+    <xsl:param name="style"/>
+    <xsl:param name="contents"/>
+    <span class="{$style}">
+      <xsl:choose>
+        <xsl:when test="string-length($contents)&lt;50">
+          <xsl:value-of select="$contents"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:call-template name="verbatim-reformatText">
+            <xsl:with-param name="sofar">0</xsl:with-param>
+            <xsl:with-param name="indent">
+              <xsl:text> </xsl:text>
+            </xsl:with-param>
+            <xsl:with-param name="text">
+              <xsl:value-of select="$contents"/>
+            </xsl:with-param>
+          </xsl:call-template>
+        </xsl:otherwise>
+      </xsl:choose>
+    </span>
+  </xsl:template>
+  <xsl:template name="emptySlash">
+    <xsl:param name="name"/>
+    <span class="emptySlash">
+      <xsl:value-of select="$name"/>
+    </span>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>Process elements teix:egXML</desc>
+  </doc>
+  <xsl:template match="teix:egXML">
+    <xsl:param name="simple">false</xsl:param>
+    <xsl:param name="highlight"/>
+    <div>
+      <xsl:attribute name="id">
+        <xsl:apply-templates mode="ident" select="."/>
+      </xsl:attribute>
+      <xsl:attribute name="class">
+	<xsl:text>pre</xsl:text>
+	<xsl:if test="not(*)">
+	  <xsl:text> cdata</xsl:text>
+	</xsl:if>
+	<xsl:choose>
+	  <xsl:when test="@valid='feasible'">
+	    <xsl:text> egXML_feasible</xsl:text>
+	  </xsl:when>
+	  <xsl:when test="@valid='false'">
+	    <xsl:text> egXML_invalid</xsl:text>
+	  </xsl:when>
+	  <xsl:otherwise>
+	    <xsl:text> egXML_valid</xsl:text>
+	  </xsl:otherwise>
+	</xsl:choose>
+      </xsl:attribute>
+      <xsl:choose>
+        <xsl:when test="$simple='true'">
+          <xsl:apply-templates mode="verbatim">
+            <xsl:with-param name="highlight">
+              <xsl:value-of select="$highlight"/>
+            </xsl:with-param>
+          </xsl:apply-templates>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:call-template name="egXMLStartHook"/>
+          <xsl:apply-templates mode="verbatim">
+            <xsl:with-param name="highlight">
+              <xsl:value-of select="$highlight"/>
+            </xsl:with-param>
+          </xsl:apply-templates>
+          <xsl:call-template name="egXMLEndHook"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </div>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>[html] <param name="grammar">grammar</param>
+         <param name="content">content</param>
+         <param name="element">element</param>
+      </desc>
+  </doc>
+  <xsl:template name="bitOut">
+    <xsl:param name="grammar"/>
+    <xsl:param name="content"/>
+    <xsl:param name="element">pre</xsl:param>
+    <xsl:choose>
+      <xsl:when test="$displayMode='both'">
+        <div class="displayRelax">
+          <button class="displayRelaxButton">
+            <span class="RNG_Compact">
+              <xsl:call-template name="i18n">
+                <xsl:with-param name="word">Compact to XML format</xsl:with-param>
+              </xsl:call-template>
+            </span>
+            <span class="RNG_XML">
+              <xsl:call-template name="i18n">
+                <xsl:with-param name="word">XML format to compact</xsl:with-param>
+              </xsl:call-template>
+            </span>
+          </button>
+          <pre class="RNG_XML">
+            <xsl:apply-templates mode="verbatim" select="$content/*/*"/>
+          </pre>
+          <pre class="RNG_Compact">
+            <xsl:call-template name="make-body-from-r-t-f">
+              <xsl:with-param name="schema">
+                <xsl:for-each select="$content/*">
+                  <xsl:call-template name="make-compact-schema"/>
+                </xsl:for-each>
+              </xsl:with-param>
+            </xsl:call-template>
+          </pre>
+        </div>
+      </xsl:when>
+      <xsl:when test="$displayMode='rng'">
+        <xsl:element name="{$element}">
+          <xsl:attribute name="class">eg</xsl:attribute>
+          <xsl:apply-templates mode="verbatim" select="$content/*/*"/>
+        </xsl:element>
+      </xsl:when>
+      <xsl:when test="$displayMode='rnc'">
+        <xsl:element name="{$element}">
+          <xsl:attribute name="class">eg</xsl:attribute>
+          <xsl:call-template name="make-body-from-r-t-f">
+            <xsl:with-param name="schema">
+              <xsl:for-each select="$content/*">
+                <xsl:call-template name="make-compact-schema"/>
+              </xsl:for-each>
+            </xsl:with-param>
+          </xsl:call-template>
+        </xsl:element>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:element name="{$element}">
+          <xsl:attribute name="class">eg</xsl:attribute>
+          <xsl:for-each select="$content/*">
+            <xsl:apply-templates mode="literal"/>
+          </xsl:for-each>
+        </xsl:element>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <xsl:template name="showSpace">
+    <xsl:text> </xsl:text>
+  </xsl:template>
+  <xsl:template name="showSpaceBetweenItems">
+    <xsl:text> </xsl:text>
+  </xsl:template>
+  <xsl:template match="tei:schemaSpec">
+    <xsl:choose>
+      <xsl:when test="tei:specGrpRef">
+        <xsl:variable name="SPECS">
+          <tei:schemaSpec>
+            <xsl:copy-of select="@*"/>
+            <xsl:apply-templates mode="expandSpecs"/>
+          </tei:schemaSpec>
+        </xsl:variable>
+        <xsl:for-each select="$SPECS/tei:schemaSpec">
+          <xsl:call-template name="schemaSpecWeave"/>
+        </xsl:for-each>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="schemaSpecWeave"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <xsl:template name="schemaSpecWeave">
+    <xsl:if test="$verbose='true'">
+      <xsl:message>Processing schemaSpec <xsl:value-of select="@ident"/>, summaryDoc=<xsl:value-of select="$summaryDoc"/>
+         </xsl:message>
+    </xsl:if>
+    <xsl:choose>
+      <xsl:when test="$summaryDoc='true'">
+        <h2>Schema <xsl:value-of select="@ident"/>: changed components</h2>
+        <xsl:for-each select="tei:classSpec[@mode or @rend='change']        | tei:macroSpec[(@mode or @rend='change')]        | tei:elementSpec[(@mode or @rend='change')]">
+          <xsl:sort select="@ident"/>
+          <xsl:apply-templates mode="weave" select="."/>
+        </xsl:for-each>
+        <h2>Schema <xsl:value-of select="@ident"/>:  unchanged  components</h2>
+        <table>
+          <xsl:for-each select="tei:classSpec[not(@mode or @rend)]          | tei:macroSpec[not(@mode or  @rend)]          | tei:elementSpec[not(@mode or @rend)]">
+            <xsl:sort select="@ident"/>
+            <tr>
+              <td id="{@ident}"><a href="http://www.tei-c.org/release/doc/tei-p5-doc/{$documentationLanguage}/html/ref-{@ident}.html"><xsl:value-of select="@ident"/></a>:
+		     <xsl:call-template name="makeDescription"/></td>
+            </tr>
+          </xsl:for-each>
+        </table>
+      </xsl:when>
+      <xsl:otherwise>
+        <h2>Schema <xsl:value-of select="@ident"/>: Elements</h2>
+        <xsl:apply-templates mode="weave" select="tei:elementSpec">
+          <xsl:sort select="@ident"/>
+        </xsl:apply-templates>
+        <xsl:if test="tei:classSpec[@type='model']">
+          <h2>Schema <xsl:value-of select="@ident"/>: Model classes</h2>
+          <xsl:apply-templates mode="weave" select="tei:classSpec[@type='model']">
+            <xsl:sort select="@ident"/>
+          </xsl:apply-templates>
+        </xsl:if>
+        <xsl:if test="tei:classSpec[@type='atts']">
+          <h2>Schema <xsl:value-of select="@ident"/>: Attribute classes</h2>
+          <xsl:apply-templates mode="weave" select="tei:classSpec[@type='atts']">
+            <xsl:sort select="@ident"/>
+          </xsl:apply-templates>
+        </xsl:if>
+        <xsl:if test="tei:macroSpec">
+          <h2>Schema <xsl:value-of select="@ident"/>: Macros</h2>
+          <xsl:apply-templates mode="weave" select="tei:macroSpec">
+            <xsl:sort select="@ident"/>
+          </xsl:apply-templates>
+        </xsl:if>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>[odds] make a link<param name="name">name</param>
+         <param name="id">id</param>
+      </desc>
+  </doc>
+  <xsl:template name="makeSectionHead">
+    <xsl:param name="name"/>
+    <xsl:param name="id"/>
+    <h3>
+      <xsl:attribute name="class">
+      <xsl:text>oddSpec</xsl:text>
+      <xsl:if test="@status">
+	<xsl:text> status_</xsl:text>
+	<xsl:value-of select="@status"/>
+      </xsl:if>
+      </xsl:attribute>
+      <xsl:call-template name="makeAnchor">
+        <xsl:with-param name="name">
+          <xsl:value-of select="$id"/>
+        </xsl:with-param>
+      </xsl:call-template>
+      <xsl:value-of select="$name"/>
+      <xsl:if test="@ns">
+	[<xsl:value-of select="@ns"/>]
+      </xsl:if>
+    </h3>
+  </xsl:template>
+  <xsl:template name="specHook">
+    <xsl:param name="name"/>
+  </xsl:template>
+  <xsl:template match="tei:ident">
+    <xsl:choose>
+      <xsl:when test="@type='class' and key('CLASSES',.)">
+        <xsl:call-template name="linkTogether">
+          <xsl:with-param name="name">
+            <xsl:value-of select="."/>
+          </xsl:with-param>
+          <xsl:with-param name="reftext">
+            <xsl:value-of select="."/>
+          </xsl:with-param>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:when test="@type">
+        <span class="ident-{@type}">
+          <xsl:apply-templates/>
+        </span>
+      </xsl:when>
+      <xsl:otherwise>
+        <span class="ident">
+          <xsl:apply-templates/>
+        </span>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <xsl:template match="tei:gi">
+    <xsl:variable name="lookup" select="."/>
+    <xsl:choose>
+      <xsl:when test="parent::tei:ref or parent::tei:head or string-length(@scheme)&gt;0">
+        <span class="gi">
+          <xsl:text>&lt;</xsl:text>
+          <xsl:apply-templates/>
+          <xsl:text>&gt;</xsl:text>
+        </span>
+      </xsl:when>
+      <xsl:when test="key('ELEMENTS',$lookup)">
+        <xsl:for-each select="key('ELEMENTS',$lookup)[last()]">
+          <xsl:call-template name="linkTogether">
+            <xsl:with-param name="class">gi</xsl:with-param>
+            <xsl:with-param name="name">
+              <xsl:value-of select="@ident"/>
+            </xsl:with-param>
+            <xsl:with-param name="reftext">
+              <xsl:choose>
+                <xsl:when test="tei:content/rng:empty">
+                  <span class="emptySlash">
+                    <xsl:value-of select="(tei:altIdent|@ident)[last()]"/>
+                  </span>
+                </xsl:when>
+                <xsl:otherwise>
+                  <xsl:value-of select="(tei:altIdent|@ident)[last()]"/>
+                </xsl:otherwise>
+              </xsl:choose>
+            </xsl:with-param>
+          </xsl:call-template>
+        </xsl:for-each>
+      </xsl:when>
+      <xsl:otherwise>
+        <span class="gi">
+          <xsl:text>&lt;</xsl:text>
+          <xsl:apply-templates/>
+          <xsl:text>&gt;</xsl:text>
+        </span>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <xsl:template name="processSchemaFragment">
+    <xsl:param name="filename"/>
+    <div class="schemaFragment">
+      <xsl:if test="tei:elementSpec">
+        <h2>
+          <xsl:call-template name="i18n">
+            <xsl:with-param name="word">Elements defined</xsl:with-param>
+          </xsl:call-template>
+        </h2>
+        <xsl:apply-templates mode="weave" select="tei:elementSpec">
+          <xsl:sort select="tei:altIdent|@ident"/>
+        </xsl:apply-templates>
+      </xsl:if>
+      <xsl:if test="tei:classSpec">
+        <h2>
+          <xsl:call-template name="i18n">
+            <xsl:with-param name="word">Classes defined</xsl:with-param>
+          </xsl:call-template>
+        </h2>
+        <xsl:apply-templates mode="weave" select="tei:classSpec">
+          <xsl:sort select="tei:altIdent|@ident"/>
+        </xsl:apply-templates>
+      </xsl:if>
+      <xsl:if test="tei:macroSpec">
+        <h2>
+          <xsl:call-template name="i18n">
+            <xsl:with-param name="word">Macros defined</xsl:with-param>
+          </xsl:call-template>
+        </h2>
+        <xsl:apply-templates mode="weave" select="tei:macroSpec">
+          <xsl:sort select="tei:altIdent|@ident"/>
+        </xsl:apply-templates>
+      </xsl:if>
+      <xsl:apply-templates select="tei:specGrpRef"/>
+    </div>
+  </xsl:template>
+  <xsl:template name="listSpecs">
+    <xsl:for-each select="..//tei:schemaSpec">
+      <hr/>
+      <xsl:for-each select="tei:classSpec">
+        <xsl:sort select="tei:altIdent"/>
+        <xsl:sort select="@ident"/>
+        <xsl:element name="{$tocElement}">
+          <xsl:attribute name="class">toclist0</xsl:attribute>
+          <a class="toclist" href="#{@ident}">
+            <xsl:choose>
+              <xsl:when test="tei:altIdent">
+                <xsl:value-of select="tei:altIdent"/>
+              </xsl:when>
+              <xsl:otherwise>
+                <xsl:value-of select="@ident"/>
+              </xsl:otherwise>
+            </xsl:choose>
+          </a>
+        </xsl:element>
+      </xsl:for-each>
+      <hr/>
+      <xsl:for-each select="tei:elementSpec">
+        <xsl:sort select="tei:altIdent"/>
+        <xsl:sort select="@ident"/>
+        <xsl:element name="{$tocElement}">
+          <xsl:attribute name="class">toclist0</xsl:attribute>
+          <a class="toclist" href="#{@ident}">
+            <xsl:choose>
+              <xsl:when test="tei:altIdent">
+                <xsl:value-of select="tei:altIdent"/>
+              </xsl:when>
+              <xsl:otherwise>
+                <xsl:value-of select="@ident"/>
+              </xsl:otherwise>
+            </xsl:choose>
+          </a>
+        </xsl:element>
+      </xsl:for-each>
+      <hr/>
+      <xsl:for-each select="tei:macroSpec">
+        <xsl:sort select="tei:altIdent"/>
+        <xsl:sort select="@ident"/>
+        <xsl:element name="{$tocElement}">
+          <xsl:attribute name="class">toclist0</xsl:attribute>
+          <a class="toclist" href="#{@ident}">
+            <xsl:choose>
+              <xsl:when test="tei:altIdent">
+                <xsl:value-of select="tei:altIdent"/>
+              </xsl:when>
+              <xsl:otherwise>
+                <xsl:value-of select="@ident"/>
+              </xsl:otherwise>
+            </xsl:choose>
+          </a>
+        </xsl:element>
+      </xsl:for-each>
+    </xsl:for-each>
+  </xsl:template>
+  <xsl:template match="tei:elementSpec[@mode='delete']">
+    <dt>Element <xsl:value-of select="@ident"/>
+      </dt>
+    <dd>
+      <b>DELETED</b>
+    </dd>
+  </xsl:template>
+  <xsl:template name="verbatim-lineBreak">
+    <xsl:param name="id"/>
+    <xsl:text disable-output-escaping="yes">&lt;br/&gt;</xsl:text>
+  </xsl:template>
+  <xsl:template match="rng:ref/@name" mode="attributetext">
+    <xsl:variable name="me">
+      <xsl:choose>
+        <xsl:when test="contains(.,'.attributes')">
+          <xsl:value-of select="substring-before(.,'.attributes')"/>
+        </xsl:when>
+        <xsl:when test="contains(.,'.content')">
+          <xsl:value-of select="substring-before(.,'.content')"/>
+        </xsl:when>
+        <xsl:when test="contains(.,'.attribute.')">
+          <xsl:value-of select="substring-before(.,'.attribute.')"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="."/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:variable name="n" select="."/>
+    <xsl:choose>
+      <xsl:when test="contains(.,'.localattributes')">
+        <xsl:value-of select="$n"/>
+      </xsl:when>
+      <xsl:when test="contains(.,'.content')">
+        <xsl:value-of select="$n"/>
+      </xsl:when>
+      <xsl:when test="ancestor::teix:egXML">
+        <xsl:value-of select="$n"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:for-each select="$top">
+          <xsl:call-template name="linkTogether">
+            <xsl:with-param name="name">
+              <xsl:value-of select="$me"/>
+            </xsl:with-param>
+            <xsl:with-param name="reftext">
+              <xsl:value-of select="$n"/>
+            </xsl:with-param>
+          </xsl:call-template>
+        </xsl:for-each>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <xsl:template match="rng:*">
+    <xsl:copy>
+      <xsl:copy-of select="@*"/>
+      <xsl:apply-templates select="rng:*|tei:*|text()|comment()"/>
+    </xsl:copy>
+  </xsl:template>
+  <xsl:template match="rng:zeroOrMore">
+    <xsl:choose>
+      <xsl:when test="count(rng:*)=1 and rng:zeroOrMore">
+        <xsl:apply-templates select="rng:*|tei:*|text()|comment()"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <rng:zeroOrMore>
+          <xsl:copy-of select="@*"/>
+          <xsl:apply-templates select="rng:*|tei:*|text()|comment()"/>
+        </rng:zeroOrMore>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <xsl:template match="tei:listRef" mode="weave"/>
+  <xsl:template match="tei:elementSpec[@mode='delete']" mode="weave"/>
+  <xsl:template match="a:documentation" mode="verbatim"/>
+  <xsl:template match="tei:ptr[@type='cit']">
+    <a class="citlink">
+      <xsl:for-each select="id(substring(@target,2))">
+        <xsl:attribute name="href">
+          <xsl:apply-templates select="." mode="generateLink"/>
+        </xsl:attribute>
+        <xsl:apply-templates select="." mode="xref"/>
+      </xsl:for-each>
+    </a>
+  </xsl:template>
+  <xsl:template match="tei:divGen[@type='macrocat']" priority="100">
+    <h3>Alphabetical list</h3>
+    <xsl:for-each select="key('MACRODOCS',1)">
+      <xsl:sort select="@module"/>
+      <xsl:if test="generate-id(.)=generate-id(key('MACRO-MODULE',@module)[1])">
+        <div id="macro-{@module}">
+          <h3>
+            <xsl:for-each select="key('MODULES',@module)">
+              <xsl:text>[</xsl:text>
+              <xsl:value-of select="@ident"/>
+              <xsl:text>] </xsl:text>
+              <xsl:call-template name="makeDescription"/>
+            </xsl:for-each>
+          </h3>
+          <xsl:for-each select="key('MACRO-MODULE',@module)">
+            <xsl:sort select="@ident"/>
+            <xsl:call-template name="refDocLink"/>
+          </xsl:for-each>
+        </div>
+      </xsl:if>
+    </xsl:for-each>
+    <xsl:apply-templates mode="weave" select="key('MACRODOCS',1)">
+      <xsl:sort select="@ident"/>
+    </xsl:apply-templates>
+  </xsl:template>
+  <xsl:template match="tei:divGen[@type='elementcat']"  priority="100">
+    <div class="atozwrapper">
+      <xsl:call-template name="atozHeader">
+        <xsl:with-param name="Key">ELEMENT-ALPHA</xsl:with-param>
+      </xsl:call-template>
+      <xsl:for-each select="key('ELEMENTDOCS',1)">
+        <xsl:sort select="lower-case(@ident)"/>
+        <xsl:variable name="letter">
+          <xsl:value-of select="substring(@ident,1,1)"/>
+        </xsl:variable>
+        <xsl:if test="generate-id(.)=generate-id(key('ELEMENT-ALPHA',$letter)[1])">
+          <div id="element-{$letter}" class="atoz">
+            <span class="listhead">
+              <xsl:value-of select="$letter"/>
+            </span>
+            <ul class="atoz">
+              <xsl:for-each select="key('ELEMENT-ALPHA',$letter)">
+                <xsl:sort select="@ident"/>
+                <li>
+		  <xsl:call-template name="refDocLink"/>
+                </li>
+              </xsl:for-each>
+            </ul>
+          </div>
+        </xsl:if>
+      </xsl:for-each>
+    </div>
+    <div id="byMod">
+      <xsl:for-each select="key('ELEMENTDOCS',1)">
+        <xsl:sort select="@module"/>
+        <xsl:if test="generate-id(.)=generate-id(key('ELEMENT-MODULE',@module)[1])">
+          <div>
+            <h3>
+              <xsl:for-each select="key('MODULES',@module)">
+                <xsl:text>[</xsl:text>
+                <xsl:value-of select="@ident"/>
+                <xsl:text>] </xsl:text>
+                <xsl:call-template name="makeDescription"/>
+              </xsl:for-each>
+            </h3>
+            <xsl:for-each select="key('ELEMENT-MODULE',@module)">
+              <xsl:sort
+		  select="@ident"/>
+	      <xsl:call-template name="refDocLink"/>
+	    </xsl:for-each>
+          </div>
+        </xsl:if>
+      </xsl:for-each>
+    </div>
+    <xsl:for-each select="key('ELEMENTDOCS',1)">
+      <xsl:apply-templates mode="weave" select="."/>
+    </xsl:for-each>
+  </xsl:template>
+
+
+  <xsl:template name="refDocLink">
+    <span
+	class="refDocLink">
+      <a>
+	<xsl:attribute name="href">
+	  <xsl:choose>
+	    <xsl:when test="number($splitLevel)=-1 or $STDOUT='true'">
+	      <xsl:text>#</xsl:text>
+	      <xsl:value-of select="@ident"/>
+	    </xsl:when>
+	    <xsl:otherwise>
+	      <xsl:text>ref-</xsl:text>
+	      <xsl:value-of
+		  select="@ident"/>
+	      <xsl:value-of select="$outputSuffix"/>
+	    </xsl:otherwise>
+	  </xsl:choose>
+	</xsl:attribute>
+	<xsl:value-of select="@ident"/>
+      </a>
+      <xsl:text> </xsl:text>
+    </span>
+  </xsl:template>
+
+  <xsl:template match="tei:divGen[@type='modelclasscat']"  priority="100">
+    <div class="atozwrapper">
+      <xsl:call-template name="atozHeader">
+        <xsl:with-param name="Key">MODEL-CLASS-ALPHA</xsl:with-param>
+      </xsl:call-template>
+      <xsl:for-each select="key('MODELCLASSDOCS',1)">
+        <xsl:sort select="lower-case(substring-after(@ident,'model.'))"/>
+        <xsl:variable name="letter">
+          <xsl:value-of select="substring(@ident,7,1)"/>
+        </xsl:variable>
+        <xsl:if test="generate-id(.)=generate-id(key('MODEL-CLASS-ALPHA',$letter)[1])">
+          <div id="element-{$letter}" class="atoz">
+            <span class="listhead">
+              <xsl:value-of select="$letter"/>
+            </span>
+            <ul class="atoz">
+              <xsl:for-each select="key('MODEL-CLASS-ALPHA',$letter)">
+                <xsl:sort select="lower-case(substring-after(@ident,'model.'))"/>
+                <li>
+		  <xsl:call-template name="refDocLink"/>
+                </li>
+              </xsl:for-each>
+            </ul>
+          </div>
+        </xsl:if>
+      </xsl:for-each>
+    </div>
+    <div id="byMod">
+      <xsl:for-each select="key('MODELCLASSDOCS',1)">
+        <xsl:sort select="@module"/>
+        <xsl:if test="generate-id(.)=generate-id(key('MODEL-CLASS-MODULE',@module)[1])">
+          <div>
+            <h3>
+              <xsl:for-each select="key('MODULES',@module)">
+                <xsl:text>[</xsl:text>
+                <xsl:value-of select="@ident"/>
+                <xsl:text>] </xsl:text>
+                <xsl:call-template name="makeDescription"/>
+              </xsl:for-each>
+            </h3>
+            <xsl:for-each select="key('MODEL-CLASS-MODULE',@module)">
+              <xsl:sort
+		  select="@ident"/>
+	      <xsl:call-template name="refDocLink"/>
+            </xsl:for-each>
+          </div>
+        </xsl:if>
+      </xsl:for-each>
+    </div>
+    <xsl:for-each select="key('MODELCLASSDOCS',1)">
+      <xsl:apply-templates select="." mode="weave"/>
+    </xsl:for-each>
+  </xsl:template>
+  <xsl:template match="tei:divGen[@type='attclasscat']"  priority="100">
+    <div class="atozwrapper">
+      <xsl:call-template name="atozHeader">
+        <xsl:with-param name="Key">ATT-CLASS-ALPHA</xsl:with-param>
+      </xsl:call-template>
+      <xsl:for-each select="key('ATTCLASSDOCS',1)">
+        <xsl:sort select="lower-case(substring-after(@ident,'att.'))"/>
+        <xsl:variable name="letter">
+          <xsl:value-of select="substring(@ident,5,1)"/>
+        </xsl:variable>
+        <xsl:if test="generate-id(.)=generate-id(key('ATT-CLASS-ALPHA',$letter)[1])">
+          <div id="element-{$letter}" class="atoz">
+            <span class="listhead">
+              <xsl:value-of select="$letter"/>
+            </span>
+            <ul class="atoz">
+              <xsl:for-each select="key('ATT-CLASS-ALPHA',$letter)">
+                <xsl:sort select="lower-case(substring-after(@ident,'att.'))"/>
+                <li>
+		  <xsl:call-template name="refDocLink"/>
+		</li>
+              </xsl:for-each>
+            </ul>
+          </div>
+        </xsl:if>
+      </xsl:for-each>
+    </div>
+    <div id="byMod">
+      <xsl:for-each select="key('ATTCLASSDOCS',1)">
+        <xsl:sort select="@module"/>
+        <xsl:if test="generate-id(.)=generate-id(key('ATT-CLASS-MODULE',@module)[1])">
+          <div>
+            <h3>
+              <xsl:for-each select="key('MODULES',@module)">
+                <xsl:text>[</xsl:text>
+                <xsl:value-of select="@ident"/>
+                <xsl:text>] </xsl:text>
+                <xsl:call-template name="makeDescription"/>
+              </xsl:for-each>
+            </h3>
+            <xsl:for-each
+		select="key('ATT-CLASS-MODULE',@module)">
+	      <xsl:call-template name="refDocLink"/>
+            </xsl:for-each>
+          </div>
+        </xsl:if>
+      </xsl:for-each>
+    </div>
+    <xsl:apply-templates mode="weave" select="key('ATTCLASSDOCS',1)">
+      <xsl:sort select="@ident"/>
+    </xsl:apply-templates>
+  </xsl:template>
+  <xsl:template name="javascriptHook">
+    <xsl:call-template name="jsForOdds"/>
+  </xsl:template>
+  <xsl:template name="jsForOdds">
+    <script type="text/javascript">
+      <xsl:comment>
+        <xsl:text disable-output-escaping="yes">
+var displayXML=0;
+states=new Array()
+states[0]="element-a"
+states[1]="element-b"
+states[2]="element-c"
+states[3]="element-d"
+states[4]="element-e"
+states[5]="element-f"
+states[6]="element-g"
+states[7]="element-h"
+states[8]="element-i"
+states[9]="element-j"
+states[10]="element-k"
+states[11]="element-l"
+states[12]="element-m"
+states[13]="element-n"
+states[14]="element-o"
+states[15]="element-p"
+states[16]="element-q"
+states[17]="element-r"
+states[18]="element-s"
+states[19]="element-t"
+states[20]="element-u"
+states[21]="element-v"
+states[22]="element-w"
+states[23]="element-x"
+states[24]="element-y"
+states[25]="element-z"
+
+function startUp() {
+
+}
+
+function hideallExcept(elm) {
+for (var i = 0; i &lt; states.length; i++) {
+ var layer;
+ if (layer = document.getElementById(states[i]) ) {
+  if (states[i] != elm) {
+    layer.style.display = "none";
+  }
+  else {
+   layer.style.display = "block";
+      }
+  }
+ }
+ var mod;
+ if ( mod = document.getElementById('byMod') ) {
+     mod.style.display = "none";
+ }
+}
+
+function showall() {
+ for (var i = 0; i &lt; states.length; i++) {
+   var layer;
+   if (layer = document.getElementById(states[i]) ) {
+      layer.style.display = "block";
+      }
+  }
+}
+
+function showByMod() {
+  hideallExcept('');
+  var mod;
+  if (mod = document.getElementById('byMod') ) {
+     mod.style.display = "block";
+     }
+}
+
+	</xsl:text>
+      </xsl:comment>
+    </script>
+  </xsl:template>
+
+  <xsl:template name="identifyElement">
+    <xsl:param name="id"/>
+    <xsl:attribute name="id">
+      <xsl:value-of select="$id"/>
+    </xsl:attribute>
+  </xsl:template>
+
+  <xsl:template name="guidelinesTop">
+    <xsl:param name="name"/>
+    <div id="hdr">
+      <xsl:call-template name="stdheader">
+        <xsl:with-param name="title">
+          <xsl:value-of select="$name"/>
+        </xsl:with-param>
+      </xsl:call-template>
+    </div>
+  </xsl:template>
+
+  <xsl:template name="atozHeader">
+    <xsl:param name="Key"/>
+    <div id="azindex">
+      <span>
+        <xsl:call-template name="i18n">
+          <xsl:with-param name="word">Sorted alphabetically</xsl:with-param>
+        </xsl:call-template>
+      </span>
+      <ul class="index">
+        <xsl:if test="count(key($Key,'a'))&gt;0">
+          <li>
+            <a onclick="hideallExcept('element-a');" href="#">a</a>
+          </li>
+        </xsl:if>
+        <xsl:if test="count(key($Key,'b'))&gt;0">
+          <li>
+            <a onclick="hideallExcept('element-b');" href="#">b</a>
+          </li>
+        </xsl:if>
+        <xsl:if test="count(key($Key,'c'))&gt;0">
+          <li>
+            <a onclick="hideallExcept('element-c');" href="#">c</a>
+          </li>
+        </xsl:if>
+        <xsl:if test="count(key($Key,'d'))&gt;0">
+          <li>
+            <a onclick="hideallExcept('element-d');" href="#">d</a>
+          </li>
+        </xsl:if>
+        <xsl:if test="count(key($Key,'e'))&gt;0">
+          <li>
+            <a onclick="hideallExcept('element-e');" href="#">e</a>
+          </li>
+        </xsl:if>
+        <xsl:if test="count(key($Key,'f'))&gt;0">
+          <li>
+            <a onclick="hideallExcept('element-f');" href="#">f</a>
+          </li>
+        </xsl:if>
+        <xsl:if test="count(key($Key,'g'))&gt;0">
+          <li>
+            <a onclick="hideallExcept('element-g');" href="#">g</a>
+          </li>
+        </xsl:if>
+        <xsl:if test="count(key($Key,'h'))&gt;0">
+          <li>
+            <a onclick="hideallExcept('element-h');" href="#">h</a>
+          </li>
+        </xsl:if>
+        <xsl:if test="count(key($Key,'i'))&gt;0">
+          <li>
+            <a onclick="hideallExcept('element-i');" href="#">i</a>
+          </li>
+        </xsl:if>
+        <xsl:if test="count(key($Key,'j'))&gt;0">
+          <li>
+            <a onclick="hideallExcept('element-j');" href="#">j</a>
+          </li>
+        </xsl:if>
+        <xsl:if test="count(key($Key,'k'))&gt;0">
+          <li>
+            <a onclick="hideallExcept('element-k');" href="#">k</a>
+          </li>
+        </xsl:if>
+        <xsl:if test="count(key($Key,'l'))&gt;0">
+          <li>
+            <a onclick="hideallExcept('element-l');" href="#">l</a>
+          </li>
+        </xsl:if>
+        <xsl:if test="count(key($Key,'m'))&gt;0">
+          <li>
+            <a onclick="hideallExcept('element-m');" href="#">m</a>
+          </li>
+        </xsl:if>
+        <xsl:if test="count(key($Key,'n'))&gt;0">
+          <li>
+            <a onclick="hideallExcept('element-n');" href="#">n</a>
+          </li>
+        </xsl:if>
+        <xsl:if test="count(key($Key,'o'))&gt;0">
+          <li>
+            <a onclick="hideallExcept('element-o');" href="#">o</a>
+          </li>
+        </xsl:if>
+        <xsl:if test="count(key($Key,'p'))&gt;0">
+          <li>
+            <a onclick="hideallExcept('element-p');" href="#">p</a>
+          </li>
+        </xsl:if>
+        <xsl:if test="count(key($Key,'q'))&gt;0">
+          <li>
+            <a onclick="hideallExcept('element-q');" href="#">q</a>
+          </li>
+        </xsl:if>
+        <xsl:if test="count(key($Key,'r'))&gt;0">
+          <li>
+            <a onclick="hideallExcept('element-r');" href="#">r</a>
+          </li>
+        </xsl:if>
+        <xsl:if test="count(key($Key,'s'))&gt;0">
+          <li>
+            <a onclick="hideallExcept('element-s');" href="#">s</a>
+          </li>
+        </xsl:if>
+        <xsl:if test="count(key($Key,'t'))&gt;0">
+          <li>
+            <a onclick="hideallExcept('element-t');" href="#">t</a>
+          </li>
+        </xsl:if>
+        <xsl:if test="count(key($Key,'u'))&gt;0">
+          <li>
+            <a onclick="hideallExcept('element-u');" href="#">u</a>
+          </li>
+        </xsl:if>
+        <xsl:if test="count(key($Key,'v'))&gt;0">
+          <li>
+            <a onclick="hideallExcept('element-v');" href="#">v</a>
+          </li>
+        </xsl:if>
+        <xsl:if test="count(key($Key,'w'))&gt;0">
+          <li>
+            <a onclick="hideallExcept('element-w');" href="#">w</a>
+          </li>
+        </xsl:if>
+        <xsl:if test="count(key($Key,'x'))&gt;0">
+          <li>
+            <a onclick="hideallExcept('element-x');" href="#">x</a>
+          </li>
+        </xsl:if>
+        <xsl:if test="count(key($Key,'y'))&gt;0">
+          <li>
+            <a onclick="hideallExcept('element-y');" href="#">y</a>
+          </li>
+        </xsl:if>
+        <xsl:if test="count(key($Key,'z'))&gt;0">
+          <li>
+            <a onclick="hideallExcept('element-z');" href="#">z</a>
+          </li>
+        </xsl:if>
+        <li class="showall">
+          <a onclick="showall();" href="#">
+            <xsl:call-template name="i18n">
+              <xsl:with-param name="word">Show all</xsl:with-param>
+            </xsl:call-template>
+          </a>
+        </li>
+        <li class="showall">
+          <a onclick="showByMod();" href="#">
+            <xsl:call-template name="i18n">
+              <xsl:with-param name="word">Show by module</xsl:with-param>
+            </xsl:call-template>
+          </a>
+        </li>
+      </ul>
+    </div>
+  </xsl:template>
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/xhtml2/oddprocessing.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/rnc/build-to.xml
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/rnc/build-to.xml	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/rnc/build-to.xml	(revision 258)
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="utf-8"?>
+<project basedir="." default="dist" name="teitornc">
+    <!--
+        This library is free software; you can redistribute it and/or
+        modify it under the terms of the GNU Lesser General Public
+        License as published by the Free Software Foundation; either
+        version 2.1 of the License, or (at your option) any later version.
+        
+        This library 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
+        Lesser General Public License for more details.
+        
+        You should have received a copy of the GNU Lesser General Public
+        License along with this library; if not, write to the Free Software
+        Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+        
+        Id: $Id: build-to.xml 9316 2011-09-13 08:06:05Z rahtz $
+        Copyright: 2011, TEI Consortium<
+    -->
+    <!--
+        Convert TEI documents into RNC schemas.
+    -->
+    <!-- Path to TEI XML file. -->
+    <property name="inputFile" value=""/>
+    <!-- Path where the output schema file will be saved. -->
+    <property name="outputFile" value=""/>
+    <!-- which profile -->
+    <property name="profile" value="default"/>
+    <!-- where does oxygen keep stuff -->
+    <property name="oxygenlib" value=""/>
+    <dirname property="inputFileDir" file="${inputFile}"/>
+    <dirname property="outputDir" file="${outputFile}"/>
+    <property name="outputTempDir" value="${outputDir}/temp-dir-for-ant"/>
+    <!-- The input file for the TRANG transformation. -->
+    <property name="trangInputFile" value="${outputFile}.rng"/>
+    
+    <path id="classpath">
+        <pathelement path="${java.class.path}"/>
+    </path>
+    
+    <!-- Use the Relax NG target to obtain a Relax NG schema and afterward transform it
+        to RNC using TRANG. -->
+    <target name="trangConvert">
+        <!-- Obtain a Relax NG schema.  -->
+        <ant antfile="../relaxng/build-to.xml" dir="../relaxng"/>
+        <!-- The Relax NG was generated inside the output file. -->
+        <copy file="${outputFile}" tofile="${trangInputFile}"/>
+        
+        <echo level="info">TRANG generate RNC from RELAXNG files</echo>
+        <java classname="com.thaiopensource.relaxng.translate.Driver" fork="no">
+            <classpath>
+                <path refid="classpath"/>
+                <pathelement location="${oxygenlib}/trang.jar"/>
+            </classpath>
+            <!-- Even though the output type is inferred from the output file extension,
+                make sure it's the right one. -->
+            <arg value="-O"/>
+            <arg value="rnc"/>
+            <arg value="${trangInputFile}" />
+            <arg value="${outputFile}" />
+        </java>
+    </target>
+    
+    <target name="cleanup" unless="debug">
+        <!-- Delete the intermediate Relax NG schema. -->
+        <delete file="${trangInputFile}"/>
+    </target>
+    
+    <target name="dist" depends="trangConvert, cleanup"/>
+    
+</project>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/rnc/build-to.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/slides/teilatex-slides.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/slides/teilatex-slides.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/slides/teilatex-slides.xsl	(revision 258)
@@ -0,0 +1,392 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+-->
+<!-- 
+TEI XSLT stylesheet family
+$Date: 2011-11-07 19:17:54 +0000 (Mon, 07 Nov 2011) $, $Revision: 9669 $, $Author: rahtz $
+
+XSL LaTeX stylesheet to make slides
+
+   
+--><xsl:stylesheet xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:atom="http://www.w3.org/2005/Atom"
+                xmlns:rng="http://relaxng.org/ns/structure/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
+                xmlns:s="http://www.ascc.net/xml/schematron"
+                xmlns:map="http://apache.org/cocoon/sitemap/1.0"
+                exclude-result-prefixes="a s map atom xhtml teix tei xsl rng"
+                version="2.0">
+  <xsl:import href="../latex2/tei.xsl"/>
+  <xsl:strip-space elements="teix:* rng:* xsl:* xhtml:* atom:*"/>
+  <xsl:output method="text" encoding="utf-8"/>
+  <xsl:variable name="docClass">beamer</xsl:variable>
+  <xsl:param name="startNamespace">\color{black}</xsl:param>
+  <xsl:param name="startElement">{\color{blue}</xsl:param>
+  <xsl:param name="startElementName">\textbf{\color{blue}</xsl:param>
+  <xsl:param name="startAttribute">{\color{blue}</xsl:param>
+  <xsl:param name="startAttributeValue">{\color{blue}</xsl:param>
+  <xsl:param name="startComment">\textit{</xsl:param>
+  <xsl:param name="endElement">}</xsl:param>
+  <xsl:param name="endElementName">}</xsl:param>
+  <xsl:param name="endComment">}</xsl:param>
+  <xsl:param name="endAttribute">}</xsl:param>
+  <xsl:param name="endAttributeValue">}</xsl:param>
+  <xsl:param name="endNamespace"/>
+  <xsl:param name="spaceCharacter">\hspace*{1em}</xsl:param>
+  <xsl:param name="classParameters"/>
+  <xsl:param name="beamerClass">PaloAlto</xsl:param>
+  <xsl:param name="pause">true</xsl:param>
+
+  <xsl:template name="verbatim-lineBreak">
+      <xsl:param name="id"/>
+      <xsl:text>\mbox{}\newline &#10;</xsl:text>
+  </xsl:template>
+
+  <xsl:template name="latexPackages">
+\usepackage{framed}
+\definecolor{shadecolor}{gray}{0.95}
+\usepackage{colortbl}
+\usepackage{longtable}
+\usetheme{<xsl:value-of select="$beamerClass"/>}
+\usepackage{times}
+\usepackage{fancyvrb}
+\usepackage{fancyhdr}
+\def\Gin@extensions{.pdf,.png,.jpg,.mps,.tif}
+\setbeamercovered{transparent}
+\let\mainmatter\relax
+\let\frontmatter\relax
+\let\backmatter\relax
+\let\endfoot\relax
+\let\endlastfoot\relax
+</xsl:template>
+
+   <xsl:template name="latexBegin"/>
+
+  <xsl:template name="latexLayout">
+\date{<xsl:value-of select="/tei:TEI/tei:teiHeader/tei:fileDesc/tei:editionStmt/tei:edition/tei:date"/>}
+\institute{<xsl:apply-templates select="/tei:TEI/tei:teiHeader/tei:fileDesc/tei:publicationStmt/tei:authority"/>}
+<xsl:if test="not($latexLogo='')">
+         <xsl:text>\pgfdeclareimage[height=1cm]{logo}{</xsl:text>
+         <xsl:choose>
+            <xsl:when test="$realFigures='true'">
+               <xsl:value-of select="$latexLogo"/>
+            </xsl:when>
+            <xsl:otherwise>
+               <xsl:text>FIG0</xsl:text>
+            </xsl:otherwise>
+         </xsl:choose>
+         <xsl:text>}</xsl:text>
+\logo{\pgfuseimage{logo}}
+</xsl:if>
+   </xsl:template>
+
+   <xsl:template match="tei:authority/tei:address/tei:addrLine">
+ \newline <xsl:apply-templates/>
+   </xsl:template> 
+
+   <xsl:template name="printTitleAndLogo">
+     \frame{\maketitle}
+   </xsl:template>
+
+   <xsl:template match="tei:divGen[@type='toc']">
+  \begin{frame} 
+  \frametitle{Outline} 
+  \tableofcontents
+  \end{frame}
+</xsl:template>
+
+   <xsl:template match="tei:div/tei:head"/>
+   <xsl:template match="tei:div1/tei:head"/>
+   <xsl:template match="tei:div2/tei:head"/>
+
+   <xsl:template match="tei:div1">
+      <xsl:choose>
+         <xsl:when test="tei:div2">
+            <xsl:call-template name="makeOuterFrame"/>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:call-template name="makeFrame"/>
+         </xsl:otherwise>
+      </xsl:choose>
+   </xsl:template>
+
+   <xsl:template match="tei:div2|tei:div3">
+      <xsl:call-template name="makeFrame"/>
+   </xsl:template>
+
+   <xsl:template match="tei:div">
+      <xsl:choose>
+         <xsl:when test="tei:div and parent::tei:body">
+            <xsl:call-template name="makeOuterFrame"/>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:call-template name="makeFrame"/>
+         </xsl:otherwise>
+      </xsl:choose>
+   </xsl:template>
+
+   <xsl:template name="makeOuterFrame">
+      <xsl:text>&#10;\section{</xsl:text>
+      <xsl:for-each select="tei:head">
+         <xsl:apply-templates/>
+      </xsl:for-each>
+      <xsl:text>}</xsl:text>
+      <xsl:text>&#10;\begin{frame}&#10;\frametitle{</xsl:text>
+      <xsl:for-each select="tei:head">
+         <xsl:apply-templates/>
+      </xsl:for-each>
+      <xsl:text>}</xsl:text>
+      <xsl:choose>
+	        <xsl:when test="tei:*[not(starts-with(local-name(.),'div'))]">
+	           <xsl:apply-templates select="tei:*[not(starts-with(local-name(.),'div'))]"/>
+	        </xsl:when>
+	        <xsl:otherwise>
+	           <xsl:text>{\Huge…}</xsl:text>
+	        </xsl:otherwise>
+      </xsl:choose>
+      <xsl:text>&#10;\end{frame}&#10;</xsl:text>
+      <xsl:apply-templates select="tei:div1|tei:div2|tei:div"/>
+  </xsl:template>
+
+   <xsl:template name="makeFrame">
+      <xsl:text>&#10;\begin{frame}</xsl:text>
+      <xsl:choose>
+         <xsl:when test="@rend='fragile'">
+            <xsl:text>[fragile]</xsl:text>
+         </xsl:when>
+         <xsl:when test=".//tei:eg">
+            <xsl:text>[fragile]</xsl:text>
+         </xsl:when>
+         <xsl:when test=".//tei:Output">
+            <xsl:text>[fragile]</xsl:text>
+         </xsl:when>
+         <xsl:when test=".//tei:Screen">
+            <xsl:text>[fragile]</xsl:text>
+         </xsl:when>
+         <xsl:when test=".//teix:egXML">
+            <xsl:text>[fragile]</xsl:text>
+         </xsl:when>
+      </xsl:choose>
+      <xsl:text>&#10;\frametitle{</xsl:text>
+      <xsl:for-each select="tei:head">
+         <xsl:apply-templates/>
+      </xsl:for-each>
+      <xsl:text>}</xsl:text>
+      <xsl:apply-templates/>
+      <xsl:text>&#10;\end{frame}&#10;</xsl:text>
+   </xsl:template>
+
+   <xsl:template name="makePic">
+      <xsl:if test="@xml:id">
+         <xsl:text>\hypertarget{</xsl:text>
+         <xsl:value-of select="@xml:id"/>
+         <xsl:text>}{}</xsl:text>
+      </xsl:if>
+      <xsl:if test="@rend='centre'">
+         <xsl:text>\centerline{</xsl:text>
+      </xsl:if>
+      <xsl:text>\includegraphics[</xsl:text>
+      <xsl:call-template name="graphicsAttributes">
+         <xsl:with-param name="mode">latex</xsl:with-param>
+      </xsl:call-template>
+      <xsl:if test="not(@width) and not (@height) and not(@scale)">
+         <xsl:text>width=\textwidth</xsl:text>
+      </xsl:if>
+      <xsl:text>]{</xsl:text>
+      <xsl:choose>
+         <xsl:when test="@url">
+            <xsl:value-of select="@url"/>
+         </xsl:when>
+         <xsl:when test="@entity">
+            <xsl:value-of select="unparsed-entity-uri(@entity)"/>
+         </xsl:when>
+      </xsl:choose>
+      <xsl:text>}</xsl:text>
+      <xsl:if test="@rend='centre'">
+         <xsl:text>}</xsl:text>
+      </xsl:if>
+   </xsl:template>
+
+   <xsl:template match="tei:hi[not(@rend)]">
+      <xsl:text>\alert{</xsl:text>
+      <xsl:apply-templates/>
+      <xsl:text>}</xsl:text>
+   </xsl:template>
+
+   <xsl:template match="tei:item[@rend='pause' or parent::tei:list/@rend='pause']">
+      <xsl:if test="$pause='true'">
+         <xsl:text>\pause </xsl:text>
+      </xsl:if>
+      <xsl:text>\item </xsl:text>
+      <xsl:apply-templates/>
+   </xsl:template>
+
+   <xsl:template match="tei:eg">
+      <xsl:text>\begin{Verbatim}[fontsize=\scriptsize,frame=single,fillcolor=\color{yellow}]&#10;</xsl:text>
+      <xsl:apply-templates mode="eg"/>
+      <xsl:text>\end{Verbatim}&#10;</xsl:text>
+   </xsl:template>
+
+  <xsl:template match="text()" mode="eg">
+      <xsl:choose>
+         <xsl:when test="starts-with(.,'&#xA;')">
+            <xsl:value-of select="substring-after(.,'&#xA;')"/>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:value-of select="."/>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="teix:egXML">
+      <xsl:param name="simple">false</xsl:param>
+      <xsl:param name="highlight"/>
+      <xsl:variable name="fontsize">
+         <xsl:choose>
+            <xsl:when test="@rend='teeny'">
+	              <xsl:text>{5.5pt}{6pt}</xsl:text>
+            </xsl:when>
+            <xsl:when test="@rend='tiny'">
+	              <xsl:text>{6.5pt}{7pt}</xsl:text>
+            </xsl:when>
+            <xsl:when test="@rend='small'">
+	              <xsl:text>{7pt}{8pt}</xsl:text>
+            </xsl:when>
+            <xsl:when test="@rend='smaller'">
+	              <xsl:text>{7.5pt}{8pt}</xsl:text>
+            </xsl:when>
+            <xsl:when test="@rend='larger'">
+	              <xsl:text>{9.5pt}{10.5pt}</xsl:text>
+            </xsl:when>
+            <xsl:when test="@rend='large'">
+	              <xsl:text>{10.5pt}{11.5pt}</xsl:text>
+            </xsl:when>
+            <xsl:otherwise>
+	              <xsl:text>{8.5pt}{9pt}</xsl:text>
+            </xsl:otherwise>
+         </xsl:choose>
+      </xsl:variable>
+\bgroup\ttfamily\fontsize<xsl:value-of select="$fontsize"/>\selectfont\par
+\begin{exampleblock}{}
+<xsl:text>\noindent\ttfamily\mbox{}</xsl:text>
+      <xsl:apply-templates mode="verbatim">
+         <xsl:with-param name="highlight">
+            <xsl:value-of select="$highlight"/>
+         </xsl:with-param>
+      </xsl:apply-templates>
+\end{exampleblock}
+\par\egroup
+  </xsl:template>
+
+  <xsl:template match="tei:p[@rend='box']">
+      <xsl:text>\par\begin{exampleblock}{}&#10;</xsl:text>
+      <xsl:apply-templates/>
+      <xsl:text>\end{exampleblock}\par&#10;</xsl:text>
+  </xsl:template>
+
+
+   <xsl:template match="tei:table">
+      <xsl:text>\par  
+  \begin{scriptsize}
+  \begin{longtable}</xsl:text>
+      <xsl:call-template name="makeTable"/>
+      <xsl:text>\end{longtable}
+  \end{scriptsize}</xsl:text>
+   </xsl:template>
+
+  <xsl:template name="makeFigureStart">
+    \noindent
+  </xsl:template>
+
+  <xsl:template name="makeFigureEnd">
+      <xsl:choose>
+         <xsl:when test="tei:head">
+            <xsl:text>&#10;\par\noindent\textit{</xsl:text>
+            <xsl:if test="@xml:id">\label{<xsl:value-of select="@xml:id"/>}</xsl:if>
+            <xsl:for-each select="tei:head">
+	      <xsl:apply-templates/>
+	    </xsl:for-each>
+            <xsl:text>}\par</xsl:text>
+         </xsl:when>
+      </xsl:choose>
+
+  </xsl:template>
+
+   <xsl:template name="tableHline">
+      <xsl:text> \hline </xsl:text>
+   </xsl:template>
+
+   <xsl:template match="tei:att">
+      <xsl:text>\emph{@</xsl:text>
+      <xsl:apply-templates/>
+      <xsl:text>}</xsl:text>
+
+   </xsl:template>
+
+
+  <xsl:template name="Text">
+      <xsl:param name="words"/>
+      <xsl:analyze-string select="$words" regex="(&amp;)">
+	<xsl:matching-substring>
+            <xsl:text>&amp;amp;</xsl:text>
+	</xsl:matching-substring>
+	<xsl:non-matching-substring>
+	  <xsl:value-of select="tei:escapeChars(.)"/>
+	</xsl:non-matching-substring>
+      </xsl:analyze-string>
+  </xsl:template>
+
+
+   <xsl:template match="@*" mode="attributetext">
+      <xsl:choose>
+         <xsl:when test="string-length(.)&gt;$attLength and contains(.,' ')">
+            <xsl:call-template name="verbatim-reformatText">
+	              <xsl:with-param name="sofar">0</xsl:with-param>
+	              <xsl:with-param name="indent">
+	                 <xsl:text> </xsl:text>
+	              </xsl:with-param>
+	              <xsl:with-param name="text">
+	                 <xsl:value-of select="normalize-space(tei:escapeChars(.))"/>
+	              </xsl:with-param>
+            </xsl:call-template>
+         </xsl:when>
+         <xsl:otherwise>
+	           <xsl:value-of select="tei:escapeChars(.)"/>
+         </xsl:otherwise>
+      </xsl:choose>
+   </xsl:template>
+
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/slides/teilatex-slides.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/slides/teihtml-slides.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/slides/teihtml-slides.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/slides/teihtml-slides.xsl	(revision 258)
@@ -0,0 +1,532 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml" 
+		xmlns:atom="http://www.w3.org/2005/Atom"
+                xmlns:rng="http://relaxng.org/ns/structure/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"                
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:xlink="http://www.w3.org/1999/xlink"
+                xmlns:m="http://www.w3.org/1998/Math/MathML"
+                xmlns:xhtml="http://www.w3.org/1999/xhtml"
+                exclude-result-prefixes="tei xlink xhtml m"
+                version="2.0">
+  <xsl:import href="../xhtml2/tei.xsl"/>
+
+  <xsl:strip-space elements="teix:* rng:* xsl:* xhtml:* atom:* m:*"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p>
+      TEI stylesheet for making HTML presentations from TEI documents
+      </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: teihtml-slides.xsl 9669 2011-11-07 19:17:54Z rahtz $</p>
+         <p>Copyright: 2011, TEI Consortium</p>
+      </desc>
+   </doc>
+  <xsl:output encoding="utf-8" method="xml" doctype-public="-//W3C//DTD XHTML 1.1//EN"/>
+  <xsl:param name="outputEncoding">utf-8</xsl:param>
+  <xsl:param name="outputMethod">xml</xsl:param>
+  <xsl:param name="outputSuffix">.xhtml</xsl:param>
+  <xsl:param name="doctypePublic">-//W3C//DTD XHTML 1.1//EN</xsl:param>
+  <xsl:param name="doctypeSystem">http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd</xsl:param>
+  <xsl:param name="cssFile">http://www.tei-c.org/stylesheet/teislides.css</xsl:param>
+  <xsl:param name="logoFile">logo.png</xsl:param>
+  <xsl:param name="logoWidth">60</xsl:param>
+  <xsl:param name="logoHeight">60</xsl:param>
+  <xsl:param name="spaceCharacter">&#160;</xsl:param>
+  <xsl:template name="lineBreak">
+      <xsl:param name="id"/>
+      <xhtml:br/>
+  </xsl:template>
+   <!--
+<xsl:text>(</xsl:text>
+<xsl:value-of select="$id"/>
+<xsl:text>)</xsl:text>
+-->
+  <xsl:param name="numberHeadings"/>
+  <xsl:param name="splitLevel">0</xsl:param>
+  <xsl:param name="STDOUT">false</xsl:param>
+  <xsl:param name="subTocDepth">-1</xsl:param>
+  <xsl:param name="topNavigationPanel"/>
+  <xsl:param name="bottomNavigationPanel">true</xsl:param>
+  <xsl:param name="linkPanel"/>
+  <xsl:template name="copyrightStatement"/>
+  <xsl:param name="makingSlides">true</xsl:param>
+
+  <xsl:template match="tei:div" mode="number">
+      <xsl:number level="any"/>
+  </xsl:template>
+
+
+  <xsl:template name="locateParentDiv">
+    <xsl:choose>
+      <xsl:when test="ancestor-or-self::tei:div">
+	<xsl:apply-templates mode="genid" select="ancestor::tei:div[last()]"/>
+      </xsl:when>
+      <xsl:when test="ancestor-or-self::tei:div1">
+	<xsl:apply-templates mode="genid" select="ancestor::tei:div1"/>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="tei:*" mode="genid">
+    <xsl:value-of select="$masterFile"/>
+    <xsl:apply-templates select="ancestor-or-self::tei:div1|ancestor-or-self::tei:div[1]" mode="number"/>
+  </xsl:template>
+
+  <xsl:template match="tei:docAuthor">
+      <div class="docAuthor">
+         <xsl:apply-templates/>
+      </div>
+  </xsl:template>
+
+  <xsl:template match="tei:docDate">
+      <div class="docDate">
+         <xsl:apply-templates/>
+      </div>
+  </xsl:template>
+
+  <xsl:template match="/tei:TEI">
+      <xsl:param name="slidenum">
+         <xsl:value-of select="$masterFile"/>0</xsl:param>
+
+      <xsl:variable name="outName">
+         <xsl:call-template name="outputChunkName">
+	           <xsl:with-param name="ident">
+	              <xsl:value-of select="$slidenum"/>
+	           </xsl:with-param>
+         </xsl:call-template>
+      </xsl:variable>
+
+      <xsl:if test="$verbose='true'">
+         <xsl:message>Opening file <xsl:value-of select="$outName"/>
+         </xsl:message>
+      </xsl:if>
+      <xsl:result-document doctype-public="{$doctypePublic}" doctype-system="{$doctypeSystem}"
+                           encoding="{$outputEncoding}"
+                           href="{$outName}"
+                           method="{$outputMethod}">
+         <xsl:call-template name="mainslide"/>
+      </xsl:result-document>
+      <xsl:if test="$verbose='true'">
+         <xsl:message>Closing file <xsl:value-of select="$outName"/>
+         </xsl:message>
+      </xsl:if>
+
+      <xsl:for-each select="tei:text/tei:body">
+         <xsl:apply-templates select="tei:div|tei:div1"/>
+      </xsl:for-each>
+  </xsl:template>
+
+  <xsl:template name="xrefpanel">
+      <xsl:param name="homepage"/>
+      <xsl:param name="mode"/>
+      <xsl:variable name="first">
+         <xsl:value-of select="$masterFile"/>0</xsl:variable>
+      <xsl:variable name="prev">
+         <xsl:choose>
+            <xsl:when test="preceding-sibling::tei:div">
+               <xsl:apply-templates select="preceding-sibling::tei:div[1]" mode="genid"/>
+            </xsl:when>
+            <xsl:when test="preceding::tei:div">
+               <xsl:apply-templates select="preceding::tei:div[1]" mode="genid"/>
+            </xsl:when>
+            <xsl:when test="preceding::tei:div1">
+               <xsl:apply-templates select="preceding::tei:div1[1]" mode="genid"/>
+            </xsl:when>
+         </xsl:choose>
+      </xsl:variable>
+      <xsl:if test="not($prev='')">
+         <a class="xreflink" accesskey="p" href="{concat($prev,$outputSuffix)}">
+            <span class="button">«</span>
+         </a>
+      </xsl:if>
+      <xsl:text>  </xsl:text>
+      <a class="xreflink" accesskey="f" href="{concat($first,$outputSuffix)}">
+         <span class="button">^</span>
+      </a>
+      <xsl:variable name="next">
+         <xsl:choose>
+            <xsl:when test="tei:div">
+               <xsl:apply-templates select="tei:div[1]" mode="genid"/>
+	           </xsl:when>
+            <xsl:when test="following-sibling::tei:div">
+               <xsl:apply-templates select="following-sibling::tei:div[1]" mode="genid"/>
+            </xsl:when>
+            <xsl:when test="following::tei:div">
+               <xsl:apply-templates select="following::tei:div[1]" mode="genid"/>
+            </xsl:when>
+            <xsl:when test="following::tei:div1">
+               <xsl:apply-templates select="following::tei:div1[1]" mode="genid"/>
+            </xsl:when>
+         </xsl:choose>
+      </xsl:variable>
+      <xsl:if test="not($next='')">
+         <a class="xreflink" accesskey="n" href="{concat($next,$outputSuffix)}">
+            <span class="button">»</span>
+         </a>
+      </xsl:if>
+      <xsl:text> </xsl:text>
+      <xsl:apply-templates select="." mode="number"/>
+  </xsl:template>
+
+  <xsl:template name="mainslide">
+      <html>
+         <xsl:call-template name="addLangAtt"/>
+         <head>
+            <title>
+               <xsl:call-template name="generateTitle"/>
+            </title>
+            <xsl:call-template name="includeCSS"/>
+            <xsl:call-template name="cssHook"/>
+            <xsl:call-template name="javascriptHook"/>
+         </head>
+         <body>
+            <div class="slidetitle" style="font-size: 36pt;">
+               <xsl:call-template name="generateTitle"/>
+            </div>
+            <div class="slidemain">
+               <xsl:apply-templates select="tei:text/tei:front//tei:docAuthor"/>
+               <xsl:apply-templates select="tei:text/tei:front//tei:docDate"/>
+               <ul class="slidetoc">
+                  <xsl:for-each select="tei:text/tei:body">
+                     <xsl:for-each select="tei:div|tei:div1">
+                        <xsl:variable name="n">
+                           <xsl:apply-templates select="." mode="genid"/>
+                        </xsl:variable>
+                        <li class="slidetoc">
+                           <a href="{$n}.xhtml">
+                              <xsl:value-of select="tei:head"/>
+                           </a>
+                        </li>
+                     </xsl:for-each>
+                  </xsl:for-each>
+               </ul>
+            </div>
+            <div class="slidebottom">
+	              <div class="slidebottom-image">
+	                 <img id="logo" src="{$logoFile}" width="{$logoWidth}" height="{$logoHeight}"
+                       alt="logo"/>
+	              </div>
+	              <div class="slidebottom-text">
+	                 <xsl:variable name="next">
+	                    <xsl:value-of select="$masterFile"/>
+	                    <xsl:text>1</xsl:text>
+	                 </xsl:variable>
+	                 <a accesskey="n" href="{concat($next,$outputSuffix)}">Start</a>
+	              </div>
+            </div>
+         </body>
+      </html>
+  </xsl:template>
+
+   <xsl:template name="includeJavascript">
+      <xsl:variable name="prev">
+         <xsl:choose>	
+            <xsl:when test="preceding-sibling::tei:div">
+	              <xsl:apply-templates select="preceding-sibling::tei:div[1]" mode="genid"/>
+            </xsl:when>
+            <xsl:when test="preceding::tei:div1">
+	              <xsl:apply-templates select="preceding::tei:div1[1]" mode="genid"/>
+            </xsl:when>
+            <xsl:when test="preceding::tei:div">
+	              <xsl:apply-templates select="preceding::tei:div[1]" mode="genid"/>
+            </xsl:when>
+            <xsl:otherwise>
+	              <xsl:value-of select="$masterFile"/>
+	              <xsl:text>0</xsl:text>
+            </xsl:otherwise>
+         </xsl:choose>
+      </xsl:variable>
+      <xsl:variable name="next">
+         <xsl:choose>
+            <xsl:when test="tei:div">
+               <xsl:apply-templates select="tei:div[1]" mode="genid"/>
+	           </xsl:when>
+
+            <xsl:when test="following-sibling::tei:div">
+	              <xsl:apply-templates select="following-sibling::tei:div[1]" mode="genid"/>
+            </xsl:when>
+            <xsl:when test="following::tei:div1">
+	              <xsl:apply-templates select="following::tei:div1[1]" mode="genid"/>
+            </xsl:when>
+            <xsl:when test="following::tei:div">
+	              <xsl:apply-templates select="following::tei:div[1]" mode="genid"/>
+            </xsl:when>
+            <xsl:otherwise>
+	              <xsl:value-of select="$masterFile"/>
+	              <xsl:text>0</xsl:text>
+            </xsl:otherwise>
+         </xsl:choose>
+      </xsl:variable>
+      <xsl:call-template name="writeJavascript">
+         <xsl:with-param name="content">
+            <xsl:text>
+    var isOp = navigator.userAgent.indexOf('Opera') &gt; -1 ? 1 : 0;
+    function keys(key) {
+    if (!key) {
+    key = event;
+    key.which = key.keyCode;
+    }
+    switch (key.which) {
+    case 10: // return
+    case 32: // spacebar
+    case 34: // page down
+    case 39: // rightkey
+    // case 40: 
+    // downkey
+    document.location = "</xsl:text>
+            <xsl:value-of select="$next"/>
+            <xsl:text>.xhtml";
+    break;
+    case 33: // page up
+    case 37: // leftkey
+    //case 38: 
+    // upkey
+    document.location = "</xsl:text>
+            <xsl:value-of select="$prev"/>
+            <xsl:text>.xhtml";
+    break;
+	}
+	}
+	function startup() {      
+	if (!isOp) {		
+	document.onkeyup = keys;
+	document.onclick = clicker;
+	}
+	}
+	
+	function clicker(e) {
+	var target;
+	if (window.event) {
+	target = window.event.srcElement;
+	e = window.event;
+	} else target = e.target;
+	if (target.href != null ) return true;
+	if (!e.which || e.which == 1) 
+	document.location = "</xsl:text>
+	           <xsl:value-of select="$next"/>
+	           <xsl:text>.xhtml";
+	}
+	
+	window.onload = startup;
+  </xsl:text>
+         </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+  <xsl:template match="tei:body/tei:div[tei:div]">
+      <xsl:variable name="slidenum">
+         <xsl:value-of select="$masterFile"/>
+         <xsl:number/>
+      </xsl:variable>
+      <xsl:variable name="outName">
+         <xsl:call-template name="outputChunkName">
+	           <xsl:with-param name="ident">
+	              <xsl:value-of select="$slidenum"/>
+	           </xsl:with-param>
+         </xsl:call-template>
+      </xsl:variable>
+
+      <xsl:if test="$verbose='true'">
+         <xsl:message>Opening file <xsl:value-of select="$outName"/>
+         </xsl:message>
+      </xsl:if>
+      <xsl:result-document doctype-public="{$doctypePublic}" doctype-system="{$doctypeSystem}"
+                           encoding="{$outputEncoding}"
+                           href="{$outName}"
+                           method="{$outputMethod}">
+        <html>
+            <xsl:call-template name="addLangAtt"/>
+            <head>
+               <title>
+                  <xsl:value-of select="tei:head"/>
+               </title>
+               <xsl:call-template name="includeCSS"/>
+               <xsl:call-template name="cssHook"/>
+               <xsl:call-template name="includeJavascript"/>
+               <xsl:call-template name="javascriptHook"/>
+            </head>
+            <body>
+               <h1>
+                  <xsl:value-of select="tei:head"/>
+               </h1>
+            </body>
+        </html>
+      </xsl:result-document>
+      <xsl:if test="$verbose='true'">
+         <xsl:message>Closing file <xsl:value-of select="$outName"/>
+         </xsl:message>
+      </xsl:if>
+
+      <xsl:apply-templates select="tei:div"/>
+  </xsl:template>
+
+
+  <xsl:template match="tei:body/tei:div|tei:div">
+      <xsl:choose>
+         <xsl:when test="$splitLevel&gt;-1">
+	           <xsl:variable name="slidenum">
+	              <xsl:apply-templates select="." mode="genid"/>
+	           </xsl:variable>
+	
+	           <xsl:variable name="outName">
+	              <xsl:call-template name="outputChunkName">
+	                 <xsl:with-param name="ident">
+	                    <xsl:value-of select="$slidenum"/>
+	                 </xsl:with-param>
+	              </xsl:call-template>
+	           </xsl:variable>
+	
+	           <xsl:if test="$verbose='true'">
+	              <xsl:message>Opening file <xsl:value-of select="$outName"/>
+               </xsl:message>
+	           </xsl:if>
+	           <xsl:result-document doctype-public="{$doctypePublic}" doctype-system="{$doctypeSystem}"
+                                 encoding="{$outputEncoding}"
+                                 href="{$outName}"
+                                 method="{$outputMethod}">
+	              <xsl:call-template name="slideout"/>
+	           </xsl:result-document>
+	           <xsl:if test="$verbose='true'">
+	              <xsl:message>Closing file <xsl:value-of select="$outName"/>
+               </xsl:message>
+	           </xsl:if>
+         </xsl:when>
+         <xsl:otherwise>
+	           <xsl:call-template name="slidebody"/>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+
+  <xsl:template name="slideout">
+      <html>
+         <xsl:call-template name="addLangAtt"/>
+         <head>
+            <title>
+               <xsl:value-of select="tei:head"/>
+            </title>
+            <xsl:call-template name="includeCSS"/>
+            <xsl:call-template name="cssHook"/>
+            <xsl:call-template name="includeJavascript"/>
+            <xsl:call-template name="javascriptHook"/>
+         </head>
+         <body>
+            <xsl:call-template name="slidebody"/>
+         </body>
+      </html>
+  </xsl:template>
+
+  <xsl:template name="slidebody">
+      <div class="slidetop">
+         <div class="slidetitle">
+            <xsl:call-template name="header">
+	              <xsl:with-param name="display">full</xsl:with-param>
+	           </xsl:call-template>
+         </div>
+         <xsl:if test="$splitLevel &gt;-1">
+            <div class="xref">
+               <xsl:call-template name="xrefpanel"/>
+            </div>
+         </xsl:if>
+      </div>
+      <div class="slidemain">
+         <xsl:apply-templates/>
+      </div>
+      <div class="slidebottom">
+         <xsl:call-template name="slideBottom"/>
+      </div>
+  </xsl:template>
+
+
+  <xsl:template name="slideBottom">
+      <div class="slidebottom">
+         <div class="slidebottom-image">
+	           <img id="logo" src="{$logoFile}" width="{$logoWidth}" height="${logoHeight}"
+                 alt="logo"/>
+         </div>
+         <div class="slidebottom-text">
+	           <xsl:call-template name="generateTitle"/>
+         </div>
+      </div>
+  </xsl:template>
+
+  <xsl:template match="tei:row">
+	     <xsl:variable name="c">
+	        <xsl:number/>
+	     </xsl:variable>
+	     <xsl:variable name="class">
+	        <xsl:choose>
+	           <xsl:when test="@role">
+		             <xsl:value-of select="@role"/>
+	           </xsl:when>
+	           <xsl:when test="$c mod 2=0">
+	              <xsl:text>Even</xsl:text>
+	           </xsl:when>
+	           <xsl:otherwise>
+	              <xsl:text>Odd</xsl:text>
+	           </xsl:otherwise>
+	        </xsl:choose>
+	     </xsl:variable>
+	     <tr class="{$class}">
+	        <xsl:apply-templates/>
+	     </tr>
+  </xsl:template>
+
+  <xsl:template match="teix:egXML">
+      <xsl:param name="simple">false</xsl:param>
+      <xsl:param name="highlight"/>
+    
+      <div class="pre">
+	        <xsl:apply-templates mode="verbatim">
+	           <xsl:with-param name="highlight">
+	              <xsl:value-of select="$highlight"/>
+	           </xsl:with-param>
+	        </xsl:apply-templates>
+      </div>
+  </xsl:template>
+
+  <xsl:template match="xhtml:*">
+      <xsl:copy-of select="."/>
+  </xsl:template>
+
+  <xsl:template match="tei:att">
+      <span class="att">
+         <xsl:apply-templates/>
+      </span>
+  </xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/slides/teihtml-slides.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/slides/teislides.css
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/slides/teislides.css	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/slides/teislides.css	(revision 258)
@@ -0,0 +1,252 @@
+/* teislides.css */
+
+body
+{
+    background: white;
+    font-family: Helvetica;
+    font-size: 24pt; 
+    color: black;
+}
+
+
+p {
+  margin-top: 6px;
+  margin-bottom: 6px;
+  }
+
+li {
+   margin-bottom: 6px;
+   margin-top: 4px;
+}
+
+pre.eg {
+    background: #ffffcc;
+    padding: 6pt;
+    font-style: roman;
+    font-size: 16pt;
+    color: blue
+    margin-left: 1em;
+    margin-top: 6pt;
+    border-style: inset
+}
+
+div.docAuthor {
+    padding: 12pt;
+    font-size: 34pt;
+    color: green;
+}
+
+div.docDate {
+    padding: 12pt;
+    font-size:34pt;
+    color: blue;
+}
+
+tr,p,ul,ol,li {
+    font-size: 24pt;
+    }
+
+p.box {
+    background: blue; color: white ;
+    padding: 10pt;
+    margin-left: 5%;
+    font-size: 24pt;
+    font-style: bold;
+    margin-right: 5%;
+    margin-top: 12pt;
+    border-style: outset;
+}
+
+
+td
+{
+    color: black;
+    margin-left: 5%;
+    margin-right: 5%;
+    margin-top: 3%;
+}
+
+pre, code, tt, Code
+{
+    font-family:  monospace;
+    color: blue;
+    font-size: 20pt;
+}
+
+tt.url {
+    font-family:  sans-serif;
+    }
+
+
+h2 {    margin-top: 24pt;
+    font-size: 32pt;
+    font-family: serif;
+    color: green;
+    background: white;
+        text-align: center;
+    border-width: 5pt;
+    border-color: white;
+    padding: 0pt;
+    margin: 0pt;
+    }
+
+
+ul,dl,ol {    
+    font-size: 24pt;
+     }
+
+li.lower {     font-style: normal; }
+
+
+
+blockquote
+{
+    margin-left: 5%;
+    margin-right: 5%;
+    margin-top: 0.5em;
+    margin-bottom: 1.5em;
+/*    color: gray; */
+    color: teal;
+    text-align: justify;
+    font-size: smaller;
+}
+
+address
+{
+    font-style:  normal;
+    font-family: cursive;
+    letter-spacing: .1em;
+    font-size: x-small;
+}
+
+a:link
+{
+    color:  blue;
+}
+
+
+a:visited
+{
+    color:  navy;
+}
+
+
+a:active
+{
+    color:  purple;
+    background: yellow;
+}
+
+
+a:hover
+{
+    color:  blue;
+    background:     silver;
+}
+
+.titlebar
+{
+    color: white;
+    background: navy;
+}
+
+
+
+div.slidemain {
+      clear: both;
+      height: 75%;
+      border-top: 2px;
+      border-left: 0;
+      border-bottom: 0;
+      border-right: 0;
+      border-style: solid;
+      border-color: blue;
+      padding-left: 5%;
+      padding-right: 5%;
+	      }
+
+div.slidebottom-text {
+      font-style: italic;
+      font-size: 12pt;
+      float: right;
+}
+div.slidebottom-image {
+      float: left;
+}
+div.slidebottom {
+      clear:both;
+      height: 2%;
+      margin-top: 10pt;
+      border-top: 2px;
+      border-left: 0;
+      border-bottom: 0;
+      border-right: 0;
+	      }
+
+div.slidetop {
+      padding-top: 2%;
+}
+
+div.slidetitle {
+    height: 10%;
+    float: left;
+    color:red;
+    font-size: 42pt;
+    font-weight: bold;
+    font-family: sans-serif;
+    text-align: left;
+    margin-bottom: 12pt;
+    padding-left: 5%;
+}
+div.xref {
+    height: 10%;
+    float: right;
+    font-size: 12pt;
+    font-weight: bold;
+    margin-bottom: 12pt;
+}
+
+span.bottomright{
+    float: right;
+    margin-top:0;
+    margin-bottom: 8pt;
+}
+
+
+li.slidetoc {
+ display: inline;
+}	      
+
+li.slidetoc:before {
+  content: " * ";
+  font-style: italic;
+}
+
+
+
+img.simple {
+	   border-style: none;
+	   }
+img.inline {
+	   border-style: none;
+	   }
+img.right {
+	   float:right
+	   }
+img.left {
+	   float:left
+	   }
+.button {
+    font-family: Symbol;
+    padding: 2px;
+    font-style: bold;
+    border-style: outset;
+    background: blue; 
+    color: white ;
+}
+a.xreflink:link {
+		        text-decoration: none;		 	    
+	    }		 
+a.xreflink:visited {
+		        text-decoration: none;		 	    
+	    }		 
Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/slides/slides-common.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/slides/slides-common.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/slides/slides-common.xsl	(revision 258)
@@ -0,0 +1,206 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:rng="http://relaxng.org/ns/structure/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="2.0">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet dealing with elements from the core module. </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: slides-common.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2011, TEI Consortium</p>
+      </desc>
+   </doc>
+
+  <xsl:template match="text()" mode="verbatim">
+      <xsl:choose>
+         <xsl:when test="normalize-space(.)=''">
+            <xsl:for-each select="following-sibling::*[1]">
+               <xsl:call-template name="lineBreak">
+                  <xsl:with-param name="id">7</xsl:with-param>
+               </xsl:call-template>
+               <xsl:call-template name="makeIndent"/>
+            </xsl:for-each>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:call-template name="wraptext">
+               <xsl:with-param name="indent">
+                  <xsl:for-each select="parent::*">
+                     <xsl:call-template name="makeIndent"/>
+                  </xsl:for-each>
+               </xsl:with-param>
+               <xsl:with-param name="text">
+                  <xsl:value-of select="."/>
+               </xsl:with-param>
+            </xsl:call-template>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <xsl:template name="wraptext">
+      <xsl:param name="indent"/>
+      <xsl:param name="text"/>
+      <xsl:choose>
+         <xsl:when test="$text='&#xA;'"/>
+         <xsl:when test="contains($text,'&#xA;')">
+            <xsl:value-of select="substring-before($text,'&#xA;')"/>
+            <xsl:call-template name="lineBreak">
+               <xsl:with-param name="id">6</xsl:with-param>
+            </xsl:call-template>
+            <xsl:value-of select="$indent"/>
+            <xsl:call-template name="wraptext">
+               <xsl:with-param name="indent">
+                  <xsl:value-of select="$indent"/>
+               </xsl:with-param>
+               <xsl:with-param name="text">
+                  <xsl:value-of select="substring-after($text,'&#xA;')"/>
+               </xsl:with-param>
+            </xsl:call-template>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:value-of select="$text"/>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <xsl:template match="*" mode="verbatim">
+      <xsl:choose>
+         <xsl:when test="not(preceding-sibling::node())">
+            <xsl:call-template name="lineBreak">
+               <xsl:with-param name="id">2</xsl:with-param>
+            </xsl:call-template>
+            <xsl:call-template name="makeIndent"/>
+         </xsl:when>
+         <xsl:when test="preceding-sibling::node()[1]/self::*">
+            <xsl:call-template name="lineBreak">
+               <xsl:with-param name="id">1</xsl:with-param>
+            </xsl:call-template>
+            <xsl:call-template name="makeIndent"/>
+         </xsl:when>
+         <xsl:when test="preceding-sibling::node()[1]/self::text()">
+    </xsl:when>
+         <xsl:otherwise>
+            <xsl:call-template name="lineBreak">
+               <xsl:with-param name="id">9</xsl:with-param>
+            </xsl:call-template>
+            <xsl:call-template name="makeIndent"/>
+         </xsl:otherwise>
+      </xsl:choose>
+      <xsl:text>&lt;</xsl:text>
+      <xsl:value-of disable-output-escaping="yes" select="$startElement"/>
+      <xsl:choose>
+         <xsl:when test="namespace-uri()='http://relaxng.org/ns/structure/1.0'">
+            <xsl:text>rng:</xsl:text>
+            <xsl:value-of select="local-name(.)"/>
+         </xsl:when>
+         <xsl:when test="namespace-uri()='http://www.w3.org/1999/XSL/Transform'">
+            <xsl:value-of disable-output-escaping="yes" select="$startNamespace"/>
+            <xsl:text>xsl:</xsl:text>
+            <xsl:value-of select="local-name(.)"/>
+            <xsl:value-of disable-output-escaping="yes" select="$endNamespace"/>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:value-of select="local-name(.)"/>
+         </xsl:otherwise>
+      </xsl:choose>
+      <xsl:value-of disable-output-escaping="yes" select="$endElement"/>
+      <xsl:for-each select="@*">
+         <xsl:text>&#160;</xsl:text>
+         <xsl:value-of disable-output-escaping="yes" select="$startAttribute"/>
+         <xsl:if test="namespace-uri()='http://relaxng.org/ns/structure/1.0'">
+            <xsl:text>xml:</xsl:text>
+         </xsl:if>
+         <xsl:value-of select="local-name(.)"/>
+         <xsl:value-of disable-output-escaping="yes" select="$endAttribute"/>
+         <xsl:text>="</xsl:text>
+         <xsl:value-of disable-output-escaping="yes" select="$startAttributeValue"/>
+         <xsl:value-of select="."/>
+         <xsl:value-of disable-output-escaping="yes" select="$endAttributeValue"/>
+         <xsl:text>"</xsl:text>
+      </xsl:for-each>
+      <xsl:choose>
+         <xsl:when test="child::node()">
+            <xsl:text>&gt;</xsl:text>
+            <xsl:apply-templates mode="verbatim"/>
+            <xsl:choose>
+               <xsl:when test="child::node()[last()]/self::text()[normalize-space(.)='']">
+                  <xsl:call-template name="lineBreak">
+                     <xsl:with-param name="id">3</xsl:with-param>
+                  </xsl:call-template>
+                  <xsl:call-template name="makeIndent"/>
+               </xsl:when>
+               <xsl:when test="child::node()[last()]/self::comment()">
+                  <xsl:call-template name="lineBreak">
+                     <xsl:with-param name="id">4</xsl:with-param>
+                  </xsl:call-template>
+                  <xsl:call-template name="makeIndent"/>
+               </xsl:when>
+               <xsl:when test="child::node()[last()]/self::*">
+                  <xsl:call-template name="lineBreak">
+                     <xsl:with-param name="id">5</xsl:with-param>
+                  </xsl:call-template>
+                  <xsl:call-template name="makeIndent"/>
+               </xsl:when>
+            </xsl:choose>
+            <xsl:text>&lt;/</xsl:text>
+            <xsl:value-of disable-output-escaping="yes" select="$startElement"/>
+            <xsl:choose>
+               <xsl:when test="namespace-uri()='http://relaxng.org/ns/structure/1.0'">
+                  <xsl:text>rng:</xsl:text>
+                  <xsl:value-of select="local-name(.)"/>
+               </xsl:when>
+               <xsl:when test="namespace-uri()='http://www.w3.org/1999/XSL/Transform'">
+                  <xsl:value-of disable-output-escaping="yes" select="$startNamespace"/>
+                  <xsl:text>xsl:</xsl:text>
+                  <xsl:value-of select="local-name(.)"/>
+                  <xsl:value-of disable-output-escaping="yes" select="$endNamesapce"/>
+               </xsl:when>
+               <xsl:otherwise>
+                  <xsl:value-of select="local-name(.)"/>
+               </xsl:otherwise>
+            </xsl:choose>
+            <xsl:value-of disable-output-escaping="yes" select="$endElement"/>
+            <xsl:text>&gt;</xsl:text>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:text>/&gt;</xsl:text>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <xsl:template name="makeIndent">
+      <xsl:for-each select="ancestor::*[not(namespace-uri()='http://www.tei-c.org/ns/1.0')]">
+         <xsl:value-of select="$spaceCharacter"/>
+      </xsl:for-each>
+  </xsl:template>
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/slides/slides-common.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/VERSION
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/VERSION	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/VERSION	(revision 258)
@@ -0,0 +1 @@
+6.7
Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/odt/mimetype
===================================================================
Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/odt/teilite.dtd
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/odt/teilite.dtd	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/odt/teilite.dtd	(revision 258)
@@ -0,0 +1,2103 @@
+
+<!--
+DTD Generated 2011-02-13T12:21:23Z. 
+-->
+
+<!-- start datatypes -->
+
+<!ENTITY % data.certainty '(high|
+medium|
+low|
+unknown)' >
+
+<!ENTITY % data.numeric ' CDATA' >
+
+<!ENTITY % data.count ' CDATA' >
+
+<!ENTITY % data.temporal.w3c ' CDATA' >
+
+<!ENTITY % data.duration.w3c ' CDATA' >
+
+<!ENTITY % data.truthValue ' CDATA' >
+
+<!ENTITY % data.xTruthValue '(unknown|
+inapplicable | true | false)' >
+
+<!ENTITY % data.language ' CDATA' >
+
+<!ENTITY % data.outputMeasurement ' CDATA' >
+
+<!ENTITY % data.pattern ' CDATA' >
+
+<!ENTITY % data.pointer ' CDATA' >
+
+<!ENTITY % data.version ' CDATA' >
+
+<!ENTITY % data.key ' CDATA' >
+
+<!ENTITY % data.word ' CDATA' >
+
+<!ENTITY % data.code ' CDATA' >
+
+<!ENTITY % data.name ' CDATA' >
+
+<!ENTITY % data.enumerated '%data.name;' >
+
+<!-- end datatypes -->
+
+<!--predeclared classes -->
+
+<!ENTITY % model.entryPart ""> 
+<!ENTITY % model.entryPart_sequence ""> 
+<!ENTITY % model.entryPart_sequenceOptional ""> 
+<!ENTITY % model.entryPart_sequenceOptionalRepeatable ""> 
+<!ENTITY % model.entryPart_sequenceRepeatable ""> 
+<!ENTITY % model.resourceLike ""> 
+<!ENTITY % model.resourceLike_sequence ""> 
+<!ENTITY % model.resourceLike_sequenceOptional ""> 
+<!ENTITY % model.resourceLike_sequenceOptionalRepeatable ""> 
+<!ENTITY % model.resourceLike_sequenceRepeatable ""> <!ENTITY % att.global.linking.attributes '
+corresp CDATA  #IMPLIED
+synch CDATA  #IMPLIED
+sameAs %data.pointer;  #IMPLIED
+copyOf %data.pointer;  #IMPLIED
+next %data.pointer;  #IMPLIED
+prev %data.pointer;  #IMPLIED
+exclude CDATA  #IMPLIED
+select CDATA  #IMPLIED'> 
+<!ENTITY % att.global.linking.attribute.corresp '
+corresp CDATA  #IMPLIED'>
+
+<!ENTITY % att.global.linking.attribute.synch '
+synch CDATA  #IMPLIED'>
+
+<!ENTITY % att.global.linking.attribute.sameAs '
+sameAs %data.pointer;  #IMPLIED'>
+
+<!ENTITY % att.global.linking.attribute.copyOf '
+copyOf %data.pointer;  #IMPLIED'>
+
+<!ENTITY % att.global.linking.attribute.next '
+next %data.pointer;  #IMPLIED'>
+
+<!ENTITY % att.global.linking.attribute.prev '
+prev %data.pointer;  #IMPLIED'>
+
+<!ENTITY % att.global.linking.attribute.exclude '
+exclude CDATA  #IMPLIED'>
+
+<!ENTITY % att.global.linking.attribute.select '
+select CDATA  #IMPLIED'>
+<!ENTITY % att.global.analytic.attributes '
+ana CDATA  #IMPLIED'> 
+<!ENTITY % att.global.analytic.attribute.ana '
+ana CDATA  #IMPLIED'>
+
+<!--end of predeclared classes -->
+<!ENTITY % att.ascribed.attributes '
+who CDATA  #IMPLIED'> 
+<!ENTITY % att.ascribed.attribute.who '
+who CDATA  #IMPLIED'>
+<!ENTITY % att.canonical.attributes '
+key %data.key;  #IMPLIED
+ref CDATA  #IMPLIED'> 
+<!ENTITY % att.canonical.attribute.key '
+key %data.key;  #IMPLIED'>
+
+<!ENTITY % att.canonical.attribute.ref '
+ref CDATA  #IMPLIED'>
+<!ENTITY % att.ranging.attributes '
+atLeast %data.numeric;  #IMPLIED
+atMost %data.numeric;  #IMPLIED
+min %data.numeric;  #IMPLIED
+max %data.numeric;  #IMPLIED'> 
+<!ENTITY % att.ranging.attribute.atLeast '
+atLeast %data.numeric;  #IMPLIED'>
+
+<!ENTITY % att.ranging.attribute.atMost '
+atMost %data.numeric;  #IMPLIED'>
+
+<!ENTITY % att.ranging.attribute.min '
+min %data.numeric;  #IMPLIED'>
+
+<!ENTITY % att.ranging.attribute.max '
+max %data.numeric;  #IMPLIED'>
+<!ENTITY % att.dimensions.attributes ' %att.ranging.attributes;
+unit %data.enumerated;  #IMPLIED
+quantity %data.numeric;  #IMPLIED
+extent CDATA  #IMPLIED
+precision %data.certainty;  #IMPLIED
+scope %data.enumerated;  #IMPLIED'> 
+<!ENTITY % att.dimensions.attribute.unit '
+unit %data.enumerated;  #IMPLIED'>
+
+<!ENTITY % att.dimensions.attribute.quantity '
+quantity %data.numeric;  #IMPLIED'>
+
+<!ENTITY % att.dimensions.attribute.extent '
+extent CDATA  #IMPLIED'>
+
+<!ENTITY % att.dimensions.attribute.precision '
+precision %data.certainty;  #IMPLIED'>
+
+<!ENTITY % att.dimensions.attribute.scope '
+scope %data.enumerated;  #IMPLIED'>
+<!ENTITY % att.breaking.attributes '
+break %data.enumerated;  #IMPLIED'> 
+<!ENTITY % att.breaking.attribute.break '
+break %data.enumerated;  #IMPLIED'>
+<!ENTITY % att.datable.w3c.attributes '
+period %data.pointer;  #IMPLIED
+when %data.temporal.w3c;  #IMPLIED
+notBefore %data.temporal.w3c;  #IMPLIED
+notAfter %data.temporal.w3c;  #IMPLIED
+from %data.temporal.w3c;  #IMPLIED
+to %data.temporal.w3c;  #IMPLIED'> 
+<!ENTITY % att.datable.w3c.attribute.period '
+period %data.pointer;  #IMPLIED'>
+
+<!ENTITY % att.datable.w3c.attribute.when '
+when %data.temporal.w3c;  #IMPLIED'>
+
+<!ENTITY % att.datable.w3c.attribute.notBefore '
+notBefore %data.temporal.w3c;  #IMPLIED'>
+
+<!ENTITY % att.datable.w3c.attribute.notAfter '
+notAfter %data.temporal.w3c;  #IMPLIED'>
+
+<!ENTITY % att.datable.w3c.attribute.from '
+from %data.temporal.w3c;  #IMPLIED'>
+
+<!ENTITY % att.datable.w3c.attribute.to '
+to %data.temporal.w3c;  #IMPLIED'>
+<!ENTITY % att.datable.attributes ' %att.datable.w3c.attributes;'> <!ENTITY % att.declarable.attributes '
+default (true|false) "false" '> 
+<!ENTITY % att.declarable.attribute.default '
+default (true|false) "false" '>
+<!ENTITY % att.declaring.attributes '
+decls CDATA  #IMPLIED'> 
+<!ENTITY % att.declaring.attribute.decls '
+decls CDATA  #IMPLIED'>
+<!ENTITY % att.divLike.attributes '
+org (composite|uniform) "uniform" 
+sample (initial|medial|final|unknown|complete) "complete" 
+part (Y|N|I|M|F) "N" '> 
+<!ENTITY % att.divLike.attribute.org '
+org (composite|uniform) "uniform" '>
+
+<!ENTITY % att.divLike.attribute.sample '
+sample (initial|medial|final|unknown|complete) "complete" '>
+
+<!ENTITY % att.divLike.attribute.part '
+part (Y|N|I|M|F) "N" '>
+<!ENTITY % att.docStatus.attributes '
+status %data.enumerated;  "draft" '> 
+<!ENTITY % att.docStatus.attribute.status '
+status %data.enumerated;  "draft" '>
+<!ENTITY % att.responsibility.attributes '
+cert %data.certainty;  #IMPLIED
+resp CDATA  #IMPLIED'> 
+<!ENTITY % att.responsibility.attribute.cert '
+cert %data.certainty;  #IMPLIED'>
+
+<!ENTITY % att.responsibility.attribute.resp '
+resp CDATA  #IMPLIED'>
+<!ENTITY % att.editLike.attributes ' %att.dimensions.attributes; %att.responsibility.attributes;
+evidence NMTOKENS  #IMPLIED
+source CDATA  #IMPLIED'> 
+<!ENTITY % att.editLike.attribute.evidence '
+evidence NMTOKENS  #IMPLIED'>
+
+<!ENTITY % att.editLike.attribute.source '
+source CDATA  #IMPLIED'>
+<!ENTITY % att.global.attributes ' %att.global.linking.attributes; %att.global.analytic.attributes;
+xml:id ID #IMPLIED
+n CDATA  #IMPLIED
+xml:lang %data.language;  #IMPLIED
+rend CDATA  #IMPLIED
+xml:base %data.pointer;  #IMPLIED
+xml:space (default|preserve) #IMPLIED'> 
+<!ENTITY % att.global.attribute.xmlid '
+xml:id ID #IMPLIED'>
+
+<!ENTITY % att.global.attribute.n '
+n CDATA  #IMPLIED'>
+
+<!ENTITY % att.global.attribute.xmllang '
+xml:lang %data.language;  #IMPLIED'>
+
+<!ENTITY % att.global.attribute.rend '
+rend CDATA  #IMPLIED'>
+
+<!ENTITY % att.global.attribute.xmlbase '
+xml:base %data.pointer;  #IMPLIED'>
+
+<!ENTITY % att.global.attribute.xmlspace '
+xml:space (default|preserve) #IMPLIED'>
+<!ENTITY % att.handFeatures.attributes '
+scribe %data.name;  #IMPLIED
+scribeRef CDATA  #IMPLIED
+script NMTOKENS  #IMPLIED
+scriptRef CDATA  #IMPLIED
+medium %data.enumerated;  #IMPLIED
+scope (sole|major|minor) #IMPLIED'> 
+<!ENTITY % att.handFeatures.attribute.scribe '
+scribe %data.name;  #IMPLIED'>
+
+<!ENTITY % att.handFeatures.attribute.scribeRef '
+scribeRef CDATA  #IMPLIED'>
+
+<!ENTITY % att.handFeatures.attribute.script '
+script NMTOKENS  #IMPLIED'>
+
+<!ENTITY % att.handFeatures.attribute.scriptRef '
+scriptRef CDATA  #IMPLIED'>
+
+<!ENTITY % att.handFeatures.attribute.medium '
+medium %data.enumerated;  #IMPLIED'>
+
+<!ENTITY % att.handFeatures.attribute.scope '
+scope (sole|major|minor) #IMPLIED'>
+<!ENTITY % att.internetMedia.attributes '
+mimeType %data.word;  #IMPLIED'> 
+<!ENTITY % att.internetMedia.attribute.mimeType '
+mimeType %data.word;  #IMPLIED'>
+<!ENTITY % att.interpLike.attributes ' %att.responsibility.attributes;
+type %data.enumerated;  #IMPLIED
+inst CDATA  #IMPLIED'> 
+<!ENTITY % att.interpLike.attribute.type '
+type %data.enumerated;  #IMPLIED'>
+
+<!ENTITY % att.interpLike.attribute.inst '
+inst CDATA  #IMPLIED'>
+<!ENTITY % att.measurement.attributes '
+unit %data.enumerated;  #IMPLIED
+quantity %data.numeric;  #IMPLIED
+commodity CDATA  #IMPLIED'> 
+<!ENTITY % att.measurement.attribute.unit '
+unit %data.enumerated;  #IMPLIED'>
+
+<!ENTITY % att.measurement.attribute.quantity '
+quantity %data.numeric;  #IMPLIED'>
+
+<!ENTITY % att.measurement.attribute.commodity '
+commodity CDATA  #IMPLIED'>
+<!ENTITY % att.naming.attributes ' %att.canonical.attributes;
+role %data.enumerated;  #IMPLIED
+nymRef CDATA  #IMPLIED'> 
+<!ENTITY % att.naming.attribute.role '
+role %data.enumerated;  #IMPLIED'>
+
+<!ENTITY % att.naming.attribute.nymRef '
+nymRef CDATA  #IMPLIED'>
+<!ENTITY % att.placement.attributes '
+place NMTOKENS  #IMPLIED'> 
+<!ENTITY % att.placement.attribute.place '
+place NMTOKENS  #IMPLIED'>
+<!ENTITY % att.typed.attributes '
+type %data.enumerated;  #IMPLIED
+subtype %data.enumerated;  #IMPLIED'> 
+<!ENTITY % att.typed.attribute.type '
+type %data.enumerated;  #IMPLIED'>
+
+<!ENTITY % att.typed.attribute.subtype '
+subtype %data.enumerated;  #IMPLIED'>
+<!ENTITY % att.pointing.attributes '
+target CDATA  #IMPLIED
+evaluate (all|one|none) #IMPLIED'> 
+<!ENTITY % att.pointing.attribute.target '
+target CDATA  #IMPLIED'>
+
+<!ENTITY % att.pointing.attribute.evaluate '
+evaluate (all|one|none) #IMPLIED'>
+<!ENTITY % att.segLike.attributes '
+function %data.enumerated;  #IMPLIED
+part (Y|N|I|M|F) "N" '> 
+<!ENTITY % att.segLike.attribute.function '
+function %data.enumerated;  #IMPLIED'>
+
+<!ENTITY % att.segLike.attribute.part '
+part (Y|N|I|M|F) "N" '>
+<!ENTITY % att.sourced.attributes '
+ed CDATA  #IMPLIED'> 
+<!ENTITY % att.sourced.attribute.ed '
+ed CDATA  #IMPLIED'>
+<!ENTITY % att.spanning.attributes '
+spanTo %data.pointer;  #IMPLIED'> 
+<!ENTITY % att.spanning.attribute.spanTo '
+spanTo %data.pointer;  #IMPLIED'>
+<!ENTITY % att.tableDecoration.attributes '
+role %data.enumerated;  "data" 
+rows %data.count;  "1" 
+cols %data.count;  "1" '> 
+<!ENTITY % att.tableDecoration.attribute.role '
+role %data.enumerated;  "data" '>
+
+<!ENTITY % att.tableDecoration.attribute.rows '
+rows %data.count;  "1" '>
+
+<!ENTITY % att.tableDecoration.attribute.cols '
+cols %data.count;  "1" '>
+<!ENTITY % att.transcriptional.attributes ' %att.editLike.attributes;
+hand %data.pointer;  #IMPLIED
+status %data.enumerated;  "unremarkable" 
+seq CDATA  #IMPLIED'> 
+<!ENTITY % att.transcriptional.attribute.hand '
+hand %data.pointer;  #IMPLIED'>
+
+<!ENTITY % att.transcriptional.attribute.status '
+status %data.enumerated;  "unremarkable" '>
+
+<!ENTITY % att.transcriptional.attribute.seq '
+seq CDATA  #IMPLIED'>
+<!ENTITY % att.translatable.attributes '
+version %data.word;  #IMPLIED'> 
+<!ENTITY % att.translatable.attribute.version '
+version %data.word;  #IMPLIED'>
+
+<!ENTITY % model.nameLike.agent "name"> 
+<!ENTITY % model.nameLike.agent_sequence "name"> 
+<!ENTITY % model.nameLike.agent_sequenceOptional "name?"> 
+<!ENTITY % model.nameLike.agent_sequenceOptionalRepeatable "name*"> 
+<!ENTITY % model.nameLike.agent_sequenceRepeatable "name+"> 
+<!ENTITY % model.segLike "seg |
+ s |
+ pc"> 
+<!ENTITY % model.segLike_sequence "seg, s, pc"> 
+<!ENTITY % model.segLike_sequenceOptional "seg?, s?, pc?"> 
+<!ENTITY % model.segLike_sequenceOptionalRepeatable "seg*, s*, pc*"> 
+<!ENTITY % model.segLike_sequenceRepeatable "seg+, s+, pc+"> 
+<!ENTITY % model.hiLike "hi"> 
+<!ENTITY % model.hiLike_sequence "hi"> 
+<!ENTITY % model.hiLike_sequenceOptional "hi?"> 
+<!ENTITY % model.hiLike_sequenceOptionalRepeatable "hi*"> 
+<!ENTITY % model.hiLike_sequenceRepeatable "hi+"> 
+<!ENTITY % model.emphLike "foreign |
+ emph |
+ mentioned |
+ soCalled |
+ gloss |
+ term |
+ title |
+ code |
+ ident"> 
+<!ENTITY % model.emphLike_sequence "foreign, emph, mentioned, soCalled, gloss, term, title, code, ident"> 
+<!ENTITY % model.emphLike_sequenceOptional "foreign?, emph?, mentioned?, soCalled?, gloss?, term?, title?, code?, ident?"> 
+<!ENTITY % model.emphLike_sequenceOptionalRepeatable "foreign*, emph*, mentioned*, soCalled*, gloss*, term*, title*, code*, ident*"> 
+<!ENTITY % model.emphLike_sequenceRepeatable "foreign+, emph+, mentioned+, soCalled+, gloss+, term+, title+, code+, ident+"> 
+<!ENTITY % model.highlighted "%model.hiLike; |
+ %model.emphLike;"> 
+<!ENTITY % model.highlighted_sequence "%model.hiLike;, %model.emphLike;"> 
+<!ENTITY % model.highlighted_sequenceOptional "%model.hiLike;?, %model.emphLike;?"> 
+<!ENTITY % model.highlighted_sequenceOptionalRepeatable "%model.hiLike;*, %model.emphLike;*"> 
+<!ENTITY % model.highlighted_sequenceRepeatable "%model.hiLike;+, %model.emphLike;+"> 
+<!ENTITY % model.dateLike "date |
+ time"> 
+<!ENTITY % model.dateLike_sequence "date, time"> 
+<!ENTITY % model.dateLike_sequenceOptional "date?, time?"> 
+<!ENTITY % model.dateLike_sequenceOptionalRepeatable "date*, time*"> 
+<!ENTITY % model.dateLike_sequenceRepeatable "date+, time+"> 
+<!ENTITY % model.measureLike "num |
+ measureGrp"> 
+<!ENTITY % model.measureLike_sequence "num, measureGrp"> 
+<!ENTITY % model.measureLike_sequenceOptional "num?, measureGrp?"> 
+<!ENTITY % model.measureLike_sequenceOptionalRepeatable "num*, measureGrp*"> 
+<!ENTITY % model.measureLike_sequenceRepeatable "num+, measureGrp+"> 
+<!ENTITY % model.egLike "eg |
+ egXML"> 
+<!ENTITY % model.egLike_sequence "eg, egXML"> 
+<!ENTITY % model.egLike_sequenceOptional "eg?, egXML?"> 
+<!ENTITY % model.egLike_sequenceOptionalRepeatable "eg*, egXML*"> 
+<!ENTITY % model.egLike_sequenceRepeatable "eg+, egXML+"> 
+<!ENTITY % model.graphicLike "graphic |
+ formula"> 
+<!ENTITY % model.graphicLike_sequence "graphic, formula"> 
+<!ENTITY % model.graphicLike_sequenceOptional "graphic?, formula?"> 
+<!ENTITY % model.graphicLike_sequenceOptionalRepeatable "graphic*, formula*"> 
+<!ENTITY % model.graphicLike_sequenceRepeatable "graphic+, formula+"> 
+<!ENTITY % model.pPart.editorial "choice |
+ abbr |
+ expan"> 
+<!ENTITY % model.pPart.editorial_sequence "choice, abbr, expan"> 
+<!ENTITY % model.pPart.editorial_sequenceOptional "choice?, abbr?, expan?"> 
+<!ENTITY % model.pPart.editorial_sequenceOptionalRepeatable "choice*, abbr*, expan*"> 
+<!ENTITY % model.pPart.editorial_sequenceRepeatable "choice+, abbr+, expan+"> 
+<!ENTITY % model.pPart.transcriptional "sic |
+ corr |
+ reg |
+ orig |
+ add |
+ del |
+ unclear"> 
+<!ENTITY % model.pPart.transcriptional_sequence "sic, corr, reg, orig, add, del, unclear"> 
+<!ENTITY % model.pPart.transcriptional_sequenceOptional "sic?, corr?, reg?, orig?, add?, del?, unclear?"> 
+<!ENTITY % model.pPart.transcriptional_sequenceOptionalRepeatable "sic*, corr*, reg*, orig*, add*, del*, unclear*"> 
+<!ENTITY % model.pPart.transcriptional_sequenceRepeatable "sic+, corr+, reg+, orig+, add+, del+, unclear+"> 
+<!ENTITY % model.pPart.edit "%model.pPart.editorial; |
+ %model.pPart.transcriptional;"> 
+<!ENTITY % model.pPart.edit_sequence "%model.pPart.editorial;, %model.pPart.transcriptional;"> 
+<!ENTITY % model.pPart.edit_sequenceOptional "%model.pPart.editorial;?, %model.pPart.transcriptional;?"> 
+<!ENTITY % model.pPart.edit_sequenceOptionalRepeatable "%model.pPart.editorial;*, %model.pPart.transcriptional;*"> 
+<!ENTITY % model.pPart.edit_sequenceRepeatable "%model.pPart.editorial;+, %model.pPart.transcriptional;+"> 
+<!ENTITY % model.ptrLike "ptr |
+ ref"> 
+<!ENTITY % model.ptrLike_sequence "ptr, ref"> 
+<!ENTITY % model.ptrLike_sequenceOptional "ptr?, ref?"> 
+<!ENTITY % model.ptrLike_sequenceOptionalRepeatable "ptr*, ref*"> 
+<!ENTITY % model.ptrLike_sequenceRepeatable "ptr+, ref+"> 
+<!ENTITY % model.global.meta "index |
+ interp |
+ interpGrp"> 
+<!ENTITY % model.global.meta_sequence "index, interp, interpGrp"> 
+<!ENTITY % model.global.meta_sequenceOptional "index?, interp?, interpGrp?"> 
+<!ENTITY % model.global.meta_sequenceOptionalRepeatable "index*, interp*, interpGrp*"> 
+<!ENTITY % model.global.meta_sequenceRepeatable "index+, interp+, interpGrp+"> 
+<!ENTITY % model.milestoneLike "milestone |
+ pb |
+ lb |
+ anchor"> 
+<!ENTITY % model.milestoneLike_sequence "milestone, pb, lb, anchor"> 
+<!ENTITY % model.milestoneLike_sequenceOptional "milestone?, pb?, lb?, anchor?"> 
+<!ENTITY % model.milestoneLike_sequenceOptionalRepeatable "milestone*, pb*, lb*, anchor*"> 
+<!ENTITY % model.milestoneLike_sequenceRepeatable "milestone+, pb+, lb+, anchor+"> 
+<!ENTITY % model.gLike ""> 
+<!ENTITY % model.gLike_sequence ""> 
+<!ENTITY % model.gLike_sequenceOptional ""> 
+<!ENTITY % model.gLike_sequenceOptionalRepeatable ""> 
+<!ENTITY % model.gLike_sequenceRepeatable ""> 
+<!ENTITY % model.phrase.xml "att |
+ gi |
+ val"> 
+<!ENTITY % model.phrase.xml_sequence "att, gi, val"> 
+<!ENTITY % model.phrase.xml_sequenceOptional "att?, gi?, val?"> 
+<!ENTITY % model.phrase.xml_sequenceOptionalRepeatable "att*, gi*, val*"> 
+<!ENTITY % model.phrase.xml_sequenceRepeatable "att+, gi+, val+"> 
+<!ENTITY % model.biblLike "bibl |
+ biblFull"> 
+<!ENTITY % model.biblLike_sequence "bibl, biblFull"> 
+<!ENTITY % model.biblLike_sequenceOptional "bibl?, biblFull?"> 
+<!ENTITY % model.biblLike_sequenceOptionalRepeatable "bibl*, biblFull*"> 
+<!ENTITY % model.biblLike_sequenceRepeatable "bibl+, biblFull+"> 
+<!ENTITY % model.headLike "head"> 
+<!ENTITY % model.headLike_sequence "head"> 
+<!ENTITY % model.headLike_sequenceOptional "head?"> 
+<!ENTITY % model.headLike_sequenceOptionalRepeatable "head*"> 
+<!ENTITY % model.headLike_sequenceRepeatable "head+"> 
+<!ENTITY % model.labelLike "desc |
+ label"> 
+<!ENTITY % model.labelLike_sequence "desc, label"> 
+<!ENTITY % model.labelLike_sequenceOptional "desc?, label?"> 
+<!ENTITY % model.labelLike_sequenceOptionalRepeatable "desc*, label*"> 
+<!ENTITY % model.labelLike_sequenceRepeatable "desc+, label+"> 
+<!ENTITY % model.listLike "list |
+ listBibl"> 
+<!ENTITY % model.listLike_sequence "list, listBibl"> 
+<!ENTITY % model.listLike_sequenceOptional "list?, listBibl?"> 
+<!ENTITY % model.listLike_sequenceOptionalRepeatable "list*, listBibl*"> 
+<!ENTITY % model.listLike_sequenceRepeatable "list+, listBibl+"> 
+<!ENTITY % model.noteLike "note"> 
+<!ENTITY % model.noteLike_sequence "note"> 
+<!ENTITY % model.noteLike_sequenceOptional "note?"> 
+<!ENTITY % model.noteLike_sequenceOptionalRepeatable "note*"> 
+<!ENTITY % model.noteLike_sequenceRepeatable "note+"> 
+<!ENTITY % model.lLike "l"> 
+<!ENTITY % model.lLike_sequence "l"> 
+<!ENTITY % model.lLike_sequenceOptional "l?"> 
+<!ENTITY % model.lLike_sequenceOptionalRepeatable "l*"> 
+<!ENTITY % model.lLike_sequenceRepeatable "l+"> 
+<!ENTITY % model.pLike "p"> 
+<!ENTITY % model.pLike_sequence "p"> 
+<!ENTITY % model.pLike_sequenceOptional "p?"> 
+<!ENTITY % model.pLike_sequenceOptionalRepeatable "p*"> 
+<!ENTITY % model.pLike_sequenceRepeatable "p+"> 
+<!ENTITY % model.stageLike "stage"> 
+<!ENTITY % model.stageLike_sequence "stage"> 
+<!ENTITY % model.stageLike_sequenceOptional "stage?"> 
+<!ENTITY % model.stageLike_sequenceOptionalRepeatable "stage*"> 
+<!ENTITY % model.stageLike_sequenceRepeatable "stage+"> 
+<!ENTITY % model.entryPart ""> 
+<!ENTITY % model.entryPart_sequence ""> 
+<!ENTITY % model.entryPart_sequenceOptional ""> 
+<!ENTITY % model.entryPart_sequenceOptionalRepeatable ""> 
+<!ENTITY % model.entryPart_sequenceRepeatable ""> 
+<!ENTITY % model.entryPart.top "cit"> 
+<!ENTITY % model.entryPart.top_sequence "cit"> 
+<!ENTITY % model.entryPart.top_sequenceOptional "cit?"> 
+<!ENTITY % model.entryPart.top_sequenceOptionalRepeatable "cit*"> 
+<!ENTITY % model.entryPart.top_sequenceRepeatable "cit+"> 
+<!ENTITY % model.global.edit "gap"> 
+<!ENTITY % model.global.edit_sequence "gap"> 
+<!ENTITY % model.global.edit_sequenceOptional "gap?"> 
+<!ENTITY % model.global.edit_sequenceOptionalRepeatable "gap*"> 
+<!ENTITY % model.global.edit_sequenceRepeatable "gap+"> 
+<!ENTITY % model.divPart "%model.lLike; |
+ %model.pLike; |
+ lg |
+ sp"> 
+<!ENTITY % model.divPart_sequence "%model.lLike;, %model.pLike;, lg, sp"> 
+<!ENTITY % model.divPart_sequenceOptional "%model.lLike;?, %model.pLike;?, lg?, sp?"> 
+<!ENTITY % model.divPart_sequenceOptionalRepeatable "%model.lLike;*, %model.pLike;*, lg*, sp*"> 
+<!ENTITY % model.divPart_sequenceRepeatable "%model.lLike;+, %model.pLike;+, lg+, sp+"> 
+<!ENTITY % model.personPart "bibl"> 
+<!ENTITY % model.personPart_sequence "bibl"> 
+<!ENTITY % model.personPart_sequenceOptional "bibl?"> 
+<!ENTITY % model.personPart_sequenceOptionalRepeatable "bibl*"> 
+<!ENTITY % model.personPart_sequenceRepeatable "bibl+"> 
+<!ENTITY % model.publicationStmtPart "address |
+ date |
+ publisher |
+ pubPlace |
+ distributor |
+ authority |
+ idno |
+ availability"> 
+<!ENTITY % model.publicationStmtPart_sequence "address, date, publisher, pubPlace, distributor, authority, idno, availability"> 
+<!ENTITY % model.publicationStmtPart_sequenceOptional "address?, date?, publisher?, pubPlace?, distributor?, authority?, idno?, availability?"> 
+<!ENTITY % model.publicationStmtPart_sequenceOptionalRepeatable "address*, date*, publisher*, pubPlace*, distributor*, authority*, idno*, availability*"> 
+<!ENTITY % model.publicationStmtPart_sequenceRepeatable "address+, date+, publisher+, pubPlace+, distributor+, authority+, idno+, availability+"> 
+<!ENTITY % model.glossLike "desc |
+ gloss"> 
+<!ENTITY % model.glossLike_sequence "desc, gloss"> 
+<!ENTITY % model.glossLike_sequenceOptional "desc?, gloss?"> 
+<!ENTITY % model.glossLike_sequenceOptionalRepeatable "desc*, gloss*"> 
+<!ENTITY % model.glossLike_sequenceRepeatable "desc+, gloss+"> 
+<!ENTITY % model.quoteLike "quote |
+ cit"> 
+<!ENTITY % model.quoteLike_sequence "quote, cit"> 
+<!ENTITY % model.quoteLike_sequenceOptional "quote?, cit?"> 
+<!ENTITY % model.quoteLike_sequenceOptionalRepeatable "quote*, cit*"> 
+<!ENTITY % model.quoteLike_sequenceRepeatable "quote+, cit+"> 
+<!ENTITY % model.qLike "%model.quoteLike; |
+ said |
+ q"> 
+<!ENTITY % model.qLike_sequence "%model.quoteLike;, said, q"> 
+<!ENTITY % model.qLike_sequenceOptional "%model.quoteLike;?, said?, q?"> 
+<!ENTITY % model.qLike_sequenceOptionalRepeatable "%model.quoteLike;*, said*, q*"> 
+<!ENTITY % model.qLike_sequenceRepeatable "%model.quoteLike;+, said+, q+"> 
+<!ENTITY % model.respLike "author |
+ editor |
+ respStmt |
+ sponsor |
+ funder |
+ principal"> 
+<!ENTITY % model.respLike_sequence "author, editor, respStmt, sponsor, funder, principal"> 
+<!ENTITY % model.respLike_sequenceOptional "author?, editor?, respStmt?, sponsor?, funder?, principal?"> 
+<!ENTITY % model.respLike_sequenceOptionalRepeatable "author*, editor*, respStmt*, sponsor*, funder*, principal*"> 
+<!ENTITY % model.respLike_sequenceRepeatable "author+, editor+, respStmt+, sponsor+, funder+, principal+"> 
+<!ENTITY % model.divWrapper "byline |
+ dateline |
+ argument |
+ epigraph |
+ salute |
+ docAuthor |
+ docDate"> 
+<!ENTITY % model.divWrapper_sequence "byline, dateline, argument, epigraph, salute, docAuthor, docDate"> 
+<!ENTITY % model.divWrapper_sequenceOptional "byline?, dateline?, argument?, epigraph?, salute?, docAuthor?, docDate?"> 
+<!ENTITY % model.divWrapper_sequenceOptionalRepeatable "byline*, dateline*, argument*, epigraph*, salute*, docAuthor*, docDate*"> 
+<!ENTITY % model.divWrapper_sequenceRepeatable "byline+, dateline+, argument+, epigraph+, salute+, docAuthor+, docDate+"> 
+<!ENTITY % model.divTopPart "%model.headLike; |
+ opener"> 
+<!ENTITY % model.divTopPart_sequence "%model.headLike;, opener"> 
+<!ENTITY % model.divTopPart_sequenceOptional "%model.headLike;?, opener?"> 
+<!ENTITY % model.divTopPart_sequenceOptionalRepeatable "%model.headLike;*, opener*"> 
+<!ENTITY % model.divTopPart_sequenceRepeatable "%model.headLike;+, opener+"> 
+<!ENTITY % model.divTop "%model.divWrapper; |
+ %model.divTopPart;"> 
+<!ENTITY % model.divTop_sequence "%model.divWrapper;, %model.divTopPart;"> 
+<!ENTITY % model.divTop_sequenceOptional "%model.divWrapper;?, %model.divTopPart;?"> 
+<!ENTITY % model.divTop_sequenceOptionalRepeatable "%model.divWrapper;*, %model.divTopPart;*"> 
+<!ENTITY % model.divTop_sequenceRepeatable "%model.divWrapper;+, %model.divTopPart;+"> 
+<!ENTITY % model.pLike.front "head |
+ byline |
+ argument |
+ epigraph |
+ docTitle |
+ titlePart |
+ docAuthor |
+ docEdition |
+ docImprint |
+ docDate"> 
+<!ENTITY % model.pLike.front_sequence "head, byline, argument, epigraph, docTitle, titlePart, docAuthor, docEdition, docImprint, docDate"> 
+<!ENTITY % model.pLike.front_sequenceOptional "head?, byline?, argument?, epigraph?, docTitle?, titlePart?, docAuthor?, docEdition?, docImprint?, docDate?"> 
+<!ENTITY % model.pLike.front_sequenceOptionalRepeatable "head*, byline*, argument*, epigraph*, docTitle*, titlePart*, docAuthor*, docEdition*, docImprint*, docDate*"> 
+<!ENTITY % model.pLike.front_sequenceRepeatable "head+, byline+, argument+, epigraph+, docTitle+, titlePart+, docAuthor+, docEdition+, docImprint+, docDate+"> 
+<!ENTITY % model.divBottomPart "trailer |
+ closer |
+ signed |
+ postscript"> 
+<!ENTITY % model.divBottomPart_sequence "trailer, closer, signed, postscript"> 
+<!ENTITY % model.divBottomPart_sequenceOptional "trailer?, closer?, signed?, postscript?"> 
+<!ENTITY % model.divBottomPart_sequenceOptionalRepeatable "trailer*, closer*, signed*, postscript*"> 
+<!ENTITY % model.divBottomPart_sequenceRepeatable "trailer+, closer+, signed+, postscript+"> 
+<!ENTITY % model.divBottom "%model.divWrapper; |
+ %model.divBottomPart;"> 
+<!ENTITY % model.divBottom_sequence "%model.divWrapper;, %model.divBottomPart;"> 
+<!ENTITY % model.divBottom_sequenceOptional "%model.divWrapper;?, %model.divBottomPart;?"> 
+<!ENTITY % model.divBottom_sequenceOptionalRepeatable "%model.divWrapper;*, %model.divBottomPart;*"> 
+<!ENTITY % model.divBottom_sequenceRepeatable "%model.divWrapper;+, %model.divBottomPart;+"> 
+<!ENTITY % model.titlepagePart "graphic |
+ byline |
+ argument |
+ epigraph |
+ docTitle |
+ titlePart |
+ docAuthor |
+ docEdition |
+ docImprint |
+ docDate"> 
+<!ENTITY % model.titlepagePart_sequence "graphic, byline, argument, epigraph, docTitle, titlePart, docAuthor, docEdition, docImprint, docDate"> 
+<!ENTITY % model.titlepagePart_sequenceOptional "graphic?, byline?, argument?, epigraph?, docTitle?, titlePart?, docAuthor?, docEdition?, docImprint?, docDate?"> 
+<!ENTITY % model.titlepagePart_sequenceOptionalRepeatable "graphic*, byline*, argument*, epigraph*, docTitle*, titlePart*, docAuthor*, docEdition*, docImprint*, docDate*"> 
+<!ENTITY % model.titlepagePart_sequenceRepeatable "graphic+, byline+, argument+, epigraph+, docTitle+, titlePart+, docAuthor+, docEdition+, docImprint+, docDate+"> 
+<!ENTITY % model.msQuoteLike "title"> 
+<!ENTITY % model.msQuoteLike_sequence "title"> 
+<!ENTITY % model.msQuoteLike_sequenceOptional "title?"> 
+<!ENTITY % model.msQuoteLike_sequenceOptionalRepeatable "title*"> 
+<!ENTITY % model.msQuoteLike_sequenceRepeatable "title+"> 
+<!ENTITY % model.msItemPart "%model.quoteLike; |
+ %model.respLike; |
+ %model.msQuoteLike; |
+ bibl |
+ listBibl"> 
+<!ENTITY % model.msItemPart_sequence "%model.quoteLike;, %model.respLike;, %model.msQuoteLike;, bibl, listBibl"> 
+<!ENTITY % model.msItemPart_sequenceOptional "%model.quoteLike;?, %model.respLike;?, %model.msQuoteLike;?, bibl?, listBibl?"> 
+<!ENTITY % model.msItemPart_sequenceOptionalRepeatable "%model.quoteLike;*, %model.respLike;*, %model.msQuoteLike;*, bibl*, listBibl*"> 
+<!ENTITY % model.msItemPart_sequenceRepeatable "%model.quoteLike;+, %model.respLike;+, %model.msQuoteLike;+, bibl+, listBibl+"> 
+<!ENTITY % model.choicePart "sic |
+ corr |
+ reg |
+ orig |
+ unclear |
+ abbr |
+ expan |
+ seg"> 
+<!ENTITY % model.choicePart_sequence "sic, corr, reg, orig, unclear, abbr, expan, seg"> 
+<!ENTITY % model.choicePart_sequenceOptional "sic?, corr?, reg?, orig?, unclear?, abbr?, expan?, seg?"> 
+<!ENTITY % model.choicePart_sequenceOptionalRepeatable "sic*, corr*, reg*, orig*, unclear*, abbr*, expan*, seg*"> 
+<!ENTITY % model.choicePart_sequenceRepeatable "sic+, corr+, reg+, orig+, unclear+, abbr+, expan+, seg+"> 
+<!ENTITY % model.imprintPart "publisher |
+ biblScope |
+ pubPlace |
+ distributor"> 
+<!ENTITY % model.imprintPart_sequence "publisher, biblScope, pubPlace, distributor"> 
+<!ENTITY % model.imprintPart_sequenceOptional "publisher?, biblScope?, pubPlace?, distributor?"> 
+<!ENTITY % model.imprintPart_sequenceOptionalRepeatable "publisher*, biblScope*, pubPlace*, distributor*"> 
+<!ENTITY % model.imprintPart_sequenceRepeatable "publisher+, biblScope+, pubPlace+, distributor+"> 
+<!ENTITY % model.catDescPart ""> 
+<!ENTITY % model.catDescPart_sequence ""> 
+<!ENTITY % model.catDescPart_sequenceOptional ""> 
+<!ENTITY % model.catDescPart_sequenceOptionalRepeatable ""> 
+<!ENTITY % model.catDescPart_sequenceRepeatable ""> 
+<!ENTITY % model.addressLike "address"> 
+<!ENTITY % model.addressLike_sequence "address"> 
+<!ENTITY % model.addressLike_sequenceOptional "address?"> 
+<!ENTITY % model.addressLike_sequenceOptionalRepeatable "address*"> 
+<!ENTITY % model.addressLike_sequenceRepeatable "address+"> 
+<!ENTITY % model.nameLike "%model.nameLike.agent; |
+ rs |
+ idno"> 
+<!ENTITY % model.nameLike_sequence "%model.nameLike.agent;, rs, idno"> 
+<!ENTITY % model.nameLike_sequenceOptional "%model.nameLike.agent;?, rs?, idno?"> 
+<!ENTITY % model.nameLike_sequenceOptionalRepeatable "%model.nameLike.agent;*, rs*, idno*"> 
+<!ENTITY % model.nameLike_sequenceRepeatable "%model.nameLike.agent;+, rs+, idno+"> 
+<!ENTITY % model.global "%model.global.meta; |
+ %model.milestoneLike; |
+ %model.noteLike; |
+ %model.global.edit; |
+ figure"> 
+<!ENTITY % model.global_sequence "%model.global.meta;, %model.milestoneLike;, %model.noteLike;, %model.global.edit;, figure"> 
+<!ENTITY % model.global_sequenceOptional "%model.global.meta;?, %model.milestoneLike;?, %model.noteLike;?, %model.global.edit;?, figure?"> 
+<!ENTITY % model.global_sequenceOptionalRepeatable "%model.global.meta;*, %model.milestoneLike;*, %model.noteLike;*, %model.global.edit;*, figure*"> 
+<!ENTITY % model.global_sequenceRepeatable "%model.global.meta;+, %model.milestoneLike;+, %model.noteLike;+, %model.global.edit;+, figure+"> 
+<!ENTITY % model.biblPart "%model.respLike; |
+ %model.imprintPart; |
+ relatedItem |
+ edition |
+ extent"> 
+<!ENTITY % model.biblPart_sequence "%model.respLike;, %model.imprintPart;, relatedItem, edition, extent"> 
+<!ENTITY % model.biblPart_sequenceOptional "%model.respLike;?, %model.imprintPart;?, relatedItem?, edition?, extent?"> 
+<!ENTITY % model.biblPart_sequenceOptionalRepeatable "%model.respLike;*, %model.imprintPart;*, relatedItem*, edition*, extent*"> 
+<!ENTITY % model.biblPart_sequenceRepeatable "%model.respLike;+, %model.imprintPart;+, relatedItem+, edition+, extent+"> 
+<!ENTITY % model.frontPart "divGen |
+ titlePage"> 
+<!ENTITY % model.frontPart_sequence "divGen, titlePage"> 
+<!ENTITY % model.frontPart_sequenceOptional "divGen?, titlePage?"> 
+<!ENTITY % model.frontPart_sequenceOptionalRepeatable "divGen*, titlePage*"> 
+<!ENTITY % model.frontPart_sequenceRepeatable "divGen+, titlePage+"> 
+<!ENTITY % model.addrPart "%model.nameLike; |
+ addrLine"> 
+<!ENTITY % model.addrPart_sequence "%model.nameLike;, addrLine"> 
+<!ENTITY % model.addrPart_sequenceOptional "%model.nameLike;?, addrLine?"> 
+<!ENTITY % model.addrPart_sequenceOptionalRepeatable "%model.nameLike;*, addrLine*"> 
+<!ENTITY % model.addrPart_sequenceRepeatable "%model.nameLike;+, addrLine+"> 
+<!ENTITY % model.pPart.data "%model.dateLike; |
+ %model.measureLike; |
+ %model.addressLike; |
+ %model.nameLike;"> 
+<!ENTITY % model.pPart.data_sequence "%model.dateLike;, %model.measureLike;, %model.addressLike;, %model.nameLike;"> 
+<!ENTITY % model.pPart.data_sequenceOptional "%model.dateLike;?, %model.measureLike;?, %model.addressLike;?, %model.nameLike;?"> 
+<!ENTITY % model.pPart.data_sequenceOptionalRepeatable "%model.dateLike;*, %model.measureLike;*, %model.addressLike;*, %model.nameLike;*"> 
+<!ENTITY % model.pPart.data_sequenceRepeatable "%model.dateLike;+, %model.measureLike;+, %model.addressLike;+, %model.nameLike;+"> 
+<!ENTITY % model.inter "%model.egLike; |
+ %model.biblLike; |
+ %model.labelLike; |
+ %model.listLike; |
+ %model.stageLike; |
+ %model.qLike; |
+ table"> 
+<!ENTITY % model.inter_sequence "%model.egLike;, %model.biblLike;, %model.labelLike;, %model.listLike;, %model.stageLike;, %model.qLike;, table"> 
+<!ENTITY % model.inter_sequenceOptional "%model.egLike;?, %model.biblLike;?, %model.labelLike;?, %model.listLike;?, %model.stageLike;?, %model.qLike;?, table?"> 
+<!ENTITY % model.inter_sequenceOptionalRepeatable "%model.egLike;*, %model.biblLike;*, %model.labelLike;*, %model.listLike;*, %model.stageLike;*, %model.qLike;*, table*"> 
+<!ENTITY % model.inter_sequenceRepeatable "%model.egLike;+, %model.biblLike;+, %model.labelLike;+, %model.listLike;+, %model.stageLike;+, %model.qLike;+, table+"> 
+<!ENTITY % model.common "%model.divPart; |
+ %model.inter;"> 
+<!ENTITY % model.common_sequence "%model.divPart;, %model.inter;"> 
+<!ENTITY % model.common_sequenceOptional "%model.divPart;?, %model.inter;?"> 
+<!ENTITY % model.common_sequenceOptionalRepeatable "%model.divPart;*, %model.inter;*"> 
+<!ENTITY % model.common_sequenceRepeatable "%model.divPart;+, %model.inter;+"> 
+<!ENTITY % model.phrase "%model.segLike; |
+ %model.highlighted; |
+ %model.graphicLike; |
+ %model.pPart.edit; |
+ %model.ptrLike; |
+ %model.phrase.xml; |
+ %model.pPart.data;"> 
+<!ENTITY % model.phrase_sequence "%model.segLike;, %model.highlighted;, %model.graphicLike;, %model.pPart.edit;, %model.ptrLike;, %model.phrase.xml;, %model.pPart.data;"> 
+<!ENTITY % model.phrase_sequenceOptional "%model.segLike;?, %model.highlighted;?, %model.graphicLike;?, %model.pPart.edit;?, %model.ptrLike;?, %model.phrase.xml;?, %model.pPart.data;?"> 
+<!ENTITY % model.phrase_sequenceOptionalRepeatable "%model.segLike;*, %model.highlighted;*, %model.graphicLike;*, %model.pPart.edit;*, %model.ptrLike;*, %model.phrase.xml;*, %model.pPart.data;*"> 
+<!ENTITY % model.phrase_sequenceRepeatable "%model.segLike;+, %model.highlighted;+, %model.graphicLike;+, %model.pPart.edit;+, %model.ptrLike;+, %model.phrase.xml;+, %model.pPart.data;+"> 
+<!ENTITY % model.limitedPhrase "%model.emphLike; |
+ %model.pPart.editorial; |
+ %model.ptrLike; |
+ %model.phrase.xml; |
+ %model.pPart.data;"> 
+<!ENTITY % model.limitedPhrase_sequence "%model.emphLike;, %model.pPart.editorial;, %model.ptrLike;, %model.phrase.xml;, %model.pPart.data;"> 
+<!ENTITY % model.limitedPhrase_sequenceOptional "%model.emphLike;?, %model.pPart.editorial;?, %model.ptrLike;?, %model.phrase.xml;?, %model.pPart.data;?"> 
+<!ENTITY % model.limitedPhrase_sequenceOptionalRepeatable "%model.emphLike;*, %model.pPart.editorial;*, %model.ptrLike;*, %model.phrase.xml;*, %model.pPart.data;*"> 
+<!ENTITY % model.limitedPhrase_sequenceRepeatable "%model.emphLike;+, %model.pPart.editorial;+, %model.ptrLike;+, %model.phrase.xml;+, %model.pPart.data;+"> 
+<!ENTITY % model.divLike "div"> 
+<!ENTITY % model.divLike_sequence "div"> 
+<!ENTITY % model.divLike_sequenceOptional "div?"> 
+<!ENTITY % model.divLike_sequenceOptionalRepeatable "div*"> 
+<!ENTITY % model.divLike_sequenceRepeatable "div+"> 
+<!ENTITY % model.divGenLike "divGen"> 
+<!ENTITY % model.divGenLike_sequence "divGen"> 
+<!ENTITY % model.divGenLike_sequenceOptional "divGen?"> 
+<!ENTITY % model.divGenLike_sequenceOptionalRepeatable "divGen*"> 
+<!ENTITY % model.divGenLike_sequenceRepeatable "divGen+"> 
+<!ENTITY % model.div1Like ""> 
+<!ENTITY % model.div1Like_sequence ""> 
+<!ENTITY % model.div1Like_sequenceOptional ""> 
+<!ENTITY % model.div1Like_sequenceOptionalRepeatable ""> 
+<!ENTITY % model.div1Like_sequenceRepeatable ""> 
+<!ENTITY % model.applicationLike "application"> 
+<!ENTITY % model.applicationLike_sequence "application"> 
+<!ENTITY % model.applicationLike_sequenceOptional "application?"> 
+<!ENTITY % model.applicationLike_sequenceOptionalRepeatable "application*"> 
+<!ENTITY % model.applicationLike_sequenceRepeatable "application+"> 
+<!ENTITY % model.teiHeaderPart "encodingDesc |
+ profileDesc"> 
+<!ENTITY % model.teiHeaderPart_sequence "encodingDesc, profileDesc"> 
+<!ENTITY % model.teiHeaderPart_sequenceOptional "encodingDesc?, profileDesc?"> 
+<!ENTITY % model.teiHeaderPart_sequenceOptionalRepeatable "encodingDesc*, profileDesc*"> 
+<!ENTITY % model.teiHeaderPart_sequenceRepeatable "encodingDesc+, profileDesc+"> 
+<!ENTITY % model.sourceDescPart ""> 
+<!ENTITY % model.sourceDescPart_sequence ""> 
+<!ENTITY % model.sourceDescPart_sequenceOptional ""> 
+<!ENTITY % model.sourceDescPart_sequenceOptionalRepeatable ""> 
+<!ENTITY % model.sourceDescPart_sequenceRepeatable ""> 
+<!ENTITY % model.encodingDescPart "projectDesc |
+ samplingDecl |
+ editorialDecl |
+ refsDecl |
+ classDecl |
+ appInfo |
+ geoDecl"> 
+<!ENTITY % model.encodingDescPart_sequence "projectDesc, samplingDecl, editorialDecl, refsDecl, classDecl, appInfo, geoDecl"> 
+<!ENTITY % model.encodingDescPart_sequenceOptional "projectDesc?, samplingDecl?, editorialDecl?, refsDecl?, classDecl?, appInfo?, geoDecl?"> 
+<!ENTITY % model.encodingDescPart_sequenceOptionalRepeatable "projectDesc*, samplingDecl*, editorialDecl*, refsDecl*, classDecl*, appInfo*, geoDecl*"> 
+<!ENTITY % model.encodingDescPart_sequenceRepeatable "projectDesc+, samplingDecl+, editorialDecl+, refsDecl+, classDecl+, appInfo+, geoDecl+"> 
+<!ENTITY % model.editorialDeclPart ""> 
+<!ENTITY % model.editorialDeclPart_sequence ""> 
+<!ENTITY % model.editorialDeclPart_sequenceOptional ""> 
+<!ENTITY % model.editorialDeclPart_sequenceOptionalRepeatable ""> 
+<!ENTITY % model.editorialDeclPart_sequenceRepeatable ""> 
+<!ENTITY % model.profileDescPart "creation |
+ langUsage |
+ textClass"> 
+<!ENTITY % model.profileDescPart_sequence "creation, langUsage, textClass"> 
+<!ENTITY % model.profileDescPart_sequenceOptional "creation?, langUsage?, textClass?"> 
+<!ENTITY % model.profileDescPart_sequenceOptionalRepeatable "creation*, langUsage*, textClass*"> 
+<!ENTITY % model.profileDescPart_sequenceRepeatable "creation+, langUsage+, textClass+"> 
+<!ENTITY % model.resourceLike ""> 
+<!ENTITY % model.resourceLike_sequence ""> 
+<!ENTITY % model.resourceLike_sequenceOptional ""> 
+<!ENTITY % model.resourceLike_sequenceOptionalRepeatable ""> 
+<!ENTITY % model.resourceLike_sequenceRepeatable ""> <!ENTITY % att.global.linking.attributes '
+corresp CDATA  #IMPLIED
+synch CDATA  #IMPLIED
+sameAs %data.pointer;  #IMPLIED
+copyOf %data.pointer;  #IMPLIED
+next %data.pointer;  #IMPLIED
+prev %data.pointer;  #IMPLIED
+exclude CDATA  #IMPLIED
+select CDATA  #IMPLIED'> 
+<!ENTITY % att.global.linking.attribute.corresp '
+corresp CDATA  #IMPLIED'>
+
+<!ENTITY % att.global.linking.attribute.synch '
+synch CDATA  #IMPLIED'>
+
+<!ENTITY % att.global.linking.attribute.sameAs '
+sameAs %data.pointer;  #IMPLIED'>
+
+<!ENTITY % att.global.linking.attribute.copyOf '
+copyOf %data.pointer;  #IMPLIED'>
+
+<!ENTITY % att.global.linking.attribute.next '
+next %data.pointer;  #IMPLIED'>
+
+<!ENTITY % att.global.linking.attribute.prev '
+prev %data.pointer;  #IMPLIED'>
+
+<!ENTITY % att.global.linking.attribute.exclude '
+exclude CDATA  #IMPLIED'>
+
+<!ENTITY % att.global.linking.attribute.select '
+select CDATA  #IMPLIED'>
+<!ENTITY % att.global.analytic.attributes '
+ana CDATA  #IMPLIED'> 
+<!ENTITY % att.global.analytic.attribute.ana '
+ana CDATA  #IMPLIED'>
+
+<!-- start predeclared patterns -->
+
+<!-- end predeclared patterns -->
+
+<!-- start rest of patterns -->
+
+<!ENTITY % macro.paraContent '( #PCDATA |
+ _DUMMY_model.gLike |
+ %model.phrase; |
+ %model.inter; |
+ %model.global;)*' >
+
+<!ENTITY % macro.limitedContent '( #PCDATA |
+ %model.limitedPhrase; |
+ %model.inter;)*' >
+
+<!ENTITY % macro.phraseSeq '( #PCDATA |
+ _DUMMY_model.gLike |
+ %model.phrase; |
+ %model.global;)*' >
+
+<!ENTITY % macro.phraseSeq.limited '( #PCDATA |
+ %model.limitedPhrase; |
+ %model.global;)*' >
+
+<!ENTITY % macro.specialPara '( #PCDATA |
+ _DUMMY_model.gLike |
+ %model.phrase; |
+ %model.inter; |
+ %model.divPart; |
+ %model.global;)*' >
+
+<!ENTITY % macro.xtext '( #PCDATA |
+ _DUMMY_model.gLike)*' >
+
+<!ENTITY % macro.anyXML ' ANY' >
+
+<!-- end patterns -->
+
+<!-- start elements -->
+
+<!--doc:(TEI document) contains a single TEI-conformant document,
+comprising a TEI header and a text, either in isolation or as part of a
+teiCorpus element. -->
+<!ELEMENT TEI (teiHeader,((_DUMMY_model.resourceLike+,text?) |
+ text))>
+<!ATTLIST TEI xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST TEI
+ %att.global.attributes;
+version %data.version;  #IMPLIED >
+<!ATTLIST TEI xsi:schemaLocation CDATA #IMPLIED
+ xmlns:xsi CDATA #FIXED 'http://www.w3.org/2001/XMLSchema-instance'
+ >
+<!--doc:(abbreviation) contains an abbreviation of any sort. -->
+<!ELEMENT abbr %macro.phraseSeq;>
+<!ATTLIST abbr xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST abbr
+ %att.global.attributes;
+ %att.responsibility.attributes;
+type %data.enumerated;  #IMPLIED >
+<!--doc:(addition) contains letters, words, or phrases inserted in the text by an
+        author, scribe, annotator, or corrector. -->
+<!ELEMENT add %macro.paraContent;>
+<!ATTLIST add xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST add
+ %att.global.attributes;
+ %att.transcriptional.attributes;
+ %att.placement.attributes;
+ %att.typed.attributes; >
+<!--doc:(address line) contains one line of a postal address. -->
+<!ELEMENT addrLine %macro.phraseSeq;>
+<!ATTLIST addrLine xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST addrLine
+ %att.global.attributes; >
+<!--doc:contains a postal  address, for example of a
+        publisher, an organization, or an individual. -->
+<!ELEMENT address ((%model.global;)*,((%model.addrPart;),(%model.global;)*)+)>
+<!ATTLIST address xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST address
+ %att.global.attributes; >
+<!--doc:(anchor point) attaches an identifier to a point within a text, whether or not it corresponds with a textual element. -->
+<!ELEMENT anchor EMPTY>
+<!ATTLIST anchor xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST anchor
+ %att.global.attributes;
+ %att.typed.attributes; >
+<!--doc:(application information) records information about an application which has
+  edited the TEI file.  -->
+<!ELEMENT appInfo (%model.applicationLike;)+>
+<!ATTLIST appInfo xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST appInfo
+ %att.global.attributes; >
+<!--doc:provides information about an application which has acted upon the document. -->
+<!ELEMENT application ((%model.labelLike;)+,((%model.ptrLike;)* |
+ (%model.pLike;)*))>
+<!ATTLIST application xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST application
+ %att.global.attributes;
+ %att.typed.attributes;
+ %att.datable.attributes;
+ident %data.name;  #REQUIRED
+version CDATA #REQUIRED >
+<!--doc:A formal list or prose description of the topics addressed by
+	a subdivision of a text. -->
+<!ELEMENT argument ((%model.global; |
+ %model.headLike;)*,((%model.common;),(%model.global;)*)+)>
+<!ATTLIST argument xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST argument
+ %att.global.attributes; >
+<!--doc:(attribute) contains the name of an attribute appearing within running text. -->
+<!ELEMENT att  (#PCDATA)>
+<!ATTLIST att xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST att
+ %att.global.attributes;
+scheme %data.enumerated;  "TEI"  >
+<!--doc:in a bibliographic reference, contains the name(s) of the
+  author(s), personal or corporate, of a work; for example in the same
+  form as that provided by a recognized bibliographic name authority.  -->
+<!ELEMENT author %macro.phraseSeq;>
+<!ATTLIST author xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST author
+ %att.global.attributes;
+ %att.naming.attributes; >
+<!--doc:(release authority) supplies the name of a person or other agency responsible for
+  making an electronic file available, other than a publisher or
+  distributor. -->
+<!ELEMENT authority %macro.phraseSeq.limited;>
+<!ATTLIST authority xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST authority
+ %att.global.attributes; >
+<!--doc:supplies information about the availability of a text, for example any restrictions on its
+    use or distribution, its copyright status, etc. -->
+<!ELEMENT availability (%model.pLike;)+>
+<!ATTLIST availability xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST availability
+ %att.global.attributes;
+ %att.declarable.attributes;
+status (free|unknown|restricted) "unknown"  >
+<!--doc:(back matter) contains any appendixes, etc. following the main part of a text. -->
+<!ELEMENT back ((%model.frontPart; |
+ %model.pLike.front; |
+ %model.global;)*,((_DUMMY_model.div1Like,(%model.frontPart; |
+ _DUMMY_model.div1Like |
+ %model.global;)*) |
+ ((%model.divLike;),(%model.frontPart; |
+ %model.divLike; |
+ %model.global;)*))?,((%model.divBottomPart;),(%model.divBottomPart; |
+ %model.global;)*)?)>
+<!ATTLIST back xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST back
+ %att.global.attributes;
+ %att.declaring.attributes; >
+<!--doc:(bibliographic citation) contains a loosely-structured bibliographic citation of which the sub-components may or may
+    not be explicitly tagged.  -->
+<!ELEMENT bibl ( #PCDATA |
+ _DUMMY_model.gLike |
+ %model.highlighted; |
+ %model.pPart.data; |
+ %model.pPart.edit; |
+ %model.segLike; |
+ %model.ptrLike; |
+ %model.biblPart; |
+ %model.global;)*>
+<!ATTLIST bibl xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST bibl
+ %att.global.attributes;
+ %att.declarable.attributes;
+ %att.typed.attributes; >
+<!--doc:(fully-structured bibliographic citation) contains a fully-structured bibliographic citation, in which all components of the TEI file
+    description are present. -->
+<!ELEMENT biblFull ((titleStmt,editionStmt?,extent?,publicationStmt,seriesStmt?,notesStmt?),sourceDesc*)>
+<!ATTLIST biblFull xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST biblFull
+ %att.global.attributes;
+ %att.declarable.attributes; >
+<!--doc:(scope of citation) defines the scope of a bibliographic reference, for example as a
+        list of page numbers, or a named subdivision of a larger work. -->
+<!ELEMENT biblScope %macro.phraseSeq;>
+<!ATTLIST biblScope xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST biblScope
+ %att.global.attributes;
+type %data.enumerated;  #IMPLIED
+from %data.word;  #IMPLIED
+to %data.word;  #IMPLIED >
+<!--doc:(text body) contains the whole body of a single unitary text, excluding any front or back matter. -->
+<!ELEMENT body ((%model.global;)*,((%model.divTop;),(%model.global; |
+ %model.divTop;)*)?,((%model.divGenLike;),(%model.global; |
+ %model.divGenLike;)*)?,(((%model.divLike;),(%model.global; |
+ %model.divGenLike;)*)+ |
+ (_DUMMY_model.div1Like,(%model.global; |
+ %model.divGenLike;)*)+ |
+ (((%model.common;),(%model.global;)*)+,(((%model.divLike;),(%model.global; |
+ %model.divGenLike;)*)+ |
+ (_DUMMY_model.div1Like,(%model.global; |
+ %model.divGenLike;)*)+)?)),((%model.divBottom;),(%model.global;)*)*)>
+<!ATTLIST body xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST body
+ %att.global.attributes;
+ %att.declaring.attributes; >
+<!--doc:contains the primary statement of responsibility given for a work
+on its title page or at the head or end of the work. -->
+<!ELEMENT byline ( #PCDATA |
+ _DUMMY_model.gLike |
+ %model.phrase; |
+ docAuthor |
+ %model.global;)*>
+<!ATTLIST byline xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST byline
+ %att.global.attributes; >
+<!--doc:(canonical reference pattern) specifies an expression and replacement pattern for transforming a canonical reference into
+    a URI.  -->
+<!ELEMENT cRefPattern (%model.pLike;)*>
+<!ATTLIST cRefPattern xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST cRefPattern
+ %att.global.attributes;
+matchPattern %data.pattern;  #REQUIRED
+replacementPattern CDATA #REQUIRED >
+<!--doc:(category description) describes some category within a taxonomy or text typology, either in the form of a brief
+    prose description or in terms of the situational parameters used by the TEI formal textDesc. -->
+<!ELEMENT catDesc ( #PCDATA |
+ %model.limitedPhrase; |
+ _DUMMY_model.catDescPart)*>
+<!ATTLIST catDesc xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST catDesc
+ %att.global.attributes; >
+<!--doc:(category reference) specifies one or more defined categories within some taxonomy or text typology. -->
+<!ELEMENT catRef EMPTY>
+<!ATTLIST catRef xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST catRef
+ %att.global.attributes;
+ %att.pointing.attributes;
+scheme %data.pointer;  #IMPLIED >
+<!--doc:contains an individual descriptive category, possibly nested within a superordinate
+    category, within a user-defined taxonomy. -->
+<!ELEMENT category ((catDesc+ |
+ (%model.glossLike;)*),category*)>
+<!ATTLIST category xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST category
+ %att.global.attributes; >
+<!--doc:contains one cell of a table.  -->
+<!ELEMENT cell %macro.paraContent;>
+<!ATTLIST cell xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST cell
+ %att.global.attributes;
+ %att.tableDecoration.attributes; >
+<!--doc:summarizes a particular change or correction made to a particular version of an electronic
+    text which is shared between several researchers. -->
+<!ELEMENT change ( #PCDATA |
+ %model.limitedPhrase; |
+ %model.inter; |
+ %model.global;)*>
+<!ATTLIST change xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST change
+ %att.global.attributes;
+ %att.ascribed.attributes;
+ %att.datable.attributes;
+ %att.docStatus.attributes; >
+<!--doc:groups a number of alternative encodings for the same point in
+        a text. -->
+<!ELEMENT choice (%model.choicePart; |
+ choice)*>
+<!ATTLIST choice xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST choice
+ %att.global.attributes; >
+<!--doc:(cited quotation) contains a quotation from some other document, together with a bibliographic reference to
+    its source. In a dictionary it may contain an example text with at least one occurrence of the
+    word form, used in the sense being described, or a translation of the headword, or an example.  -->
+<!ELEMENT cit (%model.qLike; |
+ %model.egLike; |
+ %model.biblLike; |
+ %model.ptrLike; |
+ %model.global; |
+ _DUMMY_model.entryPart)+>
+<!ATTLIST cit xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST cit
+ %att.global.attributes;
+ %att.typed.attributes; >
+<!--doc:(classification code) contains the classification code used for this text in some standard classification system. -->
+<!ELEMENT classCode %macro.phraseSeq.limited;>
+<!ATTLIST classCode xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST classCode
+ %att.global.attributes;
+scheme %data.pointer;  #REQUIRED >
+<!--doc:(classification declarations) contains one or more taxonomies defining any classificatory
+codes used elsewhere in the text. -->
+<!ELEMENT classDecl (taxonomy)+>
+<!ATTLIST classDecl xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST classDecl
+ %att.global.attributes; >
+<!--doc:groups together salutations, datelines, and similar phrases appearing as a final group at
+    the end of a division, especially of a letter. -->
+<!ELEMENT closer ( #PCDATA |
+ _DUMMY_model.gLike |
+ signed |
+ dateline |
+ salute |
+ %model.phrase; |
+ %model.global;)*>
+<!ATTLIST closer xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST closer
+ %att.global.attributes; >
+<!--doc:contains literal code from some formal language such as a
+programming language. -->
+<!ELEMENT code  (#PCDATA)>
+<!ATTLIST code xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST code
+ %att.global.attributes;
+lang %data.word;  #IMPLIED >
+<!--doc:(correction) contains the correct form of a passage apparently erroneous in the copy text. -->
+<!ELEMENT corr %macro.paraContent;>
+<!ATTLIST corr xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST corr
+ %att.global.attributes;
+ %att.editLike.attributes;
+ %att.typed.attributes; >
+<!--doc:contains information about the creation of a text. -->
+<!ELEMENT creation %macro.phraseSeq.limited;>
+<!ATTLIST creation xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST creation
+ %att.global.attributes; >
+<!--doc:contains a date in any format. -->
+<!ELEMENT date ( #PCDATA |
+ _DUMMY_model.gLike |
+ %model.phrase; |
+ %model.global;)*>
+<!ATTLIST date xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST date
+ %att.global.attributes;
+ %att.datable.attributes;
+ %att.editLike.attributes;
+ %att.typed.attributes;
+calendar %data.enumerated;  #IMPLIED >
+<!--doc:contains a brief description of the place, date, time, etc. of production of a letter,
+    newspaper story, or other work, prefixed or suffixed to it as a kind of heading or trailer.  -->
+<!ELEMENT dateline %macro.phraseSeq;>
+<!ATTLIST dateline xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST dateline
+ %att.global.attributes; >
+<!--doc:(deletion) contains a letter, word, or passage deleted, marked as deleted, or otherwise indicated as
+    superfluous or spurious in the copy text by an author, scribe, annotator, or corrector. -->
+<!ELEMENT del %macro.paraContent;>
+<!ATTLIST del xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST del
+ %att.global.attributes;
+ %att.transcriptional.attributes;
+ %att.typed.attributes; >
+<!--doc:(description) contains a brief description of the object documented by its parent element, including its
+    intended usage, purpose, or application where this is appropriate. -->
+<!ELEMENT desc %macro.limitedContent;>
+<!ATTLIST desc xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST desc
+ %att.global.attributes;
+ %att.translatable.attributes; >
+<!--doc:supplies the name of a person or other agency responsible for the
+distribution of a text. -->
+<!ELEMENT distributor %macro.phraseSeq;>
+<!ATTLIST distributor xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST distributor
+ %att.global.attributes; >
+<!--doc:(text division) contains a subdivision of the front, body, or back of a text. -->
+<!ELEMENT div ((%model.divTop; |
+ %model.global;)*,((((%model.divLike; |
+ %model.divGenLike;),(%model.global;)*)+ |
+ (((%model.common;),(%model.global;)*)+,((%model.divLike; |
+ %model.divGenLike;),(%model.global;)*)*)),((%model.divBottom;),(%model.global;)*)*)?)>
+<!ATTLIST div xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST div
+ %att.global.attributes;
+ %att.divLike.attributes;
+ %att.typed.attributes;
+ %att.declaring.attributes; >
+<!--doc:(automatically generated text division) indicates the location at which a textual division generated
+        automatically by a text-processing application is to appear. -->
+<!ELEMENT divGen (%model.headLike;)*>
+<!ATTLIST divGen xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST divGen
+ %att.global.attributes;
+type %data.enumerated;  #IMPLIED >
+<!--doc:(document author) contains the name of the author of the document, as given on the
+title page (often but not always contained in a byline). -->
+<!ELEMENT docAuthor %macro.phraseSeq;>
+<!ATTLIST docAuthor xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST docAuthor
+ %att.global.attributes;
+ %att.canonical.attributes; >
+<!--doc:(document date) contains the date of a document, as given
+(usually) on a title page. -->
+<!ELEMENT docDate %macro.phraseSeq;>
+<!ATTLIST docDate xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST docDate
+ %att.global.attributes;
+when %data.temporal.w3c;  #IMPLIED >
+<!--doc:(document edition) contains an edition statement as presented on a title page of a
+document. -->
+<!ELEMENT docEdition %macro.paraContent;>
+<!ATTLIST docEdition xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST docEdition
+ %att.global.attributes; >
+<!--doc:(document imprint) contains the imprint statement (place and date of publication,
+publisher name), as given
+(usually) at the foot of a title page. -->
+<!ELEMENT docImprint ( #PCDATA |
+ _DUMMY_model.gLike |
+ %model.phrase; |
+ pubPlace |
+ docDate |
+ publisher |
+ %model.global;)*>
+<!ATTLIST docImprint xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST docImprint
+ %att.global.attributes; >
+<!--doc:(document title) contains the title of a document, including all its
+constituents, as given on a title page. -->
+<!ELEMENT docTitle ((%model.global;)*,(titlePart,(%model.global;)*)+)>
+<!ATTLIST docTitle xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST docTitle
+ %att.global.attributes;
+ %att.canonical.attributes; >
+<!--doc:(edition) describes the particularities of one edition of a text. -->
+<!ELEMENT edition %macro.phraseSeq;>
+<!ATTLIST edition xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST edition
+ %att.global.attributes; >
+<!--doc:(edition statement) groups information relating to one edition of a text. -->
+<!ELEMENT editionStmt ((%model.pLike;)+ |
+ (edition,respStmt*))>
+<!ATTLIST editionStmt xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST editionStmt
+ %att.global.attributes; >
+<!--doc:secondary statement of responsibility for a bibliographic item, for example the name of an
+    individual, institution or organization, (or of several such) acting as editor, compiler,
+    translator, etc.  -->
+<!ELEMENT editor %macro.phraseSeq;>
+<!ATTLIST editor xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST editor
+ %att.global.attributes;
+ %att.naming.attributes; >
+<!--doc:(editorial practice declaration) provides details of editorial principles and practices applied
+during the encoding of a text. -->
+<!ELEMENT editorialDecl (%model.pLike; |
+ _DUMMY_model.editorialDeclPart)+>
+<!ATTLIST editorialDecl xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST editorialDecl
+ %att.global.attributes;
+ %att.declarable.attributes; >
+<!--doc:(example) contains any kind of illustrative example.  -->
+<!ELEMENT eg  (#PCDATA)>
+<!ATTLIST eg xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST eg
+ %att.global.attributes; >
+<!--doc:(example of XML) contains a single well-formed XML fragment demonstrating the use of some XML element or
+    attribute, in which the egXML element itself functions as the root element.  -->
+<!ELEMENT egXML (#PCDATA)*>
+<!ATTLIST egXML xmlns CDATA "http://www.tei-c.org/ns/Examples">
+<!ATTLIST egXML
+ %att.global.attributes;
+valid (true|feasible|false) "true"  >
+<!--doc:(emphasized) marks words or phrases which are stressed or emphasized for
+        linguistic or rhetorical effect. -->
+<!ELEMENT emph %macro.paraContent;>
+<!ATTLIST emph xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST emph
+ %att.global.attributes; >
+<!--doc:(encoding description) documents the relationship between an electronic text and the
+source or sources from which it was derived. -->
+<!ELEMENT encodingDesc (%model.encodingDescPart; |
+ %model.pLike;)+>
+<!ATTLIST encodingDesc xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST encodingDesc
+ %att.global.attributes; >
+<!--doc:contains a quotation, anonymous or attributed, appearing at the start of a section or
+    chapter, or on a title page.  -->
+<!ELEMENT epigraph (%model.common; |
+ %model.global;)*>
+<!ATTLIST epigraph xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST epigraph
+ %att.global.attributes; >
+<!--doc:(expansion) contains the expansion of an abbreviation. -->
+<!ELEMENT expan %macro.phraseSeq;>
+<!ATTLIST expan xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST expan
+ %att.global.attributes;
+ %att.editLike.attributes; >
+<!--doc:describes the approximate size of a text as stored on some carrier medium, whether digital
+    or non-digital, specified in any convenient units. -->
+<!ELEMENT extent %macro.phraseSeq;>
+<!ATTLIST extent xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST extent
+ %att.global.attributes; >
+<!--doc:(description of figure) contains a brief prose description of the appearance or content
+of a graphic figure, for use when documenting an image without
+displaying it. -->
+<!ELEMENT figDesc %macro.limitedContent;>
+<!ATTLIST figDesc xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST figDesc
+ %att.global.attributes; >
+<!--doc:groups elements representing or containing graphic information such as an illustration or
+    figure. -->
+<!ELEMENT figure (%model.headLike; |
+ %model.pLike; |
+ figDesc |
+ %model.graphicLike; |
+ %model.egLike; |
+ %model.global;)*>
+<!ATTLIST figure xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST figure
+ %att.global.attributes;
+ %att.placement.attributes;
+ %att.typed.attributes; >
+<!--doc:(file description) contains a full bibliographic description of an electronic file. -->
+<!ELEMENT fileDesc ((titleStmt,editionStmt?,extent?,publicationStmt,seriesStmt?,notesStmt?),sourceDesc+)>
+<!ATTLIST fileDesc xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST fileDesc
+ %att.global.attributes; >
+<!--doc:(foreign) identifies a word or phrase as belonging to some language other than that of the
+                surrounding text.  -->
+<!ELEMENT foreign %macro.phraseSeq;>
+<!ATTLIST foreign xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST foreign
+ %att.global.attributes; >
+<!--doc:contains a mathematical or other formula. -->
+<!ELEMENT formula ( #PCDATA |
+ %model.graphicLike;)*>
+<!ATTLIST formula xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST formula
+ %att.global.attributes;
+notation %data.code;  #IMPLIED >
+<!--doc:(front matter) contains any prefatory matter (headers,
+title page, prefaces, dedications, etc.)
+found  at the start of a document, before the main body. -->
+<!ELEMENT front ((%model.frontPart; |
+ %model.pLike.front; |
+ %model.global;)*,((_DUMMY_model.div1Like,(%model.frontPart; |
+ _DUMMY_model.div1Like |
+ %model.global;)*) |
+ ((%model.divLike;),(%model.frontPart; |
+ %model.divLike; |
+ %model.global;)*))?,((%model.divBottomPart;),(%model.divBottomPart; |
+ %model.global;)*)?)>
+<!ATTLIST front xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST front
+ %att.global.attributes;
+ %att.declaring.attributes; >
+<!--doc:(funding body) specifies the name of an individual, institution, or organization responsible for the
+    funding of a project or text. -->
+<!ELEMENT funder %macro.phraseSeq.limited;>
+<!ATTLIST funder xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST funder
+ %att.global.attributes; >
+<!--doc:(gap) indicates a point where material has been omitted in a transcription, whether for editorial
+    reasons described in the TEI header, as part of sampling practice, or because the material is
+    illegible, invisible, or inaudible. -->
+<!ELEMENT gap (%model.glossLike;)*>
+<!ATTLIST gap xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST gap
+ %att.global.attributes;
+ %att.editLike.attributes;
+reason CDATA  #IMPLIED
+hand %data.pointer;  #IMPLIED
+agent %data.enumerated;  #IMPLIED >
+<!--doc:(geographic coordinates declaration) documents the notation and the datum used for geographic coordinates expressed as content of
+    the geo element elsewhere within the document. -->
+<!ELEMENT geoDecl %macro.phraseSeq;>
+<!ATTLIST geoDecl xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST geoDecl
+ %att.global.attributes;
+ %att.declarable.attributes;
+datum %data.enumerated;  "WGS84"  >
+<!--doc:(element name) contains the name (generic identifier) of an element. -->
+<!ELEMENT gi  (#PCDATA)>
+<!ATTLIST gi xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST gi
+ %att.global.attributes;
+scheme %data.enumerated;  "TEI"  >
+<!--doc:identifies a phrase or word used to provide a gloss or definition for some other word or
+    phrase. -->
+<!ELEMENT gloss %macro.phraseSeq;>
+<!ATTLIST gloss xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST gloss
+ %att.global.attributes;
+ %att.declaring.attributes;
+ %att.translatable.attributes;
+ %att.typed.attributes;
+ %att.pointing.attributes;
+cRef %data.pointer;  #IMPLIED >
+<!--doc:indicates the location of an inline graphic, illustration, or figure. -->
+<!ELEMENT graphic (%model.glossLike;)*>
+<!ATTLIST graphic xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST graphic
+ %att.global.attributes;
+ %att.internetMedia.attributes;
+ %att.declaring.attributes;
+width %data.outputMeasurement;  #IMPLIED
+height %data.outputMeasurement;  #IMPLIED
+scale %data.numeric;  #IMPLIED
+url %data.pointer;  #REQUIRED >
+<!--doc:contains the body of a composite text, grouping together a sequence of distinct texts (or
+    groups of such texts) which are regarded as a unit for some purpose, for example the collected
+    works of an author, a sequence of prose essays, etc. -->
+<!ELEMENT group ((%model.divTop; |
+ %model.global;)*,((text |
+ group),(text |
+ group |
+ %model.global;)*),(%model.divBottom;)*)>
+<!ATTLIST group xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST group
+ %att.global.attributes;
+ %att.declaring.attributes; >
+<!--doc:(heading) contains any type of heading, for example the title of a section, or the heading of a list,
+    glossary, manuscript description, etc. -->
+<!ELEMENT head %macro.paraContent;>
+<!ATTLIST head xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST head
+ %att.global.attributes;
+ %att.typed.attributes; >
+<!--doc:(highlighted) marks a word or phrase as graphically distinct from the
+        surrounding text, for reasons concerning which no claim is
+        made.  -->
+<!ELEMENT hi %macro.paraContent;>
+<!ATTLIST hi xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST hi
+ %att.global.attributes; >
+<!--doc:(identifier) contains an identifier or name for an object of some kind in a formal language. -->
+<!ELEMENT ident  (#PCDATA)>
+<!ATTLIST ident xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST ident
+ %att.global.attributes;
+ %att.typed.attributes; >
+<!--doc:(identifier) supplies any form of identifier used to identify some object,
+  such as a bibliographic item, a person, a title, an organization,
+  etc. in a standardized way. -->
+<!ELEMENT idno %macro.xtext;>
+<!ATTLIST idno xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST idno
+ %att.global.attributes;
+type %data.enumerated;  #IMPLIED >
+<!--doc:(index entry) marks a location to be indexed for whatever purpose. -->
+<!ELEMENT index (term,index?)*>
+<!ATTLIST index xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST index
+ %att.global.attributes;
+ %att.spanning.attributes;
+indexName %data.name;  #IMPLIED >
+<!--doc:(interpretation) summarizes a specific interpretative annotation which can be linked to a span of text. -->
+<!ELEMENT interp ( #PCDATA |
+ _DUMMY_model.gLike |
+ %model.glossLike;)*>
+<!ATTLIST interp xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST interp
+ %att.global.attributes;
+ %att.interpLike.attributes; >
+<!--doc:(interpretation group) collects together a set of related interpretations which share responsibility or type. -->
+<!ELEMENT interpGrp ((%model.glossLike;)*,interp+)>
+<!ATTLIST interpGrp xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST interpGrp
+ %att.global.attributes;
+ %att.interpLike.attributes; >
+<!--doc:contains one component of a list. -->
+<!ELEMENT item %macro.specialPara;>
+<!ATTLIST item xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST item
+ %att.global.attributes; >
+<!--doc:contains a list of keywords or phrases identifying the topic or nature of a text. -->
+<!ELEMENT keywords (term+ |
+ list)>
+<!ATTLIST keywords xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST keywords
+ %att.global.attributes;
+scheme %data.pointer;  #REQUIRED >
+<!--doc:(verse line) contains a single, possibly incomplete, line of verse. -->
+<!ELEMENT l %macro.paraContent;>
+<!ATTLIST l xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST l
+ %att.global.attributes;
+part (Y|N|I|M|F) "N"  >
+<!--doc:contains the label associated with an item in a list; in glossaries, marks the term being
+    defined. -->
+<!ELEMENT label %macro.phraseSeq;>
+<!ATTLIST label xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST label
+ %att.global.attributes; >
+<!--doc:(language usage) describes the languages, sublanguages, registers, dialects, etc.
+represented within a text. -->
+<!ELEMENT langUsage (language)+>
+<!ATTLIST langUsage xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST langUsage
+ %att.global.attributes;
+ %att.declarable.attributes; >
+<!--doc:characterizes a single language or sublanguage used within a text. -->
+<!ELEMENT language %macro.phraseSeq.limited;>
+<!ATTLIST language xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST language
+ %att.global.attributes;
+ident %data.language;  #REQUIRED
+usage CDATA #IMPLIED >
+<!--doc:(line break) marks the start of a new (typographic) line in some edition or version of a text. -->
+<!ELEMENT lb EMPTY>
+<!ATTLIST lb xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST lb
+ %att.global.attributes;
+ %att.typed.attributes;
+ %att.sourced.attributes;
+ %att.spanning.attributes;
+ %att.breaking.attributes; >
+<!--doc:(line group) contains a group of verse lines functioning as a formal unit, e.g. a stanza, refrain,
+        verse paragraph, etc. -->
+<!ELEMENT lg ((%model.divTop; |
+ %model.global;)*,(%model.lLike; |
+ lg),(%model.lLike; |
+ lg |
+ %model.global;)*,((%model.divBottom;),(%model.global;)*)*)>
+<!ATTLIST lg xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST lg
+ %att.global.attributes;
+ %att.divLike.attributes;
+ %att.typed.attributes;
+ %att.declaring.attributes; >
+<!--doc:(list) contains any sequence of items organized as a list. -->
+<!ELEMENT list (((%model.divTop;) |
+ (%model.global;))*,((item,(%model.global;)*)+ |
+ (label,(%model.global;)*,item,(%model.global;)*)+),((%model.divBottom;),(%model.global;)*)*)>
+<!ATTLIST list xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST list
+ %att.global.attributes;
+type %data.enumerated;  "simple"  >
+<!--doc:(citation list) contains a list of bibliographic citations of any kind.  -->
+<!ELEMENT listBibl ((%model.headLike;)*,(%model.biblLike; |
+ %model.milestoneLike; |
+ listBibl)+)>
+<!ATTLIST listBibl xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST listBibl
+ %att.global.attributes;
+ %att.declarable.attributes;
+ %att.typed.attributes; >
+<!--doc:(measure group) contains a group of dimensional specifications which relate to the same object, for example
+    the height and width of a manuscript page. -->
+<!ELEMENT measureGrp ( #PCDATA |
+ _DUMMY_model.gLike |
+ %model.measureLike;)*>
+<!ATTLIST measureGrp xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST measureGrp
+ %att.global.attributes;
+ %att.measurement.attributes;
+ %att.typed.attributes; >
+<!--doc:marks words or phrases mentioned, not used. -->
+<!ELEMENT mentioned %macro.phraseSeq;>
+<!ATTLIST mentioned xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST mentioned
+ %att.global.attributes; >
+<!--doc:marks a boundary point separating any kind of section of a text, typically but not
+    necessarily indicating a point at which some part of a standard reference system changes, where
+    the change is not represented by a structural element. -->
+<!ELEMENT milestone EMPTY>
+<!ATTLIST milestone xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST milestone
+ %att.global.attributes;
+ %att.typed.attributes;
+ %att.sourced.attributes;
+ %att.spanning.attributes;
+ %att.breaking.attributes;
+unit %data.enumerated;  #REQUIRED >
+<!--doc:(name, proper noun) contains a proper noun or noun phrase. -->
+<!ELEMENT name %macro.phraseSeq;>
+<!ATTLIST name xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST name
+ %att.global.attributes;
+ %att.naming.attributes;
+ %att.typed.attributes; >
+<!--doc:contains a note or annotation. -->
+<!ELEMENT note %macro.specialPara;>
+<!ATTLIST note xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST note
+ %att.global.attributes;
+ %att.placement.attributes;
+ %att.pointing.attributes;
+ %att.responsibility.attributes;
+ %att.typed.attributes;
+anchored %data.truthValue;  "true" 
+targetEnd CDATA  #IMPLIED >
+<!--doc:(notes statement) collects together any notes providing information about a text additional to that recorded
+    in other parts of the bibliographic description. -->
+<!ELEMENT notesStmt (%model.noteLike;)+>
+<!ATTLIST notesStmt xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST notesStmt
+ %att.global.attributes; >
+<!--doc:(number) contains a number, written in any form. -->
+<!ELEMENT num %macro.phraseSeq;>
+<!ATTLIST num xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST num
+ %att.global.attributes;
+ %att.ranging.attributes;
+type %data.enumerated;  #IMPLIED
+value %data.numeric;  #IMPLIED >
+<!--doc:groups together dateline, byline, salutation, and similar phrases appearing as a preliminary
+    group at the start of a division, especially of a letter. -->
+<!ELEMENT opener ( #PCDATA |
+ _DUMMY_model.gLike |
+ %model.phrase; |
+ argument |
+ byline |
+ dateline |
+ epigraph |
+ salute |
+ signed |
+ %model.global;)*>
+<!ATTLIST opener xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST opener
+ %att.global.attributes; >
+<!--doc:(original form) contains a reading which is marked as following the original, rather than being normalized
+        or corrected. -->
+<!ELEMENT orig %macro.paraContent;>
+<!ATTLIST orig xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST orig
+ %att.global.attributes;
+ %att.responsibility.attributes; >
+<!--doc:(paragraph) marks paragraphs in prose. -->
+<!ELEMENT p %macro.paraContent;>
+<!ATTLIST p xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST p
+ %att.global.attributes;
+ %att.declaring.attributes; >
+<!--doc:(page break) marks the boundary between one page of a text and the next in a standard reference system. -->
+<!ELEMENT pb EMPTY>
+<!ATTLIST pb xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST pb
+ %att.global.attributes;
+ %att.typed.attributes;
+ %att.sourced.attributes;
+ %att.spanning.attributes;
+ %att.breaking.attributes; >
+<!--doc: (punctuation character) a character or string of characters regarded as constituting a
+  single punctuation mark. -->
+<!ELEMENT pc ( #PCDATA |
+ _DUMMY_model.gLike)*>
+<!ATTLIST pc xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST pc
+ %att.global.attributes;
+ %att.segLike.attributes;
+ %att.typed.attributes;
+force (strong|weak|inter) #IMPLIED
+unit %data.enumerated;  #IMPLIED
+pre %data.truthValue;  #IMPLIED >
+<!--doc:contains a postscript, e.g. to a letter. -->
+<!ELEMENT postscript ((%model.common;) |
+ (%model.global;))*>
+<!ATTLIST postscript xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST postscript
+ %att.global.attributes; >
+<!--doc:(principal researcher) supplies the name of the principal researcher responsible for the
+creation of an electronic text. -->
+<!ELEMENT principal %macro.phraseSeq.limited;>
+<!ATTLIST principal xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST principal
+ %att.global.attributes; >
+<!--doc:(text-profile description) provides a detailed description of non-bibliographic aspects of a text, specifically the
+    languages and sublanguages used, the situation in which it was produced, the participants and
+    their setting. -->
+<!ELEMENT profileDesc (%model.profileDescPart;)*>
+<!ATTLIST profileDesc xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST profileDesc
+ %att.global.attributes; >
+<!--doc:(project description) describes in detail the aim or purpose for which an electronic file was encoded, together
+    with any other relevant information concerning the process by which it was assembled or
+    collected. -->
+<!ELEMENT projectDesc (%model.pLike;)+>
+<!ATTLIST projectDesc xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST projectDesc
+ %att.global.attributes;
+ %att.declarable.attributes; >
+<!--doc:(pointer) defines a pointer to another location. -->
+<!ELEMENT ptr EMPTY>
+<!ATTLIST ptr xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST ptr
+ %att.global.attributes;
+ %att.pointing.attributes;
+ %att.typed.attributes;
+ %att.declaring.attributes;
+cRef CDATA  #IMPLIED >
+<!--doc:(publication place) contains the name of the place where a bibliographic item was published. -->
+<!ELEMENT pubPlace %macro.phraseSeq;>
+<!ATTLIST pubPlace xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST pubPlace
+ %att.global.attributes;
+ %att.naming.attributes; >
+<!--doc:(publication statement) groups information concerning the publication or distribution of an electronic or other
+    text.  -->
+<!ELEMENT publicationStmt ((%model.pLike;)+ |
+ (%model.publicationStmtPart;)+)>
+<!ATTLIST publicationStmt xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST publicationStmt
+ %att.global.attributes; >
+<!--doc:provides the name of the organization responsible for the publication or distribution of a
+        bibliographic item. -->
+<!ELEMENT publisher %macro.phraseSeq;>
+<!ATTLIST publisher xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST publisher
+ %att.global.attributes; >
+<!--doc:(separated from the surrounding text with quotation marks) contains material which is marked as (ostensibly) being somehow different than the
+    surrounding text, for any one of a variety of reasons including, but not limited to: direct
+    speech or thought, technical terms or jargon, authorial distance, quotations from elsewhere, and
+    passages that are mentioned but not used. -->
+<!ELEMENT q %macro.specialPara;>
+<!ATTLIST q xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST q
+ %att.global.attributes;
+ %att.ascribed.attributes;
+type %data.enumerated;  #IMPLIED >
+<!--doc:(quotation) contains a phrase or passage attributed by the narrator or author to some agency external
+        to the text. -->
+<!ELEMENT quote %macro.specialPara;>
+<!ATTLIST quote xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST quote
+ %att.global.attributes;
+ %att.typed.attributes; >
+<!--doc:(reference) defines a reference to another location, possibly modified by additional text or comment. -->
+<!ELEMENT ref %macro.paraContent;>
+<!ATTLIST ref xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST ref
+ %att.global.attributes;
+ %att.pointing.attributes;
+ %att.typed.attributes;
+ %att.declaring.attributes;
+cRef CDATA  #IMPLIED >
+<!--doc:(reference state) specifies one component of a canonical reference defined by the milestone method. -->
+<!ELEMENT refState EMPTY>
+<!ATTLIST refState xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST refState
+ %att.global.attributes;
+ %att.sourced.attributes;
+unit %data.enumerated;  #REQUIRED
+length %data.count;  #IMPLIED
+delim CDATA #IMPLIED >
+<!--doc:(references declaration) specifies how canonical references are constructed for this
+  text. -->
+<!ELEMENT refsDecl ((%model.pLike;)+ |
+ cRefPattern+ |
+ refState+)>
+<!ATTLIST refsDecl xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST refsDecl
+ %att.global.attributes;
+ %att.declarable.attributes; >
+<!--doc:(regularization) contains a reading which has been regularized or normalized in some sense. -->
+<!ELEMENT reg %macro.paraContent;>
+<!ATTLIST reg xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST reg
+ %att.global.attributes;
+ %att.editLike.attributes;
+ %att.typed.attributes; >
+<!--doc:contains or references some other bibliographic item which is related to the present one in
+    some specified manner, for example as a constituent or alternative version of it. -->
+<!ELEMENT relatedItem (%model.biblLike; |
+ %model.ptrLike;)?>
+<!ATTLIST relatedItem xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST relatedItem
+ %att.global.attributes;
+ %att.typed.attributes;
+target %data.pointer;  #IMPLIED >
+<!--doc:(responsibility) contains a phrase describing the nature of a person's intellectual responsibility. -->
+<!ELEMENT resp %macro.phraseSeq.limited;>
+<!ATTLIST resp xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST resp
+ %att.global.attributes;
+ %att.canonical.attributes; >
+<!--doc:(statement of responsibility) supplies a statement of responsibility for the intellectual content of a text, edition,
+    recording, or series, where the specialized elements for authors, editors, etc. do not suffice
+    or do not apply. -->
+<!ELEMENT respStmt ((resp+,(%model.nameLike.agent;)+) |
+ ((%model.nameLike.agent;)+,resp+))>
+<!ATTLIST respStmt xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST respStmt
+ %att.global.attributes; >
+<!--doc:(revision description) summarizes the revision history for a file. -->
+<!ELEMENT revisionDesc (list |
+ change+)>
+<!ATTLIST revisionDesc xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST revisionDesc
+ %att.global.attributes;
+ %att.docStatus.attributes; >
+<!--doc:contains one row of a table.  -->
+<!ELEMENT row (cell)+>
+<!ATTLIST row xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST row
+ %att.global.attributes;
+ %att.tableDecoration.attributes; >
+<!--doc:(referencing string) contains a general purpose name or referring string. -->
+<!ELEMENT rs %macro.phraseSeq;>
+<!ATTLIST rs xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST rs
+ %att.global.attributes;
+ %att.naming.attributes;
+type %data.enumerated;  #IMPLIED >
+<!--doc:(s-unit) contains a sentence-like division of a text. -->
+<!ELEMENT s %macro.phraseSeq;>
+<!ATTLIST s xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST s
+ %att.global.attributes;
+ %att.segLike.attributes;
+ %att.typed.attributes; >
+<!--doc:(speech or thought) indicates passages thought or spoken aloud, whether explicitly indicated in the source or
+    not, whether directly or indirectly reported, whether by real people or fictional characters. -->
+<!ELEMENT said %macro.specialPara;>
+<!ATTLIST said xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST said
+ %att.global.attributes;
+ %att.ascribed.attributes;
+aloud %data.xTruthValue;  "unknown" 
+direct %data.xTruthValue;  "true"  >
+<!--doc:(salutation) contains a salutation or greeting prefixed to a foreword, dedicatory epistle, or other
+    division of a text, or the salutation in the closing of a letter, preface, etc. -->
+<!ELEMENT salute %macro.phraseSeq;>
+<!ATTLIST salute xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST salute
+ %att.global.attributes; >
+<!--doc:(sampling declaration) contains a prose description of the rationale and methods used in sampling texts in the
+    creation of a corpus or collection. -->
+<!ELEMENT samplingDecl (%model.pLike;)+>
+<!ATTLIST samplingDecl xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST samplingDecl
+ %att.global.attributes;
+ %att.declarable.attributes; >
+<!--doc:describes a particular script distinguished within
+    the description of a manuscript or similar resource. -->
+<!ELEMENT scriptNote %macro.specialPara;>
+<!ATTLIST scriptNote xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST scriptNote
+ %att.global.attributes;
+ %att.handFeatures.attributes; >
+<!--doc:(arbitrary segment) represents any segmentation of text below the chunk level. -->
+<!ELEMENT seg %macro.paraContent;>
+<!ATTLIST seg xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST seg
+ %att.global.attributes;
+ %att.segLike.attributes;
+ %att.typed.attributes;
+ %att.responsibility.attributes; >
+<!--doc:(series statement) groups information about the series, if any, to which a publication belongs. -->
+<!ELEMENT seriesStmt ((%model.pLike;)+ |
+ (title+,(idno |
+ respStmt)*))>
+<!ATTLIST seriesStmt xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST seriesStmt
+ %att.global.attributes; >
+<!--doc:(latin for thus or so
+  ) contains text reproduced although apparently incorrect or inaccurate. -->
+<!ELEMENT sic %macro.paraContent;>
+<!ATTLIST sic xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST sic
+ %att.global.attributes;
+ %att.responsibility.attributes; >
+<!--doc:(signature) contains the closing salutation, etc., appended to a foreword,
+dedicatory epistle, or other division of a text.  -->
+<!ELEMENT signed %macro.phraseSeq;>
+<!ATTLIST signed xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST signed
+ %att.global.attributes; >
+<!--doc:contains a word or phrase for which the author or narrator indicates a disclaiming of
+    responsibility, for example by the use of scare quotes or italics. -->
+<!ELEMENT soCalled %macro.phraseSeq;>
+<!ATTLIST soCalled xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST soCalled
+ %att.global.attributes; >
+<!--doc:(source description) describes the source from which an electronic text was derived or generated, typically a
+    bibliographic description in the case of a digitized text, or a phrase such as "born digital"
+    for a text which has no previous existence. -->
+<!ELEMENT sourceDesc ((%model.pLike;)+ |
+ (%model.biblLike; |
+ _DUMMY_model.sourceDescPart |
+ %model.listLike;)+)>
+<!ATTLIST sourceDesc xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST sourceDesc
+ %att.global.attributes;
+ %att.declarable.attributes; >
+<!--doc:(speech) An individual speech in a performance text, or a passage presented as such in a prose or
+    verse text. -->
+<!ELEMENT sp ((%model.global;)*,(speaker,(%model.global;)*)?,((%model.lLike; |
+ lg |
+ %model.pLike; |
+ %model.stageLike; |
+ %model.qLike;),(%model.global;)*)+)>
+<!ATTLIST sp xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST sp
+ %att.global.attributes;
+ %att.ascribed.attributes; >
+<!--doc:A specialized form of heading or label, giving the name of one or more speakers in a
+        dramatic text or fragment. -->
+<!ELEMENT speaker %macro.phraseSeq;>
+<!ATTLIST speaker xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST speaker
+ %att.global.attributes; >
+<!--doc:specifies the name of a sponsoring organization or institution. -->
+<!ELEMENT sponsor %macro.phraseSeq.limited;>
+<!ATTLIST sponsor xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST sponsor
+ %att.global.attributes; >
+<!--doc:(stage direction) contains any kind of stage direction within a dramatic text or fragment. -->
+<!ELEMENT stage %macro.specialPara;>
+<!ATTLIST stage xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST stage
+ %att.global.attributes;
+type %data.enumerated;  #IMPLIED >
+<!--doc:contains text displayed in tabular form, in rows and columns. -->
+<!ELEMENT table ((%model.headLike; |
+ %model.global;)*,(row,(%model.global;)*)+)>
+<!ATTLIST table xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST table
+ %att.global.attributes;
+rows %data.count;  #IMPLIED
+cols %data.count;  #IMPLIED >
+<!--doc:defines a typology used to classify texts either implicitly, by means of a bibliographic
+    citation, or explicitly by a structured taxonomy. -->
+<!ELEMENT taxonomy ((%model.glossLike;)* |
+ category+ |
+ ((%model.biblLike;),category*))>
+<!ATTLIST taxonomy xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST taxonomy
+ %att.global.attributes; >
+<!--doc:contains the whole of a TEI encoded corpus, comprising a single corpus header and one or
+    more TEI elements, each containing a single text header and a text. -->
+<!ELEMENT teiCorpus (teiHeader,(TEI |
+ teiCorpus)+)>
+<!ATTLIST teiCorpus xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST teiCorpus
+ %att.global.attributes;
+version %data.version;  "5.0"  >
+<!ATTLIST teiCorpus xsi:schemaLocation CDATA #IMPLIED
+ xmlns:xsi CDATA #FIXED 'http://www.w3.org/2001/XMLSchema-instance'
+ >
+<!--doc:(TEI Header) supplies the descriptive and declarative information making up an electronic title page
+    prefixed to every TEI-conformant text. -->
+<!ELEMENT teiHeader (fileDesc,(%model.teiHeaderPart;)*,revisionDesc?)>
+<!ATTLIST teiHeader xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST teiHeader
+ %att.global.attributes;
+type %data.enumerated;  "text"  >
+<!--doc:contains a single-word, multi-word, or symbolic designation which is regarded as a technical
+    term. -->
+<!ELEMENT term %macro.phraseSeq;>
+<!ATTLIST term xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST term
+ %att.global.attributes;
+ %att.declaring.attributes;
+ %att.pointing.attributes;
+ %att.typed.attributes;
+ %att.canonical.attributes;
+cRef %data.pointer;  #IMPLIED
+sortKey %data.word;  #IMPLIED >
+<!--doc:contains a single text of any kind, whether unitary or composite, for example a poem or
+    drama, a collection of essays, a novel, a dictionary, or a corpus sample. -->
+<!ELEMENT text ((%model.global;)*,(front,(%model.global;)*)?,(body |
+ group),(%model.global;)*,(back,(%model.global;)*)?)>
+<!ATTLIST text xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST text
+ %att.global.attributes;
+ %att.declaring.attributes;
+ %att.typed.attributes; >
+<!--doc:(text classification) groups information which describes the nature or topic of a text in terms of a standard
+    classification scheme, thesaurus, etc. -->
+<!ELEMENT textClass (classCode |
+ catRef |
+ keywords)*>
+<!ATTLIST textClass xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST textClass
+ %att.global.attributes;
+ %att.declarable.attributes; >
+<!--doc:contains a phrase defining a time of day in any format. -->
+<!ELEMENT time ( #PCDATA |
+ _DUMMY_model.gLike |
+ %model.phrase; |
+ %model.global;)*>
+<!ATTLIST time xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST time
+ %att.global.attributes;
+ %att.datable.attributes;
+ %att.editLike.attributes;
+ %att.typed.attributes; >
+<!--doc:contains a title for any kind of work. -->
+<!ELEMENT title %macro.paraContent;>
+<!ATTLIST title xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST title
+ %att.global.attributes;
+ %att.canonical.attributes;
+level (a|m|j|s|u) #IMPLIED
+type %data.enumerated;  #IMPLIED >
+<!--doc:(title page) contains the title page of a text, appearing within the front or back matter.  -->
+<!ELEMENT titlePage ((%model.global;)*,(%model.titlepagePart;),(%model.titlepagePart; |
+ %model.global;)*)>
+<!ATTLIST titlePage xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST titlePage
+ %att.global.attributes;
+type %data.enumerated;  #IMPLIED >
+<!--doc:contains a subsection or division of the title of a work, as
+indicated on a title page. -->
+<!ELEMENT titlePart %macro.paraContent;>
+<!ATTLIST titlePart xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST titlePart
+ %att.global.attributes;
+type %data.enumerated;  "main"  >
+<!--doc:(title statement) groups information about the title of a work and those responsible for its intellectual
+    content. -->
+<!ELEMENT titleStmt (title+,(%model.respLike;)*)>
+<!ATTLIST titleStmt xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST titleStmt
+ %att.global.attributes; >
+<!--doc:contains a closing title or footer appearing at the end of a division of a text.  -->
+<!ELEMENT trailer %macro.phraseSeq;>
+<!ATTLIST trailer xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST trailer
+ %att.global.attributes; >
+<!--doc:describes a particular font or other significant typographic feature distinguished within
+    the description of a printed resource. -->
+<!ELEMENT typeNote %macro.specialPara;>
+<!ATTLIST typeNote xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST typeNote
+ %att.global.attributes;
+ %att.handFeatures.attributes; >
+<!--doc:contains a word, phrase, or passage which cannot be transcribed with certainty because it
+        is illegible or inaudible in the source. -->
+<!ELEMENT unclear %macro.paraContent;>
+<!ATTLIST unclear xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST unclear
+ %att.global.attributes;
+ %att.editLike.attributes;
+reason CDATA  #IMPLIED
+hand %data.pointer;  #IMPLIED
+agent %data.enumerated;  #IMPLIED >
+<!--doc:(value) contains a single attribute value. -->
+<!ELEMENT val  (#PCDATA)>
+<!ATTLIST val xmlns CDATA "http://www.tei-c.org/ns/1.0">
+<!ATTLIST val
+ %att.global.attributes; >
+<!-- end elements -->

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/odt/teilite.dtd
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/odt/TEIP5.ott
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/odt/TEIP5.ott
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/odt/expandxsl.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/odt/expandxsl.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/odt/expandxsl.xsl	(revision 258)
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet
+    xpath-default-namespace="http://www.w3.org/1999/XSL/Transform" 
+    xmlns:doc="http://www.oxygenxml.com/ns/doc/xsl"
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+    version="2.0"
+>
+
+<!--This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+
+$Id: checkxsl.xsl 9646 2011-11-05 23:39:08Z rahtz $
+
+2008, TEI Consortium
+-->
+
+<xsl:template match="import">
+  <xsl:for-each select="doc(@href)/stylesheet">
+    <xsl:apply-templates/>
+  </xsl:for-each>
+</xsl:template>
+
+<xsl:template match="doc:*"/>
+
+<xsl:template match="stylesheet">
+  <xsl:copy>
+    <xsl:copy-of select="@*"/>
+    <xsl:apply-templates/>
+</xsl:copy>
+</xsl:template>
+
+<xsl:template match="text()|@*|comment()">
+  <xsl:copy-of select="."/>
+</xsl:template>
+
+<xsl:template match="*">
+  <xsl:copy>
+    <xsl:copy-of select="@*"/>
+    <xsl:apply-templates/>
+  </xsl:copy>
+</xsl:template>
+
+<xsl:template match="*" mode="import">
+  <xsl:copy>
+    <xsl:attribute name="priority">-10</xsl:attribute>
+    <xsl:copy-of select="@*"/>
+    <xsl:apply-templates/>
+  </xsl:copy>
+</xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/odt/expandxsl.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/odt/fixgraphics.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/odt/fixgraphics.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/odt/fixgraphics.xsl	(revision 258)
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:tei="http://www.tei-c.org/ns/1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                xmlns:tiff="http://ns.adobe.com/tiff/1.0/"
+                xmlns:teidocx="http://www.tei-c.org/ns/teidocx/1.0"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="2.0">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet dealing with elements from the core module. </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: fixgraphics.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc>
+   </doc>
+
+  <xsl:output method="xml" indent="yes"/>
+  <xsl:param name="DIR"/>
+  <xsl:key name="W" match="tiff:ImageWidth" use="1"/>
+  <xsl:key name="H" match="tiff:ImageLength" use="1"/>
+  <xsl:template match="@*|text()|comment()|processing-instruction()">
+      <xsl:copy-of select="."/>
+  </xsl:template>
+  
+  
+  <xsl:template match="*">
+      <xsl:copy>
+         <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
+      </xsl:copy>
+  </xsl:template>
+  
+  
+  <xsl:template match="tei:graphic">
+      <xsl:copy>
+	        <xsl:variable name="newName">
+	           <xsl:text>Pictures/resource</xsl:text>
+	           <xsl:number level="any"/>
+	           <xsl:text>.</xsl:text>
+	           <xsl:value-of select="tokenize(@url,'\.')[last()]"/>
+	        </xsl:variable>
+	        <xsl:attribute name="url">
+	           <xsl:value-of select="$newName"/>
+	        </xsl:attribute>
+	        <xsl:copy-of select="@n"/>
+	        <xsl:copy-of select="@height"/>
+	        <xsl:copy-of select="@width"/>
+	        <xsl:copy-of select="@scale"/>
+		
+	        <xsl:if test="doc-available(concat($DIR,'/',$newName,'.xmp'))">
+	           <xsl:attribute name="tei:width">
+	              <xsl:for-each select="document(concat($DIR,'/',$newName,'.xmp'),/)">
+	                 <xsl:value-of select="(number(key('W',1)) div 72) * 9144"/>
+	              </xsl:for-each>
+	           </xsl:attribute>
+	  
+	           <xsl:attribute name="tei:height">
+	              <xsl:for-each select="document(concat($DIR,'/',$newName,'.xmp'),/)">
+	                 <xsl:value-of select="(number(key('H',1)) div 72) * 9144"/>
+	              </xsl:for-each>
+	           </xsl:attribute>
+	        </xsl:if>
+      </xsl:copy>
+  </xsl:template>
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/odt/fixgraphics.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/odt/TypeDetection.xcu
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/odt/TypeDetection.xcu	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/odt/TypeDetection.xcu	(revision 258)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<oor:component-data xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" oor:name="TypeDetection" oor:package="org.openoffice.Office">
+ <node oor:name="Types">
+  <node oor:name="TEIP5">
+   <prop oor:name="Data" oor:type="xs:string">
+    <value>0,,doctype:TEI,,xml,0,</value>
+   </prop>
+   <prop oor:name="UIName" oor:type="xs:string">
+    <value xml:lang="en-US">TEI</value>
+   </prop>
+  </node>
+ </node>
+ <node oor:name="Filters">
+  <node oor:name="TEIP5">
+   <prop oor:name="UIName" oor:type="xs:string">
+    <value xml:lang="en-US">TEI</value>
+   </prop>
+   <prop oor:name="Data" oor:type="xs:string">
+    <value>0,TEIP5,com.sun.star.text.TextDocument,com.sun.star.comp.Writer.XmlFilterAdaptor,524355,com.sun.star.documentconversion.XSLTFilter;;com.sun.star.comp.Writer.XMLOasisImporter;com.sun.star.comp.Writer.XMLOasisExporter;vnd.sun.star.Package:TEIP5/teitoodt.xsl;vnd.sun.star.Package:TEIP5/odttotei.xsl;vnd.sun.star.Package:TEIP5/teilite.dtd;,0,vnd.sun.star.Package:TEIP5/TEIP5.ott</value>
+   </prop>
+  </node></node>
+</oor:component-data>
\ No newline at end of file
Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/odt/build-to.xml
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/odt/build-to.xml	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/odt/build-to.xml	(revision 258)
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="utf-8"?>
+<project basedir="." default="dist" name="teitooo">
+<!--
+	This library is free software; you can redistribute it and/or
+	modify it under the terms of the GNU Lesser General Public
+	License as published by the Free Software Foundation; either
+	version 2.1 of the License, or (at your option) any later version.
+	
+	This library 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
+	Lesser General Public License for more details.
+	
+	You should have received a copy of the GNU Lesser General Public
+	License along with this library; if not, write to the Free Software
+	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+	
+        Id: $Id: build-to.xml 9875 2011-12-04 18:27:43Z rahtz $
+        Copyright: 2011, TEI Consortium<
+-->
+  <!--
+ Convert TEI documents into OO files.
+ -->
+  <!-- Path to TEI XML file. -->
+  <property name="inputFile" value=""/>
+  <!-- Path where the output oo file will be saved. -->
+  <property name="outputFile" value=""/>
+  <!-- which profile -->
+  <property name="profile" value="default"/>
+  <!-- which language -->
+  <property name="lang" value="en"/>
+  <!-- where does oxygen keep stuff -->
+  <property name="oxygenlib" value=""/>
+  <!-- Stylesheet for transformation -->
+  <property name="stylesheetFile"  value="../profiles/${profile}/odt/to.xsl"/>
+  <property name="listgraphics"    value="../tools/makegraphicsanttask.xsl"/>
+  <dirname property="inputFileDir" file="${inputFile}"/>
+  <dirname property="outputDir"    file="${outputFile}"/>
+  <dirname property="xslDir"       file="${stylesheetFile}"/>
+  <property name="outputTempDir"   value="${outputDir}/temp-dir-for-ant"/>
+
+  <path id="classpath">
+    <pathelement path="${java.class.path}"/>
+  </path>
+
+  <import file="../odds2/build-to.xml"/>
+
+  <target name="setup">
+    <taskdef name="images" classname="ImageTask" classpath="../tools/ImageInfo/ImageInfo.jar"/>
+    <delete dir="${outputTempDir}"/>
+    <mkdir  dir="${outputTempDir}"/>
+  </target>
+
+  <target name="dist" depends="setup,odd,notodd">
+    <!-- Recreate temporary output directory -->
+    <!-- The transformation for OO output. -->
+    <echo level="info">unzip ODT template</echo>
+    <unzip src="${xslDir}/template.odt" dest="${outputTempDir}"/>
+    <echo level="info">Get names of graphics files and write an ant task</echo>
+    <xslt force="yes" style="${listgraphics}" classpath="classpath" in="${outputTempDir}/tmp2.xml" out="${outputTempDir}/copy.xml">
+      <xmlcatalog>
+        <catalogpath>
+          <pathelement location="../../../../catalog.xml"/>
+          <pathelement location="../../../../../xhtml11/dtd/xhtmlcatalog.xml"/>
+        </catalogpath>
+      </xmlcatalog>
+      <factory name="net.sf.saxon.TransformerFactoryImpl"/>
+      <classpath location="${oxygenlib}/saxon9ee.jar"/>
+      <param name="inputDir" expression="${inputFileDir}"/>
+      <param name="mediaDir" expression="Pictures"/>
+    </xslt>
+    <echo level="info">Copy image files by running ant task</echo>
+    <ant antfile="${outputTempDir}/copy.xml"/>
+    <echo level="info">Read dimensions of image files and write info file</echo>
+    <images outputFile="${outputTempDir}/image-size-info.xml">
+      <fileset dir="${outputTempDir}" includes="Pictures/*.*"/>
+    </images>
+    <echo level="info">XSLT generate files for oo </echo>
+    <xslt force="yes" style="${stylesheetFile}" in="${outputTempDir}/tmp2.xml" out="${outputTempDir}/newdocument.xml" classpath="classpath">
+      <xmlcatalog>
+        <catalogpath>
+          <pathelement location="../../../../catalog.xml"/>
+          <pathelement location="../../../../../xhtml11/dtd/xhtmlcatalog.xml"/>
+        </catalogpath>
+      </xmlcatalog>
+      <factory name="net.sf.saxon.TransformerFactoryImpl"/>
+      <classpath location="${oxygenlib}/saxon9ee.jar"/>
+      <param name="outputDir" expression="file:///${outputTempDir}"/>
+      <param name="freestanding" expression="true"/>
+      <!-- supply name of language-->
+      <param name="lang" expression="${lang}" if="lang"/>
+      <!-- emit some diagnostics"-->
+      <param name="debug" expression="${debug}" if="debug"/>
+      <!-- be verbose-->
+      <param name="verbose" expression="${verbose}" if="verbose"/>
+    </xslt>
+    <move file="${outputTempDir}/newdocument.xml" tofile="${outputTempDir}/content.xml" overwrite="true"/>
+    <echo level="info">ZIP: put files from ${outputTempDir} together into ${outputFile}</echo>
+    <zip destfile="${outputDir}/temp-for-ant.zip" basedir="${outputTempDir}" compress="true" excludes="tmp1.xml,tmp2.xml,image-size-info.xml,copy.xml"/>
+    <copy file="${outputDir}/temp-for-ant.zip" tofile="${outputFile}" overwrite="true"/>
+    <delete file="${outputDir}/temp-for-ant.zip"/>
+    <delete dir="${outputTempDir}"/>
+  </target>
+</project>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/odt/build-to.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/odt/build-from.xml
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/odt/build-from.xml	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/odt/build-from.xml	(revision 258)
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="utf-8"?>
+<project basedir="." default="dist" name="docxtei">
+<!--
+	This library is free software; you can redistribute it and/or
+	modify it under the terms of the GNU Lesser General Public
+	License as published by the Free Software Foundation; either
+	version 2.1 of the License, or (at your option) any later version.
+	
+	This library 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
+	Lesser General Public License for more details.
+	
+	You should have received a copy of the GNU Lesser General Public
+	License along with this library; if not, write to the Free Software
+	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+	
+        Id: $Id: build-from.xml 9316 2011-09-13 08:06:05Z rahtz $
+        Copyright: 2011, TEI Consortium<
+-->
+  <!--
+ Convert odt files to TEI documents.
+ -->
+  <!-- Path to ODT file. -->
+  <property name="inputFile" value=""/>
+  <!-- Path where the output TEI file will be saved. -->
+  <property name="outputFile" value=""/>
+  <!-- which profile -->
+  <property name="profile" value="default"/>
+  <!-- which language -->
+  <property name="lang" value="en"/>
+  <!-- where does oxygen keep stuff -->
+  <property name="oxygenlib" value=""/>
+  <!-- Stylesheet for transformation -->
+  <property name="odttotei"  value="../profiles/${profile}/odt/from.xsl"/>
+  <dirname property="inputFileDir" file="${inputFile}"/>
+  <dirname property="outputDir"    file="${outputFile}"/>
+  <property name="outputTempDir"   value="${outputDir}/temp-dir-for-ant"/>
+
+  <path id="classpath">
+    <pathelement path="${java.class.path}"/>
+  </path>
+
+  <target name="setup">
+    <!-- Recreate temporary output directory -->
+    <delete dir="${outputTempDir}"/>
+    <mkdir  dir="${outputTempDir}"/>
+  </target>
+
+  <target name="dist" depends="convert,mediadir.check,picturecopy,cleanup"/>
+
+  <target name="convert" depends="setup">
+    <unzip src="${inputFile}" dest="${outputTempDir}"/>
+    <xslt force="yes" style="${odttotei}" classpath="classpath" in="${outputTempDir}/content.xml" out="${outputFile}">
+      <xmlcatalog>
+        <catalogpath>
+          <pathelement location="../../../../catalog.xml"/>
+          <pathelement location="../../../../../xhtml11/dtd/xhtmlcatalog.xml"/>
+        </catalogpath>
+      </xmlcatalog>
+      <factory name="net.sf.saxon.TransformerFactoryImpl"/>
+      <classpath location="${oxygenlib}/saxon9ee.jar"/>
+      <param name="dir" expression="${outputTempDir}"/>
+      <param name="inputDir" expression="${inputFileDir}"/>
+      <param name="mediaDir" expression="Pictures"/>
+    </xslt>
+  </target>
+
+  <target name="mediadir.check">
+    <condition property="mediadir.exists">
+      <available file="${outputTempDir}/Pictures" type="dir"/>
+    </condition>
+  </target>
+
+  <target name="picturecopy" if="${mediadir.exists}">
+    <move todir="${outputDir}/Pictures"  overwrite="true">
+      <fileset dir="${outputTempDir}/Pictures"/>
+    </move>
+  </target>
+
+  <target name="cleanup" unless="debug">
+    <delete dir="${outputTempDir}"/>
+  </target>
+
+</project>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/odt/build-from.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/odt/grouping.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/odt/grouping.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/odt/grouping.xsl	(revision 258)
@@ -0,0 +1,126 @@
+<xsl:stylesheet
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:mf="http://example.com/mf"
+ exclude-result-prefixes="xs mf"
+ version="2.0">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet dealing with elements from the core module. </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: grouping.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc>
+   </doc>
+
+
+ <xsl:output indent="yes"/>
+
+ <xsl:template match="body">
+   <xsl:copy>
+     <xsl:sequence select="mf:group(*, 1, 0)"/>
+   </xsl:copy>
+ </xsl:template>
+
+ <xsl:function name="mf:group" as="node()*">
+   <xsl:param name="elements" as="element()*"/>
+   <xsl:param name="level" as="xs:integer"/>
+   <xsl:param name="last-level" as="xs:integer"/>
+   <xsl:for-each-group select="$elements"
+group-starting-with="head[@level = $level]">
+     <xsl:variable name="head" as="element()?"
+select=".[self::head[@level = $level]]"/>
+     <xsl:variable name="tail" as="element()*" select="current-group()
+except $head"/>
+     <xsl:choose>
+       <xsl:when test="$head">
+         <xsl:sequence select="mf:nested-divs($head, $tail, $level,
+$level - $last-level)"/>
+       </xsl:when>
+       <xsl:otherwise>
+           <xsl:choose>
+             <xsl:when test="$tail[self::head[@level]]">
+               <xsl:sequence select="mf:group($tail, $level + 1, $last-level)"/>
+             </xsl:when>
+             <xsl:otherwise>
+               <xsl:copy-of select="$tail"/>
+             </xsl:otherwise>
+           </xsl:choose>
+       </xsl:otherwise>
+     </xsl:choose>
+   </xsl:for-each-group>
+ </xsl:function>
+
+ <xsl:function name="mf:nested-divs" as="element()*">
+   <xsl:param name="head" as="element()?"/>
+   <xsl:param name="tail" as="element()*"/>
+   <xsl:param name="level" as="xs:integer"/>
+   <xsl:param name="i" as="xs:integer"/>
+   <xsl:choose>
+     <xsl:when test="$i gt 0">
+       <div>
+         <xsl:sequence select="mf:nested-divs($head, $tail, $level, $i - 1)"/>
+       </div>
+     </xsl:when>
+     <xsl:otherwise>
+       <xsl:copy-of select="$head"/>
+       <xsl:choose>
+         <xsl:when test="$tail[self::head[@level]]">
+           <xsl:sequence select="mf:group($tail, $level + 1, $level)"/>
+         </xsl:when>
+         <xsl:otherwise>
+           <xsl:copy-of select="$tail"/>
+         </xsl:otherwise>
+       </xsl:choose>
+     </xsl:otherwise>
+   </xsl:choose>
+ </xsl:function>
+
+</xsl:stylesheet>
+
+<!--
+It has become rather complicated with two functions due to the
+requirement to add missing levels.
+
+Your latest suggestion to first normalize the input by adding missing
+levels and then to group in a second pass might indeed be an approach
+leading to shorter and less complicated code.
+
+
+
+       Martin Honnen
+       http://msmvps.com/blogs/martin_honnen/
+-->
+

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/odt/grouping.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/odt/odttotei.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/odt/odttotei.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/odt/odttotei.xsl	(revision 258)
@@ -0,0 +1,1450 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet
+  exclude-result-prefixes="office style text table draw fo xlink dc
+			   meta number tei svg chart dr3d math form
+			   script ooo ooow oooc dom xforms xs xsd xsi"
+  office:version="1.0" version="2.0" 
+  xmlns:xs="http://www.w3.org/2001/XMLSchema"
+  xmlns="http://www.tei-c.org/ns/1.0"
+  xmlns:tei="http://www.tei-c.org/ns/1.0"
+  xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
+  xmlns:dc="http://purl.org/dc/elements/1.1/"
+  xmlns:dom="http://www.w3.org/2001/xml-events"
+  xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
+  xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
+  xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
+  xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
+  xmlns:math="http://www.w3.org/1998/Math/MathML"
+  xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
+  xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
+  xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
+  xmlns:ooo="http://openoffice.org/2004/office"
+  xmlns:oooc="http://openoffice.org/2004/calc"
+  xmlns:ooow="http://openoffice.org/2004/writer"
+  xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
+  xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
+  xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
+  xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
+  xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
+  xmlns:xforms="http://www.w3.org/2002/xforms"
+  xmlns:xlink="http://www.w3.org/1999/xlink"
+  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet for making TEI files from
+	 OpenOffice. Originally derived from the OpenOffice /Docbook
+	 conversion, but largely rewritten</p>
+         <p> 
+            <h1 xmlns="">License</h1>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: odttotei.xsl 10180 2012-03-25 14:48:46Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc>
+   </doc>
+
+  <xsl:key match="style:style" name="STYLES" use="@style:name"/>
+
+
+  <xsl:key name="LISTS" 
+	 match="text:list-level-style-number" 
+	 use="parent::text:list-style/@style:name"/>
+
+  <xsl:key match="text:h" name="Headings" use="text:outline-level"/>
+
+  <xsl:param name="debug">false</xsl:param>
+
+  <xsl:param name="dir">.</xsl:param>
+
+  <xsl:output encoding="utf-8" indent="yes"/>
+
+  <!--  <xsl:strip-space elements="text:span"/>-->
+  
+  <xsl:variable name="META">
+    <xsl:choose>
+      <xsl:when test="doc-available(concat($dir,'/meta.xml'))">
+        <xsl:copy-of select="document(concat($dir,'/meta.xml'))//office:meta"/>
+      </xsl:when>
+      <xsl:when test="/office:document/office:meta">
+        <xsl:copy-of select="/office:document/office:meta"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:copy-of select="/office:document-meta/office:meta"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:variable name="document-title">
+    <xsl:choose>
+      <xsl:when
+	  test="/office:document-content/office:body/office:text/text:p[@text:style-name='Title']">
+        <xsl:value-of
+	    select="/office:document-content/office:body/office:text/text:p[@text:style-name='Title'][1]"
+	    />
+      </xsl:when>
+      <xsl:when test="$META/office:meta/dc:title">
+        <xsl:value-of select="$META/office:meta/dc:title"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:text>Untitled Document</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:template match="*" mode="summary">
+    <xsl:text>&#10;</xsl:text>
+    <xsl:for-each select="ancestor::*"><xsl:text>.</xsl:text></xsl:for-each>
+    <xsl:value-of select="name()"/>:
+    <xsl:apply-templates mode="summary"/>
+  </xsl:template>
+
+  <xsl:template match="/">
+    <xsl:if test="$debug='true'">
+      <xsl:message>Look for metadata in <xsl:value-of select="concat($dir,'/meta.xml')"/></xsl:message>
+    </xsl:if>
+    <xsl:variable name="pass1">
+      <xsl:apply-templates/>
+    </xsl:variable>
+    <xsl:variable name="pass2">
+      <xsl:apply-templates mode="pass2" select="$pass1"/>
+    </xsl:variable>
+    <xsl:apply-templates mode="pass3" select="$pass2"/>    
+  </xsl:template>
+
+  <xsl:template match="office:document-content|office:body">
+    <xsl:for-each select="descendant::text:variable-decl">
+      <xsl:variable name="name">
+        <xsl:value-of select="@text:name"/>
+      </xsl:variable>
+      <xsl:if test="contains(@text:name,'entitydecl')">
+        <xsl:text disable-output-escaping="yes">&lt;!DOCTYPE TEI [
+	</xsl:text>
+        <xsl:text disable-output-escaping="yes">&lt;!ENTITY </xsl:text>
+        <xsl:value-of select="substring-after(@text:name,'entitydecl_')"/>
+        <xsl:text> &quot;</xsl:text>
+        <xsl:value-of
+          select="/descendant::text:variable-set[@text:name= $name][1]"/>
+        <xsl:text disable-output-escaping="yes">&quot;&gt;</xsl:text>
+        <xsl:text disable-output-escaping="yes">]&gt;</xsl:text>
+      </xsl:if>
+    </xsl:for-each>
+    <TEI>
+	<xsl:for-each select="$META/office:meta/dc:language">
+	  <xsl:attribute name="xml:lang">
+	    <xsl:value-of select="normalize-space(.)"/>
+	  </xsl:attribute>
+	</xsl:for-each>  
+      <xsl:call-template name="teiHeader"/>
+      <text>
+	<xsl:apply-templates/>
+      </text>
+    </TEI>
+  </xsl:template>
+
+
+  <xsl:template match="text:variable-set|text:variable-get">
+    <xsl:choose>
+      <xsl:when test="contains(@text:style-name,'entitydecl')">
+        <xsl:text disable-output-escaping="yes">&amp;</xsl:text>
+        <xsl:value-of select="substring-after(@text:style-name,'entitydecl_')"/>
+        <xsl:text disable-output-escaping="yes">;</xsl:text>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="teiHeader">
+    <teiHeader>
+      <fileDesc>
+        <titleStmt>
+          <title>
+            <xsl:value-of select="$document-title"/>
+          </title>
+          <author>
+            <xsl:value-of
+              select="$META/office:meta/meta:initial-creator"/>
+          </author>
+        </titleStmt>
+        <editionStmt>
+          <edition>
+            <date>
+              <xsl:value-of
+                select="$META/office:meta/meta:creation-date"/>
+            </date>
+          </edition>
+        </editionStmt>
+        <publicationStmt>
+          <p>no publication statement available</p>
+        </publicationStmt>
+        <sourceDesc>
+          <p>
+	    <xsl:apply-templates
+              select="$META/office:meta/meta:generator"/>
+	    <xsl:text>Written by OpenOffice</xsl:text>
+	  </p>
+        </sourceDesc>
+      </fileDesc>
+      <xsl:variable name="pD">
+	<xsl:if test="$META/office:meta/dc:language">
+	  <langUsage>
+	    <language>
+	      <xsl:attribute name="ident">
+		<xsl:value-of select="$META/office:meta/dc:language"/>
+	      </xsl:attribute>
+	      <xsl:value-of select="$META/office:meta/dc:language"/>
+	    </language>
+	  </langUsage>
+	</xsl:if>
+	<xsl:if test="$META/office:meta/meta:keyword">
+	  <textClass>
+	    <keywords scheme="unknown">
+	      <list>
+		<xsl:for-each select="$META/office:meta/meta:keyword">
+		  <item>
+		    <xsl:value-of select="."/>
+		  </item>
+		</xsl:for-each>
+	      </list>
+	    </keywords>
+	  </textClass>
+	</xsl:if>
+      </xsl:variable>
+      <xsl:if test="$pD/*">
+	<profileDesc>
+	  <xsl:copy-of select="$pD"/>
+	</profileDesc>
+      </xsl:if>
+      <revisionDesc>
+	<change>
+	  <name>
+	    <xsl:apply-templates
+		select="$META/office:meta/dc:creator"/>
+	  </name>
+	  <date>
+	    <xsl:apply-templates select="$META/office:meta/dc:date"/>
+	  </date>
+	</change>
+      </revisionDesc>
+    </teiHeader>
+  </xsl:template>
+
+
+
+  <xsl:template match="/office:document-content/office:body">
+      <xsl:apply-templates/>
+  </xsl:template>
+
+  <!-- sections -->
+  <xsl:template match="text:h">
+    <xsl:choose>
+      <xsl:when test="ancestor::text:note-body">
+          <xsl:apply-templates/>
+      </xsl:when>
+      <xsl:when test="@text:style-name='ArticleInfo'"> </xsl:when>
+      <xsl:when test="@text:style-name='Abstract'">
+        <div type="abstract">
+          <xsl:apply-templates/>
+        </div>
+      </xsl:when>
+      <xsl:when test="@text:style-name='Appendix'">
+        <div type="appendix">
+          <xsl:apply-templates/>
+        </div>
+      </xsl:when>
+      <xsl:otherwise>
+	<HEAD level="1" style="{@text:style-name}">
+	  <xsl:apply-templates/>
+	</HEAD>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="text:h[@text:outline-level]">
+    <xsl:choose>
+      <xsl:when test="ancestor::text:note-body">
+	<p>
+	  <xsl:attribute name="rend">
+	    <xsl:choose>
+	      <xsl:when test="@text:style-name">
+		<xsl:value-of select="@text:style-name"/>
+	      </xsl:when>
+	      <xsl:otherwise>heading</xsl:otherwise>
+	    </xsl:choose>
+	  </xsl:attribute>
+          <xsl:apply-templates/>
+	</p>
+      </xsl:when>
+      <xsl:otherwise>
+	<HEAD level="{@text:outline-level}" >
+	  <xsl:attribute name="style">
+	    <xsl:choose>
+	      <xsl:when test="@text:style-name">
+		<xsl:value-of select="@text:style-name"/>
+	      </xsl:when>
+	      <xsl:otherwise>nostyle</xsl:otherwise>
+	    </xsl:choose>
+	  </xsl:attribute>
+	  <xsl:apply-templates/>
+	</HEAD>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  
+  <!-- special case paragraphs -->
+  <xsl:template match="text:p[@text:style-name='XMLComment']">
+    <xsl:comment>
+      <xsl:value-of select="."/>
+    </xsl:comment>
+  </xsl:template>
+ 
+
+  <xsl:template match="text:p[@text:style-name]">
+    <xsl:choose>
+      <xsl:when test="draw:frame and parent::draw:text-box">
+	<xsl:apply-templates select="draw:frame"/>
+	<head>
+	  <xsl:apply-templates select="text()|*[not(local-name(.)='frame')]"/>
+	</head>
+      </xsl:when>
+      <xsl:when test="parent::table:table-cell">
+	<xsl:call-template name="applyStyle"/>
+      </xsl:when>
+
+      <xsl:when test="count(parent::text:note-body/text:p)=1">
+          <xsl:apply-templates/>
+      </xsl:when>
+
+      <xsl:when test="count(parent::text:list-item/text:p)=1">
+          <xsl:apply-templates/>
+      </xsl:when>
+
+      <xsl:when test="@text:style-name='Document Title'">
+        <title>
+          <xsl:apply-templates/>
+        </title>
+      </xsl:when>
+
+      <xsl:when test="@text:style-name='Author'">
+        <author>
+          <xsl:apply-templates/>
+        </author>
+      </xsl:when>
+
+      <xsl:when test="@text:style-name='lg'">
+        <lg>
+	  <xsl:for-each-group select="node()"
+			      group-ending-with="text:line-break">
+	    <l><xsl:apply-templates select="current-group()"/></l>
+	  </xsl:for-each-group>
+        </lg>
+      </xsl:when>
+      <xsl:when test="@text:style-name='Title'">
+        <title>
+          <xsl:apply-templates/>
+        </title>
+      </xsl:when>
+      <xsl:when test="@text:style-name='Date'">
+        <date>
+          <xsl:apply-templates/>
+        </date>
+      </xsl:when>
+      <xsl:when test="@text:style-name='Section Title'">
+        <head>
+          <xsl:apply-templates/>
+        </head>
+      </xsl:when>
+      <xsl:when test="@text:style-name='Appendix Title'">
+        <head>
+          <xsl:apply-templates/>
+        </head>
+      </xsl:when>
+      <xsl:when test="@text:style-name='Screen'">
+        <Screen>
+          <xsl:apply-templates/>
+        </Screen>
+      </xsl:when>
+      <xsl:when test="@text:style-name='Output'">
+        <Output>
+          <xsl:apply-templates/>
+        </Output>
+      </xsl:when>
+
+      <xsl:otherwise>
+        <p>
+          <xsl:variable name="stylename"><xsl:value-of select="@text:style-name"></xsl:value-of></xsl:variable>
+          <xsl:choose>
+            <xsl:when test="matches($stylename,'P[0-9]+')">
+              <xsl:attribute name="rend" select="//style:style[@style:name=$stylename]/@style:parent-style-name"></xsl:attribute>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:attribute name="rend" select="@text:style-name"></xsl:attribute>
+            </xsl:otherwise>
+          </xsl:choose> 
+          <!-- <xsl:attribute name="rend" select="@text:style-name"/> -->
+	<xsl:apply-templates/>
+<!--      <xsl:call-template name="applyStyle"/>-->
+        </p>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="office:annotation/text:p" priority="100">
+    <note>
+        <xsl:apply-templates/>
+    </note>
+  </xsl:template>
+
+
+  <!-- normal paragraphs -->
+  <xsl:template match="text:p">
+    <xsl:choose>
+      <xsl:when test="parent::text:list-item">
+	<xsl:call-template name="applyStyle"/>
+      </xsl:when>
+      <xsl:when test="parent::table:table-cell">
+        <xsl:call-template name="applyStyle"/>
+      </xsl:when>
+      <xsl:when test="@text:style-name='Table'"/>
+      <xsl:when test="text:span[@text:style-name = 'XrefLabel']"/>
+      <xsl:when test="@text:style-name='Speech'">
+        <sp>
+          <speaker/>
+          <p>
+            <xsl:call-template name="id.attribute"/>
+            <xsl:call-template name="applyStyle"/>
+          </p>
+        </sp>
+      </xsl:when>
+      <xsl:otherwise>
+        <p>
+          <xsl:call-template name="id.attribute"/>
+          <xsl:call-template name="applyStyle"/>
+        </p>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <!-- lists -->
+  <xsl:template match="text:list">
+    <xsl:variable name="style">
+      <xsl:for-each select="key('LISTS',@text:style-name)[1]">
+	<xsl:value-of select="@text:style-name"/>
+      </xsl:for-each>
+    </xsl:variable>
+    <xsl:choose>
+      <xsl:when test="text:list-item/text:h">
+	<xsl:for-each select="text:list-item">
+	  <xsl:apply-templates/>
+	</xsl:for-each>
+      </xsl:when>
+      <xsl:when test="@text:style-name='Var List'">
+        <list>
+          <xsl:apply-templates/>
+        </list>
+      </xsl:when>
+      <xsl:when test="contains($style,'Number')">
+        <list type="ordered">
+          <xsl:apply-templates/>
+        </list>
+      </xsl:when>
+      <xsl:otherwise>
+        <list type="unordered">
+          <xsl:apply-templates/>
+        </list>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="text:list-header">
+    <head>
+      <xsl:apply-templates/>
+    </head>
+  </xsl:template>
+
+  <xsl:template match="text:list-item">
+    <xsl:choose>
+      <xsl:when test="parent::text:list/@text:style-name='Var List'">
+        <item>
+          <xsl:for-each select="text:p[@text:style-name='VarList Term']">
+            <xsl:apply-templates select="."/>
+          </xsl:for-each>
+        </item>
+      </xsl:when>
+      <xsl:otherwise>
+        <item>
+	  <xsl:apply-templates/>
+	</item>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+
+  <xsl:template
+    match="text:p[@text:style-name='VarList Item' or
+	   @text:style-name='List Contents']">
+    <GLOSS n="item">
+      <xsl:apply-templates/>
+    </GLOSS>
+  </xsl:template>
+
+  <xsl:template
+    match="text:p[@text:style-name='VarList Term' or @text:style-name='List Heading']">
+    <GLOSS n="label"> 
+      <xsl:apply-templates/>
+    </GLOSS>
+  </xsl:template>
+
+  <!-- inline -->
+
+  <xsl:template match="text:span">
+    <xsl:variable name="Style">
+      <xsl:value-of select="@text:style-name"/>
+    </xsl:variable>
+    <xsl:choose>
+      <xsl:when test="$Style='Emphasis'">
+        <emph>
+          <xsl:apply-templates/>
+        </emph>
+      </xsl:when>
+      <xsl:when test="$Style='Underline'">
+        <hi rend="ul">
+          <xsl:apply-templates/>
+        </hi>
+      </xsl:when>
+      <xsl:when test="$Style='SmallCaps'">
+        <hi rend="sc">
+          <xsl:apply-templates/>
+        </hi>
+      </xsl:when>
+      <xsl:when test="$Style='Emphasis Bold'">
+        <hi rend="bold">
+          <xsl:apply-templates/>
+        </hi>
+      </xsl:when>
+      <xsl:when test="$Style='Highlight'">
+        <hi>
+          <xsl:apply-templates/>
+        </hi>
+      </xsl:when>
+      <xsl:when test="$Style='q'">
+        <q>
+          <xsl:choose>
+            <xsl:when test="starts-with(.,'&#x2018;')">
+              <xsl:value-of
+                select="substring-before(substring-after(.,'&#x2018;'),'&#x2019;')"
+              />
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:apply-templates/>
+            </xsl:otherwise>
+          </xsl:choose>
+        </q>
+      </xsl:when>
+      <xsl:when test="$Style='date'">
+        <date>
+          <xsl:apply-templates/>
+        </date>
+      </xsl:when>
+      <xsl:when test="$Style='l'">
+        <l>
+          <xsl:apply-templates/>
+        </l>
+      </xsl:when>
+      <xsl:when test="$Style='Filespec'">
+        <Filespec>
+          <xsl:apply-templates/>
+        </Filespec>
+      </xsl:when>
+      <xsl:when test="$Style='gi'">
+        <gi>
+          <xsl:apply-templates/>
+        </gi>
+      </xsl:when>
+      <xsl:when test="$Style='Code'">
+        <Code>
+          <xsl:apply-templates/>
+        </Code>
+      </xsl:when>
+      <xsl:when test="$Style='Input'">
+        <Input>
+          <xsl:apply-templates/>
+        </Input>
+      </xsl:when>
+      <xsl:when test="$Style='Internet Link'">
+        <xsl:apply-templates/>
+      </xsl:when>
+      <xsl:when test="$Style='SubScript'">
+	<hi rend="sub">
+	  <xsl:apply-templates/>
+        </hi>
+      </xsl:when>
+      <xsl:when test="$Style='SuperScript'">
+        <hi rend="sup">
+	  <xsl:apply-templates/>
+        </hi>
+      </xsl:when>
+      <xsl:when test="style:text-properties[@fo:text-transform='small-caps']">
+	<hi rend="sc">
+	  <xsl:apply-templates/>
+	</hi>
+      </xsl:when>
+      <xsl:when test="../text:h">
+        <xsl:apply-templates/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="applyStyle"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="applyStyle">
+    <xsl:variable name="name">
+      <xsl:value-of select="@text:style-name"/>
+    </xsl:variable>
+
+    <xsl:choose>
+      <xsl:when test="string-length(.)=0"/>
+      <xsl:when test="text:note">
+	<xsl:apply-templates/>
+      </xsl:when>
+      <xsl:when test="key('STYLES',$name)">
+        <xsl:variable name="contents">
+          <xsl:apply-templates/>
+        </xsl:variable>
+        <xsl:for-each select="key('STYLES',$name)">
+
+	  <!--! <xsl:for-each select="style:text-properties/@*">
+	      <xsl:value-of select="name(.)"/>:        <xsl:value-of select="."/>&#10;
+	      </xsl:for-each>
+	  -->
+	  <xsl:variable name="divrendstring">
+	    <xsl:if
+		test="style:paragraph-properties/@fo:text-align">
+	      <xsl:value-of
+		  select="style:paragraph-properties/@fo:text-align"/>
+	      <xsl:text> </xsl:text>
+	    </xsl:if>
+	  </xsl:variable>
+
+	  <xsl:variable name="rendstring">
+	    <xsl:if
+		test="style:text-properties[starts-with(@style:text-position,'super')]">
+	      <xsl:text>sup </xsl:text>
+	    </xsl:if>
+	    
+	    <xsl:if
+		test="style:text-properties[starts-with(@style:text-position,'sub')]">
+	      <xsl:text>sub </xsl:text>
+	    </xsl:if>
+	    
+	    <xsl:if test="style:text-properties[@fo:font-weight='bold']">
+	      <xsl:text>bold </xsl:text>
+	    </xsl:if>
+	    
+	    <xsl:if
+		test="style:text-properties[@style:text-underline-type='double']">
+	      <xsl:text>underdoubleline </xsl:text>
+	    </xsl:if>
+	    
+	    <xsl:if
+		test="style:text-properties[@style:text-underline-style='solid']">
+	      <xsl:text>underline </xsl:text>
+	    </xsl:if>
+	    
+	    <xsl:if
+		test="style:text-properties[@style:text-line-through-style='solid']">
+	      <xsl:text>strikethrough </xsl:text>
+	    </xsl:if>
+	    
+	    <xsl:if
+		test="style:text-properties[@fo:font-variant='small-caps']">
+	      <xsl:text>smallcaps </xsl:text>
+	    </xsl:if>
+	    
+	    <xsl:if test="style:text-properties[@fo:font-style='italic']">
+	      <xsl:text>italic </xsl:text>
+	    </xsl:if>
+	  </xsl:variable>
+
+	  <!--<xsl:message>so: <xsl:value-of select="$divrendstring"/></xsl:message>
+	  <xsl:if test="not($divrendstring='')">
+	      <xsl:attribute name="rend" select="normalize-space($divrendstring)"/>
+	  </xsl:if>-->
+
+	  <xsl:choose>
+	    <xsl:when test="$rendstring=''">
+	      <xsl:copy-of select="$contents"/>
+	    </xsl:when>
+	    <xsl:otherwise>
+	      <hi rend="{normalize-space($rendstring)}">
+		<xsl:copy-of select="$contents"/>
+	      </hi>
+	    </xsl:otherwise>
+	  </xsl:choose>
+	  
+        </xsl:for-each>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:apply-templates/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <!-- tables -->
+  <xsl:template match="table:table">
+    <table rend="frame">
+      <xsl:if test="@table:name and not(@table:name = 'local-table')">
+        <xsl:attribute name="xml:id">
+          <xsl:value-of select="@table:name"/>
+        </xsl:attribute>
+      </xsl:if>
+      <xsl:if test="following-sibling::text:p[@text:style-name='Table']">
+        <head>
+          <xsl:value-of
+            select="following-sibling::text:p[@text:style-name='Table']"/>
+        </head>
+      </xsl:if>
+      <xsl:call-template name="generictable"/>
+    </table>
+
+  </xsl:template>
+
+
+  <xsl:template name="generictable">
+    <xsl:variable name="cells" select="count(descendant::table:table-cell)"/>
+    <xsl:variable name="rows">
+      <xsl:value-of select="count(descendant::table:table-row) "/>
+    </xsl:variable>
+    <xsl:variable name="cols">
+      <xsl:value-of select="$cells div $rows"/>
+    </xsl:variable>
+    <xsl:variable name="numcols">
+      <xsl:choose>
+        <xsl:when
+          test="child::table:table-column/@table:number-columns-repeated">
+          <xsl:value-of
+            select="number(table:table-column/@table:number-columns-repeated+1)"
+          />
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="$cols"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+
+    <xsl:apply-templates/>
+  </xsl:template>
+
+  <xsl:template name="colspec">
+    <xsl:param name="left"/>
+    <xsl:if
+      test="number($left &lt; ( table:table-column/@table:number-columns-repeated +2)  )">
+      <colspec>
+        <xsl:attribute name="colnum">
+          <xsl:value-of select="$left"/>
+        </xsl:attribute>
+        <xsl:attribute name="colname">
+          <xsl:text>c</xsl:text>
+          <xsl:value-of select="$left"/>
+        </xsl:attribute>
+      </colspec>
+      <xsl:call-template name="colspec">
+        <xsl:with-param name="left" select="$left+1"/>
+      </xsl:call-template>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template match="table:table-column">
+    <xsl:apply-templates/>
+  </xsl:template>
+
+  <xsl:template match="table:table-header-rows">
+    <xsl:apply-templates/>
+  </xsl:template>
+
+  <xsl:template match="table:table-header-rows/table:table-row">
+    <row role="label">
+      <xsl:apply-templates/>
+    </row>
+  </xsl:template>
+
+  <xsl:template match="table:table/table:table-row">
+    <row>
+      <xsl:apply-templates/>
+    </row>
+  </xsl:template>
+
+  <xsl:template match="table:table-cell/text:h">
+    <xsl:apply-templates/>
+  </xsl:template>
+
+
+  <xsl:template match="table:table-cell">
+    <cell>
+      <xsl:if test="@table:number-columns-spanned &gt;'1'">
+        <xsl:attribute name="cols">
+          <xsl:value-of select="@table:number-columns-spanned"/>
+        </xsl:attribute>
+      </xsl:if>
+      <xsl:if test="@table:number-rows-spanned &gt;'1'">
+        <xsl:attribute name="rows">
+          <xsl:value-of select="@table:number-rows-spanned"/>
+        </xsl:attribute>
+      </xsl:if>
+      <xsl:if test="text:h">
+        <xsl:attribute name="role">label</xsl:attribute>
+      </xsl:if>
+      <xsl:apply-templates/>
+    </cell>
+  </xsl:template>
+
+
+  <!-- notes -->
+  <xsl:template match="text:note-citation"/>
+
+  <xsl:template match="text:note-body">
+    <xsl:apply-templates/>
+  </xsl:template>
+
+  <xsl:template match="text:note-ref">
+    <ref target="#{@text:ref-name}">
+      <xsl:apply-templates/>
+    </ref>
+  </xsl:template>
+
+  <xsl:template match="text:note">
+    <note>
+      <xsl:if test="@text:id">
+	<xsl:attribute name="xml:id">
+	  <xsl:value-of select="@text:id"/>
+	</xsl:attribute>
+      </xsl:if>
+      <xsl:choose>
+        <xsl:when test="@text:note-class='endnote'">
+          <xsl:attribute name="place">end</xsl:attribute>
+        </xsl:when>
+        <xsl:when test="@text:note-class='footnote'">
+          <xsl:attribute name="place">foot</xsl:attribute>
+        </xsl:when>
+      </xsl:choose>
+      <xsl:if test="text:note-citation">
+	<xsl:attribute name="n">
+	  <xsl:value-of select="text:note-citation"/>
+	</xsl:attribute>
+      </xsl:if>
+      <xsl:apply-templates/>
+    </note>
+  </xsl:template>
+
+  <!-- drawing -->
+  <xsl:template match="draw:plugin">
+    <ptr target="{@xlink:href}"/>
+  </xsl:template>
+
+  <xsl:template match="draw:text-box">
+    <xsl:apply-templates/>
+  </xsl:template>
+
+  <xsl:template match="draw:frame">
+    <xsl:choose>
+      <xsl:when test="ancestor::draw:frame">
+	<xsl:apply-templates/>
+      </xsl:when>
+      <xsl:otherwise>
+	<figure>
+	  <xsl:apply-templates/>
+	</figure>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="draw:image">
+    <xsl:choose>
+      <xsl:when test="ancestor::draw:text-box">
+	<xsl:call-template name="findGraphic"/>
+      </xsl:when>
+      <xsl:when test="ancestor::draw:frame">
+	<xsl:call-template name="findGraphic"/>
+      </xsl:when>
+      <xsl:when test="parent::text:p[@text:style-name='Mediaobject']">
+        <figure>
+          <xsl:call-template name="findGraphic"/>
+          <head>
+            <xsl:value-of select="."/>
+          </head>
+        </figure>
+      </xsl:when>
+      <xsl:otherwise>
+        <figure>
+          <xsl:call-template name="findGraphic"/>
+        </figure>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="findGraphic">
+    <xsl:choose>
+      <xsl:when test="office:binary-data">
+	<xsl:apply-templates/>
+      </xsl:when>
+      <xsl:when test="@xlink:href">
+        <graphic>
+          <xsl:attribute name="url">
+            <xsl:value-of select="@xlink:href"/>
+          </xsl:attribute>
+        </graphic>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="office:binary-data">    
+    <binaryObject mimeType="image/jpg">
+      <xsl:value-of select="."/>
+    </binaryObject>
+  </xsl:template>
+
+
+  <!-- linking -->
+  <xsl:template match="text:a">
+    <xsl:choose>
+      <xsl:when test="starts-with(@xlink:href,'mailto:')">
+        <xsl:choose>
+          <xsl:when test=".=@xlink:href">
+            <ptr target="{substring-after(@xlink:href,'mailto:')}"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <ref target="{@xlink:href}">
+              <xsl:apply-templates/>
+            </ref>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+      <xsl:when test="contains(@xlink:href,'://')">
+        <xsl:choose>
+          <xsl:when test=".=@xlink:href">
+            <ptr target="{@xlink:href}"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <ref target="{@xlink:href}">
+              <xsl:apply-templates/>
+            </ref>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+      <xsl:when test="not(contains(@xlink:href,'#'))">
+        <ref target="{@xlink:href}">
+          <xsl:apply-templates/>
+        </ref>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:variable name="linkvar" select="@xlink:href"/>
+        <xsl:choose>
+          <xsl:when test=".=$linkvar">
+            <ptr target="{$linkvar}"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <ref target="{$linkvar}">
+              <xsl:apply-templates/>
+            </ref>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="text:line-break">
+    <xsl:choose>
+      <xsl:when test="parent::text:span[@text:style-name='l']"/>
+      <xsl:when test="parent::text:p[@text:style-name='lg']"/>
+      <xsl:otherwise>
+	<lb/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+
+  <xsl:template match="text:tab">
+    <xsl:text>	</xsl:text>
+  </xsl:template>
+
+  <xsl:template match="text:reference-ref">
+    <ptr target="#id_{@text:ref-name}"/>
+  </xsl:template>
+
+  <xsl:template name="id.attribute.literal">
+    <xsl:if test="child::text:reference-mark-start">
+      <xsl:text> xml:id=&quot;</xsl:text>
+	<xsl:text>id_</xsl:text>
+        <xsl:value-of select="child::text:reference-mark-start/@text:style-name"
+        />
+	<xsl:text>&quot;</xsl:text>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template name="id.attribute">
+    <xsl:if test="child::text:reference-mark-start">
+      <xsl:attribute name="xml:id">
+	<xsl:text>id_</xsl:text>
+        <xsl:value-of select="child::text:reference-mark-start/@text:style-name"
+        />
+      </xsl:attribute>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template match="text:reference-mark-start"/>
+
+  <xsl:template match="text:reference-mark-end"/>
+
+  <xsl:template match="comment">
+    <xsl:comment>
+      <xsl:value-of select="."/>
+    </xsl:comment>
+  </xsl:template>
+
+  <xsl:template match="text:user-index-mark">
+    <index indexName="{@text:index-name}">
+      <term>
+	<xsl:value-of select="@text:string-value"/>
+      </term>
+    </index>
+  </xsl:template>
+
+  <xsl:template match="text:alphabetical-index-mark">
+    <xsl:if test="not(normalize-space(@text:string-value)='')">
+    <index>
+      <xsl:if test="@text:id">
+	<xsl:attribute name="xml:id">
+	  <xsl:value-of select="@text:id"/>
+	</xsl:attribute>
+      </xsl:if>
+      <xsl:choose>
+	<xsl:when test="@text:key1">
+	  <term>
+	    <xsl:value-of select="@text:key1"/>
+	  </term>
+	  <index>
+	    <term>
+	      <xsl:value-of select="@text:string-value"/>
+	    </term>
+	  </index>
+	</xsl:when>
+	<xsl:otherwise>
+	  <term>
+	    <xsl:value-of select="@text:string-value"/>
+	  </term>
+	</xsl:otherwise>
+      </xsl:choose>
+    </index>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template match="text:alphabetical-index">
+    <index>
+      <xsl:apply-templates select="text:index-body"/>
+    </index>
+  </xsl:template>
+
+  <xsl:template match="text:index-body">
+    <xsl:for-each select="text:p[@text:style-name = 'Index 1']">
+      <index>
+        <term>
+          <xsl:value-of select="."/>
+        </term>
+        <xsl:if test="key('secondary_children', generate-id())">
+          <index>
+	    <term>
+            <xsl:value-of select="key('secondary_children', generate-id())"/>
+	    </term>
+	  </index>
+        </xsl:if>
+      </index>
+    </xsl:for-each>
+  </xsl:template>
+
+  <xsl:template match="text:bookmark-ref">
+    <ref target="#id_{@text:ref-name}" type="{@text:reference-format}">
+      <xsl:apply-templates/>
+    </ref>
+  </xsl:template>
+
+  <xsl:template match="text:bookmark-start">
+    <anchor type="bookmark-start">
+      <xsl:attribute name="xml:id">
+	<xsl:text>id_</xsl:text>
+	<xsl:value-of select="@text:name"/>
+      </xsl:attribute>
+    </anchor>
+  </xsl:template>
+
+  <xsl:template match="text:bookmark-end">
+    <anchor type="bookmark-end">
+      <xsl:attribute name="corresp">
+	<xsl:text>#id_</xsl:text>
+	<xsl:value-of select="@text:name"/>
+      </xsl:attribute>
+    </anchor>
+  </xsl:template>
+
+  <xsl:template match="text:bookmark">
+    <anchor>
+      <xsl:attribute name="xml:id">
+	<xsl:text>id_</xsl:text>
+	<xsl:value-of select="@text:name"/>
+      </xsl:attribute>
+    </anchor>
+  </xsl:template>
+  <!--
+These seem to have no obvious translation
+-->
+
+  <xsl:template match="text:endnotes-configuration"/>
+
+  <xsl:template match="text:file-name"/>
+
+  <xsl:template match="text:footnotes-configuration"/>
+
+  <xsl:template match="text:linenumbering-configuration"/>
+
+  <xsl:template match="text:list-level-style-bullet"/>
+
+  <xsl:template match="text:list-level-style-number"/>
+
+  <xsl:template match="text:list-style"/>
+
+  <xsl:template match="text:outline-level-style"/>
+
+  <xsl:template match="text:outline-style"/>
+
+  <xsl:template match="text:s"/>
+
+  <xsl:template match="text:editing-cycles"><xsl:value-of select="."/></xsl:template>
+  <xsl:template match="text:page-count"><xsl:value-of select="."/></xsl:template>
+  <xsl:template match="text:word-count"><xsl:value-of select="."/></xsl:template>
+  <xsl:template match="text:image-count"><xsl:value-of select="."/></xsl:template>
+  <xsl:template match="text:table-count"><xsl:value-of select="."/></xsl:template>
+  <xsl:template match="text:modification-date"><xsl:value-of select="."/></xsl:template>
+  <xsl:template match="text:modification-time"><xsl:value-of select="."/></xsl:template>
+  <xsl:template match="text:sequence-ref"><xsl:value-of select="."/></xsl:template>
+
+  <xsl:template match="text:*"> [[[UNTRANSLATED <xsl:value-of select="name(.)"/>: <xsl:apply-templates/>]]] </xsl:template>
+
+
+  <!-- sections of the OO format we don't need at present -->
+
+  <xsl:template match="office:automatic-styles"/>
+
+  <xsl:template match="office:font-decls"/>
+
+  <xsl:template match="office:meta"/>
+
+  <xsl:template match="office:script"/>
+
+  <xsl:template match="office:settings"/>
+
+  <xsl:template match="office:styles"/>
+
+  <xsl:template match="style:*"/>
+
+
+  <xsl:template match="dc:*">
+    <xsl:apply-templates/>
+  </xsl:template>
+
+  <xsl:template match="meta:creation-date">
+    <xsl:apply-templates/>
+  </xsl:template>
+
+  <xsl:template match="meta:editing-cycles"/>
+
+  <xsl:template match="meta:editing-duration"/>
+
+  <xsl:template match="meta:generator"/>
+
+  <xsl:template match="meta:user-defined"/>
+
+  <!--
+<xsl:template match="text()">
+  <xsl:apply-templates select="normalize-space(.)"/>
+</xsl:template>
+-->
+
+<xsl:template match="text:section">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="text:sequence-decl">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="text:sequence-decls">
+  <xsl:apply-templates/>
+</xsl:template>
+
+
+<xsl:template match="text:sequence">
+  <xsl:apply-templates/>
+</xsl:template>
+
+
+<xsl:template match="text:section-source"/>
+
+
+<xsl:template match="text:soft-page-break">
+	<pb/>
+</xsl:template>
+
+<xsl:template name="stars">
+   <xsl:param name="n"/>
+   <xsl:if test="$n &gt;0">
+     <xsl:text>*</xsl:text>
+     <xsl:call-template name="stars">
+       <xsl:with-param name="n">
+	 <xsl:value-of select="$n - 1"/>
+       </xsl:with-param>
+     </xsl:call-template>
+   </xsl:if>
+</xsl:template>
+
+<xsl:template match="text:change|text:changed-region|text:change-end|text:change-start">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="text:table-of-content"/>
+<xsl:template match="text:index-entry-chapter"/>
+<xsl:template match="text:index-entry-page-number"/>
+<xsl:template match="text:index-entry-tab-stop"/>
+<xsl:template match="text:index-entry-text"/>
+<xsl:template match="text:index-title-template"/>
+<xsl:template match="text:table-of-content-entry-template"/>
+<xsl:template match="text:table-of-content-source"/>
+
+  <xsl:template match="office:text">
+    <body>
+      <xsl:variable name="Body">
+	<HEAD level="1" magic="true">Start</HEAD>
+        <xsl:apply-templates/>
+      </xsl:variable>
+      <!-- debug
+      <xsl:result-document href="/tmp/temp.xml">
+	<xsl:copy-of select="$Body"/>
+      </xsl:result-document>
+      -->
+      <xsl:variable name="Body2">
+	<xsl:for-each select="$Body">
+	  <xsl:apply-templates mode="pass1"/>
+	</xsl:for-each>
+      </xsl:variable>
+      <xsl:for-each select="$Body2">
+        <xsl:for-each-group select="tei:*" group-starting-with="tei:HEAD[@level='1']">
+          <xsl:choose>
+            <xsl:when test="self::tei:HEAD[@level='1']">
+	      <xsl:call-template name="group-by-section"/>
+            </xsl:when>
+            <xsl:otherwise>
+	      <xsl:call-template name="inSection"/>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:for-each-group>
+      </xsl:for-each>
+    </body>
+  </xsl:template>
+
+  <xsl:template name="group-by-section">
+    <xsl:variable name="ThisHeader" select="number(@level)"/>
+    <xsl:variable name="NextHeader" select="number(@level)+1"/>
+    <xsl:choose>
+      <xsl:when test="@magic">
+	  <xsl:for-each-group select="current-group() except ."
+			      group-starting-with="tei:HEAD[number(@level)=$NextHeader]">
+	    <xsl:choose>
+	      <xsl:when test="self::tei:HEAD">
+		<xsl:call-template name="group-by-section"/>
+	      </xsl:when>
+	    <xsl:otherwise>
+	      <xsl:call-template name="inSection"/>
+	    </xsl:otherwise>
+	    </xsl:choose>
+	  </xsl:for-each-group>
+      </xsl:when>
+      <xsl:otherwise>
+	<div>
+	  <xsl:choose>
+	    <xsl:when test="starts-with(@style,'Heading')"/>
+	    <xsl:when test="@style">
+	      <xsl:attribute name="rend" select="@style"/>
+	    </xsl:when>
+	  </xsl:choose>
+	  <xsl:if test="not(@interpolated='true')">
+	    <head>
+	      <xsl:apply-templates mode="pass1"/>
+	    </head>
+	  </xsl:if>
+	  <xsl:for-each-group select="current-group() except ."
+			      group-starting-with="tei:HEAD[number(@level)=$NextHeader]">
+	    <xsl:choose>
+	      <xsl:when test="self::tei:HEAD">
+		<xsl:call-template name="group-by-section"/>
+	      </xsl:when>
+	    <xsl:otherwise>
+		<xsl:call-template name="inSection"/>
+	    </xsl:otherwise>
+	    </xsl:choose>
+	  </xsl:for-each-group>
+	</div>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+
+  <xsl:template name="inSection">
+    <xsl:for-each-group select="current-group()"
+			group-adjacent="if (self::tei:GLOSS)
+					then 1
+					else 2">      
+      <xsl:choose>
+	<xsl:when test="current-grouping-key()=1">
+	  <list type="gloss">
+	    <xsl:for-each select="current-group()">
+	      <xsl:element name="{@n}">
+		<xsl:apply-templates mode="pass2"/>
+	      </xsl:element>
+	    </xsl:for-each>
+	  </list>
+	</xsl:when>
+	<xsl:otherwise>
+	  <xsl:for-each select="current-group()">
+	    <xsl:apply-templates select="." mode="pass2"/>
+	  </xsl:for-each>
+	</xsl:otherwise>
+      </xsl:choose>
+    </xsl:for-each-group>
+  </xsl:template>
+		
+<xsl:template match="@*|text()|comment()|processing-instruction()" mode="pass1">
+    <xsl:copy-of select="."/>
+  </xsl:template>
+
+  <xsl:template match="tei:p[not(node())]" mode="pass1"/>
+
+  <xsl:template match="tei:HEAD" mode="pass1">
+    <xsl:if test="preceding-sibling::tei:HEAD">
+      <xsl:variable name="prev"
+		    select="xs:integer(number(preceding-sibling::tei:HEAD[1]/@level))"/>
+      <xsl:variable name="current"
+		    select="xs:integer(number(@level))"/>
+	<xsl:if test="($current - $prev) &gt;1 ">
+	  <!--<xsl:message>Walk from <xsl:value-of select="$prev"/> to <xsl:value-of select="$current"/></xsl:message>-->
+	  <xsl:for-each
+	      select="$prev + 1   to $current - 1 ">
+	    <HEAD interpolated='true' level="{.}"/>
+	  </xsl:for-each>
+	</xsl:if>
+    </xsl:if>
+    <xsl:copy>
+    <xsl:apply-templates
+	select="*|@*|processing-instruction()|comment()|text()"
+	mode="pass1"/>
+    </xsl:copy>
+  </xsl:template>
+
+  <xsl:template match="*" mode="pass1">
+    <xsl:copy>
+      <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()" mode="pass1"/>
+    </xsl:copy>
+  </xsl:template>
+
+
+  <!-- second pass -->
+
+
+  <xsl:template match="tei:p[not(*) and normalize-space(.)='']" mode="pass2"/>
+
+    <xsl:template match="@*|comment()|processing-instruction()" mode="pass2">
+        <xsl:copy-of select="."/>
+    </xsl:template>
+    
+    <xsl:template match="*" mode="pass2">
+        <xsl:copy>
+            <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()" mode="pass2"/>
+        </xsl:copy>
+    </xsl:template>
+    
+    
+    <xsl:template match="text()" mode="pass2">
+        <xsl:value-of select="."/>
+    </xsl:template>
+
+
+    <xsl:template match="tei:title" mode="pass2">
+      <xsl:choose>
+	<xsl:when test="parent::tei:div|parent::tei:body">
+	  <head>
+            <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()" mode="pass2"/>
+	  </head>
+	</xsl:when>
+	<xsl:otherwise>
+	  <xsl:copy>
+	    <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()" mode="pass2"/>
+	  </xsl:copy>
+	</xsl:otherwise>
+      </xsl:choose>
+    </xsl:template>
+
+  <!-- third pass -->
+
+
+
+    <xsl:template match="@*|comment()|processing-instruction()" mode="pass3">
+        <xsl:copy-of select="."/>
+    </xsl:template>
+    
+    <xsl:template match="*" mode="pass3">
+        <xsl:copy>
+            <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()" mode="pass3"/>
+        </xsl:copy>
+    </xsl:template>
+    
+    
+    <xsl:template match="text()" mode="pass3">
+        <xsl:value-of select="."/>
+    </xsl:template>
+
+    <xsl:template match="tei:div[not(@type)]" mode="pass3">
+      <div type="div{count(ancestor-or-self::tei:div)}">
+	<xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()" mode="pass3"/>
+      </div>
+    </xsl:template>
+
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/odt/odttotei.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/odt/teitoodt.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/odt/teitoodt.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/odt/teitoodt.xsl	(revision 258)
@@ -0,0 +1,1929 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet
+    version="2.0"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:teidocx="http://www.tei-c.org/ns/teidocx/1.0"
+    xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
+    xmlns:dc="http://purl.org/dc/elements/1.1/"
+    xmlns:dom="http://www.w3.org/2001/xml-events"
+    xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
+    xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
+    xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
+    xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
+    xmlns:math="http://www.w3.org/1998/Math/MathML"
+    xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
+    xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
+    xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
+    xmlns:m="http://www.w3.org/1998/Math/MathML"
+    xmlns:atom="http://www.w3.org/2005/Atom"  
+    xmlns:estr="http://exslt.org/strings"
+    xmlns:xlink="http://www.w3.org/1999/xlink"
+    xmlns:xhtml="http://www.w3.org/1999/xhtml"
+    xmlns:dbk="http://docbook.org/ns/docbook"
+    xmlns:rng="http://relaxng.org/ns/structure/1.0"
+    xmlns:ooo="http://openoffice.org/2004/office"
+    xmlns:oooc="http://openoffice.org/2004/calc"
+    xmlns:ooow="http://openoffice.org/2004/writer"
+    xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
+    xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
+    xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
+    xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
+    xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
+    xmlns:xforms="http://www.w3.org/2002/xforms"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:tei="http://www.tei-c.org/ns/1.0"
+    xmlns:teix="http://www.tei-c.org/ns/Examples"
+    office:version="1.0"
+    >
+
+  <xsl:import href="../common2/core.xsl"/>
+  <xsl:param name="useFixedDate">false</xsl:param>
+
+    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet for making OpenOffice files from TEI XML.
+	 Originally derived from the OpenOffice /Docbook
+	 conversion, but largely rewritten </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: teitoodt.xsl 10180 2012-03-25 14:48:46Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc>
+   </doc>
+  
+  <xsl:strip-space elements="teix:* rng:* xsl:* xhtml:* atom:* m:*"/>
+    <xsl:key name="W" match="image" use="@url"/>
+    <xsl:key name="H" match="image" use="@url"/>
+
+
+  <xsl:output method="xml" omit-xml-declaration="no"/>
+
+  <xsl:decimal-format name="staff" digit="D"/>
+  <xsl:variable name="doc_type">TEI</xsl:variable>
+  <xsl:param name="useHeaderFrontMatter">false</xsl:param>
+  <xsl:param name="postQuote">’</xsl:param>
+  <xsl:param name="preQuote">‘</xsl:param>
+  <xsl:param name="outputDir">.</xsl:param>
+  <xsl:param name="freestanding">false</xsl:param>
+  <xsl:key name='IDS' match="tei:*[@xml:id]" use="@xml:id"/>
+  <xsl:key name='GRAPHICS' match="tei:graphic" use="1"/>
+  <xsl:key name="Page" match="style:page-layout-properties" use="1"/>
+
+  <xsl:template match="/">
+    <xsl:choose>
+      <xsl:when test="$freestanding='true'">
+	<xsl:result-document href="{concat($outputDir,'/meta.xml')}">
+	  <xsl:call-template name="META"/>
+	</xsl:result-document>
+	<office:document-content>
+	  <xsl:if test="$freestanding='true'">
+	  <xsl:for-each select="document(concat($outputDir,'/content.xml'))/office:document-content">
+	    <xsl:copy-of select="office:scripts"/>
+	    <xsl:copy-of select="office:font-face-decls"/>
+	    <xsl:copy-of select="office:automatic-styles"/>
+	  </xsl:for-each>
+	  </xsl:if>
+	  <office:body>
+	    <office:text>
+	      <xsl:apply-templates/>
+	    </office:text>
+	  </office:body>
+	</office:document-content>
+      </xsl:when>
+      <xsl:otherwise>
+	<office:document>
+	  <xsl:call-template name="META"/>
+	  <office:body>
+	    <office:text>
+	      <xsl:apply-templates/>
+	    </office:text>
+	  </office:body>
+	</office:document>
+      </xsl:otherwise>
+    </xsl:choose>
+    <xsl:result-document href="{concat($outputDir,'/META-INF/manifest.xml')}">
+      <manifest:manifest xmlns:manifest="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0">
+	<manifest:file-entry manifest:media-type="application/vnd.oasis.opendocument.text" manifest:version="1.2" manifest:full-path="/"/>
+	<manifest:file-entry manifest:media-type="" manifest:full-path="Configurations2/statusbar/"/>
+	<manifest:file-entry manifest:media-type="" manifest:full-path="Configurations2/accelerator/current.xml"/>
+	<manifest:file-entry manifest:media-type="" manifest:full-path="Configurations2/accelerator/"/>
+	<manifest:file-entry manifest:media-type="" manifest:full-path="Configurations2/floater/"/>
+	<manifest:file-entry manifest:media-type="" manifest:full-path="Configurations2/popupmenu/"/>
+	<manifest:file-entry manifest:media-type="" manifest:full-path="Configurations2/progressbar/"/>
+	<manifest:file-entry manifest:media-type="" manifest:full-path="Configurations2/menubar/"/>
+	<manifest:file-entry manifest:media-type="" manifest:full-path="Configurations2/toolbar/"/>
+	<manifest:file-entry manifest:media-type="" manifest:full-path="Configurations2/images/Bitmaps/"/>
+	<manifest:file-entry manifest:media-type="" manifest:full-path="Configurations2/images/"/>
+	<manifest:file-entry manifest:media-type="application/vnd.sun.xml.ui.configuration" manifest:full-path="Configurations2/"/>
+	<manifest:file-entry manifest:media-type="text/xml" manifest:full-path="content.xml"/>
+	<manifest:file-entry manifest:media-type="application/rdf+xml" manifest:full-path="manifest.rdf"/>
+	<manifest:file-entry manifest:media-type="text/xml" manifest:full-path="styles.xml"/>
+	<manifest:file-entry manifest:media-type="text/xml" manifest:full-path="meta.xml"/>
+	<manifest:file-entry manifest:media-type="" manifest:full-path="Thumbnails/thumbnail.png"/>
+	<manifest:file-entry manifest:media-type="" manifest:full-path="Thumbnails/"/>
+	<manifest:file-entry manifest:media-type="text/xml"
+			     manifest:full-path="settings.xml"/>
+	<xsl:if test="count(key('GRAPHICS',1))&gt;0">
+	<manifest:file-entry manifest:media-type="" manifest:full-path="Pictures/"/>
+	<xsl:for-each select="key('GRAPHICS',1)">
+	  <xsl:variable name="imagetype"
+			select="tokenize(@url,'\.')[last()]"/>
+	  <manifest:file-entry>
+	    <xsl:attribute name="manifest:full-path">
+	      <xsl:text>Pictures/resource</xsl:text>
+	      <xsl:number level="any"/>
+	      <xsl:text>.</xsl:text>
+	      <xsl:value-of select="$imagetype"/>
+	    </xsl:attribute>
+	    <xsl:attribute name="manifest:media-type">
+	      <xsl:text>image/</xsl:text>
+	      <xsl:choose>
+		<xsl:when test="$imagetype='png'">png</xsl:when>
+		<xsl:when test="$imagetype='gif'">gif</xsl:when>
+		<xsl:when test="$imagetype='jpg'">jpeg</xsl:when>
+		<xsl:when test="$imagetype='jpeg'">jpg</xsl:when>
+		<xsl:when test="$imagetype='tiff'">tiff</xsl:when>
+		<xsl:when test="$imagetype='tif'">tiff</xsl:when>
+		<xsl:otherwise>jpeg</xsl:otherwise>
+	      </xsl:choose>
+	    </xsl:attribute>
+	  </manifest:file-entry>
+	</xsl:for-each>
+	</xsl:if>
+      </manifest:manifest>
+    </xsl:result-document>
+
+  </xsl:template>
+
+  <xsl:template name="META">
+    <xsl:for-each select="*">
+    <office:meta>
+      <meta:generator>TEI to OpenOffice XSLT</meta:generator>
+      <dc:title>
+	<xsl:call-template name="generateTitle"/>
+      </dc:title>
+      <dc:description/>
+      <dc:subject/>
+      <meta:creation-date>
+	<xsl:call-template name="generateDate"/>
+      </meta:creation-date>
+      <dc:date>
+	<xsl:call-template name="generateRevDate"/>
+      </dc:date>
+      <dc:language>
+	<xsl:choose>
+	  <xsl:when test="/tei:TEI/@xml:lang">
+	    <xsl:value-of select="/tei:TEI/@xml:lang"/>
+	  </xsl:when>
+	  <xsl:otherwise>en</xsl:otherwise>
+	</xsl:choose>
+      </dc:language>
+      <meta:editing-cycles>1</meta:editing-cycles>
+      <meta:editing-duration>PT00H00M00S</meta:editing-duration>
+      <meta:user-defined meta:name="Info 1"/>
+      <meta:user-defined meta:name="Info 2"/>
+      <meta:user-defined meta:name="Info 3"/>
+      <meta:user-defined meta:name="Info 4"/>
+      <meta:document-statistic meta:table-count="1" meta:image-count="0" meta:object-count="0" meta:page-count="1" meta:paragraph-count="42" meta:word-count="144" meta:character-count="820"/>
+    </office:meta>
+    </xsl:for-each>
+  </xsl:template>
+
+  <!-- base structure -->
+  <xsl:template match="tei:TEI">
+    <xsl:apply-templates select="tei:text"/>
+  </xsl:template>
+
+  <xsl:template match="tei:body|tei:front|tei:back">
+	<xsl:apply-templates/>
+  </xsl:template>
+
+
+  <xsl:template match="tei:head">
+    <xsl:choose>
+      <xsl:when test="parent::tei:figure"/>
+      <xsl:when test="parent::tei:list"/>
+      <xsl:when test="parent::tei:div"/>
+      <xsl:when test="parent::tei:div1"/>
+      <xsl:when test="parent::tei:div2"/>
+      <xsl:when test="parent::tei:div3"/>
+      <xsl:when test="parent::tei:div4"/>
+      <xsl:when test="parent::tei:div5"/>
+      <xsl:when test="parent::tei:div6"/>
+      <xsl:when test="parent::tei:table"/>
+
+      <xsl:otherwise>
+	<xsl:choose>
+	  <xsl:when test="parent::tei:appendix">
+	    <text:p text:style-name="Appendix">
+	      <xsl:apply-templates/>	   
+	    </text:p>	
+	  </xsl:when>
+	  <xsl:when test="parent::tei:body">
+	    <text:h text:outline-level="1">
+	      <xsl:apply-templates/>
+	    </text:h>
+	  </xsl:when>
+	  <xsl:otherwise>
+	    <text:p>
+	      <xsl:apply-templates/>	   
+	    </text:p>
+	  </xsl:otherwise>
+	</xsl:choose>
+
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+
+
+  <xsl:template match="tei:div">
+    <xsl:variable name="depth">
+      <xsl:value-of select="count(ancestor::tei:div)"/>
+    </xsl:variable>
+    <text:h>
+      <xsl:attribute name="text:outline-level">
+	<xsl:value-of select="$depth + 1"/>
+      </xsl:attribute>
+      <xsl:call-template name="test.id"/>
+      <xsl:apply-templates select="tei:head" mode="show"/>
+    </text:h>
+    <xsl:apply-templates/>
+  </xsl:template>
+
+  <xsl:template match="tei:div1|tei:div2|tei:div3|tei:div4|tei:div5|tei:div6">
+    <xsl:variable name="depth">
+      <xsl:value-of select="substring-after(name(.),'div')"/>
+    </xsl:variable>
+    <text:h>
+      <xsl:attribute name="text:outline-level">
+	<xsl:value-of select="$depth + 1"/>
+      </xsl:attribute>
+      <xsl:call-template name="test.id"/>
+      <xsl:apply-templates select="tei:head" mode="show"/>
+    </text:h>
+    <xsl:apply-templates/>
+  </xsl:template>
+
+
+
+<!-- paragraphs -->
+  <xsl:template match="tei:pb">
+    <text:soft-page-break/>
+  </xsl:template>
+
+  <xsl:template match="tei:p">
+    <xsl:variable name="style">
+      <xsl:choose>
+	<xsl:when test="ancestor::tei:note[@place='foot']">
+	    <xsl:text>Footnote</xsl:text>
+	</xsl:when>
+	<xsl:otherwise>
+	  <xsl:text>Text_20_body</xsl:text>
+	</xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:choose>
+<!--      
+     <xsl:when test="tei:pb">
+	<xsl:for-each-group select="node()" group-adjacent="boolean(self::tei:pb)">
+	  <xsl:choose>
+	    <xsl:when test="current-grouping-key()">
+		<text:p text:style-name="P1"/>
+	    </xsl:when>
+	    <xsl:otherwise>
+	    <text:p text:style-name="{$style}">
+	      <xsl:call-template name="test.id"/>
+	      <xsl:apply-templates select="current-group()"/>
+	    </text:p>
+	  </xsl:otherwise>  
+        </xsl:choose>
+	</xsl:for-each-group>
+      </xsl:when>
+-->
+      <xsl:when test="tei:list">
+	<xsl:for-each-group select="node()" group-adjacent="boolean(self::tei:list)">
+	  <xsl:choose>
+	    <xsl:when test="current-grouping-key()">
+	      <xsl:apply-templates select="current-group()"/>
+	    </xsl:when>
+	    <xsl:otherwise>
+	    <text:p text:style-name="{$style}">
+	      <xsl:call-template name="test.id"/>
+	      <xsl:apply-templates select="current-group()"/>
+	    </text:p>
+	  </xsl:otherwise>  
+        </xsl:choose>
+	</xsl:for-each-group>
+      </xsl:when>
+      <xsl:otherwise>
+	<text:p text:style-name="{$style}">
+	  <xsl:call-template name="test.id"/>
+	  <xsl:apply-templates/>
+	</text:p>
+      </xsl:otherwise>  
+    </xsl:choose>
+  </xsl:template>
+
+
+
+<!-- figures -->
+  <xsl:template match="tei:figure">
+    <xsl:call-template name="startHook"/>
+    <text:p text:style-name="Standard">
+      <xsl:call-template name="test.id"/>
+      <xsl:apply-templates select="tei:graphic"/>
+    </text:p>
+    <xsl:if test="tei:head">
+      <text:p text:style-name="Caption">
+	<text:span text:style-name="Figurenum">
+	  <xsl:text>Figure </xsl:text>
+	  <text:sequence 
+	      text:ref-name="refFigure0" 
+	      text:name="Figure"
+	      text:formula="Figure+1"
+	      style:num-format="1">
+	  <xsl:number level="any"/>
+	  <xsl:text>.</xsl:text>
+	  </text:sequence>
+	</text:span>
+	<xsl:text> </xsl:text>
+	<xsl:apply-templates select="tei:head" mode="show"/>
+      </text:p>
+    </xsl:if>
+    <xsl:call-template name="endHook"/>
+
+  </xsl:template>
+
+  <xsl:template match="tei:graphic">
+    <xsl:variable name="id">
+      <xsl:choose>
+	<xsl:when test="@xml:id">
+	  <xsl:value-of select="@xml:id"/>
+	</xsl:when>
+	<xsl:otherwise>
+	  <xsl:text>Figure</xsl:text><xsl:number level="any"/>
+	</xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+
+	<xsl:variable name="filename">
+	  <xsl:text>Pictures/resource</xsl:text>
+	  <xsl:number level="any"/>
+	  <xsl:text>.</xsl:text>
+	  <xsl:value-of select="tokenize(@url,'\.')[last()]"/>
+	</xsl:variable>
+	<xsl:variable name="origheight">
+	  <xsl:choose>
+	    <xsl:when test="@teidocx:height">
+	      <xsl:value-of select="@teidocx:height"/>
+	    </xsl:when>
+	    <xsl:when test="doc-available(concat($outputDir,'/image-size-info.xml'))">
+		<xsl:for-each select="document(concat($outputDir,'/image-size-info.xml'))">
+		  <xsl:value-of select="(number(key('H',$filename)/height) div 72) * 9144"/>
+		</xsl:for-each>
+	    </xsl:when>
+	    <xsl:otherwise>0</xsl:otherwise>
+	  </xsl:choose>
+	</xsl:variable>
+
+	<xsl:variable name="origwidth">
+	  <xsl:choose>
+	    <xsl:when test="@teidocx:width">
+	      <xsl:value-of select="@teidocx:width"/>
+	    </xsl:when>
+	    <xsl:when test="doc-available(concat($outputDir,'/image-size-info.xml'))">
+		<xsl:for-each select="document(concat($outputDir,'/image-size-info.xml'))">
+		  <xsl:value-of select="(number(key('W',$filename)/width) div 72) * 9144"/>
+		</xsl:for-each>
+	    </xsl:when>
+	    <xsl:otherwise>0</xsl:otherwise>
+	  </xsl:choose>
+	</xsl:variable>
+
+    <xsl:choose>
+      <xsl:when test="$filename and  ( ($origwidth and $origheight) or (@width and @height))">
+	
+	<!-- work out page width / height and subtract 1inch on all sides -->
+	<xsl:variable name="pageWidth">
+	  <xsl:for-each
+	      select="document(concat($outputDir,'/styles.xml'))/office:document-styles/office:automatic-styles/style:page-layout/style:page-layout-properties">
+	    <xsl:value-of
+		select="number(tei:convert-dim-pt(@fo:page-width) - 144)"/>
+	  </xsl:for-each>
+	</xsl:variable>
+	<xsl:variable name="pageHeight">
+	  <xsl:for-each
+	      select="document(concat($outputDir,'/styles.xml'))/office:document-styles/office:automatic-styles/style:page-layout/style:page-layout-properties">
+	    <xsl:value-of 
+		select="number(tei:convert-dim-pt(@fo:page-height) - 144)"/>
+	  </xsl:for-each>
+	</xsl:variable>
+	
+	<xsl:variable name="Width">
+	  <xsl:choose>
+	    <xsl:when test="contains(@width,'%')">
+	      <xsl:value-of select="(($pageWidth div 100) * number(substring-before(@width,'%'))) cast as xs:integer"/>
+	    </xsl:when>
+	    <xsl:when test="@width">
+	      <xsl:value-of select="tei:convert-dim-pt(@width)"/>
+	    </xsl:when>
+	    <xsl:when test="@scale and $origwidth">
+	      <xsl:value-of select="number($origwidth * number(@scale)) div 127 cast as xs:integer"/>
+	    </xsl:when>
+	    <xsl:when test="@height[not(contains(.,'%'))] and $origheight">
+	      <xsl:variable name="h">
+		<xsl:value-of select="number(tei:convert-dim-pt(@height))"/>
+	      </xsl:variable>
+	      <xsl:value-of select="($h * number($origwidth)) div number($origheight)"/>
+	    </xsl:when>
+	    <xsl:when test="$origwidth">
+	      <xsl:value-of select="number($origwidth) div 127"/>
+	    </xsl:when>
+	    <xsl:otherwise>
+	      <xsl:message terminate="yes">no way to work out image width for
+	      <xsl:value-of select="$filename"/>
+	      </xsl:message>
+	    </xsl:otherwise>
+	  </xsl:choose>
+	</xsl:variable>
+	
+	<xsl:variable name="Height">
+	  <xsl:choose>
+	    <xsl:when test="contains(@height,'%')">
+	      <xsl:value-of select="(($pageHeight div 100) * (number(substring-before(@height,'%')))) cast as xs:integer"/>
+	    </xsl:when>
+	    <xsl:when test="@height">
+	      <xsl:value-of select="tei:convert-dim-pt(@height)"/>
+	    </xsl:when>
+	    <xsl:when test="@scale and $origheight">
+	      <xsl:value-of select="($origheight *
+				    number(@scale)) div 127 cast as xs:integer"/>
+	    </xsl:when>
+	    <xsl:when test="@width[not(contains(.,'%'))] and $origheight and $origwidth">
+	      <xsl:variable name="w">
+		<xsl:value-of select="number(tei:convert-dim-pt(@width))"/>
+	      </xsl:variable>
+	      <xsl:value-of select="($w * number($origheight)) div number($origwidth)"/>
+	    </xsl:when>
+	    <xsl:when test="$origheight">
+	      <xsl:value-of select="number($origheight) div 127"/>
+	    </xsl:when>
+	    <xsl:otherwise>
+	      <xsl:message terminate="yes">no way to work out image height for
+	      <xsl:value-of select="$filename"/>
+	      </xsl:message>
+	    </xsl:otherwise>
+	  </xsl:choose>
+	</xsl:variable>
+	
+	<!-- check for sense -->
+	<xsl:variable name="imageHeight">
+	  <xsl:choose>
+	    <xsl:when test="$Height &lt; 0">
+	      <xsl:value-of select="$pageHeight"/>
+	    </xsl:when>
+	    <xsl:when test="number($Height) &gt; $pageHeight">
+	      <xsl:value-of select="$pageHeight"/>
+	    </xsl:when>
+	    <xsl:otherwise>
+	      <xsl:value-of select="$Height"/>
+	    </xsl:otherwise>
+	  </xsl:choose>
+	</xsl:variable>
+	<xsl:variable name="imageWidth">
+	  <xsl:choose>
+	    <xsl:when test="$Width &lt; 0">
+	      <xsl:value-of select="$pageWidth"/>
+	    </xsl:when>
+	    <xsl:when test="number($Width) &gt; $pageWidth">
+	      <xsl:value-of select="$pageWidth"/>
+	    </xsl:when>
+	    <xsl:otherwise>
+	      <xsl:value-of select="$Width"/>
+	    </xsl:otherwise>
+	  </xsl:choose>
+	</xsl:variable>
+<!--
+<xsl:message>
+  <xsl:for-each select="@*">
+    - @<xsl:value-of select="name(.)"/>: <xsl:value-of select="."/>
+</xsl:for-each>
+    - pageWidth: <xsl:value-of select="$pageWidth"/>
+    - pageHeight: <xsl:value-of select="$pageHeight"/>
+    - Width: <xsl:value-of select="$Width"/>
+    - Height: <xsl:value-of select="$Height"/>
+    - imageWidth: <xsl:value-of select="$imageWidth"/>
+    - imageHeight: <xsl:value-of select="$imageHeight"/>
+</xsl:message>
+-->
+	<draw:frame draw:style-name="fr1" 
+		    draw:name="{$id}"
+		    draw:z-index="0">
+	  <xsl:attribute name="text:anchor-type">
+	    <xsl:choose>
+	      <xsl:when test="parent::tei:figure">
+		<xsl:text>paragraph</xsl:text>
+	      </xsl:when>
+	      <xsl:otherwise>
+		<xsl:text>as-char</xsl:text>
+	      </xsl:otherwise>
+	    </xsl:choose>
+	  </xsl:attribute>
+	  
+	  <xsl:attribute name="svg:width">
+	    <xsl:value-of select="$imageWidth"/>
+	    <xsl:text>pt</xsl:text>
+	  </xsl:attribute>
+	  <xsl:attribute name="svg:height">
+	    <xsl:value-of select="$imageHeight"/>
+	    <xsl:text>pt</xsl:text>
+	  </xsl:attribute>
+	  <draw:image
+	      xlink:href="{$filename}" 
+	      xlink:type="simple" 
+	      xlink:show="embed"
+	      xlink:actuate="onLoad" 
+	      draw:filter-name="&lt;All formats&gt;"/>
+	</draw:frame>
+      </xsl:when>	
+      <xsl:otherwise>
+	<xsl:message terminate="yes">ERROR. no image size info for  <xsl:value-of select="$filename"/>, cannot proceed</xsl:message>
+	
+      </xsl:otherwise>
+    </xsl:choose>
+    
+  </xsl:template>
+
+
+<!-- lists -->
+  <xsl:template match="tei:list|tei:listBibl">
+    <xsl:if test="tei:head">
+      <text:p>
+	<xsl:attribute name="text:style-name">
+	  <xsl:choose>
+	    <xsl:when  test="@type='ordered'">P2</xsl:when>
+	    <xsl:otherwise>P1</xsl:otherwise>
+	  </xsl:choose>
+      </xsl:attribute>
+      <xsl:apply-templates select="tei:head" mode="show"/>
+      </text:p>
+    </xsl:if>
+    <text:list>
+      <xsl:attribute name="text:style-name">
+	<xsl:choose>
+	    <xsl:when test="self::tei:listBibl">L2</xsl:when>
+            <xsl:when test="not(@type)">L1</xsl:when>
+            <xsl:when test="@type='ordered'">L2</xsl:when>
+            <xsl:when test="@type='unordered'">L1</xsl:when>
+	</xsl:choose>
+      </xsl:attribute>
+      <xsl:apply-templates/>
+    </text:list>
+  </xsl:template>
+
+
+
+  <xsl:template match="tei:list[@type='gloss' or @rend='valList']" priority="10">
+    <xsl:apply-templates/>
+  </xsl:template>
+
+  <xsl:template match="tei:list[@type='gloss' or @rend='valList']/tei:item">
+    <text:p text:style-name="List_20_Contents">
+      <xsl:apply-templates/>
+    </text:p>
+  </xsl:template>
+
+  <xsl:template match="tei:list[@type='gloss' or @rend='valList']/tei:label">
+    <text:p text:style-name="List_20_Heading">
+      <xsl:apply-templates/>
+    </text:p>
+  </xsl:template>
+
+  <xsl:template match="tei:item/tei:p">
+    <xsl:apply-templates/>
+  </xsl:template>
+
+  <xsl:template match="tei:item">
+    <text:list-item>
+      <xsl:choose>
+	<xsl:when test="tei:list">
+	  <xsl:apply-templates/>
+	</xsl:when>
+	<xsl:otherwise>
+	  <text:p>
+	    <xsl:attribute name="text:style-name">
+	      <xsl:choose>
+		<xsl:when  test="parent::tei:list/@type='ordered'">P2</xsl:when>
+		<xsl:otherwise>P1</xsl:otherwise>
+	      </xsl:choose>
+	    </xsl:attribute>
+	    <xsl:apply-templates/>
+	  </text:p>
+	</xsl:otherwise>
+      </xsl:choose>
+    </text:list-item>
+  </xsl:template>
+
+<!-- inline stuff -->
+  <xsl:template match="tei:emph">
+    <text:span text:style-name="Emphasis">
+      <xsl:apply-templates/>
+    </text:span>
+  </xsl:template>
+
+  <xsl:template  match="tei:gi">
+    <xsl:text>&lt;</xsl:text>
+    <xsl:apply-templates/>
+    <xsl:text>&gt;</xsl:text>
+  </xsl:template>
+
+  <xsl:template  match="tei:caesura">
+    <xsl:text>&#160;&#160;&#160;</xsl:text>
+  </xsl:template>
+
+  <xsl:template match="tei:q">
+    <text:span text:style-name="q">
+      <xsl:text>&#x2018;</xsl:text>
+      <xsl:apply-templates/>
+      <xsl:text>&#x2019;</xsl:text>
+    </text:span>
+  </xsl:template>
+
+
+  <xsl:template match="tei:note">
+    <text:note text:note-class="footnote">
+    <text:note-citation>
+      <xsl:number level="any" count="tei:note[@place='foot']"/>
+    </text:note-citation>
+      <text:note-body>
+	<text:p text:style-name="Footnote">
+	  <xsl:apply-templates/>
+	</text:p>
+      </text:note-body>
+    </text:note>  
+  </xsl:template>
+
+  <xsl:template match="tei:note[@place='end']">
+    <text:note text:note-class="endnote">
+    <text:note-citation>
+      <xsl:number format="i" level="any" count="tei:note[@place='end']"/>
+    </text:note-citation>
+      <text:note-body>
+	<text:p text:style-name="Endnote">
+	  <xsl:apply-templates/>
+	</text:p>
+      </text:note-body>
+    </text:note>
+  </xsl:template>
+
+
+  <xsl:template match="tei:ref">
+    <text:a xlink:type="simple" xlink:href="{@target}">
+      <xsl:apply-templates/>
+    </text:a>
+  </xsl:template>
+
+  <xsl:template match="tei:ptr">
+    <text:a xlink:type="simple" xlink:href="{@target}">
+      <xsl:choose>
+	<xsl:when test="starts-with(@target,'#')">
+	  <xsl:for-each select="id(substring(@target,2))">
+	    <xsl:apply-templates select="." mode="crossref"/>
+	  </xsl:for-each>
+	</xsl:when>
+	<xsl:otherwise>
+	  <xsl:value-of select="@target"/>
+	</xsl:otherwise>
+      </xsl:choose>
+    </text:a>
+  </xsl:template>
+
+  <xsl:template match="tei:table|tei:figure|tei:item" mode="crossref">
+    <xsl:number level="any"/>
+  </xsl:template>
+
+  <xsl:template match="tei:div" mode="crossref">
+    <xsl:number format="1.1.1.1.1"
+		level="multiple" 
+		count="tei:div"/>
+  </xsl:template>
+
+  <xsl:template
+      match="tei:div1|tei:div2|tei:div3|tei:div4|tei:div5|tei:div6" 
+      mode="crossref">
+    <xsl:number format="1.1.1.1.1"
+        count="tei:div1|tei:div2|tei:div3|tei:div4|tei:div5|tei:div6"
+        level="multiple"/>
+  </xsl:template>
+
+  <xsl:template name="test.id">
+    <xsl:if test="@xml:id">
+      <text:bookmark text:name="{@xml:id}"/>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template match="tei:unclear">
+    <text:span text:style-name="Highlight">
+      <xsl:apply-templates/>
+    </text:span>
+  </xsl:template>
+
+  <xsl:template match="tei:hi">
+    <text:span>
+      <xsl:attribute name="text:style-name">
+	<xsl:choose>
+	  <xsl:when test="@rend='normalweight'">
+	    <xsl:text>Standard</xsl:text>
+	  </xsl:when>
+	  <xsl:when test="@rend='code' or @rend='typewriter'">
+	    <xsl:text>Source_20_Text</xsl:text>
+	  </xsl:when>
+	  <xsl:when test="@rend='sup' or @rend='superscript'">
+	    <xsl:text>Superscript</xsl:text>
+	  </xsl:when>
+	  <xsl:when test="@rend='sub' or @rend='subscript'">
+	    <xsl:text>Subscript</xsl:text>
+	  </xsl:when>
+	  <xsl:when test="@rend='bold'">
+	    <xsl:text>Highlight</xsl:text>
+	  </xsl:when>
+	  <xsl:when test="@rend='label'">
+	    <xsl:text>Highlight</xsl:text>
+	  </xsl:when>
+	  <xsl:when test="@rend='it' or @rend='i' or @rend='italic'">
+	    <xsl:text>Emphasis</xsl:text>
+	  </xsl:when>
+	  <xsl:when test="@rend='underline'">
+	    <xsl:text>Underline</xsl:text>
+	  </xsl:when>
+	  <xsl:when test="@rend='sc' or @rend='smallcaps'">
+	    <xsl:text>SmallCaps</xsl:text>
+	  </xsl:when>
+	  <xsl:when test="@rend='sc' or @rend='capsall'">
+	    <xsl:text>AllCaps</xsl:text>
+	  </xsl:when>
+	  <xsl:when test="@rend='strikethrough'">
+	    <xsl:text>StrikeThrough</xsl:text>
+	  </xsl:when>
+	  <xsl:when test="@rend='strikedoublethrough'">
+	    <xsl:text>StrikeDoubleThrough</xsl:text>
+	  </xsl:when>
+	  <xsl:when test="@rend='underline'">
+	    <xsl:text>UnderLine</xsl:text>
+	  </xsl:when>
+	  <xsl:when test="@rend='underdoubleline'">
+	    <xsl:text>UnderDoubleLine</xsl:text>
+	  </xsl:when>
+	  <xsl:otherwise>
+	    <xsl:text>Emphasis</xsl:text>
+	  </xsl:otherwise>
+	</xsl:choose>
+      </xsl:attribute>
+      <xsl:apply-templates/>
+    </text:span>
+  </xsl:template>
+
+  <xsl:template match="tei:term">
+    <text:span>
+      <xsl:attribute name="text:style-name">
+	<xsl:text>Highlight</xsl:text>
+      </xsl:attribute>
+      <xsl:apply-templates/>
+    </text:span>
+</xsl:template>
+
+  <xsl:template match="tei:index"/>
+
+  <xsl:template match="tei:eg">
+    <xsl:call-template name="startHook"/>
+    <xsl:call-template name="Literal">
+      <xsl:with-param name="Text">
+	<xsl:value-of select="."/>
+      </xsl:with-param>
+    </xsl:call-template>
+    <xsl:call-template name="endHook"/>
+  </xsl:template>
+
+  <xsl:template match="teix:egXML">
+    <xsl:call-template name="startHook"/>
+    <xsl:call-template name="Literal">
+      <xsl:with-param name="Text">
+	<xsl:apply-templates mode="verbatim"/>
+      </xsl:with-param>
+    </xsl:call-template>
+    <xsl:call-template name="endHook"/>
+  </xsl:template>
+
+  <!-- safest to drop comments entirely, I think -->
+  <xsl:template match="comment()"/>
+
+  <xsl:template match="tei:head" mode="show">
+    <xsl:apply-templates/>
+  </xsl:template>
+
+  <xsl:template match="tei:lb">
+    <text:line-break/>
+  </xsl:template>
+
+  <xsl:template match="tei:biblStruct">
+    <text:list-item>
+      <text:p text:style-name="P2">
+	<xsl:apply-templates/>
+      </text:p>
+    </text:list-item>
+  </xsl:template>
+
+  <xsl:template match="tei:bibl|tei:signed|tei:docTitle|tei:byline|tei:docImprint">
+    <text:p text:style-name="tei_{local-name(.)}">
+      <xsl:apply-templates/>
+    </text:p>
+  </xsl:template>
+
+  <xsl:template match="tei:lg">
+    <text:p text:style-name="lg">
+      <xsl:apply-templates/>
+    </text:p>
+  </xsl:template>
+
+  <xsl:template match="tei:l">
+    <xsl:choose>
+      <xsl:when test="parent::tei:q">
+	<xsl:apply-templates/>
+	<text:line-break/>
+      </xsl:when>
+      <xsl:when test="parent::tei:lg">
+	<xsl:apply-templates/>
+	<text:line-break/>
+      </xsl:when>
+      <xsl:otherwise>
+	<text:p text:style-name="lg">
+	  <xsl:apply-templates/>
+	</text:p>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="Literal">
+    <xsl:param name="Text"/>
+    <xsl:choose>
+      <xsl:when test="contains($Text,'&#10;')">
+	<text:p text:style-name="Preformatted_20_Text">
+	  <xsl:value-of
+	      select="translate(substring-before($Text,'&#10;'),' ','&#160;')"/>
+	</text:p>
+	<xsl:call-template name="Literal">
+	  <xsl:with-param name="Text">
+	    <xsl:value-of select="substring-after($Text,'&#10;')"/>
+	  </xsl:with-param>
+	</xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+	<text:p text:style-name="Preformatted_20_Text">
+	  <xsl:value-of select="translate($Text,' ','&#160;')"/>
+	</text:p>
+      </xsl:otherwise>
+    </xsl:choose>
+    <!-- text:s c="6" to ident 6 spaces -->
+  </xsl:template>
+
+
+  <xsl:template match="tei:sp">
+    <xsl:apply-templates/>
+  </xsl:template>
+
+  <xsl:template match="tei:stage">
+    <xsl:choose>
+      <xsl:when test="parent::tei:sp">
+	<text:p text:style-name="Stage">
+	  <xsl:apply-templates/>
+	</text:p>
+      </xsl:when>
+      <xsl:otherwise>
+	<text:span text:style-name="Stage">
+	  <xsl:apply-templates/>
+	</text:span>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="tei:speaker">
+      <text:p text:style-name="Speaker">
+	<xsl:apply-templates/>
+      </text:p>
+  </xsl:template>
+
+  <!-- tables-->
+
+  <xsl:template match="tei:table">
+    <xsl:call-template name="startHook"/>
+    <xsl:variable name="tablenum">
+      <xsl:choose>
+	<xsl:when test="@xml:id"><xsl:value-of select="@xml:id"/></xsl:when>
+	<xsl:otherwise>table<xsl:number level="any"/></xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <table:table
+	table:name="{$tablenum}"
+	table:style-name="Table1">
+      <xsl:for-each select="1 to max(for $i in tei:row return count($i/tei:cell))">
+	<table:table-column
+	    table:style-name="Table{.}.col{.}">
+	</table:table-column>
+      </xsl:for-each>
+      <xsl:apply-templates/>
+    </table:table>
+    <xsl:if test="tei:head">
+      <text:p text:style-name="Caption">
+	<xsl:apply-templates select="tei:head" mode="show"/>
+      </text:p>
+    </xsl:if>
+    <xsl:call-template name="endHook"/>
+  </xsl:template>
+
+
+  <xsl:template match="tei:row[@role='label']">
+    <table:table-header-rows>
+      <table:table-row>
+	<xsl:apply-templates/>
+      </table:table-row>
+    </table:table-header-rows>
+  </xsl:template>
+
+
+  <xsl:template match="tei:row">
+    <table:table-row>
+      <xsl:apply-templates/>
+    </table:table-row>
+  </xsl:template>
+
+
+
+  <xsl:template match="tei:seg">
+    <text:span>
+      <xsl:apply-templates/>
+    </text:span>
+  </xsl:template>
+
+  <xsl:template match="tei:seg[@rend='parent']">
+      <xsl:apply-templates/>
+  </xsl:template>
+
+  <xsl:template match="tei:ident">
+    <text:span>
+      <xsl:apply-templates/>
+    </text:span>
+  </xsl:template>
+
+  <xsl:template match="tei:cit[@rend='display' or not(@rend)]">
+    <text:p text:style-name="tei_cit">
+      <xsl:apply-templates/>
+    </text:p>
+  </xsl:template>
+
+  <xsl:template match="tei:mentioned">
+    <text:span>
+      <xsl:apply-templates/>
+    </text:span>
+  </xsl:template>
+
+  <xsl:template match="tei:code">
+    <text:span text:style-name="User_20_Entry">
+      <xsl:apply-templates/>
+    </text:span>
+  </xsl:template>
+
+  <xsl:template match="tei:cell">
+    <table:table-cell>
+      <xsl:if test="@cols">
+	<xsl:attribute name="table:number-columns-spanned"
+		       select="@cols"/>
+      </xsl:if>
+      <xsl:if test="@rows">
+	<xsl:attribute name="table:number-rows-spanned"
+		       select="@rows"/>
+      </xsl:if>
+      <xsl:variable name="cellContents">
+	<xsl:apply-templates/>
+      </xsl:variable>
+      <xsl:for-each-group select="$cellContents/node()"			  
+			  group-adjacent="if (self::draw:frame or self::text:span or self::text() or self::text:a)
+					  then 1
+					  else 2">      
+      <xsl:choose>
+	<xsl:when test="current-grouping-key()=1">
+	    <text:p>
+	      <xsl:copy-of select="current-group()"/>
+	    </text:p>
+	  </xsl:when>
+	  <xsl:otherwise>
+	    <xsl:copy-of select="current-group()"/>
+	  </xsl:otherwise>
+	</xsl:choose>
+      </xsl:for-each-group>
+    </table:table-cell>
+    <xsl:if test="@cols">
+      <xsl:for-each select="2 to @cols">
+	<table:covered-table-cell/>
+      </xsl:for-each>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:param name="startComment"></xsl:param>
+  <xsl:param name="endComment"></xsl:param>
+  <xsl:param name="startElement"></xsl:param>
+  <xsl:param name="endElement"></xsl:param>
+  <xsl:param name="startElementName"></xsl:param>
+  <xsl:param name="endElementName"></xsl:param>
+  <xsl:param name="startAttribute"></xsl:param>
+  <xsl:param name="endAttribute"></xsl:param>
+  <xsl:param name="startAttributeValue"></xsl:param>
+  <xsl:param name="endAttributeValue"></xsl:param>
+  <xsl:param name="startNamespace"></xsl:param>
+  <xsl:param name="endNamespace"></xsl:param>
+
+  <xsl:param name="spaceCharacter">&#160;</xsl:param>
+  <xsl:param name="showNamespaceDecls">true</xsl:param>
+
+  <xsl:param name="wrapLength">65</xsl:param>
+
+  <xsl:param name="attsOnSameLine">3</xsl:param>
+  <xsl:key name="Namespaces" match="*[ancestor::teix:egXML]" use="namespace-uri()"/>
+
+  <xsl:key name="Namespaces" match="*[not(ancestor::*)]" use="namespace-uri()"/>
+
+
+  <xsl:template name="newLine">&#10;</xsl:template>
+
+  <xsl:template name="lineBreak">
+    <xsl:param name="id"/>
+    <xsl:text>&#10;</xsl:text>
+  </xsl:template>
+
+  <xsl:template match="comment()" mode="verbatim">
+    <xsl:choose>
+      <xsl:when test="ancestor::Wrapper"/>
+      <xsl:when test="ancestor::xhtml:Wrapper"/>
+      <xsl:otherwise>
+    <xsl:call-template name="lineBreak">
+      <xsl:with-param name="id">21</xsl:with-param>
+    </xsl:call-template>
+    <xsl:value-of  disable-output-escaping="yes" select="$startComment"/>
+    <xsl:text>&lt;!--</xsl:text>
+    <xsl:value-of select="."/>
+    <xsl:text>--&gt;</xsl:text>
+    <xsl:value-of  disable-output-escaping="yes"
+		   select="$endComment"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="text()" mode="verbatim">
+    <xsl:choose>
+      <xsl:when test="not(preceding-sibling::node() or contains(.,'&#10;'))">
+	<xsl:call-template name="Text">
+	  <xsl:with-param name="words">
+	    <xsl:value-of select="."/>
+	  </xsl:with-param>
+	</xsl:call-template>
+<!--	
+        <xsl:if test="substring(.,string-length(.))=' '">
+	  <xsl:text> </xsl:text>
+	</xsl:if>
+-->
+      </xsl:when>
+      <xsl:when test="normalize-space(.)=''">
+        <xsl:for-each select="following-sibling::*[1]">
+          <xsl:call-template name="lineBreak">
+            <xsl:with-param name="id">7</xsl:with-param>
+          </xsl:call-template>
+          <xsl:call-template name="makeIndent"/>
+        </xsl:for-each>
+      </xsl:when>
+      <xsl:otherwise>
+<!--
+	<xsl:if test="starts-with(.,' ')">
+	  <xsl:text> </xsl:text>
+	</xsl:if>
+-->
+        <xsl:call-template name="wraptext">
+          <xsl:with-param name="count">0</xsl:with-param>
+          <xsl:with-param name="indent">
+            <xsl:for-each select="parent::*">
+              <xsl:call-template name="makeIndent"/>
+            </xsl:for-each>
+          </xsl:with-param>
+          <xsl:with-param name="text">
+	    <xsl:choose>
+	      <xsl:when test="starts-with(.,'&#10;') and not
+			      (preceding-sibling::node())">
+		<xsl:call-template name="Text">
+		  <xsl:with-param name="words">
+		    <xsl:value-of select="substring(.,2)"/>
+		  </xsl:with-param>
+		</xsl:call-template>
+		
+	      </xsl:when>
+	      <xsl:otherwise>
+		<xsl:call-template name="Text">
+		  <xsl:with-param name="words">
+		    <xsl:value-of select="."/>
+		  </xsl:with-param>
+		</xsl:call-template>
+	      </xsl:otherwise>
+	    </xsl:choose>
+          </xsl:with-param>
+        </xsl:call-template>
+	<!--
+	<xsl:if test="substring(.,string-length(.))=' '">
+	  <xsl:text> </xsl:text>
+	</xsl:if>
+	-->
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="wraptext">
+    <xsl:param name="indent"/>
+    <xsl:param name="text"/>
+    <xsl:param name="count">0</xsl:param>
+    <xsl:choose>
+      <xsl:when test="normalize-space($text)=''"/>
+      <xsl:when test="contains($text,'&#10;')">
+	<xsl:if test="$count &gt; 0">
+	  <xsl:value-of select="$indent"/>
+	  <xsl:text> </xsl:text>
+	</xsl:if>
+	<xsl:call-template name="Text">
+	  <xsl:with-param name="words">
+	    <xsl:value-of
+		select="substring-before($text,'&#10;')"/>
+	  </xsl:with-param>
+	</xsl:call-template>
+<!--	<xsl:if test="not(substring-after($text,'&#10;')='')">-->
+	  <xsl:call-template name="lineBreak">
+	    <xsl:with-param name="id">6</xsl:with-param>
+	  </xsl:call-template>
+	  <xsl:value-of select="$indent"/>
+	  <xsl:call-template name="wraptext">
+	    <xsl:with-param name="indent">
+	      <xsl:value-of select="$indent"/>
+	    </xsl:with-param>
+	    <xsl:with-param name="text">
+	      <xsl:value-of select="substring-after($text,'&#10;')"/>
+	    </xsl:with-param>
+	    <xsl:with-param name="count">
+	      <xsl:value-of select="$count + 1"/>
+	    </xsl:with-param>
+	  </xsl:call-template>
+
+      </xsl:when>
+      <xsl:otherwise>
+	<xsl:if test="$count &gt; 0 and parent::*">
+	  <xsl:value-of select="$indent"/>
+	  <xsl:text> </xsl:text>
+	</xsl:if>
+	<xsl:call-template name="Text">
+	  <xsl:with-param name="words">
+	    <xsl:value-of select="$text"/>
+	  </xsl:with-param>
+	</xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="Text">
+    <xsl:param name="words"/>
+    <xsl:choose>
+      <xsl:when test="contains($words,'&amp;')">
+	<xsl:value-of
+	    select="substring-before($words,'&amp;')"/>
+	<xsl:text>&amp;amp;</xsl:text>
+	<xsl:call-template name="Text">
+	  <xsl:with-param name="words">
+	    <xsl:value-of select="substring-after($words,'&amp;')"/>
+	  </xsl:with-param>
+	</xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+	<xsl:value-of select="$words"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="*" mode="verbatim">
+    <xsl:choose>
+      <xsl:when test="parent::xhtml:Wrapper"/>
+<!--      <xsl:when test="child::node()[last()]/self::text()[not(.='')] and child::node()[1]/self::text()[not(.='')]"/>-->
+      <xsl:when test="not(parent::*)  or parent::teix:egXML">
+	<xsl:choose>
+	  <xsl:when test="preceding-sibling::node()[1][self::text()]
+			  and following-sibling::node()[1][self::text()]"/>
+	  <xsl:when test="preceding-sibling::*">
+	    <xsl:call-template name="lineBreak">
+	      <xsl:with-param name="id">-1</xsl:with-param>
+	    </xsl:call-template>
+	  </xsl:when>
+	  <xsl:otherwise>
+	    <xsl:call-template name="newLine"/>
+        <!-- <xsl:call-template name="makeIndent"/>-->
+	  </xsl:otherwise>
+	</xsl:choose>
+      </xsl:when>
+      <xsl:when test="not(preceding-sibling::node())">
+	<xsl:call-template name="lineBreak">
+          <xsl:with-param name="id">-2</xsl:with-param>
+	</xsl:call-template>
+        <xsl:call-template name="makeIndent"/>
+      </xsl:when>
+      <xsl:when test="preceding-sibling::node()[1]/self::*">
+        <xsl:call-template name="lineBreak">
+          <xsl:with-param name="id">1</xsl:with-param>
+        </xsl:call-template>
+        <xsl:call-template name="makeIndent"/>
+      </xsl:when>
+      <xsl:when test="preceding-sibling::node()[1]/self::text()">
+	</xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="lineBreak">
+          <xsl:with-param name="id">9</xsl:with-param>
+        </xsl:call-template>
+        <xsl:call-template name="makeIndent"/>
+      </xsl:otherwise>
+    </xsl:choose>
+
+    <xsl:value-of disable-output-escaping="yes" select="$startElement"/>
+    <xsl:text>&lt;</xsl:text>
+    <xsl:call-template name="makeElementName">
+      <xsl:with-param name="start">true</xsl:with-param>
+    </xsl:call-template>
+    <xsl:apply-templates select="@*" mode="verbatim"/>
+    <xsl:if test="$showNamespaceDecls='true' or parent::teix:egXML[@rend='full']">
+      <xsl:choose>
+      <xsl:when test="not(parent::*)">
+	<xsl:apply-templates select="." mode="ns"/>
+      </xsl:when>
+      <xsl:when test="parent::teix:egXML and not(preceding-sibling::*)">
+	<xsl:apply-templates select="." mode="ns"/>
+      </xsl:when>
+      </xsl:choose>
+    </xsl:if>
+
+    <xsl:choose>
+      <xsl:when test="child::node()">
+        <xsl:text>&gt;</xsl:text>
+        <xsl:value-of disable-output-escaping="yes" select="$endElement"/>
+        <xsl:apply-templates mode="verbatim"/>
+        <xsl:choose>
+          <xsl:when test="child::node()[last()]/self::text() and child::node()[1]/self::text()"/>
+
+	  <xsl:when test="not(parent::*)  or parent::teix:egXML">
+            <xsl:call-template name="lineBreak">
+              <xsl:with-param name="id">23</xsl:with-param>
+            </xsl:call-template>
+	  </xsl:when>
+          <xsl:when test="child::node()[last()]/self::text()[normalize-space(.)='']">
+            <xsl:call-template name="lineBreak">
+              <xsl:with-param name="id">3</xsl:with-param>
+            </xsl:call-template>
+            <xsl:call-template name="makeIndent"/>
+          </xsl:when>
+          <xsl:when test="child::node()[last()]/self::comment()">
+            <xsl:call-template name="lineBreak">
+              <xsl:with-param name="id">4</xsl:with-param>
+            </xsl:call-template>
+            <xsl:call-template name="makeIndent"/>
+          </xsl:when>
+          <xsl:when test="child::node()[last()]/self::*">
+            <xsl:call-template name="lineBreak">
+              <xsl:with-param name="id">5</xsl:with-param>
+            </xsl:call-template>
+            <xsl:call-template name="makeIndent"/>
+          </xsl:when>
+        </xsl:choose>
+        <xsl:value-of disable-output-escaping="yes" select="$startElement"/>
+        <xsl:text>&lt;/</xsl:text>
+	<xsl:call-template name="makeElementName">
+	  <xsl:with-param name="start">false</xsl:with-param>
+	</xsl:call-template>
+        <xsl:text>&gt;</xsl:text>
+        <xsl:value-of disable-output-escaping="yes" select="$endElement"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:text>/&gt;</xsl:text>
+        <xsl:value-of disable-output-escaping="yes" select="$endElement"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+
+  <xsl:template name="makeElementName">
+    <xsl:param name="start"/>
+    <xsl:choose>
+
+      <xsl:when
+	  test="namespace-uri()='http://docbook.org/ns/docbook'">
+	<xsl:value-of disable-output-escaping="yes" select="$startNamespace"/>
+	<xsl:text>dbk:</xsl:text>
+	<xsl:value-of disable-output-escaping="yes" select="$endNamespace"/>
+	<xsl:value-of disable-output-escaping="yes" select="$startElementName"/>
+	<xsl:value-of select="local-name(.)"/>
+	<xsl:value-of disable-output-escaping="yes" select="$endElementName"/>
+      </xsl:when>
+
+      <xsl:when
+	  test="namespace-uri()='http://www.w3.org/2001/XMLSchema'">
+	<xsl:value-of disable-output-escaping="yes" select="$startNamespace"/>
+	<xsl:text>xsd:</xsl:text>
+	<xsl:value-of disable-output-escaping="yes"
+		      select="$endNamespace"/>
+	<xsl:value-of disable-output-escaping="yes" select="$startElementName"/>
+	
+	<xsl:value-of select="local-name(.)"/>
+	<xsl:value-of disable-output-escaping="yes" select="$endElementName"/>
+	
+      </xsl:when>
+
+      <xsl:when
+	  test="namespace-uri()='http://www.ascc.net/xml/schematron'">
+	<xsl:value-of disable-output-escaping="yes" select="$startNamespace"/>
+	<xsl:text>sch:</xsl:text>
+	<xsl:value-of disable-output-escaping="yes"
+		      select="$endNamespace"/>
+	<xsl:value-of disable-output-escaping="yes" select="$startElementName"/>
+	
+	<xsl:value-of select="local-name(.)"/>
+	<xsl:value-of disable-output-escaping="yes" select="$endElementName"/>
+	
+      </xsl:when>
+
+      <xsl:when
+	  test="namespace-uri()='http://www.w3.org/1998/Math/MathML'">
+	<xsl:value-of disable-output-escaping="yes" select="$startNamespace"/>
+	<xsl:text>m:</xsl:text>
+	<xsl:value-of disable-output-escaping="yes"
+		      select="$endNamespace"/>
+	<xsl:value-of disable-output-escaping="yes" select="$startElementName"/>
+	
+	<xsl:value-of select="local-name(.)"/>
+	<xsl:value-of disable-output-escaping="yes" select="$endElementName"/>
+	
+      </xsl:when>
+
+      <xsl:when
+	  test="namespace-uri()='http://purl.oclc.org/dsdl/nvdl/ns/structure/1.0'">
+	<xsl:value-of disable-output-escaping="yes" select="$startNamespace"/>
+	<xsl:text>nvdl:</xsl:text>
+	<xsl:value-of disable-output-escaping="yes"
+		      select="$endNamespace"/>
+	<xsl:value-of disable-output-escaping="yes" select="$startElementName"/>
+	
+	<xsl:value-of select="local-name(.)"/>
+	<xsl:value-of disable-output-escaping="yes" select="$endElementName"/>
+	
+      </xsl:when>
+
+      <xsl:when
+	  test="namespace-uri()='http://relaxng.org/ns/compatibility/annotations/1.0'">
+	<xsl:value-of disable-output-escaping="yes" select="$startNamespace"/>
+	<xsl:text>a:</xsl:text>
+	<xsl:value-of disable-output-escaping="yes"
+		      select="$endNamespace"/>
+	<xsl:value-of disable-output-escaping="yes" select="$startElementName"/>
+	
+	<xsl:value-of select="local-name(.)"/>
+	<xsl:value-of disable-output-escaping="yes" select="$endElementName"/>
+	
+      </xsl:when>
+      <xsl:when
+	  test="namespace-uri()='http://www.w3.org/1999/xhtml'">
+	<xsl:value-of disable-output-escaping="yes" select="$startNamespace"/>
+	<xsl:text>xhtml:</xsl:text>
+	<xsl:value-of disable-output-escaping="yes"
+		      select="$endNamespace"/>
+	<xsl:value-of disable-output-escaping="yes" select="$startElementName"/>
+	
+	<xsl:value-of select="local-name(.)"/>
+	<xsl:value-of disable-output-escaping="yes" select="$endElementName"/>
+	
+      </xsl:when>
+
+      <xsl:when
+	  test="namespace-uri()='http://www.w3.org/1999/xlink'">
+	<xsl:value-of disable-output-escaping="yes" select="$startNamespace"/>
+	<xsl:text>xlink:</xsl:text>
+	<xsl:value-of disable-output-escaping="yes"
+		      select="$endNamespace"/>
+	<xsl:value-of disable-output-escaping="yes" select="$startElementName"/>
+	
+	<xsl:value-of select="local-name(.)"/>
+	<xsl:value-of disable-output-escaping="yes" select="$endElementName"/>
+	
+      </xsl:when>
+
+      <xsl:when
+	  test="namespace-uri()='http://relaxng.org/ns/structure/1.0'">
+	<xsl:value-of disable-output-escaping="yes" select="$startNamespace"/>
+	<xsl:text>rng:</xsl:text>
+	<xsl:value-of disable-output-escaping="yes"
+		      select="$endNamespace"/>
+	<xsl:value-of disable-output-escaping="yes" select="$startElementName"/>
+	<xsl:value-of select="local-name(.)"/>
+	<xsl:value-of disable-output-escaping="yes" select="$endElementName"/>
+	
+      </xsl:when>
+
+      <xsl:when
+	  test="namespace-uri()='http://earth.google.com/kml/2.1'">
+	<xsl:value-of disable-output-escaping="yes" select="$startNamespace"/>
+	<xsl:text>kml:</xsl:text>
+	<xsl:value-of disable-output-escaping="yes"
+		      select="$endNamespace"/>
+	<xsl:value-of disable-output-escaping="yes" select="$startElementName"/>
+	<xsl:value-of select="local-name(.)"/>
+	<xsl:value-of disable-output-escaping="yes" select="$endElementName"/>
+	
+      </xsl:when>
+
+      <xsl:when
+	  test="namespace-uri()='http://www.w3.org/2005/11/its'">
+	<xsl:value-of disable-output-escaping="yes" select="$startNamespace"/>
+	<xsl:text>its:</xsl:text>
+	<xsl:value-of disable-output-escaping="yes"
+		      select="$endNamespace"/>
+	<xsl:value-of disable-output-escaping="yes" select="$startElementName"/>
+	<xsl:value-of select="local-name(.)"/>
+	<xsl:value-of disable-output-escaping="yes" select="$endElementName"/>
+      </xsl:when>
+
+      <xsl:when test="namespace-uri()='http://www.w3.org/1999/XSL/Transform'">
+        <xsl:value-of disable-output-escaping="yes" select="$startNamespace"/>
+        <xsl:text>xsl:</xsl:text>
+        <xsl:value-of select="local-name(.)"/>
+        <xsl:value-of disable-output-escaping="yes" select="$endNamespace"/>
+      </xsl:when>
+
+      <xsl:when
+	  test="namespace-uri()='http://www.tei-c.org/ns/Examples'">
+	<xsl:value-of disable-output-escaping="yes" select="$startElementName"/>
+	<xsl:value-of select="local-name(.)"/>
+	<xsl:value-of disable-output-escaping="yes" select="$endElementName"/>
+      </xsl:when>
+
+      <xsl:when
+	  test="namespace-uri()='http://www.w3.org/2005/Atom'">
+	<xsl:value-of disable-output-escaping="yes" select="$startNamespace"/>
+	<xsl:text>atom:</xsl:text>
+	<xsl:value-of disable-output-escaping="yes"
+		      select="$endNamespace"/>
+	<xsl:value-of disable-output-escaping="yes" select="$startElementName"/>
+	<xsl:value-of select="local-name(.)"/>
+	    <xsl:value-of disable-output-escaping="yes" select="$endElementName"/>
+      </xsl:when>
+
+      <xsl:when
+	  test="namespace-uri()='http://purl.org/rss/1.0/modules/event/'">
+	<xsl:value-of disable-output-escaping="yes" select="$startNamespace"/>
+	<xsl:text>ev:</xsl:text>
+	<xsl:value-of disable-output-escaping="yes"
+		      select="$endNamespace"/>
+	<xsl:value-of disable-output-escaping="yes" select="$startElementName"/>
+	<xsl:value-of select="local-name(.)"/>
+	<xsl:value-of disable-output-escaping="yes" select="$endElementName"/>
+	
+      </xsl:when>
+
+      <xsl:when test="not(namespace-uri()='')">
+	<xsl:value-of disable-output-escaping="yes" select="$startElementName"/>
+	<xsl:value-of select="local-name(.)"/>
+	<xsl:value-of disable-output-escaping="yes" select="$endElementName"/>
+	<xsl:if test="$start='true'">
+	  <xsl:text> xmlns="</xsl:text>
+	  <xsl:value-of select="namespace-uri()"/>
+	  <xsl:text>"</xsl:text>
+	</xsl:if>
+      </xsl:when>
+
+      <xsl:otherwise>
+	<xsl:value-of disable-output-escaping="yes" select="$startElementName"/>
+	<xsl:value-of select="local-name(.)"/>
+	<xsl:value-of disable-output-escaping="yes" select="$endElementName"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+
+    <xsl:template name="makeIndent">
+      <xsl:variable name="depth"
+		    select="count(ancestor::*[not(namespace-uri()='http://www.tei-c.org/ns/1.0')])"/>
+      <xsl:call-template name="makeSpace">
+	<xsl:with-param name="d">
+	  <xsl:value-of select="$depth"/>
+	</xsl:with-param>
+      </xsl:call-template>
+  </xsl:template>
+
+  <xsl:template name="makeSpace">
+    <xsl:param name="d"/>
+    <xsl:if test="number($d)&gt;1">
+      <xsl:value-of select="$spaceCharacter"/>
+      <xsl:call-template name="makeSpace">
+	<xsl:with-param name="d">
+	  <xsl:value-of select="$d -1"/>
+	</xsl:with-param>
+      </xsl:call-template>
+    </xsl:if>
+  </xsl:template>
+
+<xsl:template match="@*" mode="verbatim">
+  <xsl:variable name="L">
+    <xsl:for-each select="../@*">
+      <xsl:value-of select="."/>
+    </xsl:for-each>
+  </xsl:variable>
+    <xsl:if test="count(../@*)&gt;$attsOnSameLine or string-length($L)&gt;40 or
+		  namespace-uri()='http://www.w3.org/2005/11/its' or
+		  string-length(.)+string-length(name(.)) &gt; 40">
+    <xsl:call-template name="lineBreak">
+      <xsl:with-param name="id">5</xsl:with-param>
+    </xsl:call-template>
+    <xsl:call-template name="makeIndent"/>
+  </xsl:if>
+  <xsl:value-of select="$spaceCharacter"/>
+  <xsl:value-of disable-output-escaping="yes" select="$startAttribute"/>
+  <xsl:choose>
+    <xsl:when test="namespace-uri()='http://www.w3.org/2005/11/its'">
+      <xsl:text>its:</xsl:text>
+    </xsl:when>
+    <xsl:when
+	test="namespace-uri()='http://www.w3.org/XML/1998/namespace'">
+      <xsl:text>xml:</xsl:text>
+    </xsl:when>
+    <xsl:when test="namespace-uri()='http://www.w3.org/1999/xlink'">
+      <xsl:text>xlink:</xsl:text>
+    </xsl:when>
+    <xsl:when
+	test="namespace-uri()='http://www.example.org/ns/nonTEI'">
+      <xsl:text>my:</xsl:text>
+    </xsl:when>
+    <xsl:when
+	test="namespace-uri()='http://relaxng.org/ns/compatibility/annotations/1.0'">
+      <xsl:text>a:</xsl:text>
+    </xsl:when>
+<!--    <xsl:otherwise>
+    <xsl:for-each select="namespace::*">
+      <xsl:if test="not(name(.)='')">
+	  <xsl:value-of select="name(.)"/>
+	  <xsl:text>:</xsl:text>
+      </xsl:if>
+    </xsl:for-each>
+    </xsl:otherwise>
+-->
+  </xsl:choose>
+  <xsl:value-of select="local-name(.)"/>
+  <xsl:value-of disable-output-escaping="yes" select="$endAttribute"/>
+  <xsl:text>="</xsl:text>
+  <xsl:value-of disable-output-escaping="yes" select="$startAttributeValue"/>
+  <xsl:apply-templates select="." mode="attributetext"/>
+  <xsl:value-of disable-output-escaping="yes" select="$endAttributeValue"/>
+  <xsl:text>"</xsl:text>
+</xsl:template>
+
+<xsl:template match="@*" mode="attributetext">
+  <xsl:choose>
+    <xsl:when test="string-length(.)&gt;50">
+      <xsl:choose>
+	<xsl:when test="contains(.,'|')">
+	  <xsl:call-template name="breakMe">
+	    <xsl:with-param name="text">
+	      <xsl:value-of select="."/>
+	    </xsl:with-param>
+	    <xsl:with-param name="sep">
+	      <xsl:text>|</xsl:text>
+	    </xsl:with-param>
+	  </xsl:call-template>
+	</xsl:when>
+	<xsl:otherwise>
+	  <xsl:call-template name="breakMe">
+	    <xsl:with-param name="text">
+	      <xsl:value-of select="."/>
+	    </xsl:with-param>
+	    <xsl:with-param name="sep">
+	      <xsl:text> </xsl:text>
+	    </xsl:with-param>
+	  </xsl:call-template>
+	</xsl:otherwise>
+      </xsl:choose>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:value-of select="."/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template name="breakMe">
+  <xsl:param name="text"/>
+  <xsl:param name="sep"/>
+  <xsl:choose>
+    <xsl:when test="string-length($text)&lt;50">
+      <xsl:value-of select="$text"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:value-of select="substring-before($text,$sep)"/>
+      <xsl:text>&#10;</xsl:text>
+      <xsl:value-of select="$sep"/>
+      <xsl:call-template name="breakMe">
+	<xsl:with-param name="text">
+	  <xsl:value-of select="substring-after($text,$sep)"/>
+	</xsl:with-param>
+	<xsl:with-param name="sep">
+	  <xsl:value-of select="$sep"/>
+	</xsl:with-param>
+      </xsl:call-template>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+
+<xsl:template match="text()|comment()|processing-instruction()" mode="ns"/>
+
+<xsl:template match="*" mode="ns">
+  <xsl:param name="list"/>
+  <xsl:variable name="used">
+    <xsl:for-each select="namespace::*">
+      <xsl:variable name="ns" select="."/>
+      <xsl:choose>
+	<xsl:when test="contains($list,$ns)"/>
+	<xsl:when test=".='http://relaxng.org/ns/structure/1.0'"/>
+	<xsl:when test=".='http://www.w3.org/2001/XInclude'"/>
+	<xsl:when test=".='http://www.tei-c.org/ns/Examples'"/>
+	<xsl:when test=".='http://relaxng.org/ns/compatibility/annotations/1.0'"/>
+	<xsl:when test="name(.)=''"/>
+	<xsl:when test=".='http://www.w3.org/XML/1998/namespace'"/>
+	<xsl:otherwise>
+	  <xsl:call-template name="lineBreak">
+	    <xsl:with-param name="id">22</xsl:with-param>
+	  </xsl:call-template>
+	  <xsl:text>&#160;&#160;&#160;</xsl:text>
+	  <xsl:text>xmlns:</xsl:text>
+	  <xsl:value-of select="name(.)"/>
+	  <xsl:text>="</xsl:text>
+	  <xsl:value-of select="."/>
+	  <xsl:text>"</xsl:text>
+	</xsl:otherwise>
+      </xsl:choose>
+    </xsl:for-each>
+    </xsl:variable>
+  <xsl:copy-of select="$used"/>
+  <xsl:apply-templates mode="ns">
+    <xsl:with-param name="list">
+      <xsl:value-of select="$list"/>
+      <xsl:value-of select="$used"/>
+    </xsl:with-param>
+  </xsl:apply-templates>
+</xsl:template>
+
+
+  <xsl:template name="italicize"/>
+
+  <xsl:template match="tei:soCalled">
+    <text:span>
+      <xsl:value-of select="$preQuote"/>
+      <xsl:apply-templates/>
+      <xsl:value-of select="$postQuote"/>
+    </text:span>
+  </xsl:template>
+
+  <xsl:function name="tei:convert-dim-pt" as="xs:integer">
+    <xsl:param name="dim"/>
+    <xsl:choose>
+      <xsl:when test="ends-with($dim,'cm')">
+	<xsl:value-of select="number(number(substring($dim,0,string-length($dim)-1))*28.3464567) cast as xs:integer"/>
+      </xsl:when>
+      <xsl:when test="ends-with($dim,'in')">
+	<xsl:value-of select="number(number(substring($dim,0,string-length($dim)-1))*72) cast as xs:integer"/>
+      </xsl:when>
+      
+      <xsl:when test="ends-with($dim,'mm')">
+	<xsl:value-of select="number(number(substring($dim,0,string-length($dim)-1))*2.83464567) cast as xs:integer"/>
+      </xsl:when>
+      <xsl:when test="ends-with($dim,'pt')">
+	<xsl:value-of select="number(substring($dim,0,string-length($dim)-1)) cast as xs:integer"/>
+      </xsl:when>
+      <xsl:when test="ends-with($dim,'px')">
+	<xsl:value-of select="number(number(substring($dim,0,string-length($dim)-1))*0.75) cast as xs:integer"/>
+      </xsl:when>
+      
+      <xsl:otherwise>
+	-1
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:function>
+
+  <xsl:template name="makeExternalLink">
+    <xsl:param name="ptr" as="xs:boolean" select="false()"/>
+    <xsl:param name="dest"/>
+    <xsl:param name="class">link_<xsl:value-of select="local-name(.)"/></xsl:param>
+    <text:a xlink:type="simple" xlink:href="{$dest}">
+      <xsl:choose>
+	<xsl:when test="$ptr">
+	  <xsl:value-of select="$dest"/>
+	</xsl:when>
+	<xsl:otherwise>
+	  <xsl:apply-templates/>
+	</xsl:otherwise>
+      </xsl:choose>
+    </text:a>
+  </xsl:template>
+
+
+  <xsl:template name="startHook">
+    <xsl:choose>
+      <xsl:when test="self::tei:list and parent::tei:item">
+	<xsl:text disable-output-escaping="yes">&lt;/text:p&gt;</xsl:text>
+	<xsl:text disable-output-escaping="yes">&lt;/text:list&gt;</xsl:text>
+      </xsl:when>
+      <xsl:when test="parent::tei:p">
+      <xsl:text disable-output-escaping="yes">&lt;/text:p&gt;</xsl:text>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="endHook">
+    <xsl:choose>
+      <xsl:when test="self::tei:list and parent::tei:item">
+	<xsl:text disable-output-escaping="yes">&lt;text:list
+	</xsl:text>
+	<xsl:choose>
+	  <xsl:when test="parent::tei:list[@type='ordered']">
+	  </xsl:when>
+	</xsl:choose>
+	<xsl:text>&gt;</xsl:text>
+	<xsl:text disable-output-escaping="yes">&lt;text:p  text:style-name="List Contents&gt;</xsl:text>
+      </xsl:when>
+      <xsl:when test="parent::tei:p">
+      <xsl:text disable-output-escaping="yes">&lt;text:p&gt;</xsl:text>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="generateRevDate">
+      <xsl:variable name="when">
+         <xsl:choose>
+            <xsl:when test="ancestor-or-self::tei:TEI/tei:teiHeader/tei:revisionDesc/descendant::tei:date">
+               <xsl:value-of select="ancestor-or-self::tei:TEI/tei:teiHeader/tei:revisionDesc/descendant::tei:date[1]"/>
+            </xsl:when>
+            <xsl:when
+		test="ancestor-or-self::tei:TEI/tei:teiHeader/tei:fileDesc/descendant::tei:date">
+	      <xsl:value-of select="ancestor-or-self::tei:TEI/tei:teiHeader/tei:fileDesc/descendant::tei:date"/>
+	    </xsl:when>	    
+         </xsl:choose>
+      </xsl:variable>
+      <xsl:choose>
+         <xsl:when test="starts-with($when,'$Date')">
+        <!-- it's RCS -->
+        <xsl:value-of select="substring($when,16,2)"/>
+            <xsl:text>/</xsl:text>
+            <xsl:value-of select="substring($when,13,2)"/>
+            <xsl:text>/</xsl:text>
+            <xsl:value-of select="substring($when,8,4)"/>
+         </xsl:when>
+         <xsl:when test="starts-with($when,'$LastChangedDate')">
+        <!-- it's Subversion-->
+        <xsl:value-of select="substring-before(substring-after($when,'('),')')"/>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:value-of select="$when"/>
+         </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+  <xsl:template name="generateDate">
+      <xsl:choose>
+	 <xsl:when test="$useFixedDate='true'">1970-01-01</xsl:when>
+         <xsl:when
+	     test="ancestor-or-self::tei:TEI/tei:teiHeader/tei:fileDesc/tei:editionStmt/descendant::tei:date[@when]">
+            <xsl:value-of select="ancestor-or-self::tei:TEI/tei:teiHeader/tei:fileDesc/tei:editionStmt/descendant::tei:date[@when][1]/@when"/>
+         </xsl:when>
+         <xsl:when test="ancestor-or-self::tei:TEI/tei:teiHeader/tei:fileDesc/tei:editionStmt/descendant::tei:date">
+            <xsl:value-of select="ancestor-or-self::tei:TEI/tei:teiHeader/tei:fileDesc/tei:editionStmt/descendant::tei:date[1]"/>
+         </xsl:when>
+         <xsl:when test="ancestor-or-self::tei:TEI/tei:teiHeader/tei:fileDesc/tei:publicationStmt/tei:date">
+            <xsl:value-of select="ancestor-or-self::tei:TEI/tei:teiHeader/tei:fileDesc/tei:publicationStmt/tei:date"/>
+         </xsl:when>
+         <xsl:when test="ancestor-or-self::tei:TEI/tei:teiHeader/tei:fileDesc/tei:editionStmt/tei:edition">
+            <xsl:apply-templates select="ancestor-or-self::tei:TEI/tei:teiHeader/tei:fileDesc/tei:editionStmt/tei:edition"/>
+         </xsl:when>
+	 <xsl:when
+	     test="ancestor-or-self::tei:TEI/tei:teiHeader/tei:revisionDesc/tei:change[@when
+		   or tei:date]">
+            <xsl:for-each
+		select="ancestor-or-self::tei:TEI/tei:teiHeader/tei:revisionDesc/tei:change[1]">
+	      <xsl:choose>
+		<xsl:when test="@when">
+		  <xsl:value-of select="@when"/>
+		</xsl:when>
+		<xsl:when test="tei:date/@when">
+		  <xsl:value-of select="tei:date/@when"/>
+		</xsl:when>
+		<xsl:when test="tei:date">
+		  <xsl:value-of select="tei:date"/>
+		</xsl:when>
+		<xsl:otherwise>
+		  <xsl:value-of select="format-dateTime(current-dateTime(),'[Y]-[M02]-[D02]')"/>
+		</xsl:otherwise>
+	      </xsl:choose>
+	    </xsl:for-each>
+	 </xsl:when>
+	 <xsl:otherwise>
+	   <xsl:value-of select="format-dateTime(current-dateTime(),'[Y]-[M02]-[D02]')"/>
+	 </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="generateTitle">
+    <xsl:for-each
+	select="ancestor-or-self::tei:TEI/tei:teiHeader/tei:fileDesc/tei:titleStmt">
+	<xsl:apply-templates select="tei:title"/>
+    </xsl:for-each>
+  </xsl:template>
+
+  <xsl:template name="makeSpan">
+    <xsl:apply-templates/>
+  </xsl:template>
+
+  <xsl:template name="tei:makeText">
+    <xsl:param name="letters"/>
+    <xsl:value-of select="$letters"/>
+  </xsl:template>
+
+
+    <xsl:template name="emphasize">
+      <xsl:param name="class"/>
+      <xsl:param name="content"/>
+      <text:span>
+	<xsl:choose>
+	  <xsl:when test="$class='titlem'">
+	    <xsl:attribute name="text:style-name">Emphasis</xsl:attribute>
+	  </xsl:when>
+	  <xsl:when test="$class='titlej'">
+	    <xsl:attribute name="text:style-name">Emphasis</xsl:attribute>
+	  </xsl:when>
+	</xsl:choose>
+	<xsl:attribute name="xml:space">preserve</xsl:attribute>
+	  <xsl:choose>
+	    <xsl:when test="$class='titles'">
+	      <xsl:text>, </xsl:text>
+	    </xsl:when>
+	    <xsl:when test="$class='titleu'">
+	      <xsl:text>‘</xsl:text>
+	    </xsl:when>
+	    <xsl:when test="$class='titlea'">
+	      <xsl:text>‘</xsl:text>
+	    </xsl:when>
+	  </xsl:choose>
+	  <xsl:value-of select="$content"/>
+	  <xsl:choose>
+	    <xsl:when test="$class='titleu'">
+	      <xsl:text>’</xsl:text>
+	    </xsl:when>
+	    <xsl:when test="$class='titlea'">
+	      <xsl:text>’</xsl:text>
+	    </xsl:when>
+	  </xsl:choose>
+      </text:span>
+    </xsl:template>
+ 
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/odt/teitoodt.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/odt/listgraphics.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/odt/listgraphics.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/odt/listgraphics.xsl	(revision 258)
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="2.0">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet dealing with elements from the core module. </p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: listgraphics.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc>
+   </doc>
+
+  <xsl:output method="text"/>
+  <xsl:param name="DIR"/>
+  <xsl:param name="ORIG">.</xsl:param>
+
+  <xsl:key match="tei:graphic|tei:pb[@facs]" use="1" name="G"/>
+
+  <xsl:template match="/">
+      <xsl:for-each select="key('G',1)">
+         <xsl:variable name="F">
+            <xsl:value-of select="@url|@facs"/>
+         </xsl:variable>
+	 <xsl:variable name="target">
+	   <xsl:value-of select="$DIR"/>
+	   <xsl:text>/image</xsl:text>
+	   <xsl:if test="self::tei:pb">pb</xsl:if>
+	   <xsl:number level="any"/>
+	   <xsl:text>.</xsl:text>
+	   <xsl:value-of select="tokenize($F,'\.')[last()]"/>
+	 </xsl:variable>
+         <xsl:choose>
+	   <xsl:when test="starts-with($F,'http')">
+	     <xsl:text>curl -s -o </xsl:text>
+	     <xsl:value-of select="$target"/>
+	     <xsl:text> </xsl:text>
+	     <xsl:value-of select="$F"/> 
+	   </xsl:when>
+	   <xsl:when test="starts-with($F,'/')">
+	     <xsl:text>cp </xsl:text>
+	     <xsl:value-of select="$F"/> 
+	     <xsl:text> </xsl:text>
+	     <xsl:value-of select="$target"/>
+	   </xsl:when>
+	   <xsl:otherwise> 
+	     <xsl:text>cp </xsl:text>
+	     <xsl:value-of select="$ORIG"/>
+	     <xsl:text>/</xsl:text>
+	     <xsl:value-of select="$F"/> 
+	     <xsl:text> </xsl:text>
+	     <xsl:value-of select="$target"/>
+	   </xsl:otherwise>
+         </xsl:choose>
+         <xsl:text>&#10;</xsl:text>
+      </xsl:for-each>
+  </xsl:template>
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/odt/listgraphics.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/nlm/tei_to_nlm.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/nlm/tei_to_nlm.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/nlm/tei_to_nlm.xsl	(revision 258)
@@ -0,0 +1,749 @@
+<?xml version="1.0"?>
+<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exist="http://exist.sourceforge.net/NS/exist" xmlns="" xpath-default-namespace="http://www.tei-c.org/ns/1.0" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" exclude-result-prefixes="#all">
+
+  <!--
+        Written by Martin Holmes, University of Victoria Humanities Computing and 
+    Media Centre, beginning in 2008.
+    
+    This file is released under the Mozilla Public Licence version 1.1 (MPL 1.1).
+    
+    This transformation is designed to convert the limited subset of TEI elements
+    used in the teiJournal project into an NLM file. NLM is:
+    
+    The National Center for Biotechnology Information (NCBI) of the National Library of
+    Medicine (NLM) created the Journal Archiving and Interchange Tag Suite.
+    
+    Our target is actually the NLM Journal Publishing Tag Set, described here:
+    
+    http://dtd.nlm.nih.gov/publishing/tag-library/3.0/index.html
+    
+    The reason for creating NLM conversion is that Open Journal Systems has committed 
+    to supporting NLM, so this provides a method of migrating data from teiJournal 
+    to OJS.
+    
+    -->
+  <xsl:output method="xml" doctype-public="-//NLM//DTD Journal Publishing DTD v3.0 20080202//EN" doctype-system="http://dtd.nlm.nih.gov/publishing/3.0/journalpublishing3.dtd" xpath-default-namespace="" indent="yes"></xsl:output>
+
+  <xsl:template match="/">
+    <article dtd-version="3.0" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+      <xsl:if test="TEI/@xml:lang">
+        <xsl:copy-of select="TEI/@xml:lang"></xsl:copy-of>
+      </xsl:if>
+<!-- We have an ontology of TEI contribution types; this does not match 
+     NLM at all. In NLM 3.0, the list of article-type values is suggested but 
+     not fixed, so we can use those which are appropriate, and use our own 
+     where there's no match. In 2.3, the list is fixed, so we'd have to convert 
+     all our non-matching ones to "other". -->
+        <xsl:choose>
+          <xsl:when test="TEI/@rend='article'">
+  <xsl:attribute name="article-type">research-article</xsl:attribute>
+</xsl:when>
+<xsl:when test="TEI/@rend='review_article'">
+  <xsl:attribute name="article-type">review-article</xsl:attribute>
+</xsl:when>
+<xsl:when test="TEI/@rend='fiction'">
+  <xsl:attribute name="article-type">fiction</xsl:attribute>
+</xsl:when>
+<xsl:when test="TEI/@rend='poetry'">
+  <xsl:attribute name="article-type">poetry</xsl:attribute>
+</xsl:when>
+<xsl:when test="TEI/@rend='review'">
+  <xsl:attribute name="article-type">book-review</xsl:attribute>
+</xsl:when>
+<xsl:when test="TEI/@rend='books_received'">
+  <xsl:attribute name="article-type">books-received</xsl:attribute>
+</xsl:when>
+<xsl:when test="TEI/@rend='note'">
+  <xsl:attribute name="article-type">brief-report</xsl:attribute>
+</xsl:when>
+<xsl:when test="TEI/@rend='discussion'">
+  <xsl:attribute name="article-type">discussion</xsl:attribute>
+</xsl:when>
+<xsl:when test="TEI/@rend='editorial'">
+  <xsl:attribute name="article-type">editorial</xsl:attribute>
+</xsl:when>
+<xsl:when test="TEI/@rend='preface'">
+  <xsl:attribute name="article-type">editorial</xsl:attribute>
+</xsl:when>
+<xsl:when test="TEI/@rend='column'">
+  <xsl:attribute name="article-type">discussion</xsl:attribute>
+</xsl:when>
+<xsl:when test="TEI/@rend='afterword'">
+  <xsl:attribute name="article-type">editorial</xsl:attribute>
+</xsl:when>
+<xsl:when test="TEI/@rend='announcement'">
+  <xsl:attribute name="article-type">announcement</xsl:attribute>
+</xsl:when>
+<xsl:when test="TEI/@rend='corrigendum'">
+  <xsl:attribute name="article-type">correction</xsl:attribute>
+</xsl:when>
+<xsl:when test="TEI/@rend='advertisement'">
+  <xsl:attribute name="article-type">announcement</xsl:attribute>
+</xsl:when>
+<xsl:when test="TEI/@rend='doc_list'">
+  <xsl:attribute name="article-type">collection</xsl:attribute>
+</xsl:when>
+<xsl:when test="TEI/@rend='site_page'">
+  <xsl:attribute name="article-type">editorial</xsl:attribute>
+</xsl:when>
+<xsl:when test="TEI/@rend='obituary'">
+  <xsl:attribute name="article-type">obituary</xsl:attribute>
+</xsl:when>
+          <xsl:otherwise><xsl:attribute name="article-type">other</xsl:attribute></xsl:otherwise>
+        </xsl:choose>
+        
+      
+      <!--      This is the metadata block, essentially. -->
+      <xsl:element name="front">
+
+        <!-- Here we dig through the teiHeader to extract what we need to create journal metadata
+     and article metadata. First, journal metadata: -->
+        <xsl:element name="journal-meta">
+          <journal-id journal-id-type="publisher">
+          <xsl:choose>
+          <xsl:when test="TEI/teiHeader[1]/fileDesc[1]/publicationStmt[1]/publisher[1]/choice[1]/abbr[1]">
+            
+              <xsl:value-of select="TEI/teiHeader[1]/fileDesc[1]/publicationStmt[1]/publisher[1]/choice[1]/abbr[1]"></xsl:value-of>
+            
+          </xsl:when>
+            <xsl:otherwise>
+              <xsl:value-of select="TEI/teiHeader[1]/fileDesc[1]/publicationStmt[1]/publisher[1]"></xsl:value-of>
+            </xsl:otherwise>
+          </xsl:choose>
+            </journal-id>
+          <issn>
+            <xsl:value-of select="TEI/teiHeader[1]/fileDesc[1]/seriesStmt[1]/idno[@type='issn']"></xsl:value-of>
+          </issn>
+          <publisher>
+            <publisher-name>
+              <xsl:choose>
+                <xsl:when test="TEI/teiHeader[1]/fileDesc[1]/publicationStmt[1]/publisher[1]/choice/abbr">
+                  <xsl:value-of select="TEI/teiHeader[1]/fileDesc[1]/publicationStmt[1]/publisher[1]/choice/abbr"></xsl:value-of>
+                  <xsl:text> (</xsl:text>
+                  <xsl:apply-templates select="TEI/teiHeader[1]/fileDesc[1]/publicationStmt[1]/publisher[1]/choice/expan"></xsl:apply-templates>
+                  <xsl:text>)</xsl:text>
+                </xsl:when>
+                <xsl:otherwise>
+                  <xsl:value-of select="TEI/teiHeader[1]/fileDesc[1]/publicationStmt[1]/publisher[1]"></xsl:value-of>
+                </xsl:otherwise>
+              </xsl:choose>
+            </publisher-name>
+          </publisher>
+
+        </xsl:element>
+
+        <!--        Next, article metadata. -->
+        <xsl:element name="article-meta">
+          <article-id pub-id-type="other">
+            <xsl:value-of select="TEI/@xml:id"></xsl:value-of>
+          </article-id>
+          <article-categories>
+            <subj-group>
+              <subject><xsl:value-of select="TEI/@rend" /></subject>
+            </subj-group>
+          </article-categories>
+          
+          <title-group>
+            <article-title><xsl:apply-templates select="TEI/teiHeader[1]/fileDesc[1]/titleStmt[1]/title[@type='main']" /></article-title>
+            <subtitle><xsl:apply-templates select="TEI/teiHeader[1]/fileDesc[1]/titleStmt[1]/title[@type='sub']" /></subtitle>
+            <alt-title alt-title-type="runningRecto"><xsl:apply-templates select="TEI/teiHeader[1]/fileDesc[1]/titleStmt[1]/title[@type='runningRecto']" /></alt-title>
+            <alt-title alt-title-type="runningVerso"><xsl:apply-templates select="TEI/teiHeader[1]/fileDesc[1]/titleStmt[1]/title[@type='runningVerso']" /></alt-title>
+          </title-group>
+          
+          <contrib-group>
+            <xsl:for-each select="TEI/teiHeader[1]/fileDesc[1]/titleStmt[1]/author">
+              <contrib contrib-type="author">
+                <xsl:apply-templates select="name"></xsl:apply-templates>
+                <aff><xsl:apply-templates select="name/affiliation" /></aff>
+              </contrib>
+            </xsl:for-each>
+          </contrib-group>
+          
+          <xsl:for-each select="TEI/teiHeader[1]/fileDesc[1]/seriesStmt[1]/respStmt">
+            <contrib-group>
+              <xsl:for-each select="name">
+                <contrib>
+                  <xsl:attribute name="contrib-type" select="../resp"></xsl:attribute>
+                  <xsl:apply-templates select="." />
+                </contrib>
+              </xsl:for-each>
+            </contrib-group>
+          </xsl:for-each>
+
+          <xsl:call-template name="dateToDMYTags"><xsl:with-param name="inDate" select="TEI/teiHeader[1]/fileDesc[1]/publicationStmt[1]/date[1]/@when" /><xsl:with-param name="outTagName">pub-date</xsl:with-param></xsl:call-template>
+          
+          <volume><xsl:apply-templates select="TEI/teiHeader[1]/fileDesc[1]/seriesStmt[1]/idno[@type='vol']" /></volume>
+          
+          <issue><xsl:apply-templates select="TEI/teiHeader[1]/fileDesc[1]/seriesStmt[1]/idno[@type='issue']" /></issue>
+          
+          <elocation-id><xsl:value-of select="TEI/teiHeader[1]/fileDesc[1]/publicationStmt[1]/idno[@type='itemNo']/@n" /></elocation-id>
+
+<!-- If there is an abstract, copy it in here for the sake of completeness. -->
+          <xsl:if test="TEI/text/body/div[@type='abstract']">
+            <abstract>
+              <xsl:apply-templates select="TEI/text/body/div[@type='abstract']/*" />
+            </abstract>
+          </xsl:if>
+
+<!--        Right now, profilDesc only contains keywords, but other templates 
+            might be added later. -->
+        <xsl:apply-templates select="TEI/teiHeader/profileDesc"></xsl:apply-templates>
+
+
+
+        </xsl:element>
+
+      </xsl:element>
+
+      <!--Here's the meat of the document. -->
+      <xsl:element name="body">
+
+        <xsl:apply-templates select="TEI/text/body"></xsl:apply-templates>
+
+      </xsl:element>
+
+      <!--      This will contain the appendices, reference list, etc. -->
+
+      <xsl:element name="back">
+<!-- Appendices first. -->
+        <xsl:if test="TEI/text/back/div[@type='appendix']">
+          <xsl:element name="app-group">
+            <xsl:for-each select="TEI/text/back/div[@type='appendix']">
+              <xsl:element name="app">
+                <xsl:if test="@xml:id">
+                  <xsl:attribute name="id" select="@xml:id" />
+                </xsl:if>
+                <xsl:apply-templates select="./*" />
+              </xsl:element>
+            </xsl:for-each>
+          </xsl:element>
+        </xsl:if>
+        
+<!-- Reference list        -->
+        <xsl:if test="TEI/text/back/div[@type='bibliogr']">
+          <xsl:variable name="bibl" select="TEI/text/back/div[@type='bibliogr']"></xsl:variable>
+          <xsl:element name="ref-list">
+<!-- If there's no title tag, we have to add an empty one. -->
+            <title><xsl:value-of select="$bibl/head" /></title>
+<!-- Now process each of the reference items. -->
+            <xsl:for-each select="$bibl/listBibl/biblStruct">
+              <xsl:apply-templates select="." />
+            </xsl:for-each>
+          </xsl:element>
+        </xsl:if>
+      </xsl:element>
+    </article>
+
+  </xsl:template>
+  
+<!-- Handling of items in profileDesc. -->
+  <xsl:template match="profileDesc"><xsl:apply-templates /></xsl:template>
+  <xsl:template match="textClass"><xsl:apply-templates /></xsl:template>
+  <xsl:template match="keywords">
+    <xsl:element name="kwd-group">
+      <xsl:if test="@scheme">
+        <xsl:attribute name="kwd-group-type" select="@scheme" />
+      </xsl:if>
+      <xsl:for-each select="list/item">
+        <xsl:element name="kwd">
+          <xsl:value-of select="." />
+        </xsl:element>
+      </xsl:for-each>
+    </xsl:element>
+  </xsl:template>
+  
+  <xsl:template name="dateToDMYTags">
+    <xsl:param name="inDate" />
+    <xsl:param name="outTagName" />
+    <xsl:element name="{$outTagName}">
+      <xsl:variable name="frags" select="tokenize($inDate, '-')" />
+      <xsl:if test="count($frags) gt 2">
+        <day><xsl:value-of select="$frags[3]" /></day>
+      </xsl:if>
+      <xsl:if test="count($frags) gt 1">
+        <month><xsl:value-of select="$frags[2]" /></month>
+      </xsl:if>
+      <xsl:if test="count($frags) gt 0">
+        <year><xsl:value-of select="$frags[1]" /></year>
+      </xsl:if>
+    </xsl:element>
+  </xsl:template>
+  
+<!-- Block-level templates. -->
+<!--  Document divisions/sections. -->
+  <xsl:template match="div">
+    <xsl:element name="sec">
+<!-- If there's no title tag, we have to add an empty one. -->
+      <xsl:if test="not(child::head)"><title></title></xsl:if>
+      <xsl:apply-templates />
+    </xsl:element>
+  </xsl:template>
+  
+  <xsl:template match="div/head">
+    <xsl:element name="title">
+      <xsl:apply-templates />
+    </xsl:element>
+  </xsl:template>
+  
+  <xsl:template match="p | ab">
+    <xsl:element name="p">
+      <xsl:apply-templates />
+    </xsl:element>
+  </xsl:template>
+  
+  <xsl:template match="list">
+    <xsl:element name="list">
+      <xsl:if test="@type">
+        <xsl:attribute name="list-type" select="@type" />
+      </xsl:if>
+      <xsl:apply-templates />
+    </xsl:element>
+  </xsl:template>
+  
+  <xsl:template match="list/item">
+    <xsl:element name="list-item">
+      <p>
+        <xsl:apply-templates />
+      </p>
+    </xsl:element>
+  </xsl:template>
+  
+    <!-- Tables are simple for the moment, but they'll get complicated. -->
+    <xsl:template match="table">
+      <xsl:element name="table-wrap">
+        <xsl:if test="@rend">
+          <xsl:attribute name="specific-use" select="@rend"/>
+        </xsl:if>
+        <xsl:if test="head">
+          <xsl:element name="caption">
+            <xsl:element name="p">
+              <xsl:apply-templates select="head"/>
+            </xsl:element>
+          </xsl:element>
+          </xsl:if>
+        <xsl:element name="table">
+          <xsl:if test="@xml:id"><xsl:attribute name="id" select="@xml:id" /></xsl:if>
+            <xsl:apply-templates/>
+        </xsl:element>
+      </xsl:element>
+    </xsl:template>
+    <xsl:template match="table/row">
+        <xsl:element name="tr">
+            <xsl:apply-templates/>
+        </xsl:element>
+    </xsl:template>
+    <xsl:template match="table/row/cell">
+      <xsl:choose>
+        <xsl:when test="parent::row/@role='label'">
+          <xsl:element name="th">
+            <xsl:apply-templates />
+          </xsl:element>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:element name="td">
+            <xsl:apply-templates />
+          </xsl:element>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:template>
+  
+<!-- Suppress handling of the table caption (head), because the NLM model moves it 
+     into the parent table-wrap element, so we have to handle it at that point
+     (above). -->
+  <xsl:template match="table/head"></xsl:template>
+  
+<!--  Low-level element templates. -->
+  
+<!-- Copy xml:id to id attribute in output. -->
+  <xsl:template match="@xml:id"><xsl:attribute name="id" select="." /></xsl:template>
+  
+<!-- Copy xml:lang to output. -->
+  <xsl:template match="@xml:lang"><xsl:copy-of select="." /></xsl:template>
+  
+<!-- Quotations. Our TEI model is more sophisticated that NLM here; we need 
+to simplify a bit. -->
+  <xsl:template match="cit">
+    <xsl:if test="quote">
+      <xsl:element name="disp-quote">
+        <xsl:if test="@rend">
+          <xsl:attribute name="specific-use" select="@rend" />
+        </xsl:if>
+<!-- If the quote is already divided into paragraphs, we can simply process
+     it; if not, we must supply a p tag, because NLM requires a block tag 
+     inside disp-quote. -->
+        <xsl:choose>
+          <xsl:when test="quote/p">
+            <xsl:apply-templates select="quote" />
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:element name="p">
+              <xsl:apply-templates select="quote" />
+            </xsl:element>
+          </xsl:otherwise>
+        </xsl:choose>
+        <xsl:if test="@rend='block' and ref">
+          <xsl:element name="attrib">
+            <xsl:apply-templates select="ref" />
+          </xsl:element>
+        </xsl:if>
+      </xsl:element>
+    </xsl:if>
+    <xsl:if test="not(@rend='block') and ref">
+       <xsl:apply-templates select="ref" />
+    </xsl:if>
+  </xsl:template>
+  
+  <xsl:template match="ref">
+<!-- For ref elements, we need to distinguish between internal and external 
+because NLM handles them differently. -->
+    <xsl:choose>
+<!-- Internal reference. -->
+      <xsl:when test="starts-with(@target, '#')">
+        <xsl:element name="xref">
+          <xsl:variable name="targId" select="substring-after(@target, '#')" />
+          <xsl:attribute name="rid" select="$targId" />
+<!-- If it's a reference to a biblStruct element in the back matter, then it should 
+be given the recommended @ref-type. -->
+          <xsl:if test="//back//biblStruct[@xml:id = $targId]"><xsl:attribute name="ref-type">bibr</xsl:attribute></xsl:if>
+          
+<!-- We have to be careful of embedded tags, because xref has a very 
+     impoverished content model. -->
+          <xsl:apply-templates />
+        </xsl:element>
+      </xsl:when>
+<!-- External reference. -->
+      <xsl:otherwise>
+        <xsl:element name="ext-link">
+          <xsl:attribute name="xlink:href" select="@target" />
+<!-- We have to be careful of embedded tags, because ext-link has a very 
+     impoverished content model. -->
+          <xsl:apply-templates />
+        </xsl:element>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  
+<!-- Abbreviations.  -->
+  <xsl:template match="choice[abbr]">
+    <xsl:apply-templates select="abbr"></xsl:apply-templates>
+  </xsl:template>
+  
+  <xsl:template match="abbr">
+    <xsl:choose>
+      <xsl:when test="not(ancestor::ref)">
+        <xsl:element name="abbrev">
+        <xsl:apply-templates />
+        <xsl:if test="preceding-sibling::expan"><def><p><xsl:apply-templates select="preceding-sibling::expan[1]" /></p></def></xsl:if>
+        <xsl:if test="following-sibling::expan"><def><p><xsl:apply-templates select="following-sibling::expan[1]" /></p></def></xsl:if>
+        </xsl:element>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="." />
+      </xsl:otherwise>
+    </xsl:choose>
+    
+  </xsl:template>
+  
+  
+<!-- Name elements are complicated, because we distinguish them by type, 
+     but NLM makes a distinction between the names of people and other 
+     types of name. The only appropriate NLM element I can find for the latter
+     is named-content. 
+     There is a further annoying complication, in that the <name> element 
+     in NLM can't show up inside regular body text, apparently.      
+-->
+
+  <xsl:template match="name[@type='person' or not(@type)][not(ancestor::div)]">
+    <xsl:element name="name">
+      <surname><xsl:apply-templates select="surname" /></surname>
+      <given-names><xsl:apply-templates select="forename" /></given-names>
+    </xsl:element>
+  </xsl:template>
+  
+  <xsl:template match="name[@type='person' or not(@type)][ancestor::div]">
+    <xsl:element name="named-content">
+      <xsl:attribute name="content-type">person</xsl:attribute>
+      <xsl:value-of select="." />
+    </xsl:element>
+  </xsl:template>
+  
+  <xsl:template match="affiliation/name[@type='org']">
+    <xsl:element name="institution">
+      <xsl:value-of select="." />
+    </xsl:element>
+  </xsl:template>
+  
+  <xsl:template match="name[@type and not(@type='person')][ancestor::div]">
+    <xsl:element name="named-content">
+      <xsl:attribute name="content-type" select="@type" />
+      <xsl:apply-templates />
+    </xsl:element>
+  </xsl:template>
+  
+<!-- Notes (footnotes/endnotes). -->
+  <xsl:template match="note">
+    <xsl:element name="fn">
+      <xsl:choose>
+        <xsl:when test="not(child::p)">
+          <xsl:element name="p">
+            <xsl:apply-templates />
+          </xsl:element>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:apply-templates />
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:element>
+  </xsl:template>
+  
+<!-- Figures and graphics. -->
+  <xsl:template match="figure">
+    <xsl:element name="fig">
+      <xsl:if test="@xml:id">
+        <xsl:attribute name="id" select="@xml:id" />
+      </xsl:if>
+      <xsl:apply-templates />
+    </xsl:element>  
+  </xsl:template>
+  
+  <xsl:template match="figure/head">
+    <caption><title><xsl:apply-templates /></title></caption>
+  </xsl:template>
+  
+  <xsl:template match="graphic">
+    <xsl:element name="graphic">
+      <xsl:attribute name="xlink:href" select="@url" />
+    </xsl:element>
+  </xsl:template>
+  
+<!-- Verse lines and groups. -->
+  <xsl:template match="lg">
+    <xsl:element name="verse-group">
+      <xsl:apply-templates />
+    </xsl:element>
+  </xsl:template>
+  
+  <xsl:template match="l">
+    <xsl:element name="verse-line">
+      <xsl:apply-templates />
+    </xsl:element>
+  </xsl:template>
+  
+  
+<!-- Bibliographical items. -->
+  <xsl:template match="listBibl/biblStruct">
+    <ref id="{@xml:id}">
+<!-- Now the hard bit. NLM's model is radically different from TEI's. -->
+      <element-citation publication-type="{@type}">
+        
+<!-- We're going to take the approach of picking out the information we 
+     need from where we expect to find it, rather than trying to apply 
+     templates in some generic way, because the structured nature of 
+     TEI biblStructs is so different from the rather looser structure 
+     of NLM. -->
+        
+<!-- First we look for authors. These might be in the analytic or in the 
+monogr; try analytic first. -->
+        <xsl:if test="analytic">
+<!-- In this case, we should be able to get both title and authors from here. -->
+          <person-group person-group-type="author">
+            <xsl:for-each select="analytic/author/name">
+              <name>
+                <surname><xsl:apply-templates select="surname" /></surname>
+                <given-names><xsl:apply-templates select="forename" /></given-names>
+              </name>
+            </xsl:for-each>
+          </person-group>
+<!-- Now we can get the title from here. NLM has an article-title element, which 
+     will do for journal articles; it uses chapter-title for book chapters. -->
+          <xsl:choose>
+            <xsl:when test="@type='book'"><chapter-title><xsl:apply-templates select="analytic/title" /></chapter-title></xsl:when>
+            <xsl:otherwise><article-title><xsl:apply-templates select="analytic/title" /></article-title></xsl:otherwise>
+          </xsl:choose> 
+        </xsl:if>
+<!-- Now we look for additional information in the monogr element. -->
+        <xsl:if test="monogr">
+<!-- If there's a monogr title element, it could be the level m or j (books and 
+journals), or it could be s (series title). We need to handle each separately.-->
+          <xsl:for-each select="monogr/title[@level='m' or @level='u' or @level='j']">
+            <source><xsl:value-of select="." /></source>
+          </xsl:for-each>
+<!-- Series titles. -->
+          <xsl:for-each select="monogr/title[@level='s']">
+            <series><xsl:value-of select="." /></series>
+          </xsl:for-each>
+<!-- Now we should look for authors and editors at the monogr level. -->
+          <xsl:if test="monogr/author">
+            <person-group person-group-type="author">
+              <xsl:for-each select="monogr/author/name">
+                <name>
+                  <surname><xsl:apply-templates select="surname" /></surname>
+                  <given-names><xsl:apply-templates select="forename" /></given-names>
+                </name>
+              </xsl:for-each>
+            </person-group>
+          </xsl:if>
+          <xsl:if test="monogr/editor">
+            <person-group person-group-type="editor">
+              <xsl:for-each select="monogr/editor/name">
+                <name>
+                  <surname><xsl:apply-templates select="surname" /></surname>
+                  <given-names><xsl:apply-templates select="forename" /></given-names>
+                </name>
+              </xsl:for-each>
+            </person-group>
+            <xsl:if test="edition">
+              <edition><xsl:value-of select="edition" /></edition>  
+            </xsl:if>
+          </xsl:if>
+          
+<!-- In TEI, idno elements are used for a variety of tasks. -->
+          <xsl:for-each select="monogr/idno">
+            <xsl:choose>
+              <xsl:when test="@type='ISSN'">
+                <issn><xsl:value-of select="." /></issn>
+              </xsl:when>
+              <xsl:when test="@type='ISBN'">
+                <isbn><xsl:value-of select="." /></isbn>
+              </xsl:when>
+            </xsl:choose>
+          </xsl:for-each>
+          
+<!-- Now we get the publication information from the imprint element. This can 
+     be handled with more conventional one-to-one mapping, so templates will do.-->
+          <xsl:apply-templates select="monogr/imprint" />
+        </xsl:if>
+<!-- We should process any respStmt elements in analytic or monogr. -->
+          <xsl:apply-templates select="descendant::respStmt">
+          </xsl:apply-templates>
+      </element-citation>
+    </ref>
+  </xsl:template>
+  
+<!-- These are mini-templates for the content of the imprint element in a 
+biblStruct. -->
+  <xsl:template match="biblStruct/monogr/imprint">
+    <xsl:apply-templates />
+  </xsl:template>
+  
+  <xsl:template match="publisher">
+    <publisher-name><xsl:apply-templates /></publisher-name>
+  </xsl:template>
+  
+  <xsl:template match="pubPlace">
+    <publisher-loc><xsl:apply-templates /></publisher-loc>
+  </xsl:template>
+  
+  <xsl:template match="biblStruct/monogr/imprint/date">
+    <year><xsl:value-of select="substring(@when, 1, 4)" /></year>
+    <xsl:if test="string-length(@when) gt 6">
+      <month><xsl:value-of select="substring(@when, 6, 2)" /></month>
+      <xsl:if test="string-length(@when) gt 9">
+        <day><xsl:value-of select="substring(@when, 9, 2)" /></day>
+      </xsl:if>
+    </xsl:if>
+  </xsl:template>
+  
+  <xsl:template match="biblStruct/monogr/imprint/biblScope">
+    <xsl:choose>
+      <xsl:when test="@type='vol'">
+        <volume><xsl:value-of select="." /></volume>
+      </xsl:when>
+      <xsl:when test="@type='issue'">
+        <issue><xsl:value-of select="." /></issue>
+      </xsl:when>
+      <xsl:when test="@type='pp'">
+        <fpage><xsl:value-of select="substring-before(., '-')"/></fpage>
+        <lpage><xsl:value-of select="substring-after(., '-')"/></lpage>
+      </xsl:when>
+<!--       ANY MORE??? -->
+      <!--<xsl:when test="@type=''"></xsl:when>
+      <xsl:when test="@type=''"></xsl:when>
+      <xsl:when test="@type=''"></xsl:when>-->
+      <xsl:otherwise><comment><xsl:value-of select="." /></comment></xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  
+  <xsl:template match="biblStruct//note">
+    <comment><xsl:value-of select="." /></comment>
+  </xsl:template>
+  
+  <xsl:template match="respStmt[ancestor::biblStruct]">
+    <person-group person-group-type="{resp}">
+      <xsl:for-each select="name">
+        <name>
+                  <surname><xsl:apply-templates select="surname" /></surname>
+                  <given-names><xsl:apply-templates select="forename" /></given-names>
+                </name>
+      </xsl:for-each>
+    </person-group>
+  </xsl:template>
+  
+<!-- The soCalled element has no analogue in NLM; the best we can do 
+is probably to use style-content, enabling us to include the quotes and
+at the same time explain them. -->
+  <xsl:template match="soCalled">
+    <styled-content style-type="scare quotes" style="::before: content(open-quote); ::after: content(close-quote);">
+      <xsl:apply-templates />
+    </styled-content>
+  </xsl:template>
+  
+<!-- The mentioned tag is similarly difficult, as is the tag element, and term. -->
+  <xsl:template match="mentioned">
+    <styled-content style-type="mentioned" style="font-style: italic;">
+      <xsl:apply-templates />
+    </styled-content>
+  </xsl:template>
+
+  <xsl:template match="tag">
+    <styled-content style-type="XML tag" style="::before: content(&lt;); ::after: content(&gt;); font-family: monospace;">
+      <xsl:apply-templates />
+    </styled-content>
+  </xsl:template>
+  
+  <xsl:template match="term">
+    <styled-content style-type="term" style="font-style: italic;">
+      <xsl:apply-templates />
+    </styled-content>
+  </xsl:template>
+  
+<!-- Line breaks are equivalent to <break/>, but cannot appear in paragraphs 
+     What nonsense. -->
+  <xsl:template match="lb"><xsl:comment>There should be a line-break here.</xsl:comment></xsl:template>
+  
+<!-- Inline elements. -->
+<!-- There's no standard way to do document titles in the body text in NLM. -->
+  <xsl:template match="title[not(ancestor::biblStruct) and not(ancestor::teiHeader)]">
+    <named-content content-type="title_level_{@level}">
+<!-- That takes care of identifying the title type. Now we might as well 
+have a shot at styling it. -->
+      <xsl:choose>
+        <xsl:when test="@level='m' or @level='j'">
+          <italic><xsl:apply-templates /></italic>
+        </xsl:when>
+        <xsl:when test="@level='a'">
+          &quot;<xsl:apply-templates />&quot;
+        </xsl:when>
+      </xsl:choose>
+    </named-content>  
+  </xsl:template>
+  
+<!--  Text style markup. -->
+<!--  Bold. -->
+  <xsl:template match="hi[@rend='bold']">
+    <xsl:element name="bold"><xsl:apply-templates /></xsl:element>
+  </xsl:template>
+<!--  Italics. -->
+  <xsl:template match="hi[@rend='italic']">
+    <xsl:element name="italic"><xsl:apply-templates /></xsl:element>
+  </xsl:template> 
+<!--  Underline. -->
+  <xsl:template match="hi[@rend='underline']">
+    <xsl:element name="underline"><xsl:apply-templates /></xsl:element>
+  </xsl:template>
+<!--  Overline. -->
+  <xsl:template match="hi[@rend='overline']">
+    <xsl:element name="overline"><xsl:apply-templates /></xsl:element>
+  </xsl:template>
+
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/nlm/tei_to_nlm.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/nlm/nlm_3_to_nlm_2.3.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/nlm/nlm_3_to_nlm_2.3.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/nlm/nlm_3_to_nlm_2.3.xsl	(revision 258)
@@ -0,0 +1,143 @@
+<?xml version="1.0"?>
+<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="#all">
+
+  <!--
+        Written by Martin Holmes, University of Victoria Humanities Computing and 
+    Media Centre, beginning in 2008.
+    
+    This file is released under the Mozilla Public Licence version 1.1 (MPL 1.1).
+    
+    This transformation is designed to convert NLM 3.0 documents to NLM 2.3;
+    it works only with the subset of NLM 3.0 used by the conversion from teiJournal
+    documents to NLM 3.0.
+    
+    NLM is:
+    
+    The National Center for Biotechnology Information (NCBI) of the National Library of
+    Medicine (NLM) created the Journal Archiving and Interchange Tag Suite.
+    
+    Our source is actually the NLM Journal Publishing Tag Set, described here:
+    
+    http://dtd.nlm.nih.gov/publishing/tag-library/3.0/index.html
+    
+    and the target is the older 2.3 version, described here:
+    
+    http://dtd.nlm.nih.gov/publishing/tag-library/2.3/index.html
+    
+    The reason for creating NLM conversion is that Open Journal Systems has committed 
+    to supporting NLM, so this provides a method of migrating data from teiJournal 
+    to OJS; however, OJS will initially support only NLM 2.3.
+    
+    -->
+  <xsl:output method="xml" doctype-public="-//NLM//DTD Journal Publishing DTD v2.3 20070202//EN" doctype-system="http://dtd.nlm.nih.gov/publishing/2.3/journalpublishing.dtd" xpath-default-namespace="" indent="yes"></xsl:output>
+
+  <xsl:template match="/">
+
+       
+       <xsl:apply-templates></xsl:apply-templates>
+       
+
+  </xsl:template>
+  
+  <!--    Root element needs its article-type attribute massaging a bit. -->
+    <!-- We have an ontology of TEI contribution types; this does not match 
+     NLM at all. In NLM 3.0, the list of article-type values is suggested but 
+     not fixed, so we can use those which are appropriate, and use our own 
+     where there's no match. In 2.3, the list is fixed, so we'd have to convert 
+     all our non-matching ones to "other". -->
+     <xsl:template match="article">
+       <article xmlns:xlink="http://www.w3.org/1999/xlink"
+          xmlns:mml="http://www.w3.org/1998/Math/MathML"
+          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+       <xsl:choose>
+<xsl:when test="@article-type='fiction'">
+  <xsl:attribute name="article-type">other</xsl:attribute>
+</xsl:when>
+<xsl:when test="@article-type='poetry'">
+  <xsl:attribute name="article-type">other</xsl:attribute>
+</xsl:when>
+          <xsl:otherwise><xsl:attribute name="article-type" select="@article-type" /></xsl:otherwise>
+       </xsl:choose>
+         <xsl:apply-templates/>
+       </article>
+     </xsl:template>
+  
+<!-- The 3.0 element-citation is just citation in 2.3. -->
+  <xsl:template match="element-citation">
+    <citation>
+      <xsl:apply-templates />
+    </citation>
+  </xsl:template>
+  
+<!-- The 3.0 element <styled-content> doesn't exist. Each type of content 
+will need to be handled separately. -->
+  <xsl:template match="styled-content[@style-type='scare quotes']">
+    &quot;<xsl:apply-templates/>&quot;
+  </xsl:template>
+    <xsl:template match="styled-content[@style-type='term' or @style-type='mentioned']">
+    <italic><xsl:apply-templates/></italic>
+    </xsl:template>
+    <xsl:template match="styled-content[@style-type='XML tag']">
+    <monospace>&lt;<xsl:apply-templates/>&gt;</monospace>
+  </xsl:template>
+  
+<!-- The @orientation attribute is required in 3.0 and not allowed in 2.3. -->
+  <xsl:template match="@orientation"></xsl:template>
+  
+<!-- @specific-use is not allowed on table-wrap. -->
+  <xsl:template match="table-wrap">
+    <xsl:element name="table-wrap">
+      <xsl:if test="@specific-use">
+        <xsl:attribute name="content-type" select="@specific-use" />
+      </xsl:if>
+      <xsl:apply-templates />
+    </xsl:element>
+  </xsl:template>
+  
+<!-- @specific-use is also not allowed on disp-quote. -->
+  <xsl:template match="disp-quote">
+    <xsl:element name="disp-quote">
+      <xsl:if test="@specific-use">
+        <xsl:attribute name="content-type" select="@specific-use" />
+      </xsl:if>
+      <xsl:apply-templates />
+    </xsl:element>
+  </xsl:template>
+  
+  
+<!-- The person-group/@person-group-type attribute in 2.3 is limited to a 
+fixed list of items.  Some of our types will not do. -->
+  <xsl:template match="person-group">
+    <person-group>
+      <xsl:if test="@person-group-type">
+        <xsl:if test="@person-group-type='allauthors' or 
+                      @person-group-type='assignee' or 
+                      @person-group-type='author' or 
+                      @person-group-type='compiler' or 
+                      @person-group-type='director' or 
+                      @person-group-type='editor' or 
+                      @person-group-type='guest-editor' or 
+                      @person-group-type='inventor' or 
+                      @person-group-type='transed' or 
+                      @person-group-type='translator'">
+            <xsl:copy-of select="@person-group-type"></xsl:copy-of>
+          </xsl:if>
+      </xsl:if>
+      <xsl:apply-templates />
+    </person-group>
+  </xsl:template>
+  
+<!-- named-content elements cannot occur inside ext-link. -->
+  <xsl:template match="named-content[ancestor::ext-link]">
+    <xsl:value-of select="." />
+  </xsl:template>
+  
+<!--  Lastly, a generic copy-all template with low priority, so that stuff not 
+      handled above is copied to the output. -->
+      <xsl:template match="@*|node()|text()|comment()|processing-instruction()" priority="-1">
+        <xsl:copy>
+            <xsl:apply-templates select="@*|node()|text()|comment()|processing-instruction()"/>
+        </xsl:copy>
+    </xsl:template>
+  
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/nlm/nlm_3_to_nlm_2.3.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/epub/epub-preflight.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/epub/epub-preflight.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/epub/epub-preflight.xsl	(revision 258)
@@ -0,0 +1,143 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:iso="http://www.iso.org/ns/1.0" xmlns="http://www.w3.org/1999/xhtml" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:tei="http://www.tei-c.org/ns/1.0" xmlns:teix="http://www.tei-c.org/ns/Examples" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ncx="http://www.daisy.org/z3986/2005/ncx/" version="2.0" exclude-result-prefixes="iso tei teix dc html ncx">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+    <desc>
+      <p>
+	TEI stylesheet for making ePub output, preflight pass to clean
+	up text. 
+      </p>
+      <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+      <p>Author: See AUTHORS</p>
+      <p>Id: $Id: epub-common.xsl 9329 2011-09-20 09:47:43Z rahtz $</p>
+      <p>Copyright: 2008, TEI Consortium</p>
+    </desc>
+  </doc>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>[epub] Local mode to rewrite names of graphics inclusions;
+      default is identity transform
+      </desc>
+  </doc>
+  <xsl:template match="@*|text()|comment()|processing-instruction()" mode="preflight">
+    <xsl:copy-of select="."/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>[epub] Local mode to rewrite names of graphics inclusions;
+      default is identifty transform
+      </desc>
+  </doc>
+  <xsl:template match="*" mode="preflight">
+    <xsl:copy>
+      <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()" mode="preflight"/>
+    </xsl:copy>
+  </xsl:template>
+
+  <xsl:template match="tei:graphic" mode="preflight">
+    <xsl:copy>
+      <xsl:choose>
+        <xsl:when test="$fixgraphicsurl='true'">
+          <xsl:variable name="newName">
+            <xsl:text>media/resource</xsl:text>
+            <xsl:number level="any"/>
+            <xsl:text>.</xsl:text>
+            <xsl:value-of select="tokenize(@url,'\.')[last()]"/>
+          </xsl:variable>
+          <xsl:attribute name="url">
+            <xsl:value-of select="$newName"/>
+          </xsl:attribute>
+          <xsl:copy-of select="@*[not(local-name()='url')]"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:copy-of select="@*"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:copy>
+  </xsl:template>
+  <xsl:template match="tei:pb[@facs]" mode="preflight">
+    <xsl:copy>
+      <xsl:choose>
+	<xsl:when test="@rend='none'">
+          <xsl:copy-of select="@*"/>
+	</xsl:when>
+        <xsl:when test="$fixgraphicsurl='true'">
+          <xsl:variable name="newName">
+            <xsl:text>media/pageimage</xsl:text>
+            <xsl:number level="any"/>
+            <xsl:text>.</xsl:text>
+            <xsl:value-of select="tokenize(@facs,'\.')[last()]"/>
+          </xsl:variable>
+          <xsl:attribute name="facs">
+            <xsl:value-of select="$newName"/>
+          </xsl:attribute>
+          <xsl:copy-of select="@*[not(local-name()='facs')]"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:copy-of select="@*"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:copy>
+  </xsl:template>
+
+  <xsl:template match="tei:hi[tei:pb]" mode="preflight">
+    <xsl:variable name="atts" select="@*"/>
+    <xsl:for-each-group select="node()" group-starting-with="tei:pb|tei:figure">
+        <xsl:choose>
+          <xsl:when test="self::tei:pb">
+	      <tei:pb>
+		<xsl:copy-of select="@*"/>
+	      </tei:pb>
+	      <tei:hi>
+		<xsl:copy-of select="$atts"/>
+		<xsl:copy-of select="current-group() except ."/>
+	      </tei:hi>
+          </xsl:when>
+          <xsl:when test="self::tei:figure">
+	    <xsl:copy-of select="."/>
+	    <tei:hi>
+	      <xsl:copy-of select="$atts"/>
+	      <xsl:copy-of select="current-group() except ."/>
+	    </tei:hi>
+          </xsl:when>
+          <xsl:otherwise>
+	    <tei:hi>
+	      <xsl:copy-of select="$atts"/>
+	      <xsl:copy-of select="current-group()"/>
+	    </tei:hi>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:for-each-group>
+
+  </xsl:template>
+
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/epub/epub-preflight.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/epub/epub-common.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/epub/epub-common.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/epub/epub-common.xsl	(revision 258)
@@ -0,0 +1,505 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:iso="http://www.iso.org/ns/1.0" xmlns="http://www.w3.org/1999/xhtml" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:tei="http://www.tei-c.org/ns/1.0" xmlns:teix="http://www.tei-c.org/ns/Examples" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ncx="http://www.daisy.org/z3986/2005/ncx/" version="2.0" exclude-result-prefixes="iso tei teix dc html ncx">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+    <desc>
+      <p>
+	TEI stylesheet for making ePub output. 
+      </p>
+      <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+      <p>Author: See AUTHORS</p>
+      <p>Id: $Id: epub-common.xsl 10057 2012-01-21 16:57:14Z rahtz $</p>
+      <p>Copyright: 2008, TEI Consortium</p>
+    </desc>
+  </doc>
+  <xsl:key match="tei:graphic[not(ancestor::teix:egXML)]" use="1" name="G"/>
+  <xsl:key name="GRAPHICS" use="1" match="tei:graphic"/>
+  <xsl:key name="PBGRAPHICS" use="1" match="tei:pb[@facs and not(@rend='none')]"/>
+  <xsl:key name="Timeline" match="tei:timeline" use="1"/>
+  <xsl:key name="Object" match="tei:when" use="substring(@corresp,2)"/>
+  <xsl:key name="objectOnPage" match="tei:*[@xml:id]" use="generate-id(preceding::tei:pb[1])"/>
+
+  <xsl:param name="javascriptFiles"/>
+  <xsl:param name="epubMimetype">application/epub+zip</xsl:param>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>[epub] Suppress normal page footer      </desc>
+  </doc>
+  <xsl:template name="stdfooter">
+    <xsl:param name="file"/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>[epub] Set licence</desc>
+  </doc>
+  <xsl:template name="generateLicence">
+    <xsl:text>Creative Commons Attribution</xsl:text>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>[epub] Set language</desc>
+  </doc>
+  <xsl:template name="generateLanguage">
+    <xsl:choose>
+      <xsl:when test="@xml:lang">
+        <xsl:value-of select="@xml:lang"/>
+      </xsl:when>
+      <xsl:when test="tei:text/@xml:lang">
+        <xsl:value-of select="tei:text/@xml:lang"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:text>en</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>[epub] Set subject</desc>
+  </doc>
+  <xsl:template name="generateSubject">
+    <xsl:if test="not($subject='')">
+      <dc:subject>
+        <xsl:value-of select="$subject"/>
+      </dc:subject>
+    </xsl:if>
+    <xsl:call-template name="generateSubjectHook"/>
+    <xsl:for-each select="tei:teiHeader/tei:profileDesc/tei:textClass/tei:keywords/tei:term">
+      <dc:subject>
+        <xsl:value-of select="."/>
+      </dc:subject>
+    </xsl:for-each>
+    <xsl:for-each select="tei:teiHeader/tei:profileDesc/tei:textClass/tei:keywords/tei:list/tei:item">
+      <dc:subject>
+        <xsl:value-of select="."/>
+      </dc:subject>
+    </xsl:for-each>
+  </xsl:template>
+
+  <xsl:template name="generateSubjectHook"/>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>[epub] Set name of publisher</desc>
+  </doc>
+  <xsl:template name="generatePublisher">
+    <xsl:choose>
+      <xsl:when test="not($publisher='')">
+        <xsl:value-of select="$publisher"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="normalize-space(ancestor-or-self::tei:TEI/tei:teiHeader/tei:fileDesc/tei:publicationStmt)"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>[epub] Set unique identifier for output
+      </desc>
+  </doc>
+  <xsl:template name="generateID">
+    <xsl:choose>
+      <xsl:when test="not($uid='')">
+        <xsl:value-of select="$uid"/>
+      </xsl:when>
+      <xsl:when test="tei:teiHeader/tei:fileDesc/tei:publicationStmt/tei:idno">
+        <xsl:value-of select="tei:teiHeader/tei:fileDesc/tei:publicationStmt/tei:idno[1]"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:text>http://www.example.com/TEIEPUB/</xsl:text>
+        <xsl:value-of select="format-dateTime(current-dateTime(),'[Y][M02][D02][H02][m02][s02]')"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>[epub] Add specific linebreak in verbatim output, as
+      readers do not seem to grok the CSS
+      </desc>
+  </doc>
+  <xsl:template name="verbatim-lineBreak">
+    <xsl:param name="id"/>
+    <br/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>[epub] Remove unwanted things from CSS
+      </desc>
+  </doc>
+  <xsl:template name="purgeCSS">
+    <xsl:choose>
+      <xsl:when test="contains(.,'line-height:')"/>
+      <xsl:when test="contains(.,'max-width:')"/>
+      <xsl:when test="contains(.,'height:')"/>
+      <!--
+      <xsl:when test="contains(.,'clear:')"/>
+      <xsl:when test="contains(.,'padding')"/>
+      <xsl:when test="contains(.,'float:')"/>
+      <xsl:when test="contains(.,'font-size:')"/>
+      <xsl:when test="contains(.,'width:')"/>
+      <xsl:when test="contains(.,'margin')"/>
+      <xsl:when test="contains(.,'border')"/>
+-->
+      <xsl:otherwise>
+        <xsl:value-of select="."/>
+        <xsl:text>&#10;</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <xsl:template name="addLangAtt"/>
+
+  <xsl:template match="tei:lb[@rend='space']">
+    <xsl:text> </xsl:text>
+  </xsl:template>
+
+  <xsl:template match="tei:milestone[@unit='line']">
+    <xsl:text> </xsl:text>
+  </xsl:template>
+
+  <xsl:template match="tei:titleStmt" mode="metadata">
+    <h3>Title statement</h3>
+    <xsl:apply-templates mode="metadata"/>
+  </xsl:template>
+  <xsl:template match="tei:editionStmt" mode="metadata">
+    <h3>Edition statement</h3>
+    <xsl:apply-templates mode="metadata"/>
+  </xsl:template>
+  <xsl:template match="tei:publicationStmt" mode="metadata">
+    <h3>Publication</h3>
+    <xsl:choose>
+      <xsl:when test="tei:p">
+        <xsl:apply-templates/>
+      </xsl:when>
+      <xsl:otherwise>
+        <dl>
+          <xsl:apply-templates mode="metadata"/>
+        </dl>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <xsl:template match="tei:seriesStmt" mode="metadata">
+    <h3>Series</h3>
+    <xsl:apply-templates mode="metadata"/>
+  </xsl:template>
+  <xsl:template match="tei:notesStmt" mode="metadata">
+    <h3>Notes</h3>
+    <xsl:apply-templates mode="metadata"/>
+  </xsl:template>
+  <xsl:template match="tei:sourceDesc" mode="metadata">
+    <h3>Source</h3>
+    <xsl:apply-templates mode="metadata"/>
+  </xsl:template>
+
+  <xsl:template match="tei:projectDesc" mode="metadata">
+    <h3>Creation</h3>
+    <xsl:apply-templates mode="metadata"/>
+  </xsl:template>
+
+  <xsl:template match="tei:editorialDecl" mode="metadata">
+    <h3>Editorial practices</h3>
+    <xsl:apply-templates mode="metadata"/>
+  </xsl:template>
+
+  <xsl:template match="tei:sourceDesc/tei:bibl" mode="metadata">
+    <p> — <xsl:apply-templates mode="metadata"/></p>
+  </xsl:template>
+  <xsl:template match="tei:sourceDesc/tei:biblFull" mode="metadata">
+    <div> — <xsl:apply-templates/></div>
+  </xsl:template>
+  <xsl:template match="tei:respStmt" mode="metadata">
+    <p><i><xsl:value-of select="tei:resp"/></i>:
+      <xsl:value-of select="tei:name"/></p>
+  </xsl:template>
+
+  <xsl:template match="tei:list" mode="metadata">
+    <ul>
+      <xsl:apply-templates mode="metadata"/>
+    </ul>
+  </xsl:template>
+  <xsl:template match="tei:item" mode="metadata">
+    <li>
+      <xsl:apply-templates mode="metadata"/>
+    </li>
+  </xsl:template>
+  <xsl:template match="tei:relatedItem[@target]" mode="metadata" priority="10">
+    <a href="{@target}">
+      <xsl:value-of select="@target"/>
+    </a>
+  </xsl:template>
+  <xsl:template match="tei:extent" mode="metadata"/>
+  <xsl:template match="tei:authority" mode="metadata">
+    <dt>Authority</dt>
+    <dd>
+      <xsl:apply-templates/>
+    </dd>
+  </xsl:template>
+  <xsl:template match="tei:publicationStmt/tei:address" mode="metadata">
+    <dt>Address</dt>
+    <dd>
+      <xsl:apply-templates/>
+    </dd>
+  </xsl:template>
+  <xsl:template match="tei:publicationStmt/tei:publisher" mode="metadata">
+    <dt>Publisher</dt>
+    <dd>
+      <xsl:apply-templates/>
+    </dd>
+  </xsl:template>
+  <xsl:template match="tei:publicationStmt/tei:pubPlace" mode="metadata">
+    <dt>Place of publication</dt>
+    <dd>
+      <xsl:apply-templates/>
+    </dd>
+  </xsl:template>
+  <xsl:template match="tei:distributor" mode="metadata">
+    <dt>Distributor</dt>
+    <dd>
+      <xsl:apply-templates/>
+    </dd>
+  </xsl:template>
+  <xsl:template match="tei:editor" mode="metadata">
+    <p><i>Editor</i>: 
+    <xsl:apply-templates/></p>
+  </xsl:template>
+  <xsl:template match="tei:funder" mode="metadata">
+    <p><i>Funder</i>: 
+    <xsl:apply-templates/></p>
+  </xsl:template>
+  <xsl:template match="tei:idno" mode="metadata">
+    <dt>ID [<xsl:value-of select="@type|@iso:meta"/>]</dt>
+    <dd>
+      <xsl:apply-templates/>
+    </dd>
+  </xsl:template>
+  <xsl:template match="tei:availability[not(@n) and preceding-sibling::tei:availability/@n]" mode="metadata"/>
+  <xsl:template match="tei:availability" mode="metadata">
+    <dt>Availability</dt>
+    <dd>
+      <xsl:apply-templates mode="metadata"/>
+    </dd>
+  </xsl:template>
+
+  <xsl:template match="tei:licence" mode="metadata">
+    <div>
+      <xsl:apply-templates/>
+    </div>
+  </xsl:template>
+
+  <xsl:template match="tei:bibl/tei:title" mode="metadata" priority="99">
+    <i>
+      <xsl:apply-templates/>
+    </i>
+  </xsl:template>
+  <xsl:template match="tei:date" mode="metadata">
+    <dt>Date</dt>
+    <dd>
+      <xsl:apply-templates/>
+    </dd>
+  </xsl:template>
+  <xsl:template match="tei:bibl/tei:date" mode="metadata"
+		priority="99">
+    <i>Date</i>:     <xsl:apply-templates/>
+  </xsl:template>
+  <xsl:template match="tei:note" mode="metadata">
+    <xsl:text> [</xsl:text>
+    <xsl:apply-templates/>
+    <xsl:text>] </xsl:text>
+  </xsl:template>
+  <xsl:template match="tei:notesStmt/tei:note" mode="metadata" priority="99">
+    <xsl:choose>
+      <xsl:when test="tei:p">
+        <xsl:apply-templates/>
+      </xsl:when>
+      <xsl:otherwise>
+        <p>
+          <xsl:apply-templates/>
+        </p>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <xsl:template match="tei:listPerson" mode="metadata">
+    <ul>
+      <xsl:apply-templates/>
+    </ul>
+  </xsl:template>
+  <!-- fallbacks -->
+  <xsl:template match="tei:sourceDesc/tei:bibl/*" mode="metadata">
+    <xsl:value-of select="."/>
+  </xsl:template>
+  <xsl:template match="*" mode="metadata">
+    <xsl:choose>
+      <xsl:when test="tei:p">
+	  <xsl:apply-templates/>
+      </xsl:when>
+      <xsl:otherwise>
+	<p>
+	  <xsl:apply-templates/>
+	</p>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <xsl:template match="tei:seriesStmt/tei:p">
+    <xsl:apply-templates/>
+  </xsl:template>
+  <xsl:template match="tei:distributor/tei:name">
+    <xsl:apply-templates/>
+    <br/>
+  </xsl:template>
+  <xsl:template match="tei:distributor/tei:address">
+    <xsl:apply-templates/>
+  </xsl:template>
+  <xsl:template match="tei:authority/tei:address">
+    <br/>
+    <xsl:apply-templates/>
+  </xsl:template>
+  <xsl:template match="tei:authority/tei:addrLine">
+    <xsl:apply-templates/>
+    <br/>
+  </xsl:template>
+  <xsl:template match="tei:title[@type='uniform']"/>
+  <xsl:template match="tei:editionStmt/tei:p">
+    <xsl:apply-templates/>
+  </xsl:template>
+  <xsl:template match="tei:editor">
+    <xsl:apply-templates/>
+    <xsl:text> (editor)</xsl:text>
+  </xsl:template>
+  <xsl:template match="tei:title[@type='main']">
+    <i>
+      <xsl:apply-templates/>
+    </i>
+  </xsl:template>
+  <xsl:template match="tei:title[@type='alternative']">
+    <xsl:apply-templates/>
+    <xsl:text> (alternative title)</xsl:text>
+  </xsl:template>
+
+  <xsl:template name="autoMakeHead">
+    <xsl:param name="display"/>
+    <xsl:choose>
+      <xsl:when test="tei:head and $display='full'">
+        <xsl:apply-templates select="tei:head" mode="makeheading"/>
+      </xsl:when>
+      <xsl:when test="tei:head">
+        <xsl:apply-templates select="tei:head" mode="plain"/>
+      </xsl:when>
+      <xsl:when test="tei:front/tei:head">
+        <xsl:apply-templates select="tei:front/tei:head" mode="plain"/>
+      </xsl:when>
+      <xsl:when test="@n">
+        <xsl:value-of select="@n"/>
+      </xsl:when>
+      <xsl:when test="@type">
+	<xsl:text>[</xsl:text>
+        <xsl:value-of select="@type"/>
+	<xsl:text>]</xsl:text>
+      </xsl:when>
+      <xsl:otherwise>&#160;</xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="generateDate">
+    <xsl:choose>
+      <xsl:when test="$useHeaderFrontMatter='true' and ancestor-or-self::tei:TEI/tei:text/tei:front//tei:docDate[@when]">
+        <xsl:apply-templates mode="date" select="ancestor-or-self::tei:TEI/tei:text/tei:front//tei:docDate/@when"/>
+      </xsl:when>
+      <xsl:when test="ancestor-or-self::tei:TEI/tei:teiHeader/tei:fileDesc/tei:editionStmt/descendant::tei:date[@when]">
+        <xsl:apply-templates select="ancestor-or-self::tei:TEI/tei:teiHeader/tei:fileDesc/tei:editionStmt/descendant::tei:date[1]/@when"/>
+      </xsl:when>
+      <xsl:when test="ancestor-or-self::tei:TEI/tei:teiHeader/tei:fileDesc/tei:publicationStmt/tei:date[@when]">
+        <xsl:apply-templates select="ancestor-or-self::tei:TEI/tei:teiHeader/tei:fileDesc/tei:publicationStmt/tei:date/@when"/>
+      </xsl:when>
+      <xsl:otherwise>
+	<xsl:value-of select="format-dateTime(current-dateTime(),'[Y]-[M02]-[D02]')"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <!-- its inserted explicitly -->
+  <xsl:template match="tei:front/tei:titlePage"/>
+
+  <xsl:template match="html:li">
+    <xsl:choose>
+      <xsl:when test="not(html:a)"/>
+      <xsl:when test="starts-with(html:a/@href,'#')"/>
+      <xsl:when test="contains(@class,'headless')"/>
+      <xsl:when test="html:a/@href=preceding-sibling::html:li/html:a/@href"/>
+      <xsl:otherwise>
+        <navPoint xmlns="http://www.daisy.org/z3986/2005/ncx/">
+          <navLabel>
+            <text>
+              <xsl:value-of select="html:span[@class='headingNumber']"/>
+              <xsl:value-of select="normalize-space(html:a[1])"/>
+            </text>
+          </navLabel>
+          <content src="{html:a/@href}"/>
+        </navPoint>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="javascriptHook">
+    <xsl:for-each select="tokenize($javascriptFiles,',')">
+      <xsl:variable name="name" select="tokenize(normalize-space(.),'/')[last()]"/>
+      <script type="text/javascript" src="{$name}">
+        <xsl:comment>JS library</xsl:comment>
+      </script>
+    </xsl:for-each>
+  </xsl:template>
+
+  <xsl:template name="epubSpineHook"/>
+  <xsl:template name="epubManifestHook"/>
+  <xsl:template name="processTEIHook"/>
+
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>[epub] Override addition of CSS links. We force a simple
+      name of "stylesheet.css"
+      </desc>
+  </doc>
+  <xsl:template name="includeCSS">
+    <xsl:call-template name="linkCSS">
+      <xsl:with-param name="file">stylesheet.css</xsl:with-param>
+    </xsl:call-template>
+    <xsl:if test="not($cssPrintFile='')">
+      <xsl:call-template name="linkCSS">
+	<xsl:with-param name="file">print.css</xsl:with-param>
+	<xsl:with-param name="media">print</xsl:with-param>
+      </xsl:call-template>
+    </xsl:if>
+    <xsl:call-template name="generateLocalCSS"/>
+  </xsl:template>
+
+  <xsl:template name="linkCSS">
+    <xsl:param name="file"/>
+    <xsl:param name="media"/>
+    <link xmlns="http://www.w3.org/1999/xhtml" href="{$file}"
+	  rel="stylesheet" type="text/css">
+      <xsl:if test="not($media='')">
+	<xsl:attribute name="media" select="$media"/>
+      </xsl:if>
+    </link>
+  </xsl:template>
+
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/epub/epub-common.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/epub/build-to.xml
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/epub/build-to.xml	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/epub/build-to.xml	(revision 258)
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<project basedir="." default="dist" name="teitoepub">
+<!--
+	This library is free software; you can redistribute it and/or
+	modify it under the terms of the GNU Lesser General Public
+	License as published by the Free Software Foundation; either
+	version 2.1 of the License, or (at your option) any later version.
+	
+	This library 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
+	Lesser General Public License for more details.
+	
+	You should have received a copy of the GNU Lesser General Public
+	License along with this library; if not, write to the Free Software
+	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+	
+        Id: $Id: build-to.xml 10055 2012-01-20 18:46:11Z rahtz $
+        Copyright: 2011, TEI Consortium<
+-->
+  <!--
+ Convert TEI documents into ePUB files.
+ -->
+  <!-- Path to TEI XML file. -->
+  <property name="inputFile" value=""/>
+  <!-- Path where the output ePUB file will be saved. -->
+  <property name="outputFile" value=""/>
+  <!-- which profile -->
+  <property name="profile" value="default"/>
+  <!-- where does oxygen keep stuff -->
+  <property name="oxygenlib" value=""/>
+  <!-- Stylesheet for transformation -->
+  <property name="stylesheetFile"
+	    value="../profiles/${profile}/epub/to.xsl"/>
+  <property name="listgraphics" value="../tools/makegraphicsanttask.xsl"/>
+  <dirname property="inputFileDir" file="${inputFile}"/>
+  <dirname property="outputDir" file="${outputFile}"/>
+  <property name="outputTempDir" value="${outputDir}/temp-dir-for-ant"/>
+  <path id="classpath">
+    <pathelement path="${java.class.path}"/>
+  </path>
+  <import file="../odds2/build-to.xml"/>
+  <target name="setup">
+    <delete dir="${outputTempDir}"/>
+    <mkdir dir="${outputTempDir}"/>
+  </target>
+  <target name="dist" depends="setup,odd,notodd,convert,cleanup"/>
+
+  <target name="convert">
+    <!-- Recreate temporary output directory -->
+    <!-- The transformation for EPUB output. -->
+    <echo level="info">XSLT generate ePub files</echo>
+    <xslt force="yes" style="${stylesheetFile}" in="${outputTempDir}/tmp2.xml" out="${outputTempDir}/OPS/index.html" classpath="classpath">
+      <xmlcatalog>
+        <catalogpath>
+          <pathelement location="../../../../catalog.xml"/>
+          <pathelement location="../../../../../xhtml11/dtd/xhtmlcatalog.xml"/>
+        </catalogpath>
+      </xmlcatalog>
+      <factory name="net.sf.saxon.TransformerFactoryImpl"/>
+      <classpath location="${oxygenlib}/saxon9ee.jar"/>
+      <param name="directory" expression="file:///${outputTempDir}"/>
+      <param name="inputDir" expression="${inputFileDir}/"/>
+      <param name="fixgraphicsurl" expression="true"/>
+      <!-- supply unique URN for ebook-->
+      <param name="uid" expression="${uid}" if="uid"/>
+      <!-- set splitting level-->
+      <param name="splitLevel" expression="${splitLevel}" if="splitLevel"/>
+      <!-- supply name of publisher for ebook-->
+      <param name="publisher" expression="${publisher}" if="publisher"/>
+      <!-- supply subject/category for ebook-->
+      <param name="subject" expression="${subject}" if="subject"/>
+      <!-- supply name of JPEG file for ebook cover-->
+      <param name="coverimage" expression="${coverimage}" if="coverimage"/>
+      <!-- supply name of CSS file-->
+      <param name="cssFile" expression="${cssFile}" if="cssFile"/>
+      <!-- name of media overlay file -->
+      <param name="mediaoverlay" expression="${mediaoverlay}" if="mediaoverlay"/>
+      <!-- file per page -->
+      <param name="filePerPage" expression="${filePerPage}" if="filePerPage"/>
+      <!-- epub viewport -->
+      <param name="viewPortHeight" expression="${viewPortHeight}" if="viewPortHeight"/>
+      <param name="viewPortWidth" expression="${viewPortWidth}" if="viewPortWidth"/>
+      <!-- supply name of language-->
+      <param name="lang" expression="${lang}" if="lang"/>
+      <!-- emit some diagnostics"-->
+      <param name="debug" expression="${debug}" if="debug"/>
+      <!-- be verbose-->
+      <param name="verbose" expression="${verbose}" if="verbose"/>
+      <!-- disable compression on the output ZIP -->
+      <param name="nocompress" expression="${nocompress}" if="nocompress"/>
+    </xslt>
+    <echo level="info">Get names of graphics files and write an ant task</echo>
+    <xslt force="yes" style="${listgraphics}" classpath="classpath" in="${outputTempDir}/tmp2.xml" out="${outputTempDir}/copy.xml">
+      <xmlcatalog>
+        <catalogpath>
+          <pathelement location="../../../../catalog.xml"/>
+          <pathelement location="../../../../../xhtml11/dtd/xhtmlcatalog.xml"/>
+        </catalogpath>
+      </xmlcatalog>
+      <factory name="net.sf.saxon.TransformerFactoryImpl"/>
+      <classpath location="${oxygenlib}/saxon9ee.jar"/>
+      <param name="inputDir" expression="${inputFileDir}"/>
+      <param name="mediaDir" expression="OPS/media"/>
+      <param name="mediaoverlay" expression="${mediaoverlay}" if="mediaoverlay"/>
+      <param name="filePerPage" expression="${filePerPage}" if="filePerPage"/>
+    </xslt>
+    <echo level="info">Copy image files</echo>
+    <ant antfile="${outputTempDir}/copy.xml"/>
+    <echo level="info">ZIP: put files from ${outputTempDir} together into ${outputFile}</echo>
+    <delete file="${outputFile}"/>
+    <zip destfile="${outputFile}" basedir="${outputTempDir}"
+	 compress="true" excludes="mimetype,tmp1.xml,tmp2.xml,copy.xml"/>
+    <zip destfile="${outputFile}" basedir="${outputTempDir}" includes="mimetype" update="true" keepcompression="true" compress="false"/>
+  </target>
+
+  <target name="cleanup" unless="debug">  
+    <delete dir="${outputTempDir}"/>
+  </target>
+</project>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/epub/build-to.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/epub/tei-to-epub.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/epub/tei-to-epub.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/epub/tei-to-epub.xsl	(revision 258)
@@ -0,0 +1,904 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:smil="http://www.w3.org/ns/SMIL" xmlns:opf="http://www.idpf.org/2007/opf" xmlns:iso="http://www.iso.org/ns/1.0" xmlns="http://www.w3.org/1999/xhtml" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:tei="http://www.tei-c.org/ns/1.0" xmlns:teix="http://www.tei-c.org/ns/Examples" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ncx="http://www.daisy.org/z3986/2005/ncx/" version="2.0" exclude-result-prefixes="iso tei teix dc              html opf ncx smil">
+  <xsl:import href="../xhtml2/tei.xsl"/>
+  <xsl:import href="epub-common.xsl"/>
+  <xsl:import href="epub-preflight.xsl"/>
+  <xsl:output method="xml" encoding="utf-8" indent="no"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+    <desc>
+      <p>
+	TEI stylesheet for making ePub output. A lot learnt from
+	http://www.hxa.name/articles/content/epub-guide_hxa7241_2007.html and
+	the stylesheets of the NZETC.
+      </p>
+      <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+      <p>Author: See AUTHORS</p>
+      <p>Id: $Id: tei-to-epub.xsl 10057 2012-01-21 16:57:14Z rahtz $</p>
+      <p>Copyright: 2008, TEI Consortium</p>
+    </desc>
+  </doc>
+  <xsl:param name="STDOUT">false</xsl:param>
+  <xsl:param name="autoHead">true</xsl:param>
+  <xsl:param name="autoToc">true</xsl:param>
+  <xsl:param name="bottomNavigationPanel">false</xsl:param>
+  <xsl:param name="coverimage"/>
+  <xsl:param name="createanttask">false</xsl:param>
+  <xsl:param name="cssFile">../tei.css</xsl:param>
+  <xsl:param name="cssODDFile">../odd.css</xsl:param>
+  <xsl:param name="cssPrintFile">../epub-print.css</xsl:param>
+  <xsl:param name="debug">false</xsl:param>
+  <xsl:param name="directory">.</xsl:param>
+  <xsl:param name="doctypePublic">-//W3C//DTD XHTML 1.1//EN</xsl:param>
+  <xsl:param name="doctypeSystem">http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd</xsl:param>
+  <xsl:param name="fixgraphicsurl">false</xsl:param>
+  <xsl:param name="footnoteBackLink">true</xsl:param>
+  <xsl:param name="inputDir">.</xsl:param>
+  <xsl:param name="institution"/>
+  <xsl:param name="linkPanel">false</xsl:param>
+  <xsl:param name="odd">false</xsl:param>
+  <xsl:param name="outputDir"><xsl:value-of select="$directory"/>/OPS</xsl:param>
+  <xsl:param name="outputTarget">epub</xsl:param>
+  <xsl:param name="publisher"/>
+  <xsl:param name="splitLevel">0</xsl:param>
+  <xsl:param name="subject"/>
+  <xsl:param name="tocDepth">5</xsl:param>
+  <xsl:param name="tocFront">true</xsl:param>
+  <xsl:param name="topNavigationPanel">false</xsl:param>
+  <xsl:param name="uid"/>
+  <xsl:param name="useHeaderFrontMatter">false</xsl:param>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>(extensible) wrapper for root element</desc>
+  </doc>
+  <xsl:template match="/">
+    <xsl:call-template name="processTEI"/>
+  </xsl:template>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>[epub] Override of top-level template. This does most of
+  the work: performing the normal transformation, fixing the links to graphics files so that they are
+  all relative, creating the extra output files, etc</desc>
+  </doc>
+  <xsl:template name="processTEI">
+    <xsl:variable name="stage1">
+      <xsl:apply-templates mode="preflight"/>
+    </xsl:variable>
+    <xsl:for-each select="$stage1">
+      <xsl:call-template name="processTEIHook"/>
+      <xsl:variable name="coverImageOutside">
+        <xsl:choose>
+          <xsl:when test="/tei:TEI/tei:text/tei:front/tei:titlePage[@facs]">
+            <xsl:for-each select="/tei:TEI/tei:text/tei:front/tei:titlePage[@facs][1]">
+              <xsl:for-each select="id(substring(@facs,2))">
+                <xsl:choose>
+                  <xsl:when test="count(tei:graphic)=1">
+                    <xsl:value-of select="tei:graphic/@url"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                    <xsl:value-of select="tei:graphic[2]/@url"/>
+                  </xsl:otherwise>
+                </xsl:choose>
+              </xsl:for-each>
+            </xsl:for-each>
+          </xsl:when>
+          <xsl:when test="not($coverimage='')">
+            <xsl:value-of select="$coverimage"/>
+          </xsl:when>
+        </xsl:choose>
+      </xsl:variable>
+      <xsl:variable name="coverImageInside">
+        <xsl:choose>
+          <xsl:when test="/tei:TEI/tei:text/tei:front/tei:titlePage[@facs]">
+            <xsl:for-each select="/tei:TEI/tei:text/tei:front/tei:titlePage[@facs][1]">
+              <xsl:for-each select="id(substring(@facs,2))">
+                <xsl:value-of select="tei:graphic[1]/@url"/>
+              </xsl:for-each>
+            </xsl:for-each>
+          </xsl:when>
+          <xsl:when test="not($coverimage='')">
+            <xsl:value-of select="$coverimage"/>
+          </xsl:when>
+        </xsl:choose>
+      </xsl:variable>
+      <xsl:choose>
+        <xsl:when test="$splitLevel='-1'">
+          <xsl:apply-templates/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:apply-templates mode="split"/>
+        </xsl:otherwise>
+      </xsl:choose>
+      <xsl:for-each select="*">
+        <xsl:variable name="TOC">
+          <TOC xmlns="http://www.w3.org/1999/xhtml">
+            <xsl:call-template name="mainTOC"/>
+          </TOC>
+        </xsl:variable>
+        <!--
+	    <xsl:result-document href="/tmp/TOC">
+	    <xsl:copy-of select="$TOC"/>
+	    </xsl:result-document>
+-->
+        <xsl:for-each select="tokenize($javascriptFiles,',')">
+          <xsl:variable name="file" select="normalize-space(.)"/>
+          <xsl:variable name="name" select="tokenize($file,'/')[last()]"/>
+          <xsl:if test="$verbose='true'">
+            <xsl:message>write Javascript file <xsl:value-of select="$name"/></xsl:message>
+          </xsl:if>
+          <xsl:result-document method="text" href="{concat($directory,'/OPS/',$name)}">
+            <xsl:for-each select="unparsed-text($file)">
+              <xsl:copy-of select="."/>
+            </xsl:for-each>
+          </xsl:result-document>
+        </xsl:for-each>
+        <xsl:if test="$verbose='true'">
+          <xsl:message>write file OPS/stylesheet.css</xsl:message>
+        </xsl:if>
+        <xsl:result-document method="text" href="{concat($directory,'/OPS/stylesheet.css')}">
+          <xsl:if test="not($cssFile='')">
+            <xsl:if test="$verbose='true'">
+              <xsl:message>reading file <xsl:value-of select="$cssFile"/></xsl:message>
+            </xsl:if>
+            <xsl:for-each select="tokenize(unparsed-text($cssFile),     '\r?\n')">
+              <xsl:call-template name="purgeCSS"/>
+            </xsl:for-each>
+          </xsl:if>
+          <xsl:if test="not($cssSecondaryFile='')">
+            <xsl:if test="$verbose='true'">
+              <xsl:message>reading secondary file <xsl:value-of select="$cssSecondaryFile"/></xsl:message>
+            </xsl:if>
+            <xsl:for-each select="tokenize(unparsed-text($cssSecondaryFile),       '\r?\n')">
+              <xsl:call-template name="purgeCSS"/>
+            </xsl:for-each>
+          </xsl:if>
+          <xsl:if test="$odd='true'">
+            <xsl:if test="$verbose='true'">
+              <xsl:message>reading file <xsl:value-of select="$cssODDFile"/></xsl:message>
+            </xsl:if>
+            <xsl:for-each select="tokenize(unparsed-text($cssODDFile),         '\r?\n')">
+              <xsl:call-template name="purgeCSS"/>
+            </xsl:for-each>
+          </xsl:if>
+          <xsl:if test="$odd='true'">
+            <xsl:if test="$verbose='true'">
+              <xsl:message>reading file <xsl:value-of select="$cssODDFile"/></xsl:message>
+            </xsl:if>
+            <xsl:for-each select="tokenize(unparsed-text($cssODDFile),         '\r?\n')">
+              <xsl:call-template name="purgeCSS"/>
+            </xsl:for-each>
+          </xsl:if>
+          <xsl:if test="$filePerPage='true'">
+            <xsl:text>body { width: </xsl:text>
+            <xsl:value-of select="$viewPortWidth"/>
+            <xsl:text>px;
+ height: </xsl:text>
+            <xsl:value-of select="$viewPortHeight"/>
+            <xsl:text>px;
+}
+img.fullpage {
+position: absolute;
+height: </xsl:text>
+            <xsl:value-of select="$viewPortHeight"/>
+            <xsl:text>px; left:0px; top:0px;}
+</xsl:text>
+          </xsl:if>
+        </xsl:result-document>
+        <xsl:if test="$verbose='true'">
+          <xsl:message>write file OPS/print.css</xsl:message>
+        </xsl:if>
+        <xsl:result-document method="text" href="{concat($directory,'/OPS/print.css')}">
+          <xsl:if test="$verbose='true'">
+            <xsl:message>reading file <xsl:value-of select="$cssPrintFile"/></xsl:message>
+          </xsl:if>
+          <xsl:for-each select="tokenize(unparsed-text($cssPrintFile),     '\r?\n')">
+            <xsl:call-template name="purgeCSS"/>
+          </xsl:for-each>
+        </xsl:result-document>
+        <xsl:if test="$verbose='true'">
+          <xsl:message>write file mimetype</xsl:message>
+        </xsl:if>
+        <xsl:result-document method="text" href="{concat($directory,'/mimetype')}">
+          <xsl:value-of select="$epubMimetype"/>
+        </xsl:result-document>
+        <xsl:if test="$verbose='true'">
+          <xsl:message>write file META-INF/container.xml</xsl:message>
+        </xsl:if>
+        <xsl:result-document method="xml" href="{concat($directory,'/META-INF/container.xml')}">
+          <container xmlns="urn:oasis:names:tc:opendocument:xmlns:container" version="1.0">
+            <rootfiles>
+              <rootfile full-path="OPS/content.opf" media-type="application/oebps-package+xml"/>
+            </rootfiles>
+          </container>
+        </xsl:result-document>
+        <xsl:if test="$verbose='true'">
+          <xsl:message>write file OPS/content.opf</xsl:message>
+        </xsl:if>
+        <xsl:result-document href="{concat($directory,'/OPS/content.opf')}" method="xml">
+	  <xsl:variable name="A">
+	    <xsl:call-template name="generateAuthor"/>
+	  </xsl:variable>
+	<xsl:variable name="printA">
+	  <xsl:analyze-string select="$A" regex="([^,]+), ([^,]+), (.+)">
+	    <xsl:matching-substring>
+	      <xsl:value-of select="regex-group(1)"/>
+	      <xsl:text>, </xsl:text>
+	      <xsl:value-of select="regex-group(2)"/>
+	    </xsl:matching-substring>
+	    <xsl:non-matching-substring>
+	      <xsl:value-of select="."/>
+	    </xsl:non-matching-substring>
+	  </xsl:analyze-string>
+	</xsl:variable>
+
+          <package xmlns="http://www.idpf.org/2007/opf" unique-identifier="dcidid" version="2.0">
+	    <xsl:call-template name="opfmetadata">
+	      <xsl:with-param name="author" select="$A"/>
+	      <xsl:with-param name="printAuthor" select="$printA"/>
+	      <xsl:with-param name="coverImageOutside" select="$coverImageOutside"/>
+	    </xsl:call-template>
+            <manifest>
+              <!-- deal with intricacies of overlay files -->
+              <xsl:variable name="TL" select="key('Timeline',1)"/>
+              <xsl:if test="$mediaoverlay='true' and        key('Timeline',1)">
+                <xsl:if test="$verbose='true'">
+                  <xsl:message>write file SMIL files</xsl:message>
+                </xsl:if>
+                <xsl:for-each select="key('Timeline',1)">
+                  <xsl:variable name="TLnumber">
+                    <xsl:number level="any"/>
+                  </xsl:variable>
+                  <xsl:variable name="audio">
+                    <xsl:text>media/audio</xsl:text>
+                    <xsl:number level="any"/>
+                    <xsl:text>.</xsl:text>
+                    <xsl:value-of select="tokenize(@corresp,'\.')[last()]"/>
+                  </xsl:variable>
+                  <item id="timeline-audio{$TLnumber}" href="{$audio}">
+                    <xsl:attribute name="media-type">
+                      <xsl:choose>
+                        <xsl:when test="contains($audio,'.m4a')">audio/m4a</xsl:when>
+                        <xsl:otherwise>audio/m4a</xsl:otherwise>
+                      </xsl:choose>
+                    </xsl:attribute>
+                  </item>
+                  <xsl:for-each select="key('PB',1)">
+                    <xsl:variable name="page">
+                      <xsl:value-of select="generate-id()"/>
+                    </xsl:variable>
+                    <xsl:variable name="target">
+                      <xsl:apply-templates select="." mode="ident"/>
+                    </xsl:variable>
+                    <xsl:if test="count(key('objectOnPage',$page))&gt;0">
+                      <item id="{$target}-audio" href="{$target}-overlay.smil" media-type="application/smil+xml"/>
+                      <xsl:result-document href="{concat($directory,'/OPS/',$target,'-overlay.smil')}" method="xml">
+                        <smil xmlns="http://www.w3.org/ns/SMIL" version="3.0" profile="http://www.ipdf.org/epub/30/profile/content/">
+                          <body>
+                            <xsl:for-each select="key('objectOnPage',$page)">
+                              <xsl:variable name="object" select="@xml:id"/>
+                              <xsl:for-each select="$TL">
+                                <xsl:for-each select="key('Object',$object)">
+                                  <par id="{@xml:id}">
+                                    <text src="{$target}.html{@corresp}"/>
+                                    <audio src="{$audio}" clipBegin="{@from}{../@unit}" clipEnd="{@to}{../@unit}"/>
+                                  </par>
+                                </xsl:for-each>
+                              </xsl:for-each>
+                            </xsl:for-each>
+                          </body>
+                        </smil>
+                      </xsl:result-document>
+                    </xsl:if>
+                  </xsl:for-each>
+                </xsl:for-each>
+              </xsl:if>
+              <xsl:if test="not($coverImageOutside='')">
+                <item href="{$coverImageOutside}" id="cover-image" media-type="image/jpeg"/>
+              </xsl:if>
+              <xsl:if test="not($coverimage='') and not($coverimage=$coverImageOutside)">
+                <item href="{$coverimage}" id="cover-image-extra" media-type="image/jpeg"/>
+              </xsl:if>
+              <xsl:for-each select="tokenize($javascriptFiles,',')">
+                <xsl:variable name="name" select="tokenize(normalize-space(.),'/')[last()]"/>
+                <item href="{$name}" id="javascript{position()}" media-type="text/javascript"/>
+              </xsl:for-each>
+              <item href="stylesheet.css" id="css" media-type="text/css"/>
+              <item href="titlepage.html" id="titlepage" media-type="application/xhtml+xml"/>
+              <xsl:if test="$filePerPage='true'">
+                <item href="titlepageverso.html" id="titlepageverso" media-type="application/xhtml+xml"/>
+              </xsl:if>
+              <xsl:for-each select="tei:text/tei:front/tei:titlePage">
+                <xsl:variable name="N" select="position()"/>
+                <item href="titlepage{$N}.html" id="titlepage{$N}" media-type="application/xhtml+xml"/>
+              </xsl:for-each>
+              <item href="titlepageback.html" id="titlepageback" media-type="application/xhtml+xml"/>
+              <item id="print.css" href="print.css" media-type="text/css"/>
+              <item id="apt" href="page-template.xpgt" media-type="application/adobe-page-template+xml"/>
+              <item id="start" href="index.html" media-type="application/xhtml+xml"/>
+              <xsl:choose>
+                <xsl:when test="$filePerPage='true'">
+                  <xsl:for-each select="key('PB',1)">
+                    <xsl:variable name="target">
+                      <xsl:apply-templates select="." mode="ident"/>
+                    </xsl:variable>
+                    <xsl:if test="@facs">
+                      <xsl:variable name="facstarget">
+                        <xsl:apply-templates select="." mode="ident"/>
+                        <xsl:text>-facs.html</xsl:text>
+                      </xsl:variable>
+                      <item href="{$facstarget}" media-type="application/xhtml+xml">
+                        <xsl:attribute name="id">
+                          <xsl:text>pagefacs</xsl:text>
+                          <xsl:number level="any"/>
+                        </xsl:attribute>
+                      </item>
+                    </xsl:if>
+                    <item href="{$target}.html" media-type="application/xhtml+xml">
+                      <xsl:if test="$mediaoverlay='true'">
+                        <xsl:attribute name="media-overlay">
+                          <xsl:value-of select="$target"/>
+                          <xsl:text>-audio</xsl:text>
+                        </xsl:attribute>
+                      </xsl:if>
+                      <xsl:attribute name="id">
+                        <xsl:text>page</xsl:text>
+                        <xsl:number level="any"/>
+                      </xsl:attribute>
+                    </item>
+                  </xsl:for-each>
+                </xsl:when>
+                <xsl:otherwise>
+                  <xsl:for-each select="$TOC/html:TOC/html:ul/html:li">
+                    <xsl:choose>
+                      <xsl:when test="not(html:a)"/>
+                      <xsl:when test="starts-with(html:a/@href,'#')"/>
+                      <xsl:otherwise>
+                        <item href="{html:a[1]/@href}" media-type="application/xhtml+xml">
+                          <xsl:attribute name="id">
+                            <xsl:text>section</xsl:text>
+                            <xsl:number count="html:li" level="any"/>
+                          </xsl:attribute>
+                        </item>
+                      </xsl:otherwise>
+                    </xsl:choose>
+                    <xsl:if test="html:ul">
+                      <xsl:for-each select="html:ul//html:li[html:a          and          not(contains(html:a/@href,'#'))]">
+                        <item href="{html:a[1]/@href}" media-type="application/xhtml+xml">
+                          <xsl:attribute name="id">
+                            <xsl:text>section</xsl:text>
+                            <xsl:number count="html:li" level="any"/>
+                          </xsl:attribute>
+                        </item>
+                      </xsl:for-each>
+                    </xsl:if>
+                  </xsl:for-each>
+                </xsl:otherwise>
+              </xsl:choose>
+              <!-- images -->
+              <xsl:for-each select="key('GRAPHICS',1)">
+                <xsl:variable name="img" select="@url|@facs"/>
+                <xsl:if test="not($img=$coverImageOutside)">
+                  <xsl:variable name="ID">
+                    <xsl:number level="any"/>
+                  </xsl:variable>
+                  <xsl:variable name="mimetype">
+                    <xsl:choose>
+                      <xsl:when test="@mimeType != ''">
+                        <xsl:value-of select="@mimeType"/>
+                      </xsl:when>
+                      <xsl:when test="contains($img,'.gif')">image/gif</xsl:when>
+                      <xsl:when test="contains($img,'.png')">image/png</xsl:when>
+                      <xsl:when test="contains($img,'.mpeg')">video/mpeg4</xsl:when>
+                      <xsl:when test="contains($img,'.mp4')">video/mpeg4</xsl:when>
+                      <xsl:when test="contains($img,'.m4v')">video/mpeg4</xsl:when>
+                      <xsl:otherwise>image/jpeg</xsl:otherwise>
+                    </xsl:choose>
+                  </xsl:variable>
+                  <item href="{$img}" id="image-{$ID}" media-type="{$mimetype}"/>
+                </xsl:if>
+              </xsl:for-each>
+              <!-- page images -->
+              <xsl:for-each select="key('PBGRAPHICS',1)">
+                <xsl:variable name="img" select="@facs"/>
+                <xsl:variable name="ID">
+                  <xsl:number level="any"/>
+                </xsl:variable>
+                <xsl:variable name="mimetype">
+                  <xsl:choose>
+                    <xsl:when test="@mimeType != ''">
+                      <xsl:value-of select="@mimeType"/>
+                    </xsl:when>
+                    <xsl:when test="contains($img,'.gif')">image/gif</xsl:when>
+                    <xsl:when test="contains($img,'.png')">image/png</xsl:when>
+                    <xsl:otherwise>image/jpeg</xsl:otherwise>
+                  </xsl:choose>
+                </xsl:variable>
+                <item href="{$img}" id="pbimage-{$ID}" media-type="{$mimetype}"/>
+              </xsl:for-each>
+              <item id="ncx" href="toc.ncx" media-type="application/x-dtbncx+xml"/>
+              <xsl:call-template name="epubManifestHook"/>
+            </manifest>
+            <spine toc="ncx">
+              <itemref idref="titlepage" linear="yes"/>
+              <xsl:if test="$filePerPage='true'">
+                <itemref idref="titlepageverso" linear="yes"/>
+              </xsl:if>
+              <xsl:for-each select="tei:text/tei:front/tei:titlePage">
+                <xsl:variable name="N" select="position()"/>
+                <itemref idref="titlepage{$N}" linear="yes"/>
+              </xsl:for-each>
+              <itemref idref="start" linear="yes"/>
+              <xsl:choose>
+                <xsl:when test="$filePerPage='true'">
+                  <xsl:for-each select="key('PB',1)">
+                    <xsl:if test="@facs">
+                      <itemref>
+                        <xsl:attribute name="idref">
+                          <xsl:text>pagefacs</xsl:text>
+                          <xsl:number level="any"/>
+                        </xsl:attribute>
+                        <xsl:attribute name="linear">yes</xsl:attribute>
+                      </itemref>
+                    </xsl:if>
+                    <itemref>
+                      <xsl:attribute name="idref">
+                        <xsl:text>page</xsl:text>
+                        <xsl:number level="any"/>
+                      </xsl:attribute>
+                      <xsl:attribute name="linear">yes</xsl:attribute>
+                    </itemref>
+                  </xsl:for-each>
+                </xsl:when>
+                <xsl:otherwise>
+                  <xsl:for-each select="$TOC/html:TOC/html:ul/html:li">
+                    <xsl:choose>
+                      <xsl:when test="not(html:a)"/>
+                      <xsl:when test="starts-with(html:a/@href,'#')"/>
+                      <xsl:otherwise>
+                        <itemref>
+                          <xsl:attribute name="idref">
+                            <xsl:text>section</xsl:text>
+                            <xsl:number count="html:li" level="any"/>
+                          </xsl:attribute>
+                          <xsl:attribute name="linear">yes</xsl:attribute>
+                        </itemref>
+                      </xsl:otherwise>
+                    </xsl:choose>
+                    <xsl:if test="html:ul">
+                      <xsl:for-each select="html:ul//html:li[html:a and not(contains(html:a/@href,'#'))]">
+                        <itemref>
+                          <xsl:attribute name="idref">
+                            <xsl:text>section</xsl:text>
+                            <xsl:number count="html:li" level="any"/>
+                          </xsl:attribute>
+                          <xsl:attribute name="linear">yes</xsl:attribute>
+                        </itemref>
+                      </xsl:for-each>
+                    </xsl:if>
+                  </xsl:for-each>
+                </xsl:otherwise>
+              </xsl:choose>
+              <itemref idref="titlepageback">
+                <xsl:attribute name="linear">
+                  <xsl:choose>
+                    <xsl:when test="$filePerPage='true'">yes</xsl:when>
+                    <xsl:otherwise>no</xsl:otherwise>
+                  </xsl:choose>
+                </xsl:attribute>
+              </itemref>
+              <xsl:call-template name="epubSpineHook"/>
+            </spine>
+            <guide>
+              <reference type="text" href="titlepage.html" title="Cover"/>
+              <reference type="text" title="Start" href="index.html"/>
+              <xsl:choose>
+                <xsl:when test="$filePerPage='true'">
+		</xsl:when>
+                <xsl:otherwise>
+                  <xsl:for-each select="$TOC/html:TOC/html:ul/html:li">
+                    <xsl:if test="html:a">
+                      <reference type="text" href="{html:a[1]/@href}">
+                        <xsl:attribute name="title">
+                          <xsl:value-of select="normalize-space(html:a[1])"/>
+                        </xsl:attribute>
+                      </reference>
+                    </xsl:if>
+                    <xsl:if test="contains(parent::html:ul/@class,'group')">
+                      <xsl:for-each select="html:ul//html:li">
+                        <xsl:choose>
+                          <xsl:when test="not(html:a)"/>
+                          <xsl:when test="contains(html:a/@href,'#')"/>
+                          <xsl:otherwise>
+                            <reference type="text" href="{html:a/@href}">
+                              <xsl:attribute name="title">
+                                <xsl:value-of select="normalize-space(html:a[1])"/>
+                              </xsl:attribute>
+                            </reference>
+                          </xsl:otherwise>
+                        </xsl:choose>
+                      </xsl:for-each>
+                    </xsl:if>
+                  </xsl:for-each>
+                </xsl:otherwise>
+              </xsl:choose>
+              <reference href="titlepageback.html" type="text" title="About this book"/>
+            </guide>
+          </package>
+        </xsl:result-document>
+        <xsl:if test="$verbose='true'">
+          <xsl:message>write file OPS/titlepage.html</xsl:message>
+        </xsl:if>
+        <xsl:result-document href="{concat($directory,'/OPS/titlepage.html')}" method="xml">
+          <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+            <head>
+              <xsl:call-template name="metaHTML">
+                <xsl:with-param name="title">Title page</xsl:with-param>
+              </xsl:call-template>
+              <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
+              <meta name="calibre:cover" content="true"/>
+              <title>Title page</title>
+              <style type="text/css" title="override_css">
+		@page {padding: 0pt; margin:0pt}
+		body { text-align: center; padding:0pt; margin: 0pt; }
+	      </style>
+            </head>
+            <body>
+              <xsl:choose>
+                <xsl:when test="$coverImageInside=''">
+                  <div>
+                    <xsl:attribute name="style">
+		      font-family: serif; 
+		      height:860;          
+		      font-size:30pt; 
+		      font-weight: bold;
+		      padding-top: 15pt;
+		      margin: 12pt;
+		      border: solid red 1pt; 
+		      text-align:center;
+		    </xsl:attribute>
+                    <xsl:call-template name="generateTitle"/>
+                  </div>
+                </xsl:when>
+                <xsl:otherwise>
+                  <div>
+                    <img width="1200" height="1700" alt="cover picture" src="{$coverImageInside}"/>
+                  </div>
+                </xsl:otherwise>
+              </xsl:choose>
+            </body>
+          </html>
+        </xsl:result-document>
+        <xsl:for-each select="tei:text/tei:front/tei:titlePage">
+          <xsl:variable name="N" select="position()"/>
+          <xsl:if test="$verbose='true'">
+            <xsl:message>write file OPS/titlepage<xsl:value-of select="$N"/>.html</xsl:message>
+          </xsl:if>
+          <xsl:result-document href="{concat($directory,'/OPS/titlepage',$N,'.html')}" method="xml">
+            <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+              <head>
+                <xsl:call-template name="metaHTML">
+                  <xsl:with-param name="title">Title page</xsl:with-param>
+                </xsl:call-template>
+                <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+                <xsl:call-template name="linkCSS">
+		  <xsl:with-param
+		      name="file">stylesheet.css</xsl:with-param>
+		</xsl:call-template>
+                <title>Title page</title>
+              </head>
+              <body>
+                <div class="titlePage">
+                  <xsl:apply-templates/>
+                </div>
+              </body>
+            </html>
+          </xsl:result-document>
+        </xsl:for-each>
+        <xsl:if test="$filePerPage='true'">
+          <xsl:if test="$verbose='true'">
+            <xsl:message>write file OPS/titlepageverso.html</xsl:message>
+          </xsl:if>
+          <xsl:result-document href="{concat($directory,'/OPS/titlepageverso.html')}" method="xml">
+            <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+              <head>
+                <xsl:call-template name="metaHTML">
+                  <xsl:with-param name="title">title page verso</xsl:with-param>
+                </xsl:call-template>
+                <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
+                <title>title page verso</title>
+              </head>
+              <body>
+                <p/>
+              </body>
+            </html>
+          </xsl:result-document>
+        </xsl:if>
+        <xsl:if test="$verbose='true'">
+          <xsl:message>write file OPS/titlepageback.html</xsl:message>
+        </xsl:if>
+        <xsl:result-document href="{concat($directory,'/OPS/titlepageback.html')}" method="xml">
+          <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+            <head>
+              <xsl:call-template name="metaHTML">
+                <xsl:with-param name="title">About this book</xsl:with-param>
+              </xsl:call-template>
+              <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
+              <title>About this book</title>
+            </head>
+            <body>
+              <div style="text-align: left; font-size: larger">
+                <h2>Information about this book</h2>
+                <xsl:for-each select="/*/tei:teiHeader/tei:fileDesc">
+                  <xsl:apply-templates mode="metadata"/>
+                </xsl:for-each>
+                <xsl:for-each select="/*/tei:teiHeader/tei:encodingDesc">
+                  <xsl:apply-templates mode="metadata"/>
+                </xsl:for-each>
+              </div>
+            </body>
+          </html>
+        </xsl:result-document>
+        <xsl:if test="$verbose='true'">
+          <xsl:message>write file OPS/toc.ncx</xsl:message>
+        </xsl:if>
+        <xsl:result-document href="{concat($directory,'/OPS/toc.ncx')}" method="xml">
+          <ncx xmlns="http://www.daisy.org/z3986/2005/ncx/" version="2005-1">
+            <head>
+              <meta name="dtb:uid">
+                <xsl:attribute name="content">
+                  <xsl:call-template name="generateID"/>
+                </xsl:attribute>
+              </meta>
+              <meta name="dtb:totalPageCount" content="0"/>
+              <meta name="dtb:maxPageNumber" content="0"/>
+            </head>
+            <docTitle>
+              <text>
+                <xsl:call-template name="generateSimpleTitle"/>
+              </text>
+            </docTitle>
+            <navMap>
+              <xsl:variable name="navPoints">
+                <navPoint>
+                  <navLabel>
+                    <text>[Cover]</text>
+                  </navLabel>
+                  <content src="titlepage.html"/>
+                </navPoint>
+                <xsl:for-each select="tei:text/tei:front/tei:titlePage[1]">
+                  <xsl:variable name="N" select="position()"/>
+                  <navPoint>
+                    <navLabel>
+                      <text>[Title page]</text>
+                    </navLabel>
+                    <content src="titlepage{$N}.html"/>
+                  </navPoint>
+                </xsl:for-each>
+                <xsl:choose>
+                  <xsl:when test="not($TOC/html:TOC/html:ul[@class='toc toc_body']/html:li)">
+                    <xsl:for-each select="$TOC/html:TOC/html:ul[@class='toc toc_front']">
+                      <xsl:apply-templates select="html:li"/>
+                    </xsl:for-each>
+                    <navPoint>
+                      <navLabel>
+                        <text>[The book]</text>
+                      </navLabel>
+                      <content src="index.html"/>
+                    </navPoint>
+                    <xsl:for-each select="$TOC/html:TOC/html:ul[contains(@class,'group')]">
+                      <xsl:apply-templates select=".//html:li[not(contains(html:a/@href,'#'))]"/>
+                    </xsl:for-each>
+                    <xsl:for-each select="$TOC/html:TOC/html:ul[@class='toc toc_back']">
+                      <xsl:apply-templates select="html:li"/>
+                    </xsl:for-each>
+                  </xsl:when>
+                  <xsl:otherwise>
+                    <xsl:for-each select="$TOC/html:TOC/html:ul">
+                      <xsl:apply-templates select="html:li"/>
+                    </xsl:for-each>
+                  </xsl:otherwise>
+                </xsl:choose>
+                <navPoint>
+                  <navLabel>
+                    <text>[About this book]</text>
+                  </navLabel>
+                  <content src="titlepageback.html"/>
+                </navPoint>
+              </xsl:variable>
+              <xsl:for-each select="$navPoints/ncx:navPoint">
+                <xsl:variable name="pos" select="position()"/>
+                <navPoint id="navPoint-{$pos}" playOrder="{$pos}">
+                  <xsl:copy-of select="*"/>
+                </navPoint>
+              </xsl:for-each>
+            </navMap>
+          </ncx>
+        </xsl:result-document>
+        <xsl:if test="$verbose='true'">
+          <xsl:message>write file OPS/page-template.xpgt</xsl:message>
+        </xsl:if>
+        <xsl:result-document method="xml" href="{concat($directory,'/OPS/page-template.xpgt')}">
+          <ade:template xmlns="http://www.w3.org/1999/xhtml" xmlns:ade="http://ns.adobe.com/2006/ade" xmlns:fo="http://www.w3.org/1999/XSL/Format">
+            <fo:layout-master-set>
+              <fo:simple-page-master master-name="single_column">
+                <fo:region-body margin-bottom="3pt" margin-top="0.5em" margin-left="3pt" margin-right="3pt"/>
+              </fo:simple-page-master>
+              <fo:simple-page-master master-name="single_column_head">
+                <fo:region-before extent="8.3em"/>
+                <fo:region-body margin-bottom="3pt" margin-top="6em" margin-left="3pt" margin-right="3pt"/>
+              </fo:simple-page-master>
+              <fo:simple-page-master master-name="two_column" margin-bottom="0.5em" margin-top="0.5em" margin-left="0.5em" margin-right="0.5em">
+                <fo:region-body column-count="2" column-gap="10pt"/>
+              </fo:simple-page-master>
+              <fo:simple-page-master master-name="two_column_head" margin-bottom="0.5em" margin-left="0.5em" margin-right="0.5em">
+                <fo:region-before extent="8.3em"/>
+                <fo:region-body column-count="2" margin-top="6em" column-gap="10pt"/>
+              </fo:simple-page-master>
+              <fo:simple-page-master master-name="three_column" margin-bottom="0.5em" margin-top="0.5em" margin-left="0.5em" margin-right="0.5em">
+                <fo:region-body column-count="3" column-gap="10pt"/>
+              </fo:simple-page-master>
+              <fo:simple-page-master master-name="three_column_head" margin-bottom="0.5em" margin-top="0.5em" margin-left="0.5em" margin-right="0.5em">
+                <fo:region-before extent="8.3em"/>
+                <fo:region-body column-count="3" margin-top="6em" column-gap="10pt"/>
+              </fo:simple-page-master>
+              <fo:page-sequence-master>
+                <fo:repeatable-page-master-alternatives>
+                  <fo:conditional-page-master-reference master-reference="three_column_head" page-position="first" ade:min-page-width="80em"/>
+                  <fo:conditional-page-master-reference master-reference="three_column" ade:min-page-width="80em"/>
+                  <fo:conditional-page-master-reference master-reference="two_column_head" page-position="first" ade:min-page-width="50em"/>
+                  <fo:conditional-page-master-reference master-reference="two_column" ade:min-page-width="50em"/>
+                  <fo:conditional-page-master-reference master-reference="single_column_head" page-position="first"/>
+                  <fo:conditional-page-master-reference master-reference="single_column"/>
+                </fo:repeatable-page-master-alternatives>
+              </fo:page-sequence-master>
+            </fo:layout-master-set>
+            <ade:style>
+              <ade:styling-rule selector=".title_box" display="adobe-other-region" adobe-region="xsl-region-before"/>
+            </ade:style>
+          </ade:template>
+        </xsl:result-document>
+        <xsl:if test="$filePerPage='true'">
+          <xsl:if test="$verbose='true'">
+            <xsl:message>write file META-INF/com.apple.ibooks.display-options.xml</xsl:message>
+          </xsl:if>
+          <xsl:result-document href="{concat($directory,'/META-INF/com.apple.ibooks.display-options.xml')}">
+            <display_options xmlns="">
+              <platform name="*">
+                <option name="fixed-layout">true</option>
+              </platform>
+            </display_options>
+          </xsl:result-document>
+        </xsl:if>
+      </xsl:for-each>
+    </xsl:for-each>
+  </xsl:template>
+  <xsl:template match="html:li">
+    <xsl:choose>
+      <xsl:when test="not(html:a)"/>
+      <xsl:when test="starts-with(html:a/@href,'#')"/>
+      <xsl:when test="contains(@class,'headless')"/>
+      <xsl:when test="html:a/@href=preceding-sibling::html:li/html:a/@href"/>
+      <xsl:otherwise>
+        <navPoint xmlns="http://www.daisy.org/z3986/2005/ncx/">
+          <navLabel>
+            <text>
+              <xsl:value-of select="html:span[@class='headingNumber']"/>
+              <xsl:value-of select="normalize-space(html:a[1])"/>
+            </text>
+          </navLabel>
+          <content src="{html:a/@href}"/>
+        </navPoint>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <xsl:template name="javascriptHook">
+    <xsl:for-each select="tokenize($javascriptFiles,',')">
+      <xsl:variable name="name" select="tokenize(normalize-space(.),'/')[last()]"/>
+      <script type="text/javascript" src="{$name}">
+        <xsl:comment>JS library</xsl:comment>
+      </script>
+    </xsl:for-each>
+  </xsl:template>
+  <xsl:template name="epubSpineHook"/>
+  <xsl:template name="epubManifestHook"/>
+  <xsl:template name="processTEIHook"/>
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
+    <desc>[epub] Override addition of CSS links. We force a simple
+      name of "stylesheet.css"
+      </desc>
+  </doc>
+  <xsl:template name="includeCSS">
+    <link xmlns="http://www.w3.org/1999/xhtml" href="stylesheet.css" rel="stylesheet" type="text/css"/>
+    <xsl:if test="not($cssPrintFile='')">
+      <link xmlns="http://www.w3.org/1999/xhtml" rel="stylesheet" media="print" type="text/css" href="print.css"/>
+    </xsl:if>
+    <link xmlns="http://www.w3.org/1999/xhtml" rel="stylesheet" type="application/vnd.adobe-page-template+xml" href="page-template.xpgt"/>
+    <xsl:call-template name="generateLocalCSS"/>
+  </xsl:template>
+
+  <xsl:template name="opfmetadata">
+    <xsl:param name="author"/>
+    <xsl:param name="printAuthor"/>
+    <xsl:param name="coverImageOutside"/>
+    <metadata xmlns="http://www.idpf.org/2007/opf"
+	      xmlns:dc="http://purl.org/dc/elements/1.1/" 
+	      xmlns:dcterms="http://purl.org/dc/terms/" 
+	      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+	      xmlns:opf="http://www.idpf.org/2007/opf">
+      <dc:title>
+	<xsl:call-template name="generateSimpleTitle"/>
+      </dc:title>
+      <dc:language xsi:type="dcterms:RFC3066">
+	<xsl:call-template name="generateLanguage"/>
+      </dc:language>
+      <xsl:call-template name="generateSubject"/>
+      <dc:identifier id="dcidid" opf:scheme="URI">
+	<xsl:call-template name="generateID"/>
+      </dc:identifier>
+      <dc:description>
+	<xsl:call-template name="generateSimpleTitle"/>
+	<xsl:text> / </xsl:text>
+	<xsl:value-of select="$author"/>
+      </dc:description>
+      <dc:creator>
+	<xsl:choose>
+	  <xsl:when test="$printAuthor=''">Anonymous/Unknown</xsl:when>
+	  <xsl:otherwise>
+	    <xsl:value-of select="$printAuthor"/>
+	  </xsl:otherwise>
+	</xsl:choose>
+      </dc:creator>
+      <dc:publisher>
+	<xsl:call-template name="generatePublisher"/>
+      </dc:publisher>
+      <xsl:for-each select="tei:teiHeader/tei:profileDesc/tei:creation/tei:date[@notAfter]">
+	<dc:date opf:event="creation">
+	  <xsl:value-of select="@notAfter"/>
+	</dc:date>
+      </xsl:for-each>
+      <xsl:for-each select="tei:teiHeader/tei:fileDesc/tei:sourceDesc//tei:date[@when][1]">
+	<dc:date opf:event="original-publication">
+	  <xsl:value-of select="@when"/>
+	</dc:date>
+      </xsl:for-each>
+      <dc:date opf:event="epub-publication" xsi:type="dcterms:W3CDTF">
+	<xsl:call-template name="generateDate"/>
+      </dc:date>
+      <dc:rights>
+	<xsl:call-template name="generateLicence"/>
+      </dc:rights>
+      <xsl:if test="not($coverImageOutside='')">
+	<meta name="cover" content="cover-image"/>
+      </xsl:if>
+    </metadata>
+</xsl:template>
+
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/epub/tei-to-epub.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tbx/teitotbx.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/tbx/teitotbx.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/tbx/teitotbx.xsl	(revision 258)
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:tei="http://www.tei-c.org/ns/1.0"
+    xmlns:tbx="http://www.lisa.org/TBX-Specification.33.0.html"
+    exclude-result-prefixes="tei tbx">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+    <desc>
+      <p> TEI stylesheet for simplifying TEI ODD markup </p>
+      <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+      <p>Author: See AUTHORS</p>
+      <p>Id: $Id: teitotbx.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+      <p>Copyright: 2008, TEI Consortium</p>
+    </desc>
+  </doc>
+
+<xsl:key name="T" match="tbx:termEntry" use="1"/>
+
+<xsl:output method="xml" indent="yes" encoding="utf-8"/>
+
+<xsl:template match="/">
+  <martif type="TBX" xml:lang="en">
+    <martifHeader>
+        <fileDesc>
+            <sourceDesc>
+                <p>from an ISO standard</p>
+            </sourceDesc>
+        </fileDesc>
+        <encodingDesc>
+            <p type="XCSURI">http://www.lisa.org/fileadmin/standards/tbx/TBXXCSV02.XCS</p>
+        </encodingDesc>
+    </martifHeader>
+    <text>
+      <body>
+	<xsl:for-each select="key('T',1)">
+	  <xsl:copy>
+	    <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
+	  </xsl:copy>
+	</xsl:for-each>
+      </body>
+    </text>
+  </martif>
+</xsl:template>
+
+
+   <xsl:template match="@*|text()|comment()|processing-instruction()">
+      <xsl:copy-of select="."/>
+   </xsl:template>
+
+
+   <xsl:template match="*">
+      <xsl:copy>
+         <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
+      </xsl:copy>
+   </xsl:template>
+
+   <xsl:template match="tei:*">
+         <xsl:apply-templates select="*|processing-instruction()|comment()|text()"/>
+   </xsl:template>
+
+
+</xsl:stylesheet>
+
+
+
+

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tbx/teitotbx.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/odd.css
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/odd.css	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/odd.css	(revision 258)
@@ -0,0 +1,382 @@
+/* tables for reference display */
+table.wovenodd {
+    width: 100%;
+    clear: both;
+}
+td.wovenodd-col1 {
+    width:15%;
+    vertical-align: top;
+}
+td.wovenodd-col2 {
+    width:85%;
+}
+table.wovenodd tr td {
+    border: 1px solid #555;
+    padding:1%;
+}
+table.wovenodd {
+    border-spacing:0px;
+    border-collapse:collapse;
+}
+table.wovenodd tr td {
+    border-spacing:0px;
+}
+table.wovenodd tr {
+    border-spacing:0px;
+    border-collapse:collapse;
+}
+table.wovenodd tr td table.attList {
+    border-spacing:0px;
+    border:none;
+}
+table.wovenodd tr td table.attList tr {
+    border-spacing:0px;
+    border:none;
+}
+table.wovenodd tr td table.attList tr td {
+    border-spacing:0px;
+    border:none;
+}
+table.attList {
+    table-layout: fixed;
+    width: 100%;
+    margin: 0pt;
+    padding: 0pt;
+}
+td.odd_label {
+    vertical-align: top;
+    width: 10%;
+    font-weight: bold;
+}
+td.odd_value {
+    vertical-align: top;
+    width: 90%;
+}
+table.attDef {
+    table-layout: fixed;
+    width: 100%;
+}
+table.attDef td.odd_label {
+    width: 10%;
+    vertical-align: top;
+    font-weight: normal;
+}
+table.attDef td.odd_value {
+    vertical-align: top;
+    width: 90%;
+}
+table.attList  td.odd_label:before {
+    content: "@";
+}
+table.attDef  td.odd_label:before {
+    content: "";
+}
+table.valList  td.odd_label:before {
+    content: "";
+}
+table.valList {
+    table-layout: fixed;
+    width: 100%;
+}
+table.valList td.odd_label {
+    width: 10%;
+    vertical-align: top;
+    font-style: normal;
+    font-weight: normal;
+}
+table.valList td.odd_value {
+    vertical-align: top;
+    width: 90%;
+}
+table.specDesc td.Attribute {
+    font-weight: bold;
+    vertical-align: top;
+}
+table.specDesc {
+    margin-left: 1em;
+}
+td p {
+    margin-top: 0pt;
+    margin-bottom: 2pt;
+}
+
+div.cdata {
+    white-space: pre;
+    clear:both;
+}
+
+span.tag:before {
+     
+}
+span.tag:after {
+     
+}
+span.gi,span.tag {
+}
+span.att {
+     
+}
+span.att:before {
+    content: "@";
+}
+span.ident, 
+span.ident-class, span.ident-datatype, span.ident-frag,
+span.ident-ge,    span.ident-macro,    span.ident-module,
+span.ident-pe,    span.ident-rng,      span.ident-schema  {
+    font-weight: bold;
+}
+
+span.ident-file, span.ident-ns {
+    font-style: italic;
+}
+
+button.displayRelaxButton {
+    margin-right: 2px;
+    margin-top: 2px;
+    font-size: 70%;
+    float: right;
+    cursor: pointer;
+}
+pre.RNG_XML {
+	    display: none;
+	    }
+
+span.RNG_XML {
+	    display: none;
+	    }
+
+/* pretty printing of XML */
+td.classSpec, td.macroSpec {
+    font-weight: bold;
+}
+a.link_odd_element:link,a.link_odd_element:visited {		   
+    /*     color: #006400; */
+}
+a.link_odd_macro:link,a.link_odd_macro:visited {
+
+}
+a.link_odd_class:link,a.link_odd_class:visited {
+
+}
+span.element {
+    font-weight: bold;
+    color: black;
+}
+td.elementSpec,span.elementname {
+    font-weight: bold;
+    color: #222288;
+}
+span.highlightelementname {
+    color: red;
+}
+
+span.attribute {
+    color: #222288;
+}
+span.attributevalue {
+    color: black;
+}
+span.comment {
+    color: black;
+    font-style:italic;
+}
+span.namespace {
+    color: #222288;
+}
+/* pretty print rnc */
+span.rnc_nc {
+    color: #006400;
+}
+span.rnc_decl {
+    color: green;
+}
+span.rnc_prefix {
+    color: blue;
+}
+span.rnc_param {
+    color: gray;
+}
+span.rnc_atom {
+    color: yellow;
+}
+span.rnc_annot {
+    color: #FF8040;
+}
+span.rnc_comment {
+    color: #FF00FF;
+}
+span.rnc_annot {
+    color: #00FFFF;
+}
+span.rnc_type {
+    color: purple;
+}
+span.rnc_keyword {
+    color: teal;
+}
+span.defaultVal {
+    font-weight: bold;
+}
+span.required {
+    font-weight: bold;
+}
+div.moduleSpec {
+    padding: 1px;
+    margin: 1px;
+    background-color: #C0C0C0;
+    color:inherit;
+    clear:right;
+}
+span.moduleSpecHead {
+    font-style: italic;
+}
+ul.specList li {
+    list-style: none;
+}
+span.specList-macroSpec {
+    font-weight: bold;
+}
+span.specList-elementSpec {
+    font-weight: bold;
+}
+span.specList-elementSpec:before {
+    content: "<";
+     
+}
+span.specList-elementSpec:after {
+    content: ">";
+     
+}
+span.specList-classSpec {
+    font-weight: bold;
+}
+span.specName {
+    color: #223377;
+    font-weight: bold;
+}
+/* A -Z Styles From http://www.smileycat.com/miaow/archives/000211.php -styling the a to z */
+#azindex {
+    background-color: #ddd;
+    color:inherit;
+    display: block;
+    margin: 0px;
+    float: left;
+    padding: 5px;
+    width: 75%;
+    border: 1px solid #999;
+}
+#azindex p {
+    color: #fff;
+    background-color: #000060;
+    padding: 4px;
+    display: block;
+    margin: 0;
+    border-bottom: 1px solid #333;
+    font-size: 0.95em;
+}
+.index {
+    font: bold 100% Verdana, Helvetica, sans-serif;
+    margin: 0;
+    padding: 0;
+}
+.index li {
+    float: left;
+    height: 1.5em;
+    list-style-type: none;
+    margin: 0.35em 0.15em;
+    padding: 0;
+    width: 1.5em;
+}
+.index a:link, .index a:visited {
+    background: #fff;
+    color: navy;
+    display: block;
+    height: 1.5em;
+    padding: 0.37em 0 0 0;
+    text-align: center;
+    text-decoration: none;
+    width: 1.5em;
+    border: 1px solid #999;
+}
+li.showall, li.showall a:visited,li.showall a:link {
+    width: 10em;
+}
+* html .index li {
+    margin: 0.2em 0.2em;
+}
+ul.index li a:hover {
+    background-color: #93D1E4;
+    color: #fff;
+    text-decoration: underline;
+}
+div.atozwrapper {
+   float: left;
+   width: 70%;
+}
+div.atoz {    
+   clear: left;
+   float: left;
+}    
+#byMod {
+   margin-top: 12px;
+   clear: left;
+}
+ul.atoz {
+    list-style: none;
+    text-align:left;
+    margin: 2px;
+    padding: 2px;
+    background-color: #eef;
+    color:inherit;
+}
+.atoz li {
+    padding: 0px;
+    display: inline;
+}
+span.listhead {
+    margin-top: 0em;
+    margin-right: 1em;
+    padding-left: 3px;
+    padding-right: 3px;
+    color: #000066;
+    font-weight: bold;
+    font-size: large;
+}
+/* End of A - Z styles */
+div.specChildren {
+    margin: 0em;
+    padding: 0em;
+}
+span.specChildModule {
+    font-weight: bold;
+}
+div.specChild {
+    margin-bottom: 4pt;
+    margin-left: 25px;
+    text-indent: -30px;
+}
+span.emptySlash:after {
+    content: "/";
+}
+/* status notation */
+.status_deprecated:after {
+    content: " (deprecated)";
+    color: red;
+}
+.status_changed:after {
+    content: " (changed)";
+    color: blue;
+}
+.status_unstable:after {
+    content: " (unstable)";
+    color: orange;
+}
+.status_deprecated {
+    border: solid red 1pt;
+}
+.status_changed {
+    border: solid blue 1pt;
+}
+.status_unstable {
+    border: solid orange 1pt;
+}
\ No newline at end of file
Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/docx-templates-twiddling/build.xml
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/docx-templates-twiddling/build.xml	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/docx-templates-twiddling/build.xml	(revision 258)
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="utf-8"?>
+<project basedir="." name="fix template styles">
+	<!-- ANT script to prepare and clean up a template for the DOCX transformation 
+		to be used for creating a DOCX target file tranformed from a TEI XML document.
+	-->
+  
+  <!-- define the the saxon transformer or place it in the ant lib directory -->
+  <property name = "saxon.jar" value=".../saxon9he.jar"/>
+  
+	<!-- modfiy basedir, if necessary: -Dbasedir=... -->
+	<echo>     basedir: ${basedir}</echo>
+	
+	<!-- profile, may be overwritten by external property: -Dprofile=default -->
+	<property name="profile" value="default"/>
+    
+	<!-- the profiles directory, may be overwritten by: -DprofilesDir=... -->
+	<property name="profilesDir">../../profiles/</property>
+	<echo> profilesDir: ${profilesDir}</echo>
+
+	<!-- the source directory, may be overwritten by: -DsourceDir=... -->
+	<property name="sourceDir">${profilesDir}${profile}/docx/</property>
+
+	<!-- the source file, may be overwritten by: -DsourceFile=... -->
+	<property name="sourceFile">${sourceDir}template_original.docx</property>
+	<echo>  sourceFile: ${sourceFile}</echo>
+  
+	<!-- the target directory, may be overwritten by: -DtargetDir=... 
+			The target directory is also used as a base for a temporary workind directory. -->
+	<property name="targetDir">${profilesDir}${profile}/docx/</property>
+  
+	<!-- the target file, may be overwritten by: -DtargetFile=... -->
+	<property name="targetFile">${targetDir}template.docx</property>
+	<echo>  targetFile: ${targetFile}</echo>
+	
+	<!-- remove the target file -->
+	<delete file="${targetFile}" />
+	
+	<!-- create the working directory and unzip the source file -->
+	<property name="temp">${targetDir}temp/</property>
+	<mkdir dir="${temp}"/>
+	<unzip src="${sourceFile}" dest="${temp}" failOnEmptyArchive="true" />
+
+	<!-- remove custom document properties -->
+	<delete includeEmptyDirs="true" verbose="true">
+		<fileset dir="${temp}">
+			<include name="docProps/custom.xml" />
+			<include name="word/webSettings.xml" />
+			<include name="word/_rels/settings.xml.rels" />
+			<include name="word/endnotes.xml" />
+			<include name="word/footnotes.xml" />
+			<include name="customXml/*" />
+			<include name="word/footer*" />
+			<include name="word/header*" />
+			<include name="word/theme" />
+			<include name="word/glossary" />
+		</fileset>
+	</delete>
+
+	<!-- fix .rels -->
+	<xslt style="fixdotrels.xsl"  in="${temp}_rels/.rels"  out="${temp}__rels/.rels" >
+		<factory name="net.sf.saxon.TransformerFactoryImpl"/>
+		<classpath location="${saxon.jar}"/>
+	</xslt>
+	<move file="${temp}__rels/.rels" tofile="${temp}_rels/.rels" verbose="true" />
+
+
+	<!-- fix styles -->
+	<xslt style="fixstyle.xsl"  in="${temp}word/styles.xml"  out="${temp}word/_styles.xml" >
+		<factory name="net.sf.saxon.TransformerFactoryImpl"/>
+		<classpath location="${saxon.jar}"/>
+	</xslt>
+	<move file="${temp}word/_styles.xml" tofile="${temp}word/styles.xml" verbose="true" />
+
+	<!-- zip back together -->
+	<zip destfile="${targetFile}" basedir="${temp}" />
+
+	<!-- delete the working directory whith all its content -->
+	<echo>remove working directory</echo>
+	<delete includeEmptyDirs="true" verbose="true">
+		<fileset dir="${temp}"/>
+	</delete>
+
+	<echo>  target template stored in ${targetFile}</echo>
+
+</project>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/docx-templates-twiddling/build.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/docx-templates-twiddling/template-oucs.docx
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/docx-templates-twiddling/template-oucs.docx
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/docx-templates-twiddling/enrich_template.docx
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/docx-templates-twiddling/enrich_template.docx
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/docx-templates-twiddling/fixdocprop.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/docx-templates-twiddling/fixdocprop.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/docx-templates-twiddling/fixdocprop.xsl	(revision 258)
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet 
+    version="2.0"
+    xmlns:p="http://schemas.openxmlformats.org/officeDocument/2006/custom-properties" 
+    xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"    
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
+    exclude-result-prefixes="w vt p">
+
+  <xsl:output  encoding="UTF-8" standalone="yes" method="xml"/>
+
+  <xsl:param name="template"/>
+  <!-- identity transform -->
+  
+  <xsl:template match="@*|text()|comment()|processing-instruction()" >
+    <xsl:copy-of select="."/>
+  </xsl:template>
+  
+  <xsl:template match="*" >
+    <xsl:copy>
+      <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()" />
+    </xsl:copy>
+  </xsl:template>
+
+  <xsl:template match="p:Properties">
+    <xsl:copy>
+      <xsl:apply-templates select="@*"/>
+      <property pid="1" name="Template">
+	<xsl:attribute name="fmtid">
+	  <xsl:text>{D5CDD505-2E9C-101B-9397-08002B2CF9AE}</xsl:text>
+	</xsl:attribute>
+	<vt:lpwstr>
+	  <xsl:value-of select="$template"/>
+	</vt:lpwstr>
+      </property>
+    </xsl:copy>
+  </xsl:template>
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/docx-templates-twiddling/fixdocprop.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/docx-templates-twiddling/oucs.docx
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/docx-templates-twiddling/oucs.docx
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/docx-templates-twiddling/fixstyle
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/docx-templates-twiddling/fixstyle	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/docx-templates-twiddling/fixstyle	(revision 258)
@@ -0,0 +1,97 @@
+#!/bin/sh
+HERE=`pwd`
+IN=`basename $1`
+OUT=`basename $2`
+INd=`dirname $1`
+OUTd=`dirname $2`
+INDIR=`(cd $INd; pwd)`
+OUTDIR=`(cd $OUTd; pwd)`
+AD=`dirname $0`
+APPDIR=`(cd $AD; pwd)`
+mkdir temp$$
+cd temp$$
+unzip -q $INDIR/$IN
+# remove old template
+if test -e $OUTDIR/$OUT
+then
+  echo "remove old template"
+  rm $OUTDIR/$OUT
+fi
+
+# remove custom document properties
+if test -e docProps/custom.xml
+then
+  echo "removed custom.xml"
+  rm docProps/custom.xml
+  #saxon docProps/custom.xml $APPDIR/fixdocprop.xsl  template="$3" > x.xml
+  #mv x.xml docProps/custom.xml
+fi
+
+# remove custom xml folder
+if test -e customXml
+then
+  echo "remove customXml folder"
+  rm -r customXml
+fi
+
+# remove webSettings
+if test -e word/webSettings.xml
+then
+	echo "remove webSettings.xml"
+	rm word/webSettings.xml
+fi
+
+# remove word/_rels/settings.xml.rels
+if test -e word/_rels/settings.xml.rels
+then
+	echo "remove settings.xml.rels"
+	rm word/_rels/settings.xml.rels	
+fi
+
+# remove headers and footers
+echo "remove all header and footer files"
+rm word/footer*
+rm word/header*
+
+# remove theme directory
+if test -e word/theme
+then
+	echo "remove document themes"
+	rm -r word/theme
+fi
+	
+
+# remove endnotes and footnotes
+if test -e word/endnotes.xml
+then
+	echo "remove endotes.xml"
+	rm word/endnotes.xml
+fi
+if test -e word/footnotes.xml
+then
+	echo "remove footnotes.xml"
+	rm word/footnotes.xml
+fi
+
+
+# remove glossary dir
+if test -e word/glossary
+then
+	echo "remove glossary directory"
+	rm -r word/glossary
+fi
+
+# fix .rels
+saxon _rels/.rels $APPDIR/fixdotrels.xsl > x
+mv x _rels/.rels
+
+#fix styles
+saxon word/styles.xml $APPDIR/fixstyle.xsl > x
+mv x word/styles.xml
+
+# zip back together
+zip -r -q $OUTDIR/$OUT .
+cd ..
+rm -rf temp$$
+
+echo "stored template in $OUTDIR/$OUT"
Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/docx-templates-twiddling/fixdotrels.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/docx-templates-twiddling/fixdotrels.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/docx-templates-twiddling/fixdotrels.xsl	(revision 258)
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet 
+    version="2.0"
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:r="http://schemas.openxmlformats.org/package/2006/relationships"
+    exclude-result-prefixes="r">
+
+  <xsl:output  encoding="UTF-8" standalone="yes" method="xml"/>
+
+  <!-- identity transform -->
+  
+  <xsl:template match="@*|text()|comment()|processing-instruction()" >
+    <xsl:copy-of select="."/>
+  </xsl:template>
+  
+  <xsl:template match="*" >
+    <xsl:copy>
+      <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()" 
+			   />
+    </xsl:copy>
+  </xsl:template>
+
+  <!-- do not copy custom xml rel -->
+  <xsl:template match="*[@Target='docProps/custom.xml']"/>
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/docx-templates-twiddling/fixdotrels.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/docx-templates-twiddling/fixstyle.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/docx-templates-twiddling/fixstyle.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/docx-templates-twiddling/fixstyle.xsl	(revision 258)
@@ -0,0 +1,208 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet 
+    version="2.0"
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
+    exclude-result-prefixes="w">
+
+  <xsl:output  encoding="UTF-8" standalone="yes" method="xml"/>
+
+  <xsl:template match="/w:styles">
+    <w:styles xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
+      xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
+      
+      <!-- copy all existing elements -->
+      <xsl:apply-templates/>
+      
+      <!-- create some new styles -->
+      <xsl:call-template name="create-egXML"/>
+      
+    </w:styles>
+  </xsl:template>
+
+  <!-- identity transform -->
+  
+  <xsl:template match="@*|text()|comment()|processing-instruction()" >
+    <xsl:copy-of select="."/>
+  </xsl:template>
+  
+  <xsl:template match="*" >
+    <xsl:copy>
+      <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()" 
+			   />
+    </xsl:copy>
+  </xsl:template>
+
+  <xsl:template match="w:style[@w:styleId='Tabletitle']//w:numId">
+    <w:numId w:val="5"/>
+  </xsl:template>
+  
+  <xsl:template match="w:style[@w:styleId='Bibliography']//w:numId">
+    <w:numId w:val="6"/>
+  </xsl:template>
+
+  <xsl:template match="w:style[@w:styleId='Figuretitle']//w:numId">
+    <w:numId w:val="7"/>
+  </xsl:template>
+  
+  <xsl:template match="w:spacing">
+    <xsl:choose>
+      <xsl:when test="ancestor::w:style[@w:styleId='Heading1']"/>
+      <xsl:when test="ancestor::w:style[@w:styleId='Heading2']"/>
+      <xsl:when test="ancestor::w:style[@w:styleId='Heading3']"/>
+      <xsl:when test="ancestor::w:style[@w:styleId='Heading4']"/>
+      <xsl:when test="ancestor::w:style[@w:styleId='Heading5']"/>
+      <xsl:when test="ancestor::w:style[@w:styleId='Heading6']"/>
+      <xsl:when test="ancestor::w:style[@w:styleId='Heading7']"/>
+      <xsl:when test="ancestor::w:style[@w:styleId='Heading8']"/>
+      <xsl:when test="ancestor::w:style[@w:styleId='Heading9']"/>
+      
+      <xsl:when test="ancestor::w:style[@w:styleId='ANNEX']"/>
+      <xsl:when test="ancestor::w:style[@w:styleId='a2']"/>
+      <xsl:when test="ancestor::w:style[@w:styleId='a3']"/>
+      <xsl:when test="ancestor::w:style[@w:styleId='a4']"/>
+      <xsl:when test="ancestor::w:style[@w:styleId='a5']"/>
+      <xsl:when test="ancestor::w:style[@w:styleId='a6']"/>
+      
+      <xsl:otherwise>
+        <w:spacing>
+          <xsl:apply-templates
+              select="*|@*|processing-instruction()|comment()|text()"
+          />
+        </w:spacing>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  
+  <xsl:template match="w:numPr">
+    <xsl:choose>
+      <xsl:when test="ancestor::w:style[@w:styleId='Heading1']">
+        <w:numPr>
+          <w:numId w:val="1"/>
+        </w:numPr>
+      </xsl:when>
+      
+      <xsl:when test="ancestor::w:style[@w:styleId='ANNEX']">
+        <w:numPr>
+          <w:numId w:val="3"/>
+        </w:numPr>
+      </xsl:when>
+      <xsl:when test="ancestor::w:style[@w:styleId='a2']">
+        <w:numPr>
+          <w:ilvl w:val="1"/>
+          <w:numId w:val="3"/>
+        </w:numPr>
+      </xsl:when>
+      <xsl:when test="ancestor::w:style[@w:styleId='a3']">
+        <w:numPr>
+          <w:ilvl w:val="2"/>
+          <w:numId w:val="3"/>
+        </w:numPr>
+      </xsl:when>
+      <xsl:when test="ancestor::w:style[@w:styleId='a4']">
+        <w:numPr>
+          <w:ilvl w:val="3"/>
+          <w:numId w:val="3"/>
+        </w:numPr>
+      </xsl:when>
+      <xsl:when test="ancestor::w:style[@w:styleId='a5']">
+        <w:numPr>
+          <w:ilvl w:val="4"/>
+          <w:numId w:val="3"/>
+        </w:numPr>
+      </xsl:when>
+      <xsl:when test="ancestor::w:style[@w:styleId='a6']">
+        <w:numPr>
+          <w:ilvl w:val="5"/>
+          <w:numId w:val="3"/>
+        </w:numPr>
+      </xsl:when>
+      
+      <xsl:when test="ancestor::w:style[@w:styleId='ListNumber']">
+        <w:numPr>
+          <w:numId w:val="8"/>
+        </w:numPr>
+      </xsl:when>
+
+      <xsl:when test="ancestor::w:style[@w:styleId='ListNumber1']">
+        <w:numPr>
+          <w:ilvl w:val="1"/>
+          <w:numId w:val="8"/>
+        </w:numPr>
+      </xsl:when>
+      
+      <xsl:when test="ancestor::w:style[@w:styleId='ListNumber2']">
+        <w:numPr>
+          <w:ilvl w:val="2"/>
+          <w:numId w:val="8"/>
+        </w:numPr>
+      </xsl:when>
+      
+      <xsl:when test="ancestor::w:style[@w:styleId='ListNumber3']">
+        <w:numPr>
+          <w:ilvl w:val="3"/>
+          <w:numId w:val="8"/>
+        </w:numPr>
+      </xsl:when>
+      
+      <xsl:when test="ancestor::w:style[@w:styleId='ListNumber4']">
+        <w:numPr>
+          <w:ilvl w:val="4"/>
+          <w:numId w:val="8"/>
+        </w:numPr>
+      </xsl:when>
+      
+      <xsl:when test="ancestor::w:style[@w:styleId='ListNumber5']">
+        <w:numPr>
+          <w:ilvl w:val="5"/>
+          <w:numId w:val="8"/>
+        </w:numPr>
+      </xsl:when>
+      
+      <xsl:when test="ancestor::w:style[@w:styleId='ListBullet']">
+        <w:numPr>
+          <w:numId w:val="9"/>
+        </w:numPr>
+      </xsl:when>
+      
+      
+
+      <xsl:otherwise>
+      	<w:numPr>
+      	  <xsl:apply-templates
+      	      select="*|@*|processing-instruction()|comment()|text()"
+      	      />
+      	</w:numPr>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  
+  <!-- new styles -->
+  <xsl:template name="create-egXML">
+    <w:style w:type="paragraph" w:customStyle="1" w:styleId="egXML">
+      <w:name w:val="egXML"/>
+      <w:basedOn w:val="Normal"/>
+      <w:qFormat/>
+      <w:pPr>
+	<w:jc w:val="left"/>
+      </w:pPr>
+      <w:rPr>
+        <w:rFonts w:ascii="Courier" w:hAnsi="Courier"/>
+        <w:sz w:val="20"/>
+      </w:rPr>
+    </w:style>
+    <w:style w:type="paragraph" w:customStyle="1" w:styleId="egXMLTable">
+      <w:name w:val="egXMLTable"/>
+      <w:basedOn w:val="Normal"/>
+      <w:qFormat/>
+      <w:pPr>
+	<w:spacing w:before="80" w:after="0"/>
+	<w:jc w:val="left"/>
+      </w:pPr>
+      <w:rPr>
+        <w:rFonts w:ascii="Courier" w:hAnsi="Courier"/>
+        <w:sz w:val="18"/>
+      </w:rPr>
+    </w:style>
+  </xsl:template>
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/docx-templates-twiddling/fixstyle.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/tangle.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/tangle.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/tangle.xsl	(revision 258)
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:fotex="http://www.tug.org/fotex"
+                xmlns:edate="http://exslt.org/dates-and-times"
+                xmlns:estr="http://exslt.org/strings"
+                xmlns:exsl="http://exslt.org/common"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:teix="http://www.tei-c.org/ns/Examples"
+                xmlns:html="http://www.w3.org/1999/xhtml"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:fo="http://www.w3.org/1999/XSL/Format"
+                xmlns:rng="http://relaxng.org/ns/structure/1.0"
+                xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
+                
+                xmlns:XSL="http://www.w3.org/1999/XSL/Transform"
+                extension-element-prefixes="exsl estr edate"
+                exclude-result-prefixes="exsl edate a fo rng tei teix fotex m html"
+                version="1.0">
+   <xsl:output indent="yes" encoding="utf-8"/>
+
+   <xsl:template match="XSL:stylesheet">
+      <xsl:copy>
+         <xsl:copy-of select="@*"/>
+         <xsl:copy-of select="XSL:*"/>
+      </xsl:copy>
+   </xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/tangle.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/checki18n.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/checki18n.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/checki18n.xsl	(revision 258)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:rng="http://relaxng.org/ns/structure/1.0"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="1.0"
+                exclude-result-prefixes="rng tei">
+   <xsl:output method="xml" encoding="utf-8" indent="yes"/>
+   <xsl:param name="lang">ja</xsl:param>
+
+   <xsl:template match="/i18n">
+      <i18n>
+         <xsl:for-each select="entry">
+            <xsl:if test="not(text[@xml:lang=$lang])">
+	              <entry>
+	                 <xsl:copy-of select="key"/>
+	                 <xsl:copy-of select="text[@xml:lang='en']"/>
+	                 <text xml:lang="{$lang}"/>
+	              </entry>
+            </xsl:if>
+         </xsl:for-each>
+      </i18n>
+   </xsl:template>
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/checki18n.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/oddbyexample.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/oddbyexample.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/oddbyexample.xsl	(revision 258)
@@ -0,0 +1,434 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+		xmlns:n="www.example.com"
+		xmlns:rng="http://relaxng.org/ns/structure/1.0"
+		xmlns:tei="http://www.tei-c.org/ns/1.0"
+		xmlns="http://www.tei-c.org/ns/1.0"
+		exclude-result-prefixes="rng tei n"
+		xpath-default-namespace="http://www.tei-c.org/ns/1.0"
+		version="2.0"><!--
+This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+
+$Id: oddbyexample.xsl 10028 2012-01-11 22:45:07Z rahtz $
+
+2008, TEI Consortium
+-->
+  <!-- typical usage:
+   saxon -it:main -o:myodd /usr/share/xml/tei/stylesheet/tools2/oddbyexample.xsl   corpus=`pwd`/
+
+-->
+  <xsl:import href="getfiles.xsl"/>
+  <!-- 
+read a corpus of TEI P5 documents and construct
+an ODD customization file which expresses the subset
+of the TEI you need to validate that corpus
+-->
+  <xsl:output indent="yes"/>
+  <!-- name of odd -->
+  <xsl:param name="schema">oddbyexample</xsl:param>
+  <!-- whether to do all the global attributes -->
+  <xsl:param name="keepGlobals">false</xsl:param>
+  <!-- the document corpus -->
+  <xsl:param name="corpus">./</xsl:param>
+  <!-- the source of the TEI (just needs *Spec)-->
+  <xsl:param name="tei">http://www.tei-c.org/Vault/P5/current/xml/tei/odd/p5subset.xml</xsl:param>
+  <!-- should we make valList for @rend -->
+  <xsl:param name="enumerateRend">false</xsl:param>
+  <xsl:param name="enumerateType">false</xsl:param>
+  <!-- should we deal with non-TEI namespaces -->
+  <xsl:param name="processNonTEI">false</xsl:param>
+  <!-- which attributes should be make valLists for, regardless -->
+  <xsl:param name="attributeList"/>
+  <xsl:variable name="checkAtts">
+    <xsl:text>,</xsl:text>
+    <xsl:value-of select="$attributeList"/>
+    <xsl:text>,</xsl:text>
+  </xsl:variable>
+  <xsl:key name="Atts" match="@*" use="local-name(parent::*)"/>
+  <xsl:key name="attVals" match="@*" use="concat(local-name(parent::*),local-name())"/>
+  <xsl:key name="ELEMENTS" use="1" match="elementSpec"/>
+  <xsl:key name="CLASSES" use="1" match="classSpec[@type='atts']"/>
+  <xsl:key name="IDENTS" use="@ident" match="*[@ident]"/>
+  <xsl:key name="MEMBERS" use="@key" match="elementSpec/classes/memberOf"/>
+  <xsl:key name="CLASSMEMBERS" use="@key" match="classSpec/classes/memberOf"/>
+  <xsl:key name="Used" use="@ident" match="docs/elementSpec"/>
+  <xsl:key name="UsedAtt" use="concat(../@ident,@ident)" match="docs/elementSpec/attDef"/>
+  <!--
+1) start a variable and copy in all of the TEI 
+2) read the corpus and get a list of all the elements and their
+attributes that it uses, put that in the same variable
+3) process the variable and read the TEI section. if an element or
+ attribute is not present in the corpus section, put out a delete
+ customization
+4) for every attribute which is of type "enumerated", construct a
+valList
+
+-->
+  <xsl:template name="processAll">
+    <xsl:variable name="count">
+      <xsl:value-of select="count(/n:ROOT/*)"/>
+    </xsl:variable>
+    <!-- assemble together all the TEI elements and attributes, 
+     followed by all the
+     elements and attributes used in the corpus -->
+    <xsl:variable name="stage1">
+      <stage1>
+        <tei>
+          <xsl:for-each select="document($tei)">
+            <xsl:for-each select="key('CLASSES',1)">
+              <classSpec>
+                <xsl:copy-of select="@ident"/>
+                <xsl:copy-of select="@module"/>
+                <xsl:for-each select=".//attDef">
+                  <attDef>
+                    <xsl:copy-of select="@ident"/>
+                    <xsl:call-template name="checktype"/>
+                  </attDef>
+                </xsl:for-each>
+                <xsl:call-template name="classmembers"/>
+              </classSpec>
+            </xsl:for-each>
+            <xsl:for-each select="key('ELEMENTS',1)">
+              <elementSpec>
+                <xsl:copy-of select="@ident"/>
+                <xsl:copy-of select="@module"/>
+                <xsl:for-each select=".//tei:attDef">
+                  <attDef>
+                    <xsl:copy-of select="@ident"/>
+                    <xsl:call-template name="checktype"/>
+                  </attDef>
+                </xsl:for-each>
+                <xsl:call-template name="classatts"/>
+              </elementSpec>
+            </xsl:for-each>
+          </xsl:for-each>
+        </tei>
+        <docs>
+          <xsl:for-each-group select="key('AllTEI',1)" group-by="local-name()">
+            <xsl:sort select="current-grouping-key()"/>
+            <xsl:variable name="ident" select="current-grouping-key()"/>
+            <elementSpec>
+              <xsl:attribute name="ident">
+                <xsl:copy-of select="current-grouping-key()"/>
+              </xsl:attribute>
+              <xsl:for-each-group select="key('Atts',$ident)" group-by="local-name()">
+                <attDef ident="{name()}">
+                  <valList type="closed">
+                    <xsl:for-each-group select="key('attVals',concat($ident,local-name()))" group-by=".">
+                      <xsl:sort select="."/>
+                      <xsl:choose>
+                        <xsl:when test="contains(current-grouping-key(),' ')">
+                          <xsl:for-each select="tokenize(current-grouping-key(),' ')">
+                            <valItem ident="{.}"/>
+                          </xsl:for-each>
+                        </xsl:when>
+                        <xsl:otherwise>
+                          <valItem ident="{current-grouping-key()}"/>
+                        </xsl:otherwise>
+                      </xsl:choose>
+                    </xsl:for-each-group>
+                  </valList>
+                </attDef>
+              </xsl:for-each-group>
+            </elementSpec>
+          </xsl:for-each-group>
+        </docs>
+      </stage1>
+    </xsl:variable>
+    <xsl:variable name="stage2">
+      <stage2>
+        <!-- for every attribute class, see if its members should be
+     deleted, by seeing if they are used anywhere-->
+        <xsl:for-each select="$stage1/stage1/tei/classSpec">
+          <classSpec ident="{@ident}" module="{@module}" type="atts" mode="change">
+            <attList>
+              <xsl:for-each select="attDef">
+                <xsl:variable name="this" select="@ident"/>
+                <xsl:variable name="used">
+                  <xsl:for-each select="../member">
+                    <!--		 <xsl:message>check for <xsl:value-of select="concat(@ident,$this)"/></xsl:message>-->
+                    <xsl:if test="key('UsedAtt',concat(@ident,$this))">true</xsl:if>
+                  </xsl:for-each>
+                </xsl:variable>
+                <xsl:choose>
+                  <xsl:when test="$keepGlobals='true' and $this='n'"/>
+                  <xsl:when test="$keepGlobals='true' and $this='rendition'"/>
+                  <xsl:when test="$keepGlobals='true' and $this='xml:id'"/>
+                  <xsl:when test="$keepGlobals='true' and $this='xml:base'"/>
+                  <xsl:when test="$keepGlobals='true' and $this='xml:space'"/>
+                  <xsl:when test="$keepGlobals='true' and $this='xml:lang'"/>
+                  <xsl:when test="$keepGlobals='true' and $this='rend'"/>
+                  <xsl:when test="$used=''">
+                    <attDef ident="{$this}" mode="delete"/>
+                  </xsl:when>
+                </xsl:choose>
+              </xsl:for-each>
+            </attList>
+          </classSpec>
+        </xsl:for-each>
+        <!-- for every TEI element, say if it is actually used or is to be deleted -->
+        <xsl:for-each select="$stage1/stage1/tei/elementSpec">
+          <xsl:choose>
+            <xsl:when test="key('Used',@ident)">
+              <elementSpec ident="{@ident}" module="{@module}" mode="keep">
+                <xsl:copy-of select="attDef"/>
+              </elementSpec>
+            </xsl:when>
+            <xsl:otherwise>
+              <elementSpec ident="{@ident}" module="{@module}" mode="delete"/>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:for-each>
+        <xsl:if test="$processNonTEI='true'">
+          <xsl:for-each-group select="key('All',1)" group-by="local-name()">
+            <xsl:sort/>
+            <xsl:choose>
+              <xsl:when test="self::n:ROOT"/>
+              <xsl:when test="namespace-uri()='http://www.tei-c.org/ns/1.0'"/>
+              <xsl:otherwise>
+                <!-- build new 'add' elementSpec -->
+                <elementSpec ident="{current-grouping-key()}" mode="add" ns="{namespace-uri()}">
+                  <xsl:text>&#10;</xsl:text>
+                  <xsl:comment>add an &lt;equiv/&gt; to point to an named  template
+in an XSLT file which will transform this to pure TEI</xsl:comment>
+                  <xsl:text>&#10;</xsl:text>
+                  <equiv filter="somefile.xsl" mimeType="text/xsl" name="{current-grouping-key()}"/>
+                  <desc>
+                    <xsl:text>&#10;</xsl:text>
+                    <xsl:comment> Describe the <xsl:value-of select="current-grouping-key()"/> element  here</xsl:comment>
+                    <xsl:text>&#10;</xsl:text>
+                  </desc>
+                  <classes>
+                    <xsl:text>&#10;</xsl:text>
+                    <xsl:comment> Add a 'memberOf key="model.className"' stanza for whatever classes it belongs to  here</xsl:comment>
+                    <xsl:text>&#10;</xsl:text>
+                  </classes>
+                  <content>
+                    <xsl:text>&#10;</xsl:text>
+                    <xsl:comment>Add RNG content model here</xsl:comment>
+                    <xsl:text>&#10;</xsl:text>
+                  </content>
+                  <xsl:if test="key('Atts',local-name())">
+                    <attList>
+                      <xsl:comment>Add attDefs:</xsl:comment>
+                      <xsl:text>&#10;</xsl:text>
+                      <xsl:for-each-group select="key('Atts',local-name())" group-by="local-name()">
+                        <xsl:sort/>
+                        <attDef ident="{local-name()}" mode="add"/>
+                      </xsl:for-each-group>
+                    </attList>
+                  </xsl:if>
+                </elementSpec>
+              </xsl:otherwise>
+            </xsl:choose>
+          </xsl:for-each-group>
+        </xsl:if>
+      </stage2>
+    </xsl:variable>
+    <!-- start writing the final ODD document -->
+    <TEI xml:lang="en">
+      <teiHeader>
+        <fileDesc>
+          <titleStmt>
+            <title>ODD by Example customization</title>
+          </titleStmt>
+          <editionStmt>
+            <edition>generated on     
+	   <date><xsl:value-of select="format-dateTime(current-dateTime(),'[Y]-[M02]-[D02]T[H02]:[m02]:[s02]Z')"/></date>
+	                 </edition>
+          </editionStmt>
+          <publicationStmt>
+            <p> </p>
+          </publicationStmt>
+          <sourceDesc>
+            <p>generated by oddbyexample.xsl, based on analyzing 
+	    <xsl:value-of select="$count"/> files from
+	    <xsl:value-of select="$corpus"/>
+                  </p>
+          </sourceDesc>
+        </fileDesc>
+      </teiHeader>
+      <text>
+        <body>
+          <!--<xsl:copy-of select="$stage1"/>-->
+          <schemaSpec ident="{$schema}">
+            <xsl:attribute name="start">
+              <xsl:if test="$stage2/stage2/elementSpec[@mode='keep' and     @ident='TEI']">TEI</xsl:if>
+              <xsl:text> </xsl:text>
+              <xsl:if test="$stage2/stage2/elementSpec[@mode='keep' and @ident='teiCorpus']">teiCorpus</xsl:if>
+            </xsl:attribute>
+            <moduleRef key="tei"/>
+            <xsl:apply-templates select="$stage2/stage2/classSpec[@module='tei']"/>
+            <moduleRef key="core"/>
+            <!-- we need to list only modules from which elements have been used -->
+            <xsl:for-each-group select="$stage2/stage2/elementSpec[@mode='keep']" group-by="@module">
+              <xsl:sort select="current-grouping-key()"/>
+              <xsl:choose>
+                <xsl:when test="@module='core'"/>
+                <xsl:otherwise>
+                  <moduleRef key="{@module}"/>
+                </xsl:otherwise>
+              </xsl:choose>
+              <xsl:for-each select="current-group()">
+                <xsl:variable name="e" select="@ident"/>
+                <!-- for every attribute, if its a class attribute, see if
+	       its already deleted. if its a local attribute, see if its used. -->
+                <xsl:variable name="a">
+                  <attList>
+                    <xsl:for-each select="attDef">
+                      <xsl:variable name="class" select="@class"/>
+                      <xsl:variable name="ident" select="@ident"/>
+                      <xsl:variable name="enumerated" select="@enumerated"/>
+                      <xsl:for-each select="$stage1">
+                        <xsl:choose>
+                          <xsl:when test="not($class='')      and      $stage2/stage2/classSpec[@ident=$class]/attList/attDef[@ident=$ident]">
+			 
+		       </xsl:when>
+		       <xsl:when test="$keepGlobals='true' and $ident='xml:id'"/>
+		       <xsl:when test="$keepGlobals='true' and $ident='xml:base'"/>
+		       <xsl:when test="$keepGlobals='true' and $ident='xml:space'"/>
+		       <xsl:when test="$keepGlobals='true' and $ident='xml:lang'"/>
+		       <xsl:when test="$keepGlobals='true' and $ident='n'"/>
+		       <xsl:when test="$keepGlobals='true' and $ident='rendition'"/>
+		       <xsl:when test="$keepGlobals='true' and
+				       $ident='rend'"/>
+		       <xsl:when test="$keepGlobals='true' and $ident='facs'"/>
+		       <xsl:when test="not(key('UsedAtt',concat($e,$ident)))">
+			 <attDef ident="{$ident}" mode="delete"/>
+		       </xsl:when>
+		       <xsl:when test="$enumerated='true'">
+			 <attDef ident="{$ident}" mode="change">
+			   <xsl:apply-templates select="key('UsedAtt',concat($e,$ident))/valList"/>
+			 </attDef>
+		       </xsl:when>
+			</xsl:choose>
+		      </xsl:for-each>
+		    </xsl:for-each>
+		  </attList>
+		</xsl:variable>
+                <xsl:for-each select="$a">
+                  <xsl:if test="attList/attDef">
+                    <elementSpec ident="{$e}" mode="change">
+                      <xsl:copy-of select="attList"/>
+                    </elementSpec>
+                  </xsl:if>
+                </xsl:for-each>
+              </xsl:for-each>
+              <xsl:copy-of select="$stage2/stage2/elementSpec[@mode='delete'          and @module=current-grouping-key()]"/>
+              <xsl:apply-templates select="$stage2/stage2/classSpec[@module=current-grouping-key()]"/>
+            </xsl:for-each-group>
+            <xsl:for-each select="$stage2/stage2/elementSpec[@mode='add']">
+              <xsl:text>
+
+
+</xsl:text>
+              <xsl:comment>You've added an element '<xsl:value-of select="@ident"/>'
+	   which does not seem to be a proper TEI element. This will make your TEI
+	   documents non-conformant, but if you really want to do this you should
+	   add an elementSpec for it if you want your document to validate. It
+	   would be better to use a separate namespace. </xsl:comment>
+              <xsl:text>
+
+</xsl:text>
+              <xsl:copy-of select="."/>
+            </xsl:for-each>
+          </schemaSpec>
+        </body>
+      </text>
+    </TEI>
+  </xsl:template>
+  <xsl:template name="classmembers">
+    <xsl:choose>
+      <xsl:when test="@ident='att.global'">
+        <xsl:for-each select="key('ELEMENTS',1)">
+          <xsl:sort select="@ident"/>
+          <member ident="{@ident}"/>
+        </xsl:for-each>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:for-each select="key('MEMBERS',@ident)">
+          <member ident="{ancestor::elementSpec/@ident}"/>
+        </xsl:for-each>
+        <xsl:for-each select="key('CLASSMEMBERS',@ident)/ancestor::classSpec">
+          <xsl:call-template name="classmembers"/>
+        </xsl:for-each>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <xsl:template name="classatts">
+    <xsl:for-each select="classes/memberOf">
+      <xsl:for-each select="key('IDENTS',@key)">
+        <xsl:for-each select=".//tei:attDef">
+          <attDef class="{ancestor::classSpec/@ident}">
+            <xsl:copy-of select="@ident"/>
+            <xsl:call-template name="checktype"/>
+          </attDef>
+        </xsl:for-each>
+        <xsl:call-template name="classatts"/>
+      </xsl:for-each>
+    </xsl:for-each>
+  </xsl:template>
+  <xsl:template name="checktype">
+    <xsl:attribute name="enumerated">
+      <xsl:choose>
+        <xsl:when test="contains($checkAtts,concat(',',@ident,','))">true</xsl:when>
+        <xsl:when test="@ident='n'">false</xsl:when>
+        <xsl:when test="@ident='rend' and $enumerateRend='true'">true</xsl:when>
+        <xsl:when test="@ident='type' and $enumerateType='true'">true</xsl:when>
+        <xsl:when test="valList[@type='closed']">true</xsl:when>
+        <xsl:when test="datatype/rng:ref[@name='data.enumerated']">true</xsl:when>
+        <!--
+      <xsl:when
+	  test="datatype/rng:ref[@name='data.word']">true</xsl:when>
+      -->
+        <xsl:otherwise>false</xsl:otherwise>
+      </xsl:choose>
+    </xsl:attribute>
+  </xsl:template>
+  <xsl:template match="valList">
+    <valList mode="add" type="closed">
+      <xsl:for-each-group select="valItem" group-by="@ident">
+        <xsl:sort select="@ident"/>
+        <valItem ident="{current-grouping-key()}"/>
+      </xsl:for-each-group>
+    </valList>
+  </xsl:template>
+  <xsl:template match="classSpec">
+    <xsl:if test="attList/attDef">
+      <xsl:copy-of select="."/>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template match="text()" mode="copy"/>
+
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/oddbyexample.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/iden.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/iden.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/iden.xsl	(revision 258)
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+		version="2.0">
+<This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+
+$Id: iden.xsl 9646 2011-11-05 23:39:08Z rahtz $
+
+2008, TEI Consortium
+-->
+
+
+<!-- identity transform -->
+<xsl:output method="xml" indent="yes" encoding="utf-8"/>
+
+   <xsl:template match="@*|text()|comment()|processing-instruction()">
+      <xsl:copy-of select="."/>
+   </xsl:template>
+
+
+   <xsl:template match="*">
+      <xsl:copy>
+         <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
+      </xsl:copy>
+   </xsl:template>
+
+
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/iden.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/xhtml2tei.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/xhtml2tei.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/xhtml2tei.xsl	(revision 258)
@@ -0,0 +1,483 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:v="urn:schemas-microsoft-com:vml"
+                xmlns:o="urn:schemas-microsoft-com:office:office"
+                xmlns:w="urn:schemas-microsoft-com:office:word"
+                xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
+                xmlns:h="http://www.w3.org/1999/xhtml"
+                exclude-result-prefixes="h v o w dt"
+                version="1.0">
+
+   <xsl:output method="xml" indent="yes"/>
+
+   <xsl:param name="filename"/>
+
+   <xsl:key name="H" match="h:h1" use="1"/>
+   <xsl:key name="H" match="h:h2" use="1"/>
+   <xsl:key name="H" match="h:h3" use="1"/>
+   <xsl:key name="H" match="h:h4" use="1"/>
+
+   <xsl:template match="h:html">
+      <xsl:variable name="author">
+         <xsl:choose>
+            <xsl:when test="h:head/h:meta[@name='Author']">
+               <xsl:value-of select="h:head/h:meta[@name='Author']/@content"/>
+            </xsl:when>
+            <xsl:when test="h:body/h:address">
+               <xsl:variable name="add">
+                  <xsl:value-of select="h:body/h:address"/>
+               </xsl:variable>
+               <xsl:choose>
+                  <xsl:when test="contains($add,'Author: ')">
+                     <xsl:value-of select="substring-after($add,'Author: ')"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:value-of select="$add"/>
+                  </xsl:otherwise>
+               </xsl:choose>
+            </xsl:when>
+            <xsl:otherwise>OUCS</xsl:otherwise>
+         </xsl:choose>
+      </xsl:variable>
+      <xsl:variable name="date">
+         <xsl:choose>
+            <xsl:when test="h:body/h:address">
+               <xsl:variable name="add">
+                  <xsl:value-of select="h:body/h:address"/>
+               </xsl:variable>
+               <xsl:choose>
+                  <xsl:when test="contains($add,'Date: ')">
+                     <xsl:value-of select="substring-after($add,'Date: ')"/>
+                  </xsl:when>
+                  <xsl:when test="contains($add,'Last updated: ')">
+                     <xsl:value-of select="substring-after($add,'Last updated: ')"/>
+                  </xsl:when>
+                  <xsl:when test="contains($add,'Last Updated: ')">
+                     <xsl:value-of select="substring-after($add,'Last Updated: ')"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:value-of select="$add"/>
+                  </xsl:otherwise>
+               </xsl:choose>
+            </xsl:when>
+            <xsl:otherwise>OUCS</xsl:otherwise>
+         </xsl:choose>
+      </xsl:variable>
+      <TEI.2>
+         <teiHeader>
+            <fileDesc>
+               <titleStmt>
+                  <title>
+                     <xsl:apply-templates select="h:head/h:title"/>
+                  </title>
+                  <author>
+                     <xsl:value-of select="$author"/>
+                  </author>
+               </titleStmt>
+               <editionStmt>
+                  <edition>
+  	                  <date>
+                        <xsl:value-of select="$date"/>
+                     </date>
+                  </edition>
+               </editionStmt>
+               <publicationStmt>
+                  <authority>OUCS</authority>
+	                 <address>
+                     <email>advisory@oucs.ox.ac.uk</email>
+                  </address>
+               </publicationStmt>
+               <sourceDesc>
+                  <p>This is the master version of an original document,
+created by converting an HTML file to TEI XML on TODAYSDATE.</p>
+               </sourceDesc>
+            </fileDesc>
+            <revisionDesc>
+               <change>
+	                 <date>$Date: 2011-10-17 09:55:51 +0100 (Mon, 17 Oct 2011) $</date>
+                  <respStmt>
+                     <name>$Author: rahtz $</name>
+                  </respStmt>
+	                 <item>$Revision: 9513 $</item>
+               </change>
+            </revisionDesc>
+         </teiHeader>
+         <text>
+            <xsl:apply-templates/>
+         </text>
+      </TEI.2>
+      <xsl:text>&#10;</xsl:text>
+   </xsl:template>
+
+   <xsl:template match="h:head"/>
+
+   <xsl:template match="h:body">
+      <body>
+         <xsl:apply-templates/>
+         <!--This code is intended to balance the div tags created by headers with -->
+  <!--     the correct number of /divs. At the moment it fails if there are -->
+  <!-- Hn tags inside td's, which we are intending to make cell labels -->
+   <xsl:variable name="starter">    
+            <xsl:value-of select="substring(name(key('H',1)[1]),2)"/>
+         </xsl:variable>
+         <xsl:variable name="ender">
+            <xsl:value-of select="substring(name(key('H',1)[last()]),2)"/>
+         </xsl:variable>
+         <xsl:variable name="difference">
+            <xsl:value-of select="$starter - $ender"/>
+         </xsl:variable>
+         <xsl:comment>
+     Started with a <xsl:value-of select="$starter"/>, ended with a <xsl:value-of select="$ender"/>
+   diff=<xsl:value-of select="$difference"/>
+         </xsl:comment>
+         <!-- test call of for loop to handle closure of divs
+got to find a way to set a trigger for closing div if no headers -->
+ <xsl:call-template name="for-loop">
+            <xsl:with-param name="i" select="$ender"/>
+            <xsl:with-param name="stepsize" select="1"/>
+            <xsl:with-param name="until" select="$starter"/>
+            <xsl:with-param name="insert" select="'/div'"/>
+         </xsl:call-template> 
+         <!-- old div closing code was here-->
+
+  </body>
+   </xsl:template>
+
+
+   <xsl:template match="h:h1|h:h2|h:h3|h:h4">
+  <!--headers inside td's are labels-->
+  <xsl:choose>
+         <xsl:when test="parent::h:td">
+            <emph>
+               <xsl:value-of select="."/>
+            </emph>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:if test="preceding::h:h1 or preceding::h:h2 or preceding::h:h3 or preceding::h:h4">
+               <xsl:variable name="previous">
+                  <xsl:value-of select="substring(name(preceding::*[name()='h1' or name()='h2' or name()='h3' or name()='h4'][1]),2)"/>
+               </xsl:variable>
+               <xsl:variable name="me">
+                  <xsl:value-of select="substring(name(.),2)"/>
+               </xsl:variable>
+               <xsl:variable name="difference">
+                  <xsl:value-of select="$me - $previous"/>
+               </xsl:variable>
+               <!--
+   <xsl:message>
+ I am a <xsl:value-of select="$me"/>, previous is <xsl:value-of select="$previous"/>, difference is <xsl:value-of select="$difference"/>
+
+   </xsl:message>
+-->
+<!-- test call of for loop to handle this ... -->
+<xsl:if test="$difference &lt; 1">
+                  <xsl:call-template name="for-loop">
+                     <xsl:with-param name="i" select="$previous"/>
+                     <xsl:with-param name="stepsize" select="1"/>
+                     <xsl:with-param name="until" select="$me"/>
+                     <xsl:with-param name="insert" select="'/div'"/>
+                  </xsl:call-template>
+               </xsl:if>
+               <xsl:if test="$difference &gt; 1">
+                  <xsl:call-template name="for-loop">
+                     <xsl:with-param name="i" select="$previous"/>
+                     <xsl:with-param name="stepsize" select="1"/>
+                     <xsl:with-param name="until" select="$me - 2"/>
+                     <xsl:with-param name="insert" select="'div'"/>
+                  </xsl:call-template> 
+               </xsl:if>
+            </xsl:if>
+            <xsl:choose>
+               <xsl:when test="h:a[@name]">
+                  <xsl:text disable-output-escaping="yes">&lt;div id="</xsl:text>
+                  <xsl:value-of select="h:a[@name]/@name"/>
+                  <xsl:text disable-output-escaping="yes">"&gt;</xsl:text>
+               </xsl:when>
+               <xsl:when test="preceding::h:a[1][@name]">
+                  <xsl:text disable-output-escaping="yes">&lt;div id="</xsl:text>
+                  <xsl:value-of select="preceding::h:a[1][@name]/@name"/>
+                  <xsl:text disable-output-escaping="yes">"&gt;</xsl:text>
+               </xsl:when>   
+               <xsl:otherwise>
+                  <xsl:text disable-output-escaping="yes">&lt;div&gt;</xsl:text>
+               </xsl:otherwise>
+            </xsl:choose>
+            <head>
+               <xsl:apply-templates mode="head"/>
+            </head>
+         </xsl:otherwise>
+      </xsl:choose>
+   </xsl:template>
+
+   <!-- low-level markup -->
+<xsl:template match="h:td/h:p">
+      <xsl:apply-templates/>
+   </xsl:template>
+
+   <xsl:template match="h:p">
+      <p>
+         <xsl:apply-templates/>
+      </p>
+   </xsl:template>
+
+   <xsl:template match="h:strong|h:b|h:em|h:i" mode="head">
+      <xsl:apply-templates/>
+   </xsl:template>
+
+   <xsl:template match="h:strong|h:b">
+      <hi>
+         <xsl:apply-templates/>
+      </hi>
+   </xsl:template>
+
+   <xsl:template match="h:tt|h:var|h:kbd|h:samp|h:code">
+      <code>
+         <xsl:apply-templates/>
+      </code>
+   </xsl:template>
+
+   <xsl:template match="h:em|h:i">
+      <emph>
+         <xsl:apply-templates/>
+      </emph>
+   </xsl:template>
+
+   <xsl:template match="h:font"><!-- just continue -->
+  <xsl:apply-templates/>
+   </xsl:template>
+
+   <xsl:template match="h:big|h:small|h:center"><!-- just continue -->
+  <xsl:apply-templates/>
+   </xsl:template>
+
+   <xsl:template match="h:span"><!-- just continue -->
+  <xsl:apply-templates/>
+   </xsl:template>
+   <xsl:template match="h:span[@class]"><!-- just continue -->
+     <hi rend="{@class}">
+       <xsl:apply-templates/>
+     </hi>
+   </xsl:template>
+   <!-- links -->
+
+<xsl:template match="h:a[@href]">
+      <xsl:variable name="content" select="descendant-or-self::text()"/>
+      <xsl:choose>
+         <xsl:when test="@href = $content">
+            <xsl:choose>
+               <xsl:when test="starts-with(@href,'#')">
+                  <ptr target="{substring(@href,2)}"/>
+               </xsl:when>
+               <xsl:otherwise>
+                  <xptr url="{@href}"/>
+               </xsl:otherwise>
+            </xsl:choose>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:choose>
+               <xsl:when test="starts-with(@href,'#')">
+                  <ref target="{substring(@href,2)}">
+                     <xsl:value-of select="$content"/>
+                  </ref>
+               </xsl:when>
+               <xsl:otherwise>
+                  <xref url="{@href}">
+                     <xsl:value-of select="$content"/>
+                  </xref>
+               </xsl:otherwise>
+            </xsl:choose>
+         </xsl:otherwise>
+      </xsl:choose>
+   </xsl:template>
+
+   <!-- ====== quotes, verbatim ====== -->
+<xsl:template match="h:blockquote">
+      <p>
+         <q rend="display">
+            <xsl:apply-templates/>
+         </q>
+      </p>
+   </xsl:template>
+
+   <xsl:template match="h:pre">
+      <eg>
+         <xsl:apply-templates/>
+      </eg>
+   </xsl:template>
+
+   <!-- ============ Lists ============== -->
+<xsl:template match="h:dl">
+      <list type="gloss">
+         <xsl:apply-templates/>
+      </list>
+   </xsl:template>
+
+   <xsl:template match="h:dt">
+      <label>
+         <xsl:apply-templates/>
+      </label>
+   </xsl:template>
+
+   <xsl:template match="h:dd">
+      <item>
+         <xsl:apply-templates/>
+      </item>
+   </xsl:template>
+
+   <xsl:template match="h:ol">
+      <list type="ordered">
+         <xsl:apply-templates/>
+      </list>
+   </xsl:template>
+
+   <xsl:template match="h:ul">
+      <list type="unordered">
+         <xsl:apply-templates/>
+      </list>
+   </xsl:template>
+
+   <xsl:template match="h:li">
+      <item>
+         <xsl:apply-templates/>
+      </item>
+   </xsl:template>
+
+   <!-- ===== sub, sup -->
+<xsl:template match="h:sub">
+      <hi rend="sub">
+         <xsl:apply-templates/>
+      </hi>
+   </xsl:template>
+   <xsl:template match="h:sup">
+      <hi rend="sup">
+         <xsl:apply-templates/>
+      </hi>
+   </xsl:template>
+
+
+
+   <!-- tables -->
+<xsl:template match="h:tr">
+      <row>
+         <xsl:apply-templates/>
+      </row>
+   </xsl:template>
+
+   <xsl:template match="h:p/h:table[@border]">
+      <table border="{@border}">
+         <xsl:apply-templates/>
+      </table>
+   </xsl:template>
+
+   <xsl:template match="h:table[@border]">
+      <p>
+         <table border="{@border}">
+            <xsl:apply-templates/>
+         </table>
+      </p>
+   </xsl:template>
+
+   <xsl:template match="h:td">
+      <cell>
+         <xsl:if test="@valign">
+            <xsl:attribute name="valign">
+               <xsl:value-of select="@valign"/>
+            </xsl:attribute>
+         </xsl:if>
+         <xsl:if test="h:p[@align]">
+            <xsl:attribute name="align">
+               <xsl:value-of select="child::h:p/@align"/>
+            </xsl:attribute>
+         </xsl:if>
+         <xsl:apply-templates/>
+      </cell>
+   </xsl:template>
+   <xsl:template match="h:address"/>
+
+
+
+   <xsl:template match="text()">
+      <xsl:variable name="N">
+         <xsl:value-of select="name(preceding-sibling::*[1])"/>
+      </xsl:variable>
+      <xsl:choose>
+         <xsl:when test="$N='h1' or $N='h3' or $N='h3' or $N='h4'">
+            <p>
+               <xsl:value-of select="normalize-space(.)"/>
+            </p>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:choose>
+               <xsl:when test="parent::h:td">
+                  <xsl:value-of select="."/>
+               </xsl:when>
+               <xsl:otherwise>
+                  <xsl:value-of select="translate(.,'&#160;',' ')"/>      
+               </xsl:otherwise>
+            </xsl:choose>
+         </xsl:otherwise>
+      </xsl:choose>
+   </xsl:template>
+
+   <xsl:template match="h:img">
+      <figure file="{@src}">
+         <xsl:if test="@alt">
+            <figDesc>
+               <xsl:value-of select="@alt"/>
+            </figDesc>
+         </xsl:if>
+      </figure>
+   </xsl:template>
+
+   <xsl:template match="h:form|h:input|h:textarea|h:option|h:select">
+      <xsl:copy>
+         <xsl:copy-of select="@*"/>
+         <xsl:apply-templates/>
+      </xsl:copy>
+   </xsl:template>
+   <xsl:template name="for-loop">
+<!-- simplified from tidwell p86. only does step up or down until -->
+    <xsl:param name="i" select="1"/>
+      <xsl:param name="stepsize" select="1"/>
+      <xsl:param name="until" select="1"/>
+      <xsl:param name="iteration" select="1"/>
+      <xsl:param name="insert" select="''"/>
+
+      <xsl:variable name="step">
+  
+         <xsl:choose>
+            <xsl:when test="$until &lt; $i">
+               <xsl:text>-</xsl:text>
+               <xsl:value-of select="$stepsize"/>
+            </xsl:when>
+            <xsl:otherwise>
+               <xsl:value-of select="$stepsize"/>
+            </xsl:otherwise>
+         </xsl:choose>
+      </xsl:variable>  
+    
+      <xsl:text disable-output-escaping="yes">&lt;</xsl:text>      
+      <xsl:value-of select="$insert"/>
+      <xsl:text disable-output-escaping="yes">&gt;</xsl:text>
+      <xsl:variable name="testpassed">
+         <xsl:choose>
+            <xsl:when test="$i != $until">
+               <xsl:text>true</xsl:text>
+            </xsl:when>
+            <xsl:otherwise>
+               <xsl:text>false</xsl:text>
+            </xsl:otherwise>
+         </xsl:choose>
+      </xsl:variable>
+      <xsl:if test="$testpassed = 'true'">    
+
+         <xsl:call-template name="for-loop">
+            <xsl:with-param name="i" select="$i + $step"/>
+            <xsl:with-param name="stepsize" select="$stepsize"/>
+            <xsl:with-param name="until" select="$until"/>
+            <xsl:with-param name="iteration" select="$iteration + 1"/>
+            <xsl:with-param name="insert" select="$insert"/>
+         </xsl:call-template>
+      </xsl:if>
+   </xsl:template>
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/xhtml2tei.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/odd2nuodd.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/odd2nuodd.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/odd2nuodd.xsl	(revision 258)
@@ -0,0 +1,200 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet version="2.0" 
+	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+	xpath-default-namespace="http://www.tei-c.org/ns/1.0"
+	xmlns="http://www.tei-c.org/ns/1.0"
+>
+
+  <!--
+      
+      $Id: odd2nuodd.xsl 9297 2011-09-07 21:37:09Z rahtz $
+      Sebastian Rahtz 2011/03/26
+      
+      Read an ODD with <elementSpec mode="delete"> statements and rewrite it
+      as <moduleRef include="* * *" or except="* * *">
+      
+  -->
+  <!-- where is a copy of P5? -->
+  <xsl:param name="P5">http://www.tei-c.org/Vault/P5/current/xml/tei/odd/p5subset.xml</xsl:param>
+  
+  <!-- do you want moduleRef generated with @include or @except? -->
+  <xsl:param name="method">include</xsl:param>
+
+
+
+  <xsl:key name="EbyM" match="elementSpec" use="@module"/>
+
+  <xsl:key name="deletedE" match="elementSpec[@mode='delete']" use="@ident"/>
+  <xsl:key name="changedE" match="elementSpec[@mode='change']" use="@ident"/>
+  <xsl:key name="changedE" match="elementSpec[@mode='replace']" use="@ident"/>
+
+  <xsl:variable name="orig" select="/"/>
+
+  <!-- identifty transforms -->
+  <xsl:template match="@*|text()|comment()|processing-instruction()">
+    <xsl:copy-of select="."/>
+  </xsl:template>
+
+  <xsl:template match="@*|text()|comment()|processing-instruction()" mode="stage2">
+    <xsl:copy-of select="."/>
+  </xsl:template>
+
+  <xsl:template match="*">
+    <xsl:copy>
+      <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
+    </xsl:copy>
+  </xsl:template>
+
+  <xsl:template match="*" mode="stage2">
+    <xsl:copy>
+      <xsl:apply-templates
+	  select="*|@*|processing-instruction()|comment()|text()" mode="stage2"/>
+    </xsl:copy>
+  </xsl:template>
+  
+  
+  <!-- work in two phases, so we can zap empty specGrp on pass 2-->
+  <xsl:template match="/">
+    <xsl:variable name="stage1">
+      <xsl:apply-templates/>
+    </xsl:variable>
+    <xsl:for-each select="$stage1">
+      <xsl:apply-templates mode="stage2"/>
+    </xsl:for-each>
+  </xsl:template>
+  
+  <!-- ignore elementSpec @mode='delete' -->
+  <xsl:template match="elementSpec[@mode='delete']"/>
+  
+  <xsl:template match="moduleRef/@include"/>
+  <xsl:template match="moduleRef/@except"/>
+
+  <!-- for any moduleRef, look up all the members of it in P5;
+       if they are not deleted by this odd, add them to a list to be
+       included -->
+  <xsl:template match="moduleRef[@key]">
+    <xsl:variable name="here" select="."/>
+    <xsl:copy>
+      <xsl:apply-templates select="@*"/>
+      <xsl:variable name="module" select="@key"/>
+      <xsl:choose>
+	<xsl:when test="$method='include' and @include">
+	  <xsl:copy-of select="@include"/>
+	</xsl:when>	
+	<xsl:when test="$method='except' and @except">
+	  <xsl:copy-of select="@except"/>
+	</xsl:when>	
+	<xsl:when test="$method='include' and @except">
+	  <xsl:variable name="not">
+	    <xsl:for-each select="tokenize($here/@except,' ')">
+	      <not ident="{.}"/>
+	    </xsl:for-each>
+	  </xsl:variable>
+	  <xsl:variable name="includelist">
+	    <xsl:for-each select="document($P5)">
+	      <xsl:for-each select="key('EbyM',$module)">
+		<xsl:sort select="@ident"/>
+		<xsl:variable name="e" select="@ident"/>
+		<xsl:if test="not($not/not[@ident=$e])">
+		  <xsl:value-of select="$e"/>
+		    <xsl:text> </xsl:text>
+		</xsl:if>
+	      </xsl:for-each>
+	    </xsl:for-each>
+	  </xsl:variable>
+	  <xsl:if test="not($includelist='')">
+	    <xsl:attribute name="include" select="normalize-space($includelist)"/>
+	  </xsl:if>
+	</xsl:when>
+	<xsl:when test="$method='include'">
+	  <xsl:variable name="includelist">
+	    <xsl:for-each select="document($P5)">
+	      <xsl:for-each select="key('EbyM',$module)">
+		<xsl:sort select="@ident"/>
+		<xsl:variable name="e" select="@ident"/>
+		<xsl:for-each select="$orig">
+		  <xsl:choose>
+		  <xsl:when test="key('deletedE',$e)"/>
+		  <xsl:otherwise>
+		    <xsl:value-of select="$e"/>
+		    <xsl:text> </xsl:text>
+		  </xsl:otherwise>
+		  </xsl:choose>
+		</xsl:for-each>
+	      </xsl:for-each>
+	    </xsl:for-each>
+	  </xsl:variable>
+	  <xsl:if test="not($includelist='')">
+	    <xsl:attribute name="include"
+			   select="normalize-space($includelist)"/>
+	  </xsl:if>
+	</xsl:when>
+	<xsl:when test="$method='except' and @include">
+	  <xsl:variable name="yes">
+	    <xsl:for-each select="tokenize($here/@include,' ')">
+	      <yes ident="{.}"/>
+	    </xsl:for-each>
+	  </xsl:variable>
+	  <xsl:variable name="exceptlist">
+	    <xsl:for-each select="document($P5)">
+	      <xsl:for-each select="key('EbyM',$module)">
+		<xsl:sort select="@ident"/>
+		<xsl:variable name="e" select="@ident"/>
+		<xsl:for-each select="$orig">
+		  <xsl:if test="not($yes/yes[@ident=$e])">
+		    <xsl:value-of select="$e"/>
+		    <xsl:text> </xsl:text>
+		  </xsl:if>
+		</xsl:for-each>
+	      </xsl:for-each>
+	    </xsl:for-each>
+	  </xsl:variable>
+	  <xsl:if test="not($exceptlist='')">
+	    <xsl:attribute name="except"  select="normalize-space($exceptlist)"/>
+	  </xsl:if>
+	</xsl:when>
+	<xsl:when test="$method='except'">
+	  <xsl:variable name="exceptlist">
+	    <xsl:for-each select="document($P5)">
+	      <xsl:for-each select="key('EbyM',$module)">
+		<xsl:sort select="@ident"/>
+		<xsl:variable name="e" select="@ident"/>
+		<xsl:for-each select="$orig">
+		  <xsl:if test="key('deletedE',$e)">
+		    <xsl:value-of select="$e"/>
+		    <xsl:text> </xsl:text>
+		  </xsl:if>
+		</xsl:for-each>
+	      </xsl:for-each>
+	    </xsl:for-each>
+	  </xsl:variable>
+	  <xsl:if test="not($exceptlist='')">
+	    <xsl:attribute name="except" select="normalize-space($exceptlist)"/>
+	  </xsl:if>
+	</xsl:when>
+	<xsl:otherwise>
+	  <xsl:message terminate="yes">Method <xsl:value-of
+	  select="$method"/> not supported</xsl:message>
+	</xsl:otherwise>
+      </xsl:choose>
+	</xsl:copy>
+      </xsl:template>
+
+  <xsl:template mode="stage2" match="specGrp[not(*)]"/>
+
+  <xsl:template mode="stage2" match="specGrpRef">
+    <xsl:choose>
+      <xsl:when test="starts-with(@target,'#')">
+	<xsl:for-each
+	    select="id(substring(@target,2))">
+	  <xsl:if test="*">
+	    <specGrpRef target="#{@xml:id}"/>
+	  </xsl:if>
+	</xsl:for-each>
+      </xsl:when>
+      <xsl:otherwise>
+	<xsl:copy-of select="."/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/odd2nuodd.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/makegraphicsanttask.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/makegraphicsanttask.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/makegraphicsanttask.xsl	(revision 258)
@@ -0,0 +1,141 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:tei="http://www.tei-c.org/ns/1.0"
+		xmlns:teix="http://www.tei-c.org/ns/Examples"
+		xmlns:smil="http://www.w3.org/ns/SMIL"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="2.0">
+  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
+      <desc>
+         <p> TEI stylesheet to get list of graphics files and make an
+	 ant task to copy them</p>
+         <p>This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+</p>
+         <p>Author: See AUTHORS</p>
+         <p>Id: $Id: makegraphicsanttask.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
+         <p>Copyright: 2008, TEI Consortium</p>
+      </desc>
+   </doc>
+   <xsl:key name="G" match="tei:graphic[not(ancestor::teix:egXML)]"  use="1"/>
+   <xsl:key name="PB" match="tei:pb[@facs and not(@rend='none')]" use="1"/>
+   <xsl:key name="Timeline" match="tei:timeline" use="1"/>
+   <xsl:param name="mediaoverlay">false</xsl:param>
+   <xsl:param name="filePerPage">false</xsl:param>
+   <xsl:param name="inputDir">.</xsl:param>
+   <xsl:param name="mediaDir">word/media</xsl:param>
+   <xsl:template match="/">
+     <project xmlns="" basedir="." default="dist" name="imagecopy">
+       <target name="dist">
+	 <xsl:if test="key('PB',1) or key('G',1)">
+	   <mkdir>
+	     <xsl:attribute name="dir">
+	       <xsl:text>${outputTempDir}/</xsl:text>
+	       <xsl:value-of select="$mediaDir"/>
+	     </xsl:attribute>
+	   </mkdir>
+	 </xsl:if>
+	 <xsl:if test="$mediaoverlay='true' and key('Timeline',1)">
+	   <xsl:for-each select="key('Timeline',1)">
+	     <xsl:variable name="target">
+	       <xsl:text>${outputTempDir}/</xsl:text>
+	       <xsl:value-of select="$mediaDir"/>
+	       <xsl:text>/audio</xsl:text>
+	       <xsl:number level="any"/>
+	       <xsl:text>.</xsl:text>
+	       <xsl:value-of select="tokenize(@corresp,'\.')[last()]"/>
+	     </xsl:variable>
+	     <copy toFile="{$target}" file="{$inputDir}/{@corresp}"/>
+	   </xsl:for-each>
+	 </xsl:if>
+	 <xsl:for-each select="key('PB',1)">
+	   <xsl:variable name="F">
+	     <xsl:choose>
+	       <xsl:when test="starts-with(@facs,'#')">
+		 <xsl:for-each select="id(substring(@facs,2))">
+		   <xsl:value-of select="tei:graphic[1]/@url"/>
+		 </xsl:for-each>
+	       </xsl:when>
+	       <xsl:otherwise>
+		 <xsl:value-of select="@facs"/>
+	       </xsl:otherwise>
+	     </xsl:choose>
+	   </xsl:variable>
+	   <xsl:variable name="target">
+	     <xsl:text>${outputTempDir}/</xsl:text>
+	     <xsl:value-of select="$mediaDir"/>
+	     <xsl:text>/pageimage</xsl:text>
+	     <xsl:number level="any"/>
+	     <xsl:text>.</xsl:text>
+	     <xsl:value-of select="tokenize($F,'\.')[last()]"/>
+	   </xsl:variable>
+	   <xsl:choose>
+	     <xsl:when test="starts-with($F,'http')">
+	       <get src="{@url}" dest="{$target}"/>
+	     </xsl:when>
+	     <xsl:when test="starts-with($F,'/')">
+	       <copy toFile="{$target}" file="{@url}"/>
+	     </xsl:when>
+	     <xsl:otherwise>
+	       <copy toFile="{$target}" file="{$inputDir}/{$F}"/>
+	     </xsl:otherwise>
+	   </xsl:choose>
+	 </xsl:for-each>
+
+	 <xsl:for-each select="key('G',1)">
+	   <xsl:variable name="F">
+	     <xsl:value-of select="@url"/>
+	   </xsl:variable>
+	   <xsl:variable name="target">
+	     <xsl:text>${outputTempDir}/</xsl:text>
+	     <xsl:value-of select="$mediaDir"/>
+	     <xsl:text>/resource</xsl:text>
+	     <xsl:number level="any"/>
+	     <xsl:text>.</xsl:text>
+	     <xsl:value-of select="tokenize($F,'\.')[last()]"/>
+	   </xsl:variable>
+	   <xsl:choose>
+	     <xsl:when test="starts-with($F,'http')">
+	       <get src="{@url}" dest="{$target}"/>
+	     </xsl:when>
+	     <xsl:when test="starts-with($F,'/')">
+	       <copy toFile="{$target}" file="{@url}"/>
+	     </xsl:when>
+	     <xsl:otherwise>
+	       <copy toFile="{$target}" file="{$inputDir}/{@url}"/>
+	     </xsl:otherwise>
+	   </xsl:choose>
+	 </xsl:for-each>
+       </target>
+     </project>
+ </xsl:template>
+   
+ </xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/makegraphicsanttask.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/html2tei.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/html2tei.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/html2tei.xsl	(revision 258)
@@ -0,0 +1,377 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet 
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    exclude-result-prefixes="tei xs"
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+    xmlns="http://www.tei-c.org/ns/1.0" 
+    xmlns:tei="http://www.tei-c.org/ns/1.0" 
+    version="2.0" 
+    xpath-default-namespace="http://www.w3.org/1999/xhtml">
+
+  <xsl:output method="xml" indent="yes"/>
+
+  <xsl:template match="html">
+    <TEI>
+      <xsl:apply-templates/>
+    </TEI>
+  </xsl:template>
+
+  <xsl:template match="head">
+    <teiHeader>
+      <fileDesc>
+        <titleStmt>
+          <title>
+            <xsl:value-of select="title"/>
+          </title>
+          <author>
+            <xsl:value-of select="meta[@name='dc.Creator']/@content"/>
+          </author>
+        </titleStmt>
+        <publicationStmt>
+	  <p></p>
+        </publicationStmt>
+      </fileDesc>
+    </teiHeader>
+  </xsl:template>
+
+  <xsl:template match="body">
+    <text>
+      <body>
+      <xsl:variable name="Body">
+	<HEAD level="1" magic="true">Start</HEAD>
+        <xsl:apply-templates/>
+      </xsl:variable>
+
+      <xsl:variable name="Body2">
+	<xsl:for-each select="$Body">
+	  <xsl:apply-templates mode="pass1"/>
+	</xsl:for-each>
+      </xsl:variable>
+
+      <xsl:for-each select="$Body2">
+        <xsl:for-each-group select="tei:*" group-starting-with="tei:HEAD[@level='1']">
+          <xsl:choose>
+            <xsl:when test="self::tei:HEAD[@level='1']">
+	      <xsl:call-template name="group-by-section"/>
+            </xsl:when>
+            <xsl:otherwise>
+	      <xsl:call-template name="inSection"/>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:for-each-group>
+      </xsl:for-each>
+    </body>
+    </text>
+  </xsl:template>
+
+
+  <xsl:template name="group-by-section">
+    <xsl:variable name="ThisHeader" select="number(@level)"/>
+    <xsl:variable name="NextHeader" select="number(@level)+1"/>
+    <xsl:choose>
+      <xsl:when test="@magic">
+	  <xsl:for-each-group select="current-group() except ."
+			      group-starting-with="tei:HEAD[number(@level)=$NextHeader]">
+	    <xsl:choose>
+	      <xsl:when test="self::tei:HEAD">
+		<xsl:call-template name="group-by-section"/>
+	      </xsl:when>
+	    <xsl:otherwise>
+	      <xsl:call-template name="inSection"/>
+	    </xsl:otherwise>
+	    </xsl:choose>
+	  </xsl:for-each-group>
+      </xsl:when>
+      <xsl:otherwise>
+	<div>
+	  <xsl:if test="@style">
+	    <xsl:attribute name="rend" select="@style"/>
+	  </xsl:if>
+	  <xsl:if test="not(@interpolated='true')">
+	    <head>
+	      <xsl:apply-templates mode="pass1"/>
+	    </head>
+	  </xsl:if>
+	  <xsl:for-each-group select="current-group() except ."
+			      group-starting-with="tei:HEAD[number(@level)=$NextHeader]">
+	    <xsl:choose>
+	      <xsl:when test="self::tei:HEAD">
+		<xsl:call-template name="group-by-section"/>
+	      </xsl:when>
+	    <xsl:otherwise>
+		<xsl:call-template name="inSection"/>
+	    </xsl:otherwise>
+	    </xsl:choose>
+	  </xsl:for-each-group>
+	</div>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+
+  <xsl:template name="inSection">
+    <xsl:for-each-group select="current-group()"
+			group-adjacent="if (self::tei:GLOSS)
+					then 1
+					else 2">      
+      <xsl:choose>
+	<xsl:when test="current-grouping-key()=1">
+	  <list type="gloss">
+	    <xsl:for-each select="current-group()">
+	      <xsl:element name="{@n}">
+		<xsl:apply-templates mode="pass2"/>
+	      </xsl:element>
+	    </xsl:for-each>
+	  </list>
+	</xsl:when>
+	<xsl:otherwise>
+	  <xsl:for-each select="current-group()">
+	    <xsl:apply-templates select="." mode="pass2"/>
+	  </xsl:for-each>
+	</xsl:otherwise>
+      </xsl:choose>
+    </xsl:for-each-group>
+  </xsl:template>
+
+  <xsl:template match="h1|h2|h3|h4|h5|h6|h7">
+    <HEAD level="{substring(local-name(),2,1)}">
+      <xsl:apply-templates select="@*"/>
+      <xsl:apply-templates/>
+    </HEAD>
+  </xsl:template>
+		
+  <xsl:template match="@*|text()|comment()|processing-instruction()" mode="pass1">
+    <xsl:copy-of select="."/>
+  </xsl:template>
+
+  <xsl:template match="tei:p[not(node())]"
+		mode="pass1"/>
+
+  <xsl:template match="tei:HEAD" mode="pass1">
+    <xsl:if test="preceding-sibling::tei:HEAD">
+      <xsl:variable name="prev"
+		    select="xs:integer(number(preceding-sibling::tei:HEAD[1]/@level))"/>
+      <xsl:variable name="current"
+		    select="xs:integer(number(@level))"/>
+	<xsl:if test="($current - $prev) &gt;1 ">
+	  <!--<xsl:message>Walk from <xsl:value-of select="$prev"/> to <xsl:value-of select="$current"/></xsl:message>-->
+	  <xsl:for-each
+	      select="$prev + 1   to $current - 1 ">
+	    <HEAD interpolated='true' level="{.}"/>
+	  </xsl:for-each>
+	</xsl:if>
+    </xsl:if>
+    <xsl:copy>
+    <xsl:apply-templates
+	select="*|@*|processing-instruction()|comment()|text()"
+	mode="pass1"/>
+    </xsl:copy>
+  </xsl:template>
+
+  <xsl:template match="*" mode="pass1">
+    <xsl:copy>
+      <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()" mode="pass1"/>
+    </xsl:copy>
+  </xsl:template>
+
+  <xsl:template match="@*|text()|comment()|processing-instruction()" mode="pass2">
+    <xsl:copy-of select="."/>
+  </xsl:template>
+
+  <xsl:template match="tei:p[not(*) and normalize-space(.)='']" mode="pass2"/>
+
+  <xsl:template match="*" mode="pass2">
+    <xsl:copy>
+      <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()" mode="pass2"/>
+    </xsl:copy>
+  </xsl:template>
+
+  <xsl:template match="br">
+    <lb/>
+  </xsl:template>
+
+  <xsl:template match="a">
+    <xsl:choose>
+      <xsl:when test="@href">
+        <ref target="{@href}">
+          <xsl:apply-templates/>
+        </ref>
+      </xsl:when>
+      <xsl:when test="@name">
+        <anchor>
+          <xsl:attribute name="xml:id" select="@name"/>
+        </anchor>
+        <xsl:apply-templates/>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="li">
+    <item>
+      <xsl:apply-templates/>
+    </item>
+  </xsl:template>
+
+  <xsl:template match="div">
+      <xsl:apply-templates/>
+  </xsl:template>
+
+  <xsl:template match="link">
+</xsl:template>
+
+  <xsl:template match="meta">
+</xsl:template>
+
+  <xsl:template match="p">
+    <p>
+      <xsl:apply-templates select="*|@*|text()|comment()"/>
+    </p>
+  </xsl:template>
+  <xsl:template match="p[@class='note']">
+    <note>
+      <xsl:apply-templates select="*|@*|text()|comment()"/>
+    </note>
+  </xsl:template>
+  <xsl:template match="title">
+</xsl:template>
+  <xsl:template match="ul">
+    <list type="unordered">
+      <xsl:apply-templates/>
+    </list>
+  </xsl:template>
+  <xsl:template match="ol">
+    <list type="ordered">
+      <xsl:apply-templates/>
+    </list>
+  </xsl:template>
+  <xsl:template match="em">
+    <hi rend="italic">
+      <xsl:apply-templates/>
+    </hi>
+  </xsl:template>
+  <xsl:template match="img">
+    <graphic url="{@src}">
+      <xsl:for-each select="@width">
+        <xsl:attribute name="width">
+          <xsl:value-of select="."/>
+          <xsl:analyze-string select="." regex="^[0-9]+$">
+            <xsl:matching-substring>
+              <xsl:text>px</xsl:text>
+            </xsl:matching-substring>
+          </xsl:analyze-string>
+        </xsl:attribute>
+      </xsl:for-each>
+      <xsl:for-each select="@height">
+        <xsl:attribute name="height">
+          <xsl:value-of select="."/>
+          <xsl:analyze-string select="." regex="^[0-9]+$">
+            <xsl:matching-substring>
+              <xsl:text>px</xsl:text>
+            </xsl:matching-substring>
+          </xsl:analyze-string>
+        </xsl:attribute>
+      </xsl:for-each>
+    </graphic>
+  </xsl:template>
+
+  <xsl:template match="pre">
+    <eg>
+      <xsl:apply-templates/>
+    </eg>
+  </xsl:template>
+
+  <xsl:template match="strong">
+    <hi rend="bold">
+      <xsl:apply-templates/>
+    </hi>
+  </xsl:template>
+
+  <xsl:template match="sup">
+    <hi rend="sup">
+      <xsl:apply-templates/>
+    </hi>
+  </xsl:template>
+
+  <xsl:template match="@class">
+    <xsl:attribute name="rend" select="."/>
+  </xsl:template>
+
+  <xsl:template match="@id">
+    <xsl:attribute name="xml:id" select="."/>
+  </xsl:template>
+
+  <xsl:template match="@title"/>
+
+  <xsl:template match="@*|comment()|text()">
+    <xsl:copy-of select="."/>
+  </xsl:template>
+
+  <xsl:template match="span">
+    <hi>
+      <xsl:if test="@class">
+	<xsl:attribute name="rend" select="@class"/>
+      </xsl:if>
+      <xsl:apply-templates select="@*|*|text()"/>
+    </hi>
+  </xsl:template>
+
+  <xsl:template match="b">
+    <hi rend="bold">
+      <xsl:apply-templates select="@*|*|text()"/>
+    </hi>
+  </xsl:template>
+
+  <xsl:template match="i">
+    <hi rend="italic">
+      <xsl:apply-templates select="@*|*|text()"/>
+    </hi>
+  </xsl:template>
+
+  <xsl:template match="font">
+      <xsl:apply-templates/>
+  </xsl:template>
+
+  <xsl:template match="blockquote">
+    <quote>
+      <xsl:apply-templates select="@*|*|text()"/>
+    </quote>
+  </xsl:template>
+
+  <xsl:template match="tt">
+    <code>
+      <xsl:apply-templates select="@*|*|text()"/>
+    </code>
+  </xsl:template>
+
+  <xsl:template match="code">
+    <eg>
+      <xsl:apply-templates select="@*|*|text()"/>
+    </eg>
+  </xsl:template>
+
+  <xsl:template match="table">
+    <table>
+      <xsl:apply-templates select="@*|*|text()"/>
+    </table>
+  </xsl:template>
+
+  <xsl:template match="td">
+    <cell>
+      <xsl:apply-templates select="@*|*|text()"/>
+    </cell>
+  </xsl:template>
+
+  <xsl:template match="tr">
+    <row>
+      <xsl:apply-templates select="@*|*|text()"/>
+    </row>
+  </xsl:template>
+
+  <xsl:template match="hr"/>
+
+  <xsl:template match="*">
+    <xsl:message>UNKNOWN TAG <xsl:value-of select="name()"/></xsl:message>
+    <xsl:apply-templates/>
+  </xsl:template>
+
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/html2tei.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/ImageInfo/build.xml
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/ImageInfo/build.xml	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/ImageInfo/build.xml	(revision 258)
@@ -0,0 +1,18 @@
+<project name="Image Size Reader" default='build'>
+
+	<target name="build">
+		<mkdir dir="bin" />
+		<javac srcdir='src' destdir='bin' includeantruntime='true' />
+		<copy file='antlib.xml' todir='bin' />
+	</target>
+
+	<target name='jar' depends='build'>
+		<jar destfile='ImageInfo.jar' basedir='bin' />
+	</target>
+
+	<target name='clean'>
+		<delete dir='bin' />
+		<delete dir='build' />
+	</target>
+
+</project>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/ImageInfo/build.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/ImageInfo/antlib.xml
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/ImageInfo/antlib.xml	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/ImageInfo/antlib.xml	(revision 258)
@@ -0,0 +1,4 @@
+<?xml version="1.0"?>
+<antlib>
+	<taskdef name="generate-image-size-report" classname="ImageTask" />
+</antlib>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/ImageInfo/antlib.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/ImageInfo/ImageInfo.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/ImageInfo/ImageInfo.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/addlang.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/addlang.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/addlang.xsl	(revision 258)
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+   <xsl:output encoding="utf-8" method="xml" indent="yes"/>
+
+   <xsl:param name="newfile"/>
+   <xsl:param name="newlang"/>
+   <xsl:param name="overwrite">true</xsl:param>
+
+   <xsl:key name="K" match="entry" use="key"/>
+
+   <xsl:template match="@*|processing-instruction()|comment()|text()">
+      <xsl:copy/>
+   </xsl:template>
+
+   <xsl:template match="text">
+      <xsl:choose>
+         <xsl:when test="not(@xml:lang) or not(@xml:lang=$newlang)">
+            <xsl:copy-of select="."/>
+         </xsl:when>
+         <xsl:when test="$overwrite='false' and @xml:lang=$newlang">
+            <xsl:copy-of select="."/>
+         </xsl:when>
+      </xsl:choose>
+
+   </xsl:template>
+
+   <xsl:template match="*">
+      <xsl:copy>
+         <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
+      </xsl:copy>
+   </xsl:template>
+
+   <xsl:template match="entry">
+      <xsl:variable name="k" select="key"/>
+      <xsl:copy>
+         <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
+         <xsl:for-each select="document($newfile)/i18n">
+            <xsl:for-each select="key('K',$k)">
+               <xsl:message>Go <xsl:value-of select="$k"/>
+               </xsl:message>
+	              <xsl:copy-of select="text[@xml:lang=$newlang]"/>
+            </xsl:for-each>
+         </xsl:for-each>
+      </xsl:copy>
+
+   </xsl:template>
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/addlang.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/extract-xsl-from-sch.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/extract-xsl-from-sch.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/extract-xsl-from-sch.xsl	(revision 258)
@@ -0,0 +1,78 @@
+<xsl:stylesheet
+    xmlns:s="http://www.ascc.net/xml/schematron"
+    xmlns:tei="http://www.tei-c.org/ns/1.0"
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+    xmlns:i="http://www.iso.org/ns/1.0"
+    xmlns:XSL="http://www.w3.org/1999/XSL/TransformAlias" 
+    exclude-result-prefixes="xsl s" 
+    version="2.0"
+>
+
+<xsl:namespace-alias stylesheet-prefix="XSL" result-prefix="xsl"/>
+
+<xsl:key name="CONTEXTS" use="." match="@context"/>
+<xsl:key name="ALLCONTEXTS" use="1" match="@context"/>
+<xsl:output method="xml" indent="yes" encoding="utf-8"/>
+
+
+<xsl:template match="/">
+  <XSL:stylesheet
+      xmlns:i="http://www.iso.org/ns/1.0"
+      xmlns:tei="http://www.tei-c.org/ns/1.0"
+      xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+      version="2.0"
+      >
+   
+   <xsl:for-each select="key('ALLCONTEXTS',1)">
+     <xsl:if test="generate-id(.)=generate-id(key('CONTEXTS',.)[1])">
+       <XSL:template match="{.}" mode="checkSchematron">
+	 <xsl:for-each select="key('CONTEXTS',.)">
+	   <xsl:for-each select="parent::s:rule">
+	     <xsl:for-each select="s:assert|s:report">
+	       <xsl:choose>
+		 <xsl:when test="self::s:assert">
+		   <XSL:if test="not({@test})">
+		     <XSL:call-template name="generateError">
+		       <XSL:with-param name="message">
+			 <xsl:value-of select="text()"/>
+		       </XSL:with-param>
+		     </XSL:call-template>
+		   </XSL:if>
+		 </xsl:when>
+		 <xsl:when test="self::s:report">
+		   <XSL:if test="{@test}">
+		     <XSL:call-template name="generateError">
+		       <XSL:with-param name="message">
+			 <xsl:value-of select="text()"/>
+		       </XSL:with-param>
+		     </XSL:call-template>
+		   </XSL:if>
+		 </xsl:when>
+	       </xsl:choose>
+	     </xsl:for-each>
+	   </xsl:for-each>
+	 </xsl:for-each>
+	 <XSL:call-template name="copyIt"/>
+       </XSL:template>
+     </xsl:if>
+  </xsl:for-each>
+
+  <XSL:template match="processing-instruction()" mode="checkSchematron">
+    <XSL:call-template name="copyMe"/>
+  </XSL:template>
+  
+  <XSL:template match="@*|text()|comment()" mode="checkSchematron">
+    <XSL:call-template name="copyMe"/>
+  </XSL:template>
+  
+  <XSL:template match="*" mode="checkSchematron">
+    <XSL:call-template name="copyIt"/>
+  </XSL:template>
+
+
+</XSL:stylesheet>
+
+
+</xsl:template>
+
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/extract-xsl-from-sch.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/folint.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/folint.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/folint.xsl	(revision 258)
@@ -0,0 +1,3224 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- ===================================================================
+
+This stylesheet is meant as a replacement to a DTD for XSL Formatting
+objects. It checks structural validity of an XSL FO document, issuing
+messages at inconsistencies found. As compared to DTD, stylesheet
+validation offers the following advantages:
+
+1. More flexibility in controlling the document structure. For example,
+the stylesheet can control the following aspects of the document
+structure that a DTD cannot handle:
+
+  - check for block-level content through intermediate fo:wrapper elements;
+  - exclude contents of fo:instream-foreign-object from validation;
+  - check mutual exclusion of @internal-destination and @external-destination;
+  - check fo:marker/fo:initial-property-set position in a mixed content model;
+  - check that fo:marker is a descendant of fo:flow;
+  - check that a footnote may not contain other footnotes or floats;
+  - etc.
+
+2. Improved readability of validation error messages. Frequent errors can get
+a separate message that explains the problem and eventually offers a hint
+to fix it. (In many respects, this is still a TODO :-)).
+
+3. Namespace awareness. The namespace prefix need not be fixed anymore
+(as it was the case with DTD validation).
+
+4. Smart handling of attribute values - "partial" validation. This stylesheet
+catches misprints in predefined attribute values but passes expressions through.
+
+*************************************************************************
+
+IMPLEMENTATION NOTES
+
+1. Stylesheet structure and techniques.
+
+The structure of this stylesheet is trivial: we apply templates to each elements
+and attributes, and issue an error message each time there is something suspicious
+about the document structure. There is a dozen of named templates that assist us
+in performing common tasks.
+
+1.1. Validating element names and content models
+
+Each element described in XSL 1.0 has a matching template, and all
+incorrectly named or missplaced elements are catched by a default rule
+(redefined to complain about invalid elements). Inside each template,
+there is a number of checks for obligatory attributes and content model.
+The document-node template checks namespace correctness and presence
+of fo:root as the top node.
+
+1.2. Validating attribute occurrency
+
+By design of XSL, almost every property may be in principle specified
+anywhere. Attribute occurrence can be reliably limited only in the
+following places:
+
+  - fo:layout-master-set and its descendants;
+  - terminal inline elements - fo:character, fo:page-number,
+    fo:page-number-citation, fo:initial-property-set;
+  - graphics - fo:external-graphics, fo:instream-foreign-object.
+
+I used the following approach to achieve this: the default rule
+for @* complains about incorrect attribute. However, the priority
+for this default rule differs across the element tree:
+
+ * -2 for fo:root, fo:page-sequence and all descendants
+   of fo:page-sequence;
+
+ *  2 for fo:simple-page-master and its descendants;
+
+ *  4 for fo:layout-master-set and its descendants other than
+      fo:simple-master/fo:region-*.
+
+For each correct attribute, the stylesheet contains an enabling template.
+Attributes that can occur only inside fo:page-sequence get enabling
+templates with default priority; attributes permitted on region
+descriptors get priority="3"; attributes of other fo:layout-master-set
+children will have priority="5".
+
+To limit attribute occurrence on atomic inlines and graphics, there are
+two disabling named templates defined. They are added inside enabling
+templates.
+
+1.3. Validating attribute values.
+
+Validation of attribute values is hard in XSL FO because of expressions:
+even properties with a closed list of possible values can be specified
+as expressions. This stylesheet validates attributes "partially":
+
+ - attributes that can get only fixed values are validated only if their value
+   does not contain a pair of parentheses (because any expression inside them
+   should inevitably contain a function call);
+
+ - attributes that can get numeric values are validated if their value
+   does not contain any of the following:
+
+     * parentheses;
+     * math operators;
+     * digits.
+
+This gives a reliable method of catching mistyped values of attributes.
+
+There are three cases where additional processing is necessary:
+
+  A. Validation of URIs. Attributes that may get URI values are checked
+     to be of the form 'url(...)'.
+
+  B. Validation of 'content-type' attribute. It is checked to start
+     with either 'content-type:' or 'namespace:'.
+
+  C. Validation of 'text-align' attribute. This attribute may have an
+     arbitrary string as its value; therefore, its correct validation
+     is impossible - a mistype in any of the fixed values turns it
+     into a 'string'. Because 'string' alignment is rare, and fixed
+     values for text-align are ubiquitous, I felt necessary to introduce
+     some heuristics to distinguish between table-alignment strings
+     and mistyped predefined tokens. The heuristics is as follows:
+     if a value contains only alphabetic characters, it's a keyword 
+     and should match one of the predefined tokens. Otherwise, it's 
+     a string and should not be spellchecked.
+
+     (Frankly speaking, a 'string' value of "left" cannot be distinguished
+     from a token 'left'. The property is really poorly designed.)
+
+2. This stylesheet also contains checks for some RenderX extensions to XSL FO.
+They are placed into a separate namespace, and should not interfere
+with the correct validation of conformant XSL FO documents.
+
+==================================================================== --><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:fo="http://www.w3.org/1999/XSL/Format"
+                xmlns:rx="http://www.renderx.com/XSL/Extensions"
+                version="1.0"
+                exclude-result-prefixes="fo rx">
+
+   <xsl:output method="xml" omit-xml-declaration="yes"/>
+
+   <!-- Strictness level. Currently used levels: 0 (loose), 1 (normal), 2 (pedantic) -->
+<xsl:param name="strictness">1</xsl:param>
+
+   <!-- =================================== -->
+<!-- Match topmost node - must be <root> -->
+
+<xsl:template match="/">
+      <xsl:if test="not(fo:root)">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">
+               <xsl:choose>
+                  <xsl:when test="local-name(*[1]) = 'root'">
+                     <xsl:text>Incorrect namespace at top element - should be 'http://www.w3.org/1999/XSL/Format'</xsl:text>
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <xsl:text>Incorrect top element - should be 'root'</xsl:text>
+                  </xsl:otherwise>
+               </xsl:choose>
+            </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:apply-templates select="fo:root"/>
+   </xsl:template>
+
+
+   <!-- =================================== -->
+<!-- Root                                -->
+
+<xsl:template match="fo:root">
+      <xsl:if test="@*[.='inherit']">
+         <xsl:call-template name="print-warning">
+            <xsl:with-param name="msg">Attributes with value of 'inherit' are meaningless on '<xsl:value-of select="name()"/>'.</xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:apply-templates select="@*"/>
+      <xsl:call-template name="no-text"/>
+
+      <xsl:apply-templates select="*[not(self::rx:meta-info                                   or self::fo:layout-master-set                                   or self::fo:declarations                                   or self::rx:outline                                   or self::fo:page-sequence)]"
+                           mode="report-intrusive-elements"/>
+
+      <xsl:if test="not(fo:layout-master-set)">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Element 'layout-master-set' is required as a child of '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:if test="count(fo:layout-master-set) &gt; 1">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">There can be only one '<xsl:value-of select="name(fo:layout-master-set[1])"/>' element as a child of '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:if test="count(fo:declarations) &gt; 1">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">There can be only one '<xsl:value-of select="name(fo:declarations[1])"/>' element as a child of '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:if test="not(fo:page-sequence)">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">There should be at least one 'page-sequence' element as a child of '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:if test="fo:layout-master-set[preceding-sibling::fo:declarations]">
+         <xsl:call-template name="print-warning">
+            <xsl:with-param name="msg">Element '<xsl:value-of select="name(fo:layout-master-set[1])"/>' shall precede '<xsl:value-of select="name(fo:declarations[1])"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:if test="fo:declarations[preceding-sibling::fo:page-sequence]">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Element '<xsl:value-of select="name(fo:declarations[1])"/>' shall be placed before the first '<xsl:value-of select="name(fo:page-sequence[1])"/>' element. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:if test="fo:layout-master-set[preceding-sibling::fo:page-sequence]">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Element '<xsl:value-of select="name(fo:layout-master-set[1])"/>' shall be placed before the first '<xsl:value-of select="name(fo:page-sequence[1])"/>' element. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <!-- Tests of RenderX extension elements -->
+  <xsl:if test="count(rx:meta-info) &gt; 1">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">There can be only one '<xsl:value-of select="name(rx:meta-info[1])"/>' element as a child of '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:if test="count(rx:outline) &gt; 1">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">There can be only one '<xsl:value-of select="name(rx:outline[1])"/>' element as a child of '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:if test="rx:meta-info[preceding-sibling::*]">
+         <xsl:call-template name="print-warning">
+            <xsl:with-param name="msg">Element '<xsl:value-of select="name(rx:meta-info[1])"/>' should be the first child of '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:if test="rx:outline[preceding-sibling::fo:page-sequence]">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Element '<xsl:value-of select="name(rx:outline[1])"/>' shall be placed before the first '<xsl:value-of select="name(fo:page-sequence[1])"/>' element. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:apply-templates select="*"/>
+
+   </xsl:template>
+
+
+   <!-- =================================== -->
+<!-- Layout-master-set                   -->
+
+<xsl:template match="fo:layout-master-set">
+      <xsl:apply-templates select="@*"/>
+      <xsl:call-template name="no-text"/>
+
+      <xsl:apply-templates select="*[not(self::fo:simple-page-master                                   or self::fo:page-sequence-master)]"
+                           mode="report-intrusive-elements">
+         <xsl:with-param name="reason">Only 'simple-page-master' and 'page-sequence-master' elements are permitted in this context.</xsl:with-param>
+      </xsl:apply-templates>
+
+      <xsl:if test="not(fo:simple-page-master)">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">There should be at least one 'simple-page-master' element inside '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:apply-templates select="*"/>
+   </xsl:template>
+
+
+   <!-- =================================== -->
+<!-- Simple-page-master                  -->
+
+<xsl:template match="fo:simple-page-master">
+      <xsl:apply-templates select="@*"/>
+      <xsl:call-template name="no-text"/>
+
+      <xsl:apply-templates select="*[not(self::fo:region-body                                   or self::fo:region-before                                   or self::fo:region-after                                   or self::fo:region-start                                   or self::fo:region-end)]"
+                           mode="report-intrusive-elements">
+         <xsl:with-param name="reason">Only region descriptors are permitted in this context.</xsl:with-param>
+      </xsl:apply-templates>
+
+      <xsl:if test="not(@master-name)">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Attribute 'master-name' is required for '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:variable name="master-name" select="@master-name"/>
+      <xsl:if test="ancestor::fo:layout-master-set             and (following-sibling::*[@master-name = $master-name]               or preceding-sibling::*[@master-name = $master-name])">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">
+        Duplicate identifier: master-name="<xsl:value-of select="$master-name"/>".
+        Property 'master-name' should be unique within '<xsl:value-of select="name(ancestor::fo:layout-master-set[1])"/>'.
+      </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:if test="not(fo:region-body)">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Element 'region-body' is required inside '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:if test="count(fo:region-body) &gt; 1">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">There can be only one '<xsl:value-of select="name(fo:region-body[1])"/>' element inside '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:if test="count(fo:region-before) &gt; 1">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">There can be only one '<xsl:value-of select="name(fo:region-before[1])"/>' element inside '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:if test="count(fo:region-after) &gt; 1">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">There can be only one '<xsl:value-of select="name(fo:region-after[1])"/>' element inside '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:if test="count(fo:region-start) &gt; 1">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">There can be only one '<xsl:value-of select="name(fo:region-start[1])"/>' element inside '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:if test="count(fo:region-end) &gt; 1">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">There can be only one '<xsl:value-of select="name(fo:region-end[1])"/>' element inside '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <!-- I didn't want to control the ordering of regions; -->
+  <!-- but they convinced me...                          -->
+
+  <xsl:if test="$strictness &gt; 0">
+         <xsl:if test="fo:region-body/preceding-sibling::*[self::fo:region-before                                                    or self::fo:region-after                                                    or self::fo:region-start                                                    or self::fo:region-end]                or fo:region-before/preceding-sibling::*[self::fo:region-after                                                    or self::fo:region-start                                                    or self::fo:region-end]                or fo:region-after/preceding-sibling::*[self::fo:region-start                                                    or self::fo:region-end]                or fo:region-start/preceding-sibling::fo:region-end">
+            <xsl:call-template name="print-warning">
+               <xsl:with-param name="msg">Incorrect order of region descriptors inside '<xsl:value-of select="name()"/>'. Regions shall be ordered according to the following content model: fo:region-body, fo:region-before?, fo:region-after?, fo:region-start?, fo:region-end?</xsl:with-param>
+            </xsl:call-template>
+         </xsl:if>
+      </xsl:if>
+
+      <xsl:apply-templates select="*"/>
+   </xsl:template>
+
+   <!-- =================================== -->
+<!-- Regions                             -->
+
+<xsl:template match="fo:region-body                    | fo:region-before                    | fo:region-after                    | fo:region-start                    | fo:region-end">
+      <xsl:apply-templates select="@*"/>
+      <xsl:call-template name="empty-element"/>
+      <xsl:if test="not(@extent) and not (self::fo:region-body)">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Attribute 'extent' is required for '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:variable name="region-name">
+         <xsl:choose>
+            <xsl:when test="@region-name">
+               <xsl:value-of select="@region-name"/>
+            </xsl:when>
+            <xsl:otherwise>
+               <xsl:value-of select="concat('xsl-', local-name())"/>
+            </xsl:otherwise>
+         </xsl:choose>
+      </xsl:variable>
+
+      <xsl:if test="ancestor::fo:simple-page-master              and (preceding-sibling::*[@region-name = $region-name]                or following-sibling::*[@region-name = $region-name])">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">
+        Duplicate identifier: region-name="<xsl:value-of select="$region-name"/>".
+        Property 'region-name' shall be unique within '<xsl:value-of select="name(ancestor::fo:simple-page-master[1])"/>'.
+      </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+  
+      <xsl:if test="$strictness &gt; 1">
+         <xsl:if test="@*[starts-with(local-name(), 'padding')]                     [normalize-space(.) != '0'                   and normalize-space(.) != '0pt'                  and normalize-space(.) != '0px'                  and normalize-space(.) != '0mm'                  and normalize-space(.) != '0em'                  and normalize-space(.) != '0cm'                  and normalize-space(.) != '0pc'                  and normalize-space(.) != '0in']">
+            <xsl:call-template name="print-warning">
+               <xsl:with-param name="msg">
+          Padding on '<xsl:value-of select="name()"/>' is a RenderX extension.
+        </xsl:with-param>
+            </xsl:call-template>
+         </xsl:if>
+
+         <xsl:if test="@*[starts-with(local-name(), 'border')]">
+            <xsl:call-template name="print-warning">
+               <xsl:with-param name="msg">
+          Border on '<xsl:value-of select="name()"/>' is a RenderX extension.
+       </xsl:with-param>
+            </xsl:call-template>
+         </xsl:if>
+      </xsl:if>
+
+   </xsl:template>
+
+
+   <!-- =================================== -->
+<!-- Page-sequence-master                -->
+
+<xsl:template match="fo:page-sequence-master">
+      <xsl:apply-templates select="@*"/>
+      <xsl:call-template name="no-text"/>
+
+      <xsl:if test="not(@master-name)">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Attribute 'master-name' is required for '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:variable name="master-name" select="@master-name"/>
+      <xsl:if test="ancestor::fo:layout-master-set             and (following-sibling::*[@master-name = $master-name]               or preceding-sibling::*[@master-name = $master-name])">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">
+        Duplicate identifier: master-name="<xsl:value-of select="$master-name"/>".
+        Property 'master-name' should be unique within '<xsl:value-of select="name(ancestor::fo:layout-master-set[1])"/>'.
+      </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:apply-templates select="*[not(self::fo:single-page-master-reference                                   or self::fo:repeatable-page-master-reference                                   or self::fo:repeatable-page-master-alternatives)]"
+                           mode="report-intrusive-elements">
+         <xsl:with-param name="reason">Only page sequence specifiers are permitted in this context.</xsl:with-param>
+      </xsl:apply-templates>
+
+      <xsl:if test="not (fo:single-page-master-reference                   or fo:repeatable-page-master-reference                   or fo:repeatable-page-master-alternatives)">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">At least one page sequence specifier is required inside '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:apply-templates select="*"/>
+   </xsl:template>
+
+
+   <!-- =================================== -->
+<!-- Page master references              -->
+
+<xsl:template match="fo:single-page-master-reference                    | fo:repeatable-page-master-reference                    | fo:conditional-page-master-reference">
+      <xsl:apply-templates select="@*"/>
+      <xsl:call-template name="empty-element"/>
+      <xsl:if test="not(@master-reference)">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Attribute 'master-reference' is required for '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+   </xsl:template>
+
+
+   <!-- =================================== -->
+<!-- Repeatable-page-master-alternatives -->
+
+<xsl:template match="fo:repeatable-page-master-alternatives">
+      <xsl:apply-templates select="@*"/>
+      <xsl:call-template name="no-text"/>
+
+      <xsl:apply-templates select="*[not(self::fo:conditional-page-master-reference)]"
+                           mode="report-intrusive-elements">
+         <xsl:with-param name="reason">Only 'conditional-page-master-reference' elements are permitted in this context.</xsl:with-param>
+      </xsl:apply-templates>
+
+      <xsl:if test="not(fo:conditional-page-master-reference)">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">At least one 'conditional-page-master-reference' element should be present inside '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:apply-templates select="*"/>
+   </xsl:template>
+
+   <!-- =================================== -->
+<!-- Rx:meta-info                        -->
+
+<xsl:template match="rx:meta-info">
+      <xsl:apply-templates select="@*"/>
+      <xsl:call-template name="no-text"/>
+
+      <xsl:apply-templates select="*[not(self::rx:meta-field)]" mode="report-intrusive-elements">
+         <xsl:with-param name="reason">Only 'meta-field' elements are permitted in this context.</xsl:with-param>
+      </xsl:apply-templates>
+
+      <xsl:if test="not (rx:meta-field)">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">At least one 'meta-field' element should be present inside '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:apply-templates select="*"/>
+   </xsl:template>
+
+
+   <!-- =================================== -->
+<!-- Rx:meta-field                       -->
+
+<xsl:template match="rx:meta-field">
+      <xsl:apply-templates select="@*"/>
+      <xsl:call-template name="empty-element"/>
+      <xsl:if test="not(@name)">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Attribute 'name' is required for '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+      <xsl:if test="not(@value)">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Attribute 'value' is required for '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+   </xsl:template>
+
+   <!-- =================================== -->
+<!-- Rx:page-device                      -->
+
+<xsl:template match="rx:page-device" mode="report-intrusive-elements">
+      <xsl:call-template name="print-error">
+         <xsl:with-param name="msg">Element 'page-device' is obsolete;  use &lt;?xep-postscript-* ?&gt; processing instructions instead.</xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+
+   <!-- =================================== -->
+<!-- Declarations                        -->
+
+<xsl:template match="fo:declarations">
+      <xsl:apply-templates select="@*"/>
+      <xsl:call-template name="no-text"/>
+
+      <xsl:apply-templates select="*[not(self::fo:color-profile)]" mode="report-intrusive-elements">
+         <xsl:with-param name="reason">Only 'color-profile' elements are permitted in this context.</xsl:with-param>
+      </xsl:apply-templates>
+
+      <xsl:apply-templates select="*"/>
+   </xsl:template>
+
+
+   <!-- =================================== -->
+<!-- Color-profile                       -->
+
+<xsl:template match="fo:color-profile">
+      <xsl:apply-templates select="@*"/>
+      <xsl:call-template name="empty-element"/>
+      <xsl:if test="not(@color-profile-name)">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Attribute 'color-profile-name' is required for '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+      <xsl:if test="not(@src)">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Attribute 'src' is required for '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+   </xsl:template>
+
+
+   <!-- =================================== -->
+<!-- Rx:outline                        -->
+
+<xsl:template match="rx:outline">
+      <xsl:apply-templates select="@*"/>
+      <xsl:call-template name="no-text"/>
+
+      <xsl:apply-templates select="*[not(self::rx:bookmark)]" mode="report-intrusive-elements">
+         <xsl:with-param name="reason">Only 'bookmark' elements are permitted in this context.</xsl:with-param>
+      </xsl:apply-templates>
+
+      <xsl:if test="not (rx:bookmark)">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">At least one 'bookmark' element should be present inside '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:apply-templates select="*"/>
+   </xsl:template>
+
+
+   <!-- =================================== -->
+<!-- Rx:bookmark                         -->
+
+<xsl:template match="rx:bookmark">
+      <xsl:apply-templates select="@*"/>
+      <xsl:call-template name="no-text"/>
+
+      <xsl:if test="not(@internal-destination or @external-destination)">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Either 'internal-destination' or 'external-destination' attribute must be present on '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:if test="@internal-destination and @external-destination">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Only one of 'internal-destination' or 'external-destination' attributes can be present on '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:apply-templates select="*[not(self::rx:bookmark                                   or self::rx:bookmark-label)]"
+                           mode="report-intrusive-elements">
+         <xsl:with-param name="reason">Only 'bookmark-label' and/or nested 'boormark' elements are permitted in this context.</xsl:with-param>
+      </xsl:apply-templates>
+
+      <xsl:if test="not (rx:bookmark-label)">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Element 'bookmark-label' is required inside '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:if test="count (rx:bookmark-label) &gt; 1">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">There should be exactly one '<xsl:value-of select="name(rx:bookmark-label[1])"/>' element inside '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:if test="rx:bookmark-label[preceding-sibling::*]">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Element '<xsl:value-of select="name(rx:bookmark-label[1])"/>' should be the first child of '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:apply-templates select="*"/>
+   </xsl:template>
+
+
+   <!-- =================================== -->
+<!-- Rx:bookmark-label                   -->
+
+<xsl:template match="rx:bookmark-label">
+      <xsl:apply-templates select="@*"/>
+
+      <xsl:apply-templates select="*" mode="report-intrusive-elements">
+         <xsl:with-param name="reason">Only plain text is permitted in this context.</xsl:with-param>
+      </xsl:apply-templates>
+   </xsl:template>
+
+
+   <!-- =================================== -->
+<!-- Page-sequence                       -->
+
+<xsl:template match="fo:page-sequence">
+      <xsl:apply-templates select="@*"/>
+      <xsl:call-template name="no-text"/>
+
+      <xsl:if test="not(@master-reference)">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Attribute 'master-reference' is required for '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:apply-templates select="*[not(self::fo:title                                   or self::fo:static-content                                   or self::fo:flow)]"
+                           mode="report-intrusive-elements">
+         <xsl:with-param name="reason">Only 'flow', 'static-content', and 'title' elements are permitted in this context.</xsl:with-param>
+      </xsl:apply-templates>
+
+      <xsl:if test="not(fo:flow)">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Element 'flow' is required inside '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:if test="count(fo:flow) &gt; 1">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">There can be only one '<xsl:value-of select="name(fo:flow[1])"/>' element inside '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:if test="count(fo:title) &gt; 1">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">There can be at most one '<xsl:value-of select="name(fo:title[1])"/>' element inside '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:if test="fo:title[preceding-sibling::*]">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Element '<xsl:value-of select="name(fo:title[1])"/>' should be the first child of its parent '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:if test="fo:flow[following-sibling::*]">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Element '<xsl:value-of select="name(fo:flow[1])"/>' should be the last child of its parent '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:apply-templates select="*"/>
+   </xsl:template>
+
+
+   <!-- =================================== -->
+<!-- Title                               -->
+
+<xsl:template match="fo:title">
+      <xsl:apply-templates select="@*"/>
+      <xsl:call-template name="inline-level"/>
+      <xsl:apply-templates select="*"/>
+   </xsl:template>
+
+
+   <!-- =================================== -->
+<!-- Flow and static-content             -->
+
+<xsl:template match="fo:flow | fo:static-content">
+      <xsl:apply-templates select="@*"/>
+      <xsl:call-template name="block-level"/>
+
+      <xsl:if test="not(@flow-name)">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Attribute 'flow-name' is required for '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:variable name="flow-name" select="@flow-name"/>
+      <xsl:if test="ancestor::fo:page-sequence             and (following-sibling::*[self::fo:flow or self::fo:static-content][@flow-name = $flow-name]               or preceding-sibling::*[self::fo:flow or self::fo:static-content][@flow-name = $flow-name])">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">
+        Duplicate identifier: flow-name="<xsl:value-of select="$flow-name"/>".
+        Property 'flow-name' should be unique within '<xsl:value-of select="name(ancestor::fo:page-sequence[1])"/>'.
+      </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:apply-templates select="*"/>
+   </xsl:template>
+
+
+   <!-- =================================== -->
+<!-- Rx:flow-section                     -->
+
+<xsl:template match="rx:flow-section">
+      <xsl:apply-templates select="@*"/>
+      <xsl:call-template name="block-level"/>
+
+      <xsl:if test="not(parent::fo:flow)">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Element '<xsl:value-of select="name()"/>' must be a direct descendant of 'flow'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:apply-templates select="*"/>
+   </xsl:template>
+
+
+   <!-- =================================== -->
+<!-- Block                               -->
+
+<xsl:template match="fo:block">
+      <xsl:apply-templates select="@*"/>
+      <xsl:call-template name="mixed-level"/>
+      <xsl:apply-templates select="*"/>
+   </xsl:template>
+
+
+   <!-- =================================== -->
+<!-- Containers                          -->
+
+<xsl:template match="fo:block-container | fo:inline-container">
+      <xsl:apply-templates select="@*"/>
+      <xsl:call-template name="block-level"/>
+      <xsl:apply-templates select="*"/>
+   </xsl:template>
+
+
+   <!-- =================================== -->
+<!-- Bidi-override                       -->
+
+<xsl:template match="fo:bidi-override">
+      <xsl:apply-templates select="@*"/>
+      <xsl:call-template name="inline-level"/>
+
+      <xsl:if test="not(@direction)">
+         <xsl:call-template name="print-warning">
+            <xsl:with-param name="msg">Attribute 'direction' is required for '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:apply-templates select="*"/>
+   </xsl:template>
+
+
+   <!-- =================================== -->
+<!-- Character                           -->
+
+<xsl:template match="fo:character">
+      <xsl:apply-templates select="@*"/>
+      <xsl:call-template name="empty-element"/>
+
+      <xsl:if test="not(@character)">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Attribute 'character' is required for '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+   </xsl:template>
+
+
+   <!-- =================================== -->
+<!-- Initial-property-set                -->
+
+<xsl:template match="fo:initial-property-set">
+      <xsl:apply-templates select="@*"/>
+      <xsl:call-template name="empty-element"/>
+
+      <xsl:choose>
+         <xsl:when test="parent::fo:block">
+            <xsl:if test="preceding-sibling::*">
+               <xsl:call-template name="print-error">
+                  <xsl:with-param name="msg">Element '<xsl:value-of select="name()"/>' should be the first child of '<xsl:value-of select="name(parent::fo:block)"/>'. </xsl:with-param>
+               </xsl:call-template>
+            </xsl:if>
+
+            <xsl:if test="preceding-sibling::text()[normalize-space() != '']">
+               <xsl:call-template name="print-error">
+                  <xsl:with-param name="msg">Element '<xsl:value-of select="name()"/>' cannot be preceded by non-space characters in '<xsl:value-of select="name(parent::fo:block)"/>'. </xsl:with-param>
+               </xsl:call-template>
+            </xsl:if>
+
+            <xsl:if test="preceding-sibling::fo:initial-property-set">
+               <xsl:call-template name="print-error">
+                  <xsl:with-param name="msg">Only one '<xsl:value-of select="name()"/>' element is permitted in 'xsl:value-of select="name(parent::fo:block)"/&gt;'. </xsl:with-param>
+               </xsl:call-template>
+            </xsl:if>
+         </xsl:when>
+
+         <xsl:otherwise>
+            <xsl:call-template name="print-error">
+               <xsl:with-param name="msg">Element '<xsl:value-of select="name()"/>' can only occur inside 'block'. </xsl:with-param>
+            </xsl:call-template>
+         </xsl:otherwise>
+      </xsl:choose>
+   </xsl:template>
+
+
+   <!-- =================================== -->
+<!-- Line-numerator                      -->
+
+<xsl:template match="rx:ruler">
+      <xsl:apply-templates select="@*"/>
+      <xsl:call-template name="empty-element"/>
+
+      <xsl:choose>
+         <xsl:when test="parent::fo:block-container">
+            <xsl:if test="preceding-sibling::*">
+               <xsl:call-template name="print-error">
+                  <xsl:with-param name="msg">Element '<xsl:value-of select="name()"/>' should be the first child of '<xsl:value-of select="name(parent::fo:block-container)"/>'. </xsl:with-param>
+               </xsl:call-template>
+            </xsl:if>
+
+            <xsl:if test="preceding-sibling::text()[normalize-space() != '']">
+               <xsl:call-template name="print-error">
+                  <xsl:with-param name="msg">Element '<xsl:value-of select="name()"/>' cannot be preceded by non-space characters in '<xsl:value-of select="name(parent::fo:block-container)"/>'. </xsl:with-param>
+               </xsl:call-template>
+            </xsl:if>
+
+            <xsl:if test="preceding-sibling::rx:ruler">
+               <xsl:call-template name="print-error">
+                  <xsl:with-param name="msg">Only one '<xsl:value-of select="name()"/>' element is permitted in 'xsl:value-of select="name(parent::fo:block-container)"/&gt;'. </xsl:with-param>
+               </xsl:call-template>
+            </xsl:if>
+         </xsl:when>
+
+         <xsl:otherwise>
+            <xsl:call-template name="print-error">
+               <xsl:with-param name="msg">Element '<xsl:value-of select="name()"/>' can only occur inside 'block-container'. </xsl:with-param>
+            </xsl:call-template>
+         </xsl:otherwise>
+      </xsl:choose>
+   </xsl:template>
+
+
+   <!-- =================================== -->
+<!-- External-graphic                    -->
+
+<xsl:template match="fo:external-graphic">
+      <xsl:apply-templates select="@*"/>
+      <xsl:call-template name="empty-element"/>
+
+      <xsl:if test="not(@src)">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Attribute 'src' is required for '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+   </xsl:template>
+
+
+   <!-- =================================== -->
+<!-- Instream-foreign-object             -->
+
+<xsl:template match="fo:instream-foreign-object">
+      <xsl:apply-templates select="@*"/>
+      <!-- only the attributes are checked -->
+</xsl:template>
+
+
+   <!-- =================================== -->
+<!-- Inline                              -->
+
+<xsl:template match="fo:inline">
+      <xsl:apply-templates select="@*"/>
+      <xsl:call-template name="mixed-level"/>
+      <xsl:apply-templates select="*"/>
+   </xsl:template>
+
+
+   <!-- =================================== -->
+<!-- Leader                              -->
+
+<xsl:template match="fo:leader">
+      <xsl:apply-templates select="@*"/>
+      <xsl:call-template name="inline-level"/>
+      <xsl:apply-templates select="*"/>
+   </xsl:template>
+
+
+   <!-- =================================== -->
+<!-- Page-number                         -->
+
+<xsl:template match="fo:page-number">
+      <xsl:apply-templates select="@*"/>
+      <xsl:call-template name="empty-element"/>
+   </xsl:template>
+
+
+   <!-- =================================== -->
+<!-- Page-number-citation                -->
+
+<xsl:template match="fo:page-number-citation">
+      <xsl:apply-templates select="@*"/>
+      <xsl:call-template name="empty-element"/>
+
+      <xsl:if test="not(@ref-id)">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Attribute 'ref-id' is required for '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+   </xsl:template>
+
+   <!-- ========================================================== -->
+<!-- Rx:page-number-citation-last (actually an XSL 1.1 element) -->
+
+<xsl:template match="rx:page-number-citation-last">
+      <xsl:apply-templates select="@*"/>
+      <xsl:call-template name="empty-element"/>
+
+      <xsl:if test="not(@ref-id)">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Attribute 'ref-id' is required for '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+   </xsl:template>
+
+
+   <!-- =================================== -->
+<!-- Rx:pinpoint                        -->
+
+<xsl:template match="rx:pinpoint">
+      <xsl:apply-templates select="@*"/>
+      <xsl:call-template name="empty-element"/>
+
+      <xsl:if test="not(@value)">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Attribute 'value' is required for '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+   </xsl:template>
+
+
+   <!-- =================================== -->
+<!-- Rx:page-index                       -->
+
+<xsl:template match="rx:page-index">
+      <xsl:apply-templates select="@*"/>
+      <xsl:call-template name="no-text"/>
+
+      <xsl:apply-templates select="*[not(self::rx:index-item)]" mode="report-intrusive-elements">
+         <xsl:with-param name="reason">Only 'rx:index-item' elements are permitted in this context</xsl:with-param>
+      </xsl:apply-templates>
+
+      <xsl:if test="not(@ref-key) and not (rx:index-item)">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Element '<xsl:value-of select="name()"/>' must have either 'ref-key' attribute, or 'rx:index-item' descendant elements.</xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+      <xsl:if test="@ref-key and rx:index-item">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Element '<xsl:value-of select="name()"/>' can have either 'ref-key' attribute or '<xsl:value-of select="name(rx:index-item[1])"/>' descendant elements, but not both.</xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+      <xsl:apply-templates select="*"/>
+   </xsl:template>
+
+   <!-- =================================== -->
+<!-- Rx:index-item                       -->
+
+<xsl:template match="rx:index-item">
+      <xsl:apply-templates select="@*"/>
+      <xsl:call-template name="empty-element"/>
+
+      <xsl:if test="not(@ref-key)">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Attribute 'ref-key' is required for '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+   </xsl:template>
+
+
+   <!-- =================================== -->
+<!-- Rx:begin-index-range                -->
+
+<xsl:template match="rx:begin-index-range">
+      <xsl:apply-templates select="@*"/>
+      <xsl:call-template name="empty-element"/>
+
+      <xsl:if test="not(@rx:key)">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Attribute 'rx:key' is required for '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+  
+      <xsl:choose>
+         <xsl:when test="not(@id)">
+            <xsl:call-template name="print-error">
+               <xsl:with-param name="msg">Attribute 'id' is required for '<xsl:value-of select="name()"/>'. </xsl:with-param>
+            </xsl:call-template>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:variable name="id" select="@id"/>
+      
+            <xsl:if test="count(preceding::rx:begin-index-range[@id=$id]) = 1">
+	              <xsl:call-template name="print-error">
+	                 <xsl:with-param name="msg">Two or more '<xsl:value-of select="name()"/>' elements with id='<xsl:value-of select="@id"/>';  'id' should be unique within the document.</xsl:with-param>
+	              </xsl:call-template>
+            </xsl:if>
+      
+            <xsl:choose> 
+               <xsl:when test="following::rx:end-index-range[@ref-id=$id]"/>
+               <xsl:when test="preceding::rx:end-index-range[@ref-id=$id]"/>
+               <xsl:otherwise>
+                  <xsl:call-template name="print-error">
+                     <xsl:with-param name="msg">Unmatched '<xsl:value-of select="name()"/>' element with id='<xsl:value-of select="@id"/>': no correspondent 'rx:end-index-range' found. </xsl:with-param>
+                  </xsl:call-template>
+               </xsl:otherwise>
+            </xsl:choose> 
+         </xsl:otherwise>
+      </xsl:choose>
+   </xsl:template>
+
+   <!-- =================================== -->
+<!-- Rx:end-index-range                  -->
+
+<xsl:template match="rx:end-index-range">
+      <xsl:apply-templates select="@*"/>
+      <xsl:call-template name="empty-element"/>
+
+      <xsl:choose>
+         <xsl:when test="not(@ref-id)">
+            <xsl:call-template name="print-error">
+               <xsl:with-param name="msg">Attribute 'ref-id' is required for '<xsl:value-of select="name()"/>'. </xsl:with-param>
+            </xsl:call-template>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:variable name="refid" select="@ref-id"/>
+
+            <xsl:if test="count(preceding::rx:end-index-range[@ref-id=$refid]) = 1">
+               <xsl:call-template name="print-error">
+                  <xsl:with-param name="msg">Two or more '<xsl:value-of select="name()"/>' elements with ref-id='<xsl:value-of select="@ref-id"/>'.</xsl:with-param>
+               </xsl:call-template>
+            </xsl:if>
+
+            <xsl:choose> 
+               <xsl:when test="following::rx:begin-index-range[@id=$refid]">
+                  <xsl:call-template name="print-warning">
+                     <xsl:with-param name="msg">Element '<xsl:value-of select="name()"/>' with ref-id='<xsl:value-of select="@ref-id"/>' precedes its matching '<xsl:value-of select="name(following::rx:begin-index-range[@id=$refid][1])"/>'. </xsl:with-param>
+                  </xsl:call-template>
+               </xsl:when>
+               <xsl:when test="preceding::rx:begin-index-range[@id=$refid]"/>
+               <xsl:otherwise>
+                  <xsl:call-template name="print-error">
+                     <xsl:with-param name="msg">Unmatched '<xsl:value-of select="name()"/>' element with ref-id='<xsl:value-of select="@ref-id"/>': no correspondent 'rx:begin-index-range' found. </xsl:with-param>
+                  </xsl:call-template>
+               </xsl:otherwise>
+            </xsl:choose> 
+         </xsl:otherwise>
+      </xsl:choose>
+   </xsl:template>
+
+
+   <!-- =================================== -->
+<!-- Table-and-caption                   -->
+
+<xsl:template match="fo:table-and-caption">
+      <xsl:apply-templates select="@*"/>
+      <xsl:call-template name="no-text"/>
+
+      <xsl:apply-templates select="*[not(self::fo:table-caption                                   or self::fo:table                                   or self::fo:marker)]"
+                           mode="report-intrusive-elements">
+         <xsl:with-param name="reason">Only 'table-caption' and 'table' elements are permitted in this context.</xsl:with-param>
+      </xsl:apply-templates>
+
+      <xsl:if test="not(fo:table)">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Element 'table' is required inside '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:if test="count(fo:table) &gt; 1">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">There can be only one '<xsl:value-of select="name(fo:table[1])"/>' element inside '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:if test="count(fo:table-caption) &gt; 1">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">There can be only one '<xsl:value-of select="name(fo:table-caption[1])"/>' element inside '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:if test="fo:table-caption[preceding-sibling::fo:table]">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Element '<xsl:value-of select="name(fo:table-caption[1])"/>' must precede '<xsl:value-of select="name(fo:table[1])"/>' inside '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:apply-templates select="*"/>
+   </xsl:template>
+
+
+   <!-- =================================== -->
+<!-- Table-caption                       -->
+
+<xsl:template match="fo:table-caption">
+      <xsl:apply-templates select="@*"/>
+      <xsl:call-template name="block-level"/>
+      <xsl:apply-templates select="*"/>
+   </xsl:template>
+
+
+   <!-- =================================== -->
+<!-- Table                               -->
+
+<xsl:template match="fo:table">
+      <xsl:apply-templates select="@*"/>
+      <xsl:call-template name="no-text"/>
+
+      <xsl:apply-templates select="*[not(self::fo:table-column                                   or self::fo:table-header                                   or self::fo:table-footer                                   or self::fo:table-body                                   or self::fo:marker)]"
+                           mode="report-intrusive-elements">
+         <xsl:with-param name="reason">Only 'table-column' elements, row group elements, and markers are permitted in this context.</xsl:with-param>
+      </xsl:apply-templates>
+
+      <xsl:if test="not(fo:table-body)">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">At least one 'table-body' is required inside '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:if test="count(fo:table-header) &gt; 1">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">There can be only one '<xsl:value-of select="name(fo:table-header[1])"/>' element inside '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:if test="count(fo:table-footer) &gt; 1">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">There can be only one '<xsl:value-of select="name(fo:table-footer[1])"/>' element inside '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:if test="fo:table-column[preceding-sibling::*[not(self::fo:table-column or self::fo:marker)]]">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">'<xsl:value-of select="name(fo:table-column[1])"/>' elements should be located before any other element in '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:if test="fo:table-header[preceding-sibling::fo:table-footer]">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Element '<xsl:value-of select="name(fo:table-header[1])"/>' should be located before '<xsl:value-of select="name(fo:table-footer[1])"/>' in '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:if test="fo:table-header[preceding-sibling::fo:table-body]">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Element '<xsl:value-of select="name(fo:table-header[1])"/>' should be located before '<xsl:value-of select="name(fo:table-body[1])"/>' in '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:if test="fo:table-body[following-sibling::*[not(self::fo:table-body)]]">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">'<xsl:value-of select="name(fo:table-body[1])"/>' elements should be located last in '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:apply-templates select="*"/>
+   </xsl:template>
+
+
+   <!-- =================================== -->
+<!-- Row group elements                  -->
+
+<xsl:template match="fo:table-body | fo:table-header | fo:table-footer">
+      <xsl:apply-templates select="@*"/>
+      <xsl:call-template name="no-text"/>
+
+      <xsl:apply-templates select="*[not(self::fo:table-row                                   or self::fo:table-cell                                   or self::fo:marker)]"
+                           mode="report-intrusive-elements">
+         <xsl:with-param name="reason">Only 'table-row', 'table-cell', or 'marker' elements are permitted in this context.</xsl:with-param>
+      </xsl:apply-templates>
+
+      <xsl:if test="$strictness &gt; 0">
+         <xsl:if test="not (*)">
+            <xsl:call-template name="print-error">
+               <xsl:with-param name="msg">Empty '<xsl:value-of select="name()"/>'. </xsl:with-param>
+            </xsl:call-template>
+         </xsl:if>
+      </xsl:if>
+
+      <xsl:if test="fo:table-row and fo:table-cell">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">'<xsl:value-of select="name(fo:table-row[1])"/>' and '<xsl:value-of select="name(fo:table-cell[1])"/>' elements should not be mixed inside '<xsl:value-of select="name()"/>' element. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:apply-templates select="*"/>
+   </xsl:template>
+
+
+   <!-- =================================== -->
+<!-- Table-row                           -->
+
+<xsl:template match="fo:table-row">
+      <xsl:apply-templates select="@*"/>
+      <xsl:call-template name="no-text"/>
+
+      <xsl:apply-templates select="*[not(self::fo:table-cell)]" mode="report-intrusive-elements">
+         <xsl:with-param name="reason">Only 'table-cell' elements are permitted in this context.</xsl:with-param>
+      </xsl:apply-templates>
+
+      <xsl:if test="not(parent::fo:table-body or parent::fo:table-header or parent::fo:table-footer)">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Element '<xsl:value-of select="name()"/>' should be wrapped in 'table-body', 'table-header', or 'table-footer'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:apply-templates select="*"/>
+   </xsl:template>
+
+   <!-- =================================== -->
+<!-- Table-cell                          -->
+
+<xsl:template match="fo:table-cell">
+      <xsl:apply-templates select="@*"/>
+      <xsl:call-template name="block-level"/>
+      <xsl:apply-templates select="*"/>
+   </xsl:template>
+
+
+   <!-- =================================== -->
+<!-- List-block                          -->
+
+<xsl:template match="fo:list-block">
+      <xsl:apply-templates select="@*"/>
+      <xsl:call-template name="no-text"/>
+
+      <xsl:apply-templates select="*[not(self::fo:list-item or self::fo:marker)]"
+                           mode="report-intrusive-elements">
+         <xsl:with-param name="reason">Only 'list-item' or 'marker' elements are permitted in this context.</xsl:with-param>
+      </xsl:apply-templates>
+
+      <xsl:apply-templates select="*"/>
+   </xsl:template>
+
+
+   <!-- =================================== -->
+<!-- List-item                           -->
+
+<xsl:template match="fo:list-item">
+      <xsl:apply-templates select="@*"/>
+      <xsl:call-template name="no-text"/>
+
+      <xsl:apply-templates select="*[not(self::fo:list-item-label                                   or self::fo:list-item-body                                   or self::fo:marker)]"
+                           mode="report-intrusive-elements">
+         <xsl:with-param name="reason">Element '<xsl:value-of select="name()"/>' shall consist of one 'list-item-label' and one 'list-item-body'.</xsl:with-param>
+      </xsl:apply-templates>
+
+      <xsl:if test="not(parent::fo:list-block)">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Element '<xsl:value-of select="name()"/>' should be a child of 'list-block'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:if test="not(fo:list-item-label)">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Element 'list-item-label' is required inside '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:if test="not(fo:list-item-body)">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Element 'list-item-body' is required inside '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:if test="count(fo:list-item-label) &gt; 1">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">There can be only one '<xsl:value-of select="name(fo:list-item-label[1])"/>' element inside '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:if test="count(fo:list-item-body) &gt; 1">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">There can be only one '<xsl:value-of select="name(fo:list-item-body[1])"/>' element inside '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:if test="fo:list-item-body[following-sibling::fo:list-item-label]">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Element '<xsl:value-of select="name(fo:list-item-label[1])"/>' must precede '<xsl:value-of select="name(fo:list-item-body[1])"/>' inside '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:if test="fo:list-item-label and not (fo:list-item-label/@start-indent)                                    and not (fo:list-item-label/@margin)                                    and not (fo:list-item-label/@margin-left)                                    and not (fo:list-item-label/@margin-right)                                    and not (fo:list-item-label/@margin-top)                                    and not (fo:list-item-label/@margin-bottom)              and fo:list-item-body and not (fo:list-item-body/@start-indent)                                    and not (fo:list-item-body/@margin)                                    and not (fo:list-item-body/@margin-left)                                    and not (fo:list-item-body/@margin-right)                                    and not (fo:list-item-body/@margin-top)                                    and not (fo:list-item-body/@margin-bottom)">
+         <xsl:call-template name="print-warning">
+            <xsl:with-param name="msg">Start-indent is not specified neither on '<xsl:value-of select="name(fo:list-item-label[1])"/>' nor on '<xsl:value-of select="name(fo:list-item-body[1])"/>': list subcomponents will overlap</xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:if test="fo:list-item-label and not (fo:list-item-label/@end-indent)                                    and not (fo:list-item-label/@margin)                                    and not (fo:list-item-label/@margin-left)                                    and not (fo:list-item-label/@margin-right)                                    and not (fo:list-item-label/@margin-top)                                    and not (fo:list-item-label/@margin-bottom)              and fo:list-item-body and not (fo:list-item-body/@end-indent)                                    and not (fo:list-item-body/@margin)                                    and not (fo:list-item-body/@margin-left)                                    and not (fo:list-item-body/@margin-right)                                    and not (fo:list-item-body/@margin-top)                                    and not (fo:list-item-body/@margin-bottom)">
+         <xsl:call-template name="print-warning">
+            <xsl:with-param name="msg">End-indent is not specified neither on '<xsl:value-of select="name(fo:list-item-label[1])"/>' nor on '<xsl:value-of select="name(fo:list-item-body[1])"/>': list subcomponents will overlap</xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:apply-templates select="*"/>
+   </xsl:template>
+
+
+   <!-- =================================== -->
+<!-- List item subcomponents             -->
+
+<xsl:template match="fo:list-item-label | fo:list-item-body">
+      <xsl:apply-templates select="@*"/>
+      <xsl:call-template name="block-level"/>
+      <xsl:apply-templates select="*"/>
+   </xsl:template>
+
+
+   <!-- =================================== -->
+<!-- Footnote                            -->
+
+<xsl:template match="fo:footnote">
+      <xsl:apply-templates select="@*"/>
+      <xsl:call-template name="no-text"/>
+      <xsl:call-template name="out-of-line"/>
+
+      <xsl:apply-templates select="*[not(self::fo:inline                                   or self::fo:footnote-body)]"
+                           mode="report-intrusive-elements">
+         <xsl:with-param name="reason">Element '<xsl:value-of select="name()"/>' shall consist of one 'inline' and one 'footnote-body'.</xsl:with-param>
+      </xsl:apply-templates>
+
+      <xsl:if test="not(fo:inline)">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Element 'inline' is required inside '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:if test="not(fo:footnote-body)">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Element 'footnote-body' is required inside '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:if test="count(fo:inline) &gt; 1">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">There can be only one '<xsl:value-of select="name(fo:inline[1])"/>' element inside '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:if test="count(fo:footnote-body) &gt; 1">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">There can be only one '<xsl:value-of select="name(fo:footnote-body[1])"/>' element inside '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:if test="fo:footnote-body[following-sibling::fo:inline]">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Element '<xsl:value-of select="name(fo:inline[1])"/>' must precede '<xsl:value-of select="name(fo:footnote-body[1])"/>' inside '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:for-each select="fo:inline">
+         <xsl:call-template name="inline-level"/>
+      </xsl:for-each>
+
+      <xsl:apply-templates select="*"/>
+   </xsl:template>
+
+
+   <!-- =================================== -->
+<!-- Footnote-body                       -->
+
+<xsl:template match="fo:footnote-body">
+      <xsl:apply-templates select="@*"/>
+      <xsl:call-template name="block-level"/>
+      <xsl:apply-templates select="*"/>
+   </xsl:template>
+
+
+   <!-- =================================== -->
+<!-- Float                               -->
+
+<xsl:template match="fo:float">
+      <xsl:apply-templates select="@*"/>
+      <xsl:call-template name="block-level"/>
+      <xsl:call-template name="out-of-line"/>
+      <xsl:apply-templates select="*"/>
+   </xsl:template>
+
+
+   <!-- =================================== -->
+<!-- Wrapper                             -->
+
+<xsl:template match="fo:wrapper">
+      <xsl:apply-templates select="@*"/>
+      <xsl:call-template name="mixed-level"/>
+      <xsl:apply-templates select="*"/>
+   </xsl:template>
+
+
+   <!-- === =============================== -->
+<!-- Marker                              -->
+
+<xsl:template match="fo:marker">
+      <xsl:apply-templates select="@*"/>
+      <xsl:call-template name="mixed-level"/>
+
+      <xsl:choose>
+         <xsl:when test="not(@marker-class-name)">
+            <xsl:call-template name="print-error">
+               <xsl:with-param name="msg">Attribute 'marker-class-name' is required for '<xsl:value-of select="name()"/>'. </xsl:with-param>
+            </xsl:call-template>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:variable name="marker-class-name" select="@marker-class-name"/>
+            <xsl:if test="preceding-sibling::fo:marker[@marker-class-name=$marker-class-name]">
+               <xsl:call-template name="print-error">
+                  <xsl:with-param name="msg">Sibling <xsl:value-of select="name()"/> elements have the same value of 'marker-class-name' attribute ("<xsl:value-of select="@marker-class-name"/>"). </xsl:with-param>
+               </xsl:call-template>
+            </xsl:if>
+         </xsl:otherwise>
+      </xsl:choose>
+
+      <xsl:if test="preceding-sibling::*[not(self::fo:marker)]">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">'<xsl:value-of select="name()"/>' elements should be initial children of their parents. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:if test="preceding-sibling::text()[normalize-space() != '']">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Element '<xsl:value-of select="name()"/>' cannot be preceded by non-space text nodes. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:if test="not(ancestor::fo:flow)">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Element '<xsl:value-of select="name()"/>' should be a descendant of 'flow'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:if test="ancestor::fo:multi-case">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Element '<xsl:value-of select="name()"/>' cannot be used inside '<xsl:value-of select="name(ancestor::fo:multi-case[1])"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:if test="ancestor::fo:float">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Element '<xsl:value-of select="name()"/>' cannot be used inside '<xsl:value-of select="name(ancestor::fo:float[1])"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:if test="ancestor::fo:footnote">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Element '<xsl:value-of select="name()"/>' cannot be used inside '<xsl:value-of select="name(ancestor::fo:footnote[1])"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:apply-templates select="*"/>
+   </xsl:template>
+
+   <!-- === =============================== -->
+<!-- Retrieve-marker                     -->
+
+<xsl:template match="fo:retrieve-marker">
+      <xsl:apply-templates select="@*"/>
+      <xsl:call-template name="empty-element"/>
+
+      <xsl:if test="not(@retrieve-class-name)">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Attribute 'retrieve-class-name' is required for '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:if test="not(ancestor::fo:static-content)">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Element '<xsl:value-of select="name()"/>' should be a descendant of 'static-content'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+   </xsl:template>
+
+
+   <!-- === =============================== -->
+<!-- Basic-link                          -->
+
+<xsl:template match="fo:basic-link">
+      <xsl:apply-templates select="@*"/>
+      <xsl:call-template name="mixed-level"/>
+
+      <xsl:if test="not(@internal-destination or @external-destination)">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Either 'internal-destination' or 'external-destination' attribute must be present on '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:if test="@internal-destination and @external-destination">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Only one of 'internal-destination' or 'external-destination' attributes can be present on '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:apply-templates select="*"/>
+   </xsl:template>
+
+
+   <!-- =================================== -->
+<!-- Multi-switch                        -->
+
+<xsl:template match="fo:multi-switch">
+      <xsl:apply-templates select="@*"/>
+      <xsl:call-template name="no-text"/>
+
+      <xsl:apply-templates select="*[not(self::fo:multi-case)]" mode="report-intrusive-elements">
+         <xsl:with-param name="reason">Only 'multi-case' elements are permitted in this context.</xsl:with-param>
+      </xsl:apply-templates>
+
+      <xsl:apply-templates select="*"/>
+   </xsl:template>
+
+
+   <!-- =================================== -->
+<!-- Multi-case                          -->
+
+<xsl:template match="fo:multi-case">
+      <xsl:apply-templates select="@*"/>
+      <xsl:call-template name="mixed-level"/>
+      <xsl:if test="not(parent::fo:multi-switch)">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Element '<xsl:value-of select="name()"/>' should be a child of 'multi-switch'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+      <xsl:apply-templates select="*"/>
+   </xsl:template>
+
+
+   <!-- ===================================== -->
+<!-- Multi-toggle                          -->
+
+<xsl:template match="fo:multi-toggle">
+      <xsl:apply-templates select="@*"/>
+      <xsl:call-template name="mixed-level"/>
+
+      <xsl:if test="not(ancestor::fo:multi-case)">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Element '<xsl:value-of select="name()"/>' can be used only inside 'multi-case'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:apply-templates select="*"/>
+   </xsl:template>
+
+
+   <!-- ===================================== -->
+<!-- Multi-properties                    -->
+
+<xsl:template match="fo:multi-properties">
+      <xsl:apply-templates select="@*"/>
+      <xsl:call-template name="no-text"/>
+
+      <xsl:apply-templates select="*[not(self::fo:multi-property-set                                   or self::fo:wrapper)]"
+                           mode="report-intrusive-elements">
+         <xsl:with-param name="reason">Element '<xsl:value-of select="name()"/>' shall consist of one or more 'multi-property-set' elements, followed by a 'wrapper'.</xsl:with-param>
+      </xsl:apply-templates>
+
+      <xsl:if test="not(fo:multi-property-set)">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">At least one 'multi-property-set' element should be specified in '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:if test="not(fo:wrapper)">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Element 'wrapper' is required inside '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:if test="count(fo:wrapper) &gt; 1">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">There can be only one '<xsl:value-of select="name(fo:wrapper[1])"/>' element inside '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:if test="fo:wrapper[following-sibling::fo:multi-property-set]">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Element '<xsl:value-of select="name(fo:wrapper[1])"/>' must be located after all '<xsl:value-of select="name(fo:multi-property-set[1])"/>' elements inside '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:apply-templates select="*"/>
+   </xsl:template>
+
+
+   <!-- ===================================== -->
+<!-- Multi-property-set                    -->
+
+<xsl:template match="fo:multi-property-set">
+      <xsl:apply-templates select="@*"/>
+      <xsl:call-template name="empty-element"/>
+
+      <xsl:if test="not(@active-state)">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Attribute 'active-state' is required for '<xsl:value-of select="name()"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:if test="not(parent::fo:multi-properties)">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Element '<xsl:value-of select="name()"/>' should be a child of 'multi-properties'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+   </xsl:template>
+
+
+   <!-- =================================== -->
+<!-- Common structure-checking templates -->
+
+<!-- Check for block-level elements         -->
+
+<xsl:template name="block-level">
+      <xsl:call-template name="no-text">
+         <xsl:with-param name="reason">Only block-level elements are permitted in this context.</xsl:with-param>
+      </xsl:call-template>
+
+      <xsl:apply-templates select="*[not(self::fo:block                                   or self::fo:block-container                                   or self::fo:list-block                                   or self::fo:table                                   or self::fo:table-and-caption                                   or self::fo:float                                   or self::fo:wrapper                                   or self::fo:marker                                   or self::fo:retrieve-marker                                   or self::fo:multi-switch                                   or self::fo:multi-properties                                   or self::rx:ruler                                   or self::rx:begin-index-range                                   or self::rx:end-index-range                                   or self::rx:flow-section)]"
+                           mode="report-intrusive-elements-block">
+         <xsl:with-param name="reason">Only block-level elements are permitted in this context.</xsl:with-param>
+      </xsl:apply-templates>
+      <xsl:for-each select="fo:wrapper | fo:multi-switch/fo:multi-case | fo:multi-properties">
+         <xsl:call-template name="block-level"/>
+      </xsl:for-each>
+   </xsl:template>
+
+
+   <!-- Check for inline-level elements         -->
+
+<xsl:template name="inline-level">
+      <xsl:apply-templates select="*[not(self::fo:bidi-override                                   or self::fo:character                                   or self::fo:external-graphic                                   or self::fo:instream-foreign-object                                   or self::fo:inline                                   or self::fo:inline-container                                   or self::fo:leader                                   or self::fo:page-number                                   or self::fo:page-number-citation                                   or self::fo:basic-link                                   or self::fo:multi-toggle                                   or self::fo:footnote                                   or self::fo:float                                   or self::fo:wrapper                                   or self::fo:marker                                   or self::fo:retrieve-marker                                   or self::fo:multi-switch                                   or self::fo:multi-properties                                  or self::rx:page-index                                   or self::rx:page-number-citation-last                                   or self::rx:page-index                                   or self::rx:begin-index-range                                   or self::rx:end-index-range                                   or self::rx:pinpoint)]"
+                           mode="report-intrusive-elements-inline">
+         <xsl:with-param name="reason">Only inline-level elements are permitted in this context.</xsl:with-param>
+      </xsl:apply-templates>
+      <xsl:for-each select="fo:wrapper | fo:multi-switch/fo:multi-case | fo:multi-properties | fo:multi-toggle | fo:inline | fo:basic-link | fo:bidi-override">
+         <xsl:call-template name="inline-level"/>
+      </xsl:for-each>
+   </xsl:template>
+
+
+   <!-- Check for mixed-level elements         -->
+
+<xsl:template name="mixed-level">
+      <xsl:apply-templates select="*[not(self::fo:block                                   or self::fo:block-container                                   or self::fo:list-block                                   or self::fo:table                                   or self::fo:table-and-caption                                   or self::fo:bidi-override                                   or self::fo:character                                   or self::fo:external-graphic                                   or self::fo:initial-property-set                                   or self::fo:instream-foreign-object                                   or self::fo:inline                                   or self::fo:inline-container                                   or self::fo:leader                                   or self::fo:page-number                                   or self::fo:page-number-citation                                   or self::fo:basic-link                                   or self::fo:multi-toggle                                   or self::fo:footnote                                   or self::fo:float                                   or self::fo:wrapper                                   or self::fo:marker                                   or self::fo:retrieve-marker                                   or self::fo:multi-switch                                   or self::fo:multi-properties                                   or self::rx:page-number-citation-last                                   or self::rx:page-index                                   or self::rx:begin-index-range                                   or self::rx:end-index-range                                   or self::rx:pinpoint)]"
+                           mode="report-intrusive-elements-block">
+         <xsl:with-param name="reason">Only block-level or inline-level elements are permitted in this context.</xsl:with-param>
+      </xsl:apply-templates>
+      <xsl:for-each select="fo:wrapper | fo:multi-switch/fo:multi-case | fo:multi-properties">
+         <xsl:call-template name="mixed-level"/>
+      </xsl:for-each>
+   </xsl:template>
+
+
+   <!-- Check constraints applicable to out-of-line elements  -->
+
+<xsl:template name="out-of-line">
+      <xsl:if test="not(ancestor::fo:flow)">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Element '<xsl:value-of select="name()"/>' should be a descendant of 'flow'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:if test="ancestor::fo:float">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Element '<xsl:value-of select="name()"/>' cannot be a descendant of '<xsl:value-of select="name(ancestor::fo:float[1])"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:if test="ancestor::fo:footnote-body">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Element '<xsl:value-of select="name()"/>' cannot be a descendant of '<xsl:value-of select="name(ancestor::fo:footnote-body[1])"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:if test="ancestor::fo:marker">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Element '<xsl:value-of select="name()"/>' cannot be a descendant of '<xsl:value-of select="name(ancestor::fo:marker[1])"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+
+      <xsl:if test="ancestor::*[@position='absolute' or @absolute-position='absolute'                          or @position='fixed' or @absolute-position='fixed']">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Element '<xsl:value-of select="name()"/>' cannot be a descendant of an absolutely positioned
+      '<xsl:value-of select="name(ancestor::*[@position='absolute' or @absolute-position='absolute'                                            or @position='fixed' or @absolute-position='fixed'][1])"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+   </xsl:template>
+
+   <!-- =================================== -->
+<!-- Auxiliary templates                 -->
+
+
+<!-- Check for non-blank #PCDATA -->
+
+<xsl:template name="no-text">
+      <xsl:param name="reason" select="''"/>
+
+      <xsl:if test="text()[normalize-space(.) != '']">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">
+        Element '<xsl:value-of select="name()"/>' cannot have
+	non-empty text descendants here. <xsl:value-of select="text()[normalize-space(.) != '']"/>
+               <xsl:if test="$reason != ''">
+                  <xsl:value-of select="$reason"/>
+               </xsl:if>
+            </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+   </xsl:template>
+
+
+   <!-- Check for element being EMPTY -->
+
+<xsl:template name="empty-element">
+      <xsl:if test="* | text()">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Element '<xsl:value-of select="name()"/>' must be empty. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+   </xsl:template>
+
+
+
+   <!-- Report an element that may not be present in a given point -->
+
+<xsl:template match="*" mode="report-intrusive-elements" priority="-1">
+      <xsl:param name="reason" select="''"/>
+      <xsl:variable name="uri" select="namespace-uri()"/>
+
+      <xsl:choose>
+         <xsl:when test="$uri='http://www.w3.org/1999/XSL/Format'                  or $uri='http://www.renderx.com/XSL/Extensions'">
+            <xsl:call-template name="print-error">
+               <xsl:with-param name="msg">
+           Element '<xsl:value-of select="name()"/>' cannot be a child of '<xsl:value-of select="name(..)"/>'.
+           <xsl:if test="$reason != ''">
+                     <xsl:value-of select="$reason"/>
+                  </xsl:if>
+               </xsl:with-param>
+            </xsl:call-template>
+         </xsl:when>
+         <xsl:when test="$uri = ''">
+            <xsl:call-template name="print-error">
+               <xsl:with-param name="msg">
+          Element '<xsl:value-of select="name()"/>' belonging to the anonymous namespace cannot occur in an XSL-FO document outside 'instream-foreign-object' elements.
+        </xsl:with-param>
+            </xsl:call-template>
+         </xsl:when>
+         <xsl:when test="$uri = 'http://www.w3.org/2000/svg'">
+            <xsl:if test="$strictness &gt; 0">
+               <xsl:call-template name="print-warning">
+                  <xsl:with-param name="msg">
+            SVG element '<xsl:value-of select="name()"/>' is located outside 'instream-foreign-object' element.
+          </xsl:with-param>
+               </xsl:call-template>
+            </xsl:if>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:if test="$strictness &gt; 1">
+               <xsl:call-template name="print-warning">
+                  <xsl:with-param name="msg">
+             Element '<xsl:value-of select="name()"/>' belongs to an unknown namespace <xsl:value-of select="$uri"/>
+                  </xsl:with-param>
+               </xsl:call-template>
+            </xsl:if>
+         </xsl:otherwise>
+      </xsl:choose>
+   </xsl:template>
+
+   <xsl:template match="*" mode="report-intrusive-elements-block" priority="-1">
+      <xsl:param name="reason"/>
+
+      <xsl:apply-templates select="." mode="report-intrusive-elements">
+         <xsl:with-param name="reason" select="$reason"/>
+      </xsl:apply-templates>
+   </xsl:template>
+
+   <xsl:template match="*" mode="report-intrusive-elements-inline" priority="-1">
+      <xsl:param name="reason"/>
+
+      <xsl:apply-templates select="." mode="report-intrusive-elements">
+         <xsl:with-param name="reason" select="$reason"/>
+      </xsl:apply-templates>
+   </xsl:template>
+
+
+   <!-- Special case: report an invalid element contained in a wrapper -->
+
+<xsl:template match="fo:wrapper/*                    | fo:multi-properties/*                    | fo:multi-case/*"
+                 mode="report-intrusive-elements-block">
+      <xsl:param name="reason" select="''"/>
+
+      <xsl:call-template name="print-error">
+         <xsl:with-param name="msg">
+      Element '<xsl:value-of select="name()"/>' cannot be a descendant of '<xsl:value-of select="name(ancestor::*[not(self::fo:wrapper or self::fo:multi-switch or self::fo:multi-case or self::fo:multi-properties)][1])"/>' through wrapper elements.
+      <xsl:if test="$reason != ''">
+               <xsl:value-of select="$reason"/>
+            </xsl:if>
+         </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="fo:wrapper/*                    | fo:inline/*                    | fo:basic-link/*                    | fo:bidi-override/*                    | fo:multi-toggle/*                    | fo:multi-properties/*                    | fo:multi-case/*"
+                 mode="report-intrusive-elements-inline">
+      <xsl:param name="reason" select="''"/>
+
+      <xsl:call-template name="print-error">
+         <xsl:with-param name="msg">
+      Element '<xsl:value-of select="name()"/>' cannot be a descendant of '<xsl:value-of select="name(ancestor::*[not(self::fo:wrapper or self::fo:multi-switch or self::fo:multi-case or self::fo:multi-toggle or self::fo:multi-properties or self::fo:inline)][1])"/>' through wrapper or inline elements.
+      <xsl:if test="$reason != ''">
+               <xsl:value-of select="$reason"/>
+            </xsl:if>
+         </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+
+   <!-- Default rules -->
+
+<xsl:template match="*" priority="-1"/>
+   <xsl:template match="text()"/>
+
+
+   <!-- ##################################################################### -->
+<!-- Processing of attributes.                                             -->
+<!-- ##################################################################### -->
+
+<!-- Report any attribute not covered by enabling templates -->
+
+<xsl:template match="@*" priority="-2">
+      <xsl:call-template name="complain-attribute"/>
+   </xsl:template>
+
+   <!-- Report any attribute in fo:layout-master-set etc. as invalid.         -->
+<!-- This is overridden by a rule with higher priority for those (few)     -->
+<!-- properties that actually may occur in these special positions         -->
+
+<xsl:template match="@*[not (parent::fo:root)                     and not (ancestor::fo:page-sequence)                     and not (parent::*/parent::fo:simple-page-master)]"
+                 priority="4">
+      <xsl:call-template name="complain-attribute"/>
+   </xsl:template>
+
+   <xsl:template match="fo:simple-page-master/*/@*" priority="2">
+      <xsl:call-template name="complain-attribute"/>
+   </xsl:template>
+
+   <xsl:template name="complain-attribute">
+      <xsl:variable name="uri" select="namespace-uri()"/>
+
+      <xsl:choose>
+    <!-- Ignore attributes from XML namespace - xml:space, xml:base, etc. -->
+    <xsl:when test="$uri='http://www.w3.org/XML/1998/namespace'"/> 
+         <xsl:when test="$uri=''                  or $uri='http://www.w3.org/1999/XSL/Format'                  or $uri='http://www.renderx.com/XSL/Extensions'">
+            <xsl:call-template name="print-error">
+               <xsl:with-param name="msg">Attribute '<xsl:value-of select="name()"/>' cannot occur at element '<xsl:value-of select="name(..)"/>'. </xsl:with-param>
+            </xsl:call-template>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:if test="$strictness &gt; 1">
+               <xsl:call-template name="print-warning">
+                  <xsl:with-param name="msg">Attribute '<xsl:value-of select="name()"/>' at element '<xsl:value-of select="name(..)"/>' belongs to an unknown namespace <xsl:value-of select="$uri"/> 
+                  </xsl:with-param>
+               </xsl:call-template>
+            </xsl:if>
+         </xsl:otherwise>
+      </xsl:choose>
+   </xsl:template>
+
+   <xsl:template name="disable-on-atomic-inlines">
+      <xsl:if test="parent::fo:character              or parent::fo:page-number              or parent::fo:page-number-citation              or parent::rx:page-number-citation-last              or parent::fo:initial-property-set">
+         <xsl:call-template name="complain-attribute"/>
+      </xsl:if>
+   </xsl:template>
+
+
+   <xsl:template name="disable-on-graphics">
+      <xsl:if test="parent::fo:external-graphic              or parent::fo:instream-foreign-object">
+         <xsl:call-template name="complain-attribute"/>
+      </xsl:if>
+   </xsl:template>
+
+   <!-- Report a value not in a list. Expressions (recognized by the presence -->
+<!-- of parentheses or operators) are excluded from validation.            -->
+
+<xsl:template name="enumerated-values">
+      <xsl:param name="valuelist"/>
+      <xsl:variable name="value" select="normalize-space(.)"/>
+      <xsl:choose>
+         <xsl:when test="contains($valuelist, concat(' ', $value, ' '))"/>
+         <xsl:when test="contains($value, '(') and contains ($value, ')')"/>
+         <xsl:otherwise>
+            <xsl:call-template name="print-error">
+               <xsl:with-param name="msg">Attribute '<xsl:value-of select="name()"/>' cannot have a value of "<xsl:value-of select="$value"/>". </xsl:with-param>
+            </xsl:call-template>
+         </xsl:otherwise>
+      </xsl:choose>
+   </xsl:template>
+
+   <!-- Report a value that is not a valid number or length. Skips validation -->
+<!-- of attributes containing digits, parentheses, and math operators.     -->
+
+<xsl:template name="quantitative-values">
+      <xsl:param name="valuelist"/>
+      <xsl:variable name="value" select="normalize-space(.)"/>
+      <xsl:choose>
+         <xsl:when test="contains($valuelist, concat(' ', $value, ' '))"/>
+         <xsl:when test="contains($value, '(') and contains ($value, ')')"/>
+         <xsl:when test="contains($value, '0')"/>
+         <xsl:when test="contains($value, '1')"/>
+         <xsl:when test="contains($value, '2')"/>
+         <xsl:when test="contains($value, '3')"/>
+         <xsl:when test="contains($value, '4')"/>
+         <xsl:when test="contains($value, '5')"/>
+         <xsl:when test="contains($value, '6')"/>
+         <xsl:when test="contains($value, '7')"/>
+         <xsl:when test="contains($value, '8')"/>
+         <xsl:when test="contains($value, '9')"/>
+         <xsl:when test="contains($value, '+')"/>
+         <xsl:when test="contains($value, ' - ')"/>
+         <xsl:when test="contains($value, '*')"/>
+         <xsl:when test="contains($value, ' div ')"/>
+         <xsl:when test="contains($value, ' mod ')"/>
+         <xsl:otherwise>
+            <xsl:call-template name="print-error">
+               <xsl:with-param name="msg">Attribute '<xsl:value-of select="name()"/>' cannot have a value of "<xsl:value-of select="$value"/>". </xsl:with-param>
+            </xsl:call-template>
+         </xsl:otherwise>
+      </xsl:choose>
+   </xsl:template>
+
+   <!-- Check if a value is valid as a URL specifier -->
+<xsl:template name="check-url">
+      <xsl:variable name="val" select="normalize-space()"/>
+      <xsl:choose>
+         <xsl:when test="$val = 'inherit'"/>
+         <xsl:when test="starts-with($val, 'url(')                 and substring ($val, string-length($val)) = ')'"/>
+         <xsl:otherwise>
+            <xsl:call-template name="print-warning">
+               <xsl:with-param name="msg">Attribute '<xsl:value-of select="name()"/>' cannot have a value of "<xsl:value-of select="."/>": should be either 'inherit' or a URI: <xsl:value-of select="name()"/>="url(...)".</xsl:with-param>
+            </xsl:call-template>
+         </xsl:otherwise>
+      </xsl:choose>
+   </xsl:template>
+
+   <!-- 7.3. Accessibility properties - ubiquitous; not validated -->
+<xsl:template match="@source-document" priority="5">
+      <xsl:variable name="val" select="normalize-space()"/>
+      <xsl:choose>
+         <xsl:when test="$val = 'inherit'"/>
+         <xsl:when test="$val = 'none'"/>
+         <xsl:when test="starts-with($val, 'url(')                 and substring ($val, string-length($val)) = ')'"/>
+         <xsl:otherwise>
+            <xsl:call-template name="print-error">
+               <xsl:with-param name="msg">Attribute '<xsl:value-of select="name()"/>' cannot have a value of "<xsl:value-of select="."/>": should be 'inherit', 'none', or one or more URIs: source="url(...) [url(...) ...]".</xsl:with-param>
+            </xsl:call-template>
+         </xsl:otherwise>
+      </xsl:choose>
+   </xsl:template>
+
+
+   <xsl:template match="@role" priority="5"/>
+
+   <!-- 7.4. Absolute position -->
+<xsl:template match="fo:block-container/@absolute-position">
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> auto absolute fixed inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@top | @bottom | @left | @right">
+      <xsl:call-template name="quantitative-values">
+         <xsl:with-param name="valuelist"> auto inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <!-- 7.5. Aural properties. May happen everywhere in the flows. Not validated. -->
+<xsl:template match="@azimuth"/>
+   <xsl:template match="@cue-after"/>
+   <xsl:template match="@cue-before"/>
+
+   <xsl:template match="@elevation">
+      <xsl:call-template name="quantitative-values">
+         <xsl:with-param name="valuelist"> below level above higher lower inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@pause-after | @pause-before">
+      <xsl:call-template name="quantitative-values">
+         <xsl:with-param name="valuelist"> inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@pitch">
+      <xsl:call-template name="quantitative-values">
+         <xsl:with-param name="valuelist"> x-low low medium high x-high inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@pitch-range">
+      <xsl:call-template name="quantitative-values">
+         <xsl:with-param name="valuelist"> inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@play-during"/>
+
+   <xsl:template match="@richness">
+      <xsl:call-template name="quantitative-values">
+         <xsl:with-param name="valuelist"> inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@speak">
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> normal none spell-out inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@speak-header">
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> once always inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@speak-numeral">
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> digits continuous inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@speak-punctuation">
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> code none inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@speech-rate">
+      <xsl:call-template name="quantitative-values">
+         <xsl:with-param name="valuelist"> x-slow slow medium fast x-fast faster slower inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@stress">
+      <xsl:call-template name="quantitative-values">
+         <xsl:with-param name="valuelist"> inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@voice-family"/>
+   <xsl:template match="@volume">
+      <xsl:call-template name="quantitative-values">
+         <xsl:with-param name="valuelist"> silent x-soft soft medium loud x-loud inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+
+   <!-- 7.6. Border, padding, and background -->
+<xsl:template priority="3" match="@background-attachment">
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> scroll fixed inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template priority="3" match="@background-color"/>
+
+   <xsl:template priority="3" match="@background-image">
+      <xsl:if test=". != 'none'">
+         <xsl:call-template name="check-url"/>
+      </xsl:if>
+   </xsl:template>
+
+   <xsl:template priority="3" match="@background-repeat">
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> repeat repeat-x repeat-y no-repeat inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template priority="3" match="@background-position-horizontal">
+      <xsl:call-template name="quantitative-values">
+         <xsl:with-param name="valuelist"> left center right inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template priority="3" match="@background-position-vertical">
+      <xsl:call-template name="quantitative-values">
+         <xsl:with-param name="valuelist"> top center bottom inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template priority="3"
+                 match="@border-before-color                    | @border-after-color                    | @border-start-color                    | @border-end-color                    | @border-top-color                    | @border-bottom-color                    | @border-left-color                    | @border-right-color"/>
+
+   <xsl:template priority="3"
+                 match="@border-before-style                    | @border-after-style                    | @border-start-style                    | @border-end-style                    | @border-top-style                    | @border-bottom-style                    | @border-left-style                    | @border-right-style">
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> none hidden dotted dashed solid double groove ridge inset outset inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template priority="3"
+                 match="@border-before-width                    | @border-before-width.length                    | @border-after-width                    | @border-after-width.length                    | @border-start-width                    | @border-start-width.length                    | @border-end-width                    | @border-end-width.length                    | @border-top-width                    | @border-bottom-width                    | @border-left-width                    | @border-right-width">
+      <xsl:call-template name="quantitative-values">
+         <xsl:with-param name="valuelist"> thin medium thick inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@border-before-width.conditionality                    | @border-after-width.conditionality                    | @border-start-width.conditionality                    | @border-end-width.conditionality">
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> discard retain </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template priority="3"
+                 match="@padding-before                    | @padding-before.length                    | @padding-after                    | @padding-after.length                    | @padding-start                    | @padding-start.length                    | @padding-end                    | @padding-end.length                    | @padding-top                    | @padding-bottom                    | @padding-left                    | @padding-right">
+      <xsl:call-template name="quantitative-values">
+         <xsl:with-param name="valuelist"> inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@padding-before.conditionality                    | @padding-after.conditionality                    | @padding-start.conditionality                    | @padding-end.conditionality">
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> discard retain </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <!-- 7.7. Font properties  -->
+<xsl:template match="@font-family">
+      <xsl:call-template name="disable-on-graphics"/>
+   </xsl:template>
+
+   <xsl:template match="@font-selection-strategy">
+      <xsl:call-template name="disable-on-graphics"/>
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> auto character-by-character inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@font-size">
+      <xsl:call-template name="disable-on-graphics"/>
+      <xsl:call-template name="quantitative-values">
+         <xsl:with-param name="valuelist"> xx-small x-small small medium large x-large xx-large larger smaller inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@font-stretch">
+      <xsl:call-template name="disable-on-graphics"/>
+      <xsl:call-template name="quantitative-values"> <!-- this is kinda sorta extension -->
+    <xsl:with-param name="valuelist"> normal wider narrower ultra-condensed extra-condensed condensed semi-condensed semi-expanded expanded extra-expanded ultra-expanded inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@font-size-adjust">
+      <xsl:call-template name="disable-on-graphics"/>
+      <xsl:call-template name="quantitative-values">
+         <xsl:with-param name="valuelist"> none inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@font-style">
+      <xsl:call-template name="disable-on-graphics"/>
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> normal italic oblique backslant inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@font-variant">
+      <xsl:call-template name="disable-on-graphics"/>
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> normal small-caps inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@font-weight">
+      <xsl:call-template name="disable-on-graphics"/>
+      <xsl:call-template name="quantitative-values">
+         <xsl:with-param name="valuelist"> normal bold bolder lighter inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <!-- 7.8. Hyphenation  -->
+<xsl:template match="@country">
+      <xsl:call-template name="disable-on-graphics"/>
+   </xsl:template>
+
+   <xsl:template match="@language">
+      <xsl:call-template name="disable-on-graphics"/>
+   </xsl:template>
+
+   <xsl:template match="@script">
+      <xsl:call-template name="disable-on-graphics"/>
+   </xsl:template>
+
+   <xsl:template match="@hyphenate">
+      <xsl:call-template name="disable-on-graphics"/>
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> false true inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@hyphenation-character">
+      <xsl:call-template name="disable-on-graphics"/>
+   </xsl:template>
+
+   <xsl:template match="@hyphenation-push-character-count                    | @hyphenation-remain-character-count">
+      <xsl:call-template name="disable-on-graphics"/>
+      <xsl:call-template name="quantitative-values">
+         <xsl:with-param name="valuelist"> inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+
+   <!-- 7.9 - 7.10. Margin properties - block and inline  -->
+<xsl:template match="@margin-top                    | @margin-bottom                    | @margin-left                    | @margin-right">
+      <xsl:call-template name="quantitative-values">
+         <xsl:with-param name="valuelist"> auto inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template priority="5"
+                 match="fo:region-body/@margin-top                    | fo:region-body/@margin-bottom                    | fo:region-body/@margin-left                    | fo:region-body/@margin-right                    | fo:simple-page-master/@margin-top                    | fo:simple-page-master/@margin-bottom                    | fo:simple-page-master/@margin-left                    | fo:simple-page-master/@margin-right">
+      <xsl:call-template name="quantitative-values"/>
+   </xsl:template>
+
+   <xsl:template match="@space-before                    | @space-before.minimum                    | @space-before.optimum                    | @space-before.maximum                    | @space-after                    | @space-after.minimum                    | @space-after.optimum                    | @space-after.maximum                    | @space-start                    | @space-start.minimum                    | @space-start.optimum                    | @space-start.maximum                    | @space-end                    | @space-end.minimum                    | @space-end.optimum                    | @space-end.maximum">
+      <xsl:call-template name="quantitative-values">
+         <xsl:with-param name="valuelist"> inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+
+   <xsl:template match="@space-before.conditionality                    | @space-after.conditionality                    | @space-start.conditionality                    | @space-end.conditionality">
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> discard retain </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@space-before.precedence                    | @space-after.precedence                    | @space-start.precedence                    | @space-end.precedence">
+      <xsl:call-template name="quantitative-values">
+         <xsl:with-param name="valuelist"> force </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+
+   <xsl:template match="@start-indent | @end-indent">
+      <xsl:call-template name="quantitative-values">
+         <xsl:with-param name="valuelist"> inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+
+   <!-- 7.11. Relative position  -->
+<xsl:template match="@relative-position">
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> static relative inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <!-- 7.12. Area alignment  -->
+<xsl:template match="@alignment-adjust">
+      <xsl:call-template name="quantitative-values">
+         <xsl:with-param name="valuelist"> auto baseline before-edge text-before-edge middle central after-edge text-after-edge ideographic alphabetic hanging mathematical top bottom text-top text-bottom inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@alignment-baseline">
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> auto baseline before-edge text-before-edge middle central after-edge text-after-edge ideographic alphabetic hanging mathematical top bottom text-top text-bottom inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@baseline-shift">
+      <xsl:call-template name="quantitative-values">
+         <xsl:with-param name="valuelist"> baseline sub super inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template priority="3" match="@display-align">
+      <xsl:call-template name="disable-on-atomic-inlines"/>
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> auto before center after inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@dominant-baseline">
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> auto use-script no-change reset-size ideographic alphabetic hanging mathematical central middle text-after-edge text-before-edge inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@relative-align">
+      <xsl:call-template name="disable-on-atomic-inlines"/>
+      <xsl:call-template name="disable-on-graphics"/>
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> before baseline inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <!-- 7.13. Area dimensions  -->
+<xsl:template match="@block-progression-dimension                    | @block-progression-dimension.minimum                    | @block-progression-dimension.optimum                    | @block-progression-dimension.maximum                    | @inline-progression-dimension                    | @inline-progression-dimension.minimum                    | @inline-progression-dimension.optimum                    | @inline-progression-dimension.maximum                    | @height                    | @width">
+      <xsl:call-template name="disable-on-atomic-inlines"/>
+      <xsl:call-template name="quantitative-values">
+         <xsl:with-param name="valuelist"> auto inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@max-height | @max-width">
+      <xsl:call-template name="disable-on-atomic-inlines"/>
+      <xsl:call-template name="quantitative-values">
+         <xsl:with-param name="valuelist"> none inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@min-height | @min-width">
+      <xsl:call-template name="disable-on-atomic-inlines"/>
+      <xsl:call-template name="quantitative-values">
+         <xsl:with-param name="valuelist"> inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@content-height | @content-width">
+      <xsl:call-template name="disable-on-atomic-inlines"/>
+      <xsl:call-template name="quantitative-values">
+         <xsl:with-param name="valuelist"> auto scale-to-fit inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@scaling">
+      <xsl:call-template name="disable-on-atomic-inlines"/>
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> uniform non-uniform inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@scaling-method">
+      <xsl:call-template name="disable-on-atomic-inlines"/>
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> auto integer-pixels resample-any-method inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+
+   <!-- 7.14. Block and line-related properties  -->
+<xsl:template match="@hyphenation-keep">
+      <xsl:call-template name="disable-on-atomic-inlines"/>
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> auto column page inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@hyphenation-ladder-count">
+      <xsl:call-template name="disable-on-atomic-inlines"/>
+      <xsl:call-template name="disable-on-graphics"/>
+      <xsl:call-template name="quantitative-values">
+         <xsl:with-param name="valuelist"> no-limit inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@text-indent | @last-line-end-indent">
+      <xsl:call-template name="disable-on-atomic-inlines"/>
+      <xsl:call-template name="disable-on-graphics"/>
+      <xsl:call-template name="quantitative-values">
+         <xsl:with-param name="valuelist"> inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@line-height">
+      <xsl:call-template name="disable-on-graphics"/>
+      <xsl:call-template name="quantitative-values">
+         <xsl:with-param name="valuelist"> normal inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@line-height.minimum                    | @line-height.optimum                    | @line-height.maximum">
+      <xsl:call-template name="disable-on-graphics"/>
+      <xsl:call-template name="quantitative-values">
+         <xsl:with-param name="valuelist"> inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@line-height.conditionality">
+      <xsl:call-template name="disable-on-atomic-inlines"/>
+      <xsl:call-template name="disable-on-graphics"/>
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> discard retain </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@line-height.precedence">
+      <xsl:call-template name="disable-on-atomic-inlines"/>
+      <xsl:call-template name="disable-on-graphics"/>
+      <xsl:call-template name="quantitative-values">
+         <xsl:with-param name="valuelist"> force </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@line-height-shift-adjustment">
+      <xsl:call-template name="disable-on-atomic-inlines"/>
+      <xsl:call-template name="disable-on-graphics"/>
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> consider-shifts disregard-shifts inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@line-stacking-strategy">
+      <xsl:call-template name="disable-on-atomic-inlines"/>
+      <xsl:call-template name="disable-on-graphics"/>
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> line-height font-height max-height inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@linefeed-treatment">
+      <xsl:call-template name="disable-on-atomic-inlines"/>
+      <xsl:call-template name="disable-on-graphics"/>
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> ignore preserve treat-as-space treat-as-zero-width-space inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@white-space-treatment">
+      <xsl:call-template name="disable-on-atomic-inlines"/>
+      <xsl:call-template name="disable-on-graphics"/>
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> ignore preserve ignore-if-before-linefeed ignore-if-after-linefeed ignore-if-surrounding-linefeed inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@text-align">
+      <xsl:call-template name="disable-on-atomic-inlines"/>
+      <xsl:variable name="keyword-charset"
+                    select="'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
+      <xsl:variable name="token" select="normalize-space()"/>
+      <xsl:if test="string-length($token) != 0 and                 string-length(translate($token, $keyword-charset, '')) = 0">
+         <xsl:call-template name="enumerated-values">
+            <xsl:with-param name="valuelist"> start center end justify inside outside left right inherit </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+   </xsl:template>
+
+
+   <xsl:template match="@text-align-last">
+      <xsl:call-template name="disable-on-atomic-inlines"/>
+      <xsl:call-template name="disable-on-graphics"/>
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> relative start center end justify inside outside left right inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@white-space-collapse">
+      <xsl:call-template name="disable-on-atomic-inlines"/>
+      <xsl:call-template name="disable-on-graphics"/>
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> false true inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@wrap-option">
+      <xsl:call-template name="disable-on-atomic-inlines"/>
+      <xsl:call-template name="disable-on-graphics"/>
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> no-wrap wrap inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+
+   <!-- 7.15. Character properties -->
+<xsl:template match="fo:character/@character"/>
+
+   <xsl:template match="@letter-spacing.minimum                     | @letter-spacing.optimum                      | @letter-spacing.maximum                      | @letter-spacing                     | @word-spacing.minimum                     | @word-spacing.optimum                     | @word-spacing.maximum                     | @word-spacing">
+      <xsl:call-template name="disable-on-graphics"/>
+      <xsl:call-template name="quantitative-values">
+         <xsl:with-param name="valuelist"> normal inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@word-spacing.conditionality                    | @letter-spacing.conditionality">
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> discard retain </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@word-spacing.precedence                    | @letter-spacing.precedence">
+      <xsl:call-template name="quantitative-values">
+         <xsl:with-param name="valuelist"> force </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+
+   <xsl:template match="@suppress-at-line-break">
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> auto suppress retain inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@text-decoration">
+      <xsl:call-template name="disable-on-graphics"/>
+   </xsl:template>
+
+   <xsl:template match="@text-shadow">
+      <xsl:call-template name="disable-on-graphics"/>
+   </xsl:template>
+
+   <xsl:template match="@text-transform">
+      <xsl:call-template name="disable-on-graphics"/>
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> capitalize uppercase lowercase none inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@treat-as-word-space">
+      <xsl:call-template name="disable-on-graphics"/>
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> auto false true inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <!-- 7.16. Color properties -->
+<xsl:template match="@color"/>
+
+   <xsl:template match="fo:color-profile/@color-profile-name" priority="5"/>
+
+   <xsl:template match="fo:color-profile/@rendering-intent                    | fo:declarations/@rendering-intent                    | fo:root/@rendering-intent"
+                 priority="5">
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> auto perceptual relative-colorimetric saturation absolute-colorimetric inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+
+   <!-- 7.17. Float properties -->
+<xsl:template match="@clear">
+      <xsl:call-template name="disable-on-atomic-inlines"/>
+      <xsl:call-template name="disable-on-graphics"/>
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> start end left right both none inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@float">
+      <xsl:call-template name="disable-on-atomic-inlines"/>
+      <xsl:call-template name="disable-on-graphics"/>
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> before start end left right inside outside none inherit </xsl:with-param>
+      </xsl:call-template>
+
+      <xsl:if test="$strictness &gt; 1">
+         <xsl:if test=".='inside' or .='outside'">
+            <xsl:call-template name="print-warning">
+               <xsl:with-param name="msg">Value "<xsl:value-of select="."/>" for 'float' attribute is a RenderX extension.</xsl:with-param>
+            </xsl:call-template>  
+         </xsl:if>
+      </xsl:if>
+   </xsl:template>
+
+   <xsl:template match="@intrusion-displace">
+      <xsl:call-template name="disable-on-atomic-inlines"/>
+      <xsl:call-template name="disable-on-graphics"/>
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> auto none line indent block inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <!-- 7.18. Keeps and breaks -->
+<xsl:template match="@break-after | @break-before">
+      <xsl:call-template name="disable-on-atomic-inlines"/>
+      <xsl:call-template name="disable-on-graphics"/>
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> auto column page even-page odd-page inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@keep-together                    | @keep-together.within-line                    | @keep-together.within-column                    | @keep-together.within-page                    | @keep-with-next                    | @keep-with-next.within-line                    | @keep-with-next.within-column                    | @keep-with-next.within-page                    | @keep-with-previous                    | @keep-with-previous.within-line                    | @keep-with-previous.within-column                    | @keep-with-previous.within-page">
+      <xsl:call-template name="quantitative-values">
+         <xsl:with-param name="valuelist"> auto always inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@orphans | @widows">
+      <xsl:call-template name="disable-on-atomic-inlines"/>
+      <xsl:call-template name="disable-on-graphics"/>
+      <xsl:call-template name="quantitative-values">
+         <xsl:with-param name="valuelist"> inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+
+   <!-- 7.19. Layout-related properties -->
+<xsl:template priority="3" match="@clip"/>
+
+   <xsl:template priority="3" match="@overflow">
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> visible hidden scroll error-if-overflow auto inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template priority="3" match="@reference-orientation">
+      <xsl:call-template name="disable-on-atomic-inlines"/>
+      <xsl:call-template name="disable-on-graphics"/>
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> 0 90 180 270 -90 -180 -270 inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template priority="5" match="fo:simple-page-master/@reference-orientation">
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> 0 90 180 270 -90 -180 -270 inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@span">
+      <xsl:if test="ancestor::fo:static-content">
+         <xsl:call-template name="print-error">
+            <xsl:with-param name="msg">Attribute 'span' cannot be used inside '<xsl:value-of select="name(ancestor::fo:static-content[1])"/>'. </xsl:with-param>
+         </xsl:call-template>
+      </xsl:if>
+      <xsl:call-template name="disable-on-atomic-inlines"/>
+      <xsl:call-template name="disable-on-graphics"/>
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> none all inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <!-- 7.20. Leader properties -->
+<xsl:template match="@leader-alignment">
+      <xsl:call-template name="disable-on-atomic-inlines"/>
+      <xsl:call-template name="disable-on-graphics"/>
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> none reference-area page inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@leader-pattern">
+      <xsl:call-template name="disable-on-atomic-inlines"/>
+      <xsl:call-template name="disable-on-graphics"/>
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> space rule dots use-content inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@leader-pattern-width">
+      <xsl:call-template name="disable-on-atomic-inlines"/>
+      <xsl:call-template name="disable-on-graphics"/>
+      <xsl:call-template name="quantitative-values">
+         <xsl:with-param name="valuelist"> use-font-metrics inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@leader-length                    | @leader-length.minimum                    | @leader-length.optimum                    | @leader-length.maximum">
+      <xsl:call-template name="disable-on-atomic-inlines"/>
+      <xsl:call-template name="disable-on-graphics"/>
+      <xsl:call-template name="quantitative-values">
+         <xsl:with-param name="valuelist"> inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@rule-style">
+      <xsl:call-template name="disable-on-atomic-inlines"/>
+      <xsl:call-template name="disable-on-graphics"/>
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> none dotted dashed solid double groove ridge inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@rule-thickness">
+      <xsl:call-template name="disable-on-atomic-inlines"/>
+      <xsl:call-template name="disable-on-graphics"/>
+      <xsl:call-template name="quantitative-values">
+         <xsl:with-param name="valuelist"> inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <!-- 7.21. Dynamic effects and hyperrefs -->
+<xsl:template match="fo:multi-property-set/@active-state">
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> link visited active hover focus </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@auto-restore">
+      <xsl:call-template name="disable-on-atomic-inlines"/>
+      <xsl:call-template name="disable-on-graphics"/>
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> false true </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="fo:multi-case/@case-name"/>
+   <xsl:template match="fo:multi-case/@case-title"/>
+
+   <xsl:template match="fo:basic-link/@destination-placement-offset">
+      <xsl:call-template name="quantitative-values"/>
+   </xsl:template>
+
+   <xsl:template match="fo:basic-link/@external-destination">
+      <xsl:call-template name="check-url"/>
+   </xsl:template>
+   <xsl:template match="rx:bookmark/@external-destination" priority="5">
+      <xsl:call-template name="check-url"/>
+   </xsl:template>
+
+   <xsl:template match="fo:basic-link/@internal-destination"/>
+   <xsl:template match="rx:bookmark/@internal-destination" priority="5"/>
+
+   <xsl:template match="rx:bookmark/@collapse-subtree" priority="5">
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> true false </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="fo:root/@rx:initial-destination"/>
+
+   <xsl:template match="fo:basic-link/@indicate-destination">
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> true false </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="fo:basic-link/@show-destination">
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> replace new </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+   <xsl:template match="rx:bookmark/@show-destination" priority="5">
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> replace new </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+
+   <xsl:template match="fo:multi-case/@starting-state">
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> show hide </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="fo:multi-toggle/@switch-to"/>
+   <xsl:template match="fo:basic-link/@target-presentation-context"/>
+   <xsl:template match="fo:basic-link/@target-processing-context"/>
+   <xsl:template match="fo:basic-link/@target-stylesheet"/>
+
+   <!-- 7.22. Marker properties -->
+<xsl:template match="fo:marker/@marker-class-name"/>
+   <xsl:template match="fo:retrieve-marker/@retrieve-class-name"/>
+
+   <xsl:template match="fo:retrieve-marker/@retrieve-position">
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> first-starting-within-page first-including-carryover last-starting-within-page last-ending-within-page </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="fo:retrieve-marker/@retrieve-boundary">
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> page page-sequence document </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+
+   <!-- 7.23. Number format properties -->
+<xsl:template match="fo:page-sequence/@format | rx:ruler/@format"/>
+   <xsl:template match="fo:page-sequence/@grouping-separator | rx:ruler/@grouping-separator"/>
+
+   <xsl:template match="fo:page-sequence/@grouping-size | rx:ruler/@grouping-size">
+      <xsl:call-template name="quantitative-values"/>
+   </xsl:template>
+
+   <xsl:template match="fo:page-sequence/@letter-value | rx:ruler/@letter-value">
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> auto alphabetic traditional </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <!-- 7.24. Pagination -->
+<xsl:template priority="5" match="fo:conditional-page-master-reference/@blank-or-not-blank">
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> blank not-blank any </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template priority="5" match="fo:conditional-page-master-reference/@odd-or-even">
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> even odd any </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template priority="5" match="fo:conditional-page-master-reference/@page-position">
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> first last rest any </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template priority="5" match="fo:region-body/@column-count">
+      <xsl:call-template name="quantitative-values"/>
+   </xsl:template>
+
+   <xsl:template priority="5" match="fo:region-body/@column-gap">
+      <xsl:call-template name="quantitative-values"/>
+   </xsl:template>
+
+   <xsl:template match="rx:flow-section/@column-count">
+      <xsl:call-template name="quantitative-values"/>
+   </xsl:template>
+
+   <xsl:template match="rx:flow-section/@column-gap">
+      <xsl:call-template name="quantitative-values"/>
+   </xsl:template>
+
+   <xsl:template priority="5"
+                 match="fo:region-before/@extent                    | fo:region-after/@extent                    | fo:region-start/@extent                    | fo:region-end/@extent">
+      <xsl:call-template name="quantitative-values"/>
+   </xsl:template>
+
+   <xsl:template match="fo:flow/@flow-name | fo:static-content/@flow-name"/>
+
+   <xsl:template match="fo:page-sequence/@force-page-count">
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> auto even odd end-on-even end-on-odd no-force </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="fo:page-sequence/@initial-page-number">
+      <xsl:call-template name="quantitative-values">
+         <xsl:with-param name="valuelist"> auto auto-odd auto-even </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template priority="5"
+                 match="fo:simple-page-master/@master-name                    | fo:page-sequence-master/@master-name"/>
+
+   <xsl:template priority="5"
+                 match="fo:page-sequence/@master-reference                    | fo:single-page-master-reference/@master-reference                    | fo:repeatable-page-master-reference/@master-reference                    | fo:conditional-page-master-reference/@master-reference"/>
+
+   <xsl:template priority="5"
+                 match="fo:repeatable-page-master-reference/@maximum-repeats                    | fo:repeatable-page-master-alternatives/@maximum-repeats">
+      <xsl:call-template name="quantitative-values">
+         <xsl:with-param name="valuelist"> no-limit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+
+   <xsl:template match="fo:root/@media-usage">
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> auto paginate bounded-in-one-dimension unbounded </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template priority="5"
+                 match="fo:simple-page-master/@page-height                    | fo:simple-page-master/@page-width">
+      <xsl:call-template name="quantitative-values">
+         <xsl:with-param name="valuelist"> auto indefinite </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template priority="5"
+                 match="fo:region-before/@precedence                    | fo:region-after/@precedence                    | fo:region-start/@precedence                    | fo:region-end/@precedence">
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> true false </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template priority="5"
+                 match="fo:region-body/@region-name                    | fo:region-before/@region-name                    | fo:region-after/@region-name                    | fo:region-start/@region-name                    | fo:region-end/@region-name"/>
+
+   <!-- 7.25. Table properties -->
+<xsl:template match="@border-after-precedence                    | @border-before-precedence                    | @border-end-precedence                    | @border-start-precedence">
+      <xsl:call-template name="disable-on-atomic-inlines"/>
+      <xsl:call-template name="disable-on-graphics"/>
+      <xsl:call-template name="quantitative-values">
+         <xsl:with-param name="valuelist"> force inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@border-collapse">
+      <xsl:call-template name="disable-on-atomic-inlines"/>
+      <xsl:call-template name="disable-on-graphics"/>
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> collapse collapse-with-precedence separate inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@border-separation                    | @border-separation.block-progression-direction                    | @border-separation.inline-progression-direction">
+      <xsl:call-template name="disable-on-atomic-inlines"/>
+      <xsl:call-template name="disable-on-graphics"/>
+      <xsl:call-template name="quantitative-values">
+         <xsl:with-param name="valuelist"> inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+
+   <xsl:template match="@caption-side">
+      <xsl:call-template name="disable-on-atomic-inlines"/>
+      <xsl:call-template name="disable-on-graphics"/>
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> before after start end top bottom left right inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="fo:table-column/@column-number                    | fo:table-cell/@column-number">
+      <xsl:call-template name="quantitative-values"/>
+   </xsl:template>
+
+   <xsl:template match="fo:table-column/@column-width">
+      <xsl:call-template name="quantitative-values"/>
+   </xsl:template>
+
+   <xsl:template match="@empty-cells">
+      <xsl:call-template name="disable-on-atomic-inlines"/>
+      <xsl:call-template name="disable-on-graphics"/>
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> show hide inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="fo:table-cell/@ends-row                    | fo:table-cell/@starts-row">
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> true false </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="fo:table-column/@number-columns-repeated">
+      <xsl:call-template name="quantitative-values"/>
+   </xsl:template>
+
+   <xsl:template match="fo:table-column/@number-columns-spanned                    | fo:table-cell/@number-columns-spanned">
+      <xsl:call-template name="quantitative-values"/>
+   </xsl:template>
+
+   <xsl:template match="fo:table-cell/@number-rows-spanned">
+      <xsl:call-template name="quantitative-values"/>
+   </xsl:template>
+
+   <xsl:template match="@table-layout">
+      <xsl:call-template name="disable-on-atomic-inlines"/>
+      <xsl:call-template name="disable-on-graphics"/>
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> auto fixed inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="fo:table/@table-omit-footer-at-break                    | fo:table/@table-omit-header-at-break                     | fo:table/@rx:table-omit-initial-header                    | fo:table/@rx:table-omit-final-footer">
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> true false </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+
+   <!-- 7.26. Writing mode -->
+<xsl:template match="@direction">
+      <xsl:call-template name="disable-on-graphics"/>
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> ltr rtl inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@glyph-orientation-horizontal">
+      <xsl:call-template name="disable-on-graphics"/>
+      <xsl:call-template name="quantitative-values">
+         <xsl:with-param name="valuelist"> inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@glyph-orientation-vertical">
+      <xsl:call-template name="disable-on-graphics"/>
+      <xsl:call-template name="quantitative-values">
+         <xsl:with-param name="valuelist"> auto inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@text-altitude | @text-depth">
+      <xsl:call-template name="quantitative-values">
+         <xsl:with-param name="valuelist"> use-font-metrics inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+
+   <xsl:template match="@unicode-bidi">
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> normal embed bidi-override inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template priority="3" match="@writing-mode">
+      <xsl:call-template name="disable-on-atomic-inlines"/>
+      <xsl:call-template name="disable-on-graphics"/>
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> lr-tb rl-tb tb-rl tb-lr lr-alternating-rl-tb lr-inverting-rl-tb lr-bt rl-bt bt-rl bt-lr lr-alternating-rl-bt lr-inverting-rl-bt tb-lr-in-lr-pairs lr rl tb inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template priority="5" match="fo:simple-page-master/@writing-mode">
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> lr-tb rl-tb tb-rl tb-lr lr-alternating-rl-tb lr-inverting-rl-tb lr-bt rl-bt bt-rl bt-lr lr-alternating-rl-bt lr-inverting-rl-bt tb-lr-in-lr-pairs lr rl tb inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+
+   <!-- 7.27. Miscellaneous properties -->
+<xsl:template match="fo:external-graphic/@content-type                    | fo:instream-foreign-object/@content-type                    | rx:background-content-type"
+                 priority="3">
+      <xsl:variable name="val" select="normalize-space()"/>
+      <xsl:choose>
+         <xsl:when test="$val = 'auto'"/>
+         <xsl:when test="starts-with($val, 'content-type:')"/>
+         <xsl:when test="starts-with($val, 'namespace:')"/>
+         <xsl:otherwise>
+            <xsl:call-template name="print-warning">
+               <xsl:with-param name="msg">Attribute '<xsl:value-of select="name()"/>' cannot have a value of "<xsl:value-of select="."/>": if not 'auto', it should be prefixed by either 'namespace:' or 'content-type:'.</xsl:with-param>
+            </xsl:call-template>
+         </xsl:otherwise>
+      </xsl:choose>
+   </xsl:template>
+
+
+   <xsl:template match="@id"/>
+   <xsl:template match="fo:page-number-citation/@ref-id"/>
+   <xsl:template match="rx:page-number-citation-last/@ref-id"/>
+   <xsl:template match="rx:end-index-range/@ref-id"/>
+
+   <xsl:template match="@provisional-label-separation                    | @provisional-distance-between-starts">
+      <xsl:call-template name="disable-on-atomic-inlines"/>
+      <xsl:call-template name="disable-on-graphics"/>
+      <xsl:call-template name="quantitative-values">
+         <xsl:with-param name="valuelist"> inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@score-spaces">
+      <xsl:call-template name="disable-on-graphics"/>
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> true false inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="fo:external-graphic/@src">
+      <xsl:call-template name="check-url"/>
+   </xsl:template>
+
+
+   <xsl:template priority="5" match="fo:color-profile/@src">
+      <xsl:call-template name="check-url"/>
+   </xsl:template>
+
+   <xsl:template match="@visibility">
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> visible hidden collapse inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@z-index">
+      <xsl:call-template name="quantitative-values">
+         <xsl:with-param name="valuelist"> auto inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+
+   <!-- 7.28. Shorthands -->
+<xsl:template priority="3" match="@background"/>
+   <xsl:template priority="3" match="@background-position"/>
+   <xsl:template priority="3" match="@border"/>
+   <xsl:template priority="3"
+                 match="@border-top                    | @border-bottom                    | @border-left                    | @border-right"/>
+   <xsl:template priority="3" match="@border-color"/>
+   <xsl:template priority="3" match="@border-style"/>
+   <xsl:template match="@border-spacing"/>
+   <xsl:template priority="3" match="@border-width"/>
+   <xsl:template match="@cue"/>
+   <xsl:template match="@font">
+      <xsl:call-template name="disable-on-graphics"/>
+   </xsl:template>
+   <xsl:template match="@margin"/>
+   <xsl:template priority="5"
+                 match="fo:simple-page-master/@margin                    | fo:region-body/@margin"/>
+
+   <xsl:template priority="3" match="@padding"/>
+
+   <xsl:template match="@page-break-after | @page-break-before">
+      <xsl:call-template name="disable-on-atomic-inlines"/>
+      <xsl:call-template name="disable-on-graphics"/>
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> auto always avoid left right inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@page-break-inside">
+      <xsl:call-template name="disable-on-graphics"/>
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> auto avoid inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@pause"/>
+
+   <xsl:template match="@position">
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> static relative absolute fixed inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template priority="5" match="fo:simple-page-master/@size">
+      <xsl:call-template name="quantitative-values">
+         <xsl:with-param name="valuelist"> auto landscape portrait </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@vertical-align">
+      <xsl:call-template name="quantitative-values">
+         <xsl:with-param name="valuelist"> baseline middle sub super text-top text-bottom top bottom inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@white-space">
+      <xsl:call-template name="disable-on-graphics"/>
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> normal pre nowrap inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@xml:lang">
+      <xsl:call-template name="disable-on-graphics"/>
+   </xsl:template>
+
+
+   <!-- RenderX extensions -->
+
+<xsl:template match="@rx:background-content-width                    | @rx:background-content-height"
+                 priority="3">
+      <xsl:call-template name="quantitative-values">
+         <xsl:with-param name="valuelist"> auto scale-to-fit inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@rx:background-scaling" priority="3">
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> uniform non-uniform inherit </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="rx:meta-field/@name" priority="5"/>
+   <xsl:template match="rx:meta-field/@value" priority="5"/>
+
+   <xsl:template match="@rx:key | rx:begin-index-range/@key"/>
+
+   <xsl:template match="rx:pinpoint/@value"/>
+
+   <xsl:template match="rx:page-index/@ref-key | rx:index-item/@ref-key"/>
+
+   <xsl:template match="@rx:list-separator | rx:page-index/@list-separator">
+      <xsl:call-template name="disable-on-atomic-inlines"/>
+      <xsl:call-template name="disable-on-graphics"/>
+   </xsl:template>
+
+   <xsl:template match="@rx:range-separator | rx:page-index/@range-separator | rx:index-item/@range-separator">
+      <xsl:call-template name="disable-on-atomic-inlines"/>
+      <xsl:call-template name="disable-on-graphics"/>
+   </xsl:template>
+
+   <xsl:template match="@rx:merge-subsequent-page-numbers | rx:page-index/@merge-subsequent-page-numbers | rx:index-item/@merge-subsequent-page-numbers">
+      <xsl:call-template name="disable-on-atomic-inlines"/>
+      <xsl:call-template name="disable-on-graphics"/>
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> false true </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <xsl:template match="@rx:link-back | rx:page-index/@link-back | rx:index-item/@link-back">
+      <xsl:call-template name="disable-on-atomic-inlines"/>
+      <xsl:call-template name="disable-on-graphics"/>
+      <xsl:call-template name="enumerated-values">
+         <xsl:with-param name="valuelist"> false true </xsl:with-param>
+      </xsl:call-template>
+   </xsl:template>
+
+   <!-- =================================== -->
+<!-- Print an error message              -->
+
+<xsl:template name="print-error">
+      <xsl:param name="msg"/>
+      <xsl:message>[error] <xsl:value-of select="normalize-space($msg)"/>
+      </xsl:message>
+   </xsl:template>
+
+   <!-- =================================== -->
+<!-- Print a warning message             -->
+
+<xsl:template name="print-warning">
+      <xsl:param name="msg"/>
+      <xsl:message>[warning] <xsl:value-of select="normalize-space($msg)"/>
+      </xsl:message>
+   </xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/folint.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/processpb.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/processpb.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/processpb.xsl	(revision 258)
@@ -0,0 +1,164 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns="http://www.tei-c.org/ns/1.0"
+		xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+		xpath-default-namespace="http://www.tei-c.org/ns/1.0"
+		version="2.0">
+<!--
+This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+
+     $Id: processpb.xsl 9646 2011-11-05 23:39:08Z rahtz $
+
+    Take an arbitrary TEI file and move page breaks (<pb>) up in the
+    hierarchy, splitting containers as needed, until <pb>s are at the
+    same level as <div>. Wrap the resulting pages on <page> element.
+-->
+  <xsl:output indent="yes"/>
+
+  <xsl:template match="teiHeader">
+    <xsl:copy-of select="."/>
+  </xsl:template>
+
+  <xsl:template match="TEI|teiCorpus|group">
+    <xsl:copy>
+      <xsl:apply-templates select="@*"/>
+      <xsl:apply-templates select="*|processing-instruction()|comment()|text()"/>
+    </xsl:copy>
+  </xsl:template>
+
+  <xsl:template match="text|body|back|front">
+    <xsl:copy>
+      <xsl:apply-templates select="@*"/>
+      <xsl:variable name="pages">
+        <xsl:apply-templates select="*|processing-instruction()|comment()|text()"/>
+      </xsl:variable>
+      <xsl:for-each select="$pages">
+        <xsl:apply-templates select="*|processing-instruction()|comment()|text()" mode="pass2"/>
+      </xsl:for-each>
+    </xsl:copy>
+  </xsl:template>
+
+
+ <!-- first (recursive) pass. look for <pb> elements and group on them -->
+  <xsl:template match="comment()|@*|processing-instruction()|text()">
+    <xsl:copy-of select="."/>
+  </xsl:template>
+
+  <xsl:template match="*">
+    <xsl:call-template name="checkpb">
+      <xsl:with-param name="eName" select="local-name()"/>
+    </xsl:call-template>
+  </xsl:template>
+
+  <xsl:template match="pb">
+    <pb>
+      <xsl:copy-of select="@*"/>
+    </pb>
+  </xsl:template>
+
+  <xsl:template name="checkpb">
+    <xsl:param name="eName"/>
+    <xsl:choose>
+      <xsl:when test="not(.//pb)">
+        <xsl:copy>
+          <xsl:apply-templates select="@*"/>
+          <xsl:apply-templates select="*|processing-instruction()|comment()|text()"/>
+        </xsl:copy>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:variable name="pass">
+          <xsl:call-template name="groupbypb">
+            <xsl:with-param name="Name" select="$eName"/>
+          </xsl:call-template>
+        </xsl:variable>
+        <xsl:for-each select="$pass">
+          <xsl:apply-templates/>
+        </xsl:for-each>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="groupbypb">
+    <xsl:param name="Name"/>
+    <xsl:for-each-group select="node()" group-starting-with="pb">
+      <xsl:choose>
+        <xsl:when test="self::pb">
+          <xsl:copy-of select="."/>
+          <xsl:element name="{$Name}">
+	    <xsl:attribute name="rend">CONTINUED</xsl:attribute>
+            <xsl:apply-templates select="current-group() except ."/>
+          </xsl:element>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:element name="{$Name}">
+            <xsl:for-each select="..">
+              <xsl:copy-of select="@*"/>
+              <xsl:apply-templates select="current-group()"/>
+            </xsl:for-each>
+          </xsl:element>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:for-each-group>
+  </xsl:template>
+
+  <!-- second pass. group by <pb> (now all at top level) and wrap groups
+       in <page> -->
+  <xsl:template match="*" mode="pass2">
+    <xsl:copy>
+      <xsl:apply-templates select="@*|*|processing-instruction()|comment()|text()" mode="pass2"/>
+    </xsl:copy>
+  </xsl:template>
+
+  <xsl:template match="*[pb]" mode="pass2">
+    <xsl:copy>
+      <xsl:apply-templates select="@*"/>
+      <xsl:for-each-group select="*" group-starting-with="pb">
+        <xsl:choose>
+          <xsl:when test="self::pb">
+            <page xmlns="http://www.tei-c.org/ns/notTEI"> 
+              <xsl:copy-of select="@*"/>
+              <xsl:copy-of select="current-group() except ."/>
+            </page>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:copy-of select="current-group()"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:for-each-group>
+    </xsl:copy>
+  </xsl:template>
+
+  <xsl:template match="comment()|@*|processing-instruction()|text()" mode="pass2">
+    <xsl:copy-of select="."/>
+  </xsl:template>
+
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/processpb.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/getfiles.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/getfiles.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/getfiles.xsl	(revision 258)
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:n="www.example.com" xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="2.0"
+                exclude-result-prefixes="n tei xs">
+
+  <xsl:param name="debug">false</xsl:param>
+  <xsl:param name="corpus"/>
+  <xsl:param name="suffix">xml</xsl:param>
+  <xsl:param name="corpusList"/>
+  <xsl:param name="processP4">false</xsl:param>
+  <xsl:param name="processP5">true</xsl:param>
+  <xsl:param name="verbose">false</xsl:param>
+  <xsl:key name="All" match="*" use="1"/>
+  <xsl:key name="AllTEI" match="tei:*" use="1"/>
+  <xsl:key name="E" match="*" use="local-name()"/>
+
+  <xsl:template name="main">
+      <xsl:variable name="pathlist">
+         <xsl:choose>
+	   <xsl:when test="$corpusList=''">
+	     <xsl:value-of select="concat($corpus,'?select=*.',$suffix,';recurse=yes;on-error=warning')"/>
+	   </xsl:when>
+	   <xsl:otherwise>
+	     <xsl:value-of select="$corpusList"/>
+	   </xsl:otherwise>
+         </xsl:choose>
+      </xsl:variable>
+      <xsl:if test="$debug='true'">
+	<xsl:message>Process <xsl:value-of select="$pathlist"/></xsl:message>
+      </xsl:if>
+      <xsl:variable name="docs" select="collection($pathlist)"/> 
+      <xsl:variable name="all">
+         <n:ROOT>
+	   <xsl:if test="$processP4='true'">
+	     <xsl:for-each select="$docs/TEI.2">
+	       <xsl:if test="$verbose='true'">
+		 <xsl:message>processing <xsl:value-of select="base-uri(.)"/>
+		 </xsl:message>
+	       </xsl:if>
+	       <TEI.2 xn="{base-uri(.)}">
+		 <xsl:apply-templates select="*|@*" mode="copy"/>
+	       </TEI.2>
+	     </xsl:for-each>
+	   </xsl:if>
+	   <xsl:if test="$processP5='true'">
+	     <xsl:for-each select="$docs/tei:*">
+	       <xsl:if test="$verbose='true'">
+		 <xsl:message>processing <xsl:value-of select="base-uri(.)"/>
+		 </xsl:message>
+	       </xsl:if>
+	       <tei:TEI xn="{base-uri(.)}">
+		 <xsl:apply-templates select="*|@*" mode="copy"/>
+	       </tei:TEI>
+	     </xsl:for-each>
+	     <xsl:for-each select="$docs/tei:teiCorpus">
+	       <xsl:if test="$verbose='true'">
+		 <xsl:message>processing <xsl:value-of select="base-uri(.)"/>
+		 </xsl:message>
+	       </xsl:if>
+	       <tei:teiCorpus xn="{base-uri(.)}">
+		 <xsl:copy-of select="@*|*"/>
+	       </tei:teiCorpus>
+	     </xsl:for-each>
+	   </xsl:if>
+         </n:ROOT>
+      </xsl:variable>
+      <xsl:for-each select="$all/*">
+	<xsl:call-template name="processAll"/>
+      </xsl:for-each>
+  </xsl:template>
+
+  <xsl:template name="processAll">
+      <html>
+         <body>
+	   <table border="1">
+	     <xsl:for-each-group select="key('All',1)" group-by="local-name()">
+	       <xsl:sort select="current-grouping-key()"/>
+	       <tr style="vertical-align:top;">
+		 <td> 
+		   <xsl:value-of select="current-grouping-key()"/>
+		 </td> 
+		 <td> 
+		   <xsl:value-of select="count(current-group())"/>
+		 </td> 
+	       </tr>
+	     </xsl:for-each-group>
+	   </table>
+         </body>
+      </html>
+  </xsl:template>
+
+  <xsl:template match="text()|@*" mode="copy">
+      <xsl:copy-of select="."/>
+  </xsl:template>
+
+  <xsl:template match="*" mode="copy">
+      <xsl:copy>
+         <xsl:apply-templates select="*|@*|text()" mode="copy"/>
+      </xsl:copy>
+  </xsl:template>
+  
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/getfiles.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/analyze.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/analyze.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/analyze.xsl	(revision 258)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:XSL="http://www.w3.org/1999/XSL/Transform"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="1.0">
+   <xsl:output indent="yes" omit-xml-declaration="yes" encoding="utf-8"/>
+   <xsl:param name="file"/>
+   <xsl:template match="XSL:stylesheet">
+      <params>
+         <xsl:for-each select="XSL:param">
+            <param file="{$file}" name="{@name}">
+               <xsl:apply-templates/>
+            </param>
+         </xsl:for-each>
+      </params>
+   </xsl:template>
+
+
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/analyze.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/checkodd.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/checkodd.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/checkodd.xsl	(revision 258)
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:rng="http://relaxng.org/ns/structure/1.0"
+                exclude-result-prefixes="tei xsl rng"
+                version="2.0">
+<!--
+This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+
+$Id: checkodd.xsl 9646 2011-11-05 23:39:08Z rahtz $
+
+2008, TEI Consortium
+-->
+
+<xsl:output method="text"/>
+   <xsl:key name="SPECS" match="tei:*[@ident]" use="@ident"/>
+
+   <xsl:template match="/">
+      <xsl:for-each select="//rng:ref">
+         <xsl:if test="not(key('SPECS',@name))">
+            <xsl:message>No *Spec defined for <xsl:value-of select="@name"/>
+            </xsl:message>
+         </xsl:if>
+      </xsl:for-each>
+   </xsl:template>
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/checkodd.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/checkxsl.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/checkxsl.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/checkxsl.xsl	(revision 258)
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+		version="2.0">
+<!--This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+
+$Id: checkxsl.xsl 9646 2011-11-05 23:39:08Z rahtz $
+
+2008, TEI Consortium
+-->
+
+<xsl:output method="text"/>
+   <xsl:key name="TEMPLATES" match="xsl:template[@name]" use="1"/>
+   <xsl:key name="CALLED_TEMPLATES" match="xsl:call-template[@name]" use="@name"/>
+
+   <xsl:template match="xsl:stylesheet">
+      <xsl:variable name="all">
+         <xsl:copy-of select="xsl:template"/>
+         <xsl:call-template name="inclusions"/>
+      </xsl:variable>
+      <xsl:for-each select="$all">
+         <xsl:for-each select="key('TEMPLATES',1)">
+            <xsl:if test="count(key('CALLED_TEMPLATES',@name))=0">
+	Template <xsl:value-of select="@name"/> is not used
+      </xsl:if>
+         </xsl:for-each>
+      </xsl:for-each>
+   </xsl:template>
+
+   <xsl:template name="inclusions">
+      <xsl:for-each select="xsl:import|xsl:include">
+         <xsl:for-each select="document(@href)/xsl:stylesheet">
+            <xsl:copy-of select="xsl:template"/>
+            <xsl:call-template name="inclusions"/>
+         </xsl:for-each>
+      </xsl:for-each>
+   </xsl:template>
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tools/checkxsl.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tite/tite-acdc.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/tite/tite-acdc.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/tite/tite-acdc.xsl	(revision 258)
@@ -0,0 +1,81 @@
+<xsl:stylesheet
+ xmlns="http://www.tei-c.org/ns/1.0"
+ xmlns:tei="http://www.tei-c.org/ns/1.0"
+ xmlns:tite="http://www.tei-c.org/ns/tite/1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+ exclude-result-prefixes="xsl tei"    
+ version="1.0">
+
+<xsl:template name="b">
+  <hi rend="bold">
+    <xsl:apply-templates 
+	select="@*|*|text()|comment()|processing-instruction"/>  
+  </hi>
+</xsl:template>
+
+<xsl:template name="i">
+  <hi rend="italic">
+    <xsl:apply-templates 
+	select="@*|*|text()|comment()|processing-instruction"/>  
+  </hi>
+</xsl:template>
+
+<xsl:template name="ul">
+  <hi rend="underline">
+    <xsl:apply-templates 
+	select="@*|*|text()|comment()|processing-instruction"/>  
+  </hi>
+</xsl:template>
+
+<xsl:template name="sup">
+  <hi rend="sup">
+    <xsl:apply-templates 
+	select="@*|*|text()|comment()|processing-instruction"/>  
+  </hi>
+</xsl:template>
+
+<xsl:template name="sub">
+  <hi rend="sub">
+    <xsl:apply-templates 
+	select="@*|*|text()|comment()|processing-instruction"/>  
+  </hi>
+</xsl:template>
+
+<xsl:template name="smcap">
+  <hi rend="smcap">
+    <xsl:apply-templates 
+	select="@*|*|text()|comment()|processing-instruction"/>  
+  </hi>
+</xsl:template>
+
+<xsl:template name="ornament">
+  <figure place="inline">
+    <xsl:apply-templates 
+	select="@*"/>
+    <xsl:choose>
+      <xsl:when test="*">
+	<xsl:apply-templates 
+	    select="*|comment()|processing-instruction"/>  
+      </xsl:when>
+      <xsl:when test="string-length(.)&gt;0">
+	<p>
+	<xsl:apply-templates 
+	    select="text()|comment()|processing-instruction"/>  
+	</p>
+      </xsl:when>
+      <xsl:otherwise>
+	<xsl:apply-templates 
+	    select="comment()|processing-instruction"/>  
+      </xsl:otherwise>
+    </xsl:choose>
+  </figure>
+</xsl:template>
+
+<xsl:template name="cols">
+  <milestone unit="cols">
+    <xsl:apply-templates 
+	select="@*|*|text()|comment()|processing-instruction"/>  
+  </milestone>
+</xsl:template>
+
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tite/tite-acdc.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tite/tite-to-tei.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/tei/tite/tite-to-tei.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/tei/tite/tite-to-tei.xsl	(revision 258)
@@ -0,0 +1,147 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+                xmlns="http://www.tei-c.org/ns/1.0"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+		exclude-result-prefixes="tei"
+		version="2.0"
+		xpath-default-namespace="http://www.tei-c.org/ns/tite/1.0">
+
+   <xsl:output cdata-section-elements="eg"/>
+
+<xsl:template match="tei:text">
+  <TEI>
+    <teiHeader>
+    <fileDesc>
+      <titleStmt>
+        <title>[converted from Tite]</title>
+      </titleStmt>
+      <publicationStmt>
+        <p>unknown</p>
+      </publicationStmt>
+      <sourceDesc>
+        <p>converted from Tite on 
+	<date><xsl:value-of select="format-dateTime(current-dateTime(),'[Y]-[M02]-[D02]T[H02]:[m02]:[s02]Z')"/></date></p>
+      </sourceDesc>
+    </fileDesc>
+      
+    </teiHeader>
+    <text>
+    <xsl:apply-templates 
+	select="@*|*|text()|comment()|processing-instruction"/>  
+    </text>
+  </TEI>
+</xsl:template>
+
+<xsl:template
+    match="tei:div1|tei:div2|tei:div3|tei:div4|tei:div5|tei:div6|tei:div7">
+  <div>
+    <xsl:apply-templates 
+	select="@*|*|text()|comment()|processing-instruction"/>  
+  </div>
+</xsl:template>
+
+<xsl:template name="b">
+  <hi rend="bold">
+    <xsl:apply-templates 
+	select="@*|*|text()|comment()|processing-instruction"/>  
+  </hi>
+</xsl:template>
+
+<xsl:template name="i">
+  <hi rend="italic">
+    <xsl:apply-templates 
+	select="@*|*|text()|comment()|processing-instruction"/>  
+  </hi>
+</xsl:template>
+
+<xsl:template name="ul">
+  <hi rend="underline">
+    <xsl:apply-templates 
+	select="@*|*|text()|comment()|processing-instruction"/>  
+  </hi>
+</xsl:template>
+
+<xsl:template name="sup">
+  <hi rend="sup">
+    <xsl:apply-templates 
+	select="@*|*|text()|comment()|processing-instruction"/>  
+  </hi>
+</xsl:template>
+
+<xsl:template name="sub">
+  <hi rend="sub">
+    <xsl:apply-templates 
+	select="@*|*|text()|comment()|processing-instruction"/>  
+  </hi>
+</xsl:template>
+
+<xsl:template name="smcap">
+  <hi rend="smcap">
+    <xsl:apply-templates 
+	select="@*|*|text()|comment()|processing-instruction"/>  
+  </hi>
+</xsl:template>
+
+<xsl:template name="ornament">
+  <figure place="inline">
+    <xsl:apply-templates 
+	select="@*"/>
+    <xsl:choose>
+      <xsl:when test="*">
+	<xsl:apply-templates 
+	    select="*|comment()|processing-instruction"/>  
+      </xsl:when>
+      <xsl:when test="string-length(.)&gt;0">
+	<p>
+	<xsl:apply-templates 
+	    select="text()|comment()|processing-instruction"/>  
+	</p>
+      </xsl:when>
+      <xsl:otherwise>
+	<xsl:apply-templates 
+	    select="comment()|processing-instruction"/>  
+      </xsl:otherwise>
+    </xsl:choose>
+  </figure>
+</xsl:template>
+
+<xsl:template name="cols">
+  <milestone unit="cols">
+    <xsl:apply-templates 
+	select="@*|*|text()|comment()|processing-instruction"/>  
+  </milestone>
+</xsl:template>
+
+   <xsl:template match="*">
+      <xsl:copy>
+         <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
+      </xsl:copy>
+   </xsl:template>
+   <xsl:template match="text()|comment()|@*|processing-instruction()">
+      <xsl:copy/>
+   </xsl:template>
+   <xsl:template match="b">
+      <xsl:call-template name="b"/>
+   </xsl:template>
+   <xsl:template match="i">
+      <xsl:call-template name="i"/>
+   </xsl:template>
+   <xsl:template match="ul">
+      <xsl:call-template name="ul"/>
+   </xsl:template>
+   <xsl:template match="sub">
+      <xsl:call-template name="sub"/>
+   </xsl:template>
+   <xsl:template match="sup">
+      <xsl:call-template name="sup"/>
+   </xsl:template>
+   <xsl:template match="smcap">
+      <xsl:call-template name="smcap"/>
+   </xsl:template>
+   <xsl:template match="cols">
+      <xsl:call-template name="cols"/>
+   </xsl:template>
+   <xsl:template match="ornament">
+      <xsl:call-template name="ornament"/>
+   </xsl:template>
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/tei/tite/tite-to-tei.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/txm-posttok-unbreakWords.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/txm-posttok-unbreakWords.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/txm-posttok-unbreakWords.xsl	(revision 258)
@@ -0,0 +1,93 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:edate="http://exslt.org/dates-and-times"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tei="http://www.tei-c.org/ns/1.0"
+  xmlns:txm="http://textometrie.org/ns/1.0"
+  exclude-result-prefixes="tei edate" xpath-default-namespace="http://www.tei-c.org/ns/1.0" version="2.0">
+
+  <!--
+This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+
+     
+This stylesheet re-unites word tokens separated by lb, cb and pb tags
+bearing @break="no" attribute. Can be used with TXM XTZ import module.
+
+All the tags must have a @break='no' and their number must not exceed 3
+in each case.
+
+Written by Alexei Lavrentiev, UMR 5317 IHRIM, 2017
+  -->
+
+
+  <xsl:output method="xml" encoding="utf-8" omit-xml-declaration="no"/> 
+  
+  
+  <!-- General patterns: all elements, attributes, comments and processing instructions are copied -->
+  
+  <xsl:template match="*">      
+        <xsl:copy>
+          <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
+        </xsl:copy>    
+  </xsl:template>
+  
+  <xsl:template match="*" mode="position"><xsl:value-of select="count(preceding-sibling::*)"/></xsl:template>
+
+  <xsl:template match="@*|comment()|processing-instruction()">
+    <xsl:copy/>
+  </xsl:template>
+
+<xsl:template match="*:w">
+  <xsl:choose>
+    <xsl:when test="following-sibling::*[1][@break='no']">
+      <xsl:copy>
+        <xsl:apply-templates select="@*"/>
+        <xsl:apply-templates/>
+        <xsl:copy-of select="following-sibling::*[position() lt 4][@break='no']"/>
+        <xsl:apply-templates select="following-sibling::w[1]/node()"/>
+      </xsl:copy>
+    </xsl:when>
+    <xsl:when test="preceding-sibling::*[1][@break='no']">
+      <!--Word ending agglutinated to the previous word-->
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:copy>
+        <xsl:apply-templates select="@*"/>
+        <xsl:apply-templates/>
+      </xsl:copy>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="*[@break='no']"/>
+
+
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/txm-posttok-unbreakWords.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/2-default-pager.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/2-default-pager.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/2-default-pager.xsl	(revision 258)
@@ -0,0 +1,239 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet exclude-result-prefixes="#all"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns:xs="http://www.w3.org/2001/XMLSchema"
+  version="2.0">
+  <!--
+This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+
+     $Id$
+     
+This stylesheet is based on TEI processpb.xsl by Sebastian Rahtz 
+available at 
+https://github.com/TEIC/Stylesheets/blob/master/tools/processpb.xsl 
+and is adapted by Alexei Lavrentiev to split an HTML edition for 
+TXM platform.
+
+  -->
+  <xsl:output indent="no" method="html"/>
+  
+  <xsl:param name="css-name-txm">txm</xsl:param>
+  <xsl:param name="css-name"><xsl:value-of select="$current-corpus-name"/></xsl:param>
+  <xsl:param name="edition-name">default</xsl:param>
+  <xsl:param name="number-words-per-page">999999</xsl:param>
+  <xsl:param name="pagination-element">a[@class='txm-page']</xsl:param>
+  <xsl:param name="output-directory"><xsl:value-of select="concat($current-file-directory,'/',$edition-name)"/></xsl:param>
+  
+  <xsl:variable name="current-file-name">
+    <xsl:analyze-string select="document-uri(.)" regex="^(.*)/([^/]+)\.[^/]+$">
+      <xsl:matching-substring>
+        <xsl:value-of select="regex-group(2)"/>
+      </xsl:matching-substring>
+    </xsl:analyze-string>
+  </xsl:variable>
+  
+  <xsl:variable name="current-file-directory">
+    <xsl:analyze-string select="document-uri(.)" regex="^(.*)/([^/]+)\.[^/]+$">
+      <xsl:matching-substring>
+        <xsl:value-of select="regex-group(1)"/>
+      </xsl:matching-substring>
+    </xsl:analyze-string>
+  </xsl:variable>
+  
+  <xsl:variable name="current-corpus-name">
+    <xsl:analyze-string select="$current-file-directory" regex="^(.*)/([^/]+)$">
+      <xsl:matching-substring>
+        <xsl:value-of select="regex-group(2)"/>
+      </xsl:matching-substring>
+    </xsl:analyze-string>
+  </xsl:variable>
+  
+  
+  <xsl:template match="html/body">
+    <xsl:variable name="pages">
+      <xsl:copy>
+        <xsl:apply-templates select="@*"/>
+        <xsl:apply-templates
+          select="*|processing-instruction()|comment()|text()"/>
+      </xsl:copy>
+    </xsl:variable>
+    <xsl:for-each select="$pages">
+      <xsl:apply-templates  mode="pass2"/>
+    </xsl:for-each>
+    <!-- creating title page with metadata -->
+  </xsl:template>
+  
+  
+  <!-- first (recursive) pass. look for <pb> elements and group on them -->
+  <xsl:template match="comment()|@*|processing-instruction()|text()">
+    <xsl:copy-of select="."/>
+  </xsl:template>
+  
+  <xsl:template match="*">
+    <xsl:call-template name="checkpb">
+      <xsl:with-param name="eName" select="local-name()"/>
+    </xsl:call-template>
+  </xsl:template>
+  
+  <xsl:template match="a[@class='txm-page']">
+    
+    <!--    <xsl:variable name="next-word-position" as="xs:integer">
+      <xsl:choose>
+        <xsl:when test="following::span[@class='w']">
+          <xsl:value-of select="count(following::span[@class='w'][1]/preceding::span[@class='w'])"/>
+        </xsl:when>
+        <xsl:otherwise>20</xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:variable name="next-pb-position" as="xs:integer">
+      <xsl:choose>
+        <xsl:when test="following::a[@class='txm-page']">
+          <xsl:value-of select="count(following::a[@class='txm-page'][1]/preceding::span[@class='w'])"/>
+        </xsl:when>
+        <xsl:otherwise>999999999</xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <!-\-<xsl:value-of select="count(following::a[@class='txm-page'][1]/preceding::a[@class='w'])"/>-\->
+    <xsl:variable name="next-word-id">
+      <xsl:choose>
+        <xsl:when test="$next-pb-position - $next-word-position = 999999999"><!-\-w_0-\-><xsl:value-of select="concat($next-pb-position,' - ',$next-word-position)"/></xsl:when>
+        <xsl:when test="$next-pb-position &gt; $next-word-position"><xsl:value-of select="following::*:span[@class='w'][1]/@id"/></xsl:when>
+        <xsl:otherwise><!-\- w_0 -\-><xsl:value-of select="concat($next-pb-position,' - ',$next-word-position)"/></xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>-->
+    
+    
+    <!--  <a xmlns="http://www.w3.org/1999/xhtml">  -->
+    
+    <a>
+      <xsl:copy-of select="@*"/>
+      <!--<xsl:attribute name="next-word-id"><xsl:value-of select="$next-word-id"/></xsl:attribute>-->
+    </a>
+  </xsl:template>
+  
+  <xsl:template name="checkpb">
+    <xsl:param name="eName"/>
+    <xsl:choose>
+      <xsl:when test="not(.//a[@class='txm-page'])">
+        <xsl:copy-of select="."/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:variable name="pass">
+          <xsl:call-template name="groupbypb">
+            <xsl:with-param name="Name" select="$eName"/>
+          </xsl:call-template>
+        </xsl:variable>
+        <xsl:for-each select="$pass">
+          <xsl:apply-templates/>
+        </xsl:for-each>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  
+  <xsl:template name="groupbypb">
+    <xsl:param name="Name"/>
+    <xsl:for-each-group select="node()" group-starting-with="a[@class='txm-page']">
+      <xsl:choose>
+        <xsl:when test="self::a[@class='txm-page']">
+          <xsl:copy-of select="."/>
+          <xsl:element name="{$Name}">
+            <xsl:attribute name="rend">CONTINUED</xsl:attribute>
+            <xsl:apply-templates select="current-group() except ."/>
+          </xsl:element>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:element name="{$Name}">
+            <xsl:for-each select="..">
+              <xsl:copy-of select="@*"/>
+              <xsl:apply-templates select="current-group()"/>
+            </xsl:for-each>
+          </xsl:element>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:for-each-group>
+  </xsl:template>
+  
+  <!-- second pass. group by <pb> (now all at top level) and wrap groups
+       in <page> -->
+  <xsl:template match="*" mode="pass2">
+    <xsl:copy>
+      <xsl:apply-templates select="@*|*|processing-instruction()|comment()|text()" mode="pass2"/>
+    </xsl:copy>
+  </xsl:template>
+  
+  <xsl:template match="comment()|@*|processing-instruction()|text()" mode="pass2">
+    <xsl:copy-of select="."/>
+  </xsl:template>
+  
+  
+  
+  <!--	<xsl:variable name="style">
+	  <xsl:copy-of select="/html/head[1]/style[1]"></xsl:copy-of>
+	</xsl:variable>-->
+  
+  <xsl:template match="*[a[@class='txm-page']]" mode="pass2" >    
+    
+    <xsl:copy>
+      <xsl:apply-templates select="@*"/>
+      <xsl:for-each-group select="*" group-starting-with="a[@class='txm-page']">
+        <xsl:choose>
+          <xsl:when test="self::a[@class='txm-page']">
+            <xsl:comment> Page <xsl:value-of select="@title"/> déplacée vers <xsl:value-of select="concat($output-directory,'/',$current-file-name,'_',@title,'.html')"/></xsl:comment>
+            <xsl:result-document href="{$output-directory}/{$current-file-name}_{@title}.html/">
+              <html>
+                <head>
+                  <meta name="txm:first-word-id" content="{@next-word-id}"/>
+                  <title><xsl:value-of select="concat($current-file-name,', Page ',@title)"/></title>
+                  <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
+                  <link rel="stylesheet" media="all" type="text/css" href="css/{$css-name-txm}.css"/>
+                  <xsl:if test="matches($css-name,'\S')"><link rel="stylesheet" media="all" type="text/css" href="css/{$css-name}.css"/></xsl:if>
+                  <!--<xsl:copy-of select="$style"/>-->
+                </head>
+                <body>
+                  <div class="txmeditionpage">
+                    <xsl:copy-of select="current-group() except ."/>
+                  </div>
+                </body>
+              </html>
+            </xsl:result-document>
+            
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:copy-of select="current-group()"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:for-each-group>
+    </xsl:copy>
+  </xsl:template>
+  
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/2-default-pager.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/ts2xmlw.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/ts2xmlw.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/ts2xmlw.xsl	(revision 258)
@@ -0,0 +1,84 @@
+<?xml version="1.0"?>
+<xsl:stylesheet version="1.0"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:tei="http://www.tei-c.org/ns/1.0"
+                xmlns:xd="http://www.pnp-software.com/XSLTdoc"
+                xmlns:edate="http://exslt.org/dates-and-times"
+                exclude-result-prefixes="edate xd">
+
+  <xd:doc type="stylesheet">
+
+    <xd:short>
+      Feuille de transformation du format TIGER-XML vers le format XML-TXM
+    </xd:short>
+
+    <xd:detail>
+      This stylesheet is free software; you can redistribute it and/or
+      modify it under the terms of the GNU Lesser General Public
+      License as published by the Free Software Foundation; either
+      version 3 of the License, or (at your option) any later version.
+      
+      This stylesheet 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
+      Lesser General Public License for more details.
+      
+      You should have received a copy of GNU Lesser Public License with
+      this stylesheet. If not, see http://www.gnu.org/licenses/lgpl.html
+    </xd:detail>
+
+    <xd:author>Matthieu Decorde, matthieu.decorde AT ens-lyon.fr</xd:author>
+    <xd:author>Serge Heiden, slh AT ens-lyon.fr</xd:author>
+    <xd:author>Alexey Lavrentev, alexei.lavrentev AT ens-lyon.fr></xd:author>
+
+    <xd:copyright>2016, ENS de Lyon/CNRS (UMR IHRIM Cactus)</xd:copyright>
+
+  </xd:doc>
+  
+  <xsl:output 
+   method="xml"
+   encoding="UTF-8"
+   indent="yes" />
+
+  <xsl:template match="corpus">
+    <corpus>
+    	<xsl:choose>
+    		<xsl:when test="subcorpus">
+    			<xsl:apply-templates select="subcorpus"/>
+    		</xsl:when>
+    		<xsl:otherwise>
+    			<text>
+    				<xsl:apply-templates select="s"/>
+    			</text>			
+    		</xsl:otherwise>
+    	</xsl:choose>
+    	<xsl:apply-templates/>
+    </corpus>
+  </xsl:template>
+  
+  <xsl:template match="subcorpus">
+    <text>
+	<xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute>
+	<xsl:apply-templates select="s"/>
+    </text>
+  </xsl:template>
+  
+  <xsl:template match="s">
+	<p>
+	  <s>
+	    <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
+	      <xsl:apply-templates select="graph/terminals/t" />
+	  </s>
+	</p>
+  </xsl:template>
+
+  <xsl:template match="t">
+		<w>
+			<xsl:for-each select="@*[not(name()='word')]">
+				<xsl:copy/>
+			</xsl:for-each>
+	        <xsl:value-of select="@word"/>
+		</w>
+  </xsl:template>
+
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/ts2xmlw.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/txm-edition-xmltxm-textgrid.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/txm-edition-xmltxm-textgrid.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/txm-edition-xmltxm-textgrid.xsl	(revision 258)
@@ -0,0 +1,290 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:edate="http://exslt.org/dates-and-times"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tei="http://www.tei-c.org/ns/1.0" xmlns:txm="http://textometrie.org/1.0"
+                exclude-result-prefixes="#all" version="2.0">
+                
+	<xsl:output method="xml" encoding="UTF-8" omit-xml-declaration="no" indent="no"  doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
+                
+                <xsl:strip-space elements="*"/>
+                
+                <xsl:template match="/">
+                	<html>
+                		<head>
+                			<title><xsl:value-of select="//tei:text[1]/@id"/></title>
+                			<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
+                			<link rel="stylesheet" media="all" type="text/css" href="css/txm-textgrid.css" />
+                			<style type="text/css">
+                				.verseline:before {
+                				position:absolute;
+                				left:-50px;
+                				top:-14px;
+                				width:25px;
+                				text-align:right;
+                				color:gray;
+                				content:attr(title);
+                				}
+                				.editionpage {
+                				page-break-before:always;                                
+                				color:gray;
+                				display:block;
+                				text-align:center;
+                				}
+                				.editionpageverse {
+                				position:relative;
+                				left:-5%;
+                				page-break-before:always;                                
+                				color:gray;
+                				display:block;
+                				text-align:center;
+                				}
+                				.noteinline {
+                				color:gray;                                
+                				}
+                				.head {
+                				color:indigo;
+                				font-weight:bold;
+                				}
+                				.speaker {
+                				color:darkblue;
+                				}
+                			</style>
+<!--                			<title>
+                				<xsl:if test="$author[not(contains(.,'anonym'))]">
+                					<xsl:value-of select="$author"/><xsl:text> : </xsl:text>
+                				</xsl:if>
+                				<xsl:value-of select="$title-normal"/>
+                			</title>                                                                -->
+                		</head>
+                			<xsl:apply-templates select="descendant::tei:text"/>
+                	</html>
+                </xsl:template>
+
+<xsl:template match="tei:text">
+	<body>
+		<a class="txm-page" title="1">&#xa0;</a>
+		<div class="metadata-page">
+			<h1><xsl:value-of select="@id"></xsl:value-of></h1>
+			<br/>
+			<table>
+				<xsl:for-each select="@*">
+					<tr>
+						<td><xsl:value-of select="name()"/></td>
+						<td><xsl:value-of select="."/></td>
+					</tr>
+				</xsl:for-each>
+			</table>
+		</div>
+		<xsl:apply-templates/>		
+	</body>
+</xsl:template>
+
+                <xsl:template match="*">
+                                <xsl:choose>
+                                	<xsl:when test="descendant::tei:p|descendant::tei:ab|descendant::tei:lg">
+                                		<div>
+                                			<xsl:call-template name="addClass"/>
+                                			<xsl:call-template name="checkId"/>
+                                			<xsl:apply-templates/></div>
+                                		<xsl:text>&#xa;</xsl:text>
+                                	</xsl:when>
+                                	<xsl:otherwise><span>
+                                		<xsl:call-template name="addClass"/>
+                                		<xsl:call-template name="checkId"/>
+<!--                                		<xsl:if test="self::tei:add[@del]">
+                                			<xsl:attribute name="title"><xsl:value-of select="@del"/></xsl:attribute>
+                                		</xsl:if>-->
+                                		<xsl:apply-templates/></span>
+                                	<xsl:call-template name="spacing-xmltxm"/>
+                                	</xsl:otherwise>
+                                </xsl:choose>
+                </xsl:template>
+                
+                <xsl:template match="@*|processing-instruction()|comment()">
+                                <!--<xsl:copy/>-->
+                </xsl:template>
+                
+<!--                <xsl:template match="comment()">
+                                <xsl:copy/>
+                </xsl:template>
+-->                
+                <xsl:template match="text()">
+                                <xsl:value-of select="."/>
+                </xsl:template>
+                
+                <xsl:template name="addClass">
+                	<xsl:attribute name="class">
+                		<xsl:value-of select="local-name(.)"/>
+                		<xsl:if test="@type"><xsl:value-of select="concat('-',@type)"/></xsl:if>
+                		<xsl:if test="@subtype"><xsl:value-of select="concat('-',@subtype)"/></xsl:if>
+                		<!--<xsl:if test="@rend"><xsl:value-of select="concat('-',@rend)"/></xsl:if>-->
+                	</xsl:attribute>                	
+                </xsl:template>
+                
+                <xsl:template name="checkId">
+                	<xsl:if test="@xml:id">
+                		<xsl:attribute name="id"><xsl:value-of select="@xml:id"/></xsl:attribute>
+                	</xsl:if>
+                	
+                </xsl:template>
+                <xsl:template match="tei:p|tei:ab|tei:lg">
+                	<p>
+                		<xsl:call-template name="addClass"/>
+                		<xsl:call-template name="checkId"/>
+                		<xsl:apply-templates/>
+                	</p>
+                	<xsl:text>&#xa;</xsl:text>
+                </xsl:template>
+	
+	<xsl:template match="tei:l">
+		<xsl:if test="preceding-sibling::*">
+			<br/>
+		</xsl:if>
+		<span class="l"><xsl:apply-templates/></span>
+	</xsl:template>
+	
+	<xsl:template match="tei:head">
+		<xsl:variable name="level">
+			<xsl:value-of select="count(ancestor::tei:div) + 1"/>
+		</xsl:variable>
+		<xsl:element name="h{$level}">
+			<xsl:call-template name="addClass"/>
+			<xsl:call-template name="checkId"/>
+			<xsl:apply-templates/>			
+		</xsl:element>
+<!--		<h2>
+			<xsl:call-template name="addClass"/>
+			<xsl:apply-templates/>
+		</h2>-->
+	</xsl:template>
+                
+	<xsl:template match="//tei:lb">
+		<xsl:variable name="lbcount">
+			<xsl:choose>
+				<xsl:when test="ancestor::tei:ab"><xsl:number from="tei:ab" level="any"/></xsl:when>
+				<xsl:when test="ancestor::tei:p"><xsl:number from="tei:p" level="any"/></xsl:when>
+				<xsl:otherwise>999</xsl:otherwise>
+			</xsl:choose>
+		</xsl:variable>
+		<xsl:if test="not($lbcount=1) or preceding-sibling::node()[matches(.,'\S')]"><br/><xsl:text>&#xa;</xsl:text></xsl:if>
+		<xsl:if test="@n and not(@rend='prose')">
+			<xsl:choose>
+				<xsl:when test="matches(@n,'^[0-9]*[05]$')">
+					<a title="{@n}" class="verseline" style="position:relative">&#xa0;</a>
+				</xsl:when>
+				<xsl:when test="matches(@n,'[^0-9]')">
+					<a title="{@n}" class="verseline" style="position:relative">&#xa0;</a>
+				</xsl:when>
+				<xsl:otherwise>
+				</xsl:otherwise>
+			</xsl:choose>
+		</xsl:if>
+	</xsl:template>
+	
+	<!-- Page breaks -->                
+	<xsl:template match="//tei:pb[not(following-sibling::tei:cb)]">
+		<xsl:variable name="editionpagetype">
+			<xsl:choose>
+				<xsl:when test="ancestor::tei:ab">editionpageverse</xsl:when>
+				<xsl:otherwise>editionpage</xsl:otherwise>
+			</xsl:choose>
+		</xsl:variable>
+		<xsl:variable name="pagenumber">
+			<xsl:choose>
+				<xsl:when test="@n"><xsl:value-of select="@n"/></xsl:when>
+				<xsl:when test="@facs"><xsl:value-of select="substring-before(@facs,'.')"/></xsl:when>
+				<xsl:otherwise>[NN]</xsl:otherwise>
+			</xsl:choose>
+		</xsl:variable>
+		<xsl:variable name="page_id"><xsl:value-of select="count(preceding::tei:pb)"/></xsl:variable>
+		<xsl:if test="//tei:ref[@type='noteAnchor'][following::tei:pb[1][count(preceding::tei:pb) = $page_id]]">
+			<xsl:text>&#xa;</xsl:text>
+			<br/>
+			<br/>			
+			<span style="display:block;border-top-style:solid;border-top-width:1px;border-top-color:gray;padding-top:5px">                                                
+				<xsl:for-each select="//tei:ref[@type='noteAnchor'][following::tei:pb[1][count(preceding::tei:pb) = $page_id]]">
+					<span class="footnote">
+						<xsl:apply-templates mode="#current" select="id(substring-after(@target,'#'))"/>
+					</span>                                                                
+				</xsl:for-each></span><xsl:text>&#xa;</xsl:text>                                                                
+			
+			
+		</xsl:if>
+	<!--	<xsl:if test="//tei:note[not(@place='inline') and not(matches(@type,'intern|auto'))][following::tei:pb[1][count(preceding::tei:pb) = $page_id]]">
+			<xsl:text>&#xa;</xsl:text>
+			<br/>
+			<br/>			
+			<span style="display:block;border-top-style:solid;border-top-width:1px;border-top-color:gray;padding-top:5px">                                                
+				<xsl:for-each select="//tei:note[not(@place='inline') and not(matches(@type,'intern|auto'))][following::tei:pb[1][count(preceding::tei:pb) = $page_id]]">
+					<xsl:variable name="note_count"><xsl:value-of select="count(preceding::tei:note[not(@place='inline')]) + 1"/></xsl:variable>
+					<!-\-<p><xsl:value-of select="$note_count"/>. <a href="#noteref_{$note_count}" name="note_{$note_count}">[<xsl:value-of select="preceding::tei:cb[1]/@xml:id"/>, l. <xsl:value-of select="preceding::tei:lb[1]/@n"/>]</a><xsl:text> </xsl:text> <xsl:value-of select="."/></p>-\->
+					<span class="note">
+						<span style="position:absolute;left:-30px"><a href="#noteref_{$note_count}" name="note_{$note_count}"><xsl:value-of select="$note_count"/></a>. </span>
+						<xsl:apply-templates mode="#current"/>
+					</span>                                                                
+				</xsl:for-each></span><xsl:text>&#xa;</xsl:text>                                                                
+			
+		</xsl:if>-->                                
+		
+		<xsl:text>&#xa;</xsl:text>
+		<br/><xsl:text>&#xa;</xsl:text>
+		<a class="txm-page" title="{count(preceding::tei:pb) + 2}">&#xa0;</a>
+		<span class="{$editionpagetype}"> - <xsl:value-of select="$pagenumber"/> - </span><br/><xsl:text>&#xa;</xsl:text>
+	</xsl:template>
+	
+	<!-- Notes -->
+	<xsl:template match="tei:ref[@type='noteAnchor']">
+		<a title="{id(substring-after(@target,'#'))//txm:form}" style="font-size:75%;position:relative;top:-5px" href="{@target}"><xsl:value-of select="descendant::txm:form"/></a>
+		<xsl:call-template name="spacing-xmltxm"/>                                
+	</xsl:template>
+	
+                
+                <xsl:template match="//tei:w"><span class="w">
+                                                <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
+                                	<xsl:attribute name="title">
+                                		<xsl:if test="ancestor::tei:corr">
+                                			<xsl:value-of select="concat(' sic : ',descendant::txm:ana[@type='#sic'])"/>
+                                		</xsl:if>
+                                		<xsl:if test="ancestor::tei:reg">
+                                			<xsl:value-of select="concat(' orig : ',descendant::txm:ana[@type='#orig'])"/>
+                                		</xsl:if>
+                                		<xsl:if test="descendant::txm:ana[matches(@type,'pos$')]">
+                                			<xsl:for-each select="descendant::txm:ana[matches(@type,'pos$')]">
+                                				<xsl:value-of select="concat(' ',substring-after(@type,'#'),' : ',.)"/>
+                                			</xsl:for-each>
+                                		</xsl:if>                                		
+                                	</xsl:attribute>
+                                                <!--<xsl:copy-of select="@*"/>-->
+                                                <xsl:apply-templates select="txm:form"/>
+                                </span><xsl:call-template name="spacing-xmltxm"></xsl:call-template></xsl:template>
+                
+                <xsl:template match="//txm:form">
+                                <xsl:apply-templates/>
+                </xsl:template>
+                
+                
+                <xsl:template match="tei:sp[not(descendant::tei:speaker)]">
+                	<div class="sp">
+                		<span class="speaker"><xsl:value-of select="@who"></xsl:value-of></span>
+                		<xsl:apply-templates/>
+                	</div>
+                </xsl:template>
+	
+	
+	<xsl:template name="spacing-xmltxm">
+		<xsl:choose>
+			<xsl:when test="ancestor::tei:w"/>
+			<xsl:when test="following::tei:w[1][matches(descendant::txm:form,'^[.,)\]]+$')]"/>			
+			<xsl:when test="matches(descendant::txm:form[1],'^[(\[]+$|\w(''|’)$')"></xsl:when>
+			<xsl:when test="position()=last() and (ancestor::tei:choice or ancestor::tei:supplied[not(@rend='multi_s')])"></xsl:when>
+			<xsl:when test="following-sibling::*[1][self::tei:note]"></xsl:when>
+			<xsl:when test="following::tei:w[1][matches(descendant::txm:form,'^[:;!?]+$')]">
+				<xsl:text>&#xa0;</xsl:text>
+			</xsl:when>
+			<xsl:otherwise>
+				<xsl:text> </xsl:text>
+			</xsl:otherwise>
+		</xsl:choose>                
+	</xsl:template>
+	
+                
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/txm-edition-xmltxm-textgrid.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/txm-front-teiHeader2textAtt.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/txm-front-teiHeader2textAtt.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/txm-front-teiHeader2textAtt.xsl	(revision 258)
@@ -0,0 +1,155 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:edate="http://exslt.org/dates-and-times"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tei="http://www.tei-c.org/ns/1.0"
+  exclude-result-prefixes="tei edate" xpath-default-namespace="http://www.tei-c.org/ns/1.0" version="2.0">
+
+  <!--
+This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+
+     
+This stylesheet extracts metadata from the teiHeader and adds them as attributes
+of the text element. Can be used with TXM XTZ and XML/W import modules.
+
+Written by Alexei Lavrentiev, UMR 5317 IHRIM, 2017
+  -->
+
+
+  <xsl:output method="xml" encoding="utf-8" omit-xml-declaration="no"/> 
+  
+  
+<!-- General patterns: all elements, attributes, comments and processing instructions are copied -->
+  
+  <xsl:template match="*">      
+        <xsl:copy>
+          <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
+        </xsl:copy>    
+  </xsl:template>
+  
+  <xsl:template match="*" mode="position"><xsl:value-of select="count(preceding-sibling::*)"/></xsl:template>
+
+  <xsl:template match="@*|comment()|processing-instruction()">
+    <xsl:copy/>
+  </xsl:template>
+
+  <xsl:variable name="current-file-name">
+    <xsl:analyze-string select="document-uri(.)" regex="^(.*)/([^/]+)\.[^/]+$">
+      <xsl:matching-substring>
+        <xsl:value-of select="regex-group(2)"/>
+      </xsl:matching-substring>
+    </xsl:analyze-string>
+  </xsl:variable>
+  
+<!-- Extracting metadata to use -->
+ 
+  <xsl:variable name="title">
+    <xsl:choose>
+      <xsl:when test="/TEI/teiHeader/fileDesc/titleStmt/title[@type='main']">
+        <xsl:value-of select="/TEI/teiHeader/fileDesc/titleStmt/title[@type='main'][1]"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="/TEI/teiHeader/fileDesc/titleStmt/title[1]"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+  
+  <xsl:variable name="author">
+    <xsl:choose>
+      <xsl:when test="/TEI/teiHeader/fileDesc/titleStmt/author">
+        <xsl:for-each select="/TEI/teiHeader/fileDesc/titleStmt/author">
+          <xsl:value-of select="."/>
+          <xsl:if test="following-sibling::author">
+            <xsl:text>, </xsl:text>
+          </xsl:if>
+        </xsl:for-each>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:text>anonyme</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+  
+  <xsl:variable name="text_creation_date">
+    <xsl:choose>
+      <xsl:when test="/TEI/teiHeader/profileDesc/creation/date[@type='compo']">
+        <xsl:choose>
+          <xsl:when test="/TEI/teiHeader/profileDesc/creation/date[@type='compo'][1]/@when">
+            <xsl:value-of select="/TEI/teiHeader/profileDesc/creation/date[@type='compo'][1]/@when"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:value-of select="/TEI/teiHeader/profileDesc/creation/date[@type='compo'][1]"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+      <xsl:when test="/TEI/teiHeader/profileDesc/creation/date">
+        <xsl:choose>
+          <xsl:when test="/TEI/teiHeader/profileDesc/creation/date[1]/@when">
+            <xsl:value-of select="/TEI/teiHeader/profileDesc/creation/date[1]/@when"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:value-of select="/TEI/teiHeader/profileDesc/creation/date[1]"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:text>sans date</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+  
+  <xsl:variable name="genre">
+    <xsl:choose>
+      <xsl:when test="/TEI/teiHeader//keywords/term[@type='genre']">
+        <xsl:value-of select="/TEI/teiHeader//keywords[1]/term[@type='genre'][1]"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:text>inconnu</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+<!-- Injecting metadata into attibutes of the text element -->
+
+<xsl:template match="text">
+  <xsl:copy>
+    <xsl:apply-templates select="@*"/>
+    <xsl:attribute name="id"><xsl:value-of select="$current-file-name"/></xsl:attribute>
+    <xsl:attribute name="titre"><xsl:value-of select="$title"/></xsl:attribute>
+    <xsl:attribute name="auteur"><xsl:value-of select="$author"/></xsl:attribute>
+    <xsl:attribute name="date-compo"><xsl:value-of select="$text_creation_date"/></xsl:attribute>
+    <xsl:attribute name="genre"><xsl:value-of select="$genre"/></xsl:attribute>
+    <xsl:apply-templates/>
+  </xsl:copy>
+</xsl:template>
+
+
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/txm-front-teiHeader2textAtt.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/filter-out-p.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/filter-out-p.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/filter-out-p.xsl	(revision 258)
@@ -0,0 +1,46 @@
+<?xml version="1.0"?>
+<xsl:stylesheet
+  xmlns:xd="http://www.pnp-software.com/XSLTdoc"
+  xmlns:edate="http://exslt.org/dates-and-times"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tei="http://www.tei-c.org/ns/1.0"
+  exclude-result-prefixes="tei edate xd" version="2.0">
+ 
+  <xd:doc type="stylesheet">
+    <xd:short>
+      Feuille de style de suppression de certains éléments XML à utiliser comme
+      prétraitement de l'import XML/w+CSV. 
+    </xd:short>
+    <xd:detail>
+      This stylesheet is free software; you can redistribute it and/or
+      modify it under the terms of the GNU Lesser General Public
+      License as published by the Free Software Foundation; either
+      version 3 of the License, or (at your option) any later version.
+      
+      This stylesheet 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
+      Lesser General Public License for more details.
+      
+      You should have received a copy of GNU Lesser Public License with
+      this stylesheet. If not, see http://www.gnu.org/licenses/lgpl.html
+    </xd:detail>
+    <xd:author>Serge Heiden slh@ens-lyon.fr</xd:author>
+    <xd:copyright>2013, CNRS / ICAR (ICAR3 LinCoBaTO)</xd:copyright>
+  </xd:doc>
+  
+
+  <xsl:output method="xml" encoding="utf-8" omit-xml-declaration="yes"/>
+
+  <xsl:template match="@*|node()">
+    <xsl:copy>
+      <xsl:apply-templates select="@*|node()" />
+    </xsl:copy>
+  </xsl:template>
+  
+<!-- On supprime tous les <p> dont l'attribut @type vaut 'ouverture' -->
+  
+  <xsl:template match="//p[@type='ouverture']">    
+      <!--<xsl:copy-of select="."/>-->    
+  </xsl:template>
+	
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/filter-out-p.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/identity.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/identity.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/identity.xsl	(revision 258)
@@ -0,0 +1,11 @@
+<!-- The Identity Transformation -->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+  <!-- Whenever you match any node or any attribute -->
+  <xsl:template match="node()|@*">
+    <!-- Copy the current node -->
+    <xsl:copy>
+      <!-- Including any attributes it has and any child nodes -->
+      <xsl:apply-templates select="@*|node()"/>
+    </xsl:copy>
+  </xsl:template>
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/identity.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/txm-posttok-addRef.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/txm-posttok-addRef.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/txm-posttok-addRef.xsl	(revision 258)
@@ -0,0 +1,91 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:edate="http://exslt.org/dates-and-times"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tei="http://www.tei-c.org/ns/1.0"
+  xmlns:txm="http://textometrie.org/ns/1.0"
+  exclude-result-prefixes="tei edate" xpath-default-namespace="http://www.tei-c.org/ns/1.0" version="2.0">
+
+  <!--
+This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+
+     
+This stylesheet adds a ref attribute to w elements that will be used for
+references in TXM concordances. Can be used with TXM XTZ import module.
+
+Written by Alexei Lavrentiev, UMR 5317 IHRIM, 2017
+  -->
+
+
+  <xsl:output method="xml" encoding="utf-8" omit-xml-declaration="no"/> 
+  
+  
+  <!-- General patterns: all elements, attributes, comments and processing instructions are copied -->
+  
+  <xsl:template match="*">      
+        <xsl:copy>
+          <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
+        </xsl:copy>    
+  </xsl:template>
+  
+  <xsl:template match="*" mode="position"><xsl:value-of select="count(preceding-sibling::*)"/></xsl:template>
+
+  <xsl:template match="@*|comment()|processing-instruction()">
+    <xsl:copy/>
+  </xsl:template>
+  
+  <xsl:template match="*:w">
+    <xsl:variable name="ref">
+      <xsl:if test="ancestor::*:text/@*:id"></xsl:if>
+      <xsl:value-of select="ancestor::*:text[1]/@*:id[1]"/>
+      <xsl:if test="ancestor::*:text/@*:id and preceding::*:pb[1]/@n">
+        <xsl:text>, </xsl:text>
+      </xsl:if>
+      <xsl:if test="preceding::*:pb[1]/@n">
+        <xsl:text>p. </xsl:text>
+        <xsl:value-of select="preceding::*:pb[1]/@n"/>
+      </xsl:if>
+      <xsl:if test="(ancestor::*:text/@*:id or preceding::*:pb[1]/@n) and preceding::*:lb[1]/@n">
+        <xsl:text>, </xsl:text>
+      </xsl:if>
+      <xsl:if test="preceding::*:lb[1]/@n">
+        <xsl:text>l. </xsl:text>
+        <xsl:value-of select="preceding::*:lb[1]/@n"/>
+      </xsl:if>
+    </xsl:variable>
+        <xsl:copy>
+          <xsl:apply-templates select="@*"/>
+          <xsl:attribute name="ref"><xsl:value-of select="$ref"/></xsl:attribute>
+          <xsl:apply-templates select="*|processing-instruction()|comment()|text()"/>
+        </xsl:copy>
+  </xsl:template>  
+
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/txm-posttok-addRef.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-corpusakkadien-xmlw_mots_effaces.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-corpusakkadien-xmlw_mots_effaces.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-corpusakkadien-xmlw_mots_effaces.xsl	(revision 258)
@@ -0,0 +1,93 @@
+<?xml version="1.0"?>
+<xsl:stylesheet
+  xmlns:xd="http://www.pnp-software.com/XSLTdoc"
+  xmlns:edate="http://exslt.org/dates-and-times"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tei="http://www.tei-c.org/ns/1.0"
+  exclude-result-prefixes="tei edate xd" version="2.0">
+  
+  <xd:doc type="stylesheet">
+    <xd:short>
+      Cette feuille de style permet de préparer les transcriptions de tablettes
+      d'argile (projet UMR PROCLAC) à l'import XML/W + CSV de TXM en créant les
+      propriétés de mots "no-unclear" et "non-supplied" pour éliminer les formes
+      non présentes ou peu lisibles dans les sources.
+    </xd:short>
+    <xd:detail>
+      This stylesheet is free software; you can redistribute it and/or
+      modify it under the terms of the GNU Lesser General Public
+      License as published by the Free Software Foundation; either
+      version 3 of the License, or (at your option) any later version.
+      
+      This stylesheet 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
+      Lesser General Public License for more details.
+      
+      You should have received a copy of GNU Lesser Public License with
+      this stylesheet. If not, see http://www.gnu.org/licenses/lgpl.html
+    </xd:detail>
+    <xd:author>Alexei Lavrentiev, alexei.lavrentev@ens-lyon.fr</xd:author>
+    <xd:copyright>2014-2015, CNRS / ICAR (équipe CACTUS)</xd:copyright>
+  </xd:doc>
+  
+
+  <xsl:output method="xml" encoding="utf-8" omit-xml-declaration="yes"/>
+
+  <xsl:template match="@*|*">
+    <xsl:copy>
+      <xsl:apply-templates select="@*|node()" />
+    </xsl:copy>
+  </xsl:template>
+  
+  <xsl:template match="@*|*" mode="nosupplied">
+    <xsl:copy>
+      <xsl:apply-templates select="@*|node()" />
+    </xsl:copy>
+  </xsl:template>
+  
+  <xsl:template match="@*|*" mode="nounclear">
+    <xsl:copy>
+      <xsl:apply-templates select="@*|node()" />
+    </xsl:copy>
+  </xsl:template>
+  
+  <xsl:template match="*[local-name()='teiHeader']"/>
+  
+  <xsl:template match="text()" mode="#all">
+    <xsl:choose>
+      <xsl:when test="ancestor::*[local-name()='w']">
+        <xsl:value-of select="."/>
+      </xsl:when>
+      <xsl:otherwise/>
+    </xsl:choose>
+  </xsl:template>
+  
+  <!-- On supprime les mots qui sont illisibles dans la source et on ajoute une propriété lexicale
+  qui correspond à la lisibilité -->
+  
+  <xsl:template match="//*[local-name()='w']">
+        <xsl:copy>
+          <xsl:apply-templates select="@*"/>
+          <xsl:attribute name="no-supplied">
+            <xsl:choose>
+              <xsl:when test="ancestor::*[local-name()='supplied']">¤</xsl:when>
+              <xsl:otherwise><xsl:apply-templates mode="nosupplied"/></xsl:otherwise>
+            </xsl:choose>
+          </xsl:attribute>
+          <xsl:attribute name="no-unclear">
+            <xsl:choose>
+              <xsl:when test="ancestor::*[local-name()='supplied'] or ancestor::*[local-name()='unclear']">¤</xsl:when>
+              <xsl:otherwise><xsl:apply-templates mode="nounclear"/></xsl:otherwise>
+            </xsl:choose>
+          </xsl:attribute>
+          <xsl:apply-templates/>
+        </xsl:copy>
+  </xsl:template>
+  
+  <xsl:template match="*[local-name()='supplied']" mode="nosupplied"/>
+  
+  <xsl:template match="*[local-name()='supplied']" mode="nounclear"/>
+  
+  <xsl:template match="*[local-name()='unclear']" mode="nounclear"/>
+	
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-corpusakkadien-xmlw_mots_effaces.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-rnc-xmlw.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-rnc-xmlw.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-rnc-xmlw.xsl	(revision 258)
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:edate="http://exslt.org/dates-and-times"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tei="http://www.tei-c.org/ns/1.0"
+  exclude-result-prefixes="tei edate" version="2.0">
+
+  <xsl:output method="xml" encoding="utf-8" omit-xml-declaration="no"/>
+
+  <xsl:template match="*">
+
+         <xsl:element name="{local-name(.)}">
+          <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
+        </xsl:element>
+
+  </xsl:template>
+
+  <xsl:template match="@*|processing-instruction()|comment()">
+    <xsl:copy/>
+  </xsl:template>
+
+<xsl:template match="head"/>
+  
+<xsl:template match="w">
+  <xsl:element name="w">
+    <xsl:attribute name="lex"><xsl:value-of select="child::ana/@lex"/></xsl:attribute>
+    <xsl:attribute name="gr"><xsl:value-of select="child::ana/@gr"/></xsl:attribute>
+    <xsl:attribute name="withstress"><xsl:value-of select="normalize-space(child::text())"/></xsl:attribute>
+    <xsl:value-of select="replace(child::text(),'`','')"/>
+  </xsl:element>
+</xsl:template>
+
+  <xsl:template match="text()">
+    <xsl:value-of select="."/>
+  </xsl:template>
+
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-rnc-xmlw.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/filter-keep-only-select.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/filter-keep-only-select.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/filter-keep-only-select.xsl	(revision 258)
@@ -0,0 +1,82 @@
+<?xml version="1.0"?>
+<xsl:stylesheet
+  xmlns:xd="http://www.pnp-software.com/XSLTdoc"
+  xmlns:edate="http://exslt.org/dates-and-times"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tei="http://www.tei-c.org/ns/1.0"
+  exclude-result-prefixes="tei edate xd" version="2.0">
+ 
+  <xd:doc type="stylesheet">
+    <xd:short>
+      Feuille de style de suppression de tous les éléments XML sauf "select",
+      à utiliser comme prétraitement de l'import XML/w+CSV.
+      
+      Pour changer le nom de la balise à conserver, mettez le nouveau nom
+      à la place de "select" dans la balise <xsl:param/> ci-dessous. Vous pouvez 
+      mettre plusieurs noms en les séparant par une barre verticale. Vous 
+      pouvez également indiquer le(s) nom(s) de balises à conserver comme un 
+      paramètre au lancement de cette feuille de style
+      
+      L'espace de nommage de la balise à conserver n'est pas pris en compte.
+    </xd:short>
+    <xd:detail>
+      This stylesheet is free software; you can redistribute it and/or
+      modify it under the terms of the GNU Lesser General Public
+      License as published by the Free Software Foundation; either
+      version 3 of the License, or (at your option) any later version.
+      
+      This stylesheet 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
+      Lesser General Public License for more details.
+      
+      You should have received a copy of GNU Lesser Public License with
+      this stylesheet. If not, see http://www.gnu.org/licenses/lgpl.html
+    </xd:detail>
+    <xd:author>Alexei Lavrentiev alexei.lavrentev@ens-lyon.fr</xd:author>
+    <xd:copyright>2013, CNRS / ICAR (ICAR3 LinCoBaTO)</xd:copyright>
+  </xd:doc>
+  
+
+  <xsl:output method="xml" encoding="utf-8" omit-xml-declaration="no"/>
+	
+	<!-- Mettez le nom de la balise à conserver à la place de "select" ci-dessous -->
+	<xsl:param name="tagToKeep">select</xsl:param>
+
+	<xsl:variable name="tagToKeepStrict"><xsl:value-of select="concat('^',$tagToKeep,'$')"/></xsl:variable>
+
+  <xsl:template match="@*|node()">
+    <xsl:copy>
+      <xsl:apply-templates select="@*|node()" />
+    </xsl:copy>
+  </xsl:template>
+
+
+<xsl:template match="/">
+  <xsl:apply-templates select="processing-instruction()"/>
+  <xsl:choose>
+    <xsl:when test="descendant::*[matches(local-name(),$tagToKeepStrict)]">
+      <xsl:apply-templates mode="with-select"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:apply-templates/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+  <xsl:template match="*" mode="with-select">
+    <xsl:choose>
+    	<xsl:when test="ancestor-or-self::*[matches(local-name(),$tagToKeepStrict)]">
+        <xsl:copy>
+          <xsl:apply-templates select="@*|node()"/>
+        </xsl:copy>      
+      </xsl:when>
+    	<xsl:when test="descendant::*[matches(local-name(),$tagToKeepStrict)]">
+        <xsl:copy>
+          <xsl:apply-templates select="@*"/>
+        	<xsl:apply-templates select="*[descendant-or-self::*[matches(local-name(),$tagToKeepStrict)]]" mode="with-select"/>
+        </xsl:copy>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:template>  
+  
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/filter-keep-only-select.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-qgraal_cm-xmlw.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-qgraal_cm-xmlw.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-qgraal_cm-xmlw.xsl	(revision 258)
@@ -0,0 +1,175 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:edate="http://exslt.org/dates-and-times"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tei="http://www.tei-c.org/ns/1.0"
+  xmlns:me="http://www.menota.org/ns/1.0"
+  xmlns:bfm="http://bfm.ens-lsh.fr/ns/1.0"
+  exclude-result-prefixes="tei edate bfm me" version="1.0">
+
+  <xsl:output method="xml" encoding="utf-8" omit-xml-declaration="no"/>
+  
+  <xsl:strip-space elements="me:norm tei:w"/>
+
+<!-- Original version -->
+<!--  <xsl:template match="*">
+    <xsl:choose>
+      <xsl:when test="namespace-uri()=''">
+        <xsl:element namespace="http://www.tei-c.org/ns/1.0" name="{local-name(.)}">
+          <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
+        </xsl:element>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:copy>
+          <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
+        </xsl:copy>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  -->
+  <!-- Eliminating all namespaces and comments -->
+  <xsl:template match="*">
+        <xsl:element namespace="http://www.tei-c.org/ns/1.0" name="{local-name(.)}">
+          <xsl:apply-templates select="*|@*|processing-instruction()|text()"/>
+        </xsl:element>
+  </xsl:template>
+  
+  
+  <xsl:template match="@*|processing-instruction()">
+    <xsl:copy/>
+  </xsl:template>
+
+<xsl:template match="processing-instruction('oxygen')"/>
+
+  <xsl:template match="text()">
+    <xsl:value-of select="."/>
+  </xsl:template>
+
+  <xsl:template match="//tei:TEI">
+    <xsl:element name="TEI" namespace="http://www.tei-c.org/ns/1.0">
+      <xsl:apply-templates/>
+    </xsl:element>
+  </xsl:template>
+  
+  <xsl:template match="tei:teiHeader"/>
+  
+  <xsl:template match="tei:text">
+    <xsl:element name="text" namespace="http://www.tei-c.org/ns/1.0">
+<xsl:attribute name="idbfm"><xsl:value-of select="ancestor::tei:TEI/tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:title[@type='reference']"/></xsl:attribute>
+<!--<xsl:attribute name="deaf"><xsl:value-of select="ancestor::tei:TEI/tei:teiHeader/tei:fileDesc/tei:sourceDesc/tei:biblFull/tei:publicationStmt/tei:idno[@type='sigle_DEAF']"/></xsl:attribute>-->
+<xsl:attribute name="titre"><xsl:value-of select="ancestor::tei:TEI/tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:title[@type='normal']"/></xsl:attribute>
+<xsl:attribute name="auteur"><xsl:value-of select="ancestor::tei:TEI/tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:author"/></xsl:attribute>
+<xsl:attribute name="siecle"><xsl:value-of select="ancestor::tei:TEI/tei:teiHeader/tei:profileDesc/tei:creation/tei:date[@type='compo']/@n"/></xsl:attribute>
+<xsl:attribute name="ssiecle"><xsl:value-of select="ancestor::tei:TEI/tei:teiHeader/tei:profileDesc/tei:creation/tei:date[@type='compo_sous_siecle']/@n"/></xsl:attribute>
+<xsl:attribute name="datecompolibre"><xsl:value-of select="ancestor::tei:TEI/tei:teiHeader/tei:profileDesc/tei:creation/tei:date[@type='compo']"/></xsl:attribute>
+<xsl:attribute name="datecompo"><xsl:value-of select="ancestor::tei:TEI/tei:teiHeader/tei:profileDesc/tei:creation/tei:date[@type='compo']/@when"/></xsl:attribute>
+<!--<xsl:attribute name="notbefore"><xsl:value-of select="ancestor::tei:TEI/tei:teiHeader/tei:profileDesc/tei:creation/tei:date[@type='compo']/@notBefore"/></xsl:attribute>
+<xsl:attribute name="notafter"><xsl:value-of select="ancestor::tei:TEI/tei:teiHeader/tei:profileDesc/tei:creation/tei:date[@type='compo']/@notAfter"/></xsl:attribute>
+<xsl:attribute name="msdatelibre"><xsl:value-of select="ancestor::tei:TEI/tei:teiHeader/tei:profileDesc/tei:creation/tei:date[@type='ms']"/></xsl:attribute>
+<xsl:attribute name="msdate"><xsl:value-of select="ancestor::tei:TEI/tei:teiHeader/tei:profileDesc/tei:creation/tei:date[@type='ms']/@when"/></xsl:attribute>
+<xsl:attribute name="msnotbefore"><xsl:value-of select="ancestor::tei:TEI/tei:teiHeader/tei:profileDesc/tei:creation/tei:date[@type='ms']/@notBefore"/></xsl:attribute>
+<xsl:attribute name="msnotafter"><xsl:value-of select="ancestor::tei:TEI/tei:teiHeader/tei:profileDesc/tei:creation/tei:date[@type='ms']/@notAfter"/></xsl:attribute>-->
+<xsl:attribute name="forme"><xsl:value-of select="ancestor::tei:TEI/tei:teiHeader/tei:profileDesc/tei:textClass/tei:catRef/@target[contains(.,'forme')]"/></xsl:attribute>
+<xsl:attribute name="domaine"><xsl:value-of select="ancestor::tei:TEI/tei:teiHeader/tei:profileDesc/tei:textDesc/tei:domain/@type"/></xsl:attribute>
+<xsl:attribute name="genre"><xsl:value-of select="ancestor::tei:TEI/tei:teiHeader/tei:profileDesc/tei:textDesc/@n"/></xsl:attribute>
+<xsl:attribute name="dialecte"><xsl:value-of select="ancestor::tei:TEI/tei:teiHeader/tei:profileDesc/tei:creation/tei:region[@type='dialecte_auteur']"/></xsl:attribute>
+<!--<xsl:attribute name="morphosynt"><xsl:value-of select="ancestor::tei:TEI/tei:teiHeader/tei:revisionDesc/tei:change[contains(.,'étiquetage morpho')]"/></xsl:attribute>
+<xsl:attribute name="restrictions"><xsl:value-of select="ancestor::tei:TEI/tei:teiHeader/tei:fileDesc/tei:publicationStmt/tei:availability/tei:ab[@type='availability_txmweb']/@subtype"/></xsl:attribute>
+<xsl:attribute name="relation"><xsl:value-of select="ancestor::tei:TEI/tei:teiHeader/tei:profileDesc/tei:textDesc/tei:derivation/@type"/></xsl:attribute>
+<xsl:attribute name="edsci"><xsl:value-of select="ancestor::tei:TEI/tei:teiHeader/tei:fileDesc/tei:sourceDesc/tei:biblFull/tei:titleStmt/tei:respStmt[contains(.,'Éditeur scientifique')]/tei:name"/></xsl:attribute>
+<xsl:attribute name="edcomm"><xsl:value-of select="ancestor::tei:TEI/tei:teiHeader/tei:fileDesc/tei:sourceDesc/tei:biblFull/tei:publicationStmt/tei:publisher"/></xsl:attribute>
+<xsl:attribute name="edville"><xsl:value-of select="ancestor::tei:TEI/tei:teiHeader/tei:fileDesc/tei:sourceDesc/tei:biblFull/tei:publicationStmt/tei:pubPlace"/></xsl:attribute>
+<xsl:attribute name="eddate"><xsl:value-of select="ancestor::tei:TEI/tei:teiHeader/tei:fileDesc/tei:sourceDesc/tei:biblFull/tei:publicationStmt/tei:date"/></xsl:attribute>
+<xsl:attribute name="ednum"><xsl:value-of select="ancestor::tei:TEI/tei:teiHeader/tei:fileDesc/tei:sourceDesc/tei:biblFull/tei:editionStmt/tei:edition"/></xsl:attribute>-->
+     <xsl:apply-templates/> 
+    </xsl:element>
+  </xsl:template>
+
+<xsl:template match="//tei:w">
+  <xsl:element name="w" namespace="http://www.tei-c.org/ns/1.0">
+    <xsl:apply-templates select="@*[not(name()='type')]"/>
+    <xsl:attribute name="pos"><xsl:value-of select="@type"/></xsl:attribute>
+    <xsl:attribute name="dipl"><xsl:apply-templates select="descendant::me:dipl"/></xsl:attribute>
+    <xsl:attribute name="ref"><xsl:value-of select="concat('graal_cm, col. ',substring-after(preceding::tei:cb[1]/@xml:id,'col_'),', l. ',preceding::tei:lb[1]/@n)"/></xsl:attribute>
+    <xsl:attribute name="q">
+      <xsl:value-of select="count(ancestor::tei:q)"/>
+    </xsl:attribute>
+    <xsl:apply-templates/>
+  </xsl:element>
+</xsl:template>
+
+  <xsl:template match="//tei:choice[parent::tei:w]">
+    <xsl:choose>
+      <xsl:when test="descendant::me:norm">
+        <xsl:apply-templates select="me:norm"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:apply-templates select="me:facs"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  
+  <xsl:template match="me:dipl">
+    <xsl:for-each select="child::node()">
+      <xsl:choose>
+        <xsl:when test="self::tei:ex">
+          <xsl:value-of select="concat('‹',.,'›')"/>
+        </xsl:when>
+        <xsl:otherwise><xsl:value-of select="normalize-space(.)"/></xsl:otherwise>
+      </xsl:choose>
+    </xsl:for-each>
+  </xsl:template>
+  
+  
+  <xsl:template match="//tei:choice[descendant::tei:w]">
+    <xsl:apply-templates select="tei:corr|tei:reg"/>
+  </xsl:template>
+  
+  <xsl:template match="//tei:surplus"/>
+  
+  <xsl:template match="//tei:del"/>
+  
+  <xsl:template match="//tei:note"/>
+  
+  <xsl:variable name="apostrophe" select='"&apos;"'/>
+
+<xsl:template match="@bfm:aggl">
+  <xsl:attribute name="rend"><xsl:value-of select="."/></xsl:attribute>
+</xsl:template>
+
+  <xsl:template match="me:norm|me:facs">
+    <xsl:apply-templates/>
+    <!-- added 2011-02-10 -->
+    <xsl:if test="ancestor::tei:w[@*='elision'] and not(substring(., string-length(.))=$apostrophe)">
+      <xsl:text>'</xsl:text>
+    </xsl:if>
+  </xsl:template>
+  
+<!--  <xsl:template match="tei:milestone[@unit='column']">
+    <xsl:element name="pb" namespace="http://www.tei-c.org/ns/1.0">      
+      <xsl:attribute name="n"><xsl:value-of select="substring-after(@xml:id,'col_')"/></xsl:attribute>
+    </xsl:element>
+  </xsl:template>
+  
+  <xsl:template match="tei:pb[@ed='#Pauphilet1923']">
+    <xsl:element name="milestone" namespace="http://www.tei-c.org/ns/1.0">
+      <xsl:attribute name="unit">page-Pauphilet</xsl:attribute>
+      <xsl:attribute name="n"><xsl:value-of select="@n"/></xsl:attribute>
+    </xsl:element>
+  </xsl:template>-->
+
+<xsl:template match="tei:cb[@rend='hidden']"/>
+
+  <xsl:template match="tei:cb[not(@rend='hidden')]">
+    <xsl:element name="pb" namespace="http://www.tei-c.org/ns/1.0">      
+      <xsl:attribute name="n"><xsl:value-of select="substring-after(@xml:id,'col_')"/></xsl:attribute>
+    </xsl:element>
+  </xsl:template>
+  
+  <xsl:template match="tei:pb"/>
+  
+  
+  <xsl:template match="bfm:sb"/>
+  
+  <xsl:template match="tei:lb[@ed='#facs']"/>
+  
+
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-qgraal_cm-xmlw.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/txm-edition-page-split.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/txm-edition-page-split.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/txm-edition-page-split.xsl	(revision 258)
@@ -0,0 +1,193 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet
+		xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+		version="2.0" xpath-default-namespace="http://www.w3.org/1999/xhtml">
+<!--
+This software is dual-licensed:
+
+1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
+Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
+
+2. http://www.opensource.org/licenses/BSD-2-Clause
+		
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors
+"as is" and any express or implied warranties, including, but not
+limited to, the implied warranties of merchantability and fitness for
+a particular purpose are disclaimed. In no event shall the copyright
+holder or contributors be liable for any direct, indirect, incidental,
+special, exemplary, or consequential damages (including, but not
+limited to, procurement of substitute goods or services; loss of use,
+data, or profits; or business interruption) however caused and on any
+theory of liability, whether in contract, strict liability, or tort
+(including negligence or otherwise) arising in any way out of the use
+of this software, even if advised of the possibility of such damage.
+
+     $Id$
+
+This stylesheet is based on TEI processpb.xsl by Sebastian Rahtz 
+available at 
+https://github.com/TEIC/Stylesheets/blob/master/tools/processpb.xsl 
+and is adapted by Alexei Lavrentiev to split an HTML edition for 
+TXM platform.
+
+  -->
+  <xsl:output indent="no" method="xml" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
+
+  <xsl:param name="cssname-txm">txm</xsl:param>
+	<xsl:param name="cssname">tei</xsl:param>
+	<xsl:param name="editionname">default</xsl:param>
+
+  <xsl:template match="html/body">
+      <xsl:variable name="pages">
+	<xsl:copy>
+	  <xsl:apply-templates select="@*"/>
+	  <xsl:apply-templates
+	      select="*|processing-instruction()|comment()|text()"/>
+	</xsl:copy>
+      </xsl:variable>
+      <xsl:for-each select="$pages">
+	<xsl:apply-templates  mode="pass2"/>
+      </xsl:for-each>
+    <!-- creating title page with metadata -->
+  </xsl:template>
+
+
+ <!-- first (recursive) pass. look for <pb> elements and group on them -->
+  <xsl:template match="comment()|@*|processing-instruction()|text()">
+    <xsl:copy-of select="."/>
+  </xsl:template>
+
+  <xsl:template match="*">
+    <xsl:call-template name="checkpb">
+      <xsl:with-param name="eName" select="local-name()"/>
+    </xsl:call-template>
+  </xsl:template>
+
+  <xsl:template match="a[@class='txm-page']">
+    <a xmlns="http://www.w3.org/1999/xhtml">
+      <xsl:copy-of select="@*"/>
+    </a>
+  </xsl:template>
+
+  <xsl:template name="checkpb">
+    <xsl:param name="eName"/>
+    <xsl:choose>
+      <xsl:when test="not(.//a[@class='txm-page'])">
+        <xsl:copy-of select="."/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:variable name="pass">
+	  <xsl:call-template name="groupbypb">
+	    <xsl:with-param name="Name" select="$eName"/>
+	  </xsl:call-template>
+        </xsl:variable>
+	<xsl:for-each select="$pass">
+	  <xsl:apply-templates/>
+	</xsl:for-each>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="groupbypb">
+    <xsl:param name="Name"/>
+    <xsl:for-each-group select="node()" group-starting-with="a[@class='txm-page']">
+      <xsl:choose>
+        <xsl:when test="self::a[@class='txm-page']">
+          <xsl:copy-of select="."/>
+          <xsl:element name="{$Name}" namespace="http://www.w3.org/1999/xhtml">
+	    <xsl:attribute name="rend">CONTINUED</xsl:attribute>
+            <xsl:apply-templates select="current-group() except ."/>
+          </xsl:element>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:element name="{$Name}" namespace="http://www.w3.org/1999/xhtml">
+            <xsl:for-each select="..">
+              <xsl:copy-of select="@*"/>
+              <xsl:apply-templates select="current-group()"/>
+            </xsl:for-each>
+          </xsl:element>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:for-each-group>
+  </xsl:template>
+
+  <!-- second pass. group by <pb> (now all at top level) and wrap groups
+       in <page> -->
+  <xsl:template match="*" mode="pass2">
+    <xsl:copy>
+      <xsl:apply-templates select="@*|*|processing-instruction()|comment()|text()" mode="pass2"/>
+    </xsl:copy>
+  </xsl:template>
+
+  <xsl:template match="comment()|@*|processing-instruction()|text()" mode="pass2">
+    <xsl:copy-of select="."/>
+  </xsl:template>
+
+	<xsl:variable name="filename">
+		<xsl:analyze-string select="document-uri(.)" regex="^(.*)/([^/]+)\.[^/]+$">
+			<xsl:matching-substring>
+				<xsl:value-of select="regex-group(2)"/>
+			</xsl:matching-substring>
+		</xsl:analyze-string>
+	</xsl:variable>
+	
+	<xsl:variable name="filedir">
+		<xsl:analyze-string select="document-uri(.)" regex="^(.*)/([^/]+)\.[^/]+$">
+			<xsl:matching-substring>
+				<xsl:value-of select="regex-group(1)"/>
+			</xsl:matching-substring>
+		</xsl:analyze-string>
+	</xsl:variable>
+	
+	
+<!--	<xsl:variable name="style">
+	  <xsl:copy-of select="/html/head[1]/style[1]"></xsl:copy-of>
+	</xsl:variable>-->
+
+  <xsl:template match="*[a[@class='txm-page']]" mode="pass2" >
+    <xsl:copy>
+      <xsl:apply-templates select="@*"/>
+      <xsl:for-each-group select="*" group-starting-with="a[@class='txm-page']">
+        <xsl:choose>
+          <xsl:when test="self::a[@class='txm-page']">
+          	<xsl:comment> Page <xsl:value-of select="@title"/> déplacée vers <xsl:value-of select="concat($filedir,'/',$editionname,'/',$filename,'_',@title,'.html')"/></xsl:comment>
+          	<xsl:result-document href="{$filedir}/{$editionname}/{$filename}_{@title}.html">
+          	<html>
+          		<head>
+          			<title><xsl:value-of select="concat($filename,', Page ',@title)"/></title>
+          			<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
+          			<link rel="stylesheet" media="all" type="text/css" href="css/{$cssname-txm}.css"/>
+          			<xsl:if test="matches($cssname,'\S')"><link rel="stylesheet" media="all" type="text/css" href="css/{$cssname}.css"/></xsl:if>
+          		  <!--<xsl:copy-of select="$style"/>-->
+          		</head>
+          		<body>
+          		  <div class="txmeditionpage">
+          			  <xsl:copy-of select="current-group() except ."/>
+          			</div>
+          		</body>
+          	</html>
+          	</xsl:result-document>
+
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:copy-of select="current-group()"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:for-each-group>
+    </xsl:copy>
+  </xsl:template>
+
+</xsl:stylesheet>

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/txm-edition-page-split.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-teiperseus-xmlw.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-teiperseus-xmlw.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-teiperseus-xmlw.xsl	(revision 258)
@@ -0,0 +1,57 @@
+<?xml version="1.0"?>
+<xsl:stylesheet
+  xmlns:xd="http://www.pnp-software.com/XSLTdoc"
+  xmlns:edate="http://exslt.org/dates-and-times"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tei="http://www.tei-c.org/ns/1.0"
+  exclude-result-prefixes="tei edate xd" version="2.0">
+  
+  <xsl:import href="txm-filter-teip5-xmlw-preserve.xsl"/>
+  <xd:doc type="stylesheet">
+    <xd:short>
+      A stylesheet to prepare PERSEUS XML-TEI texts to TXM import.
+    </xd:short>
+    <xd:detail>
+      This stylesheet is free software; you can redistribute it and/or
+      modify it under the terms of the GNU Lesser General Public
+      License as published by the Free Software Foundation; either
+      version 3 of the License, or (at your option) any later version.
+      
+      This stylesheet 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
+      Lesser General Public License for more details.
+      
+      You should have received a copy of GNU Lesser Public License with
+      this stylesheet. If not, see http://www.gnu.org/licenses/lgpl.html
+    </xd:detail>
+    <xd:author>Alexei Lavrentiev alexei.lavrentev@ens-lyon.fr</xd:author>
+    <xd:copyright>2012, CNRS / ICAR (ICAR3 LinCoBaTO)</xd:copyright>
+  </xd:doc>
+  
+
+  <xsl:output method="xml" encoding="utf-8" omit-xml-declaration="no"/>
+  
+  <xsl:template match="//tei:text">
+    <xsl:copy>
+      <xsl:copy-of select="@*"/>
+      <xsl:attribute name="author"><xsl:value-of select="//tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:author"/></xsl:attribute>
+      <xsl:attribute name="title"><xsl:value-of select="//tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:title[@type='work']"/></xsl:attribute>
+      <xsl:attribute name="editor"><xsl:value-of select="//tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:editor"/></xsl:attribute>
+      <xsl:apply-templates/>
+    </xsl:copy>
+  </xsl:template>
+  
+<xsl:template match="//tei:sp">
+  <div3 type="sp" xmlns="http://www.tei-c.org/ns/1.0">
+    <xsl:apply-templates/>    
+  </div3>
+</xsl:template>  
+
+<xsl:template match="//tei:speaker">
+  <head><xsl:apply-templates/></head>
+</xsl:template>
+  
+  <xsl:template match="//tei:bibl">
+    <note type="bibl" xmlns="http://www.tei-c.org/ns/1.0"><xsl:apply-templates/></note>
+  </xsl:template>
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-teiperseus-xmlw.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-teibrown-xmlw.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-teibrown-xmlw.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-teibrown-xmlw.xsl	(revision 258)
@@ -0,0 +1,135 @@
+<?xml version="1.0"?>
+<xsl:stylesheet
+  xmlns:xd="http://www.pnp-software.com/XSLTdoc"
+  xmlns:edate="http://exslt.org/dates-and-times"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tei="http://www.tei-c.org/ns/1.0"
+  exclude-result-prefixes="tei edate xd" version="2.0">
+  
+  <xd:doc type="stylesheet">
+    <xd:short>
+      This stylesheet prepares XML-TEI P5 files of the Brown corpus
+      for TXM import with xml/w+csv module.
+      Specify the location of this file on your system in the "Front
+      XSLT" import option.
+    </xd:short>
+    <xd:detail>
+      This stylesheet is free software; you can redistribute it and/or
+      modify it under the terms of the GNU Lesser General Public
+      License as published by the Free Software Foundation; either
+      version 3 of the License, or (at your option) any later version.
+      
+      This stylesheet 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
+      Lesser General Public License for more details.
+      
+      You should have received a copy of GNU Lesser Public License with
+      this stylesheet. If not, see http://www.gnu.org/licenses/lgpl.html
+    </xd:detail>
+    <xd:author>Alexei Lavrentiev alexei.lavrentev@ens-lyon.fr</xd:author>
+    <xd:copyright>2012, CNRS / ICAR (ICAR3 LinCoBaTO)</xd:copyright>
+  </xd:doc>
+  
+
+  <xsl:output method="xml" encoding="utf-8" omit-xml-declaration="no"/>
+  
+  
+<!--  <xsl:template match="/">
+      <xsl:apply-templates/>  
+  </xsl:template>
+-->
+  
+  <xsl:template match="*">
+        <xsl:element namespace="http://www.tei-c.org/ns/1.0" name="{local-name(.)}">
+          <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
+        </xsl:element>
+  </xsl:template>
+
+  <xsl:template match="@*|comment()">
+    <xsl:copy/>
+  </xsl:template>
+
+  <xsl:template match="text()">
+    <xsl:analyze-string select="." regex="&amp;|&lt;|&gt;|--|\*(\w+)">
+      <xsl:matching-substring>
+        <xsl:choose>
+          <xsl:when test="matches(.,'&amp;')">
+            <expan xmlns="http://www.tei-c.org/ns/1.0">and</expan>
+          </xsl:when>
+          <xsl:when test="matches(.,'&lt;')">
+            <xsl:text>[</xsl:text>
+          </xsl:when>
+          <xsl:when test="matches(.,'&gt;')">
+            <xsl:text>]</xsl:text>
+          </xsl:when>          
+          <xsl:when test="matches(.,'--')">
+            <!-- double dash provokes malformed xml in the notes in the notes placed in xml comments by the tokenizer -->
+            <xsl:text> - </xsl:text>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:value-of select="."/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:matching-substring>
+      <xsl:non-matching-substring>         
+            <xsl:value-of select="."/>
+      </xsl:non-matching-substring>      
+    </xsl:analyze-string>
+  </xsl:template>
+  
+
+  <xsl:template match="processing-instruction()"/>
+
+<!-- teiHeader deleted for the xml/w import module -->
+  
+  <xsl:template match="tei:teiHeader">    
+      <!--<xsl:copy-of select="."/>-->    
+  </xsl:template>
+	
+	<xsl:template match="tei:text">
+		<xsl:copy>
+		<xsl:apply-templates select="@*"/>
+		<xsl:attribute name="type">
+			<xsl:choose>
+				<xsl:when test="@decls='A'">PRESS: REPORTAGE</xsl:when>
+				<xsl:when test="@decls='B'">PRESS: EDITORIAL</xsl:when>
+				<xsl:when test="@decls='C'">PRESS: REVIEWS</xsl:when>
+				<xsl:when test="@decls='D'">RELIGION</xsl:when>
+				<xsl:when test="@decls='E'">SKILL AND HOBBIES</xsl:when>
+				<xsl:when test="@decls='F'">POPULAR LORE</xsl:when>
+				<xsl:when test="@decls='G'">BELLES-LETTRES</xsl:when>
+				<xsl:when test="@decls='H'">MISCELLANEOUS: GOVERNMENT AND HOUSE ORGANS</xsl:when>
+				<xsl:when test="@decls='J'">LEARNED</xsl:when>
+				<xsl:when test="@decls='K'">FICTION: GENERAL</xsl:when>
+				<xsl:when test="@decls='L'">FICTION: MYSTERY</xsl:when>
+				<xsl:when test="@decls='M'">FICTION: SCIENCE</xsl:when>
+				<xsl:when test="@decls='N'">FICTION: ADVENTURE</xsl:when>
+				<xsl:when test="@decls='P'">FICTION: ROMANCE</xsl:when>
+				<xsl:when test="@decls='R'">HUMOR</xsl:when>				
+			</xsl:choose>
+		</xsl:attribute>
+		<xsl:apply-templates/>
+		</xsl:copy>
+	</xsl:template>
+
+<xsl:template match="@type|@pos">
+	<xsl:attribute name="type">
+		<xsl:value-of select="translate(.,' *','_')"></xsl:value-of>
+	</xsl:attribute>
+</xsl:template>
+	
+	<xsl:template match="tei:mw">
+		<w xmlns="http://www.tei-c.org/ns/1.0">
+			<xsl:apply-templates select="@*"/>
+			<xsl:apply-templates/>
+		</w>
+	</xsl:template>
+	
+	<xsl:template match="tei:c[@type='pct']">
+		<w xmlns="http://www.tei-c.org/ns/1.0">
+			<xsl:apply-templates select="@*"/>
+			<xsl:apply-templates/>
+		</w>			
+	</xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-teibrown-xmlw.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-teifrantext-xmlw.xsl
===================================================================
--- tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-teifrantext-xmlw.xsl	(revision 0)
+++ tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-teifrantext-xmlw.xsl	(revision 258)
@@ -0,0 +1,92 @@
+<?xml version="1.0"?>
+<xsl:stylesheet
+  xmlns:xd="http://www.pnp-software.com/XSLTdoc"
+  xmlns:edate="http://exslt.org/dates-and-times"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tei="http://www.tei-c.org/ns/1.0"
+  exclude-result-prefixes="tei edate xd" version="2.0">
+  
+  <xsl:import href="txm-filter-teip5-xmlw-preserve.xsl"/>
+  
+  <xd:doc type="stylesheet">
+    <xd:short>
+      Feuille de style de préparation des fichiers TEI de la Revue
+      Discours à l'importation TXM dans un format xml simple. 
+    </xd:short>
+    <xd:detail>
+      This stylesheet is free software; you can redistribute it and/or
+      modify it under the terms of the GNU Lesser General Public
+      License as published by the Free Software Foundation; either
+      version 3 of the License, or (at your option) any later version.
+      
+      This stylesheet 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
+      Lesser General Public License for more details.
+      
+      You should have received a copy of GNU Lesser Public License with
+      this stylesheet. If not, see http://www.gnu.org/licenses/lgpl.html
+    </xd:detail>
+    <xd:author>Alexei Lavrentiev alexei.lavrentev@ens-lyon.fr</xd:author>
+    <xd:copyright>2012, CNRS / ICAR (ICAR3 LinCoBaTO)</xd:copyright>
+  </xd:doc>
+  
+  <xsl:output method="xml" encoding="utf-8" omit-xml-declaration="no"/>
+
+  <!--<xsl:variable name="langue"><xsl:value-of select="lower-case(//tei:teiHeader[1]/tei:profileDesc[1]/tei:langUsage[1]/tei:language[1])"/></xsl:variable>-->
+
+<!-- On injecte les mots clés dans la langue de l'article et on ne garde que l'abstract dans la langue de l'article -->
+  
+  <xsl:template match="text()">
+    <xsl:analyze-string select="." regex="&amp;lt;|&amp;gt;|&amp;|&lt;|&gt;|--|\*(\w+)">
+      <xsl:matching-substring>
+        <xsl:choose>
+          <xsl:when test="matches(.,'&amp;lt;')">
+            <xsl:text>‹</xsl:text>
+          </xsl:when>
+          <xsl:when test="matches(.,'&amp;gt;')">
+            <xsl:text>›</xsl:text>
+          </xsl:when>
+          <!--          <xsl:when test="matches(.,'&amp;')">
+            <!-\-<expan xmlns="http://www.tei-c.org/ns/1.0">and</expan>-\->
+          	<xsl:text>&amp;amp;</xsl:text>
+          </xsl:when>-->
+          <xsl:when test="matches(.,'&lt;')">
+            <xsl:text>‹</xsl:text>
+          </xsl:when>
+          <xsl:when test="matches(.,'&gt;')">
+            <xsl:text>›</xsl:text>
+          </xsl:when>
+          <!-- pose problème si se trouve dans les notes transformés en commentaires xml par le tokeniseur -->
+          <xsl:when test="matches(.,'--')">
+            <xsl:text> - </xsl:text>
+          </xsl:when>
+          <!-- spécial Frantext!!! -->
+          <xsl:when test="matches(.,'\*(\w+)')">
+            <w xmlns="http://www.tei-c.org/ns/1.0" type="maj"><xsl:value-of select="regex-group(1)"/></w>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:value-of select="."/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:matching-substring>
+      <xsl:non-matching-substring>         
+        <xsl:value-of select="."/>
+      </xsl:non-matching-substring>      
+    </xsl:analyze-string>
+  </xsl:template>
+  
+  <xsl:template match="tei:text">
+    <xsl:copy>
+      <xsl:apply-templates/>
+    </xsl:copy>
+  </xsl:template>
+  
+<xsl:template match="tei:div">
+  <xsl:copy>
+    <xsl:attribute name="n"><xsl:value-of select="count(preceding-sibling::tei:div) + 1"/></xsl:attribute>
+    <xsl:apply-templates select="@*"/>
+    <xsl:apply-templates/>
+  </xsl:copy>
+</xsl:template>
+  
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-teifrantext-xmlw.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/build.properties
===================================================================
--- tmp/org.txm.core/build.properties	(revision 0)
+++ tmp/org.txm.core/build.properties	(revision 258)
@@ -0,0 +1,66 @@
+bin.includes = META-INF/,\
+               lib/ant-1.7.1.jar,\
+               lib/ant-launcher.jar,\
+               lib/ant.jar,\
+               lib/antlr-2.7.7.jar,\
+               lib/asm-analysis-2.2.3.jar,\
+               lib/asm-tree-2.2.3.jar,\
+               lib/colt-1.2.0.jar,\
+               lib/concurrent-1.3.4.jar,\
+               lib/dom4j-1.6.1.jar,\
+               lib/forms-1.0.7.jar,\
+               lib/jline-0.9.94.jar,\
+               lib/junit-4.5.jar,\
+               lib/jvectClipboard-1.2.jar,\
+               lib/liquidlnf.jar,\
+               lib/log4j-1.2.12.jar,\
+               lib/looks-2.0.1.jar,\
+               lib/macSpecific.jar,\
+               lib/quaqua.jar,\
+               lib/REngine.jar,\
+               lib/RserveEngine.jar,\
+               lib/rtfCleaner.jar,\
+               lib/swing-layout-1.0.3.jar,\
+               .,\
+               lib/juniversalchardet-1.0.3.jar,\
+               lib/textcat-1.0.1.jar,\
+               lib/saxon9he.jar,\
+               lib/jtidy-r938.jar,\
+               lib/json-20090211.jar,\
+               lib/juh-3.2.1.jar,\
+               lib/jurt-3.2.1.jar,\
+               lib/ridl-3.2.1.jar,\
+               lib/unoil-3.2.1.jar,\
+               bin/,\
+               src/groovy/,\
+               plugin.xml,\
+               lib/hsqldb.jar,\
+               lib/sqlite-jdbc-3.8.11.2.jar,\
+               lib/postgresql-9.4.1207.jre6.jar,\
+               lib/jodconverter-core-3.1-beta.jar,\
+               log4j.properties,\
+               bin/org/txm/functions/mesures/
+output.. = bin/
+source.. = src/java/,\
+           src/groovy/,\
+           res/
+bin.excludes = META-INF/TSTMANIFEST.MF,\
+               bin/org/knallgrau/,\
+               bin/org/kohsuke/,\
+               bin/org/txm/functions/,\
+               bin/org/txm/images/,\
+               bin/org/txm/renderer/,\
+               bin/org/txm/searchengine/,\
+               bin/org/txm/xml/,\
+               bin/org/txm/css/,\
+               bin/org/txm/annotation/,\
+               bin/org/txm/js/,\
+               bin/org/txm/metadatas/,\
+               bin/org/txm/objects/,\
+               bin/org/txm/package.html,\
+               bin/org/txm/sql/,\
+               bin/org/txm/stat/,\
+               bin/org/txm/tbx/,\
+               bin/org/txm/tests/,\
+               bin/org/txm/ts/,\
+               bin/org/txm/utils/

Property changes on: tmp/org.txm.core/build.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/plugin.xml
===================================================================
--- tmp/org.txm.core/plugin.xml	(revision 0)
+++ tmp/org.txm.core/plugin.xml	(revision 258)
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+
+</plugin>

Property changes on: tmp/org.txm.core/plugin.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/.classpath
===================================================================
--- tmp/org.txm.core/.classpath	(revision 0)
+++ tmp/org.txm.core/.classpath	(revision 258)
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry exported="true" kind="lib" path="lib/ant-1.7.1.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/ant-launcher.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/ant.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/antlr-2.7.7.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/asm-analysis-2.2.3.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/asm-tree-2.2.3.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/colt-1.2.0.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/concurrent-1.3.4.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/dom4j-1.6.1.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/forms-1.0.7.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/jline-0.9.94.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/junit-4.5.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/jvectClipboard-1.2.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/liquidlnf.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/log4j-1.2.12.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/looks-2.0.1.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/macSpecific.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/quaqua.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/REngine.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/RserveEngine.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/rtfCleaner.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/swing-layout-1.0.3.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/juniversalchardet-1.0.3.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/textcat-1.0.1.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/json-20090211.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/juh-3.2.1.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/jurt-3.2.1.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/ridl-3.2.1.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/unoil-3.2.1.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/jtidy-r938.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/sqlite-jdbc-3.8.11.2.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/postgresql-9.4.1207.jre6.jar"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+	<classpathentry exported="true" kind="con" path="org.eclipse.pde.core.requiredPlugins">
+		<attributes>
+			<attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" value="org.txm.toolbox/native"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="src" path="src/java"/>
+	<classpathentry kind="src" path="test"/>
+	<classpathentry exported="true" kind="lib" path="bin/" sourcepath="src/java"/>
+	<classpathentry excluding="org/txm/importer/graal/xsl/" kind="src" path="src/groovy"/>
+	<classpathentry kind="src" path="res"/>
+	<classpathentry exported="true" kind="con" path="GROOVY_DSL_SUPPORT"/>
+	<classpathentry exported="true" kind="lib" path="lib/hsqldb.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/jodconverter-core-3.1-beta.jar"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>

Property changes on: tmp/org.txm.core/.classpath
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/LICENSE.TXT
===================================================================
--- tmp/org.txm.core/LICENSE.TXT	(revision 0)
+++ tmp/org.txm.core/LICENSE.TXT	(revision 258)
@@ -0,0 +1,675 @@
+GNU GENERAL PUBLIC LICENSE
+                       Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                            Preamble
+
+  The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+  The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works.  By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.  We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors.  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+  To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights.  Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received.  You must make sure that they, too, receive
+or can get the source code.  And you must show them these terms so they
+know their rights.
+
+  Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+  For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software.  For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+  Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so.  This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software.  The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable.  Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products.  If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+  Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary.  To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+                       TERMS AND CONDITIONS
+
+  0. Definitions.
+
+  "This License" refers to version 3 of the GNU General Public License.
+
+  "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+  "The Program" refers to any copyrightable work licensed under this
+License.  Each licensee is addressed as "you".  "Licensees" and
+"recipients" may be individuals or organizations.
+
+  To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy.  The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+  A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+  To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy.  Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+  To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies.  Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+  An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License.  If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+  1. Source Code.
+
+  The "source code" for a work means the preferred form of the work
+for making modifications to it.  "Object code" means any non-source
+form of a work.
+
+  A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+  The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form.  A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+  The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities.  However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work.  For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+  The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+  The Corresponding Source for a work in source code form is that
+same work.
+
+  2. Basic Permissions.
+
+  All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met.  This License explicitly affirms your unlimited
+permission to run the unmodified Program.  The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work.  This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+  You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force.  You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright.  Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+  Conveying under any other circumstances is permitted solely under
+the conditions stated below.  Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+  No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+  When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+  4. Conveying Verbatim Copies.
+
+  You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+  You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+  5. Conveying Modified Source Versions.
+
+  You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+    a) The work must carry prominent notices stating that you modified
+    it, and giving a relevant date.
+
+    b) The work must carry prominent notices stating that it is
+    released under this License and any conditions added under section
+    7.  This requirement modifies the requirement in section 4 to
+    "keep intact all notices".
+
+    c) You must license the entire work, as a whole, under this
+    License to anyone who comes into possession of a copy.  This
+    License will therefore apply, along with any applicable section 7
+    additional terms, to the whole of the work, and all its parts,
+    regardless of how they are packaged.  This License gives no
+    permission to license the work in any other way, but it does not
+    invalidate such permission if you have separately received it.
+
+    d) If the work has interactive user interfaces, each must display
+    Appropriate Legal Notices; however, if the Program has interactive
+    interfaces that do not display Appropriate Legal Notices, your
+    work need not make them do so.
+
+  A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit.  Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+  6. Conveying Non-Source Forms.
+
+  You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+    a) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by the
+    Corresponding Source fixed on a durable physical medium
+    customarily used for software interchange.
+
+    b) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by a
+    written offer, valid for at least three years and valid for as
+    long as you offer spare parts or customer support for that product
+    model, to give anyone who possesses the object code either (1) a
+    copy of the Corresponding Source for all the software in the
+    product that is covered by this License, on a durable physical
+    medium customarily used for software interchange, for a price no
+    more than your reasonable cost of physically performing this
+    conveying of source, or (2) access to copy the
+    Corresponding Source from a network server at no charge.
+
+    c) Convey individual copies of the object code with a copy of the
+    written offer to provide the Corresponding Source.  This
+    alternative is allowed only occasionally and noncommercially, and
+    only if you received the object code with such an offer, in accord
+    with subsection 6b.
+
+    d) Convey the object code by offering access from a designated
+    place (gratis or for a charge), and offer equivalent access to the
+    Corresponding Source in the same way through the same place at no
+    further charge.  You need not require recipients to copy the
+    Corresponding Source along with the object code.  If the place to
+    copy the object code is a network server, the Corresponding Source
+    may be on a different server (operated by you or a third party)
+    that supports equivalent copying facilities, provided you maintain
+    clear directions next to the object code saying where to find the
+    Corresponding Source.  Regardless of what server hosts the
+    Corresponding Source, you remain obligated to ensure that it is
+    available for as long as needed to satisfy these requirements.
+
+    e) Convey the object code using peer-to-peer transmission, provided
+    you inform other peers where the object code and Corresponding
+    Source of the work are being offered to the general public at no
+    charge under subsection 6d.
+
+  A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+  A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling.  In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage.  For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product.  A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+  "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source.  The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+  If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information.  But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+  The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed.  Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+  Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+  7. Additional Terms.
+
+  "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law.  If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+  When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it.  (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.)  You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+  Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+    a) Disclaiming warranty or limiting liability differently from the
+    terms of sections 15 and 16 of this License; or
+
+    b) Requiring preservation of specified reasonable legal notices or
+    author attributions in that material or in the Appropriate Legal
+    Notices displayed by works containing it; or
+
+    c) Prohibiting misrepresentation of the origin of that material, or
+    requiring that modified versions of such material be marked in
+    reasonable ways as different from the original version; or
+
+    d) Limiting the use for publicity purposes of names of licensors or
+    authors of the material; or
+
+    e) Declining to grant rights under trademark law for use of some
+    trade names, trademarks, or service marks; or
+
+    f) Requiring indemnification of licensors and authors of that
+    material by anyone who conveys the material (or modified versions of
+    it) with contractual assumptions of liability to the recipient, for
+    any liability that these contractual assumptions directly impose on
+    those licensors and authors.
+
+  All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10.  If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term.  If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+  If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+  Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+  8. Termination.
+
+  You may not propagate or modify a covered work except as expressly
+provided under this License.  Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+  However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+  Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+  Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License.  If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+  9. Acceptance Not Required for Having Copies.
+
+  You are not required to accept this License in order to receive or
+run a copy of the Program.  Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance.  However,
+nothing other than this License grants you permission to propagate or
+modify any covered work.  These actions infringe copyright if you do
+not accept this License.  Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+  10. Automatic Licensing of Downstream Recipients.
+
+  Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License.  You are not responsible
+for enforcing compliance by third parties with this License.
+
+  An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations.  If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+  You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License.  For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+  11. Patents.
+
+  A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based.  The
+work thus licensed is called the contributor's "contributor version".
+
+  A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version.  For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+  Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+  In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement).  To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+  If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients.  "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+  If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+  A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License.  You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+  Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+  12. No Surrender of Others' Freedom.
+
+  If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all.  For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+  13. Use with the GNU Affero General Public License.
+
+  Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work.  The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+  14. Revised Versions of this License.
+
+  The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+  Each version is given a distinguishing version number.  If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation.  If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+  If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+  Later license versions may give you additional or different
+permissions.  However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+  15. Disclaimer of Warranty.
+
+  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. Limitation of Liability.
+
+  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+  17. Interpretation of Sections 15 and 16.
+
+  If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+                     END OF TERMS AND CONDITIONS
+
+            How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program 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 3 of the License, or
+    (at your option) any later version.
+
+    This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+  If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+    <program>  Copyright (C) <year>  <name of author>
+    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+  You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+  The GNU General Public License does not permit incorporating your program
+into proprietary programs.  If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.  But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
+
Index: tmp/org.txm.core/META-INF/TSTMANIFEST.MF
===================================================================
--- tmp/org.txm.core/META-INF/TSTMANIFEST.MF	(revision 0)
+++ tmp/org.txm.core/META-INF/TSTMANIFEST.MF	(revision 258)
@@ -0,0 +1,699 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Toolbox
+Bundle-SymbolicName: org.textometrie.toolbox;singleton:=true
+Bundle-Version: 0.5.0
+Bundle-Activator: org.textometrie.toolbox.Activator
+Require-Bundle: org.eclipse.core.runtime,
+ org.codehaus.groovy;bundle-version="1.7.0",
+ org.eclipse.osgi.util;bundle-version="3.2.0"
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Export-Package: EDU.oswego.cs.dl.util.concurrent,
+ EDU.oswego.cs.dl.util.concurrent.misc;uses:="EDU.oswego.cs.dl.util.concurrent,javax.swing,new EDU.oswego.cs.dl.util.concurrent.misc",
+ antlr;
+  uses:="antlr.collections.impl,
+   antlr.debug,
+   antlr.ASdebug,
+   antlr.collections",
+ antlr.ASdebug;uses:="antlr",
+ antlr.actions.cpp;uses:="antlr.collections.impl,antlr",
+ antlr.actions.csharp;uses:="antlr.collections.impl,antlr",
+ antlr.actions.java;uses:="antlr.collections.impl,antlr",
+ antlr.actions.python;uses:="antlr.collections.impl,antlr",
+ antlr.build,
+ antlr.collections;uses:="antlr",
+ antlr.collections.impl;uses:="antlr.collections,antlr",
+ antlr.debug;uses:="antlr.collections.impl,antlr",
+ antlr.debug.misc;
+  uses:="javax.swing.tree,
+   javax.swing,
+   antlr.collections,
+   javax.swing.event",
+ antlr.preprocessor;uses:="antlr.collections.impl,antlr",
+ cern.clhep,
+ cern.colt;uses:="cern.colt.list,cern.colt.function",
+ cern.colt.bitvector;uses:="cern.colt.function,cern.colt",
+ cern.colt.buffer;uses:="cern.colt.list,cern.colt",
+ cern.colt.function,
+ cern.colt.list;
+  uses:="cern.colt.buffer,
+   cern.colt.function,
+   cern.colt,
+   cern.colt.bitvector",
+ cern.colt.list.adapter;uses:="cern.colt.list",
+ cern.colt.map;uses:="cern.colt.list,cern.colt.function,cern.colt",
+ cern.colt.matrix;
+  uses:="cern.colt.list,
+   cern.colt.function,
+   cern.colt,
+   cern.colt.matrix.impl",
+ cern.colt.matrix.bench;
+  uses:="cern.colt.matrix,
+   cern.colt.function,
+   new cern.colt.matrix.bench,
+   cern.colt,
+   cern.colt.matrix.linalg",
+ cern.colt.matrix.doublealgo;
+  uses:="cern.jet.math,
+   hep.aida,
+   cern.colt.matrix,
+   hep.aida.bin,
+   cern.colt.function,
+   new cern.colt.matrix.doublealgo,
+   cern.colt,
+   cern.jet.random.engine,
+   cern.colt.matrix.impl",
+ cern.colt.matrix.impl;
+  uses:="cern.jet.math,
+   cern.colt.matrix,
+   cern.colt.list,
+   cern.colt.function,
+   cern.colt,
+   cern.jet.random.engine,
+   cern.colt.matrix.doublealgo,
+   cern.colt.map",
+ cern.colt.matrix.linalg;
+  uses:="EDU.oswego.cs.dl.util.concurrent,
+   cern.colt.matrix,
+   cern.colt.list,
+   cern.colt.function,
+   cern.colt",
+ cern.colt.matrix.objectalgo;
+  uses:="cern.colt.matrix,
+   cern.colt.function,
+   cern.colt,
+   cern.colt.matrix.impl",
+ cern.jet.math;uses:="cern.colt.function",
+ cern.jet.random;uses:="cern.colt.function,cern.colt,cern.jet.random.engine",
+ cern.jet.random.engine;uses:="cern.colt.function,cern.colt",
+ cern.jet.random.sampling;uses:="cern.jet.random,cern.colt,cern.jet.random.engine",
+ cern.jet.stat;uses:="cern.jet.math,cern.colt.list",
+ cern.jet.stat.quantile;
+  uses:="cern.jet.random.sampling,
+   cern.colt.list,
+   cern.colt.function,
+   cern.colt,
+   cern.jet.random.engine",
+ corejava,
+ hep.aida,
+ hep.aida.bin;
+  uses:="cern.jet.stat.quantile,
+   hep.aida,
+   cern.colt.buffer,
+   cern.colt.list,
+   cern.colt.function,
+   cern.colt,
+   cern.jet.random.engine",
+ hep.aida.ref;uses:="hep.aida,cern.colt.matrix.impl",
+ images,
+ javax.xml.xquery;
+  uses:="javax.xml.stream,
+   javax.xml.transform,
+   org.w3c.dom,
+   org.xml.sax,
+   javax.xml.namespace",
+ jline,
+ junit.extensions;uses:="junit.framework",
+ junit.framework;uses:="org.junit.runner.manipulation,org.junit.runner,org.junit.runner.notification",
+ junit.runner;uses:="junit.framework",
+ junit.textui;uses:="junit.framework,junit.runner",
+ net.sf.saxon;
+  uses:="net.sf.saxon.trace,
+   net.sf.saxon.value,
+   net.sf.saxon.functions,
+   net.sf.saxon.style,
+   net.sf.saxon.trans,
+   net.sf.saxon.tree,
+   net.sf.saxon.expr,
+   net.sf.saxon.number,
+   org.xml.sax,
+   net.sf.saxon.query,
+   net.sf.saxon.charcode,
+   javax.xml.transform,
+   net.sf.saxon.event,
+   javax.xml.transform.stream,
+   net.sf.saxon.om,
+   net.sf.saxon.instruct,
+   javax.xml.transform.sax,
+   net.sf.saxon.type,
+   net.sf.saxon.sort",
+ net.sf.saxon.charcode;uses:="net.sf.saxon.sort",
+ net.sf.saxon.codenorm;uses:="net.sf.saxon.sort",
+ net.sf.saxon.dom;
+  uses:="net.sf.saxon.value,
+   javax.xml.parsers,
+   net.sf.saxon.expr,
+   org.w3c.dom,
+   net.sf.saxon,
+   org.xml.sax,
+   javax.xml.transform,
+   net.sf.saxon.event,
+   net.sf.saxon.pattern,
+   net.sf.saxon.om,
+   net.sf.saxon.type",
+ net.sf.saxon.event;
+  uses:="net.sf.saxon.trace,
+   net.sf.saxon.trans,
+   net.sf.saxon.expr,
+   net.sf.saxon,
+   org.xml.sax,
+   org.xml.sax.ext,
+   net.sf.saxon.charcode,
+   javax.xml.transform,
+   javax.xml.transform.stream,
+   net.sf.saxon.om,
+   net.sf.saxon.type,
+   net.sf.saxon.sort",
+ net.sf.saxon.evpull;
+  uses:="javax.xml.stream,
+   javax.xml.transform,
+   net.sf.saxon.event,
+   net.sf.saxon.om,
+   net.sf.saxon.expr,
+   net.sf.saxon,
+   javax.xml.namespace",
+ net.sf.saxon.expr;
+  uses:="net.sf.saxon.trace,
+   net.sf.saxon.value,
+   net.sf.saxon.functions,
+   net.sf.saxon.trans,
+   net.sf.saxon.evpull,
+   net.sf.saxon,
+   org.xml.sax,
+   net.sf.saxon.regex,
+   net.sf.saxon.event,
+   javax.xml.transform,
+   net.sf.saxon.pattern,
+   new net.sf.saxon.expr,
+   net.sf.saxon.om,
+   net.sf.saxon.instruct,
+   net.sf.saxon.type,
+   net.sf.saxon.sort",
+ net.sf.saxon.functions;
+  uses:="net.sf.saxon.value,
+   net.sf.saxon.trans,
+   net.sf.saxon.expr,
+   net.sf.saxon,
+   org.xml.sax,
+   net.sf.saxon.query,
+   net.sf.saxon.regex,
+   javax.xml.transform,
+   net.sf.saxon.event,
+   net.sf.saxon.om,
+   net.sf.saxon.instruct,
+   net.sf.saxon.type,
+   net.sf.saxon.sort",
+ net.sf.saxon.instruct;
+  uses:="net.sf.saxon.trace,
+   net.sf.saxon.value,
+   net.sf.saxon.functions,
+   net.sf.saxon.trans,
+   net.sf.saxon.expr,
+   net.sf.saxon,
+   net.sf.saxon.evpull,
+   net.sf.saxon.number,
+   net.sf.saxon.query,
+   net.sf.saxon.regex,
+   javax.xml.transform,
+   net.sf.saxon.event,
+   net.sf.saxon.pattern,
+   net.sf.saxon.om,
+   net.sf.saxon.type,
+   net.sf.saxon.sort",
+ net.sf.saxon.java;
+  uses:="net.sf.saxon.functions,
+   javax.xml.transform,
+   net.sf.saxon.event,
+   javax.xml.transform.stream,
+   net.sf.saxon.type,
+   net.sf.saxon,
+   org.xml.sax,
+   net.sf.saxon.sort",
+ net.sf.saxon.number;uses:="net.sf.saxon.value,net.sf.saxon.om",
+ net.sf.saxon.om;
+  uses:="net.sf.saxon.value,
+   net.sf.saxon.expr,
+   net.sf.saxon.evpull,
+   net.sf.saxon,
+   javax.xml.namespace,
+   org.xml.sax,
+   net.sf.saxon.event,
+   javax.xml.transform,
+   net.sf.saxon.pattern,
+   net.sf.saxon.type,
+   org.xml.sax.helpers,
+   net.sf.saxon.sort,
+   net.sf.saxon.tinytree",
+ net.sf.saxon.pattern;
+  uses:="net.sf.saxon.trace,
+   net.sf.saxon.expr,
+   net.sf.saxon,
+   net.sf.saxon.event,
+   net.sf.saxon.om,
+   net.sf.saxon.instruct,
+   net.sf.saxon.type,
+   net.sf.saxon.tinytree,
+   net.sf.saxon.sort",
+ net.sf.saxon.pull;
+  uses:="javax.xml.stream,
+   net.sf.saxon.value,
+   javax.xml.transform,
+   net.sf.saxon.event,
+   net.sf.saxon.om,
+   net.sf.saxon.expr,
+   javax.xml.namespace",
+ net.sf.saxon.query;
+  uses:="net.sf.saxon.trace,
+   net.sf.saxon.value,
+   net.sf.saxon.functions,
+   net.sf.saxon.trans,
+   net.sf.saxon.expr,
+   net.sf.saxon.evpull,
+   net.sf.saxon,
+   net.sf.saxon.event,
+   javax.xml.transform,
+   javax.xml.transform.stream,
+   net.sf.saxon.om,
+   net.sf.saxon.instruct,
+   net.sf.saxon.type,
+   net.sf.saxon.sort",
+ net.sf.saxon.regex;uses:="net.sf.saxon.om,net.sf.saxon.sort",
+ net.sf.saxon.s9api;
+  uses:="net.sf.saxon.sxpath,
+   net.sf.saxon.trace,
+   net.sf.saxon.value,
+   net.sf.saxon.functions,
+   net.sf.saxon.expr,
+   org.w3c.dom,
+   net.sf.saxon,
+   javax.xml.namespace,
+   org.xml.sax,
+   net.sf.saxon.query,
+   net.sf.saxon.event,
+   javax.xml.transform,
+   net.sf.saxon.om,
+   net.sf.saxon.type",
+ net.sf.saxon.sort;
+  uses:="net.sf.saxon.trace,
+   net.sf.saxon.value,
+   net.sf.saxon.expr,
+   net.sf.saxon,
+   net.sf.saxon.pattern,
+   net.sf.saxon.om,
+   net.sf.saxon.instruct,
+   net.sf.saxon.type",
+ net.sf.saxon.style;
+  uses:="net.sf.saxon.sxpath,
+   net.sf.saxon.trace,
+   net.sf.saxon.value,
+   net.sf.saxon.functions,
+   net.sf.saxon.trans,
+   net.sf.saxon.tree,
+   net.sf.saxon.expr,
+   net.sf.saxon,
+   org.xml.sax,
+   net.sf.saxon.query,
+   net.sf.saxon.event,
+   javax.xml.transform,
+   net.sf.saxon.pattern,
+   net.sf.saxon.om,
+   net.sf.saxon.instruct,
+   net.sf.saxon.type,
+   net.sf.saxon.sort",
+ net.sf.saxon.sxpath;
+  uses:="net.sf.saxon.value,
+   net.sf.saxon.functions,
+   net.sf.saxon.trans,
+   net.sf.saxon.expr,
+   net.sf.saxon,
+   javax.xml.transform,
+   net.sf.saxon.event,
+   net.sf.saxon.om,
+   net.sf.saxon.instruct,
+   net.sf.saxon.type,
+   net.sf.saxon.sort",
+ net.sf.saxon.tinytree;
+  uses:="net.sf.saxon.value,
+   javax.xml.transform,
+   net.sf.saxon.event,
+   net.sf.saxon.pattern,
+   net.sf.saxon.om,
+   net.sf.saxon.evpull,
+   net.sf.saxon,
+   net.sf.saxon.sort",
+ net.sf.saxon.trace;
+  uses:="net.sf.saxon.event,
+   net.sf.saxon.om,
+   net.sf.saxon.type,
+   net.sf.saxon.expr,
+   net.sf.saxon",
+ net.sf.saxon.trans;
+  uses:="net.sf.saxon.trace,
+   net.sf.saxon.value,
+   net.sf.saxon.expr,
+   net.sf.saxon,
+   net.sf.saxon.number,
+   javax.xml.transform,
+   net.sf.saxon.pattern,
+   net.sf.saxon.om,
+   net.sf.saxon.instruct,
+   net.sf.saxon.type,
+   net.sf.saxon.sort",
+ net.sf.saxon.tree;
+  uses:="net.sf.saxon.value,
+   javax.xml.transform,
+   net.sf.saxon.event,
+   net.sf.saxon.pattern,
+   net.sf.saxon.om,
+   net.sf.saxon",
+ net.sf.saxon.type;
+  uses:="net.sf.saxon.value,
+   javax.xml.transform,
+   net.sf.saxon.pattern,
+   net.sf.saxon.trans,
+   net.sf.saxon.om,
+   net.sf.saxon.expr,
+   net.sf.saxon,
+   org.xml.sax,
+   net.sf.saxon.sort",
+ net.sf.saxon.value;
+  uses:="net.sf.saxon.expr,
+   net.sf.saxon,
+   javax.xml.namespace,
+   javax.xml.transform,
+   net.sf.saxon.event,
+   net.sf.saxon.pattern,
+   net.sf.saxon.om,
+   net.sf.saxon.type,
+   net.sf.saxon.sort",
+ net.sf.saxon.xpath;
+  uses:="net.sf.saxon.sxpath,
+   net.sf.saxon.value,
+   net.sf.saxon.functions,
+   net.sf.saxon.expr,
+   net.sf.saxon,
+   javax.xml.namespace,
+   org.xml.sax,
+   javax.xml.xpath,
+   javax.xml.transform,
+   net.sf.saxon.om,
+   net.sf.saxon.instruct,
+   net.sf.saxon.type,
+   net.sf.saxon.sort",
+ net.sf.saxon.xqj;
+  uses:="net.sf.saxon.value,
+   net.sf.saxon.functions,
+   org.w3c.dom,
+   net.sf.saxon,
+   org.xml.sax,
+   javax.xml.namespace,
+   javax.xml.datatype,
+   javax.xml.stream,
+   net.sf.saxon.query,
+   javax.xml.transform,
+   net.sf.saxon.om,
+   javax.xml.xquery,
+   net.sf.saxon.type",
+ org.apache.commons.cli,
+ org.apache.commons.io;uses:="org.apache.commons.io.filefilter",
+ org.apache.commons.io.comparator;uses:="org.apache.commons.io",
+ org.apache.commons.io.filefilter;uses:="org.apache.commons.io",
+ org.apache.commons.io.input,
+ org.apache.commons.io.output,
+ org.apache.commons.lang;uses:="org.apache.commons.lang.exception",
+ org.apache.commons.lang.builder,
+ org.apache.commons.lang.enums,
+ org.apache.commons.lang.exception,
+ org.apache.commons.lang.math,
+ org.apache.commons.lang.mutable,
+ org.apache.commons.lang.text,
+ org.apache.commons.lang.time,
+ org.apache.log4j;uses:="org.apache.log4j.helpers,org.apache.log4j.or,org.apache.log4j.spi",
+ org.apache.log4j.chainsaw;
+  uses:="org.apache.log4j,
+   javax.swing,
+   javax.swing.table,
+   org.apache.log4j.spi,
+   javax.swing.event,
+   org.xml.sax.helpers,
+   org.xml.sax",
+ org.apache.log4j.config;uses:="org.apache.log4j",
+ org.apache.log4j.helpers;uses:="org.apache.log4j,org.apache.log4j.spi",
+ org.apache.log4j.jdbc;uses:="org.apache.log4j,org.apache.log4j.spi",
+ org.apache.log4j.jmx;uses:="org.apache.log4j,org.apache.log4j.spi,javax.management",
+ org.apache.log4j.lf5;uses:="org.apache.log4j.lf5.viewer,org.apache.log4j,org.apache.log4j.spi",
+ org.apache.log4j.lf5.config,
+ org.apache.log4j.lf5.util;uses:="org.apache.log4j.lf5.viewer,org.apache.log4j.lf5",
+ org.apache.log4j.lf5.viewer;
+  uses:="org.apache.log4j.lf5.util,
+   org.apache.log4j.lf5.viewer.categoryexplorer,
+   org.apache.log4j.lf5,
+   javax.swing,
+   javax.swing.table,
+   javax.swing.event,
+   org.apache.log4j.lf5.viewer.configure",
+ org.apache.log4j.lf5.viewer.categoryexplorer;
+  uses:="org.apache.log4j.lf5,
+   javax.swing.tree,
+   javax.swing,
+   javax.swing.table,
+   javax.swing.event",
+ org.apache.log4j.lf5.viewer.configure;uses:="org.apache.log4j.lf5.viewer,javax.swing.tree,org.w3c.dom",
+ org.apache.log4j.lf5.viewer.images,
+ org.apache.log4j.net;
+  uses:="javax.naming,
+   org.apache.log4j.helpers,
+   org.apache.log4j,
+   javax.jms,
+   javax.mail.internet,
+   org.apache.log4j.spi,
+   javax.mail",
+ org.apache.log4j.nt;uses:="org.apache.log4j,org.apache.log4j.spi",
+ org.apache.log4j.or;uses:="org.apache.log4j.spi",
+ org.apache.log4j.or.jms;uses:="org.apache.log4j.or",
+ org.apache.log4j.or.sax;uses:="org.apache.log4j.or",
+ org.apache.log4j.spi;uses:="org.apache.log4j,org.apache.log4j.or",
+ org.apache.log4j.varia;uses:="org.apache.log4j,org.apache.log4j.spi",
+ org.apache.log4j.xml;
+  uses:="org.apache.log4j.config,
+   org.apache.log4j.helpers,
+   org.apache.log4j,
+   org.apache.log4j.spi,
+   org.w3c.dom,
+   org.xml.sax",
+ org.apache.tools.ant;
+  uses:="org.apache.tools.ant.input,
+   org.apache.tools.ant.launch,
+   org.apache.tools.ant.types.selectors,
+   new org.apache.tools.ant,
+   org.xml.sax,
+   org.apache.tools.ant.types",
+ org.apache.tools.ant.dispatch;uses:="org.apache.tools.ant",
+ org.apache.tools.ant.filters;uses:="org.apache.tools.ant.util,org.apache.tools.ant.types,org.apache.tools.ant",
+ org.apache.tools.ant.filters.util;uses:="org.apache.tools.ant",
+ org.apache.tools.ant.helper;
+  uses:="org.apache.tools.ant.util,
+   org.apache.tools.ant,
+   org.xml.sax.helpers,
+   org.xml.sax",
+ org.apache.tools.ant.input,
+ org.apache.tools.ant.listener;uses:="org.apache.tools.ant",
+ org.apache.tools.ant.loader;uses:="org.apache.tools.ant",
+ org.apache.tools.ant.taskdefs;
+  uses:="org.apache.tools.ant.util.facade,
+   org.apache.tools.ant.input,
+   org.apache.tools.tar,
+   org.apache.tools.ant.types.selectors.modifiedselector,
+   org.apache.tools.zip,
+   org.apache.tools.ant.types.spi,
+   org.apache.tools.ant,
+   org.apache.tools.ant.types.selectors,
+   org.w3c.dom,
+   org.xml.sax,
+   org.apache.tools.ant.types.resources.selectors,
+   org.apache.tools.ant.types.resources,
+   org.apache.tools.ant.util,
+   org.apache.tools.ant.filters,
+   org.apache.tools.ant.taskdefs.condition,
+   org.apache.tools.ant.taskdefs.email,
+   org.apache.tools.ant.types",
+ org.apache.tools.ant.taskdefs.compilers;uses:="org.apache.tools.ant.types,org.apache.tools.ant.taskdefs,org.apache.tools.ant",
+ org.apache.tools.ant.taskdefs.condition;
+  uses:="org.apache.tools.ant.types,
+   org.apache.tools.ant.taskdefs,
+   org.apache.tools.ant.types.selectors,
+   org.apache.tools.ant",
+ org.apache.tools.ant.taskdefs.cvslib;uses:="org.apache.tools.ant.util,org.apache.tools.ant.taskdefs,org.apache.tools.ant.types",
+ org.apache.tools.ant.taskdefs.email;uses:="org.apache.tools.ant.types,org.apache.tools.ant",
+ org.apache.tools.ant.taskdefs.rmic;
+  uses:="org.apache.tools.ant.util,
+   org.apache.tools.ant.types,
+   org.apache.tools.ant.taskdefs,
+   org.apache.tools.ant",
+ org.apache.tools.ant.types;
+  uses:="org.apache.tools.ant.types.selectors.modifiedselector,
+   org.apache.tools.ant.taskdefs,
+   org.apache.tools.ant,
+   org.apache.tools.ant.types.selectors,
+   org.xml.sax,
+   org.apache.tools.ant.util,
+   javax.xml.transform,
+   org.apache.tools.ant.filters,
+   org.apache.tools.ant.util.regexp",
+ org.apache.tools.ant.types.conditions,
+ org.apache.tools.ant.types.mappers;uses:="org.apache.tools.ant.util,org.apache.tools.ant.types",
+ org.apache.tools.ant.types.resources;
+  uses:="org.apache.tools.tar,
+   org.apache.tools.zip,
+   org.apache.tools.ant.types.resources.comparators,
+   org.apache.tools.ant,
+   org.apache.tools.ant.types.selectors,
+   org.apache.tools.ant.types.resources.selectors,
+   org.apache.tools.ant.util,
+   org.apache.tools.ant.types",
+ org.apache.tools.ant.types.resources.comparators;uses:="org.apache.tools.ant.types,org.apache.tools.ant",
+ org.apache.tools.ant.types.resources.selectors;uses:="org.apache.tools.ant.types.resources.comparators,org.apache.tools.ant.types,org.apache.tools.ant",
+ org.apache.tools.ant.types.selectors;
+  uses:="org.apache.tools.ant.types.resources.selectors,
+   org.apache.tools.ant.util,
+   org.apache.tools.ant.types.selectors.modifiedselector,
+   org.apache.tools.ant.types,
+   org.apache.tools.ant",
+ org.apache.tools.ant.types.selectors.modifiedselector;
+  uses:="org.apache.tools.ant.types.resources.selectors,
+   org.apache.tools.ant.types,
+   org.apache.tools.ant.types.selectors,
+   org.apache.tools.ant",
+ org.apache.tools.ant.types.spi;uses:="org.apache.tools.ant",
+ org.apache.tools.ant.util;
+  uses:="javax.xml.parsers,
+   org.apache.tools.ant,
+   org.w3c.dom,
+   org.xml.sax,
+   org.apache.tools.ant.types.resources,
+   org.apache.tools.ant.types.resources.selectors,
+   org.apache.tools.ant.types,
+   org.apache.tools.ant.util.regexp",
+ org.apache.tools.ant.util.facade;uses:="org.apache.tools.ant.types",
+ org.apache.tools.ant.util.regexp;uses:="org.apache.tools.ant",
+ org.apache.tools.bzip2,
+ org.apache.tools.mail,
+ org.apache.tools.tar,
+ org.apache.tools.zip,
+ org.hamcrest,
+ org.hamcrest.core;uses:="org.hamcrest",
+ org.hamcrest.internal;x-internal:=true,
+ org.junit;uses:="org.hamcrest",
+ org.junit.experimental.results;uses:="org.junit.internal.matchers,org.junit.runner,org.hamcrest",
+ org.junit.experimental.runners;uses:="org.junit.runners,org.junit.runners.model",
+ org.junit.experimental.theories;
+  uses:="org.junit.experimental.theories.internal,
+   org.junit.internal,
+   org.junit.runners,
+   org.junit.runners.model,
+   new org.junit.experimental.theories",
+ org.junit.experimental.theories.internal;x-internal:=true,
+ org.junit.experimental.theories.suppliers;uses:="org.junit.experimental.theories",
+ org.junit.internal;x-internal:=true,
+ org.junit.internal.builders;x-internal:=true,
+ org.junit.internal.matchers;x-internal:=true,
+ org.junit.internal.requests;x-internal:=true,
+ org.junit.internal.runners;x-internal:=true,
+ org.junit.internal.runners.model;x-internal:=true,
+ org.junit.internal.runners.statements;x-internal:=true,
+ org.junit.matchers;uses:="org.junit.internal.matchers,org.hamcrest",
+ org.junit.runner;
+  uses:="org.junit.runner.manipulation,
+   junit.framework,
+   org.junit.internal,
+   org.junit.runner.notification",
+ org.junit.runner.manipulation;uses:="org.junit.runner",
+ org.junit.runner.notification;uses:="org.junit.runner",
+ org.junit.runners;
+  uses:="org.junit.runner.manipulation,
+   org.junit.runner,
+   org.junit.internal.runners,
+   org.junit.runners.model,
+   org.junit.runner.notification,
+   org.junit.internal.runners.model",
+ org.junit.runners.model;uses:="org.junit.runner,org.junit.internal.runners.model",
+ org.objectweb.asm.tree;uses:="org.objectweb.asm",
+ org.objectweb.asm.tree.analysis;uses:="org.objectweb.asm,org.objectweb.asm.tree",
+ org.rosuda.REngine,
+ org.rosuda.REngine.Rserve;uses:="org.rosuda.REngine.Rserve.protocol,org.rosuda.REngine",
+ org.rosuda.REngine.Rserve.protocol;uses:="org.rosuda.REngine",
+ org.textometrie,
+ org.textometrie.export,
+ org.textometrie.functions,
+ org.textometrie.functions.ca;uses:="org.textometrie.searchengine.cqp.corpus",
+ org.textometrie.functions.concordances;
+  uses:="org.textometrie.searchengine.cqp.corpus,
+   org.textometrie.searchengine.cqp.corpus.query,
+   org.textometrie.utils.logger,
+   org.textometrie.functions.concordances.comparators",
+ org.textometrie.functions.concordances.comparators;uses:="org.textometrie.functions.concordances,org.textometrie.searchengine.cqp.corpus",
+ org.textometrie.functions.cooccurrences,
+ org.textometrie.functions.cooccurrences.comparators,
+ org.textometrie.functions.diagnostic,
+ org.textometrie.functions.referencer,
+ org.textometrie.functions.progression,
+ org.textometrie.functions.specificities;uses:="org.textometrie.stat.data,org.textometrie.searchengine.cqp.corpus,org.textometrie.utils.logger",
+ org.textometrie.functions.index,
+ org.textometrie.importer,
+ org.textometrie.objects;uses:="org.w3c.dom",
+ org.textometrie.searchengine,
+ org.textometrie.searchengine.cqp;uses:="org.textometrie.utils.logger",
+ org.textometrie.searchengine.cqp.clientExceptions,
+ org.textometrie.searchengine.cqp.corpus;
+  uses:="org.textometrie.stat.data,
+   org.textometrie.searchengine.cqp,
+   org.textometrie.searchengine.cqp.corpus.query,
+   org.textometrie.utils.logger",
+ org.textometrie.searchengine.cqp.corpus.query;uses:="org.textometrie.searchengine.cqp.corpus,org.textometrie.utils.logger",
+ org.textometrie.searchengine.cqp.serverException,
+ org.textometrie.stat,
+ org.textometrie.stat.data;uses:="org.textometrie.searchengine.cqp.corpus",
+ org.textometrie.stat.engine.r;
+  uses:="org.textometrie.searchengine.cqp.corpus,
+   cern.colt.matrix,
+   cern.colt.list,
+   org.textometrie.stat,
+   org.rosuda.REngine,
+   org.textometrie.utils.logger",
+ org.textometrie.stat.engine.r.data;
+  uses:="org.textometrie.stat.data,
+   org.textometrie.searchengine.cqp.corpus,
+   cern.colt.matrix,
+   org.textometrie.stat.engine.r,
+   org.rosuda.REngine,
+   org.textometrie.utils.logger",
+ org.textometrie.stat.engine.r.function;uses:="org.textometrie.stat.data,org.textometrie.utils.logger",
+ org.textometrie.stat.engine.r.rcolt;uses:="cern.colt.matrix,cern.colt.function",
+ org.textometrie.stat.utils,
+ org.textometrie.test,
+ org.textometrie.tokenizer,
+ org.textometrie.toolbox;uses:="org.eclipse.core.runtime,org.osgi.framework",
+ org.textometrie.utils,
+ org.textometrie.utils.i18n,
+ org.textometrie.utils.logger;uses:="org.textometrie.utils.i18n",
+ org.textometrie.utils.processbuilder,
+ org.textometrie.utils.tostring,
+ org.textometrie.utils.treetagger
+Bundle-ClassPath: .,
+ lib/ant-1.7.1.jar,
+ lib/antlr-2.7.7.jar,
+ lib/asm-analysis-2.2.3.jar,
+ lib/asm-tree-2.2.3.jar,
+ lib/colt-1.2.0.jar,
+ lib/commons-cli-1.2.jar,
+ lib/commons-io-1.4.jar,
+ lib/commons-lang-2.4.jar,
+ lib/concurrent-1.3.4.jar,
+ lib/hsqldb.jar,
+ lib/jline-0.9.94.jar,
+ lib/junit-4.5.jar,
+ lib/log4j-1.2.12.jar,
+ lib/REngine.jar,
+ lib/RserveEngine.jar,
+ lib/saxon-xom-9.2.jar

Property changes on: tmp/org.txm.core/META-INF/TSTMANIFEST.MF
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/META-INF/persistence.xml
===================================================================
--- tmp/org.txm.core/META-INF/persistence.xml	(revision 0)
+++ tmp/org.txm.core/META-INF/persistence.xml	(revision 258)
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<persistence version="2.0" 
+	xmlns="http://java.sun.com/xml/ns/persistence" 
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">	
+		<persistence-unit name="MyPUWithHSQL" transaction-type="RESOURCE_LOCAL">
+		<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
+		
+		<class>org.txm.annotation.Annotation</class>
+		<class>org.txm.annotation.repository.AnnotationType</class>
+		<class>org.txm.annotation.repository.TypedValue</class>
+<!--	<class>org.txm.functions.dictionary_jpa.EntryId</class>
+		<class>org.txm.functions.dictionary_jpa.EntryProperty</class>
+		<class>org.txm.functions.dictionary_jpa.EntryPropertyType</class>-->
+		<properties>
+			<property name="javax.persistence.jdbc.driver" value="org.hsqldb.jdbcDriver"/>
+			<property name="javax.persistence.jdbc.url" value="jdbc:hsqldb:file:txmdb/db;shutdown=true;hsqldb.write_delay=false;hsqldb.lock_file=false;hsqldb.applog=0;hsqldb.sqllog=0"/>
+			<property name="javax.persistence.jdbc.user" value="SA"/>
+			
+			<property name="eclipselink.logging.parameters" value="false"/>
+ 			<property name="eclipselink.logging.level" value="OFF" />
+ 			
+<!-- 			<property name="eclipselink.jdbc.read-connections.min" value="1" />
+			<property name="eclipselink.jdbc.write-connections.min" value="1" />
+			<property name="eclipselink.jdbc.batch-writing" value="JDBC" />
+  -->
+			<!-- Logging 
+			<property name="eclipselink.logging.file" value="output.log"/>
+			<property name="eclipselink.logging.logger" value="JavaLogger"/>
+			-->
+		
+<!-- 		<property name="eclipselink.logging.level" value="FINE" />
+			<property name="eclipselink.logging.timestamp" value="false" />
+			<property name="eclipselink.logging.session" value="false" />
+			<property name="eclipselink.logging.thread" value="false" /> -->
+			
+			<!-- <property name="eclipselink.ddl-generation" value="drop-and-create-tables"/> -->
+			<!-- <property name="eclipselink.ddl-generation.output-mode" value="database"/> -->
+		</properties>
+ 
+	</persistence-unit>
+</persistence>
\ No newline at end of file

Property changes on: tmp/org.txm.core/META-INF/persistence.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/META-INF/MANIFEST.MF
===================================================================
--- tmp/org.txm.core/META-INF/MANIFEST.MF	(revision 0)
+++ tmp/org.txm.core/META-INF/MANIFEST.MF	(revision 258)
@@ -0,0 +1,418 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Toolbox
+Bundle-SymbolicName: org.txm.core;singleton:=true
+Bundle-Version: 0.7.0.qualifier
+Bundle-Activator: org.txm.toolbox.Activator
+Require-Bundle: org.eclipse.core.runtime,
+ org.txm.statsengine.r.core;bundle-version="1.0.0";visibility:=reexport,
+ org.eclipse.osgi.util;bundle-version="3.2.0",
+ org.txm.lexicon.core;bundle-version="1.0.0",
+ org.eclipse.core.net,
+ org.eclipse.osgi,
+ groovy-all;bundle-version="1.0.0",
+ org.eclipse.persistence.jpa;bundle-version="2.6.0",
+ javax.persistence;bundle-version="2.1.0",
+ org.eclipse.persistence.jpa.jpql;bundle-version="2.6.0",
+ org.txm.utils;bundle-version="1.0.0";visibility:=reexport
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Export-Package: EDU.oswego.cs.dl.util.concurrent,
+ EDU.oswego.cs.dl.util.concurrent.misc,
+ antlr,
+ antlr.ASdebug,
+ antlr.actions.cpp,
+ antlr.actions.csharp,
+ antlr.actions.java,
+ antlr.actions.python,
+ antlr.build,
+ antlr.collections,
+ antlr.collections.impl,
+ antlr.debug,
+ antlr.debug.misc,
+ antlr.preprocessor,
+ cern.clhep,
+ cern.colt,
+ cern.colt.bitvector,
+ cern.colt.buffer,
+ cern.colt.function,
+ cern.colt.list,
+ cern.colt.list.adapter,
+ cern.colt.map,
+ cern.colt.matrix,
+ cern.colt.matrix.bench,
+ cern.colt.matrix.doublealgo,
+ cern.colt.matrix.impl,
+ cern.colt.matrix.linalg,
+ cern.colt.matrix.objectalgo,
+ cern.jet.math,
+ cern.jet.random,
+ cern.jet.random.engine,
+ cern.jet.random.sampling,
+ cern.jet.stat,
+ cern.jet.stat.quantile,
+ ch.randelshofer.quaqua,
+ ch.randelshofer.quaqua.border,
+ ch.randelshofer.quaqua.color,
+ ch.randelshofer.quaqua.colorchooser,
+ ch.randelshofer.quaqua.datatransfer,
+ ch.randelshofer.quaqua.ext.base64,
+ ch.randelshofer.quaqua.ext.batik.ext.awt,
+ ch.randelshofer.quaqua.ext.batik.ext.awt.image,
+ ch.randelshofer.quaqua.ext.batik.ext.awt.image.codec.tiff,
+ ch.randelshofer.quaqua.ext.batik.ext.awt.image.codec.util,
+ ch.randelshofer.quaqua.ext.batik.ext.awt.image.renderable,
+ ch.randelshofer.quaqua.ext.batik.ext.awt.image.rendered,
+ ch.randelshofer.quaqua.ext.batik.i18n,
+ ch.randelshofer.quaqua.ext.batik.util,
+ ch.randelshofer.quaqua.ext.nanoxml,
+ ch.randelshofer.quaqua.filechooser,
+ ch.randelshofer.quaqua.icon,
+ ch.randelshofer.quaqua.jaguar,
+ ch.randelshofer.quaqua.jaguar.filechooser,
+ ch.randelshofer.quaqua.leopard,
+ ch.randelshofer.quaqua.leopard.filechooser,
+ ch.randelshofer.quaqua.osx,
+ ch.randelshofer.quaqua.panther,
+ ch.randelshofer.quaqua.panther.filechooser,
+ ch.randelshofer.quaqua.subset,
+ ch.randelshofer.quaqua.tiger,
+ ch.randelshofer.quaqua.tiger.filechooser,
+ ch.randelshofer.quaqua.util,
+ com.birosoft.liquid,
+ com.birosoft.liquid.borders,
+ com.birosoft.liquid.skin,
+ com.jgoodies.forms.builder,
+ com.jgoodies.forms.debug,
+ com.jgoodies.forms.factories,
+ com.jgoodies.forms.layout,
+ com.jgoodies.forms.util,
+ com.jgoodies.looks,
+ com.jgoodies.looks.common,
+ com.jgoodies.looks.plastic,
+ com.jgoodies.looks.plastic.theme,
+ com.jgoodies.looks.windows,
+ corejava,
+ filters.BuildXmlLiturgie,
+ filters.Concatenator,
+ filters.CutHeader,
+ filters.EliminateWhiteSpaces,
+ filters.FusionHeader,
+ filters.FusionXmlHeaderBody,
+ filters.MinimalFilter,
+ filters.OneOpenTagPerLine,
+ filters.OneTagPerLine,
+ filters.ProcessEnclitics,
+ filters.ProcessQuotes,
+ filters.RegexFilter,
+ filters.ReunitBrokenTags,
+ filters.ReunitBrokenWords,
+ filters.TagSentences,
+ filters.Tokeniser,
+ filters.WordInternalElement,
+ filters.eliminateNAttributes,
+ hep.aida,
+ hep.aida.bin,
+ hep.aida.ref,
+ jline,
+ junit.extensions,
+ junit.framework,
+ junit.runner,
+ junit.textui,
+ org.apache.log4j,
+ org.apache.log4j.chainsaw,
+ org.apache.log4j.config,
+ org.apache.log4j.helpers,
+ org.apache.log4j.jdbc,
+ org.apache.log4j.jmx,
+ org.apache.log4j.lf5,
+ org.apache.log4j.lf5.util,
+ org.apache.log4j.lf5.viewer,
+ org.apache.log4j.lf5.viewer.categoryexplorer,
+ org.apache.log4j.lf5.viewer.configure,
+ org.apache.log4j.net,
+ org.apache.log4j.nt,
+ org.apache.log4j.or,
+ org.apache.log4j.or.jms,
+ org.apache.log4j.or.sax,
+ org.apache.log4j.spi,
+ org.apache.log4j.varia,
+ org.apache.log4j.xml,
+ org.apache.tools.ant,
+ org.apache.tools.ant.dispatch,
+ org.apache.tools.ant.filters,
+ org.apache.tools.ant.filters.util,
+ org.apache.tools.ant.helper,
+ org.apache.tools.ant.input,
+ org.apache.tools.ant.launch,
+ org.apache.tools.ant.listener,
+ org.apache.tools.ant.loader,
+ org.apache.tools.ant.property,
+ org.apache.tools.ant.taskdefs,
+ org.apache.tools.ant.taskdefs.compilers,
+ org.apache.tools.ant.taskdefs.condition,
+ org.apache.tools.ant.taskdefs.cvslib,
+ org.apache.tools.ant.taskdefs.email,
+ org.apache.tools.ant.taskdefs.rmic,
+ org.apache.tools.ant.types,
+ org.apache.tools.ant.types.mappers,
+ org.apache.tools.ant.types.resources,
+ org.apache.tools.ant.types.resources.comparators,
+ org.apache.tools.ant.types.resources.selectors,
+ org.apache.tools.ant.types.selectors,
+ org.apache.tools.ant.types.selectors.modifiedselector,
+ org.apache.tools.ant.types.spi,
+ org.apache.tools.ant.util,
+ org.apache.tools.ant.util.facade,
+ org.apache.tools.ant.util.regexp,
+ org.apache.tools.bzip2,
+ org.apache.tools.mail,
+ org.apache.tools.tar,
+ org.apache.tools.zip,
+ org.artofsolving.jodconverter,
+ org.artofsolving.jodconverter.cli,
+ org.artofsolving.jodconverter.document,
+ org.artofsolving.jodconverter.office,
+ org.artofsolving.jodconverter.process,
+ org.artofsolving.jodconverter.util,
+ org.dom4j,
+ org.dom4j.bean,
+ org.dom4j.datatype,
+ org.dom4j.dom,
+ org.dom4j.dtd,
+ org.dom4j.io,
+ org.dom4j.jaxb,
+ org.dom4j.rule,
+ org.dom4j.rule.pattern,
+ org.dom4j.swing,
+ org.dom4j.tree,
+ org.dom4j.util,
+ org.dom4j.xpath,
+ org.dom4j.xpp,
+ org.hamcrest,
+ org.hamcrest.core,
+ org.hamcrest.internal,
+ org.hsqldb,
+ org.hsqldb.dbinfo,
+ org.hsqldb.error,
+ org.hsqldb.index,
+ org.hsqldb.jdbc,
+ org.hsqldb.jdbc.pool,
+ org.hsqldb.lib,
+ org.hsqldb.lib.java,
+ org.hsqldb.lib.tar,
+ org.hsqldb.navigator,
+ org.hsqldb.persist,
+ org.hsqldb.resources,
+ org.hsqldb.result,
+ org.hsqldb.rights,
+ org.hsqldb.rowio,
+ org.hsqldb.scriptio,
+ org.hsqldb.server,
+ org.hsqldb.types,
+ org.hsqldb.util,
+ org.jdesktop.layout,
+ org.junit,
+ org.junit.experimental.results,
+ org.junit.experimental.runners,
+ org.junit.experimental.theories,
+ org.junit.experimental.theories.internal,
+ org.junit.experimental.theories.suppliers,
+ org.junit.internal,
+ org.junit.internal.builders,
+ org.junit.internal.matchers,
+ org.junit.internal.requests,
+ org.junit.internal.runners,
+ org.junit.internal.runners.model,
+ org.junit.internal.runners.statements,
+ org.junit.matchers,
+ org.junit.runner,
+ org.junit.runner.manipulation,
+ org.junit.runner.notification,
+ org.junit.runners,
+ org.junit.runners.model,
+ org.knallgrau.utils.textcat,
+ org.kohsuke.args4j,
+ org.kohsuke.args4j.spi,
+ org.mozilla.universalchardet,
+ org.mozilla.universalchardet.prober,
+ org.mozilla.universalchardet.prober.contextanalysis,
+ org.mozilla.universalchardet.prober.distributionanalysis,
+ org.mozilla.universalchardet.prober.sequence,
+ org.mozilla.universalchardet.prober.statemachine,
+ org.objectweb.asm.tree,
+ org.objectweb.asm.tree.analysis,
+ org.postgresql,
+ org.postgresql.copy,
+ org.postgresql.core,
+ org.postgresql.core.v2,
+ org.postgresql.core.v3,
+ org.postgresql.ds,
+ org.postgresql.ds.common,
+ org.postgresql.fastpath,
+ org.postgresql.geometric,
+ org.postgresql.gss,
+ org.postgresql.hostchooser,
+ org.postgresql.jdbc,
+ org.postgresql.jdbc2,
+ org.postgresql.jdbc2.optional,
+ org.postgresql.jdbc3,
+ org.postgresql.largeobject,
+ org.postgresql.osgi,
+ org.postgresql.ssl,
+ org.postgresql.ssl.jdbc4,
+ org.postgresql.sspi,
+ org.postgresql.translation,
+ org.postgresql.util,
+ org.postgresql.xa,
+ org.rosuda.REngine,
+ org.rosuda.REngine.Rserve,
+ org.rosuda.REngine.Rserve.protocol,
+ org.sqlite,
+ org.sqlite.core,
+ org.sqlite.date,
+ org.sqlite.javax,
+ org.sqlite.jdbc3,
+ org.sqlite.jdbc4,
+ org.sqlite.util,
+ org.txm,
+ org.txm.annotation,
+ org.txm.annotation.conversion,
+ org.txm.annotation.repository,
+ org.txm.annotation.storage.temporary,
+ org.txm.annotation.temporary,
+ org.txm.ant,
+ org.txm.core.messages,
+ org.txm.core.preferences,
+ org.txm.core.results,
+ org.txm.core.results.comparators,
+ org.txm.export,
+ org.txm.export.conll2009,
+ org.txm.export.ts,
+ org.txm.functions,
+ org.txm.functions.concordances,
+ org.txm.functions.concordances.comparators,
+ org.txm.functions.diagnostic,
+ org.txm.functions.internal,
+ org.txm.functions.mesures,
+ org.txm.functions.parabrowser,
+ org.txm.functions.parallelcontexts,
+ org.txm.functions.preview,
+ org.txm.functions.referencer,
+ org.txm.functions.selection,
+ org.txm.functions.summary,
+ org.txm.importer,
+ org.txm.importer.RGAQCJ,
+ org.txm.importer.alceste,
+ org.txm.importer.bfm,
+ org.txm.importer.bvh,
+ org.txm.importer.corptef,
+ org.txm.importer.cwb,
+ org.txm.importer.discours,
+ org.txm.importer.doc,
+ org.txm.importer.factiva,
+ org.txm.importer.filters,
+ org.txm.importer.fleurs,
+ org.txm.importer.frantext,
+ org.txm.importer.graal,
+ org.txm.importer.hyperbase,
+ org.txm.importer.hyperprince,
+ org.txm.importer.lasla,
+ org.txm.importer.limsi,
+ org.txm.importer.perrault,
+ org.txm.importer.quick,
+ org.txm.importer.scripting,
+ org.txm.importer.teicmc,
+ org.txm.importer.tmx,
+ org.txm.importer.transcriber,
+ org.txm.importer.wtc,
+ org.txm.importer.xml,
+ org.txm.importer.xmltxm,
+ org.txm.importer.xmltxmpara,
+ org.txm.importer.xtz,
+ org.txm.macro.annotation,
+ org.txm.macro.commands,
+ org.txm.macro.cqp,
+ org.txm.macro.csv,
+ org.txm.macro.edition,
+ org.txm.macro.misc,
+ org.txm.macro.r,
+ org.txm.macro.stats,
+ org.txm.macro.text,
+ org.txm.macro.transcription,
+ org.txm.macro.txt,
+ org.txm.macro.xml,
+ org.txm.macro.xsl,
+ org.txm.macroproto,
+ org.txm.macroproto.edition,
+ org.txm.macroproto.export,
+ org.txm.macroproto.importer,
+ org.txm.macroproto.partition,
+ org.txm.macroproto.txt,
+ org.txm.metadatas,
+ org.txm.objects,
+ org.txm.scripts,
+ org.txm.scripts.clix,
+ org.txm.scripts.i18n,
+ org.txm.scripts.teitxm,
+ org.txm.scripts.tigersearch,
+ org.txm.searchengine.cqp,
+ org.txm.searchengine.cqp.clientExceptions,
+ org.txm.searchengine.cqp.corpus,
+ org.txm.searchengine.cqp.corpus.query,
+ org.txm.searchengine.cqp.serverException,
+ org.txm.setup,
+ org.txm.sql,
+ org.txm.stat.utils,
+ org.txm.svn,
+ org.txm.sw,
+ org.txm.tal,
+ org.txm.tal.melt,
+ org.txm.tal.stanford,
+ org.txm.test,
+ org.txm.tests,
+ org.txm.tokenizer,
+ org.txm.toolbox,
+ org.txm.utils,
+ org.w3c.tidy,
+ org.w3c.tidy.ant
+Bundle-ClassPath: .,
+ lib/ant-1.7.1.jar,
+ lib/ant-launcher.jar,
+ lib/ant.jar,
+ lib/antlr-2.7.7.jar,
+ lib/asm-analysis-2.2.3.jar,
+ lib/asm-tree-2.2.3.jar,
+ lib/colt-1.2.0.jar,
+ lib/concurrent-1.3.4.jar,
+ lib/dom4j-1.6.1.jar,
+ lib/forms-1.0.7.jar,
+ lib/jline-0.9.94.jar,
+ lib/junit-4.5.jar,
+ lib/jvectClipboard-1.2.jar,
+ lib/liquidlnf.jar,
+ lib/log4j-1.2.12.jar,
+ lib/looks-2.0.1.jar,
+ lib/macSpecific.jar,
+ lib/quaqua.jar,
+ lib/REngine.jar,
+ lib/RserveEngine.jar,
+ lib/rtfCleaner.jar,
+ lib/swing-layout-1.0.3.jar,
+ lib/juniversalchardet-1.0.3.jar,
+ lib/textcat-1.0.1.jar,
+ lib/saxon9he.jar,
+ lib/jtidy-r938.jar,
+ lib/json-20090211.jar,
+ lib/juh-3.2.1.jar,
+ lib/jurt-3.2.1.jar,
+ lib/ridl-3.2.1.jar,
+ lib/unoil-3.2.1.jar,
+ lib/hsqldb.jar,
+ bin/,
+ lib/sqlite-jdbc-3.8.11.2.jar,
+ lib/postgresql-9.4.1207.jre6.jar,
+ lib/jodconverter-core-3.1-beta.jar
+Bundle-ActivationPolicy: lazy
+Bundle-Vendor: Textometrie.org
+JPA-PersistenceUnits: MyPUWithHSQL
+Meta-Persistence: META-INF/persistence.xml

Property changes on: tmp/org.txm.core/META-INF/MANIFEST.MF
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/.groovy/suggestions.xdsl
===================================================================
--- tmp/org.txm.core/.groovy/suggestions.xdsl	(revision 0)
+++ tmp/org.txm.core/.groovy/suggestions.xdsl	(revision 258)
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<projectSuggestions/>
Index: tmp/org.txm.core/data.properties
===================================================================
--- tmp/org.txm.core/data.properties	(revision 0)
+++ tmp/org.txm.core/data.properties	(revision 258)
@@ -0,0 +1,4 @@
+#HSQL Database Engine 2.0.0
+#Mon Oct 19 18:27:18 CEST 2015
+version=2.0.0
+modified=yes

Property changes on: tmp/org.txm.core/data.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/lib/macSpecific.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.core/lib/macSpecific.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.core/lib/textcat-1.0.1.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.core/lib/textcat-1.0.1.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.core/lib/juniversalchardet-1.0.3.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.core/lib/juniversalchardet-1.0.3.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.core/lib/asm-tree-2.2.3.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.core/lib/asm-tree-2.2.3.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.core/lib/dom4j-1.6.1.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.core/lib/dom4j-1.6.1.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.core/lib/libquaqua.jnilib
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.core/lib/libquaqua.jnilib
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.core/lib/ant-launcher.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.core/lib/ant-launcher.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.core/lib/ant.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.core/lib/ant.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.core/lib/concurrent-1.3.4.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.core/lib/concurrent-1.3.4.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.core/lib/jurt-3.2.1.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.core/lib/jurt-3.2.1.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.core/lib/ant-1.7.1.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.core/lib/ant-1.7.1.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.core/lib/unoil-3.2.1.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.core/lib/unoil-3.2.1.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.core/lib/rtfCleaner.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.core/lib/rtfCleaner.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.core/lib/jtidy-r938.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.core/lib/jtidy-r938.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.core/lib/liquidlnf.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.core/lib/liquidlnf.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.core/lib/jvectClipboard-1.2.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.core/lib/jvectClipboard-1.2.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.core/lib/sqltool.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.core/lib/sqltool.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.core/lib/colt-1.2.0.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.core/lib/colt-1.2.0.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.core/lib/junit-4.5.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.core/lib/junit-4.5.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.core/lib/saxon9he.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.core/lib/saxon9he.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.core/lib/log4j-1.2.12.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.core/lib/log4j-1.2.12.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.core/lib/swing-layout-1.0.3.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.core/lib/swing-layout-1.0.3.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.core/lib/asm-analysis-2.2.3.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.core/lib/asm-analysis-2.2.3.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.core/lib/jodconverter-core-3.1-beta.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.core/lib/jodconverter-core-3.1-beta.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.core/lib/postgresql-9.4.1207.jre6.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.core/lib/postgresql-9.4.1207.jre6.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.core/lib/hsqldb.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.core/lib/hsqldb.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.core/lib/looks-2.0.1.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.core/lib/looks-2.0.1.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.core/lib/juh-3.2.1.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.core/lib/juh-3.2.1.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.core/lib/REngine.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.core/lib/REngine.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.core/lib/forms-1.0.7.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.core/lib/forms-1.0.7.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.core/lib/sqlite-jdbc-3.8.11.2.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.core/lib/sqlite-jdbc-3.8.11.2.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.core/lib/ridl-3.2.1.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.core/lib/ridl-3.2.1.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.core/lib/libquaqua64.jnilib
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.core/lib/libquaqua64.jnilib
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.core/lib/antlr-2.7.7.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.core/lib/antlr-2.7.7.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.core/lib/RserveEngine.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.core/lib/RserveEngine.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.core/lib/quaqua.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.core/lib/quaqua.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.core/lib/jline-0.9.94.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.core/lib/jline-0.9.94.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.core/lib/json-20090211.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.core/lib/json-20090211.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.core/log4j.properties
===================================================================
--- tmp/org.txm.core/log4j.properties	(revision 0)
+++ tmp/org.txm.core/log4j.properties	(revision 258)
@@ -0,0 +1 @@
+log4j.rootLogger=FATAL
\ No newline at end of file

Property changes on: tmp/org.txm.core/log4j.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/data.script
===================================================================
--- tmp/org.txm.core/data.script	(revision 0)
+++ tmp/org.txm.core/data.script	(revision 258)
@@ -0,0 +1,32 @@
+SET DATABASE UNIQUE NAME HSQLDB5080D3E890
+SET DATABASE GC 0
+SET DATABASE DEFAULT RESULT MEMORY ROWS 0
+SET DATABASE EVENT LOG LEVEL 0
+SET DATABASE SQL SIZE TRUE
+SET DATABASE SQL NAMES FALSE
+SET DATABASE TRANSACTION CONTROL LOCKS
+SET DATABASE DEFAULT ISOLATION LEVEL READ COMMITTED
+SET FILES WRITE DELAY 500 MILLIS
+SET FILES BACKUP INCREMENT TRUE
+SET FILES CACHE SIZE 10000
+SET FILES CACHE ROWS 50000
+SET FILES SCALE 8
+SET FILES LOB SCALE 32
+SET FILES DEFRAG 20
+SET FILES NIO TRUE
+SET FILES LOG TRUE
+SET FILES LOG SIZE 50
+SET DATABASE TEXT TABLE DEFAULTS ''
+CREATE USER SA PASSWORD ''
+CREATE SCHEMA PUBLIC AUTHORIZATION DBA
+SET SCHEMA PUBLIC
+ALTER SEQUENCE SYSTEM_LOBS.LOB_ID RESTART WITH 1
+SET DATABASE DEFAULT INITIAL SCHEMA PUBLIC
+GRANT USAGE ON DOMAIN INFORMATION_SCHEMA.YES_OR_NO TO PUBLIC
+GRANT USAGE ON DOMAIN INFORMATION_SCHEMA.TIME_STAMP TO PUBLIC
+GRANT USAGE ON DOMAIN INFORMATION_SCHEMA.CARDINAL_NUMBER TO PUBLIC
+GRANT USAGE ON DOMAIN INFORMATION_SCHEMA.CHARACTER_DATA TO PUBLIC
+GRANT USAGE ON DOMAIN INFORMATION_SCHEMA.SQL_IDENTIFIER TO PUBLIC
+GRANT DBA TO SA
+SET SCHEMA SYSTEM_LOBS
+INSERT INTO BLOCKS VALUES(0,2147483647,0)
Index: tmp/org.txm.core/.settings/org.eclipse.core.resources.prefs
===================================================================
--- tmp/org.txm.core/.settings/org.eclipse.core.resources.prefs	(revision 0)
+++ tmp/org.txm.core/.settings/org.eclipse.core.resources.prefs	(revision 258)
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/<project>=UTF-8

Property changes on: tmp/org.txm.core/.settings/org.eclipse.core.resources.prefs
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/.settings/org.eclipse.ltk.core.refactoring.prefs
===================================================================
--- tmp/org.txm.core/.settings/org.eclipse.ltk.core.refactoring.prefs	(revision 0)
+++ tmp/org.txm.core/.settings/org.eclipse.ltk.core.refactoring.prefs	(revision 258)
@@ -0,0 +1,3 @@
+#Wed Jan 12 14:19:56 CET 2011
+eclipse.preferences.version=1
+org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false

Property changes on: tmp/org.txm.core/.settings/org.eclipse.ltk.core.refactoring.prefs
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- tmp/org.txm.core/.settings/org.eclipse.jdt.core.prefs	(revision 0)
+++ tmp/org.txm.core/.settings/org.eclipse.jdt.core.prefs	(revision 258)
@@ -0,0 +1,8 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch,*.groovy
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6

Property changes on: tmp/org.txm.core/.settings/org.eclipse.jdt.core.prefs
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/.settings/org.eclipse.jdt.groovy.core.prefs
===================================================================
--- tmp/org.txm.core/.settings/org.eclipse.jdt.groovy.core.prefs	(revision 0)
+++ tmp/org.txm.core/.settings/org.eclipse.jdt.groovy.core.prefs	(revision 258)
@@ -0,0 +1,3 @@
+eclipse.preferences.version=1
+groovy.compiler.level=23
+groovy.script.filters=scripts/**/*.groovy,y,src/main/resources/**/*.groovy,y,src/test/resources/**/*.groovy,y

Property changes on: tmp/org.txm.core/.settings/org.eclipse.jdt.groovy.core.prefs
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/test/org/txm/StartToolbox.java
===================================================================
--- tmp/org.txm.core/test/org/txm/StartToolbox.java	(revision 0)
+++ tmp/org.txm.core/test/org/txm/StartToolbox.java	(revision 258)
@@ -0,0 +1,17 @@
+package org.txm;
+
+import java.io.File;
+
+import org.junit.Test;
+
+public class StartToolbox {
+
+	@Test
+	public void test() throws Exception {
+		String home = System.getProperty("user.home");
+		String product_configuration_path = "runtime-rcpapplication.product/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.txm.rcpapplication.prefs";
+		File properties = new File(home, product_configuration_path);
+		Toolbox.initialize(properties);
+	}
+
+}

Property changes on: tmp/org.txm.core/test/org/txm/StartToolbox.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/test/org/txm/annotation/temporary/AllTests.java
===================================================================
--- tmp/org.txm.core/test/org/txm/annotation/temporary/AllTests.java	(revision 0)
+++ tmp/org.txm.core/test/org/txm/annotation/temporary/AllTests.java	(revision 258)
@@ -0,0 +1,13 @@
+package org.txm.annotation.temporary;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+import org.txm.StartToolbox;
+
+@RunWith(Suite.class)
+@SuiteClasses({ StartToolbox.class, CreateAnnotation.class, DeleteAnnotation.class,
+		UpdateAnnotation.class })
+public class AllTests {
+
+}

Property changes on: tmp/org.txm.core/test/org/txm/annotation/temporary/AllTests.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/test/org/txm/annotation/temporary/DeleteAnnotation.java
===================================================================
--- tmp/org.txm.core/test/org/txm/annotation/temporary/DeleteAnnotation.java	(revision 0)
+++ tmp/org.txm.core/test/org/txm/annotation/temporary/DeleteAnnotation.java	(revision 258)
@@ -0,0 +1,14 @@
+package org.txm.annotation.temporary;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class DeleteAnnotation {
+
+	@Test
+	public void test() {
+		fail("Not yet implemented");
+	}
+
+}

Property changes on: tmp/org.txm.core/test/org/txm/annotation/temporary/DeleteAnnotation.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/test/org/txm/annotation/temporary/UpdateAnnotation.java
===================================================================
--- tmp/org.txm.core/test/org/txm/annotation/temporary/UpdateAnnotation.java	(revision 0)
+++ tmp/org.txm.core/test/org/txm/annotation/temporary/UpdateAnnotation.java	(revision 258)
@@ -0,0 +1,14 @@
+package org.txm.annotation.temporary;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class UpdateAnnotation {
+
+	@Test
+	public void test() {
+		fail("Not yet implemented");
+	}
+
+}

Property changes on: tmp/org.txm.core/test/org/txm/annotation/temporary/UpdateAnnotation.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/test/org/txm/annotation/temporary/CreateAnnotation.java
===================================================================
--- tmp/org.txm.core/test/org/txm/annotation/temporary/CreateAnnotation.java	(revision 0)
+++ tmp/org.txm.core/test/org/txm/annotation/temporary/CreateAnnotation.java	(revision 258)
@@ -0,0 +1,30 @@
+package org.txm.annotation.temporary;
+
+import static org.junit.Assert.*;
+
+import java.util.HashMap;
+
+import org.junit.Test;
+import org.txm.Toolbox;
+import org.txm.annotation.storage.temporary.TemporaryAnnotationManager;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.clientExceptions.InvalidCqpIdException;
+import org.txm.searchengine.cqp.corpus.CorpusManager;
+import org.txm.searchengine.cqp.corpus.MainCorpus;
+
+public class CreateAnnotation {
+
+	@Test
+	public void test() throws CqiClientException, InvalidCqpIdException {
+		if (!Toolbox.isInitialized()) fail("Toolbox not initialized.");
+		MainCorpus corpus = CorpusManager.getCorpusManager().getCorpus("VOEUX");
+		if (corpus == null) fail("Corpus Voeux not loaded.");
+		
+		HashMap<String, Object> properties = TemporaryAnnotationManager.getInitialisationProperties(corpus);
+		properties.put("eclipselink.persistencexml", System.getProperty("user.home")+"/workspace442/org.txm.toolbox/META-INF/persistence.xml");
+		
+		TemporaryAnnotationManager tam = new TemporaryAnnotationManager(corpus, properties);
+		System.out.println(tam);
+	}
+
+}

Property changes on: tmp/org.txm.core/test/org/txm/annotation/temporary/CreateAnnotation.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/default.xml
===================================================================
--- tmp/org.txm.core/default.xml	(revision 0)
+++ tmp/org.txm.core/default.xml	(revision 258)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<workspace name="default">
+   <projects>
+      <project name="default">
+         <bases>
+         </bases>
+
+         <corpora>
+         </corpora>
+      </project>
+   </projects>
+</workspace>
\ No newline at end of file

Property changes on: tmp/org.txm.core/default.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/.project
===================================================================
--- tmp/org.txm.core/.project	(revision 0)
+++ tmp/org.txm.core/.project	(revision 258)
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.txm.core</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.ManifestBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.SchemaBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>net.sourceforge.metrics.builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>com.stateofflow.eclipse.metrics.MetricsBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.groovy.core.groovyNature</nature>
+		<nature>org.eclipse.pde.PluginNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>net.sourceforge.metrics.nature</nature>
+		<nature>com.stateofflow.eclipse.metrics.MetricsNature</nature>
+	</natures>
+</projectDescription>

Property changes on: tmp/org.txm.core/.project
___________________________________________________________________
Added: svn:mime-type
   + text/plain

